diff --git a/README.md b/README.md index d797e4e54..811cdb8e5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ 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). Помимо этого, крайне развитый официальный форум поддержки, где помимо прочего можно испытать движок в работе на демо-версии, не устанавливая его, а также получить любую другую интересующую вас информацию и скачать моды. ## Установка diff --git a/admin/admin_mass_email.php b/admin/admin_mass_email.php index a9285ebf0..e97560c56 100644 --- a/admin/admin_mass_email.php +++ b/admin/admin_mass_email.php @@ -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 .") "); } diff --git a/callseed.php b/callseed.php index dd7fec431..5ee29a021 100644 --- a/callseed.php +++ b/callseed.php @@ -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 "); diff --git a/dl.php b/dl.php index 064421396..452a96842 100644 --- a/dl.php +++ b/dl.php @@ -84,7 +84,7 @@ if ($t_data['attach_ext_id'] == 8) } // 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) { diff --git a/install/upgrade/r496-user_birthday.php b/install/upgrade/r496-user_birthday.php index 014284236..1d84435f9 100644 --- a/install/upgrade/r496-user_birthday.php +++ b/install/upgrade/r496-user_birthday.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) { diff --git a/library/includes/cron/jobs/prune_inactive_users.php b/library/includes/cron/jobs/prune_inactive_users.php index a170d8168..7ca8f8510 100644 --- a/library/includes/cron/jobs/prune_inactive_users.php +++ b/library/includes/cron/jobs/prune_inactive_users.php @@ -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) diff --git a/library/includes/cron/jobs/tr_seed_bonus.php b/library/includes/cron/jobs/tr_seed_bonus.php index 3cc379c26..862adca9c 100644 --- a/library/includes/cron/jobs/tr_seed_bonus.php +++ b/library/includes/cron/jobs/tr_seed_bonus.php @@ -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 .") "); } diff --git a/library/includes/datastore/build_stats.php b/library/includes/datastore/build_stats.php index 30d3cc851..e5e7a69c5 100644 --- a/library/includes/datastore/build_stats.php +++ b/library/includes/datastore/build_stats.php @@ -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 diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php index 7923a53be..17cbf0ad0 100644 --- a/library/includes/functions_post.php +++ b/library/includes/functions_post.php @@ -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 diff --git a/library/includes/functions_upload.php b/library/includes/functions_upload.php index 9c2762217..7075ff1cc 100644 --- a/library/includes/functions_upload.php +++ b/library/includes/functions_upload.php @@ -126,7 +126,7 @@ class upload_common } 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); } else diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index af91a1667..b78ae5a1f 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -86,12 +86,7 @@ define('ADMIN', 1); define('MOD', 2); define('GROUP_MEMBER', 20); define('CP_HOLDER', 25); - -$excluded_users = array( - 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); @@ -431,7 +426,7 @@ $datastore->enqueue(array('cat_forums')); if (!$bb_cfg['board_startdate']) { 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 diff --git a/memberlist.php b/memberlist.php index 84eb16b9a..768f56d14 100644 --- a/memberlist.php +++ b/memberlist.php @@ -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));