diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 229b11e49eb69cfe26a502d00478957db369fcdc..fb4f3079a6af35756396698bdfe3bc511b523520 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -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('
'.$this->errorLocation.'
'.$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
+?>
diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php
index 224f2eebfa8434e95055db0f581e0d4eb15d6678..dbe7a11974b1205be118d9dc88fe65307cea5374 100644
--- a/server/lib/classes/file.inc.php
+++ b/server/lib/classes/file.inc.php
@@ -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;$iwf($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;
}
diff --git a/server/lib/classes/getconf.inc.php b/server/lib/classes/getconf.inc.php
index a4bc83234cacce74799e4e808c34fa1dad7770ff..2a319781fd50d0729a25c595e3c2a39c1b319aa1 100644
--- a/server/lib/classes/getconf.inc.php
+++ b/server/lib/classes/getconf.inc.php
@@ -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
+?>
diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php
index ed855b810960d77981105791f74dc84a159b9b58..fff492807942e8e0ab8f46e87f154fc2143a3bdf 100644
--- a/server/lib/classes/modules.inc.php
+++ b/server/lib/classes/modules.inc.php
@@ -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 {
$data['new'][$key] = utf8_decode($val);
}
- $this->current_datalog_id = $d["datalog_id"];
+ $this->current_datalog_id = $d['datalog_id'];
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);
}
//$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]);
//$app->log("Deleting sys_datalog ID ".$rec["datalog_id"],LOGLEVEL_DEBUG);
- $app->db->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->db->query("UPDATE server SET updated = ".$d['datalog_id']." WHERE server_id = ".$conf['server_id']);
+ $app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
}
}
@@ -241,8 +241,8 @@ class modules {
if(is_array($hooks)) {
foreach($hooks as $hook) {
- $module_name = $hook["module"];
- $function_name = $hook["function"];
+ $module_name = $hook['module'];
+ $function_name = $hook['function'];
// Claa the processing function of the module
if($this->debug) $app->log("Call function '$function_name' in module '$module_name' raised by TableHook '$table_name'.",LOGLEVEL_DEBUG);
call_user_method($function_name,$app->loaded_modules[$module_name],$table_name,$action,$data);
@@ -256,4 +256,4 @@ class modules {
}
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/plugins.inc.php b/server/lib/classes/plugins.inc.php
index 826944a9772c8a6d92798d8924418018a35c9323..d5d8f20fc460f51a1d335c46b8d27131fc87740c 100644
--- a/server/lib/classes/plugins.inc.php
+++ b/server/lib/classes/plugins.inc.php
@@ -44,7 +44,7 @@ class plugins {
$subPath = 'plugins-enabled';
if ($type == 'core') $subPath = 'plugins-core';
- $plugins_dir = $conf["rootpath"].$conf["fs_div"].$subPath.$conf["fs_div"];
+ $plugins_dir = $conf['rootpath'].$conf['fs_div'].$subPath.$conf['fs_div'];
$tmp_plugins = array();
if (is_dir($plugins_dir)) {
@@ -62,15 +62,15 @@ class plugins {
//** load the plugins
foreach($tmp_plugins as $plugin_name => $file) {
include_once($plugins_dir.$file);
- if($this->debug) $app->log("Loading Plugin: $plugin_name",LOGLEVEL_DEBUG);
+ if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG);
$app->loaded_plugins[$plugin_name] = new $plugin_name;
$app->loaded_plugins[$plugin_name]->onLoad();
}
} else {
- $app->log("Unable to open the plugin directory: $plugins_dir",LOGLEVEL_ERROR);
+ $app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR);
}
} else {
- $app->log("Plugin directory missing: $plugins_dir",LOGLEVEL_ERROR);
+ $app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR);
}
}
@@ -83,7 +83,7 @@ class plugins {
global $app;
foreach($events as $event_name) {
$this->available_events[$event_name] = $module_name;
- if($this->debug) $app->log("Announced event: $event_name",LOGLEVEL_DEBUG);
+ if($this->debug) $app->log('Announced event: '.$event_name,LOGLEVEL_DEBUG);
}
}
@@ -95,10 +95,10 @@ class plugins {
function registerEvent($event_name,$plugin_name,$function_name) {
global $app;
if(!isset($this->available_events[$event_name])) {
- $app->log("Unable to register the function '$function_name' in the plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
+ $app->log("Unable to register function '$function_name' from plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
} else {
$this->subscribed_events[$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
- if($this->debug) $app->log("Registered the function '$function_name' in the plugin '$plugin_name' for event '$event_name'.",LOGLEVEL_DEBUG);
+ if($this->debug) $app->log("Registered function '$function_name' from plugin '$plugin_name' for event '$event_name'.",LOGLEVEL_DEBUG);
}
}
@@ -108,14 +108,14 @@ class plugins {
// Get the subscriptions for this event
$events = (isset($this->subscribed_events[$event_name]))?$this->subscribed_events[$event_name]:'';
- if($this->debug) $app->log("Raised event: '$event_name'",LOGLEVEL_DEBUG);
+ if($this->debug) $app->log('Raised event: '.$event_name,LOGLEVEL_DEBUG);
if(is_array($events)) {
foreach($events as $event) {
- $plugin_name = $event["plugin"];
- $function_name = $event["function"];
+ $plugin_name = $event['plugin'];
+ $function_name = $event['function'];
// Call the processing function of the plugin
- $app->log("Call function '$function_name' in plugin '$plugin_name' raised by event '$event_name'.",LOGLEVEL_DEBUG);
+ $app->log("Calling function '$function_name' from plugin '$plugin_name' raised by event '$event_name'.",LOGLEVEL_DEBUG);
call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
unset($plugin_name);
unset($function_name);
@@ -127,4 +127,4 @@ class plugins {
}
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index 3f9e6e45944a0bd6e5067b9b7ae984d028ffeca7..e53eee0671e39ca1c0a57683dea9223ea17b0340 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -41,7 +41,7 @@ class services {
if(is_array($this->registered_services[$service_name])) {
$this->delayed_restarts[$service_name] = $action;
} else {
- $app->log("Unable to add a delayed restart for '$service_name'. Service '$service_name' is not registered.",LOGLEVEL_WARNING);
+ $app->log("Unable to add a delayed restart for '$service_name'. Service not registered.",LOGLEVEL_WARNING);
}
}
@@ -51,12 +51,12 @@ class services {
global $app;
if(is_array($this->registered_services[$service_name])) {
- $module_name = $this->registered_services[$service_name]["module"];
- $function_name = $this->registered_services[$service_name]["function"];
- $app->log("Call function '$function_name' in module '$module_name'.",LOGLEVEL_DEBUG);
+ $module_name = $this->registered_services[$service_name]['module'];
+ $function_name = $this->registered_services[$service_name]['function'];
+ $app->log("Calling function '$function_name' from module '$module_name'.",LOGLEVEL_DEBUG);
call_user_method($function_name,$app->loaded_modules[$module_name],$action);
} else {
- $app->log("Unable to restart $service_name. Service $service_name is not registered.",LOGLEVEL_WARNING);
+ $app->log("Unable to restart $service_name. Service not registered.",LOGLEVEL_WARNING);
}
}
@@ -77,4 +77,4 @@ class services {
}
}
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 685d4f2004da066800e15f8bea7477a45e5d55e1..bd4290308d3fed42f530622dd59846c9b0937859 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -926,7 +926,7 @@ class system{
*
*/
function network_info(){
- $dist = $this->server_conf["dist"];
+ $dist = $this->server_conf['dist'];
ob_start();
passthru('ifconfig');
$output = ob_get_contents();
@@ -950,9 +950,9 @@ class system{
}
$output = trim(ob_get_contents());
ob_end_clean();
- if($output != ""){
- $ifconfig["INTERFACE"][$interface] = $output;
- $ifconfig["IP"][$output] = $interface;
+ if($output != ''){
+ $ifconfig['INTERFACE'][$interface] = $output;
+ $ifconfig['IP'][$output] = $interface;
}
}
if(!empty($ifconfig)){
@@ -1087,23 +1087,23 @@ class system{
if ($urlHandle){
socket_set_timeout($urlHandle, $timeout);
- $urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts["host"]."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
+ $urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts['host']."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
if ($user) $urlString .= 'Authorization: Basic '.base64_encode($user.':'.$pass)."\r\n";
$urlString .= "\r\n";
fputs($urlHandle, $urlString);
- $month["Jan"] = '01';
- $month["Feb"] = '02';
- $month["Mar"] = '03';
- $month["Apr"] = '04';
- $month["May"] = '05';
- $month["Jun"] = '06';
- $month["Jul"] = '07';
- $month["Aug"] = '08';
- $month["Sep"] = '09';
- $month["Oct"] = '10';
- $month["Nov"] = '11';
- $month["Dec"] = '12';
+ $month['Jan'] = '01';
+ $month['Feb'] = '02';
+ $month['Mar'] = '03';
+ $month['Apr'] = '04';
+ $month['May'] = '05';
+ $month['Jun'] = '06';
+ $month['Jul'] = '07';
+ $month['Aug'] = '08';
+ $month['Sep'] = '09';
+ $month['Oct'] = '10';
+ $month['Nov'] = '11';
+ $month['Dec'] = '12';
$c = 0;
$l = 0;
$startzeit = time();