Code

Removed old menu parsing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Dec 2005 13:22:01 +0000 (13:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Dec 2005 13:22:01 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2251 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_xmlParse.inc [deleted file]
plugins/admin/applications/class_applicationGeneric.inc

diff --git a/include/class_xmlParse.inc b/include/class_xmlParse.inc
deleted file mode 100644 (file)
index 3f8c07c..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (https://gosa.gonicus.de)
- * Copyright (C) 2003  Cajus Pollmeier
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-class xmlParse  {
-
-       /* XML parser */
-       var $parser;
-
-       /* Selected connection */
-       var $current    = array();
-       var $currentPos = 0;
-       var $depth              = array();
-       var $data               = array();
-
-       function xmlParse()
-       {
-               $this->parser = xml_parser_create();
-               xml_set_object($this->parser, $this);
-               xml_set_element_handler($this->parser, "tag_open", "tag_close");
-       }
-
-       function parseMenu($file)
-       {
-               if (!($fp = @fopen($file, "r"))) {
-                       print_red(sprintf(_("Could not open XML input '%s'."),$file));
-                       $this->data = array();
-                       return(false);
-               }
-
-               $data = fread($fp, filesize($file));
-
-               $t = split("\n",$data);
-               $s = preg_replace("/<!DOCTYPE.*>/","<Input>",$data."</Input>");
-               $data = $t[0]."\n".$s;  
-               
-               fclose($fp);
-               xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 1);
-               xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 0);
-               xml_parse_into_struct($this->parser, $data, $vals, $index);
-
-               $params = array();
-               $level = array();
-               
-               $this->data = array();  
-               $this->depth = array(); 
-               $i = 0 ; 
-               $current ="";
-               $dir = "";
-               foreach($vals as $ele){
-                       if($ele['tag'] =="INPUT") continue;
-                       if($ele['tag'] =="INCLUDE") continue;
-
-                       if(!in_array($ele['tag'],array("MENU","CATEGORY","DIRECTORY"))) continue;
-
-                       if($ele['type'] == "open"){
-                               $tag = $ele['tag'].$i;
-               
-                               if($ele['tag'] != "MENU"){
-                                       $i++;
-                                       $this->currentPos ++ ;
-                                       $this->depth[$this->currentPos] = $tag;
-                               }
-                               $current = &$this->data;
-                               foreach($this->depth as $name){
-                                       $current = &$current[$name];    
-                               }
-                       }elseif($ele['type']=="close"){
-                               unset($this->depth[($this->currentPos)]);
-                               $this->currentPos --;
-                               if($ele['tag'] == "MENU")
-                               $dir ="";
-                       }
-                       if(($ele['tag'] == "CATEGORY")&&(!empty($ele['value']))&&(isset($ele['value']))){
-                               $current[preg_replace("/\/$/","",$dir)]['name'] = $ele['value'];
-                       }
-                       if(isset($current['type'])){
-                               unset($current['type']);
-                       }
-                       if($ele['tag'] == "DIRECTORY"){
-                               $dir .= preg_replace("/\.directory/","",$ele['value'])."/";
-                       }
-                       if(($ele['tag'] == "CATEGORY")&&(!empty($ele['value']))&&(isset($ele['value']))){
-                               $current[preg_replace("/\/$/","",$dir)] = $ele['value'];
-                       }
-                       $curback = $current;    
-               }
-               
-       }
-
-
-       function parse($filename)
-       {
-               if(!file_exists($filename)){
-                       return(false);
-               }else{ 
-                       $fh= fopen($filename, "r"); 
-                       $xmldata= fread($fh, 100000);
-                       fclose($fh); 
-                       if(!xml_parse($this->parser, chop($xmldata))){
-                               print(sprintf(_("XML error in %s : %s at line %d"),$filename,
-                                                       xml_error_string(xml_get_error_code($this->parser)),
-                                                       xml_get_current_line_number($this->parser)));
-                       }
-               }
-               return(true);
-       }
-
-       function tag_open($parser, $tag, $attrs)
-       {
-               $this->currentPos ++ ;
-               $this->depth[$this->currentPos] = $tag;
-
-               $current = &$this->data;
-               foreach($this->depth as $name){
-                       $current = &$current[$name];    
-               }
-               $current = $attrs;
-       }
-
-       function tag_close($parser, $tag)
-       {
-               unset($this->depth[($this->currentPos)]);
-               $this->currentPos --; 
-       }
-
-       function GetData()
-       {
-               return ($this->data);
-       }
-
-}
-?>
index 44ea1694666fa6246db21efa3074844e1d61ff07..2f32485b300670839c7e3540ba813e23cfb25980 100644 (file)
@@ -16,7 +16,6 @@ class application extends plugin
   var $gosaApplicationIcon= "";
   var $gotoLogonScript ="";
   var $iconData;
-  var $Categories = array();
 
   /* Headpage attributes */
   var $last_sorting= "invalid";
@@ -31,25 +30,6 @@ class application extends plugin
   {
        plugin::plugin ($config, $dn);
 
-       $tmp = new xmlParse();
-       
-       $this->Categories= array();
-       if(!isset($this->config->data['MAIN']['KDE_APPLICATIONS_MENU']))        {
-               print_red(_("There is no value for 'KDE_APPLICATIONS_MENU' specified in your gosa.conf."));
-       }else{
-               $path = $this->config->data['MAIN']['KDE_APPLICATIONS_MENU'];
-               if(file_exists($path)){
-                       if(is_readable($path)){
-                               $tmp->parseMenu($path);
-                               $this->Categories = $tmp->GetData();
-                       }else{
-                               print_red(sprintf(_("The specified file '%s' for 'KDE_APPLICATIONS_MENU' in your gosa.conf is not accessable."),$path));
-                       }
-               }else{
-                       print_red(sprintf(_("The specified file '%s' for 'KDE_APPLICATIONS_MENU' in your gosa.conf is not accessable."),$path));
-               }
-       }
-
        /* Load icon */
        $ldap= $config->get_ldap_link();
        if ($dn != 'new'){