From: hickert Date: Wed, 7 Dec 2005 13:22:01 +0000 (+0000) Subject: Removed old menu parsing X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=abc8a9b8c6eb1bac83a968b1525541c0f439d77f;p=gosa.git Removed old menu parsing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2251 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_xmlParse.inc b/include/class_xmlParse.inc deleted file mode 100644 index 3f8c07c70..000000000 --- a/include/class_xmlParse.inc +++ /dev/null @@ -1,149 +0,0 @@ -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("//","",$data.""); - $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); - } - -} -?> diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 44ea16946..2f32485b3 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -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'){