Redundant 'else' keyword.

This commit is contained in:
Yuriy Pikhtarev 2017-06-25 17:06:27 +03:00
commit 20c7a60d64
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
17 changed files with 85 additions and 75 deletions

View file

@ -135,7 +135,9 @@ if ($search_imagick) {
if (preg_match('/convert/i', $imagick)) {
return true;
} elseif ($imagick != 'none') {
}
if ($imagick != 'none') {
if (!preg_match('/WIN/i', PHP_OS)) {
$retval = @exec('whereis convert');
$paths = explode(' ', $retval);

View file

@ -568,7 +568,9 @@ if ($mode) {
if ($forum_info['forum_parent'] && $prev_forum['forum_parent'] != $forum_info['forum_parent']) {
$show_main_page = true;
break;
} elseif ($move_down_forum_id = get_prev_root_forum_id($forums, $forum_order)) {
}
if ($move_down_forum_id = get_prev_root_forum_id($forums, $forum_order)) {
$move_up_forum_id = $forum_id;
$move_down_ord_val = (get_sf_count($forum_id) + 1) * 10;
$move_up_ord_val = ((get_sf_count($move_down_forum_id) + 1) * 10) + $move_down_ord_val;
@ -579,7 +581,9 @@ if ($mode) {
if ($forum_info['forum_parent'] && $next_forum['forum_parent'] != $forum_info['forum_parent']) {
$show_main_page = true;
break;
} elseif ($move_up_forum_id = get_next_root_forum_id($forums, $forum_order)) {
}
if ($move_up_forum_id = get_next_root_forum_id($forums, $forum_order)) {
$move_down_forum_id = $forum_id;
$move_down_forum_order = $forum_order;
$move_down_ord_val = (get_sf_count($move_up_forum_id) + 1) * 10;

46
dl.php
View file

@ -182,27 +182,27 @@ if ($download_mode == PHYSICAL_LINK) {
$url = make_url($upload_dir . '/' . $attachment['physical_filename']);
header('Location: ' . $url);
exit;
} else {
if (IS_GUEST && !bb_captcha('check')) {
global $template;
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
$message = '<form action="' . DOWNLOAD_URL . $attachment['attach_id'] . '" method="post">';
$message .= $lang['CAPTCHA'] . ':';
$message .= '<div class="mrg_10" align="center">' . bb_captcha('get') . '</div>';
$message .= '<input type="hidden" name="redirect_url" value="' . $redirect_url . '" />';
$message .= '<input type="submit" class="bold" value="' . $lang['SUBMIT'] . '" /> &nbsp;';
$message .= '<input type="button" class="bold" value="' . $lang['GO_BACK'] . '" onclick="document.location.href = \'' . $redirect_url . '\';" />';
$message .= '</form>';
$template->assign_vars(array(
'ERROR_MESSAGE' => $message,
));
require(PAGE_HEADER);
require(PAGE_FOOTER);
}
send_file_to_browser($attachment, $upload_dir);
exit;
}
if (IS_GUEST && !bb_captcha('check')) {
global $template;
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
$message = '<form action="' . DOWNLOAD_URL . $attachment['attach_id'] . '" method="post">';
$message .= $lang['CAPTCHA'] . ':';
$message .= '<div class="mrg_10" align="center">' . bb_captcha('get') . '</div>';
$message .= '<input type="hidden" name="redirect_url" value="' . $redirect_url . '" />';
$message .= '<input type="submit" class="bold" value="' . $lang['SUBMIT'] . '" /> &nbsp;';
$message .= '<input type="button" class="bold" value="' . $lang['GO_BACK'] . '" onclick="document.location.href = \'' . $redirect_url . '\';" />';
$message .= '</form>';
$template->assign_vars(array(
'ERROR_MESSAGE' => $message,
));
require(PAGE_HEADER);
require(PAGE_FOOTER);
}
send_file_to_browser($attachment, $upload_dir);
exit;

View file

@ -60,9 +60,9 @@ class Apc extends Common
$this->num_queries++;
return apc_delete($this->prefix . $name);
} else {
return apc_clear_cache();
}
return apc_clear_cache();
}
public function is_installed()

View file

@ -101,9 +101,9 @@ class Memcache extends Common
$this->num_queries++;
return ($this->connected) ? $this->memcache->delete($this->prefix . $name, 0) : false;
} else {
return ($this->connected) ? $this->memcache->flush() : false;
}
return ($this->connected) ? $this->memcache->flush() : false;
}
public function is_installed()

View file

@ -85,9 +85,9 @@ class Redis extends Common
$this->num_queries++;
return true;
} else {
return false;
}
return false;
}
public function rm($name = '')
@ -104,9 +104,9 @@ class Redis extends Common
$this->num_queries++;
return ($this->connected) ? $this->redis->del($this->prefix . $name) : false;
} else {
return ($this->connected) ? $this->redis->flushDB() : false;
}
return ($this->connected) ? $this->redis->flushDB() : false;
}
public function is_installed()

View file

@ -78,9 +78,9 @@ class Sqlite extends Common
// return
if (is_array($this->prefix . $name)) {
return $cached_items;
} else {
return $cached_items[$name] ?? false;
}
return $cached_items[$name] ?? false;
}
public function set($name, $value, $ttl = 604800)

View file

@ -60,11 +60,11 @@ class Xcache extends Common
$this->num_queries++;
return xcache_unset($this->prefix . $name);
} else {
xcache_clear_cache(XC_TYPE_PHP, 0);
xcache_clear_cache(XC_TYPE_VAR, 0);
return;
}
xcache_clear_cache(XC_TYPE_PHP, 0);
xcache_clear_cache(XC_TYPE_VAR, 0);
return;
}
public function is_installed()

View file

@ -102,9 +102,9 @@ class Caches
{
if (!empty($cfg['shard_type']) && $cfg['shard_type'] != 'none') {
return $this->cfg['db_dir'] . $name . '_*' . $ext;
} else {
return $this->cfg['db_dir'] . $name . $ext;
}
return $this->cfg['db_dir'] . $name . $ext;
}
public function get_table_schema($cfg)

View file

@ -137,9 +137,9 @@ class Upload
if ($mode == 'attach') {
$file_path = get_attach_path($params['topic_id']);
return $this->_move($file_path);
} else {
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
}
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
}
/**

View file

@ -407,7 +407,9 @@ class User
cache_update_userdata($this->data);
return $this->data;
} elseif ($new_session_userdata = $this->session_create($userdata, false)) {
}
if ($new_session_userdata = $this->session_create($userdata, false)) {
// Removing guest sessions from this IP
OLD_DB()->query("
DELETE FROM " . BB_SESSIONS . "

View file

@ -31,11 +31,11 @@ function attach_mod_get_lang($language_file)
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
if (file_exists($file)) {
return $bb_cfg['default_lang'];
} else {
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
if (file_exists($file)) {
return $attach_config['board_lang'];
}
}
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
if (file_exists($file)) {
return $attach_config['board_lang'];
}
bb_die('Attachment mod language file does not exist: language/' . $attach_config['board_lang'] . '/' . $language_file . '.php');

View file

@ -26,12 +26,12 @@ function get_img_size_format($width, $height)
round($width * ($max_width / $width)),
round($height * ($max_width / $width))
);
} else {
return array(
round($width * ($max_width / $height)),
round($height * ($max_width / $height))
);
}
return array(
round($width * ($max_width / $height)),
round($height * ($max_width / $height))
);
}
/**
@ -44,9 +44,9 @@ function is_imagick()
if ($attach_config['img_imagick'] != '') {
$imagick = $attach_config['img_imagick'];
return true;
} else {
return false;
}
return false;
}
/**

View file

@ -587,9 +587,9 @@ function bt_show_ip($ip, $port = '')
$ip = decode_ip($ip);
$ip .= ($port) ? ":$port" : '';
return $ip;
} else {
return ($bb_cfg['bt_show_ip_only_moder']) ? false : decode_ip_xx($ip);
}
return ($bb_cfg['bt_show_ip_only_moder']) ? false : decode_ip_xx($ip);
}
function bt_show_port($port)
@ -598,9 +598,9 @@ function bt_show_port($port)
if (IS_AM) {
return $port;
} else {
return ($bb_cfg['bt_show_port_only_moder']) ? false : $port;
}
return ($bb_cfg['bt_show_port_only_moder']) ? false : $port;
}
function decode_ip_xx($ip)
@ -741,10 +741,10 @@ function get_username($user_id)
$usernames[$row['user_id']] = $row['username'];
}
return $usernames;
} else {
$row = OLD_DB()->fetch_row("SELECT username FROM " . BB_USERS . " WHERE user_id = $user_id LIMIT 1");
return $row['username'];
}
$row = OLD_DB()->fetch_row("SELECT username FROM " . BB_USERS . " WHERE user_id = $user_id LIMIT 1");
return $row['username'];
}
function get_user_id($username)
@ -846,9 +846,9 @@ function get_attachments_dir($cfg = null)
if ($cfg['upload_dir'][0] == '/' || ($cfg['upload_dir'][0] != '/' && $cfg['upload_dir'][1] == ':')) {
return $cfg['upload_dir'];
} else {
return BB_ROOT . $cfg['upload_dir'];
}
return BB_ROOT . $cfg['upload_dir'];
}
function bb_get_config($table, $from_db = false, $update_cache = true)

View file

@ -81,9 +81,9 @@ function update_forum_feed($forum_id, $forum_data)
}
if (create_atom($file_path, 'f', $forum_id, htmlCHR($forum_data['forum_name']), $topics)) {
return true;
} else {
return false;
}
return false;
}
function update_user_feed($user_id, $username)
@ -127,9 +127,9 @@ function update_user_feed($user_id, $username)
}
if (create_atom($file_path, 'u', $user_id, wbr($username), $topics)) {
return true;
} else {
return false;
}
return false;
}
function create_atom($file_path, $mode, $id, $title, $topics)

View file

@ -576,9 +576,9 @@ function get_registered_torrents($id, $mode)
if ($rowset = @OLD_DB()->sql_fetchrowset($result)) {
return $rowset;
} else {
return false;
}
return false;
}
function torrent_error_exit($message)

View file

@ -24,7 +24,9 @@ function validate_username($username, $check_ban_and_taken = true)
// Length
if (mb_strlen($username, 'UTF-8') > USERNAME_MAX_LENGTH) {
return $lang['USERNAME_TOO_LONG'];
} elseif (mb_strlen($username, 'UTF-8') < USERNAME_MIN_LENGTH) {
}
if (mb_strlen($username, 'UTF-8') < USERNAME_MIN_LENGTH) {
return $lang['USERNAME_TOO_SMALL'];
}
// Allowed symbols
@ -94,9 +96,9 @@ function validate_email($email, $check_ban_and_taken = true)
if ($row = OLD_DB()->fetch_row("SELECT `user_email` FROM " . BB_USERS . " WHERE user_email = '$email_sql' LIMIT 1")) {
if ($row['user_email'] == $userdata['user_email']) {
return false;
} else {
return $lang['EMAIL_TAKEN'];
}
return $lang['EMAIL_TAKEN'];
}
}