// Determine index/fulltext/unique word
$noIndex = (
(
- strpos($sql, 'INDEX') === false
+ isInStringIgnoreCase('INDEX', $sql)
) && (
- strpos($sql, 'KEY') === false
+ isInStringIgnoreCase('KEY', $sql)
) && (
- strpos($sql, 'FULLTEXT') === false
+ isInStringIgnoreCase('FULLTEXT', $sql)
) && (
- strpos($sql, 'UNIQUE') === false
+ isInStringIgnoreCase('UNIQUE', $sql)
)
);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
// Shall we add/drop?
- if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false) || (strpos($sql, 'CHANGE') !== false)) && ($noIndex === true)) {
+ if (((isInString('ADD', $sql)) || (isInString('DROP', $sql)) || (isInString('CHANGE', $sql))) && ($noIndex === true)) {
// Try two columns, one should fix
foreach (array(4,5) as $idx) {
// If an entry is not set, abort here
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(isSqlTableColumnFound($tableName, $columnName)));
// Do we have no entry on ADD or an entry on DROP/CHANGE?
- // 123 4 43 3 4 4 32 23 4 43 34 5 5 4 45 6 6 5 5 5 56 7 76 6 654321
- if (((!isSqlTableColumnFound($tableName, $columnName)) && (strpos($sql, 'ADD') !== false)) || ((isSqlTableColumnFound($tableName, $columnName)) && ((strpos($sql, 'DROP') !== false) || ((strpos($sql, 'CHANGE') !== false) && ($idx == 4) && ((!isSqlTableColumnFound($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
+ if (((!isSqlTableColumnFound($tableName, $columnName)) && (isInString('ADD', $sql))) || ((isSqlTableColumnFound($tableName, $columnName)) && ((isInString('DROP', $sql)) || ((isInString('CHANGE', $sql)) && ($idx == 4) && ((!isSqlTableColumnFound($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
// Do the query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
$result = SQL_QUERY($sql, $F, $L, false);
// Skip further attempt(s)
break;
- // 1234 5 54 4 5 5 43 34 5 54 45 6 6 54 4 5 5 432 2 21
- } elseif ((((isSqlTableColumnFound($tableName, $columnName)) && (strpos($sql, 'ADD') !== false)) || ((!isSqlTableColumnFound($tableName, $columnName)) && ((strpos($sql, 'DROP') !== false)) || (strpos($sql, 'CHANGE') !== false))) && ($columnName != 'KEY')) {
+ } elseif ((((isSqlTableColumnFound($tableName, $columnName)) && (isInString('ADD', $sql))) || ((!isSqlTableColumnFound($tableName, $columnName)) && ((isInString('DROP', $sql))) || (isInString('CHANGE', $sql)))) && ($columnName != 'KEY')) {
// Abort here because it is alreay there
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: sql=' . $sql . ',columnName=' . $columnName . ',idx=' . $idx);
break;
- } elseif ((!isSqlTableColumnFound($tableName, $columnName)) && (strpos($sql, 'DROP') !== false)) {
+ } elseif ((!isSqlTableColumnFound($tableName, $columnName)) && (isInString('DROP', $sql))) {
// Abort here because we tried to drop a column which is not there (never created maybe)
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No drop: ' . $sql);
break;
logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(isSqlTableColumnFound($tableName, $columnName)) . '');
}
} // END - foreach
- } elseif ((getTableType() == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
+ } elseif ((getTableType() == 'InnoDB') && (isInString('FULLTEXT', $sql))) {
// Skip this query silently because InnoDB does not understand fulltext indexes
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : isSqlTableColumnFound($columnName)), $F, $L));
} elseif ($noIndex === false) {
// Init loop
$begin = 1;
$keyName = ',';
- while (strpos($keyName, ',') !== false) {
+ while (isInString(',', $keyName)) {
// Use last
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyName=' . $keyName . 'begin=' . $begin . ' - BEFORE');
$keyName = str_replace('`', '', $tableArray[count($tableArray) - $begin]);
} // END - if
// Set from header
- if ((!isInStringIgnoreCase('@', str_replace('{AT}', '@', $toEmail))) && ($toEmail > 0)) {
+ if ((!isInString('@', $toEmail)) && ($toEmail > 0)) {
// Does the user exist?
if ((isExtensionActive('user')) && (fetchUserData($toEmail))) {
// Get the email
// Read from source file
$line = fgets ($fp, 1024);
- if (strpos($line, $search) > -1) {
+ if (isInString($search, $line)) {
$next = '0';
$found = true;
} // END - if
// Encodes an URL for adding session id, etc.
function encodeUrl ($url, $outputMode = '0') {
// Do we have already have a PHPSESSID inside or view.php is called? Then abort here
- if ((strpos($url, session_name()) !== false) || (isRawOutputMode())) {
+ if ((isInStringIgnoreCase(session_name(), $url)) || (isRawOutputMode())) {
// Raw output mode detected or session_name() found in URL
return $url;
} // END - if
// Invalid session
// Determine right seperator
$seperator = '&';
- if (strpos($url, '?') === false) {
+ if (!isInString('?', $url)) {
// No question mark
$seperator = '?';
} elseif ((!isHtmlOutputMode()) || ($outputMode != '0')) {
// Simple check for spider
function isSpider () {
// Get the UA and trim it down
- $userAgent = trim(strtolower(detectUserAgent(true)));
+ $userAgent = trim(detectUserAgent(true));
// It should not be empty, if so it is better a spider/bot
if (empty($userAgent)) {
} // END - if
// Is it a spider?
- return ((strpos($userAgent, 'spider') !== false) || (strpos($userAgent, 'slurp') !== false) || (strpos($userAgent, 'bot') !== false) || (strpos($userAgent, 'archiver') !== false));
+ return ((isInStringIgnoreCase('spider', $userAgent)) || (isInStringIgnoreCase('slurp', $userAgent)) || (isInStringIgnoreCase('bot', $userAgent)) || (isInStringIgnoreCase('archiver', $userAgent)));
}
// Function to search for the last modified file
// There should be data, else we don't need to extend $baseUrl with $body
if (!empty($body)) {
// Do we have a question-mark in the script?
- if (strpos($baseUrl, '?') === false) {
+ if (!isInString('?', $baseUrl)) {
// No, so first char must be question mark
$body = '?' . $body;
} else {
// Check if we have chunks
foreach ($response as $line) {
// Make lower-case and trim it
- $line = trim(strtolower($line));
+ $line = trim($line);
// Entry found?
- if ((strpos($line, 'transfer-encoding') !== false) && (strpos($line, 'chunked') !== false)) {
+ if ((isInStringIgnoreCase('transfer-encoding', $line)) && (isInStringIgnoreCase('chunked', $line))) {
// Found!
$isChunked = true;
break;
} // END - if
// Now simply check it
- $masked = (strpos($GLOBALS['messages'][getCurrentLanguage()][$messageId], '%') !== false);
+ $masked = isInString('%', $GLOBALS['messages'][getCurrentLanguage()][$messageId]);
// Return result
return $masked;
// Create email link to admins's account
function generateAdminEmailLink ($email, $mod = 'admin') {
// Is it an email?
- if (strpos(str_replace('{AT}', '@', $email), '@') !== false) {
+ if (isInString('@', $email)) {
// Create email link
$result = SQL_QUERY_ESC("SELECT `id`
FROM
// See ext-html.php if you want to add more URL ends...
foreach ($GLOBALS['url_ends'] as $end) {
- if (isInString($end, $check)) $check = substr($check, 0, strpos($check, $end));
+ if (isInString($end, $check)) {
+ $check = substr($check, 0, strpos($check, $end));
+ } // END - if
} // END - foreach
// Now replace the URL against anchor container and pray...
$response = sendPostRequest($requestString, $requestData);
// Check the response header if all is fine
- if (strpos($response[0], '200') === false) {
+ if (!isInString('200', $response[0])) {
// Something bad happend... :(
return array(
'status' => 'request_error',
// Walk through all files
foreach ($menuArray as $file) {
// Is this a PHP script?
- if ((!isDirectory($file)) && (strpos($file, '' . $type . '-') > -1) && (strpos($file, '.php') > 0)) {
+ if ((!isDirectory($file)) && (isInString('' . $type . '-', $file)) && (isInString('.php', $file))) {
// Then test if the file is readable
$test = sprintf("inc/modules/%s/%s", $menu, $file);
$content = sendGetRequest('check-updates3.php');
// Is the first line with "200 OK"?
- $valid = (strpos($content[0], '200 OK') !== false);
+ $valid = isInString('200 OK', $content[0]);
// Return result
return $valid;
} // END - switch
if ((isSqlsValid()) && (isSqlsValid())) {
- if (strpos($GLOBALS['sqls'][0], 'INSERT') > -1) {
+ // Is INSERT there?
+ if (isInString('INSERT', $GLOBALS['sqls'][0])) {
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level`=%s LIMIT 1",
array(bigintval(postRequestParameter('level'))), __FILE__, __LINE__);
SQL_FREERESULT($result);
getConfig('usage_base')
);
} else {
- if (strpos(getRequestParameter('image'), "\\") > 0) setGetRequestParameter('image', substr(getRequestParameter('image'), 0, strpos(getRequestParameter('image'), "\\")));
+ if (strpos(getRequestParameter('image'), "\\") > 0) {
+ setGetRequestParameter('image', substr(getRequestParameter('image'), 0, strpos(getRequestParameter('image'), "\\")));
+ } // END - if
$FQFN = sprintf("%s%s/%s_usage_%s.png",
getPath(),
getConfig('usage_base'),
$url = '';
if (getConfig('allow_url_in_text') == 'Y') {
// Test submitted text against some filters (length, URLs in text etc.)
- if ((strpos(strtolower(postRequestParameter('text')), 'https://') > -1) || (strpos(strtolower(postRequestParameter('text')), 'http://') > -1) || (strpos(strtolower(postRequestParameter('text')), "www") > -1)) {
+ if ((isInStringIgnoreCase('https://', postRequestParameter('text'))) || (isInStringIgnoreCase('http://', postRequestParameter('text'))) || (isInStringIgnoreCase('www', postRequestParameter('text')))) {
// URL found
$url = 'modules.php?module=login&what=order&code=' . getCode('URL_FOUND');
} // END - if
if (getConfig('allow_url_in_subject') == 'Y') {
// Check the subject line for issues
setPostRequestParameter('subject', str_replace("\\", '[nl]', substr(postRequestParameter('subject'), 0, 200)));
- if ((strpos(strtolower(postRequestParameter('subject')), 'http://') > -1) || (strpos(strtolower(postRequestParameter('subject')), "www") > -1)) {
+ if ((isInStringIgnoreCase('https://', postRequestParameter('subject'))) || (isInStringIgnoreCase('http://', postRequestParameter('subject'))) || (isInStringIgnoreCase('www', postRequestParameter('subject')))) {
// URL in subject found
$url = 'modules.php?module=login&what=order&code=' . getCode('SUBJECT_URL');
} // END - if
// Compress it?
/**
* @TODO On some pages this is buggy
- if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('gzip', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) {
+ if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (isInStringIgnoreCase('gzip', $_SERVER['HTTP_ACCEPT_ENCODING']))) {
// Compress it for HTTP gzip
$GLOBALS['output'] = gzencode($GLOBALS['output'], 9);
// Add header
sendHeader('Content-Encoding: gzip');
- } elseif (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('deflate', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) {
+ } elseif (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (isInStringIgnoreCase('deflate', $_SERVER['HTTP_ACCEPT_ENCODING']))) {
// Compress it for HTTP deflate
$GLOBALS['output'] = gzcompress($GLOBALS['output'], 9);
$count = 0;
// Compile all out
- while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($count < 7)) {
+ while (((isInString('{--', $code)) || (isInString('{DQUOTE}', $code)) || (isInString('{?', $code)) || (isInString('{%', $code) !== false)) && ($count < 7)) {
// Init common variables
$content = array();
$newContent = '';
// Do we have to compile the code?
$ret = '';
- if ((strpos($GLOBALS['tpl_content'][$template], '$') !== false) || (strpos($GLOBALS['tpl_content'][$template], '{--') !== false) || (strpos($GLOBALS['tpl_content'][$template], '{?') !== false) || (strpos($GLOBALS['tpl_content'][$template], '{%') !== false)) {
+ if ((isInString('$', $GLOBALS['tpl_content'][$template])) || (isInString('{--', $GLOBALS['tpl_content'][$template])) || (isInString('{?', $GLOBALS['tpl_content'][$template])) || (isInString('{%', $GLOBALS['tpl_content'][$template]))) {
// Normal HTML output?
if (isHtmlOutputMode()) {
// Add surrounding HTML comments to help finding bugs faster
// check if running on IIS < 6 with CGI-PHP
if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) &&
- (strpos($_SERVER['GATEWAY_INTERFACE'], 'CGI') !== false) &&
+ (isInString('CGI', $_SERVER['GATEWAY_INTERFACE'])) &&
(preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) &&
($matches[1] < 6)) {
// Send the IIS header