mirror of
https://github.com/torrentpier/torrentpier
synced 2025-07-07 21:41:40 -07:00
'str(i)str(...)' could be replaced with 'str(i)pos(...)'.
This commit is contained in:
parent
e89f0173d8
commit
b4d079ff10
8 changed files with 14 additions and 14 deletions
|
@ -271,7 +271,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
|
|
||||||
$username = preg_replace('/\*/', '%', trim(strip_tags(strtolower($username))));
|
$username = preg_replace('/\*/', '%', trim(strip_tags(strtolower($username))));
|
||||||
|
|
||||||
if (strstr($username, '%')) {
|
if (false !== strpos($username, '%')) {
|
||||||
$op = 'LIKE';
|
$op = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
$op = '=';
|
$op = '=';
|
||||||
|
@ -292,7 +292,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
|
|
||||||
$email = preg_replace('/\*/', '%', trim(strip_tags(strtolower($email))));
|
$email = preg_replace('/\*/', '%', trim(strip_tags(strtolower($email))));
|
||||||
|
|
||||||
if (strstr($email, '%')) {
|
if (false !== strpos($email, '%')) {
|
||||||
$op = 'LIKE';
|
$op = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
$op = '=';
|
$op = '=';
|
||||||
|
@ -577,7 +577,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
break;
|
break;
|
||||||
case 'equals':
|
case 'equals':
|
||||||
// looking for a -
|
// looking for a -
|
||||||
if (strstr($postcount_value, '-')) {
|
if (false !== strpos($postcount_value, '-')) {
|
||||||
$range = preg_split('/[-\s]+/', $postcount_value);
|
$range = preg_split('/[-\s]+/', $postcount_value);
|
||||||
|
|
||||||
$range_begin = (int)$range[0];
|
$range_begin = (int)$range[0];
|
||||||
|
@ -624,7 +624,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
|
|
||||||
$userfield_value = preg_replace('/\*/', '%', trim(strip_tags(strtolower($userfield_value))));
|
$userfield_value = preg_replace('/\*/', '%', trim(strip_tags(strtolower($userfield_value))));
|
||||||
|
|
||||||
if (strstr($userfield_value, '%')) {
|
if (false !== strpos($userfield_value, '%')) {
|
||||||
$op = 'LIKE';
|
$op = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
$op = '=';
|
$op = '=';
|
||||||
|
|
2
dl.php
2
dl.php
|
@ -54,7 +54,7 @@ function send_file_to_browser($attachment, $upload_dir)
|
||||||
|
|
||||||
// Correct the mime type - we force application/octet-stream for all files, except images
|
// Correct the mime type - we force application/octet-stream for all files, except images
|
||||||
// Please do not change this, it is a security precaution
|
// Please do not change this, it is a security precaution
|
||||||
if (!strstr($attachment['mimetype'], 'image')) {
|
if (false === strpos($attachment['mimetype'], 'image')) {
|
||||||
$attachment['mimetype'] = 'application/octet-stream';
|
$attachment['mimetype'] = 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ function attachment_sync_topic($topics)
|
||||||
*/
|
*/
|
||||||
function get_extension($filename)
|
function get_extension($filename)
|
||||||
{
|
{
|
||||||
if (!stristr($filename, '.')) {
|
if (false === stripos($filename, '.')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$extension = strrchr(strtolower($filename), '.');
|
$extension = strrchr(strtolower($filename), '.');
|
||||||
|
|
|
@ -41,7 +41,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
$post_id_array = array();
|
$post_id_array = array();
|
||||||
|
|
||||||
if (!is_array($attach_id_array)) {
|
if (!is_array($attach_id_array)) {
|
||||||
if (strstr($attach_id_array, ', ')) {
|
if (false !== strpos($attach_id_array, ', ')) {
|
||||||
$attach_id_array = explode(', ', $attach_id_array);
|
$attach_id_array = explode(', ', $attach_id_array);
|
||||||
} elseif (strstr($attach_id_array, ',')) {
|
} elseif (strstr($attach_id_array, ',')) {
|
||||||
$attach_id_array = explode(',', $attach_id_array);
|
$attach_id_array = explode(',', $attach_id_array);
|
||||||
|
@ -82,7 +82,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr($post_id_array, ', ')) {
|
if (false !== strpos($post_id_array, ', ')) {
|
||||||
$post_id_array = explode(', ', $post_id_array);
|
$post_id_array = explode(', ', $post_id_array);
|
||||||
} elseif (strstr($post_id_array, ',')) {
|
} elseif (strstr($post_id_array, ',')) {
|
||||||
$post_id_array = explode(',', $post_id_array);
|
$post_id_array = explode(',', $post_id_array);
|
||||||
|
@ -127,7 +127,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($attach_id_array)) {
|
if (!is_array($attach_id_array)) {
|
||||||
if (strstr($attach_id_array, ', ')) {
|
if (false !== strpos($attach_id_array, ', ')) {
|
||||||
$attach_id_array = explode(', ', $attach_id_array);
|
$attach_id_array = explode(', ', $attach_id_array);
|
||||||
} elseif (strstr($attach_id_array, ',')) {
|
} elseif (strstr($attach_id_array, ',')) {
|
||||||
$attach_id_array = explode(',', $attach_id_array);
|
$attach_id_array = explode(',', $attach_id_array);
|
||||||
|
|
|
@ -1741,7 +1741,7 @@ function redirect($url)
|
||||||
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
|
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url')) {
|
if (false !== strpos(urldecode($url), "\n") || false !== strpos(urldecode($url), "\r") || false !== strpos(urldecode($url), ';url')) {
|
||||||
bb_die('Tried to redirect to potentially insecure url');
|
bb_die('Tried to redirect to potentially insecure url');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ define('SELECT', 6);
|
||||||
|
|
||||||
if (!empty($banned_user_agents)) {
|
if (!empty($banned_user_agents)) {
|
||||||
foreach ($banned_user_agents as $agent) {
|
foreach ($banned_user_agents as $agent) {
|
||||||
if (strstr(USER_AGENT, $agent)) {
|
if (false !== strpos(USER_AGENT, $agent)) {
|
||||||
$filename = 'Download files by using browser';
|
$filename = 'Download files by using browser';
|
||||||
$output = '@';
|
$output = '@';
|
||||||
header('Content-Type: text/plain');
|
header('Content-Type: text/plain');
|
||||||
|
|
|
@ -393,7 +393,7 @@ class template
|
||||||
*/
|
*/
|
||||||
public function assign_block_vars($blockname, $vararray): bool
|
public function assign_block_vars($blockname, $vararray): bool
|
||||||
{
|
{
|
||||||
if (strstr($blockname, '.')) {
|
if (false !== strpos($blockname, '.')) {
|
||||||
// Nested block.
|
// Nested block.
|
||||||
$blocks = explode('.', $blockname);
|
$blocks = explode('.', $blockname);
|
||||||
$blockcount = count($blocks) - 1;
|
$blockcount = count($blocks) - 1;
|
||||||
|
|
|
@ -48,7 +48,7 @@ $login_errors = array();
|
||||||
if (preg_match('/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si', $_SERVER['QUERY_STRING'], $matches)) {
|
if (preg_match('/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si', $_SERVER['QUERY_STRING'], $matches)) {
|
||||||
$redirect_url = $matches[1];
|
$redirect_url = $matches[1];
|
||||||
|
|
||||||
if (!strstr($redirect_url, '?') && $first_amp = strpos($redirect_url, '&')) {
|
if (false === strpos($redirect_url, '?') && $first_amp = strpos($redirect_url, '&')) {
|
||||||
$redirect_url[$first_amp] = '?';
|
$redirect_url[$first_amp] = '?';
|
||||||
}
|
}
|
||||||
} elseif (!empty($_POST['redirect'])) {
|
} elseif (!empty($_POST['redirect'])) {
|
||||||
|
@ -60,7 +60,7 @@ if (preg_match('/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si', $_SERVER['QUERY_STRING
|
||||||
$redirect_url = str_replace('&admin=1', '', $redirect_url);
|
$redirect_url = str_replace('&admin=1', '', $redirect_url);
|
||||||
$redirect_url = str_replace('?admin=1', '', $redirect_url);
|
$redirect_url = str_replace('?admin=1', '', $redirect_url);
|
||||||
|
|
||||||
if (!$redirect_url || strstr(urldecode($redirect_url), "\n") || strstr(urldecode($redirect_url), "\r") || strstr(urldecode($redirect_url), ';url')) {
|
if (!$redirect_url || false !== strpos(urldecode($redirect_url), "\n") || false !== strpos(urldecode($redirect_url), "\r") || false !== strpos(urldecode($redirect_url), ';url')) {
|
||||||
$redirect_url = "index.php";
|
$redirect_url = "index.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue