X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fdb%2Flib-mysql3.php;h=a0f4499b147e583f014001c6f179f54888486c07;hp=465e0d5b2c790c602bbf58be38eab47c5244cdc9;hb=b20eb1c60e5d9eb2bd596bbd119d35d10ee46b20;hpb=a2ca374f65976d21651fffb64a78d3a9678bb3b8 diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 465e0d5b2c..a0f4499b14 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -119,12 +119,12 @@ Query string:
} // END - if // Count DB hits - if (!isStatsEntrySet('db_hits_run')) { + if (!isStatsEntrySet('db_hits')) { // Count in dummy variable - setStatsEntry('db_hits_run', 1); + setStatsEntry('db_hits', 1); } else { // Count to config array - incrementStatsEntry('db_hits_run'); + incrementStatsEntry('db_hits'); } // Return the result @@ -252,9 +252,6 @@ function SQL_CLOSE ($F, $L) { // Destroy cache unset($GLOBALS['sql_link_res']); - // Move stats - incrementStatsEntry('db_hits', getStatsEntry('db_hits_run')); - // Return the result return $close; } @@ -347,37 +344,34 @@ function SQL_INSERTID () { // Escape a string for the database function SQL_ESCAPE ($str, $secureString=true, $strip=true) { // Do we have cache? - if (isset($GLOBALS['sql_escapes'][$str])) { - // Then use it instead - return $GLOBALS['sql_escapes'][$str]; - } // END - if - - // Secure string first? (which is the default behaviour!) - if ($secureString === true) { - // Then do it here - $str = secureString($str, $strip); - } // END - if + if (!isset($GLOBALS['sql_escapes'][''.$str.''])) { + // Secure string first? (which is the default behaviour!) + if ($secureString === true) { + // Then do it here + $str = secureString($str, $strip); + } // END - if - if (!SQL_IS_LINK_UP()) { - // Fall-back to smartAddSlashes() when there is no link - $ret = smartAddSlashes($str); - } elseif (function_exists('mysql_real_escape_string')) { - // The new and improved version - //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):str={$str}
"); - $ret = mysql_real_escape_string($str, SQL_GET_LINK()); - } elseif (function_exists('mysql_escape_string')) { - // The obsolete function - $ret = mysql_escape_string($str, SQL_GET_LINK()); - } else { - // If nothing else works, fall back to smartAddSlashes() again - $ret = smartAddSlashes($str); - } + if (!SQL_IS_LINK_UP()) { + // Fall-back to smartAddSlashes() when there is no link + $ret = smartAddSlashes($str); + } elseif (function_exists('mysql_real_escape_string')) { + // The new and improved version + //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):str={$str}
"); + $ret = mysql_real_escape_string($str, SQL_GET_LINK()); + } elseif (function_exists('mysql_escape_string')) { + // The obsolete function + $ret = mysql_escape_string($str, SQL_GET_LINK()); + } else { + // If nothing else works, fall back to smartAddSlashes() again + $ret = smartAddSlashes($str); + } - // Cache result - $GLOBALS['sql_escapes'][$str] = $ret; + // Cache result + $GLOBALS['sql_escapes'][''.$str.''] = $ret; + } // END - if // Return it - return $ret; + return $GLOBALS['sql_escapes'][''.$str.'']; } // SELECT query string from table, columns and so on... ;-)