コード例 #1
0
ファイル: settings.php プロジェクト: hstonec/discussion
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();
}
コード例 #2
0
ファイル: how-to.php プロジェクト: nciftci/codefaster
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;
}
コード例 #3
0
ファイル: signup.php プロジェクト: hstonec/discussion
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();
}
コード例 #4
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
 }
コード例 #5
0
ファイル: cache_ex.php プロジェクト: yehchge/FastTemplate
<?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();
コード例 #6
0
ファイル: start.php プロジェクト: nciftci/codefaster
<?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);
    }
コード例 #7
0
ファイル: languageeditor.php プロジェクト: nciftci/codefaster
include_once INCLUDE_PATH . "cls_sidebar.php";
$stringutil = new String("");
$all_url_vars = array();
$all_url_vars = $stringutil->parse_all();
/**
 * @author   - Test Developer
 * @desc     - autentication will be called here
 * @vers     - 1.0
 **/
$util = new Authenticate();
$util->check_authentification();
$sb = new Sidebar();
$input_dir = INDEX_PATH . "language/";
$input_files = array("en.inc.php", "en.extra.inc.php");
$output_file = "en.extra.inc.php";
$ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH);
$ft->define(array("main" => "template_index.html", "content" => "languageeditor.html"));
$language_data = array();
foreach ($input_files as $filename) {
    $input_filename = $input_dir . $filename;
    $file = fopen($input_filename, "r");
    if ($file) {
        while (!feof($file)) {
            $line = trim(fgets($file));
            if (stripos($line, "define") === 0) {
                //if line contains "define"
                if (preg_match('/define\\(\\"(.*?)\\",\\s*\\"(.*)\\"\\)/i', $line, $matches)) {
                    $name = $matches[1];
                    $value = $matches[2];
                    $language_data[$name] = $value;
                }
コード例 #8
0
ファイル: main.php プロジェクト: BackupTheBerlios/core-svn
define('PATH_TO_CLASSES', 'classes');
define('PATH_TO_MODULES', 'modules');
require PATH_TO_CLASSES . '/cls_db_mysql.php';
require PATH_TO_CLASSES . '/cls_upload.php';
require PATH_TO_CLASSES . '/cls_rss_parser.php';
require_once 'inc/config.php';
require_once '../inc/common_lib.php';
require_once '../inc/admin_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';
require_once PATH_TO_CLASSES . '/cls_permissions.php';
// inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony
$ft = new FastTemplate('./templates/' . $lang . '/tpl');
// egzemplarz klasy obs³uguj±cej bazê danych Core
$db = new DB_SQL();
// pobieramy poziom uprawnieñ
$query = sprintf("\r\n    SELECT \r\n        permission_level \r\n    FROM \r\n        %1\$s \r\n    WHERE \r\n        login = '******'", TABLE_USERS, $_SESSION['login']);
$db->query($query);
$db->next_record();
$privileges = $db->f('permission_level');
// egzemplarz klasy do obs³ugi uprawnieñ
$perms = new permissions();
$permarr = $perms->getPermissions($privileges);
$ft->assign(array('PERMS_USER' => false, 'PERMS_WRITER' => false, 'PERMS_MODERATOR' => false, 'PERMS_TPLEDITOR' => false, 'PERMS_ADMIN' => false));
switch ($privileges) {
    case '1':
        $privilege_level = 1;
        $ft->assign('PERMS_USER', true);
コード例 #9
0
header("Content-type: application/xml");
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);
コード例 #10
0
ファイル: main.php プロジェクト: BackupTheBerlios/core-svn
    case '3':
        $privilege_level = 2;
        break;
    case '7':
        $privilege_level = 3;
        break;
    case '15':
        $privilege_level = 4;
        break;
    case '31':
        $privilege_level = 5;
        break;
}
// Templates
// inicjowanie klasy, wkazanie katalogu przechowujacego szablony
$ft = new FastTemplate(pathjoin('templates', $lang, 'tpl'));
// tablica definicji użytych plików *.tpl
$ft->define(array('index' => 'index.tpl', 'main_loader' => 'main_loader.tpl', 'result_note' => 'result_note.tpl', 'menu_header' => 'menu_header.tpl', 'menu' => 'menu.tpl'));
$ft->define_dynamic('menu_row', 'menu');
// przełącznica ładowanej treści
$CorePage = isset($_GET['p']) ? $_GET['p'] : 0;
$CoreModulesMap = array(1 => 'add_note.php', 2 => 'edit_note.php', 3 => 'add_page.php', 4 => 'edit_page.php', 5 => 'edit_comments.php', 6 => 'most_comments.php', 7 => 'add_user.php', 8 => 'add_category.php', 9 => 'edit_category.php', 10 => 'core_configuration.php', 11 => 'add_links.php', 12 => 'edit_links.php', 13 => 'edit_users.php', 14 => 'edit_templates.php', 15 => 'transfer_note.php', 16 => 'list_note.php');
if (array_key_exists($CorePage, $CoreModulesMap)) {
    require pathjoin(PATH_TO_MODULES_ADM, $CoreModulesMap[$CorePage]);
} else {
    require pathjoin(PATH_TO_MODULES_ADM, 'main.php');
}
//menu glowne - zaznaczenie wybranej zakladki
if (in_array($CorePage, array(1, 2, 5, 6, 16))) {
    $tag = 'NEWS_CURRENT';
} elseif (in_array($CorePage, array(3, 4))) {
コード例 #11
0
/**
 * Function pay_get
 **/
function pay_get()
{
    global $gData, $gOptions;
    $Kaznachey = new Kaznachey();
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
    $hrpd = json_decode($HTTP_RAW_POST_DATA);
    $order_id = intval($hrpd->MerchantInternalPaymentId);
    if ($order_id == 0) {
        if (isset($_GET['show_result'])) {
            $html = file_get_contents('pay_mod/kaznachey/pay_ok.htm');
            print $html;
            exit;
        } else {
            $kaznachey->home_url();
            exit;
        }
    }
    if (isset($hrpd->MerchantInternalPaymentId)) {
        if ($hrpd->ErrorCode == 0) {
            $gData = data_connect();
            $command = "UPDATE " . DB_NICK . "_archive_order SET get_payment=2 WHERE order_id='" . addslashes($hrpd->MerchantInternalPaymentId) . "'";
            mysql_query($command);
            // Set order ok e-mail for admin
            $tplm = new FastTemplate('./pay_mod/Kaznachey');
            $tplm->DefineTemplate(array('mail_message' => 'pay_ok_mail.htm'));
            $tplm->Assign(array('ORDERCODE' => $hrpd->MerchantInternalPaymentId, 'SUMA' => number_format($arr['amt'] * 1, 2, '.', ''), 'CURR' => $arr['ccy'], 'SHOPNAMES' => $gOptions['attr_shop_name'], 'SHOPURL' => $gOptions['attr_shop_url'], 'DATE' => date('Y-m-d H:i:s', $arr['date'])));
            $tplm->Parse('MAIL', 'mail_message');
            $mailer = new Emailer(MAIL_SERVER);
            $mailer->SetCharset($gOptions['attr_admin_charset']);
            $mailer->SetTypeText();
            $all_message = iconv(SHOP_CHARSET, $gOptions['attr_admin_charset'], $tplm->Fetch('MAIL'));
            $subject = substr($all_message, strpos($all_message, 'Message_subject:') + 16, strpos($all_message, 'Message_content:') - 16);
            $message = substr($all_message, strpos($all_message, 'Message_content:') + 16);
            $mailer->AddMessage($message);
            $mailer->BuildMessage();
            $mailer->Send($gOptions['attr_admin_email'], $gOptions['attr_shop_email'], ltrim($subject, " "));
        }
    }
}
コード例 #12
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();
コード例 #13
0
ファイル: config.php プロジェクト: nciftci/codefaster
        }
    } 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)) {
コード例 #14
0
ファイル: cls_sidebar.php プロジェクト: nciftci/codefaster
 /**
  *
  * @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");
 }
コード例 #15
0
ファイル: index.php プロジェクト: nciftci/codefaster
include_once INCLUDE_PATH . "connection.php";
include_once INCLUDE_PATH . "cls_sidebar.php";
$stringutil = new String("");
$all_url_vars = array();
$all_url_vars = $stringutil->parse_all();
/**
 * @author   - Test Developer
 * @desc     - autentication will be called here
 * @vers     - 1.0
 **/
$util = new Authenticate();
$util->check_authentification();
/**
 * @desc     - Call of Fast Template, with PATH from defines.inc.php
 **/
$ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH);
$ft->define(array("main" => "template_index.html", "content" => "index.html"));
// static part
$ft->multiple_assign_define("LANG_");
$ft->multiple_assign_define("CONF_");
//verify if installer directory exist, give back alert
if (file_exists('../installer') && CONF_INDEX_URL !== "INST_URL" && ERROR_DEBUG == 0) {
    $errormessage = "<div class=\"mError\">" . LANG_ADMIN_INSTALLER . "</div>";
}
//verify the password for admin, if setup, redirect to change.
if (PASSWORD == "setup") {
    header("Location: config.php?action=form&pagenr=1");
    exit;
}
$ft->assign("MESSAGE", $errormessage);
$sb = new Sidebar();
コード例 #16
0
ファイル: profile.php プロジェクト: Ericyao7/reciteWord
<?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"]);
    }
}
コード例 #17
0
ファイル: error.php プロジェクト: nciftci/codefaster
// Server Name
$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");
コード例 #18
0
ファイル: checkAns.php プロジェクト: Ericyao7/reciteWord
<?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();
コード例 #19
0
<?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";
コード例 #20
0
ファイル: example_1.php プロジェクト: yehchge/FastTemplate
<?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;
コード例 #21
0
ファイル: example_2.php プロジェクト: yehchge/FastTemplate
<?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;
コード例 #22
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;
コード例 #23
0
ファイル: index.php プロジェクト: BackupTheBerlios/core-svn
$max_photo_width = $db_conf->get_config('max_photo_width');
$date_format = $db_conf->get_config('date_format');
$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'])) {
コード例 #24
0
<?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";
        }
コード例 #25
0
ファイル: index.php プロジェクト: BackupTheBerlios/core-svn
if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] === TRUE) {
    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);
コード例 #26
0
ファイル: flex_table.php プロジェクト: yehchge/FastTemplate
/**
 * 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');
}
コード例 #27
0
ファイル: index.php プロジェクト: BackupTheBerlios/core-svn
    break;
}
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);
コード例 #28
0
ファイル: html-stats.php プロジェクト: teammember8/roundcube
    die("Cannot acces {$outdir} directory!");
}
// data initialization
$rundate = date("Y-m-d H:i", mktime());
// open database connection
$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)) {
コード例 #29
0
ファイル: install.php プロジェクト: BackupTheBerlios/core-svn
 *
 * 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;
コード例 #30
0
ファイル: templateeditor.php プロジェクト: nciftci/codefaster
 for ($i = 0; $i < $size; $i++) {
     $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);