From 2d87b6640edf82df55223e33b9a778b22a5ecb1f Mon Sep 17 00:00:00 2001 From: nanosimbiot Date: Sun, 24 Jul 2011 08:00:57 +0000 Subject: [PATCH] r129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Упрощение работы с постами, используя ajax git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@129 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/admin/admin_reports.php | 9 ++++---- upload/ajax.php | 14 +++++++++-- upload/config.php | 1 + upload/includes/cron/jobs/cache_gc.php | 32 +++++++++++--------------- upload/posting.php | 2 ++ upload/templates/default/viewtopic.tpl | 14 +++++++++-- upload/viewtopic.php | 3 +++ 7 files changed, 49 insertions(+), 26 deletions(-) diff --git a/upload/admin/admin_reports.php b/upload/admin/admin_reports.php index 971d2e5f6..3a4249ea3 100644 --- a/upload/admin/admin_reports.php +++ b/upload/admin/admin_reports.php @@ -1,5 +1,6 @@ '

' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', ''), diff --git a/upload/ajax.php b/upload/ajax.php index d677ae02d..aab823594 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -21,6 +21,12 @@ switch ($ajax->action) require(INC_DIR .'bbcode.php'); break; + case 'posts': + require(INC_DIR .'bbcode.php'); + require(INC_DIR .'functions_post.php'); + require(INC_DIR .'functions_admin.php'); + break; + case 'view_torrent': case 'mod_action': case 'change_tor_status': @@ -69,6 +75,7 @@ class ajax_common 'view_message' => array('guest'), 'view_torrent' => array('guest'), 'user_register' => array('guest'), + 'posts' => array('guest'), ); var $action = null; @@ -257,8 +264,7 @@ class ajax_common */ function prompt_for_confirm ($confirm_msg) { - global $lang; - if(!empty($confirm_msg)) $confirm_msg = $lang['CONFIRM']; + if(empty($confirm_msg)) $this->ajax_die('false'); $this->response['prompt_confirm'] = 1; $this->response['confirm_msg'] = $confirm_msg; @@ -401,4 +407,8 @@ class ajax_common require(AJAX_DIR .'mod_action.php'); } + function posts() + { + require(AJAX_DIR .'posts.php'); + } } diff --git a/upload/config.php b/upload/config.php index dd29e9bb6..fb6224c40 100644 --- a/upload/config.php +++ b/upload/config.php @@ -408,6 +408,7 @@ $bb_cfg['user_signature_end'] = ''; //Это позволит испол $bb_cfg['use_posts_cache'] = true; // if you switch from ON to OFF, you need to TRUNCATE `bb_posts_html` table $bb_cfg['posts_cache_days_keep'] = 14; $bb_cfg['max_post_length'] = 120000; // bytes +$bb_cfg['use_ajax_posts'] = true; // Search $bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx diff --git a/upload/includes/cron/jobs/cache_gc.php b/upload/includes/cron/jobs/cache_gc.php index ff2143cd0..55737f71a 100644 --- a/upload/includes/cron/jobs/cache_gc.php +++ b/upload/includes/cron/jobs/cache_gc.php @@ -2,23 +2,19 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); -if (method_exists(CACHE('tr_cache'), 'gc')) +$gc_cache = array( + 'tr_cache', + 'bb_cache', + 'session_cache', + 'bb_login_err', + 'bb_cap_sid', +); + +foreach ($gc_cache as $cache_name) { - $changes = CACHE('tr_cache')->gc(); - $cron_runtime_log .= date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n"; -} -if (method_exists(CACHE('bb_cache'), 'gc')) -{ - $changes = CACHE('bb_cache')->gc(); - $cron_runtime_log .= date('Y-m-d H:i:s') ." -- bb -- $changes rows deleted\n"; -} -if (method_exists(CACHE('session_cache'), 'gc')) -{ - $changes = CACHE('session_cache')->gc(TIMENOW + $bb_cfg['session_cache_gc_ttl']); - $cron_runtime_log .= date('Y-m-d H:i:s') ." -- ss -- $changes rows deleted\n"; -} -if (method_exists(CACHE('bb_login_err'), 'gc')) -{ - $changes = CACHE('bb_login_err')->gc(); - $cron_runtime_log .= date('Y-m-d H:i:s') ." -- ss -- $changes rows deleted\n"; + if (method_exists(CACHE($cache_name), 'gc')) + { + $changes = CACHE($cache_name)->gc(); + $cron_runtime_log .= date('Y-m-d H:i:s') ." -- tr -- $changes rows deleted\n"; + } } diff --git a/upload/posting.php b/upload/posting.php index 63b134013..76334ab09 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -639,6 +639,8 @@ else define('WORD_LIST_OBTAINED', TRUE); } + if($post_info['post_attachment'] && !IS_AM) $message = $post_info['topic_title']; + // Use trim to get rid of spaces placed there by MS-SQL 2000 $quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username']; $message = '[quote="' . $quote_username . '"]' . $message . '[/quote]'; diff --git a/upload/templates/default/viewtopic.tpl b/upload/templates/default/viewtopic.tpl index 02c340c37..5b9f9aa97 100644 --- a/upload/templates/default/viewtopic.tpl +++ b/upload/templates/default/viewtopic.tpl @@ -14,6 +14,16 @@ + + + +