mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Revert "[WIP] Sanity!"
This commit is contained in:
@@ -31,7 +31,6 @@ include_once($config['install_dir'].'/html/includes/authentication/'.$config['au
|
||||
* @return string|boolean
|
||||
*/
|
||||
function GenSQL($rule) {
|
||||
$rule = htmlspecialchars_decode($rule);
|
||||
$rule = RunMacros($rule);
|
||||
if( empty($rule) ) {
|
||||
//Cannot resolve Macros due to recursion. Rule is invalid.
|
||||
|
||||
@@ -1265,16 +1265,3 @@ function get_port_id ($ports_mapped, $port, $port_association_mode) {
|
||||
|
||||
return $port_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize
|
||||
* @param mixed $item Reference to Item
|
||||
* @param mixed $key Key
|
||||
* @return void
|
||||
*/
|
||||
function sanitize_array(&$item, $key) {
|
||||
$tmp = htmlspecialchars($item);
|
||||
if( !empty($tmp) ){
|
||||
$item = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,8 +266,6 @@ function dbFetchRows($sql, $parameters=array(), $nocache=false) {
|
||||
if ($config['memcached']['enable'] && $nocache === false) {
|
||||
$config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']);
|
||||
}
|
||||
array_walk_recursive($rows,'sanitize_array');
|
||||
reset($rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
@@ -335,8 +333,6 @@ function dbFetchRow($sql=null, $parameters=array(), $nocache=false) {
|
||||
if ($config['memcached']['enable'] && $nocache === false) {
|
||||
$config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$row,$config['memcached']['ttl']);
|
||||
}
|
||||
array_walk_recursive($row,'sanitize_array');
|
||||
reset($row);
|
||||
return $row;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -267,8 +267,6 @@ function dbFetchRows($sql, $parameters=array(), $nocache=false) {
|
||||
if ($config['memcached']['enable'] && $nocache === false) {
|
||||
$config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']);
|
||||
}
|
||||
array_walk_recursive($rows,'sanitize_array');
|
||||
reset($rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
@@ -336,8 +334,6 @@ function dbFetchRow($sql=null, $parameters=array(), $nocache=false) {
|
||||
if ($config['memcached']['enable'] && $nocache === false) {
|
||||
$config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$row,$config['memcached']['ttl']);
|
||||
}
|
||||
array_walk_recursive($row,'sanitize_array');
|
||||
reset($row);
|
||||
return $row;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -97,7 +97,6 @@ class ObjCache implements ArrayAccess {
|
||||
else {
|
||||
$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = dbFetchRows($this->data[$obj]['query'], $this->data[$obj]['params']);
|
||||
if (sizeof($GLOBALS['_ObjCache'][$this->obj][$obj]['value']) == 1 && sizeof($GLOBALS['_ObjCache'][$this->obj][$obj]['value'][0]) == 1) {
|
||||
reset($GLOBALS['_ObjCache'][$this->obj][$obj]['value'][0]);
|
||||
$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = current($GLOBALS['_ObjCache'][$this->obj][$obj]['value'][0]);
|
||||
}
|
||||
return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
|
||||
|
||||
Reference in New Issue
Block a user