From e7c328126a213e6ad23a55d9cf0b619417eebd26 Mon Sep 17 00:00:00 2001 From: bradymiller Date: Thu, 12 Apr 2012 03:15:28 -0700 Subject: [PATCH] Skip audit/logging of translation queries --- library/sql.inc | 24 ++++++++++++++++++++++++ library/translation.inc.php | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/library/sql.inc b/library/sql.inc index 26f7176a9..ab129e7b2 100644 --- a/library/sql.inc +++ b/library/sql.inc @@ -101,6 +101,30 @@ function sqlStatement($statement, $binds=NULL ) } } +// Function that is the equivalent of the above +// sqlStatement() function, EXCEPT it skips the +// audit engine. This function should only be used +// in very special situations. +function sqlStatementNoLog($statement, $binds=NULL ) +{ + if (is_array($binds)) { + // Use adodb ExecuteNoLog with binding and return a recordset. + $recordset = $GLOBALS['adodb']['db']->ExecuteNoLog( $statement, $binds ); + if ($recordset === FALSE) { + HelpfulDie("query failed: $statement", $GLOBALS['adodb']['db']->ErrorMsg()); + } + return $recordset; + } + else { + // Use mysql_query and return a resource. + $resource = mysql_query($statement, $GLOBALS['dbh']); + if ($resource === FALSE) { + HelpfulDie("query failed: $statement", mysql_error($GLOBALS['dbh'])); + } + return $resource; + } +} + // Function that will allow use of the adodb binding // feature to prevent sql-injection. // It will act upon the object returned from the diff --git a/library/translation.inc.php b/library/translation.inc.php index 0b8809868..33132372e 100644 --- a/library/translation.inc.php +++ b/library/translation.inc.php @@ -33,7 +33,7 @@ function xl($constant,$mode='r',$prepend='',$append='') { "lang_definitions.cons_id = lang_constants.cons_id WHERE " . "lang_id='$lang_id' AND constant_name = '" . add_escape_custom($constant) . "' LIMIT 1"; - $res = SqlStatement($sql); + $res = sqlStatementNoLog($sql); $row = SqlFetchArray($res); $string = $row['definition']; if ($string == '') { $string = "$constant"; } -- 2.11.4.GIT