protected function _initializeApplication() { global $registry; try { $registry->pushApp('koward', empty($this->auth_handler) || $this->auth_handler != $this->params[':action']); } catch (Horde_Exception $e) { if ($e->getCode() == 'permission_denied') { $this->urlFor(array('controller' => 'index', 'action' => 'login'))->redirect(); } } $this->koward = Koward::singleton(); if ($this->koward->objects instanceof PEAR_Error) { return; } if (!empty($this->koward->objects)) { $this->types = array_keys($this->koward->objects); } else { throw new Koward_Exception('No object types have been configured!'); } $this->checkAccess(); $this->menu = $this->getMenu(); $this->theme = isset($this->koward->conf['koward']['theme']) ? $this->koward->conf['koward']['theme'] : 'koward'; $this->welcome = isset($this->koward->conf['koward']['greeting']) ? $this->koward->conf['koward']['greeting'] : _("Welcome."); $this->current_user = $GLOBALS['registry']->getAuth(); $session = Horde_Kolab_Session::singleton(); if (!empty($session->user_uid)) { $user = $this->koward->getObject($session->user_uid); $type = $this->koward->getType($user); $this->role = $this->koward->objects[$type]['label']; } }
public function __construct(&$vars, &$object, $params = array()) { $this->koward =& Koward::singleton(); $this->object =& $object; parent::__construct($vars); $type = false; $this->setButtons(_("Search")); $this->_addFields($this->koward->search); }
public function __construct(&$object, $buttons) { $this->koward =& Koward::singleton(); parent::__construct(Horde_Variables::getDefaultVariables()); $this->setTitle(_("Object actions")); $this->object = $object; if (!empty($buttons)) { $this->setButtons($buttons); } }
public function __construct(&$vars, &$object, $params = array()) { $this->koward =& Koward::singleton(); $this->object =& $object; parent::__construct($vars); $type = false; if (empty($this->object)) { $title = _("Add Object"); $this->setButtons(_("Add")); foreach ($this->koward->objects as $key => $config) { if (!$this->koward->hasAccess('object/add/' . $key, Koward::PERM_EDIT)) { continue; } $options[$key] = $config['label']; } $v = $this->addVariable(_("Choose an object type"), 'type', 'enum', true, false, null, array($options, true)); $action = Horde_Form_Action::factory('submit'); $v->setAction($action); $v->setOption('trackchange', true); if (is_null($vars->get('formname')) && $vars->get($v->getVarName()) != $vars->get('__old_' . $v->getVarName())) { $this->koward->notification->push(sprintf(_("Selected object type \"%s\"."), $object_conf[$vars->get('type')]['label']), 'horde.message'); } $type = $vars->get('type'); } else { $title = _("Edit Object"); $type = $this->koward->getType($this->object); if (empty($type)) { throw new Koward_Exception('Undefined object class!'); } if (!$this->isSubmitted()) { $vars->set('type', $type); $keys = array_keys($this->_getFields($this->koward->objects[$type])); $vars->set('object', $this->object->toHash($keys)); $this->setButtons(true); } } if (isset($params['title'])) { $title = $params['title']; } $this->setTitle($title); if (!empty($type)) { $this->_addFields($this->koward->objects[$type]); } }
public static function singleton() { if (!isset(self::$instance)) { self::$instance = new Koward(); } return self::$instance; }
<?php /** * Identify the horde base application. */ require_once __DIR__ . '/../../koward/config/base.php'; /** * The Autoloader allows us to omit "require/include" statements. */ require_once 'Horde/Autoloader/Default.php'; /* Configure the Autoloader to handle the "Koward" pattern */ $__autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Koward_/', 'Koward/')); /* Dispatch the request. */ try { Koward::dispatch(__FILE__); } catch (Exception $e) { global $notification, $registry; Horde::log($e, 'DEBUG'); if (isset($notification)) { $notification->push($e->getMessage(), 'horde.error'); } if (isset($registry)) { $registry->get('webroot', 'koward')->redirect(); } }
if (!$opts->base) { throw new InvalidArgumentException('The path to the application base has not been specified!'); } /** * Ensure that the base parameters (especially SERVER_NAME) get set for the * command line. */ $cli = Horde_Cli::init(); /** * Hm, the fact that we need the registry at this point for * identifying the location where we installed the application is not * really satisfying. We need it to know the location of the * configuration though. */ $koward_authentication = 'none'; require_once $opts->base . '/koward/config/base.php'; /** * FIXME END */ /* Configure the Autoloader to handle the "Koward" pattern */ $__autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Koward_/', 'Koward/')); /* Dispatch the request. */ try { Koward::dispatch($opts->base . '/htdocs/koward/koward.php', 'Koward_Cli'); } catch (Exception $e) { // @TODO Make nicer echo '<h1>' . $e->getMessage() . '</h1>'; echo '<pre>'; var_dump($e); echo '</pre>'; }