public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
vito (author)
Mon Oct 05 10:48:26 -0700 2009
commit  6caea733a36320fb66f3ad35eae64e967243ddc5
tree    c1d34eccbb1fd6013b19d04f0b6c94c1e6c4e72e
parent  c41fc068cbe4456f5194d5d925ad88e269646e5f
chyrp / index.php
100755 50 lines (37 sloc) 1.747 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
    if (version_compare(PHP_VERSION, "5.1.3", "<"))
        exit("Chyrp requires PHP 5.1.3 or greater.");
 
    require_once "includes/common.php";
 
    # Prepare the controller.
    $main = MainController::current();
 
    # Parse the route.
    $route = Route::current($main);
 
    # Check if the user can view the site.
    if (!$visitor->group->can("view_site") and
        !in_array($route->action, array("login", "logout", "register", "lost_password")))
        if ($trigger->exists("can_not_view_site"))
            $trigger->call("can_not_view_site");
        else
            show_403(__("Access Denied"), __("You are not allowed to view this site."));
 
    # Execute the appropriate Controller responder.
    $route->init();
 
    # If the route failed or nothing was displayed, check for:
    # 1. Module-provided pages.
    # 2. Feather-provided pages.
    # 3. Theme-provided pages.
    if (!$route->success and !$main->displayed) {
        $displayed = false;
 
        foreach ($config->enabled_modules as $module)
            if (file_exists(MODULES_DIR."/".$module."/pages/".$route->action.".php"))
                $displayed = require MODULES_DIR."/".$module."/pages/".$route->action.".php";
 
        if (!$displayed)
            foreach ($config->enabled_feathers as $feather)
                if (file_exists(FEATHERS_DIR."/".$feather."/pages/".$route->action.".php"))
                    $displayed = require FEATHERS_DIR."/".$feather."/pages/".$route->action.".php";
 
        if (!$displayed and $theme->file_exists("pages/".$route->action))
            $main->display("pages/".$route->action);
        elseif (!$displayed)
            show_404();
    }
 
    $trigger->call("end", $route);
 
    ob_end_flush();