Example #1
0
$registry->createAndStoreObject('authenticate', 'authenticate');
$registry->createAndStoreObject('urlprocessor', 'url');
$registry->getObject('url')->getURLData();
// database settings
include FRAMEWORK_PATH . 'config.php';
// create a database connection
$registry->getObject('db')->newConnection($configs['db_host_sn'], $configs['db_user_sn'], $configs['db_pass_sn'], $configs['db_name_sn']);
$controller = $registry->getObject('url')->getURLBit(0);
if ($controller != 'api') {
    $registry->getObject('authenticate')->checkForAuthentication();
}
// store settings in our registry
$settingsSQL = "SELECT `key`, `value` FROM settings";
$registry->getObject('db')->executeQuery($settingsSQL);
while ($setting = $registry->getObject('db')->getRows()) {
    $registry->storeSetting($setting['value'], $setting['key']);
}
$registry->getObject('template')->getPage()->addTag('siteurl', $registry->getSetting('siteurl'));
$registry->getObject('template')->buildFromTemplates('header.tpl.php', 'main.tpl.php', 'footer.tpl.php');
$controllers = array();
$controllersSQL = "SELECT * FROM controllers WHERE active=1";
$registry->getObject('db')->executeQuery($controllersSQL);
while ($cttrlr = $registry->getObject('db')->getRows()) {
    $controllers[] = $cttrlr['controller'];
}
if ($registry->getObject('authenticate')->isLoggedIn() && $controller != 'api') {
    $registry->getObject('template')->addTemplateBit('userbar', 'userbar_loggedin.tpl.php');
    $registry->getObject('template')->getPage()->addTag('username', $registry->getObject('authenticate')->getUser()->getUsername());
} elseif ($controller != 'api') {
    $registry->getObject('template')->addTemplateBit('userbar', 'userbar.tpl.php');
}
Example #2
0
$registry->createAndStoreModel('Authenticate', 'authenticate');
$registry->createAndStoreModel('Registration', 'register');
$registry->createAndStoreModel('Products', 'products');
$registry->createAndStoreModel('Categories', 'categories');
$registry->createAndStoreModel('Authors', 'authors');
$registry->createAndStoreModel('Basket', 'basket');
$registry->createAndStoreModel('User', 'user');
$registry->createAndStoreModel('Account', 'account');
$registry->createAndStoreModel('Rating', 'rating');
$registry->createAndStoreModel('Review', 'review');
$registry->createAndStoreModel('Checkout', 'checkout');
$registry->createAndStoreModel('UploadFiles', 'upload');
$registry->getObject('url')->getURLData();
$registry->storeSetting('default', 'view');
$registry->storeSetting('template', 'template');
$registry->storeSetting('authentication', 'authenticate');
$registry->storeSetting('Book Store', 'sitename');
$registry->storeSetting('https://', 'protocol');
$registry->storeSetting($registry->getSetting('protocol') . 'localhost/bookstore/', 'siteurl');
include 'protected/config/config.php';
// create database connection
$registry->getObject('db')->newConnection(DB_SERVER, DB_NAME, DB_USER, DB_PASS);
// process authentication
$registry->getModel('authenticate')->checkForAuthentication();
if ($registry->getModel('authenticate')->isLoggedIn() === true) {
    $registry->getObject('template')->username = $registry->getObject('session')->get('firstName');
    $registry->getObject('template')->loggedIn = $registry->getModel('authenticate')->isLoggedIn();
}
// loads list of categories for sidebar menu
// limits display on 12 categories randomly ordered
$registry->getObject('template')->sidebarCategories = $registry->getModel('categories')->categoriesForSidebar();
// loads list of authors for sidebar menu