コード例 #1
0
ファイル: init.inc.php プロジェクト: RobMacKay/Helix
}
// Creates the database tables if set to true
if (BUILD_DATABASE === TRUE) {
    DB_Actions::build_database();
}
// Check for a valid session
AdminUtilities::check_session();
/*******************************************************************************
* Break apart the URL and determine what data needs to be loaded
*******************************************************************************/
// URL Parsing - Read the URL and break it apart for processing
$url_array = Utilities::read_url();
// Load the menu
$menu = new Menu($url_array);
// Load the page attributes from the menu array
$menu_page = DB_Actions::get_page_data_by_slug($url_array[0]);
// Check if the page should actually be shown as main content
if (property_exists($menu_page, 'show_full') && $menu_page->show_full != 1) {
    header("Location: /" . DB_Actions::get_default_page());
    exit;
} else {
    if ($menu_page === FALSE) {
        require_once CMS_PATH . 'core/helper/class.missing.inc.php';
        $menu_page->page_name = 'Invalid URL';
        $menu_page->type = 'Missing';
    }
}
/*******************************************************************************
* Initialize the main content class and load entry data
*******************************************************************************/
// Create a new object for the correct page type
コード例 #2
0
ファイル: class.form.inc.php プロジェクト: RobMacKay/Helix
 private static function _create_class()
 {
     // Make sure the page conforms to the slug format
     if (SIV::validate($_REQUEST['page'], SIV::SLUG)) {
         $page = strtolower($_REQUEST['page']);
         $page_data = DB_Actions::get_page_data_by_slug($page);
     } else {
         // Throw an exception and die
         ECMS_Error::log_exception(new Exception("Page \"{$page}\" isn't valid."));
     }
     // The Admin class is a special case, and needs to be loaded manually
     if ($page === 'admin') {
         require_once CMS_PATH . 'core/helper/class.admin.inc.php';
         $class = 'Admin';
     } else {
         if ($page === 'menu') {
             $class = 'Menu';
         } else {
             if ($page === 'comments') {
                 require_once CMS_PATH . 'core/helper/class.comments.inc.php';
                 $class = 'Comments';
             } else {
                 if (is_object($page_data)) {
                     $class = $page_data->type;
                     if (empty($class)) {
                         // Throw an exception and die
                         ECMS_Error::log_exception(new Exception("Page \"{$page}\" doesn't actually exist."));
                     }
                 } else {
                     // Throw an exception and die
                     ECMS_Error::log_exception(new Exception("Unsupported page type \"{$page}\" supplied."));
                 }
             }
         }
     }
     // Create a new instance of the appropriate class
     return new $class(array($page));
 }