
Originally Posted by
dreamdaily
Just in case someone is still on 1.2.x and wants to implement the Google Analytics:
Here is what needs to be done on 1.2.x:
1) Install the Mod like described in the README file.
2) Modify the core file /includes/classes/db/sql/query_factory.php:
a) Find around line 268
function queryTime() {
return $this->total_query_time;
}
}
b) Add right AFTER the function queryTime() and BEFORE the second curly brace the following code from the 1.3.x version of this file.
The final result looks like this:
function queryTime() {
return $this->total_query_time;
}
function getBindVarValue($value, $type) {
$typeArray = explode(':',$type);
$type = $typeArray[0];
switch ($type) {
case 'csv':
return $value;
break;
case 'passthru':
return $value;
break;
case 'float':
return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
break;
case 'integer':
return (int)$value;
break;
case 'string':
if (isset($typeArray[1])) {
$regexp = $typeArray[1];
}
return '\'' . $this->prepare_input($value) . '\'';
break;
case 'noquotestring':
return $this->prepare_input($value);
break;
case 'currency':
return '\'' . $this->prepare_input($value) . '\'';
break;
case 'date':
return '\'' . $this->prepare_input($value) . '\'';
break;
case 'enum':
if (isset($typeArray[1])) {
$enumArray = explode('|', $typeArray[1]);
}
return '\'' . $this->prepare_input($value) . '\'';
default:
die('var-type undefined: ' . $type . '('.$value.')');
}
}
/**
* method to do bind variables to a query
**/
function bindVars($sql, $bindVarString, $bindVarValue, $bindVarType, $debug = false) {
$bindVarTypeArray = explode(':', $bindVarType);
$sqlNew = $this->getBindVarValue($bindVarValue, $bindVarType);
$sqlNew = str_replace($bindVarString, $sqlNew, $sql);
return $sqlNew;
}
function prepareInput($string) {
return @mysql_real_escape_string($string);
}
}
It seems to be working without a glitch on the 1.2.5 code.
All the best,
--dreamdaily
Bookmarks