mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
* some optimizations & fixes according to awesome PHPStorm Php Inspections plugin!
This commit is contained in:
parent
c48452b37d
commit
eab416c0b4
11
common.php
11
common.php
@ -30,7 +30,7 @@ define('MYAAC_VERSION', '0.8.0-dev');
|
|||||||
define('DATABASE_VERSION', 23);
|
define('DATABASE_VERSION', 23);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
|
|
||||||
// account flags
|
// account flags
|
||||||
define('FLAG_ADMIN', 1);
|
define('FLAG_ADMIN', 1);
|
||||||
@ -54,7 +54,7 @@ define('TICKER', 2);
|
|||||||
define('ARTICLE', 3);
|
define('ARTICLE', 3);
|
||||||
|
|
||||||
// directories
|
// directories
|
||||||
define('BASE', dirname(__FILE__) . '/');
|
define('BASE', __DIR__ . '/');
|
||||||
define('ADMIN', BASE . 'admin/');
|
define('ADMIN', BASE . 'admin/');
|
||||||
define('SYSTEM', BASE . 'system/');
|
define('SYSTEM', BASE . 'system/');
|
||||||
define('CACHE', SYSTEM . 'cache/');
|
define('CACHE', SYSTEM . 'cache/');
|
||||||
@ -87,16 +87,15 @@ define('TFS_LAST', TFS_03);
|
|||||||
// basedir
|
// basedir
|
||||||
$basedir = '';
|
$basedir = '';
|
||||||
$tmp = explode('/', $_SERVER['SCRIPT_NAME']);
|
$tmp = explode('/', $_SERVER['SCRIPT_NAME']);
|
||||||
$size = sizeof($tmp) - 1;
|
$size = count($tmp) - 1;
|
||||||
for($i = 1; $i < $size; $i++)
|
for($i = 1; $i < $size; $i++)
|
||||||
$basedir .= '/' . $tmp[$i];
|
$basedir .= '/' . $tmp[$i];
|
||||||
|
|
||||||
$basedir = str_replace('/admin', '', $basedir);
|
$basedir = str_replace(array('/admin', '/install'), '', $basedir);
|
||||||
$basedir = str_replace('/install', '', $basedir);
|
|
||||||
define('BASE_DIR', $basedir);
|
define('BASE_DIR', $basedir);
|
||||||
|
|
||||||
if(isset($_SERVER['HTTP_HOST'])) {
|
if(isset($_SERVER['HTTP_HOST'])) {
|
||||||
if (isset($_SERVER['HTTPS'][0]) && $_SERVER['HTTPS'] == 'on')
|
if (isset($_SERVER['HTTPS'][0]) && $_SERVER['HTTPS'] === 'on')
|
||||||
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
|
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
|
||||||
else
|
else
|
||||||
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
|
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
|
||||||
|
33
index.php
33
index.php
@ -29,8 +29,8 @@
|
|||||||
// ini_set('display_startup_errors', 1);
|
// ini_set('display_startup_errors', 1);
|
||||||
// error_reporting(E_ALL);
|
// error_reporting(E_ALL);
|
||||||
|
|
||||||
require_once('common.php');
|
require_once 'common.php';
|
||||||
require_once(SYSTEM . 'functions.php');
|
require_once SYSTEM . 'functions.php';
|
||||||
|
|
||||||
$uri = $_SERVER['REQUEST_URI'];
|
$uri = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
|||||||
$_REQUEST['name'] = urldecode($tmp[0]);
|
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||||
|
|
||||||
chdir(TOOLS . 'signature');
|
chdir(TOOLS . 'signature');
|
||||||
include(TOOLS . 'signature/index.php');
|
include TOOLS . 'signature/index.php';
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
|
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
|
||||||
@ -57,7 +57,7 @@ else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists(BASE . 'config.local.php'))
|
if(file_exists(BASE . 'config.local.php'))
|
||||||
require_once(BASE . 'config.local.php');
|
require_once BASE . 'config.local.php';
|
||||||
|
|
||||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||||
{
|
{
|
||||||
@ -120,8 +120,7 @@ else {
|
|||||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
|
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2')
|
||||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($rules as $rule => $redirect) {
|
foreach($rules as $rule => $redirect) {
|
||||||
@ -164,15 +163,15 @@ define('PAGE', $page);
|
|||||||
|
|
||||||
$template_place_holders = array();
|
$template_place_holders = array();
|
||||||
|
|
||||||
require_once(SYSTEM . 'init.php');
|
require_once SYSTEM . 'init.php';
|
||||||
|
|
||||||
// event system
|
// event system
|
||||||
require_once(SYSTEM . 'hooks.php');
|
require_once SYSTEM . 'hooks.php';
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
$hooks->load();
|
$hooks->load();
|
||||||
require_once(SYSTEM . 'template.php');
|
require_once SYSTEM . 'template.php';
|
||||||
require_once(SYSTEM . 'login.php');
|
require_once SYSTEM . 'login.php';
|
||||||
require_once(SYSTEM . 'status.php');
|
require_once SYSTEM . 'status.php';
|
||||||
|
|
||||||
$twig->addGlobal('config', $config);
|
$twig->addGlobal('config', $config);
|
||||||
$twig->addGlobal('status', $status);
|
$twig->addGlobal('status', $status);
|
||||||
@ -236,11 +235,11 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($config['views_counter'])
|
if($config['views_counter'])
|
||||||
require_once(SYSTEM . 'counter.php');
|
require_once SYSTEM . 'counter.php';
|
||||||
|
|
||||||
if($config['visitors_counter'])
|
if($config['visitors_counter'])
|
||||||
{
|
{
|
||||||
require_once(SYSTEM . 'libs/visitors.php');
|
require_once SYSTEM . 'libs/visitors.php';
|
||||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +263,7 @@ if(fetchDatabaseConfig('site_closed', $site_closed)) {
|
|||||||
if(!$logged)
|
if(!$logged)
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
require(SYSTEM . 'pages/accountmanagement.php');
|
require SYSTEM . 'pages/accountmanagement.php';
|
||||||
$content .= ob_get_contents();
|
$content .= ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$load_it = false;
|
$load_it = false;
|
||||||
@ -305,7 +304,7 @@ if($config['backward_support']) {
|
|||||||
$config['site']['screenshot_page'] = true;
|
$config['site']['screenshot_page'] = true;
|
||||||
|
|
||||||
if($config['forum'] != '')
|
if($config['forum'] != '')
|
||||||
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']);
|
$config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']);
|
||||||
|
|
||||||
foreach($status as $key => $value)
|
foreach($status as $key => $value)
|
||||||
$config['status']['serverStatus_' . $key] = $value;
|
$config['status']['serverStatus_' . $key] = $value;
|
||||||
@ -317,7 +316,7 @@ if($load_it)
|
|||||||
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
|
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
|
||||||
|
|
||||||
if($config['backward_support'])
|
if($config['backward_support'])
|
||||||
require(SYSTEM . 'compat_pages.php');
|
require SYSTEM . 'compat_pages.php';
|
||||||
|
|
||||||
$ignore = false;
|
$ignore = false;
|
||||||
|
|
||||||
@ -388,7 +387,7 @@ if($load_it)
|
|||||||
ob_start();
|
ob_start();
|
||||||
if($hooks->trigger(HOOK_BEFORE_PAGE)) {
|
if($hooks->trigger(HOOK_BEFORE_PAGE)) {
|
||||||
if(!$ignore)
|
if(!$ignore)
|
||||||
require($file);
|
require $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config['backward_support'] && isset($main_content[0]))
|
if($config['backward_support'] && isset($main_content[0]))
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
if(!isset($config['database_type'][0]) || !isset($config['database_user'][0]) || !isset($config['database_password'][0]) || !isset($config['database_name'][0]))
|
if(!isset($config['database_type'][0], $config['database_user'][0], $config['database_password'][0], $config['database_name'][0]))
|
||||||
{
|
{
|
||||||
if(isset($config['lua']['sqlType'])) {// tfs 0.3
|
if(isset($config['lua']['sqlType'])) {// tfs 0.3
|
||||||
if(isset($config['lua']['mysqlHost'])) {// tfs 0.2
|
if(isset($config['lua']['mysqlHost'])) {// tfs 0.2
|
||||||
|
@ -70,7 +70,7 @@ function getPlayerLink($name, $generate = true)
|
|||||||
if(is_numeric($name))
|
if(is_numeric($name))
|
||||||
{
|
{
|
||||||
$player = new OTS_Player();
|
$player = new OTS_Player();
|
||||||
$player->load(intval($name));
|
$player->load((int)$name);
|
||||||
if($player->isLoaded())
|
if($player->isLoaded())
|
||||||
$name = $player->getName();
|
$name = $player->getName();
|
||||||
}
|
}
|
||||||
@ -88,9 +88,7 @@ function getHouseLink($name, $generate = true)
|
|||||||
if(is_numeric($name))
|
if(is_numeric($name))
|
||||||
{
|
{
|
||||||
$house = $db->query(
|
$house = $db->query(
|
||||||
'SELECT ' . $db->fieldName('name') .
|
'SELECT `name` FROM `houses` WHERE `id` = ' . (int)$name);
|
||||||
' FROM ' . $db->tableName('houses') .
|
|
||||||
' WHERE ' . $db->fieldName('id') . ' = ' . (int)$name);
|
|
||||||
if($house->rowCount() > 0)
|
if($house->rowCount() > 0)
|
||||||
$name = $house->fetchColumn();
|
$name = $house->fetchColumn();
|
||||||
}
|
}
|
||||||
@ -122,7 +120,7 @@ function getGuildLink($name, $generate = true)
|
|||||||
function getItemNameById($id) {
|
function getItemNameById($id) {
|
||||||
global $db;
|
global $db;
|
||||||
$query = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'items` WHERE `id` = ' . $db->quote($id) . ' LIMIT 1;');
|
$query = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'items` WHERE `id` = ' . $db->quote($id) . ' LIMIT 1;');
|
||||||
if($query->rowCount() == 1) {
|
if($query->rowCount() === 1) {
|
||||||
$item = $query->fetch();
|
$item = $query->fetch();
|
||||||
return $item['name'];
|
return $item['name'];
|
||||||
}
|
}
|
||||||
@ -154,7 +152,7 @@ function getFlagImage($country)
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
if(!isset($config['countries']))
|
if(!isset($config['countries']))
|
||||||
require(SYSTEM . 'countries.conf.php');
|
require SYSTEM . 'countries.conf.php';
|
||||||
|
|
||||||
if(!isset($config['countries'][$country])) {
|
if(!isset($config['countries'][$country])) {
|
||||||
return '';
|
return '';
|
||||||
@ -176,16 +174,18 @@ function getBoolean($v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(is_numeric($v))
|
if(is_numeric($v))
|
||||||
return intval($v) > 0;
|
return (int)$v > 0;
|
||||||
|
|
||||||
$v = strtolower($v);
|
$v = strtolower($v);
|
||||||
return $v == 'yes' || $v == 'true';
|
return $v === 'yes' || $v === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates random string.
|
* Generates random string.
|
||||||
*
|
*
|
||||||
* @param int $length Length of the generated string.
|
* @param int $length Length of the generated string.
|
||||||
|
* @param bool $lowCase Should lower case characters be used?
|
||||||
|
* @param bool $upCase Should upper case characters be used?
|
||||||
* @param bool $numeric Should numbers by used too?
|
* @param bool $numeric Should numbers by used too?
|
||||||
* @param bool $special Should special characters by used?
|
* @param bool $special Should special characters by used?
|
||||||
* @return string Generated string.
|
* @return string Generated string.
|
||||||
@ -242,7 +242,7 @@ function fetchDatabaseConfig($name, &$value)
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$query = $db->query('SELECT ' . $db->fieldName('value') . ' FROM ' . $db->tableName(TABLE_PREFIX . 'config') . ' WHERE ' . $db->fieldName('name') . ' = ' . $db->quote($name));
|
$query = $db->query('SELECT `value` FROM `' . TABLE_PREFIX . 'config` WHERE `name` = ' . $db->quote($name));
|
||||||
if($query->rowCount() <= 0)
|
if($query->rowCount() <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -297,9 +297,9 @@ function encrypt($str)
|
|||||||
$str .= $config['database_salt'];
|
$str .= $config['database_salt'];
|
||||||
|
|
||||||
$encryptionType = $config['database_encryption'];
|
$encryptionType = $config['database_encryption'];
|
||||||
if(isset($encryptionType) && strtolower($encryptionType) != 'plain')
|
if(isset($encryptionType) && strtolower($encryptionType) !== 'plain')
|
||||||
{
|
{
|
||||||
if($encryptionType == 'vahash')
|
if($encryptionType === 'vahash')
|
||||||
return base64_encode(hash('sha256', $str));
|
return base64_encode(hash('sha256', $str));
|
||||||
|
|
||||||
return hash($encryptionType, $str);
|
return hash($encryptionType, $str);
|
||||||
@ -350,6 +350,8 @@ function delete_player($name)
|
|||||||
$player->delete();
|
$player->delete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete guild with id
|
//delete guild with id
|
||||||
@ -407,7 +409,7 @@ function tickers()
|
|||||||
{
|
{
|
||||||
global $tickers_content, $featured_article;
|
global $tickers_content, $featured_article;
|
||||||
|
|
||||||
if(PAGE == 'news') {
|
if(PAGE === 'news') {
|
||||||
if(isset($tickers_content))
|
if(isset($tickers_content))
|
||||||
return $tickers_content . $featured_article;
|
return $tickers_content . $featured_article;
|
||||||
}
|
}
|
||||||
@ -429,9 +431,9 @@ function template_place_holder($type)
|
|||||||
if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type]))
|
if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type]))
|
||||||
$ret = implode($template_place_holders[$type]);
|
$ret = implode($template_place_holders[$type]);
|
||||||
|
|
||||||
if($type == 'head_start')
|
if($type === 'head_start')
|
||||||
$ret .= template_header();
|
$ret .= template_header();
|
||||||
elseif($type == 'body_end')
|
elseif($type === 'body_end')
|
||||||
$ret .= template_ga_code();
|
$ret .= template_ga_code();
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -506,7 +508,7 @@ function template_ga_code()
|
|||||||
global $config, $twig;
|
global $config, $twig;
|
||||||
if(!isset($config['google_analytics_id'][0]))
|
if(!isset($config['google_analytics_id'][0]))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return $twig->render('google_analytics.html.twig');
|
return $twig->render('google_analytics.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +576,7 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false)
|
|||||||
$players_rows .= "item or field";
|
$players_rows .= "item or field";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(in_array(substr(strtolower($killer), 0, 1), $vowels))
|
if(in_array(strtolower($killer[0]), $vowels))
|
||||||
$players_rows .= "an ";
|
$players_rows .= "an ";
|
||||||
else
|
else
|
||||||
$players_rows .= "a ";
|
$players_rows .= "a ";
|
||||||
@ -746,7 +748,7 @@ function get_templates()
|
|||||||
$path = TEMPLATES;
|
$path = TEMPLATES;
|
||||||
foreach(scandir($path) as $file)
|
foreach(scandir($path) as $file)
|
||||||
{
|
{
|
||||||
if($file[0] != '.' && $file != '..' && is_dir($path . $file))
|
if($file[0] !== '.' && $file !== '..' && is_dir($path . $file))
|
||||||
$ret[] = $file;
|
$ret[] = $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,7 +767,7 @@ function get_plugins()
|
|||||||
foreach(scandir($path) as $file) {
|
foreach(scandir($path) as $file) {
|
||||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
$file_name = pathinfo($file, PATHINFO_FILENAME);
|
$file_name = pathinfo($file, PATHINFO_FILENAME);
|
||||||
if ($file == '.' || $file == '..' || $file == 'disabled' || $file == 'example.json' || is_dir($path . $file) || $file_ext != 'json')
|
if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$ret[] = str_replace('.json', '', $file_name);
|
$ret[] = str_replace('.json', '', $file_name);
|
||||||
@ -797,7 +799,7 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
|||||||
global $mailer, $config;
|
global $mailer, $config;
|
||||||
if(!$mailer)
|
if(!$mailer)
|
||||||
{
|
{
|
||||||
require(SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php');
|
require SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php';
|
||||||
$mailer = new PHPMailer();
|
$mailer = new PHPMailer();
|
||||||
$mailer->setLanguage('en', LIBS . 'phpmailer/language/');
|
$mailer->setLanguage('en', LIBS . 'phpmailer/language/');
|
||||||
}
|
}
|
||||||
@ -871,9 +873,7 @@ function load_config_lua($filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$config_string = file_get_contents($filename);
|
$config_string = str_replace(array("\r\n", "\r"), "\n", file_get_contents($filename));
|
||||||
$config_string = str_replace("\r\n", "\n", $config_string);
|
|
||||||
$config_string = str_replace("\r", "\n", $config_string);
|
|
||||||
$lines = explode("\n", $config_string);
|
$lines = explode("\n", $config_string);
|
||||||
if(count($lines) > 0)
|
if(count($lines) > 0)
|
||||||
foreach($lines as $ln => $line)
|
foreach($lines as $ln => $line)
|
||||||
@ -984,12 +984,14 @@ function getTopPlayers($limit = 5) {
|
|||||||
$query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
|
$query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
|
||||||
$player['online'] = ($query->rowCount() > 0 ? 1 : 0);
|
$player['online'] = ($query->rowCount() > 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
unset($player);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($players as &$player) {
|
foreach($players as &$player) {
|
||||||
$player['rank'] = ++$i;
|
$player['rank'] = ++$i;
|
||||||
}
|
}
|
||||||
|
unset($player);
|
||||||
|
|
||||||
if($cache->enabled())
|
if($cache->enabled())
|
||||||
$cache->set('top_' . $limit . '_level', serialize($players), 120);
|
$cache->set('top_' . $limit . '_level', serialize($players), 120);
|
||||||
@ -1008,7 +1010,7 @@ function deleteDirectory($dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(scandir($dir) as $item) {
|
foreach(scandir($dir) as $item) {
|
||||||
if($item == '.' || $item == '..') {
|
if($item === '.' || $item === '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,6 +1023,6 @@ function deleteDirectory($dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validator functions
|
// validator functions
|
||||||
require_once(LIBS . 'validator.php');
|
require_once LIBS . 'validator.php';
|
||||||
require_once(SYSTEM . 'compat.php');
|
require_once SYSTEM . 'compat.php';
|
||||||
?>
|
?>
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
|
||||||
// load configuration
|
// load configuration
|
||||||
require_once(BASE . 'config.php');
|
require_once BASE . 'config.php';
|
||||||
if(file_exists(BASE . 'config.local.php')) // user customizations
|
if(file_exists(BASE . 'config.local.php')) // user customizations
|
||||||
require(BASE . 'config.local.php');
|
require BASE . 'config.local.php';
|
||||||
|
|
||||||
if(!isset($config['installed']) || !$config['installed']) {
|
if(!isset($config['installed']) || !$config['installed']) {
|
||||||
die('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
die('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||||
@ -20,7 +20,7 @@ if(!isset($config['installed']) || !$config['installed']) {
|
|||||||
|
|
||||||
date_default_timezone_set($config['date_timezone']);
|
date_default_timezone_set($config['date_timezone']);
|
||||||
// take care of trailing slash at the end
|
// take care of trailing slash at the end
|
||||||
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
|
if($config['server_path'][strlen($config['server_path']) - 1] !== '/')
|
||||||
$config['server_path'] .= '/';
|
$config['server_path'] .= '/';
|
||||||
|
|
||||||
// enable gzip compression if supported by the browser
|
// enable gzip compression if supported by the browser
|
||||||
@ -28,11 +28,11 @@ if($config['gzip_output'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($
|
|||||||
ob_start('ob_gzhandler');
|
ob_start('ob_gzhandler');
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
require_once(SYSTEM . 'libs/cache.php');
|
require_once SYSTEM . 'libs/cache.php';
|
||||||
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
$cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']);
|
||||||
|
|
||||||
// twig
|
// twig
|
||||||
require_once(LIBS . 'Twig/Autoloader.php');
|
require_once LIBS . 'Twig/Autoloader.php';
|
||||||
Twig_Autoloader::register();
|
Twig_Autoloader::register();
|
||||||
|
|
||||||
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates');
|
||||||
@ -117,35 +117,35 @@ if(isset($config['lua']['servername']))
|
|||||||
if(isset($config['lua']['houserentperiod']))
|
if(isset($config['lua']['houserentperiod']))
|
||||||
$config['lua']['houseRentPeriod'] = $config['lua']['houserentperiod'];
|
$config['lua']['houseRentPeriod'] = $config['lua']['houserentperiod'];
|
||||||
|
|
||||||
if($config['item_images_url'][strlen($config['item_images_url']) - 1] != '/')
|
if($config['item_images_url'][strlen($config['item_images_url']) - 1] !== '/')
|
||||||
$config['item_images_url'] .= '/';
|
$config['item_images_url'] .= '/';
|
||||||
|
|
||||||
// localize data/ directory
|
// localize data/ directory
|
||||||
if(isset($config['lua']['dataDirectory'][0]))
|
if(isset($config['lua']['dataDirectory'][0]))
|
||||||
{
|
{
|
||||||
$tmp = $config['lua']['dataDirectory'];
|
$tmp = $config['lua']['dataDirectory'];
|
||||||
if($tmp[0] != '/')
|
if($tmp[0] !== '/')
|
||||||
$tmp = $config['server_path'] . $tmp;
|
$tmp = $config['server_path'] . $tmp;
|
||||||
|
|
||||||
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
if($tmp[strlen($tmp) - 1] !== '/') // do not forget about trailing slash
|
||||||
$tmp .= '/';
|
$tmp .= '/';
|
||||||
}
|
}
|
||||||
else if(isset($config['lua']['data_directory'][0]))
|
else if(isset($config['lua']['data_directory'][0]))
|
||||||
{
|
{
|
||||||
$tmp = $config['lua']['data_directory'];
|
$tmp = $config['lua']['data_directory'];
|
||||||
if($tmp[0] != '/')
|
if($tmp[0] !== '/')
|
||||||
$tmp = $config['server_path'] . $tmp;
|
$tmp = $config['server_path'] . $tmp;
|
||||||
|
|
||||||
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
if($tmp[strlen($tmp) - 1] !== '/') // do not forget about trailing slash
|
||||||
$tmp .= '/';
|
$tmp .= '/';
|
||||||
}
|
}
|
||||||
else if(isset($config['lua']['datadir'][0]))
|
else if(isset($config['lua']['datadir'][0]))
|
||||||
{
|
{
|
||||||
$tmp = $config['lua']['datadir'];
|
$tmp = $config['lua']['datadir'];
|
||||||
if($tmp[0] != '/')
|
if($tmp[0] !== '/')
|
||||||
$tmp = $config['server_path'] . $tmp;
|
$tmp = $config['server_path'] . $tmp;
|
||||||
|
|
||||||
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
|
if($tmp[strlen($tmp) - 1] !== '/') // do not forget about trailing slash
|
||||||
$tmp .= '/';
|
$tmp .= '/';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -195,7 +195,7 @@ unset($tmp, $id, $vocation);
|
|||||||
|
|
||||||
// load towns
|
// load towns
|
||||||
/* TODO: doesnt work
|
/* TODO: doesnt work
|
||||||
ini_set('memory_limit', '-1');
|
ini_set('memory_limit', '-1');
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
|
|
||||||
if($cache->enabled() && $cache->fetch('towns', $tmp)) {
|
if($cache->enabled() && $cache->fetch('towns', $tmp)) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This file contains main toolkit class. Please read README file for quick startup guide and/or tutorials for more info.
|
* This file contains main toolkit class. Please read README file for quick startup guide and/or tutorials for more info.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @author Wrzasq <wrzasq@gmail.com>
|
* @author Wrzasq <wrzasq@gmail.com>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Main POT class.
|
* Main POT class.
|
||||||
*
|
*
|
||||||
* @package POT
|
* @package POT
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
*/
|
*/
|
||||||
@ -76,70 +76,70 @@ class POT
|
|||||||
const SKILL__LAST = self::SKILL__LEVEL;
|
const SKILL__LAST = self::SKILL__LEVEL;
|
||||||
/**
|
/**
|
||||||
* Head slot.
|
* Head slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_HEAD = 1;
|
const SLOT_HEAD = 1;
|
||||||
/**
|
/**
|
||||||
* Necklace slot.
|
* Necklace slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_NECKLACE = 2;
|
const SLOT_NECKLACE = 2;
|
||||||
/**
|
/**
|
||||||
* Backpack slot.
|
* Backpack slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_BACKPACK = 3;
|
const SLOT_BACKPACK = 3;
|
||||||
/**
|
/**
|
||||||
* Armor slot.
|
* Armor slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_ARMOR = 4;
|
const SLOT_ARMOR = 4;
|
||||||
/**
|
/**
|
||||||
* Right hand slot.
|
* Right hand slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_RIGHT = 5;
|
const SLOT_RIGHT = 5;
|
||||||
/**
|
/**
|
||||||
* Left hand slot.
|
* Left hand slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_LEFT = 6;
|
const SLOT_LEFT = 6;
|
||||||
/**
|
/**
|
||||||
* Legs slot.
|
* Legs slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_LEGS = 7;
|
const SLOT_LEGS = 7;
|
||||||
/**
|
/**
|
||||||
* Boots slot.
|
* Boots slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_FEET = 8;
|
const SLOT_FEET = 8;
|
||||||
/**
|
/**
|
||||||
* Ring slot.
|
* Ring slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
const SLOT_RING = 9;
|
const SLOT_RING = 9;
|
||||||
/**
|
/**
|
||||||
* Ammunition slot.
|
* Ammunition slot.
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @since 0.0.3
|
* @since 0.0.3
|
||||||
*/
|
*/
|
||||||
@ -147,7 +147,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* First depot item sid.
|
* First depot item sid.
|
||||||
*
|
*
|
||||||
* @version 0.0.4
|
* @version 0.0.4
|
||||||
* @since 0.0.4
|
* @since 0.0.4
|
||||||
*/
|
*/
|
||||||
@ -155,21 +155,21 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* IP ban.
|
* IP ban.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
const BAN_IP = 1;
|
const BAN_IP = 1;
|
||||||
/**
|
/**
|
||||||
* Player ban.
|
* Player ban.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
const BAN_PLAYER = 2;
|
const BAN_PLAYER = 2;
|
||||||
/**
|
/**
|
||||||
* Account ban.
|
* Account ban.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
@ -177,14 +177,14 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ascencind sorting order.
|
* Ascencind sorting order.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
const ORDER_ASC = 1;
|
const ORDER_ASC = 1;
|
||||||
/**
|
/**
|
||||||
* Descending sorting order.
|
* Descending sorting order.
|
||||||
*
|
*
|
||||||
* @version 0.0.5
|
* @version 0.0.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
*/
|
*/
|
||||||
@ -211,11 +211,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton.
|
* Singleton.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method return global instance of POT class. You can only fetch it this way - class constructor is private and you can't create instance of it other way. This is clasic singleton implementation. As class names are globaly accessible you can fetch it anywhere in code.
|
* This method return global instance of POT class. You can only fetch it this way - class constructor is private and you can't create instance of it other way. This is clasic singleton implementation. As class names are globaly accessible you can fetch it anywhere in code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return POT Global POT class instance.
|
* @return POT Global POT class instance.
|
||||||
* @example examples/quickstart.php quickstart.php
|
* @example examples/quickstart.php quickstart.php
|
||||||
* @tutorial POT/Basics.pkg#basics.instance
|
* @tutorial POT/Basics.pkg#basics.instance
|
||||||
@ -235,22 +235,22 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* POT classes directory.
|
* POT classes directory.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Directory path to POT files.
|
* Directory path to POT files.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $path = '';
|
private $path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set POT directory.
|
* Set POT directory.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Use this method if you keep your POT package in different directory then this file. Don't need to care about trailing directory separator - it will append it if needed.
|
* Use this method if you keep your POT package in different directory then this file. Don't need to care about trailing directory separator - it will append it if needed.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param string $path POT files path.
|
* @param string $path POT files path.
|
||||||
* @example examples/fakeroot.php fakeroot.php
|
* @example examples/fakeroot.php fakeroot.php
|
||||||
* @tutorial POT/Basics.pkg#basics.fakeroot
|
* @tutorial POT/Basics.pkg#basics.fakeroot
|
||||||
@ -260,7 +260,7 @@ class POT
|
|||||||
$this->path = str_replace('\\', '/', $path);
|
$this->path = str_replace('\\', '/', $path);
|
||||||
|
|
||||||
// appends ending slash to directory path
|
// appends ending slash to directory path
|
||||||
if( substr($this->path, -1) != '/')
|
if( substr($this->path, -1) !== '/')
|
||||||
{
|
{
|
||||||
$this->path .= '/';
|
$this->path .= '/';
|
||||||
}
|
}
|
||||||
@ -268,44 +268,44 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class initialization tools.
|
* Class initialization tools.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Never create instance of this class by yourself! Use POT::getInstance()!
|
* Never create instance of this class by yourself! Use POT::getInstance()!
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.0.2 version this method registers spl_autoload_register() callback. If you use POT with PHP 5.0 you need {@link compat.php compat.php library} to prevent from FATAL errors.
|
* Note: Since 0.0.2 version this method registers spl_autoload_register() callback. If you use POT with PHP 5.0 you need {@link compat.php compat.php library} to prevent from FATAL errors.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.0.3 version this method is private.
|
* Note: Since 0.0.3 version this method is private.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
*/
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
// default POT directory
|
// default POT directory
|
||||||
$this->path = dirname(__FILE__) . '/';
|
$this->path = __DIR__ . '/';
|
||||||
// registers POT autoload mechanism
|
// registers POT autoload mechanism
|
||||||
spl_autoload_register( array($this, 'loadClass') );
|
spl_autoload_register( array($this, 'loadClass') );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads POT class file.
|
* Loads POT class file.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Runtime class loading on demand - usefull for autoloading functions. Usualy you don't need to call this method directly.
|
* Runtime class loading on demand - usefull for autoloading functions. Usualy you don't need to call this method directly.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.0.2 version this method is suitable for spl_autoload_register().
|
* Note: Since 0.0.2 version this method is suitable for spl_autoload_register().
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.0.3 version this method handles also exception classes.
|
* Note: Since 0.0.3 version this method handles also exception classes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.3
|
* @version 0.0.3
|
||||||
* @param string $class Class name.
|
* @param string $class Class name.
|
||||||
*/
|
*/
|
||||||
@ -319,43 +319,43 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Database connection.
|
* Database connection.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* OTServ database connection object.
|
* OTServ database connection object.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @var PDO
|
* @var PDO
|
||||||
*/
|
*/
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to database.
|
* Connects to database.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Creates OTServ database connection object.
|
* Creates OTServ database connection object.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* First parameter is one of database driver constants values. Currently {@link OTS_DB_MySQL MySQL}, {@link OTS_DB_SQLite SQLite}, {@link OTS_DB_PostgreSQL PostgreSQL} and {@link OTS_DB_ODBC ODBC} drivers are supported. This parameter can be null, then you have to specify <var>'driver'</var> parameter. Such way is comfortable to store entire database configuration in one array and possibly runtime evaluation and/or configuration file saving.
|
* First parameter is one of database driver constants values. Currently {@link OTS_DB_MySQL MySQL}, {@link OTS_DB_SQLite SQLite}, {@link OTS_DB_PostgreSQL PostgreSQL} and {@link OTS_DB_ODBC ODBC} drivers are supported. This parameter can be null, then you have to specify <var>'driver'</var> parameter. Such way is comfortable to store entire database configuration in one array and possibly runtime evaluation and/or configuration file saving.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* For parameters list see driver documentation. Common parameters for all drivers are:
|
* For parameters list see driver documentation. Common parameters for all drivers are:
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li><var>driver</var> - optional, specifies driver, aplies when <var>$driver</var> method parameter is <i>null</i>,</li>
|
* <li><var>driver</var> - optional, specifies driver, aplies when <var>$driver</var> method parameter is <i>null</i>,</li>
|
||||||
* <li><var>prefix</var> - optional, prefix for database tables, use if you have more then one OTServ installed on one database.</li>
|
* <li><var>prefix</var> - optional, prefix for database tables, use if you have more then one OTServ installed on one database.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.1 version this method throws {@link E_OTS_Generic E_OTS_Generic exceptions} instead of general Exception class objects. Since all exception classes are child classes of Exception class so your old code will still handle all exceptions.
|
* Note: Since 0.1.1 version this method throws {@link E_OTS_Generic E_OTS_Generic exceptions} instead of general Exception class objects. Since all exception classes are child classes of Exception class so your old code will still handle all exceptions.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.2 version this method checks if PDO extension is loaded and if not, then throws LogicException. This exception class is part of SPL library and was introduced in PHP 5.1 so if you use PHP 5.0 you will need to load {@link compat.php compat.php library} first.
|
* Note: Since 0.1.2 version this method checks if PDO extension is loaded and if not, then throws LogicException. This exception class is part of SPL library and was introduced in PHP 5.1 so if you use PHP 5.0 you will need to load {@link compat.php compat.php library} first.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @param array $params Connection info.
|
* @param array $params Connection info.
|
||||||
* @throws LogicException When PDO extension is not loaded.
|
* @throws LogicException When PDO extension is not loaded.
|
||||||
@ -391,15 +391,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries server status.
|
* Queries server status.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Sends 'info' packet to OTS server and return output. Returns {@link OTS_InfoRespond OTS_InfoRespond} (wrapper for XML data) with results or <var>false</var> if server is online.
|
* Sends 'info' packet to OTS server and return output. Returns {@link OTS_InfoRespond OTS_InfoRespond} (wrapper for XML data) with results or <var>false</var> if server is online.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.4 version this method is static so you can call it staticly, but it is also still possible to call it in dynamic context.
|
* Note: Since 0.1.4 version this method is static so you can call it staticly, but it is also still possible to call it in dynamic context.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.4
|
* @version 0.1.4
|
||||||
* @since 0.0.2
|
* @since 0.0.2
|
||||||
* @param string $server Server IP/domain.
|
* @param string $server Server IP/domain.
|
||||||
@ -418,19 +418,19 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns database connection handle.
|
* Returns database connection handle.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* At all you shouldn't use this method and work with database using POT classes, but it may be sometime necessary to use direct database access (mainly until POT won't provide many important features).
|
* At all you shouldn't use this method and work with database using POT classes, but it may be sometime necessary to use direct database access (mainly until POT won't provide many important features).
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* It is also important as serialised objects after unserialisation needs to be re-initialised with database connection.
|
* It is also important as serialised objects after unserialisation needs to be re-initialised with database connection.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note that before you will be able to fetch connection handler, you have to connect to database using {@link POT::connect() connect() method}.
|
* Note that before you will be able to fetch connection handler, you have to connect to database using {@link POT::connect() connect() method}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.0.4
|
* @version 0.0.4
|
||||||
* @since 0.0.4
|
* @since 0.0.4
|
||||||
* @return PDO Database connection handle.
|
* @return PDO Database connection handle.
|
||||||
@ -442,15 +442,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bans given IP number.
|
* Bans given IP number.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Adds IP/mask ban. You can call this function with only one parameter to ban only given IP address without expiration.
|
* Adds IP/mask ban. You can call this function with only one parameter to ban only given IP address without expiration.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Second parameter is mask which you can use to ban entire IP classes. Third parameter is time after which ban will expire. However - this is not lifetime - it is timestamp of moment, when ban should expire (and <var>0</var> means forever).
|
* Second parameter is mask which you can use to ban entire IP classes. Third parameter is time after which ban will expire. However - this is not lifetime - it is timestamp of moment, when ban should expire (and <var>0</var> means forever).
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @param string $ip IP to ban.
|
* @param string $ip IP to ban.
|
||||||
@ -493,11 +493,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes ban from given IP number.
|
* Deletes ban from given IP number.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Removes given IP/mask ban. Remember to specify also mask if you banned intire IP class.
|
* Removes given IP/mask ban. Remember to specify also mask if you banned intire IP class.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @param string $ip IP to ban.
|
* @param string $ip IP to ban.
|
||||||
@ -528,7 +528,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if given IP is banned.
|
* Checks if given IP is banned.
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @param string $ip IP to ban.
|
* @param string $ip IP to ban.
|
||||||
@ -557,7 +557,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of banned IPs as list of pairs (ip => IP, mask => MASK).
|
* Returns list of banned IPs as list of pairs (ip => IP, mask => MASK).
|
||||||
*
|
*
|
||||||
* @version 0.1.5
|
* @version 0.1.5
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @return array List of banned IPs.
|
* @return array List of banned IPs.
|
||||||
@ -594,7 +594,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of vocations.
|
* List of vocations.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @var OTS_VocationsList
|
* @var OTS_VocationsList
|
||||||
@ -603,15 +603,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads vocations list.
|
* Loads vocations list.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads vocations from given file. You can create local instances of vocations lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
* This method loads vocations from given file. You can create local instances of vocations lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.0 version this method loads instance of {@link OTS_VocationsList OTS_VocationsList} which you should fetch to get vocations info instead of calling POT class methods.
|
* Note: Since 0.1.0 version this method loads instance of {@link OTS_VocationsList OTS_VocationsList} which you should fetch to get vocations info instead of calling POT class methods.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @param string $file vocations.xml file location.
|
* @param string $file vocations.xml file location.
|
||||||
@ -625,11 +625,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if vocations are loaded.
|
* Checks if vocations are loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching vocations list in new enviroment, or after loading new list to make sure it is loaded.
|
* You should use this method before fetching vocations list in new enviroment, or after loading new list to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if vocations are loaded.
|
* @return bool True if vocations are loaded.
|
||||||
@ -641,7 +641,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads vocations list.
|
* Unloads vocations list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -652,11 +652,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns vocations list object.
|
* Returns vocations list object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.0 version this method returns loaded instance of {@link OTS_VocationsList OTS_VocationsList} instead of array. However {@link OTS_VocationsList OTS_VocationsList class} provides full array interface including Iterator, Countable and ArrayAccess interfaces so your code will work fine with it.
|
* Note: Since 0.1.0 version this method returns loaded instance of {@link OTS_VocationsList OTS_VocationsList} instead of array. However {@link OTS_VocationsList OTS_VocationsList class} provides full array interface including Iterator, Countable and ArrayAccess interfaces so your code will work fine with it.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.0.5
|
* @since 0.0.5
|
||||||
* @return OTS_VocationsList List of vocations.
|
* @return OTS_VocationsList List of vocations.
|
||||||
@ -710,7 +710,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of loaded monsters.
|
* List of loaded monsters.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.0.6
|
* @since 0.0.6
|
||||||
* @var OTS_MonstersList
|
* @var OTS_MonstersList
|
||||||
@ -719,15 +719,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads monsters mapping file.
|
* Loads monsters mapping file.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads monsters list from <var>monsters.xml</var> file in given directory. You can create local instances of monsters lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
* This method loads monsters list from <var>monsters.xml</var> file in given directory. You can create local instances of monsters lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.0 version this method loads instance of {@link OTS_MonstersList OTS_MonstersList} which you should fetch to get vocations info instead of calling POT class methods.
|
* Note: Since 0.1.0 version this method loads instance of {@link OTS_MonstersList OTS_MonstersList} which you should fetch to get vocations info instead of calling POT class methods.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.0.6
|
* @since 0.0.6
|
||||||
* @param string $path Monsters directory.
|
* @param string $path Monsters directory.
|
||||||
@ -740,11 +740,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if monsters are loaded.
|
* Checks if monsters are loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching monsters list in new enviroment, or after loading new list to make sure it is loaded.
|
* You should use this method before fetching monsters list in new enviroment, or after loading new list to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if monsters are loaded.
|
* @return bool True if monsters are loaded.
|
||||||
@ -756,7 +756,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads monsters list.
|
* Unloads monsters list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -767,11 +767,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of laoded monsters.
|
* Returns list of laoded monsters.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.0 version this method returns loaded instance of {@link OTS_MonstersList OTS_MonstersList} instead of array. However {@link OTS_MonstersList OTS_MonstersList class} provides full array interface including Iterator, Countable and ArrayAccess interfaces so your code will work fine with it.
|
* Note: Since 0.1.0 version this method returns loaded instance of {@link OTS_MonstersList OTS_MonstersList} instead of array. However {@link OTS_MonstersList OTS_MonstersList class} provides full array interface including Iterator, Countable and ArrayAccess interfaces so your code will work fine with it.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.0.6
|
* @since 0.0.6
|
||||||
* @return OTS_MonstersList List of monsters.
|
* @return OTS_MonstersList List of monsters.
|
||||||
@ -807,7 +807,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Spells list.
|
* Spells list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var OTS_SpellsList
|
* @var OTS_SpellsList
|
||||||
@ -816,15 +816,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads spells list.
|
* Loads spells list.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads spells list from given file. You can create local instances of spells lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
* This method loads spells list from given file. You can create local instances of spells lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: Since 0.1.0 version this method loads instance of {@link OTS_SpellsList OTS_SpellsList} which you should fetch to get vocations info instead of calling POT class methods.
|
* Note: Since 0.1.0 version this method loads instance of {@link OTS_SpellsList OTS_SpellsList} which you should fetch to get vocations info instead of calling POT class methods.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.0.7
|
* @since 0.0.7
|
||||||
* @param string $file Spells file name.
|
* @param string $file Spells file name.
|
||||||
@ -837,11 +837,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if spells are loaded.
|
* Checks if spells are loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching spells list in new enviroment, or after loading new list to make sure it is loaded.
|
* You should use this method before fetching spells list in new enviroment, or after loading new list to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if spells are loaded.
|
* @return bool True if spells are loaded.
|
||||||
@ -853,7 +853,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads spells list.
|
* Unloads spells list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -864,7 +864,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of laoded spells.
|
* Returns list of laoded spells.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return OTS_SpellsList List of spells.
|
* @return OTS_SpellsList List of spells.
|
||||||
@ -987,7 +987,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of loaded houses.
|
* List of loaded houses.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var OTS_HousesList
|
* @var OTS_HousesList
|
||||||
@ -996,11 +996,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads houses list file.
|
* Loads houses list file.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads houses list from given file. You can create local instances of houses lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
* This method loads houses list from given file. You can create local instances of houses lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $path Houses file.
|
* @param string $path Houses file.
|
||||||
@ -1013,11 +1013,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if houses are loaded.
|
* Checks if houses are loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching houses list in new enviroment, or after loading new list to make sure it is loaded.
|
* You should use this method before fetching houses list in new enviroment, or after loading new list to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if houses are loaded.
|
* @return bool True if houses are loaded.
|
||||||
@ -1029,7 +1029,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads houses list.
|
* Unloads houses list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -1040,7 +1040,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of laoded houses.
|
* Returns list of laoded houses.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return OTS_HousesList List of houses.
|
* @return OTS_HousesList List of houses.
|
||||||
@ -1094,7 +1094,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache handler for items loading.
|
* Cache handler for items loading.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var IOTS_FileCache
|
* @var IOTS_FileCache
|
||||||
@ -1103,11 +1103,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Presets cache handler for items loader.
|
* Presets cache handler for items loader.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Use this method in order to preset cache handler for items list that you want to load into global POT instance. Note that this driver will be set for global resource only. If you will create local items list instances they won't use this driver automaticly.
|
* Use this method in order to preset cache handler for items list that you want to load into global POT instance. Note that this driver will be set for global resource only. If you will create local items list instances they won't use this driver automaticly.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param IOTS_FileCache $cache Cache handler (skip this parameter to reset cache handler to null).
|
* @param IOTS_FileCache $cache Cache handler (skip this parameter to reset cache handler to null).
|
||||||
*/
|
*/
|
||||||
public function setItemsCache(IOTS_FileCache $cache = null)
|
public function setItemsCache(IOTS_FileCache $cache = null)
|
||||||
@ -1117,7 +1117,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of loaded items.
|
* List of loaded items.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var OTS_ItemsList
|
* @var OTS_ItemsList
|
||||||
@ -1126,11 +1126,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads items list.
|
* Loads items list.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads items list from <var>items.xml</var> and <var>items.otb</var> files from given directory. You can create local instances of items lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
* This method loads items list from <var>items.xml</var> and <var>items.otb</var> files from given directory. You can create local instances of items lists directly - calling this method will associate loaded list with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $path Items information directory.
|
* @param string $path Items information directory.
|
||||||
@ -1151,11 +1151,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if items are loaded.
|
* Checks if items are loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching items list in new enviroment, or after loading new list to make sure it is loaded.
|
* You should use this method before fetching items list in new enviroment, or after loading new list to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if items are loaded.
|
* @return bool True if items are loaded.
|
||||||
@ -1167,7 +1167,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads items list.
|
* Unloads items list.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -1178,7 +1178,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of laoded items.
|
* Returns list of laoded items.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return OTS_ItemsList List of items.
|
* @return OTS_ItemsList List of items.
|
||||||
@ -1232,7 +1232,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache handler for OTBM loading.
|
* Cache handler for OTBM loading.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var IOTS_FileCache
|
* @var IOTS_FileCache
|
||||||
@ -1241,11 +1241,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Presets cache handler for OTBM loader.
|
* Presets cache handler for OTBM loader.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Use this method in order to preset cache handler for map that you want to load into global POT instance. Note that this driver will be set for global resource only. If you will create local OTBM instances they won't use this driver automaticly.
|
* Use this method in order to preset cache handler for map that you want to load into global POT instance. Note that this driver will be set for global resource only. If you will create local OTBM instances they won't use this driver automaticly.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param IOTS_FileCache $cache Cache handler (skip this parameter to reset cache handler to null).
|
* @param IOTS_FileCache $cache Cache handler (skip this parameter to reset cache handler to null).
|
||||||
*/
|
*/
|
||||||
public function setMapCache(IOTS_FileCache $cache = null)
|
public function setMapCache(IOTS_FileCache $cache = null)
|
||||||
@ -1255,7 +1255,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loaded map.
|
* Loaded map.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var OTS_OTBMFile
|
* @var OTS_OTBMFile
|
||||||
@ -1264,15 +1264,15 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads OTBM map.
|
* Loads OTBM map.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method loads OTBM map from given file. You can create local instances of maps directly - calling this method will associate loaded map with POT class instance and will make it available everywhere in the code.
|
* This method loads OTBM map from given file. You can create local instances of maps directly - calling this method will associate loaded map with POT class instance and will make it available everywhere in the code.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Note: This method will also load houses list associated with map.
|
* Note: This method will also load houses list associated with map.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param string $path Map file path.
|
* @param string $path Map file path.
|
||||||
@ -1293,11 +1293,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if OTBM is loaded.
|
* Checks if OTBM is loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* You should use this method before fetching map information in new enviroment, or after loading new map to make sure it is loaded.
|
* You should use this method before fetching map information in new enviroment, or after loading new map to make sure it is loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if map is loaded.
|
* @return bool True if map is loaded.
|
||||||
@ -1309,7 +1309,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads OTBM map.
|
* Unloads OTBM map.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -1320,7 +1320,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns loaded map.
|
* Returns loaded map.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return OTS_OTBMFile Loaded OTBM file.
|
* @return OTS_OTBMFile Loaded OTBM file.
|
||||||
@ -1425,7 +1425,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Display driver.
|
* Display driver.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @var IOTS_Display
|
* @var IOTS_Display
|
||||||
@ -1434,7 +1434,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets display driver for database-related resources.
|
* Sets display driver for database-related resources.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @param IOTS_Display $display Display driver.
|
* @param IOTS_Display $display Display driver.
|
||||||
@ -1446,11 +1446,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if any display driver is loaded.
|
* Checks if any display driver is loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is mostly used internaly by POT classes.
|
* This method is mostly used internaly by POT classes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return bool True if driver is loaded.
|
* @return bool True if driver is loaded.
|
||||||
@ -1462,7 +1462,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads display driver.
|
* Unloads display driver.
|
||||||
*
|
*
|
||||||
* @version 0.1.0
|
* @version 0.1.0
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
@ -1473,11 +1473,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current display driver.
|
* Returns current display driver.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is mostly used internaly by POT classes.
|
* This method is mostly used internaly by POT classes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @return IOTS_Display Current display driver.
|
* @return IOTS_Display Current display driver.
|
||||||
@ -1495,7 +1495,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Display driver for non-database resources.
|
* Display driver for non-database resources.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @var IOTS_DataDisplay
|
* @var IOTS_DataDisplay
|
||||||
@ -1504,7 +1504,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets display driver for non-database resources.
|
* Sets display driver for non-database resources.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @param IOTS_DataDisplay $dataDisplay Display driver.
|
* @param IOTS_DataDisplay $dataDisplay Display driver.
|
||||||
@ -1516,11 +1516,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if any display driver for non-database resources is loaded.
|
* Checks if any display driver for non-database resources is loaded.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is mostly used internaly by POT classes.
|
* This method is mostly used internaly by POT classes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @return bool True if driver is loaded.
|
* @return bool True if driver is loaded.
|
||||||
@ -1532,7 +1532,7 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads display driver.
|
* Unloads display driver.
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
*/
|
*/
|
||||||
@ -1543,11 +1543,11 @@ class POT
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current display driver.
|
* Returns current display driver.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This method is mostly used internaly by POT classes.
|
* This method is mostly used internaly by POT classes.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @version 0.1.3
|
* @version 0.1.3
|
||||||
* @since 0.1.3
|
* @since 0.1.3
|
||||||
* @return IOTS_DataDisplay Current display driver.
|
* @return IOTS_DataDisplay Current display driver.
|
||||||
|
@ -31,7 +31,7 @@ if($current_session !== false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ACTION == 'logout' && !isset($_REQUEST['account_login'])) {
|
if(ACTION === 'logout' && !isset($_REQUEST['account_login'])) {
|
||||||
if(isset($account_logged) && $account_logged->isLoaded()) {
|
if(isset($account_logged) && $account_logged->isLoaded()) {
|
||||||
if($hooks->trigger(HOOK_LOGOUT, array('account' => $account_logged, 'password' => getSession('password')))) {
|
if($hooks->trigger(HOOK_LOGOUT, array('account' => $account_logged, 'password' => getSession('password')))) {
|
||||||
unsetSession('account');
|
unsetSession('account');
|
||||||
@ -52,7 +52,7 @@ if(ACTION == 'logout' && !isset($_REQUEST['account_login'])) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// new login with data from form
|
// new login with data from form
|
||||||
if(!$logged && isset($_POST['account_login']) && isset($_POST['password_login']))
|
if(!$logged && isset($_POST['account_login'], $_POST['password_login']))
|
||||||
{
|
{
|
||||||
$login_account = $_POST['account_login'];
|
$login_account = $_POST['account_login'];
|
||||||
$login_password = $_POST['password_login'];
|
$login_password = $_POST['password_login'];
|
||||||
|
@ -56,7 +56,7 @@ if($cache->enabled())
|
|||||||
if($fetch_from_db)
|
if($fetch_from_db)
|
||||||
{
|
{
|
||||||
// get info from db
|
// get info from db
|
||||||
$status_query = $db->query('SELECT ' . $db->fieldName('name') . ', ' . $db->fieldName('value') . ' FROM ' . $db->tableName(TABLE_PREFIX . 'config') . ' WHERE ' . $db->fieldName('name') . ' LIKE "%status%"');
|
$status_query = $db->query('SELECT `name`, `value` FROM `' . TABLE_PREFIX . 'config` WHERE ' . $db->fieldName('name') . ' LIKE "%status%"');
|
||||||
if($status_query->rowCount() <= 0) // empty, just insert it
|
if($status_query->rowCount() <= 0) // empty, just insert it
|
||||||
{
|
{
|
||||||
foreach($status as $key => $value)
|
foreach($status as $key => $value)
|
||||||
|
@ -66,7 +66,7 @@ if($exists || ($config['backward_support'] && file_exists(BASE . $template_path
|
|||||||
$config[$key] = $value;
|
$config[$key] = $value;
|
||||||
}
|
}
|
||||||
else if(file_exists(BASE . $template_path . '/config.php'))
|
else if(file_exists(BASE . $template_path . '/config.php'))
|
||||||
require(BASE . $template_path . '/config.php');
|
require BASE . $template_path . '/config.php';
|
||||||
|
|
||||||
$template = array();
|
$template = array();
|
||||||
$template['link_account_manage'] = getLink('account/manage');
|
$template['link_account_manage'] = getLink('account/manage');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user