/** * Entry point into the configuration process * * @return void */ function build_config() { /* get the site settings */ $settings = parse_ini_file(APP_PATH . 'hm3.ini'); if (is_array($settings) && !empty($settings)) { /* determine compression commands */ list($js_compress, $css_compress) = compress_methods($settings); /* get module detail */ list($js, $css, $filters, $assets) = get_module_assignments($settings); /* combine and compress page content */ combine_includes($js, $js_compress, $css, $css_compress); /* write out the hm3.rc file */ write_config_file($settings, $filters); /* create the production version */ create_production_site($assets, $settings); } else { printf("\nNo settings found in ini file\n"); } }
* Create the autoconf.php file. */ case "write_config": include "../includes/func.php"; // special characters " and $ are escaped $database = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $timezone = $_REQUEST['timezone']; $db_layer = $_REQUEST['db_layer']; $db_type = $_REQUEST['db_type']; $prefix = addcslashes($_REQUEST['prefix'], '"$'); $lang = $_REQUEST['lang']; $salt = createPassword(20); write_config_file($database, $hostname, $username, $password, $db_layer, $db_type, $prefix, $lang, $salt, $timezone); break; /** * Create the database. */ /** * Create the database. */ case "make_database": $databaseName = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $server_type = $_REQUEST['db_type']; $db_layer = $_REQUEST['db_layer']; $db_error = false;
if (isset($progress)) { print_feedback($progress); } print_errors($errors); echo '<input type="hidden" name="step" value="' . $step . '" />'; unset($_POST['step']); unset($_POST['action']); unset($errors); print_hidden($step); echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>'; echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />'; } else { require 'include/config_template.php'; $comments = '/*' . str_pad(' This file was generated by the AChecker ' . $new_version . ' installation script.', 70, ' ') . '*/ /*' . str_pad(' File generated ' . date('Y-m-d H:m:s'), 70, ' ') . '*/'; if (!write_config_file('../include/config.inc.php', $comments)) { echo '<input type="hidden" name="step" value="' . $step . '" />'; print_feedback($progress); $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.'; print_errors($errors); echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>'; echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />'; } else { echo '<input type="hidden" name="step" value="' . $step . '" />'; print_hidden($step); $progress[] = 'Data has been saved successfully.'; @chmod('../include/config.inc.php', 0444); print_feedback($progress); echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>'; } }
if ((int) $revisionDB < 922) { logfile("-- update to r922"); exec_query("ALTER TABLE `{$p}knd` ADD `knd_password` VARCHAR(255);", 1); exec_query("ALTER TABLE `{$p}knd` ADD `knd_secure` varchar(60) NOT NULL default '0';", 1); } if ((int) $revisionDB < 935) { logfile("-- update to r935"); exec_query("CREATE TABLE `{$p}exp` (\n `exp_ID` int(10) NOT NULL AUTO_INCREMENT,\n `exp_timestamp` int(10) NOT NULL DEFAULT '0',\n `exp_usrID` int(10) NOT NULL,\n `exp_pctID` int(10) NOT NULL,\n `exp_designation` text NOT NULL,\n `exp_comment` text NOT NULL,\n `exp_comment_type` tinyint(1) NOT NULL DEFAULT '0',\n `exp_cleared` tinyint(1) NOT NULL DEFAULT '0',\n `exp_value` decimal(10,2) NOT NULL DEFAULT '0.00',\n PRIMARY KEY (`exp_ID`)\n) AUTO_INCREMENT=1;"); } if ((int) $revisionDB < 1067) { logfile("-- update to r1067"); /* * Write new config file with password salt */ $kga['password_salt'] = createPassword(20); if (write_config_file($kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], $kga['server_conn'], $kga['server_type'], $kga['server_prefix'], $kga['language'], $kga['password_salt'])) { echo '<tr><td>' . $kga['lang']['updater'][140] . '</td><td class="green"> </td></tr>'; } else { die($kga['lang']['updater'][130]); } /* * Reset all passwords */ $new_passwords = array(); $result = mysql_query("SELECT * FROM {$p}usr"); $users = array(); while ($row = mysql_fetch_assoc($result)) { $users[] = $row; } foreach ($users as $user) { if ($user['usr_name'] == 'admin') {
$days = (int) $_REQUEST['editLimitDays']; $editLimit = $hours + $days * 24; $editLimit *= 60 * 60; // convert to seconds } if ($editLimit === false || $editLimit === 0) { $config_data['editLimit'] = '-'; } else { $config_data['editLimit'] = $editLimit; } if (!$database->configuration_edit($config_data)) { $errors[''] = $kga['lang']['error']; } } if (count($errors) == 0) { write_config_file($kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], $kga['server_conn'], $kga['server_type'], $kga['server_prefix'], $kga['language'], $kga['password_salt'], $_REQUEST['defaultTimezone']); } header('Content-Type: application/json;charset=utf-8'); echo json_encode(array('errors' => $errors)); break; case "toggleDeletedUsers": setcookie("adminPanel_extension_show_deleted_users", $axValue); break; case "createGlobalRole": $role_data['name'] = trim($axValue); $errors = array(); if (!isset($kga['user'])) { $errors[] = $kga['lang']['errorMessages']['permissionDenied']; } else { if ($database->globalRole_find($role_data)) { $errors[] = $kga['lang']['errorMessages']['sameGlobalRoleName'];
echo '<input type="hidden" name="step" value="' . $step . '" />'; print_feedback($progress); $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.'; print_errors($errors); echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>'; echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />'; } else { echo '<input type="hidden" name="step" value="' . $step . '" />'; print_hidden($step); $progress[] = 'Data has been saved successfully.'; if (version_compare($_POST['step1']['old_version'], '1.5.2', '<')) { require AT_INCLUDE_PATH . 'install/config_template.php'; $comments = '/*' . str_pad(' This file was generated by the ATutor 1.5.2 installation script.', 70, ' ') . '*/ /*' . str_pad(' File generated ' . date('Y-m-d H:m:s'), 70, ' ') . '*/'; $_POST['db_login'] = urldecode($_POST['db_login']); $_POST['db_password'] = urldecode($_POST['db_password']); write_config_file('../include/config.inc.php', $_POST['step1']['db_login'], $_POST['step1']['db_password'], $_POST['step1']['db_host'], $_POST['step1']['db_port'], $_POST['step1']['db_name'], $_POST['step1']['tb_prefix'], $comments, $_POST['step5']['content_dir'], $_POST['step1']['smtp'], $_POST['step1']['get_file']); } @chmod('../include/config.inc.php', 0444); if (file_exists('../../' . $_POST['step1']['old_path'] . '/include/config_multisite.inc.php')) { if (!copy('../../' . $_POST['step1']['old_path'] . '/include/config_multisite.inc.php', '../include/config_multisite.inc.php')) { $errors[] = 'Failed to copy Multisite configuration file to new site.'; } } print_feedback($progress); echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>'; } } ?> </form>
function updateFavoriteEpisode(&$fav, $title) { global $config_values; if (!($guess = guess_match($title, TRUE))) { return; } if (preg_match('/^((\\d+x)?\\d+)p$/', $guess['episode'])) { $guess['episode'] = preg_replace('/^((?:\\d+x)?\\d+)p$/', '\\1', $guess['episode']); $PROPER = "p"; } else { $PROPER = ''; } if (preg_match('/(^)(\\d{8})$/', $guess['episode'], $regs)) { $curEpisode = $regs[2]; $expectedEpisode = $regs[2] + 1; } else { if (preg_match('/^(\\d+)x(\\d+)$/i', $guess['episode'], $regs)) { $curEpisode = preg_replace('/(\\d+)x/i', "", $guess['episode']); $curSeason = preg_replace('/x(\\d+)/i', "", $guess['episode']); $expectedEpisode = sprintf('%02d', $fav['Episode'] + 1); } else { return; } } if ($fav['Episode'] && $curEpisode > $expectedEpisode) { $show = $guess['key']; $episode = $guess['episode']; $expected = $curSeason . "x" . $expectedEpisode; $oldEpisode = $fav['Episode']; $oldSeason = $fav['Season']; $newEpisode = $curEpisode + 1; $newSeason = $curSeason + 1; $msg = "Matched \"{$show} {$episode}\" but expected \"{$expected}\".\n"; $msg .= "This usualy means that a double episode is downloaded before this one.\n"; $msg .= "But it could mean that you missed an episode or that \"{$episode}\" is a special episode.\n"; $msg .= "If this is the case you need to reset the \"Last Downloaded Episode\" setting to \"{$oldSeason} x {$oldEpisode}\" in the Favorites menu.\n"; $msg .= "If you don't, the next match wil be \"Season: {$curSeason} Episode: {$newEpisode}\" or \"Season {$newSeason} Episode: 1\".\n"; $subject = "TorrentWatch-X: got {$show} {$episode}, expected {$expected}"; MailNotify($msg, $subject); $msg = escapeshellarg($msg); run_script('error', $title, $msg); } if (!isset($fav['Season'], $fav['Episode']) || $regs[1] > $fav['Season']) { $fav['Season'] = $regs[1]; $fav['Episode'] = $regs[2] . $PROPER; } else { if ($regs[1] == $fav['Season'] && $regs[2] > $fav['Episode']) { $fav['Episode'] = $regs[2] . $PROPER; } else { $fav['Episode'] .= $PROPER; } } write_config_file(); }
$sth->execute(); $sth = $dbHandle->prepare($index3); $sth->execute(); echo "Database created <br>"; } catch (PDOException $exception) { throw new Exception("Database unavailable", 503); } } //guessing fsroot // get the FSYNC_ROOT url // $fsRoot = "https://"; if (!isset($_SERVER['HTTPS'])) { $fsRoot = "http://"; } $fsRoot .= $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/"; if (strpos($_SERVER['REQUEST_URI'], 'index.php') !== 0) { $fsRoot .= "index.php/"; } // write settings.php, if not possible, display the needed contant // write_config_file($dbType, $dbHost, $dbName, $dbUser, $dbPass, $fsRoot); echo "<hr><hr> Finished the setup, please delete setup.php and go on with the FFSync<hr><hr>"; echo <<<EOT <hr><hr> <h4>This script has guessed the Address of your installation, this might not be accurate,<br/> Please check if this script can be reached by <a href="{$fsRoot}">{$fsRoot}</a> .<br/> If thats not the case you have to ajust the settings.php<br /> </h4> EOT; }
function parse_options() { global $html_out, $config_values; $filler = "<br>"; array_keys($_GET); $commands = array_keys($_GET); if (empty($commands)) { return FALSE; } if (preg_match("/^\\//", $commands[0])) { $commands[0] = preg_replace("/^\\//", '', $commands[0]); } switch ($commands[0]) { case 'getClientData': if ($_REQUEST['recent']) { $response = getClientData(1); } else { $response = getClientData(0); } echo $response; exit; case 'delTorrent': $response = delTorrent($_REQUEST['delTorrent'], $_REQUEST['trash'], $_REQUEST['batch']); echo "{$response}"; exit; case 'stopTorrent': $response = stopTorrent($_REQUEST['stopTorrent'], $_REQUEST['batch']); echo "{$response}"; exit; case 'startTorrent': $response = startTorrent($_REQUEST['startTorrent'], $_REQUEST['batch']); echo "{$response}"; exit; case 'moveTo': $response = moveTorrent($_REQUEST['moveTo'], $_REQUEST['torHash'], $_REQUEST['batch']); echo "{$response}"; exit; case 'updateFavorite': $response = update_favorite(); if (preg_match("/^Error:", $response)) { echo "<div id=\"fav_error\" class=\"dialog_window\" style=\"display: block\">{$response}</div>"; } break; case 'updateFeed': update_feed(); break; case 'clearCache': clear_cache(); break; case 'setGlobals': update_global_config(); write_config_file(); break; case 'matchTitle': $feedLink = $_GET['rss']; foreach ($config_values['Feeds'] as $key => $feed) { if ($feed['Link'] == "{$feedLink}") { $idx = $key; } } if ($config_values['Feeds'][$idx]['seedRatio']) { $seedRatio = $config_values['Feeds'][$idx]['seedRatio']; } else { $seedRatio = $config_values['Settings']['Default Seed Ratio']; } if (!$seedRatio) { $seedRatio = -1; } if ($tmp = guess_match(html_entity_decode($_GET['title']), TRUE)) { $_GET['name'] = trim(strtr($tmp['key'], "._", " ")); if ($config_values['Settings']['MatchStyle'] == "glob") { $_GET['filter'] = trim(strtr($tmp['key'], " ._", "???")); $_GET['filter'] .= '*'; } else { $_GET['filter'] = trim($tmp['key']); } $_GET['quality'] = $tmp['data']; $_GET['feed'] = $_GET['rss']; $_GET['button'] = 'Add'; $_GET['savein'] = 'Default'; $_GET['seedratio'] = $seedRatio; } else { $_GET['name'] = $_GET['title']; $_GET['filter'] = $_GET['title']; $_GET['quality'] = 'All'; $_GET['feed'] = $_GET['rss']; $_GET['button'] = 'Add'; $_GET['savein'] = 'Default'; $_GET['seedratio'] = $seedRatio; } if ($config_values['Settings']['Default Feed All'] && preg_match('/^(\\d+)x(\\d+)p?$|^(\\d{8})$/i', $tmp['episode'])) { $_GET['feed'] = 'All'; } $response = update_favorite(); if ($response) { echo "{$response}"; } //break; exit; case 'hide': $response = add_hidden(ucwords($_GET['hide'])); if ($response) { echo "ERROR:{$response}"; } else { $guess = guess_match(html_entity_decode($_GET['hide']), TRUE); echo $guess['key']; } exit; case 'delHidden': del_hidden($_GET['unhide']); break; case 'dlTorrent': // Loaded via ajax foreach ($config_values['Favorites'] as $fav) { $guess = guess_match(html_entity_decode($_GET['title'])); $name = trim(strtr($guess['key'], "._", " ")); if ($name == $fav['Name']) { $downloadDir = $fav['Save In']; } } if ((!isset($downloadDir) || $downloadDir == "Default") && isset($config_values['Settings']['Download Dir'])) { $downloadDir = $config_values['Settings']['Download Dir']; } $r = client_add_torrent(preg_replace('/ /', '%20', trim($_GET['link'])), $downloadDir, $_GET['title'], $_GET['feed']); if ($r == "Success") { $torHash = get_torHash(add_cache($_GET['title'])); } if (isset($torHash)) { echo $torHash; } else { echo $r; } exit(0); break; case 'clearHistory': // Loaded via ajax if (file_exists($config_values['Settings']['History'])) { unlink($config_values['Settings']['History']); } display_history(); close_html(); exit(0); break; case 'get_client': global $config_values; echo $config_values['Settings']['Client']; exit; case 'version_check': echo version_check(); exit; case 'post_bug': global $tw_version; $response = post_bug($_POST['Summary'], $_POST['Name'], $_POST['Email'], $_POST['Priority'], $_POST['Description']); echo $response; exit; case 'get_dialog_data': switch ($_GET['get_dialog_data']) { case '#favorites': display_favorites(); exit; case '#configuration': display_global_config(); exit; case '#hidelist': display_hidelist(); exit; case '#feeds': display_feeds(); exit; case '#history': display_history(); exit; case '#show_legend': display_legend(); exit; case '#report_bug': report_bug(); exit; case '#clear_cache': display_clearCache(); exit; case '#show_transmission': display_transmission(); exit; case '#show_info': show_info(urldecode($_GET['episode_name'])); exit; default: exit; } default: $output = "<script type='text/javascript'>alert('Bad Paramaters passed to " . $_SERVER['PHP_SELF'] . ": " . $_SERVER['REQUEST_URI'] . "');</script>"; } if (isset($exec)) { exec($exec, $output); } if (isset($output)) { if (is_array($output)) { $output = implode($filler, $output); } $html_out .= str_replace("\n", "<br>", "<div class='execoutput'>{$output}</div>"); echo $html_out; $html_out = ""; } return; }
'permissions' => PHOTO_UPLOAD_PERMISSION, 'interactive' => false), 'RaceCrew' => array('password' => 'murphy', 'permissions' => VIEW_RACE_RESULTS_PERMISSION | VIEW_AWARDS_PERMISSION | CHECK_IN_RACERS_PERMISSION | REVERT_CHECK_IN_PERMISSION | ASSIGN_RACER_IMAGE_PERMISSION | PHOTO_UPLOAD_PERMISSION | EDIT_RACER_PERMISSION | REGISTER_NEW_RACER_PERMISSION), 'RaceCoordinator' => array('password' => 'doyourbest', 'permissions' => -1) \t ); \$post_setup_role = 'RaceCoordinator'; ?> END; $ok = write_config_file($config_roles, $content); } if ($ok) { echo "<success/>\n"; // Setup permissions were granted temporarily because there was no // configuration present. Now that there is, remove the special setting_up // flag and log in (without password) as the race coordinator (or whatever // other role the config file specifies). unset($_SESSION['setting_up']); @(include_once local_file_name($config_roles)); if (!isset($post_setup_role)) { $post_setup_role = 'RaceCoordinator'; } $_SESSION['role'] = $post_setup_role; $role = $roles[$post_setup_role]; if ($role) {
return $unique_id; } function write_csv_dataset($data_string) { $unique_id = uniqid(); $data_file = "./uploads/" . $unique_id . ".csv"; $handle = fopen($data_file, 'w') or die('Cannot open file: ' . $data_file); fwrite($handle, $data_string); fclose($handle); return $unique_id; } if (isset($_POST['json_string']) && isset($_POST['action'])) { $json_string = $_POST['json_string']; $action = $_POST['action']; if ($action == "write_config") { echo write_config_file($json_string); } else { if ($action == "write_pasted_data") { echo write_pasted_data($json_string); } else { if ($action == "write_dataset") { echo write_dataset($json_string); } else { if ($action == "write_csv_dataset") { echo write_csv_dataset($json_string); } else { echo "all your bases are belong to us"; } } } }
$smtp = $_POST['step1']['smtp']; $get_file = $_POST['step1']['get_file']; } else { if ($_POST['step2']['db_login']) { $db_login = $_POST['step2']['db_login']; $db_pwd = $_POST['step2']['db_password']; $db_host = $_POST['step2']['db_host']; $db_port = $_POST['step2']['db_port']; $db_name = $_POST['step2']['db_name']; $tb_prefix = $_POST['step2']['tb_prefix']; $content_dir = $_POST['step4']['content_dir']; $smtp = $_POST['step3']['smtp']; $get_file = $_POST['step4']['get_file']; } } if (!write_config_file('../include/config.inc.php', $db_login, $db_pwd, $db_host, $db_port, $db_name, $tb_prefix, $comments, $content_dir, $smtp, $get_file)) { echo '<input type="hidden" name="step" value="' . $step . '" />'; print_feedback($progress); $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.'; print_errors($errors); echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>'; echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />'; } else { /* if header img and logo were carried forward AND the upgrade was from 1.4.3 to 1.5 then */ if (($_POST['step1']['header_img'] != '' || $_POST['step1']['header_logo'] != '') && $new_version == '1.5' && $_POST['step1']['old_version'] == '1.4.3') { $db = mysql_connect($_POST['step1']['db_host'] . ':' . $_POST['step1']['db_port'], $_POST['step1']['db_login'], urldecode($_POST['step1']['db_password'])); mysql_select_db($_POST['step1']['db_name'], $db); $sql = "INSERT INTO " . $_POST['step1']['tb_prefix'] . "themes VALUES ('ATutor_alt', '1.5', 'default_oldheader', NOW() , 'Backwards compatible default theme', 2)"; @mysql_query($sql, $db); $sql = "UPDATE " . $_POST['step1']['tb_prefix'] . "themes SET status=0, version='1.5' WHERE dir_name = 'default'"; @mysql_query($sql, $db);
// release of kimai 1.1.0 if ((int) $revisionDB < 1390) { Kimai_Logger::logfile("-- update to r1390"); exec_query("DELETE FROM `{$p}configuration` WHERE `option` = 'show_sensible_data'"); } if ((int) $revisionDB < 1391) { Kimai_Logger::logfile("-- update to r1391"); exec_query("INSERT INTO `{$p}configuration` (`option`,`value`) VALUES('table_time_format', '%H:%M')"); } if ((int) $revisionDB < 1392) { Kimai_Logger::logfile("-- update to r1392"); $charset = ''; if ($kga['utf8']) { $charset = 'utf8'; } $success = write_config_file($kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], $charset, $kga['server_prefix'], $kga['language'], $kga['password_salt'], $kga['defaultTimezone']); if ($success) { $level = 'green'; $additional = 'charset: ' . $charset; } else { $level = 'red'; $additional = 'Unable to write config file.'; } printLine($level, 'Store charset in configuration file <i>autoconf.php</i>.', $additional); } if ((int) $revisionDB < 1393) { Kimai_Logger::logfile("-- update to r1393"); exec_query("ALTER TABLE `{$p}users` CHANGE `mail` `mail` VARCHAR(160) NULL"); exec_query("ALTER TABLE `{$p}timeSheet` CHANGE `fixedRate` `fixedRate` DECIMAL(10,2) NULL"); } // ================================================================================
} if ($dbInstalled) { echo "DB is already installed!<br>"; } else { echo "Now going to install the new database! Type is: {$dbType}<br>"; try { $create_statement = " create table wbo ( username varchar(100), id varchar(65), collection varchar(100),\n parentid varchar(65), predecessorid int, modified real, sortindex int,\n payload text, payload_size int, ttl int, primary key (username,collection,id))"; $create_statement2 = " create table users ( username varchar(255), md5 varchar(64), primary key (username)) "; $index1 = 'create index parentindex on wbo (username, parentid)'; $index2 = 'create index predecessorindex on wbo (username, predecessorid)'; $index3 = 'create index modifiedindex on wbo (username, collection, modified)'; $sth = $dbHandle->prepare($create_statement); $sth->execute(); $sth = $dbHandle->prepare($create_statement2); $sth->execute(); $sth = $dbHandle->prepare($index1); $sth->execute(); $sth = $dbHandle->prepare($index2); $sth->execute(); $sth = $dbHandle->prepare($index3); $sth->execute(); echo "Database created <br>"; } catch (PDOException $exception) { throw new Exception("Database unavailable", 503); } } // write settings.php, if not possible, display the needed contant // write_config_file($dbType, $dbHost, $dbName, $dbUser, $dbPass); echo "<hr><hr> Finished the setup, please delete setup.php and go on with the FFSync<hr><hr>"; }
if ((int)$revisionDB < 1379) { if(!isset($defaultTimezone) && isset($kga['defaultTimezone'])) { $defaultTimezone = $kga['defaultTimezone']; } if(!isset($defaultTimezone)) { $defaultTimezone = null; } $success = write_config_file( $kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], 'mysql', '', $kga['server_prefix'], $kga['language'], $kga['password_salt'], $defaultTimezone); if ($success) { $level = 'green'; } else { $level = 'red'; } printLine($level,'Updated autoconf.php to use MYSQL configuration in <i>autoconf.php</i>.'); }
*/ case "write_config": include "../includes/func.php"; // special characters " and $ are escaped $database = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $charset = 'utf8'; $prefix = addcslashes($_REQUEST['prefix'], '"$'); $lang = $_REQUEST['lang']; $salt = createPassword(20); $timezone = $_REQUEST['timezone']; $kimaiConfig = new Kimai_Config(array('server_prefix' => $server_prefix, 'server_hostname' => $hostname, 'server_database' => $database, 'server_username' => $username, 'server_password' => $password, 'server_charset' => $charset, 'defaultTimezone' => $timezone, 'password_salt' => $salt)); Kimai_Registry::setConfig($kimaiConfig); write_config_file($database, $hostname, $username, $password, $charset, $prefix, $lang, $salt, $timezone); break; /** * Create the database. */ /** * Create the database. */ case 'make_database': $databaseName = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $db_error = false; $result = false; $database = new Kimai_Database_Mysql($result, false);
$db = new QuickDB($_SESSION['db_host'], $_SESSION['db_username'], $_SESSION['db_password'], $_SESSION['db_name'], false, false); $dbms_schema = 'schemas/mysql_schema.sql'; } $remove_remarks = "remove_remarks"; $delimiter = ";"; $sql_query = @file_get_contents($dbms_schema); $remove_remarks($sql_query); $sql_query = split_sql_file($sql_query, $delimiter); foreach ($sql_query as $sql) { $db->execute($sql); } require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "db_initial_values.php"; foreach ($sql_ary as $sql) { $db->execute($sql); } write_config_file(); $rename = write_functions_file(); update_config_file(); $success = true; } if (!$success) { $next = array('0' => 'Install', '1' => 'onClick="document.forms[\'final_form\'].submit();"'); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout" . DIRECTORY_SEPARATOR . "pages_final_confirm.php"; } if ($success) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "includes/functions_php.php"; $header = htmlspecialchars('<link type="text/css" rel="stylesheet" id="arrowchat_css" media="all" href="' . $_SESSION['config_path'] . 'external.php?type=css" charset="utf-8" /> <script type="text/javascript" src="' . $_SESSION['config_path'] . 'includes/js/jquery.js"></script> <script type="text/javascript" src="' . $_SESSION['config_path'] . 'includes/js/jquery-ui.js"></script>'); $footer = htmlspecialchars('<script type="text/javascript" src="' . $_SESSION['config_path'] . 'external.php?type=djs" charset="utf-8"></script> <script type="text/javascript" src="' . $_SESSION['config_path'] . 'external.php?type=js" charset="utf-8"></script>');
$_config .= "\$timeautoclose= " . $_POST['auto_close'] . ";\n"; $_config .= "\$autochecklink = " . (isset($_POST['autochecklink']) && $_POST['autochecklink'] == 'on' ? 'true' : 'false') . "; // Auto check submited link in audl\n\n"; $_config .= "\$mip_enabled= " . (isset($_POST['mip_enabled']) && $_POST['mip_enabled'] == 'on' ? 'true' : 'false') . "; //If you need to disable multiple ip support, set to false\n"; $_config .= "\$mip_arotate= " . (isset($_POST['mip_arotate']) && $_POST['mip_arotate'] == 'on' ? 'true' : 'false') . "; //Auto change to next ip after start transload process\n\n"; $_config .= "\$secretkey = '" . $_POST['secretkey'] . "';//Place your Secret Key\n"; $_config .= "\$iframealocate = " . $_POST['iframealocate'] . ";//how many iframe to allocate in audl for manual method.\n"; $_config .= "\$pointboost = " . $_POST['pointbooster'] . ";//boost your RS-Point with this feature!!\n"; $_config .= "\$autosubmit = true;\n\n"; $_config .= "\$timezone = " . $_POST['timezone'] . "; // set Timezone. It is GMT+(7) for Indonesia.\n"; $_config .= "\$lang = '" . $arlang[$_POST['language']] . "'; // set Language.\n\n"; //$_config .= "\$arCSS = getArrayfromfile(IMAGE_DIR, 'style_sujancok_', '.css');\n"; $_config .= "\$csstype = '" . $arCSS[$_POST['theme']] . "'; // set Theme to your RL. eg. _default\n"; $_config .= "?>"; $close_config_page = false; // SAVING CONFIG $buffer_TEXT .= write_config_file($fileconfig, $_config); if ($close_config_page) { if ($saved_success) { $arfield = array("oth" => "", "acc" => "", "up" => ""); foreach ($ar_chkbox_othr_acc as $key => $_opremix) { $arfield["oth"] .= "'" . $_opremix . "'" . ($key != count($ar_chkbox_othr_acc) - 1 ? ", " : ""); } foreach ($ar_chkbox_acc as $key => $_premix) { $arfield["acc"] .= "'" . $_premix . "'" . ($key != count($ar_chkbox_acc) - 1 ? ", " : ""); } foreach ($ar_chkbox_up_acc as $key => $_upremix) { $arfield["up"] .= "'" . $_upremix . "'" . ($key != count($ar_chkbox_up_acc) - 1 ? ", " : ""); } $buff_cleancookie_js = "\n<script type=\"text/javascript\">\n var tmpCk = new Object();\n tmpCk['custom_rlck'] = Array('rl_ajax');\n tmpCk['arfield_oth'] = Array(" . $arfield["oth"] . ");\n tmpCk['arfield_acc'] = Array(" . $arfield["acc"] . ");\n tmpCk['arfield_up'] = Array(" . $arfield["up"] . ");\n for(var subCok in tmpCk){\n ckRec = tmpCk[subCok];\n for(var i=0; i<ckRec.length; i++){deleteCookie(ckRec[i], dirpath, '');} \n }\n try{document.getElementById('btn_back').focus()}catch(e){};\n</script>"; $buffer_TEXT .= $buff_cleancookie_js; }