*        /vendor       If you are using composer then it puts stuff in here.
 *
 * The .htaccess file directs
 *         anything in /assets to be served by Apache.
 *         anything beginning "ajax" to be called directly i.e. ajax.php (this may or may not be useful - remove it if not)
 *         everything else gets passed into this script where it treats the URL thus:
 *                 /                        =>        /home and then
 *                 /action/r/e/st/          =>        Broken down in Context class. An action and an array of parameters.
 *
 *         Query strings and/or post fields are in the $_ arrays as normal.
 */
include 'class/support/framework.php';
Framework::initialise();
$local = Local::getinstance()->setup(__DIR__, FALSE, TRUE, TRUE, TRUE);
# Not Ajax, debug on, load twig, load RB
$context = Context::getinstance()->setup($local);
$action = $context->action();
if ($action === '') {
    $action = 'home';
}
$page = R::findOne('page', 'name=? and active=?', array($action, 1));
if (!is_object($page)) {
    # No such page or it is marked as inactive
    $context->divert('/error/404?page=' . urlencode($_SERVER['REQUEST_URI']));
    # does not return
}
if ($page->needlogin && !$context->hasuser()) {
    # not logged in or not an admin
    $context->divert('/login?page=' . urlencode($local->debase($_SERVER['REQUEST_URI'])));
}
if ($page->admin && !$context->hasadmin()) {
Example #2
0
 * 	   anything in /assets to be served by Apache unless you are usin gthe Assets class to improve caching
 *         anything beginning "ajax" to be called directly i.e. ajax.php (this may or may not be useful - remove it if not)
 *         everything else gets passed into this script where it treats the URL thus:
 *                 /                        =>        /home and then
 *                 /action/r/e/st/          =>        Broken down in Context class. An action and an array of parameters.
 *
 *         Query strings and/or post fields are in the $_ arrays as normal but please use the access functions provided
 *         to get at the values whenever appropriate!
 */
include 'class/support/framework.php';
Framework::initialise();
Config::setup();
# add default headers etc. - anything that the user choses to add to the code.
$local = Local::getinstance()->setup(__DIR__, FALSE, TRUE, TRUE, TRUE);
# Not Ajax, debug on, load twig, load RB
$context = Context::getinstance()->setup();
$mfl = $local->makebasepath('maintenance');
# maintenance mode indicator file
if (file_exists($mfl) && !$context->hasadmin()) {
    # only let administrators in as we are doing maintenance. Could have a similar feature for other roles
    $context->web()->sendtemplate('support/maintenance.twig', StatusCodes::HTTP_OK, 'text/html', ['msg' => file_get_contents($mfl)]);
    exit;
}
$action = $context->action();
if ($action === '') {
    # default to home if there is nothing
    $action = 'home';
}
$mime = Web::HTMLMIME;
/*
 * Look in the database for what to do based on the first part of the URL. DBOP is either = or regexp
Example #3
0
<?php

/**
 * Ajax entry point of the system
 *
 * @author Lindsay Marshall <*****@*****.**>
 * @copyright 2012-2015 Newcastle University
 */
/**
 * The real work is all done in the Ajax class.
 */
include 'class/support/framework.php';
Framework::initialise();
// Ajax on, debug on, load twig, load RB
$ld = Local::getinstance()->setup(__DIR__, TRUE, TRUE, TRUE, TRUE);
# setup the Local singleton
Ajax::getinstance()->handle(Context::getinstance()->setup());
<?php

/**
 * Ajax entry point of the system
 *
 * @author Lindsay Marshall <*****@*****.**>
 * @copyright 2012-2015 Newcastle University
 */
/**
 * The real work is all done in the Ajax class.
 */
include 'class/support/framework.php';
Framework::initialise();
// Ajax on, debug on, load twig, load RB
Ajax::getinstance()->handle(Context::getinstance()->setup(Local::getinstance()->setup(__DIR__, TRUE, TRUE, TRUE, TRUE)));