本文整理汇总了PHP中sys_get_param_str函数的典型用法代码示例。如果您正苦于以下问题:PHP sys_get_param_str函数的具体用法?PHP sys_get_param_str怎么用?PHP sys_get_param_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sys_get_param_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sn_admin_planet_edit_mode
function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
{
global $lang;
$admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array('structures' => $lang['tech'][UNIT_STRUCTURES], 'fleet' => $lang['tech'][UNIT_SHIPS], 'defense' => $lang['tech'][UNIT_DEFENCE], 'resources_loot' => $lang['tech'][UNIT_RESOURCES]));
$mode = sys_get_param_str('mode');
$admin_planet_edit_mode_list_keys = array_keys($admin_planet_edit_mode_list);
$mode = in_array($mode, $admin_planet_edit_mode_list_keys) ? $mode : $admin_planet_edit_mode_list_keys[0];
return $mode;
}
开发者ID:divyinfo,项目名称:SuperNova,代码行数:9,代码来源:admin_planet_edit.inc.php
示例2: sn_battle_report_view
function sn_battle_report_view($template = null)
{
global $template_result, $lang;
require_once 'includes/includes/ube_report.php';
$combat_data = sn_ube_report_load(sys_get_param_str('cypher'));
if ($combat_data != UBE_REPORT_NOT_FOUND) {
sn_ube_report_generate($combat_data, $template_result);
$template = gettemplate('ube_combat_report', $template);
} else {
message($lang['sys_msg_ube_report_err_not_found'], $lang['sys_error']);
}
return $template;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:13,代码来源:battle_report.php
示例3: sys_user_vacation
/**
* Created by PhpStorm.
* User: Gorlum
* Date: 17.04.2015
* Time: 6:37
*/
function sys_user_vacation($user)
{
global $config;
if (sys_get_param_str('vacation') == 'leave') {
if ($user['vacation'] < SN_TIME_NOW) {
$user['vacation'] = 0;
$user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
db_user_set_by_id($user['id'], "`vacation` = {$user['vacation']}, `vacation_next` = {$user['vacation_next']}");
}
}
if ($user['vacation']) {
sn_sys_logout(false, true);
$template = gettemplate('vacation', true);
$template->assign_vars(array('NAME' => $user['username'], 'VACATION_END' => date(FMT_DATE_TIME, $user['vacation']), 'CAN_LEAVE' => $user['vacation'] <= SN_TIME_NOW, 'RANDOM' => mt_rand(1, 2)));
display(parsetemplate($template), '', false, '', false, false);
}
return false;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:24,代码来源:sys_user.php
示例4: sn_chat_msg_view
function sn_chat_msg_view($template = null)
{
global $config, $skip_fleet_update, $user, $lang;
define('IN_AJAX', true);
$skip_fleet_update = true;
$history = sys_get_param_str('history');
if (!$history) {
$config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
}
$page = 0;
$last_message = '';
$alliance = 0;
$template_result['.']['chat'] = array();
if (!$history && $config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) {
$result['disable'] = true;
$template_result['.']['chat'][] = array('TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), 'DISABLE' => true);
} else {
$alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
$page_limit = 20;
// Chat rows Limit
$where_add = '';
$last_message = 0;
if ($history) {
$rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", true);
$page_count = ceil($rows['CNT'] / $page_limit);
for ($i = 0; $i < $page_count; $i++) {
$template_result['.']['page'][] = array('NUMBER' => $i);
}
$page = min($page_count, max(0, sys_get_param_int('sheet')));
} else {
$last_message = sys_get_param_id('last_message');
$where_add = $last_message ? "AND `messageid` > {$last_message}" : '';
}
$start_row = $page * $page_limit;
$query = doquery("SELECT c.*, u.authlevel\n FROM\n {{chat}} AS c\n LEFT JOIN {{users}} AS u ON u.id = c.chat_message_sender_id\n WHERE c.chat_message_recipient_id IS NULL AND c.ally_id = '{$alliance}' {$where_add} ORDER BY messageid DESC LIMIT {$start_row}, {$page_limit};");
while ($chat_row = db_fetch($query)) {
// Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
$chat_row['user'] = player_nick_render_to_html($chat_row['user']);
$nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8');
$nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']);
if (!$history) {
$nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>";
}
$template_result['.']['chat'][] = array('TIME' => cht_message_parse(date(FMT_DATE_TIME, $chat_row['timestamp'] + SN_CLIENT_TIME_DIFF)), 'NICK' => $nick, 'TEXT' => cht_message_parse($chat_row['message'], false, intval($chat_row['authlevel'])));
$last_message = max($last_message, $chat_row['messageid']);
}
}
$template_result['.']['chat'] = array_reverse($template_result['.']['chat']);
$template_result += array('PAGE' => $page, 'ALLY' => $alliance, 'HISTORY' => $history);
$template = gettemplate('chat_messages', $template);
$template->assign_recursive($template_result);
if ($history) {
display($template, "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true);
} else {
$result['last_message'] = $last_message;
ob_start();
displayP($template);
$result['html'] = ob_get_contents();
ob_end_clean();
print json_encode($result);
}
die;
}
开发者ID:divyinfo,项目名称:SuperNova,代码行数:63,代码来源:chat.php
示例5: sys_get_param_str_raw
$msg_sent = true;
} else {
$recipient_name = sys_get_param_str_raw('recipient_name');
$subject = sys_get_param_str_raw('subject');
$text = sys_get_param_str_raw('text');
}
}
$subject = $subject ? $subject : $lang['msg_subject_default'];
$template->assign_vars(array('RECIPIENT_ID' => $recipient_id, 'RECIPIENT_NAME' => $recipient_name, 'SUBJECT' => $subject, 'TEXT' => $text));
foreach ($error_list as $error_message) {
$template->assign_block_vars('messages', $error_message);
}
break;
case 'delete':
$query_add = '';
$message_range = sys_get_param_str('message_range');
switch ($message_range) {
case 'unchecked':
case 'checked':
$marked_message_list = sys_get_param('mark', array());
if ($message_range == 'checked' && empty($marked_message_list)) {
break;
}
$query_add = implode(',', $marked_message_list);
if ($query_add) {
$query_add = "IN ({$query_add})";
if ($message_range == 'unchecked') {
$query_add = "NOT {$query_add}";
}
$query_add = " AND `message_id` {$query_add}";
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:messages.php
示例6: iconv
if ($config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && $microtime - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) {
print iconv('CP1251', 'UTF-8', $lang['chat_timeout']);
die;
}
$history = sys_get_param_str('history');
/*
if(!$history && $microtime - $config->array_get('users', $user['id'], 'chat_last_refresh') < 1)
{
// print($microtime - $config->array_get('users', $user['id'], 'chat_last_refresh'));
die();
}
*/
$template = gettemplate('chat_messages', true);
$page_limit = 25;
// Chat rows Limit
$alliance = sys_get_param_str('ally');
if ($alliance && $user['ally_id']) {
$alliance = $user['ally_id'];
} else {
$alliance = 0;
}
if ($history) {
$rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", '', true);
$page_count = ceil($rows['CNT'] / $page_limit);
for ($i = 0; $i < $page_count; $i++) {
$template->assign_block_vars('page', array('NUMBER' => $i));
}
$page = min($page_count, sys_get_param_int('page'));
} else {
$page = 0;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:chat_msg.php
示例7: Exception
if ($new_password != sys_get_param('newpass2')) {
throw new Exception('', 2);
}
$user['password'] = md5($new_password);
// TODO: Change cookie to not force user relogin
setcookie(COOKIE_NAME, '', time() - 100000, '/', '', 0);
//le da el expire
$template->assign_var('CHANGE_PASS', -1);
} catch (Exception $e) {
$template->assign_var('CHANGE_PASS', $e->getCode());
}
}
$user['email'] = sys_get_param_str('db_email');
$user['dpath'] = sys_get_param_str('dpath');
$user['lang'] = $language = sys_get_param_str('langer', $language);
$user['avatar'] = sys_get_param_str('avatar');
$user['design'] = sys_get_param_int('design');
$user['noipcheck'] = sys_get_param_int('noipcheck');
$user['spio_anz'] = sys_get_param_int('spio_anz');
$user['settings_tooltiptime'] = sys_get_param_int('settings_tooltiptime');
$user['settings_fleetactions'] = sys_get_param_int('settings_fleetactions', 1);
$user['settings_allylogo'] = sys_get_param_int('settings_allylogo');
$user['settings_esp'] = sys_get_param_int('settings_esp');
$user['settings_wri'] = sys_get_param_int('settings_wri');
$user['settings_bud'] = sys_get_param_int('settings_bud');
$user['settings_mis'] = sys_get_param_int('settings_mis');
$user['settings_rep'] = sys_get_param_int('settings_rep');
$user['planet_sort'] = sys_get_param_int('settings_sort');
$user['planet_sort_order'] = sys_get_param_int('settings_order');
$user['deltime'] = !sys_get_param_int('db_deaktjava') ? 0 : ($user['deltime'] ? $user['deltime'] : $time_now + 604800);
doquery("UPDATE {{users}} SET\r\n `username` = '{$username}',\r\n `password` = '{$user['password']}',\r\n `email` = '{$user['email']}',\r\n `lang` = '{$user['lang']}',\r\n `avatar` = '{$user['avatar']}',\r\n `dpath` = '{$user['dpath']}',\r\n `design` = '{$user['design']}',\r\n `noipcheck` = '{$user['noipcheck']}',\r\n `planet_sort` = '{$user['planet_sort']}',\r\n `planet_sort_order` = '{$user['planet_sort_order']}',\r\n `spio_anz` = '{$user['spio_anz']}',\r\n `settings_tooltiptime` = '{$user['settings_tooltiptime']}',\r\n `settings_fleetactions` = '{$user['settings_fleetactions']}',\r\n `settings_allylogo` = '{$user['settings_allylogo']}',\r\n `settings_esp` = '{$user['settings_esp']}',\r\n `settings_wri` = '{$user['settings_wri']}',\r\n `settings_bud` = '{$user['settings_bud']}',\r\n `settings_mis` = '{$user['settings_mis']}',\r\n `settings_rep` = '{$user['settings_rep']}',\r\n `deltime` = '{$user['deltime']}',\r\n `kolorminus` = '{$user['kolorminus']}',\r\n `kolorplus` = '{$user['kolorplus']}',\r\n `kolorpoziom` = '{$user['kolorpoziom']}',\r\n `vacation` = '{$user['vacation']}',\r\n `options` = '{$user['options']}'\r\n WHERE `id` = '{$user['id']}' LIMIT 1");
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:options.php
示例8: sys_admin_player_ban
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;
$parse['mode'] = $mode;
display(parsetemplate(gettemplate("admin/admin_ban", true), $parse), $lang['adm_ban_title'], false, '', true);
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:banned.php
示例9: fwrite
fwrite($file_handler, "array(\r\n");
foreach ($string_value as $arr_name => $arr_data) {
adm_lng_write_string($arr_name, $arr_data, $ident . ' ', $string_name_prefix);
}
fwrite($file_handler, "{$ident}),\r\n");
}
fwrite($file_handler, "\r\n");
}
$template = gettemplate('admin/admin_locale', true);
lng_include('system');
lng_include('tech');
lng_include('admin');
$languages = array();
$language_domains = array();
$languages_info = lng_get_list();
$domain = sys_get_param_str('domain');
if ($domain) {
$lang_new = sys_get_param('lang_new');
if (!empty($lang_new)) {
$constants = get_defined_constants(true);
$constants = $constants['user'];
ksort($constants);
foreach ($languages_info as $lang_id => $land_data) {
$file_handler = fopen(SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php.new", 'w');
fwrite($file_handler, "<?php\r\n\r\n/*\r\n#############################################################################\n# Filename: {$domain}.mo.php\n# Project: SuperNova.WS\n# Website: http://www.supernova.ws\n# Description: Massive Multiplayer Online Browser Space Startegy Game\r\n#\r\n");
foreach ($land_data['LANG_COPYRIGHT'] as $lang_copyright) {
$lang_copyright = str_replace(array('©', '"', '<', '>'), array('©', '"', '<', '>'), $lang_copyright);
fwrite($file_handler, "# {$lang_copyright}\r\n");
}
fwrite($file_handler, "#############################################################################\r\n*/\r\n\n/**\r\n*\r\n* @package language\r\n* @system [{$land_data['LANG_NAME_ENGLISH']}]\r\n* @version " . SN_VERSION . "\r\n*\r\n*/\r\n\n/**\r\n* DO NOT CHANGE\r\n*/\r\n\r\nif (!defined('INSIDE')) die();\r\n\n\$a_lang_array = array(\r\n");
foreach ($lang_new as $string_name => $string_value) {
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:admin_locale.php
示例10: sys_get_param_float
$config->eco_planet_storage_deuterium = sys_get_param_float('eco_planet_storage_deuterium', BASE_STORAGE_SIZE);
$config->chat_timeout = sys_get_param_int('chat_timeout', 5);
$config->game_news_overview = sys_get_param_int('game_news_overview', 5);
$config->advGoogleLeftMenuIsOn = sys_get_param_int('advGoogleLeftMenuIsOn');
$config->advGoogleLeftMenuCode = sys_get_param('advGoogleLeftMenuCode');
$config->debug = sys_get_param_int('debug');
$config->game_counter = sys_get_param_int('game_counter');
$config->geoip_whois_url = sys_get_param_str('geoip_whois_url');
$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));
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:settings.php
示例11: define
* @version 1.1 - Remade with more robust template by Gorlum for http://supernova.ws
* @version 1.0s - Security checked for SQL-injection by Gorlum for http://supernova.ws
* @version 1
* @copyright 2008 By e-Zobar for XNova
*/
define('INSIDE', true);
define('INSTALL', false);
define('IN_ADMIN', true);
require '../common.' . substr(strrchr(__FILE__, '.'), 1);
if ($user['authlevel'] < 3) {
AdminMessage($lang['adm_err_denied']);
}
$parse = $lang;
// extract($_GET);
$delete = sys_get_param_str('delete');
$deleteall = sys_get_param_str('deleteall');
// Système de suppression
if ($delete) {
doquery("DELETE FROM {{chat}} WHERE `messageid`={$delete};");
} elseif ($deleteall == 'yes') {
doquery("DELETE FROM {{chat}};");
}
// Affichage des messages
$query = doquery("SELECT * FROM {{chat}} ORDER BY messageid DESC LIMIT 25;");
$i = 0;
while ($e = mysql_fetch_assoc($query)) {
$i++;
$parse['msg_list'] .= stripslashes("<tr>" . "<td class=n>{$e['messageid']}</td>" . "<td class=n><center>" . str_replace(' ', ' ', date(FMT_DATE_TIME, $e['timestamp'])) . "</center></td>" . "<td class=n><center>{$e['user']}</center></td>" . "<td class=b width=100%>" . nl2br($e['message']) . "<td class=n><center><a href=\"admin/admin_chat.php?delete={$e['messageid']}\"><img src=\"design/images/r1.png\"></a></center></td>" . "</td></tr>");
}
$parse['msg_num'] = $i;
display(parsetemplate(gettemplate('admin/admin_chat'), $parse), "Chat", false, '', true);
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:admin_chat.php
示例12: que_build
//.........这里部分代码省略.........
}
if ($unit_amount < 1) {
throw new exception('{Неправильное количество юнитов - сообщите Администрации}', ERR_ERROR);
// TODO EXCEPTION
}
/*
if($unit_max && $unit_level + $unit_amount > $unit_max)
{
throw new exception("Постройка {$unit_amount} {$lang['tech'][$unit_id]} приведет к привышению максимально возможного количества юнитов данного типа", ERR_ERROR); // TODO EXCEPTION
}
*/
// TODO Переделать eco_unit_busy для всех типов зданий
// if(eco_unit_busy($user, $planet, $que, $unit_id))
// {
// die('Unit busy'); // TODO EXCEPTION
// }
if (get_unit_param($unit_id, P_STACKABLE)) {
// TODO Поле 'max_Lot_size' для ограничения размера стэка в очереди - то ли в юниты, то ли в очередь
if (in_array($unit_id, $group_missile = sn_get_groups('missile'))) {
// TODO Поле 'container' - указывает на родительску структуру, в которой хранится данный юнит и по вместительности которой нужно применять размер юнита
$used_silo = 0;
foreach ($group_missile as $missile_id) {
$missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0;
$used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE);
}
$free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo;
if ($free_silo <= 0) {
throw new exception('{Ракетная шахта уже заполнена или будет заполнена по окончанию очереди}', ERR_ERROR);
// TODO EXCEPTION
}
$unit_size = get_unit_param($unit_id, P_UNIT_SIZE);
if ($free_silo < $unit_size) {
throw new exception("{В ракетной шахте нет места для {$lang['tech'][$unit_id]}}", ERR_ERROR);
// TODO EXCEPTION
}
$unit_amount = max(0, min($unit_amount, floor($free_silo / $unit_size)));
}
$unit_level = $new_unit_level = 0;
} else {
$unit_amount = 1;
if ($que_id == QUE_STRUCTURES) {
// if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $que['sectors'][$planet['id']] <= 0)
$sectors_qued = is_array($in_que) ? array_sum($in_que) : 0;
if ($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) {
throw new exception('{Не хватает секторов на планете}', ERR_ERROR);
// TODO EXCEPTION
}
// И что это я такое написал? Зачем?
//if($build_mode == BUILD_DESTROY && $planet['field_current'] <= $que['amounts'][$que_id])
//{
// die('Too much buildings'); // TODO EXCEPTION
//}
}
$build_multiplier = $build_mode == BUILD_CREATE ? 1 : -1;
$new_unit_level = $unit_level + $unit_amount * $build_multiplier;
}
$build_data = eco_get_build_data($user, $planet, $unit_id, $unit_level);
$unit_amount = min($build_data['CAN'][$build_mode], $unit_amount);
if ($unit_amount < 0) {
throw new exception('{Не хватает ресурсов}', ERR_ERROR);
// TODO EXCEPTION
}
if ($new_unit_level < 0) {
throw new exception('{Нельзя уничтожить больше юнитов, чем есть}', ERR_ERROR);
// TODO EXCEPTION
}
if ($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) {
throw new exception('{Строительство блокировано}', ERR_ERROR);
// TODO EXCEPTION
}
// $unit_amount = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW);
$unit_amount_qued = 0;
while ($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) {
$place = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW);
que_add_unit($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode);
$unit_amount -= $place;
$que = que_get($user['id'], $planet['id'], $que_id, true);
$unit_amount_qued += $place;
}
// pdump($que);
/*
pdump($que = que_get($user['id'], $planet['id'], $que_id, true));
*/
// die();
// if(count($que['ques'][$que_id][$user['id']][$planet_id]) >= $que_max_length)
sn_db_transaction_commit();
if ($redirect) {
sys_redirect("{$_SERVER['PHP_SELF']}?mode=" . sys_get_param_str('mode') . "&ally_id=" . sys_get_param_id('ally_id'));
die;
}
$operation_result = array('STATUS' => ERR_NONE, 'MESSAGE' => '{Строительство начато}');
} catch (exception $e) {
sn_db_transaction_rollback();
$operation_result = array('STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, 'MESSAGE' => $e->getMessage());
}
if (!empty($operation_result['MESSAGE'])) {
$operation_result['MESSAGE'] .= ' ' . ($unit_amount_qued ? $unit_amount_qued : $unit_amount) . 'x[' . $lang['tech'][$unit_id] . ']' . (isset($planet['id']) ? ' на ' . $planet['name'] : '') . '}';
}
return $operation_result;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:101,代码来源:eco_queue.php
示例13: substr
/**
* announce.php
*
* @v4 Security checks by Gorlum for http://supernova.ws
* @v2 (c) copyright 2010 by Gorlum for http://supernova.ws
* based on admin/activeplanet.php (c) 2008 for XNova
*/
$allow_anonymous = true;
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
$template = gettemplate('announce', true);
$announce_id = sys_get_param_int('id');
$text = sys_get_param_str('text');
$announce_time = sys_get_param_str('dtDateTime');
$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'];
开发者ID:sonicmaster,项目名称:RPG,代码行数:30,代码来源:announce.php
示例14: AdminMessage
AdminMessage($lang['adm_err_denied']);
}
$template = gettemplate("admin/adm_metamatter", true);
$message = '';
$message_status = ERR_ERROR;
if ($points = sys_get_param_float('points')) {
try {
$username = sys_get_param_str_unsafe('id_user');
if (empty($username)) {
throw new Exception($lang['adm_mm_no_dest']);
}
$an_account = new Account(classSupernova::$auth->account->db);
if (!$an_account->db_get_by_id($username) && !$an_account->db_get_by_name($username) && !$an_account->db_get_by_email($username)) {
throw new Exception(sprintf($lang['adm_mm_user_none'], $username));
}
if (!$an_account->metamatter_change(RPG_ADMIN, $points, sprintf($lang['adm_matter_change_log_record'], $an_account->account_id, db_escape($an_account->account_name), $user['id'], db_escape($user['username']), db_escape(sys_get_param_str('reason'))))) {
throw new Exception($lang['adm_mm_add_err']);
}
$message = sprintf($lang['adm_mm_user_added'], $an_account->account_name, $an_account->account_id, pretty_number($points));
$isNoError = true;
$message_status = ERR_NONE;
} catch (Exception $e) {
$message = $e->getMessage();
}
//} elseif($id_user) {
// // Points is empty but destination is set - this again means error
// $message = $lang['adm_mm_no_quant'];
}
if ($message_status == ERR_ERROR) {
$template->assign_vars(array('ID_USER' => $username, 'POINTS' => $points, 'REASON' => $reason));
}
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:adm_metamatter.php
示例15: doquery
$query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;");
while ($row = db_fetch($query)) {
$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};");
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:blitz_register.php
示例16: gettemplate
<?php
try {
$template = gettemplate('universe_rename', true);
if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) {
throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR);
}
if ($uni_system < 0 || $uni_system > $config->game_maxSystem) {
throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR);
}
$uni_row = doquery("select * from `{{universe}}` where `universe_galaxy` = {$uni_galaxy} and `universe_system` = {$uni_system} limit 1;", '', true);
$uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy;
$uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}"));
if (sys_get_param_str('uni_name_submit')) {
$uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name'));
$uni_price = sys_get_param_float('uni_price');
if ($uni_price < $uni_row['universe_price']) {
throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR);
}
$uni_row['universe_price'] = $uni_price;
sn_db_transaction_start();
$user = db_user_by_id($user['id'], true);
// if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price)
if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) {
throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR);
}
if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) {
throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR);
}
doquery("replace {{universe}} set `universe_galaxy` = {$uni_galaxy}, `universe_system` = {$uni_system}, `universe_name` = '{$uni_row['universe_name']}', `universe_price` = {$uni_row['universe_price']};");
$debug->warning(sprintf($lang['uni_msg_admin_rename'], $user['id'], $user['username'], $uni_price, $uni_system ? $lang['uni_system_of'] : $lang['uni_galaxy_of'], $uni_galaxy, $uni_system ? ":{$uni_system}" : '', strip_tags(sys_get_param_str_unsafe('uni_name'))), $lang['uni_naming'], LOG_INFO_UNI_RENAME);
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:uni_rename.php
示例17: isset
if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) {
continue;
}
$header = isset($value['header']) ? $value['header'] : $lang['stat_type'][$key];
$template->assign_block_vars($array_name, array('ID' => $key, 'HEADER' => $header, 'SELECTED' => $key == $selected));
}
}
$allow_anonymous = true;
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('stat');
$sn_group_stat_common = sn_get_groups('STAT_COMMON');
$who = sys_get_param_int('who', 1);
$type = sys_get_param_int('type');
$type = $who != 1 && !in_array($type, $sn_group_stat_common) ? 1 : $type;
$range = sys_get_param_int('range', 1);
$source = sys_get_param_str('source');
$template = gettemplate('stat_statistics', true);
$subject_list = array(1 => array('header' => $lang['stat_player']));
if (!$source) {
$subject_list[2] = array('header' => $lang['stat_allys']);
}
stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common);
$stat_types = array(STAT_TOTAL => array('type' => 'total'), STAT_FLEET => array('type' => 'fleet'), STAT_TECH => array('type' => 'tech'), STAT_BUILDING => array('type' => 'build'), STAT_DEFENSE => array('type' => 'defs'), STAT_RESOURCE => array('type' => 'res'), STAT_RAID_TOTAL => array('type' => 'raids'), STAT_RAID_WON => array('type' => 'raidswin'), STAT_RAID_LOST => array('type' => 'raidsloose'), STAT_LVL_BUILDING => array('type' => 'lvl_minier'), STAT_LVL_TECH => array('type' => 'player_rpg_tech_level'), STAT_LVL_RAID => array('type' => 'lvl_raid'));
stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common);
$Rank = $stat_types[$type]['type'];
$is_common_stat = in_array($type, $sn_group_stat_common);
$start = floor($range / 100 % 100) * 100;
$query = db_stat_list_statistic($who, $is_common_stat, $Rank, $start, $source);
// TODO - Не работает, если игроков на Блице > 100
$record_count = $source ? db_num_rows($query) : ($who == 1 ? db_user_count() : db_ally_count());
// pdump($record_count, '$record_count');
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:stat.php
示例18: exception
default:
throw new exception('note_warn_no_range', ERR_WARNING);
break;
}
sn_db_transaction_start();
doquery("DELETE FROM {{notes}} WHERE `owner` = {$user['id']} {$query_where};");
sn_db_transaction_commit();
throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
} catch (exception $e) {
$note_id_edit = 0;
sn_db_transaction_rollback();
$result[] = array('STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, 'MESSAGE' => $lang[$e->getMessage()]);
}
} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
$note_title == db_escape($lang['note_new_title']) ? $note_title = '' : false;
($note_text = sys_get_param_str('note_text')) == db_escape($lang['note_new_text']) ? $note_text = '' : false;
try {
if (!$note_text && !$note_title) {
throw new exception('note_err_note_empty', ERR_WARNING);
}
$note_priority = min(sys_get_param_id('note_priority', 2), count($note_priority_classes) - 1);
$note_galaxy = max(0, min(sys_get_param_id('note_galaxy'), $config->game_maxGalaxy));
$note_system = max(0, min(sys_get_param_id('note_system'), $config->game_maxSystem));
$note_planet = max(0, min(sys_get_param_id('note_planet'), $config->game_maxPlanet + 1));
$note_planet_type = max(1, min(sys_get_param_id('note_planet_type', 1), count($lang['sys_planet_type'])));
$note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0;
sn_db_transaction_start();
if ($note_id_edit) {
$check_note_id = doquery("SELECT `id`, `owner` FROM {{notes}} WHERE `id` = {$note_id_edit} LIMIT 1 FOR UPDATE", true);
if (!$check_note_id) {
throw new exception('note_err_note_not_found', ERR_ERROR);
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:31,代码来源:notes.php
示例19: array
$template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['pay_msg_mm_purchase_test']),
|
请发表评论