Skip to content

Commit d84050e

Browse files
author
pedro_morgan
committed
php5 and general code tidy
1 parent 0a6e9e0 commit d84050e

File tree

3 files changed

+32
-40
lines changed

3 files changed

+32
-40
lines changed

interface/lib/classes/cmstree.inc.php

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,43 @@
2929
*/
3030

3131
class nodetree {
32-
var $childs;
33-
var $btext;
34-
var $id;
32+
public $childs;
33+
public $btext;
34+
public $id;
3535
}
3636

3737
class cmstree
3838
{
39-
var $_table;
39+
//TODO is this used ?? - pedro
40+
//var $_table;
4041

41-
// $vars enthält:
42+
// $vars enth�lt:
4243
// - parent :id des Elternelementes
4344
// - type :n = node, i = item
4445
// - doctype_id :id des Dokumententyps, wenn nicht im content Feld
4546
// - title :Titel des Eintrages
4647
// - status :1 = ok, d = delete
4748
// - icon :icon im node-tree, optional
4849
// - modul :modul des Eintrages, noch nicht verwendet
49-
// - doc_id :id des zugehörigen Dokumentes
50+
// - doc_id :id des zugeh�rigen Dokumentes
5051

51-
function node_list()
52+
public function node_list()
5253
{
53-
global $app;
54+
global $app;
5455

55-
$nodes = $app->db->queryAllRecords("SELECT * FROM media_cat order by sort, name");
56+
$nodes = $app->db->queryAllRecords('SELECT * FROM media_cat order by sort, name');
5657

5758
$optionlist = array();
5859
$my0 = new nodetree();
5960

6061
foreach($nodes as $row) {
6162

62-
$id = "my".$row["media_cat_id"];
63-
$btext = $row["name"];
64-
$ordner = 'my'.$row["parent"];
63+
$id = 'my'.$row['media_cat_id'];
64+
$btext = $row['name'];
65+
$ordner = 'my'.$row['parent'];
6566
if(!is_object($$id)) $$id = new nodetree();
6667
$$id->btext = $btext;
67-
$$id->id = $row["media_cat_id"];
68+
$$id->id = $row['media_cat_id'];
6869

6970
if(is_object($$ordner)) {
7071
$$ordner->childs[] = &$$id;
@@ -74,21 +75,16 @@ function node_list()
7475
}
7576
}
7677

77-
$this->ptree($my0,0,$optionlist);
78-
79-
if(is_array($nodes)){
80-
return $optionlist;
81-
} else {
82-
return false;
83-
}
78+
$this->ptree($my0, 0, $optionlist);
79+
return is_array($nodes) ? $optionlist : false;
8480
}
8581

86-
function ptree($myobj, $tiefe, &$optionlist){
82+
private function ptree($myobj, $tiefe, &$optionlist){
8783
global $_SESSION;
8884
$tiefe += 1;
8985
$id = $myobj->id;
9086

91-
if(is_array($myobj->childs) and ($_SESSION["s"]["cat_open"][$id] == 1 or $tiefe <= 1)) {
87+
if(is_array($myobj->childs) and ($_SESSION['s']['cat_open'][$id] == 1 or $tiefe <= 1)) {
9288
foreach($myobj->childs as $val) {
9389
// kategorie => str_repeat('- &nbsp;',$tiefe) . $val->btext,
9490

@@ -103,13 +99,12 @@ function ptree($myobj, $tiefe, &$optionlist){
10399
}
104100
*/
105101
$val_id = $val->id;
106-
if($_SESSION["s"]["cat_open"][$val_id] == 1) {
102+
if($_SESSION['s']['cat_open'][$val_id] == 1) {
107103
$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>";
108104
} else {
109105
$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>";
110106
}
111107

112-
113108
$optionlist[] = array( media_cat => $kategorie,
114109
media_cat_id => $val->id,
115110
depth => $tiefe);

interface/lib/classes/getconf.inc.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
2-
2+
/**
3+
* getconf class
4+
*
5+
* @author Till Brehm
6+
* @copyright 2005, Till Brehm, projektfarm Gmbh
7+
* @version 0.1
8+
* @package ISPConfig
9+
*/
310
/*
411
Copyright (c) 2006, Till Brehm, projektfarm Gmbh
512
All rights reserved.
@@ -30,31 +37,24 @@
3037

3138
class getconf {
3239

33-
var $config;
40+
private $config;
3441

35-
function get_server_config($server_id, $section = '') {
42+
public function get_server_config($server_id, $section = '') {
3643
global $app;
37-
44+
3845
if(!is_array($this->config[$server_id])) {
3946
$app->uses('ini_parser');
4047
$server_id = intval($server_id);
4148
$server = $app->db->queryOneRecord("SELECT config FROM server WHERE server_id = $server_id");
4249
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server["config"]));
4350
}
44-
45-
if($section == '') {
46-
return $this->config[$server_id];
47-
} else {
48-
return $this->config[$server_id][$section];
49-
}
51+
return ($section == '') ? $this->config[$server_id] : $this->config[$server_id][$section];
5052
}
5153

52-
function get_global_config() {
54+
public function get_global_config() {
5355

5456
die("not yet implemented");
55-
5657
}
57-
5858
}
5959

6060
?>

interface/lib/classes/ini_parser.inc.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public function parse_ini_string($ini) {
5757
return $this->config;
5858
}
5959

60-
61-
6260
public function get_ini_string($file) {
6361
$content = '';
6462
foreach($this->config as $section => $data) {
@@ -71,7 +69,6 @@ public function get_ini_string($file) {
7169
}
7270
return $content;
7371
}
74-
7572
}
7673

7774
?>

0 commit comments

Comments
 (0)