public function getHTML($small = false)
 {
     global $install, $sql;
     include_once "HTML/Template/Flexy.php";
     $config = new Configuracion($sql);
     $this->data->TITLE = $config->get("Nombre del Sitio");
     $map = $config->get("Coordenadas del Mapa");
     $marker = $config->get("Coordenadas del Marcador");
     if ($map) {
         $map = split(",", $map);
         $this->data->MAP = "<script>\nvar lat = " . $map[0] . ";\nvar lon = " . $map[1] . ";\n</script>";
     }
     if ($marker) {
         $marker = split(",", $marker);
         $this->data->MARKER = "<script>\nvar latMarker = " . $marker[0] . ";\nvar lonMarker = " . $marker[1] . ";\n</script>";
     }
     $options = array('compileDir' => $install . '/tmp', 'templateDir' => $install . '/template');
     if ($small) {
         $template = "content.small.html";
     } else {
         $template = $this->data->data["TEMPLATECON"];
         $cursor = $sql->readDB("TEMPLATE", "ID______TEM={$template}");
         $res = $cursor->fetch_assoc();
         $template = $res["FILE____TEM"];
     }
     $output = new HTML_Template_Flexy($options);
     $output->compile($template);
     return $output->bufferedOutputObject($this->data);
 }
Example #2
0
 /**
  * 出力を返却
  *
  * @return string
  * @access public
  */
 protected function getOutput()
 {
     if ($this->_encoding) {
         return mb_convert_encoding($this->flexy->bufferedOutputObject($this->_obj, $this->_elements), $this->_encoding['to'], $this->_encoding['from']);
     } else {
         return $this->flexy->bufferedOutputObject($this->_obj, $this->_elements);
     }
 }
Example #3
0
function compileAll($options, $files = array())
{
    // loop through
    $dh = opendir(dirname(__FILE__) . '/templates/');
    while (false !== ($file = readdir($dh))) {
        if ($file[0] == '.') {
            continue;
        }
        if (is_dir(dirname(__FILE__) . '/templates/' . $file)) {
            continue;
        }
        // skip if not listed in files (and it's an array)
        if ($files && !in_array($file, $files)) {
            continue;
        }
        $x = new HTML_Template_Flexy($options);
        echo "compile  {$file} \n";
        $res = $x->compile($file);
        if ($res !== true) {
            echo "Compile failure: " . $res->toString() . "\n";
        }
    }
}
Example #4
0
function compilefile($file, $data = array(), $options = array(), $elements = array())
{
    $options = $options + array('templateDir' => dirname(__FILE__) . '/templates', 'forceCompile' => true, 'fatalError' => HTML_TEMPLATE_FLEXY_ERROR_RETURN, 'url_rewrite' => 'images/:/myproject/images/', 'compileDir' => dirname(__FILE__) . '/results1');
    // basic options..
    echo "\n\n===Compiling {$file}===\n\n";
    $options['compileDir'] = dirname(__FILE__) . '/results1';
    $x = new HTML_Template_Flexy($options);
    $res = $x->compile($file);
    if ($res !== true) {
        echo "===Compile failure==\n" . $res->toString() . "\n";
        return;
    }
    echo "\n\n===Compiled file: {$file}===\n";
    echo file_get_contents($x->compiledTemplate);
    if (!empty($options['show_elements'])) {
        print_r($x->getElements());
    }
    if (!empty($options['show_words'])) {
        print_r(unserialize(file_get_contents($x->gettextStringsFile)));
    }
    echo "\n\n===With data file: {$file}===\n";
    $data = (object) $data;
    $x->outputObject($data, $elements);
}
Example #5
0
 function outputBody()
 {
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - start');
     }
     $ff = HTML_FlexyFramework::get();
     $proj = $ff->project;
     // DB_DataObject::debugLevel(1);
     $m = DB_DAtaObject::factory('Builder_modules');
     $m->get('name', $proj);
     //var_dump($m->path);exit;
     // needs to modify the template directory??
     // use the builder_module == app name
     // look for part with same name.
     if (empty($ff->Pman_Builder['from_filesystem'])) {
         $template_engine = new HTML_Template_Flexy(array('templateDir' => $m->path));
     } else {
         $template_engine = new HTML_Template_Flexy();
     }
     $template_engine->debug = 1;
     //print_R($template_engine);
     $template_engine->compile($this->template);
     if ($this->elements) {
         /* BC crap! */
         $this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements, $this->errors);
     }
     $template_engine->elements = $this->elements;
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - render template');
     }
     //DB_DataObject::debugLevel(1);
     $template_engine->outputObject($this, $this->elements);
     if ($this->timer) {
         $this->timer->setMarker(__CLASS__ . '::outputBody - end');
     }
 }
Example #6
0
File: Regex.php Project: q32p/emst
 /**
  *   actually it will only be used to apply the pre and post filters
  *
  *   @access     public
  *   @version    01/12/10
  *   @author     Alan Knowles <*****@*****.**>
  *   @param      string  $input      the string to filter
  *   @param      array   $prefix     the subset of methods to use.
  *   @return     string  the filtered string
  */
 function applyFilters($input, $prefix = "", $negate = FALSE)
 {
     $this->flexy->debug("APPLY FILTER {$prefix}<BR>");
     $filters = $this->options['filters'];
     $this->flexy->debug(serialize($filters) . "<BR>");
     foreach ($filters as $filtername) {
         $class = "HTML_Template_Flexy_Compiler_Regex_{$filtername}";
         require_once "HTML/Template/Flexy/Compiler/Regex/{$filtername}.php";
         if (!class_exists($class)) {
             return HTML_Template_Flexy::staticRaiseError("Failed to load filter {$filter}", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
         }
         if (!@$this->filter_objects[$class]) {
             $this->filter_objects[$class] = new $class();
             $this->filter_objects[$class]->_set_engine($this);
         }
         $filter =& $this->filter_objects[$class];
         $methods = get_class_methods($class);
         $this->flexy->debug("METHODS:");
         $this->flexy->debug(serialize($methods) . "<BR>");
         foreach ($methods as $method) {
             if ($method[0] == "_") {
                 continue;
                 // private
             }
             if ($method == $class) {
                 continue;
                 // constructor
             }
             $this->flexy->debug("TEST: {$negate} {$prefix} : {$method}");
             if ($negate && preg_match($prefix, $method)) {
                 continue;
             }
             if (!$negate && !preg_match($prefix, $method)) {
                 continue;
             }
             $this->flexy->debug("APPLYING {$filtername} {$method}<BR>");
             $input = $filter->{$method}($input);
         }
     }
     return $input;
 }
<?php

$tpl = new stdClass();
include_once "common.php";
require_once "HTML/Template/Flexy.php";
include_once "sesion.php";
$table = "RESERVA";
$tpl->variablesJavascript = "<script type='text/javascript'>";
$local = $_SESSION['local'];
$tpl->variablesJavascript .= "var local = '" . $local . "';\n";
$tpl->MAPA = "";
$cursor = $sql->readDB("LOCAL", "CODIGO__LOC='{$local}'");
if ($cursor && $cursor->num_rows > 0) {
    if ($data = $cursor->fetch_assoc()) {
        $tpl->MAPA = $data['PLANO___LOC'];
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("selecciona-mesa.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
Example #8
0
 /**
  * Load the plugins, and lookup which one provides the required method 
  *
  * 
  * @param   string           Name
  *
  * @return   string|PEAR_Error   the class that provides it.
  * @access   private
  */
 function _loadPlugins($name)
 {
     // name can be:
     // ahref = maps to {class_prefix}_ahref::ahref
     $this->plugins = array();
     if (empty($this->plugins)) {
         foreach ($this->flexy->options['plugins'] as $cname => $file) {
             if (!is_int($cname)) {
                 include_once $file;
                 $this->plugins[$cname] = new $cname();
                 $this->plugins[$cname]->flexy =& $this->flexy;
                 continue;
             }
             $cname = $file;
             require_once 'HTML/Template/Flexy/Plugin/' . $cname . '.php';
             $class = "HTML_Template_Flexy_Plugin_{$cname}";
             $this->plugins[$class] = new $class();
             $this->plugins[$class]->flexy =& $this->flexy;
         }
     }
     foreach ($this->plugins as $class => $o) {
         //echo "checking :". get_class($o). ":: $name\n";
         if (is_callable(array($o, $name), true)) {
             return $class;
         }
     }
     return HTML_Template_Flexy::raiseError("could not find plugin with method: '{$name}'");
 }
Example #9
0
// 設定読み込み
$ini = ic2_loadconfig();
if ($ini['Viewer']['cache'] && file_exists($_conf['iv2_cache_db_path'])) {
    $viewer_cache_exists = true;
} else {
    $viewer_cache_exists = false;
}
// データベースに接続
$db = DB::connect($ini['General']['dsn']);
if (DB::isError($db)) {
    p2die($db->getMessage());
}
// テンプレートエンジン初期化
$_flexy_options =& PEAR5::getStaticProperty('HTML_Template_Flexy', 'options');
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ImageCache2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy();
// }}}
// {{{ データベース操作・ファイル削除
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        // 画像を削除する
        case 'dropZero':
        case 'dropAborn':
            if ($_POST['action'] == 'dropZero') {
                // ランク=0 の画像を削除する
                $where = $db->quoteIdentifier('rank') . ' = 0';
                if (isset($_POST['dropZeroLimit'])) {
                    // 取得した期間を限定
                    switch ($_POST['dropZeroSelectTime']) {
                        case '24hours':
                            $expires = 86400;
Example #10
0
 /**
  * Handler for User defined functions in templates..
  * <flexy:function name="xxxxx">.... </flexy:block>  // equivilant to function xxxxx() { 
  * <flexy:function call="{xxxxx}">.... </flexy:block>  // equivilant to function {$xxxxx}() { 
  * <flexy:function call="xxxxx">.... </flexy:block>  // equivilant to function {$xxxxx}() { 
  * 
  * This will not handle nested blocks initially!! (and may cause even more problems with 
  * if /foreach stuff..!!
  *
  * @param    object token to convert into a element.
  * @access   public
  */
 function functionToString($element)
 {
     if ($arg = $element->getAttribute('NAME')) {
         // this is a really kludgy way of doing this!!!
         // hopefully the new Template Package will have a sweeter method..
         $GLOBALS['_HTML_TEMPLATE_FLEXY']['prefixOutput'] .= $this->compiler->appendPHP("\nfunction _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this) {\n") . $element->compileChildren($this->compiler) . $this->compiler->appendPHP("\n}\n");
         return '';
     }
     if (!isset($element->ucAttributes['CALL'])) {
         return HTML_Template_Flexy::raiseError(' tag flexy:function needs an argument call or name' . " Error on Line {$element->line} &lt;{$element->tag}&gt;", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
     }
     // call is a  stirng : nice and simple..
     if (is_string($element->ucAttributes['CALL'])) {
         $arg = $element->getAttribute('CALL');
         return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$arg})) " . " _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this);");
     }
     // we make a big assumption here.. - it should really be error checked..
     // that the {xxx} element is item 1 in the list...
     $e = $element->ucAttributes['CALL'][1];
     $add = $e->toVar($e->value);
     if (is_a($add, 'PEAR_Error')) {
         return $add;
     }
     return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$add})) " . "call_user_func_array('_html_template_flexy_compiler_standard_flexy_'.{$add},array(\$t,\$this));");
 }
Example #11
0
File: Flexy.php Project: q32p/emst
 /**
  *   HTML_Template_Flexy_Token_Tag toString 
  *
  * @param    object    HTML_Template_Flexy_Token_Tag
  * 
  * @return   string     string to build a template
  * @access   public 
  * @see      toString*
  */
 function toStringTag($element)
 {
     $original = $element->getAttribute('ALT');
     // techncially only input type=(submit|button|input) alt=.. applies, but we may
     // as well translate any occurance...
     if (($element->tag == 'IMG' || $element->tag == 'INPUT') && is_string($original) && strlen($original)) {
         $this->addStringToGettext($original);
         $quote = $element->ucAttributes['ALT'][0];
         $element->ucAttributes['ALT'] = $quote . $this->flexy->translateString($original) . $quote;
     }
     $original = $element->getAttribute('TITLE');
     if (is_string($original) && strlen($original)) {
         $this->addStringToGettext($original);
         $quote = $element->ucAttributes['TITLE'][0];
         $element->ucAttributes['TITLE'] = $quote . $this->flexy->translateString($original) . $quote;
     }
     if (strpos($element->tag, ':') === false) {
         $namespace = 'Tag';
     } else {
         $bits = explode(':', $element->tag);
         $namespace = $bits[0];
     }
     if ($namespace[0] == '/') {
         $namespace = substr($namespace, 1);
     }
     if (empty($this->tagHandlers[$namespace])) {
         require_once 'HTML/Template/Flexy/Compiler/Flexy/Tag.php';
         $this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Flexy_Tag::factory($namespace, $this);
         if (!$this->tagHandlers[$namespace]) {
             return HTML_Template_Flexy::staticRaiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
         }
     }
     return $this->tagHandlers[$namespace]->toString($element);
 }
$urlsPriority = array();
$base = "http://" . $_SERVER['HTTP_HOST'];
$urls = array();
$urlsPriority[] = $base;
$cursor = $sql->readDB("CATEGORIA", "ESTADO__CAT='A'");
while ($row = $cursor->fetch_assoc()) {
    $url = url_slug($row['NOMBRE__CAT']);
    if ($row['PADRE___CAT'] == '-1') {
        $urlsPriority[] = $base . "/" . $url;
    } else {
        $urls[] = $base . "/" . $url;
    }
}
if ($cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'")) {
    while ($row = $cursor->fetch_assoc()) {
        if (!empty($row['TITULO__CON'])) {
            $url = url_slug($row['TITULO__CON']);
        } else {
            $url = "contenido=" . $row["ID______CON"];
        }
        $urls[] = $base . "/" . $url;
    }
}
$tpl->PRIORITY = $urlsPriority;
$tpl->URLS = $urls;
$tpl->DATE = date(DATE_ATOM);
//*
$output = new HTML_Template_Flexy(array('templateDir' => $install . "/template", 'compileDir' => $install . '/tmp'));
$output->compile("sitemap.xml");
$output->outputObject($tpl);
//*/
Example #13
0
 /**
  * output a template (optionally with flexy object & element.)
  *
  * @param   string         name of flexy template.
  * @param   object         object as per HTML_Template_Flexy:outputObject
  * @param   array          elements array as per HTML_Template_Flexy:outputObject    
  * 
  * @return   none
  * @access   public
  */
 function display($templatename, $object = null, $elements = array())
 {
     // some standard stuff available to a smarty template..
     $this->vars['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'];
     $o = PEAR::getStaticProperty('HTML_Template_Flexy', 'options');
     require_once 'HTML/Template/Flexy.php';
     $t = new HTML_Template_Flexy();
     $t->compile($templatename);
     $object = $object !== null ? $object : new StdClass();
     foreach ($this->vars as $k => $v) {
         $object->{$k} = $v;
     }
     $t->outputObject($object, $elements);
 }
    }
    $curDate .= " 00:00:00";
    $tpl->FECHA = str_replace(' 00:00:00', '', $curDate);
    $cursor = $sql->con->query($q = "SELECT * FROM RESERVA LEFT JOIN CLIENTE ON RUTCLIENRES=RUT_____CLI LEFT JOIN MESA ON MESA____RES=ID______MES LEFT JOIN PEDIDO ON RESERVA_PED=CODIGO__RES LEFT JOIN ESTADO_PEDIDO ON ESTADO__PED=ID______EPE WHERE FECHA___RES BETWEEN '" . $curDate . "' AND DATE_ADD('" . $curDate . "', INTERVAL 1 DAY) {$cond} ORDER BY APELLIDOCLI ASC,FECHA___RES DESC");
    // /*AND NOW() BETWEEN FECHA___RES AND DATE_SUB(FECHA___RES, INTERVAL -DURACIONRES HOUR)*/
    if ($cursor && $cursor->num_rows > 0) {
        while ($row = $cursor->fetch_assoc()) {
            $hora = split(" ", $row['FECHA___RES'])[1];
            $estado = $row['ESTADO__PED'] < 6 ? !empty($row['ESTADO__PED']) ? 'En Curso' : 'Reservada' : 'Finalizada';
            $tpl->RESERVA[$row['CODIGO__RES']] = array("link" => $row['CODIGO__RES'], "mesa" => $row['NUMERO__MES'], "cliente" => $row['RUT_____CLI'] ? $row['APELLIDOCLI'] . ", " . $row['NOMBRE__CLI'] : "Cliente sin Registro", "hora" => $hora, "estado" => $row['DESCRIPCEPE'], "class" => 'reserva-' . $row['ID______EPE']);
        }
    }
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("reservas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
function codigo()
{
    global $sql;
    $charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $key = '';
    for ($i = 0; $i < 12; $i++) {
        $key .= $charset[mt_rand(0, strlen($charset) - 1)];
    }
    $cursor = $sql->readDB("RESERVA", "CODIGO__RES='" . $key . "'");
    if ($cursor && $cursor->num_rows > 0) {
        return codigo();
    } else {
$cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['TITULO__CON']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
    if ("contenido=" . $row["ID______CON"] == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
$cursor = $sql->readDB("CATEGORIA");
while ($row = $cursor->fetch_assoc()) {
    if (url_slug($row['NOMBRE__CAT']) == substr($_SERVER['REQUEST_URI'], 1)) {
        $error = false;
    }
}
if (!$error) {
    Header("HTTP/1.0 200 OK");
    $_REQUEST['bufferedHTML'] = true;
    $_REQUEST['what'] = substr($_SERVER['REQUEST_URI'], 1);
    include_once "getContent.php";
    $content = $retval['html'];
    $content .= "<script>var error = true; var passedURL = '" . substr($_SERVER['REQUEST_URI'], 1) . "';</script>";
    include_once "container.php";
    exit;
}
$options = array('templateDir' => $install . "/template", 'compileDir' => $install . "/tmp");
$object = new HTML_Template_Flexy($options);
$object->compile("error.html");
$content = $object->bufferedOutputObject($tpl);
$content .= "<script>var error = true; var passedURL = 'home';</script>";
include_once "container.php";
Example #16
0
 /**
  *   HTML_Template_Flexy_Token_Tag toString 
  *
  * @param    object    HTML_Template_Flexy_Token_Tag
  * 
  * @return   string     string to build a template
  * @access   public 
  * @see      toString*
  */
 function toStringTag($element)
 {
     if (strpos($element->tag, ':') === false) {
         $namespace = 'Tag';
     } else {
         $bits = explode(':', $element->tag);
         $namespace = $bits[0];
     }
     if ($namespace[0] == '/') {
         $namespace = substr($namespace, 1);
     }
     if (empty($this->tagHandlers[$namespace])) {
         require_once 'HTML/Template/Flexy/Compiler/Standard/Tag.php';
         $this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Standard_Tag::factory($namespace, $this);
         if (!$this->tagHandlers[$namespace]) {
             return HTML_Template_Flexy::raiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
         }
     }
     return $this->tagHandlers[$namespace]->toString($element);
 }
Example #17
0
 /**
  * The core tokenizing part - runs the tokenizer on the data,
  * and stores the results in $this->tokens[]
  *
  * @param   string               Data to tokenize
  * 
  * @return   none | PEAR::Error
  * @access   public|private
  * @see      see also methods.....
  */
 function tokenize($data)
 {
     require_once 'HTML/Template/Flexy/Tokenizer.php';
     $tokenizer =& HTML_Template_Flexy_Tokenizer::construct($data, $this->options);
     // initialize state - this trys to make sure that
     // you dont do to many elses etc.
     //echo "RUNNING TOKENIZER";
     // step one just tokenize it.
     $i = 1;
     while ($t = $tokenizer->yylex()) {
         if ($t == HTML_TEMPLATE_FLEXY_TOKEN_ERROR) {
             return HTML_Template_Flexy::raiseError(array("HTML_Template_Flexy_Tree::Syntax error in File: %s (Line %s)\n" . "Tokenizer Error: %s\n" . "Context:\n\n%s\n\n >>>>>> %s\n", $this->options['filename'], $tokenizer->yyline, $tokenizer->error, htmlspecialchars(substr($tokenizer->yy_buffer, 0, $tokenizer->yy_buffer_end)), htmlspecialchars(substr($tokenizer->yy_buffer, $tokenizer->yy_buffer_end, 100))), HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_DIE);
         }
         if ($t == HTML_TEMPLATE_FLEXY_TOKEN_NONE) {
             continue;
         }
         if ($t->token == 'Php') {
             continue;
         }
         $i++;
         $this->tokens[$i] = $tokenizer->value;
         $this->tokens[$i]->id = $i;
         //print_r($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]);
     }
     //echo "BUILT TOKENS";
 }
Example #18
0
 /**
  *
  * Assign a token by reference.  This allows you change variable
  * values within the template and have those changes reflected back
  * at the calling logic script.  Works as with form 2 of assign().
  *
  * @access public
  *
  * @param string $name The template token-name for the reference.
  *
  * @param mixed &$ref The variable passed by-reference.
  *
  * @return bool|PEAR_Error Boolean true on success, or a PEAR_Error
  * on failure.
  *
  * @throws SAVANT_ERROR_ASSIGN_REF Unknown reason for error.
  *
  * @see assign()
  * @author Paul M. Jones <*****@*****.**>
  * @see assignObject()
  *
  */
 function assignRef($name, &$ref)
 {
     // look for the proper case: name and variable
     if (is_string($name) && isset($ref)) {
         if (isset($this->variables[$name])) {
             unset($this->variables[$name]);
         }
         //
         // assign the token as a reference
         $this->references[$name] =& $ref;
         // done!
         return true;
     }
     // final error catch
     return HTML_Template_Flexy::raiseError("invalid type sent to assignRef, " . print_r($name, true), HTML_TEMPLATE_FLEXY_ASSIGN_ERROR_INVALIDARGS);
 }
Example #19
0
function ic2_display($path, $params)
{
    global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
    if (P2_OS_WINDOWS) {
        $path = str_replace('\\', '/', $path);
    }
    if (strncmp($path, '/', 1) == 0) {
        $s = empty($_SERVER['HTTPS']) ? '' : 's';
        $to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
    } else {
        $dir = dirname(P2Util::getMyUrl());
        if (strncasecmp($path, './', 2) == 0) {
            $to = $dir . substr($path, 1);
        } elseif (strncasecmp($path, '../', 3) == 0) {
            $to = dirname($dir) . substr($path, 2);
        } else {
            $to = $dir . '/' . $path;
        }
    }
    $name = basename($path);
    $ext = strrchr($name, '.');
    switch ($redirect) {
        case 1:
            header("Location: {$to}");
            exit;
        case 2:
            switch ($ext) {
                case '.jpg':
                    header("Content-Type: image/jpeg; name=\"{$name}\"");
                    break;
                case '.png':
                    header("Content-Type: image/png; name=\"{$name}\"");
                    break;
                case '.gif':
                    header("Content-Type: image/gif; name=\"{$name}\"");
                    break;
                default:
                    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
                        header("Content-Type: application/octetstream; name=\"{$name}\"");
                    } else {
                        header("Content-Type: application/octet-stream; name=\"{$name}\"");
                    }
            }
            header("Content-Disposition: inline; filename=\"{$name}\"");
            header('Content-Length: ' . filesize($path));
            readfile($path);
            exit;
        default:
            if (!class_exists('HTML_Template_Flexy', false)) {
                require 'HTML/Template/Flexy.php';
            }
            if (!class_exists('HTML_QuickForm', false)) {
                require 'HTML/QuickForm.php';
            }
            if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
                require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
            }
            if (isset($uri)) {
                $img_o = 'uri';
                $img_p = $uri;
            } elseif (isset($id)) {
                $img_o = 'id';
                $img_p = $id;
            } else {
                $img_o = 'file';
                $img_p = $file;
            }
            $img_q = $img_o . '=' . rawurlencode($img_p);
            // QuickFormの初期化
            $_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
            $_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
            $_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
            $mobile = Net_UserAgent_Mobile::singleton();
            $qa = 'size=3 maxlength=3';
            if ($mobile->isDoCoMo()) {
                $qa .= ' istyle=4';
            } elseif ($mobile->isEZweb()) {
                $qa .= ' format=*N';
            } elseif ($mobile->isSoftBank()) {
                $qa .= ' mode=numeric';
            }
            $_presets = array('' => 'サイズ・品質');
            foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
                $_presets[$_preset_name] = $_preset_name;
            }
            $qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
            $qf->setConstants($_constants);
            $qf->setDefaults($_defaults);
            $qf->addElement('hidden', 't');
            $qf->addElement('hidden', 'u');
            $qf->addElement('hidden', 'v');
            $qf->addElement('text', 'x', '高さ', $qa);
            $qf->addElement('text', 'y', '横幅', $qa);
            $qf->addElement('text', 'q', '品質', $qa);
            $qf->addElement('select', 'p', 'プリセット', $_presets);
            $qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
            $qf->addElement('checkbox', 'w', 'トリム');
            $qf->addElement('checkbox', 'z', 'DL');
            $qf->addElement('submit', 's');
            $qf->addElement('submit', 'o');
            // FlexyとQurickForm_Rendererの初期化
            $_flexy_options = array('locale' => 'ja', 'charset' => 'cp932', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
            $flexy = new HTML_Template_Flexy($_flexy_options);
            $rdr = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
            $qf->accept($rdr);
            // 表示
            $flexy->setData('p2vid', P2_VERSION_ID);
            $flexy->setData('title', 'IC2::Cached');
            $flexy->setData('pc', !$_conf['ktai']);
            $flexy->setData('iphone', $_conf['iphone']);
            if (!$_conf['ktai']) {
                $flexy->setData('skin', $GLOBALS['skin_name']);
                //$flexy->setData('stylesheets', array('css'));
                //$flexy->setData('javascripts', array('js'));
            } else {
                $flexy->setData('k_color', array('c_bgcolor' => !empty($_conf['mobile.background_color']) ? $_conf['mobile.background_color'] : '#ffffff', 'c_text' => !empty($_conf['mobile.text_color']) ? $_conf['mobile.text_color'] : '#000000', 'c_link' => !empty($_conf['mobile.link_color']) ? $_conf['mobile.link_color'] : '#0000ff', 'c_vlink' => !empty($_conf['mobile.vlink_color']) ? $_conf['mobile.vlink_color'] : '#9900ff'));
            }
            $rank = isset($params['rank']) ? $params['rank'] : 0;
            if ($_conf['iphone']) {
                $img_dir = 'img/iphone/';
                $img_ext = '.png';
            } else {
                $img_dir = 'img/';
                $img_ext = $_conf['ktai'] ? '.gif' : '.png';
            }
            $stars = array();
            $stars[-1] = $img_dir . ($rank == -1 ? 'sn1' : 'sn0') . $img_ext;
            //$stars[0] = $img_dir . (($rank ==  0) ? 'sz1' : 'sz0') . $img_ext;
            $stars[0] = $img_dir . ($_conf['iphone'] ? 'sz0' : 'sz1') . $img_ext;
            for ($i = 1; $i <= 5; $i++) {
                $stars[$i] = $img_dir . ($rank >= $i ? 's1' : 's0') . $img_ext;
            }
            $k_at_a = str_replace('&amp;', '&', $_conf['k_at_a']);
            $setrank_url = "ic2.php?{$img_q}&t={$thumb}&r=0{$k_at_a}";
            $flexy->setData('stars', $stars);
            $flexy->setData('params', $params);
            if ($thumb == 2 && $rank >= 0) {
                if ($ini['General']['inline'] == 1) {
                    $t = 2;
                    $link = null;
                } else {
                    $t = 1;
                    $link = $path;
                }
                $r = $ini['General']['redirect'] == 1 ? 1 : 2;
                $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}";
                $flexy->setData('preview', $preview);
                $flexy->setData('link', $link);
                $flexy->setData('info', null);
            } else {
                $flexy->setData('preview', null);
                $flexy->setData('link', $path);
                $flexy->setData('info', null);
            }
            if (!$_conf['ktai'] || $_conf['iphone']) {
                $flexy->setData('backto', null);
            } elseif (isset($_REQUEST['from'])) {
                $flexy->setData('backto', $_REQUEST['from']);
                $setrank_url .= '&from=' . rawurlencode($_REQUEST['from']);
            } elseif (isset($_SERVER['HTTP_REFERER'])) {
                $flexy->setData('backto', $_SERVER['HTTP_REFERER']);
            } else {
                $flexy->setData('backto', null);
            }
            $flexy->setData('stars', $stars);
            $flexy->setData('sertank', $setrank_url . '&rank=');
            if ($_conf['iphone']) {
                $_conf['extra_headers_ht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}">
EOP;
                $_conf['extra_headers_xht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}" />
EOP;
            }
            $flexy->setData('edit', extension_loaded('gd') && $rank >= 0);
            $flexy->setData('form', $rdr->toObject());
            $flexy->setData('doctype', $_conf['doctype']);
            $flexy->setData('extra_headers', $_conf['extra_headers_ht']);
            $flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
            $flexy->compile('preview.tpl.html');
            P2Util::header_nocache();
            $flexy->output();
    }
    exit;
}
Example #20
0
 function display()
 {
     $output = new HTML_Template_Flexy(array('templateDir' => MAX_PATH . '/lib/max/Admin/Inventory/themes', 'compileDir' => MAX_PATH . '/var/templates_compiled', 'flexyIgnore' => true));
     $codes = $this->codes;
     $this->codes = array();
     if (is_array($codes)) {
         foreach ($codes as $v) {
             $k = count($this->codes);
             $v['id'] = "tag_{$k}";
             $v['name'] = "tag[{$k}]";
             $v['autotrackname'] = "autotrack[{$k}]";
             $v['autotrack'] = isset($v['autotrack']) ? $v['autotrack'] : false;
             $v['rank'] = $k + 1;
             $v['move_up'] = $k > 0;
             $v['move_down'] = $k < count($codes) - 1;
             $this->codes[] = $v;
         }
     }
     // Display page content
     $output->compile('TrackerAppend.html');
     $output->outputObject($this);
 }
Example #21
0
function getInputWidget($key, $value = "", $type = "text")
{
    global $sql;
    $retval = '';
    preg_match('/[a-zA-Z]+/', $type, $matches);
    preg_match('/\\[[_\\|\\=a-zA-Z0-9]+\\]/', $type, $options);
    if ($options) {
        $options = str_replace(array('[', ']'), '', $options[0]);
        $tmp = explode("|", $options);
        unset($options);
        foreach ($tmp as $v) {
            $tmp = explode("=", $v);
            $options[$tmp[1]] = $tmp[0];
        }
    }
    switch ($matches[0]) {
        case 'radio':
            foreach ($options as $k => $v) {
                if ($k != '_bootstrap') {
                    $retval .= "<label class='radio inline'>";
                    if ($k == $value) {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}' checked='checked'>{$v}";
                    } else {
                        $retval .= "<input type='radio' name='{$key}' value='{$k}'>{$v}";
                    }
                    $retval .= "</label>";
                }
            }
            break;
        case 'dbcombobox':
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $retval .= "<select name='{$key}' value='{$value}'>";
            $query = "SELECT * FROM " . $ref['TABLE'] . ";";
            $result = $sql->con->query($query);
            while ($row = $result->fetch_assoc()) {
                if ($value == $row[$ref['INDEX']]) {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "' selected>" . $row[$ref['LABEL']] . "</option>";
                } else {
                    $retval .= "\t<option value='" . $row[$ref['INDEX']] . "'>" . $row[$ref['LABEL']] . "</option>";
                }
            }
            $retval .= "</select>";
            break;
        case 'textarea':
            if ($options) {
                foreach ($options as $k => $v) {
                    $configs[$v] = $k;
                }
                $cols = $configs['cols'];
                $rows = $configs['rows'];
                $retval .= "<textarea name='{$key}' cols='{$cols}' rows='{$rows}'>";
            } else {
                $retval .= "<textarea name='{$key}'>";
            }
            $retval .= "{$value}</textarea>";
            break;
        case 'tinyMCE':
            $retval = "<textarea id='{$key}' name='{$key}'>{$value}</textarea>";
            $retval .= "<script src=\"//tinymce.cachefly.net/4.1/tinymce.min.js\"></script>";
            $retval .= "<script>tinymce.init({selector:'#{$key}'});</script>";
            break;
        case 'file':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/{$value}\" alt=\"Preview\">";
            }
            $retval .= "<input type='{$type}' name='" . $key . "_file' value='{$value}' onchange='previewImage(this)' width='200'>";
            $retval .= "<input type='hidden' name='{$key}' value='{$value}'>";
            break;
        case 'multifile':
            include_once "HTML/Template/Flexy.php";
            $options = array('templateDir' => "inputWidgets/templates", 'compileDir' => "inputWidgets/templates");
            $obj = new stdClass();
            $obj->KEY = $key;
            $obj->JAVASCRIPT = "<script>var key = '" . $key . "'</script>";
            $tmp = unserialize($value);
            if (is_array($tmp)) {
                foreach ($tmp as $tk => $tv) {
                    $obj->FILAS[]['nombre'] = $tv;
                }
            }
            $output = new HTML_Template_Flexy($options);
            $output->compile('multifile.html');
            $retval = $output->bufferedOutputObject($obj);
            break;
        default:
            $retval = "<input type='{$type}' name='{$key}' value='{$value}'>";
            break;
    }
    return $retval;
}
            foreach ($options as $k => $v) {
                $ref[$v] = $k;
            }
            $query = "SELECT * FROM " . $ref['TABLE'] . " WHERE " . $ref['INDEX'] . "='" . $value . "';";
            $cursor = $sql->query($query);
            while ($row = $cursor->fetch_assoc()) {
                $retval = $row[$ref['LABEL']];
            }
            break;
        case 'thumb':
            if (empty($value)) {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/NoDisponible.jpg\" alt=\"Preview\">";
            } else {
                $retval = "<img class=\"thumbnail\" src=\"/thumbnailer/100/100/crop/{$value}\" alt=\"Preview\">";
            }
            break;
        default:
            $retval = $value;
            break;
    }
    //*/
    return $retval;
}
$bread[count($bread) - 1]['active'] = true;
$bread[count($bread) - 1]['link'] = false;
$tpl->BREAD = $bread;
$options = array('templateDir' => 'templates', 'compileDir' => 'tmp');
$output = new HTML_Template_Flexy($options);
$output->compile("platos.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
Example #23
0
 /**
  * Lazy loading of PEAR, and the error handler..
  * This should load HTML_Template_Flexy_Error really..
  * 
  * @param   string message
  * @param   int      error type.
  * @param   int      an equivalant to pear error return|die etc.
  *
  * @return   object      pear error.
  * @access   public
  */
 function raiseError($message, $type = null, $fatal = HTML_TEMPLATE_FLEXY_ERROR_RETURN)
 {
     HTML_Template_Flexy::debug("<B>HTML_Template_Flexy::raiseError</B>{$message}");
     require_once 'PEAR.php';
     if (HTML_Template_Flexy_is_a($this, 'HTML_Template_Flexy') && $fatal == HTML_TEMPLATE_FLEXY_ERROR_DIE) {
         // rewrite DIE!
         return PEAR::raiseError($message, $type, $this->options['fatalError']);
     }
     if (isset($GLOBALS['_HTML_TEMPLATE_FLEXY']['fatalError']) && $fatal == HTML_TEMPLATE_FLEXY_ERROR_DIE) {
         return PEAR::raiseError($message, $type, $GLOBALS['_HTML_TEMPLATE_FLEXY']['fatalError']);
     }
     return PEAR::raiseError($message, $type, $fatal);
 }
Example #24
0
 /**
  * do the stack lookup on the variable
  * this relates to flexy
  * t relates to the object being parsed.
  *
  * @return  string PHP variable 
  * @access   public
  */
 function findVar($string)
 {
     global $_HTML_TEMPLATE_FLEXY_TOKEN;
     if (!$string || $string == 't') {
         return '$t';
     }
     if ($string == 'this') {
         return '$this';
     }
     // accept global access on some string
     if (@$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['globals'] && preg_match('/^(_POST|_GET|_REQUEST|_SESSION|_COOKIE|GLOBALS)\\[/', $string)) {
         return '$' . $string;
     }
     if (!@$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['privates'] && $string[0] == '_') {
         return HTML_Template_Flexy::raiseError('HTML_Template_Flexy::Attempt to access private variable:' . " on line {$this->line} of {$GLOBALS['_HTML_TEMPLATE_FLEXY']['filename']}" . ", Use options[privates] to allow this.", HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
     }
     $lookup = $string;
     if ($p = strpos($string, '[')) {
         $lookup = substr($string, 0, $p);
     }
     for ($s = $_HTML_TEMPLATE_FLEXY_TOKEN['state']; $s > 0; $s--) {
         if (in_array($lookup, $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s])) {
             return '$' . $string;
         }
     }
     return '$t->' . $string;
 }
Example #25
0
 /**
  * setErrors - sets the suffix of an element to a value..
  *  
  * HTML_Element_Factory::setErrors($elements,array('name','not long enough'));
  *
  * @depreciated  - this is really outside the scope of Factory - it should be 
  *                   seperated into a rendering toolkit of some kind.
  * @param   array    of HTML_Element's
  * @param    array   key(tag name) => error
  * @param    string sprintf error format..
  *
  * @return   array    Array of HTML_Elements 
  * @access   public
  */
 function &setErrors(&$ret, $set, $format = '<span class="error">%s</span>')
 {
     if (empty($ret) || !is_array($ret)) {
         $ret = array();
     }
     // check what you send this.. !!!
     if (!is_array($set)) {
         return HTML_Template_Flexy::raiseError('invalid arguments "$set" (should be an array) sent to HTML_Template_Flexy_Factory::setErrors', 0, HTML_TEMPLATE_FLEXY_ERROR_DIE);
     }
     foreach ($set as $k => $v) {
         if (!$v) {
             continue;
         }
         if (!isset($ret[$k])) {
             $ret[$k] = new HTML_Template_Flexy_Element();
         }
         $ret[$k]->suffix .= sprintf($format, $v);
     }
     return $ret;
 }
Example #26
0
 /**
  * output the default template with the editing facilities.
  * 
  * @return   none
  * @access   public
  */
 function outputDefaultTemplate()
 {
     $o = array('compileDir' => ini_get('session.save_path') . '/HTML_Template_Flexy_Translate', 'templateDir' => dirname(__FILE__) . '/templates');
     $x = new HTML_Template_Flexy($o);
     $x->compile('translator.html');
     $x->outputObject($this);
 }
Example #27
0
 /**
  * reWriteURL - can using the config option 'url_rewrite'
  *  format "from:to,from:to"
  * only handle left rewrite. 
  * so 
  *  "/images:/myroot/images"
  * would change
  *   /images/xyz.gif to /myroot/images/xyz.gif
  *   /images/stylesheet/imagestyles.css to  /myroot/images/stylesheet/imagestyles.css
  *   note /imagestyles did not get altered.
  * will only work on strings (forget about doing /images/{someimage}
  *
  *
  * @param    string attribute to rewrite
  * @return   none
  * @access   public
  */
 function reWriteURL($which)
 {
     global $_HTML_TEMPLATE_FLEXY;
     if (!is_string($original = $this->element->getAttribute($which))) {
         return;
     }
     if ($original == '') {
         return;
     }
     if (empty($_HTML_TEMPLATE_FLEXY['currentOptions']['url_rewrite'])) {
         return;
     }
     $bits = explode(",", $_HTML_TEMPLATE_FLEXY['currentOptions']['url_rewrite']);
     $new = $original;
     foreach ($bits as $bit) {
         if (!strlen(trim($bit))) {
             continue;
         }
         $parts = explode(':', $bit);
         if (!isset($parts[1])) {
             return HTML_Template_Flexy::raiseError('HTML_Template_Flexy: url_rewrite syntax incorrect' . print_r(array($bits, $bits), true), null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
         }
         $new = preg_replace('#^' . $parts[0] . '#', $parts[1], $new);
     }
     if ($original == $new) {
         return;
     }
     $this->element->ucAttributes[$which] = '"' . $new . '"';
 }
Example #28
0
File: Tag.php Project: q32p/emst
 /**
  * calls HTML_Template_Flexy::raiseError() with the current file, line and tag
  * @param    string  Message to display
  * @param    type   (see HTML_Template_Flexy::raiseError())
  * @param    boolean  isFatal.
  * 
  * @access   private
  */
 function _raiseErrorWithPositionAndTag($message, $type = null, $fatal = HTML_TEMPLATE_FLEXY_ERROR_RETURN)
 {
     global $_HTML_TEMPLATE_FLEXY;
     $message = "Error:{$_HTML_TEMPLATE_FLEXY['filename']} on Line {$this->element->line}" . " in Tag &lt;{$this->element->tag}&gt;:<BR>\n" . $message;
     return HTML_Template_Flexy::staticRaiseError($message, $type, $fatal);
 }
Example #29
0
 /**
  * XXX: why does it use Flexy when all other stuff here does not depend on it?
  */
 function outputStyle()
 {
     ob_start();
     HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this);
     $ret = ob_get_contents();
     ob_end_clean();
     return $ret;
 }
        $cursor = $sql->con->query($q = "SELECT * FROM INSUMOS_PLATO LEFT JOIN INSUMO_LOCAL ON INSUMO__ILC=INSUMO__IPL WHERE PLATO___IPL='{$plato}' AND LOCAL___ILC='{$local}'");
        if ($cursor && $cursor->num_rows > 0) {
            while ($row = $cursor->fetch_assoc()) {
                $upData = array("INSUMO__ILC" => $row['INSUMO__ILC'], "CANTIDADILC" => (int) $row['CANTIDADILC'] - (int) $row['CANTIDADIPL']);
                $sql->updateDB("INSUMO_LOCAL", $upData, "ID______ILC='" . $row['ID______ILC'] . "'");
            }
        }
        header('Location: cola-pedidos');
    }
}
if (isset($_REQUEST['cancelar'])) {
    $detalle_pedido = $sql->con->real_escape_string($_REQUEST['cancelar']);
    $data = array("ESTADO__DEP" => 'P');
    if (!$sql->updateDB("DETALLE_PEDIDO", $data, "ID______DEP='" . $detalle_pedido . "'")) {
    } else {
        header('Location: cola-pedidos');
    }
}
$cursor = $sql->con->query("SELECT * FROM DETALLE_PEDIDO LEFT JOIN PLATO ON PLATO___DEP=CODIGO__PLA LEFT JOIN PEDIDO ON PEDIDO__DEP=NUMERO__PED WHERE PEDIDO__DEP IN (SELECT NUMERO__PED FROM PEDIDO WHERE RESERVA_PED IN (SELECT CODIGO__RES FROM RESERVA WHERE MESA____RES IN (SELECT ID______MES FROM MESA WHERE LOCAL___MES='" . $local . "'))) AND (ESTADO__DEP='P' OR ESTADO__DEP='L' OR ESTADO__DEP='D')");
if ($cursor && $cursor->num_rows > 0) {
    while ($row = $cursor->fetch_assoc()) {
        if ($row['ESTADO__PED'] < 6 && $row['ESTADO__DEP'] != 'L') {
            $tpl->pendiente[] = $row;
        }
    }
}
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("cola-pedidos.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";