function generate($template, $data = null) { $this->load_library('rain.tpl.class'); raintpl::$tpl_dir = ROOT . "/application/templates/email/"; // template directory $tpl = new raintpl(); //include Rain TPL if (isset($data)) { $data = Utils::decode($data); $tpl->assign($data); } if (!get_config('email.debug_templates')) { $this->message = @$tpl->draw($template, true); } else { $this->message = $tpl->draw($template, true); } // draw the template }
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 }
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 if ($user->data['user_id'] == ANONYMOUS) { error_box("Erreur", "Vous devez être connecté pour accèder à cette page.", "index.php"); exit; } $tpl = new raintpl(); if (!empty($user->data['partner']) && !empty($user->data['tokken'])) { $tpl->assign("link", "https://steamcommunity.com/tradeoffer/new/?partner=" . $user->data['partner'] . "&token=" . $user->data['tokken'] . ""); } draw($tpl->draw("page_trade", $return_string = true), "Mise à jour");
<?php $tpl = new raintpl(); $tpl->assign('steamid', str_replace("STEAM_0", "STEAM_1", $user->data['steamid'])); draw($tpl->draw("page_roleplay", $return_string = true), "roleplay", array("angular.route.min.js", "heatmap.min.js", "jquery.maphilight.js", "angular.dnd.min.js"));
<?php if ($user->data['user_id'] == ANONYMOUS) { error_box("Erreur", "Vous devez vous connecter pour acceder a cette page."); exit; } if ($user->data['steamid'] == 'notset' || $user->data['steamid'] == '') { error_box("Erreur", "Vous devez vous connecter pour acceder a cette page."); exit; } $query = mysql_query("SELECT * FROM `srv_bans` WHERE `SteamID`='" . $user->data['steamid'] . "' AND (`Length`='0' OR `EndTime`>UNIX_TIMESTAMP()) AND `is_unban`='0';"); while ($row2 = mysql_fetch_array($query)) { error_box("Erreur", "Vous etes bannis d'un de nos serveurs, et n'avez pas acces a cette page."); exit; } $tpl = new raintpl(); $tpl->assign('steamid', str_replace("STEAM_0", "STEAM_1", $user->data['steamid'])); draw($tpl->draw("page_report", $return_string = true), "Plainte téléphone", array("angular.min.js"));
print "blabla"; print_r($_GET); die; } $content = file_get_contents($_GET['page']); $content = str_replace("{{{year}}}", date("Y"), $content); $content = str_replace("{{{fullname}}}", "Mémîks", $content); $content = str_replace("\n", "<br>", $content); 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("title", $_GET['page']); $tpl->assign("content", $content); $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->draw("display"); // draw the template
$tpl->assign("HEAD", $HEAD); $tpl->assign("END", $END); $tpl->assign("AJAX", $AJAX); $dataMySQL->ExecuteSQL("SELECT COUNT(*) from `" . DB_PREFIX . "users` WHERE 1 ;"); $allUSERS = $dataMySQL->ArrayResult(); $dataMySQL->ExecuteSQL("SELECT COUNT(*) FROM `" . DB_PREFIX . "users` WHERE `idc` > 4150;"); $cUSERS = $dataMySQL->ArrayResult(); $COUS = $cUSERS['COUNT(*)'] / $allUSERS['COUNT(*)'] * 100; $NCOUS = $cUSERS['COUNT(*)']; $ACOUS = $allUSERS['COUNT(*)'] - $cUSERS['COUNT(*)']; $tpl->assign("COUS", $COUS); $tpl->assign("COUS2", 100 - $COUS); $tpl->assign("NCOUS", $NCOUS); $tpl->assign("ACOUS", $ACOUS); $tpl->assign("DATE", date("Y") . " " . $version); $tpl->assign("IP", $_SERVER["REMOTE_ADDR"]); $tpl->assign("module", $thispage); //echo $dataMySQL->sLastQuery; //if($ajaxer!==3 && LEVEL!=="1") $content.="<script>console.log('".LEVEL." {$thispage}');$(\".current\").html(\"{$thispage}\")</script>"; //if($ajaxer!==3 && LEVEL==1) $content.="<script>console.log('LEVEL ".LEVEL.": {$thispage}');$(\".current\").html(\"{$thispage} (query:".$dataMySQL->queryS.")\")</script>"; $tpl->assign("contents", $content); for ($n = 0; $n < count($_HOSTEL_NETS); $n++) { $hostelnets .= '<li class=""><a onclick="get_ajax(\'/ajax3/users/net/' . str_replace("/", "_", $_HOSTEL_NETS[$n]) . '/\', \'.ajaxer\');return false;" href="/users/net/' . str_replace("/", "_", $_HOSTEL_NETS[$n]) . '/"><i class="entypo-list"></i> <span>Список <span class="btn btn-success btn-sm ">' . $_HOSTEL_NETS[$n] . '</span></span></a></li>'; } $tpl->assign("hostelnets", $hostelnets); $tpl->draw("main"); } else { $tpl->assign("login", $content); $tpl->draw("unlogin"); } $dataMySQL->DisConnect();
<?php include_once 'includes/homematic.php'; include_once 'includes/rain.tpl.class.php'; $home = new HomeMaticInstance(); $tempset["regular"] = new tempsetInstance(); $tempset["regular"]->addTemp("07:00", 19, $tempset["regular"]->presetWorkday); $tempset["regular"]->addTemp("09:00", 17, $tempset["regular"]->presetWorkday); $tempset["regular"]->addTemp("18:00", 19, $tempset["regular"]->presetWorkday); $tempset["regular"]->addTemp("23:00", 17, $tempset["regular"]->presetWorkday); $tempset["regular"]->addTemp("08:00", 20, $tempset["regular"]->presetWeekend); $tempset["regular"]->addTemp("11:00", 17, $tempset["regular"]->presetWorkday); $tempset["nothome"] = new tempsetInstance(); $tempset["nothome"]->addTemp("01:00", 17); raintpl::$tpl_dir = "tpl/"; raintpl::$cache_dir = "/tmp/"; raintpl::$base_url = "/"; raintpl::$path_replace = true; $tpl = new raintpl(); $tpl->assign("deviceList", $home->getAllDevices(true)); $tpl->draw('index');