<?php if (!headers_sent()) { header('Content-Type: text/html; charset=UTF-8'); } require_once __DIR__ . '/../../../autoload.php'; if (file_exists(__DIR__ . '/../sandbox/c3.php')) { require __DIR__ . '/../sandbox/c3.php'; } else { require __DIR__ . '/../claypit/c3.php'; } require_once 'glue.php'; require_once 'data.php'; require_once 'controllers.php'; $urls = array('/' => 'index', '/info' => 'info', '/cookies' => 'cookies', '/cookies2' => 'cookiesHeader', '/search.*' => 'search', '/login' => 'login', '/redirect' => 'redirect', '/redirect2' => 'redirect2', '/redirect3' => 'redirect3', '/redirect4' => 'redirect4', '/facebook\\??.*' => 'facebookController', '/form/(.*?)(#|\\?.*?)?' => 'form', '/articles\\??.*' => 'articles', '/auth' => 'httpAuth'); glue::stick($urls);
require_once dirname(__FILE__) . '/core/controller/AdminUsers.php'; require_once dirname(__FILE__) . '/core/controller/Search.php'; require_once dirname(__FILE__) . '/core/controller/AdminUpdateBets.php'; require_once dirname(__FILE__) . '/core/controller/AdminAddMatch.php'; //Create database try { $database = new Database(); } catch (exception $e) { echo '<h2>Database Error</h2>'; die; } $urls = array('ERROR' => 'Controller\\Error', INSTALL_DIR . 'player/(\\d+)' => 'Controller\\Player', INSTALL_DIR . 'register' => 'Controller\\Register', INSTALL_DIR => 'Controller\\Home', INSTALL_DIR . 'login/?(\\?.*)?' => 'Controller\\Login', INSTALL_DIR . 'coach/(\\d+)' => 'Controller\\Coach', INSTALL_DIR . 'team/(\\d+)' => 'Controller\\Team', INSTALL_DIR . 'competition/(\\d+)' => 'Controller\\Competition', INSTALL_DIR . 'match/(\\d+)' => 'Controller\\Match', INSTALL_DIR . 'referee/(\\d+)' => 'Controller\\Referee', INSTALL_DIR . 'tournament/(\\d+)' => 'Controller\\Tournament', INSTALL_DIR . 'news' => 'Controller\\News', INSTALL_DIR . 'config-panel' => 'Controller\\UserConfigPanel', INSTALL_DIR . 'bets' => 'Controller\\Bets', INSTALL_DIR . 'place-bet/(\\d+)' => 'Controller\\placeBet', INSTALL_DIR . 'events' => 'Controller\\Events', INSTALL_DIR . 'player(\\?.*)?' => 'Controller\\TopPlayers', INSTALL_DIR . 'create-group' => 'Controller\\CreateGroup', INSTALL_DIR . 'country/(\\d+)' => 'Controller\\Country', INSTALL_DIR . 'group/(\\S+)' => 'Controller\\Group', INSTALL_DIR . 'invite-user' => 'Controller\\InviteUser', INSTALL_DIR . 'invites' => 'Controller\\Invites', INSTALL_DIR . 'page/(\\d+)' => 'Controller\\Page', INSTALL_DIR . 'page/(\\d+)/edit' => 'Controller\\PageEdit', INSTALL_DIR . 'admin' => 'Controller\\Admin', INSTALL_DIR . 'admin/dashboard' => 'Controller\\AdminDashboard', INSTALL_DIR . 'admin/matches' => 'Controller\\AdminMatches', INSTALL_DIR . 'admin/match/(\\d+)/(\\S+)' => 'Controller\\AdminMatch', INSTALL_DIR . 'admin/match/(\\d+)/(\\S+)/(\\d+)' => 'Controller\\AdminMatch', INSTALL_DIR . 'admin/match/add' => 'Controller\\AdminAddMatch', INSTALL_DIR . 'admin/pages' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/pages/analytics' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/pages/delete/(\\d+)' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/users' => 'Controller\\AdminUsers', INSTALL_DIR . 'search' => 'Controller\\Search', INSTALL_DIR . 'admin/update-bets' => 'Controller\\AdminUpdateBets'); //The controller manages everything //and handles all possible database errors try { $controller = glue::stick($urls); } catch (exception $e) { $controller = new \Controller\Error(); } //Load the header controller try { //Make navigator controller $navigator = new Controller\Navigator(); //Make header controller $header = new \Controller\Header(); //Include the header template include dirname(__FILE__) . '/theme/header.php'; //Include the theme part $controller->template(); //Include the footer template include dirname(__FILE__) . '/theme/footer.php';
<?php namespace MyFramework; require_once 'config/config.php'; require_once 'libs/glue.php'; require_once 'libs/base.php'; require_once 'libs/filters.php'; try { session_start(); glue::stick($routes); } catch (\Exception $e) { die('ERROR: ' . $e->getMessage() . ' in [' . $e->getFile() . '] @ line ' . $e->getLine()); }