mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Стилистика
This commit is contained in:
parent
97de02e919
commit
c655fc89cf
18 changed files with 65 additions and 54 deletions
|
@ -40,7 +40,7 @@ if (isset($_POST['submit']))
|
|||
AND ug.user_pending = 0
|
||||
AND u.user_id = ug.user_id
|
||||
AND u.user_active = 1
|
||||
AND u.user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
|
||||
AND u.user_id NOT IN(". EXCLUDED_USERS . $user_id_sql .")
|
||||
");
|
||||
}
|
||||
else
|
||||
|
@ -49,7 +49,7 @@ if (isset($_POST['submit']))
|
|||
SELECT username, user_email, user_lang
|
||||
FROM ". BB_USERS ."
|
||||
WHERE user_active = 1
|
||||
AND user_id NOT IN(". EXCLUDED_USERS_CSV . $user_id_sql .")
|
||||
AND user_id NOT IN(". EXCLUDED_USERS . $user_id_sql .")
|
||||
");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ $user_list = DB()->fetch_rowset("
|
|||
LEFT JOIN ". BB_BT_TRACKER ." tr ON(tr.user_id = dl.user_id)
|
||||
WHERE dl.topic_id = $topic_id
|
||||
AND dl.user_status IN (". DL_STATUS_COMPLETE.", ". DL_STATUS_DOWN.")
|
||||
AND dl.user_id NOT IN ({$userdata['user_id']}, ". EXCLUDED_USERS_CSV . $ban_user_id .")
|
||||
AND dl.user_id NOT IN ({$userdata['user_id']}, ". EXCLUDED_USERS . $ban_user_id .")
|
||||
AND u.user_active = 1
|
||||
GROUP BY dl.user_id
|
||||
");
|
||||
|
|
|
@ -72,7 +72,9 @@ function DB ($db_alias = 'db1')
|
|||
return $DBS->get_db_obj($db_alias);
|
||||
}
|
||||
|
||||
// cache
|
||||
/**
|
||||
* Cache
|
||||
*/
|
||||
require(INC_DIR . 'cache/common.php');
|
||||
require(INC_DIR . 'datastore/common.php');
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ if ($confirm) {
|
|||
DB()->query("ALTER TABLE ". BB_USERS ." CHANGE COLUMN user_birthday user_birthday_old int(11) NOT NULL DEFAULT 0 AFTER user_gender");
|
||||
DB()->query("ALTER TABLE ". BB_USERS ." ADD user_birthday date NOT NULL DEFAULT '0000-00-00' AFTER user_gender");
|
||||
|
||||
$sql = "SELECT user_id, user_birthday_old FROM ". BB_USERS ." WHERE user_birthday_old != 0 AND user_id NOT IN ('". EXCLUDED_USERS_CSV ."')";
|
||||
$sql = "SELECT user_id, user_birthday_old FROM ". BB_USERS ." WHERE user_birthday_old != 0 AND user_id NOT IN ('". EXCLUDED_USERS ."')";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ class Poll
|
|||
* @type array
|
||||
*/
|
||||
private $_poll_votes = [];
|
||||
|
||||
/**
|
||||
* @type int
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class Sessions
|
||||
*/
|
||||
class Sessions
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
<?php
|
||||
|
||||
// @todo заменить на Smarty или подобное
|
||||
|
||||
/**
|
||||
* Class Template
|
||||
*/
|
||||
class Template
|
||||
{
|
||||
// Variable that holds all the data we'll be substituting into the compiled templates
|
||||
// This will end up being a multi-dimensional array like this: $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value
|
||||
// If it's a root-level variable, it'll be like this: $this->vars[varname] == value or $this->_tpldata['.'][0][varname] == value
|
||||
// Array "vars" is added for easier access to data
|
||||
var $_tpldata = array('.' => array(0 => array()));
|
||||
var $_tpldata = ['.' => [0 => []]];
|
||||
var $vars;
|
||||
|
||||
// Hash of filenames for each template handle
|
||||
var $files = array();
|
||||
var $files_cache = array(); // array of cache files that exists
|
||||
var $files_cache2 = array(); // array of cache files (exists or not exists)
|
||||
var $files = [];
|
||||
var $files_cache = []; // array of cache files that exists
|
||||
var $files_cache2 = []; // array of cache files (exists or not exists)
|
||||
|
||||
// Root template directory
|
||||
var $root = '';
|
||||
|
@ -28,10 +32,10 @@ class Template
|
|||
var $tpldef = 'default';
|
||||
|
||||
// This will hash handle names to the compiled code for that handle
|
||||
var $compiled_code = array();
|
||||
var $compiled_code = [];
|
||||
|
||||
// This will hold the uncompiled code for that handle.
|
||||
var $uncompiled_code = array();
|
||||
var $uncompiled_code = [];
|
||||
|
||||
// Cache settings
|
||||
var $use_cache = 1;
|
||||
|
@ -45,7 +49,7 @@ class Template
|
|||
var $cur_tpl = '';
|
||||
|
||||
// List of replacements (tpl files in this list will be replaced with other tpl files)
|
||||
var $replace = array();
|
||||
var $replace = [];
|
||||
|
||||
// Counter for include
|
||||
var $include_count = 0;
|
||||
|
@ -61,7 +65,7 @@ class Template
|
|||
var $preparse = '';
|
||||
var $postparse = '';
|
||||
|
||||
var $lang = array();
|
||||
var $lang = [];
|
||||
|
||||
/**
|
||||
* Constructor. Installs XS mod on first run or updates it and sets the root dir.
|
||||
|
@ -86,7 +90,7 @@ class Template
|
|||
*/
|
||||
function destroy()
|
||||
{
|
||||
$this->_tpldata = array('.' => array(0 => array()));
|
||||
$this->_tpldata = ['.' => [0 => []]];
|
||||
$this->vars = &$this->_tpldata['.'][0];
|
||||
$this->xs_started = 0;
|
||||
}
|
||||
|
@ -444,8 +448,8 @@ class Template
|
|||
}
|
||||
|
||||
// Replace <!-- (END)PHP --> tags
|
||||
$search = array('<!-- PHP -->', '<!-- ENDPHP -->');
|
||||
$replace = array('<' . '?php ', ' ?' . '>');
|
||||
$search = ['<!-- PHP -->', '<!-- ENDPHP -->'];
|
||||
$replace = ['<' . '?php ', ' ?' . '>'];
|
||||
$code = str_replace($search, $replace, $code);
|
||||
|
||||
// Break it up into lines and put " -->" back
|
||||
|
@ -456,19 +460,19 @@ class Template
|
|||
}
|
||||
|
||||
$block_nesting_level = 0;
|
||||
$block_names = array();
|
||||
$block_names = [];
|
||||
$block_names[0] = ".";
|
||||
$block_items = array();
|
||||
$block_items = [];
|
||||
$count_if = 0;
|
||||
|
||||
// Prepare array for compiled code
|
||||
$compiled = array();
|
||||
$compiled = [];
|
||||
|
||||
// Array of switches
|
||||
$sw = array();
|
||||
$sw = [];
|
||||
|
||||
// Replace all short php tags
|
||||
$new_code = array();
|
||||
$new_code = [];
|
||||
$line_count = count($code_lines);
|
||||
for ($i = 0; $i < $line_count; $i++) {
|
||||
$line = $code_lines[$i];
|
||||
|
@ -729,11 +733,11 @@ class Template
|
|||
return $code;
|
||||
}
|
||||
// Change template varrefs into PHP varrefs. This one will handle varrefs WITH namespaces
|
||||
$varrefs = array();
|
||||
$varrefs = [];
|
||||
preg_match_all('#\{(([a-z0-9\-_]+?\.)+)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
|
||||
$varcount = sizeof($varrefs[1]);
|
||||
$search = array();
|
||||
$replace = array();
|
||||
$search = [];
|
||||
$replace = [];
|
||||
for ($i = 0; $i < $varcount; $i++) {
|
||||
$namespace = $varrefs[1][$i];
|
||||
$varname = $varrefs[3][$i];
|
||||
|
@ -766,7 +770,7 @@ class Template
|
|||
|
||||
$tokens = $match[0];
|
||||
$tokens_cnt = count($tokens);
|
||||
$is_arg_stack = array();
|
||||
$is_arg_stack = [];
|
||||
|
||||
for ($i = 0; $i < $tokens_cnt; $i++) {
|
||||
$token = &$tokens[$i];
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* A class for validating method parameters to allowed types via reflection.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Class Upload
|
||||
*/
|
||||
class Upload
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,14 +2,17 @@
|
|||
|
||||
// @todo переписать
|
||||
|
||||
/**
|
||||
* Class emailer
|
||||
*/
|
||||
class emailer
|
||||
{
|
||||
var $msg, $subject, $extra_headers;
|
||||
var $addresses, $reply_to, $from;
|
||||
var $use_smtp;
|
||||
|
||||
var $tpl_msg = array();
|
||||
var $vars = array();
|
||||
var $tpl_msg = [];
|
||||
var $vars = [];
|
||||
|
||||
function emailer ($use_smtp/*$tpl_name, $sbj, $to_address*/)
|
||||
{
|
||||
|
@ -29,17 +32,17 @@ class emailer
|
|||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$this->vars = array(
|
||||
$this->vars = [
|
||||
'BOARD_EMAIL' => $bb_cfg['board_email'],
|
||||
'SITENAME' => $bb_cfg['board_email_sitename'],
|
||||
'EMAIL_SIG' => !empty($bb_cfg['board_email_sig']) ? "-- \n{$bb_cfg['board_email_sig']}" : '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
// Resets all the data (address, template file, etc etc to default
|
||||
function reset ()
|
||||
{
|
||||
$this->addresses = array();
|
||||
$this->addresses = [];
|
||||
$this->msg = $this->extra_headers = '';
|
||||
$this->set_default_vars();
|
||||
}
|
||||
|
@ -163,7 +166,7 @@ class emailer
|
|||
// We now try and pull a subject from the email body ... if it exists,
|
||||
// do this here because the subject may contain a variable
|
||||
$drop_header = '';
|
||||
$match = array();
|
||||
$match = [];
|
||||
if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
|
||||
{
|
||||
$this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : 'No Subject');
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
// @todo переписать
|
||||
|
||||
/**
|
||||
* Class sitemap
|
||||
*/
|
||||
class sitemap
|
||||
{
|
||||
var $home = '';
|
||||
|
|
|
@ -19,7 +19,7 @@ while (true)
|
|||
AND user_lastvisit = 0
|
||||
AND user_session_time = 0
|
||||
AND user_regdate <= ". (TIMENOW - 86400 * $not_activated_days) ."
|
||||
AND user_id NOT IN(". EXCLUDED_USERS_CSV .")
|
||||
AND user_id NOT IN(". EXCLUDED_USERS .")
|
||||
LIMIT $users_per_cycle");
|
||||
|
||||
foreach ($sql as $row)
|
||||
|
@ -34,7 +34,7 @@ while (true)
|
|||
WHERE user_level = 0
|
||||
AND user_posts = 0
|
||||
AND user_lastvisit <= ". (TIMENOW - 86400 * $not_active_days) ."
|
||||
AND user_id NOT IN(". EXCLUDED_USERS_CSV .")
|
||||
AND user_id NOT IN(". EXCLUDED_USERS .")
|
||||
LIMIT $users_per_cycle");
|
||||
|
||||
foreach ($sql as $row)
|
||||
|
|
|
@ -47,7 +47,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
|||
AND b.release_count <= $release
|
||||
AND u.user_regdate < $user_regdate
|
||||
AND u.user_active = 1
|
||||
AND u.user_id not IN(". EXCLUDED_USERS_CSV .")
|
||||
AND u.user_id not IN(". EXCLUDED_USERS .")
|
||||
");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ global $bb_cfg;
|
|||
$data = array();
|
||||
|
||||
// usercount
|
||||
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")");
|
||||
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS .")");
|
||||
$data['usercount'] = number_format($row['usercount']);
|
||||
|
||||
// newestuser
|
||||
|
@ -38,9 +38,9 @@ if ($bb_cfg['tor_stats'])
|
|||
// gender stat
|
||||
if ($bb_cfg['gender'])
|
||||
{
|
||||
$male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM ". BB_USERS ." WHERE user_gender = ". MALE ." AND user_id NOT IN(". EXCLUDED_USERS_CSV .")");
|
||||
$female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM ". BB_USERS ." WHERE user_gender = ". FEMALE ." AND user_id NOT IN(". EXCLUDED_USERS_CSV .")");
|
||||
$unselect = DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM ". BB_USERS ." WHERE user_gender = 0 AND user_id NOT IN(". EXCLUDED_USERS_CSV .")");
|
||||
$male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM ". BB_USERS ." WHERE user_gender = ". MALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
||||
$female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM ". BB_USERS ." WHERE user_gender = ". FEMALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
||||
$unselect = DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM ". BB_USERS ." WHERE user_gender = 0 AND user_id NOT IN(". EXCLUDED_USERS .")");
|
||||
|
||||
$data['male'] = $male['male'];
|
||||
$data['female'] = $female['female'];
|
||||
|
@ -52,7 +52,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
|||
{
|
||||
$sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
|
||||
FROM ". BB_USERS ."
|
||||
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")
|
||||
WHERE user_id NOT IN(". EXCLUDED_USERS .")
|
||||
AND user_birthday != '0000-00-00'
|
||||
AND user_active = 1
|
||||
ORDER BY user_level DESC, username
|
||||
|
|
|
@ -358,7 +358,7 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
|
|||
$watch_list = DB()->fetch_rowset("SELECT u.username, u.user_id, u.user_email, u.user_lang
|
||||
FROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u
|
||||
WHERE tw.topic_id = $topic_id
|
||||
AND tw.user_id NOT IN (". $userdata['user_id'] .", ". EXCLUDED_USERS_CSV . $user_id_sql .")
|
||||
AND tw.user_id NOT IN (". $userdata['user_id'] .", ". EXCLUDED_USERS . $user_id_sql .")
|
||||
AND tw.notify_status = ". TOPIC_WATCH_NOTIFIED ."
|
||||
AND u.user_id = tw.user_id
|
||||
AND u.user_active = 1
|
||||
|
|
|
@ -86,12 +86,7 @@ define('ADMIN', 1);
|
|||
define('MOD', 2);
|
||||
define('GROUP_MEMBER', 20);
|
||||
define('CP_HOLDER', 25);
|
||||
|
||||
$excluded_users = [
|
||||
GUEST_UID,
|
||||
BOT_UID,
|
||||
];
|
||||
define('EXCLUDED_USERS_CSV', implode(',', $excluded_users));
|
||||
define('EXCLUDED_USERS', implode(',', [GUEST_UID, BOT_UID]));
|
||||
|
||||
// User related
|
||||
define('USER_ACTIVATION_NONE', 0);
|
||||
|
@ -351,7 +346,6 @@ define('XS_TAG_ELSEIF', 7);
|
|||
define('XS_TAG_ENDIF', 8);
|
||||
define('XS_TAG_BEGINELSE', 11);
|
||||
|
||||
|
||||
if (!empty($banned_user_agents))
|
||||
{
|
||||
foreach ($banned_user_agents as $agent)
|
||||
|
@ -448,7 +442,7 @@ $datastore->enqueue(['cat_forums']);
|
|||
if (!$bb_cfg['board_startdate'])
|
||||
{
|
||||
bb_update_config(['board_startdate' => TIMENOW]);
|
||||
DB()->query("UPDATE ". BB_USERS ." SET user_regdate = ". TIMENOW ." WHERE user_id IN(2, ". EXCLUDED_USERS_CSV .")");
|
||||
DB()->query("UPDATE ". BB_USERS ." SET user_regdate = ". TIMENOW ." WHERE user_id IN(2, ". EXCLUDED_USERS .")");
|
||||
}
|
||||
|
||||
// Cron
|
||||
|
|
|
@ -151,7 +151,7 @@ $template->assign_vars(array(
|
|||
));
|
||||
|
||||
// per-letter selection end
|
||||
$sql = "SELECT username, user_id, user_rank, user_opt, user_posts, user_regdate, user_from, user_website, user_email FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")";
|
||||
$sql = "SELECT username, user_id, user_rank, user_opt, user_posts, user_regdate, user_from, user_website, user_email FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS .")";
|
||||
if ( $username )
|
||||
{
|
||||
$username = preg_replace('/\*/', '%', clean_username($username));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue