mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Logical operators should be avoided
The or operator does not have the same precedence as ||. This could lead to unexpected behavior, use || instead. The and operator does not have the same precedence as &&. This could lead to unexpected behavior, use && instead.
This commit is contained in:
parent
a6625d7327
commit
147d61169a
29 changed files with 63 additions and 50 deletions
|
@ -13,11 +13,11 @@ $prune_performed = false;
|
||||||
|
|
||||||
if (isset($_REQUEST['submit']))
|
if (isset($_REQUEST['submit']))
|
||||||
{
|
{
|
||||||
if (!$var =& $_REQUEST['f'] OR !$f_selected = get_id_ary($var))
|
if (!($var =& $_REQUEST['f']) || !($f_selected = get_id_ary($var)))
|
||||||
{
|
{
|
||||||
bb_die('Forum not selected');
|
bb_die('Forum not selected');
|
||||||
}
|
}
|
||||||
if (!$var =& $_REQUEST['prunedays'] OR !$prunedays = abs(intval($var)))
|
if (!($var =& $_REQUEST['prunedays']) || !($prunedays = abs(intval($var))))
|
||||||
{
|
{
|
||||||
bb_die($lang['NOT_DAYS']);
|
bb_die($lang['NOT_DAYS']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ if ($var =& $_REQUEST[$topic_key])
|
||||||
// Sort
|
// Sort
|
||||||
$sort_val = $def_sort;
|
$sort_val = $def_sort;
|
||||||
|
|
||||||
if ($var =& $_REQUEST[$sort_key] AND $var != $def_sort)
|
if (($var =& $_REQUEST[$sort_key]) && ($var != $def_sort))
|
||||||
{
|
{
|
||||||
$sort_val = ($var == $sort_asc) ? $sort_asc : $sort_desc;
|
$sort_val = ($var == $sort_asc) ? $sort_asc : $sort_desc;
|
||||||
$url = url_arg($url, $sort_key, $sort_val);
|
$url = url_arg($url, $sort_key, $sort_val);
|
||||||
|
@ -148,12 +148,12 @@ if ($var =& $_REQUEST[$sort_key] AND $var != $def_sort)
|
||||||
$datetime_val = $def_datetime;
|
$datetime_val = $def_datetime;
|
||||||
$daysback_val = $def_days;
|
$daysback_val = $def_days;
|
||||||
|
|
||||||
if ($var =& $_REQUEST[$daysback_key] AND $var != $def_days)
|
if (($var =& $_REQUEST[$daysback_key]) && ($var != $def_days))
|
||||||
{
|
{
|
||||||
$daysback_val = max(intval($var), 1);
|
$daysback_val = max(intval($var), 1);
|
||||||
$url = url_arg($url, $daysback_key, $daysback_val);
|
$url = url_arg($url, $daysback_key, $daysback_val);
|
||||||
}
|
}
|
||||||
if ($var =& $_REQUEST[$datetime_key] AND $var != $def_datetime)
|
if (($var =& $_REQUEST[$datetime_key]) && ($var != $def_datetime))
|
||||||
{
|
{
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
||||||
if (($tmp_timestamp = strtotime($var, $tz)) > 0)
|
if (($tmp_timestamp = strtotime($var, $tz)) > 0)
|
||||||
|
|
|
@ -177,7 +177,7 @@ if ($mode == 'submit' || $mode == 'refresh')
|
||||||
$timer_expired = false;
|
$timer_expired = false;
|
||||||
$words_sql = array();
|
$words_sql = array();
|
||||||
|
|
||||||
while ($row = DB()->fetch_next($result) AND !$timer_expired)
|
while (($row = DB()->fetch_next($result)) && !$timer_expired)
|
||||||
{
|
{
|
||||||
set_time_limit(600);
|
set_time_limit(600);
|
||||||
$start_post_id = ($num_rows == 0) ? $row['post_id'] : $start_post_id;
|
$start_post_id = ($num_rows == 0) ? $row['post_id'] : $start_post_id;
|
||||||
|
|
|
@ -215,7 +215,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id))
|
||||||
'CAT_HREF' => "$base_url&c=$c_id",
|
'CAT_HREF' => "$base_url&c=$c_id",
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
|
if (!($c =& $_REQUEST['c']) || !in_array($c, array('all', $c_id)) || empty($c_data['forums']))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ else if ($mode == 'group' && $group_id)
|
||||||
'CAT_HREF' => "$base_url&c=$c_id",
|
'CAT_HREF' => "$base_url&c=$c_id",
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!$c =& $_REQUEST['c'] OR !in_array($c, array('all', $c_id)) OR empty($c_data['forums']))
|
if (!($c =& $_REQUEST['c']) || !in_array($c, array('all', $c_id)) || empty($c_data['forums']))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ class sql_db
|
||||||
{
|
{
|
||||||
$num_rows = false;
|
$num_rows = false;
|
||||||
|
|
||||||
if ($result OR $result = $this->result)
|
if ($result || ($result = $this->result))
|
||||||
{
|
{
|
||||||
$num_rows = is_resource($result) ? mysql_num_rows($result) : false;
|
$num_rows = is_resource($result) ? mysql_num_rows($result) : false;
|
||||||
}
|
}
|
||||||
|
@ -368,13 +368,16 @@ class sql_db
|
||||||
$info[] = "$num rows";
|
$info[] = "$num rows";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($this->link) AND $ext = mysql_info($this->link))
|
if (is_resource($this->link) && ($ext = mysql_info($this->link)))
|
||||||
{
|
{
|
||||||
$info[] = "$ext";
|
$info[] = "$ext";
|
||||||
}
|
}
|
||||||
elseif (!$num && ($aff = $this->affected_rows($this->result) AND $aff != -1))
|
elseif (!$num && ($aff = $this->affected_rows($this->result)))
|
||||||
{
|
{
|
||||||
$info[] = "$aff rows";
|
if ($aff != -1)
|
||||||
|
{
|
||||||
|
$info[] = "$aff rows";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return join(', ', $info);
|
return join(', ', $info);
|
||||||
|
|
|
@ -39,7 +39,7 @@ if ($is_moderator)
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) AND $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id'])))
|
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) && $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id'])))
|
||||||
{
|
{
|
||||||
$avatar_ext_id = (int) $upload->file_ext_id;
|
$avatar_ext_id = (int) $upload->file_ext_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ $excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
||||||
$only_new = $user->opt_js['only_new'];
|
$only_new = $user->opt_js['only_new'];
|
||||||
|
|
||||||
// Validate requested category id
|
// Validate requested category id
|
||||||
if ($viewcat AND !$viewcat =& $forums['c'][$viewcat]['cat_id'])
|
if ($viewcat && !($viewcat =& $forums['c'][$viewcat]['cat_id']))
|
||||||
{
|
{
|
||||||
redirect("index.php");
|
redirect("index.php");
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ $cache_name = 'index_sql_' . md5($sql);
|
||||||
if (!$cache->has($cache_name)) {
|
if (!$cache->has($cache_name)) {
|
||||||
$cat_forums = [];
|
$cat_forums = [];
|
||||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||||
if (!$cat_id = $row['cat_id'] OR !$forum_id = $row['forum_id']) {
|
if (!($cat_id = $row['cat_id']) || !($forum_id = $row['forum_id'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ if ($confirm) {
|
||||||
);
|
);
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['avatars'], $FILE, false) AND $upload->store('avatar', $row)) {
|
if ($upload->init($bb_cfg['avatars'], $FILE, false) && $upload->store('avatar', $row)) {
|
||||||
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1");
|
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1");
|
||||||
$avatars_ok++;
|
$avatars_ok++;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,7 +7,7 @@ global $bb_cfg, $lang, $user;
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
$user_id = (int) $this->request['user_id'];
|
$user_id = (int) $this->request['user_id'];
|
||||||
|
|
||||||
if (!$user_id OR !$u_data = get_userdata($user_id))
|
if (!$user_id || !($u_data = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die('Invalid user_id');
|
$this->ajax_die('Invalid user_id');
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ global $bf, $lang;
|
||||||
$user_id = (int) $this->request['user_id'];
|
$user_id = (int) $this->request['user_id'];
|
||||||
$new_opt = \Zend\Json\Json::decode($this->request['user_opt'], \Zend\Json\Json::TYPE_ARRAY);
|
$new_opt = \Zend\Json\Json::decode($this->request['user_opt'], \Zend\Json\Json::TYPE_ARRAY);
|
||||||
|
|
||||||
if (!$user_id OR !$u_data = get_userdata($user_id))
|
if (!$user_id || !($u_data = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die('invalid user_id');
|
$this->ajax_die('invalid user_id');
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ global $datastore, $lang;
|
||||||
$ranks = $datastore->get('ranks');
|
$ranks = $datastore->get('ranks');
|
||||||
$rank_id = intval($this->request['rank_id']);
|
$rank_id = intval($this->request['rank_id']);
|
||||||
|
|
||||||
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
|
if (!($user_id = intval($this->request['user_id'])) || !($profiledata = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die("invalid user_id: $user_id");
|
$this->ajax_die("invalid user_id: $user_id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $userdata, $lang;
|
global $bb_cfg, $userdata, $lang;
|
||||||
|
|
||||||
if (!$group_id = intval($this->request['group_id']) OR !$group_info = get_group_data($group_id))
|
if (!($group_id = intval($this->request['group_id'])) || !($group_info = get_group_data($group_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang;
|
global $bb_cfg, $lang;
|
||||||
|
|
||||||
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
|
if (!($user_id = intval($this->request['user_id'])) || !($profiledata = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ switch ($field)
|
||||||
case 'user_regdate':
|
case 'user_regdate':
|
||||||
case 'user_lastvisit':
|
case 'user_lastvisit':
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
||||||
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] OR $value > TIMENOW)
|
if ((($value = strtotime($value, $tz)) < $bb_cfg['board_startdate']) || ($value > TIMENOW))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $lang, $user;
|
global $lang, $user;
|
||||||
|
|
||||||
if (!$user_id = intval($this->request['user_id']) OR !$profiledata = get_userdata($user_id))
|
if (!($user_id = intval($this->request['user_id'])) || !($profiledata = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
$this->ajax_die("invalid user_id: $user_id");
|
$this->ajax_die("invalid user_id: $user_id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ switch($this->request['type'])
|
||||||
$where_sql = (IS_GUEST) ? "p.poster_ip = '". USER_IP ."'" : "p.poster_id = {$userdata['user_id']}";
|
$where_sql = (IS_GUEST) ? "p.poster_ip = '". USER_IP ."'" : "p.poster_id = {$userdata['user_id']}";
|
||||||
|
|
||||||
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM ". BB_POSTS ." p WHERE $where_sql";
|
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM ". BB_POSTS ." p WHERE $where_sql";
|
||||||
if ($row = DB()->fetch_row($sql) AND $row['last_post_time'])
|
if (($row = DB()->fetch_row($sql)) && $row['last_post_time'])
|
||||||
{
|
{
|
||||||
if ($userdata['user_level'] == USER)
|
if ($userdata['user_level'] == USER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,16 @@ $config = [
|
||||||
'directory' => __DIR__ . '/../internal_data/cache',
|
'directory' => __DIR__ . '/../internal_data/cache',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
/*'cache' => [
|
||||||
|
'adapter' => \TorrentPier\Cache\MemoryAdapter::class,
|
||||||
|
'options' => [
|
||||||
|
'servers' => [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 11211,
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],*/
|
||||||
],
|
],
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
|
|
|
@ -128,7 +128,7 @@ $this->store('viewtopic_forum_select', $data);
|
||||||
//
|
//
|
||||||
// latest_news
|
// latest_news
|
||||||
//
|
//
|
||||||
if ($bb_cfg['show_latest_news'] AND $news_forum_ids = $bb_cfg['latest_news_forum_id'])
|
if ($bb_cfg['show_latest_news'] && ($news_forum_ids = $bb_cfg['latest_news_forum_id']))
|
||||||
{
|
{
|
||||||
$news_count = max($bb_cfg['latest_news_count'], 1);
|
$news_count = max($bb_cfg['latest_news_count'], 1);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ if ($bb_cfg['show_latest_news'] AND $news_forum_ids = $bb_cfg['latest_news_forum
|
||||||
//
|
//
|
||||||
// Network_news
|
// Network_news
|
||||||
//
|
//
|
||||||
if ($bb_cfg['show_network_news'] AND $net_forum_ids = $bb_cfg['network_news_forum_id'])
|
if ($bb_cfg['show_network_news'] && ($net_forum_ids = $bb_cfg['network_news_forum_id']))
|
||||||
{
|
{
|
||||||
$net_count = max($bb_cfg['network_news_count'], 1);
|
$net_count = max($bb_cfg['network_news_count'], 1);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ function sync ($type, $id)
|
||||||
|
|
||||||
$all_topics = ($id === 'all');
|
$all_topics = ($id === 'all');
|
||||||
|
|
||||||
if (!$all_topics AND !$topic_csv = get_id_csv($id))
|
if (!$all_topics && !($topic_csv = get_id_csv($id)))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ function sync ($type, $id)
|
||||||
|
|
||||||
$all_users = ($id === 'all');
|
$all_users = ($id === 'all');
|
||||||
|
|
||||||
if (!$all_users AND !$user_csv = get_id_csv($id))
|
if (!$all_users && !($user_csv = get_id_csv($id)))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $pr
|
||||||
|
|
||||||
$prune = ($mode_or_topic_id === 'prune');
|
$prune = ($mode_or_topic_id === 'prune');
|
||||||
|
|
||||||
if (!$prune AND !$topic_csv = get_id_csv($mode_or_topic_id))
|
if (!$prune && !($topic_csv = get_id_csv($mode_or_topic_id)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ function topic_move ($topic_id, $to_forum_id, $from_forum_id = null, $leave_shad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$topics OR !$topic_csv = get_id_csv(array_keys($topics)))
|
if (!$topics || !($topic_csv = get_id_csv(array_keys($topics))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
{
|
{
|
||||||
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM ". BB_POSTS ." p WHERE $where_sql";
|
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM ". BB_POSTS ." p WHERE $where_sql";
|
||||||
|
|
||||||
if ($row = DB()->fetch_row($sql) AND $row['last_post_time'])
|
if (($row = DB()->fetch_row($sql)) && $row['last_post_time'])
|
||||||
{
|
{
|
||||||
if ($userdata['user_level'] == USER)
|
if ($userdata['user_level'] == USER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,15 +8,15 @@ $edit_tpl_mode = ($can_edit_tpl && !empty($_REQUEST['edit_tpl']));
|
||||||
// forum_data
|
// forum_data
|
||||||
$sql = "SELECT forum_name, allow_reg_tracker, forum_tpl_id FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
|
$sql = "SELECT forum_name, allow_reg_tracker, forum_tpl_id FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
|
||||||
|
|
||||||
if (!$forum_id OR !$f_data = DB()->fetch_row($sql))
|
if (!$forum_id || !($f_data = DB()->fetch_row($sql)))
|
||||||
{
|
{
|
||||||
bb_die($lang['FORUM_NOT_EXIST']);
|
bb_die($lang['FORUM_NOT_EXIST']);
|
||||||
}
|
}
|
||||||
// tpl_data
|
// tpl_data
|
||||||
$tpl_data = array();
|
$tpl_data = [];
|
||||||
$sql = "SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1";
|
$sql = "SELECT * FROM ". BB_TOPIC_TPL ." WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1";
|
||||||
|
|
||||||
if (!$f_data['forum_tpl_id'] OR !$tpl_data = DB()->fetch_row($sql))
|
if (!$f_data['forum_tpl_id'] || !($tpl_data = DB()->fetch_row($sql)))
|
||||||
{
|
{
|
||||||
if (!$edit_tpl_mode)
|
if (!$edit_tpl_mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,7 +187,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
$err = validate_username($username);
|
$err = validate_username($username);
|
||||||
if (!$errors AND $err && $mode == 'register')
|
if (!$errors && $err && ($mode == 'register'))
|
||||||
{
|
{
|
||||||
$errors[] = $err;
|
$errors[] = $err;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
{
|
{
|
||||||
$errors[] = $lang['CHOOSE_E_MAIL'];
|
$errors[] = $lang['CHOOSE_E_MAIL'];
|
||||||
}
|
}
|
||||||
if (!$errors AND $err = validate_email($email))
|
if (!$errors && ($err = validate_email($email)))
|
||||||
{
|
{
|
||||||
$errors[] = $err;
|
$errors[] = $err;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
{
|
{
|
||||||
$errors[] = $lang['CONFIRM_PASSWORD_EXPLAIN'];
|
$errors[] = $lang['CONFIRM_PASSWORD_EXPLAIN'];
|
||||||
}
|
}
|
||||||
if (!$errors AND $err = validate_email($email))
|
if (!$errors && ($err = validate_email($email)))
|
||||||
{
|
{
|
||||||
$errors[] = $err;
|
$errors[] = $err;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['avatars'], $_FILES['avatar']) AND $upload->store('avatar', $pr_data))
|
if ($upload->init($bb_cfg['avatars'], $_FILES['avatar']) && $upload->store('avatar', $pr_data))
|
||||||
{
|
{
|
||||||
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
|
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
|
||||||
$db_data['avatar_ext_id'] = (int) $upload->file_ext_id;
|
$db_data['avatar_ext_id'] = (int) $upload->file_ext_id;
|
||||||
|
|
|
@ -29,7 +29,7 @@ if (!$ranks = $datastore->get('ranks'))
|
||||||
}
|
}
|
||||||
|
|
||||||
$poster_rank = $rank_image= $rank_style = $rank_select = '';
|
$poster_rank = $rank_image= $rank_style = $rank_select = '';
|
||||||
if ($user_rank = $profiledata['user_rank'] AND isset($ranks[$user_rank]))
|
if (($user_rank = $profiledata['user_rank']) && isset($ranks[$user_rank]))
|
||||||
{
|
{
|
||||||
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
|
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
|
||||||
$poster_rank = $ranks[$user_rank]['rank_title'];
|
$poster_rank = $ranks[$user_rank]['rank_title'];
|
||||||
|
|
|
@ -224,7 +224,7 @@ switch ($mode)
|
||||||
$req_topics = isset($_POST['topic_id_list']) ? $_POST['topic_id_list'] : $topic_id;
|
$req_topics = isset($_POST['topic_id_list']) ? $_POST['topic_id_list'] : $topic_id;
|
||||||
validate_topics($forum_id, $req_topics, $topic_titles);
|
validate_topics($forum_id, $req_topics, $topic_titles);
|
||||||
|
|
||||||
if (!$req_topics OR !$topic_csv = get_id_csv($req_topics))
|
if (!$req_topics || !($topic_csv = get_id_csv($req_topics)))
|
||||||
{
|
{
|
||||||
bb_die($lang['NONE_SELECTED']);
|
bb_die($lang['NONE_SELECTED']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['attach'], $_FILES['attach']) AND $upload->store('attach', array('topic_id' => $topic_id)))
|
if ($upload->init($bb_cfg['attach'], $_FILES['attach']) && $upload->store('attach', array('topic_id' => $topic_id)))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
UPDATE ". BB_TOPICS ." SET
|
UPDATE ". BB_TOPICS ." SET
|
||||||
|
|
|
@ -27,7 +27,7 @@ if (isset($_POST['del_my_post']))
|
||||||
<a href="index.php">'. $lang['INDEX_RETURN'] .'</a>
|
<a href="index.php">'. $lang['INDEX_RETURN'] .'</a>
|
||||||
');
|
');
|
||||||
|
|
||||||
if (empty($_POST['topic_id_list']) OR !$topic_csv = get_id_csv($_POST['topic_id_list']))
|
if (empty($_POST['topic_id_list']) || !($topic_csv = get_id_csv($_POST['topic_id_list'])))
|
||||||
{
|
{
|
||||||
bb_die($lang['NONE_SELECTED']);
|
bb_die($lang['NONE_SELECTED']);
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,7 @@ function prevent_huge_searches ($SQL)
|
||||||
$SQL['ORDER BY'] = array();
|
$SQL['ORDER BY'] = array();
|
||||||
$SQL['LIMIT'] = array('0');
|
$SQL['LIMIT'] = array('0');
|
||||||
|
|
||||||
if (DB()->query($SQL) AND $row = DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count"))
|
if (DB()->query($SQL) && ($row = DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count")))
|
||||||
{
|
{
|
||||||
if ($row['rows_count'] > $bb_cfg['limit_max_search_results'])
|
if ($row['rows_count'] > $bb_cfg['limit_max_search_results'])
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,7 +128,7 @@ $template->assign_vars(array(
|
||||||
));
|
));
|
||||||
|
|
||||||
// post_buttons
|
// post_buttons
|
||||||
if (!empty($page_cfg['load_tpl_vars']) AND $vars = array_flip($page_cfg['load_tpl_vars']))
|
if (!empty($page_cfg['load_tpl_vars']) && ($vars = array_flip($page_cfg['load_tpl_vars'])))
|
||||||
{
|
{
|
||||||
if (isset($vars['post_buttons']))
|
if (isset($vars['post_buttons']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -462,7 +462,7 @@ if (!$set_default)
|
||||||
hash_search($_REQUEST[$hash_key]);
|
hash_search($_REQUEST[$hash_key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tm =& $_REQUEST[$title_match_key] AND is_string($tm))
|
if (($tm =& $_REQUEST[$title_match_key]) && is_string($tm))
|
||||||
{
|
{
|
||||||
if ($tmp = mb_substr(trim($tm), 0, $title_match_max_len))
|
if ($tmp = mb_substr(trim($tm), 0, $title_match_max_len))
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ if (!$forums = $datastore->get('cat_forums'))
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
$forums = $datastore->get('cat_forums');
|
$forums = $datastore->get('cat_forums');
|
||||||
}
|
}
|
||||||
if (!$forum_id OR !$forum_data = $forums['forum'][$forum_id])
|
if (!$forum_id || !($forum_data = $forums['forum'][$forum_id]))
|
||||||
{
|
{
|
||||||
bb_die($lang['FORUM_NOT_EXIST']);
|
bb_die($lang['FORUM_NOT_EXIST']);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ $select_tpp = '';
|
||||||
if ($is_auth['auth_mod'])
|
if ($is_auth['auth_mod'])
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($req_tpp = $di->request->query->getInt('tpp') AND in_array($req_tpp, $bb_cfg['allowed_topics_per_page']))
|
if (($req_tpp = $di->request->query->getInt('tpp')) && in_array($req_tpp, $bb_cfg['allowed_topics_per_page']))
|
||||||
{
|
{
|
||||||
$topics_per_page = $req_tpp;
|
$topics_per_page = $req_tpp;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ $sel_previous_days = array(
|
||||||
|
|
||||||
if (!empty($_REQUEST['topicdays']))
|
if (!empty($_REQUEST['topicdays']))
|
||||||
{
|
{
|
||||||
if ($req_topic_days = $di->request->query->getInt('topicdays') AND isset($sel_previous_days[$req_topic_days]))
|
if (($req_topic_days = $di->request->query->getInt('topicdays')) && isset($sel_previous_days[$req_topic_days]))
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT COUNT(*) AS forum_topics
|
SELECT COUNT(*) AS forum_topics
|
||||||
|
|
|
@ -33,7 +33,7 @@ $select_ppp = '';
|
||||||
|
|
||||||
if ($userdata['session_admin'])
|
if ($userdata['session_admin'])
|
||||||
{
|
{
|
||||||
if ($req_ppp = $di->request->query->getInt('ppp') AND in_array($req_ppp, $bb_cfg['allowed_posts_per_page']))
|
if (($req_ppp = $di->request->query->getInt('ppp')) && in_array($req_ppp, $bb_cfg['allowed_posts_per_page']))
|
||||||
{
|
{
|
||||||
$posts_per_page = $req_ppp;
|
$posts_per_page = $req_ppp;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ for($i = 0; $i < $total_posts; $i++)
|
||||||
|
|
||||||
$poster_rank = $rank_image = '';
|
$poster_rank = $rank_image = '';
|
||||||
$user_rank = $postrow[$i]['user_rank'];
|
$user_rank = $postrow[$i]['user_rank'];
|
||||||
if (!$user->opt_js['h_rnk_i'] AND isset($ranks[$user_rank]))
|
if (!$user->opt_js['h_rnk_i'] && isset($ranks[$user_rank]))
|
||||||
{
|
{
|
||||||
$rank_image = ($bb_cfg['show_rank_image'] && $ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
|
$rank_image = ($bb_cfg['show_rank_image'] && $ranks[$user_rank]['rank_image']) ? '<img src="'. $ranks[$user_rank]['rank_image'] .'" alt="" title="" border="0" />' : '';
|
||||||
$poster_rank = ($bb_cfg['show_rank_text']) ? $ranks[$user_rank]['rank_title'] : '';
|
$poster_rank = ($bb_cfg['show_rank_text']) ? $ranks[$user_rank]['rank_title'] : '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue