/** * @ignore */ public static function renderview($uObject) { if (self::$engine === null) { $tPath = Io::translatePath(Config::get('raintpl/path', '{core}include/3rdparty/raintpl/inc')); require $tPath . '/rain.tpl.class.php'; raintpl::configure('base_url', null); raintpl::configure('tpl_dir', $uObject['templatePath']); raintpl::configure('tpl_ext', '.rain'); raintpl::configure('cache_dir', Io::translatePath('{writable}cache/raintpl/')); if (Framework::$disableCaches) { raintpl::configure('check_template_update', true); } self::$engine = new \RainTPL(); } else { self::$engine = new \RainTPL(); } self::$engine->assign('model', $uObject['model']); if (is_array($uObject['model'])) { foreach ($uObject['model'] as $tKey => $tValue) { self::$engine->assign($tKey, $tValue); } } foreach (Framework::$variables as $tKey => $tValue) { self::$engine->assign($tKey, $tValue); } self::$engine->draw($uObject['templateFile']); }
function generate_page($url, $title, $content) { global $CSS_STYLE; raintpl::$tpl_dir = './tpl/'; // template directory raintpl::$cache_dir = "./cache/"; // cache directory raintpl::$base_url = url(); // base URL of blog raintpl::configure('path_replace', false); raintpl::configure('debug', true); $tpl = new raintpl(); //include Rain TPL $tpl->assign("url", $url); $tpl->assign("tinyurl", md5($url)); $tpl->assign("title", $title); $tpl->assign("isLogged", Session::isLogged()); if (Session::isLogged()) { $tpl->assign("username", $_SESSION['username']); $tpl->assign("logpage", "./log.php?logout"); $tpl->assign("logname", "Logout"); } else { $tpl->assign("logpage", "./log.php"); $tpl->assign("logname", "Login"); } $tpl->assign("content", $content); $tpl->assign("version", VERSION); $tpl->draw("article"); // draw the template }
public function draw($file) { include "inc/lib/raintpl/rain.tpl.class.php"; raintpl::configure('tpl_dir', "class/tpl/"); if (!is_dir('tmp')) { mkdir('tmp', 0705); chmod('tmp', 0705); } raintpl::configure('cache_dir', "tmp/"); raintpl::configure('path_replace', false); $this->tpl = new RainTPL(); $this->tpl->assign($this->var); $this->tpl->draw($file); //include $file; }
public function loadView($fileName, $data = array(), $return_string = false) { require_once CORE_DIR . '/rain.tpl.class.php'; raintpl::configure("base_url", null); raintpl::configure("tpl_dir", APP_DIR . "/views/"); raintpl::configure("cache_dir", APP_DIR . "/cache/"); $tpl = new RainTPL(); foreach ($data as $key => $val) { $tpl->assign($key, $val); } $tpl->assign("baseURL", baseURL()); if ($return_string) { $html = $tpl->draw($fileName, true); return $html; } else { $tpl->draw($fileName, false); } }
<?php require_once "/home/neku/www/page/public/rain/rain.tpl.class.php"; raintpl::configure('path_replace', false); raintpl::configure('tpl_dir', '/home/neku/www/page/public/rain/template/'); raintpl::configure('cache_dir', '/home/neku/www/page/public/rain/cache/'); $tpl = new RainTPL(); $title = "Temp File Hosting"; $tpl->assign("title", $title); $tpl->draw("header"); $tpl->assign("filename", $n); $tpl->draw("upload-done"); $tpl->draw("footer");
} } else { $fsc = new fs_controller(); } if (!isset($_GET['page'])) { /// redireccionamos a la página definida por el usuario $fsc->select_default_page(); } if ($fsc->template and !$fsc_error) { /// configuramos rain.tpl raintpl::configure('base_url', NULL); raintpl::configure('tpl_dir', 'view/'); raintpl::configure('path_replace', FALSE); /// ¿Se puede escribir sobre la carpeta temporal? if (is_writable('tmp')) { raintpl::configure('cache_dir', 'tmp/' . FS_TMP_NAME); } else { echo '<center>' . '<h1>No se puede escribir sobre la carpeta tmp de FacturaScripts</h1>' . '<p>Consulta la <a target="_blank" href="//www.facturascripts.com/comm3/index.php?page=community_item&id=351">documentación</a>.</p>' . '</center>'; die('<center><iframe src="//www.facturascripts.com/comm3/index.php?page=community_item&id=351" width="90%" height="800"></iframe></center>'); } $tpl = new RainTPL(); $tpl->assign('fsc', $fsc); if (isset($_POST['user'])) { $tpl->assign('nlogin', $_POST['user']); } else { if (isset($_COOKIE['user'])) { $tpl->assign('nlogin', $_COOKIE['user']); } else { $tpl->assign('nlogin', ''); } }
<?php include './config.php'; include './classes/Helper.class.php'; $GLOBALS['site'] = "start"; if (isset($_GET['site']) && is_string($_GET['site'])) { $name = basename(preg_replace('/[^(\\x20-\\x7F)]*/', '', $_GET['site'])); if (file_exists('./module/' . $name . '.php')) { $GLOBALS['site'] = $name; } } Helper::loadClasses(); $GLOBALS['template'] = new raintpl(); raintpl::configure('tpl_dir', './templates/'); raintpl::configure('cache_dir', './cache/templates/'); include './module/' . $GLOBALS['site'] . '.php'; $content = Routing::getInstance()->render(); $GLOBALS['template']->assign('content', $content); include './boxes/login.php'; include './boxes/status.php'; include './boxes/navigation.php'; include './boxes/ping.php'; $GLOBALS['template']->assign('box_news', file_get_contents('boxes/news.php')); if (isset($GLOBALS['just_content']) && $GLOBALS['just_content'] == true) { $GLOBALS['template']->draw("index_just_content"); } else { $GLOBALS['template']->draw("index"); }
} } else { $fsc = new fs_controller(); } if (!isset($_GET['page'])) { /// redireccionamos a la página definida por el usuario $fsc->select_default_page(); } if ($fsc->template) { /// configuramos rain.tpl raintpl::configure('base_url', NULL); raintpl::configure('tpl_dir', 'view/'); raintpl::configure('path_replace', FALSE); /// ¿Se puede escribir sobre la carpeta temporal? if (is_writable('tmp')) { raintpl::configure('cache_dir', 'tmp/'); } else { echo '<center>' . '<h1>No se puede escribir sobre la carpeta tmp de FacturaScripts</h1>' . '<p>Consulta la <a target="_blank" href="//www.facturascripts.com/comm3/index.php?page=community_item&id=351">documentación</a>.</p>' . '</center>'; die('<center><iframe src="//www.facturascripts.com/comm3/index.php?page=community_item&id=351" width="90%" height="800"></iframe></center>'); } $tpl = new RainTPL(); $tpl->assign('fsc', $fsc); if (isset($_COOKIE['user'])) { $tpl->assign('nlogin', $_COOKIE['user']); } else { $tpl->assign('nlogin', ''); } $tpl->draw($fsc->template); } $fsc->close(); }
<?php /* * BtiTracker v1.5.0 is a php tracker system for BitTorrent, easy to setup and configure. * This tracker is a frontend for DeHackEd's tracker, aka phpBTTracker (now heavely modified). * Updated and Maintained by Yupy. * Copyright (C) 2004-2014 Btiteam.org */ require_once CLASS_PATH . 'class.Template.php'; raintpl::configure("base_url", null); raintpl::configure("tpl_dir", ""); raintpl::configure("cache_dir", "cache/"); $tpl = new RainTPL(); dbconn(); function standardheader($title, $normalpage = true, $idlang = 0) { global $SITENAME, $STYLEPATH, $USERLANG, $time_start, $gzip, $GZIP_ENABLED, $err_msg_install, $db; $time_start = get_microtime(); // default settings for blocks/menu if (!isset($GLOBALS["charset"])) { $GLOBALS["charset"] = "iso-8859-1"; } // controll if client can handle gzip if ($GZIP_ENABLED && user::$current['uid'] > 1) { if (stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") && extension_loaded('zlib') && ini_get("zlib.output_compression") == 0) { if (ini_get('output_handler') != 'ob_gzhandler') { ob_start("ob_gzhandler"); $gzip = 'enabled'; } else { ob_start(); $gzip = 'enabled';
// // 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; either version 2 of the License, or // (at your option) any later version. // require_once "includes/superfecta_base.php"; $superfecta = new superfecta_base(); //Define our rootpath define("SUPERFECTA_ROOT_PATH", dirname(__FILE__) . '/'); //Include templating engine require_once SUPERFECTA_ROOT_PATH . 'includes/rain.tpl.class.php'; //Define template locations raintpl::configure("base_url", SUPERFECTA_ROOT_PATH . '/views/images/'); raintpl::configure("tpl_dir", SUPERFECTA_ROOT_PATH . 'views/'); raintpl::configure("cache_dir", SUPERFECTA_ROOT_PATH . 'views/compiled/'); //Setup templating engine $supertpl = new RainTPL(); $scheme = isset($_REQUEST['scheme']) ? $_REQUEST['scheme'] : ''; $module_info = $superfecta->xml2array("modules/superfecta/module.xml"); $schemecopy = ''; $goto = NULL; //create a copy of a scheme if requested if ($schemecopy != "") { //determine the highest order amount. $query = "SELECT MAX(ABS(value)) FROM superfectaconfig WHERE field = 'order'"; $results = sql($query, "getAll"); $new_order = $results[0][0] + 1; //set new scheme name $name_good = false; $new_name = $schemecopy . ' copy';
* Init - file * * @ Kaveh Raji <*****@*****.**> */ define("ROOTPATH", $_SERVER["DOCUMENT_ROOT"] . "/"); define("PROJECTPATH", ROOTPATH . "Your-Project-Path/"); /* * First including the configuration - file which can contain neccessary - data */ include PROJECTPATH . "inc/conf.inc.php"; //include the RainTPL class include PROJECTPATH . "inc/rain.tpl.class.php"; raintpl::configure("base_url", null); raintpl::configure("tpl_dir", "tpl/"); raintpl::configure("cache_dir", "tmp/"); raintpl::configure('path_replace', false); $tpl = new RainTPL(); /* * Now including some libaries needed */ include PROJECTPATH . "inc/libs/vitabytes/sleekshop_request.inc.php"; include PROJECTPATH . "inc/libs/vitabytes/mailing.inc.php"; /* * Including models and controllers */ include PROJECTPATH . "inc/categories.inc.php"; include PROJECTPATH . "inc/shopobjects.inc.php"; include PROJECTPATH . "inc/session.inc.php"; include PROJECTPATH . "inc/cart.inc.php"; include PROJECTPATH . "inc/user.inc.php"; include PROJECTPATH . "inc/order.inc.php";
$_SESSION['currentUser'] = serialize($myUser); } } if (!$myUser && isset($_COOKIE[$conf->get('COOKIE_NAME')])) { $users = User::getAllUsers(); foreach ($users as $user) { if ($user->getCookie() == $_COOKIE[$conf->get('COOKIE_NAME')]) { $myUser = $user; $myUser->loadRight(); } } } //Instanciation du template $tpl = new RainTPL(); //Definition des dossiers de template raintpl::configure("base_url", null); raintpl::configure("tpl_dir", './templates/' . $conf->get('DEFAULT_THEME') . '/'); raintpl::configure("cache_dir", "./cache/tmp/"); $view = ''; $rank = new Rank(); if ($myUser != false && $myUser->getRank() != false) { $rank = $rank->getById($myUser->getRank()); } $tpl->assign('myUser', $myUser); $tpl->assign('userManager', $userManager); $tpl->assign('configurationManager', $conf); $tpl->assign('error', $error); $tpl->assign('notice', $message); $tpl->assign('_', $_); $tpl->assign('action', ''); $tpl->assign('rank', $rank);
public static function replaceRainTpl($code) { $function = self::loadFunction($code, 'draw'); $function = preg_replace('/public /m', '', $function); $code = self::replaceFunction($code, 'draw'); include "inc/lib/raintpl/Rain.php"; raintpl::configure('tpl_dir', "class/tpl/"); if (!is_dir('tmp')) { mkdir('tmp', 0705); chmod('tmp', 0705); } raintpl::configure('cache_dir', "tmp/"); raintpl::configure('path_replace', false); $arrayTpl = glob("class/tpl/*.html"); $rain = new Rain(); foreach ($arrayTpl as $tpl) { $tpl = str_replace('.html', '', basename($tpl)); $test = file_get_contents('class/tpl/' . $tpl . '.html'); $test = str_replace(array("<?", "?>"), array("<?", "?>"), $test); $tmp = $rain->compileTemplate($test, 'class/tpl'); $lines = explode(PHP_EOL, $tmp); for ($i = 0; $i < count($lines); $i++) { if (preg_match('/Rain/', $lines[$i])) { $lines[$i] = self::replaceIncludeRainTpl($lines[$i]); } } $function = ' public static function ' . $tpl . 'Tpl() { extract(FeedPage::$var); ?> ' . implode("\n", $lines) . ' <?php } '; $code = self::insertFunction($code, $function, 'FeedPage'); } $code = preg_replace('/=\\$this->var\\[/', '=FeedPage::$var[', $code); return $code; }
TODO: penser a ajouter la gestion des utilisateurs et des fichiers sauvegarder via XML: http://php.net/manual/en/function.simplexml-load-string.php */ if (isset($_GET['logout'])) { Session::logout(); header('Location: index.php'); die; } else { if (isset($_POST['login']) && isset($_POST['password'])) { $user = User::getUser('./conf/', $_POST['login']); if ($user && $user->getPassword() != null && Session::login($_POST['login'], User::getHashPassword($_POST['password']), $user->getLogin(), $user->getPassword())) { if (Session::isLogged() && $_SESSION['username'] != null && !is_dir('./' . SAVED_PATH . '/' . $_SESSION['username'])) { mkdir('./' . SAVED_PATH . '/' . $_SESSION['username'], 0705); } header('Location: index.php'); die; } } } raintpl::$tpl_dir = './tpl/'; // template directory raintpl::$cache_dir = "./cache/"; // cache directory raintpl::$base_url = url(); // base URL of blog raintpl::configure('path_replace', false); raintpl::configure('debug', true); $tpl = new raintpl(); //include Rain TPL $tpl->draw("login"); // draw the template
<?php require_once "rain/rain.tpl.class.php"; raintpl::configure('path_replace', false); raintpl::configure('tpl_dir', 'rain/template/'); raintpl::configure('cache_dir', 'rain/cache/'); $tpl = new RainTPL(); $title = "Temp File Hosting"; if (isset($_GET['info'])) { $title = "Info"; } $tpl->assign("title", $title); $tpl->draw("header"); if (isset($_GET['info'])) { $tpl->draw("info"); } else { $tpl->draw("upload"); } $tpl->draw("footer");
<?php /*** include the controller class ***/ include __SITE_PATH . '/application/' . 'controller_base.class.php'; /*** include the registry class ***/ include __SITE_PATH . '/application/' . 'registry.class.php'; /*** include the router class ***/ include __SITE_PATH . '/application/' . 'router.class.php'; /*** include the template class ***/ //include __SITE_PATH . '/application/' . 'template.class.php'; // Original TPL Class include __SITE_PATH . '/application/' . 'rainTPL.class.php'; raintpl::$tpl_dir = __SITE_PATH . '/views/'; raintpl::$cache_dir = __SITE_PATH . '/cache/'; raintpl::configure('base_url', __SITE_PATH); $config = parse_ini_file("application/config.ini", 1); /*** auto load model classes ***/ function __autoload($class_name) { $filename = strtolower($class_name) . '.class.php'; $file = __SITE_PATH . '/model/' . $filename; if (file_exists($file) == false) { return false; } include $file; } /*** a new registry object ***/ $registry = new registry(); $registry->DB_Conn = $config['db_conn']; $registry->config = $config; /*** create the database registry object ***/ $registry->database = new db($registry->DB_Conn);
} return $str; } function crypt_password($pass, $salt) { return crypt($pass, "\$2y\$08\$" . $salt); } // the session_start(); if (!isset($_SESSION['logged_in'])) { $_SESSION['logged_in'] = false; } if (!isset($notemplate)) { require_once 'ext/rain.tpl.class.php'; raintpl::configure("path_replace", false); raintpl::configure("tpl_dir", "views/"); $tpl = new RainTPL(); // new words counter $new_words_count = -1; if ($_SESSION['logged_in'] === true) { $res = $sql->query("SELECT `id` FROM `words` WHERE `new` = 1;"); $new_words_count = $res->num_rows; } // total words count $res = $sql->query("SELECT `id` FROM `words`;"); $words_total_count = $res->num_rows * 3; // site name $res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"sitename\";")->fetch_assoc(); $site_name = htmlspecialchars($res['value']); // user name $res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"username\";")->fetch_assoc();
<?php include "lib/rain.tpl.class.php"; raintpl::configure("base_url", null); raintpl::configure("tpl_dir", "tpl/"); raintpl::configure("cache_dir", "temp/"); $tpl = new RainTPL(); require_once "lib/init.php"; require_once "lib/database.class.php"; include "lib/Parsedown.php"; $Parsedown = new Parsedown(); $newPost = ""; // Get parameters from URL if (isset($_GET['page'])) { // Load up the correct post from URL slug $loadSlug = $_GET['page']; $auth = isset($_SESSION['user']); // load database $db = Database::getInstance(); $db->query("SELECT * FROM posts WHERE urlslug=? LIMIT 1", array($loadSlug)); $result = $db->firstResult(); $title = ""; $date = ""; $body = ""; $parentMU = ""; $sidebar = ""; $tagsList = ""; if ($result != null) { // Post was found. Load the contents and display them. $title = $result['title']; $date = date('M.d.Y', strtotime($result['lastedit']));
public function __construct($options = array()) { $rootdir = PATH; raintpl::configure("base_url", $rootdir); raintpl::configure("tpl_dir", $rootdir . "/res/tpl/"); raintpl::configure("cache_dir", $rootdir . "/res/tpl/tmp/"); raintpl::configure("path_replace", false); $options = array_merge($this->options, $options); if (isset($_SESSION["lang"])) { $options["strings"] = $_SESSION["lang"]; } $options['data']['string'] = $this->loadString($options["strings"]); $tpl = $this->getTpl(); $this->options = $options; if (gettype($this->options['data']) == 'array') { foreach ($this->options['data'] as $key => $val) { $tpl->assign($key, $val); } } $tpl->draw("header", false); }