mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-24 07:05:47 -07:00
r593
Небольшая чистка в файле functions.php
This commit is contained in:
parent
3ed9f6e039
commit
48afb90e3f
1 changed files with 43 additions and 63 deletions
|
@ -1316,22 +1316,16 @@ function get_db_stat($mode)
|
|||
switch ($mode)
|
||||
{
|
||||
case 'usercount':
|
||||
$sql = "SELECT COUNT(user_id) AS total
|
||||
FROM " . BB_USERS;
|
||||
$sql = "SELECT COUNT(user_id) AS total FROM " . BB_USERS;
|
||||
break;
|
||||
|
||||
case 'newestuser':
|
||||
$sql = "SELECT user_id, username
|
||||
FROM " . BB_USERS . "
|
||||
WHERE user_id <> " . GUEST_UID . "
|
||||
ORDER BY user_id DESC
|
||||
LIMIT 1";
|
||||
$sql = "SELECT user_id, username FROM " . BB_USERS . " WHERE user_id <> " . GUEST_UID . " ORDER BY user_id DESC LIMIT 1";
|
||||
break;
|
||||
|
||||
case 'postcount':
|
||||
case 'topiccount':
|
||||
$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total
|
||||
FROM " . BB_FORUMS;
|
||||
$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total FROM " . BB_FORUMS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1875,9 +1869,7 @@ function meta_refresh($url, $time = 5)
|
|||
{
|
||||
global $template;
|
||||
|
||||
$template->assign_var(
|
||||
'META' , '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />'
|
||||
);
|
||||
$template->assign_var('META', '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />');
|
||||
}
|
||||
|
||||
function redirect ($url)
|
||||
|
@ -1914,8 +1906,6 @@ function redirect ($url)
|
|||
exit;
|
||||
}
|
||||
|
||||
//-- mod : topic display order ---------------------------------------------------------------------
|
||||
//-- add
|
||||
// build a list of the sortable fields or return field name
|
||||
function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $list = 'sort')
|
||||
{
|
||||
|
@ -1958,7 +1948,6 @@ function get_forum_display_sort_option($selected_row=0, $action='list', $list='s
|
|||
}
|
||||
return $res;
|
||||
}
|
||||
//-- fin mod : topic display order -----------------------------------------------------------------
|
||||
|
||||
function topic_attachment_image($switch_attachment)
|
||||
{
|
||||
|
@ -2010,12 +1999,12 @@ if (!function_exists('array_combine'))
|
|||
$key_count = count($keys);
|
||||
$value_count = count($values);
|
||||
if ($key_count !== $value_count) {
|
||||
user_error('array_combine() Both parameters should have equal number of elements', E_USER_WARNING);
|
||||
user_error('array_combine() both parameters should have equal number of elements', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($key_count === 0 || $value_count === 0) {
|
||||
user_error('array_combine() Both parameters should have number of elements at least 0', E_USER_WARNING);
|
||||
user_error('array_combine() both parameters should have number of elements at least 0', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2482,12 +2471,6 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
|||
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
||||
$wrap_with_quotes = preg_match('#^"[^"]+"$#', $text);
|
||||
|
||||
# $min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
|
||||
# $max_word_len = $bb_cfg['search_max_word_len'];
|
||||
|
||||
# $text = preg_replace('#\b\w{1,'. $min_word_len .'}\b#', '', $text);
|
||||
# $text = preg_replace('#\b\w{'. $max_word_len .',}\b#', '', $text);
|
||||
|
||||
$text = ' '. str_compact(ltrim($text, $ltrim_chars)) .' ';
|
||||
|
||||
if ($remove_stopwords)
|
||||
|
@ -2510,10 +2493,6 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
|||
}
|
||||
else
|
||||
{
|
||||
# if ($all_words)
|
||||
# {
|
||||
# $text = preg_replace('#\s(\b\w)#', ' +$1', $text);
|
||||
# }
|
||||
$text_match_sql = DB()->escape(trim($text));
|
||||
}
|
||||
|
||||
|
@ -2521,6 +2500,7 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
|||
{
|
||||
bb_die($lang['NO_SEARCH_MATCH']);
|
||||
}
|
||||
|
||||
return $text_match_sql;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue