本文整理汇总了PHP中sys_get_param_int函数的典型用法代码示例。如果您正苦于以下问题:PHP sys_get_param_int函数的具体用法?PHP sys_get_param_int怎么用?PHP sys_get_param_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sys_get_param_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sn_ube_simulator_fleet_converter
function sn_ube_simulator_fleet_converter($sym_attacker, $sym_defender)
{
$combat_data = array(UBE_OPTIONS => array(UBE_SIMULATOR => sys_get_param_int('simulator'), UBE_MISSION_TYPE => MT_ATTACK), UBE_PLAYERS => array(), UBE_FLEETS => array());
sn_ube_simulator_fill_side($combat_data, $sym_defender, false);
sn_ube_simulator_fill_side($combat_data, $sym_attacker, true);
return $combat_data;
}
示例2: scheduler_process
function scheduler_process()
{
global $config, $user, $debug, $lang;
$is_admin_request = false;
$ts_var_stat_update = strtotime($config->db_loadItem('var_stat_update'));
$ts_scheduled_update = sys_schedule_get_prev_run($config->db_loadItem('stats_schedule'), $config->var_stat_update);
if (sys_get_param_int('admin_update')) {
define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1);
if (USER_LEVEL > 0) {
$is_admin_request = true;
$ts_scheduled_update = SN_TIME_NOW;
}
}
if ($ts_scheduled_update > $ts_var_stat_update) {
lng_include('admin');
sn_db_transaction_start();
$ts_var_stat_update_end = strtotime($config->db_loadItem('var_stat_update_end'));
if (SN_TIME_NOW > $ts_var_stat_update_end) {
$old_server_status = $config->db_loadItem('game_disable');
$config->db_saveItem('game_disable', GAME_DISABLE_STAT);
$config->db_saveItem('var_stat_update_end', date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($config->db_loadItem('stats_minimal_interval') ? $config->stats_minimal_interval : 600)));
$config->db_saveItem('var_stat_update_msg', 'Update started');
sn_db_transaction_commit();
$msg = $is_admin_request ? 'admin request' : 'scheduler';
$next_run = date(FMT_DATE_TIME_SQL, sys_schedule_get_prev_run($config->stats_schedule, $config->var_stat_update, true));
$msg = "Running stat updates: {$msg}. Config->var_stat_update = " . $config->var_stat_update . ', $ts_scheduled_update = ' . date(FMT_DATE_TIME_SQL, $ts_scheduled_update) . ', next_stat_update = ' . $next_run;
$debug->warning($msg, 'Stat update', LOG_INFO_STAT_PROCESS);
$total_time = microtime(true);
// require_once('../includes/sys_stat.php');
require_once SN_ROOT_PHYSICAL . 'includes/includes/sys_stat.php';
sys_stat_calculate();
$total_time = microtime(true) - $total_time;
$msg = "Stat update complete in {$total_time} seconds.";
$debug->warning($msg, 'Stat update', LOG_INFO_STAT_PROCESS);
$msg = "{$lang['adm_done']}: {$total_time} {$lang['sys_sec']}.";
// . date(FMT_DATE_TIME, $ts_scheduled_update) . ' ' . date(FMT_DATE_TIME, $config->var_stat_update);
// TODO: Analyze maintenance result. Add record to log if error. Add record to log if OK
$maintenance_result = sys_maintenance();
$config->db_saveItem('var_stat_update', SN_TIME_SQL);
$config->db_saveItem('var_stat_update_msg', $msg);
$config->db_saveItem('var_stat_update_next', $next_run);
$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_SQL);
$config->db_saveItem('var_stat_update_end', SN_TIME_SQL);
$config->db_saveItem('game_disable', $old_server_status);
} elseif ($ts_scheduled_update > $ts_var_stat_update) {
$timeout = strtotime($config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW;
$msg = $config->db_loadItem('var_stat_update_msg');
$msg = "{$msg} ETA {$timeout} seconds. Please wait...";
}
sn_db_transaction_rollback();
} elseif ($is_admin_request) {
$msg = 'Stat is up to date';
}
return $msg;
}
示例3: sys_avatar_upload
function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar')
{
global $config, $lang, $user;
try {
$avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id;
$avatar_filename .= '.png';
$fullsize_filename .= '_full.png';
if (sys_get_param_int('avatar_remove')) {
if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
}
$avatar_field = 0;
throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
} elseif ($_FILES['avatar']['size']) {
if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) {
throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
}
if ($_FILES['avatar']['error']) {
throw new Exception(sprintf($lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR);
}
if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) {
throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
}
$avatar_size = getimagesize($_FILES['avatar']['tmp_name']);
$avatar_max_width = $config->avatar_max_width;
$avatar_max_height = $config->avatar_max_height;
if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) {
$aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]);
$avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio);
$result = imagecopyresized($avatar_image_new, $avatar_image, 0, 0, 0, 0, $avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio, $avatar_size[0], $avatar_size[1]);
imagedestroy($avatar_image);
$avatar_image = $avatar_image_new;
}
if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
}
if (!imagepng($avatar_image, $avatar_filename, 9)) {
throw new Exception($lang['opt_msg_avatar_error_writing'], ERR_ERROR);
}
$avatar_field = 1;
imagedestroy($avatar_image);
throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE);
}
} catch (Exception $e) {
return array('STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, 'MESSAGE' => $e->getMessage());
}
}
示例4: user_time_diff_probe
static function user_time_diff_probe()
{
// Определяем время в браузере
$client_time = strtotime(sys_get_param('client_gmt'));
// Попытка определить по GMT-времени браузера. В нём будет часовой пояс (GMT), поэтому время будет автоматически преобразовано в часовой пояс сервера
!$client_time ? $client_time = round(sys_get_param_float('timeBrowser') / 1000) : false;
// Попытка определить по Date.valueOf() - миллисекунды с начала эпохи UNIX_TIME
!$client_time ? $client_time = SN_TIME_NOW : false;
// Если все попытки провалились - тупо берем время сервера
// TODO - REMOVE
// !($client_time = strtotime(sys_get_param('client_gmt'))) // Время в браузере определяется через GMT
// ? (!($client_time = sys_get_param_float('timeBrowser') / 1000)
// ? $client_time = SN_TIME_NOW : false)
// : false;
// !($client_time = strtotime(sys_get_param('client_gmt'))) // Время в браузере определяется через GMT
// ? $client_time = SN_TIME_NOW
// : false;
$result = array(PLAYER_OPTION_TIME_DIFF => $client_time - SN_TIME_NOW, PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => ($browser_utc_offset = sys_get_param_int('utc_offset')) ? $browser_utc_offset - date('Z') : 0, PLAYER_OPTION_TIME_DIFF_FORCED => sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED'), PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL);
return $result;
}
示例5: sys_get_param_str
$detail_url = sys_get_param_str('detail_url');
$mode = sys_get_param_str('mode');
if ($sys_user_logged_in) {
doquery("UPDATE {{users}} SET `news_lastread` = 0 WHERE `id` = {$user['id']} LIMIT 1;");
}
if ($user['authlevel'] >= 3) {
if (!empty($text)) {
$idAnnounce = sys_get_param_int('id');
$dtDateTime = empty($announce_time) ? "FROM_UNIXTIME(" . time() . ")" : "'{$announce_time}'";
if ($mode == 'edit') {
doquery("UPDATE {{announce}} SET `tsTimeStamp`={$dtDateTime}, `strAnnounce`='{$text}', detail_url = '{$detail_url}' WHERE `idAnnounce`={$idAnnounce}");
} else {
doquery("INSERT INTO {{announce}} SET `tsTimeStamp`={$dtDateTime}, `strAnnounce`='{$text}', detail_url = '{$detail_url}'");
}
doquery("UPDATE {{users}} SET `news_lastread` = `news_lastread` + 1;");
if (sys_get_param_int('news_mass_mail')) {
$text = $_POST['text'];
if ($detail_url) {
// TODO: Move merging detail url to template
$text = "{$text} <a href=\"{$detail_url}\">{$lang['news_more']}</a>";
}
msg_send_simple_message('*', 0, 0, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['news_title'], $text);
}
$mode = '';
}
switch ($mode) {
case 'del':
doquery("DELETE FROM {{announce}} WHERE `idAnnounce`={$announce_id} LIMIT 1;");
$mode = '';
break;
case 'edit':
示例6: ceil
$blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
$row['blitz_online'] ? $blitz_prize_players_active++ : false;
$blitz_players++;
}
$blitz_prize_dark_matter = $blitz_prize_players_active * 20000;
$blitz_prize_places = ceil($blitz_prize_players_active / 5);
/*
'Игрок10'
'Игрок14'
'Игрок23'
'Игрок32'
'Игрок40'
*/
if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
// $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
$blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
sn_db_transaction_start();
$query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;");
while ($row = db_fetch($query)) {
if (!$row['blitz_place']) {
continue;
}
$blitz_prize_dark_matter_actual = round($blitz_prize_dark_matter_actual / 2);
$blitz_prize_places_actual--;
$reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
if ($reward) {
rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf($lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']));
doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ({$reward}) WHERE id = {$row['id']} AND `round_number` = {$current_round};");
}
if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
示例7: array
$sym_attacker = $_POST['attacker'] ? $_POST['attacker'] : array();
if ($replay) {
$unpacked = sn_ube_simulator_decode_replay($replay);
$sym_defender = $unpacked['D'];
$sym_attacker = $unpacked['A'];
} else {
$sym_defender = array(0 => $sym_defender);
$sym_attacker = array(1 => $sym_attacker);
}
if ($_POST['submit'] || $execute) {
$replay = sn_ube_simulator_encode_replay($sym_defender, 'D');
$replay .= sn_ube_simulator_encode_replay($sym_attacker, 'A');
$combat_data = sn_ube_simulator_fleet_converter($sym_attacker, $sym_defender);
$combat_data[UBE_OPTIONS][UBE_METHOD] = $config->game_ube_method ? $config->game_ube_method : 0;
sn_ube_combat($combat_data);
if (!sys_get_param_int('simulator') || sys_get_param_str('reload')) {
sn_ube_report_save($combat_data);
}
if (sys_get_param_str('reload')) {
$combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]);
}
//debug($combat_data);
// Рендерим их в темплейт
sn_ube_report_generate($combat_data, $template_result);
$template_result['MICROTIME'] = $combat_data[UBE_TIME_SPENT];
$template = gettemplate('ube_combat_report', true);
$template->assign_recursive($template_result);
display($template, '', false, '', false, false, true);
} else {
$template = gettemplate('simulator', true);
$techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL);
示例8: sys_get_param_str
$action = sys_get_param_str('action');
$player_banned_row = db_user_by_username($name_unsafe);
if ($mode == 'banit' && $action) {
if ($player_banned_row) {
$reas = $_POST['why'];
$days = $_POST['days'];
$hour = $_POST['hour'];
$mins = $_POST['mins'];
$secs = $_POST['secs'];
// $isVacation = $_POST['isVacation'];
$BanTime = $days * 86400;
$BanTime += $hour * 3600;
$BanTime += $mins * 60;
$BanTime += $secs;
// $BannedUntil = SN_TIME_NOW + $BanTime;
sys_admin_player_ban($user, $player_banned_row, $BanTime, $is_vacation = sys_get_param_int('isVacation'), sys_get_param_str('why'));
$DoneMessage = "{$lang['adm_bn_thpl']} {$name_output} {$lang['adm_bn_isbn']}";
if ($is_vacation) {
$DoneMessage .= $lang['adm_bn_vctn'];
}
$DoneMessage .= $lang['adm_bn_plnt'];
} else {
$DoneMessage = sprintf($lang['adm_bn_errr'], $name_output);
}
AdminMessage($DoneMessage, $lang['adm_ban_title']);
} elseif ($mode == 'unbanit' && $action) {
sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : $lang['sys_unbanned']);
$DoneMessage = $lang['adm_unbn_thpl'] . " " . $name_output . " " . $lang['adm_unbn_isbn'];
AdminMessage($DoneMessage, $lang['adm_unbn_ttle']);
}
$parse['name'] = $name_output;
示例9: elseif
} elseif (sys_get_param_str('abandon')) {
//if(sec_password_encode(sys_get_param('abandon_confirm'), $user['salt']) == $user['password']) {
if (sec_password_check($user, sys_get_param('abandon_confirm'))) {
if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
$destroyed = SN_TIME_NOW + 60 * 60 * 24;
db_planet_set_by_id($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0");
db_planet_set_by_parent($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0");
db_user_set_by_id($user['id'], '`current_planet` = `id_planet`');
message($lang['ov_delete_ok'], $lang['colony_abandon'], 'overview.php?mode=manage');
} else {
message($lang['ov_delete_wrong_planet'], $lang['colony_abandon'], 'overview.php?mode=manage');
}
} else {
message($lang['ov_delete_wrong_pass'], $lang['colony_abandon'], 'overview.php?mode=manage');
}
} elseif (($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) && (!get_unit_param($hire, P_MAX_STACK) || $planetrow['PLANET_GOVERNOR_ID'] != $hire || $planetrow['PLANET_GOVERNOR_ID'] == $hire && $planetrow['PLANET_GOVERNOR_LEVEL'] < get_unit_param($hire, P_MAX_STACK))) {
sn_db_transaction_start();
$user = db_user_by_id($user['id'], true);
$planetrow = db_planet_by_id($planetrow['id'], true);
$build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
if ($build_data['CAN'][BUILD_CREATE]) {
if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
$planetrow['PLANET_GOVERNOR_LEVEL']++;
$query = '`PLANET_GOVERNOR_LEVEL` + 1';
} else {
$planetrow['PLANET_GOVERNOR_LEVEL'] = 1;
$planetrow['PLANET_GOVERNOR_ID'] = $hire;
$query = '1';
}
db_planet_set_by_id($planetrow['id'], "`PLANET_GOVERNOR_ID` = {$hire}, `PLANET_GOVERNOR_LEVEL` = {$query}");
rpg_points_change($user['id'], RPG_GOVERNOR, -$build_data[BUILD_CREATE][RES_DARK_MATTER], sprintf($lang['ov_governor_purchase'], $lang['tech'][$hire], $hire, $planetrow['PLANET_GOVERNOR_LEVEL'], uni_render_planet_full($planetrow, '', false, true)));
示例10: sys_get_param_float
$config->uni_price_galaxy = sys_get_param_float('uni_price_galaxy');
$config->uni_price_system = sys_get_param_float('uni_price_system');
$config->user_birthday_gift = sys_get_param_float('user_birthday_gift');
$config->user_birthday_range = sys_get_param_int('user_birthday_range');
$config->stats_hide_admins = sys_get_param_int('stats_hide_admins');
$config->stats_hide_player_list = sys_get_param_str('stats_hide_player_list');
$config->stats_hide_pm_link = sys_get_param_int('stats_hide_pm_link');
$config->stats_schedule = sys_get_param_str('stats_schedule');
$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period');
if ($config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
if ($config->empire_mercenary_temporary) {
db_unit_list_admin_delete_mercenaries_finished();
} else {
db_unit_list_admin_set_mercenaries_expire_time($config->empire_mercenary_base_period);
}
$config->empire_mercenary_temporary = sys_get_param_int('empire_mercenary_temporary');
}
$config->db_saveAll();
$template->assign_var('MESSAGE', $lang['adm_opt_saved']);
}
$template->assign_vars(array('ALLOW_BUFFING' => $config->allow_buffing, 'ALLY_HELP_WEAK' => $config->ally_help_weak, 'GAME_EMAIL_PM' => $config->game_email_pm, 'game_mode' => $config->game_mode, 'game_language' => $config->game_default_language, 'ECO_SCALE_STORAGE' => $config->eco_scale_storage, 'USER_VACATION_DISABLE' => $config->user_vacation_disable, 'ADV_LEFT_MENU' => $config->advGoogleLeftMenuIsOn, 'GAME_DISABLE' => $config->game_disable, 'GAME_DEBUG' => $config->debug, 'GAME_COUNTER' => $config->game_counter, 'TPL_MINIFIER' => $config->tpl_minifier, 'EMPIRE_MERCENARY_TEMPORARY' => $config->empire_mercenary_temporary, 'SERVER_UPDATE_CHECK_AUTO' => $config->server_updater_check_auto, 'CHECK_DATE' => $config->server_updater_check_last ? date(FMT_DATE_TIME, $config->server_updater_check_last) : 0, 'CHECK_RESULT' => isset($lang['adm_opt_ver_response'][$config->server_updater_check_result]) ? $lang['adm_opt_ver_response'][$config->server_updater_check_result] : $lang['adm_opt_ver_response'][SNC_VER_UNKNOWN_RESPONSE], 'CHECK_CLASS' => isset($sn_version_check_class[$config->server_updater_check_result]) ? $sn_version_check_class[$config->server_updater_check_result] : $sn_version_check_class[SNC_VER_UNKNOWN_RESPONSE], 'SERVER_UPDATE_ID' => $config->server_updater_id, 'SERVER_UPDATE_KEY' => $config->server_updater_key, 'STATS_HIDE_ADMINS' => $config->stats_hide_admins, 'STATS_HIDE_PM_LINK' => $config->stats_hide_pm_link));
foreach ($lang['sys_game_disable_reason'] as $id => $name) {
$template->assign_block_vars('sys_game_disable_reason', array('ID' => $id, 'NAME' => $name));
}
foreach ($lang['sys_game_mode'] as $mode_id => $mode_name) {
$template->assign_block_vars('game_modes', array('ID' => $mode_id, 'NAME' => $mode_name));
}
foreach ($lang['adm_opt_ver_response'] as $ver_id => $ver_response) {
$template->assign_block_vars('ver_response', array('ID' => $ver_id, 'NAME' => js_safe_string($ver_response)));
}
$lang_list = lng_get_list();
示例11: substr
<?php
/**
* login.php
*
* @version 2.0 Security checks & tests by Gorlum for http://supernova.ws
* @version 1.1 Security checks & tests by Gorlum for http://supernova.ws
* @version 1.0
* @copyright 2008 by ?????? for XNova
*/
include 'includes/init.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('login');
lng_include('admin');
$id_ref = sys_get_param_int('id_ref');
$username = sys_get_param('username');
$password = sys_get_param('password');
if ($username) {
$result = sn_login($username, $password, $_POST['rememberme']);
switch ($result['status']) {
case LOGIN_SUCCESS:
$user = $result['user_row'];
header('Location: overview.php');
break;
case LOGIN_ERROR_USERNAME:
case LOGIN_ERROR_PASSWORD:
message($result['error_msg'], $lang['Login_Error']);
break;
default:
}
die;
} elseif (!empty($_COOKIE[$config->COOKIE_NAME])) {
示例12: implode
if ($message_class_id != MSG_TYPE_OUTBOX) {
$SubUpdateQry[] = "`{$message_class['name']}` = '0'";
$user[$message_class['name']] = 0;
}
}
$SubUpdateQry = implode(',', $SubUpdateQry);
} else {
$SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'";
$SubSelectQry = "AND `message_type` = '{$current_class}'";
$user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']];
$user[$sn_message_class_list[$current_class]['name']] = 0;
}
doquery("UPDATE {{users}} SET {$SubUpdateQry} WHERE `id` = '{$user['id']}' LIMIT 1;");
$message_query = "SELECT * FROM {{messages}} WHERE `message_owner` = '{$user['id']}' {$SubSelectQry} ORDER BY `message_time` DESC;";
}
if (sys_get_param_int('return')) {
header('Location: messages.php');
die;
}
$template = gettemplate('msg_message_list', true);
$message_query = doquery($message_query);
while ($message_row = mysql_fetch_assoc($message_query)) {
$template->assign_block_vars('messages', array('ID' => $message_row['message_id'], 'DATE' => date(FMT_DATE_TIME, $message_row['message_time']), 'FROM' => htmlspecialchars($message_row['message_from']), 'SUBJ' => htmlspecialchars($message_row['message_subject']), 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), 'FROM_ID' => $message_row['message_sender'], 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name']));
}
$current_class_text = $lang['msg_class'][$current_class];
$template->assign_vars(array("MESSAGE_CLASS" => $current_class, "MESSAGE_CLASS_TEXT" => $current_class_text));
break;
}
if (!$template) {
$template = gettemplate('msg_message_class', true);
$query = doquery("SELECT message_owner, message_type, COUNT(message_owner) AS message_count FROM {{messages}} WHERE `message_owner` = {$user['id']} GROUP BY message_owner, message_type ORDER BY message_owner ASC, message_type;");
示例13: substr
<?php
require_once 'includes/init.' . substr(strrchr(__FILE__, '.'), 1);
$mode = sys_get_param_int('mode');
$ajax = sys_get_param_int('ajax');
$url = 'http://supernova.ws/version_check.php?mode=' . $mode . '&db=' . DB_VERSION . '&release=' . SN_RELEASE . '&version=' . SN_VERSION . '&key=' . urlencode($config->server_updater_key) . '&id=' . urlencode($config->server_updater_id);
/*
//TODO REMOVE DEBUG!!!
$url = 'http://localhost/supernova_site/version_check.php?mode=' . $mode
. '&db=' . DB_VERSION
. '&release=' . SN_RELEASE
. '&version=' . SN_VERSION
. '&key=' . urlencode($config->server_updater_key)
. '&id=' . urlencode($config->server_updater_id);
*/
switch ($mode) {
case SNC_MODE_REGISTER:
if ($config->server_updater_key || $config->server_updater_id) {
if ($ajax) {
print SNC_VER_REGISTER_ERROR_REGISTERED;
}
die;
}
$url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
//TODO REMOVE DEBUG!!!
//$url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode('http://supernova.ws/');
break;
}
$check_result = sn_get_url_contents($url);
if (!$check_result) {
$version_check = SNC_VER_ERROR_CONNECT;
示例14: substr
<?php
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
if (sys_get_param_str('return_fleet')) {
$fleet_id = sys_get_param_int('fleet_id');
if ($fleet_id) {
$FleetRow = doquery("SELECT * FROM {{fleets}} WHERE `fleet_id` = '{$fleet_id}' LIMIT 1;", '', true);
if ($FleetRow['fleet_owner'] == $user['id'] && $FleetRow['fleet_mess'] == 0) {
$ReturnFlyingTime = ($FleetRow['fleet_end_stay'] != 0 && $FleetRow['fleet_start_time'] < $time_now ? $FleetRow['fleet_start_time'] : $time_now) - $FleetRow['start_time'] + $time_now + 1;
doquery("UPDATE {{fleets}} SET `fleet_start_time` = '{$time_now}', `fleet_group` = 0, `fleet_end_stay` = '0', `fleet_end_time` = '{$ReturnFlyingTime}', `fleet_target_owner` = '{$user['id']}', `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_id}' LIMIT 1;");
// if($FleetRow['fleet_mission'] == MT_AKS)
if ($FleetRow['fleet_group']) {
// TODO: Make here to delete only one AKS - by adding aks_fleet_count to AKS table
doquery('DELETE FROM {{aks}} WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM {{fleets}});');
}
} elseif ($FleetRow['fleet_id'] && $FleetRow['fleet_owner'] != $user['id']) {
$debug->warning('Trying to return fleet that not belong to user', 'Hack attempt', 302, array('base_dump' => true, 'fleet_row' => $FleetRow));
die('Hack attempt 302');
}
}
}
lng_include('overview');
lng_include('fleet');
$parse = $lang;
if (!$planetrow) {
$parse_err['title'] = $lang['fl_error'];
$parse_err['mes'] = $lang['fl_noplanetrow'];
$parse['ErrorNoPlanetRow'] = parsetemplate(gettemplate('message_body'), $parse_err);
}
CheckPlanetUsedFields($planetrow);
$template = gettemplate('flying_fleets', true);
示例15: que_build
function que_build($user, $planet, $build_mode = BUILD_CREATE, $redirect = true)
{
global $lang;
$unit_amount_qued = 0;
try {
if (!$user['id']) {
throw new exception('{Нет идентификатора пользователя - сообщите Администрации}', ERR_ERROR);
// TODO EXCEPTION
}
$unit_id = sys_get_param_int('unit_id');
/*
if(!$unit_id && is_array($unit_list = sys_get_param('fmenge')))
{
foreach($unit_list as $unit_id => $unit_amount) if($unit_amount) break;
}
*/
if (!$unit_id) {
throw new exception('{Нет идентификатора юнита - сообщите Администрации}', ERR_ERROR);
// TODO EXCEPTION
}
$que_id = que_get_unit_que($unit_id);
if (!$que_id) {
throw new exception('{Неправильный тип очереди - сообщите Администрации}', ERR_ERROR);
// TODO EXCEPTION
}
if ($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) {
throw new exception('{Уничтожать можно только здания на планете}', ERR_ERROR);
// TODO EXCEPTION
}
$que_data = sn_get_groups('ques');
$que_data = $que_data[$que_id];
// die();
// TODO Переделать под подочереди
if ($que_id == QUE_STRUCTURES) {
$sn_groups_build_allow = sn_get_groups('build_allow');
$que_data['unit_list'] = $sn_groups_build_allow[$planet['planet_type']];
if (!isset($que_data['unit_list'][$unit_id])) {
throw new exception('{Это здание нельзя строить на ' . ($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR);
// TODO EXCEPTION
}
}
/*
// TODO Разделить очереди для Верфи и Обороны
elseif($que_id == QUE_HANGAR)
{
$que_data['mercenary'] = in_array($unit_id, sn_get_groups('defense')) ? MRC_FORTIFIER : MRC_ENGINEER;
}
elseif($que_id == QUE_HANGAR)
{
$que_data['mercenary'] = in_array($unit_id, sn_get_groups('defense')) ? MRC_FORTIFIER : MRC_ENGINEER;
}
*/
sn_db_transaction_start();
// Это нужно, что бы заблокировать пользователя и работу с очередями
$user = db_user_by_id($user['id']);
// Это нужно, что бы заблокировать планету от списания ресурсов
if (isset($planet['id']) && $planet['id']) {
$planet = db_planet_by_id($planet['id'], true);
} else {
$planet['id'] = 0;
}
$planet_id = $que_id == QUE_RESEARCH ? 0 : intval($planet['id']);
$que = que_get($user['id'], $planet['id'], $que_id, true);
$in_que =& $que['in_que'][$que_id][$user['id']][$planet_id];
$que_max_length = que_get_max_que_length($user, $planet, $que_id, $que_data);
// TODO Добавить вызовы функций проверок текущей и максимальной длин очередей
if (count($in_que) >= $que_max_length) {
throw new exception('{Все слоты очереди заняты}', ERR_ERROR);
// TODO EXCEPTION
}
// TODO Отдельно посмотреть на уничтожение зданий - что бы можно было уничтожать их без планов
switch (eco_can_build_unit($user, $planet, $unit_id)) {
case BUILD_ALLOWED:
break;
case BUILD_UNIT_BUSY:
throw new exception('{Строение занято}', ERR_ERROR);
break;
// TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading
// case BUILD_REQUIRE_NOT_MEET:
// TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading
// case BUILD_REQUIRE_NOT_MEET:
default:
if ($build_mode == BUILD_CREATE) {
throw new exception('{Требования не удовлетворены}', ERR_ERROR);
}
break;
// TODO EXCEPTION eco_bld_msg_err_requirements_not_meet
}
$unit_amount = floor(sys_get_param_float('unit_amount', 1));
$unit_amount_qued = $unit_amount;
$units_qued = isset($in_que[$unit_id]) ? $in_que[$unit_id] : 0;
$unit_level = mrc_get_level($user, $planet, $unit_id, true, true) + $units_qued;
if ($unit_max = get_unit_param($unit_id, P_MAX_STACK)) {
if ($unit_level >= $unit_max) {
throw new exception('{Максимальное количество юнитов данного типа уже достигнуто или будет достигнуто по окончанию очереди}', ERR_ERROR);
// TODO EXCEPTION
}
$unit_amount = max(0, min($unit_amount, $unit_max - $unit_level));
}
if ($unit_amount < 1) {
//.........这里部分代码省略.........