mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Merge branch 'master' of github.com:laf/librenms into issue-803
This commit is contained in:
		@@ -68,7 +68,7 @@ function GetRules($device) {
 | 
			
		||||
		$where .= " || alert_map.target = ?";
 | 
			
		||||
		$params[] = 'g'.$group;
 | 
			
		||||
	}
 | 
			
		||||
	return dbFetchRows('SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE (alert_rules.device_id = -1 || alert_rules.device_id = ? ) || ( alert_map.target = ? '.$where.' )',$params);
 | 
			
		||||
	return dbFetchRows('SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE alert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ? ) || alert_map.target = ? '.$where.' )',$params);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										52
									
								
								includes/caches/devices.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								includes/caches/devices.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if( $_SESSION['userlevel'] >= 5 ) {
 | 
			
		||||
 | 
			
		||||
	$data['count'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['up'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices WHERE `status` = '1' AND `ignore` = '0'  AND `disabled` = '0'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['down'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices WHERE `status` = '0' AND `ignore` = '0'  AND `disabled` = '0'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['ignored'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices WHERE `ignore` = '1' AND `disabled` = '0'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['disabled'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices WHERE `disabled` = '1'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
  $data['count'] = array(
 | 
			
		||||
		'query' => "SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id`",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['up'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`status` = '1' AND D.`ignore` = '0' AND D.`disabled` = '0'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['down'] = array(
 | 
			
		||||
		'query' => "SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`status` = '0' AND D.`ignore` = '0' AND D.`disabled` = '0'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['ignored'] = array(
 | 
			
		||||
		'query' => "SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`ignore` = '1' AND D.`disabled` = '0'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['disabled'] = array(
 | 
			
		||||
		'query' => "SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`disabled` = '1'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										61
									
								
								includes/caches/ports.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								includes/caches/ports.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if( $_SESSION['userlevel'] >= 5 ) {
 | 
			
		||||
 | 
			
		||||
	$data['count'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports WHERE `deleted` = '0'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['up'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['down'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['shutdown'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['errored'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['ignored'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')",
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
	$data['count'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id`",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['up'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['down'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['shutdown'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['errored'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	$data['ignored'] = array(
 | 
			
		||||
		'query'  => "SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								includes/caches/services.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								includes/caches/services.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if( $_SESSION['userlevel'] >= 5 ) {
 | 
			
		||||
 | 
			
		||||
	$data['count']    = array( 'query' => "SELECT COUNT(*) FROM services");
 | 
			
		||||
	$data['up']       = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '1'");
 | 
			
		||||
	$data['down']     = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '0'");
 | 
			
		||||
	$data['ignored']  = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '1' AND `service_disabled` = '0'");
 | 
			
		||||
	$data['disabled'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_disabled` = '1'");
 | 
			
		||||
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
	$data['count']    = array(
 | 
			
		||||
		'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id`",
 | 
			
		||||
		'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['up']       = array(
 | 
			
		||||
  	'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '1'",
 | 
			
		||||
  	'params' => array($_SESSION['user_id'])
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  $data['down']     = array(
 | 
			
		||||
  	'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0'",
 | 
			
		||||
  	'params' => array($_SESSION['user_id'])
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $data['ignored']  = array(
 | 
			
		||||
  	'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '1' AND S.`service_disabled` = '0'",
 | 
			
		||||
  	'params' => array($_SESSION['user_id'])
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  $data['disabled'] = array(
 | 
			
		||||
  	'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_disabled` = '1'",
 | 
			
		||||
  	'params' => array($_SESSION['user_id'])
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -599,4 +599,8 @@ $config['distributed_poller_group']                      = 0;
 | 
			
		||||
$config['distributed_poller_memcached_host']             = 'example.net';
 | 
			
		||||
$config['distributed_poller_memcached_port']             = '11211';
 | 
			
		||||
 | 
			
		||||
// Stats callback system
 | 
			
		||||
$config['callback_post']                                 = 'https://stats.librenms.org/log.php';
 | 
			
		||||
$config['callback_clear']                                = 'https://stats.librenms.org/clear.php';
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
@@ -144,6 +144,33 @@ if ($lldp_array)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo("OSPF Discovery: ");
 | 
			
		||||
 | 
			
		||||
if ($config['autodiscovery']['ospf'] === TRUE) {
 | 
			
		||||
    echo "enabled\n";
 | 
			
		||||
    foreach (dbFetchRows("SELECT DISTINCT(`ospfNbrIpAddr`),`device_id` FROM `ospf_nbrs`") as $nbr) {
 | 
			
		||||
        $ip = $nbr['ospfNbrIpAddr'];
 | 
			
		||||
        $device_id = $nbr['device_id'];
 | 
			
		||||
        if (match_network($config['autodiscovery']['nets-exclude'], $ip)) {
 | 
			
		||||
            echo("x");
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        if (!match_network($config['nets'], $ip)) {
 | 
			
		||||
            echo("i");
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        $name = gethostbyaddr($ip);
 | 
			
		||||
        $remote_device_id = discover_new_device($name);
 | 
			
		||||
        if (isset($remote_device_id) && $remote_device_id > 0) {
 | 
			
		||||
            log_event("Device $name ($ip) autodiscovered through OSPF", $remote_device_id, 'system');
 | 
			
		||||
        } else {
 | 
			
		||||
            log_event("OSPF discovery of $name ($ip) failed - check ping and SNMP access", $device_id, 'system');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
} else {
 | 
			
		||||
   echo "disabled\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($debug) { print_r($link_exists); }
 | 
			
		||||
 | 
			
		||||
$sql = "SELECT * FROM `links` AS L, `ports` AS I WHERE L.local_port_id = I.port_id AND I.device_id = '".$device['device_id']."'";
 | 
			
		||||
 
 | 
			
		||||
@@ -1129,4 +1129,28 @@ function convert_delay($delay) {
 | 
			
		||||
    return($delay_sec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
function guidv4($data) {
 | 
			
		||||
    // http://stackoverflow.com/questions/2040240/php-function-to-generate-v4-uuid#15875555
 | 
			
		||||
    // From: Jack http://stackoverflow.com/users/1338292/ja%CD%A2ck
 | 
			
		||||
    assert(strlen($data) == 16);
 | 
			
		||||
 | 
			
		||||
    $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
 | 
			
		||||
    $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
 | 
			
		||||
 | 
			
		||||
    return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function set_curl_proxy($post)
 | 
			
		||||
{
 | 
			
		||||
    global $config;
 | 
			
		||||
    if (isset($_ENV['https_proxy'])) {
 | 
			
		||||
	$tmp = rtrim($_ENV['https_proxy'], "/");
 | 
			
		||||
	$proxystr = str_replace(array("http://", "https://"), "", $tmp);
 | 
			
		||||
	$config['callback_proxy'] = $proxystr;
 | 
			
		||||
	echo "Setting proxy to ".$proxystr." (from https_proxy=".$_ENV['https_proxy'].")\n";
 | 
			
		||||
    }
 | 
			
		||||
    if (isset($config['callback_proxy'])) {
 | 
			
		||||
	echo "Using ".$config['callback_proxy']." as proxy\n";
 | 
			
		||||
	curl_setopt($post, CURLOPT_PROXY, $config['callback_proxy']);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										113
									
								
								includes/object-cache.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								includes/object-cache.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,113 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/* Copyright (C) 2015 Daniel Preussker <f0o@devilcode.org>
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Object-Cache
 | 
			
		||||
 * @author f0o <f0o@devilcode.org>
 | 
			
		||||
 * @copyright 2015 f0o, LibreNMS
 | 
			
		||||
 * @license GPL
 | 
			
		||||
 * @package LibreNMS
 | 
			
		||||
 * @subpackage Cache
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class ObjCache implements ArrayAccess {
 | 
			
		||||
	private $data = array();
 | 
			
		||||
	private $obj  = "";
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Initialize ObjCache
 | 
			
		||||
	 * @param string $obj Name of Object
 | 
			
		||||
	 * @return void
 | 
			
		||||
	 */
 | 
			
		||||
	public function __construct( $obj ) {
 | 
			
		||||
		global $config;
 | 
			
		||||
		$this->obj = $obj;
 | 
			
		||||
		if( isset($GLOBALS['_ObjCache'][$obj]) ) {
 | 
			
		||||
			$this->data = $GLOBALS['_ObjCacheSkell'][$obj];
 | 
			
		||||
		} else {
 | 
			
		||||
			if( !is_array($GLOBALS['_ObjCacheSkell']) ) {
 | 
			
		||||
				$GLOBALS['_ObjCacheSkell'] = array();
 | 
			
		||||
			}
 | 
			
		||||
			if( !is_array($GLOBALS['_ObjCache']) ) {
 | 
			
		||||
				$GLOBALS['_ObjCache'] = array();
 | 
			
		||||
			}
 | 
			
		||||
			if( file_exists($config['install_dir'].'/includes/caches/'.$obj.'.inc.php') ) {
 | 
			
		||||
				$data = array();
 | 
			
		||||
				include($config['install_dir'].'/includes/caches/'.$obj.'.inc.php');
 | 
			
		||||
				$this->data = $data;
 | 
			
		||||
				$GLOBALS['_ObjCacheSkell'][$obj] = $this->data;
 | 
			
		||||
				if( !is_array($GLOBALS['_ObjCache'][$obj]) ) {
 | 
			
		||||
					$GLOBALS['_ObjCache'][$obj] = $this->data;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check if data exists
 | 
			
		||||
	 * @param string $obj Name of Data-Object
 | 
			
		||||
	 * @return boolean
 | 
			
		||||
	 */
 | 
			
		||||
	public function offsetExists( $obj ) {
 | 
			
		||||
		if( isset($this->data[$obj]) ) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get Data-Object
 | 
			
		||||
	 * @param string $obj Name of Data-Object
 | 
			
		||||
	 * @return mixed
 | 
			
		||||
	 */
 | 
			
		||||
	public function offsetGet( $obj ) {
 | 
			
		||||
		if( isset($this->data[$obj]) ) {
 | 
			
		||||
			if( isset($this->data[$obj]['value']) ) {
 | 
			
		||||
				return $this->data[$obj]['value'];
 | 
			
		||||
			} elseif( isset($GLOBALS['_ObjCache'][$this->obj][$obj]['value']) ) {
 | 
			
		||||
				return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
 | 
			
		||||
			} else {
 | 
			
		||||
				$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = dbFetchCell($this->data[$obj]['query'],$this->data[$obj]['params']);
 | 
			
		||||
				return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Overrides internal Cache-Object
 | 
			
		||||
	 * @param string $obj Name of Data-Object
 | 
			
		||||
	 * @param mixed $value Value
 | 
			
		||||
	 * @return boolean
 | 
			
		||||
	 */
 | 
			
		||||
	public function offsetSet( $obj, $value ) {
 | 
			
		||||
		if( !is_array($this->data[$obj]) ) {
 | 
			
		||||
			$this->data[$obj] = array();
 | 
			
		||||
		}
 | 
			
		||||
		$this->data[$obj]['value'] = $value;
 | 
			
		||||
		return $this->data[$obj]['value'];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Reset Data-Object
 | 
			
		||||
	 * @param string $obj Name of Data-Object
 | 
			
		||||
	 * @return mixed
 | 
			
		||||
	 */
 | 
			
		||||
	public function offsetUnset( $obj ) {
 | 
			
		||||
		unset($this->data[$obj]['value']);
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user