Example #1
0
<?php

App::uses('Subpage', 'Model');
$Subpage = new Subpage();
if (Configure::read('debug') == 0) {
    $subpages = Cache::read('subpages', 'long');
    if ($subpages === false) {
        $subpages = $Subpage->getAllPages(true);
    }
} else {
    $subpages = $Subpage->getAllPages(true);
}
Cache::write('subpages', $subpages, 'long');
foreach ($subpages as $page) {
    if (isset($page['Subpage']['controller']) && isset($page['Subpage']['action'])) {
        Router::connect('/' . $page['Subpage']['path'], array('controller' => $page['Subpage']['controller'], 'action' => $page['Subpage']['action'], $page['Subpage']['id'], 'admin' => false));
    } else {
        Router::connect('/' . $page['Subpage']['path'], array('controller' => 'subpages', 'action' => 'renderPage', $page['Subpage']['id'], 'admin' => false));
    }
}
Router::connect('/admin', array('controller' => 'users', 'action' => 'login', 'admin' => true));
CakePlugin::routes();
require CAKE . 'Config' . DS . 'routes.php';
Example #2
0
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: public');
require_once './init.php';
ob_start();
$kio->left = $kio->right = true;
// $module = $block = new stdClass();
// Check for contents to display (int) or to include (string)
$s = ctype_digit(u0) ? (int) u0 : (int) Kio::getConfig('front_page');
// Static page
if ($s) {
    try {
        if (!Module::exists('subpage')) {
            throw new Exception(t('Module dosn&apos;t exists'));
        }
        require_once ROOT . 'modules/subpage/subpage.module.php';
        $module = new Subpage($s);
        echo $module->getContent();
        define('MODULE', 'subpage-' . $s);
    } catch (Exception $e) {
        define('MODULE', 'error');
        echo $e->getMessage();
    }
} else {
    if (u0) {
        switch (u0) {
            // Administration
            case 'admin':
                include_once ROOT . 'admin/index.php';
                if (!$module->name) {
                    $module->name = end($kio->title);
                }