Ask your ISP to enable this extension\n"; } //test session variables if (!empty($_SESSION) and $_SESSION['lcSess1'] == 42 and $_SESSION['lcSess2'] == 'hitchhiker') { $okiMsg[] = "PHP sessions Ok\n"; } else { $errMsg[] = "PHP sessions not working
Check PHP installation on your server\n"; } //check for missing/invalid form fields $regEx = "~^(\w{1,20} = [^<>?%$@{}\\^=\r\n]{1,60}([\r\n]|$)+)+$~"; $clNerror = (!empty($newCals) and !preg_match($regEx,$newCals."\n")) ? ' class="hilite"' : ''; $clDerror = (!preg_match('~^\w{1,20}$~i',$defCal)) ? ' class="hilite"' : ''; $dbHerror = !$dbHost ? ' class="hilite"' : ''; $dbUerror = !$dbUnam ? ' class="hilite"' : ''; $dbPerror = !$dbPwrd ? ' class="hilite"' : ''; $dbNerror = !$dbName ? ' class="hilite"' : ''; $adNerror = !$adName ? ' class="hilite"' : ''; $adEerror = (!preg_match($rxEmailX,$adMail)) ? ' class="hilite"' : ''; $adPerror = !$adPwrd ? ' class="hilite"' : ''; if (!$clNerror) { $allCals = $curCals; //currently installed calendars if ($newCals) { $newCalPairs = preg_split('~[\r\n]+~m',$newCals); foreach ($newCalPairs as $newCalPair) { //get cal from newCals list($calID,$calTitle) = explode(' = ',$newCalPair); $allCals[$calID] = $calTitle; //add/replace into $allCals } } if (!$clDerror and !array_key_exists($defCal,$allCals)) { $defCal = substr($newCals,0,strpos($newCals,' = ')); //set to first newcalendar } } else { $errMsg[] = "Error: No or invalid calendar name = title pair(s) (highlighted)"; } if ($clDerror or $dbHerror or $dbHerror or $dbUerror or $dbPerror or $dbNerror or $adNerror or $adEerror or $adPerror) { $errMsg[] = "Error: Missing or invalid form fields (highlighted)"; } else { $okiMsg[] = "Form fields OK"; } } if ($test) { if (@file_put_contents('./lctest.dat','LuxCal') === false) { //write test file $errMsg[] = "Writing to the calendar's root folder
Check file permissions on your server\n"; } else { unlink('./lctest.dat'); //delete test file $okiMsg[] = "Writing to the calendar's root folder\n"; } if (@file_put_contents('./files/lctest.dat','LuxCal') === false) { //write test file $errMsg[] = "Writing to the 'files' folder
Check file permissions on your server\n"; } else { unlink('./files/lctest.dat'); //delete test file $okiMsg[] = "Writing to the 'files' folder\n"; } //create empty sql.log if (@file_put_contents('./logs/sql.log','') === false) { $errMsg[] = "Writing an empty sql.log file to the 'logs' folder
Check file permissions on your server\n"; } else { $okiMsg[] = "Writing an empty sql.log file to the 'logs' folder\n"; } //create empty luxcal.log if (@file_put_contents('./logs/luxcal.log','') === false) { $errMsg[] = "Writing an empty luxcal.log file to the 'logs' folder
Check file permissions on your server\n"; } else { $okiMsg[] = "Writing an empty luxcal.log file to the 'logs' folder\n"; } } if ($install and empty($errMsg)) { //prepare db data $adPwMd5 = trim($adPwrd) == '********' ? $adPwMd5 : md5($adPwrd); //connect to db if (!$dbH = dbConnect('void',0)) { //0: return on error ($dbH false) $errMsg[] = "Database $dbName - Problem connecting to database
Check your database credentials/permissions\n"; } else { dbQuery("SET NAMES utf8 COLLATE utf8_unicode_ci; SET CHARACTER SET utf8;"); //set character set and collation foreach ($allCals as $name => $title) { //check / create calendar tables $calID = $name; //select calendar //create tables, if not exist createDbTable('events'); createDbTable('categories'); createDbTable('users'); createDbTable('groups'); createDbTable('settings'); createDbTable('styles'); //insert initial data in groups, users, cats and settings tables initGroups(); initUsers($adName,$adMail,$adPwMd5); initCats(); initStyles(); $dbSet = array(); $dbSet['calendarTitle'] = $title; $dbSet['calendarUrl'] = calBaseUrl().'?cal='.$name; $dbSet['calendarEmail'] = $adMail; checkSettings($dbSet); saveSettings($dbSet); } } $dbH = null; //close db if (empty($errMsg)) { //save configuration $dbDef = $defCal; saveConfig(); //save LuxCal version and db data session_unset(); //force retrieve of settings and selection of default calendar $htaccess = htaccess(); //check .htaccess file for blocking access to .cdb, .log and .txt files //installation successful echo "
\n
Note:
\n{$htaccess}
"; } echo "Tests failed:
\n"; echo "- \n";
foreach ($errMsg as $msg) { echo "
- {$msg} \n"; } echo "
Tests passed:
\n"; echo "- \n";
foreach ($okiMsg as $msg) { echo "
- {$msg} \n"; } echo "
\n"; } if (empty($errMsg)) { if ($test) { echo "
Select 'install/save' to install the calendar(s) and to save the credentials.
\n"; } else { echo "Complete this form to configure/install the LuxCal Event Calendar.\n";
echo "
Select 'test' to validate the form fields and select 'install/save' to continue.
Correct/solve the errors/failures and test again.
\n"; } //display form echo "\n"; echo "\n"; echo "