diff -r de56132c008d -r bdac73ed481e install/includes/ui.php --- a/install/includes/ui.php Sun Mar 28 21:49:26 2010 -0400 +++ b/install/includes/ui.php Sun Mar 28 23:10:46 2010 -0400 @@ -22,227 +22,227 @@ class Enano_Installer_UI { - /** - * The list of installer stages. - * @var array - */ - - var $stages = array(); - - /** - * The GUID of the active stage - * @var string - */ - - var $current_stage = ''; - - /** - * The application name, or the name displayed after the stage name in the title bar. Should be localized. - * @var string - */ - - var $app_name = ''; - - /** - * If the header should be simplified (stripped of the Enano logo and top heading), this will be true. - * @var bool - */ - - var $simple = false; - - /** - * Text inserted into the header on the right. - * @var string - */ - - var $step = ''; - - /** - * Extra text to add to the HTML section - * @var array Will be implode()'ed - */ - - var $additional_headers = array(); - - /** - * Constructor. - * @param string The name displayed in the tag - * @param bool If true, the simplified header format is displayed. - */ - - function __construct($app_name, $simple_header) - { - $this->stages = array( - 'main' => array(), - 'hide' => array() - ); - $this->app_name = $app_name; - $this->simple = ( $simple_header ) ? true : false; - } - - /** - * Adds more text to the HTML header. - * @param string - */ - - function add_header($html) - { - $this->additional_headers[] = $html; - } - - /** - * Adds a stage to the installer. - * @param string Title of the stage, should be already put through $lang->get() - * @param bool If true, the stage is shown among possible stages at the top of the window. If false, acts as a hidden stage - * @return string Unique identifier for stage, used later on set_visible_stage() - */ - - function add_stage($stage, $visible = true) - { - $key = ( $visible ) ? 'main' : 'hide'; - $guid = md5(microtime() . mt_rand()); - $this->stages[$key][$guid] = $stage; - if ( empty($this->current_stage) ) - $this->current_stage = $guid; - return $guid; - } - - /** - * Resets the active stage of installation. This is for the UI only; it doesn't actually change how the backend works. - * @param string GUID of stage, returned from add_stage() - * @return bool true on success, false if stage GUID not found - */ - - function set_visible_stage($guid) - { - foreach ( $this->stages['main'] as $key => $stage_name ) - { - if ( $key == $guid ) - { - $this->current_stage = $guid; - return true; - } - } - foreach ( $this->stages['hide'] as $key => $stage_name ) - { - if ( $key == $guid ) - { - $this->current_stage = $guid; - return true; - } - } - return false; - } - - /** - * Outputs the HTML headers and start of the <body>, including stage indicator - */ - - function show_header() - { - // Determine the name of the current stage - $stage_name = false; - - if ( isset($this->stages['main'][$this->current_stage]) ) - $stage_name = $this->stages['main'][$this->current_stage]; - else if ( isset($this->stages['hide'][$this->current_stage]) ) - $stage_name = $this->stages['hide'][$this->current_stage]; - else - // Can't determine name of stage - return false; - - $this->app_name = htmlspecialchars($this->app_name); - $stage_name = htmlspecialchars($stage_name); - - global $lang; - if ( is_object($lang) && isset($GLOBALS['lang_uri']) ) - { - $lang_uri = sprintf($GLOBALS['lang_uri'], $lang->lang_code); - $this->add_header('<script type="text/javascript" src="' . $lang_uri . '"></script>'); - } - - $additional_headers = implode("\n ", $this->additional_headers); - $title = addslashes(str_replace(' ', '_', $stage_name)); - $js_dynamic = '<script type="text/javascript"> - var title="' . $title . '"; - var scriptPath="'.scriptPath.'"; - var cdnPath="'.scriptPath.'"; - var ENANO_SID=""; - var AES_BITS='.AES_BITS.'; - var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; - var pagepass=\'\'; - var ENANO_LANG_ID = 1; - var DISABLE_MCE = true; + /** + * The list of installer stages. + * @var array + */ + + var $stages = array(); + + /** + * The GUID of the active stage + * @var string + */ + + var $current_stage = ''; + + /** + * The application name, or the name displayed after the stage name in the title bar. Should be localized. + * @var string + */ + + var $app_name = ''; + + /** + * If the header should be simplified (stripped of the Enano logo and top heading), this will be true. + * @var bool + */ + + var $simple = false; + + /** + * Text inserted into the header on the right. + * @var string + */ + + var $step = ''; + + /** + * Extra text to add to the HTML <head> section + * @var array Will be implode()'ed + */ + + var $additional_headers = array(); + + /** + * Constructor. + * @param string The name displayed in the <title> tag + * @param bool If true, the simplified header format is displayed. + */ + + function __construct($app_name, $simple_header) + { + $this->stages = array( + 'main' => array(), + 'hide' => array() + ); + $this->app_name = $app_name; + $this->simple = ( $simple_header ) ? true : false; + } + + /** + * Adds more text to the HTML header. + * @param string + */ + + function add_header($html) + { + $this->additional_headers[] = $html; + } + + /** + * Adds a stage to the installer. + * @param string Title of the stage, should be already put through $lang->get() + * @param bool If true, the stage is shown among possible stages at the top of the window. If false, acts as a hidden stage + * @return string Unique identifier for stage, used later on set_visible_stage() + */ + + function add_stage($stage, $visible = true) + { + $key = ( $visible ) ? 'main' : 'hide'; + $guid = md5(microtime() . mt_rand()); + $this->stages[$key][$guid] = $stage; + if ( empty($this->current_stage) ) + $this->current_stage = $guid; + return $guid; + } + + /** + * Resets the active stage of installation. This is for the UI only; it doesn't actually change how the backend works. + * @param string GUID of stage, returned from add_stage() + * @return bool true on success, false if stage GUID not found + */ + + function set_visible_stage($guid) + { + foreach ( $this->stages['main'] as $key => $stage_name ) + { + if ( $key == $guid ) + { + $this->current_stage = $guid; + return true; + } + } + foreach ( $this->stages['hide'] as $key => $stage_name ) + { + if ( $key == $guid ) + { + $this->current_stage = $guid; + return true; + } + } + return false; + } + + /** + * Outputs the HTML headers and start of the <body>, including stage indicator + */ + + function show_header() + { + // Determine the name of the current stage + $stage_name = false; + + if ( isset($this->stages['main'][$this->current_stage]) ) + $stage_name = $this->stages['main'][$this->current_stage]; + else if ( isset($this->stages['hide'][$this->current_stage]) ) + $stage_name = $this->stages['hide'][$this->current_stage]; + else + // Can't determine name of stage + return false; + + $this->app_name = htmlspecialchars($this->app_name); + $stage_name = htmlspecialchars($stage_name); + + global $lang; + if ( is_object($lang) && isset($GLOBALS['lang_uri']) ) + { + $lang_uri = sprintf($GLOBALS['lang_uri'], $lang->lang_code); + $this->add_header('<script type="text/javascript" src="' . $lang_uri . '"></script>'); + } + + $additional_headers = implode("\n ", $this->additional_headers); + $title = addslashes(str_replace(' ', '_', $stage_name)); + $js_dynamic = '<script type="text/javascript"> + var title="' . $title . '"; + var scriptPath="'.scriptPath.'"; + var cdnPath="'.scriptPath.'"; + var ENANO_SID=""; + var AES_BITS='.AES_BITS.'; + var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; + var pagepass=\'\'; + var ENANO_LANG_ID = 1; + var DISABLE_MCE = true; var enano_version = \'' . installer_enano_version() . '\'; - var msg_loading_component = \'Loading %component%...\'; - </script>'; - - echo <<<EOF + var msg_loading_component = \'Loading %component%...\'; + </script>'; + + echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>{$stage_name} • {$this->app_name} - - - - $js_dynamic - - $additional_headers - - -
+ + {$stage_name} • {$this->app_name} + + + + $js_dynamic + + $additional_headers + + +
EOF; - if ( !$this->simple ) - { - $step = ( !empty($this->step) ) ? '
' . htmlspecialchars($this->step) . '
' : ''; - echo << - $step - Enano logo -
+ if ( !$this->simple ) + { + $step = ( !empty($this->step) ) ? '
' . htmlspecialchars($this->step) . '
' : ''; + echo << + $step + Enano logo +
EOF; - } - $stages_class = ( $this->simple ) ? 'stages' : 'stages stages-fixed'; - echo << - \n
\n \n"; + echo "
\n "; + echo "
\n "; + } + + /** + * Displays the page footer. + */ + + function show_footer() + { + $scriptpath = scriptPath; + $year = date('Y'); + echo << + Enano and its various components, related documentation, and artwork are copyright © 2006-$year Dan Fuhry.
+ Copyrights for third-party components are held by their respective authors.
+ This program is Free Software; see the file "GPL" included with this package for details. +
+
+ + + EOF; - } - + } + } ?>