// Try to set max upload file size and read (May not work on some hosts). ini_set('post_max_size', '16M'); ini_set('upload_max_filesize', '16M'); checkphpversion(); error_reporting(E_ALL ^ E_WARNING); // See all error except warnings. //error_reporting(-1); // See all errors (for debugging only) include "inc/rain.tpl.class.php"; //include Rain TPL raintpl::$tpl_dir = "tpl_bilbo/"; // template directory if (!is_dir('tmp')) { mkdir('tmp', 0705); chmod('tmp', 0705); } raintpl::$cache_dir = dirname(__FILE__) . "/../data/tmp/"; // cache directory ob_start(); // Output buffering for the page cache. // In case stupid admin has left magic_quotes enabled in php.ini: if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } // Prevent caching on client side or proxy: (yes, it's ugly)
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 }
/** * Initialize the smarty and display object * @param String $paramTemplateDir smarty/template dir * @param String $paramCacheDir smarty/cache dir */ public function __construct($paramTemplateDir, $paramCacheDir = false) { if (!$paramCacheDir) { $paramCacheDir = ROOT . "/tpl/tmp/"; } raintpl::$tpl_dir = $paramTemplateDir; raintpl::$cache_dir = $paramCacheDir; $this->raintpl = new raintpl(); $this->rendered = false; $this->tpls = array(); $this->objects = array(); $this->head = "<meta name=\"generator\" content=\"OrongoCMS r" . REVISION . "\" />"; $this->js = ""; $this->generalhtml = ""; $this->imports = array(); $this->pluginhtml = array(); $this->pluginhtml['before_article'] = ""; $this->pluginhtml['before_page'] = ""; $this->pluginhtml['after_page'] = ""; $this->pluginhtml['after_article'] = ""; $this->import(orongoURL("js/widget.prettyAlert.js")); }
ini_set('session.use_trans_sid', false); session_name('shaarli'); // Start session if needed (Some server auto-start sessions). if (session_id() == '') { session_start(); } // Regenerate session ID if invalid or not defined in cookie. if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) { session_regenerate_id(true); $_COOKIE['shaarli'] = session_id(); } include "inc/rain.tpl.class.php"; //include Rain TPL raintpl::$tpl_dir = $GLOBALS['config']['RAINTPL_TPL']; // template directory raintpl::$cache_dir = $GLOBALS['config']['RAINTPL_TMP']; // cache directory $pluginManager = PluginManager::getInstance(); $pluginManager->load($GLOBALS['config']['ENABLED_PLUGINS']); ob_start(); // Output buffering for the page cache. // In case stupid admin has left magic_quotes enabled in php.ini: if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
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 /*** 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);
/** * Creates new Rain instance if it doesn't already exist, and returns it. * * @throws RuntimeException If Rain lib directory does not exist. * @return RainInstance */ private function getInstance() { if (!self::$rainInstance) { if (!is_dir(self::$rainDirectory)) { throw new \RuntimeException('Cannot set the Rain lib directory : ' . self::$rainDirectory . '. Directory does not exist.'); } require_once self::$rainDirectory . '/rain.tpl.class.php'; raintpl::$tpl_dir = self::$rainTemplatesDirectory; raintpl::$cache_dir = self::$rainCacheDirectory; self::$rainInstance = new \raintpl(); } return self::$rainInstance; }
function Raintpl_View($tpl_dir, $cache_dir, $base_url) { raintpl::$tpl_dir = $tpl_dir; raintpl::$cache_dir = $cache_dir; raintpl::$base_url = $base_url; }
/** * Creates new Rain instance if it doesn't already exist, and returns it. * * @throws RuntimeException If Rain lib directory does not exist. * @return RainInstance */ private function getInstance() { if (!$this->rainInstance) { if (!is_dir($this->rainDirectory)) { throw new RuntimeException('Cannot set the Rain lib directory : ' . $this->rainDirectory . '. Directory does not exist.'); } require_once $this->rainDirectory . '/rain.tpl.class.php'; raintpl::$tpl_dir = $this->rainTemplatesDirectory; raintpl::$cache_dir = $this->rainCacheDirectory; $this->rainInstance = new raintpl(); } return $this->rainInstance; }
require_once ENGINE_DIR . '/classes/class.mysql.php'; $dataMySQL = new MySQL(); require_once ENGINE_DIR . '/init.login.php'; if ($mob == "1") { define('MOBILEDEV', true); } else { define('MOBILEDEV', false); } /*define('MOBILEDEV', false);*/ $AJAX = get_AJAX($mob); //echo $_SESSION['mobile_enable']; require_once ENGINE_DIR . '/classes/template/inc/rain.tpl.class.php'; //include Rain TPL $tpl = new raintpl(); raintpl::$tpl_dir = ENGINE_DIR . '/template/AdminLTE-2.3.0/'; raintpl::$cache_dir = ENGINE_DIR . '/tmp/'; raintpl::configure('tpl_ext', 'html'); raintpl::configure('base_url', $CONFIG['base_url']); raintpl::configure('path_replace', false); $tpl->assign("THEMEDIR", "/root/template"); $rd = array(0 => "progress-success", 1 => "progress-warning", 2 => "progress-danger", 3 => "", 4 => "progress-success", 5 => "progress-success"); $tpl->assign("RANDOMBAR", $rd[mt_rand(0, 5)]); $tpl->assign("alert", "NAN"); //if(MOBILEDEV) raintpl::$tpl_dir = ROOT_DIR.'/root/template/mobile/'; // //if($_GET['ajax']==2) raintpl::$tpl_dir = ROOT_DIR.'/root/template/ajax/'; if (AJAXTPL) { raintpl::$tpl_dir = ROOT_DIR . '/root/template/ajax/'; } //if($_GET['ajax']==1) raintpl::$tpl_dir = ROOT_DIR.'/root/template/frame/'; $HEAD = "\n\t<script type=\"text/javascript\">\n\tfunction goBack()\n\t {\n\t window.history.back()\n\t }\n\t</script>";
// Try to set max upload file size and read (May not work on some hosts). ini_set('post_max_size', '16M'); ini_set('upload_max_filesize', '16M'); checkphpversion(); error_reporting(E_ALL ^ E_WARNING); // See all error except warnings. //error_reporting(-1); // See all errors (for debugging only) include "inc/rain.tpl.class.php"; //include Rain TPL raintpl::$tpl_dir = "tpl/"; // template directory if (!is_dir('tmp')) { mkdir('tmp', 0705); chmod('tmp', 0705); } raintpl::$cache_dir = "tmp/"; // cache directory ob_start(); // Output buffering for the page cache. // In case stupid admin has left magic_quotes enabled in php.ini: if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } // Prevent caching on client side or proxy: (yes, it's ugly)
error_reporting(E_ALL ^ E_WARNING); // See all error except warnings. //error_reporting(-1); // See all errors (for debugging only) include "inc/rain.tpl.class.php"; //include Rain TPL raintpl::$tpl_dir = "tpl/"; // template directory $raintpl_tmpdir = $GLOBALS['config']['RTP_TMPDIR']; if (substr($raintpl_tmpdir, -1) != '/') { $raintpl_tmpdir = $raintpl_tmpdir . '/'; } if (!is_dir($raintpl_tmpdir)) { mkdir($raintpl_tmpdir, 0705); chmod($raintpl_tmpdir, 0705); } raintpl::$cache_dir = $raintpl_tmpdir; // cache directory. must end with '/' ob_start(); // Output buffering for the page cache. // In case stupid admin has left magic_quotes enabled in php.ini: if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } // Prevent caching on client side or proxy: (yes, it's ugly)