Author: Lars Michelsen <[email protected]>
Date: Sat Feb 26 22:12:04 2011 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Sat Feb 26 21:12:04 2011 +0000
Fixed map/shape upload code
---
share/server/core/classes/CoreModManageShapes.php | 10 ++++++----
share/server/core/classes/CoreModMap.php | 4 ++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/share/server/core/classes/CoreModManageShapes.php
b/share/server/core/classes/CoreModManageShapes.php
index c1523f7..8c8cdec 100644
--- a/share/server/core/classes/CoreModManageShapes.php
+++ b/share/server/core/classes/CoreModManageShapes.php
@@ -82,14 +82,16 @@ class CoreModManageShapes extends CoreModule {
if(!preg_match(MATCH_PNG_GIF_JPG_FILE, $fileName))
new GlobalMessage('ERROR',
$this->CORE->getLang()->getText('The uploaded file is no image (png,jpg,gif)
file or contains unwanted chars.'));
- $filePath = $this->CORE->getMainCfg()->getValue('paths',
'shape').$fileName;
+ $filePath = $this->CORE->getMainCfg()->getPath('sys', 'local',
'shapes').$fileName;
return move_uploaded_file($a['image_file']['tmp_name'],
$filePath) && $this->CORE->setPerms($filePath);
}
protected function doDelete($a) {
- if(file_exists($this->CORE->getMainCfg()->getValue('paths',
'shape').$a['image']))
- return
unlink($this->CORE->getMainCfg()->getValue('paths', 'shape').$a['image']);
- return false;
+ $path = $this->CORE->getMainCfg()->getPath('sys', '', 'shapes',
$a['image']);
+ if($path !== '')
+ return unlink($path);
+ else
+ return false;
}
protected function handleResponseDelete() {
diff --git a/share/server/core/classes/CoreModMap.php
b/share/server/core/classes/CoreModMap.php
index 7fcc6b2..199db49 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -293,8 +293,8 @@ class CoreModMap extends CoreModule {
if(!preg_match(MATCH_CFG_FILE, $mapName))
new GlobalMessage('ERROR',
$this->CORE->getLang()->getText('The uploaded file is no map configuration
file.'));
- $mapPath = $this->CORE->getMainCfg()->getValue('paths',
'mapcfg').$mapName;
- return move_uploaded_file($a['map_file']['tmp_name'], $mapPath)
&& $this->CORE->setPerms($filePath);
+ $filePath = $this->CORE->getMainCfg()->getValue('paths',
'mapcfg').$mapName;
+ return move_uploaded_file($a['map_file']['tmp_name'],
$filePath) && $this->CORE->setPerms($filePath);
}
protected function handleResponseDoExportMap() {
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins