Commit 458767fb authored by jwarnier's avatar jwarnier

- replace double-quotes with single-quotes whenever appropriate

- reword some output
- fix typos
parent 85c4e5c1
......@@ -29,18 +29,18 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class db
{
var $dbHost = ""; // hostname of the MySQL server
var $dbName = ""; // logical database name on that server
var $dbUser = ""; // database authorized user
var $dbPass = ""; // user's password
var $dbHost = ''; // hostname of the MySQL server
var $dbName = ''; // logical database name on that server
var $dbUser = ''; // database authorized user
var $dbPass = ''; // user's password
var $linkId = 0; // last result of mysql_connect()
var $queryId = 0; // last result of mysql_query()
var $record = array(); // last record fetched
var $autoCommit = 1; // Autocommit Transactions
var $currentRow; // current row number
var $errorNumber = 0; // last error number
var $errorMessage = ""; // last error message
var $errorLocation = "";// last error location
var $errorMessage = ''; // last error message
var $errorLocation = '';// last error location
var $show_error_messages = true;
// constructor
......@@ -48,10 +48,10 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{
global $conf;
$this->dbHost = $conf["db_host"];
$this->dbName = $conf["db_database"];
$this->dbUser = $conf["db_user"];
$this->dbPass = $conf["db_password"];
$this->dbHost = $conf['db_host'];
$this->dbName = $conf['db_database'];
$this->dbUser = $conf['db_user'];
$this->dbPass = $conf['db_password'];
$this->dbCharset = $conf['db_charset'];
//$this->connect();
}
......@@ -66,7 +66,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if($this->errorNumber && $this->show_error_messages && method_exists($app,'log'))
{
// echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
$app->log($this->errorLocation." ".$this->errorMessage,LOGLEVEL_WARN);
$app->log($this->errorLocation.' '.$this->errorMessage,LOGLEVEL_WARN);
//flush();
}
}
......@@ -282,16 +282,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
unset($tmp);
// Insert the server_id, if the record has a server_id
$server_id = (isset($record_old["server_id"]) && $record_old["server_id"] > 0)?$record_old["server_id"]:0;
if(isset($record_new["server_id"])) $server_id = $record_new["server_id"];
$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
if($diff_num > 0) {
//print_r($diff_num);
//print_r($diffrec_full);
$diffstr = $app->db->quote(serialize($diffrec_full));
$username = $app->db->quote($_SESSION["s"]["user"]["username"]);
$dbidx = $primary_field.":".$primary_id;
$username = $app->db->quote($_SESSION['s']['user']['username']);
$dbidx = $primary_field.':'.$primary_id;
if($action == 'INSERT') $action = 'i';
if($action == 'UPDATE') $action = 'u';
......@@ -383,27 +383,27 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function createTable($table_name,$columns) {
$index = "";
$index = '';
$sql = "CREATE TABLE $table_name (";
foreach($columns as $col){
$sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
$sql .= $col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
if($col["notNull"] == true) {
$sql .= "NOT NULL ";
if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
if($col['notNull'] == true) {
$sql .= 'NOT NULL ';
} else {
$sql .= "NULL ";
$sql .= 'NULL ';
}
if($col["autoInc"] == true) $sql .= "auto_increment ";
$sql.= ",";
if($col['autoInc'] == true) $sql .= 'auto_increment ';
$sql.= ',';
// key Definitionen
if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
if($col['option'] == 'primary') $index .= "PRIMARY KEY (".$col['name']."),";
if($col['option'] == 'index') $index .= "INDEX (".$col['name']."),";
if($col['option'] == 'unique') $index .= "UNIQUE (".$col['name']."),";
}
$sql .= $index;
$sql = substr($sql,0,-1);
$sql .= ")";
$sql .= ')';
$this->query($sql);
return true;
......@@ -423,29 +423,29 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function alterTable($table_name,$columns) {
$index = "";
$index = '';
$sql = "ALTER TABLE $table_name ";
foreach($columns as $col){
if($col["action"] == 'add') {
$sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
} elseif ($col["action"] == 'alter') {
$sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
} elseif ($col["action"] == 'drop') {
$sql .= "DROP ".$col["name"]." ";
if($col['action'] == 'add') {
$sql .= "ADD ".$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
} elseif ($col['action'] == 'alter') {
$sql .= "CHANGE ".$col['name']." ".$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
} elseif ($col['action'] == 'drop') {
$sql .= "DROP ".$col['name'].' ';
}
if($col["action"] != 'drop') {
if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
if($col["notNull"] == true) {
$sql .= "NOT NULL ";
if($col['action'] != 'drop') {
if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
if($col['notNull'] == true) {
$sql .= 'NOT NULL ';
} else {
$sql .= "NULL ";
$sql .= 'NULL ';
}
if($col["autoInc"] == true) $sql .= "auto_increment ";
$sql.= ",";
if($col['autoInc'] == true) $sql .= 'auto_increment ';
$sql.= ',';
// key Definitionen
if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
if($col['option'] == 'primary') $index .= "PRIMARY KEY (".$col['name']."),";
if($col['option'] == 'index') $index .= "INDEX (".$col['name']."),";
if($col['option'] == 'unique') $index .= "UNIQUE (".$col['name']."),";
}
}
$sql .= $index;
......@@ -505,38 +505,38 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$column = array();
$column["name"] = $name;
//$column["type"] = $type;
$column["defaultValue"] = $default;
if(stristr($key,"PRI")) $column["option"] = "primary";
if(stristr($isnull,"YES")) {
$column["notNull"] = false;
$column['name'] = $name;
//$column['type'] = $type;
$column['defaultValue'] = $default;
if(stristr($key,'PRI')) $column['option'] = 'primary';
if(stristr($isnull,'YES')) {
$column['notNull'] = false;
} else {
$column["notNull"] = true;
$column['notNull'] = true;
}
if($extra == 'auto_increment') $column["autoInc"] = true;
if($extra == 'auto_increment') $column['autoInc'] = true;
// Type in Metatype umsetzen
if(stristr($type,"int(")) $metaType = 'int32';
if(stristr($type,"bigint")) $metaType = 'int64';
if(stristr($type,"char")) {
if(stristr($type,'int(')) $metaType = 'int32';
if(stristr($type,'bigint')) $metaType = 'int64';
if(stristr($type,'char')) {
$metaType = 'char';
$tmp_typeValue = explode('(',$type);
$column["typeValue"] = substr($tmp_typeValue[1],0,-1);
$column['typeValue'] = substr($tmp_typeValue[1],0,-1);
}
if(stristr($type,"varchar")) {
if(stristr($type,'varchar')) {
$metaType = 'varchar';
$tmp_typeValue = explode('(',$type);
$column["typeValue"] = substr($tmp_typeValue[1],0,-1);
$column['typeValue'] = substr($tmp_typeValue[1],0,-1);
}
if(stristr($type,"text")) $metaType = 'text';
if(stristr($type,"double")) $metaType = 'double';
if(stristr($type,"blob")) $metaType = 'blob';
if(stristr($type,'text')) $metaType = 'text';
if(stristr($type,'double')) $metaType = 'double';
if(stristr($type,'blob')) $metaType = 'blob';
$column["type"] = $metaType;
$column['type'] = $metaType;
$columns[] = $column;
}
......@@ -595,7 +595,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return 'char';
break;
case 'varchar':
if($typeValue < 1) die("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig.");
if($typeValue < 1) die('Database failure: Lenght required for these data types.');
return 'varchar('.$typeValue.')';
break;
case 'text':
......@@ -609,4 +609,4 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
?>
\ No newline at end of file
?>
......@@ -33,14 +33,14 @@ class file{
function rf($file){
global $app;
clearstatcache();
if(!$fp = fopen ($file, "rb")){
$app->log("WARNING: could not open file ".$file, 2);
if(!$fp = fopen ($file, 'rb')){
$app->log('WARNING: Could not open file '.$file, 2);
return false;
} else {
if(filesize($file) > 0){
$content = fread($fp, filesize($file));
} else {
$content = "";
$content = '';
}
fclose($fp);
return $content;
......@@ -50,8 +50,8 @@ class file{
function wf($file, $content){
global $app;
$this->mkdirs(dirname($file));
if(!$fp = fopen ($file, "wb")){
$app->log("WARNING: could not open file ".$file, 2);
if(!$fp = fopen ($file, 'wb')){
$app->log('WARNING: Could not open file '.$file, 2);
return false;
} else {
fwrite($fp,$content);
......@@ -63,8 +63,8 @@ class file{
function af($file, $content){
global $app;
$this->mkdirs(dirname($file));
if(!$fp = fopen ($file, "ab")){
$app->log("WARNING: could not open file ".$file, 2);
if(!$fp = fopen ($file, 'ab')){
$app->log('WARNING: Could not open file '.$file, 2);
return false;
} else {
fwrite($fp,$content);
......@@ -83,7 +83,7 @@ class file{
if($pos != 0){
$new_lines[] = substr($line,0,$pos);
} else {
$new_lines[] = "";
$new_lines[] = '';
}
} else {
$new_lines[] = $line;
......@@ -95,7 +95,7 @@ class file{
$new_lines = NULL;
return $content_without_comments;
} else {
return "";
return '';
}
}
......@@ -106,7 +106,7 @@ class file{
$manual = "\n".trim($parts[1]);
return $manual;
} else {
return "";
return '';
}
}
......@@ -120,13 +120,13 @@ class file{
$lines = explode("\n", $content);
if(!empty($lines)){
foreach($lines as $line){
if(trim($line) != "") $new_lines[] = $line;
if(trim($line) != '') $new_lines[] = $line;
}
}
if(is_array($new_lines)){
$content = implode("\n", $new_lines);
} else {
$content = "";
$content = '';
}
if($file){
$this->wf($input, $content);
......@@ -160,17 +160,17 @@ class file{
function edit_dist($var, $val){
global $$var;
$files = array("/root/ispconfig/dist.inc.php");
$files = array('/root/ispconfig/dist.inc.php');
foreach($files as $file){
if(is_file($file)){
$file_content = $this->unix_nl($this->rf($file));
$lines = explode("\n", $file_content);
for($i=0;$i<sizeof($lines);$i++){
$parts = explode("=", $lines[$i]);
$parts = explode('=', $lines[$i]);
if($parts[0] == $var || $parts[0] == '$'.$var.' '){
$parts[1] = str_replace($$var, $val, $parts[1]);
}
$lines[$i] = implode("=", $parts);
$lines[$i] = implode('=', $parts);
}
$file_content = implode("\n", $lines);
$this->wf($file, $file_content);
......@@ -178,7 +178,7 @@ class file{
}
}
function getDirectoryListing($dirname, $sortorder = "a", $show_subdirs = 0, $show_subdirfiles = 0, $exts = "", $ext_save = 1){
function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $show_subdirfiles = 0, $exts = '', $ext_save = 1){
// This function will return an array with filenames based on the criteria you can set in the variables
// @sortorder : a for ascending (the standard) or d for descending (you can use the "r" for reverse as well, works the same)
// @show_subdirs : 0 for NO, 1 for YES - meaning it will show the names of subdirectories if there are any
......@@ -190,33 +190,33 @@ class file{
// @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
$dirname = realpath($dirname);
if (!$exts || empty($exts) || $exts == "") {
$exts = array("jpg", "gif", "jpeg", "png");
if (!$exts || empty($exts) || $exts == '') {
$exts = array('jpg', 'gif', 'jpeg', 'png');
}
if ($handle = opendir($dirname)) {
$filelist = array();
while (false !== ($file = readdir($handle))) {
// Filter out higher directory references
if ($file != "." && $file != "..") {
if ($file != '.' && $file != '..') {
// Only look at directories or files, filter out symbolic links
if ( filetype ($dirname."/".$file) != "link") {
if ( filetype ($dirname.'/'.$file) != 'link') {
// If it's a file, check against valid extentions and add to the list
if ( filetype ($dirname."/".$file) == "file" ) {
if ( filetype ($dirname.'/'.$file) == 'file' ) {
if ($this->checkFileExtension($file, $exts, $ext_save)) {
$filelist[] = $file;
}
}
// If it's a directory and either subdirs should be listed or files from subdirs add relevant names to the list
else if ( filetype ($dirname."/".$file) == "dir" && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
else if ( filetype ($dirname.'/'.$file) == 'dir' && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
if ($show_subdirs == 1) {
$filelist[] = $file;
}
if ($show_subdirfiles == 1) {
$subdirname = $file;
$subdirfilelist = $this->getDirectoryListing($dirname."/".$subdirname."/", $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
$subdirfilelist = $this->getDirectoryListing($dirname.'/'.$subdirname.'/', $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
for ($i = 0 ; $i < count($subdirfilelist) ; $i++) {
$subdirfilelist[$i] = $subdirname."/".$subdirfilelist[$i];
$subdirfilelist[$i] = $subdirname.'/'.$subdirfilelist[$i];
}
$filelist = array_merge($filelist, $subdirfilelist);
}
......@@ -231,7 +231,7 @@ class file{
// Sort the results
if (count($filelist) > 1) {
natcasesort($filelist);
if ($sortorder == "d" || $sortorder == "r" ) {
if ($sortorder == 'd' || $sortorder == 'r' ) {
$filelist = array_reverse($filelist, TRUE);
}
}
......@@ -249,7 +249,7 @@ class file{
return $passed;
}
}
if ($exts == "all") {
if ($exts == 'all') {
$passed = TRUE;
return $passed;
}
......
......@@ -38,8 +38,8 @@ class getconf {
if(!is_array($this->config[$server_id])) {
$app->uses('ini_parser');
$server_id = intval($server_id);
$server = $app->db->queryOneRecord("SELECT config FROM server WHERE server_id = $server_id");
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server["config"]));
$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config']));
}
if($section == '') {
......@@ -54,12 +54,12 @@ class getconf {
if(!is_array($this->config['global'])) {
$app->uses('ini_parser');
$tmp = $app->db->queryOneRecord("SELECT config FROM sys_ini WHERE sysini_id = 1");
$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp["config"]));
$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp['config']));
}
return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
}
}
?>
\ No newline at end of file
?>
......@@ -43,21 +43,21 @@ class modules {
$subPath = 'mods-enabled';
if ($type == 'core') $subPath = 'mods-core';
$modules_dir = $conf["rootpath"].$conf["fs_div"].$subPath.$conf["fs_div"];
$modules_dir = $conf['rootpath'].$conf['fs_div'].$subPath.$conf['fs_div'];
if (is_dir($modules_dir)) {
if ($dh = opendir($modules_dir)) {
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
$module_name = substr($file,0,-8);
include_once($modules_dir.$file);
if($this->debug) $app->log("Loading Module: $module_name",LOGLEVEL_DEBUG);
if($this->debug) $app->log('Loading Module: '.$module_name,LOGLEVEL_DEBUG);
$app->loaded_modules[$module_name] = new $module_name;
$app->loaded_modules[$module_name]->onLoad();
}
}
}
} else {
$app->log("Modules directory missing: $modules_dir",LOGLEVEL_ERROR);
$app->log('Modules directory missing: '.$modules_dir,LOGLEVEL_ERROR);
}
}
......@@ -84,18 +84,18 @@ class modules {
//* If its a multiserver setup
if($app->db->dbHost != $app->dbmaster->dbHost) {
if($conf["mirror_server_id"] > 0) {
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = ".$conf["mirror_server_id"]." OR server_id = 0) ORDER BY datalog_id";
if($conf['mirror_server_id'] > 0) {
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = ".$conf['mirror_server_id']." OR server_id = 0) ORDER BY datalog_id";
} else {
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0) ORDER BY datalog_id";
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id";
}
$records = $app->dbmaster->queryAllRecords($sql);
foreach($records as $d) {
//** encode data to utf-8 and unserialize it
if(!$data = unserialize(stripslashes($d["data"]))) {
$data = unserialize($d["data"]);
if(!$data = unserialize(stripslashes($d['data']))) {
$data = unserialize($d['data']);
}
//** Decode data back to locale
foreach($data['old'] as $key => $val) {
......@@ -107,20 +107,20 @@ class modules {
$replication_error = false;
$this->current_datalog_id = $d["datalog_id"];
$this->current_datalog_id = $d['datalog_id'];
/*
* If we are in a mirror setup, rewrite the server_id of records that originally
* belonged to the mirrored server to the local server_id
*/
if($conf["mirror_server_id"] > 0 && $d['dbtable'] != 'server') {
if(isset($data['new']['server_id']) && $data['new']['server_id'] == $conf["mirror_server_id"]) $data['new']['server_id'] = $conf["server_id"];
if(isset($data['old']['server_id']) && $data['old']['server_id'] == $conf["mirror_server_id"]) $data['old']['server_id'] = $conf["server_id"];
if($conf['mirror_server_id'] > 0 && $d['dbtable'] != 'server') {
if(isset($data['new']['server_id']) && $data['new']['server_id'] == $conf['mirror_server_id']) $data['new']['server_id'] = $conf['server_id'];
if(isset($data['old']['server_id']) && $data['old']['server_id'] == $conf['mirror_server_id']) $data['old']['server_id'] = $conf['server_id'];
}
if(count($data['new']) > 0) {
if($d["action"] == 'i' || $d["action"] == 'u') {
$idx = explode(":",$d["dbidx"]);
if($d['action'] == 'i' || $d['action'] == 'u') {
$idx = explode(':',$d['dbidx']);
$tmp_sql1 = '';
$tmp_sql2 = '';
foreach($data['new'] as $fieldname => $val) {
......@@ -137,9 +137,9 @@ class modules {
$app->db->query($sql);
if($app->db->errorNumber > 0) {
$replication_error = true;
$app->log("Replication failed. Error: (" . $d[dbtable] . ") in mysql server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
$app->log("Replication failed. Error: (" . $d[dbtable] . ") in MySQL server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
}
$app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
}
/*
if($d["action"] == 'u') {
......@@ -158,8 +158,8 @@ class modules {
$app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
}
*/
if($d["action"] == 'd') {
$idx = explode(":",$d["dbidx"]);
if($d['action'] == 'd') {
$idx = explode(':',$d['dbidx']);
$sql = "DELETE FROM $d[dbtable] ";
$sql .= " WHERE $idx[0] = $idx[1]";
$app->db->query($sql);
......@@ -167,23 +167,23 @@ class modules {
$replication_error = true;
$app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
}
$app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
}
if($replication_error == false) {
if(is_array($data['old']) || is_array($data['new'])) {
$this->raiseTableHook($d["dbtable"],$d["action"],$data);
$this->raiseTableHook($d['dbtable'],$d['action'],$data);
} else {
$app->log("Data array was empty for datalog_id ".$d["datalog_id"],LOGLEVEL_WARN);
$app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN);
}
//$this->raiseTableHook($d["dbtable"],$d["action"],$data);
//$app->dbmaster->query("DELETE FROM sys_datalog WHERE datalog_id = ".$d["datalog_id"]);
//$app->log("Deleting sys_datalog ID ".$d["datalog_id"],LOGLEVEL_DEBUG);
$app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf["server_id"]);
$app->log("Processed datalog_id ".$d["datalog_id"],LOGLEVEL_DEBUG);
$app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']);
$app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
} else {
$app->log("Error in Replication, changes were not processed.",LOGLEVEL_ERROR);
$app->log('Error in Replication, changes were not processed.',LOGLEVEL_ERROR);
/*
* If there is any error in processing the datalog we can't continue, because
* we do not know if the newer actions require this (old) one.
......@@ -191,19 +191,19 @@ class modules {
return;
}
} else {
$app->log("Datalog does not contain any changes for this record ".$d["datalog_id"],LOGLEVEL_DEBUG);
$app->log('Datalog does not contain any changes for this record '.$d['datalog_id'],LOGLEVEL_DEBUG);
}
}
//* if we have a single server setup
} else {
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0) ORDER BY datalog_id";
$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id";
$records = $app->db->queryAllRecords($sql);
foreach($records as $d) {
//** encode data to utf-8 to be able to unserialize it and then unserialize it
if(!$data = unserialize(stripslashes($d["data"]))) {
$data = unserialize($d["data"]);
if(!$data = unserialize(stripslashes($d['data']))) {
$data = unserialize($d['data']);
}
//** decode data back to current locale
foreach($data['old'] as $key => $val) {
......@@ -213,16 +213,16 @@ class modules {