Alias functions usage.

This commit is contained in:
Yuriy Pikhtarev 2017-05-05 00:57:55 +03:00
parent a47094e6e1
commit 4a79c081b5
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
53 changed files with 199 additions and 199 deletions

View file

@ -394,7 +394,7 @@ if ($view === 'attachments') {
$attachments = search_attachments($order_by, $total_rows);
}
if (sizeof($attachments) > 0) {
if (count($attachments) > 0) {
for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) {
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';

View file

@ -290,7 +290,7 @@ if ($mode == 'cats') {
$row = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($row); $i++) {
for ($i = 0; $i < count($row); $i++) {
if ($row[$i]['cat_id'] == IMAGE_CAT) {
$s_assigned_group_images[] = $row[$i]['group_name'];
}
@ -401,7 +401,7 @@ if ($submit && $mode == 'quota') {
$allowed_list = array();
for ($i = 0; $i < sizeof($quota_change_list); $i++) {
for ($i = 0; $i < count($quota_change_list); $i++) {
$filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]);
$sql = 'UPDATE ' . BB_QUOTA_LIMITS . "
@ -506,7 +506,7 @@ if ($mode == 'quota') {
$rows = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($rows); $i++) {
for ($i = 0; $i < count($rows); $i++) {
$size_format = ($rows[$i]['quota_limit'] >= 1048576) ? 'mb' : (($rows[$i]['quota_limit'] >= 1024) ? 'kb' : 'b');
if ($rows[$i]['quota_limit'] >= 1048576) {

View file

@ -83,7 +83,7 @@ if ($submit && $mode == 'extensions') {
// Generate correct Change List
$extensions = array();
for ($i = 0; $i < sizeof($extension_change_list); $i++) {
for ($i = 0; $i < count($extension_change_list); $i++) {
$extensions['_' . $extension_change_list[$i]]['comment'] = $extension_explain_list[$i];
$extensions['_' . $extension_change_list[$i]]['group_id'] = intval($group_select_list[$i]);
}
@ -98,7 +98,7 @@ if ($submit && $mode == 'extensions') {
DB()->sql_freeresult($result);
if ($num_rows > 0) {
for ($i = 0; $i < sizeof($extension_row); $i++) {
for ($i = 0; $i < count($extension_row); $i++) {
if ($extension_row[$i]['comment'] != $extensions['_' . $extension_row[$i]['ext_id']]['comment'] || intval($extension_row[$i]['group_id']) != intval($extensions['_' . $extension_row[$i]['ext_id']]['group_id'])) {
$sql_ary = array(
'comment' => (string)$extensions['_' . $extension_row[$i]['ext_id']]['comment'],
@ -250,15 +250,15 @@ if ($submit && $mode == 'groups') {
$allowed_list = array();
for ($i = 0; $i < sizeof($group_allowed_list); $i++) {
for ($j = 0; $j < sizeof($group_change_list); $j++) {
for ($i = 0; $i < count($group_allowed_list); $i++) {
for ($j = 0; $j < count($group_change_list); $j++) {
if ($group_allowed_list[$i] == $group_change_list[$j]) {
$allowed_list[$j] = 1;
}
}
}
for ($i = 0; $i < sizeof($group_change_list); $i++) {
for ($i = 0; $i < count($group_change_list); $i++) {
$allowed = (isset($allowed_list[$i])) ? 1 : 0;
$filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]);
@ -471,7 +471,7 @@ if (@$add_forum && $e_mode == 'perm' && $group) {
$add_forums_list = get_var('entries', array(0));
$add_all_forums = false;
for ($i = 0; $i < sizeof($add_forums_list); $i++) {
for ($i = 0; $i < count($add_forums_list); $i++) {
if ($add_forums_list[$i] == 0) {
$add_all_forums = true;
}
@ -506,7 +506,7 @@ if (@$add_forum && $e_mode == 'perm' && $group) {
}
// Generate array for Auth_Pack, do not add doubled forums
for ($i = 0; $i < sizeof($add_forums_list); $i++) {
for ($i = 0; $i < count($add_forums_list); $i++) {
if (!in_array($add_forums_list[$i], $auth_p)) {
$auth_p[] = $add_forums_list[$i];
}
@ -543,13 +543,13 @@ if (@$delete_forum && $e_mode == 'perm' && $group) {
$auth_p = array();
// Generate array for Auth_Pack, delete the chosen ones
for ($i = 0; $i < sizeof($auth_p2); $i++) {
for ($i = 0; $i < count($auth_p2); $i++) {
if (!in_array($auth_p2[$i], $delete_forums_list)) {
$auth_p[] = $auth_p2[$i];
}
}
$auth_bitstream = (sizeof($auth_p) > 0) ? auth_pack($auth_p) : '';
$auth_bitstream = (count($auth_p) > 0) ? auth_pack($auth_p) : '';
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group;
@ -596,7 +596,7 @@ if ($e_mode == 'perm' && $group) {
}
}
for ($i = 0; $i < sizeof($forum_perm); $i++) {
for ($i = 0; $i < count($forum_perm); $i++) {
$template->assign_block_vars('allow_option_values', array(
'VALUE' => $forum_perm[$i]['forum_id'],
'OPTION' => htmlCHR($forum_perm[$i]['forum_name']))
@ -675,7 +675,7 @@ if ($e_mode == 'perm' && $group) {
$message .= ($message == '') ? $forum_name : '<br />' . $forum_name;
}
if (sizeof($empty_perm_forums) > 0) {
if (count($empty_perm_forums) > 0) {
$template->assign_vars(array('ERROR_MESSAGE' => $lang['NOTE_ADMIN_EMPTY_GROUP_PERMISSIONS'] . $message));
}
}

View file

@ -42,7 +42,7 @@ if (isset($_REQUEST['submit'])) {
}
$prunetime = TIMENOW - 86400 * $prunedays;
$forum_csv = in_array($all_forums, $f_selected) ? $all_forums : join(',', $f_selected);
$forum_csv = in_array($all_forums, $f_selected) ? $all_forums : implode(',', $f_selected);
$where_sql = ($forum_csv != $all_forums) ? "WHERE forum_id IN($forum_csv)" : '';

View file

@ -106,7 +106,7 @@ if ($var =& $_REQUEST[$type_key]) {
if (in_array($all_types, $type_selected)) {
$type_selected = array($all_types);
}
$type_csv = join(',', $type_selected);
$type_csv = implode(',', $type_selected);
$url = ($type_csv != $def_types) ? url_arg($url, $type_key, $type_csv) : $url;
}
@ -120,7 +120,7 @@ if ($var =& $_REQUEST[$user_key]) {
if (in_array($all_users, $user_selected)) {
$user_selected = array($all_users);
}
$user_csv = join(',', $user_selected);
$user_csv = implode(',', $user_selected);
$url = ($user_csv != $def_users) ? url_arg($url, $user_key, $user_csv) : $url;
}
@ -134,7 +134,7 @@ if ($var =& $_REQUEST[$forum_key]) {
if (in_array($all_forums, $forum_selected)) {
$forum_selected = array($all_forums);
}
$forum_csv = join(',', $forum_selected);
$forum_csv = implode(',', $forum_selected);
$url = ($forum_csv != $def_forums) ? url_arg($url, $forum_key, $forum_csv) : $url;
}
@ -144,7 +144,7 @@ $topic_csv = '';
if ($var =& $_REQUEST[$topic_key]) {
$topic_selected = get_id_ary($var);
$topic_csv = join(',', $topic_selected);
$topic_csv = implode(',', $topic_selected);
$url = ($topic_csv) ? url_arg($url, $topic_key, $topic_csv) : $url;
}

View file

@ -54,7 +54,7 @@ if (isset($_POST['submit'])) {
foreach ($sql as $row) {
$user_id_sql[] = ',' . $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
$user_id_sql = implode('', $user_id_sql);
if ($group_id != -1) {
$user_list = DB()->fetch_rowset("
@ -113,7 +113,7 @@ $template->assign_vars(array(
'MESSAGE' => $message,
'SUBJECT' => $subject,
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '',
'S_USER_ACTION' => 'admin_mass_email.php',
'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups),

View file

@ -263,7 +263,7 @@ print_page('index.tpl', 'admin');
// Functions
function inarray($needle, $haystack)
{
for ($i = 0; $i < sizeof($haystack); $i++) {
for ($i = 0; $i < count($haystack); $i++) {
if ($haystack[$i] == $needle) {
return true;
}

View file

@ -131,11 +131,11 @@ echo "\n
</td></tr>
\n";
echo "\n<tr><td align=center> peers: in last " . join(' / ', $peers_in_last_minutes) . " min</td>\n";
echo "\n<td align=center>" . join(' / ', $peers_in_last_min) . "</td></tr>\n";
echo "\n<tr><td align=center> peers: in last " . implode(' / ', $peers_in_last_minutes) . " min</td>\n";
echo "\n<td align=center>" . implode(' / ', $peers_in_last_min) . "</td></tr>\n";
echo "\n<tr><td align=center> peers in last $peers_in_last_sec_limit sec <br /> [ per second, DESC order --> ] <br /> last peer: $stat[last_peer_time] seconds ago <br /> " . date("j M H:i:s [T O]") . " </td>\n";
echo '<td align=center style="font-size: 13px; font-family: \'Courier New\',Courier,monospace;"><pre> ' . join(' ', $peers_in_last_sec) . "</pre></td></tr>\n";
echo '<td align=center style="font-size: 13px; font-family: \'Courier New\',Courier,monospace;"><pre> ' . implode(' ', $peers_in_last_sec) . "</pre></td></tr>\n";
echo '</table>';

View file

@ -53,7 +53,7 @@ function tracker_exit()
$str[] = sprintf('%.4f' . LOG_SEPR . '%02d%%', $DBS->sql_timetotal, $sql_total_perc);
$str[] = $DBS->num_queries;
$str[] = sprintf('%.1f', sys('la'));
$str = join(LOG_SEPR, $str) . LOG_LF;
$str = implode(LOG_SEPR, $str) . LOG_LF;
dbg_log($str, '!!gentime');
}
}

View file

@ -51,7 +51,7 @@ $sql = DB()->fetch_rowset("SELECT ban_userid FROM " . BB_BANLIST . " WHERE ban_u
foreach ($sql as $row) {
$ban_user_id[] = ',' . $row['ban_userid'];
}
$ban_user_id = join('', $ban_user_id);
$ban_user_id = implode('', $ban_user_id);
$user_list = DB()->fetch_rowset("
SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl

View file

@ -213,7 +213,7 @@ function utime()
function bb_log($msg, $file_name)
{
if (is_array($msg)) {
$msg = join(LOG_LF, $msg);
$msg = implode(LOG_LF, $msg);
}
$file_name .= (LOG_EXT) ? '.' . LOG_EXT : '';
return file_write($msg, LOG_DIR . '/' . $file_name);
@ -413,7 +413,7 @@ function sys($param)
{
switch ($param) {
case 'la':
return function_exists('sys_getloadavg') ? join(' ', sys_getloadavg()) : 0;
return function_exists('sys_getloadavg') ? implode(' ', sys_getloadavg()) : 0;
break;
case 'mem':
return function_exists('memory_get_usage') ? memory_get_usage() : 0;
@ -475,7 +475,7 @@ function log_request($file = '', $prepend_str = false, $add_post = true)
if (!empty($_POST) && $add_post) {
$str[] = "post: " . str_compact(urldecode(http_build_query($_POST)));
}
$str = join("\t", $str) . "\n";
$str = implode("\t", $str) . "\n";
bb_log($str, $file);
}

View file

@ -128,7 +128,7 @@ if ($mode == 'set_topics_dl_status') {
}
// Get existing topics
if ($req_topics_sql = join(',', $req_topics_ary)) {
if ($req_topics_sql = implode(',', $req_topics_ary)) {
$sql = "SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_id IN($req_topics_sql)";
foreach (DB()->fetch_rowset($sql) as $row) {

View file

@ -281,7 +281,7 @@ if (!$group_id) {
foreach ($members as $members_id) {
$sql_in[] = (int)$members_id;
}
if (!$sql_in = join(',', $sql_in)) {
if (!$sql_in = implode(',', $sql_in)) {
bb_die($lang['NONE_SELECTED']);
}

View file

@ -255,7 +255,7 @@ foreach ($cat_forums as $cid => $c) {
'POSTS' => commify($f['forum_posts']),
'TOPICS' => commify($f['forum_topics']),
'LAST_SF_ID' => isset($f['last_sf_id']) ? $f['last_sf_id'] : null,
'MODERATORS' => isset($moderators[$fid]) ? join(', ', $moderators[$fid]) : '',
'MODERATORS' => isset($moderators[$fid]) ? implode(', ', $moderators[$fid]) : '',
'FORUM_FOLDER_ALT' => ($new) ? $lang['NEW'] : $lang['OLD'],
));
@ -365,7 +365,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
}
$week_all = ($week_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $week_list)) . $week_all;
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
} else {
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
}
@ -380,7 +380,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$today_list[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>';
}
$today_all = ($today_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_today\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
$today_list = $lang['BIRTHDAY_TODAY'] . join(', ', $today_list) . $today_all;
$today_list = $lang['BIRTHDAY_TODAY'] . implode(', ', $today_list) . $today_all;
} else {
$today_list = $lang['NOBIRTHDAY_TODAY'];
}

View file

@ -80,7 +80,7 @@ if ($confirm) {
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1");
$avatars_ok++;
} else {
echo "{$row['user_id']}: ", join("\n{$row['user_id']}: ", $upload->errors), "\n";
echo "{$row['user_id']}: ", implode("\n{$row['user_id']}: ", $upload->errors), "\n";
$avatars_err++;
}
}

View file

@ -71,7 +71,7 @@ switch ($mode) {
}
}
if ($html) {
$this->response['group_list_html'] = '<ul><li>' . join('</li><li>', $html) . '</li></ul>';
$this->response['group_list_html'] = '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
} else {
$this->response['group_list_html'] = $lang['GROUP_LIST_HIDDEN'];
}

View file

@ -43,7 +43,7 @@ switch ($mode) {
foreach ($stats['birthday_week_list'] as $week) {
$html[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html));
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $html));
} else {
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
}
@ -59,7 +59,7 @@ switch ($mode) {
foreach ($stats['birthday_today_list'] as $today) {
$html[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>';
}
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
$html = $lang['BIRTHDAY_TODAY'] . implode(', ', $html);
} else {
$html = $lang['NOBIRTHDAY_TODAY'];
}
@ -88,7 +88,7 @@ switch ($mode) {
}
$html = ':&nbsp;';
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
$html .= ($moderators) ? implode(', ', $moderators) : $lang['NONE'];
unset($moderators, $mod);
$datastore->rm('moderators');
break;

View file

@ -46,7 +46,7 @@ function init_complete_extensions_data()
}
$allowed_extensions = array();
for ($i = 0, $size = sizeof($extension_informations); $i < $size; $i++) {
for ($i = 0, $size = count($extension_informations); $i < $size; $i++) {
$extension = strtolower(trim($extension_informations[$i]['extension']));
$allowed_extensions[] = $extension;
$display_categories[$extension] = intval($extension_informations[$i]['cat_id']);
@ -140,12 +140,12 @@ function init_display_post_attachments($switch_attachment)
}
}
if (sizeof($post_id_array) == 0) {
if (count($post_id_array) == 0) {
return;
}
$rows = get_attachments_from_post($post_id_array);
$num_rows = sizeof($rows);
$num_rows = count($rows);
if ($num_rows == 0) {
return;
@ -183,7 +183,7 @@ function display_attachments($post_id)
{
global $template, $upload_dir, $userdata, $allowed_extensions, $display_categories, $download_modes, $lang, $attachments, $upload_icons, $attach_config;
$num_attachments = @sizeof($attachments['_' . $post_id]);
$num_attachments = @count($attachments['_' . $post_id]);
if ($num_attachments == 0) {
return;

View file

@ -106,7 +106,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
*/
function sort_multi_array($sort_array, $key, $sort_order, $pre_string_sort = 0)
{
$last_element = sizeof($sort_array) - 1;
$last_element = count($sort_array) - 1;
if (!$pre_string_sort) {
$string_sort = (!is_numeric(@$sort_array[$last_element - 1][$key])) ? true : false;
@ -266,7 +266,7 @@ function search_attachments($order_by, &$total_rows)
$sql = 'SELECT a.*, t.post_id, p.post_time, p.topic_id
FROM ' . BB_ATTACHMENTS . ' t, ' . BB_ATTACHMENTS_DESC . ' a, ' . BB_POSTS . ' p WHERE ';
if (sizeof($where_sql) > 0) {
if (count($where_sql) > 0) {
$sql .= implode('AND', $where_sql) . ' AND ';
}
@ -309,7 +309,7 @@ function search_attachments($order_by, &$total_rows)
function limit_array($array, $start, $pagelimit)
{
// array from start - start+pagelimit
$limit = (sizeof($array) < ($start + $pagelimit)) ? sizeof($array) : $start + $pagelimit;
$limit = (count($array) < ($start + $pagelimit)) ? count($array) : $start + $pagelimit;
$limit_array = [];

View file

@ -103,7 +103,7 @@ function auth_pack($auth_array)
$one_char = $two_char = false;
$auth_cache = '';
for ($i = 0; $i < sizeof($auth_array); $i++) {
for ($i = 0; $i < count($auth_array); $i++) {
$val = base64_pack(intval($auth_array[$i]));
if (strlen($val) == 1 && !$one_char) {
$auth_cache .= $one_char_encoding;
@ -316,7 +316,7 @@ function get_attachments_from_post($post_id_array)
*/
function get_total_attach_filesize($attach_ids)
{
if (!is_array($attach_ids) || !sizeof($attach_ids)) {
if (!is_array($attach_ids) || !count($attach_ids)) {
return 0;
}
@ -356,7 +356,7 @@ function get_extension_informations()
function attachment_sync_topic($topics)
{
if (is_array($topics)) {
$topics = join(',', $topics);
$topics = implode(',', $topics);
}
$posts_without_attach = $topics_without_attach = array();
@ -372,7 +372,7 @@ function attachment_sync_topic($topics)
foreach ($rowset as $row) {
$posts_without_attach[] = $row['post_id'];
}
if ($posts_sql = join(',', $posts_without_attach)) {
if ($posts_sql = implode(',', $posts_without_attach)) {
DB()->query("UPDATE " . BB_POSTS . " SET post_attachment = 0 WHERE post_id IN($posts_sql)");
}
}
@ -399,7 +399,7 @@ function attachment_sync_topic($topics)
foreach ($rowset as $row) {
$topics_without_attach[] = $row['topic_id'];
}
if ($topics_sql = join(',', $topics_without_attach)) {
if ($topics_sql = implode(',', $topics_without_attach)) {
DB()->query("UPDATE " . BB_TOPICS . " SET topic_attachment = 0 WHERE topic_id IN($topics_sql)");
}
}

View file

@ -94,7 +94,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
}
if (!sizeof($post_id_array)) {
if (!count($post_id_array)) {
return;
}
@ -139,13 +139,13 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
}
if (!sizeof($attach_id_array)) {
if (!count($attach_id_array)) {
return;
}
$sql_id = 'post_id';
if (sizeof($post_id_array) && sizeof($attach_id_array)) {
if (count($post_id_array) && count($attach_id_array)) {
$sql = 'DELETE FROM ' . BB_ATTACHMENTS . '
WHERE attach_id IN (' . implode(', ', $attach_id_array) . ")
AND $sql_id IN (" . implode(', ', $post_id_array) . ')';
@ -187,7 +187,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
//bt end
for ($i = 0; $i < sizeof($attach_id_array); $i++) {
for ($i = 0; $i < count($attach_id_array); $i++) {
$sql = 'SELECT attach_id
FROM ' . BB_ATTACHMENTS . '
WHERE attach_id = ' . (int)$attach_id_array[$i];
@ -236,7 +236,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
// Now Sync the Topic/PM
if (sizeof($post_id_array)) {
if (count($post_id_array)) {
$sql = 'SELECT topic_id
FROM ' . BB_POSTS . '
WHERE post_id IN (' . implode(', ', $post_id_array) . ')

View file

@ -50,7 +50,7 @@ function group_select($select_name, $default_group = 0)
$group_name[$num_rows]['group_id'] = 0;
$group_name[$num_rows]['group_name'] = $lang['NOT_ASSIGNED'];
for ($i = 0; $i < sizeof($group_name); $i++) {
for ($i = 0; $i < count($group_name); $i++) {
if (!$default_group) {
$selected = ($i == 0) ? ' selected="selected"' : '';
} else {
@ -93,7 +93,7 @@ function download_select($select_name, $group_id = 0)
$group_select = '<select name="' . $select_name . '">';
for ($i = 0; $i < sizeof($types_download); $i++) {
for ($i = 0; $i < count($types_download); $i++) {
if (!$group_id) {
$selected = ($types_download[$i] == INLINE_LINK) ? ' selected="selected"' : '';
} else {
@ -138,14 +138,14 @@ function category_select($select_name, $group_id = 0)
$types = array(NONE_CAT);
$modes = array('none');
for ($i = 0; $i < sizeof($types_category); $i++) {
for ($i = 0; $i < count($types_category); $i++) {
$types[] = $types_category[$i];
$modes[] = $modes_category[$i];
}
$group_select = '<select name="' . $select_name . '" style="width:100px">';
for ($i = 0; $i < sizeof($types); $i++) {
for ($i = 0; $i < count($types); $i++) {
if (!$group_id) {
$selected = ($types[$i] == NONE_CAT) ? ' selected="selected"' : '';
} else {
@ -172,7 +172,7 @@ function size_select($select_name, $size_compare)
$select_field = '<select name="' . $select_name . '">';
for ($i = 0; $i < sizeof($size_types_text); $i++) {
for ($i = 0; $i < count($size_types_text); $i++) {
$selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
$select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
}
@ -204,7 +204,7 @@ function quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($quota_name); $i++) {
for ($i = 0; $i < count($quota_name); $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}
@ -235,7 +235,7 @@ function default_quota_limit_select($select_name, $default_quota = 0)
}
DB()->sql_freeresult($result);
for ($i = 0; $i < sizeof($quota_name); $i++) {
for ($i = 0; $i < count($quota_name); $i++) {
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
}

View file

@ -220,7 +220,7 @@ function strip_quotes($text)
}
} while ($pos !== false);
if (sizeof($start_pos) == 0) {
if (count($start_pos) == 0) {
return $text;
}
@ -235,7 +235,7 @@ function strip_quotes($text)
}
} while ($pos !== false);
if (sizeof($end_pos) == 0) {
if (count($end_pos) == 0) {
return $text;
}
@ -250,7 +250,7 @@ function strip_quotes($text)
$newtext = '[...] ';
$substr_pos = 0;
foreach ($pos_list as $pos => $type) {
$stacksize = sizeof($stack);
$stacksize = count($stack);
if ($type == 'start') {
// empty stack, so add from the last close tag or the beginning of the string
if ($stacksize == 0) {
@ -377,7 +377,7 @@ function extract_search_words($text)
}
$text = $text_out;
if (sizeof($text) > $max_words_count) {
if (count($text) > $max_words_count) {
# shuffle($text);
$text = array_splice($text, 0, $max_words_count);
}
@ -393,7 +393,7 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
$words = ($text) ? extract_search_words($text) : array();
if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
return join("\n", $words);
return implode("\n", $words);
}
DB()->query("DELETE FROM " . BB_POSTS_SEARCH . " WHERE post_id = $post_id");
@ -543,7 +543,7 @@ class bbcode
$text = preg_replace_callback("#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#isu", array(&$this, 'url_callback'), $text);
// Normalize block level tags wrapped with new lines
$block_tags = join('|', $this->block_tags);
$block_tags = implode('|', $this->block_tags);
$text = str_replace("\n\n[hr]\n\n", '[br][hr][br]', $text);
$text = preg_replace("#(\s*)(\[/?($block_tags)(.*?)\])(\s*)#", '$2', $text);
@ -623,7 +623,7 @@ class bbcode
foreach ($found_spam as $keyword) {
$spam_exp[] = preg_quote($keyword, '/');
}
$spam_exp = join('|', $spam_exp);
$spam_exp = implode('|', $spam_exp);
$text = preg_replace("/($spam_exp)(\S*)/i", $spam_replace, $msg_decoded);
$text = htmlCHR($text, false, ENT_NOQUOTES);

View file

@ -70,7 +70,7 @@ class cache_sqlite extends cache_common
$rowset = $this->db->fetch_rowset("
SELECT cache_name, cache_value
FROM " . $this->cfg['table_name'] . "
WHERE cache_name IN('$this->prefix_sql" . join("','$this->prefix_sql", $name_sql) . "') AND cache_expire_time > " . TIMENOW . "
WHERE cache_name IN('$this->prefix_sql" . implode("','$this->prefix_sql", $name_sql) . "') AND cache_expire_time > " . TIMENOW . "
LIMIT " . count($name) . "
");

View file

@ -461,34 +461,34 @@ class sql_db
$fields[] = $field;
$values[] = $this->escape($val, $check_type, $dont_escape);
}
$fields = join(', ', $fields);
$values = join(', ', $values);
$fields = implode(', ', $fields);
$values = implode(', ', $values);
$query = "($fields)\nVALUES\n($values)";
} elseif ($query_type == 'INSERT_SELECT') {
foreach ($input_ary as $field => $val) {
$fields[] = $field;
$values[] = $this->escape($val, $check_type, $dont_escape);
}
$fields = join(', ', $fields);
$values = join(', ', $values);
$fields = implode(', ', $fields);
$values = implode(', ', $values);
$query = "($fields)\nSELECT\n$values";
} elseif ($query_type == 'MULTI_INSERT') {
foreach ($input_ary as $id => $sql_ary) {
foreach ($sql_ary as $field => $val) {
$values[] = $this->escape($val, $check_type, $dont_escape);
}
$ary[] = '(' . join(', ', $values) . ')';
$ary[] = '(' . implode(', ', $values) . ')';
$values = [];
}
$fields = join(', ', array_keys($input_ary[0]));
$values = join(",\n", $ary);
$fields = implode(', ', array_keys($input_ary[0]));
$values = implode(",\n", $ary);
$query = "($fields)\nVALUES\n$values";
} elseif ($query_type == 'SELECT' || $query_type == 'UPDATE') {
foreach ($input_ary as $field => $val) {
$ary[] = "$field = " . $this->escape($val, $check_type, $dont_escape);
}
$glue = ($query_type == 'SELECT') ? "\nAND " : ",\n";
$query = join($glue, $ary);
$query = implode($glue, $ary);
}
if (!$query) {
@ -529,31 +529,31 @@ class sql_db
foreach ($sql_ary as $clause => $ary) {
switch ($clause) {
case 'SELECT':
$sql .= ($ary) ? ' SELECT ' . join(' ', $sql_ary['select_options']) . ' ' . join(', ', $ary) : '';
$sql .= ($ary) ? ' SELECT ' . implode(' ', $sql_ary['select_options']) . ' ' . implode(', ', $ary) : '';
break;
case 'FROM':
$sql .= ($ary) ? ' FROM ' . join(', ', $ary) : '';
$sql .= ($ary) ? ' FROM ' . implode(', ', $ary) : '';
break;
case 'INNER JOIN':
$sql .= ($ary) ? ' INNER JOIN ' . join(' INNER JOIN ', $ary) : '';
$sql .= ($ary) ? ' INNER JOIN ' . implode(' INNER JOIN ', $ary) : '';
break;
case 'LEFT JOIN':
$sql .= ($ary) ? ' LEFT JOIN ' . join(' LEFT JOIN ', $ary) : '';
$sql .= ($ary) ? ' LEFT JOIN ' . implode(' LEFT JOIN ', $ary) : '';
break;
case 'WHERE':
$sql .= ($ary) ? ' WHERE ' . join(' AND ', $ary) : '';
$sql .= ($ary) ? ' WHERE ' . implode(' AND ', $ary) : '';
break;
case 'GROUP BY':
$sql .= ($ary) ? ' GROUP BY ' . join(', ', $ary) : '';
$sql .= ($ary) ? ' GROUP BY ' . implode(', ', $ary) : '';
break;
case 'HAVING':
$sql .= ($ary) ? ' HAVING ' . join(' AND ', $ary) : '';
$sql .= ($ary) ? ' HAVING ' . implode(' AND ', $ary) : '';
break;
case 'ORDER BY':
$sql .= ($ary) ? ' ORDER BY ' . join(', ', $ary) : '';
$sql .= ($ary) ? ' ORDER BY ' . implode(', ', $ary) : '';
break;
case 'LIMIT':
$sql .= ($ary) ? ' LIMIT ' . join(', ', $ary) : '';
$sql .= ($ary) ? ' LIMIT ' . implode(', ', $ary) : '';
break;
}
}
@ -643,7 +643,7 @@ class sql_db
foreach ((array)$tables as $table_name) {
$tables_sql[] = "$table_name $lock_type";
}
if ($tables_sql = join(', ', $tables_sql)) {
if ($tables_sql = implode(', ', $tables_sql)) {
$this->locked = $this->sql_query("LOCK TABLES $tables_sql");
}
@ -913,7 +913,7 @@ class sql_db
$msg[] = sprintf('%05d', getmypid());
$msg[] = $this->db_server;
$msg[] = short_query($this->cur_query);
$msg = join(LOG_SEPR, $msg);
$msg = implode(LOG_SEPR, $msg);
$msg .= ($info = $this->query_info()) ? ' # ' . $info : '';
$msg .= ' # ' . $this->debug_find_source() . ' ';
$msg .= defined('IN_CRON') ? 'cron' : basename($_SERVER['REQUEST_URI']);

View file

@ -73,7 +73,7 @@ foreach ($cron_jobs as $job) {
$msg[] = sprintf('%-4s', round(sys('la'), 1));
$msg[] = sprintf('%05d', getmypid());
$msg[] = $job['cron_title'];
$msg = join(LOG_SEPR, $msg);
$msg = implode(LOG_SEPR, $msg);
bb_log($msg . LOG_LF, CRON_LOG_DIR . '/' . CRON_LOG_FILE);
}
@ -97,7 +97,7 @@ foreach ($cron_jobs as $job) {
$msg[] = sprintf('%-4s', round(sys('la'), 1));
$msg[] = sprintf('%05d', getmypid());
$msg[] = round(utime() - $cron_start_time) . '/' . round(utime() - TIMESTART) . ' sec';
$msg = join(LOG_SEPR, $msg);
$msg = implode(LOG_SEPR, $msg);
$msg .= LOG_LF . '------=-------=----------=------=-------=----------';
bb_log($msg . LOG_LF, CRON_LOG_DIR . '/' . CRON_LOG_FILE);

View file

@ -66,13 +66,13 @@ if ($dir = @opendir($attach_dir)) {
$f_len += strlen($f) + 5;
if ($f_len > $db_max_packet) {
$files = join(',', $files);
$files = implode(',', $files);
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
$files = array();
$f_len = 0;
}
}
if ($files = join(',', $files)) {
if ($files = implode(',', $files)) {
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
}
closedir($dir);
@ -154,7 +154,7 @@ if ($check_attachments) {
$orphan_db_attach[] = $row['attach_id'];
}
// Delete all orphan attachments
if ($orphans_sql = join(',', $orphan_db_attach)) {
if ($orphans_sql = implode(',', $orphan_db_attach)) {
if ($fix_errors) {
DB()->query("DELETE FROM " . BB_ATTACHMENTS_DESC . " WHERE attach_id IN($orphans_sql)");
DB()->query("DELETE FROM " . BB_ATTACHMENTS . " WHERE attach_id IN($orphans_sql)");
@ -172,7 +172,7 @@ if ($check_attachments) {
$orphan_tor[] = $row['topic_id'];
}
// Delete all orphan torrents
if ($orphans_sql = join(',', $orphan_tor)) {
if ($orphans_sql = implode(',', $orphan_tor)) {
if ($fix_errors) {
DB()->query("DELETE FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($orphans_sql)");
}
@ -188,7 +188,7 @@ if ($check_attachments) {
foreach (DB()->fetch_rowset($sql) as $row) {
$posts_without_attach[] = $row['post_id'];
}
if ($posts_sql = join(',', $posts_without_attach)) {
if ($posts_sql = implode(',', $posts_without_attach)) {
if ($fix_errors) {
DB()->query("UPDATE " . BB_POSTS . " SET post_attachment = 0 WHERE post_id IN($posts_sql)");
}
@ -204,7 +204,7 @@ if ($check_attachments) {
foreach (DB()->fetch_rowset($sql) as $row) {
$topics_without_attach[] = $row['topic_id'];
}
if ($topics_sql = join(',', $topics_without_attach)) {
if ($topics_sql = implode(',', $topics_without_attach)) {
if ($fix_errors) {
DB()->query("UPDATE " . BB_TOPICS . " SET topic_attachment = 0 WHERE topic_id IN($topics_sql)");
}

View file

@ -47,7 +47,7 @@ foreach ($keeping_dlstat as $dl_status => $days_to_keep) {
}
}
if ($delete_dlstat_sql = join(') OR (', $delete_dlstat_sql)) {
if ($delete_dlstat_sql = implode(') OR (', $delete_dlstat_sql)) {
DB()->query("DELETE QUICK FROM " . BB_BT_DLSTATUS . " WHERE ($delete_dlstat_sql)");
}

View file

@ -47,8 +47,8 @@ foreach (DB()->fetch_rowset($sql) as $row) {
$topics_sql[] = $row['topic_id'];
$attach_sql[] = $row['attach_id'];
}
$dead_tor_sql = join(',', $topics_sql);
$attach_sql = join(',', $attach_sql);
$dead_tor_sql = implode(',', $topics_sql);
$attach_sql = implode(',', $attach_sql);
if ($dead_tor_sql && $attach_sql) {
// Delete torstat

View file

@ -73,7 +73,7 @@ while (true) {
}
foreach (DB()->fetch_rowset($sql) as $row) {
$val[] = join(',', $row);
$val[] = implode(',', $row);
}
if ($val) {
@ -81,13 +81,13 @@ while (true) {
DB()->query("
REPLACE INTO " . NEW_BB_BT_TRACKER_SNAP . "
(topic_id, seeders, leechers, speed_up, speed_down)
VALUES(" . join('),(', $val) . ")
VALUES(" . implode('),(', $val) . ")
");
} else {
DB()->query("
INSERT INTO " . BB_BT_TRACKER_SNAP . "
(topic_id, speed_up, speed_down)
VALUES(" . join('),(', $val) . ")
VALUES(" . implode('),(', $val) . ")
ON DUPLICATE KEY UPDATE speed_up = VALUES(speed_up), speed_down = VALUES(speed_down)
");
}
@ -179,7 +179,7 @@ if ($bb_cfg['torhelp_enabled']) {
$online_users_ary[] = $row['uid'];
}
if ($online_users_csv = join(',', $online_users_ary)) {
if ($online_users_csv = implode(',', $online_users_ary)) {
DB()->query("
INSERT INTO " . NEW_BB_BT_TORHELP . " (user_id, topic_id_csv)
SELECT

View file

@ -113,9 +113,9 @@ foreach (DB()->fetch_rowset($sql) as $row) {
$data['c'][$row['cat_id']]['forums'][] = $fid;
}
foreach ($data['not_auth_forums'] as $key => $val) {
$data['not_auth_forums'][$key] = join(',', $val);
$data['not_auth_forums'][$key] = implode(',', $val);
}
$data['tracker_forums'] = join(',', $data['tracker_forums']);
$data['tracker_forums'] = implode(',', $data['tracker_forums']);
$this->store('cat_forums', $data);

View file

@ -79,7 +79,7 @@ class datastore_sqlite extends datastore_common
$prefix_sql = SQLite3::escapeString($this->prefix);
array_deep($items, 'SQLite3::escapeString');
$items_list = $prefix_sql . join("','$prefix_sql", $items);
$items_list = $prefix_sql . implode("','$prefix_sql", $items);
$rowset = $this->db->fetch_rowset("SELECT ds_title, ds_data FROM " . $this->cfg['table_name'] . " WHERE ds_title IN ('$items_list')");

View file

@ -583,7 +583,7 @@ class Date_Delta
break;
}
}
return join(' ', $parts);
return implode(' ', $parts);
}
// returns the associative array with date deltas.
@ -1915,7 +1915,7 @@ function get_id_csv($ids)
{
$ids = array_values((array)$ids);
array_deep($ids, 'intval', 'one-dimensional');
return (string)join(',', $ids);
return (string)implode(',', $ids);
}
// $ids - array(id1,id2,..) or (string) id1,id2,..
@ -2249,7 +2249,7 @@ function log_sphinx_error($err_type, $err_msg, $query = '')
'negation on top level',
'Query word length is less than min prefix length',
);
if (!count($ignore_err_txt) || !preg_match('#' . join('|', $ignore_err_txt) . '#i', $err_msg)) {
if (!count($ignore_err_txt) || !preg_match('#' . implode('|', $ignore_err_txt) . '#i', $err_msg)) {
$orig_query = strtr($_REQUEST['nm'], array("\n" => '\n'));
bb_log(date('m-d H:i:s') . " | $err_type | $err_msg | $orig_query | $query" . LOG_LF, 'sphinx_error');
}
@ -2291,7 +2291,7 @@ function get_title_match_topics($title_match_sql, $forum_ids = array())
log_sphinx_error('wrn', $warning, $title_match_sql);
}
} elseif ($bb_cfg['search_engine_type'] == 'mysql') {
$where_forum = ($forum_ids) ? "AND forum_id IN(" . join(',', $forum_ids) . ")" : '';
$where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : '';
$search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : '';
if ($title_match) {

View file

@ -58,7 +58,7 @@ function sync($type, $id)
// начальное обнуление значений
$forum_ary = explode(',', $forum_csv);
DB()->query("REPLACE INTO $tmp_sync_forums (forum_id) VALUES(" . join('),(', $forum_ary) . ")");
DB()->query("REPLACE INTO $tmp_sync_forums (forum_id) VALUES(" . implode('),(', $forum_ary) . ")");
DB()->query("
REPLACE INTO $tmp_sync_forums
@ -761,5 +761,5 @@ function get_usernames_for_log($user_id)
}
}
return join(', ', $users_log_msg);
return implode(', ', $users_log_msg);
}

View file

@ -47,7 +47,7 @@ function update_table_bool($table_name, $key, $field_name, $field_def_val)
}
// Update status
if ($in_sql = join(',', $in_sql)) {
if ($in_sql = implode(',', $in_sql)) {
$sql = "UPDATE $table_name
SET $field_name = 1
WHERE $key IN($in_sql)";

View file

@ -32,7 +32,7 @@ function update_user_level($user_id)
global $datastore;
if (is_array($user_id)) {
$user_id = join(',', $user_id);
$user_id = implode(',', $user_id);
}
$user_groups_in = ($user_id !== 'all') ? "AND ug.user_id IN($user_id)" : '';
$users_in = ($user_id !== 'all') ? "AND u.user_id IN($user_id)" : '';
@ -203,7 +203,7 @@ function store_permissions($group_id, $auth_ary)
function update_user_permissions($user_id = 'all')
{
if (is_array($user_id)) {
$user_id = join(',', $user_id);
$user_id = implode(',', $user_id);
}
$delete_in = ($user_id !== 'all') ? " WHERE user_id IN($user_id)" : '';
$users_in = ($user_id !== 'all') ? "AND ug.user_id IN($user_id)" : '';

View file

@ -318,7 +318,7 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
foreach ($sql as $row) {
$user_id_sql[] = ',' . $row['ban_userid'];
}
$user_id_sql = join('', $user_id_sql);
$user_id_sql = implode('', $user_id_sql);
$watch_list = DB()->fetch_rowset("SELECT u.username, u.user_id, u.user_email, u.user_lang
FROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u
@ -362,7 +362,7 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
$update_watched_sql[] = $row['user_id'];
}
$update_watched_sql = join(',', $update_watched_sql);
$update_watched_sql = implode(',', $update_watched_sql);
}
if ($update_watched_sql) {

View file

@ -73,7 +73,7 @@ function validate_username($username, $check_ban_and_taken = true)
foreach (DB()->fetch_rowset("SELECT disallow_username FROM " . BB_DISALLOW . " ORDER BY NULL") as $row) {
$banned_names[] = str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#u'));
}
if ($banned_names_exp = join('|', $banned_names)) {
if ($banned_names_exp = implode('|', $banned_names)) {
if (preg_match("#^($banned_names_exp)$#iu", $username)) {
return $lang['USERNAME_DISALLOWED'];
}
@ -101,7 +101,7 @@ function validate_email($email, $check_ban_and_taken = true)
foreach (DB()->fetch_rowset("SELECT ban_email FROM " . BB_BANLIST . " ORDER BY NULL") as $row) {
$banned_emails[] = str_replace('\*', '.*?', preg_quote($row['ban_email'], '#'));
}
if ($banned_emails_exp = join('|', $banned_emails)) {
if ($banned_emails_exp = implode('|', $banned_emails)) {
if (preg_match("#^($banned_emails_exp)$#i", $email)) {
return sprintf($lang['EMAIL_BANNED'], $email);
}

View file

@ -94,7 +94,7 @@ foreach (DB()->fetch_rowset($sql) as $u) {
$stat[] = "t:<span style=\"color: #1E90FF\">$t</span>";
}
$ulist[$level][] = ($stat) ? "$name<span class=\"ou_stat\" style=\"color: #707070\" title=\"{$u['session_ip']}\"> [<b>" . join(', ', $stat) . '</b>]</span>' : $name;
$ulist[$level][] = ($stat) ? "$name<span class=\"ou_stat\" style=\"color: #707070\" title=\"{$u['session_ip']}\"> [<b>" . implode(', ', $stat) . '</b>]</span>' : $name;
} else {
$guests_online = $u['ips'];
$users_cnt['guest'] = $guests_online;
@ -111,18 +111,18 @@ if ($ulist) {
if (count($users) > 200) {
$style = 'margin: 3px 0; padding: 2px 4px; border: 1px inset; height: 200px; overflow: auto;';
$block[] = "<div style=\"$style\">\n" . join(",\n", $users) . "</div>\n";
$block[] = "<div style=\"$style\">\n" . implode(",\n", $users) . "</div>\n";
$short[] = '<a href="index.php?online_full=1#online">' . $lang['USERS'] . ': ' . count($users) . '</a>';
} else {
$inline[] = join(",\n", $users);
$short[] = join(",\n", $users);
$inline[] = implode(",\n", $users);
$short[] = implode(",\n", $users);
}
$logged_online += count($users);
}
$online['userlist'] = join(",\n", $inline) . join("\n", $block);
$online_short['userlist'] = join(",\n", $short);
$online['userlist'] = implode(",\n", $inline) . implode("\n", $block);
$online_short['userlist'] = implode(",\n", $short);
}
if (!$online['userlist']) {

View file

@ -248,7 +248,7 @@ if (!empty($page_cfg['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])
}
$template->assign_vars(array(
'TORHELP_TOPICS' => join("</li>\n<li>", $torhelp_topics),
'TORHELP_TOPICS' => implode("</li>\n<li>", $torhelp_topics),
));
}
}

View file

@ -680,7 +680,7 @@ class user_common
}
}
return join(',', $not_auth_forums);
return implode(',', $not_auth_forums);
}
/**
@ -713,7 +713,7 @@ class user_common
switch ($return_as) {
case 'csv':
return join(',', $excluded);
return implode(',', $excluded);
case 'array':
return $excluded;
case 'flip':

View file

@ -53,13 +53,13 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
if ($headers != '') {
if (is_array($headers)) {
if (sizeof($headers) > 1) {
$headers = join("\n", $headers);
if (count($headers) > 1) {
$headers = implode("\n", $headers);
} else {
$headers = $headers[0];
}
}
$headers = chop($headers);
$headers = rtrim($headers);
// Make sure there are no bare linefeeds in the headers
$headers = preg_replace('#(?<!\r)\n#si', "\r\n", $headers);
@ -81,7 +81,7 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
$headers .= ($header != '') ? $header . "\r\n" : '';
}
$headers = chop($headers);
$headers = rtrim($headers);
$cc = explode(', ', $cc);
$bcc = explode(', ', $bcc);
}
@ -106,31 +106,31 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
// This improved as provided by SirSir to accomodate
if (!empty($bb_cfg['smtp_username']) && !empty($bb_cfg['smtp_password'])) {
fputs($socket, "EHLO " . $bb_cfg['smtp_host'] . "\r\n");
fwrite($socket, "EHLO " . $bb_cfg['smtp_host'] . "\r\n");
server_parse($socket, "250", __LINE__);
fputs($socket, "AUTH LOGIN\r\n");
fwrite($socket, "AUTH LOGIN\r\n");
server_parse($socket, "334", __LINE__);
fputs($socket, base64_encode($bb_cfg['smtp_username']) . "\r\n");
fwrite($socket, base64_encode($bb_cfg['smtp_username']) . "\r\n");
server_parse($socket, "334", __LINE__);
fputs($socket, base64_encode($bb_cfg['smtp_password']) . "\r\n");
fwrite($socket, base64_encode($bb_cfg['smtp_password']) . "\r\n");
server_parse($socket, "235", __LINE__);
} else {
fputs($socket, "HELO " . $bb_cfg['smtp_host'] . "\r\n");
fwrite($socket, "HELO " . $bb_cfg['smtp_host'] . "\r\n");
server_parse($socket, "250", __LINE__);
}
// From this point onward most server response codes should be 250
// Specify who the mail is from....
fputs($socket, "MAIL FROM: <" . $bb_cfg['board_email'] . ">\r\n");
fwrite($socket, "MAIL FROM: <" . $bb_cfg['board_email'] . ">\r\n");
server_parse($socket, "250", __LINE__);
// Add an additional bit of error checking to the To field.
$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
if (preg_match('#[^ ]+\@[^ ]+#', $mail_to)) {
fputs($socket, "RCPT TO: <$mail_to>\r\n");
fwrite($socket, "RCPT TO: <$mail_to>\r\n");
server_parse($socket, "250", __LINE__);
}
@ -140,7 +140,7 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
// Add an additional bit of error checking to bcc header...
$bcc_address = trim($bcc_address);
if (preg_match('#[^ ]+\@[^ ]+#', $bcc_address)) {
fputs($socket, "RCPT TO: <$bcc_address>\r\n");
fwrite($socket, "RCPT TO: <$bcc_address>\r\n");
server_parse($socket, "250", __LINE__);
}
}
@ -150,35 +150,35 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
// Add an additional bit of error checking to cc header
$cc_address = trim($cc_address);
if (preg_match('#[^ ]+\@[^ ]+#', $cc_address)) {
fputs($socket, "RCPT TO: <$cc_address>\r\n");
fwrite($socket, "RCPT TO: <$cc_address>\r\n");
server_parse($socket, "250", __LINE__);
}
}
// Ok now we tell the server we are ready to start sending data
fputs($socket, "DATA\r\n");
fwrite($socket, "DATA\r\n");
// This is the last response code we look for until the end of the message.
server_parse($socket, "354", __LINE__);
// Send the Subject Line...
fputs($socket, "Subject: $subject\r\n");
fwrite($socket, "Subject: $subject\r\n");
// Now the To Header.
fputs($socket, "To: $mail_to\r\n");
fwrite($socket, "To: $mail_to\r\n");
// Now any custom headers....
fputs($socket, "$headers\r\n\r\n");
fwrite($socket, "$headers\r\n\r\n");
// Ok now we are ready for the message...
fputs($socket, "$message\r\n");
fwrite($socket, "$message\r\n");
// Ok the all the ingredients are mixed in let's cook this puppy...
fputs($socket, ".\r\n");
fwrite($socket, ".\r\n");
server_parse($socket, "250", __LINE__);
// Now tell the server we are done and close the socket...
fputs($socket, "QUIT\r\n");
fwrite($socket, "QUIT\r\n");
fclose($socket);
return true;

View file

@ -396,12 +396,12 @@ class template
if (strstr($blockname, '.')) {
// Nested block.
$blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1;
$blockcount = count($blocks) - 1;
$str = &$this->_tpldata;
for ($i = 0; $i < $blockcount; $i++) {
$str = &$str[$blocks[$i] . '.'];
$str = &$str[sizeof($str) - 1];
$str = &$str[count($str) - 1];
}
// Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given
@ -517,7 +517,7 @@ class template
{
// Get an array of the blocks involved.
$blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1;
$blockcount = count($blocks) - 1;
if ($include_last_iterator) {
return '$' . $blocks[$blockcount] . '_item';
}
@ -686,7 +686,7 @@ class template
} else {
// This block is nested.
// Generate a namespace string for this block.
$namespace = join('.', $block_names);
$namespace = implode('.', $block_names);
// strip leading period from root level..
$namespace = substr($namespace, 2);
// Get a reference to the data array for this block that depends on the
@ -806,7 +806,7 @@ class template
$code_header = '';
$code_footer = '';
return $code_header . join('', $compiled) . $code_footer;
return $code_header . implode('', $compiled) . $code_footer;
}
/*
@ -821,7 +821,7 @@ class template
// This one will handle varrefs WITH namespaces
$varrefs = array();
preg_match_all('#\{(([a-z0-9\-_]+?\.)+)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
$varcount = sizeof($varrefs[1]);
$varcount = count($varrefs[1]);
$search = array();
$replace = array();
for ($i = 0; $i < $varcount; $i++) {
@ -912,7 +912,7 @@ class template
case 'is':
$is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
$is_arg = join(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
$is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
$new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
@ -948,9 +948,9 @@ class template
}
if ($elseif) {
$code = '} elseif (' . join(' ', $tokens) . ') {';
$code = '} elseif (' . implode(' ', $tokens) . ') {';
} else {
$code = 'if (' . join(' ', $tokens) . ') {';
$code = 'if (' . implode(' ', $tokens) . ') {';
}
return $code;

View file

@ -97,7 +97,7 @@ if ($row = DB()->fetch_row($sql)) {
'USERNAME' => profile_url($row),
'S_HIDDEN_FIELDS' => '',
'S_POST_ACTION' => "profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id",
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '',
));
print_page('usercp_email.tpl');

View file

@ -147,7 +147,7 @@ switch ($mode) {
} else {
$pr_user_id = $userdata['user_id'];
}
$profile_fields_sql = join(', ', array_keys($profile_fields));
$profile_fields_sql = implode(', ', array_keys($profile_fields));
$sql = "
SELECT
user_id,
@ -679,7 +679,7 @@ $template->assign_vars($tp_data);
$template->assign_vars(array(
'PAGE_TITLE' => ($mode == 'editprofile') ? $lang['EDIT_PROFILE'] . ($adm_edit ? " :: {$pr_data['username']}" : '') : $lang['REGISTER'],
'SHOW_REG_AGREEMENT' => ($mode == 'register' && !IS_ADMIN),
'ERROR_MESSAGE' => ($errors) ? join('<br />', array_unique($errors)) : '',
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '',
'MODE' => $mode,
'EDIT_PROFILE' => ($mode == 'editprofile'),
'ADM_EDIT' => $adm_edit,

View file

@ -162,7 +162,7 @@ if (IS_ADMIN) {
if ($single) {
$group_membership[] = $lang['INDIVIDUAL'];
}
$group_membership = join(', ', $group_membership);
$group_membership = implode(', ', $group_membership);
}
$template->assign_vars(array(
'GROUP_MEMBERSHIP' => (bool)$group_membership,
@ -232,6 +232,6 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) {
$user_restrictions[] = $lang['NEW_THREADS'];
}
$template->assign_var('USER_RESTRICTIONS', join('</li><li>', $user_restrictions));
$template->assign_var('USER_RESTRICTIONS', implode('</li><li>', $user_restrictions));
print_page('usercp_viewprofile.tpl');

View file

@ -135,7 +135,7 @@ if (IS_GUEST || $mod_admin_login) {
$template->assign_vars(array(
'LOGIN_USERNAME' => htmlCHR($login_username),
'LOGIN_PASSWORD' => htmlCHR($login_password),
'ERROR_MESSAGE' => join('<br />', $login_errors),
'ERROR_MESSAGE' => implode('<br />', $login_errors),
'ADMIN_LOGIN' => $mod_admin_login,
'REDIRECT_URL' => htmlCHR($redirect_url),
'CAPTCHA_HTML' => ($need_captcha && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : '',

View file

@ -259,7 +259,7 @@ switch ($mode) {
} else {
print_confirmation(array(
'QUESTION' => $lang['CONFIRM_DELETE_TOPIC'],
'ITEMS_LIST' => join("\n</li>\n<li>\n", $topic_titles),
'ITEMS_LIST' => implode("\n</li>\n<li>\n", $topic_titles),
'FORM_ACTION' => "modcp.php",
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
));
@ -304,7 +304,7 @@ switch ($mode) {
'MESSAGE_TITLE' => $lang['CONFIRM'],
'MESSAGE_TEXT' => $lang['CONFIRM_MOVE_TOPIC'],
'TOPIC_TITLES' => join("\n</li>\n<li>\n", $topic_titles),
'TOPIC_TITLES' => implode("\n</li>\n<li>\n", $topic_titles),
'S_FORUM_SELECT' => $forum_select,
'S_MODCP_ACTION' => "modcp.php",
@ -402,7 +402,7 @@ switch ($mode) {
$req_post_id_sql[] = $pid;
}
}
if ($req_post_id_sql = join(',', $req_post_id_sql)) {
if ($req_post_id_sql = implode(',', $req_post_id_sql)) {
$sql = "SELECT post_id
FROM " . BB_POSTS . "
WHERE post_id IN($req_post_id_sql)
@ -417,7 +417,7 @@ switch ($mode) {
foreach ($rowset as $rid => $row) {
$post_id_sql[] = $row['post_id'];
}
$post_id_sql = join(',', $post_id_sql);
$post_id_sql = implode(',', $post_id_sql);
}
}
}

View file

@ -241,7 +241,7 @@ if (!$is_auth[$is_auth_type]) {
}
if ($mode == 'new_rel') {
if ($tor_status = join(',', $bb_cfg['tor_cannot_new'])) {
if ($tor_status = implode(',', $bb_cfg['tor_cannot_new'])) {
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
WHERE poster_id = {$userdata['user_id']}
@ -404,7 +404,7 @@ if (($delete || $mode == 'delete') && !$confirm) {
}
}
$sub_forums[] = $forum_id;
$sub_forums = join(',', $sub_forums);
$sub_forums = implode(',', $sub_forums);
// Подсчет проверенных релизов в форумах раздела
$count_checked_releases = DB()->fetch_row("
SELECT COUNT(*) AS checked_releases

View file

@ -504,7 +504,7 @@ if ($mode == 'read') {
if (count($mark_list)) {
$delete_sql_id = '';
for ($i = 0; $i < sizeof($mark_list); $i++) {
for ($i = 0; $i < count($mark_list); $i++) {
$delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($mark_list[$i]);
}
@ -544,7 +544,7 @@ if ($mode == 'read') {
}
} while ($row = DB()->sql_fetchrow($result));
if (sizeof($update_users)) {
if (count($update_users)) {
while (list($type, $users) = each($update_users)) {
while (list($user_id, $dec) = each($users)) {
$update_list[$type][$dec][] = $user_id;
@ -564,7 +564,7 @@ if ($mode == 'read') {
}
while (list($dec, $user_ary) = each($dec_ary)) {
$user_ids = join(', ', $user_ary);
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . BB_USERS . "
SET $type = $type - $dec
@ -624,7 +624,7 @@ if ($mode == 'read') {
}
}
} elseif ($save && $mark_list && $folder != 'savebox' && $folder != 'outbox') {
if (sizeof($mark_list)) {
if (count($mark_list)) {
// See if recipient is at their savebox limit
$sql = "SELECT COUNT(privmsgs_id) AS savebox_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . BB_PRIVMSGS . "
@ -663,7 +663,7 @@ if ($mode == 'read') {
}
$saved_sql_id = '';
for ($i = 0; $i < sizeof($mark_list); $i++) {
for ($i = 0; $i < count($mark_list); $i++) {
$saved_sql_id .= (($saved_sql_id != '') ? ', ' : '') . intval($mark_list[$i]);
}
@ -707,7 +707,7 @@ if ($mode == 'read') {
}
} while ($row = DB()->sql_fetchrow($result));
if (sizeof($update_users)) {
if (count($update_users)) {
while (list($type, $users) = each($update_users)) {
while (list($user_id, $dec) = each($users)) {
$update_list[$type][$dec][] = $user_id;
@ -727,7 +727,7 @@ if ($mode == 'read') {
}
while (list($dec, $user_ary) = each($dec_ary)) {
$user_ids = join(', ', $user_ary);
$user_ids = implode(', ', $user_ary);
$sql = "UPDATE " . BB_USERS . " SET $type = $type - $dec WHERE user_id IN ($user_ids)";
if (!DB()->sql_query($sql)) {

View file

@ -390,13 +390,13 @@ if (!$items_found) {
$forum_selected = get_id_ary($var);
if (!in_array($search_all, $forum_selected)) {
$forum_val = join(',', $forum_selected);
$forum_val = implode(',', $forum_selected);
}
}
// Topic
if ($var =& $_REQUEST[$topic_key]) {
$topic_val = join(',', get_id_ary($var));
$topic_val = implode(',', get_id_ary($var));
}
// Poster id (from requested name or id)
@ -442,7 +442,7 @@ if ($dl_down_val) {
if ($dl_will_val) {
$dl_status[] = DL_STATUS_WILL;
}
$dl_status_csv = join(',', $dl_status);
$dl_status_csv = implode(',', $dl_status);
// Switches
$dl_search = ($dl_status && !IS_GUEST);
@ -526,7 +526,7 @@ if ($post_mode) {
$search_match_topics_csv = '';
$title_match_topics = get_title_match_topics($text_match_sql, $forum_selected);
if (!$search_match_topics_csv = join(',', $title_match_topics)) {
if (!$search_match_topics_csv = implode(',', $title_match_topics)) {
bb_die($lang['NO_SEARCH_MATCH']);
}
@ -565,7 +565,7 @@ if ($post_mode) {
LEFT JOIN $posts_html_tbl ON(h.post_id = pt.post_id)
INNER JOIN $users_tbl ON(u.user_id = p.poster_id)
WHERE
p.post_id IN(" . join(',', $items_display) . ")
p.post_id IN(" . implode(',', $items_display) . ")
$excluded_forums_sql
LIMIT $per_page
";
@ -729,7 +729,7 @@ else {
$search_match_topics_csv = '';
$title_match_topics = get_title_match_topics($text_match_sql, $forum_selected);
if (!$search_match_topics_csv = join(',', $title_match_topics)) {
if (!$search_match_topics_csv = implode(',', $title_match_topics)) {
bb_die($lang['NO_SEARCH_MATCH']);
}
@ -787,7 +787,7 @@ else {
$SQL['LEFT JOIN'][] = BB_BT_DLSTATUS . " dl ON(dl.user_id = $user_id AND dl.topic_id = t.topic_id)";
}
$SQL['WHERE'][] = "t.topic_id IN(" . join(',', $items_display) . ")";
$SQL['WHERE'][] = "t.topic_id IN(" . implode(',', $items_display) . ")";
if ($excluded_forums_csv) {
$SQL['WHERE'][] = "t.forum_id NOT IN($excluded_forums_csv)";
}
@ -882,7 +882,7 @@ function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
$search_id = make_rand_str(SEARCH_ID_LENGTH);
if ($items_count > $per_page) {
$search_array = join(',', $items_found);
$search_array = implode(',', $items_found);
$save_in_db = array(
'order',

View file

@ -373,7 +373,7 @@ if (!$set_default) {
if ($req_cat_id =& $_REQUEST[$cat_key]) {
if (isset($cat_forum['c'][$req_cat_id])) {
$valid_forums = $cat_forum['c'][$req_cat_id];
$forum_val = join(',', $valid_forums);
$forum_val = implode(',', $valid_forums);
}
} // Get requested forum_id(s)
elseif ($req_forums =& $_REQUEST[$forum_key]) {
@ -381,17 +381,17 @@ if (!$set_default) {
$req_forums = (array)$req_forums;
array_deep($req_forums, 'intval');
$valid_forums = array_intersect($req_forums, $allowed_forums);
$forum_val = join(',', $valid_forums);
$forum_val = implode(',', $valid_forums);
}
} elseif (isset($previous_settings[$forum_key])) {
$valid_forums = array_intersect(explode(',', $previous_settings[$forum_key]), $allowed_forums);
$forum_val = join(',', $valid_forums);
$forum_val = implode(',', $valid_forums);
}
if ($forum_val && $forum_val != $search_all) {
$search_in_forums_ary = array_slice(explode(',', $forum_val), 0, $max_forums_selected);
$search_in_forums_fary = array_flip($search_in_forums_ary);
$search_in_forums_csv = join(',', $search_in_forums_ary);
$search_in_forums_csv = implode(',', $search_in_forums_ary);
$forum_val = $search_in_forums_csv;
} else {
$forum_val = $search_all;
@ -462,7 +462,7 @@ if ($dl_down_val) {
if ($dl_will_val) {
$dl_status[] = DL_STATUS_WILL;
}
$dl_status_csv = join(',', $dl_status);
$dl_status_csv = implode(',', $dl_status);
// Switches
$seed_exist = (bool)$seed_exist_val;
@ -530,7 +530,7 @@ if ($allowed_forums) {
if ($title_match) {
$title_match_topics = get_title_match_topics($title_match_sql, $search_in_forums_ary);
if (!$search_match_topics_csv = join(',', $title_match_topics)) {
if (!$search_match_topics_csv = implode(',', $title_match_topics)) {
$tr_error = true;
}
} else {
@ -630,7 +630,7 @@ if ($allowed_forums) {
foreach (DB()->fetch_rowset($SQL) as $row) {
$tor_list_ary[] = $row['topic_id'];
}
$tor_list_sql = join(',', $tor_list_ary);
$tor_list_sql = implode(',', $tor_list_ary);
$tor_count = count($tor_list_ary);
}
}
@ -655,7 +655,7 @@ if ($allowed_forums) {
$tor_to_show = ($tor_count > $per_page) ? array_slice($tor_list_ary, $start, $per_page) : $tor_list_ary;
if (!$tor_to_show = join(',', $tor_to_show)) {
if (!$tor_to_show = implode(',', $tor_to_show)) {
bb_die($lang['NO_SEARCH_MATCH']);
}

View file

@ -324,7 +324,7 @@ if ($title_match =& $_REQUEST[$title_match_key]) {
$title_match_val = clean_text_match($tmp, true, false);
$title_match_topics = get_title_match_topics($title_match_val, array(0 => $forum_id));
if ($search_match_topics_csv = join(',', $title_match_topics)) {
if ($search_match_topics_csv = implode(',', $title_match_topics)) {
$title_match_sql = "AND t.topic_id IN($search_match_topics_csv)";
}
}
@ -349,7 +349,7 @@ foreach (DB()->fetch_rowset($sql) as $row) {
}
// Titles, posters etc.
if ($topics_csv = join(',', $topic_ids)) {
if ($topics_csv = implode(',', $topic_ids)) {
$topic_rowset = DB()->fetch_rowset("
SELECT
t.*, t.topic_poster AS first_user_id, u1.user_rank as first_user_rank,
@ -402,7 +402,7 @@ $u_auth[] = ($is_auth['auth_vote']) ? $lang['RULES_VOTE_CAN'] : $lang['RULES_VOT
$u_auth[] = ($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'];
$u_auth[] = ($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'];
$u_auth[] = ($is_auth['auth_mod']) ? $lang['RULES_MODERATE'] : '';
$u_auth = join("<br />\n", $u_auth);
$u_auth = implode("<br />\n", $u_auth);
$template->assign_vars(array(
'SHOW_JUMPBOX' => true,