Apply relevant changes to deal with php7,4 deprecations

pull/2775/head
Isaac Connor 2019-12-07 11:45:32 -05:00
parent cc6d40d67e
commit 4632bbd124
8 changed files with 47 additions and 164 deletions

View File

@ -51,10 +51,10 @@ class Event extends ZM_Object {
if ( $new ) { if ( $new ) {
$this->{'Storage'} = $new; $this->{'Storage'} = $new;
} }
if ( ! ( array_key_exists('Storage', $this) and $this->{'Storage'} ) ) { if ( ! ( property_exists($this, 'Storage') and $this->{'Storage'} ) ) {
if ( isset($this->{'StorageId'}) and $this->{'StorageId'} ) if ( isset($this->{'StorageId'}) and $this->{'StorageId'} )
$this->{'Storage'} = Storage::find_one(array('Id'=>$this->{'StorageId'})); $this->{'Storage'} = Storage::find_one(array('Id'=>$this->{'StorageId'}));
if ( ! ( array_key_exists('Storage', $this) and $this->{'Storage'} ) ) if ( ! ( property_exists($this, 'Storage') and $this->{'Storage'} ) )
$this->{'Storage'} = new Storage(NULL); $this->{'Storage'} = new Storage(NULL);
} }
return $this->{'Storage'}; return $this->{'Storage'};
@ -64,10 +64,10 @@ class Event extends ZM_Object {
if ( $new ) { if ( $new ) {
$this->{'SecondaryStorage'} = $new; $this->{'SecondaryStorage'} = $new;
} }
if ( ! ( array_key_exists('SecondaryStorage', $this) and $this->{'SecondaryStorage'} ) ) { if ( ! ( property_exists($this, 'SecondaryStorage') and $this->{'SecondaryStorage'} ) ) {
if ( isset($this->{'SecondaryStorageId'}) and $this->{'SecondaryStorageId'} ) if ( isset($this->{'SecondaryStorageId'}) and $this->{'SecondaryStorageId'} )
$this->{'SecondaryStorage'} = Storage::find_one(array('Id'=>$this->{'SecondaryStorageId'})); $this->{'SecondaryStorage'} = Storage::find_one(array('Id'=>$this->{'SecondaryStorageId'}));
if ( ! ( array_key_exists('SecondaryStorage', $this) and $this->{'SecondaryStorage'} ) ) if ( ! ( property_exists($this, 'SecondaryStorage') and $this->{'SecondaryStorage'} ) )
$this->{'SecondaryStorage'} = new Storage(NULL); $this->{'SecondaryStorage'} = new Storage(NULL);
} }
return $this->{'SecondaryStorage'}; return $this->{'SecondaryStorage'};
@ -262,7 +262,7 @@ class Event extends ZM_Object {
if ( is_null($new) or ( $new != '' ) ) { if ( is_null($new) or ( $new != '' ) ) {
$this->{'DiskSpace'} = $new; $this->{'DiskSpace'} = $new;
} }
if ( (!array_key_exists('DiskSpace',$this)) or (null === $this->{'DiskSpace'}) ) { if ( (!property_exists($this, 'DiskSpace')) or (null === $this->{'DiskSpace'}) ) {
$this->{'DiskSpace'} = folder_size($this->Path()); $this->{'DiskSpace'} = folder_size($this->Path());
dbQuery('UPDATE Events SET DiskSpace=? WHERE Id=?', array($this->{'DiskSpace'}, $this->{'Id'})); dbQuery('UPDATE Events SET DiskSpace=? WHERE Id=?', array($this->{'DiskSpace'}, $this->{'Id'}));
} }
@ -298,7 +298,7 @@ class Event extends ZM_Object {
} // end function createListThumbnail } // end function createListThumbnail
function ThumbnailWidth( ) { function ThumbnailWidth( ) {
if ( ! ( array_key_exists('ThumbnailWidth', $this) ) ) { if ( ! ( property_exists($this, 'ThumbnailWidth') ) ) {
if ( ZM_WEB_LIST_THUMB_WIDTH ) { if ( ZM_WEB_LIST_THUMB_WIDTH ) {
$this->{'ThumbnailWidth'} = ZM_WEB_LIST_THUMB_WIDTH; $this->{'ThumbnailWidth'} = ZM_WEB_LIST_THUMB_WIDTH;
$scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$this->{'Width'}; $scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$this->{'Width'};
@ -315,7 +315,7 @@ class Event extends ZM_Object {
} // end function ThumbnailWidth } // end function ThumbnailWidth
function ThumbnailHeight( ) { function ThumbnailHeight( ) {
if ( ! ( array_key_exists('ThumbnailHeight', $this) ) ) { if ( ! ( property_exists($this, 'ThumbnailHeight') ) ) {
if ( ZM_WEB_LIST_THUMB_WIDTH ) { if ( ZM_WEB_LIST_THUMB_WIDTH ) {
$this->{'ThumbnailWidth'} = ZM_WEB_LIST_THUMB_WIDTH; $this->{'ThumbnailWidth'} = ZM_WEB_LIST_THUMB_WIDTH;
$scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$this->{'Width'}; $scale = (SCALE_BASE*ZM_WEB_LIST_THUMB_WIDTH)/$this->{'Width'};

View File

@ -39,8 +39,8 @@ class Filter extends ZM_Object {
$this->{'Query'} = func_get_arg(0);; $this->{'Query'} = func_get_arg(0);;
$this->{'Query_json'} = jsonEncode($this->{'Query'}); $this->{'Query_json'} = jsonEncode($this->{'Query'});
} }
if ( !array_key_exists('Query', $this) ) { if ( !property_exists($this, 'Query') ) {
if ( array_key_exists('Query_json', $this) and $this->{'Query_json'} ) { if ( property_exists($this, 'Query_json') and $this->{'Query_json'} ) {
$this->{'Query'} = jsonDecode($this->{'Query_json'}); $this->{'Query'} = jsonDecode($this->{'Query_json'});
} else { } else {
$this->{'Query'} = array(); $this->{'Query'} = array();

View File

@ -18,7 +18,7 @@ class Group extends ZM_Object {
} }
public function delete() { public function delete() {
if ( array_key_exists('Id', $this) ) { if ( property_exists($this, 'Id') ) {
dbQuery('DELETE FROM Groups_Monitors WHERE GroupId=?', array($this->{'Id'})); dbQuery('DELETE FROM Groups_Monitors WHERE GroupId=?', array($this->{'Id'}));
dbQuery('UPDATE Groups SET ParentId=NULL WHERE ParentId=?', array($this->{'Id'})); dbQuery('UPDATE Groups SET ParentId=NULL WHERE ParentId=?', array($this->{'Id'}));
dbQuery('DELETE FROM Groups WHERE Id=?', array($this->{'Id'})); dbQuery('DELETE FROM Groups WHERE Id=?', array($this->{'Id'}));
@ -35,7 +35,7 @@ class Group extends ZM_Object {
if ( isset($new) ) { if ( isset($new) ) {
$this->{'depth'} = $new; $this->{'depth'} = $new;
} }
if ( !array_key_exists('depth', $this) or ($this->{'depth'} === null) ) { if ( !property_exists($this, 'depth') or ($this->{'depth'} === null) ) {
$this->{'depth'} = 0; $this->{'depth'} = 0;
if ( $this->{'ParentId'} != null ) { if ( $this->{'ParentId'} != null ) {
$Parent = Group::find_one(array('Id'=>$this->{'ParentId'})); $Parent = Group::find_one(array('Id'=>$this->{'ParentId'}));
@ -46,7 +46,7 @@ class Group extends ZM_Object {
} // end public function depth } // end public function depth
public function MonitorIds( ) { public function MonitorIds( ) {
if ( ! array_key_exists('MonitorIds', $this) ) { if ( ! property_exists($this, 'MonitorIds') ) {
$this->{'MonitorIds'} = dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId=?', 'MonitorId', array($this->{'Id'})); $this->{'MonitorIds'} = dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId=?', 'MonitorId', array($this->{'Id'}));
} }
return $this->{'MonitorIds'}; return $this->{'MonitorIds'};

View File

@ -116,11 +116,11 @@ private $status_fields = array(
); );
public function Control() { public function Control() {
if ( !array_key_exists('Control', $this) ) { if ( !property_exists($this, 'Control') ) {
if ( $this->ControlId() ) if ( $this->ControlId() )
$this->{'Control'} = Control::find_one(array('Id'=>$this->{'ControlId'})); $this->{'Control'} = Control::find_one(array('Id'=>$this->{'ControlId'}));
if ( !(array_key_exists('Control', $this) and $this->{'Control'}) ) if ( !(property_exists($this, 'Control') and $this->{'Control'}) )
$this->{'Control'} = new Control(); $this->{'Control'} = new Control();
} }
return $this->{'Control'}; return $this->{'Control'};
@ -138,7 +138,7 @@ private $status_fields = array(
$this->{$fn} = $args[0]; $this->{$fn} = $args[0];
} }
} }
if ( array_key_exists($fn, $this) ) { if ( property_exists($this, $fn) ) {
return $this->{$fn}; return $this->{$fn};
} else if ( array_key_exists($fn, $this->defaults) ) { } else if ( array_key_exists($fn, $this->defaults) ) {
if ( is_array($this->defaults[$fn]) ) { if ( is_array($this->defaults[$fn]) ) {
@ -211,9 +211,9 @@ private $status_fields = array(
$this->{'Width'} = $new; $this->{'Width'} = $new;
$field = ( $this->Orientation() == 'ROTATE_90' or $this->Orientation() == 'ROTATE_270' ) ? 'Height' : 'Width'; $field = ( $this->Orientation() == 'ROTATE_90' or $this->Orientation() == 'ROTATE_270' ) ? 'Height' : 'Width';
if ( array_key_exists($field, $this) ) if ( property_exists($this, $field) )
return $this->{$field}; return $this->{$field};
return $this->defaults{$field}; return $this->defaults[$field];
} // end function Width } // end function Width
public function ViewHeight($new=null) { public function ViewHeight($new=null) {
@ -221,9 +221,9 @@ private $status_fields = array(
$this->{'Height'} = $new; $this->{'Height'} = $new;
$field = ( $this->Orientation() == 'ROTATE_90' or $this->Orientation() == 'ROTATE_270' ) ? 'Width' : 'Height'; $field = ( $this->Orientation() == 'ROTATE_90' or $this->Orientation() == 'ROTATE_270' ) ? 'Width' : 'Height';
if ( array_key_exists($field, $this) ) if ( property_exists($this, $field) )
return $this->{$field}; return $this->{$field};
return $this->defaults{$field}; return $this->defaults[$field];
} // end function Height } // end function Height
public function SignalCheckColour($new=null) { public function SignalCheckColour($new=null) {
@ -234,10 +234,10 @@ private $status_fields = array(
// Validate that it's a valid colour (we seem to allow color names, not just hex). // Validate that it's a valid colour (we seem to allow color names, not just hex).
// This also helps prevent XSS. // This also helps prevent XSS.
if (array_key_exists($field, $this) && preg_match('/^[#0-9a-zA-Z]+$/', $this->{$field})) { if ( property_exists($this, $field) && preg_match('/^[#0-9a-zA-Z]+$/', $this->{$field})) {
return $this->{$field}; return $this->{$field};
} }
return $this->defaults{$field}; return $this->defaults[$field];
} // end function SignalCheckColour } // end function SignalCheckColour
public static function find( $parameters = array(), $options = array() ) { public static function find( $parameters = array(), $options = array() ) {
@ -253,7 +253,7 @@ private $status_fields = array(
Warning('Attempt to control a monitor with no Id'); Warning('Attempt to control a monitor with no Id');
return; return;
} }
if ( (!defined('ZM_SERVER_ID')) or ( array_key_exists('ServerId', $this) and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) { if ( (!defined('ZM_SERVER_ID')) or ( property_exists($this, 'ServerId') and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) {
if ( $this->Type() == 'Local' ) { if ( $this->Type() == 'Local' ) {
$zmcArgs = '-d '.$this->{'Device'}; $zmcArgs = '-d '.$this->{'Device'};
} else { } else {
@ -306,7 +306,7 @@ private $status_fields = array(
return; return;
} }
if ( (!defined('ZM_SERVER_ID')) or ( array_key_exists('ServerId', $this) and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) { if ( (!defined('ZM_SERVER_ID')) or ( property_exists($this, 'ServerId') and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) {
if ( $this->{'Function'} == 'None' || $this->{'Function'} == 'Monitor' || $mode == 'stop' ) { if ( $this->{'Function'} == 'None' || $this->{'Function'} == 'Monitor' || $mode == 'stop' ) {
if ( ZM_OPT_CONTROL ) { if ( ZM_OPT_CONTROL ) {
daemonControl('stop', 'zmtrack.pl', '-m '.$this->{'Id'}); daemonControl('stop', 'zmtrack.pl', '-m '.$this->{'Id'});
@ -367,8 +367,8 @@ private $status_fields = array(
} }
} }
if ( !array_key_exists('GroupIds', $this) ) { if ( !property_exists($this, 'GroupIds') ) {
if ( array_key_exists('Id', $this) and $this->{'Id'} ) { if ( property_exists($this, 'Id') and $this->{'Id'} ) {
$this->{'GroupIds'} = dbFetchAll('SELECT `GroupId` FROM `Groups_Monitors` WHERE `MonitorId`=?', 'GroupId', array($this->{'Id'}) ); $this->{'GroupIds'} = dbFetchAll('SELECT `GroupId` FROM `Groups_Monitors` WHERE `MonitorId`=?', 'GroupId', array($this->{'Id'}) );
if ( ! $this->{'GroupIds'} ) if ( ! $this->{'GroupIds'} )
$this->{'GroupIds'} = array(); $this->{'GroupIds'} = array();
@ -417,7 +417,7 @@ private $status_fields = array(
if ( $new ) { if ( $new ) {
$this->{'Storage'} = $new; $this->{'Storage'} = $new;
} }
if ( ! ( array_key_exists('Storage', $this) and $this->{'Storage'} ) ) { if ( ! ( property_exists($this, 'Storage') and $this->{'Storage'} ) ) {
$this->{'Storage'} = isset($this->{'StorageId'}) ? $this->{'Storage'} = isset($this->{'StorageId'}) ?
Storage::find_one(array('Id'=>$this->{'StorageId'})) : Storage::find_one(array('Id'=>$this->{'StorageId'})) :
new Storage(NULL); new Storage(NULL);
@ -493,7 +493,7 @@ public function sendControlCommand($command) {
} }
} }
if ( (!defined('ZM_SERVER_ID')) or ( array_key_exists('ServerId', $this) and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) { if ( (!defined('ZM_SERVER_ID')) or ( property_exists($this, 'ServerId') and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) {
# Local # Local
Logger::Debug('Trying to send options ' . print_r($options, true)); Logger::Debug('Trying to send options ' . print_r($options, true));

View File

@ -1,133 +1,22 @@
<?php <?php
namespace ZM; namespace ZM;
require_once('Object.php');
require_once('database.php'); class MontageLayout extends ZM_Object {
protected static $table = 'MontageLayouts';
class MontageLayout { protected $defaults = array(
private $defaults = array(
'Id' => null, 'Id' => null,
'Name' => '', 'Name' => '',
'Positions' => 0, 'Positions' => 0,
); );
public function __construct( $IdOrRow = NULL ) { public static function find( $parameters = array(), $options = array() ) {
if ( $IdOrRow ) { return ZM_Object::_find(get_class(), $parameters, $options);
$row = NULL;
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
$row = dbFetchOne( 'SELECT * FROM MontageLayouts WHERE Id=?', NULL, array( $IdOrRow ) );
if ( ! $row ) {
Error("Unable to load MontageLayout record for Id=" . $IdOrRow );
}
} else if ( is_array( $IdOrRow ) ) {
$row = $IdOrRow;
} else {
Error("Unknown argument passed to MontageLayout Constructor ($IdOrRow)");
return;
} }
if ( $row ) { public static function find_one( $parameters = array(), $options = array() ) {
foreach ($row as $k => $v) { return ZM_Object::_find_one(get_class(), $parameters, $options);
$this->{$k} = $v;
} }
} else {
Error('No row for MontageLayout ' . $IdOrRow );
}
} # end if isset($IdOrRow)
} // end function __construct
public function __call($fn, array $args){
if ( count($args) ) {
$this->{$fn} = $args[0];
}
if ( array_key_exists($fn, $this) ) {
return $this->{$fn};
} else {
if ( array_key_exists( $fn, $this->defaults ) ) {
return $this->defaults{$fn};
} else {
$backTrace = debug_backtrace();
$file = $backTrace[1]['file'];
$line = $backTrace[1]['line'];
Warning( "Unknown function call MontageLayout->$fn from $file:$line" );
}
}
}
public function set( $data ) {
foreach ($data as $k => $v) {
if ( is_array( $v ) ) {
# perhaps should turn into a comma-separated string
$this->{$k} = implode(',',$v);
} else if ( is_string( $v ) ) {
$this->{$k} = trim( $v );
} else if ( is_integer( $v ) ) {
$this->{$k} = $v;
} else if ( is_bool( $v ) ) {
$this->{$k} = $v;
} else {
Error( "Unknown type $k => $v of var " . gettype( $v ) );
$this->{$k} = $v;
}
}
}
public static function find( $parameters = null, $options = null ) {
$filters = array();
$sql = 'SELECT * FROM MontageLayouts ';
$values = array();
if ( $parameters ) {
$fields = array();
$sql .= 'WHERE ';
foreach ( $parameters as $field => $value ) {
if ( $value == null ) {
$fields[] = $field.' IS NULL';
} else if ( is_array( $value ) ) {
$func = function(){return '?';};
$fields[] = $field.' IN ('.implode(',', array_map( $func, $value ) ). ')';
$values += $value;
} else {
$fields[] = $field.'=?';
$values[] = $value;
}
}
$sql .= implode(' AND ', $fields );
}
if ( $options and isset($options['order']) ) {
$sql .= ' ORDER BY ' . $options['order'];
}
$result = dbQuery($sql, $values);
if ( $result ) {
$results = $result->fetchALL();
foreach ( $results as $row ) {
$filters[] = new MontageLayout($row);
}
}
return $filters;
}
public function save( $new_values = null ) {
if ( $new_values ) {
foreach ( $new_values as $k=>$v ) {
$this->{$k} = $v;
}
}
$fields = array_values( array_filter( array_keys($this->defaults), function($field){return $field != 'Id';} ) );
$values = null;
if ( isset($this->{'Id'}) ) {
$sql = 'UPDATE MontageLayouts SET '.implode(', ', array_map( function($field) {return $field.'=?';}, $fields ) ) . ' WHERE Id=?';
$values = array_map( function($field){return $this->{$field};}, $fields );
$values[] = $this->{'Id'};
dbQuery($sql, $values);
} else {
$sql = 'INSERT INTO MontageLayouts ('.implode( ',', $fields ).') VALUES ('.implode(',',array_map( function(){return '?';}, $fields ) ).')';
$values = array_map( function($field){return $this->{$field};}, $fields );
dbQuery($sql, $values);
global $dbConn;
$this->{'Id'} = $dbConn->lastInsertId();
}
} // end function save
} // end class MontageLayout } // end class MontageLayout
?> ?>

View File

@ -45,7 +45,7 @@ class ZM_Object {
$this->{$fn} = $args[0]; $this->{$fn} = $args[0];
} }
if ( array_key_exists($fn, $this) ) { if ( property_exists($this, $fn) ) {
return $this->{$fn}; return $this->{$fn};
} else { } else {
if ( array_key_exists($fn, $this->defaults) ) { if ( array_key_exists($fn, $this->defaults) ) {
@ -140,10 +140,10 @@ class ZM_Object {
foreach ($this->defaults as $key => $value) { foreach ($this->defaults as $key => $value) {
if ( is_callable(array($this, $key)) ) { if ( is_callable(array($this, $key)) ) {
$json[$key] = $this->$key(); $json[$key] = $this->$key();
} else if ( array_key_exists($key, $this) ) { } else if ( property_exists($this, $key) ) {
$json[$key] = $this->{$key}; $json[$key] = $this->{$key};
} else { } else {
$json[$key] = $this->defaults{$key}; $json[$key] = $this->defaults[$key];
} }
} }
return json_encode($json); return json_encode($json);
@ -215,7 +215,7 @@ class ZM_Object {
} else if ( $this->$field() != $value ) { } else if ( $this->$field() != $value ) {
$changes[$field] = $value; $changes[$field] = $value;
} }
} else if ( array_key_exists($field, $this) ) { } else if ( property_exists($this, $field) ) {
$type = (array_key_exists($field, $this->defaults) && is_array($this->defaults[$field])) ? $this->defaults[$field]['type'] : 'scalar'; $type = (array_key_exists($field, $this->defaults) && is_array($this->defaults[$field])) ? $this->defaults[$field]['type'] : 'scalar';
Logger::Debug("Checking field $field => current ". Logger::Debug("Checking field $field => current ".
(is_array($this->{$field}) ? implode(',',$this->{$field}) : $this->{$field}) . ' ?= ' . (is_array($this->{$field}) ? implode(',',$this->{$field}) : $this->{$field}) . ' ?= ' .

View File

@ -80,7 +80,7 @@ class Storage extends ZM_Object {
} }
public function disk_total_space() { public function disk_total_space() {
if ( !array_key_exists('disk_total_space', $this) ) { if ( !property_exists($this, 'disk_total_space') ) {
$path = $this->Path(); $path = $this->Path();
if ( file_exists($path) ) { if ( file_exists($path) ) {
$this->{'disk_total_space'} = disk_total_space($path); $this->{'disk_total_space'} = disk_total_space($path);
@ -94,7 +94,7 @@ class Storage extends ZM_Object {
public function disk_used_space() { public function disk_used_space() {
# This isn't a function like this in php, so we have to add up the space used in each event. # This isn't a function like this in php, so we have to add up the space used in each event.
if ( ( !array_key_exists('disk_used_space', $this)) or !$this->{'disk_used_space'} ) { if ( ( !property_exists($this, 'disk_used_space')) or !$this->{'disk_used_space'} ) {
if ( $this->{'Type'} == 's3fs' ) { if ( $this->{'Type'} == 's3fs' ) {
$this->{'disk_used_space'} = $this->event_disk_space(); $this->{'disk_used_space'} = $this->event_disk_space();
} else { } else {
@ -112,7 +112,7 @@ class Storage extends ZM_Object {
public function event_disk_space() { public function event_disk_space() {
# This isn't a function like this in php, so we have to add up the space used in each event. # This isn't a function like this in php, so we have to add up the space used in each event.
if ( (! array_key_exists('DiskSpace', $this)) or (!$this->{'DiskSpace'}) ) { if ( (! property_exists($this, 'DiskSpace')) or (!$this->{'DiskSpace'}) ) {
$used = dbFetchOne('SELECT SUM(DiskSpace) AS DiskSpace FROM Events WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this->Id())); $used = dbFetchOne('SELECT SUM(DiskSpace) AS DiskSpace FROM Events WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this->Id()));
do { do {
@ -130,8 +130,8 @@ class Storage extends ZM_Object {
} // end function event_disk_space } // end function event_disk_space
public function Server() { public function Server() {
if ( ! array_key_exists('Server',$this) ) { if ( ! property_exists($this, 'Server') ) {
if ( array_key_exists('ServerId', $this) ) { if ( property_exists($this, 'ServerId') ) {
$this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'})); $this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'}));
if ( !$this->{'Server'} ) { if ( !$this->{'Server'} ) {

View File

@ -110,13 +110,7 @@ function dbError($sql) {
function dbEscape( $string ) { function dbEscape( $string ) {
global $dbConn; global $dbConn;
if ( version_compare(phpversion(), '4.3.0', '<')) if ( version_compare(phpversion(), '5.4', '<=') and get_magic_quotes_gpc() )
if ( get_magic_quotes_gpc() )
return $dbConn->quote(stripslashes($string));
else
return $dbConn->quote($string);
else
if ( get_magic_quotes_gpc() )
return $dbConn->quote(stripslashes($string)); return $dbConn->quote(stripslashes($string));
else else
return $dbConn->quote($string); return $dbConn->quote($string);