Пример #1
0
$mountfiles = $mountdata . "/files/";
$mountsys = $mountdata . "/sys/";
$patch = $dolphii . "/patch/";
$patchfiles = $patch . "/files/";
$patchsys = $patch . "/sys/";
/* My pagination system */
/* API is not really an API, maybe it is idk */
/* it just returns doesn't return an HTML page */
$allowedpages = array_diff(scandir($pages), array('..', '.'));
$allowedapis = array_diff(scandir($apis), array('..', '.'));
if (isset($_GET['page'])) {
    includePage($_GET['page']);
} elseif (isset($_GET['api'])) {
    includeAPI($_GET['api']);
} else {
    includePage('default');
}
function includePage($page)
{
    global $allowedpages;
    global $pages;
    if (!in_array($page, $allowedpages)) {
        $page = 'default';
    }
    include "start.php";
    $pathprefix = "{$pages}/{$page}/";
    include "{$pathprefix}/{$page}.php";
}
function includeAPI($api)
{
    global $allowedchannels;
Пример #2
0
        $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
    }
    if (!strlen($page['template'])) {
        if (cf\Page::isDescendantOf($page, 'catalog')) {
            $page['template'] = 'category';
        } else {
            $page['template'] = 'page';
            //resolveTemplate($page['parent_id']);
        }
    }
    function includePage(&$page, &$crumbs, $pathInfo)
    {
        global $smarty;
        return require_once dirname(__FILE__) . '/' . $page['template'] . '.php';
    }
    $pageFound = false;
    if (file_exists(dirname(__FILE__) . '/' . $page['template'] . '.php')) {
        $pageFound = includePage($page, $crumbs, $pathInfo);
    }
    if (strlen($pathInfo['notfound']) && !$pageFound) {
        $page = cf\Page::get('error404');
        includePage($page, $crumbs, $pathInfo);
    }
    $smarty->assign('page', $page);
    $smarty->assign('crumbs', $crumbs);
    $tpl = file_exists(dirname(__FILE__) . '/templates/' . $page['template'] . '.tpl') ? $page['template'] : 'page';
    $smarty->display("{$tpl}.tpl");
} catch (Exception $e) {
    header("Location: /error404");
    exit;
}
Пример #3
0
<?php

function includePage($pageName)
{
    $filename = "content/" . $pageName . ".php";
    if (file_exists($filename)) {
        include_once $filename;
    } else {
        include_once "content/404.php";
    }
}
include_once "parts/header_main.php";
include_once "parts/sidebar.php";
if (array_key_exists('p', $_GET)) {
    includePage($_GET['p']);
} else {
    includePage('main');
}
//$_GET['p']
//$filename = "content/".$_GET['p'].".php";
//if ( file_exists ( $filename ) ) {
//    include_once $filename;
//} else {
//    include_once "content/404.php";
//}
//include_once "content/main.php";
include_once "parts/footer.php";