mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-24 15:15:46 -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)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'usercount':
|
case 'usercount':
|
||||||
$sql = "SELECT COUNT(user_id) AS total
|
$sql = "SELECT COUNT(user_id) AS total FROM " . BB_USERS;
|
||||||
FROM " . BB_USERS;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'newestuser':
|
case 'newestuser':
|
||||||
$sql = "SELECT user_id, username
|
$sql = "SELECT user_id, username FROM " . BB_USERS . " WHERE user_id <> " . GUEST_UID . " ORDER BY user_id DESC LIMIT 1";
|
||||||
FROM " . BB_USERS . "
|
|
||||||
WHERE user_id <> " . GUEST_UID . "
|
|
||||||
ORDER BY user_id DESC
|
|
||||||
LIMIT 1";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'postcount':
|
case 'postcount':
|
||||||
case 'topiccount':
|
case 'topiccount':
|
||||||
$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total
|
$sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total FROM " . BB_FORUMS;
|
||||||
FROM " . BB_FORUMS;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1875,9 +1869,7 @@ function meta_refresh($url, $time = 5)
|
||||||
{
|
{
|
||||||
global $template;
|
global $template;
|
||||||
|
|
||||||
$template->assign_var(
|
$template->assign_var('META', '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />');
|
||||||
'META' , '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirect ($url)
|
function redirect ($url)
|
||||||
|
@ -1914,8 +1906,6 @@ function redirect ($url)
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-- mod : topic display order ---------------------------------------------------------------------
|
|
||||||
//-- add
|
|
||||||
// build a list of the sortable fields or return field name
|
// build a list of the sortable fields or return field name
|
||||||
function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $list = 'sort')
|
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;
|
return $res;
|
||||||
}
|
}
|
||||||
//-- fin mod : topic display order -----------------------------------------------------------------
|
|
||||||
|
|
||||||
function topic_attachment_image($switch_attachment)
|
function topic_attachment_image($switch_attachment)
|
||||||
{
|
{
|
||||||
|
@ -2010,12 +1999,12 @@ if (!function_exists('array_combine'))
|
||||||
$key_count = count($keys);
|
$key_count = count($keys);
|
||||||
$value_count = count($values);
|
$value_count = count($values);
|
||||||
if ($key_count !== $value_count) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key_count === 0 || $value_count === 0) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2482,12 +2471,6 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
||||||
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
||||||
$wrap_with_quotes = preg_match('#^"[^"]+"$#', $text);
|
$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)) .' ';
|
$text = ' '. str_compact(ltrim($text, $ltrim_chars)) .' ';
|
||||||
|
|
||||||
if ($remove_stopwords)
|
if ($remove_stopwords)
|
||||||
|
@ -2510,10 +2493,6 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# if ($all_words)
|
|
||||||
# {
|
|
||||||
# $text = preg_replace('#\s(\b\w)#', ' +$1', $text);
|
|
||||||
# }
|
|
||||||
$text_match_sql = DB()->escape(trim($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']);
|
bb_die($lang['NO_SEARCH_MATCH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text_match_sql;
|
return $text_match_sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue