Example #1
0
    // were going to call facebook using this users session
    FB::setSessionUser($user);
    // tell wib client who the active user is
    WIB::setSessionUser($user);
} else {
    define('CURRENT_UID', NULL);
    define('CURRENT_SESSION_KEY', NULL);
}
/**
 * the HTTP/HTML Template Handler & Presentation Layer (the view in mvc)
 */
require 'view.php';
// we are serving templates out of this folder
Template::setTemplatePath(CORE_PATH . 'view/');
// we are serving templates out of this folder
Template::setLayoutPath(SITE_ROOT . 'htdoc/layout/');
// the uri to target the controller
$controller = array_val($_REQUEST, 'controller');
// lots of people are going to hate this but i want to enforce denying access to global variables
// if we enforce use of $params, it makes is much easier to write tests, and create code which scales
$params = $_REQUEST;
$_REQUEST = $_GET = $_POST = array();
// the controller to dispatch is determined by the controller $_REQUEST variable
// the parameters to pass in are from the http request
// and we are using the HTTP/HTML View
try {
    //
    dispatch_controller($controller, $params, $user);
} catch (Exception $e) {
    // send the error to the error controller with the generated message
    $controller_obj = c('error');