0byt3m1n1
Path:
/
data
/
applications
/
aps.bak
/
phprojekt
/
6.0.6-0
/
standard
/
scripts
/
[
Home
]
File: phprojekt_upgrade.php
<?php function phprojekt_upgrade_50($root_dir) { /* Definition and include section */ define('avoid_auth','1'); define('PATH_PRE','./'); if (session_id() == "") { session_start(); } chdir($root_dir); set_include_path(get_include_path().PATH_SEPARATOR.$root_dir); $_SESSION['step'] = 'initial'; $_SESSION['mode'] = 'basic'; $_SESSION['langua'] = 'en'; $_SESSION['dont_die'] = true; // $_SESSION['ok'] = true; $_REQUEST['admin_pw'] = $password; $loginstring = $login; $_POST['action_setup_do'] = true; // include routine for session_register include_once('lib/gpcs_vars.inc.php'); // include specific setup functions include_once('setup/setup_functions.php'); /*Some checks before starting */ $step = (isset($_POST['step']))? $_POST['step'] : (isset($_SESSION['step']))? $_SESSION['step'] :'initial'; $mode = (isset($_POST['mode']))? $_POST['mode'] : (isset($_SESSION['mode']))? $_SESSION['mode'] : 'basic'; // Check language $langua = check_language(); $_SESSION['langua'] = $langua; $GLOBALS['langua'] = $langua; define('LANG',$langua); // If language ok, then we can start the translation include_once("./lang/".LANG.".inc.php"); function __($textid) { return (isset($GLOBALS['_lang'][$textid]) && $GLOBALS['_lang'][$textid] <> '') ? $GLOBALS['_lang'][$textid] : $textid; } // Check PHP version. Note: if php version < 3, please update if (substr(phpversion(),0,1) == '3') { alert_message(__('<b>Sorry, PHP 4 or 5 required!</b><br /><br /> Please download the current version at <a href="http://www.php.net">www.php.net</a>')); } // Check if config exists. NOTE: If exissts, then this will be a configuration or upgrade, not a installation. if ((file_exists("./config.inc.php") and filesize('./config.inc.php') > 0) or (file_exists('../../config.inc.php') and filesize('../../config.inc.php') > 0)) { include_once('./lib/lib.inc.php'); if ((!isset($db_type)) && defined("PHPR_DB_TYPE")) { $db_type = PHPR_DB_TYPE; } define('DB_TYPE',$db_type); include_once('./lib/db/'.DB_TYPE.'.inc.php'); constants_to_vars(); $ok = 1; // admin password valid $_SESSION['ok'] = 1; // config.inc.php exists, then this is a configuration or update. Also, this is the first step inside the setup. $configure = true; $_SESSION['configure'] = true; $_SESSION['step'] = 'initial'; $_SESSION['step'] = $step; } /* Process setup */ define("setup_included", "1"); // include the configuration array (with all setup fields include_once('setup/setup_configuration.php'); // First, if configurable (noconfigurable=false), then, we will include the config.inc.php if ($configure == true) { include_once("config.inc.php"); // get the old values and store as '_old values $old_config_array = get_defined_constants(); if (isset($old_config_array['PHPR_VERSION']) && $old_config_array['PHPR_VERSION'] < $config_array['version']['default']) { $setupType = 'upgrade'; } elseif (!isset($old_config_array['PHPR_VERSION'])) { // to allow compativility with versions older than 5.0 if (isset($version)) { $old_config_array = array(); foreach ($config_array as $oneName => $oneField) { if (isset($oneField['old_name'])) { $oneNameOld = $oneField['old_name']; } else { $oneNameOld = $oneName; } if (isset($$oneNameOld)) { $cons_name = 'PHPR_'.strtoupper($oneName); $old_config_array[$cons_name] = $$oneNameOld; } } $setupType = 'upgrade'; } else { $setupType = 'installation'; } } else { $setupType = 'configuration'; } } else { $setupType = 'installation'; } // Well, after all checks, lets start processing if (isset($_POST)) // && !isset($_POST['admin_pw'])) { // This function will save on $_SESSION all the values sent by $_POST // If we are on advenced or basic or default step, it will be necessary to validate the values received by post. if (isset($_POST['action_setup_advanced']) || isset($_POST['action_setup_basic']) || isset($_POST['action_setup_default'])) { $validate = true; } else { $validate = false; } // this function will save the post information received from previous page. save_form_values($_POST,$config_array, $validate, $old_config_array); // select the next step (the step to be displayed). This depends on the button pressed. if (isset($_POST['action_setup_basic'])) { $step = 'configuration'; $mode = 'basic'; $_SESSION['mode'] = $mode; $_SESSION['step'] = $step; } elseif (isset($_POST['action_setup_advanced'])) { $step = 'configuration'; $mode = 'advanced'; $_SESSION['mode'] = $mode; $_SESSION['step'] = $step; } elseif (isset($_POST['action_setup_go_back'])) { $step = 'configuration'; $mode = $_SESSION['mode']; $_SESSION['step'] = $step; } elseif (isset($_POST['action_setup_finish'])) { $step = 'summary'; $_SESSION['step'] = $step; } // This option (do or default option) will call the step3.php, to install phprojekt. elseif (isset($_POST['action_setup_default']) || (isset($_POST['action_setup_do']))) { if ($configure) { if (isset($old_config_array['PHPR_VERSION']) && $old_config_array['PHPR_VERSION'] < $config_array['version']['default']) { $setup = 'update'; $_SESSION['setup'] = 'update'; } else { $setup = 'configure'; $_SESSION['setup'] = 'configure'; } } else { $setup = 'install'; $_SESSION['setup'] = 'install'; } // If database didn't exists, we will try to create it test_db_connection(false); include_once("setup/step3.php"); } else { // If no button pressed we will display the initial $step = 'initial'; $mode = 'basic'; $_SESSION['step'] = $step; $_SESSION['mode'] = $mode; } } else { alert_message(__('Configuration array not found.')); } } ?>