Module: nagvis
Branch: master
Commit: cb494e5a5d22b93c032c31e6deb96f3b2bfa070d
URL:
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=cb494e5a5d22b93c032c31e6deb96f3b2bfa070d
Author: LaMi <[email protected]>
Date: Fri Jan 15 13:59:22 2010 +0100
#20 Removed old backup/restore methods
---
share/frontend/wui/form_handler.php | 46 ---------
share/frontend/wui/functions/form_handler.php | 125 -------------------------
2 files changed, 0 insertions(+), 171 deletions(-)
diff --git a/share/frontend/wui/form_handler.php
b/share/frontend/wui/form_handler.php
index 4b7b7ef..7039b47 100644
--- a/share/frontend/wui/form_handler.php
+++ b/share/frontend/wui/form_handler.php
@@ -39,10 +39,6 @@ require("../../server/core/functions/debug.php");
require("../../server/core/functions/getuser.php");
require("../../server/core/functions/oldPhpVersionFixes.php");
-// Include needed WUI specific functions
-//FIXME: Remove this ...
-require('./functions/form_handler.php');
-
// This defines wether the GlobalMessage prints HTML or ajax error messages
define('CONST_AJAX' , FALSE);
@@ -145,48 +141,6 @@ switch($_GET['myaction']) {
}
break;
/*
- * Restore a backup of the given MAP
- */
- case 'map_restore':
- if(!isset($_GET['map']) || $_GET['map'] == '') {
- echo $CORE->getLang()->getText('mustValueNotSet',
'ATTRIBUTE~map');
- } else {
- // delete current config
- $MAPCFG = new WuiMapCfg($CORE, $_GET['map']);
- $MAPCFG->readMapConfig();
- $MAPCFG->deleteMapConfig();
- // restore backup
- if(file_exists($CORE->getMainCfg()->getValue('paths',
'mapcfg').$_GET['map'].'.cfg.bak')) {
- copy($CORE->getMainCfg()->getValue('paths',
'mapcfg').$_GET['map'].'.cfg.bak',$CORE->getMainCfg()->getValue('paths',
'mapcfg').$_GET['map'].'.cfg');
- }
- // reset status
- $done = FALSE;
-
- // is status for this map there?
- $file = file($CORE->getMainCfg()->getValue('paths',
'mapcfg').'autobackup.status');
- foreach($file AS $key => $val) {
- if(ereg("^".$mapname."=",$val)) {
- // $arr[1] is value
- $arr = explode('=',$val);
-
- $file[$key] =
$mapname.'='.$CORE->getMainCfg()->getValue('wui', 'autoupdatefreq')."\n";
- $done = TRUE;
- }
- }
-
- if($done == FALSE) {
- $file[] =
$mapname.'='.$CORE->getMainCfg()->getValue('wui', 'autoupdatefreq')."\n";
- }
-
- //write array back to file
- $fp = fopen($CORE->getMainCfg()->getValue('paths',
'mapcfg').'autobackup.status',"w");
- fwrite($fp,implode("",$file));
- fclose($fp);
-
- print
"<script>window.document.location.href='./index.php?map=".$_GET['map']."';</script>\n";
- }
- break;
- /*
* Set the default backend in the main configuration
*/
case 'mgt_backend_default':
diff --git a/share/frontend/wui/functions/form_handler.php
b/share/frontend/wui/functions/form_handler.php
deleted file mode 100644
index 749f80a..0000000
--- a/share/frontend/wui/functions/form_handler.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*****************************************************************************
- *
- * form_handler.php - Functions which are needed by the form handler
- *
- * Copyright (c) 2004-2008 NagVis Project (Contact: [email protected])
- *
- * License:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *****************************************************************************/
-
-/**
- * @author Lars Michelsen <[email protected]>
- */
-
-/**
- * Parses a String of properties which are submited by WUI forms and saves the
- * values to an array.
- *
- * @param String String of all properties which were set by WUI
- * @return Array List of the properties
- * @author Lars Michelsen <[email protected]>
- */
-function getArrayFromProperties(&$properties) {
- $prop = Array();
- // The sets are seperated by ^ signs, seperate them
- $properties = explode('^',$properties);
-
- // Loop each property
- foreach($properties AS $var => $line) {
- // seperate string in an array
- $arr = @explode('=',$line);
-
- // read key from array and delete it
- $key = @strtolower(@trim($arr[0]));
- unset($arr[0]);
-
- // build string from rest of array
- $prop[$key] = @trim(@implode('=', $arr));
- }
- return $prop;
-}
-
-/**
- * Automaticaly makes a backup each X (autoupdatefreq) save of the specified
map
- *
- * @param WuiMainCfg Main cofniguration object
- * @param String Name of the map which gets saved
- * @return Boolean Succesful?
- * @author Lars Michelsen <[email protected]>
- */
-function backup($MAINCFG, $mapname) {
- if($MAINCFG->getValue('wui', 'autoupdatefreq') == 0) {
- // delete all *.bak
- foreach(getAllFiles() AS $file) {
- unlink($MAINCFG->getValue('paths',
'mapcfg').$file.'.cfg.bak');
- }
- // delete statusfile
- unlink($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status');
-
- return TRUE;
- } else {
- //no statusfile? create!
- if(!file_exists($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status')) {
- // create file
- $fp = fopen($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status', "w");
- fwrite($fp,$mapname.'='.$MAINCFG->getValue('wui',
'autoupdatefreq')."\n");
- fclose($fp);
- // set permissions
- chmod($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status',0666);
-
- return TRUE;
- } else {
- $done = FALSE;
-
- // is status for this map there?
- $file = file($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status');
- foreach($file AS $key => $val) {
- if(preg_match('/^'.$mapname.'=/',$val)) {
- // $arr[1] is value
- $arr = explode('=',$val);
-
- if($arr[1]-1 == 0) {
- // erstelle backup
-
copy($MAINCFG->getValue('paths',
'mapcfg').$arr[0].'.cfg',$MAINCFG->getValue('paths',
'mapcfg').$arr[0].'.cfg.bak');
- // zur�cksetzen
- $nextval =
$MAINCFG->getValue('wui', 'autoupdatefreq');
- } elseif($arr[1]-1 >=
$MAINCFG->getValue('wui', 'autoupdatefreq')) {
- $nextval =
$MAINCFG->getValue('wui', 'autoupdatefreq');
- } else {
- $nextval = $arr[1]-1;
- }
- $file[$key] =
$mapname.'='.$nextval."\n";
-
- $done = TRUE;
- }
- }
-
- if($done == FALSE) {
- $file[] =
$mapname.'='.$MAINCFG->getValue('wui', 'autoupdatefreq')."\n";
- }
-
- //write array back to file
- $fp = fopen($MAINCFG->getValue('paths',
'mapcfg').'autobackup.status','w');
- fwrite($fp,implode('',$file));
- fclose($fp);
-
- return TRUE;
- }
- }
-}
-?>
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins