本文整理汇总了PHP中Functions_Lib类的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib类的具体用法?PHP Functions_Lib怎么用?PHP Functions_Lib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Functions_Lib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$modules_array = '';
$modules_count = count(explode(';', Functions_Lib::read_config('modules')));
$row_template = parent::$page->get_template('adm/modules_row_view');
$module_rows = '';
$parse['alert'] = '';
// SAVE PAGE
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['save']) {
for ($i = 0; $i <= $modules_count - 2; $i++) {
$modules_array .= (isset($_POST["status{$i}"]) ? 1 : 0) . ';';
}
Functions_Lib::update_config('modules', $modules_array);
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']);
}
// SHOW PAGE
$modules_array = explode(';', Functions_Lib::read_config('modules'));
foreach ($modules_array as $module => $status) {
if ($status != NULL) {
$parse['module'] = $module;
$parse['module_name'] = $this->_lang['module'][$module];
$parse['module_value'] = $status == 1 ? 'checked' : '';
$parse['color'] = $status == 1 ? 'text-success' : 'text-error';
$module_rows .= parent::$page->parse_template($row_template, $parse);
}
}
$parse['module_rows'] = $module_rows;
parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/modules_view"), $parse));
}
示例2: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['alert'] = '';
$error = '';
if (isset($_POST['save'])) {
if (isset($_POST['premium_url']) && !empty($_POST['premium_url'])) {
Functions_Lib::update_config('premium_url', Functions_Lib::prep_url($_POST['premium_url']));
} else {
$error .= $this->_lang['pr_error_url'];
}
if (isset($_POST['trader_darkmatter']) && $_POST['trader_darkmatter'] > 0) {
Functions_Lib::update_config('trader_darkmatter', $_POST['trader_darkmatter']);
} else {
$error .= $this->_lang['pr_error_trader'];
}
if ($error != '') {
$parse['alert'] = Administration_Lib::save_message('warning', $error);
} else {
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['pr_all_ok_message']);
}
}
$parse['premium_url'] = Functions_Lib::read_config('premium_url');
$parse['trader_darkmatter'] = Functions_Lib::read_config('trader_darkmatter');
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/premium_view'), $parse));
}
示例3: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$load_template = parent::$page->get_template('adm/errors_row_view');
$deleteall = isset($_GET['deleteall']) ? $_GET['deleteall'] : '';
$file = XGP_ROOT . LOGS_PATH . 'ErrorLog.php';
$errors_all = file_get_contents($file);
$i = 0;
$parse['errors_list'] = '';
if ($errors_all != "") {
$errors_all = explode('||', $errors_all);
foreach ($errors_all as $error) {
$errors_row = explode('|', $error);
if (isset($errors_row[3])) {
$i++;
$parse['errors_list'] .= parent::$page->parse_template($load_template, $errors_row);
}
}
}
$parse['errors_list_resume'] = $i . $this->_lang['er_errors'];
if ($deleteall == 'yes') {
$fh = fopen($file, 'w');
fclose($fh);
Functions_Lib::redirect('admin.php?page=errors');
}
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/errors_view'), $parse));
}
示例4: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
if ($_POST) {
$login = parent::$db->query_fetch("SELECT `user_id`, `user_name`, `user_password`, `user_banned`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['login']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `user_password` = '" . sha1($_POST['pass']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
if ($login['user_banned'] <= time()) {
$this->remove_ban($login['user_name']);
}
if ($login) {
// User login
if (parent::$users->user_login($login['user_id'], $login['user_name'], $login['user_password'])) {
// Update current planet
parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`user_current_planet` = `user_home_planet_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` ='" . $login['user_id'] . "'");
// Redirect to game
Functions_Lib::redirect('game.php?page=overview');
}
}
// If login fails
Functions_Lib::redirect('index.php');
} else {
$parse['year'] = date('Y');
$parse['version'] = VERSION;
$parse['servername'] = Functions_Lib::read_config('game_name');
$parse['game_logo'] = Functions_Lib::read_config('game_logo');
$parse['forum_url'] = Functions_Lib::read_config('forum_url');
$parse['js_path'] = JS_PATH . 'home/';
$parse['css_path'] = CSS_PATH . 'home/';
$parse['img_path'] = IMG_PATH . 'home/';
$parse['base_path'] = BASE_PATH;
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('home/index_body'), $parse), FALSE, '', FALSE);
}
}
示例5: production_amount
/**
* method production_amount
* param1 $production
* param2 $boost
* return production amount
*/
public static function production_amount($production, $boost, $is_energy = false)
{
if ($is_energy) {
return floor($production * $boost);
} else {
return floor($production * Functions_Lib::read_config('resource_multiplier') * $boost);
}
}
示例6: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
// Check module access
Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID));
$this->_lang = parent::$lang;
$this->build_page();
}
示例7: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
$this->_lang = parent::$lang;
if ($this->server_requirementes()) {
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ins_no_server_requirements']));
}
}
示例8: migrate_to_xml
/**
* @project XG Proyect
* @version 3.x.x build 0000
* @copyright Copyright (C) 2008 - 2014
*/
function migrate_to_xml()
{
$query = $db->query("SELECT * FROM " . DB_PREFIX . "config");
$search = array('�', '�', '�', '�', '"', '#', '$', '%', '(', ')', '�', '�', '|', '~');
$replace = array('¡', '¿', '°', 'ª', '"', '#', '$', '%', '(', ')', '¬', '€', '|', '~');
while ($row = $db->fetch_array($query)) {
if ($row['config_name'] != 'BuildLabWhileRun') {
Functions_Lib::update_config(strtolower($row['config_name']), str_replace($search, $replace, $row['config_value']));
}
}
}
示例9: build_page
/**
* method build_page
* param
* return the statistics page
*/
private function build_page()
{
$parse = $this->_lang;
$parse['dpath'] = DPATH;
$bloc = $this->_lang;
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$time = isset($_GET['time']) ? $_GET['time'] : '';
if ($mode == 2 && ($time == 'month' or $time == 'week')) {
$Selected = $_GET['offi'];
$time = 'darkmatter_' . $time;
$set_time = $time == 'darkmatter_month' ? 3600 * 24 * 30 * 3 : 3600 * 24 * 7;
if (in_array($Selected, $this->_reslist['officier'])) {
$Result = $this->is_officier_accesible($Selected, $time);
$Price = $this->get_officier_price($Selected, $time);
if ($Result !== FALSE) {
$this->_current_user['premium_dark_matter'] -= $Price;
// IF THE OFFICIER IS ACTIVE
if (Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Selected]])) {
$this->_current_user[$this->_resource[$Selected]] += $set_time;
// ADD TIME
} else {
$this->_current_user[$this->_resource[$Selected]] = time() + $set_time;
// SET TIME
}
parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_dark_matter` = '" . $this->_current_user['premium_dark_matter'] . "',\n\t\t\t\t\t\t\t\t\t\t\t`" . $this->_resource[$Selected] . "` = '" . $this->_current_user[$this->_resource[$Selected]] . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `premium_user_id` = '" . $this->_current_user['user_id'] . "';");
}
}
Functions_Lib::redirect('game.php?page=officier');
} else {
$OfficierRowTPL = parent::$page->get_template('officier/officier_row');
$parse['disp_off_tbl'] = '';
$parse['premium_pay_url'] = Functions_Lib::read_config('premium_url') != '' ? Functions_Lib::read_config('premium_url') : 'game.php?page=officier';
foreach ($this->_lang['tech'] as $Element => $ElementName) {
if ($Element >= 601 && $Element <= 605) {
$bloc['dpath'] = DPATH;
$bloc['off_id'] = $Element;
$bloc['off_status'] = Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Element]]) ? '<font color=lime>' . $this->_lang['of_active'] . ' ' . date(Functions_Lib::read_config('date_format'), $this->_current_user[$this->_resource[$Element]]) . '</font>' : '<font color=red>' . $this->_lang['of_inactive'] . '</font>';
$bloc['off_name'] = $ElementName;
$bloc['off_desc'] = $this->_lang['res']['descriptions'][$Element];
$bloc['off_desc_short'] = $this->_lang['info'][$Element]['description'];
$bloc['month_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_month'));
$bloc['week_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_week'));
$bloc['img_big'] = $this->get_officier_image($Element, 'img_big');
$bloc['img_small'] = $this->get_officier_image($Element, 'img_small');
$bloc['off_link_month'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=month";
$bloc['off_link_week'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=week";
$parse['disp_off_tbl'] .= parent::$page->parse_template($OfficierRowTPL, $bloc);
}
}
}
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('officier/officier_table'), $parse));
}
示例10: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && Administration_Lib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) {
$this->build_page($this->_current_user);
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例11: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
// Check module access
Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID));
$this->_lang = parent::$lang;
$this->_resource = parent::$objects->get_objects();
$this->_requeriments = parent::$objects->get_relations();
$this->_current_user = parent::$users->get_user_data();
$this->_current_planet = parent::$users->get_planet_data();
$this->build_page();
}
示例12: missile_mission
/**
* method missile_mission
* param $fleet_row
* return the missile result
*/
public function missile_mission($fleet_row)
{
if ($fleet_row['fleet_start_time'] <= time()) {
if ($fleet_row['fleet_mess'] == 0) {
$attacker_data = parent::$db->query_fetch("SELECT p.`planet_name`, r.`research_weapons_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_start_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_start_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_start_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_start_type'] . ";");
$target_data = parent::$db->query_fetch("SELECT p.`planet_id`, p.`planet_name`, p.`planet_user_id`, d.*, r.`research_shielding_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_end_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_end_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_end_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_end_type'] . ";");
if ($target_data['defense_anti-ballistic_missile'] >= $fleet_row['fleet_amount']) {
$message = $this->_lang['ma_all_destroyed'] . '<br>';
$amount = $fleet_row['fleet_amount'];
} else {
$amount = 0;
if ($target_data['defense_anti-ballistic_missile'] > 0) {
$message = $target_data['defense_anti-ballistic_missile'] . $this->_lang['ma_some_destroyed'] . " <br>";
}
$attack = floor(($fleet_row['fleet_amount'] - $target_data['defense_anti-ballistic_missile']) * ($this->_combat_caps[503]['attack'] * (1 + $attacker_data['research_weapons_technology'] / 10)));
$attack_order = $this->set_attack_order($fleet_row['fleet_target_obj']);
$destroyed_query = '';
// PROCESS THE MISSILE ATTACK
for ($t = 0; $t < count($attack_order); $t++) {
$n = $attack_order[$t];
if ($target_data[$this->_resource[$n]]) {
$defense = ($this->_pricelist[$n]['metal'] + parent::$_pricelist[$n]['crystal']) / 10 * (1 + $target_data['research_shielding_technology'] / 10);
if ($attack >= $defense * $target_data[$this->_resource[$n]]) {
$destroyed = $target_data[$this->_resource[$n]];
} else {
$destroyed = floor($attack / $defense);
}
$attack -= $destroyed * $defense;
if ($destroyed != 0) {
$message .= $this->_lang['tech'][$n] . " (-" . $destroyed . ")<br>";
$destroyed_query .= "`" . $this->_resource[$n] . "` = `" . $this->_resource[$n] . "` - " . $destroyed . ",";
}
}
}
if ($destroyed_query != '') {
parent::$db->query("UPDATE " . DEFENSES . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t{$destroyed_query}\n\t\t\t\t\t\t\t\t\t\t\t\t`defense_anti-ballistic_missile` = '" . $amount . "'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE defense_planet_id = " . $target_data['id']);
}
}
$search = array('%1%', '%2%', '%3%');
$replace = array($fleet_row['fleet_amount'], $attacker_data['planet_name'] . ' [' . $fleet_row['fleet_start_galaxy'] . ':' . $fleet_row['fleet_start_system'] . ':' . $fleet_row['fleet_start_planet'] . '] ', $target_data['name'] . ' [' . $fleet_row['fleet_end_galaxy'] . ':' . $fleet_row['fleet_end_system'] . ':' . $fleet_row['fleet_end_planet'] . '] ');
$message_vorlage = str_replace($search, $replace, $this->_lang['ma_missile_string']);
if (empty($message) or $message == '') {
$message = $this->_lang['ma_planet_without_defens'];
}
Functions_Lib::send_message($target_data['planet_user_id'], '', $fleet_row['fleet_end_time'], 5, $this->_lang['sys_mess_tower'], $this->_lang['gl_missile_attack'], $message_vorlage . $message);
parent::remove_fleet($fleet_row['fleet_id']);
}
}
}
示例13: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
// RUN STATISTICS SCRIPT AND THE SET THE RESULT
$result = Statistics_Lib::make_stats();
// PREPARE DATA TO PARSE
$parse = $this->_lang;
$parse['memory_p'] = str_replace(array("%p", "%m"), $result['memory_peak'], $this->_lang['sb_top_memory']);
$parse['memory_e'] = str_replace(array("%e", "%m"), $result['end_memory'], $this->_lang['sb_final_memory']);
$parse['memory_i'] = str_replace(array("%i", "%m"), $result['initial_memory'], $this->_lang['sb_start_memory']);
$parse['alert'] = Administration_Lib::save_message('ok', str_replace("%t", $result['totaltime'], $this->_lang['sb_stats_update']));
// UPDATE STATISTICS LAST UPDATE
Functions_Lib::update_config('stat_last_update', $result['stats_time']);
// SHOW TEMPLATE
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/buildstats_view'), $parse));
}
示例14: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && $this->_current_user['user_authlevel'] == 3) {
include_once XGP_ROOT . 'application/libraries/Creator_Lib.php';
$this->_creator = new Creator_Lib();
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例15: calculate_points
/**
* method calculate_points
* param $element
* param $level
* return the points for the current element and level
*/
public static function calculate_points($element, $level, $type = '')
{
switch ($type) {
case 'tech':
$current_level = $level;
break;
case '':
default:
$current_level = $level - 1 < 0 ? 0 : $level - 1;
break;
}
$element = parent::$objects->get_price($element);
$resources_total = $element['metal'] + $element['crystal'] + $element['deuterium'];
$level_mult = pow($element['factor'], $current_level);
$points = $resources_total * $level_mult / Functions_Lib::read_config('stat_settings');
return $points;
}