From 143c7a822202ae2c1a5b31dcbdb2e072763a4a24 Mon Sep 17 00:00:00 2001 From: stekkel Date: Tue, 15 Oct 2002 23:20:51 +0000 Subject: [PATCH] fix for infinite loop when help files have trailing empty lines. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3873 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/help.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/help.php b/src/help.php index 99671fbe..2da48edf 100644 --- a/src/help.php +++ b/src/help.php @@ -41,7 +41,7 @@ $helpdir[8] = 'FAQ.hlp'; */ function get_info($doc, $pos) { - + $ary = array(0,0,0); for ($n=$pos; $n < count($doc); $n++) { if (trim(strtolower($doc[$n])) == '' || trim(strtolower($doc[$n])) == '
') { @@ -77,12 +77,17 @@ function get_info($doc, $pos) { $ary[2] = $ary[0]; } return( $ary ); - } + } else if (!trim(strtolower($doc[$n]))) { + $ary[0] = ''; + $ary[1] = ''; + $ary[2] = ''; + $ary[3] = $n; + } } - $ary[0] = _("ERROR: Help files are not in the right format!"); $ary[1] = $ary[0]; - + $ary[2] = $ary[0]; + $ary[3] = $n; return( $ary ); } @@ -220,7 +225,7 @@ if ($help_exists == true) { $help_info = get_info($doc, $n); echo "$chapter.$section - $help_info[0]" . html_tag( 'ul', $help_info[1] ); - $n = $help_info[3]; + $n = $help_info[3]; } echo '
' . _("Top") . '
'; -- 2.25.1