filecache кеширование по умолчанию, отключение tidy в конфинге git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@119 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-07-22 10:34:16 +00:00
commit 9e7213d571
4 changed files with 18 additions and 98 deletions

View file

@ -192,16 +192,13 @@ class CACHES
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
case 'filecache':
default:
if (!isset($this->obj[$cache_name]))
{
$this->obj[$cache_name] = new cache_file($this->cfg['db_dir'] . $cache_name .'/');
}
$this->ref[$cache_name] =& $this->obj[$cache_name];
break;
default:
trigger_error("invalid cache_type: $cache_type", E_USER_ERROR);
}
}
}

View file

@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2';
$bb_cfg['tp_release_state'] = 'TP II r118';
$bb_cfg['tp_release_date'] = '18-07-2011';
$bb_cfg['tp_release_state'] = 'TP II r119';
$bb_cfg['tp_release_date'] = '22-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";
@ -425,11 +425,7 @@ $bb_cfg['search_max_word_len'] = 35;
$bb_cfg['limit_max_search_results'] = false;
$bb_cfg['search_help_url'] = '';
$bb_cfg['search_match_help_topic_id'] = 0;
$bb_cfg['tidy_cfg'] = array(
# 'hide-comments' => false,
# 'indent' => true,
# 'indent-spaces' => 1,
);
$bb_cfg['tidy_post'] = true;
$bb_cfg['spam_filter_file_path'] = ''; //BB_PATH .'/misc/spam_filter_words.txt';
// Posting

View file

@ -93,73 +93,6 @@ function prepare_message ($message)
return $message;
}
//
// post_html_cache
//
function update_post_html_cache ($post_id, $post_text)
{
if (CACHE('bb_post_html')->used)
{
$post_html = bbcode2html($post_text);
CACHE('bb_post_html')->set($post_id, $post_html, 86400, 'p_html_');
}
}
function rm_post_html_cache ($post_id)
{
CACHE('bb_post_html')->rm("p_html_{$post_id}");
}
// $post_ids - array or int
function get_posts_html ($post_ids)
{
if (!$post_ids_csv = get_id_csv($post_ids))
{
return is_array($post_ids) ? array() : '';
}
return CACHE('bb_post_html')->get($post_ids, 'get_posts_html_items', 'p_html_', 86400);
}
// $post_ids - array
function get_posts_html_items ($post_ids)
{
if (!$post_ids_csv = get_id_csv($post_ids)) return array();
$items = array_fill_keys( (array)$post_ids, null );
$sql = "SELECT post_id, post_text FROM ". BB_POSTS_TEXT ." WHERE post_id IN($post_ids_csv) ORDER BY NULL";
foreach (DB('pt')->fetch_rowset($sql) as $row)
{
$items[$row['post_id']] = bbcode2html($row['post_text']);
}
return is_array($post_ids) ? $items : $items[$post_ids];
}
// $post_ids - array or int
function get_posts_text ($post_ids)
{
global $bb_cfg;
if (!$post_ids_csv = get_id_csv($post_ids))
{
return is_array($post_ids) ? array() : '';
}
$posts_text = array();
$sql = "SELECT post_id, post_text FROM ". BB_POSTS_TEXT ." WHERE post_id IN($post_ids_csv) ORDER BY NULL";
foreach (DB('pt')->fetch_rowset($sql) as $row)
{
$posts_text[$row['post_id']] = $row['post_text'];
}
return is_array($post_ids) ? $posts_text : $posts_text[$post_ids];
}
// Fill smiley templates (or just the variables) with smileys
// Either in a window or inline
function generate_smilies($mode)
@ -548,16 +481,9 @@ class bbcode
*/
function bbcode ()
{
global $bb_cfg;
$this->tpl = get_bbcode_tpl();
$this->init_replacements();
if ($bb_cfg['tidy_cfg'])
{
$this->tidy_cfg = array_merge($this->tidy_cfg, $bb_cfg['tidy_cfg']);
}
}
/**
@ -629,8 +555,10 @@ class bbcode
* bbcode2html
* $text должен быть уже обработан htmlCHR($text, false, ENT_NOQUOTES);
*/
function bbcode2html ($text, $do_tidy = true)
function bbcode2html ($text)
{
global $bb_cfg;
$text = " $text ";
$text = $this->clean_up($text);
$text = $this->spam_filter($text);
@ -659,7 +587,7 @@ class bbcode
$text = $this->new_line2html($text);
$text = trim($text);
if ($do_tidy)
if ($bb_cfg['tidy_post'])
{
$text = $this->tidy($text);
}
@ -848,6 +776,8 @@ class bbcode
*/
function tidy ($text)
{
if (!function_exists('tidy_repair_string')) die('(see $bb_cfg[\'tidy_post\'] in config.php)');
$text = tidy_repair_string($text, $this->tidy_cfg, 'utf8');
return $text;
}

View file

@ -734,16 +734,13 @@ function topic_review ($topic_id)
// Fetch posts data
$review_posts = DB()->fetch_rowset("
SELECT
p.*, pt.post_text,
p.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
IF(p.poster_id = ". ANONYMOUS .", p.post_username, u.username) AS username, u.user_id
FROM
". BB_POSTS ." p,
". BB_POSTS_TEXT ." pt,
". BB_USERS ." u
WHERE
p.topic_id = ". (int) $topic_id ."
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
FROM ". BB_POSTS ." p
LEFT JOIN ". BB_USERS ." u ON(u.user_id = p.poster_id)
LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = p.post_id)
WHERE p.topic_id = ". (int) $topic_id ."
ORDER BY p.post_time DESC
LIMIT ". $bb_cfg['posts_per_page'] ."
");