--- FreeBSD/tinderbox/webui/module/module.php 2007/11/13 07:36:19 1.1.1.1.2.1 +++ FreeBSD/tinderbox/webui/module/module.php 2007/11/15 15:31:35 1.1.1.1.2.2 @@ -24,36 +24,34 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Paefchen$ +# $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 $ # class module { public $TinderboxDS = null; + private $_template_vars = array(); public function __construct() { - $this->TinderboxDS = new TinderboxDS; + $this->TinderboxDS = TinderboxDS::instance(); } - public 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 ); + 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,11 +61,11 @@ class module { } public function template_assign( $varname, $varcontent ) { - $this->TEMPLATE_VARS[$varname] = $varcontent; + $this->_template_vars[$varname] = $varcontent; } public function template_cleanup() { - return $this->TEMPLATE_VARS = array(); + return $this->_template_vars = array(); } }