Added nick class to remove bunch of nick{1-7} functions
This commit is contained in:
parent
1522f20a7b
commit
1c8cdec3eb
@ -23,8 +23,6 @@ echo '<hr>';
|
||||
|
||||
//echo n::show(11263)."<br>".n::show(11221)->geninf();
|
||||
echo '<hr>';
|
||||
echo nick::search(11263)->geninf();
|
||||
echo nick::id(11263)->inf();
|
||||
echo '<hr>';
|
||||
echo nick::search(11221)->geninf();
|
||||
echo '<hr>';
|
||||
echo nick::search(11263)->geninf(1);
|
||||
echo nick::id(11263)->geninf(1);
|
14
ch.php
14
ch.php
@ -469,20 +469,6 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
|
||||
$_GET['text'] = str_replace('private [pal]', '', $_GET['text']);
|
||||
}
|
||||
|
||||
if (strstr($_GET['text'], "/g_nologin") && (in_array($user['align'], $var_security['g_nologin']['align']) || in_array($user['id'], $var_security['g_nologin']['id']))) {
|
||||
$temp = str_replace('/g_nologin', '', $_GET['text']);
|
||||
AddChatSystem('<b style="color: Red;">' . $temp . '</b>');
|
||||
$action = 1;
|
||||
unset($temp);
|
||||
}
|
||||
|
||||
if (strstr($_GET['text'], "/g_login") && (in_array($user['align'], $var_security['g_login']['align']) || in_array($user['id'], $var_security['g_login']['id']))) {
|
||||
$temp = str_replace('/g_login', '', $_GET['text']);
|
||||
AddChatSystem('<b style="color: Red;">[' . $user['login'] . ']</b> <font style="color: Red;">' . $temp . '</font>');
|
||||
$action = 1;
|
||||
unset($temp);
|
||||
}
|
||||
|
||||
unset($tmp);
|
||||
# Упростил тот Адъ и Израиль до одной нормальной строчки, которая вырежет все ссылки.
|
||||
if (!preg_match(GAMEDOMAIN, $_GET['text']) || !preg_match("/imgur.com/", $_GET['text'])) {
|
||||
|
@ -5,6 +5,8 @@
|
||||
* Project name: Battles-Game
|
||||
*/
|
||||
|
||||
/* @DEPRECATED */
|
||||
|
||||
class n
|
||||
{
|
||||
private static $_instance = null;
|
||||
|
@ -8,7 +8,7 @@
|
||||
class nick
|
||||
{
|
||||
private $user_data;
|
||||
|
||||
private $
|
||||
|
||||
/**
|
||||
* nick constructor.
|
||||
@ -23,7 +23,7 @@ class nick
|
||||
|
||||
}
|
||||
|
||||
public static function search($playerId)
|
||||
public static function id($playerId)
|
||||
{
|
||||
return new self($playerId);
|
||||
}
|
||||
@ -31,7 +31,7 @@ class nick
|
||||
/**
|
||||
* @param int $showInvisibility
|
||||
*/
|
||||
public function geninf($showInvisibility = 0)
|
||||
public function full($showInvisibility = 0)
|
||||
{
|
||||
$n ='';
|
||||
if ($showInvisibility) {
|
||||
@ -51,4 +51,9 @@ class nick
|
||||
|
||||
return $n;
|
||||
}
|
||||
|
||||
public function short()
|
||||
{
|
||||
return $this->user_data['login'];
|
||||
}
|
||||
}
|
@ -5,19 +5,19 @@
|
||||
* Project name: Battles-Game
|
||||
*/
|
||||
|
||||
class u
|
||||
class users_row
|
||||
{
|
||||
private $user_id;
|
||||
private $row;
|
||||
|
||||
|
||||
/**
|
||||
* u constructor.
|
||||
* users_row constructor.
|
||||
* @param $playerId
|
||||
*/
|
||||
public function __construct($playerId)
|
||||
{
|
||||
if (!$this->user_id) {
|
||||
$this->user_id = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i',$playerId)->fetch_assoc();
|
||||
if (!$this->row) {
|
||||
$this->row = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ class u
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function i()
|
||||
public function result()
|
||||
{
|
||||
return $this->user_id;
|
||||
return $this->row;
|
||||
}
|
||||
}
|
12
config.php
12
config.php
@ -9,9 +9,17 @@ ini_set('display_errors', 'On');
|
||||
error_reporting(E_ALL);
|
||||
define("GAMEDOMAIN","combats.loc");
|
||||
|
||||
$var_security = array('g_login' => array('align' => array(2.99), 'id' => array(10022)), 'g_nologin' => array('align' => array(2.99), 'id' => array(10022)));
|
||||
|
||||
/**
|
||||
* Классы для работы с базой данных.
|
||||
*/
|
||||
require_once('Database/Mysql.php');
|
||||
require_once('Database/Exception.php');
|
||||
require_once('Database/Statement.php');
|
||||
require_once('Database/db.php');
|
||||
|
||||
/**
|
||||
* Автозагрузка классов.
|
||||
*/
|
||||
spl_autoload_register(function ($class_name) {
|
||||
include_once 'classes/' . $class_name . '.php';
|
||||
});
|
||||
|
@ -6,11 +6,13 @@
|
||||
*/
|
||||
|
||||
require_once 'config.php';
|
||||
require_once 'classes/u.php';
|
||||
$u = new u($_SESSION['uid']);
|
||||
|
||||
/** Бля, если это сработает... */
|
||||
$user = $u->i();
|
||||
/**
|
||||
* Класс-заглушка для работы глобальных переменных в функциях.
|
||||
* Возвращает массив данных таблицы users.
|
||||
*/
|
||||
$u = new users_row($_SESSION['uid']);
|
||||
$user = $u->result();
|
||||
|
||||
define("HPADDICTIONEFFECT", 33);
|
||||
|
||||
|
6
klan.php
6
klan.php
@ -230,8 +230,8 @@ $polno = unserialize($klan['vozm']);
|
||||
$data = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time()-60), $klan['id']);
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
if ($row['online'] > 0) {
|
||||
echo '<A HREF="javascript:top.AddToPrivate(\'', nick7($row['id']), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>';
|
||||
nickname($row['id']);
|
||||
echo '<A HREF="javascript:top.AddToPrivate(\'', nick::id($row['id'])->short(), '\', top.CtrlPress)" target=refreshed><img src="i/lock.gif" width=20 height=15></A>';
|
||||
echo nick::id($row['id'])->full();
|
||||
#nick2($row['id']);
|
||||
if ($row['id'] == $klan['glava']) {
|
||||
echo ' - <font color=#008080><b>Глава клана</b></font>';
|
||||
@ -246,7 +246,7 @@ $polno = unserialize($klan['vozm']);
|
||||
echo ' - <i>', $rrm, '</i><BR>';
|
||||
} else if ($row['online'] < 1) {
|
||||
echo '<img src="i/lock1.gif" width=20 height=15>';
|
||||
nickname($row['id']);
|
||||
echo nick::id($row['id'])->full();
|
||||
#nick2($row['id']);
|
||||
if ($row['id'] == $klan['glava']) {
|
||||
echo ' - <font color=#008080><b>Глава клана</b></font>';
|
||||
|
Loading…
Reference in New Issue
Block a user