Module: nagvis Branch: master Commit: 6af1ff4726300467aaae3453be5a7bbf8be8799a URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=6af1ff4726300467aaae3453be5a7bbf8be8799a
Author: Lars Michelsen <[email protected]> Date: Sat May 8 00:42:14 2010 +0200 Additional cleanups; map timestamp fetching is now also protected by auth system --- share/server/core/classes/CoreModGeneral.php | 35 ++++++++++++-------------- 1 files changed, 16 insertions(+), 19 deletions(-) diff --git a/share/server/core/classes/CoreModGeneral.php b/share/server/core/classes/CoreModGeneral.php index e7aa8e8..ff1d9ca 100644 --- a/share/server/core/classes/CoreModGeneral.php +++ b/share/server/core/classes/CoreModGeneral.php @@ -85,17 +85,20 @@ class CoreModGeneral extends CoreModule { } } - if(isset($aOpts['m']) && is_array($aOpts['m'])) { - foreach($aOpts['m'] AS $sMap) { - $MAPCFG = new NagVisMapCfg($this->CORE, $sMap); - $aReturn[$sMap] = $MAPCFG->getFileModificationTime(); - } - } - - if(isset($aOpts['am']) && is_array($aOpts['am'])) { - foreach($aOpts['am'] AS $sAutomap) { - $MAPCFG = new NagVisAutomapCfg($this->CORE, $sAutomap); - $aReturn[$sAutomap] = $MAPCFG->getFileModificationTime(); + // Loop maps and automaps + foreach(Array('m' => 'Map', 'am' => 'AutoMap') AS $t => $p) { + if(isset($aOpts[$t]) && is_array($aOpts[$t])) { + foreach($aOpts[$t] AS $sMap) { + if($this->CORE->getAuthorization() === null || !$this->CORE->getAuthorization()->isPermitted($p, 'view', $sMap)) + continue; + + if($t == 'm') + $MAPCFG = new NagVisMapCfg($this->CORE, $sMap); + else + $MAPCFG = new NagVisAutomapCfg($this->CORE, $sMap); + + $aReturn[$sMap] = $MAPCFG->getFileModificationTime(); + } } } @@ -110,8 +113,7 @@ class CoreModGeneral extends CoreModule { $arrReturn = Array(); // Parse view specific uri params - $aKeys = Array('name' => MATCH_STRING_NO_SPACE); - $aOpts = $this->getCustomOptions($aKeys); + $aOpts = $this->getCustomOptions(Array('name' => MATCH_STRING_NO_SPACE)); foreach($aOpts['name'] AS $sName) { if($type == 'hover') @@ -128,8 +130,7 @@ class CoreModGeneral extends CoreModule { $arrReturn = Array(); // Parse view specific uri params - $aKeys = Array('url' => MATCH_STRING_URL); - $aOpts = $this->getCustomOptions($aKeys); + $aOpts = $this->getCustomOptions(Array('url' => MATCH_STRING_URL)); foreach($aOpts['url'] AS $sUrl) { $OBJ = new NagVisHoverUrl($this->CORE, $sUrl); @@ -162,11 +163,9 @@ class CoreModGeneral extends CoreModule { for($i = 0; $i < $numObjects; $i++) { switch($arrType[$i]) { case 'map': - // Skip unpermitted maps if($this->CORE->getAuthorization() === null || !$this->CORE->getAuthorization()->isPermitted('Map', 'view', $arrName1[$i])) continue 2; - // Initialize map configuration based on map type $MAPCFG = new NagVisMapCfg($this->CORE, $arrName1[$i]); $MAPCFG->readMapConfig(); @@ -174,11 +173,9 @@ class CoreModGeneral extends CoreModule { $OBJ->fetchMapObjects(); break; case 'automap': - // Skip unpermitted maps if($this->CORE->getAuthorization() === null || !$this->CORE->getAuthorization()->isPermitted('AutoMap', 'view', $arrName1[$i])) continue 2; - // Initialize map configuration based on map type $MAPCFG = new NagVisAutomapCfg($this->CORE, $arrName1[$i]); $MAPCFG->readMapConfig(); ------------------------------------------------------------------------------ _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
