예제 #1
0
파일: NewPage.php 프로젝트: raz0rsdge/horde
 /**
  * Renders this page in display mode.
  *
  * @throws Wicked_Exception
  */
 public function display()
 {
     $GLOBALS['page_output']->addScriptFile('edit.js');
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->action = Wicked::url('NewPage');
     $view->formInput = Horde_Util::formInput();
     $view->referrer = $this->referrer();
     if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) {
         $figlet = new Text_Figlet();
         Horde_Exception_Pear::catchError($figlet->loadFont($GLOBALS['conf']['wicked']['figlet_font']));
         $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true));
     }
     if ($this->_template) {
         $view->text = Wicked_Page::getPage($this->_template)->getText();
     }
     return $view->render('edit/new');
 }
예제 #2
0
파일: Pear.php 프로젝트: jubinpatel/horde
 /**
  * Exception handling.
  *
  * @param mixed $result The result to be checked for a PEAR_Error.
  *
  * @return mixed Returns the original result if it was no PEAR_Error.
  *
  * @throws Horde_Exception_Pear In case the result was a PEAR_Error.
  */
 public static function catchError($result)
 {
     self::$_class = __CLASS__;
     return parent::catchError($result);
 }
예제 #3
0
 public function testArrayUserinfo()
 {
     $this->_loadPear();
     try {
         Horde_Exception_Pear::catchError(new PEAR_Error('An error occurred.', null, null, null, array('userinfo')));
     } catch (Horde_Exception_Pear $e) {
         $this->assertContains('[0] => userinfo', $e->details);
     }
 }
예제 #4
0
 /**
  * Renders this page in display mode.
  *
  * @throws Wicked_Exception
  */
 public function display()
 {
     $GLOBALS['page_output']->addScriptFile('edit.js');
     $GLOBALS['injector']->getInstance('Horde_View_Topbar')->subinfo = sprintf(_("Last Modified %s by %s"), $this->formatVersionCreated(), $this->author());
     $page = Wicked_Page::getPage($this->referrer());
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->action = Wicked::url('EditPage');
     $view->formInput = Horde_Util::formInput();
     $view->name = $page->pageName();
     $view->header = $page->pageUrl()->link() . htmlspecialchars($page->pageName()) . '</a> ';
     if ($page->isLocked()) {
         $view->header .= ' ' . Horde::img('locked.png', _("Locked"));
     }
     $view->cancel = $page->pageUrl()->add('actionID', 'unlock')->link(array('class' => 'horde-cancel')) . _("Cancel") . '</a>';
     if (!empty($GLOBALS['conf']['wicked']['require_change_log'])) {
         $view->changelogRequired = Horde::img('required.png', _("Changelog is required"));
     }
     if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) {
         $figlet = new Text_Figlet();
         Horde_Exception_Pear::catchError($figlet->loadFont($GLOBALS['conf']['wicked']['figlet_font']));
         $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true));
     }
     $view->text = Horde_Util::getFormData('page_text');
     if (is_null($view->text)) {
         $view->text = $page->getText();
     }
     return $view->render('edit/standard');
 }
예제 #5
0
파일: Sql.php 프로젝트: raz0rsdge/horde
 /**
  * Deletes a user.
  *
  * @param integer $user_id  The id of the user to delete.
  *
  * @throws Vilma_Exception
  */
 public function deleteUser($user_id)
 {
     Horde_Exception_Pear::catchError($user = $this->getUser($user_id));
     /* Delete all virtual emails for this user. */
     $sql = 'DELETE FROM ' . $this->_params['tables']['virtuals'] . ' WHERE ' . $this->_getTableField('virtuals', 'virtual_destination') . ' = ?';
     $values = array($user['user_name']);
     Horde::log($sql, 'DEBUG');
     Horde_Exception_Pear::catchError($this->_db->query($sql, $values));
     /* Delete the actual user. */
     $sql = 'DELETE FROM ' . $this->_params['tables']['users'] . ' WHERE ' . $this->_getTableField('users', 'user_id') . ' = ?';
     $values = array((int) $user_id);
     Horde::log($sql, 'DEBUG');
     Horde_Exception_Pear::catchError($this->_db->query($sql, $values));
     Vilma_MailboxDriver::factory()->deleteMailbox(Vilma::stripUser($user['user_name']), Vilma::stripDomain($user['user_name']));
 }