当前位置: 首页>>代码示例>>PHP>>正文


PHP sys_get_param_id函数代码示例

本文整理汇总了PHP中sys_get_param_id函数的典型用法代码示例。如果您正苦于以下问题:PHP sys_get_param_id函数的具体用法?PHP sys_get_param_id怎么用?PHP sys_get_param_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sys_get_param_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: survey_vote

function survey_vote(&$user)
{
    if (empty($user['id'])) {
        return true;
    }
    sn_db_transaction_start();
    $survey_id = sys_get_param_id('survey_id');
    $is_voted = doquery("SELECT `survey_vote_id` FROM `{{survey_votes}}` WHERE survey_parent_id = {$survey_id} AND survey_vote_user_id = {$user['id']} FOR UPDATE;", true);
    if (empty($is_voted)) {
        $survey_vote_id = sys_get_param_id('survey_vote');
        $is_answer_exists = doquery("SELECT `survey_answer_id` FROM `{{survey_answers}}` WHERE survey_parent_id = {$survey_id} AND survey_answer_id = {$survey_vote_id};", true);
        if (!empty($is_answer_exists)) {
            $user_name_safe = db_escape($user['username']);
            doquery("INSERT INTO {{survey_votes}} SET `survey_parent_id` = {$survey_id}, `survey_parent_answer_id` = {$survey_vote_id}, `survey_vote_user_id` = {$user['id']}, `survey_vote_user_name` = '{$user_name_safe}';");
        }
    }
    sn_db_transaction_commit();
    return true;
}
开发者ID:divyinfo,项目名称:SuperNova,代码行数:19,代码来源:_news.php

示例2: substr

<?php

/**
 * 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);
global $config;
nws_mark_read($user);
$template = gettemplate('announce', true);
$announce_id = sys_get_param_id('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');
$announce = array();
if ($user['authlevel'] >= 3) {
    if (!empty($text)) {
        // $idAnnounce = sys_get_param_id('id');
        $announce_time = strtotime($announce_time, SN_TIME_NOW);
        $announce_time = $announce_time ? $announce_time : SN_TIME_NOW;
        if ($mode == 'edit') {
            doquery("UPDATE {{announce}} SET `tsTimeStamp` = FROM_UNIXTIME({$announce_time}), `strAnnounce`='{$text}', detail_url = '{$detail_url}' WHERE `idAnnounce`={$announce_id};");
            doquery("DELETE FROM {{survey}} WHERE `survey_announce_id` = {$announce_id};");
        } else {
            doquery("INSERT INTO {{announce}}\n        SET `tsTimeStamp` = FROM_UNIXTIME({$announce_time}), `strAnnounce`='{$text}', detail_url = '{$detail_url}',\n        `user_id` = {$user['id']}, `user_name` = '" . db_escape($user['username']) . "'");
            $announce_id = db_insert_id();
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:31,代码来源:announce.php

示例3: define

 */
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']);
}
if ($delete = sys_get_param_id('delete')) {
    doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;");
} elseif (sys_get_param_str('delete_update_info')) {
    doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);");
} elseif (sys_get_param_str('deleteall') == 'yes') {
    //  doquery("TRUNCATE TABLE `{{logs}}`");
}
if ($detail = sys_get_param_id('detail')) {
    $template = gettemplate('admin/adm_log_main_detail', true);
    $errorInfo = doquery("SELECT * FROM `{{logs}}` WHERE `log_id` = {$detail} LIMIT 1;", true);
    $error_dump = unserialize($errorInfo['log_dump']);
    if (is_array($error_dump)) {
        foreach ($error_dump as $key => $value) {
            $v = array('VAR_NAME' => $key, 'VAR_VALUE' => $key == 'query_log' ? $value : dump($value, $key));
            $template->assign_block_vars('vars', $v);
        }
    }
    $template->assign_vars($errorInfo);
} else {
    $template = gettemplate('admin/adm_log_main', true);
    $i = 0;
    $query = doquery("SELECT * FROM `{{logs}}` ORDER BY log_id DESC LIMIT 100;");
    while ($u = db_fetch($query)) {
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:adm_log_main.php

示例4: foreach

//      'MESSAGE' => $e->getMessage(),
//    ));
//  }
//}
// Таблица скидок
$prev_discount = 0;
if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) {
    foreach (sn_module_payment::$bonus_table as $sum => $discount) {
        if ($discount && $discount != $prev_discount) {
            $template->assign_block_vars('discount', array('SUM' => $sum, 'DISCOUNT' => $discount * 100, 'DISCOUNT_ONE' => 1 + $discount, 'TEXT' => sprintf($lang['pay_mm_bonus_each'], pretty_number($sum), round($discount * 100))));
            $prev_discount = $discount;
        }
    }
}
// Результат платежа
if ($payment_id = sys_get_param_id('payment_id')) {
    $payment = doquery("SELECT * FROM {{payment}} WHERE `payment_id` = {$payment_id} LIMIT 1;", true);
    if ($payment && $payment['payment_user_id'] == $user['id']) {
        if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
            $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained'])));
        }
        if ($payment['payment_status'] == PAYMENT_STATUS_NONE) {
            $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), 'STATUS' => 1));
        }
        if ($payment['payment_test']) {
            $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['pay_msg_mm_purchase_test']), 'STATUS' => -1));
        }
    }
}
$unit_available_amount_list =& sn_module_payment::$bonus_table;
$request = array('metamatter' => sys_get_param_float('metamatter'));
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:metamatter.php

示例5: sys_get_param_id

$message_delete = sys_get_param_id('msg_del');
if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
    $message_delete = implode(', ', $message_delete);
}
if ($message_delete) {
    doquery("DELETE FROM {{messages}} WHERE `message_id` in ({$message_delete});");
    $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete)));
}
if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
    $delete_date = "{$year}-{$month}-{$day}";
    doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : ''));
    $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date)));
}
$page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true);
$page_max = ceil($page_max['max'] / 25);
$int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max);
if (sys_get_param('page_prev') && $int_page_current > 1) {
    $int_page_current--;
} elseif (sys_get_param('page_next') && $int_page_current < $page_max) {
    $int_page_current++;
}
for ($i = 1; $i <= $page_max; $i++) {
    $template->assign_block_vars('page', array('NUMBER' => $i));
}
/*
$Prev       = ( !empty($_POST['prev'])   ) ? true : false;
$Next       = ( !empty($_POST['next'])   ) ? true : false;
$DelSel     = ( !empty($_POST['delsel']) ) ? true : false;
$DelDat     = ( !empty($_POST['deldat']) ) ? true : false;
$CurrPage   = ( !empty($_POST['curr'])   ) ? $_POST['curr'] : 1;
$SelType    = $_POST['type'];
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:adm_message_list.php

示例6: tpl_login_lang

function tpl_login_lang(&$template)
{
    global $language;
    $url_params = array();
    if ($language) {
        $url_params[] = "lang={$language}";
    }
    if ($id_ref = sys_get_param_id('id_ref')) {
        $url_params[] = "id_ref={$id_ref}";
    }
    $template->assign_vars($q = array('LANG' => $language ? $language : '', 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', 'FILENAME' => basename($_SERVER['PHP_SELF'])));
    foreach (lng_get_list() as $lng_id => $lng_data) {
        if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
            foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
                $lng_data1 = $lng_data;
                $lng_data1 = array_merge($lng_data1, $lang_variant);
                $template->assign_block_vars('language', $lng_data1);
            }
        } else {
            $template->assign_block_vars('language', $lng_data);
        }
    }
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:23,代码来源:template.php

示例7: substr

<?php

include 'common.' . substr(strrchr(__FILE__, '.'), 1);
if (sys_get_param_str('return_fleet')) {
    $fleet_id = sys_get_param_id('fleet_id');
    if ($fleet_id) {
        sn_db_transaction_start();
        $FleetRow = doquery("SELECT * FROM {{fleets}} WHERE `fleet_id` = '{$fleet_id}' LIMIT 1 FOR UPDATE;", '', true);
        if ($FleetRow['fleet_owner'] == $user['id'] && $FleetRow['fleet_mess'] == 0) {
            $ReturnFlyingTime = ($FleetRow['fleet_end_stay'] != 0 && $FleetRow['fleet_start_time'] < SN_TIME_NOW ? $FleetRow['fleet_start_time'] : SN_TIME_NOW) - $FleetRow['start_time'] + SN_TIME_NOW + 1;
            doquery("UPDATE {{fleets}} SET `fleet_start_time` = " . SN_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_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));
            sn_db_transaction_rollback();
            die('Hack attempt 302');
        }
        sn_db_transaction_commit();
    }
}
lng_include('overview');
lng_include('fleet');
if (!$planetrow) {
    message($lang['fl_noplanetrow'], $lang['fl_error']);
}
$template = gettemplate('flying_fleets', true);
$i = 0;
$fleet_query = doquery("SELECT * FROM {{fleets}} WHERE fleet_owner={$user['id']};");
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:31,代码来源:flying_fleets.php

示例8: que_delete

function que_delete($que_type, $user = array(), $planet = array(), $clear = false)
{
    $planets_locked = array();
    // TODO: Some checks
    sn_db_transaction_start();
    $user = db_user_by_id($user['id'], true);
    $planet['id'] = $planet['id'] && $que_type !== QUE_RESEARCH ? $planet['id'] : 0;
    $global_que = que_get($user['id'], $planet['id'], $que_type, true);
    //pdump($global_que);
    //pdump($planet['id']);
    //pdump($global_que[$que_type][$planet['id']]);
    if (!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) {
        $que = array_reverse($global_que['ques'][$que_type][$user['id']][$planet['id']]);
        foreach ($que as $que_item) {
            db_que_delete_by_id($que_item['que_id']);
            if ($que_item['que_planet_id_origin']) {
                $planet['id'] = $que_item['que_planet_id_origin'];
            }
            if (!isset($planets_locked[$planet['id']])) {
                $planets_locked[$planet['id']] = $planet['id'] ? db_planet_by_id($planet['id'], true) : $planet;
            }
            $build_data = sys_unit_str2arr($que_item['que_unit_price']);
            db_change_units($user, $planets_locked[$planet['id']], array(RES_METAL => $build_data[RES_METAL] * $que_item['que_unit_amount'], RES_CRYSTAL => $build_data[RES_CRYSTAL] * $que_item['que_unit_amount'], RES_DEUTERIUM => $build_data[RES_DEUTERIUM] * $que_item['que_unit_amount']));
            if (!$clear) {
                break;
            }
        }
        if (is_numeric($planet['id'])) {
            db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())");
        } elseif (is_numeric($user['id'])) {
            db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())');
        }
        sn_db_transaction_commit();
    } else {
        sn_db_transaction_rollback();
    }
    //die();
    header("Location: {$_SERVER['PHP_SELF']}?mode={$que_type}" . "&ally_id=" . sys_get_param_id('ally_id'));
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:39,代码来源:eco_queue.php

示例9: sn_sys_planet_core_transmute

function sn_sys_planet_core_transmute(&$user, &$planetrow)
{
    if (!sys_get_param_str('transmute')) {
        return array();
    }
    global $lang;
    try {
        if ($planetrow['planet_type'] != PT_PLANET) {
            throw new exception($lang['ov_core_err_not_a_planet'], ERR_ERROR);
        }
        if ($planetrow['density_index'] == ($new_density_index = sys_get_param_id('density_type'))) {
            throw new exception($lang['ov_core_err_same_density'], ERR_WARNING);
        }
        sn_db_transaction_start();
        $user = db_user_by_id($user['id'], true, '*');
        $planetrow = db_planet_by_id($planetrow['id'], true, '*');
        //    $global_data = sys_o_get_updated($user, $planetrow['id'], SN_TIME_NOW);
        //    $user = $global_data['user'];
        //    $planetrow = $global_data['planet'];
        $planet_density_index = $planetrow['density_index'];
        $density_price_chart = planet_density_price_chart($planet_density_index);
        if (!isset($density_price_chart[$new_density_index])) {
            // Hack attempt
            throw new exception($lang['ov_core_err_denisty_type_wrong'], ERR_ERROR);
        }
        $user_dark_matter = mrc_get_level($user, false, RES_DARK_MATTER);
        $transmute_cost = get_unit_param(UNIT_PLANET_DENSITY, 'cost');
        $transmute_cost = $transmute_cost[RES_DARK_MATTER] * $density_price_chart[$new_density_index];
        if ($user_dark_matter < $transmute_cost) {
            throw new exception($lang['ov_core_err_no_dark_matter'], ERR_ERROR);
        }
        $sn_data_planet_density = sn_get_groups('planet_density');
        foreach ($sn_data_planet_density as $key => $value) {
            if ($key == $new_density_index) {
                break;
            }
            $prev_density_index = $key;
        }
        $new_density = round(($sn_data_planet_density[$new_density_index][UNIT_PLANET_DENSITY] + $sn_data_planet_density[$prev_density_index][UNIT_PLANET_DENSITY]) / 2);
        rpg_points_change($user['id'], RPG_PLANET_DENSITY_CHANGE, -$transmute_cost, array('Planet %1$s ID %2$d at coordinates %3$s changed density type from %4$d "%5$s" to %6$d "%7$s". New density is %8$d kg/m3', $planetrow['name'], $planetrow['id'], uni_render_coordinates($planetrow), $planet_density_index, $lang['uni_planet_density_types'][$planet_density_index], $new_density_index, $lang['uni_planet_density_types'][$new_density_index], $new_density));
        db_planet_set_by_id($planetrow['id'], "`density` = {$new_density}, `density_index` = {$new_density_index}");
        sn_db_transaction_commit();
        $planetrow['density'] = $new_density;
        $planetrow['density_index'] = $new_density_index;
        $result = array('STATUS' => ERR_NONE, 'MESSAGE' => sprintf($lang['ov_core_err_none'], $lang['uni_planet_density_types'][$planet_density_index], $lang['uni_planet_density_types'][$new_density_index], $new_density));
    } catch (exception $e) {
        sn_db_transaction_rollback();
        $result = array('STATUS' => $e->getCode(), 'MESSAGE' => $e->getMessage());
    }
    return $result;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:51,代码来源:general.php

示例10: sn_eco_build

function sn_eco_build($que_type, &$auser, &$planet)
{
    global $lang, $config;
    if ($ally_id = sys_get_param_id('ally_id')) {
        define('SN_IN_ALLY', true);
        $ranks = ally_get_ranks($auser['ally']);
        if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
            $user =& $auser['ally']['player'];
            $planet = array('metal' => $user['metal'], 'crystal' => $user['crystal'], 'deuterium' => $user['deuterium']);
        }
    }
    if (!$user) {
        $user =& $auser;
    }
    switch ($action = sys_get_param_escaped('action')) {
        case 'create':
            // Add unit to que for build
        // Add unit to que for build
        case 'destroy':
            // Add unit to que for remove
            $operation_result = que_build($user, $planet, $action == 'destroy' ? BUILD_DESTROY : BUILD_CREATE);
            break;
        case 'trim':
            que_delete($que_type, $user, $planet, false);
            break;
        case 'clear':
            que_delete($que_type, $user, $planet, true);
            break;
    }
    $group_missile = sn_get_groups('missile');
    $silo_capacity_free = 0;
    if ($que_type == QUE_STRUCTURES) {
        $build_unit_list = sn_get_groups('build_allow');
        $build_unit_list = $build_unit_list[$planet['planet_type']];
        $artifact_id = ART_NANO_BUILDER;
        $page_header = $lang['tech'][UNIT_STRUCTURES];
    } elseif ($que_type == QUE_RESEARCH) {
        if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
            message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
        }
        if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
            message($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]);
        }
        $build_unit_list = sn_get_groups('tech');
        $artifact_id = ART_HEURISTIC_CHIP;
        $page_header = $lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
    } elseif ($que_type == QUE_MERCENARY) {
        //    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
        //      message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
        //    }
        //    if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
        //      message($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]);
        //    }
        $build_unit_list = sn_get_groups('mercenaries');
        $artifact_id = 0;
        $page_header = $lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
    } else {
        if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
            message($lang['need_hangar'], $lang['tech'][STRUC_FACTORY_HANGAR]);
        }
        $build_unit_list = sn_get_groups($page_mode = $que_type == SUBQUE_FLEET ? 'fleet' : 'defense');
        $page_header = $lang[$page_mode];
        $artifact_id = 0;
        $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY);
        foreach ($group_missile as $unit_id) {
            $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE);
        }
        $silo_capacity_free = max(0, $silo_capacity_free);
    }
    // Caching values that used more then one time into local variables
    //  $config_resource_multiplier = $config->resource_multiplier;
    $config_resource_multiplier = game_resource_multiplier();
    /*
    // Code for fully working new que system
    $hangar_busy = count($que['que'][QUE_HANGAR]);
    $lab_busy    = count($que['que'][QUE_RESEARCH]) && !$config->BuildLabWhileRun;
    */
    $template = gettemplate('buildings_builds', true);
    if (!empty($operation_result)) {
        $template->assign_block_vars('result', $operation_result);
    }
    $planet_id = $que_type == QUE_RESEARCH || $que_type == QUE_MERCENARY ? 0 : $planet['id'];
    $ques = que_get($user['id'], $planet_id, $que_type);
    $in_que =& $ques['in_que'][$que_type][$user['id']][$planet_id];
    $que =& $ques['ques'][$que_type][$user['id']][$planet_id];
    que_tpl_parse($template, $que_type, $user, $planet, $que);
    $que_length = count($que);
    $can_que_element = $que_length < que_get_max_que_length($user, $planet, $que_type);
    $fleet_list = flt_get_fleets_to_planet($planet);
    $planet_fields_max = eco_planet_fields_max($planet);
    $planet_fields_current = $planet['field_current'];
    $planet_fields_que = is_array($in_que) ? -array_sum($in_que) : 0;
    $planet_fields_free = max(0, $planet_fields_max - $planet_fields_current + $planet_fields_que);
    $planet_fields_queable = $que_type != QUE_STRUCTURES || $planet_fields_free > 0;
    //$planet_temp_max       = $planet['temp_max'];
    $sn_modifiers_resource = sn_get_groups('modifiers');
    $sn_modifiers_resource = $sn_modifiers_resource[MODIFIER_RESOURCE_PRODUCTION];
    $sn_groups_density = sn_get_groups('planet_density');
    $density_info = $sn_groups_density[$planet['density_index']][UNIT_RESOURCES];
    $user_dark_matter = mrc_get_level($user, null, RES_DARK_MATTER);
//.........这里部分代码省略.........
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:101,代码来源:eco_bld_structures.php

示例11: doquery

$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", '', true);
$FlyingFleets = $FlyingFleets['Number'];
if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
    message($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
}
$MaxExpeditions = get_player_max_expeditons($user);
if ($MaxExpeditions) {
    $FlyingExpeditions = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
    $FlyingExpeditions = $FlyingExpeditions['expedi'];
} else {
    $FlyingExpeditions = 0;
}
switch ($fleet_page) {
    case 3:
    case 2:
        $fleet_group_mr = sys_get_param_id('fleet_group');
        $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
        $fleetarray = is_array($fleetarray) ? $fleetarray : array();
        foreach ($fleetarray as $ship_id => &$ship_amount) {
            if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
                $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
                die;
            }
            $ship_amount = floatval($ship_amount);
        }
        $UsedPlanet = false;
        $YourPlanet = false;
        $missiontype = array();
        if ($planet > $config->game_maxPlanet) {
            $target_mission = MT_EXPLORE;
            $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:fleet.php

示例12: substr

 *   1.1 - Modified by -MoF- (UGamela germany)
 *   1.0 - Created by Perberos
 * @copyright 2008 by Chlorel for XNova
 */
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('universe');
lng_include('stat');
$mode = sys_get_param_str('mode');
$uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']);
$uni_system = sys_get_param_int('system', $planetrow['system']);
$planet = sys_get_param_int('planet', $planetrow['planet']);
if ($mode == 'name') {
    require_once 'includes/includes/uni_rename.php';
}
require_once 'includes/includes/flt_functions.php';
$CurrentPlanetID = sys_get_param_id('current');
$POST_galaxyLeft = sys_get_param_str('galaxyLeft');
$POST_galaxyRight = sys_get_param_str('galaxyRight');
$POST_systemLeft = sys_get_param_str('systemLeft');
$POST_systemRight = sys_get_param_str('systemRight');
$fleetmax = GetMaxFleets($user);
$CurrentPlID = $planetrow['id'];
$CurrentMIP = mrc_get_level($user, $planetrow, UNIT_DEF_MISSILE_INTERPLANET, false, true);
$HavePhalanx = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX);
$CurrentSystem = $planetrow['system'];
$CurrentGalaxy = $planetrow['galaxy'];
$maxfleet = doquery("SELECT COUNT(*) AS flying_fleet_count FROM {{fleets}} WHERE `fleet_owner` = '{$user['id']}';", '', true);
$maxfleet_count = $maxfleet['flying_fleet_count'];
if ($mode == 1) {
    if ($POST_galaxyLeft) {
        $uni_galaxy--;
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:31,代码来源:galaxy.php

示例13: payment_request_process

 protected function payment_request_process($options = array())
 {
     global $lang, $config;
     if (!$this->manifest['active']) {
         throw new Exception($lang['pay_msg_module_disabled'], SN_MODULE_DISABLED);
     }
     // Если есть payment_id - загружаем под него данные
     if (!empty($this->payment_params['payment_id'])) {
         $this->request_payment_id = sys_get_param_id($this->payment_params['payment_id']);
         if (!$this->request_payment_id) {
             throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
         }
         if (!$this->db_get_by_id($this->request_payment_id)) {
             throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
         }
         // Проверяем - был ли этот платеж обработан?
         // TODO - Статусы бывают разные. Нужен спецфлаг payment_processed
         if ($this->payment_status != PAYMENT_STATUS_NONE) {
             sn_db_transaction_rollback();
             sys_redirect(SN_ROOT_VIRTUAL . 'metamatter.php?payment_id=' . $this->payment_id);
             die;
         }
     }
     // Пытаемся получить из запроса ИД аккаунта
     $request_account_id = !empty($this->payment_params['account_id']) ? sys_get_param_id($this->payment_params['account_id']) : 0;
     // Если в запросе нет ИД аккаунта - пытаемся использовать payment_account_id
     if (empty($request_account_id) && !empty($this->payment_account_id)) {
         $request_account_id = $this->payment_account_id;
     }
     // Если теперь у нас нету ИД аккаунта ни в запросе, ни в записи таблицы - можно паниковать
     if (empty($request_account_id)) {
         // TODO - аккаунт
         throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
     }
     // Если нет записи в таблице - тогда берем payment_account_id из запроса
     if (empty($this->payment_account_id)) {
         $this->payment_account_id = $request_account_id;
     }
     // Если у нас отличаются ИД аккаунта в запросе и ИД аккаунта в записи - тоже можно паниковать
     if ($this->payment_account_id != $request_account_id) {
         // TODO - Поменять сообщение об ошибке
         throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
     }
     // Проверяем существование аккаунта с данным ИД
     if (!$this->account->db_get_by_id($this->payment_account_id)) {
         throw new Exception($lang['pay_msg_request_user_invalid'] . ' ID ' . $this->payment_account_id, $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
     }
     // TODO Проверка на сервер_ид - как бы и не нужна, наверное?
     if (!empty($this->payment_params['server_id'])) {
         $this->request_server_id = sys_get_param_str($this->payment_params['server_id']);
         if (SN_ROOT_VIRTUAL != $this->request_server_id) {
             throw new Exception($lang['pay_msg_request_server_wrong'] . " {$this->request_server_id} вместо " . SN_ROOT_VIRTUAL, SN_PAYMENT_REQUEST_SERVER_WRONG);
         }
     }
     // Сверка количества оплаченной ММ с учётом бонусов
     if (!empty($this->payment_params['payment_dark_matter_gained'])) {
         $request_mm_amount = sys_get_param_id($this->payment_params['payment_dark_matter_gained']);
         if ($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) {
             throw new Exception($lang['pay_msg_mm_request_amount_invalid'] . " пришло {$request_mm_amount} ММ вместо {$this->payment_dark_matter_gained} ММ", SN_PAYMENT_REQUEST_MM_AMOUNT_INVALID);
         }
         empty($this->payment_dark_matter_gained) ? $this->payment_dark_matter_gained = $request_mm_amount : false;
     }
     if (empty($this->payment_dark_matter_paid)) {
         // TODO - обратный расчёт из gained
     }
     // Проверка наличия внешнего ИД платежа
     if (!empty($this->payment_params['payment_external_id'])) {
         $request_payment_external_id = sys_get_param_id($this->payment_params['payment_external_id']);
         if (empty($request_payment_external_id)) {
             throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
         } elseif (!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) {
             // TODO - Может быть поменять сообщение
             throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
         }
         $this->payment_external_id = $request_payment_external_id;
     }
     // Сверка суммы, запрошенной СН к оплате
     if (!empty($this->payment_params['payment_external_money'])) {
         $request_money_out = sys_get_param_float($this->payment_params['payment_external_money']);
         if ($request_money_out != $this->payment_external_amount && $this->is_loaded) {
             throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " пришло {$request_money_out} денег вместо {$this->payment_external_amount} денег", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
         }
         empty($this->payment_external_amount) ? $this->payment_external_amount = $request_money_out : false;
     }
     // Заполняем поле валюты платёжной системы
     if (!empty($this->payment_params['payment_external_currency'])) {
         $this->payment_external_currency = sys_get_param_str($this->payment_params['payment_external_currency']);
         if (empty($this->payment_external_currency)) {
             // TODO - поменять сообщение
             throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " {$this->payment_external_currency}", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
         }
     }
     if (empty($this->payment_external_currency)) {
         $this->payment_external_currency = $this->config['currency'];
     }
     // Заполнение внутренней суммы и валюты из внешних данных
     if (empty($this->payment_currency)) {
         $this->payment_currency = $config->payment_currency_default;
     }
     if (empty($this->payment_amount) && !empty($this->payment_external_currency)) {
//.........这里部分代码省略.........
开发者ID:divyinfo,项目名称:SuperNova,代码行数:101,代码来源:sn_module_payment.php

示例14: sys_get_param_str

$mode = sys_get_param_str('msg_delete') ? 'delete' : sys_get_param_str('mode');
$current_class = sys_get_param_int('message_class');
if (!isset($sn_message_class_list[$current_class])) {
    $current_class = 0;
    $mode = '';
}
switch ($mode) {
    case 'write':
        $error_list = array();
        $template = gettemplate('msg_message_compose', true);
        $recipient_name = sys_get_param_str_unsafe('recipient_name');
        if ($recipient_name) {
            $recipient_row = db_user_by_username($recipient_name);
        }
        if (!$recipient_row) {
            $recipient_id = sys_get_param_id('id');
            $recipient_row = db_user_by_id($recipient_id);
            if (!$recipient_row) {
                $recipient_id = 0;
            }
        }
        if ($recipient_row) {
            $recipient_id = $recipient_row['id'];
            $recipient_name = $recipient_row['username'];
        }
        if ($recipient_id == $user['id']) {
            $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
        }
        $re = 0;
        $subject = sys_get_param_str('subject');
        while (strpos($subject, $lang['msg_answer_prefix']) !== false) {
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:messages.php

示例15: substr

<?php

/**
 * jumpgate.php
 *
 * Jump Gate interface, I presume
 *
 * @version 1.0st Security checks & tests by Gorlum for http://supernova.ws
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('fleet');
if ($TargetPlanet = sys_get_param_id('jmpto')) {
    sn_db_transaction_start();
    db_user_by_id($user['id'], true, 'id');
    $planetrow = db_planet_by_id($planetrow['id'], true);
    if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) {
        $TargetGate = db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
        if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) {
            $NextDestTime = uni_get_time_to_jump($TargetGate);
            if (!$NextDestTime) {
                // $SubQueryOri = "";
                // $SubQueryDes = "";
                $ship_list = sys_get_param('ships');
                $db_changeset = array();
                foreach ($ship_list as $ship_id => $ship_count) {
                    if (!in_array($ship_id, sn_get_groups('fleet'))) {
                        continue;
                    }
                    $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
开发者ID:divyinfo,项目名称:SuperNova,代码行数:31,代码来源:jumpgate.php


注:本文中的sys_get_param_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。