Exemplo n.º 1
0
$user = null;
// get a user from the session
if ($facebookID = array_val($_SESSION, 'facebookID')) {
    // will throw an exception if invalid
    $user = m('user', $facebookID);
}
// a user called from the wib NAL, will throw an exception if invalid
if ($wib_session_user_id = array_val($_REQUEST, 'wib_session_user')) {
    $user = m($wib_session_user_id);
}
// if we are logged in then set some useful defines and setup some other classes
if ($user) {
    define('CURRENT_UID', $user->getID());
    define('CURRENT_SESSION_KEY', $user->get_facebook_token());
    // 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
Exemplo n.º 2
0
<?php

// test root directory
define('TEST_ROOT', realpath(dirname(__FILE__) . '/../') . '/');
// include the core for the framework
require TEST_ROOT . 'core/header.php';
// http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html
require_once 'PHPUnit/Framework.php';
// include our wrapper "test" for the PHPUnit_Framework_TestCase
require 'test.php';
// the MVC requires a view class, this view captures the changes so we can write unit tests
require 'view.php';
// craig's user
$test_user = m('user', 507521266);
// for tests that require a users is logged in
Test::setUser($test_user);
// were going to call facebook using this users session
FB::setSessionUser($test_user);
// tell wib client who the active user is
WIB::setSessionUser($test_user);