Example #1
0
/**
 * 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();
}
Example #3
0
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();
}
Example #4
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 #5
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 #6
0
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();
}
Example #7
0
<?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;
Example #8
0
        $example = "";
        foreach ($xmlarray['data'] as $item) {
            if (!empty($fields)) {
                $fields .= ";";
            }
            $fields .= $item['function'];
            if (!empty($example)) {
                $example .= ";";
            }
            $example .= $item['function'];
        }
        //		print_r($xmlarray);exit;
        $ft->assign("DEV_NAME", $xmlarray['developername']);
        $ft->assign("PROJECT_NAME", $xmlarray['projectname']);
        $ft->assign("CLASS_NAME", $xmlarray['classname']);
        $ft->assign("VAR_NAME", $xmlarray['varname']);
        $ft->assign("TABLE", $xmlarray['tablename']);
        $ft->assign("DISABLE_SOME_FIELDS", ' ');
        $ft->assign("DBFIELDS_EN", strtolower($fields));
        $fields_noen = str_replace("_en", "", $fields);
        $ft->assign("DBFIELDS", $fields_noen);
        $tokexample = explode(";", $fields_noen);
        $tokenr = sizeof($tokexample);
        $ft->assign("EXAMPLE", $example);
    } else {
        header("Location: index.php");
        exit;
    }
}
$ft->parse("BODY", array("content", "main"));
print $ft->fetch("BODY");
Example #9
0
<?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();
Example #10
0
    }
}
############################################################
$tree_array = array();
build_au_array($rootAU, "");
#print_r($tree_array);
foreach (array_keys($tree_array) as $au) {
    if ($tree_array[$au]['roles']) {
        $all_roles[$au]['roles'] = $tree_array[$au]['roles'];
        $all_roles[$au]['zone'] = $tree_array[$au]['zone'];
    }
}
$_SESSION['all_roles'] = $all_roles;
#print_r($_SESSION['all_roles']);
$tree = "";
$text = "Um zu den Administrations-Seiten einer AU zu kommen, w&auml;hlen Sie entsprechenden Link.";
if (!$all_roles) {
    $text = "Sie sind in der Benutzerdatenbank des <b>net&lowast;Client Management</b> registriert<br>\n\t\t\t\tIhnen wurden jedoch noch keine administrativen Rechte zugeordnet<br><br>\n\t\t\t\tWenden Sie sich bitte an<br><br>\n\t\t\t\t<b>**DHCP USER EMAIL**</b>";
} else {
    draw_tree($rootAU, "", "");
}
$template->assign(array("TEXT" => $text));
$template->assign(array("TREE" => $tree));
#############################################################
# Daten in die Vorlage parsen
$template->assign(array("PFAD" => $START_PATH));
$template->parse("LOGIN", "Login");
$template->parse("HAUPTFENSTER", "Webseite");
$template->parse("PAGE", "Vorlage");
# Fertige Seite an den Browser senden
$template->FastPrint("PAGE");
Example #11
0
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()) {
            if ($db->f("active") != "N") {
                // Rejestrujemy zmienne sesyjne
                $_SESSION["login"] = $login;
                $_SESSION["loggedIn"] = TRUE;
                header("Location: main.php");
                break;
            } else {
                // U¿ytkownik nie zaaktywowa³ konta::db
                $ft->assign('ERROR_MSG', $i18n['index'][2]);
                $ft->parse('ROWS', ".form_login");
Example #12
0
$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 />", "<", ">");
        $replacement = array(" &amp; ", "&lt;br /&gt;", "&lt;", "&gt;");
        $text = str_replace($pattern, $replacement, $text);
        $permanent_link = (bool) $rewrite ? $http_root . '1,' . $id . ',1,item.html' : $http_root . 'index.php?p=1&amp;id=' . $id . '';
        $ft->assign(array('DATE' => $date, 'TITLE' => $title, 'AUTHOR' => $author, 'PERMALINK' => $permanent_link, 'TEXT' => $text, 'DISPLAY_XML' => true));
        $ft->parse('XML_ROW', ".xml_row");
    }
} else {
    $ft->assign('DISPLAY_XML', false);
    $ft->parse('XML_ROW', ".xml_row");
}
$ft->parse('CONTENT', "xml_feed");
$ft->FastPrint('CONTENT');
Example #13
0
<?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();
Example #14
0
             // CheckBox
             $options = explode("|", $comment[$i]);
             $current_2power = 1;
             $value_str = "";
             for ($j = 0; $j < count($options); $j++) {
                 $value_str .= $br . "<input type=checkbox name='" . "CNF_CHBX_" . $name[$i] . "[]' " . (($value[$i] & $current_2power) == $current_2power ? "CHECKED" : "") . "> " . constant($options[$j]);
             }
             break;
     }
     //end for
     $ft->assign("CONF_ID", $id[$i]);
     $ft->assign("CONF_DESCRIPTION", constant($description[$i]));
     $ft->assign("CONF_NAME", $name[$i]);
     $ft->assign("CONF_VALUE", $value_str);
     $ft->assign("NR_ROWS", $nr);
     $ft->parse("CONF_LIST", ".conf_list");
 }
 if (PASSWORD == "setup") {
     $errormessage = "<div class=\"mError\">" . LANG_ADMIN_SETUPPASSWORD . "</div>";
 }
 $ft->assign("MESSAGE", $errormessage);
 $ft->assign("INDEX_PATH", INDEX_PATH);
 $ft->clear_dynamic("conf_list");
 //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();
Example #15
0
$lang = get_config('language_set');
require_once 'i18n/' . $lang . '/i18n.php';
if (isset($_COOKIE['devlog_design']) && is_dir('./templates/' . $lang . '/' . $_COOKIE['devlog_design'] . '/tpl/')) {
    $theme = $_COOKIE['devlog_design'];
} elseif (is_dir('./templates/' . $lang . '/main/tpl')) {
    $theme = 'main';
} else {
    printf('<div style="font-family: Arial, sans-serif; font-size: 16px; background-color: #ccc; border: 1px solid red; padding: 15px; text-align: center;">%s</div>', $i18n['design'][0]);
    exit;
}
@setcookie('devlog_design', $theme, time() + 3600 * 24 * 365);
// inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony
$ft = new FastTemplate('./templates/' . $lang . '/' . $theme . '/tpl/');
$db = new DB_SQL();
$ft->define('photo_main', 'photo_main.tpl');
$ft->assign('TITLE', get_config('title_page'));
$query = sprintf("\r\n    SELECT \r\n        image \r\n    FROM \r\n        %1\$s \r\n    WHERE \r\n        id = '%2\$d' \r\n    LIMIT 1", $table = empty($_GET['p']) ? TABLE_MAIN : TABLE_PAGES, $_GET['id']);
$db->query($query);
$db->next_record();
$image = $db->f('image');
if (!empty($image)) {
    list($width, $height) = getimagesize("photos/" . $image);
    $ft->assign(array('IMAGE_NAME' => $image, 'IMAGE_WIDTH' => $width, 'IMAGE_HEIGHT' => $height, 'LANG' => $lang, 'THEME' => $theme));
    $ft->parse('CONTENT', 'photo_main');
} else {
    // jesli ktos probuje grzebac w adresie url
    header("Location: index.php");
    exit;
}
$ft->FastPrint('CONTENT');
exit;
Example #16
0
}
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"]);
    }
}
foreach ($wordIDArr as $id) {
    $getContentSql = "SELECT word, word_def FROM words WHERE words_id = '{$id}'";
    if (!($res = mysqli_query($dbc, $getContentSql))) {
        $template->assign("DEFINITION", "getContentSql error.");
        $template->parse("CONTENT", "main");
        return;
    } else {
        while ($row = mysqli_fetch_assoc($res)) {
            array_push($wordsArr, $row["word"]);
Example #17
0
 /**
  *
  * @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");
 }
Example #18
0
/*
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);
$mail->setFromAddress(EMAIL_INREG, EMAIL_NAME);
$mail->setSubject($subject);
$mail->setType(2);
$mail->setHtmlMessage($message);
$mail->SendMail();
$ft->parse("BODY", array("content", "main"));
$ft->showDebugInfo(ERROR_DEBUG);
$ft->FastPrint();
Example #19
0
    header("Location: languageeditor.php");
    exit;
}
if (empty($all_url_vars['language_checkbox'])) {
    $mode = "first_page";
} else {
    $mode = "edit_page";
    $new_language_data = array();
    foreach ($all_url_vars['language_checkbox'] as $lang_key => $lang_value) {
        $new_language_data[$lang_key] = $language_data[$lang_key];
    }
    $language_data = $new_language_data;
}
$ft->define_dynamic("row", "content");
foreach ($language_data as $lang_key => $lang_value) {
    $ft->assign("LANGUAGE_KEY", $lang_key);
    if ($mode == "first_page") {
        $ft->assign("LANGUAGE_VALUE", htmlspecialchars_decode($lang_value));
        $ft->assign("LANGUAGE_CHECKBOX", "<input type='checkbox' id='{$lang_key}' name='language_checkbox[{$lang_key}]' />");
    } else {
        $ft->assign("LANGUAGE_VALUE", "<input type='text' id='{$lang_key}' name='language_text[{$lang_key}]' value='" . htmlspecialchars_decode($lang_value) . "' size='60' />");
        $ft->assign("LANGUAGE_CHECKBOX", "");
    }
    $ft->parse("ROW", ".row");
}
$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();
Example #20
0
                $output .= "</table>\n\n";
            }
            $output .= "<h4><a href=\"../../" . $teamcode . "/" . $row['package'] . "/index.php\">" . $row['package'] . "</a></h4>\n" . "<table border=\"0\" cellpadding=\"2\">\n" . "<tr bgcolor=\"#f0f0ff\"><td><i>filename</i></td><td><i>translated</i></td>" . "<td><i>fuzzy</i></td><td><i>untranslated</i></td></tr>\n";
            $package = $row['package'];
        }
        $filename = preg_replace('/\\.po$/', "", $row['filename']);
        $cvsurl = cvsweburl($rev, $teamcode, $package, $row['filename']);
        $output .= "<tr bgcolor=\"#f8f8f8\"><td><a href=\"{$cvsurl}\">{$filename}</a></td><td>" . $row['translated'] . "</td><td>" . $row['fuzzy'] . "</td><td>" . $row['untranslated'] . "</td></tr>\n";
        $count++;
    }
    if ($count == 0) {
        $output .= "<table border=\"0\" cellpadding=\"2\">\n" . "<tr><td>There's no files available.</td></tr>\n";
    }
    $output .= "</table>\n\n";
    $tplp4->assign(array(TXT_TEAMNAME => $teamname, TXT_TEAMCODE => $teamcode, TXT_TEAMCODE2 => strtoupper($teamcode), TEAMLIST => $teamlist, CONTENT => $output));
    $tplp4->parse(MAIN, "level2partial");
    writefile("{$outdir}/{$rev}/partial/{$teamcode}/index.php", $tplp4->fetch());
}
// render HTML/PHP pages by KDE package for level 2 & 3
foreach ($m_packages as $package) {
    debug(10, "render level2 for '{$package}' package");
    $output = "";
    $total_error = 0;
    $total_translated = 0;
    $total_fuzzy = 0;
    $total_untranslated = 0;
    // make dirpath for $rev & current package
    if (!is_dir("{$outdir}/{$rev}/{$package}")) {
        if (!@mkdir("{$outdir}/{$rev}/{$package}", 0755)) {
            die("Cannot make {$outdir}/{$rev}/{$package} directory!");
        }
Example #21
0
    case in_array($CorePage, array(8, 9, 15)):
        $menu_content = array('8' => $i18n['subcat_menu'][8], '9' => $i18n['subcat_menu'][9], '15' => $i18n['subcat_menu'][10]);
        break;
        // configuration menu content
    // configuration menu content
    case in_array($CorePage, array(10)):
        $menu_content = array('10' => $i18n['subcat_menu'][11]);
        break;
        // links menu content
    // links menu content
    case in_array($CorePage, array(11, 12)):
        $menu_content = array('11' => $i18n['subcat_menu'][12], '12' => $i18n['subcat_menu'][13]);
        break;
        // template menu content
    // template menu content
    case in_array($CorePage, array(14)):
        $menu_content = array('14' => $i18n['subcat_menu'][14]);
        break;
}
if (!empty($CorePage)) {
    // walk & parse through an array
    foreach ($menu_content as $menu_num => $menu_desc) {
        $ft->assign(array('MENU_NUMBER' => $menu_num, 'MENU_DESC' => $menu_desc));
        $ft->parse('SUBCAT_MENU', '.menu_row');
    }
    $ft->parse('SUBCAT_MENU', 'menu');
}
$ft->assign(array('PRIVILEGE_LEVEL' => $privilege_level, 'PAGE_TITLE' => $i18n['main'][0], 'LOGGED_IN' => $_SESSION['login'], 'VERSION' => get_config('core_version'), 'CSS_HREF' => sprintf('templates/%s/css/style.css', $lang), 'LANG' => $lang, $tag => 'id="current"'));
$ft->parse('MENU_HEADER', '.menu_header');
$ft->parse('MAIN_CONTENT', array('main_loader', 'index'));
$ft->FastPrint();
Example #22
0
            case '14':
                $this->mod = 'edit_templates';
                break;
            case '15':
                $this->mod = 'transfer_note';
                break;
            default:
                $this->mod = 'main';
        }
        $this->mod = $this->name_cleaner($this->mod);
        if ($this->mod == '') {
            $this->return_dead();
        }
        if (!@file_exists(PATH_TO_MODULES . '/' . $this->mod . $this->MODULE_EXTENSION)) {
            $this->return_dead();
        }
    }
    function name_cleaner($name)
    {
        return preg_replace('/[^a-zA-Z0-9\\-\\_]/', '', $name);
    }
    function return_dead()
    {
        $this->mod = 'main';
    }
}
$loader = new loader();
require_once PATH_TO_MODULES . '/' . $loader->mod . $loader->MODULE_EXTENSION;
$ft->parse('MAIN_CONTENT', array('main_loader', 'index'));
$ft->FastPrint();
exit;
Example #23
0
} else {
    $CoreId = isset($_GET['id']) ? $_GET['id'] : '';
    $CorePage = $_GET['p'];
}
$CoreModulesMap = array(1 => 'alter_view.php', 2 => 'comments_view.php', 3 => 'comments_add.php', 4 => 'category_view.php', 5 => 'pages_view.php', 6 => 'articles_view.php', 7 => 'newsletter.php', 8 => 'search.php', 9 => 'date_view.php');
require_once pathjoin(PATH_TO_MODULES_USER, array_key_exists($CorePage, $CoreModulesMap) ? $CoreModulesMap[$CorePage] : 'main_view.php');
// wyznaczamy szablon jaki ma byc parsowany, sprawdzajac
// czy faktycznie znajduje sie on w katalogu z szablonami
if (!isset($assigned_tpl) || !file_exists(pathjoin(ROOT, 'templates', $lang, $theme, 'tpl', $assigned_tpl . '_page.tpl'))) {
    $assigned_tpl = 'main_page';
}
$ft->define_dynamic('alternate_design_row', $assigned_tpl);
while ($d = $read_dir->read()) {
    if ($d[0] != '.') {
        $ft->assign(array('ALTERNATE_TEMPLATE' => $d, 'TEMPLATE_LINK' => $CoreRewrite->template_switch($d, $rewrite)));
        $ft->parse('ALTERNATE_DESIGN_ROW', '.alternate_design_row');
    }
}
// tablica includowanych modulow
$modules = array('category_list', 'pages_list', 'links_list');
while (list($m) = each($modules)) {
    require_once PATH_TO_MODULES_USER . $modules[$m] . '.php';
}
if ((bool) $show_calendar) {
    $ft->assign(array('LINKED' => false, 'SHOW_CALENDAR' => true));
    $calendar = new calendar();
    $calendar->display_calendar();
} else {
    $ft->assign(array('LINKED' => false, 'SHOW_CALENDAR' => false));
}
$ft->parse('MAIN', $assigned_tpl);
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
}
Example #25
0
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()) {
            if ($db->f('active') != 'N') {
                // Rejestrujemy zmienne sesyjne
                $_SESSION['login'] = $login;
                $_SESSION['loggedIn'] = TRUE;
                header('Location: main.php');
                break;
            } else {
                // U�ytkownik nie zaaktywowa� konta::db
                $ft->assign('ERROR_MSG', $i18n['index'][2]);
                $ft->parse('ROWS', '.form_login');
Example #26
0
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();
}
Example #27
0
<?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();
Example #28
0
<?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;
Example #29
0
 *
 * 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;
Example #30
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;