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 }
function displaySettings() { $tpl = new FastTemplate("templates/"); $tpl->define(array("web_main" => "web_main.html", "web_header" => "web_header.html", "head_script" => "settings/head_script.html", "profile" => "settings/profile.html", "department" => "settings/department.html", "department_option" => "settings/department_option.html", "authority" => "settings/authority.html", "body" => "settings/body.html", "web_nav" => "web_nav.html", "web_footer" => "web_footer.html")); $userDAO = new UserDAO(); $user = $userDAO->getUserByID($_SESSION["userID"]); //display profile displayProfile($user, $tpl); //display group displayGroup($user, $tpl); $role = $user->getRole(); if ($role->getRoleID() == "1" || $role->getRoleID() == "2") { //display user displayUser($user, $tpl); desplayDepartment($user, $tpl); //display record displayRecord($user, $tpl); $tpl->parse("SETTINGS_AUTHORITY", "authority"); } else { $tpl->assign("SETTINGS_DEPARTMENT", ""); $tpl->assign("SETTINGS_USER", ""); $tpl->assign("SETTINGS_RECORD", ""); $tpl->assign("SETTINGS_AUTHORITY", ""); } $tpl->assign("TITLE", "My Profile"); $tpl->parse("WEB_HEADER", "web_header"); $tpl->parse("HEAD_SCRIPT", "head_script"); $tpl->parse("WEB_NAV", "web_nav"); $tpl->parse("SETTINGS_PROFILE", "profile"); $tpl->parse("BODY", ".body"); $tpl->parse("WEB_FOOTER", "web_footer"); $tpl->parse("MAIN", "web_main"); $tpl->FastPrint(); }
/** * Fills template with headers and cells array * @param $headers - array of column headers * @param $cells - array of cell values * @param $caption - caption of table * @param $rows - number of rows * @param $cols - caption of columns */ function fillTable($headers, $cells, $caption, $rows, $cols) { // initializing of fasttemplate $ft = new FastTemplate("./templates/"); $ft->define(array('table' => "flextable.html")); $ft->define_dynamic("header", "table"); $ft->define_dynamic("rows", "table"); $ft->define_dynamic("cols", "table"); //handling headers (column names) foreach ($headers as $head) { $ft->assign(array('header' => $head)); $ft->parse('HEADERS', ".header"); } // handling cells foreach ($cells as $row) { foreach ($row as $cell) { $ft->assign(array('cellvalue' => $cell)); $ft->parse('COLS', ".cols"); } $ft->parse('ROWS', ".rows"); $ft->clear("COLS"); } $ft->assign("caption", $caption); $ft->assign("rows", $rows); $ft->assign("cols", $cols); $ft->parse('MAIN', "table"); $ft->FastPrint('MAIN'); }
function displayDepartUser($departID, $userID) { $tpl = new FastTemplate("templates/"); $tpl->define(array("user" => "index/user.html", "department" => "index/department.html", "depart_user" => "index/depart_user.html", "header" => "index/header.html")); $departDAO = new DepartmentDAO(); $depart = $departDAO->getDepartmentByID($departID); if ($departID == "1" || $depart === null) { $tpl->assign("INDEX_DEPART_USER_HEADER", ""); } else { $tpl->assign("INDEX_HEADER_NAME", $depart->getDepartmentName()); $tpl->parse("INDEX_DEPART_USER_HEADER", "header"); } $result = findDepartAndUser($departID, $userID); if ($result === false || count($result) === 0) { $tpl->assign("INDEX_DEPART_USER", ""); } else { foreach ($result as $node) { if ($node["type"] == 1) { $tpl->assign("INDEX_DEPARTID", $node["id"]); $tpl->assign("INDEX_DEPART_NAME", $node["name"]); $tpl->parse("INDEX_DEPART_USER", ".department"); } elseif ($node["type"] == 2) { $tpl->assign("INDEX_USERID", $node["id"]); $tpl->assign("INDEX_USER_NAME", $node["name"]); $tpl->parse("INDEX_DEPART_USER", ".user"); } } } $tpl->parse("MAIN", "depart_user"); $tpl->FastPrint(); }
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; }
function displaySignup() { $tpl = new FastTemplate("templates/"); $tpl->define(array("web_main" => "web_main.html", "web_header" => "web_header.html", "head_script" => "signup/head_script.html", "body" => "signup/body.html", "web_footer" => "web_footer.html")); $tpl->assign("TITLE", "Sign Up"); $tpl->parse("WEB_HEADER", "web_header"); $tpl->parse("HEAD_SCRIPT", "head_script"); $tpl->parse("BODY", ".body"); $tpl->parse("WEB_FOOTER", "web_footer"); $tpl->parse("MAIN", "web_main"); $tpl->FastPrint(); }
function displayLogin($message = null) { $tpl = new FastTemplate("templates/"); $tpl->define(array("web_main" => "web_main.html", "web_header" => "web_header.html", "head_script" => "login/head_script.html", "message" => "login/message.html", "body" => "login/body.html", "web_footer" => "web_footer.html")); if ($message != null) { $tpl->assign("LOGIN_MESSAGE", $message); $tpl->parse("LOGIN_INFO", "message"); } else { $tpl->assign("LOGIN_INFO", ""); } $tpl->assign("TITLE", "Login"); $tpl->parse("WEB_HEADER", "web_header"); $tpl->parse("HEAD_SCRIPT", "head_script"); $tpl->parse("BODY", ".body"); $tpl->parse("WEB_FOOTER", "web_footer"); $tpl->parse("MAIN", "web_main"); $tpl->FastPrint(); }
<?php # 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. $titel = $TITEL_PREFIX . "IP Clients"; # 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. $mainnr = 2; $template = new FastTemplate("."); # dem erstellten Template-Objekt eine Vorlage zuweisen $definedTemplates = array("Vorlage" => "../frame.dwt", "Login" => "../logout_form.inc.dwt", "Mmenu" => "../hauptmenue.dwt", "Menu" => "menu.dwt", "IPBlocks" => "../common/ipblocks.dwt", "Webseite" => $webseite); if (isset($additionalTemplates)) { foreach ($additionalTemplates as $templateKey => $templateFile) { $definedTemplates[$templateKey] = $templateFile; } } $template->define($definedTemplates); $template->assign(array("SEITENTITEL" => $titel, "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); include "computers_menu.php"; include "../common/ip_blocks.inc.php";
<?php session_start(); error_reporting(E_ALL ^ E_WARNING); include_once '../commons.php'; include 'checkResultOperation.php'; header('Cache-control: private, must-revalidate'); //support page back $template = new FastTemplate("../../view/html/templates/reciteWord"); $template->define(array("main" => "checkResult.html", "ol" => "ol.html", "li" => "li.html")); $template->assign("OL", ""); $template->assign("ACCURANCY", ""); $template->assign("USER_NAME", $_SESSION['username']); $template->assign("USER_IMG", $_SESSION['userimg']); $template->assign("USER_ID", $_SESSION['userID']); if (isset($_POST["checkAns"])) { $class = $_SESSION['class']; //echo "class = ".$class; $userID = $_SESSION['userID']; $trueNo = showTrueIDs($userID, $class); //echo "<BR> trueNo = ".$trueNo; $template->clear("OL"); $wrongNo = showWrongIDs($userID, $class); //echo "<BR> wrongNo = ".$wrongNo; $acc = intval($trueNo / ($trueNo + $wrongNo) * 100); $template->assign("ACCURANCY", $acc . "%"); saveAcc($userID, $acc); } $template->parse("CONTENT", "main"); $template->FastPrint();
$dbh = initdb($sql_host, $sql_user, $sql_pass, $sql_db); // get last day with statistic data debug(10, "getting last day with statistic data"); $result = @mysql_query("SELECT DISTINCT sdate FROM essential " . "ORDER BY sdate DESC LIMIT 0,1", $dbh) or die("SQL error: get date from esential"); $row = mysql_fetch_row($result); $currdate = $row[0]; $tplt2 = new FastTemplate("./templates/"); $tplt3 = new FastTemplate("./templates/"); $tplp2 = new FastTemplate("./templates/"); $tplp3 = new FastTemplate("./templates/"); $tplp4 = new FastTemplate("./templates/"); $tplt2->define(array("level2byteam" => "level2byteam.tpl")); $tplt3->define(array("level3byteam" => "level3byteam.tpl")); $tplp2->define(array("level2bypackage" => "level2bypackage.tpl")); $tplp3->define(array("level3bypackage" => "level3bypackage.tpl")); $tplp4->define(array("level2partial" => "level2partial.tpl")); $tplt2->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev)); $tplt3->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev)); $tplp2->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev)); $tplp3->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev)); $tplp4->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev)); // ************* DATA PROCESSING ************* debug(10, "getting team codes"); $m_teams = array(); $res = @mysql_query("SELECT teamcode,teamname FROM teams WHERE rev='{$rev}' ORDER BY teamcode", $dbh) or die("SQL error: teams\n"); while ($row = mysql_fetch_array($res)) { $m_teams[$row['teamcode']] = $row['teamname']; } debug(10, "getting packages"); $m_packages = array(); $res = @mysql_query("SELECT package FROM sum WHERE rev='{$rev}' GROUP BY package", $dbh) or die("SQL error: group by package\n");
<?php include_once "./config.inc.php"; include_once INCLUDE_PATH . "cls_fast_template.php"; include_once INCLUDE_PATH . "cls_string.php"; include_once INCLUDE_PATH . "cls_xml.php"; include_once INCLUDE_PATH . "cls_session.php"; $stringutil = new String(); $session = new MYSession(); $field_types = array("primary", "key", "index", "unique", "fulltext", "foreign", "check"); $all_url_vars = $stringutil->parse_all(); $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main" => "template_body.html", "content" => "generate.html")); if (!empty($all_url_vars['table'])) { $all_url_vars['table'] = $stringutil->changeBRtoEnter($all_url_vars['table']); $all_url_vars['table'] = strtolower($all_url_vars['table']); $tok = explode(",", $all_url_vars['table']); //print_r($tok); //print $stringutil->changeBRtoEnter($all_url_vars['table']); exit; $toknr = sizeof($tok); $fpos = strpos($tok[0], "("); $firsttok = substr($tok[0], 0, $fpos); $firsttok = strtolower($firsttok); $firsttok = str_replace(" ", "", $firsttok); $firsttok = str_replace("createtable", "", $firsttok); if ($firsttok[0] == "`") { $firsttok = substr($firsttok, 1, strlen($firsttok)); } if ($firsttok[strlen($firsttok) - 1] == "`") { $firsttok = substr($firsttok, 0, strlen($firsttok) - 1); }
define("PATH_TO_CLASSES", "administration/classes"); require PATH_TO_CLASSES . "/cls_db_mysql.php"; // dodawanie pliku konfigurujacego bibliotekê baz danych require PATH_TO_CLASSES . '/cls_fast_template.php'; require "administration/inc/config.php"; require "inc/common_lib.php"; require "inc/main_lib.php"; // mysql_server_version get_mysql_server_version(); $db = new DB_SQL(); $query = sprintf("\r\n SELECT \r\n b.*, a.id, a.title \r\n FROM \r\n %1\$s b \r\n LEFT JOIN \r\n %2\$s a \r\n ON \r\n b.comments_id = a.id \r\n GROUP BY \r\n date \r\n DESC \r\n LIMIT \r\n %3\$d", TABLE_COMMENTS, TABLE_MAIN, 10); $db->query($query); $rewrite = get_config('mod_rewrite'); $lang = get_config('language_set'); $ft = new FastTemplate('./templates/' . $lang . '/main/tpl/'); $ft->define('xml_feed', 'xml_feed.tpl'); $ft->define_dynamic('xml_row', 'xml_feed'); $http_root = get_httproot(); $ft->assign(array('MAINSITE_LINK' => 'http://' . $http_root, 'NEWS_FEED' => false)); if ($db->num_rows() > 0) { while ($db->next_record()) { $date = $db->f("date"); $title = $db->f("title"); $text = $db->f("text"); $author = $db->f("author"); $id = $db->f("id"); $image = $db->f("image"); $comments_allow = $db->f("comments_allow"); $comments = $db->f("comments"); $date = coreRssDateConvert($date); $pattern = array("&", "<br />", "<", ">");
$ft->assign('PERMS_USER', true); $ft->assign('PERMS_WRITER', true); $ft->assign('PERMS_MODERATOR', true); $ft->assign('PERMS_TPLEDITOR', true); break; case '31': $privilege_level = 5; $ft->assign('PERMS_USER', true); $ft->assign('PERMS_WRITER', true); $ft->assign('PERMS_MODERATOR', true); $ft->assign('PERMS_TPLEDITOR', true); $ft->assign('PERMS_ADMIN', true); break; } // tablica definicji u¿ytych plików *.tpl $ft->define(array('index' => 'index.tpl', 'main_loader' => 'main_loader.tpl', 'result_note' => 'result_note.tpl')); $ft->assign(array('PRIVILEGE_LEVEL' => $privilege_level, 'PAGE_TITLE' => $i18n['main'][0], 'LOGGED_IN' => $_SESSION['login'], 'VERSION' => get_config('core_version'), 'CSS_HREF' => 'templates/' . $lang . '/css/style.css', 'LANG' => $lang)); // prze³±cznica ³adowanej tre¶ci $p = empty($_GET['p']) ? '' : $_GET['p']; $inc_modules = array('header_menu', 'subcat_menu'); foreach ($inc_modules as $module) { // ³adowanie dodatkowych modu³ów include 'modules/' . $module . '.php'; } class loader { var $mod = ''; var $MODULE_EXTENSION = '.php'; // konstruktor function loader() {
<?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;
function displayIndex($userID) { $tpl = new FastTemplate("templates/"); $tpl->define(array("web_main" => "web_main.html", "web_header" => "web_header.html", "head_script" => "index/head_script.html", "user" => "index/user.html", "department" => "index/department.html", "list_item" => "index/list_item.html", "group" => "index/group.html", "comment" => "index/comment.html", "link" => "index/link.html", "image" => "index/image.html", "invitation" => "index/invitation.html", "group_option" => "index/group_option.html", "body" => "index/body.html", "web_nav" => "web_nav.html", "web_footer" => "web_footer.html")); $userDAO = new UserDAO(); $user = $userDAO->getUserByID($userID); //initial owner group $groupDAO = new GroupDAO(); $groups = $groupDAO->getGroupsByOwner($user); if ($groups === null) { $tpl->assign("INDEX_GROUP_OPTION", ""); } else { foreach ($groups as $ownerGroup) { $tpl->assign("INDEX_GROUP_OPTIONID", $ownerGroup->getGroupID()); $tpl->assign("INDEX_GROUP_OPTIONNAME", $ownerGroup->getGroupName()); $tpl->parse("INDEX_GROUP_OPTION", ".group_option"); } } //initial list item $gmDAO = new GroupMemberDAO(); $gms = $gmDAO->getGroupMembersByUser($user); if ($gms !== null) { $i = 1; $hasoneaccept = false; foreach ($gms as $gm) { if ($gm->getAcceptStatus() == "2") { continue; } $group = $gm->getGroup(); $tpl->assign("INDEX_LIST_ITEM_GROUPID", $group->getGroupID()); if ($i == 1) { $tpl->assign("INDEX_GROUP_HEADER", $group->getGroupName()); $tpl->assign("INDEX_LIST_ITEM_ACTIVE", "active"); } else { $tpl->assign("INDEX_LIST_ITEM_ACTIVE", ""); } $tpl->assign("INDEX_LIST_ITEM_SEQ", $i); $tpl->assign("INDEX_LIST_ITEM_GROUPNAME", $group->getGroupName()); $tpl->parse("INDEX_LIST_ITEM_LI", ".list_item"); $hasoneaccept = true; $i++; } if ($hasoneaccept == false) { $tpl->assign("INDEX_LIST_ITEM_LI", ""); $tpl->assign("INDEX_GROUP_HEADER", ""); } } else { $tpl->assign("INDEX_LIST_ITEM_LI", ""); $tpl->assign("INDEX_GROUP_HEADER", ""); } //initial comments $recordDAO = new RecordDAO(); if ($gms !== null) { $hasGMSflag = false; $i = 1; foreach ($gms as $gm) { if ($gm->getAcceptStatus() == "2") { continue; } $group = $gm->getGroup(); if ($i == 1) { $tpl->assign("INDEX_GROUP_HIDE", ""); } else { $tpl->assign("INDEX_GROUP_HIDE", "hide"); } $tpl->assign("INDEX_GROUP_SEQ", $i); $records = $recordDAO->getRecordsByGroup($group); if ($records === null) { $tpl->assign("INDEX_GROUP_COMMENT", ""); } else { $hasOneFlag = false; $tpl->clear("INDEX_GROUP_COMMENT"); foreach ($records as $rec) { if ($rec->getDisplayStatus() === "2") { continue; } $commentUser = $rec->getUser(); $tpl->assign("INDEX_GROUP_COMMENT_USERPHOTO", $commentUser->getPhotoURL()); $tpl->assign("INDEX_GROUP_COMMENT_USERNAME", $commentUser->getFirstName() . " " . $commentUser->getLastName()); $tpl->assign("INDEX_GROUP_COMMENT_TIME", $rec->getTime()); $type = $rec->getMessageType(); $con = $rec->getContent(); if ($type == "1") { $tpl->assign("INDEX_GROUP_COMMENT_CONTENT", htmlentities($con)); } else { if ($type == "2") { $tpl->assign("INDEX_CONTENT_IMGURL", $con); $tpl->parse("INDEX_GROUP_COMMENT_CONTENT", "image"); } else { if ($type == "3") { $tpl->assign("INDEX_GROUP_CONTENT_LINKURL", $con); $baseName = pathinfo($con, PATHINFO_BASENAME); $pos = strpos($baseName, "_"); $oriName = substr($baseName, $pos + 1); $tpl->assign("INDEX_GROUP_CONTENT_LINKNAME", htmlentities($oriName)); $tpl->parse("INDEX_GROUP_COMMENT_CONTENT", "link"); } else { if ($type == "4") { $tpl->assign("INDEX_GROUP_CONTENT_LINKURL", "http://" . rawurlencode($con)); $tpl->assign("INDEX_GROUP_CONTENT_LINKNAME", htmlentities($con)); $tpl->parse("INDEX_GROUP_COMMENT_CONTENT", "link"); } } } } $tpl->parse("INDEX_GROUP_COMMENT", ".comment"); $hasOneFlag = true; } if ($hasOneFlag == false) { $tpl->assign("INDEX_GROUP_COMMENT", ""); } } $tpl->parse("INDEX_GROUP", ".group"); $hasGMSflag = true; $i++; } if ($hasGMSflag == false) { $tpl->assign("INDEX_GROUP_COMMENT", ""); $tpl->parse("INDEX_GROUP", "group"); } } else { $tpl->assign("INDEX_GROUP_COMMENT", ""); $tpl->parse("INDEX_GROUP", "group"); } //initial department and user $result = findDepartAndUser(1, $userID); if (count($result) === 0) { $tpl->assign("INDEX_DEPART_USER", ""); } else { foreach ($result as $node) { if ($node["type"] == 1) { $tpl->assign("INDEX_DEPARTID", $node["id"]); $tpl->assign("INDEX_DEPART_NAME", $node["name"]); $tpl->parse("INDEX_DEPART_USER", ".department"); } elseif ($node["type"] == 2) { $tpl->assign("INDEX_USERID", $node["id"]); $tpl->assign("INDEX_USER_NAME", $node["name"]); $tpl->parse("INDEX_DEPART_USER", ".user"); } } } //initial annocement $flag = false; $gmArr = $gmDAO->getGroupMembersByUser($user); if ($gmArr !== null) { foreach ($gmArr as $gmPend) { if ($gmPend->getAcceptStatus() == "2") { $gmGroup = $gmPend->getGroup(); $gmOwner = $gmGroup->getOwner(); $tpl->assign("INDEX_INVITATION_OWNER", $gmOwner->getFirstName() . " " . $gmOwner->getLastName()); $tpl->assign("INDEX_INVITATION_GROUPNAME", $gmGroup->getGroupName()); $tpl->assign("INDEX_INVITATION_GROUPID", $gmGroup->getGroupID()); $tpl->parse("INDEX_INVITATION", ".invitation"); $flag = true; } } } if ($flag === false) { $tpl->assign("INDEX_INVITATION", ""); } $tpl->assign("TITLE", "Home"); $tpl->parse("WEB_HEADER", "web_header"); $tpl->parse("HEAD_SCRIPT", "head_script"); $tpl->parse("WEB_NAV", "web_nav"); $tpl->parse("BODY", ".body"); $tpl->parse("WEB_FOOTER", "web_footer"); $tpl->parse("MAIN", "web_main"); $tpl->FastPrint(); }
} else { $ft->assign("MESSAGE", ""); } $ft->assign("INDEX_PATH", INDEX_PATH); //sidebar $sb = new Sidebar(); $ft->assign("SIDEBAR", $sb->getSideBar()); $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("BODY", array("content", "main")); $ft->showDebugInfo(ERROR_DEBUG); $ft->FastPrint(); } else { if ($all_url_vars['action'] == "form") { $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "template_index.html", "leftmenu" => "left_menu.html", "content" => "config.html")); if (!strstr(PHP_OS, 'WIN')) { if (!is_writable(INDEX_PATH . "tmp/extraconfig.inc.php")) { $ft->assign("MESSAGE", "<div class=\"mError\">" . LANG_CONF_ERROR_NOMOD . "</div>"); } else { $ft->assign("MESSAGE", "<div class=\"mError\">" . LANG_CONF_ERROR_SECURITY . "</div>"); } } else { $ft->assign("MESSAGE", ""); } $SQL = "SELECT id,description,name,value,comment,type FROM " . DB_PREFIX . "config WHERE pagenr='" . $all_url_vars['pagenr'] . "' ORDER BY position ASC;"; $retid = mysql_query($SQL) or die(mysql_error()); $nr_totalrecords = mysql_num_rows($retid); $i = 0; if ($row = mysql_fetch_array($retid)) { do {
<?php include 'tplutil.inc'; include 'class.FastTemplate.php3'; $tpl = new FastTemplate("slides/pragmatic"); $tpl->define(array('main' => 'fasttemplate.tpl', 'option' => 'fasttemplate-option.tpl')); foreach (get_users() as $user) { $tpl->assign(array('USER' => $user)); $tpl->parse('OPTIONS', '.option'); } $tpl->assign(array('USER' => get_user(), 'TITLE' => 'My Title')); $tpl->parse('MAIN', 'main'); $tpl->FastPrint();
/** * * @author - Elteto Zoltan * @desc - get the sidebar from table * @vers - 1.0 */ public function getSideBar() { $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "sidebar.html")); $template = $ft->get_template("sidebar.html"); $var_array = $ft->getPrefPatternVariables("IS_", $template); // only show if is available $SQL = "SELECT * FROM `" . DB_PREFIX . $this->table_name . "` WHERE availability=1 ORDER BY `position` ASC"; $retid = mysql_query($SQL); if (!$retid) { echo mysql_error(); } $i = 0; if ($row = mysql_fetch_array($retid)) { do { $module_id[$i] = $row["module_id"]; $module_name[$i] = $row["module_name"]; $availability[$i] = $row["availability"]; $filename[$i] = $row["filename"]; $extra_menu[$i] = $row["extra_menu"]; $restriction_name[$i] = $row["restriction_name"]; $i++; } while ($row = mysql_fetch_array($retid)); } $nrmodules = $i; if ($nrmodules == 0) { $ft->assign("SIDEBAR_EXIST", 0); } else { $ft->assign("SIDEBAR_EXIST", 1); $ft->setPattern(array("LANG_", "CONF_")); $ft->define_dynamic("sideex", "main"); for ($i = 0; $i < $nrmodules; $i++) { $ft->assign("MODULE_NAME", constant($module_name[$i])); $ft->assign("FILENAME", $filename[$i]); //restriction if (!empty($restriction_name[$i])) { $tmp = array($restriction_name[$i]); foreach ($var_array as $value) { $ft->assign("{$value}", in_array($value, $tmp) ? 0 : 1); } } else { foreach ($var_array as $value) { $ft->assign("{$value}", 1); } } // could be extra details what admin want to show. This is in extra_menu field. if (!empty($extra_menu[$i])) { $var_lang_array = $ft->getPrefPatternVariables("LANG_", $extra_menu[$i]); foreach ($var_lang_array as $language) { $extra_menu[$i] = str_replace("{" . $language . "}", constant($language), $extra_menu[$i]); } $ft->assign("ISEXTRA_MENU", 1); $ft->assign("EXTRA_MENU", $extra_menu[$i]); } else { $ft->assign("ISEXTRA_MENU", 0); } $ft->parse("SIDEEX", ".sideex"); } } $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("mainContent", "main"); return $ft->fetch("mainContent"); }
<?php session_start(); error_reporting(E_ALL ^ E_WARNING); include_once '../commons.php'; header('Cache-control: private, must-revalidate'); //support page back if (!$_SESSION['userID']) { header("Location: ../../../reciteWord/php/login/Login.php"); } global $dbc; $template = new FastTemplate("../../view/html/templates/profile"); $template->define(array("main" => "profile.html", "ol" => "ol.html", "li" => "li.html", "cell" => "cells.html")); $template->assign("USER_NAME", $_SESSION['username']); $template->assign("USER_IMG", $_SESSION['userimg']); $template->assign("USER_ID", $_SESSION['userID']); $template->assign("OL", ""); $userID = $_SESSION['userID']; $wordIDArr = array(); $wordsArr = array(); $defArr = array(); $getProfileWordSql = "SELECT word_id FROM userword WHERE user_id = '{$userID}'"; if (!($res = mysqli_query($dbc, $getProfileWordSql))) { $template->assign("DEFINITION", "getProfileWordSql error."); $template->parse("CONTENT", "main"); return; } else { while ($row = mysqli_fetch_assoc($res)) { array_push($wordIDArr, $row["word_id"]); } }
$request_uri = getenv("REQUEST_URI"); // Requested URI $http_ref = getenv("HTTP_REFERER"); // HTTP Referer $http_agent = getenv("HTTP_USER_AGENT"); // User Agent $error_date = date("D M j Y g:i:s a T"); // Error Date /* Send error to ADMIN. High traffic websites have the potential to generate A LOT of emails so make sure you setup some sort of email filter for these error notifications so they don't flood your inbox. */ $ftea = new FastTemplate(EMAIL_PATH); $ftea->define(array("main" => "template_index.html", "content" => "error.html")); $ftea->assign("IP", $ip); $ftea->assign("SERVER_NAME", $server_name); $ftea->assign("REQUEST_URI", $request_uri); $ftea->assign("HTTP_REF", $http_ref); $ftea->assign("HTTP_AGENT", $http_agent); $ftea->assign("ERROR_DATE", $error_date); $ftea->assign("ERROR_CODE", $error_code); $ftea->multiple_assign_define("CONF_"); $ftea->multiple_assign_define("LANG_"); $ftea->parse("CONTENT", "content"); $ftea->parse("BODY", "main"); $subject = $error_code; $message = $ftea->fetch("BODY"); $mail = new UniversalMailSender("2"); $mail->setToAddress(EMAIL_INREG, EMAIL_NAME);
<?php // 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.tpl. (On purpose of course :) // Header("Content-type: text/plain"); // If you want to see the // raw html in your browser, // uncomment this. include "class.FastTemplate.php"; $tpl = new FastTemplate("./templates"); $start = $tpl->utime(); // Benchmarking $tpl->define(array('header' => "header.tpl", 'body' => "middle.tpl", 'footer' => "footer.tpl")); $tpl->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')); $tpl->parse('HEAD', "header"); $tpl->parse('BODY', "body"); $tpl->parse('FOOT', "footer"); // $tpl->clear(array("HEAD","BODY")); // Uncomment this to see how // the class handles errors $tpl->FastPrint("HEAD"); $tpl->FastPrint("BODY"); $tpl->FastPrint("FOOT"); $end = $tpl->utime(); $runtime = $end - $start; echo "Completed in {$runtime} seconds<BR>\n"; exit;
function bind_generartemplate($dominio) { //Generar conf apache require_once _CFG_INTERFACE_FASTTEMPLATE; $tpl = new FastTemplate(_CFG_INTERFACE_PLANTILLAS); $tpl->define(array(main => "bind.tpl")); $tpl->assign(SERVER_NAME, _CFG_SERVER_NAME); $tpl->assign(SERVER_NS, _CFG_SERVER_NS); $tpl->assign(SERVER_IP, _CFG_SERVER_IP); if ($dominio != "") { $tpl->assign(DOMINIO, $dominio); } $tpl->parse(CONTENT, "main"); $contenido = $tpl->fetch(CONTENT); return $contenido; //Fin configuración apache }
$show_calendar = $db_conf->get_config('show_calendar'); $lang = $db_conf->get_config('language_set'); require_once pathjoin(ROOT, 'i18n', $lang, 'i18n.php'); // counter if (!isset($_COOKIE['core_counter'])) { @setcookie('core_counter', 'hit', time() + 10800); $db_conf->set_config('counter', $db_conf->get_config('counter') + 1); } // template & design switcher $theme = prepare_template($lang, $i18n); @setcookie('devlog_design', $theme, time() + 3600 * 24 * 365); // inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony $templates_dir = pathjoin(ROOT, 'templates', $lang); $ft = new FastTemplate(pathjoin($templates_dir, $theme, 'tpl')); $read_dir = @dir($templates_dir); $ft->define(array('main_page' => 'main_page.tpl', 'note_main' => 'note_main.tpl', 'main_denied' => 'main_denied.tpl', 'rows' => 'default_rows.tpl', 'category_list' => 'category_list.tpl', 'newsletter' => 'newsletter.tpl', 'query_failed' => 'query_failed.tpl')); // warto¶æ poczatkowa zmiennej $start -> potrzebna przy stronnicowaniu $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; $val = empty($val) ? '' : $val; // generowanie linkow if ((bool) $rewrite) { $rss_link = './rss'; $rssc_link = './rsscomments'; } else { $rss_link = './rss.php'; $rssc_link = './rsscomments.php'; } $ft->assign(array('TITLE' => $db_conf->get_config('title_page'), 'STATISTICS' => $db_conf->get_config('counter'), 'ENGINE_VERSION' => $i18n['index'][1], 'RSS_LINK' => $rss_link, 'RSSCOMMENTS_LINK' => $rssc_link, 'SEARCH_LINK' => $CoreRewrite->search($rewrite), 'CAT_ALL_LINK' => $CoreRewrite->category_all($rewrite), 'CORE_VERSION' => $db_conf->get_config('core_version'), 'LANG' => $lang, 'THEME' => $theme, 'BASE_HREF' => BASE_HREF)); if (!isset($_GET['p'])) { $start_page_type = $db_conf->get_config('start_page_type'); $start_page_id = $db_conf->get_config('start_page_id');
} define('PATH_TO_CLASSES', 'classes'); require_once PATH_TO_CLASSES . '/cls_db_mysql.php'; require_once PATH_TO_CLASSES . '/cls_phpmailer.php'; require_once "inc/config.php"; require_once '../inc/common_lib.php'; // mysql_server_version get_mysql_server_version(); $lang = get_config('language_set'); require_once 'i18n/' . $lang . '/i18n.php'; require_once PATH_TO_CLASSES . '/cls_fast_template.php'; // warto¶æ pocz±tkowa zmiennej $start -> potrzebna przy stronnicowaniu $start = isset($_GET['start']) ? intval($_GET['start']) : 0; // inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony $ft = new FastTemplate('./templates/' . $lang . '/tpl'); $ft->define(array('main' => "main.tpl", 'main_loader' => "main_loader.tpl", 'rows' => "rows.tpl", 'form_login' => "form_login.tpl")); $ft->assign(array('TITLE' => $i18n['index'][0], 'ERROR_MSG' => '', 'CSS_HREF' => 'templates/' . $lang . '/css/style.css')); // deklaracja zmiennej $p $p = empty($_GET['p']) ? '' : $_GET['p']; if ($p == "log") { $login = trim($_POST['login']); $password = trim(md5($_POST['password'])); if (empty($login) or empty($password)) { // U¿ytkownik nie uzupe³ni³ wszystkich pól::form $ft->assign('ERROR_MSG', $i18n['index'][1]); $ft->parse('ROWS', ".form_login"); } else { $db = new DB_SQL(); $query = sprintf("\r\n SELECT \r\n active \r\n FROM \r\n %1\$s \r\n WHERE \r\n login = '******' \r\n AND \r\n password = '******'", TABLE_USERS, $login, $password); $db->query($query); if ($db->num_rows()) {
header('Location: main.php'); break; } require_once PATH_TO_CLASSES . '/cls_db_mysql.php'; require_once PATH_TO_CLASSES . '/cls_phpmailer.php'; require_once ROOT . 'inc/common_lib.php'; // mysql_server_version get_mysql_server_version(); $lang = get_config('language_set'); require_once 'i18n/' . $lang . '/i18n.php'; require_once PATH_TO_CLASSES . '/cls_fast_template.php'; // warto�� pocz�tkowa zmiennej $start -> potrzebna przy stronnicowaniu $start = isset($_GET['start']) ? intval($_GET['start']) : 0; // inicjowanie klasy, wkazanie katalogu przechowuj�cego szablony $ft = new FastTemplate('./templates/' . $lang . '/tpl'); $ft->define(array('main' => 'main.tpl', 'main_loader' => 'main_loader.tpl', 'rows' => 'rows.tpl', 'form_login' => 'form_login.tpl')); $ft->assign(array('TITLE' => $i18n['index'][0], 'ERROR_MSG' => '', 'LANG' => $lang)); // deklaracja zmiennej $p $p = empty($_GET['p']) ? '' : $_GET['p']; if ($p == 'log') { $login = trim($_POST['login']); $password = trim(md5($_POST['password'])); if (empty($login) || empty($password)) { // U�ytkownik nie uzupe�ni� wszystkich p�l::form $ft->assign('ERROR_MSG', $i18n['index'][1]); $ft->parse('ROWS', '.form_login'); } else { $db = new DB_SQL(); $query = sprintf("\n SELECT \n active \n FROM \n %1\$s \n WHERE \n login = '******' \n AND \n password = '******'", TABLE_USERS, $login, $password); $db->query($query); if ($db->num_rows()) {
$filename = $files_array[$i]; if (preg_match("/(" . $allowed_extensions . ")\$/i", $filename) == 0) { continue; } $buffer .= "<option value=\"" . $i . "\">" . $filename . "</option>\n"; } if ($template_name != "") { $temp_source = @file_get_contents(INDEX_PATH . $files_array[$template_name]); } $temp_source = str_replace("{", "#_", $temp_source); $temp_source = str_replace("}", "_#", $temp_source); $temp_source = str_replace("textarea", "textarea#", $temp_source); $temp_source = str_replace("BEGIN DYNAMIC BLOCK", "BDYB", $temp_source); $temp_source = str_replace("END DYNAMIC BLOCK", "EDYB", $temp_source); $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "template_index.html", "content" => "templateeditor.html")); $variable_text = @file_get_contents(INDEX_PATH . "admintool/variables.txt"); // segitseg, szovegek $ft->assign("VARIABLE_TEXT", $variable_text); if ($all_url_vars["msg"] == 1) { $ft->assign("SAVED_MSG", 1); } 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]);
<?php // Example FastTemplate Dynamic Demo // The dynamic example from the man page Header("Content-type: text/plain; charset=utf-8"); include "class.FastTemplate.php"; $tpl = new FastTemplate("./templates"); $start = $tpl->utime(); $tpl->define(array('main' => "main.tpl", 'table' => "dynamic.tpl")); $tpl->assign(array('TITLE' => "FastTemplate Dynamic Test")); $tpl->define_dynamic("row", "table"); for ($n = 1; $n <= 3; $n++) { $Number = $n; $BigNum = $n * 10; $tpl->assign(array('NUMBER' => $Number, 'BIG_NUMBER' => $BigNum)); $tpl->parse('{ROWS}', ".row"); } $tpl->parse('MAIN', array("table", "main")); $tpl->FastPrint(); $end = $tpl->utime(); $run = $end - $start; echo "Runtime [{$run}] seconds<BR>\n"; exit;
<?php // $Id: cache_ex.php,v 1.4 2004/12/27 22:34:10 lvalics Exp $ // Cache Example include "cls_fast_template.php"; $ft = new FastTemplate('./templates'); // CACHE will be used $ft->setCacheTime(3); $ft->USE_CACHE(); $ft->define(array("main" => "cache.html")); $data = date("d/m/Y"); $ft->assign('DATA_ATUAL', $data); $ft->assign("HORA", date("H:i:s")); // Benchmarking $start = $ft->utime(); $end = $ft->utime(); $runtime = ($end - $start) * 1000; $ft->assign("DEBUGSEC", $runtime); // end Benchmarking $ft->parse("BODY", array("main")); $ft->FastPrint();
* * 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; version 2 only. * * 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. * */ header('Content-type: text/html; charset=UTF8'); define('PATH_TO_CLASSES', '../administration/classes'); define('EXTENSION', '.php'); require_once PATH_TO_CLASSES . "/cls_db_mysql.php"; require_once PATH_TO_CLASSES . "/cls_fast_template.php"; require_once PATH_TO_CLASSES . "/cls_permissions.php"; $lang = !empty($_POST['lang']) ? $_POST['lang'] : 'pl'; require_once 'i18n/' . $lang . '/i18n.php'; $ft = new FastTemplate("./templates/" . $lang); $ft_path = $ft->get_root(); $ft->define('main', "main.tpl"); $ft->assign('CSS_HREF', $ft_path . "style/style.css"); $p = empty($_GET['p']) ? '' : $_GET['p']; switch ($p) { default: include "modules/main_content.php"; $ft->parse('MAIN', 'main'); } $ft->FastPrint(); exit;
<?php #Pfad festlegen wo die Dateien sich befinden include 'start_header.inc.php'; session_unregister('rollen'); session_unregister('all_roles'); $titel = "Rechner und IP Management Startseite"; $webseite = "home.dwt"; # neues Template-Objekt erstellen $template = new FastTemplate("."); # dem erstellten Template-Objekt eine Vorlage zuweisen $template->define(array("Vorlage" => "index.dwt", "Login" => "logout_form.inc.dwt", "Webseite" => $webseite)); $template->assign(array("SEITENTITEL" => $titel, "USERCN" => $usercn)); ############################################################ function build_au_array($au, $parentau) { global $ds, $ldaperror, $tree_array, $tree; if ($parentau == "") { $tree_array[$au]['mode'] = "exp"; } else { $tree_array[$au]['mode'] = "coll"; } # au data $au_data = get_au_data($au, array("ou", "associateddomain")); #print_r($au_data); echo "<br><br>"; $tree_array[$au]['roles'] = get_au_roles($au); # Falls MainAdmin dann auch MainAdmin automatisch im gesamten Subtree if ($parentau && in_array("MainAdmin", $tree_array[$parentau]['roles'])) { if (!in_array("MainAdmin", $tree_array[$au]['roles'])) { $tree_array[$au]['roles'][] = "MainAdmin"; }