Skip to content
Snippets Groups Projects
Commit d84050e6 authored by pedro_morgan's avatar pedro_morgan
Browse files

php5 and general code tidy

parent 0a6e9e00
No related branches found
No related tags found
No related merge requests found
...@@ -29,16 +29,17 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -29,16 +29,17 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
class nodetree { class nodetree {
var $childs; public $childs;
var $btext; public $btext;
var $id; public $id;
} }
class cmstree class cmstree
{ {
var $_table; //TODO is this used ?? - pedro
//var $_table;
// $vars enthält: // $vars enthlt:
// - parent :id des Elternelementes // - parent :id des Elternelementes
// - type :n = node, i = item // - type :n = node, i = item
// - doctype_id :id des Dokumententyps, wenn nicht im content Feld // - doctype_id :id des Dokumententyps, wenn nicht im content Feld
...@@ -46,25 +47,25 @@ var $_table; ...@@ -46,25 +47,25 @@ var $_table;
// - status :1 = ok, d = delete // - status :1 = ok, d = delete
// - icon :icon im node-tree, optional // - icon :icon im node-tree, optional
// - modul :modul des Eintrages, noch nicht verwendet // - modul :modul des Eintrages, noch nicht verwendet
// - doc_id :id des zugehörigen Dokumentes // - doc_id :id des zugehrigen Dokumentes
function node_list() public function node_list()
{ {
global $app; global $app;
$nodes = $app->db->queryAllRecords("SELECT * FROM media_cat order by sort, name"); $nodes = $app->db->queryAllRecords('SELECT * FROM media_cat order by sort, name');
$optionlist = array(); $optionlist = array();
$my0 = new nodetree(); $my0 = new nodetree();
foreach($nodes as $row) { foreach($nodes as $row) {
$id = "my".$row["media_cat_id"]; $id = 'my'.$row['media_cat_id'];
$btext = $row["name"]; $btext = $row['name'];
$ordner = 'my'.$row["parent"]; $ordner = 'my'.$row['parent'];
if(!is_object($$id)) $$id = new nodetree(); if(!is_object($$id)) $$id = new nodetree();
$$id->btext = $btext; $$id->btext = $btext;
$$id->id = $row["media_cat_id"]; $$id->id = $row['media_cat_id'];
if(is_object($$ordner)) { if(is_object($$ordner)) {
$$ordner->childs[] = &$$id; $$ordner->childs[] = &$$id;
...@@ -74,21 +75,16 @@ var $_table; ...@@ -74,21 +75,16 @@ var $_table;
} }
} }
$this->ptree($my0,0,$optionlist); $this->ptree($my0, 0, $optionlist);
return is_array($nodes) ? $optionlist : false;
if(is_array($nodes)){
return $optionlist;
} else {
return false;
}
} }
function ptree($myobj, $tiefe, &$optionlist){ private function ptree($myobj, $tiefe, &$optionlist){
global $_SESSION; global $_SESSION;
$tiefe += 1; $tiefe += 1;
$id = $myobj->id; $id = $myobj->id;
if(is_array($myobj->childs) and ($_SESSION["s"]["cat_open"][$id] == 1 or $tiefe <= 1)) { if(is_array($myobj->childs) and ($_SESSION['s']['cat_open'][$id] == 1 or $tiefe <= 1)) {
foreach($myobj->childs as $val) { foreach($myobj->childs as $val) {
// kategorie => str_repeat('- &nbsp;',$tiefe) . $val->btext, // kategorie => str_repeat('- &nbsp;',$tiefe) . $val->btext,
...@@ -103,13 +99,12 @@ var $_table; ...@@ -103,13 +99,12 @@ var $_table;
} }
*/ */
$val_id = $val->id; $val_id = $val->id;
if($_SESSION["s"]["cat_open"][$val_id] == 1) { if($_SESSION['s']['cat_open'][$val_id] == 1) {
$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder.png' border='0'> ".$val->btext."</a></div>"; $kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder.png' border='0'> ".$val->btext."</a></div>";
} else { } else {
$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>"; $kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>";
} }
$optionlist[] = array( media_cat => $kategorie, $optionlist[] = array( media_cat => $kategorie,
media_cat_id => $val->id, media_cat_id => $val->id,
depth => $tiefe); depth => $tiefe);
......
<?php <?php
/**
* getconf class
*
* @author Till Brehm
* @copyright 2005, Till Brehm, projektfarm Gmbh
* @version 0.1
* @package ISPConfig
*/
/* /*
Copyright (c) 2006, Till Brehm, projektfarm Gmbh Copyright (c) 2006, Till Brehm, projektfarm Gmbh
All rights reserved. All rights reserved.
...@@ -30,31 +37,24 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -30,31 +37,24 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class getconf { class getconf {
var $config; private $config;
function get_server_config($server_id, $section = '') { public function get_server_config($server_id, $section = '') {
global $app; global $app;
if(!is_array($this->config[$server_id])) { if(!is_array($this->config[$server_id])) {
$app->uses('ini_parser'); $app->uses('ini_parser');
$server_id = intval($server_id); $server_id = intval($server_id);
$server = $app->db->queryOneRecord("SELECT config FROM server WHERE server_id = $server_id"); $server = $app->db->queryOneRecord("SELECT config FROM server WHERE server_id = $server_id");
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server["config"])); $this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server["config"]));
} }
return ($section == '') ? $this->config[$server_id] : $this->config[$server_id][$section];
if($section == '') {
return $this->config[$server_id];
} else {
return $this->config[$server_id][$section];
}
} }
function get_global_config() { public function get_global_config() {
die("not yet implemented"); die("not yet implemented");
} }
} }
?> ?>
\ No newline at end of file
...@@ -57,8 +57,6 @@ class ini_parser{ ...@@ -57,8 +57,6 @@ class ini_parser{
return $this->config; return $this->config;
} }
public function get_ini_string($file) { public function get_ini_string($file) {
$content = ''; $content = '';
foreach($this->config as $section => $data) { foreach($this->config as $section => $data) {
...@@ -71,7 +69,6 @@ class ini_parser{ ...@@ -71,7 +69,6 @@ class ini_parser{
} }
return $content; return $content;
} }
} }
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment