X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fhelp.php;h=4d6586072a5fe32efcd5040aaaeaaef9bf60538f;hp=f9d07b51aa3c28bd06a0197eccc18c5ebc200461;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=386c7b5475f02b7d08f19521dabe7c2ac9216355 diff --git a/src/help.php b/src/help.php index f9d07b51..4d658607 100644 --- a/src/help.php +++ b/src/help.php @@ -5,18 +5,21 @@ * * Displays help for the user * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright 1999-2020 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ +/** This is the help page */ +define('PAGE_NAME', 'help'); + /** * Include the SquirrelMail initialization file. */ require('../include/init.php'); -displayPageHeader($color, 'None' ); +displayPageHeader($color); $helpdir[0] = 'basic.hlp'; $helpdir[1] = 'main_folder.hlp'; @@ -92,17 +95,7 @@ function get_info($doc, $pos) { /**************[ END HELP FUNCTIONS ]******************/ -echo html_tag( 'table', - html_tag( 'tr', - html_tag( 'td','
' . _("Help") .'
', 'center', $color[0] ) - ) , - 'center', '', 'width="95%" cellpadding="1" cellspacing="2" border="0"' ); - -do_hook('help_top'); - -echo html_tag( 'table', '', 'center', '', 'width="90%" cellpadding="0" cellspacing="10" border="0"' ) . - html_tag( 'tr' ) . - html_tag( 'td' ); +do_hook('help_top', $null); if (!isset($squirrelmail_language)) { $squirrelmail_language = 'en_US'; @@ -111,11 +104,14 @@ if (!isset($squirrelmail_language)) { if (file_exists("../help/$squirrelmail_language")) { $user_language = $squirrelmail_language; } else if (file_exists('../help/en_US')) { - error_box(_("Help is not available in the selected language. It will be displayed in English instead."), $color); + error_box(_("Help is not available in the selected language. It will be displayed in English instead.")); echo '
'; $user_language = 'en_US'; } else { - error_box( _("Help is not available. Please contact your system administrator for assistance."), $color ); + error_box( _("Help is not available. Please contact your system administrator for assistance.")); + echo ''; + // Display footer (closes HTML tags) and stop script execution. + $oTemplate->display('footer.tpl'); exit; } @@ -166,24 +162,21 @@ if ( $chapter == 0 || !isset( $helpdir[$chapter-1] ) ) { } } - // Write the TOC header - echo html_tag( 'table', '', 'center', '', 'cellpadding="0" cellspacing="0" border="0"' ) . - html_tag( 'tr' ) . - html_tag( 'td' ) . - '
' . _("Table of Contents") . '

'; - echo html_tag( 'ol' ); - - // Write the TOC chapters. - for ($i=0, $cnt = count($toc); $i < $cnt; $i++) { - echo '
  • ' . - $toc[$i][1] . '' . html_tag( 'ul', $toc[$i][2] ); - } - // Provide hook for external help scripts. - do_hook('help_chapter'); - - // Write the TOC footer. - echo ''; + do_hook('help_chapter', $null); + + $new_toc = array(); + foreach ($toc as $ch) { + $a = array(); + $a['Chapter'] = $ch[0]; + $a['Title'] = $ch[1]; + $a['Summary'] = trim($ch[2]); + $new_toc[] = $a; + } + + $oTemplate->assign('toc', $new_toc); + + $oTemplate->display('help_toc.tpl'); } else { // Initialise the needed variables. $display_chapter = TRUE; @@ -195,68 +188,55 @@ if ( $chapter == 0 || !isset( $helpdir[$chapter-1] ) ) { } elseif (file_exists("../help/en_US/" . $helpdir[$chapter-1])) { // If the selected language can't be found, try English. $doc = file("../help/en_US/" . $helpdir[$chapter-1]); - error_box(_("This chapter in not available in the selected language. It will be displayed in English instead."), $color); + error_box(_("This chapter is not available in the selected language. It will be displayed in English instead.")); echo '
    '; } else { // If English can't be found, the chapter went MIA. $display_chapter = FALSE; } - // Write the chpater header. - echo '
    '; - if ($chapter <= 1){ - echo '' . _("Previous") - . ' | '; - } else { - echo '' . _("Previous") . ' | '; - } - echo '' . _("Table of Contents") . ''; - if ($chapter >= count($helpdir)){ - echo ' | ' . _("Next") . ''; - } else { - echo ' | ' . _("Next") . ''; - } - echo '

    '; - // Write the chapter. if ($display_chapter) { // If there is a valid chapter, display it. $help_info = get_info($doc, 0); - echo '' . $chapter . ' - ' . $help_info[0] - . '

    '; - - if (isset($help_info[1]) && $help_info[1]) { - echo $help_info[1]; - } else { - echo html_tag( 'p', $help_info[2], 'left' ); - } - + $ch = array(); + $ch['Chapter'] = $chapter; + $ch['Title'] = $help_info[0]; + $ch['Summary'] = isset($help_info[1]) && $help_info[1] ? trim($help_info[1]) : $help_info[2]; + $ch['Sections'] = array(); $section = 0; for ($n = $help_info[3], $cnt = count($doc); $n < $cnt; $n++) { $section++; $help_info = get_info($doc, $n); - echo "$chapter.$section - $help_info[0]" . - html_tag( 'ul', $help_info[1] ); $n = $help_info[3]; - } - echo '
    ' . _("Top") . '
    '; + $a = array(); + $a['SectionNumber'] = $section; + $a['SectionTitle'] = $help_info[0]; + $a['SectionText'] = isset($help_info[1]) ? trim($help_info[1]) : '';; + + $ch['Sections'][] = $a; + } + + $oTemplate->assign('chapter_number', $chapter); + $oTemplate->assign('chapter_count', count($helpdir)); + $oTemplate->assign('chapter_title', $ch['Title']); + $oTemplate->assign('chapter_summary', $ch['Summary']); + $oTemplate->assign('sections', $ch['Sections']); + $oTemplate->assign('error_msg', NULL); } else { - // If the help file went MIA, display an error message. - error_box(sprintf(_("For some reason, chapter %s is not available."), $chapter), $color); + // If the help file went MIA, trigger an error message. + $oTemplate->assign('chapter_number', $chapter); + $oTemplate->assign('chapter_count', count($helpdir)); + $oTemplate->assign('chapter_title', ''); + $oTemplate->assign('chapter_summary', ''); + $oTemplate->assign('sections', array()); + $oTemplate->assign('error_msg', sprintf(_("For some reason, chapter %s is not available."), $chapter)); } + + $oTemplate->display('help_chapter.tpl'); } -do_hook('help_bottom'); +do_hook('help_bottom', $null); -echo html_tag( 'tr', - html_tag( 'td', ' ', 'left', $color[0] ) - ); - -?> - -display('footer.tpl'); -?> \ No newline at end of file