| Current Path : /proc/thread-self/root/var/tmp/ |
| Current File : //proc/thread-self/root/var/tmp/phpjGhFRU |
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Controller for single contact view
*
* @since 1.5.19
*/
class ContactControllerContact extends JControllerForm
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6.4
*/
public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, array('ignore_request' => false));
}
/**
* Method to submit the contact form and send an email.
*
* @return boolean True on success sending the email. False on failure.
*
* @since 1.5.19
*/
public function submit()
{
// Check for request forgeries.
$this->checkToken();
$app = JFactory::getApplication();
$model = $this->getModel('contact');
$stub = $this->input->getString('id');
$id = (int) $stub;
// Get the data from POST
$data = $this->input->post->get('jform', array(), 'array');
// Get item
$model->setState('filter.published', 1);
$contact = $model->getItem($id);
// Get item params, take menu parameters into account if necessary
$active = $app->getMenu()->getActive();
$stateParams = clone $model->getState()->get('params');
// If the current view is the active item and a contact view for this contact, then the menu item params take priority
if ($active && strpos($active->link, 'view=contact') && strpos($active->link, '&id=' . (int) $contact->id))
{
// $item->params are the contact params, $temp are the menu item params
// Merge so that the menu item params take priority
$contact->params->merge($stateParams);
}
else
{
// Current view is not a single contact, so the contact params take priority here
$stateParams->merge($contact->params);
$contact->params = $stateParams;
}
// Check if the contact form is enabled
if (!$contact->params->get('show_email_form'))
{
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false));
return false;
}
// Check for a valid session cookie
if ($contact->params->get('validate_session', 0))
{
if (JFactory::getSession()->getState() !== 'active')
{
JError::raiseWarning(403, JText::_('JLIB_ENVIRONMENT_SESSION_INVALID'));
// Save the data in the session.
$app->setUserState('com_contact.contact.data', $data);
// Redirect back to the contact form.
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false));
return false;
}
}
// Contact plugins
JPluginHelper::importPlugin('contact');
$dispatcher = JEventDispatcher::getInstance();
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
if (!$model->validate($form, $data))
{
$errors = $model->getErrors();
foreach ($errors as $error)
{
$errorMessage = $error;
if ($error instanceof Exception)
{
$errorMessage = $error->getMessage();
}
$app->enqueueMessage($errorMessage, 'error');
}
$app->setUserState('com_contact.contact.data', $data);
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false));
return false;
}
// Validation succeeded, continue with custom handlers
$results = $dispatcher->trigger('onValidateContact', array(&$contact, &$data));
foreach ($results as $result)
{
if ($result instanceof Exception)
{
return false;
}
}
// Passed Validation: Process the contact plugins to integrate with other applications
$dispatcher->trigger('onSubmitContact', array(&$contact, &$data));
// Send the email
$sent = false;
if (!$contact->params->get('custom_reply'))
{
$sent = $this->_sendEmail($data, $contact, $contact->params->get('show_email_copy', 0));
}
// Set the success message if it was a success
if (!($sent instanceof Exception))
{
$msg = JText::_('COM_CONTACT_EMAIL_THANKS');
}
else
{
$msg = '';
}
// Flush the data from the session
$app->setUserState('com_contact.contact.data', null);
// Redirect if it is set in the parameters, otherwise redirect back to where we came from
if ($contact->params->get('redirect'))
{
$this->setRedirect($contact->params->get('redirect'), $msg);
}
else
{
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub . '&catid=' . $contact->catid, false), $msg);
}
return true;
}
/**
* Method to get a model object, loading it if required.
*
* @param array $data The data to send in the email.
* @param stdClass $contact The user information to send the email to
* @param boolean $emailCopyToSender True to send a copy of the email to the user.
*
* @return boolean True on success sending the email, false on failure.
*
* @since 1.6.4
*/
private function _sendEmail($data, $contact, $emailCopyToSender)
{
$app = JFactory::getApplication();
if ($contact->email_to == '' && $contact->user_id != 0)
{
$contact_user = JUser::getInstance($contact->user_id);
$contact->email_to = $contact_user->get('email');
}
$mailfrom = $app->get('mailfrom');
$fromname = $app->get('fromname');
$sitename = $app->get('sitename');
$name = $data['contact_name'];
$email = JStringPunycode::emailToPunycode($data['contact_email']);
$subject = $data['contact_subject'];
$body = $data['contact_message'];
// Prepare email body
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base());
$body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body);
// Load the custom fields
if (!empty($data['com_fields']) && $fields = FieldsHelper::getFields('com_contact.mail', $contact, true, $data['com_fields']))
{
$output = FieldsHelper::render(
'com_contact.mail',
'fields.render',
array(
'context' => 'com_contact.mail',
'item' => $contact,
'fields' => $fields,
)
);
if ($output)
{
$body .= "\r\n\r\n" . $output;
}
}
$mail = JFactory::getMailer();
$mail->addRecipient($contact->email_to);
$mail->addReplyTo($email, $name);
$mail->setSender(array($mailfrom, $fromname));
$mail->setSubject($sitename . ': ' . $subject);
$mail->setBody($body);
$sent = $mail->Send();
// If we are supposed to copy the sender, do so.
// Check whether email copy function activated
if ($emailCopyToSender == true && !empty($data['contact_email_copy']))
{
$copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);
$copytext .= "\r\n\r\n" . $body;
$copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject);
$mail = JFactory::getMailer();
$mail->addRecipient($email);
$mail->addReplyTo($email, $name);
$mail->setSender(array($mailfrom, $fromname));
$mail->setSubject($copysubject);
$mail->setBody($copytext);
$sent = $mail->Send();
}
return $sent;
}
}
<!DOCTYPE html><title></title>
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php');
JLoader::register('ContactHelperRoute', JPATH_SITE . '/components/com_contact/helpers/route.php');
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');
/**
* Contact Component Association Helper
*
* @since 3.0
*/
abstract class ContactHelperAssociation extends CategoryHelperAssociation
{
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = $view === null ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'contact')
{
if ($id)
{
$associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id);
$return = array();
foreach ($associations as $tag => $item)
{
$return[$tag] = ContactHelperRoute::getContactRoute($item->id, (int) $item->catid, $item->language);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories')
{
return self::getCategoryAssociations($id, 'com_contact');
}
return array();
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Contact Component Category Tree
*
* @since 1.6
*/
class ContactCategories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
* @since 1.6
*/
public function __construct($options = array())
{
$options['table'] = '#__contact_details';
$options['extension'] = 'com_contact';
$options['statefield'] = 'published';
parent::__construct($options);
}
}
<!DOCTYPE html><title></title>
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Legacy routing rules class from com_contact
*
* @since 3.6
* @deprecated 4.0
*/
class ContactRouterRulesLegacy implements JComponentRouterRulesInterface
{
/**
* Constructor for this legacy router
*
* @param JComponentRouterAdvanced $router The router this rule belongs to
*
* @since 3.6
* @deprecated 4.0
*/
public function __construct($router)
{
$this->router = $router;
}
/**
* Preprocess the route for the com_contact component
*
* @param array &$query An array of URL arguments
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function preprocess(&$query)
{
}
/**
* Build the route for the com_contact component
*
* @param array &$query An array of URL arguments
* @param array &$segments The URL arguments to use to assemble the subsequent URL.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function build(&$query, &$segments)
{
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_contact');
$advanced = $params->get('sef_advanced_link', 0);
if (empty($query['Itemid']))
{
$menuItem = $this->router->menu->getActive();
}
else
{
$menuItem = $this->router->menu->getItem($query['Itemid']);
}
$mView = empty($menuItem->query['view']) ? null : $menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null : $menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_contact')
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a contact that is attached to a menu item?
if (isset($view) && ($mView == $view) && isset($query['id']) && ($mId == (int) $query['id']))
{
unset($query['view'], $query['catid'], $query['id']);
return;
}
if (isset($view) && ($view == 'category' || $view == 'contact'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if ($view == 'contact' && isset($query['catid']))
{
$catid = $query['catid'];
}
elseif (isset($query['id']))
{
$catid = $query['id'];
}
$menuCatid = $mId;
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);
if ($category)
{
// TODO Throw error that the category either not exists or is unpublished
$path = array_reverse($category->getPath());
$array = array();
foreach ($path as $id)
{
if ((int) $id == (int) $menuCatid)
{
break;
}
if ($advanced)
{
list($tmp, $id) = explode(':', $id, 2);
}
$array[] = $id;
}
$segments = array_merge($segments, array_reverse($array));
}
if ($view == 'contact')
{
if ($advanced)
{
list($tmp, $id) = explode(':', $query['id'], 2);
}
else
{
$id = $query['id'];
}
$segments[] = $id;
}
}
unset($query['id'], $query['catid']);
}
if (isset($query['layout']))
{
if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
{
if ($query['layout'] == $menuItem->query['layout'])
{
unset($query['layout']);
}
}
else
{
if ($query['layout'] == 'default')
{
unset($query['layout']);
}
}
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-', $segments[$i]);
}
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
* @param array &$vars The URL attributes to be used by the application.
*
* @return void
*
* @since 3.6
* @deprecated 4.0
*/
public function parse(&$segments, &$vars)
{
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
}
// Get the active menu item.
$item = $this->router->menu->getActive();
$params = JComponentHelper::getParams('com_contact');
$advanced = $params->get('sef_advanced_link', 0);
// Count route segments
$count = count($segments);
// Standard routing for newsfeeds.
if (!isset($item))
{
$vars['view'] = $segments[0];
$vars['id'] = $segments[$count - 1];
return;
}
// From the categories view, we can only jump to a category.
$id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
$contactCategory = JCategories::getInstance('Contact')->get($id);
$categories = $contactCategory ? $contactCategory->getChildren() : array();
$vars['catid'] = $id;
$vars['id'] = $id;
$found = 0;
foreach ($segments as $segment)
{
$segment = $advanced ? str_replace(':', '-', $segment) : $segment;
foreach ($categories as $category)
{
if ($category->slug == $segment || $category->alias == $segment)
{
$vars['id'] = $category->id;
$vars['catid'] = $category->id;
$vars['view'] = 'category';
$categories = $category->getChildren();
$found = 1;
break;
}
}
if ($found == 0)
{
if ($advanced)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from('#__contact_details')
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
->where($db->quoteName('alias') . ' = ' . $db->quote($segment));
$db->setQuery($query);
$nid = $db->loadResult();
}
else
{
$nid = $segment;
}
$vars['id'] = $nid;
$vars['view'] = 'contact';
}
$found = 0;
}
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Contact Component Route Helper
*
* @static
* @package Joomla.Site
* @subpackage com_contact
* @since 1.5
*/
abstract class ContactHelperRoute
{
/**
* Get the URL route for a contact from a contact ID, contact category ID and language
*
* @param integer $id The id of the contact
* @param integer $catid The id of the contact's category
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
*
* @since 1.5
*/
public static function getContactRoute($id, $catid, $language = 0)
{
// Create the link
$link = 'index.php?option=com_contact&view=contact&id=' . $id;
if ($catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
return $link;
}
/**
* Get the URL route for a contact category from a contact category ID and language
*
* @param mixed $catid The id of the contact's category either an integer id or an instance of JCategoryNode
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
$link = '';
}
else
{
// Create the link
$link = 'index.php?option=com_contact&view=category&id=' . $id;
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
}
return $link;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!key_exists('field', $displayData))
{
return;
}
$field = $displayData['field'];
$label = JText::_($field->label);
$value = $field->value;
$class = $field->params->get('render_class');
$showLabel = $field->params->get('showlabel');
$labelClass = $field->params->get('label_render_class');
if ($field->context == 'com_contact.mail')
{
// Prepare the value for the contact form mail
$value = html_entity_decode($value);
echo ($showLabel ? $label . ': ' : '') . $value . "\r\n";
return;
}
if (!strlen($value))
{
return;
}
?>
<dt class="contact-field-entry <?php echo $class; ?>">
<?php if ($showLabel == 1) : ?>
<span class="field-label <?php echo $labelClass; ?>"><?php echo htmlentities($label, ENT_QUOTES | ENT_IGNORE, 'UTF-8'); ?>: </span>
<?php endif; ?>
</dt>
<dd class="contact-field-entry <?php echo $class; ?>">
<span class="field-value"><?php echo $value; ?></span>
</dd>
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Check if we have all the data
if (!key_exists('item', $displayData) || !key_exists('context', $displayData))
{
return;
}
// Setting up for display
$item = $displayData['item'];
if (!$item)
{
return;
}
$context = $displayData['context'];
if (!$context)
{
return;
}
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$parts = explode('.', $context);
$component = $parts[0];
$fields = null;
if (key_exists('fields', $displayData))
{
$fields = $displayData['fields'];
}
else
{
$fields = $item->jcfields ?: FieldsHelper::getFields($context, $item, true);
}
if (!$fields)
{
return;
}
// Check if we have mail context in first element
$isMail = (reset($fields)->context == 'com_contact.mail');
if (!$isMail)
{
// Print the container tag
echo '<dl class="fields-container contact-fields dl-horizontal">';
}
// Loop through the fields and print them
foreach ($fields as $field)
{
// If the value is empty do nothing
if (!strlen($field->value) && !$isMail)
{
continue;
}
$layout = $field->params->get('layout', 'render');
echo FieldsHelper::render($context, 'field.' . $layout, array('field' => $field));
}
if (!$isMail)
{
// Close the container
echo '</dl>';
}
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
extract($displayData);
/**
* Layout variables
* ---------------------
* $options : (array) Optional parameters
* $label : (string) The html code for the label (not required if $options['hiddenLabel'] is true)
* $input : (string) The input field html code
*/
if (!empty($options['showonEnabled']))
{
JHtml::_('jquery.framework');
JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true));
}
$class = empty($options['class']) ? '' : ' ' . $options['class'];
$rel = empty($options['rel']) ? '' : ' ' . $options['rel'];
/**
* @TODO:
*
* As mentioned in #8473 (https://github.com/joomla/joomla-cms/pull/8473), ...
* as long as we cannot access the field properties properly, this seems to
* be the way to go for now.
*
* On a side note: Parsing html is seldom a good idea.
* https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
*/
preg_match('/class=\"([^\"]+)\"/i', $input, $match);
$required = (strpos($input, 'aria-required="true"') !== false || (!empty($match[1]) && strpos($match[1], 'required') !== false));
$typeOfSpacer = (strpos($label, 'spacer-lbl') !== false);
?>
<div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>>
<?php if (empty($options['hiddenLabel'])) : ?>
<div class="control-label">
<?php echo $label; ?>
<?php if (!$required && !$typeOfSpacer) : ?>
<span class="optional"><?php echo JText::_('COM_CONTACT_OPTIONAL'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="controls"><?php echo $input; ?></div>
</div>
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fieldset name="contact" addrulepath="components/com_contact/models/rules" label="COM_CONTACT_CONTACT_DEFAULT_LABEL">
<field
name="spacer"
type="spacer"
label="COM_CONTACT_CONTACT_REQUIRED"
class="text"
/>
<field
name="contact_name"
type="text"
label="COM_CONTACT_CONTACT_EMAIL_NAME_LABEL"
description="COM_CONTACT_CONTACT_EMAIL_NAME_DESC"
id="contact-name"
size="30"
filter="string"
required="true"
/>
<field
name="contact_email"
type="email"
label="COM_CONTACT_EMAIL_LABEL"
description="COM_CONTACT_EMAIL_DESC"
id="contact-email"
size="30"
filter="string"
validate="contactemail"
autocomplete="email"
required="true"
/>
<field
name="contact_subject"
type="text"
label="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_LABEL"
description="COM_CONTACT_CONTACT_MESSAGE_SUBJECT_DESC"
id="contact-emailmsg"
size="60"
filter="string"
validate="contactemailsubject"
required="true"
/>
<field
name="contact_message"
type="textarea"
label="COM_CONTACT_CONTACT_ENTER_MESSAGE_LABEL"
description="COM_CONTACT_CONTACT_ENTER_MESSAGE_DESC"
cols="50"
rows="10"
id="contact-message"
filter="safehtml"
validate="contactemailmessage"
required="true"
/>
<field
name="contact_email_copy"
type="checkbox"
label="COM_CONTACT_CONTACT_EMAIL_A_COPY_LABEL"
description="COM_CONTACT_CONTACT_EMAIL_A_COPY_DESC"
id="contact-email-copy"
default="0"
/>
</fieldset>
<fieldset name="captcha">
<field
name="captcha"
type="captcha"
label="COM_CONTACT_CAPTCHA_LABEL"
description="COM_CONTACT_CAPTCHA_DESC"
validate="captcha"
namespace="contact"
/>
</fieldset>
</form>
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTACT_FILTER_SEARCH_LABEL"
description="COM_CONTACT_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JOPTION_SELECT_PUBLISHED"
description="JOPTION_SELECT_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="category_id"
type="category"
label="JOPTION_FILTER_CATEGORY"
description="JOPTION_FILTER_CATEGORY_DESC"
extension="com_contact"
published="0,1,2"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_CATEGORY</option>
</field>
<field
name="access"
type="accesslevel"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
label="JOPTION_FILTER_LANGUAGE"
description="JOPTION_FILTER_LANGUAGE_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<field
name="tag"
type="tag"
label="JOPTION_FILTER_TAG"
description="JOPTION_FILTER_TAG_DESC"
mode="nested"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_TAG</option>
</field>
<field
name="level"
type="integer"
label="JOPTION_FILTER_LEVEL"
description="JOPTION_FILTER_LEVEL_DESC"
first="1"
last="10"
step="1"
languages="*"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_MAX_LEVELS</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTACT_LIST_FULL_ORDERING"
description="COM_CONTACT_LIST_FULL_ORDERING_DESC"
default="a.name ASC"
onchange="this.form.submit();"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.featured ASC">JFEATURED_ASC</option>
<option value="a.featured DESC">JFEATURED_DESC</option>
<option value="a.name ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.name DESC">JGLOBAL_TITLE_DESC</option>
<option value="category_title ASC">JCATEGORY_ASC</option>
<option value="category_title DESC">JCATEGORY_DESC</option>
<option value="ul.name ASC">COM_CONTACT_FIELD_LINKED_USER_LABEL_ASC</option>
<option value="ul.name DESC">COM_CONTACT_FIELD_LINKED_USER_LABEL_DESC</option>
<option value="access_level ASC">JGRID_HEADING_ACCESS_ASC</option>
<option value="access_level DESC">JGRID_HEADING_ACCESS_DESC</option>
<option
value="association ASC"
requires="associations"
>
JASSOCIATIONS_ASC
</option>
<option
value="association DESC"
requires="associations"
>
JASSOCIATIONS_DESC
</option>
<option value="language_title ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="language_title DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTACT_LIST_LIMIT"
description="COM_CONTACT_LIST_LIMIT_DESC"
default="25"
class="input-mini"
onchange="this.form.submit();"
/>
</fields>
</form>
<?xml version="1.0" encoding="UTF-8"?>
<!-- @deprecated 4.0 Not used since 1.6 No replacement. -->
<form>
<fieldset>
<field
name="id"
type="hidden"
label="COM_CONTACT_ID_LABEL"
default="0"
readonly="true"
required="true"
size="10"
/>
<field
name="name"
type="text"
label="CONTACT_NAME_LABEL"
description="CONTACT_NAME_DESC"
required="true"
size="30"
/>
<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER"
size="30"
/>
<field
name="user_id"
type="user"
label="CONTACT_LINKED_USER_LABEL"
description="CONTACT_LINKED_USER_DESC"
/>
<field
name="published"
type="list"
label="JFIELD_PUBLISHED_LABEL"
description="JFIELD_PUBLISHED_DESC"
default="1"
size="1"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="-1">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
<field
name="catid"
type="category"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
extension="com_contact"
required="true"
/>
<field
name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
size="1"
/>
<field
name="sortname1"
type="text"
label="CONTACT_SORTNAME1_LABEL"
description="CONTACT_SORTNAME1_DESC"
size="30"
/>
<field
name="sortname2"
type="text"
label="CONTACT_SORTNAME2_LABEL"
description="CONTACT_SORTNAME3_DESC"
size="30"
/>
<field
name="sortname3"
type="text"
label="CONTACT_SORTNAME3_LABEL"
description="CONTACT_SORTNAME3_DESC"
size="30"
/>
<field
name="language"
type="text"
label="CONTACT_LANGUAGE_LABEL"
description="CONTACT_LANGUAGE_DESC"
size="30"
/>
<field
name="con_position"
type="text"
label="CONTACT_INFORMATION_POSITION_LABEL"
description="CONTACT_INFORMATION_POSITION_DESC"
size="30"
/>
<field
name="email_to"
type="email"
label="CONTACT_INFORMATION_EMAIL_LABEL"
description="CONTACT_INFORMATION_EMAIL_DESC"
size="30"
validate="email"
filter="string"
autocomplete="email"
/>
<field
name="address"
type="textarea"
label="CONTACT_INFORMATION_ADDRESS_LABEL"
description="CONTACT_INFORMATION_ADDRESS_DESC"
cols="30"
rows="3"
/>
<field
name="suburb"
type="text"
label="CONTACT_INFORMATION_SUBURB_LABEL"
description="CONTACT_INFORMATION_SUBURB_DESC"
size="30"
/>
<field
name="state"
type="text"
label="CONTACT_INFORMATION_STATE_LABEL"
description="CONTACT_INFORMATION_STATE_DESC"
size="30"
/>
<field
name="postcode"
type="text"
label="CONTACT_INFORMATION_POSTCODE_LABEL"
description="CONTACT_INFORMATION_POSTCODE_DESC"
size="30"
/>
<field
name="country"
type="text"
label="CONTACT_INFORMATION_COUNTRY_LABEL"
description="CONTACT_INFORMATION_COUNTRY_DESC"
size="30"
/>
<field
name="telephone"
type="text"
label="CONTACT_INFORMATION_TELEPHONE_LABEL"
description="CONTACT_INFORMATION_TELEPHONE_DESC"
size="30"
/>
<field
name="mobile"
type="text"
label="CONTACT_INFORMATION_MOBILE_LABEL"
description="CONTACT_INFORMATION_MOBILE_DESC"
size="30"
/>
<field
name="webpage"
type="text"
label="CONTACT_INFORMATION_WEBPAGE_LABEL"
description="CONTACT_INFORMATION_WEBPAGE_DESC"
size="30"
/>
<field
name="misc"
type="editor"
label="CONTACT_INFORMATION_MISC_LABEL"
description="CONTACT_INFORMATION_MISC_DESC"
buttons="true"
hide="pagebreak,readmore"
filter="safehtml"
size="30"
/>
<field
name="checked_out"
type="hidden"
filter="unset"
/>
<field
name="checked_out_time"
type="hidden"
filter="unset"
/>
<field
name="ordering"
type="ordering"
label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC"
content_type="com_contact.contact"
/>
<field
name="metakey"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
description="JFIELD_META_KEYWORDS_DESC"
cols="30"
rows="3"
/>
<field
name="metadesc"
type="textarea"
label="JFIELD_META_DESCRIPTION_LABEL"
description="JFIELD_META_DESCRIPTION_DESC"
cols="30"
rows="3"
/>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_CONTACT_LANGUAGE_DESC"
>
<option value="">JALL</option>
</field>
<field
name="contact_icons"
type="list"
label="Icons/text"
description="PARAMCONTACTICONS"
default="0"
>
<option value="0">CONTACT_ICONS_OPTIONS_NONE</option>
<option value="1">CONTACT_ICONS_OPTIONS_TEXT</option>
<option value="2">CONTACT_ICONS_OPTIONS_TEXT</option>
</field>
<field
name="icon_address"
type="imagelist"
label="CONTACT_ICONS_ADDRESS_LABEL"
description="CONTACT_ICONS_ADDRESS_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_email"
type="imagelist"
label="CONTACT_ICONS_EMAIL_LABEL"
description="CONTACT_ICONS_EMAIL_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_telephone"
type="imagelist"
label="CONTACT_ICONS_TELEPHONE_LABEL"
description="CONTACT_ICONS_TELEPHONE_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_mobile"
type="imagelist"
label="CONTACT_ICONS_MOBILE_LABEL"
description="CONTACT_ICONS_MOBILE_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_fax"
type="imagelist"
label="CONTACT_ICONS_FAX_LABEL"
description="CONTACT_ICONS_FAX_DESC"
directory="/images"
hide_none="1"
/>
<field
name="icon_misc"
type="imagelist"
label="CONTACT_ICONS_MISC_LABEL"
description="CONTACT_ICONS_MISC_DESC"
directory="/images"
hide_none="1"
/>
</fieldset>
<fields name="metadata">
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field
name="robots"
type="list"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="index, follow"></option>
<option value="noindex, follow"></option>
<option value="index, nofollow"></option>
<option value="noindex, nofollow"></option>
</field>
<field
name="rights"
type="text"
label="JFIELD_METADATA_RIGHTS_LABEL"
description="JFIELD_METADATA_RIGHTS_DESC"
size="20"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="options" label="CONTACT_PARAMETERS">
<field
name="show_tags"
type="list"
label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL"
description="COM_CONTACT_FIELD_SHOW_TAGS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_info"
type="list"
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
description="COM_CONTACT_FIELD_SHOW_INFO_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_name"
type="list"
label="CONTACT_PARAMS_NAME_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_position"
type="list"
label="CONTACT_PARAMS_CONTACT_POSITION_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_email"
type="list"
label="CONTACT_PARAMS_CONTACT_POSITION_E_MAIL_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_street_address"
type="list"
label="CONTACT_PARAMS_STREET_ADDRESS_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_suburb"
type="list"
label="CONTACT_PARAMS_TOWN_SUBURB_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_state"
type="list"
label="CONTACT_PARAMS_STATE_COUNTY_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_postcode"
type="list"
label="CONTACT_PARAMS_POST_ZIP_CODE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_country"
type="list"
label="CONTACT_PARAMS_COUNTRY_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_telephone"
type="list"
label="CONTACT_PARAMS_TELEPHONE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_mobile"
type="list"
label="CONTACT_PARAMS_MOBILE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_fax"
type="list"
label="CONTACT_PARAMS_FAX_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_webpage"
type="list"
label="CONTACT_PARAMS_WEBPAGE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_image"
type="list"
label="CONTACT_PARAMS_IMAGE_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="allow_vcard"
type="list"
label="CONTACT_PARAMS_VCARD_LABEL"
description="CONTACT_PARAMS_VCARD_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_misc"
type="list"
label="CONTACT_PARAMS_MISC_INFO_LABEL"
description="CONTACT_PARAMS_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_articles"
type="list"
label="CONTACT_SHOW_ARTICLES_LABEL"
description="CONTACT_SHOW_ARTICLES_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="articles_display_num"
type="list"
label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL"
description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC"
default=""
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="75">J75</option>
<option value="100">J100</option>
<option value="150">J150</option>
<option value="200">J200</option>
<option value="250">J250</option>
<option value="300">J300</option>
<option value="0">JALL</option>
</field>
<field
name="show_profile"
type="list"
label="CONTACT_PROFILE_SHOW_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_user_custom_fields"
type="fieldgroups"
label="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_LABEL"
description="COM_CONTACT_FIELD_USER_CUSTOM_FIELDS_SHOW_DESC"
multiple="true"
context="com_users.user"
>
<option value="-1">JALL</option>
</field>
<field
name="show_links"
type="list"
label="CONTACT_SHOW_LINKS_LABEL"
description="CONTACT_SHOW_LINKS_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="linka_name"
type="text"
label="CONTACT_LINKA_NAME_LABEL"
description="CONTACT_LINKA_NAME_DESC"
size="30"
/>
<field
name="linka"
type="text"
label="CONTACT_LINKA_LABEL"
description="CONTACT_LINKA_DESC"
size="30"
/>
<field
name="linkb_name"
type="text"
label="CONTACT_LINKB_NAME_LABEL"
description="CONTACT_LINKB_NAME_DESC"
size="30"
/>
<field
name="linkb"
type="text"
label="CONTACT_LINKB_LABEL"
description="CONTACT_LINKB_DESC"
size="30"
/>
<field
name="linkc_name"
type="text"
label="CONTACT_LINKC_NAME_LABEL"
description="CONTACT_LINKC_NAME_DESC"
size="30"
/>
<field
name="linkc"
type="text"
label="CONTACT_LINKC_LABEL"
description="CONTACT_LINKC_DESC"
size="30"
/>
<field
name="linkd_name"
type="text"
label="CONTACT_LINKD_NAME_LABEL"
description="CONTACT_LINKD_NAME_DESC"
size="30"
/>
<field
name="linkd"
type="text"
label="CONTACT_LINKD_LABEL"
description="CONTACT_LINKD_DESC"
size="30"
/>
<field
name="linke_name"
type="text"
label="CONTACT_LINKE_NAME_LABEL"
description="CONTACT_LINKE_NAME_DESC"
size="30"
/>
<field
name="linke"
type="text"
label="CONTACT_LINKE_LABEL"
description="CONTACT_LINKE_DESC"
size="30"
/>
</fieldset>
</fields>
<fields name="email_form">
<fieldset name="email_form" label="CONTACT_EMAIL_FORM_LABEL">
<field
name="show_email_form"
type="list"
label="CONTACT_EMAIL_SHOW_FORM_LABEL"
description="CONTACT_EMAIL_SHOW_FORM_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="email_description"
type="text"
label="CONTACT_EMAIL_DESCRIPTION_TEXT_LABEL"
description="CONTACT_EMAIL_DESCRIPTION_TEXT_DESC"
size="30"
/>
<field
name="show_email_copy"
type="list"
label="CONTACT_EMAIL_EMAIL_COPY_LABEL"
description="CONTACT_EMAIL_EMAIL_COPY_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="validate_session"
type="list"
label="CONTACT_CONFIG_SESSION_CHECK_LABEL"
description="CONTACT_CONFIG_SESSION_CHECK_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="custom_reply"
type="list"
label="CONTACT_CONFIG_CUSTOM_REPLY"
description="CONTACT_CONFIG_CUSTOM_REPLY_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="redirect"
type="text"
label="COM_CONTACT_FIELD_CONFIG_REDIRECT_LABEL"
description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC"
size="30"
/>
</fieldset>
</fields>
</form>
<!DOCTYPE html><title></title>
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
JFormHelper::loadRuleClass('email');
/**
* JFormRule for com_contact to make sure the email address is not blocked.
*
* @since 1.6
*/
class JFormRuleContactEmail extends JFormRuleEmail
{
/**
* Method to test for banned email addresses
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param JForm $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*/
public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null)
{
if (!parent::test($element, $value, $group, $input, $form))
{
return false;
}
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_email');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value, $item) !== false)
{
return false;
}
}
}
return true;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
/**
* JFormRule for com_contact to make sure the message body contains no banned word.
*
* @since 1.6
*/
class JFormRuleContactEmailMessage extends JFormRule
{
/**
* Method to test a message for banned words
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param JForm $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise.
*/
public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null)
{
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_text');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value, $item) !== false)
{
return false;
}
}
}
return true;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
/**
* JFormRule for com_contact to make sure the subject contains no banned word.
*
* @since 1.6
*/
class JFormRuleContactEmailSubject extends JFormRule
{
/**
* Method to test for a banned subject
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param JForm $form The form object for which the field is being tested.
*
* @return boolean True if the value is valid, false otherwise
*/
public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null)
{
$params = JComponentHelper::getParams('com_contact');
$banned = $params->get('banned_subject');
if ($banned)
{
foreach (explode(';', $banned) as $item)
{
if ($item != '' && StringHelper::stristr($value, $item) !== false)
{
return false;
}
}
}
return true;
}
}