Location: PHPKode > projects > Dev's CMS > devscms/admin/index.php
<?php

require('../includes/class.error.php');

error_reporting(E_ALL | E_STRICT);
set_error_handler(array('errors', 'errorHandler'));
set_exception_handler(array('errors', 'exceptionHandler'));
header ('Content-type: text/html; charset=utf-8');
date_default_timezone_set('Europe/Stockholm');

session_start();

define('ROOT_DIR', '../');
require('../includes/class.system.php');
system::includeLib('auth');

// Config
config::set('system', 'checkTemplate', false);
config::set('system', 'stylesPath', 'styles/');
config::set('system', 'scriptsPath', 'js/');
config::set('gallery', 'path', '../' . config::get('gallery', 'path'));
config::set('gallery', 'uploadPath', '../' . config::get('gallery', 'uploadPath'));
config::set('files', 'path', '../' . config::get('files', 'path'));

// Get vars
$page = isset($_GET['p']) ? $_GET['p'] : '';
$action = isset($_GET['a']) ? $_GET['a'] : '';

// Pages and actions
$pages = array('s' => 'start', 'd' => 'documents', 'n' => 'news', 'f' => 'files', 'l' => 'login', 'g' => 'gallery');
$actions = array('i' => 'index', 'e' => 'edit', 'n' => 'new', 'r' => 'remove', 'u' => 'upload', 'a' => 'auth', 'g' => 'get');

$page = isset($pages[$page]) ? $pages[$page] : 'start';
$action = isset($actions[$action]) ? $actions[$action] : 'index';
$moduleFolder = /*$page == 'start' || $page == 'login' ? '' : */"$page/";
$moduleFolderPhp = empty($moduleFolder) ? '' : "modules/$moduleFolder";
$pageFilename = $action;
$containerTemplate = auth::getInstance()->isLoginPage() ? 'login_container' : 'index';

// Create system
$system = new system($moduleFolder . $pageFilename, $containerTemplate);

// Auth
auth::getInstance()->requireLogin();

// Side menu and objects
if (!auth::getInstance()->isLoginPage()) {
	// Side menu template
	$sideMenuTpl = new template("{$moduleFolder}menu");
	
	// Create objects
	$documents = new documents($system->db);
	$news = new news($system->db);
	$files = new files($system->db);
	$galleryPictures = new galleryPictures($system->db);
	$galleryTags = new galleryTags($system->db);
	$galleryAlbums = new galleryAlbums($system->db);

	require("{$moduleFolderPhp}menu.php");
	$system->mainTemplate->set('sideMenu', $sideMenuTpl);
}

$system->addIncludes('jquery.js');

// Include page
require("$moduleFolderPhp$pageFilename.php");

// Get modules
$modules = array();
foreach ($system->modules as $module) {
	$modules[] = array('href' => '?p=' . substr($module['name'], 0, 1), 'title' => config::get($module, 'name'));
}
$system->mainTemplate->set('modules', $modules);

// Render
$system->render();
Return current item: Dev's CMS