/** * control * * @return void */ function control() { // Automatic Upgrade if (isset($_GET['auto'])) { $step = (int) $_GET['auto']; // Turn Off Site if ($step == 1) { displayStepOne(); } elseif ($step == 2) { displayStepTwo(); } elseif ($step == 3) { displayStepThree(); } elseif ($step == 4) { displayStepFour(); } elseif ($step == 5) { displayStepFive(); } elseif ($step == 6) { displayStepSix(); } elseif ($step == 7) { displayStepSeven(); } } elseif (isset($_GET['manual'])) { displayManualUpgrade(); } elseif (isset($_GET['upgrade'])) { displayUpgradeDatabase(); } elseif (isset($_GET['site'])) { displayUpgradeSiteStatus($_GET['site']); } else { displayStart(); } }
/** * setupDatabase * * @return void */ function setupDatabase() { if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['fname']) || empty($_POST['lname']) || empty($_POST['email'])) { displayStepFive("<p class=\"error\">" . T_('You forgot a required field. Please fill out all required fields.') . "</p>"); return; } include_once 'inc/config_inc.php'; include_once 'inc/install_inc.php'; include_once 'inc/utils.php'; include_once 'inc/thirdparty/phpass/PasswordHash.php'; // Hash the pw $hasher = new PasswordHash(8, FALSE); $password = $hasher->HashPassword($_POST['password']); $connection = mysql_connect($cfg_mysql_host, $cfg_mysql_user, $cfg_mysql_pass); if (!$connection) { die("<h1>Connection Error [" . __FILE__ . __LINE__ . "]</h1>" . mysql_error()); } mysql_select_db($cfg_mysql_db) or die("<h1>Error</h1><p><b>Database could not be found!</b></p>" . mysql_error()); $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $email = mysql_real_escape_string($_POST['email']); $bYear = (int) $_POST['year']; $bMonth = (int) $_POST['month']; $bMonth = str_pad($bMonth, 2, "0", STR_PAD_LEFT); $bDay = (int) $_POST['day']; $bDay = str_pad($bDay, 2, "0", STR_PAD_LEFT); $username = mysql_real_escape_string($_POST['username']); installUsers($fname, $lname, $email, $bYear, $bMonth, $bDay, $username, $password); installCategory(); installCalendar(); installTables(); echo ' <div id="install"> <h1>' . T_('Hooray! Yippie!') . '</h1> <p>' . sprintf(T_('%s has been installed successfully.'), 'Family Connections') . '</p> <p><a href="index.php">' . sprintf(T_('Please continue to the homepage to login and begin using %s.'), 'Family Connections') . '</a><p> </div>'; }