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
}
Exemple #2
0
   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
 function Raintpl_View($tpl_dir, $cache_dir, $base_url)
 {
     raintpl::$tpl_dir = $tpl_dir;
     raintpl::$cache_dir = $cache_dir;
     raintpl::$base_url = $base_url;
 }
Exemple #4
0
<?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');
Exemple #5
0
<?php

include_once 'includes/sio-call-mgmt.php';
include_once 'includes/rain.tpl.class.php';
include_once 'config/config.inc.php';
$sio = new sioCallMgmt();
raintpl::$tpl_dir = "tpl/";
raintpl::$cache_dir = "/tmp/";
raintpl::$base_url = "/sio-call-mgmt/";
raintpl::$path_replace = true;
$tpl = new raintpl();
session_start();
if (!empty($_SESSION["isAuthenticated"]) && $_SESSION["isAuthenticated"]) {
    $tpl->assign("authenticated", true);
    $sio->setUserId($_SESSION["userId"]);
    $tpl->assign("userDetails", $sio->getUserDetails());
} else {
    $tpl->assign("authenticated", false);
}
#$tpl->assign("settings",$sio->getSettings());
$tpl->draw('index');