ipsclass =& $ipsclass; //----------------------------------------- // Grab XML file and check //----------------------------------------- if ( file_exists( INS_ROOT_PATH . 'installfiles/sequence.xml' ) ) { $config = implode( '', file( INS_ROOT_PATH . 'installfiles/sequence.xml' ) ); $xml = new class_xml(); $config = $xml->xml_parse_document( $config ); //----------------------------------------- // Loop through and sort out settings... //----------------------------------------- foreach( $xml->xml_array['installdata']['action'] as $id => $entry ) { $_pages[ $entry['position']['VALUE'] ] = array( 'file' => $entry['file']['VALUE'], 'menu' => $entry['menu']['VALUE'] ); } ksort( $_pages ); foreach( $_pages as $position => $data ) { $this->install_pages[ $data['file'] ] = $data['menu']; } } $this->install_pages['done'] = 'Finish'; /* Set Current Page */ $this->page_current = ( $this->ipsclass->input['p'] ) ? $this->ipsclass->input['p'] : 'requirements'; if( ! $this->install_pages[$this->page_current] ) { $this->page_current = 'requirements'; } } /** * install_template::set_title * * Sets the title for the current page * * @var string $title */ function set_title( $title ) { $this->page_title = $title; } /** * install_template::append * * Adds to the main body output * * @var string $add */ function append( $add ) { $this->page_content .= $add; } /** * install_template::output * * Builds page and sends to browser * */ function output() { /* Build Side Bar */ $curr_reached = 0; $this->progress = array(); foreach( $this->install_pages as $key => $page ) { if( $key == $this->page_current ) { $this->progress[] = array( 'step_doing', $page ); $curr_reached = 1; } else if( $curr_reached ) { $this->progress[] = array( 'step_notdone', $page ); } else { $this->progress[] = array( 'step_done', $page ); } } $this->page_template(); } /*************************************************************** * * HTML TEMPLATE FUNCTIONS * **************************************************************/ // ------------------------------------------------------------ // Main Template // ------------------------------------------------------------ function page_template() { $this->saved_data = urlencode($this->saved_data); echo << IPS Installer

 

 

 

Welcome to the IPS Product Installer

{$this->install_pages[$this->page_current]}

    EOF; foreach( $this->progress as $p ) { echo "
  • {$p[1]}
  • "; } echo <<

{$this->product_name} Installation

{$this->product_version}
{$this->page_content}

EOF; if( ! $this->hide_next ) { if( $this->next_action == 'disabled' ) { echo << EOF; } else { if( !$this->next_action ) { $back = $this->ipsclass->my_getenv('HTTP_REFERER'); echo << EOF; } echo << EOF; } } $date = date("Y"); echo <<
EOF; } // ------------------------------------------------------------ // Requirements Page Template // ------------------------------------------------------------ function requirements_page( $php_version, $sql_version ) { return <<
Welcome to the installer for {$this->product_name}. This wizard will guide you through the installation process.


System Requirements


PHP: v{$php_version} or better
SQL: mySQL v$sql_version or better

EOF; } // ------------------------------------------------------------ // EULA Page Template // ------------------------------------------------------------ function eula_page( $eula ) { return << check_eula = function() { if( document.getElementById( 'eula' ).checked == true ) { return true; } else { alert( 'You must agree to the license before continuing' ); return false; } } document.getElementById( 'install-form' ).onsubmit = check_eula; Please read and agree to the End User License Agreement before continuing.

$eula
I agree to the license agreement EOF; } // ------------------------------------------------------------ // Address Page Template // ------------------------------------------------------------ function address_page( $dir, $url ) { return <<
  Address details
Install Directory:
Install Address:
EOF; } // ------------------------------------------------------------ // DB Check Page Template // ------------------------------------------------------------ function db_check_page( $drivers=array() ) { //----------------------------------------- // INIT //----------------------------------------- $_drivers = ''; foreach ($drivers as $k => $v) { $selected = ($v == "mysql") ? " selected='selected'" : ""; $_drivers .= "\n"; } return <<
Please select which database engine you wish to use.
  Database Engine
SQL Driver:
EOF; } // ------------------------------------------------------------ // DB Page Template // ------------------------------------------------------------ function db_page() { $prefix = $_REQUEST['db_pre'] ? $_REQUEST['db_pre'] : INS_DEFAULT_SQL_PREFIX; return <<
Ask your webhost if you are unsure about any of these settings. You must create the database before installing..
  Database details
SQL Host:
Database Name:
SQL Username:
SQL Password:
SQL Table Prefix:
EOF; } // ------------------------------------------------------------ // Admin Page Template // ------------------------------------------------------------ function admin_page() { return <<   Your administrative account
Username:
Password:
Confirm Password:
E-mail Address:
EOF; } // ------------------------------------------------------------ // Install Page SPlash Template // ------------------------------------------------------------ function install_page() { return <<product_name}. Click Start to begin the automatic process!

EOF; } // ------------------------------------------------------------ // Install Page Refresh Template // ------------------------------------------------------------ function install_page_refresh( $output=array() ) { $HTML = << //
    EOF; foreach( $output as $l ) { $HTML .= << $l EOF; } $HTML .= <<
    EOF; return $HTML; } // ------------------------------------------------------------ // Install Progress Screen // ------------------------------------------------------------ function install_progress( $line ) { $HTML = << EOF; foreach( $line as $l ) { $HTML .= << $l EOF; } $HTML .= << EOF; return $HTML; } // ------------------------------------------------------------ // Install Done Screen // ------------------------------------------------------------ function install_done( $url, $install_locked ) { $extra = ''; if ( ! $install_locked ) { $extra = "

    INSTALLER NOT LOCKED
    Please disable or remove 'install/index.php' immediately!

    "; } $HTML .= <<   Installation complete!

    Congratulations, your {$this->product_name} is now installed and ready to use! Below are some links you may find useful.


    $extra

    Useful Links

    EOF; return $HTML; } // ------------------------------------------------------------ // Warning Message Template // ------------------------------------------------------------ function warning( $messages ) { $HTML = <<
    EOF; foreach( $messages as $msg ) { $HTML .= "

    $msg

    "; } $HTML .= <<
    EOF; $this->append( $HTML ); } } ?>