Author: Jason Felice (jason.m.felice@gmail.com)
Author: Jan Schneider (jan@horde.org)
Author: Michael Slusarz (slusarz@horde.org)
Inheritance: extends Ingo_Basic_Base
Example #1
0
 /**
  */
 protected function _content()
 {
     global $injector, $session;
     /* Get list of filters */
     $filters = Ingo_Storage_FilterIterator_Match::create($injector->getInstance('Ingo_Factory_Storage')->create(), $session->get('ingo', 'script_categories'));
     $html = '<table class="ingoBlockSummary">';
     foreach ($filters as $rule) {
         $active = $rule->disable ? _("inactive") : _("active");
         switch (get_class($rule)) {
             case 'Ingo_Rule_System_Vacation':
                 $html .= '<tr><td>' . '<span class="iconImg vacationImg"></span>' . '</td><td>' . Ingo_Basic_Vacation::url()->link(array('title' => _("Edit"))) . _("Vacation") . '</a> ' . $active . '</td></tr>';
                 break;
             case 'Ingo_Rule_System_Forward':
                 $html .= '<tr><td>' . '<span class="iconImg forwardImg"></span>' . '</td><td>' . Ingo_Basic_Forward::url()->link(array('title' => _("Edit"))) . _("Forward") . '</a> ' . $active;
                 $addr = $rule->addresses;
                 if (!empty($addr)) {
                     $html .= ':<br />' . implode('<br />', $addr);
                 }
                 $html .= '</td></tr>';
                 break;
             case 'Ingo_Rule_System_Whitelist':
                 $html .= '<tr><td>' . '<span class="iconImg whitelistImg"></span>' . '</td><td>' . Ingo_Basic_Whitelist::url()->link(array('title' => _("Edit"))) . _("Whitelist") . '</a> ' . $active . '</td></tr>';
                 break;
             case 'Ingo_Rule_System_Blacklist':
                 $html .= '<tr><td>' . '<span class="iconImg blacklistImg"></span>' . '</td><td>' . Ingo_Basic_Blacklist::url()->link(array('title' => _("Edit"))) . _("Blacklist") . '</a> ' . $active . '</td></tr>';
                 break;
             case 'Ingo_Rule_Spam Filter':
                 $html .= '<tr><td>' . '<span class="iconImg spamImg"></span>' . '</td><td>' . Ingo_Basic_Spam::url()->link(array('title' => _("Edit"))) . _("Spam Filter") . '</a> ' . $active . '</td></tr>';
                 break;
         }
     }
     return $html . '</table>';
 }
Example #2
0
 /**
  */
 protected function _content()
 {
     /* Get list of filters */
     $filters = $GLOBALS['injector']->getInstance('Ingo_Factory_Storage')->create()->retrieve(Ingo_Storage::ACTION_FILTERS);
     $html = '<table class="ingoBlockSummary">';
     foreach ($filters->getFilterList() as $filter) {
         if (!empty($filter['disable'])) {
             $active = _("inactive");
         } else {
             $active = _("active");
         }
         $s_categories = $GLOBALS['session']->get('ingo', 'script_categories');
         switch ($filter['name']) {
             case 'Vacation':
                 if (in_array(Ingo_Storage::ACTION_VACATION, $s_categories)) {
                     $html .= '<tr><td>' . '<span class="iconImg vacationImg"></span>' . '</td><td>' . Ingo_Basic_Vacation::url()->link(array('title' => _("Edit"))) . _("Vacation") . '</a> ' . $active . '</td></tr>';
                 }
                 break;
             case 'Forward':
                 if (in_array(Ingo_Storage::ACTION_FORWARD, $s_categories)) {
                     $html .= '<tr><td>' . '<span class="iconImg forwardImg"></span>' . '</td><td>' . Ingo_Basic_Forward::url()->link(array('title' => _("Edit"))) . _("Forward") . '</a> ' . $active;
                     $data = unserialize($GLOBALS['prefs']->getValue('forward'));
                     if (!empty($data['a'])) {
                         $html .= ':<br />' . implode('<br />', $data['a']);
                     }
                     $html .= '</td></tr>';
                 }
                 break;
             case 'Whitelist':
                 if (in_array(Ingo_Storage::ACTION_WHITELIST, $s_categories)) {
                     $html .= '<tr><td>' . '<span class="iconImg whitelistImg"></span>' . '</td><td>' . Ingo_Basic_Whitelist::url()->link(array('title' => _("Edit"))) . _("Whitelist") . '</a> ' . $active . '</td></tr>';
                 }
                 break;
             case 'Blacklist':
                 if (in_array(Ingo_Storage::ACTION_BLACKLIST, $s_categories)) {
                     $html .= '<tr><td>' . '<span class="iconImg blacklistImg"></span>' . '</td><td>' . Ingo_Basic_Blacklist::url()->link(array('title' => _("Edit"))) . _("Blacklist") . '</a> ' . $active . '</td></tr>';
                 }
                 break;
             case 'Spam Filter':
                 if (in_array(Ingo_Storage::ACTION_SPAM, $s_categories)) {
                     $html .= '<tr><td>' . '<span class="iconImg spamImg"></span>' . '</td><td>' . Ingo_Basic_Spam::url()->link(array('title' => _("Edit"))) . _("Spam Filter") . '</a> ' . $active . '</td></tr>';
                 }
                 break;
         }
     }
     return $html . '</table>';
 }
Example #3
0
 /**
  */
 public function menu($menu)
 {
     global $conf, $injector, $prefs, $registry, $session;
     $s_categories = $session->get('ingo', 'script_categories');
     $vars = $injector->getInstance('Horde_Variables');
     $menu->add(Ingo_Basic_Filters::url(), _("Filter _Rules"), 'ingo-rules', null, null, null, $vars->page == 'filters' ? 'current' : '__noselection');
     try {
         if (in_array('Ingo_Rule_System_Whitelist', $s_categories)) {
             $menu->add(Horde::url($registry->link('mail/showWhitelist')), _("_Whitelist"), 'ingo-whitelist', null, null, null, $vars->page == 'whitelist' ? 'current' : '__noselection');
         }
     } catch (Horde_Exception $e) {
         Horde::log($e, 'ERR');
     }
     try {
         if (in_array('Ingo_Rule_System_Blacklist', $s_categories)) {
             $menu->add(Horde::url($registry->link('mail/showBlacklist')), _("_Blacklist"), 'ingo-blacklist', null, null, null, $vars->page == 'blacklist' ? 'current' : '__noselection');
         }
     } catch (Horde_Exception $e) {
         Horde::log($e, 'ERR');
     }
     if (in_array('Ingo_Rule_System_Vacation', $s_categories)) {
         $menu->add(Ingo_Basic_Vacation::url(), _("_Vacation"), 'ingo-vacation', null, null, null, $vars->page == 'vacation' ? 'current' : '__noselection');
     }
     if (in_array('Ingo_Rule_System_Forward', $s_categories)) {
         $menu->add(Ingo_Basic_Forward::url(), _("_Forward"), 'ingo-forward', null, null, null, $vars->page == 'forward' ? 'current' : '__noselection');
     }
     if (in_array('Ingo_Rule_System_Spam', $s_categories)) {
         $menu->add(Ingo_Basic_Spam::url(), _("S_pam"), 'ingo-spam', null, null, null, $vars->page == 'spam' ? 'current' : '__noselection');
     }
     if ((!$prefs->isLocked('auto_update') || !$prefs->getValue('auto_update')) && $injector->getInstance('Ingo_Factory_Script')->hasFeature('script_file')) {
         $menu->add(Ingo_Basic_Script::url(), _("_Script"), 'ingo-script', null, null, null, $vars->page == 'script' ? 'current' : '__noselection');
     }
     if (($shares = $injector->getInstance('Ingo_Shares')) && empty($conf['share']['no_sharing'])) {
         if ($shares->getShare($session->get('ingo', 'current_share'))->get('owner') == $registry->getAuth()) {
             $share = $session->get('ingo', 'current_share');
         } else {
             $share = $session->get('ingo', 'backend/id') . ':' . $registry->getAuth();
         }
         $menu->add('#', _("_Permissions"), 'horde-perms', null, '', Horde::popupJs(Horde::url($registry->get('webroot', 'horde') . '/services/shares/edit.php', true), array('params' => array('app' => 'ingo', 'share' => $share), 'urlencode' => true)) . 'return false;');
     }
 }
Example #4
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $page_output, $prefs, $session;
     /* Get the list of filter rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     /* Load the Ingo_Script factory. */
     $factory = $injector->getInstance('Ingo_Factory_Script');
     /* Get permissions. */
     $edit_allowed = Ingo::hasSharePermission(Horde_Perms::EDIT);
     $delete_allowed = Ingo::hasSharePermission(Horde_Perms::DELETE);
     /* Token checking. */
     $actionID = $this->_checkToken(array('rule_copy', 'rule_delete', 'rule_disable', 'rule_enable'));
     /* Default to no mailbox filtering. */
     $mbox_search = null;
     /* Perform requested actions. */
     switch ($actionID) {
         case 'mbox_search':
             if (isset($this->vars->searchfield)) {
                 $mbox_search = array('exact' => $this->vars->get('searchexact', 1), 'query' => $this->vars->searchfield);
             }
             break;
         case 'rule_copy':
         case 'rule_delete':
         case 'rule_disable':
         case 'rule_enable':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $success = false;
             switch ($actionID) {
                 case 'rule_delete':
                     if (!$delete_allowed) {
                         $notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
                         self::url()->redirect();
                     }
                     if (($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) && $ingo_storage->deleteRule($tmp)) {
                         $notification->push(sprintf(_("Rule \"%s\" deleted."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
                 case 'rule_copy':
                     switch ($ingo_storage->maxRules()) {
                         case Ingo_Storage::MAX_NONE:
                             Horde::permissionDeniedError('ingo', 'max_rules', _("You are not allowed to create or edit custom rules."));
                             break 2;
                         case Ingo_Storage::MAX_OVER:
                             Horde::permissionDeniedError('ingo', 'max_rules', sprintf(_("You are not allowed to create more than %d rules."), $ingo_storage->max_rules));
                             break 2;
                     }
                     if (($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) && $ingo_storage->copyRule($tmp)) {
                         $notification->push(sprintf(_("Rule \"%s\" copied."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
                 case 'rule_disable':
                 case 'rule_enable':
                     if ($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) {
                         $tmp->disable = $actionID === 'rule_disable';
                         $ingo_storage->updateRule($tmp);
                         $notification->push(sprintf($actionID === 'rule_disable' ? _("Rule \"%s\" disabled.") : _("Rule \"%s\" enabled."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
             }
             /* Save changes */
             if ($success) {
                 try {
                     $factory->activateAll();
                 } catch (Ingo_Exception $e) {
                     $notification->push($e->getMessage(), 'horde.error');
                 }
             }
             break;
         case 'settings_save':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $prefs->setValue('show_filter_msg', $this->vars->show_filter_msg);
             $prefs->setValue('filter_seen', $this->vars->filter_seen);
             $notification->push(_("Settings successfully updated."), 'horde.success');
             break;
         case 'apply_filters':
             $factory->perform();
             break;
     }
     /* Common URLs. */
     $filters_url = $this->_addToken(self::url());
     $rule_url = Ingo_Basic_Rule::url();
     $view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/filters'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     $view->addHelper('Horde_Core_View_Helper_Image');
     $view->addHelper('Horde_Core_View_Helper_Label');
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->canapply = $factory->canPerform();
     $view->deleteallowed = $delete_allowed;
     $view->editallowed = $edit_allowed;
     $view->formurl = $filters_url;
     $view->can_copy = $edit_allowed && !$ingo_storage->maxRules();
     $display = array();
     $filters = Ingo_Storage_FilterIterator_Match::create($ingo_storage, $session->get('ingo', 'script_categories'));
     foreach ($filters as $rule) {
         $copyurl = $delurl = $editurl = null;
         $entry = array();
         $url = $filters_url->copy()->add('uid', $rule->uid);
         switch (get_class($rule)) {
             case 'Ingo_Rule_System_Blacklist':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Blacklist::url();
                 $entry['filterimg'] = 'blacklist.png';
                 break;
             case 'Ingo_Rule_System_Whitelist':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Whitelist::url();
                 $entry['filterimg'] = 'whitelist.png';
                 break;
             case 'Ingo_Rule_System_Vacation':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Vacation::url();
                 $entry['filterimg'] = 'vacation.png';
                 break;
             case 'Ingo_Rule_System_Forward':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Forward::url();
                 $entry['filterimg'] = 'forward.png';
                 break;
             case 'Ingo_Rule_System_Spam':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Spam::url();
                 $entry['filterimg'] = 'spam.png';
                 break;
             default:
                 if (!is_null($mbox_search)) {
                     if ($mbox_search['exact']) {
                         if (strcasecmp($filter['action-value'], $mbox_search['query']) !== 0) {
                             continue 2;
                         }
                     } elseif (stripos($filter['action-value'], $mbox_search['query']) === false) {
                         continue 2;
                     }
                 }
                 $editurl = $rule_url->copy()->add(array('edit' => $rule->uid));
                 $delurl = $url->copy()->add('actionID', 'rule_delete');
                 $copyurl = $url->copy()->add('actionID', 'rule_copy');
                 break;
         }
         /* Create description. */
         if (!$edit_allowed) {
             $entry['descriplink'] = htmlspecialchars($rule->name);
         } elseif (!empty($rule->conditions)) {
             $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $rule->name), null, null, null, $rule->description()) . htmlspecialchars($rule->name) . '</a>';
         } else {
             $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $rule->name)) . htmlspecialchars($rule->name) . '</a>';
         }
         /* Create delete link. */
         if ($delete_allowed && !is_null($delurl)) {
             $entry['dellink'] = Horde::link($delurl, sprintf(_("Delete %s"), $rule->name), null, null, "return window.confirm('" . addslashes(_("Are you sure you want to delete this rule?")) . "');");
         }
         /* Create copy link. */
         if ($view->can_copy && !is_null($copyurl)) {
             $entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $rule->name));
         }
         /* Create disable/enable link. */
         if (!$rule->disable) {
             $entry['disabled'] = true;
             if ($edit_allowed) {
                 $entry['disablelink'] = Horde::link($url->copy()->add('actionID', 'rule_disable'), sprintf(_("Disable %s"), $rule->name));
             }
         } elseif ($edit_allowed) {
             $entry['enablelink'] = Horde::link($url->copy()->add('actionID', 'rule_enable'), sprintf(_("Enable %s"), $rule->name));
         }
         $display[$rule->uid] = $entry;
     }
     $view->filter = $display;
     $view->mbox_search = $mbox_search;
     if ($edit_allowed && is_null($mbox_search)) {
         if ($factory->hasFeature('on_demand')) {
             $view->settings = true;
             $view->flags = $prefs->getValue('filter_seen');
             $view->show_filter_msg = $prefs->getValue('show_filter_msg');
         }
         $page_output->addScriptFile('hordecore.js', 'horde');
         $page_output->addScriptPackage('Horde_Core_Script_Package_Sortable');
     }
     $page_output->addScriptFile('stripe.js', 'horde');
     $page_output->addScriptFile('filters.js');
     $page_output->ajax = true;
     $topbar = $injector->getInstance('Horde_View_Topbar');
     $topbar->search = true;
     $topbar->searchAction = self::url();
     $topbar->searchLabel = _("Mailbox Search");
     $topbar->searchParameters = array('actionID' => 'mbox_search', 'searchexact' => 0, 'page' => 'filters');
     $this->header = _("Filter Rules");
     $this->output = $view->render('filters');
 }
Example #5
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $page_output, $prefs, $session;
     /* Get the list of filter rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
     /* Load the Ingo_Script factory. */
     $factory = $injector->getInstance('Ingo_Factory_Script');
     /* Get permissions. */
     $edit_allowed = Ingo::hasSharePermission(Horde_Perms::EDIT);
     $delete_allowed = Ingo::hasSharePermission(Horde_Perms::DELETE);
     /* Permissions. */
     $perms = $injector->getInstance('Horde_Core_Perms');
     /* Token checking. */
     $actionID = $this->_checkToken(array('rule_copy', 'rule_delete', 'rule_disable', 'rule_enable'));
     /* Default to no mailbox filtering. */
     $mbox_search = null;
     /* Perform requested actions. */
     switch ($actionID) {
         case 'mbox_search':
             if (isset($this->vars->searchfield)) {
                 $mbox_search = array('exact' => $this->vars->get('searchexact', 1), 'query' => $this->vars->searchfield);
             }
             break;
         case 'rule_copy':
         case 'rule_delete':
         case 'rule_disable':
         case 'rule_enable':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             switch ($actionID) {
                 case 'rule_delete':
                     if (!$delete_allowed) {
                         $notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
                         self::url()->redirect();
                     }
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     if ($filters->deleteRule($this->vars->rulenumber)) {
                         $notification->push(sprintf(_("Rule \"%s\" deleted."), $tmp['name']), 'horde.success');
                     }
                     break;
                 case 'rule_copy':
                     $max = $perms->hasAppPermission(Ingo_Perms::getPerm('max_rules'));
                     if ($max === 0) {
                         Horde::permissionDeniedError('ingo', 'max_rules', _("You are not allowed to create or edit custom rules."));
                         break 2;
                     } elseif ($max !== true && $max <= count($filters->getFilterList())) {
                         Horde::permissionDeniedError('ingo', 'max_rules', sprintf(_("You are not allowed to create more than %d rules."), $max));
                         break 2;
                     }
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     if ($filters->copyRule($this->vars->rulenumber)) {
                         $notification->push(sprintf(_("Rule \"%s\" copied."), $tmp['name']), 'horde.success');
                     }
                     break;
                 case 'rule_disable':
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     $filters->ruleDisable($this->vars->rulenumber);
                     $notification->push(sprintf(_("Rule \"%s\" disabled."), $tmp['name']), 'horde.success');
                     break;
                 case 'rule_enable':
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     $filters->ruleEnable($this->vars->rulenumber);
                     $notification->push(sprintf(_("Rule \"%s\" enabled."), $tmp['name']), 'horde.success');
                     break;
             }
             /* Save changes */
             $ingo_storage->store($filters);
             try {
                 Ingo_Script_Util::update();
             } catch (Ingo_Exception $e) {
                 $notification->push($e->getMessage(), 'horde.error');
             }
             break;
         case 'settings_save':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $prefs->setValue('show_filter_msg', $this->vars->show_filter_msg);
             $prefs->setValue('filter_seen', $this->vars->filter_seen);
             $notification->push(_("Settings successfully updated."), 'horde.success');
             break;
         case 'apply_filters':
             $factory->perform();
             break;
     }
     /* Get the list of rules now. */
     $filter_list = $filters->getFilterList();
     /* Common URLs. */
     $filters_url = $this->_addToken(self::url());
     $rule_url = Ingo_Basic_Rule::url();
     $view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/filters'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     $view->addHelper('Horde_Core_View_Helper_Image');
     $view->addHelper('Horde_Core_View_Helper_Label');
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->canapply = $factory->canPerform();
     $view->deleteallowed = $delete_allowed;
     $view->editallowed = $edit_allowed;
     $view->formurl = $filters_url;
     if (count($filter_list)) {
         $display = array();
         $s_categories = $session->get('ingo', 'script_categories');
         $view->can_copy = $edit_allowed && (($max_rules = $perms->hasAppPermission(Ingo_Perms::getPerm('max_rules'))) === true || $max_rules > count($filter_list));
         foreach ($filter_list as $rule_number => $filter) {
             /* Non-display categories. */
             if (!in_array($filter['action'], $s_categories)) {
                 $display[$rule_number] = false;
                 continue;
             }
             $copyurl = $delurl = $editurl = $name = null;
             $entry = array();
             $url = $filters_url->copy()->add('rulenumber', $rule_number);
             switch ($filter['action']) {
                 case Ingo_Storage::ACTION_BLACKLIST:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Blacklist::url();
                     $entry['filterimg'] = 'blacklist.png';
                     $name = _("Blacklist");
                     break;
                 case Ingo_Storage::ACTION_WHITELIST:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Whitelist::url();
                     $entry['filterimg'] = 'whitelist.png';
                     $name = _("Whitelist");
                     break;
                 case Ingo_Storage::ACTION_VACATION:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Vacation::url();
                     $entry['filterimg'] = 'vacation.png';
                     $name = _("Vacation");
                     break;
                 case Ingo_Storage::ACTION_FORWARD:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Forward::url();
                     $entry['filterimg'] = 'forward.png';
                     $name = _("Forward");
                     break;
                 case Ingo_Storage::ACTION_SPAM:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Spam::url();
                     $entry['filterimg'] = 'spam.png';
                     $name = _("Spam Filter");
                     break;
                 default:
                     if (!is_null($mbox_search)) {
                         if ($mbox_search['exact']) {
                             if (strcasecmp($filter['action-value'], $mbox_search['query']) !== 0) {
                                 continue 2;
                             }
                         } elseif (stripos($filter['action-value'], $mbox_search['query']) === false) {
                             continue 2;
                         }
                     }
                     $editurl = $rule_url->copy()->add(array('edit' => $rule_number));
                     $delurl = $url->copy()->add('actionID', 'rule_delete');
                     $copyurl = $url->copy()->add('actionID', 'rule_copy');
                     $name = $filter['name'];
                     break;
             }
             /* Create description. */
             if (!$edit_allowed) {
                 $entry['descriplink'] = htmlspecialchars($name);
             } elseif (!empty($filter['conditions'])) {
                 $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $ingo_storage->ruleDescription($filter)) . htmlspecialchars($name) . '</a>';
             } else {
                 $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . htmlspecialchars($name) . '</a>';
             }
             /* Create delete link. */
             if ($delete_allowed && !is_null($delurl)) {
                 $entry['dellink'] = Horde::link($delurl, sprintf(_("Delete %s"), $name), null, null, "return window.confirm('" . addslashes(_("Are you sure you want to delete this rule?")) . "');");
             }
             /* Create copy link. */
             if ($view->can_copy && !is_null($copyurl)) {
                 $entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $name));
             }
             /* Create disable/enable link. */
             if (empty($filter['disable'])) {
                 $entry['disabled'] = true;
                 if ($edit_allowed) {
                     $entry['disablelink'] = Horde::link($url->copy()->add('actionID', 'rule_disable'), sprintf(_("Disable %s"), $name));
                 }
             } elseif ($edit_allowed) {
                 $entry['enablelink'] = Horde::link($url->copy()->add('actionID', 'rule_enable'), sprintf(_("Enable %s"), $name));
             }
             $display[$rule_number] = $entry;
         }
         $view->filter = $display;
         $view->mbox_search = $mbox_search;
     }
     if ($edit_allowed && is_null($mbox_search)) {
         if ($factory->hasFeature('on_demand')) {
             $view->settings = true;
             $view->flags = $prefs->getValue('filter_seen');
             $view->show_filter_msg = $prefs->getValue('show_filter_msg');
         }
         $page_output->addScriptFile('hordecore.js', 'horde');
         $page_output->addScriptPackage('Horde_Core_Script_Package_Sortable');
     }
     $page_output->addScriptFile('stripe.js', 'horde');
     $page_output->addScriptFile('filters.js');
     $topbar = $injector->getInstance('Horde_View_Topbar');
     $topbar->search = true;
     $topbar->searchAction = self::url();
     $topbar->searchLabel = _("Mailbox Search");
     $topbar->searchParameters = array('actionID' => 'mbox_search', 'searchexact' => 0, 'page' => 'filters');
     $this->header = _("Filter Rules");
     $this->output = $view->render('filters');
 }