00001 <?php 00002 00015 // $Id: InstallHandler.inc.php,v 1.13 2008/07/01 01:16:12 asmecher Exp $ 00016 00017 00018 /* FIXME Prevent classes from trying to initialize the session manager (and thus the database connection) */ 00019 define('SESSION_DISABLE_INIT', 1); 00020 00021 import('install.form.InstallForm'); 00022 import('install.form.UpgradeForm'); 00023 00024 class InstallHandler extends Handler { 00025 00030 function index() { 00031 // Make sure errors are displayed to the browser during install. 00032 @ini_set('display_errors', E_ALL); 00033 00034 InstallHandler::validate(); 00035 00036 if (($setLocale = Request::getUserVar('setLocale')) != null && Locale::isLocaleValid($setLocale)) { 00037 Request::setCookieVar('currentLocale', $setLocale); 00038 } 00039 00040 $installForm = &new InstallForm(); 00041 $installForm->initData(); 00042 $installForm->display(); 00043 } 00044 00048 function validate() { 00049 if (Config::getVar('general', 'installed')) { 00050 Request::redirect(null, 'index'); 00051 } 00052 } 00053 00057 function install() { 00058 InstallHandler::validate(); 00059 00060 $installForm = &new InstallForm(); 00061 $installForm->readInputData(); 00062 00063 if ($installForm->validate()) { 00064 $installForm->execute(); 00065 00066 } else { 00067 $installForm->display(); 00068 } 00069 } 00070 00074 function upgrade() { 00075 InstallHandler::validate(); 00076 00077 if (($setLocale = Request::getUserVar('setLocale')) != null && Locale::isLocaleValid($setLocale)) { 00078 Request::setCookieVar('currentLocale', $setLocale); 00079 } 00080 00081 $installForm = &new UpgradeForm(); 00082 $installForm->initData(); 00083 $installForm->display(); 00084 } 00085 00089 function installUpgrade() { 00090 InstallHandler::validate(); 00091 00092 $installForm = &new UpgradeForm(); 00093 $installForm->readInputData(); 00094 00095 if ($installForm->validate()) { 00096 $installForm->execute(); 00097 00098 } else { 00099 $installForm->display(); 00100 } 00101 } 00102 00103 } 00104 00105 ?>
1.5.6