фикс получения аттачей, gitter chat, EXCLUDED_USERS

This commit is contained in:
PheRum 2015-10-22 16:37:10 +03:00
commit b21b0ac766
12 changed files with 19 additions and 24 deletions

View file

@ -1,6 +1,6 @@
TorrentPier TorrentPier
====================== ======================
[![Join the chat at https://gitter.im/torrentpier/torrentpier](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/torrentpier/torrentpier?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
TorrentPier - движок торрент-трекера, написанный на php. Высокая скорость работы, простота модификации, устойчивость к высоким нагрузкам, в том числе и поддержка альтернативных анонсеров (например, Ocelot). Помимо этого, крайне развитый официальный форум поддержки, где помимо прочего можно испытать движок в работе на демо-версии, не устанавливая его, а также получить любую другую интересующую вас информацию и скачать моды. TorrentPier - движок торрент-трекера, написанный на php. Высокая скорость работы, простота модификации, устойчивость к высоким нагрузкам, в том числе и поддержка альтернативных анонсеров (например, Ocelot). Помимо этого, крайне развитый официальный форум поддержки, где помимо прочего можно испытать движок в работе на демо-версии, не устанавливая его, а также получить любую другую интересующую вас информацию и скачать моды.
## Установка ## Установка

View file

@ -40,7 +40,7 @@ if (isset($_POST['submit']))
AND ug.user_pending = 0 AND ug.user_pending = 0
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
AND u.user_active = 1 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 else
@ -49,7 +49,7 @@ if (isset($_POST['submit']))
SELECT username, user_email, user_lang SELECT username, user_email, user_lang
FROM ". BB_USERS ." FROM ". BB_USERS ."
WHERE user_active = 1 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 .")
"); ");
} }

View file

@ -40,7 +40,7 @@ $user_list = DB()->fetch_rowset("
LEFT JOIN ". BB_BT_TRACKER ." tr ON(tr.user_id = dl.user_id) LEFT JOIN ". BB_BT_TRACKER ." tr ON(tr.user_id = dl.user_id)
WHERE dl.topic_id = $topic_id WHERE dl.topic_id = $topic_id
AND dl.user_status IN (". DL_STATUS_COMPLETE.", ". DL_STATUS_DOWN.") 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 AND u.user_active = 1
GROUP BY dl.user_id GROUP BY dl.user_id
"); ");

2
dl.php
View file

@ -84,7 +84,7 @@ if ($t_data['attach_ext_id'] == 8)
} }
// All other // All other
$file_path = get_attach_path($topic_id); $file_path = get_attach_path($topic_id, $t_data['attach_ext_id']);
if (($file_contents = @file_get_contents($file_path)) === false) if (($file_contents = @file_get_contents($file_path)) === false)
{ {

View file

@ -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 ." 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"); 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) foreach (DB()->fetch_rowset($sql) as $row)
{ {

View file

@ -19,7 +19,7 @@ while (true)
AND user_lastvisit = 0 AND user_lastvisit = 0
AND user_session_time = 0 AND user_session_time = 0
AND user_regdate <= ". (TIMENOW - 86400 * $not_activated_days) ." 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"); LIMIT $users_per_cycle");
foreach ($sql as $row) foreach ($sql as $row)
@ -34,7 +34,7 @@ while (true)
WHERE user_level = 0 WHERE user_level = 0
AND user_posts = 0 AND user_posts = 0
AND user_lastvisit <= ". (TIMENOW - 86400 * $not_active_days) ." 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"); LIMIT $users_per_cycle");
foreach ($sql as $row) foreach ($sql as $row)

View file

@ -47,7 +47,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
AND b.release_count <= $release AND b.release_count <= $release
AND u.user_regdate < $user_regdate AND u.user_regdate < $user_regdate
AND u.user_active = 1 AND u.user_active = 1
AND u.user_id not IN(". EXCLUDED_USERS_CSV .") AND u.user_id not IN(". EXCLUDED_USERS .")
"); ");
} }

View file

@ -7,7 +7,7 @@ global $bb_cfg;
$data = array(); $data = array();
// usercount // 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']); $data['usercount'] = number_format($row['usercount']);
// newestuser // newestuser
@ -38,9 +38,9 @@ if ($bb_cfg['tor_stats'])
// gender stat // gender stat
if ($bb_cfg['gender']) 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 .")"); $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_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 .")");
$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 .")"); $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['male'] = $male['male'];
$data['female'] = $female['female']; $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 $sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
FROM ". BB_USERS ." 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_birthday != '0000-00-00'
AND user_active = 1 AND user_active = 1
ORDER BY user_level DESC, username ORDER BY user_level DESC, username

View file

@ -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 $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 FROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u
WHERE tw.topic_id = $topic_id 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 tw.notify_status = ". TOPIC_WATCH_NOTIFIED ."
AND u.user_id = tw.user_id AND u.user_id = tw.user_id
AND u.user_active = 1 AND u.user_active = 1

View file

@ -126,7 +126,7 @@ class upload_common
} }
else if ($mode == 'attach') else if ($mode == 'attach')
{ {
$file_path = get_attach_path($params['topic_id']); $file_path = get_attach_path($params['topic_id'], $params['attach_ext_id']);
return $this->_move($file_path); return $this->_move($file_path);
} }
else else

View file

@ -86,12 +86,7 @@ define('ADMIN', 1);
define('MOD', 2); define('MOD', 2);
define('GROUP_MEMBER', 20); define('GROUP_MEMBER', 20);
define('CP_HOLDER', 25); define('CP_HOLDER', 25);
define('EXCLUDED_USERS', implode(',', [GUEST_UID, BOT_UID]));
$excluded_users = array(
GUEST_UID,
BOT_UID,
);
define('EXCLUDED_USERS_CSV', implode(',', $excluded_users));
// User related // User related
define('USER_ACTIVATION_NONE', 0); define('USER_ACTIVATION_NONE', 0);
@ -431,7 +426,7 @@ $datastore->enqueue(array('cat_forums'));
if (!$bb_cfg['board_startdate']) if (!$bb_cfg['board_startdate'])
{ {
bb_update_config(array('board_startdate' => TIMENOW)); bb_update_config(array('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 // Cron

View file

@ -151,7 +151,7 @@ $template->assign_vars(array(
)); ));
// per-letter selection end // 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 ) if ( $username )
{ {
$username = preg_replace('/\*/', '%', clean_username($username)); $username = preg_replace('/\*/', '%', clean_username($username));