Example #1
0
 public function check_authentification()
 {
     // begin authenticate part
     if (AUTH_TYPE == 1) {
         if (!$AUTHENTICATE) {
             header("WWW-Authenticate: Basic realm=\"ADMIN " . CONF_SITE_NAME . "\"");
             header("HTTP/1.0 401 Unauthorized");
             $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH);
             $ft->define(array("main" => "template_firstpage.html", "content" => "authentication_failed.html"));
             $ft->multiple_assign_define("LANG_");
             $ft->multiple_assign_define("CONF_");
             $ft->parse("BODY", array("content", "main"));
             $ft->showDebugInfo(ERROR_DEBUG);
             $ft->FastPrint();
             exit;
         }
     } else {
         if (AUTH_TYPE == 2) {
             include_once INCLUDE_PATH . 'cls_session.php';
             $sess = new MYSession();
             if (!$sess->get(SESSION_ID)) {
                 $sess->set('session_url_before', $_SERVER['REQUEST_URI']);
                 header("Location: login.php");
                 exit;
             }
         }
     }
     // end authenticate part
 }
Example #2
0
function ShowProduct($id_product)
{
    $objResponse = new xajaxResponse();
    $bError = false;
    $stringutil = new String("");
    $tempname = "en_title";
    $tempdescription = "en_detaileddescription";
    $SQL = "SELECT {$tempname},{$tempdescription} FROM " . DB_PREFIX . "product WHERE id_product='" . $id_product . "'";
    //$objResponse->addAlert($SQL);
    $retid = mysql_query($SQL);
    if (!$retid) {
        echo mysql_error();
    }
    if ($row = mysql_fetch_array($retid)) {
        $name = $row[$tempname];
        $description = $stringutil->cleanDescription2($row[$tempdescription]);
    }
    $ft = new FastTemplate(TEMPLATE_PATH);
    $ft->define(array("main" => "product_rightmenu.html"));
    $ft->assign("NAME", $name);
    //if (NONSEO==1) $ft->assign("URL_TYPE", "product.php?name=".$stringutil->CleanLink($name)."&id=".$id_product."");
    //else $ft->assign("URL_TYPE", "product.php/".$stringutil->CleanLink($name)."/".$id_product."/");
    $ft->assign("DESCRIPTION", $description);
    $ft->multiple_assign_define("LANG_");
    $ft->parse("mainContent", "main");
    $ft->showDebugInfo(ERROR_DEBUG);
    $c = $ft->fetch("mainContent");
    //$objResponse->addAlert($c);
    $objResponse->addAssign("body_firstpage_background_right", "innerHTML", $c);
    return $objResponse;
}
Example #3
0
    } else {
        $ft->assign("SAVED_MSG", 0);
    }
    if (strpos($files_array[$template_name], ".bak") === false) {
        $ft->assign("BAK_FILE", 0);
    } else {
        $ft->assign("BAK_FILE", 1);
    }
    $ft->assign("TEMPLATE_NAMES", $buffer);
    $ft->assign("TEMPLATE_NAME", $files_array[$template_name]);
    $ft->assign("TEMPLATE_DESCRIPTION", $temp_source);
    $ft->multiple_assign_define("LANG_");
    $ft->multiple_assign_define("CONF_");
    $ft->assign("SIDEBAR", $sb->getSideBar());
    $ft->parse("BODY", array("content", "main"));
    $ft->showDebugInfo(ERROR_DEBUG);
    $ft->FastPrint();
} else {
    $template_name = $all_url_vars["t_name"];
    $template_source = $_REQUEST["template_source"];
    $template_source = str_replace("#_", "{", $template_source);
    $template_source = str_replace("_#", "}", $template_source);
    $template_source = str_replace("textarea#", "textarea", $template_source);
    $template_source = str_replace("BDYB", "BEGIN DYNAMIC BLOCK", $template_source);
    $template_source = str_replace("EDYB", "END DYNAMIC BLOCK", $template_source);
    $template_source = html_entity_decode($template_source);
    rename(INDEX_PATH . $template_name, INDEX_PATH . $template_name . ".bak");
    $outputfile = INDEX_PATH . $template_name;
    if (!empty($template_source)) {
        $fp = fopen($outputfile, "w+");
        if (!fwrite($fp, $template_source)) {
Example #4
0
<?php

// Example FastTemplate Demo #1 - The example from the man page
// $Id: example_1.php,v 1.5 2006/02/14 12:27:33 paul Exp $
Header("Content-type: text/html");
include "cls_fast_template.php";
$ft = new FastTemplate("./templates");
$ft->php_in_html(true);
$ft->REWRITE_SRC_PATH = "www.google.com/";
$time1 = $ft->utime();
$ft->define(array('main' => "main.html", 'table' => "table.html", 'row' => "row.html"));
$ft->assign(array("TITLE" => "FastTemplate Test"));
for ($n = 1; $n <= 3; $n++) {
    $Number = $n;
    $BigNum = $n * 10;
    $ft->assign(array('NUMBER' => $Number, 'BIG_NUMBER' => $BigNum));
    $ft->parse("ROWS", ".row");
}
$ft->showDebugInfo(1);
$ft->parse("MAIN", array("table", "main"));
print $ft->utime() - $time1 . "\n";
$ft->FastPrint();
exit;
Example #5
0
<?php

// $ID$
//  Example FastTemplate demo #2: Build a linear web page. (top down)
//  Check your error_log when this is done - this demo has unresolved
//  variables defined in footer.html. (On purpose of course :)
// Header("Content-type: text/plain");  // If you want to see the
// raw html in your browser,
// uncomment this.
include "cls_fast_template.php";
$ft = new FastTemplate("./templates");
$start = $ft->utime();
// Benchmarking
$ft->define(array('header' => "header.html", 'body' => "middle.html", 'footer' => "footer.html"));
$ft->assign(array('TITLE' => "FastTemplate Demo2", 'HEAD1' => "FastTemplate Page Demo", 'TD1' => "Column 1", 'TD2' => "Column 2", 'TD3' => "Cool Stuff", 'TD4' => '<BLINK>Cooler Stuff</BLINK>', 'MAILTO' => '*****@*****.**', 'LINK' => 'www.thewebmasters.net/php/', 'LINKNAME' => 'The WebMasters Net'));
$ft->parse('HEAD', "header");
$ft->parse('BODY', "body");
$ft->parse('FOOT', "footer");
// $ft->clear(array("HEAD","BODY"));   // Uncomment this to see how
// the class handles errors
$ft->showDebugInfo(2);
$ft->FastPrint("HEAD");
$ft->FastPrint("BODY");
$ft->FastPrint("FOOT");
$end = $ft->utime();
$runtime = ($end - $start) * 1000;
echo "Completed in {$runtime} seconds<BR>\n";
exit;
Example #6
0
<?php

/** $Id: ifelse.php,v 1.2 2005/06/15 19:37:15 vadim Exp $
 * Example of using new features in FastTemplate
 * start: Mon Jan 17 23:21:10 EET 2005 @931 /Internet Time/
 * @author Voituk Vadim <voituk###asg.kiev.ua>
 */
require_once 'cls_fast_template.php';
$Template = new FastTemplate('./templates');
// You can use array or 2 strings as this function parameters
//$Template->define(array('main', 'ifelse.html'));
$Template->define('main', 'ifelse.html');
$Template->define_dynamic('dn_test', 'main');
$Template->assign(array('USER_NAME' => $_REQUEST['name'], 'USER_SURNAME' => $_REQUEST['surname']));
for ($i = 1; $i < 6; ++$i) {
    $Template->assign(array('NUMBER' => $i, 'is_li_selected' => $_REQUEST['number'] == $i ? 'true' : ''));
    $Template->parse('TMP', '.dn_test');
}
$Template->showDebugInfo(1);
print $Template->parse_and_return('main');
//<---- New method too