public function __construct()
{
- require_once 'Horde/Notification.php';
- require_once 'Horde/Registry.php';
+ global $registry, $notification, $browser, $conf;
- $this->notification = Notification::singleton();
- $this->registry = Registry::singleton();
+ $this->registry = &$registry;
+ $this->notification = &$notification;
- $result = $this->registry->pushApp('koward', false);
- if ($result instanceOf PEAR_Error) {
- $this->notification->push($result);
- }
+ $this->auth = &Auth::singleton($conf['auth']['driver']);
- $this->conf = Horde::loadConfiguration('conf.php', 'conf');
+ $this->conf = Horde::loadConfiguration('koward.php', 'koward');
$this->objects = Horde::loadConfiguration('objects.php', 'objects');
$this->attributes = Horde::loadConfiguration('attributes.php', 'attributes');
$this->labels = Horde::loadConfiguration('labels.php', 'labels');
public static function dispatch($koward)
{
+ global $registry, $notification, $browser;
+
+ /* Horde core classes that aren't autoloaded. */
+ include_once 'Horde/Util.php';
+ include_once 'Horde/String.php';
+ include_once 'Horde/NLS.php';
+ include_once 'Horde/Auth.php';
+ include_once 'Horde/Perms.php';
+ include_once 'Horde/Notification.php';
+ include_once 'Horde/Registry.php';
+
+ $notification = Notification::singleton();
+ $registry = Registry::singleton();
+
+ /* Browser detection object. */
+ if (class_exists('Horde_Browser')) {
+ $browser = Horde_Browser::singleton();
+ }
+
+ $result = $registry->pushApp('koward', false);
+ if ($result instanceOf PEAR_Error) {
+ $notification->push($result);
+ }
+
$webroot = Koward::_detectWebroot($koward);
// Set up our request and routing objects
}
// Check for route definitions.
- $routeFile = dirname($koward) . '/config/routes.php';
+ $routeFile = dirname($koward) . '/../config/routes.php';
if (!file_exists($routeFile)) {
throw new Horde_Controller_Exception('Not routable');
}
static public function singleton()
{
if (!isset(self::$instance)) {
- self::$instance = new Koward_Koward();
+ self::$instance = new Koward();
}
return self::$instance;
{
protected function _initializeApplication()
{
+ global $registry;
+
$this->koward = Koward::singleton();
+ if (is_a(($pushed = $registry->pushApp('horde', empty($this->auth_handler))), 'PEAR_Error')) {
+ if ($pushed->getCode() == 'permission_denied') {
+ header('Location: ' . $this->urlFor(array('controller' => 'login', 'action' => 'login')));
+ exit;
+ }
+ }
+
+
$this->types = array_keys($this->koward->objects);
if (empty($this->types)) {
throw new Koward_Exception('No object types have been configured!');
$this->menu = $this->getMenu();
- $this->theme = isset($this->koward->conf['koward']['theme']) ? $this->koward->conf['koward']['theme'] : 'koward';
+ $this->theme = isset($this->koward->conf['theme']) ? $this->koward->conf['theme'] : 'koward';
}
/**
* @package Koward
*/
-// @TODO Clean up
-require_once dirname(__FILE__) . '/ApplicationController.php';
-
/**
* @package Koward
*/
-class ObjectController extends Koward_ApplicationController
+class ObjectController extends Koward_Controller_Application
{
var $object_type;
&& isset($this->koward->objects[$this->object_type])) {
$params = array('attributes' => array_keys($this->attributes));
$class = $this->koward->objects[$this->object_type]['class'];
- $this->objectlist = $this->koward->server->listHash($class,
- $params);
+ $this->objectlist = $this->koward->getServer()->listHash($class,
+ $params);
foreach ($this->objectlist as $uid => $info) {
$this->objectlist[$uid]['edit_url'] = Horde::link(
$this->urlFor(array('controller' => 'object',