init.php
<?php
/* TODO:
* Update @link
*/
/*
* =============================================================================
* Document: init.php
* Created on: Jan 31, 2011,
* at 8:53:58 PM
* Author: Derek Maciel <derekamaciel@gmail.com>
* Short description:
* -
*
* =============================================================================
*
* Long description:
* - (optional)
*
* =============================================================================
*
* This program is part of Novel CMS.
*
* Novel CMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Novel CMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Novel CMS, with a file name of "COPYING". If not, see
* <http://www.gnu.org/licenses/>.
*
* =============================================================================
*
* @project Novel CMS
* @category System Class
* @author Derek Maciel <derekamaciel@gmail.com>
* @copyright 2011 Derek Maciel <derekamaciel@gmail.com>
* @license http://www.gnu.org/licenses/gpl.html GNU GPL, Ver. 3
* @version 1.0.0
* @link http://pear.php.net/package/PackageName
*
* =============================================================================
*/
//To prevent direct script access, users will have to have accessed init.php
if (!defined('INIT')) define('INIT', TRUE);
//Load the global config:
/*
* @TODO: A bug in PHP?! require() or die(); gives
* "Failed opening required '1'"
* Therefore, (require()) is needed.
*/
class Main {
function __construct() {
//Load the uri class
(require(SYSTEMDIR.'uri.'.EXT))
or die("The Novel CMS Initializer wasn't found! =( <br/>" .
"I was looking for <b>'uri.".EXT .
"'</b> in <b>'" . SYSTEMDIR . "'</b>, was this wrong?");
// Load the auth class
(require(SYSTEMDIR.'auth.'.EXT))
or die("The Novel CMS Initializer wasn't found! =( <br/>" .
"I was looking for <b>'auth.".EXT .
"'</b> in <b>'" . SYSTEMDIR . "'</b>, was this wrong?");
// Load the config class
(require(SYSTEMDIR.'config.'.EXT))
or die("The Novel CMS Initializer wasn't found! =( <br/>" .
"I was looking for <b>'config.".EXT .
"'</b> in <b>'" . SYSTEMDIR . "'</b>, was this wrong?");
// Load the error handling class
(require(SYSTEMDIR.'errorhandling.'.EXT))
or die("The Novel CMS Initializer wasn't found! =( <br/>" .
"I was looking for <b>'errorhandling.".EXT .
"'</b> in <b>'" . SYSTEMDIR . "'</b>, was this wrong?");
// Load the configuration files:
$this->config = new Config;
// Load the rest:
$this->uri = new Uri;
$this->auth = new Auth;
$this->errorhandling = new ErrorHandling;
$this->config->sanity();
}
}
config.php
<?php
/* TODO:
* Update @link
*/
/*
* =============================================================================
* Document: config.php
* Created on: Feb 1, 2011,
* at 8:40:45 PM
* Author: Derek Maciel <derekamaciel@gmail.com>
* Short description:
* Loads configuration files.
*
* =============================================================================
*
* Long description:
* This class loads configuration files and is able to retrieve specific
* configuration values. This is extensible--any configuration file for
* any plugin is able to be loaded, as long as you know the name of the
* file.
*
* =============================================================================
*
* This program is part of Novel CMS.
*
* Novel CMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Novel CMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Novel CMS, with a file name of "COPYING". If not, see
* <http://www.gnu.org/licenses/>.
*
* =============================================================================
*
* @project Novel CMS
* @category System Class
* @author Derek Maciel <derekamaciel@gmail.com>
* @copyright 2011 Derek Maciel <derekamaciel@gmail.com>
* @license http://www.gnu.org/licenses/gpl.html GNU GPL, Ver. 3
* @version v1.0.0
* @link http://pear.php.net/package/PackageName
*
* =============================================================================
*/
/*
* REPLACE THIS COMMENT WITH INCLUDES
*/
class Config extends Main
{
/*
* Function __construct
* @param datatype variable description
* @return datatype description
*/
function __construct(/* $arg */) {
$this->load_global("config_global");
}
/*
* Function load_global
* @param array $filename The name of the configuration file.
* @param boolean $throw Whether to throw errors or not
* @return array The configuration values as an array
*/
public function load_global($filename="config", $throw = true) {
(require(CONFIGDIR.$filename.".".EXT))
or die("'".$filename.".".EXT."' could not be found.");
}
public static function sanity()
{
echo "Hello";
}
/*
* Function load_plugin
* @param string $filename The name of the configuration file.
* @param bool $throw Whether to throw errors or not
* @return array The configuration values as an array
*/
public function load_plugin($filename, $throw = true) {
}
}