/** * Constructor * * Set the default vars like template, db and dispatcher * @param WikiDispatcher &$dispatcher */ function WikiPrivileges(&$dispatcher) { $this->dispatcher = $dispatcher; $config = isset($this->dispatcher->conf['template']) ? $this->dispatcher->conf['template'] : null; $this->template =& VoodooTemplate::getInstance($config); $this->template->setDir(WIKI_TEMPLATES); $this->db = $this->dispatcher->controller->DBConnect(); $this->defaultArgs = array('prepath' => PATH_TO_DOCROOT); $this->privs = new VoodooPrivileges($this->dispatcher->controller); $this->siteArgs = array('view' => array('name' => 'article', 'extra' => '<span class="spacer" />')); if ($this->hasRights($_SESSION['access'], 'modify')) { $this->siteArgs['edit'] = array('name' => 'edit this page'); } elseif ($this->hasRights($_SESSION['access'], 'source')) { $this->siteArgs['source'] = array('name' => 'source'); } if ($this->hasRights($_SESSION['access'], 'history')) { $this->siteArgs['history'] = array('name' => 'history'); } }