本文整理汇总了PHP中Functions_Lib::update_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::update_config方法的具体用法?PHP Functions_Lib::update_config怎么用?PHP Functions_Lib::update_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::update_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
$error = '';
if (isset($_POST['save'])) {
if (isset($_POST['premium_url']) && !empty($_POST['premium_url'])) {
Functions_Lib::update_config('premium_url', Functions_Lib::prep_url($_POST['premium_url']));
} else {
$error .= $this->_lang['pr_error_url'];
}
if (isset($_POST['trader_darkmatter']) && $_POST['trader_darkmatter'] > 0) {
Functions_Lib::update_config('trader_darkmatter', $_POST['trader_darkmatter']);
} else {
$error .= $this->_lang['pr_error_trader'];
}
if ($error != '') {
$parse['alert'] = Administration_Lib::save_message('warning', $error);
} else {
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['pr_all_ok_message']);
}
}
$parse['premium_url'] = Functions_Lib::read_config('premium_url');
$parse['trader_darkmatter'] = Functions_Lib::read_config('trader_darkmatter');
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/premium_view'), $parse));
}
示例2: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$modules_array = '';
$modules_count = count(explode(';', Functions_Lib::read_config('modules')));
$row_template = parent::$page->get_template('adm/modules_row_view');
$module_rows = '';
$parse['alert'] = '';
// SAVE PAGE
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['save']) {
for ($i = 0; $i <= $modules_count - 2; $i++) {
$modules_array .= (isset($_POST["status{$i}"]) ? 1 : 0) . ';';
}
Functions_Lib::update_config('modules', $modules_array);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']);
}
// SHOW PAGE
$modules_array = explode(';', Functions_Lib::read_config('modules'));
foreach ($modules_array as $module => $status) {
if ($status != NULL) {
$parse['module'] = $module;
$parse['module_name'] = $this->_lang['module'][$module];
$parse['module_value'] = $status == 1 ? 'checked' : '';
$parse['color'] = $status == 1 ? 'text-success' : 'text-error';
$module_rows .= parent::$page->parse_template($row_template, $parse);
}
}
$parse['module_rows'] = $module_rows;
parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/modules_view"), $parse));
}
示例3: migrate_to_xml
/**
* @project XG Proyect
* @version 3.x.x build 0000
* @copyright Copyright (C) 2008 - 2014
*/
function migrate_to_xml()
{
$query = $db->query("SELECT * FROM " . DB_PREFIX . "config");
$search = array('�', '�', '�', '�', '"', '#', '$', '%', '(', ')', '�', '�', '|', '~');
$replace = array('¡', '¿', '°', 'ª', '"', '#', '$', '%', '(', ')', '¬', '€', '|', '~');
while ($row = $db->fetch_array($query)) {
if ($row['config_name'] != 'BuildLabWhileRun') {
Functions_Lib::update_config(strtolower($row['config_name']), str_replace($search, $replace, $row['config_value']));
}
}
}
示例4: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
if (isset($_POST['opt_save']) && $_POST['opt_save'] == '1') {
// CHECK BEFORE SAVE
$this->run_validations();
Functions_Lib::update_config('game_name', $this->_game_config['game_name']);
Functions_Lib::update_config('game_logo', $this->_game_config['game_logo']);
Functions_Lib::update_config('lang', $this->_game_config['lang']);
Functions_Lib::update_config('game_speed', $this->_game_config['game_speed']);
Functions_Lib::update_config('fleet_speed', $this->_game_config['fleet_speed']);
Functions_Lib::update_config('resource_multiplier', $this->_game_config['resource_multiplier']);
Functions_Lib::update_config('admin_email', $this->_game_config['admin_email']);
Functions_Lib::update_config('forum_url', $this->_game_config['forum_url']);
Functions_Lib::update_config('reg_enable', $this->_game_config['reg_enable']);
Functions_Lib::update_config('game_enable', $this->_game_config['game_enable']);
Functions_Lib::update_config('close_reason', $this->_game_config['close_reason']);
Functions_Lib::update_config('ssl_enabled', $this->_game_config['ssl_enabled']);
Functions_Lib::update_config('date_time_zone', $this->_game_config['date_time_zone']);
Functions_Lib::update_config('date_format', $this->_game_config['date_format']);
Functions_Lib::update_config('date_format_extended', $this->_game_config['date_format_extended']);
Functions_Lib::update_config('adm_attack', $this->_game_config['adm_attack']);
Functions_Lib::update_config('debug', $this->_game_config['debug']);
Functions_Lib::update_config('fleet_cdr', $this->_game_config['fleet_cdr']);
Functions_Lib::update_config('defs_cdr', $this->_game_config['defs_cdr']);
Functions_Lib::update_config('noobprotection', $this->_game_config['noobprotection']);
Functions_Lib::update_config('noobprotectiontime', $this->_game_config['noobprotectiontime']);
Functions_Lib::update_config('noobprotectionmulti', $this->_game_config['noobprotectionmulti']);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']);
}
$parse['game_name'] = $this->_game_config['game_name'];
$parse['game_logo'] = $this->_game_config['game_logo'];
$parse['language_settings'] = Functions_Lib::get_languages($this->_game_config['lang']);
$parse['game_speed'] = $this->_game_config['game_speed'] / 2500;
$parse['fleet_speed'] = $this->_game_config['fleet_speed'] / 2500;
$parse['resource_multiplier'] = $this->_game_config['resource_multiplier'];
$parse['admin_email'] = $this->_game_config['admin_email'];
$parse['forum_url'] = $this->_game_config['forum_url'];
$parse['closed'] = $this->_game_config['game_enable'] == 1 ? " checked = 'checked' " : "";
$parse['close_reason'] = stripslashes($this->_game_config['close_reason']);
$parse['ssl_enabled'] = $this->_game_config['ssl_enabled'] == 1 ? " checked = 'checked' " : "";
$parse['date_time_zone'] = $this->time_zone_picker();
$parse['date_format'] = $this->_game_config['date_format'];
$parse['date_format_extended'] = $this->_game_config['date_format_extended'];
$parse['adm_attack'] = $this->_game_config['adm_attack'] == 1 ? " checked = 'checked' " : "";
$parse['debug'] = $this->_game_config['debug'] == 1 ? " checked = 'checked' " : "";
$parse['shiips'] = $this->_game_config['fleet_cdr'];
$parse['defenses'] = $this->_game_config['defs_cdr'];
$parse['noobprot'] = $this->_game_config['noobprotection'] == 1 ? " checked = 'checked' " : "";
$parse['noobprot2'] = $this->_game_config['noobprotectiontime'];
$parse['noobprot3'] = $this->_game_config['noobprotectionmulti'];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/server_view'), $parse));
}
示例5: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
// RUN STATISTICS SCRIPT AND THE SET THE RESULT
$result = Statistics_Lib::make_stats();
// PREPARE DATA TO PARSE
$parse = $this->_lang;
$parse['memory_p'] = str_replace(array("%p", "%m"), $result['memory_peak'], $this->_lang['sb_top_memory']);
$parse['memory_e'] = str_replace(array("%e", "%m"), $result['end_memory'], $this->_lang['sb_final_memory']);
$parse['memory_i'] = str_replace(array("%i", "%m"), $result['initial_memory'], $this->_lang['sb_start_memory']);
$parse['alert'] = Administration_Lib::save_message('ok', str_replace("%t", $result['totaltime'], $this->_lang['sb_stats_update']));
// UPDATE STATISTICS LAST UPDATE
Functions_Lib::update_config('stat_last_update', $result['stats_time']);
// SHOW TEMPLATE
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/buildstats_view'), $parse));
}
示例6: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
if (isset($_POST['opt_save']) && $_POST['opt_save'] == '1') {
// CHECK BEFORE SAVE
$this->run_validations();
Functions_Lib::update_config('reg_enable', $this->_game_config['reg_enable']);
Functions_Lib::update_config('reg_welcome_message', $this->_game_config['reg_welcome_message']);
Functions_Lib::update_config('reg_welcome_email', $this->_game_config['reg_welcome_email']);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['ur_all_ok_message']);
}
$parse['reg_closed'] = $this->_game_config['reg_enable'] == 1 ? " checked = 'checked' " : "";
$parse['reg_welcome_message'] = $this->_game_config['reg_welcome_message'] == 1 ? " checked = 'checked' " : "";
$parse['reg_welcome_email'] = $this->_game_config['reg_welcome_email'] == 1 ? " checked = 'checked' " : "";
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/registration_view'), $parse));
}
示例7: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
if (isset($_POST['opt_save']) && $_POST['opt_save'] == '1') {
// CHECK BEFORE SAVE
$this->run_validations();
Functions_Lib::update_config('initial_fields', $this->_game_config['initial_fields']);
Functions_Lib::update_config('metal_basic_income', $this->_game_config['metal_basic_income']);
Functions_Lib::update_config('crystal_basic_income', $this->_game_config['crystal_basic_income']);
Functions_Lib::update_config('deuterium_basic_income', $this->_game_config['deuterium_basic_income']);
Functions_Lib::update_config('energy_basic_income', $this->_game_config['energy_basic_income']);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['np_all_ok_message']);
}
$parse['initial_fields'] = $this->_game_config['initial_fields'];
$parse['metal_basic_income'] = $this->_game_config['metal_basic_income'];
$parse['crystal_basic_income'] = $this->_game_config['crystal_basic_income'];
$parse['deuterium_basic_income'] = $this->_game_config['deuterium_basic_income'];
$parse['energy_basic_income'] = $this->_game_config['energy_basic_income'];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/planets_view'), $parse));
}
示例8: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$game_stat = Functions_Lib::read_config('stat');
$game_stat_level = Functions_Lib::read_config('stat_level');
$game_stat_settings = Functions_Lib::read_config('stat_settings');
$game_stat_update_time = Functions_Lib::read_config('stat_update_time');
$this->_lang['alert'] = '';
if (isset($_POST['save']) && $_POST['save'] == $this->_lang['cs_save_changes']) {
if (isset($_POST['stat']) && $_POST['stat'] != $game_stat) {
Functions_Lib::update_config('stat', $_POST['stat']);
$game_stat = $_POST['stat'];
$ASD3 = $_POST['stat'];
}
if (isset($_POST['stat_level']) && is_numeric($_POST['stat_level']) && $_POST['stat_level'] != $game_stat_level) {
Functions_Lib::update_config('stat_level', $_POST['stat_level']);
$game_stat_level = $_POST['stat_level'];
$ASD1 = $_POST['stat_level'];
}
if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings']) && $_POST['stat_settings'] != $game_stat_settings) {
Functions_Lib::update_config('stat_settings', $_POST['stat_settings']);
$game_stat_settings = $_POST['stat_settings'];
}
if (isset($_POST['stat_update_time']) && is_numeric($_POST['stat_update_time']) && $_POST['stat_update_time'] != $game_stat_update_time) {
Functions_Lib::update_config('stat_update_time', $_POST['stat_update_time']);
$game_stat_update_time = $_POST['stat_update_time'];
}
$this->_lang['alert'] = Administration_Lib::save_message('ok', $this->_lang['cs_all_ok_message']);
}
$selected = "selected=\"selected\"";
$stat = $game_stat == 1 ? 'sel_sta1' : 'sel_sta0';
$this->_lang[$stat] = $selected;
$this->_lang['stat_level'] = $game_stat_level;
$this->_lang['stat_settings'] = $game_stat_settings;
$this->_lang['stat_update_time'] = $game_stat_update_time;
$this->_lang['yes'] = $this->_lang['cs_yes'][1];
$this->_lang['no'] = $this->_lang['cs_no'][0];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/statistics_view'), $this->_lang));
}
示例9: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
// ON POST
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// SAVE DATA
if (isset($_POST['save']) && $_POST['save']) {
Functions_Lib::update_config('auto_backup', isset($_POST['auto_backup']) && $_POST['auto_backup'] == 'on' ? 1 : 0);
}
// BACKUP DATABASE RIGHT NOW
if (isset($_POST['backup']) && $_POST['backup']) {
$result = parent::$db->backup_db();
if ($result != FALSE) {
$parse['alert'] = Administration_Lib::save_message('ok', str_replace('%s', round($result / 1024, 2), $this->_lang['bku_backup_done']));
}
}
}
// PARSE DATA
$auto_backup_status = Functions_Lib::read_config('auto_backup');
$parse['color'] = $auto_backup_status == 1 ? 'text-success' : 'text-error';
$parse['checked'] = $auto_backup_status == 1 ? 'checked' : '';
parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/backup_view"), $parse));
}
示例10: createAccount
/**
* method createAccount
* param
* return TRUE successfully created admin | FALSE an error ocurred
*/
private function createAccount()
{
// validations
if (empty($_POST['adm_user']) or empty($_POST['adm_pass']) or empty($_POST['adm_email']) or !Functions_Lib::valid_email($_POST['adm_email'])) {
return false;
}
// some default values
$adm_name = parent::$db->escape_value($_POST['adm_user']);
$adm_email = parent::$db->escape_value($_POST['adm_email']);
$adm_pass = sha1($_POST['adm_pass']);
// a bunch of of queries :/
parent::$db->query("INSERT INTO " . USERS . " SET\n `user_id` = '1',\n `user_name` = '" . $adm_name . "',\n `user_email` = '" . $adm_email . "',\n `user_email_permanent` = '" . $adm_email . "',\n `user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\n `user_agent` = '',\n `user_authlevel` = '3',\n `user_home_planet_id` = '1',\n `user_galaxy` = '1',\n `user_system` = '1',\n `user_planet` = '1',\n `user_current_planet` = '1',\n `user_register_time` = '" . time() . "',\n `user_password` = '" . $adm_pass . "';");
$this->_planet->createPlanetWithOptions(array('planet_user_id' => 1, 'planet_name' => $adm_name, 'planet_galaxy' => 1, 'planet_system' => 1, 'planet_planet' => 1, 'planet_last_update' => time(), 'planet_metal' => 500, 'planet_crystal' => 500, 'planet_deuterium' => 0));
parent::$db->query("INSERT INTO " . RESEARCH . " SET `research_user_id` = '1';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET `user_statistic_user_id` = '1';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET `premium_user_id` = '1';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET `setting_user_id` = '1';");
parent::$db->query("INSERT INTO " . BUILDINGS . " SET `building_planet_id` = '1';");
parent::$db->query("INSERT INTO " . DEFENSES . " SET `defense_planet_id` = '1';");
parent::$db->query("INSERT INTO " . SHIPS . " SET `ship_planet_id` = '1';");
// write the new admin email for support and debugging
Functions_Lib::update_config('admin_email', $adm_email);
return true;
}
示例11: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
if (isset($_POST['mode']) && $_POST['mode']) {
$view_m = isset($_POST['view_m']) ? $this->set_rank($_POST['view_m']) : '';
$edit_m = isset($_POST['edit_m']) ? $this->set_rank($_POST['edit_m']) : '';
$config_m = isset($_POST['config_m']) ? $this->set_rank($_POST['config_m']) : '';
$tools_m = isset($_POST['tools_m']) ? $this->set_rank($_POST['tools_m']) : '';
$log_m = isset($_POST['log_m']) ? $this->set_rank($_POST['log_m']) : '';
$maintenance_m = isset($_POST['maintenance_m']) ? $this->set_rank($_POST['maintenance_m']) : '';
$view_o = isset($_POST['view_o']) ? $this->set_rank($_POST['view_o']) : '';
$edit_o = isset($_POST['edit_o']) ? $this->set_rank($_POST['edit_o']) : '';
$config_o = isset($_POST['config_o']) ? $this->set_rank($_POST['config_o']) : '';
$tools_o = isset($_POST['tools_o']) ? $this->set_rank($_POST['tools_o']) : '';
$log_o = isset($_POST['log_o']) ? $this->set_rank($_POST['log_o']) : '';
$maintenance_o = isset($_POST['maintenance_o']) ? $this->set_rank($_POST['maintenance_o']) : '';
$log_a = isset($_POST['log_a']) ? $this->set_rank($_POST['log_a']) : '';
$QueryEdit = $view_m . "," . $edit_m . "," . $config_m . "," . $tools_m . "," . $log_m . "," . $maintenance_m . ";" . $view_o . "," . $edit_o . "," . $config_o . "," . $tools_o . "," . $log_o . "," . $maintenance_o . ";" . $log_a . ";";
Functions_Lib::update_config('moderation', $QueryEdit);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['mod_all_ok_message']);
}
$QueryModeration = Functions_Lib::read_config('moderation');
$QueryModerationEx = explode(";", $QueryModeration);
$Moderator = explode(",", $QueryModerationEx[0]);
$Operator = explode(",", $QueryModerationEx[1]);
$Administrator = explode(",", $QueryModerationEx[2]);
// MODERADORES
if ($Moderator[0] == 1) {
$parse['view_m'] = 'checked = "checked"';
}
if ($Moderator[1] == 1) {
$parse['edit_m'] = 'checked = "checked"';
}
if ($Moderator[2] == 1) {
$parse['config_m'] = 'checked = "checked"';
}
if ($Moderator[3] == 1) {
$parse['tools_m'] = 'checked = "checked"';
}
if ($Moderator[4] == 1) {
$parse['log_m'] = 'checked = "checked"';
}
if ($Moderator[5] == 1) {
$parse['maintenance_m'] = 'checked = "checked"';
}
// OPERADORES
if ($Operator[0] == 1) {
$parse['view_o'] = 'checked = "checked"';
}
if ($Operator[1] == 1) {
$parse['edit_o'] = 'checked = "checked"';
}
if ($Operator[2] == 1) {
$parse['config_o'] = 'checked = "checked"';
}
if ($Operator[3] == 1) {
$parse['tools_o'] = 'checked = "checked"';
}
if ($Operator[4] == 1) {
$parse['log_o'] = 'checked = "checked"';
}
if ($Operator[5] == 1) {
$parse['maintenance_o'] = 'checked = "checked"';
}
// ADMINISTRADOR (SOLO PARA EL HISTORIAL)
if ($Administrator[0] == 1) {
$parse['log_a'] = 'checked = "checked"';
}
$parse['mods'] = $this->_lang['user_level'][1];
$parse['oper'] = $this->_lang['user_level'][2];
$parse['adm'] = $this->_lang['user_level'][3];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/moderation_view'), $parse));
}
示例12: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
if ($_POST) {
if (!$this->run_validations()) {
Functions_Lib::redirect('index.php');
} else {
$user_password = $_POST['password'];
$user_name = $_POST['character'];
$user_email = $_POST['email'];
$hashed_password = sha1($user_password);
parent::$db->query("INSERT INTO " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_name` = '" . parent::$db->escape_value(strip_tags($user_name)) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_email` = '" . parent::$db->escape_value($user_email) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_email_permanent` = '" . parent::$db->escape_value($user_email) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_agent` = '" . $_SERVER['HTTP_USER_AGENT'] . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '0',\r\n\t\t\t\t\t\t\t\t\t\t`user_register_time` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_password`='" . $hashed_password . "';");
$user_id = parent::$db->insert_id();
parent::$db->query("INSERT INTO " . RESEARCH . " SET\r\n\t\t\t\t\t\t\t\t\t\t`research_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_statistic_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET\r\n\t\t\t\t\t\t\t\t\t\t`premium_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '" . $user_id . "';");
$last_galaxy = Functions_Lib::read_config('lastsettedgalaxypos');
$last_system = Functions_Lib::read_config('lastsettedsystempos');
$last_planet = Functions_Lib::read_config('lastsettedplanetpos');
while (!isset($newpos_checked)) {
for ($galaxy = $last_galaxy; $galaxy <= MAX_GALAXY_IN_WORLD; $galaxy++) {
for ($system = $last_system; $system <= MAX_SYSTEM_IN_GALAXY; $system++) {
for ($pos = $last_planet; $pos <= 4; $pos++) {
$planet = round(mt_rand(4, 12));
switch ($last_planet) {
case 1:
$last_planet += 1;
break;
case 2:
$last_planet += 1;
break;
case 3:
if ($last_system == MAX_SYSTEM_IN_GALAXY) {
$last_galaxy += 1;
$last_system = 1;
$last_planet = 1;
break;
} else {
$last_planet = 1;
}
$last_system += 1;
break;
}
break;
}
break;
}
break;
}
$planet_row = parent::$db->query_fetch("SELECT *\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' LIMIT 1;");
if ($planet_row['id'] == '0') {
$newpos_checked = TRUE;
}
if (!$planet_row) {
$this->_creator->create_planet($galaxy, $system, $planet, $user_id, '', TRUE);
$newpos_checked = TRUE;
}
if ($newpos_checked) {
Functions_Lib::update_config('lastsettedgalaxypos', $last_galaxy);
Functions_Lib::update_config('lastsettedsystempos', $last_system);
Functions_Lib::update_config('lastsettedplanetpos', $last_planet);
}
}
parent::$db->query("UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = (SELECT `planet_id` FROM " . PLANETS . " WHERE `planet_user_id` = '" . $user_id . "' LIMIT 1),\r\n\t\t\t\t\t\t\t\t\t\t`user_current_planet` = (SELECT `planet_id` FROM " . PLANETS . " WHERE `planet_user_id` = '" . $user_id . "' LIMIT 1),\r\n\t\t\t\t\t\t\t\t\t\t`user_galaxy` = '" . $galaxy . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_system` = '" . $system . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_planet` = '" . $planet . "'\r\n\t\t\t\t\t\t\t\t\t\t WHERE `user_id` = '" . $user_id . "' LIMIT 1;");
$from = $this->_lang['re_welcome_message_from'];
$subject = $this->_lang['re_welcome_message_subject'];
$message = str_replace('%s', $user_name, $this->_lang['re_welcome_message_content']);
// Send Welcome Message to the user if the feature is enabled
if (Functions_Lib::read_config('reg_welcome_message')) {
Functions_Lib::send_message($user_id, 0, '', 5, $from, $subject, $message);
}
// Send Welcome Email to the user if the feature is enabled
if (Functions_Lib::read_config('reg_welcome_email')) {
$this->send_pass_email($user_email, $user_name, $user_password);
}
// User login
if (parent::$users->user_login($user_id, $user_name, $hashed_password)) {
// Redirect to game
Functions_Lib::redirect('game.php?page=overview');
}
}
}
// If login fails
Functions_Lib::redirect('index.php');
}
示例13: updateStatistics
/**
* updateStatistics
*
* @return void
*/
private function updateStatistics()
{
// LAST UPDATE AND UPDATE INTERVAL, EX: 15 MINUTES
$stat_last_update = Functions_Lib::read_config('stat_last_update');
$update_interval = Functions_Lib::read_config('stat_update_time');
if (time() >= $stat_last_update + 60 * $update_interval) {
$result = Statistics_Lib::make_stats();
Functions_Lib::update_config('stat_last_update', $result['stats_time']);
}
}
示例14: install_navbar
/**
* method install_navbar
* param
* return install navigation bar
*/
private function install_navbar()
{
// Update config language to the new setted value
if (isset($_POST['language'])) {
Functions_Lib::update_config('lang', $_POST['language']);
Functions_Lib::redirect(XGP_ROOT . 'install/');
}
$current_page = isset($_GET['page']) ? $_GET['page'] : NULL;
$items = '';
$pages = array(0 => array('install', $this->_lang['ins_overview'], 'overview'), 1 => array('install', $this->_lang['ins_license'], 'license'), 2 => array('install', $this->_lang['ins_install'], 'step1'), 3 => array('update', $this->_lang['ins_update'], ''), 4 => array('migrate', $this->_lang['ins_migrate'], ''));
// BUILD THE MENU
foreach ($pages as $key => $data) {
if ($data[2] != '') {
// URL
$items .= '<li' . ($current_page == $data[0] ? ' class="active"' : '') . '><a href="index.php?page=' . $data[0] . '&mode=' . $data[2] . '">' . $data[1] . '</a></li>';
} else {
// URL
$items .= '<li' . ($current_page == $data[0] ? ' class="active"' : '') . '><a href="index.php?page=' . $data[0] . '">' . $data[1] . '</a></li>';
}
}
// PARSE THE MENU AND OTHER DATA
$parse = $this->_lang;
$parse['menu_items'] = $items;
$parse['language_select'] = Functions_Lib::get_languages(Functions_Lib::read_config('lang'));
return $this->parse_template($this->get_template('install/topnav_view'), $parse);
}
示例15: create_account
/**
* method create_account
* param
* return TRUE successfully created admin | FALSE an error ocurred
*/
private function create_account()
{
// validations
if (empty($_POST['adm_user']) or empty($_POST['adm_pass']) or empty($_POST['adm_email']) or !Functions_Lib::valid_email($_POST['adm_email'])) {
return FALSE;
}
// some default values
$adm_name = parent::$db->escape_value($_POST['adm_user']);
$adm_email = parent::$db->escape_value($_POST['adm_email']);
$adm_pass = sha1($_POST['adm_pass']);
// a bunch of of queries :/
parent::$db->query("INSERT INTO " . USERS . " SET\r\n\t\t\t\t\t\t\t\t`user_id` = '1',\r\n\t\t\t\t\t\t\t\t`user_name` = '" . $adm_name . "',\r\n\t\t\t\t\t\t\t\t`user_email` = '" . $adm_email . "',\r\n\t\t\t\t\t\t\t\t`user_email_permanent` = '" . $adm_email . "',\r\n\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\r\n\t\t\t\t\t\t\t\t`user_agent` = '',\r\n\t\t\t\t\t\t\t\t`user_authlevel` = '3',\r\n\t\t\t\t\t\t\t\t`user_home_planet_id` = '1',\r\n\t\t\t\t\t\t\t\t`user_galaxy` = '1',\r\n\t\t\t\t\t\t\t\t`user_system` = '1',\r\n\t\t\t\t\t\t\t\t`user_planet` = '1',\r\n\t\t\t\t\t\t\t\t`user_current_planet` = '1',\r\n\t\t\t\t\t\t\t\t`user_register_time` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t`user_password` = '" . $adm_pass . "';");
parent::$db->query("INSERT INTO " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t`planet_user_id` = '1',\r\n\t\t\t\t\t\t\t\t`planet_galaxy` = '1',\r\n\t\t\t\t\t\t\t\t`planet_system` = '1',\r\n\t\t\t\t\t\t\t\t`planet_planet` = '1',\r\n\t\t\t\t\t\t\t\t`planet_last_update` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t`planet_metal` = '500',\r\n\t\t\t\t\t\t\t\t`planet_crystal` = '500',\r\n\t\t\t\t\t\t\t\t`planet_deuterium` = '0';");
parent::$db->query("INSERT INTO " . RESEARCH . " SET\r\n\t\t\t\t\t\t\t\t`research_user_id` = '1';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\r\n\t\t\t\t\t\t\t\t`user_statistic_user_id` = '1';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET\r\n\t\t\t\t\t\t\t\t`premium_user_id` = '1';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '1';");
parent::$db->query("INSERT INTO " . BUILDINGS . " SET\r\n\t\t\t\t\t\t\t\t`building_planet_id` = '1';");
parent::$db->query("INSERT INTO " . DEFENSES . " SET\r\n\t\t\t\t\t\t\t\t`defense_planet_id` = '1';");
parent::$db->query("INSERT INTO " . SHIPS . " SET\r\n\t\t\t\t\t\t\t\t`ship_planet_id` = '1';");
// write the new admin email for support and debugging
Functions_Lib::update_config('admin_email', $adm_email);
return TRUE;
}