Пример #1
0
<?php

session_start();
DEFINE("FRAMEWORK_PATH", dirname(__FILE__) . "/");
require 'registry/registry.class.php';
$registry = new Registry();
// setup our core registry objects
$registry->createAndStoreObject('template', 'template');
$registry->createAndStoreObject('mysqldb', 'db');
$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);
Пример #2
0
<?php

ob_start();
session_set_cookie_params(0, '/', '', true, true);
session_start();
// the application root path
defined('BASE_URI') ? NULL : define('BASE_URI', dirname(__FILE__) . "\\");
require_once 'protected/registry/Registry.php';
$registry = new Registry();
// setup core registry objects and settings
$registry->createAndStoreObject('Template', 'template');
$registry->createAndStoreObject('Mysqldb', 'db');
$registry->createAndStoreObject('UrlProcessor', 'url');
$registry->createAndStoreObject('Security', 'security');
$registry->createAndStoreObject('Session', 'session');
$registry->createAndStoreObject('Email', 'mailout');
$registry->createAndStoreObject('Paginator', 'paginator');
$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');