= 97 and $c <= 122) ? chr(($c-82-($n*4))%26+97) : (($c >= 65 and $c <= 90) ? chr(($c-53+($n*2))%26+65) : $ch); } return implode($splits); } //sanity check if (version_compare(PHP_VERSION,'5.3.0') < 0) { //check PHP version exit('

PHP version too low

You need version 5.3 or higher
Your current version is: '.PHP_VERSION); } foreach ($_REQUEST as $key => $value) { if (is_string($value)) $_REQUEST[$key] = htmlspecialchars(strip_tags(trim($value)),ENT_QUOTES,'UTF-8'); } //set error reporting error_reporting(E_ALL); //errors and notices ini_set('display_errors',1); ini_set('log_errors',1); //get configuration data if (file_exists('./lcconfig.php')) { //try lcconfig.php (LuxCal 2.7.3+) include './lcconfig.php'; } elseif (file_exists('./lcaldbc.dat')) { //try lcaldbc.dat (LuxCal 2.6.0 - 2.7.2) if (list(,,$dbc) = file('./lcaldbc.dat',FILE_IGNORE_NEW_LINES)) { list($dbHost,$dbName,$dbUnam,$dbPwrd,$dbPfix) = unserialize(ciph($dbc,1)); } } if (empty($dbType)) { $dbType = 'MySQL'; } //set database type $lcV = implode('.',str_split(substr(basename(__FILE__),7,-4))).'M'; //set new LuxCal version //delete possible calID cookie of previous installation $calPath = './'.basename(__DIR__); setcookie('LCALcid', '', time()-3600,$calPath); //get calendar tools require './common/toolbox.php'; //general toolbox require './common/toolboxd.php'; //database tools require './common/toolboxx.php'; //admin tools ?> LuxCal Event Calendar - Upgrade
LuxCal Event Calendar
LuxCal: {$lcV}Your PHP version: ".PHP_VERSION."Calendar Upgrade to Version {$lcV}\n"; echo "
\n"; do { //start of processing if (empty($dbHost) OR empty($dbUnam) OR empty($dbName)) { //no db credentials found $error = "No database credentials found in calendar root (file: lcconfig.php)"; break; } if (!isset($dbDef)) { //before v4.1 if (!isset($dbPfix)) { //config data not complete $error = "Not all configuration data found in calendar root (file: lcconfig.php)"; break; } $dbDef = $dbPfix; //set default calendar } $calID = $dbDef = rtrim($dbDef,'_'); //remove possible separator "_" $report[] = "Configuration file 'lcconfig.php' found. Configuration data loaded:"; $report[] = "- Database name: {$dbName}"; $report[] = "- Default calendar: {$dbDef}"; //connect to database if (!$dbH = dbConnect('void',0)) { $error = "Could not connect to database"; break; } //check/update table prefixes of old versions $stH = dbQuery("SHOW TABLES LIKE '%settings'"); while ($row = $stH->fetch(PDO::FETCH_NUM)) { $matches = array(); if (preg_match('~^([a-z\d]{0,20})settings$~',$row[0],$matches)) { //no prefix or no separator (_) $fromPf = empty($matches[1]) ? '' : $matches[1]; $toPf = empty($matches[1]) ? 'mycal' : $matches[1]; //no prefix: 'mycal' $q = "RENAME TABLE {$fromPf}events TO {$toPf}_events, {$fromPf}categories TO {$toPf}_categories, {$fromPf}users TO {$toPf}_users, {$fromPf}settings TO {$toPf}_settings "; $stH2 = dbQuery($q); if ($stH2) { $report[] = "Tables '{$fromPf}xxxxxx' renamed to '{$toPf}_xxxxxx'"; } $calID = $dbDef = $toPf; } } //get settings of default calendar and set time zone $dbSet = getSettings(); if ($dbSet === false) { $error = "Could not retrieve calendar settings from the database"; break; } date_default_timezone_set($dbSet['timeZone']); $report[] = "Default calendar settings retrieved and timezone set to:"; $report[] = "- ".$dbSet['timeZone']; /* ===== LuxCal 3.1.0 drop table `x_sessdata` (not used anymore) ===== */ dbQuery("DROP TABLE IF EXISTS `x_sessdata`",0); //get installed calendars $allCals = getCals(); if (empty($allCals)) { $error = "No calendars found in the database."; break; } $report[] = "Calendar(s) found in the database:"; foreach($allCals as $cID=>$title) { $report[] = '- '.$cID.' = '.$title.($cID == $dbDef ? " (default)" : ''); } /*============================= start upgrading ==============================*/ foreach($allCals as $cID=>$title) { //process each installed calendar $report[] = "Processing calendar: {$cID} - {$title}"; $calID = $cID; //set current calendar //upgrade db tables to the latest schema, while preserving data upgradeDb(); $report[] = "- Database tables and structures verified/updated."; //upgrade admin settings $dbSet = getSettings(); checkSettings($dbSet); saveSettings($dbSet); $report[] = "- Administrator settings verified/updated"; } //Save LuxCal version and config data if (!saveConfig()) { $error = "Unable to write the file lcconfig.php to calendar root. Check file permissions (should be 755)."; break; } $report[] = "Configuration file 'lcconfig.php' updated and saved to root folder."; //check .htaccess file for blocking access to .cdb, .log and .txt files if ($htaccess = htaccess()) { $report[] = "{$htaccess}"; } } while (0); //end of processing echo "

\n"; if (empty($error)) { echo "
Start of Upgrade
\n"; echo "\n"; echo "
End of Upgrade
\n"; echo "
\n"; echo "
\n"; echo "The calendar has been upgraded to version {$lcV}.\n"; echo "

Make a back-up copy of the configuration file 'lcconfig.php'.


\n"; echo "
\n"; echo "\n"; echo "
\n
\n"; } else { echo "
\n"; echo "
The following error occurred:
\n"; echo "
- {$error}

\n"; echo "The calendar upgrade to version {$lcV} has been aborted.
\n"; echo "Correct the error and restart the upgrade script.\n"; echo "
\n"; } echo "
\n"; ?>

AFTER USE MAKE THE FILE INACCESSIBLE OR REMOVE IT FROM THE SERVER !

design - powered by LuxSoft