Skip to content

Commit

Permalink
! Change @ini_get to ini_get. It never returns an error.
Browse files Browse the repository at this point in the history
! @version_compare() never returns an error... neither does version_compare()
! Change version_compare() == # to the nicer, more readable format of version_compare(,,'')
! Changed some substr() == string to strpos() === #
! Substr is slower than other methods such as strpos and indexs (Many PHP Files)
! [WIP 4176]
  • Loading branch information
Spuds committed Jan 25, 2012
1 parent c3f6282 commit f438dca
Show file tree
Hide file tree
Showing 47 changed files with 124 additions and 124 deletions.
6 changes: 3 additions & 3 deletions SSI.php
Expand Up @@ -55,7 +55,7 @@
die($mmessage);

// Fix for using the current directory as a path.
if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
if (strpos($sourcedir, '.') === 0 && strpos($sourcedir, '.') !== 1)
$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);

// Load the important includes.
Expand All @@ -68,7 +68,7 @@
require_once($sourcedir . '/Security.php');

// Using an pre-PHP 5.1 version?
if (@version_compare(PHP_VERSION, '5.1') == -1)
if (version_compare(PHP_VERSION, '5.1', '<'))
require_once($sourcedir . '/Subs-Compat.php');

// Create a variable to store some SMF specific functions in.
Expand Down Expand Up @@ -102,7 +102,7 @@
define('WIRELESS', false);

// Gzip output? (because it must be boolean and true, this can't be hacked.)
if (isset($ssi_gzip) && $ssi_gzip === true && @ini_get('zlib.output_compression') != '1' && @ini_get('output_handler') != 'ob_gzhandler' && @version_compare(PHP_VERSION, '4.2.0') != -1)
if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>='))
ob_start('ob_gzhandler');
else
$modSettings['enableCompressedOutput'] = '0';
Expand Down
2 changes: 1 addition & 1 deletion Sources/Admin.php
Expand Up @@ -828,7 +828,7 @@ function AdminSearchInternal()
$name = preg_replace('~<(?:div|span)\sclass="smalltext">.+?</(?:div|span)>~', '', $name);

$context['search_results'][] = array(
'url' => (substr($item[1], 0, 4) == 'area' ? $scripturl . '?action=admin;' . $item[1] : $item[1]) . ';' . $context['session_var'] . '=' . $context['session_id'] . ((substr($item[1], 0, 4) == 'area' && $section == 'settings' ? '#' . $item[0][0] : '')),
'url' => (strpos($item[1], 'area') === 0 ? $scripturl . '?action=admin;' . $item[1] : $item[1]) . ';' . $context['session_var'] . '=' . $context['session_id'] . ((strpos($item[1], 'area') === 0 && $section == 'settings' ? '#' . $item[0][0] : '')),
'name' => $name,
'type' => $section,
'help' => shorten_subject(isset($item[2]) ? strip_tags($helptxt[$item2]) : (isset($helptxt[$found]) ? strip_tags($helptxt[$found]) : ''), 255),
Expand Down
20 changes: 10 additions & 10 deletions Sources/Class-Package.php
Expand Up @@ -138,7 +138,7 @@ public function path($path, $return_full = false)
$el = substr($el, 0, strpos($el, '['));
}
// Find an attribute.
elseif (substr($el, 0, 1) == '@')
elseif (strpos($el, '@') === 0)
{
// It simplifies things if the attribute is already there ;).
if (isset($array[$el]))
Expand Down Expand Up @@ -205,7 +205,7 @@ public function exists($path)
$el = substr($el, 0, strpos($el, '['));
}
// Find an attribute.
elseif (substr($el, 0, 1) == '@')
elseif (strpos($el, '@') === 0)
return isset($array[$el]);
else
$lvl = null;
Expand Down Expand Up @@ -506,7 +506,7 @@ protected function _xml($array, $indent)
// Run through and recurively output all the elements or attrbutes inside this.
foreach ($array as $k => $v)
{
if (substr($k, 0, 1) == '@')
if (strpos($k, '@') === 0)
$output .= ' ' . substr($k, 1) . '="' . $v . '"';
elseif (is_array($v))
{
Expand Down Expand Up @@ -716,11 +716,11 @@ public function __construct($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous'

public function connect($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = 'ftpclient@simplemachines.org')
{
if (substr($ftp_server, 0, 6) == 'ftp://')
if (strpos($ftp_server, 'ftp://') === 0)
$ftp_server = substr($ftp_server, 6);
elseif (substr($ftp_server, 0, 7) == 'ftps://')
elseif (strpos($ftp_server, 'ftps://') === 0)
$ftp_server = 'ssl://' . substr($ftp_server, 7);
if (substr($ftp_server, 0, 7) == 'http://')
if (strpos($ftp_server, 'http://') === 0)
$ftp_server = substr($ftp_server, 7);
$ftp_server = strtr($ftp_server, array('/' => '', ':' => '', '@' => ''));

Expand Down Expand Up @@ -823,7 +823,7 @@ public function check_response($desired)
$time = time();
do
$this->last_message = fgets($this->connection, 1024);
while ((strlen($this->last_message) < 4 || substr($this->last_message, 0, 1) == ' ' || substr($this->last_message, 3, 1) != ' ') && time() - $time < 5);
while ((strlen($this->last_message) < 4 || strpos($this->last_message, ' ') === 0 || strpos($this->last_message, ' ') !== 3) && time() - $time < 5);

// Was the desired response returned?
return is_array($desired) ? in_array(substr($this->last_message, 0, 3), $desired) : substr($this->last_message, 0, 3) == $desired;
Expand All @@ -840,10 +840,10 @@ public function passive()
$time = time();
do
$response = fgets($this->connection, 1024);
while (substr($response, 3, 1) != ' ' && time() - $time < 5);
while (strpos($response, ' ') !== 3 && time() - $time < 5);

// If it's not 227, we weren't given an IP and port, which means it failed.
if (substr($response, 0, 4) != '227 ')
if (strpos($response, '227 ') !== 0)
{
$this->error = 'bad_response';
return false;
Expand Down Expand Up @@ -1008,7 +1008,7 @@ public function detect_path($filesystem_path, $lookup_file = null)
if (strlen(dirname($_SERVER['PHP_SELF'])) > 1)
$path .= dirname($_SERVER['PHP_SELF']);
}
elseif (substr($filesystem_path, 0, 9) == '/var/www/')
elseif (strpos($filesystem_path, '/var/www/') === 0)
$path = substr($filesystem_path, 8);
else
$path = strtr(strtr($filesystem_path, array('\\' => '/')), array($_SERVER['DOCUMENT_ROOT'] => ''));
Expand Down
4 changes: 2 additions & 2 deletions Sources/DbPackages-mysql.php
Expand Up @@ -534,7 +534,7 @@ function smf_db_list_columns($table_name, $detail = false, $parameters = array()
SHOW FIELDS
FROM {raw:table_name}',
array(
'table_name' => substr($table_name, 0, 1) == '`' ? $table_name : '`' . $table_name . '`',
'table_name' => strpos($table_name, '`') === 0 ? $table_name : '`' . $table_name . '`',
)
);
$columns = array();
Expand Down Expand Up @@ -601,7 +601,7 @@ function smf_db_list_indexes($table_name, $detail = false, $parameters = array()
SHOW KEYS
FROM {raw:table_name}',
array(
'table_name' => substr($table_name, 0, 1) == '`' ? $table_name : '`' . $table_name . '`',
'table_name' => strpos($table_name, '`') === 0 ? $table_name : '`' . $table_name . '`',
)
);
$indexes = array();
Expand Down
6 changes: 3 additions & 3 deletions Sources/Display.php
Expand Up @@ -129,7 +129,7 @@ function Display()
}

// Add 1 to the number of views of this topic.
if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)
if (!$user_info['possibly_robot'] && empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
Expand Down Expand Up @@ -250,7 +250,7 @@ function Display()
}

// Start from a certain time index, not a message.
if (substr($_REQUEST['start'], 0, 4) == 'from')
if (strpos($_REQUEST['start'], 'from') === 0)
{
$timestamp = (int) substr($_REQUEST['start'], 4);
if ($timestamp === 0)
Expand Down Expand Up @@ -280,7 +280,7 @@ function Display()
}

// Link to a message...
elseif (substr($_REQUEST['start'], 0, 3) == 'msg')
elseif (strpos($_REQUEST['start'], 'msg') === 0)
{
$virtual_msg = (int) substr($_REQUEST['start'], 3);
if (!$topicinfo['unapproved_posts'] && $virtual_msg >= $topicinfo['id_last_msg'])
Expand Down
2 changes: 1 addition & 1 deletion Sources/DumpDatabase.php
Expand Up @@ -44,7 +44,7 @@ function DumpDatabase2()

// Attempt to stop from dying...
@set_time_limit(600);
if (@ini_get('memory_limit') < 256)
if (ini_get('memory_limit') < 256)
@ini_set('memory_limit', '256M');

// Start saving the output... (don't do it otherwise for memory reasons.)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Help.php
Expand Up @@ -87,7 +87,7 @@ function ShowAdminHelp()
loadLanguage('Help');

// Permission specific help?
if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp')
if (isset($_GET['help']) && strpos($_GET['help'], 'permissionhelp') === 0)
loadLanguage('ManagePermissions');

loadTemplate('Help');
Expand Down
12 changes: 6 additions & 6 deletions Sources/Load.php
Expand Up @@ -63,14 +63,14 @@ function reloadSettings()
}

// UTF-8 in regular expressions is unsupported on PHP(win) versions < 4.2.3.
$utf8 = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || @version_compare(PHP_VERSION, '4.2.3') != -1);
$utf8 = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || version_compare(PHP_VERSION, '4.2.3', '>='));

// Set a list of common functions.
$ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);';
$ent_check = empty($modSettings['disableEntityCheck']) ? array('preg_replace(\'~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~e\', \'$smcFunc[\\\'entity_fix\\\'](\\\'\\2\\\')\', ', ')') : array('', '');

// Preg_replace can handle complex characters only for higher PHP versions.
$space_chars = $utf8 ? (@version_compare(PHP_VERSION, '4.3.3') != -1 ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : "\xC2\xA0\xC2\xAD\xE2\x80\x80-\xE2\x80\x8F\xE2\x80\x9F\xE2\x80\xAF\xE2\x80\x9F\xE3\x80\x80\xEF\xBB\xBF") : '\x00-\x08\x0B\x0C\x0E-\x19\xA0';
$space_chars = $utf8 ? (version_compare(PHP_VERSION, '4.3.3', '>=') ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : "\xC2\xA0\xC2\xAD\xE2\x80\x80-\xE2\x80\x8F\xE2\x80\x9F\xE2\x80\xAF\xE2\x80\x9F\xE3\x80\x80\xEF\xBB\xBF") : '\x00-\x08\x0B\x0C\x0E-\x19\xA0';

/**
* @global array An array of anonymous helper functions.
Expand Down Expand Up @@ -1358,7 +1358,7 @@ function loadTheme($id_theme = 0, $initialize = true)

// If this isn't set yet, is a theme option, or is not the default theme..
if (!isset($themeData[$row['id_member']][$row['variable']]) || $row['id_theme'] != '1')
$themeData[$row['id_member']][$row['variable']] = substr($row['variable'], 0, 5) == 'show_' ? $row['value'] == '1' : $row['value'];
$themeData[$row['id_member']][$row['variable']] = strpos($row['variable'], 'show_') === 0 ? $row['value'] == '1' : $row['value'];
}
$smcFunc['db_free_result']($result);

Expand Down Expand Up @@ -1654,7 +1654,7 @@ function loadTheme($id_theme = 0, $initialize = true)

// Set the character set from the template.
$context['character_set'] = empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set'];
$context['utf8'] = $context['character_set'] === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || @version_compare(PHP_VERSION, '4.2.3') != -1);
$context['utf8'] = $context['character_set'] === 'UTF-8' && (strpos(strtolower(PHP_OS), 'win') === false || version_compare(PHP_VERSION, '4.2.3', '>='));
$context['right_to_left'] = !empty($txt['lang_rtl']);

$context['tabindex'] = 1;
Expand Down Expand Up @@ -1780,7 +1780,7 @@ function loadTemplate($template_name, $style_sheets = array(), $fatal = true)
if ($loaded)
{
// For compatibility reasons, if this is the index template without new functions, include compatible stuff.
if (substr($template_name, 0, 5) == 'index' && !function_exists('template_button_strip'))
if (strpos($template_name, 'index') === 0 && !function_exists('template_button_strip'))
loadTemplate('Compat');

if ($db_show_debug === true)
Expand Down Expand Up @@ -2318,7 +2318,7 @@ function template_include($filename, $once = false)

echo '<span style="color: black;">', sprintf('%' . strlen($n) . 's', $line), ':</span> ';
if (isset($data2[$line]) && $data2[$line] != '')
echo substr($data2[$line], 0, 2) == '</' ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line . $data2[$line];
echo strpos($data2[$line], '</') === 0 ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line . $data2[$line];

if (isset($data2[$line]) && preg_match('~(<[^/>]+>)[^<]*$~', $data2[$line], $color_match) != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/LogInOut.php
Expand Up @@ -648,7 +648,7 @@ function phpBB3_password_check($passwd, $passwd_hash)
$salt = substr($passwd_hash, 4, 8);

// Things are done differently for PHP 5.
if (@version_compare(PHP_VERSION, '5') >= 0)
if (version_compare(PHP_VERSION, '5', '>='))
{
$hash = md5($salt . $passwd, true);
for (; $count != 0; --$count)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Logging.php
Expand Up @@ -309,7 +309,7 @@ function displayDebug()
if ($_SESSION['view_queries'] == 1 && !empty($db_cache))
foreach ($db_cache as $q => $qq)
{
$is_select = substr(trim($qq['q']), 0, 6) == 'SELECT' || preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+SELECT .+$~s', trim($qq['q'])) != 0;
$is_select = strpos(trim($qq['q']), 'SELECT') === 0 || preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+SELECT .+$~s', trim($qq['q'])) != 0;
// Temporary tables created in earlier queries are not explainable.
if ($is_select)
{
Expand Down
4 changes: 2 additions & 2 deletions Sources/ManageErrors.php
Expand Up @@ -125,7 +125,7 @@ function ViewErrorLog()
'time' => timeformat($row['log_time']),
'timestamp' => $row['log_time'],
'url' => array(
'html' => htmlspecialchars((substr($row['url'], 0, 1) == '?' ? $scripturl : '') . $row['url']),
'html' => htmlspecialchars((strpos($row['url'], '?') === 0 ? $scripturl : '') . $row['url']),
'href' => base64_encode($smcFunc['db_escape_wildcard_string']($row['url']))
),
'message' => array(
Expand Down Expand Up @@ -206,7 +206,7 @@ function ViewErrorLog()
$context['filter']['value']['html'] = '<a href="' . $scripturl . '?action=profile;u=' . $id . '">' . $user_profile[$id]['real_name'] . '</a>';
}
elseif ($filter['variable'] == 'url')
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars((substr($filter['value']['sql'], 0, 1) == '?' ? $scripturl : '') . $filter['value']['sql']), array('\_' => '_')) . '\'';
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars((strpos($filter['value']['sql'], '?') === 0 ? $scripturl : '') . $filter['value']['sql']), array('\_' => '_')) . '\'';
elseif ($filter['variable'] == 'message')
{
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars($filter['value']['sql']), array("\n" => '<br />', '&lt;br /&gt;' => '<br />', "\t" => '&nbsp;&nbsp;&nbsp;', '\_' => '_', '\\%' => '%', '\\\\' => '\\')) . '\'';
Expand Down
4 changes: 2 additions & 2 deletions Sources/ManageLanguages.php
Expand Up @@ -152,7 +152,7 @@ function DownloadLanguage()
foreach ($_POST['copy_file'] as $file)
{
// Check it's not very bad.
if (strpos($file, '..') !== false || (substr($file, 0, 6) != 'Themes' && !preg_match('~agreement\.[A-Za-z-_0-9]+\.txt$~', $file)))
if (strpos($file, '..') !== false || (strpos($file, 'Themes') !== 0 && !preg_match('~agreement\.[A-Za-z-_0-9]+\.txt$~', $file)))
fatal_error($txt['languages_download_illegal_paths']);

$chmod_files[] = $boarddir . '/' . $file;
Expand Down Expand Up @@ -290,7 +290,7 @@ function DownloadLanguage()
else
{
// If we think it's a theme thing, work out what the theme is.
if (substr($dirname, 0, 6) == 'Themes' && preg_match('~Themes[\\/]([^\\/]+)[\\/]~', $dirname, $match))
if (strpos($dirname, 'Themes') === 0 && preg_match('~Themes[\\/]([^\\/]+)[\\/]~', $dirname, $match))
$theme_name = $match[1];
else
$theme_name = 'misc';
Expand Down
4 changes: 2 additions & 2 deletions Sources/ManageMaintenance.php
Expand Up @@ -128,7 +128,7 @@ function MaintainDatabase()
global $context, $db_type, $db_character_set, $modSettings, $smcFunc, $txt;

// Show some conversion options?
$context['convert_utf8'] = $db_type == 'mysql' && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']())) <= 0;
$context['convert_utf8'] = $db_type == 'mysql' && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']()), '<=');
$context['convert_entities'] = $db_type == 'mysql' && isset($db_character_set, $modSettings['global_character_set']) && $db_character_set === 'utf8' && $modSettings['global_character_set'] === 'UTF-8';

if (isset($_GET['done']) && $_GET['done'] == 'convertutf8')
Expand Down Expand Up @@ -372,7 +372,7 @@ function ConvertUtf8()
validateToken('admin-maint');

// Character set conversions are only supported as of MySQL 4.1.2.
if (version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']())) > 0)
if (version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']()), '>'))
fatal_lang_error('utf8_db_version_too_low');

// Use the messages.body column as indicator for the database charset.
Expand Down
2 changes: 1 addition & 1 deletion Sources/ManageNews.php
Expand Up @@ -67,7 +67,7 @@ function ManageNews()
);

// Force the right area...
if (substr($_REQUEST['sa'], 0, 7) == 'mailing')
if (strpos($_REQUEST['sa'], 'mailing') === 0)
$context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers';

$subActions[$_REQUEST['sa']][0]();
Expand Down
2 changes: 1 addition & 1 deletion Sources/ManageSettings.php
Expand Up @@ -1657,7 +1657,7 @@ function EditCustomProfiles()
'private' => $row['private'],
'can_search' => $row['can_search'],
'mask' => $row['mask'],
'regex' => substr($row['mask'], 0, 5) == 'regex' ? substr($row['mask'], 5) : '',
'regex' => strpos($row['mask'], 'regex') === 0 ? substr($row['mask'], 5) : '',
'enclose' => $row['enclose'],
'placement' => $row['placement'],
);
Expand Down
6 changes: 3 additions & 3 deletions Sources/ManageSmileys.php
Expand Up @@ -573,7 +573,7 @@ function AddSmiley()
// Uploading just one smiley for all of them?
if (isset($_POST['sameall']) && isset($_FILES['uploadSmiley']['name']) && $_FILES['uploadSmiley']['name'] != '')
{
if (!is_uploaded_file($_FILES['uploadSmiley']['tmp_name']) || (@ini_get('open_basedir') == '' && !file_exists($_FILES['uploadSmiley']['tmp_name'])))
if (!is_uploaded_file($_FILES['uploadSmiley']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['uploadSmiley']['tmp_name'])))
fatal_lang_error('smileys_upload_error');

// Sorry, no spaces, dots, or anything else but letters allowed.
Expand Down Expand Up @@ -644,7 +644,7 @@ function AddSmiley()
continue;

// Got one...
if (!is_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name']) || (@ini_get('open_basedir') == '' && !file_exists($_FILES['individual_' . $set['name']]['tmp_name'])))
if (!is_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['individual_' . $set['name']]['tmp_name'])))
fatal_lang_error('smileys_upload_error');

// Sorry, no spaces, dots, or anything else but letters allowed.
Expand Down Expand Up @@ -1392,7 +1392,7 @@ function InstallSmileySet()
/**
* @todo Decide: overwrite or not?
*/
if (isset($_FILES['set_gz']) && is_uploaded_file($_FILES['set_gz']['tmp_name']) && (@ini_get('open_basedir') != '' || file_exists($_FILES['set_gz']['tmp_name'])))
if (isset($_FILES['set_gz']) && is_uploaded_file($_FILES['set_gz']['tmp_name']) && (ini_get('open_basedir') != '' || file_exists($_FILES['set_gz']['tmp_name'])))
$extracted = read_tgz_file($_FILES['set_gz']['tmp_name'], $boarddir . '/Smileys/' . $name);
elseif (isset($_REQUEST['set_gz']))
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/Memberlist.php
Expand Up @@ -475,7 +475,7 @@ function MLSearch()
foreach ($_POST['fields'] as $field)
{
$curField = substr($field, 5);
if (substr($field, 0, 5) == 'cust_' && isset($context['custom_search_fields'][$curField]))
if (strpos($field, 'cust_') === 0 && isset($context['custom_search_fields'][$curField]))
{
$customJoin[] = 'LEFT JOIN {db_prefix}themes AS t' . $curField . ' ON (t' . $curField . '.variable = {string:t' . $curField . '} AND t' . $curField . '.id_theme = 1 AND t' . $curField . '.id_member = mem.id_member)';
$query_parameters['t' . $curField] = $curField;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Modlog.php
Expand Up @@ -143,7 +143,7 @@ function ViewModlog()
// For the moment they can only search for ONE action!
foreach ($txt as $key => $text)
{
if (substr($key, 0, 10) == 'modlog_ac_' && strpos($text, $search_params['string']) !== false)
if (strpos($key, 'modlog_ac_') === 0 && strpos($text, $search_params['string']) !== false)
{
$search_params['string'] = substr($key, 10);
break;
Expand Down

0 comments on commit f438dca

Please sign in to comment.