function SQL_PREPARE_SQL_STRING ($sqlString) {
// Is it already cached?
if (!isset($GLOBALS['sql_strings'][$sqlString])) {
- // No, generate the eval() command
- $eval = '$sql = "' . FILTER_COMPILE_EXPRESSION_CODE(FILTER_COMPILE_CONFIG($sqlString)) . '";';
- eval($eval);
-
- // ... and set it
- $GLOBALS['sql_strings'][$sqlString] = $sql;
+ // No, so compile and set it
+ $GLOBALS['sql_strings'][$sqlString] = FILTER_COMPILE_EXPRESSION_CODE(compileSqlConfig($sqlString));
} // END - if
// Return it
} // END - if
// Shall we update usage counters (ONLY FOR DEBUGGING!)
- if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (getConfig('update_filter_usage') == 'Y')) {
+ if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')) {
// Update all counters
foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) {
// Walk through all filters
return $GLOBALS['http_status'];
}
+// Compiles config entries for SQL queries
+function compileSqlConfig ($sqlString) {
+ // Replace all
+ foreach (array('_MYSQL_PREFIX', '_TABLE_TYPE') as $configEntry) {
+ // "Compile" it
+ $sqlString = str_replace('{?' . $configEntry . '?}', getConfig($configEntry), $sqlString);
+ } // END - foreach
+
+ // Return the compiled SQL string
+ return $sqlString;
+}
+
// [EOF]
?>