diff options
Diffstat (limited to 'frontends/php/include/classes')
| -rw-r--r-- | frontends/php/include/classes/cscript.inc.php | 41 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctable.inc.php | 17 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctag.inc.php | 19 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctree.inc.php | 1 |
4 files changed, 64 insertions, 14 deletions
diff --git a/frontends/php/include/classes/cscript.inc.php b/frontends/php/include/classes/cscript.inc.php new file mode 100644 index 00000000..6ace5ca7 --- /dev/null +++ b/frontends/php/include/classes/cscript.inc.php @@ -0,0 +1,41 @@ +<?php +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** 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., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php +class CScript extends CObject{ +/* public */ + + function CScript($item=NULL){ + $this->items = array(); + $this->AddItem($item); + } + + function AddItem($value){ + if(is_array($value)){ + foreach($value as $item){ + array_push($this->items,unpack_object($item)); + } + } + else if(!is_null($value)){ + array_push($this->items,unpack_object($value)); + } + } +} +?> diff --git a/frontends/php/include/classes/ctable.inc.php b/frontends/php/include/classes/ctable.inc.php index 03711739..5ccca19d 100644 --- a/frontends/php/include/classes/ctable.inc.php +++ b/frontends/php/include/classes/ctable.inc.php @@ -62,15 +62,17 @@ } elseif(is_array($item)){ foreach($item as $el){ - if(strtolower(get_class($el))=='ccol') { - parent::AddItem($el); + if(strtolower(get_class($el))=='ccol') { + parent::AddItem($el); } elseif(!is_null($el)) { - parent::AddItem('<td>'.unpack_object($el).'</td>'); +// parent::AddItem('<td>'.unpack_object($el).'</td>'); + parent::AddItem(new CCol($el)); } } } elseif(!is_null($item)){ - parent::AddItem('<td>'.unpack_object($item).'</td>'); +// parent::AddItem('<td>'.unpack_object($item).'</td>'); + parent::AddItem(new CCol($item)); } } @@ -150,7 +152,8 @@ $this->oddRowClass: $this->evenRowClass); }/**/ - return $item->ToString(); + return $item; +// return $item->ToString(); } function SetHeader($value=NULL,$class=NULL){ @@ -169,6 +172,7 @@ if(is_null($class)) $class = $this->footerClass; $this->footer = $this->PrepareRow($value,$class); + $this->footer = $this->footer->ToString(); } function AddRow($item,$rowClass=NULL){ @@ -178,7 +182,7 @@ } function ShowRow($item,$rowClass=NULL){ - echo $this->PrepareRow($item,$rowClass); + echo $this->PrepareRow($item,$rowClass)->ToString(); ++$this->rownum; } /* protected */ @@ -196,6 +200,7 @@ $ret = ""; if($this->rownum == 0 && isset($this->message)) { $ret = $this->PrepareRow(new CCol($this->message,'message')); + $ret = $ret->ToString(); } $ret .= $this->footer; $ret .= parent::EndToString(); diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php index 923cc00a..97cc2325 100644 --- a/frontends/php/include/classes/ctag.inc.php +++ b/frontends/php/include/classes/ctag.inc.php @@ -90,17 +90,22 @@ function CleanItems() { $this->items = array(); } function ItemsCount() { return count($this->items); } + function AddItem($value) { - if(is_array($value)) - { - foreach($value as $item) - { - array_push($this->items,unpack_object($item)); + if(is_object($value)){ + array_push($this->items,unpack_object($value)); + } + else if(is_string($value)){ + array_push($this->items,str_replace(array('<','>','"'),array('<','>','"'),$value)); +// array_push($this->items,htmlspecialchars($value)); + } + else if(is_array($value)){ + foreach($value as $item){ + $this->AddItem($item); // Attention, recursion !!! } } - elseif(!is_null($value)) - { + else if(!is_null($value)){ array_push($this->items,unpack_object($value)); } } diff --git a/frontends/php/include/classes/ctree.inc.php b/frontends/php/include/classes/ctree.inc.php index 7972bb14..0592c19d 100644 --- a/frontends/php/include/classes/ctree.inc.php +++ b/frontends/php/include/classes/ctree.inc.php @@ -238,7 +238,6 @@ function CheckTree(){ $this->tree[$parentid]['childnodes'][] = $id; $this->tree[$id]['nodelist'] = ''; -// echo $id.BR; } return true; |
