예제 #1
0
 function getHTML($smarty)
 {
     $smarty->assign_by_ref('field', $this);
     $output = $smarty->fetch(Installer::getTemplatePath("field_{$this->type}.tpl"));
     $smarty->clear_assign('field');
     return $output;
 }
예제 #2
0
 function getHTML($smarty)
 {
     $file_contents = 'Could not read file ' . $this->file_name;
     if (is_readable($this->file_name)) {
         $file_contents = file($this->file_name);
         $file_contents = join('', $file_contents);
     }
     $smarty->assign('FILE_CONTENTS', $file_contents);
     return $smarty->fetch(Installer::getTemplatePath('action_accept_text.tpl'));
 }
예제 #3
0
 function run()
 {
     $output = '';
     $field_form = '';
     $versions =& $this->config->getSetting('VERSION_SET');
     $smarty =& $GLOBALS['INSTALLER']['SMARTY'];
     if ($this->phase == 0) {
         $vc =& $this->config->getSetting('VERSION_CHECK');
         $this->old_version = $vc->getCurrentVersion();
         $this->special_actions = $vc->getSpecialActions($this->old_version);
         $smarty->assign('INSTALLED', $this->old_version !== FALSE);
         $smarty->assign('OLD_VERSION', $this->old_version);
         $smarty->assign('VERSION', $versions->getNewestVersion());
         $smarty->assign('LONG_VERSION', $versions->getNewestLongVersion());
         $output .= $smarty->fetch(Installer::getTemplatePath('version_check.tpl'));
         $smarty->assign('CAN_CONTINUE', true);
     } elseif ($this->phase == 1) {
         $fields = $versions->getFieldsForUpgrade($this->old_version);
         $field_count = count($fields);
         if ($field_count == 0) {
             $this->phase++;
             return $this->run();
         }
         if (isset($_REQUEST['save_data'])) {
             // Save the data
             for ($i = 0; $i < $field_count; $i++) {
                 $field =& $fields[$i];
                 $field->saveField();
             }
             $this->phase++;
             return $this->run();
         } else {
             // Draw the form fields
             $field_form .= "<INPUT TYPE='hidden' name='save_data' value='true'>\n";
             for ($i = 0; $i < $field_count; $i++) {
                 $field =& $fields[$i];
                 $field_form .= $field->getHTML($smarty);
             }
             $smarty->assign('FORM_FIELDS', $field_form);
             $output .= $smarty->fetch(Installer::getTemplatePath('collect_data.tpl'));
         }
     } elseif ($this->phase == 2) {
         $tests =& $versions->getTestsForUpgrade($this->old_version);
         $test_count = count($tests);
         for ($i = 0; $i < $test_count; $i++) {
             $test =& $tests[$i];
             $test->perform();
             $smarty->assign_by_ref('test', $test);
             $output .= $smarty->fetch(Installer::getTemplatePath('test_result.tpl'));
             $smarty->clear_assign('test');
         }
         if ($versions->testsComplete($this->old_version)) {
             $smarty->assign('CAN_CONTINUE', true);
         } else {
             $smarty->assign('CAN_CONTINUE', false);
         }
     } elseif ($this->phase == 3) {
         if (is_a($this->special_actions, 'ActionSet')) {
             // Handle saving of data
             if (isset($_REQUEST['save_action'])) {
                 $actions =& $this->special_actions;
                 $action_count = count($actions);
                 for ($i = 0; $i < $action_count; $i++) {
                     $action =& $actions[$i];
                     if ($action->isInteractive()) {
                         $action->dataSubmitted();
                         $action->perform();
                         $smarty->assign_by_ref('ACTION', $action);
                         $action_html .= $smarty->fetch(Installer::getTemplatePath('action_complete.tpl'));
                         $smarty->clear_assign('ACTION');
                     }
                 }
             }
             // See whats next
             $actions =& $this->special_actions;
             $action_count = count($actions);
             for ($i = 0; $i < $action_count; $i++) {
                 $action =& $actions[$i];
                 if (!$action->success()) {
                     if ($action->isInteractive()) {
                         $action_html .= $action->getHTML($smarty);
                     } else {
                         $action->perform();
                         $smarty->assign_by_ref('ACTION', $action);
                         $action_html .= $smarty->fetch(Installer::getTemplatePath('action_complete.tpl'));
                         $smarty->clear_assign('ACTION');
                     }
                 }
             }
             $smarty->assign('ACTION_HTML', $action_html);
             $output .= $smarty->fetch(Installer::getTemplatePath('actions.tpl'));
             $smarty->clear_assign('ACTION_HTML');
             if ($versions->actionsComplete($this->old_version)) {
                 $smarty->assign('CAN_CONTINUE', true);
             } else {
                 $smarty->assign('CAN_CONTINUE', false);
             }
         } else {
             $this->phase++;
             $output .= $this->run();
         }
     } elseif ($this->phase == 4) {
         $action_html = '';
         // Handle saving of data
         if (isset($_REQUEST['save_action'])) {
             $actions =& $versions->getNextActionsForUpgrade($this->old_version);
             $action_count = count($actions);
             for ($i = 0; $i < $action_count; $i++) {
                 $action =& $actions[$i];
                 if ($action->isInteractive()) {
                     $action->dataSubmitted();
                     $action->perform();
                     $smarty->assign_by_ref('ACTION', $action);
                     $action_html .= $smarty->fetch(Installer::getTemplatePath('action_complete.tpl'));
                     $smarty->clear_assign('ACTION');
                 }
             }
         }
         // See whats next
         $actions = $versions->getNextActionsForUpgrade($this->old_version);
         $action_count = count($actions);
         for ($i = 0; $i < $action_count; $i++) {
             $action =& $actions[$i];
             if (!$action->success()) {
                 if ($action->isInteractive()) {
                     $action_html .= $action->getHTML($smarty);
                 } else {
                     $action->perform();
                     $smarty->assign_by_ref('ACTION', $action);
                     $action_html .= $smarty->fetch(Installer::getTemplatePath('action_complete.tpl'));
                     $smarty->clear_assign('ACTION');
                 }
             }
         }
         if ($action_count == 0) {
             $this->phase++;
             return $this->run();
         }
         $this->action_title = $action->getTitle();
         $smarty->assign('ACTION_HTML', $action_html);
         $output .= $smarty->fetch(Installer::getTemplatePath('actions.tpl'));
         $smarty->clear_assign('ACTION_HTML');
         if ($versions->actionsComplete($this->old_version)) {
             $smarty->assign('CAN_CONTINUE', true);
         } else {
             $smarty->assign('CAN_CONTINUE', false);
         }
     } elseif ($this->phase == 5) {
         $finalAction = $versions->getFinalAction($this->old_version);
         if ($finalAction) {
             $finalAction->perform();
             $smarty->assign_by_ref('ACTION', $finalAction);
             $output .= $smarty->fetch(Installer::getTemplatePath('action_complete.tpl'));
             $smarty->clear_assign('ACTION');
         }
         $output .= $smarty->fetch(Installer::getTemplatePath('finished.tpl'));
         $url = str_replace('installer', '', dirname($_SERVER['SCRIPT_NAME']));
         $smarty->assign('APP_URL', $url);
         $smarty->assign('FINISHED', true);
     }
     return $output;
 }
예제 #4
0
<?php

require_once realpath(dirname(__FILE__)) . '/Installer.php';
$smarty = new InstallerSmarty();
$GLOBALS['INSTALLER']['SMARTY'] =& $smarty;
$output = '';
if (!isset($run_output)) {
    $run_output = '';
}
$run_output .= $GLOBALS['INSTALLER']['ENGINE']->run();
$smarty->assign('INSTALLER_PHASE', $GLOBALS['INSTALLER']['ENGINE']->getPhaseName());
$output .= $smarty->fetch(Installer::getTemplatePath('header.tpl'));
$output .= $run_output;
$output .= $smarty->fetch(Installer::getTemplatePath('footer.tpl'));
print $output;
예제 #5
0
 function getHTML($smarty)
 {
     $smarty->assign("loop", $this->loop);
     $smarty->assign_by_ref('ACTION', $this);
     if ($this->loop < 2) {
         $es =& $GLOBALS['INSTALLER']['SMARTY'];
         $es->assign('HEADER_EXTRAS', '<META HTTP-EQUIV=Refresh CONTENT="2; URL=install.php?save_action=true">');
     }
     return $smarty->fetch(Installer::getTemplatePath('action_sql_file.tpl'));
 }
예제 #6
0
 function getHTML($smarty)
 {
     if ($this->prepareParameters() === FALSE) {
         $this->result = INSTALLER_ACTION_FAIL;
         return $this->result;
     }
     $smarty->assign("files", $this->file_list);
     $smarty->assign("loop", $this->loop);
     $smarty->assign_by_ref('ACTION', $this);
     if ($this->loop == 3) {
         $es =& $GLOBALS['INSTALLER']['SMARTY'];
         $es->assign('HEADER_EXTRAS', '<META HTTP-EQUIV=Refresh CONTENT="2; URL=install.php?save_action=true">');
     }
     return $smarty->fetch(Installer::getTemplatePath('action_sql_options.tpl'));
 }