List of banned email addresses Peter Rotich <*****@*****.**> Copyright (c) 2006-2013 osTicket http://www.osticket.com Released under the GNU General Public License WITHOUT ANY WARRANTY. See LICENSE.TXT for details. vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require 'admin.inc.php'; include_once INCLUDE_DIR . 'class.banlist.php'; /* Get the system ban list filter */ if (!($filter = Banlist::getFilter())) { $warn = 'System ban list is empty.'; } elseif (!$filter->isActive()) { $warn = 'SYSTEM BAN LIST filter is <b>DISABLED</b> - <a href="filters.php">enable here</a>.'; } $rule = null; //ban rule obj. if ($filter && $_REQUEST['id'] && !($rule = $filter->getRule($_REQUEST['id']))) { $errors['err'] = 'Unknown or invalid ban list ID #'; } if ($_POST && !$errors && $filter) { switch (strtolower($_POST['do'])) { case 'update': if (!$rule) { $errors['err'] = 'Unknown or invalid ban rule.'; } elseif (!$_POST['val'] || !Validator::is_email($_POST['val'])) {
protected function filterTicketData($origin, $vars, $forms, $user = false) { global $cfg; // Unset all the filter data field data in case things change // during recursive calls foreach ($vars as $k => $v) { if (strpos($k, 'field.') === 0) { unset($vars[$k]); } } foreach ($forms as $F) { if ($F) { $vars += $F->getFilterData(); } } if (!$user) { $interesting = array('name', 'email'); $user_form = UserForm::getUserForm()->getForm($vars); // Add all the user-entered info for filtering foreach ($interesting as $F) { $field = $user_form->getField($F); $vars[$F] = $field->toString($field->getClean()); } // Attempt to lookup the user and associated data $user = User::lookupByEmail($vars['email']); } // Add in user and organization data for filtering if ($user) { $vars += $user->getFilterData(); $vars['email'] = $user->getEmail(); $vars['name'] = $user->getName()->getOriginal(); if ($org = $user->getOrganization()) { $vars += $org->getFilterData(); } } else { // Unpack all known user info from the request foreach ($user_form->getFields() as $f) { $vars['field.' . $f->get('id')] = $f->toString($f->getClean()); } // Add in organization data if one exists for this email domain list($mailbox, $domain) = explode('@', $vars['email'], 2); if ($org = Organization::forDomain($domain)) { $vars += $org->getFilterData(); } } try { // Make sure the email address is not banned if (TicketFilter::isBanned($vars['email'])) { throw new RejectedException(Banlist::getFilter(), $vars); } // Init ticket filters... $ticket_filter = new TicketFilter($origin, $vars); $ticket_filter->apply($vars); } catch (FilterDataChanged $ex) { // Don't pass user recursively, assume the user has changed return self::filterTicketData($origin, $ex->getData(), $forms); } return $vars; }