本文整理汇总了PHP中Functions_Lib::get_default_vacation_time方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::get_default_vacation_time方法的具体用法?PHP Functions_Lib::get_default_vacation_time怎么用?PHP Functions_Lib::get_default_vacation_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::get_default_vacation_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$mode = isset($_GET['mode']) ? $_GET['mode'] : NULL;
if ($_POST && $mode == 'exit') {
if (isset($_POST['exit_modus']) && $_POST['exit_modus'] == 'on' and $this->_current_user['setting_vacations_until'] <= time()) {
$urlaubs_modus = '0';
parent::$db->query("UPDATE " . SETTINGS . ", " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_status` = '0',\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_until` = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_metal_mine_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_crystal_mine_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_deuterium_sintetizer_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_solar_plant_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_fusion_reactor_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_ship_solar_satellite_porcent = '10'\r\n\t\t\t\t\t\t\t\t\t\tWHERE `setting_user_id` = '" . intval($this->_current_user['user_id']) . "' AND planet_user_id = '" . intval($this->_current_user['user_id']) . "'");
Functions_Lib::redirect('game.php?page=options');
} else {
$urlaubs_modus = '1';
Functions_Lib::redirect('game.php?page=options');
}
}
if ($_POST && $mode == "change") {
// < ------------------------------------------------- COMPROBACION DE IP -------------------------------------------------- >
if (isset($_POST['noipcheck']) && $_POST['noipcheck'] == 'on') {
$noipcheck = '1';
} else {
$noipcheck = '0';
}
// < ------------------------------------------------- NOMBRE DE USUARIO --------------------------------------------------- >
if (isset($_POST['db_character']) && $_POST['db_character'] != '') {
$username = parent::$db->escape_value($_POST['db_character']);
} else {
$username = parent::$db->escape_value($this->_current_user['user_name']);
}
// < ------------------------------------------------- DIRECCION DE EMAIL -------------------------------------------------- >
if (isset($_POST['db_email']) && $_POST['db_email'] != '') {
$db_email = parent::$db->escape_value($_POST['db_email']);
} else {
$db_email = parent::$db->escape_value($this->_current_user['user_email']);
}
// < ------------------------------------------------- CANTIDAD DE SONDAS -------------------------------------------------- >
if (isset($_POST['spio_anz']) && is_numeric($_POST['spio_anz'])) {
$spio_anz = intval($_POST['spio_anz']);
} else {
$spio_anz = '1';
}
// < ------------------------------------------------- MENSAJES DE FLOTAS -------------------------------------------------- >
if (isset($_POST['settings_fleetactions']) && is_numeric($_POST['settings_fleetactions'])) {
$settings_fleetactions = intval($_POST['settings_fleetactions']);
} else {
$settings_fleetactions = '1';
}
// < ------------------------------------------------- SONDAS DE ESPIONAJE ------------------------------------------------- >
if (isset($_POST['settings_esp']) && $_POST['settings_esp'] == 'on') {
$settings_esp = '1';
} else {
$settings_esp = '0';
}
// < ------------------------------------------------- ESCRIBIR MENSAJE ---------------------------------------------------- >
if (isset($_POST['settings_wri']) && $_POST['settings_wri'] == 'on') {
$settings_wri = '1';
} else {
$settings_wri = '0';
}
// < --------------------------------------------- AÑADIR A LISTA DE AMIGOS ------------------------------------------------ >
if (isset($_POST['settings_bud']) && $_POST['settings_bud'] == 'on') {
$settings_bud = '1';
} else {
$settings_bud = '0';
}
// < ------------------------------------------------- ATAQUE CON MISILES -------------------------------------------------- >
if (isset($_POST['settings_mis']) && $_POST['settings_mis'] == 'on') {
$settings_mis = '1';
} else {
$settings_mis = '0';
}
// < ------------------------------------------------- VER REPORTE --------------------------------------------------------- >
if (isset($_POST['settings_rep']) && $_POST['settings_rep'] == 'on') {
$settings_rep = '1';
} else {
$settings_rep = '0';
}
// < ------------------------------------------------- MODO VACACIONES ----------------------------------------------------- >
if (isset($_POST['urlaubs_modus']) && $_POST['urlaubs_modus'] == 'on') {
if ($this->CheckIfIsBuilding()) {
Functions_Lib::message($this->_lang['op_cant_activate_vacation_mode'], "game.php?page=options", 2);
}
$urlaubs_modus = '1';
$time = Functions_Lib::get_default_vacation_time();
parent::$db->query("UPDATE " . SETTINGS . ", " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_status` = '{$urlaubs_modus}',\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_until` = '{$time}',\r\n\t\t\t\t\t\t\t\t\t\tplanet_metal_perhour = '" . Functions_Lib::read_config('metal_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_crystal_perhour = '" . Functions_Lib::read_config('crystal_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_deuterium_perhour = '" . Functions_Lib::read_config('deuterium_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_energy_used = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_energy_max = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_metal_mine_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_crystal_mine_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_deuterium_sintetizer_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_solar_plant_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_fusion_reactor_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_ship_solar_satellite_porcent = '0'\r\n\t\t\t\t\t\t\t\t\t\tWHERE `setting_user_id` = '" . intval($this->_current_user['user_id']) . "' AND planet_user_id = '" . intval($this->_current_user['user_id']) . "'");
} else {
$urlaubs_modus = '0';
}
// < ------------------------------------------------- BORRAR CUENTA ------------------------------------------------------- >
if (isset($_POST['db_deaktjava']) && $_POST['db_deaktjava'] == 'on') {
$db_deaktjava = time();
} else {
$db_deaktjava = '0';
}
$SetSort = parent::$db->escape_value($_POST['settings_sort']);
$SetOrder = parent::$db->escape_value($_POST['settings_order']);
//// < -------------------------------------- ACTUALIZAR TODO LO SETEADO ANTES --------------------------------------------- >
parent::$db->query("UPDATE " . USERS . " AS u, " . SETTINGS . " AS s SET\r\n\t\t\t\t\t\t\t\t\tu.`user_email` = '{$db_email}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_no_ip_check` = '{$noipcheck}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_sort` = '{$SetSort}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_order` = '{$SetOrder}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_probes_amount` = '{$spio_anz}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_fleet_actions` = '{$settings_fleetactions}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_espionage` = '{$settings_esp}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_write` = '{$settings_wri}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_buddy` = '{$settings_bud}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_missile` = '{$settings_mis}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_vacations_status` = '{$urlaubs_modus}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_delete_account` = '{$db_deaktjava}'\r\n\t\t\t\t\t\t\t\t\tWHERE u.`user_id` = '" . $this->_current_user['user_id'] . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\ts.`setting_user_id` = '" . $this->_current_user['user_id'] . "'");
//.........这里部分代码省略.........
示例2: save_settings
/**
* method save_settings
* param
* return save settings for the current user
*/
private function save_settings()
{
$vacation_time = Functions_Lib::get_default_vacation_time();
// DEFAULT VACATION TIME BEFORE A USER CAN REMOVE IT
$setting_planet_sort = isset($_POST['setting_planet_sort']) ? (int) $_POST['setting_planet_sort'] : 0;
$setting_planet_order = isset($_POST['setting_planet_order']) ? (int) $_POST['setting_planet_order'] : 0;
$setting_no_ip_check = isset($_POST['setting_no_ip_check']) && $_POST['setting_no_ip_check'] == 'on' ? 1 : 0;
$setting_probes_amount = isset($_POST['setting_probes_amount']) ? (int) $_POST['setting_probes_amount'] : 0;
$setting_fleet_actions = isset($_POST['setting_fleet_actions']) ? (int) $_POST['setting_fleet_actions'] : 0;
$setting_galaxy_espionage = isset($_POST['setting_galaxy_espionage']) && $_POST['setting_galaxy_espionage'] == 'on' ? 1 : 0;
$setting_galaxy_write = isset($_POST['setting_galaxy_write']) && $_POST['setting_galaxy_write'] == 'on' ? 1 : 0;
$setting_galaxy_buddy = isset($_POST['setting_galaxy_buddy']) && $_POST['setting_galaxy_buddy'] == 'on' ? 1 : 0;
$setting_galaxy_missile = isset($_POST['setting_galaxy_missile']) && $_POST['setting_galaxy_missile'] == 'on' ? 1 : 0;
$setting_vacations_status = isset($_POST['setting_vacations_status']) && $_POST['setting_vacations_status'] == 'on' ? 1 : 0;
$setting_vacations_until = isset($_POST['setting_vacations_status']) && $_POST['setting_vacations_status'] == 'on' ? $vacation_time : 0;
$setting_delete_account = isset($_POST['setting_delete_account']) && $_POST['setting_delete_account'] == 'on' ? time() : 0;
// BUILD THE SPECIFIC QUERY
if ($this->_user_query['setting_vacations_status'] == 1 && $setting_vacations_status == 0) {
// WE HAVE TO REMOVE HIM FROM VACATION AND SET PLANET PRODUCTION
$vacation_head = " , " . PLANETS . " AS p";
$vacation_condition = " AND p.`planet_user_id` = '" . (int) $this->_id . "'";
$vacation_query = "\r\n\t\t\ts.`setting_vacations_status` = '{$setting_vacations_status}',\r\n\t\t\ts.`setting_vacations_until` = '{$setting_vacations_until}',\r\n\t\t\tp.`planet_building_metal_mine_porcent` = '10',\r\n\t\t\tp.`planet_building_crystal_mine_porcent` = '10',\r\n\t\t\tp.`planet_building_deuterium_sintetizer_porcent` = '10',\r\n\t\t\tp.`planet_building_solar_plant_porcent` = '10',\r\n\t\t\tp.`planet_building_fusion_reactor_porcent` = '10',\r\n\t\t\tp.`planet_ship_solar_satellite_porcent` = '10',";
} elseif ($this->_user_query['setting_vacations_status'] == 0 && $setting_vacations_status == 1) {
// WE HAVE TO ADD HIM TO VACATION AND REMOVE PLANET PRODUCTION
$vacation_head = " , " . PLANETS . " AS p";
$vacation_condition = " AND p.`planet_user_id` = '" . (int) $this->_id . "'";
$vacation_query = "\r\n\t\t\ts.`setting_vacations_status` = '{$setting_vacations_status}',\r\n\t\t\ts.`setting_vacations_until` = '{$setting_vacations_until}',\r\n\t\t\tp.`planet_metal_perhour` = '" . Functions_Lib::read_config('metal_basic_income') . "',\r\n\t\t\tp.`planet_crystal_perhour` = '" . Functions_Lib::read_config('crystal_basic_income') . "',\r\n\t\t\tp.`planet_deuterium_perhour` = '" . Functions_Lib::read_config('deuterium_basic_income') . "',\r\n\t\t\tp.`planet_energy_used` = '0',\r\n\t\t\tp.`planet_energy_max` = '0',\r\n\t\t\tp.`planet_building_metal_mine_porcent` = '0',\r\n\t\t\tp.`planet_building_crystal_mine_porcent` = '0',\r\n\t\t\tp.`planet_building_deuterium_sintetizer_porcent` = '0',\r\n\t\t\tp.`planet_building_solar_plant_porcent` = '0',\r\n\t\t\tp.`planet_building_fusion_reactor_porcent` = '0',\r\n\t\t\tp.`planet_ship_solar_satellite_porcent` = '0',";
} else {
$vacation_head = '';
$vacation_condition = '';
$vacation_query = '';
}
parent::$db->query("UPDATE " . SETTINGS . " AS s{$vacation_head} SET\r\n\t\t\t\t\t\t\t\t\t{$vacation_query}\r\n\t\t\t\t\t\t\t\t\ts.`setting_no_ip_check` = '{$setting_no_ip_check}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_sort` = '{$setting_planet_sort}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_order` = '{$setting_planet_order}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_probes_amount` = '{$setting_probes_amount}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_fleet_actions` = '{$setting_fleet_actions}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_espionage` = '{$setting_galaxy_espionage}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_write` = '{$setting_galaxy_write}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_buddy` = '{$setting_galaxy_buddy}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_missile` = '{$setting_galaxy_missile}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_delete_account` = '{$setting_delete_account}'\r\n\t\t\t\t\t\t\t\t\tWHERE s.`setting_user_id` = '{$this->_id}'{$vacation_condition}");
$this->_alert_info = $this->_lang['us_all_ok_message'];
$this->_alert_type = 'ok';
}