Пример #1
0
function CreateMenu($path, $depth, $template, $title)
{
    $TPL = new LTemplate();
    include_once GC_IPATH . "_base/site-index.php";
    $AllLinks = array();
    reset($SIndex);
    while ($SSite = current($SIndex)) {
        if (substr(key($SIndex), 0, strlen($path)) == $path) {
            $Link['Name'] = extractName(key($SIndex));
            $Link['File'] = GC_WEBPATH . 'show.php?p=' . key($SIndex);
            $AllLinks[] = $Link;
        }
        next($SIndex);
    }
    $TPL->set('Title', $title);
    $TPL->setBlock('Links', $AllLinks);
    $TPL->render($template);
}
Пример #2
0
function ErrorHandler($errno, $errstr, $errfile, $errline)
{
    $TPL = new LTemplate();
    switch ($errno) {
        case E_ERROR:
            $TPL->set('ERRORTYPE', 'ERROR');
            break;
        case E_WARNING:
            $TPL->set('ERRORTYPE', 'WARNING');
            break;
        case E_PARSE:
            $TPL->set('ERRORTYPE', 'PARSING ERROR');
            break;
        default:
            return;
    }
    $TPL->set('ERRORSTR', $errstr);
    $TPL->set('ERRORFILE', $errfile);
    $TPL->set('ERRORLINE', $errline);
    $TPL->render(GC_PDEFTPL . 'error.tpl');
    exit;
}
Пример #3
0
include_once GC_PLIB . 'libSession.inc';
include_once GC_IPATH . 'functions.php';
//admin includes
include_once GC_PADMIN . 'page-alias.php';
include_once GC_PADMIN . 'admin-functions.php';
////////////////////////////
//Objects
$TPL = new LTemplate();
$Session = new Session();
/////////////////////////////
//  check Session
if (!checkSession()) {
    $TPL->render($SPages['login']);
    exit;
}
if ($_GET['action'] == 'logout') {
    $Session->destroy();
    $TPL->render($SPages['login']);
    exit;
}
//////////////////////////////
//?p=site&s=/news
//TODO check for not available pages
if (empty($_GET['p'])) {
    $_GET['p'] = "example";
}
$Mod = $SPages[$_GET['p']];
//////////////////////////////
$TPL->set('Menu', $SPages['menu']);
$TPL->set('Module', $Mod);
$TPL->render($SPages['basetmpl']);