mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Redundant 'else' keyword.
This commit is contained in:
parent
bb014ed1a2
commit
20c7a60d64
17 changed files with 85 additions and 75 deletions
|
@ -135,7 +135,9 @@ if ($search_imagick) {
|
||||||
|
|
||||||
if (preg_match('/convert/i', $imagick)) {
|
if (preg_match('/convert/i', $imagick)) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ($imagick != 'none') {
|
}
|
||||||
|
|
||||||
|
if ($imagick != 'none') {
|
||||||
if (!preg_match('/WIN/i', PHP_OS)) {
|
if (!preg_match('/WIN/i', PHP_OS)) {
|
||||||
$retval = @exec('whereis convert');
|
$retval = @exec('whereis convert');
|
||||||
$paths = explode(' ', $retval);
|
$paths = explode(' ', $retval);
|
||||||
|
|
|
@ -568,7 +568,9 @@ if ($mode) {
|
||||||
if ($forum_info['forum_parent'] && $prev_forum['forum_parent'] != $forum_info['forum_parent']) {
|
if ($forum_info['forum_parent'] && $prev_forum['forum_parent'] != $forum_info['forum_parent']) {
|
||||||
$show_main_page = true;
|
$show_main_page = true;
|
||||||
break;
|
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_up_forum_id = $forum_id;
|
||||||
$move_down_ord_val = (get_sf_count($forum_id) + 1) * 10;
|
$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;
|
$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']) {
|
if ($forum_info['forum_parent'] && $next_forum['forum_parent'] != $forum_info['forum_parent']) {
|
||||||
$show_main_page = true;
|
$show_main_page = true;
|
||||||
break;
|
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_id = $forum_id;
|
||||||
$move_down_forum_order = $forum_order;
|
$move_down_forum_order = $forum_order;
|
||||||
$move_down_ord_val = (get_sf_count($move_up_forum_id) + 1) * 10;
|
$move_down_ord_val = (get_sf_count($move_up_forum_id) + 1) * 10;
|
||||||
|
|
4
dl.php
4
dl.php
|
@ -182,7 +182,8 @@ if ($download_mode == PHYSICAL_LINK) {
|
||||||
$url = make_url($upload_dir . '/' . $attachment['physical_filename']);
|
$url = make_url($upload_dir . '/' . $attachment['physical_filename']);
|
||||||
header('Location: ' . $url);
|
header('Location: ' . $url);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
if (IS_GUEST && !bb_captcha('check')) {
|
if (IS_GUEST && !bb_captcha('check')) {
|
||||||
global $template;
|
global $template;
|
||||||
|
|
||||||
|
@ -205,4 +206,3 @@ if ($download_mode == PHYSICAL_LINK) {
|
||||||
|
|
||||||
send_file_to_browser($attachment, $upload_dir);
|
send_file_to_browser($attachment, $upload_dir);
|
||||||
exit;
|
exit;
|
||||||
}
|
|
||||||
|
|
|
@ -60,9 +60,9 @@ class Apc extends Common
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
return apc_delete($this->prefix . $name);
|
return apc_delete($this->prefix . $name);
|
||||||
} else {
|
|
||||||
return apc_clear_cache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return apc_clear_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_installed()
|
public function is_installed()
|
||||||
|
|
|
@ -101,9 +101,9 @@ class Memcache extends Common
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
return ($this->connected) ? $this->memcache->delete($this->prefix . $name, 0) : false;
|
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()
|
public function is_installed()
|
||||||
|
|
|
@ -85,9 +85,9 @@ class Redis extends Common
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rm($name = '')
|
public function rm($name = '')
|
||||||
|
@ -104,9 +104,9 @@ class Redis extends Common
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
return ($this->connected) ? $this->redis->del($this->prefix . $name) : false;
|
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()
|
public function is_installed()
|
||||||
|
|
|
@ -78,9 +78,9 @@ class Sqlite extends Common
|
||||||
// return
|
// return
|
||||||
if (is_array($this->prefix . $name)) {
|
if (is_array($this->prefix . $name)) {
|
||||||
return $cached_items;
|
return $cached_items;
|
||||||
} else {
|
|
||||||
return $cached_items[$name] ?? false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $cached_items[$name] ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set($name, $value, $ttl = 604800)
|
public function set($name, $value, $ttl = 604800)
|
||||||
|
|
|
@ -60,12 +60,12 @@ class Xcache extends Common
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
return xcache_unset($this->prefix . $name);
|
return xcache_unset($this->prefix . $name);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
xcache_clear_cache(XC_TYPE_PHP, 0);
|
xcache_clear_cache(XC_TYPE_PHP, 0);
|
||||||
xcache_clear_cache(XC_TYPE_VAR, 0);
|
xcache_clear_cache(XC_TYPE_VAR, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function is_installed()
|
public function is_installed()
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,9 +102,9 @@ class Caches
|
||||||
{
|
{
|
||||||
if (!empty($cfg['shard_type']) && $cfg['shard_type'] != 'none') {
|
if (!empty($cfg['shard_type']) && $cfg['shard_type'] != 'none') {
|
||||||
return $this->cfg['db_dir'] . $name . '_*' . $ext;
|
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)
|
public function get_table_schema($cfg)
|
||||||
|
|
|
@ -137,9 +137,9 @@ class Upload
|
||||||
if ($mode == 'attach') {
|
if ($mode == 'attach') {
|
||||||
$file_path = get_attach_path($params['topic_id']);
|
$file_path = get_attach_path($params['topic_id']);
|
||||||
return $this->_move($file_path);
|
return $this->_move($file_path);
|
||||||
} else {
|
|
||||||
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trigger_error("Invalid upload mode: $mode", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -407,7 +407,9 @@ class User
|
||||||
cache_update_userdata($this->data);
|
cache_update_userdata($this->data);
|
||||||
|
|
||||||
return $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
|
// Removing guest sessions from this IP
|
||||||
OLD_DB()->query("
|
OLD_DB()->query("
|
||||||
DELETE FROM " . BB_SESSIONS . "
|
DELETE FROM " . BB_SESSIONS . "
|
||||||
|
|
|
@ -31,12 +31,12 @@ function attach_mod_get_lang($language_file)
|
||||||
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
|
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
return $bb_cfg['default_lang'];
|
return $bb_cfg['default_lang'];
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
|
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
return $attach_config['board_lang'];
|
return $attach_config['board_lang'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bb_die('Attachment mod language file does not exist: language/' . $attach_config['board_lang'] . '/' . $language_file . '.php');
|
bb_die('Attachment mod language file does not exist: language/' . $attach_config['board_lang'] . '/' . $language_file . '.php');
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,13 @@ function get_img_size_format($width, $height)
|
||||||
round($width * ($max_width / $width)),
|
round($width * ($max_width / $width)),
|
||||||
round($height * ($max_width / $width))
|
round($height * ($max_width / $width))
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
round($width * ($max_width / $height)),
|
round($width * ($max_width / $height)),
|
||||||
round($height * ($max_width / $height))
|
round($height * ($max_width / $height))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if imagick is present
|
* Check if imagick is present
|
||||||
|
@ -44,9 +44,9 @@ function is_imagick()
|
||||||
if ($attach_config['img_imagick'] != '') {
|
if ($attach_config['img_imagick'] != '') {
|
||||||
$imagick = $attach_config['img_imagick'];
|
$imagick = $attach_config['img_imagick'];
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -587,9 +587,9 @@ function bt_show_ip($ip, $port = '')
|
||||||
$ip = decode_ip($ip);
|
$ip = decode_ip($ip);
|
||||||
$ip .= ($port) ? ":$port" : '';
|
$ip .= ($port) ? ":$port" : '';
|
||||||
return $ip;
|
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)
|
function bt_show_port($port)
|
||||||
|
@ -598,9 +598,9 @@ function bt_show_port($port)
|
||||||
|
|
||||||
if (IS_AM) {
|
if (IS_AM) {
|
||||||
return $port;
|
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)
|
function decode_ip_xx($ip)
|
||||||
|
@ -741,11 +741,11 @@ function get_username($user_id)
|
||||||
$usernames[$row['user_id']] = $row['username'];
|
$usernames[$row['user_id']] = $row['username'];
|
||||||
}
|
}
|
||||||
return $usernames;
|
return $usernames;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$row = OLD_DB()->fetch_row("SELECT username FROM " . BB_USERS . " WHERE user_id = $user_id LIMIT 1");
|
$row = OLD_DB()->fetch_row("SELECT username FROM " . BB_USERS . " WHERE user_id = $user_id LIMIT 1");
|
||||||
return $row['username'];
|
return $row['username'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function get_user_id($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] == ':')) {
|
if ($cfg['upload_dir'][0] == '/' || ($cfg['upload_dir'][0] != '/' && $cfg['upload_dir'][1] == ':')) {
|
||||||
return $cfg['upload_dir'];
|
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)
|
function bb_get_config($table, $from_db = false, $update_cache = true)
|
||||||
|
|
|
@ -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)) {
|
if (create_atom($file_path, 'f', $forum_id, htmlCHR($forum_data['forum_name']), $topics)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_user_feed($user_id, $username)
|
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)) {
|
if (create_atom($file_path, 'u', $user_id, wbr($username), $topics)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_atom($file_path, $mode, $id, $title, $topics)
|
function create_atom($file_path, $mode, $id, $title, $topics)
|
||||||
|
|
|
@ -576,9 +576,9 @@ function get_registered_torrents($id, $mode)
|
||||||
|
|
||||||
if ($rowset = @OLD_DB()->sql_fetchrowset($result)) {
|
if ($rowset = @OLD_DB()->sql_fetchrowset($result)) {
|
||||||
return $rowset;
|
return $rowset;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function torrent_error_exit($message)
|
function torrent_error_exit($message)
|
||||||
|
|
|
@ -24,7 +24,9 @@ function validate_username($username, $check_ban_and_taken = true)
|
||||||
// Length
|
// Length
|
||||||
if (mb_strlen($username, 'UTF-8') > USERNAME_MAX_LENGTH) {
|
if (mb_strlen($username, 'UTF-8') > USERNAME_MAX_LENGTH) {
|
||||||
return $lang['USERNAME_TOO_LONG'];
|
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'];
|
return $lang['USERNAME_TOO_SMALL'];
|
||||||
}
|
}
|
||||||
// Allowed symbols
|
// 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 = OLD_DB()->fetch_row("SELECT `user_email` FROM " . BB_USERS . " WHERE user_email = '$email_sql' LIMIT 1")) {
|
||||||
if ($row['user_email'] == $userdata['user_email']) {
|
if ($row['user_email'] == $userdata['user_email']) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
return $lang['EMAIL_TAKEN'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $lang['EMAIL_TAKEN'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue