From 85c0ee455914e5a1f2db46eec1c7fb6363814a43 Mon Sep 17 00:00:00 2001 From: nanosimbiot Date: Tue, 6 Mar 2012 05:49:18 +0000 Subject: [PATCH] r381 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ALTER TABLE `bb_posts` ADD `user_post` TINYINT( 1 ) NOT NULL DEFAULT '1'; мои сообщения аля рутрекер (часть 1) git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@381 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- install/sql/mysql.sql | 3 ++- upload/common.php | 3 ++- upload/config.php | 6 ++---- upload/includes/functions.php | 15 ++++++++------- upload/search.php | 1 + 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index f3bb0ce54..ad8b604a5 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -917,6 +917,7 @@ CREATE TABLE `bb_posts` ( `post_edit_count` smallint(5) unsigned NOT NULL default '0', `post_attachment` tinyint(1) NOT NULL default '0', `post_reported` tinyint(1) NOT NULL default '0', + `user_post` tinyint(1) NOT NULL default '1', PRIMARY KEY (`post_id`), KEY `topic_id` (`topic_id`), KEY `poster_id` (`poster_id`), @@ -928,7 +929,7 @@ CREATE TABLE `bb_posts` ( -- Дамп данных таблицы `bb_posts` -- -INSERT INTO `bb_posts` VALUES (1, 1, 1, 2, 1309421220, '', '', 0, 0, 0, 0); +INSERT INTO `bb_posts` VALUES (1, 1, 1, 2, 1309421220, '', '', 0, 0, 0, 0, 1); -- -------------------------------------------------------- diff --git a/upload/common.php b/upload/common.php index 26c74eb4c..65cf2dd14 100644 --- a/upload/common.php +++ b/upload/common.php @@ -39,6 +39,7 @@ define('TOR_TYPE_GOLD', 1); define('TOR_TYPE_SILVER', 2); define('ANONYMOUS', -1); +define('BOT_UID', -746); // DBS class DBS @@ -1762,7 +1763,7 @@ switch ($bb_cfg['datastore_type']) case 'apc': $datastore = new datastore_apc(); break; - + case 'filecache': default: $datastore = new datastore_file($bb_cfg['cache']['db_dir'] . 'datastore/'); } diff --git a/upload/config.php b/upload/config.php index 4fab4b8bb..7778b2324 100644 --- a/upload/config.php +++ b/upload/config.php @@ -52,8 +52,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array(); // Increase number of revision after update $bb_cfg['tp_version'] = '2.4 (beta)'; -$bb_cfg['tp_release_state'] = 'R380'; -$bb_cfg['tp_release_date'] = '04-03-2012'; +$bb_cfg['tp_release_state'] = 'R381'; +$bb_cfg['tp_release_date'] = '06-03-2012'; // Database $charset = 'utf8'; @@ -474,8 +474,6 @@ $bb_cfg['ad_blocks'] = array( ); // Misc -define('BOT_UID', -746); - define('LOADAVG', function_exists('get_loadavg') ? get_loadavg() : 0); define('MEM_USAGE', function_exists('memory_get_usage')); diff --git a/upload/includes/functions.php b/upload/includes/functions.php index c0fc26622..9eeedd4cc 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -1206,10 +1206,11 @@ function wbr ($text, $max_word_length = HTML_WBR_LENGTH) function get_bt_userdata ($user_id) { - return DB()->fetch_row("SELECT bt.*, SUM(tr.speed_up) as speed_up, SUM(tr.speed_down) as speed_down + return DB()->fetch_row("SELECT bt.*, SUM(tr.speed_up) as speed_up, SUM(tr.speed_down) as speed_down FROM ". BB_BT_USERS ." bt LEFT JOIN ". BB_BT_TRACKER ." tr ON (bt.user_id = tr.user_id) - WHERE bt.user_id = ". (int) $user_id); + WHERE bt.user_id = ". (int) $user_id ." + GROUP BY bt.user_id"); } function get_bt_ratio ($btu) @@ -1224,7 +1225,7 @@ function get_bt_ratio ($btu) function show_bt_userdata ($user_id) { global $lang; - + $btu = get_bt_userdata($user_id); $GLOBALS['template']->assign_vars(array( @@ -2731,13 +2732,13 @@ function create_magnet($infohash, $auth_key, $logged_in) function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width = '') { global $bb_cfg, $lang; - + $height = ($height != '') ? 'height="'. $height .'"' : ''; $width = ($width != '') ? 'width="'. $width .'"' : ''; - + $user_avatar = ''; - - + + if ($allow_avatar) { switch($type) diff --git a/upload/search.php b/upload/search.php index cc2122aa1..3219a93d3 100644 --- a/upload/search.php +++ b/upload/search.php @@ -618,6 +618,7 @@ else if ($new_topics) $SQL['WHERE'][] = "t.topic_time > $lastvisit"; if ($prev_days) $SQL['WHERE'][] = "$tbl.$time_field > ". $time_opt[$time_val]['sql']; if ($my_posts) $SQL['WHERE'][] = "p.poster_id = $poster_id_val"; + if ($my_posts && $user->id == $poster_id_val) $SQL['WHERE'][] = "p.user_post = 1"; if ($my_topics) $SQL['WHERE'][] = "t.topic_poster = $poster_id_val"; if ($text_match_sql)