--- FreeBSD/tinderbox/webui/module/module.php 2007/11/02 20:55:00 1.1 +++ FreeBSD/tinderbox/webui/module/module.php 2007/11/15 15:31:35 1.1.1.1.2.2 @@ -24,37 +24,34 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# $Paefchen: FreeBSD/tinderbox/webui/module/module.php,v 1.1.1.1.2.1 2007/11/13 07:36:19 as Exp $ # $MCom: portstools/tinderbox/webui/module/module.php,v 1.4 2005/12/26 22:41:41 marcus Exp $ # -require_once 'core/functions.php'; -require_once 'core/TinderboxDS.php'; - class module { + public $TinderboxDS = null; + private $_template_vars = array(); - function module() { - $this->TinderboxDS = new TinderboxDS(); + public function __construct() { + $this->TinderboxDS = TinderboxDS::instance(); } - function template_parse( $template ) { - global $templatesdir; - global $templatesuri; - global $tinderbox_name; - global $tinderbox_title; - global $display_login; + public function template_parse($template) { + /* as xxx */ + # global $display_login; - $this->template_assign( 'templatesuri', $templatesuri ); - $this->template_assign( 'tinderbox_name', $tinderbox_name ); - $this->template_assign( 'tinderbox_title', $tinderbox_title ); - $this->template_assign( 'display_login', $display_login ); - $this->template_assign( 'errors', $this->TinderboxDS->getErrors() ); + $this->template_assign('templatesuri', TEMPLATESURL); + $this->template_assign('tinderbox_name', TB_NAME); + $this->template_assign('tinderbox_title', TB_TITLE); + $this->template_assign('display_login', $display_login); + /* as xxx */ + #$this->template_assign('errors', $this->TinderboxDS->getErrors()); - foreach( $this->TEMPLATE_VARS as $varname => $varcontent ) { - $varcontent = var_export( $varcontent, true ); - eval( '$'.$varname.' = '.$varcontent.';' ); - } + foreach ($this->_template_vars as $varname => $varcontent) + $$varname = $varcontent; + ob_start(); - require $templatesdir.'/'.$template; + require TEMPLATESDIR.'/'.$template; $parsed = ob_get_contents(); ob_end_clean(); @@ -63,12 +60,13 @@ class module { return $parsed; } - function template_assign( $varname, $varcontent ) { - $this->TEMPLATE_VARS[$varname] = $varcontent; + public function template_assign( $varname, $varcontent ) { + $this->_template_vars[$varname] = $varcontent; } - function template_cleanup() { - return $this->TEMPLATE_VARS = array(); + public function template_cleanup() { + return $this->_template_vars = array(); } } + ?>