uawdijnntqw1x1x1
IP : 216.73.216.231
Hostname : 213-108-241-110.cprapid.com
Kernel : Linux 213-108-241-110.cprapid.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
digilove
/
public_html
/
cfa23e
/
.
/
..
/
41423
/
models.tar
/
/
fields/languageclient.php000064400000003361152326013660011514 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_newsfeeds * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JFormHelper::loadFieldClass('list'); /** * Client Language List field. * * @since 3.9.0 */ class JFormFieldLanguageclient extends JFormFieldList { /** * The form field type. * * @var string * @since 3.9.0 */ protected $type = 'Languageclient'; /** * Cached form field options. * * @var array * @since 3.9.0 */ protected $cache = array(); /** * Method to get the field options. * * @return array The field option objects. * * @since 3.9.0 */ protected function getOptions() { // Try to load the data from our mini-cache. if (!empty($this->cache)) { return $this->cache; } // Get all languages of frontend and backend. $languages = array(); $site_languages = JLanguageHelper::getKnownLanguages(JPATH_SITE); $admin_languages = JLanguageHelper::getKnownLanguages(JPATH_ADMINISTRATOR); // Create a single array of them. foreach ($site_languages as $tag => $language) { $languages[$tag . '0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE')); } foreach ($admin_languages as $tag => $language) { $languages[$tag . '1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR')); } // Sort it by language tag and by client after that. ksort($languages); // Add the languages to the internal cache. $this->cache = array_merge(parent::getOptions(), $languages); return $this->cache; } } forms/filter_installed.xml000064400000004601152326013660011745 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <field name="client_id" type="list" onchange="jQuery('#filter_search, select[id^=filter_], #list_fullordering').val('');this.form.submit();" filtermode="selector" > <option value="0">JSITE</option> <option value="1">JADMINISTRATOR</option> </field> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_LABEL" description="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" noresults="JGLOBAL_NO_MATCHING_RESULTS" /> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" default="name ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="name ASC">COM_LANGUAGES_HEADING_LANGUAGE_ASC</option> <option value="name DESC">COM_LANGUAGES_HEADING_LANGUAGE_DESC</option> <option value="nativeName ASC">COM_LANGUAGES_HEADING_TITLE_NATIVE_ASC</option> <option value="nativeName DESC">COM_LANGUAGES_HEADING_TITLE_NATIVE_DESC</option> <option value="language ASC">COM_LANGUAGES_HEADING_LANG_TAG_ASC</option> <option value="language DESC">COM_LANGUAGES_HEADING_LANG_TAG_DESC</option> <option value="published ASC">COM_LANGUAGES_HEADING_DEFAULT_ASC</option> <option value="published DESC">COM_LANGUAGES_HEADING_DEFAULT_DESC</option> <option value="version ASC">COM_LANGUAGES_HEADING_VERSION_ASC</option> <option value="version DESC">COM_LANGUAGES_HEADING_VERSION_DESC</option> <option value="creationDate ASC">COM_LANGUAGES_HEADING_DATE_ASC</option> <option value="creationDate DESC">COM_LANGUAGES_HEADING_DATE_DESC</option> <option value="author ASC">COM_LANGUAGES_HEADING_AUTHOR_ASC</option> <option value="author DESC">COM_LANGUAGES_HEADING_AUTHOR_DESC</option> <option value="authorEmail ASC">COM_LANGUAGES_HEADING_AUTHOR_EMAIL_ASC</option> <option value="authorEmail DESC">COM_LANGUAGES_HEADING_AUTHOR_EMAIL_DESC</option> <option value="extension_id ASC">JGRID_HEADING_ID_ASC</option> <option value="extension_id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> forms/filter_languages.xml000064400000004637152326013660011745 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="JSEARCH_FILTER" description="COM_LANGUAGES_SEARCH_IN_TITLE" hint="JSEARCH_FILTER" /> <field name="published" type="status" filter="1,0,-2,*" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="access" type="accesslevel" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_ACCESS</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" default="a.ordering ASC" 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.title ASC">JGLOBAL_TITLE_ASC</option> <option value="a.title DESC">JGLOBAL_TITLE_DESC</option> <option value="a.title_native ASC">COM_LANGUAGES_HEADING_TITLE_NATIVE_ASC</option> <option value="a.title_native DESC">COM_LANGUAGES_HEADING_TITLE_NATIVE_DESC</option> <option value="a.lang_code ASC">COM_LANGUAGES_HEADING_LANG_TAG_ASC</option> <option value="a.lang_code DESC">COM_LANGUAGES_HEADING_LANG_TAG_DESC</option> <option value="a.sef ASC">COM_LANGUAGES_HEADING_LANG_CODE_ASC</option> <option value="a.sef DESC">COM_LANGUAGES_HEADING_LANG_CODE_DESC</option> <option value="a.image ASC">COM_LANGUAGES_HEADING_LANG_IMAGE_ASC</option> <option value="a.image DESC">COM_LANGUAGES_HEADING_LANG_IMAGE_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option> <option value="l.home ASC">COM_LANGUAGES_HEADING_HOMEPAGE_ASC</option> <option value="l.home DESC">COM_LANGUAGES_HEADING_HOMEPAGE_DESC</option> <option value="a.lang_id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.lang_id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> forms/filter_overrides.xml000064400000001220152326013660011762 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <field name="language_client" type="languageclient" onchange="this.form.submit();" > <option value="">COM_LANGUAGES_OVERRIDE_SELECT_LANGUAGE</option> </field> <fields name="filter"> <field name="search" type="text" inputmode="search" label="JSEARCH_FILTER" description="COM_LANGUAGES_VIEW_OVERRIDES_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> </fields> <fields name="list"> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> forms/index.html000064400000000037152326013660007673 0ustar00<!DOCTYPE html><title></title> forms/language.xml000064400000005063152326013660010207 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fieldset> <field name="lang_id" type="text" label="JGLOBAL_FIELD_ID_LABEL" description="JGLOBAL_FIELD_ID_DESC" class="readonly" default="0" readonly="true" /> <field name="lang_code" type="text" label="COM_LANGUAGES_FIELD_LANG_TAG_LABEL" description="COM_LANGUAGES_FIELD_LANG_TAG_DESC" maxlength="7" required="true" size="10" /> <field name="title" type="text" label="JGLOBAL_TITLE" description="COM_LANGUAGES_FIELD_TITLE_DESC" maxlength="50" required="true" size="40" /> <field name="title_native" type="text" label="COM_LANGUAGES_FIELD_TITLE_NATIVE_LABEL" description="COM_LANGUAGES_FIELD_TITLE_NATIVE_DESC" maxlength="50" required="true" size="40" /> <field name="sef" type="text" label="COM_LANGUAGES_FIELD_LANG_CODE_LABEL" description="COM_LANGUAGES_FIELD_LANG_CODE_DESC" maxlength="50" required="true" size="10" /> <field name="image" type="filelist" label="COM_LANGUAGES_FIELD_IMAGE_LABEL" description="COM_LANGUAGES_FIELD_IMAGE_DESC" stripext="1" directory="media/mod_languages/images/" hide_none="1" hide_default="1" filter="\.gif$" size="10" > <option value="">JNONE</option> </field> <field name="description" type="textarea" label="JGLOBAL_DESCRIPTION" description="COM_LANGUAGES_FIELD_DESCRIPTION_DESC" cols="80" rows="5" /> <field name="published" type="list" label="JSTATUS" description="COM_LANGUAGES_FIELD_PUBLISHED_DESC" default="1" size="1" > <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="-2">JTRASHED</option> </field> <field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" size="1" /> </fieldset> <fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC" rows="3" cols="30" /> <field name="metadesc" type="textarea" label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC" rows="3" cols="30" /> </fieldset> <fieldset name="site_name" label="COM_LANGUAGES_FIELDSET_SITE_NAME_LABEL"> <field name="sitename" type="text" label="COM_LANGUAGES_FIELD_SITE_NAME_LABEL" description="COM_LANGUAGES_FIELD_SITE_NAME_DESC" filter="string" size="50" /> </fieldset> </form> forms/override.xml000064400000003737152326013660010251 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fieldset> <field name="key" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_KEY_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_KEY_DESC" size="60" required="true" filter="LanguagesHelper::filterKey" /> <field name="override" type="textarea" label="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_OVERRIDE_DESC" cols="50" rows="5" filter="LanguagesHelper::filterText" /> <field name="both" type="checkbox" label="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_BOTH_DESC" value="true" filter="boolean" /> <field name="searchstring" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHSTRING_DESC" size="50" /> <field name="searchtype" type="list" label="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_DESC" default="value" > <option value="constant">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_CONSTANT</option> <option value="value">COM_LANGUAGES_OVERRIDE_FIELD_SEARCHTYPE_TEXT</option> </field> <field name="language" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_LANGUAGE_DESC" filter="unset" readonly="true" class="readonly" size="50" /> <field name="client" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_CLIENT_DESC" filter="unset" readonly="true" class="readonly" size="50" /> <field name="file" type="text" label="COM_LANGUAGES_OVERRIDE_FIELD_FILE_LABEL" description="COM_LANGUAGES_OVERRIDE_FIELD_FILE_DESC" filter="unset" readonly="true" class="readonly" size="80" /> <field name="id" type="hidden" /> </fieldset> </form> index.html000064400000000037152326013660006545 0ustar00<!DOCTYPE html><title></title> installed.php000064400000024573152326013660007253 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @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; use Joomla\Utilities\ArrayHelper; /** * Languages Component Languages Model * * @since 1.6 */ class LanguagesModelInstalled extends JModelList { /** * @var object client object * @deprecated 4.0 */ protected $client = null; /** * @var object user object */ protected $user = null; /** * @var boolean|JExeption True, if FTP settings should be shown, or an exception */ protected $ftp = null; /** * @var string option name */ protected $option = null; /** * @var array languages description */ protected $data = null; /** * @var int total number of languages */ protected $total = null; /** * @var int total number of languages installed * @deprecated 4.0 */ protected $langlist = null; /** * @var string language path */ protected $path = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 3.5 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'name', 'nativeName', 'language', 'author', 'published', 'version', 'creationDate', 'author', 'authorEmail', 'extension_id', 'client_id', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'name', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); // Special case for client id. $clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int'); $clientId = (!in_array($clientId, array (0, 1))) ? 0 : $clientId; $this->setState('client_id', $clientId); // Load the parameters. $params = JComponentHelper::getParams('com_languages'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('client_id'); $id .= ':' . $this->getState('filter.search'); return parent::getStoreId($id); } /** * Method to get the client object. * * @return object * * @since 1.6 */ public function getClient() { return JApplicationHelper::getClientInfo($this->getState('client_id', 0)); } /** * Method to get the ftp credentials. * * @return object * * @since 1.6 */ public function getFtp() { if (is_null($this->ftp)) { $this->ftp = JClientHelper::setCredentialsFromRequest('ftp'); } return $this->ftp; } /** * Method to get the option. * * @return object * * @since 1.6 */ public function getOption() { $option = $this->getState('option'); return $option; } /** * Method to get Languages item data. * * @return array * * @since 1.6 */ public function getData() { // Fetch language data if not fetched yet. if (is_null($this->data)) { $this->data = array(); $isCurrentLanguageRtl = JFactory::getLanguage()->isRtl(); $params = JComponentHelper::getParams('com_languages'); $installedLanguages = JLanguageHelper::getInstalledLanguages(null, true, true, null, null, null); // Compute all the languages. foreach ($installedLanguages as $clientId => $languages) { $defaultLanguage = $params->get(JApplicationHelper::getClientInfo($clientId)->name, 'en-GB'); foreach ($languages as $lang) { $row = new stdClass; $row->language = $lang->element; $row->name = $lang->metadata['name']; $row->nativeName = isset($lang->metadata['nativeName']) ? $lang->metadata['nativeName'] : '-'; $row->client_id = (int) $lang->client_id; $row->extension_id = (int) $lang->extension_id; $row->author = $lang->manifest['author']; $row->creationDate = $lang->manifest['creationDate']; $row->authorEmail = $lang->manifest['authorEmail']; $row->version = $lang->manifest['version']; $row->published = $defaultLanguage === $row->language ? 1 : 0; $row->checked_out = 0; // Fix wrongly set parentheses in RTL languages if ($isCurrentLanguageRtl) { $row->name = html_entity_decode($row->name . '‎', ENT_QUOTES, 'UTF-8'); $row->nativeName = html_entity_decode($row->nativeName . '‎', ENT_QUOTES, 'UTF-8'); } $this->data[] = $row; } } } $installedLanguages = array_merge($this->data); // Process filters. $clientId = (int) $this->getState('client_id'); $search = $this->getState('filter.search'); foreach ($installedLanguages as $key => $installedLanguage) { // Filter by client id. if (in_array($clientId, array(0, 1))) { if ($installedLanguage->client_id !== $clientId) { unset($installedLanguages[$key]); continue; } } // Filter by search term. if (!empty($search)) { if (stripos($installedLanguage->name, $search) === false && stripos($installedLanguage->nativeName, $search) === false && stripos($installedLanguage->language, $search) === false) { unset($installedLanguages[$key]); continue; } } } // Process ordering. $listOrder = $this->getState('list.ordering', 'name'); $listDirn = $this->getState('list.direction', 'ASC'); $installedLanguages = ArrayHelper::sortObjects($installedLanguages, $listOrder, strtolower($listDirn) === 'desc' ? -1 : 1, true, true); // Process pagination. $limit = (int) $this->getState('list.limit', 25); // Sets the total for pagination. $this->total = count($installedLanguages); if ($limit !== 0) { $start = (int) $this->getState('list.start', 0); return array_slice($installedLanguages, $start, $limit); } return $installedLanguages; } /** * Method to get installed languages data. * * @return string An SQL query. * * @since 1.6 * * @deprecated 4.0 */ protected function getLanguageList() { // Create a new db object. $db = $this->getDbo(); $query = $db->getQuery(true); $client = $this->getState('client_id'); $type = 'language'; // Select field element from the extensions table. $query->select($this->getState('list.select', 'a.element')) ->from('#__extensions AS a'); $type = $db->quote($type); $query->where('(a.type = ' . $type . ')') ->where('state = 0') ->where('enabled = 1') ->where('client_id=' . (int) $client); // For client_id = 1 do we need to check language table also? $db->setQuery($query); $this->langlist = $db->loadColumn(); return $this->langlist; } /** * Method to get the total number of Languages items. * * @return integer * * @since 1.6 */ public function getTotal() { if (is_null($this->total)) { $this->getData(); } return $this->total; } /** * Method to set the default language. * * @param integer $cid Id of the language to publish. * * @return boolean * * @since 1.6 */ public function publish($cid) { if ($cid) { $client = $this->getClient(); $params = JComponentHelper::getParams('com_languages'); $params->set($client->name, $cid); $table = JTable::getInstance('extension'); $id = $table->find(array('element' => 'com_languages')); // Load. if (!$table->load($id)) { $this->setError($table->getError()); return false; } $table->params = (string) $params; // Pre-save checks. if (!$table->check()) { $this->setError($table->getError()); return false; } // Save the changes. if (!$table->store()) { $this->setError($table->getError()); return false; } } else { $this->setError(JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); return false; } // Clean the cache of com_languages and component cache. $this->cleanCache(); $this->cleanCache('_system', 0); $this->cleanCache('_system', 1); return true; } /** * Method to get the folders. * * @return array Languages folders. * * @since 1.6 */ protected function getFolders() { if (is_null($this->folders)) { $path = $this->getPath(); jimport('joomla.filesystem.folder'); $this->folders = JFolder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides')); } return $this->folders; } /** * Method to get the path. * * @return string The path to the languages folders. * * @since 1.6 */ protected function getPath() { if (is_null($this->path)) { $client = $this->getClient(); $this->path = JLanguageHelper::getLanguagePath($client->path); } return $this->path; } /** * Method to compare two languages in order to sort them. * * @param object $lang1 The first language. * @param object $lang2 The second language. * * @return integer * * @since 1.6 * * @deprecated 4.0 */ protected function compareLanguages($lang1, $lang2) { return strcmp($lang1->name, $lang2->name); } /** * Method to switch the administrator language. * * @param string $cid The language tag. * * @return boolean * * @since 3.5 */ public function switchAdminLanguage($cid) { if ($cid) { $client = $this->getClient(); if ($client->name == 'administrator') { JFactory::getApplication()->setUserState('application.lang', $cid); } } else { JError::raiseWarning(500, JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); return false; } return true; } } language.php000064400000014016152326013660007046 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @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; use Joomla\Utilities\ArrayHelper; /** * Languages Component Language Model * * @since 1.5 */ class LanguagesModelLanguage extends JModelAdmin { /** * Constructor. * * @param array $config An optional associative array of configuration settings. */ public function __construct($config = array()) { $config = array_merge( array( 'event_after_save' => 'onExtensionAfterSave', 'event_before_save' => 'onExtensionBeforeSave', 'events_map' => array( 'save' => 'extension' ) ), $config ); parent::__construct($config); } /** * Override to get the table. * * @param string $name Name of the table. * @param string $prefix Table name prefix. * @param array $options Array of options. * * @return JTable * * @since 1.6 */ public function getTable($name = '', $prefix = '', $options = array()) { return JTable::getInstance('Language'); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('administrator'); $params = JComponentHelper::getParams('com_languages'); // Load the User state. $langId = $app->input->getInt('lang_id'); $this->setState('language.id', $langId); // Load the parameters. $this->setState('params', $params); } /** * Method to get a member item. * * @param integer $langId The id of the member to get. * * @return mixed User data object on success, false on failure. * * @since 1.0 */ public function getItem($langId = null) { $langId = (!empty($langId)) ? $langId : (int) $this->getState('language.id'); // Get a member row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($langId); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } // Set a valid accesslevel in case '0' is stored due to a bug in the installation SQL (was fixed with PR 2714). if ($table->access == '0') { $table->access = (int) JFactory::getConfig()->get('access'); } $properties = $table->getProperties(1); $value = ArrayHelper::toObject($properties, 'JObject'); return $value; } /** * Method to get the group form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure. * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_languages.language', 'language', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_languages.edit.language.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_languages.language', $data); return $data; } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $langId = (!empty($data['lang_id'])) ? $data['lang_id'] : (int) $this->getState('language.id'); $isNew = true; $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin($this->events_map['save']); $table = $this->getTable(); $context = $this->option . '.' . $this->name; // Load the row if saving an existing item. if ($langId > 0) { $table->load($langId); $isNew = false; } // Prevent white spaces, including East Asian double bytes. $spaces = array('/\xE3\x80\x80/', ' '); $data['lang_code'] = str_replace($spaces, '', $data['lang_code']); // Prevent saving an incorrect language tag if (!preg_match('#\b([a-z]{2,3})[-]([A-Z]{2})\b#', $data['lang_code'])) { $this->setError(JText::_('COM_LANGUAGES_ERROR_LANG_TAG')); return false; } $data['sef'] = str_replace($spaces, '', $data['sef']); $data['sef'] = JApplicationHelper::stringURLSafe($data['sef']); // Prevent saving an empty url language code if ($data['sef'] === '') { $this->setError(JText::_('COM_LANGUAGES_ERROR_SEF')); return false; } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the before save event. $result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew)); // Check the event responses. if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; } // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } // Trigger the after save event. $dispatcher->trigger($this->event_after_save, array($context, &$table, $isNew)); $this->setState('language.id', $table->lang_id); // Clean the cache. $this->cleanCache(); return true; } /** * Custom clean cache method. * * @param string $group Optional cache group name. * @param integer $clientId Application client id. * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('_system'); parent::cleanCache('com_languages'); } } languages.php000064400000012763152326013660007240 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Languages Model Class * * @since 1.6 */ class LanguagesModelLanguages extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'lang_id', 'a.lang_id', 'lang_code', 'a.lang_code', 'title', 'a.title', 'title_native', 'a.title_native', 'sef', 'a.sef', 'image', 'a.image', 'published', 'a.published', 'ordering', 'a.ordering', 'access', 'a.access', 'access_level', 'home', 'l.home', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.ordering', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd')); $this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string')); // Load the parameters. $params = JComponentHelper::getParams('com_languages'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.published'); return parent::getStoreId($id); } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select all fields from the languages table. $query->select($this->getState('list.select', 'a.*', 'l.home')) ->from($db->quoteName('#__languages') . ' AS a'); // Join over the asset groups. $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Select the language home pages. $query->select('l.home AS home') ->join('LEFT', $db->quoteName('#__menu') . ' AS l ON l.language = a.lang_code AND l.home=1 AND l.language <> ' . $db->quote('*')); // Filter on the published state. $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } elseif ($published === '') { $query->where('(a.published IN (0, 1))'); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('(a.title LIKE ' . $search . ')'); } // Filter by access level. if ($access = $this->getState('filter.access')) { $query->where('a.access = ' . (int) $access); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Set the published language(s). * * @param array $cid An array of language IDs. * @param integer $value The value of the published state. * * @return boolean True on success, false otherwise. * * @since 1.6 */ public function setPublished($cid, $value = 0) { return JTable::getInstance('Language')->publish($cid, $value); } /** * Method to delete records. * * @param array $pks An array of item primary keys. * * @return boolean Returns true on success, false on failure. * * @since 1.6 */ public function delete($pks) { // Sanitize the array. $pks = (array) $pks; // Get a row instance. $table = JTable::getInstance('Language'); // Iterate the items to delete each one. foreach ($pks as $itemId) { if (!$table->delete((int) $itemId)) { $this->setError($table->getError()); return false; } } // Clean the cache. $this->cleanCache(); return true; } /** * Custom clean cache method, 2 places for 2 clients. * * @param string $group Optional cache group name. * @param integer $clientId Application client id. * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('_system'); parent::cleanCache('com_languages'); } } override.php000064400000014046152326013660007105 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @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; /** * Languages Override Model * * @since 2.5 */ class LanguagesModelOverride extends JModelAdmin { /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return mixed A JForm object on success, false on failure. * * @since 2.5 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_languages.override', 'override', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } $client = $this->getState('filter.client', 'site'); $language = $this->getState('filter.language', 'en-GB'); $langName = JLanguage::getInstance($language)->getName(); if (!$langName) { // If a language only exists in frontend, its metadata cannot be // loaded in backend at the moment, so fall back to the language tag. $langName = $language; } $form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client))); $form->setValue('language', null, JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language)); $form->setValue('file', null, JPath::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 2.5 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_languages.edit.override.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_languages.override', $data); return $data; } /** * Method to get a single record. * * @param string $pk The key name. * * @return mixed Object on success, false otherwise. * * @since 2.5 */ public function getItem($pk = null) { $input = JFactory::getApplication()->input; $pk = !empty($pk) ? $pk : $input->get('id'); $fileName = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); $result = new stdClass; $result->key = ''; $result->override = ''; if (isset($strings[$pk])) { $result->key = $pk; $result->override = $strings[$pk]; } $oppositeFileName = constant('JPATH_' . strtoupper($this->getState('filter.client') == 'site' ? 'administrator' : 'site')) . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; $oppositeStrings = JLanguageHelper::parseIniFile($oppositeFileName); $result->both = isset($oppositeStrings[$pk]) && ($oppositeStrings[$pk] == $strings[$pk]); return $result; } /** * Method to save the form data. * * @param array $data The form data. * @param boolean $oppositeClient Indicates whether the override should not be created for the current client. * * @return boolean True on success, false otherwise. * * @since 2.5 */ public function save($data, $oppositeClient = false) { jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $client = $app->getUserState('com_languages.overrides.filter.client', 0); $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); // If the override should be created for both. if ($oppositeClient) { $client = 1 - $client; } // Return false if the constant is a reserved word, i.e. YES, NO, NULL, FALSE, ON, OFF, NONE, TRUE $blacklist = array('YES', 'NO', 'NULL', 'FALSE', 'ON', 'OFF', 'NONE', 'TRUE'); if (in_array($data['key'], $blacklist)) { $this->setError(JText::_('COM_LANGUAGES_OVERRIDE_ERROR_RESERVED_WORDS')); return false; } $client = $client ? 'administrator' : 'site'; // Parse the override.ini file in oder to get the keys and strings. $fileName = constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); if (isset($strings[$data['id']])) { // If an existent string was edited check whether // the name of the constant is still the same. if ($data['key'] == $data['id']) { // If yes, simply override it. $strings[$data['key']] = $data['override']; } else { // If no, delete the old string and prepend the new one. unset($strings[$data['id']]); $strings = array($data['key'] => $data['override']) + $strings; } } else { // If it is a new override simply prepend it. $strings = array($data['key'] => $data['override']) + $strings; } // Write override.ini file with the strings. if (JLanguageHelper::saveToIniFile($fileName, $strings) === false) { return false; } // If the override should be stored for both clients save // it also for the other one and prevent endless recursion. if (isset($data['both']) && $data['both'] && !$oppositeClient) { return $this->save($data, true); } return true; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 2.5 */ protected function populateState() { $app = JFactory::getApplication(); $client = $app->getUserStateFromRequest('com_languages.overrides.filter.client', 'filter_client', 0, 'int') ? 'administrator' : 'site'; $this->setState('filter.client', $client); $language = $app->getUserStateFromRequest('com_languages.overrides.filter.language', 'filter_language', 'en-GB', 'cmd'); $this->setState('filter.language', $language); } } overrides.php000064400000014716152326013660007274 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @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; /** * Languages Overrides Model * * @since 2.5 */ class LanguagesModelOverrides extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 2.5 */ public function __construct($config = array()) { parent::__construct($config); $this->filter_fields = array('key', 'text'); } /** * Retrieves the overrides data * * @param boolean $all True if all overrides shall be returned without considering pagination, defaults to false * * @return array Array of objects containing the overrides of the override.ini file * * @since 2.5 */ public function getOverrides($all = false) { // Get a storage key. $store = $this->getStoreId(); // Try to load the data from internal storage. if (!empty($this->cache[$store])) { return $this->cache[$store]; } $client = strtoupper($this->getState('filter.client')); // Parse the override.ini file in order to get the keys and strings. $fileName = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); // Delete the override.ini file if empty. if (file_exists($fileName) && $strings === array()) { JFile::delete($fileName); } // Filter the loaded strings according to the search box. $search = $this->getState('filter.search'); if ($search != '') { $search = preg_quote($search, '~'); $matchvals = preg_grep('~' . $search . '~i', $strings); $matchkeys = array_intersect_key($strings, array_flip(preg_grep('~' . $search . '~i', array_keys($strings)))); $strings = array_merge($matchvals, $matchkeys); } // Consider the ordering if ($this->getState('list.ordering') == 'text') { if (strtoupper($this->getState('list.direction')) == 'DESC') { arsort($strings); } else { asort($strings); } } else { if (strtoupper($this->getState('list.direction')) == 'DESC') { krsort($strings); } else { ksort($strings); } } // Consider the pagination. if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit')) { $strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true); } // Add the items to the internal cache. $this->cache[$store] = $strings; return $this->cache[$store]; } /** * Method to get the total number of overrides. * * @return integer The total number of overrides. * * @since 2.5 */ public function getTotal() { // Get a storage key. $store = $this->getStoreId('getTotal'); // Try to load the data from internal storage if (!empty($this->cache[$store])) { return $this->cache[$store]; } // Add the total to the internal cache. $this->cache[$store] = count($this->getOverrides(true)); return $this->cache[$store]; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 2.5 */ protected function populateState($ordering = 'key', $direction = 'asc') { // We call populate state first so that we can then set the filter.client and filter.language properties in afterwards parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $language_client = $this->getUserStateFromRequest('com_languages.overrides.language_client', 'language_client', '', 'cmd'); $client = substr($language_client, -1); $language = substr($language_client, 0, -1); // Sets the search filter. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $this->setState('language_client', $language . $client); $this->setState('filter.client', $client ? 'administrator' : 'site'); $this->setState('filter.language', $language); // Add the 'language_client' value to the session to display a message if none selected $app->setUserState('com_languages.overrides.language_client', $language . $client); // Add filters to the session because they won't be stored there by 'getUserStateFromRequest' if they aren't in the current request. $app->setUserState('com_languages.overrides.filter.client', $client); $app->setUserState('com_languages.overrides.filter.language', $language); } /** * Method to delete one or more overrides. * * @param array $cids Array of keys to delete. * * @return integer Number of successfully deleted overrides, boolean false if an error occurred. * * @since 2.5 */ public function delete($cids) { // Check permissions first. if (!JFactory::getUser()->authorise('core.delete', 'com_languages')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); return false; } jimport('joomla.filesystem.file'); $filterclient = JFactory::getApplication()->getUserState('com_languages.overrides.filter.client'); $client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR'; // Parse the override.ini file in oder to get the keys and strings. $fileName = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = JLanguageHelper::parseIniFile($fileName); // Unset strings that shall be deleted foreach ($cids as $key) { if (isset($strings[$key])) { unset($strings[$key]); } } // Write override.ini file with the strings. if (JLanguageHelper::saveToIniFile($fileName, $strings) === false) { return false; } $this->cleanCache(); return count($cids); } /** * Removes all of the cached strings from the table. * * @return boolean result of operation * * @since 3.4.2 */ public function purge() { $db = JFactory::getDbo(); // Note: TRUNCATE is a DDL operation // This may or may not mean depending on your database try { $db->truncateTable('#__overrider'); } catch (RuntimeException $e) { return $e; } JFactory::getApplication()->enqueueMessage(JText::_('COM_LANGUAGES_VIEW_OVERRIDES_PURGE_SUCCESS')); } } strings.php000064400000010436152326013660006756 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_languages * * @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; /** * Languages Strings Model * * @since 2.5 */ class LanguagesModelStrings extends JModelLegacy { /** * Method for refreshing the cache in the database with the known language strings. * * @return boolean True on success, Exception object otherwise. * * @since 2.5 */ public function refresh() { JLoader::register('LanguagesHelper', JPATH_ADMINISTRATOR . '/components/com_languages/helpers/languages.php'); $app = JFactory::getApplication(); $app->setUserState('com_languages.overrides.cachedtime', null); // Empty the database cache first. try { $this->_db->setQuery('TRUNCATE TABLE ' . $this->_db->quoteName('#__overrider')); $this->_db->execute(); } catch (RuntimeException $e) { return $e; } // Create the insert query. $query = $this->_db->getQuery(true) ->insert($this->_db->quoteName('#__overrider')) ->columns('constant, string, file'); // Initialize some variables. $client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site'; $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); $base = constant('JPATH_' . strtoupper($client)); $path = $base . '/language/' . $language; $files = array(); // Parse common language directory. jimport('joomla.filesystem.folder'); if (is_dir($path)) { $files = JFolder::files($path, '.*ini$', false, true); } // Parse language directories of components. $files = array_merge($files, JFolder::files($base . '/components', '.*ini$', 3, true)); // Parse language directories of modules. $files = array_merge($files, JFolder::files($base . '/modules', '.*ini$', 3, true)); // Parse language directories of templates. $files = array_merge($files, JFolder::files($base . '/templates', '.*ini$', 3, true)); // Parse language directories of plugins. $files = array_merge($files, JFolder::files(JPATH_PLUGINS, '.*ini$', 4, true)); // Parse all found ini files and add the strings to the database cache. foreach ($files as $file) { $strings = LanguagesHelper::parseFile($file); if ($strings && count($strings)) { $query->clear('values'); foreach ($strings as $key => $string) { $query->values($this->_db->quote($key) . ',' . $this->_db->quote($string) . ',' . $this->_db->quote(JPath::clean($file))); } try { $this->_db->setQuery($query); $this->_db->execute(); } catch (RuntimeException $e) { return $e; } } } // Update the cached time. $app->setUserState('com_languages.overrides.cachedtime.' . $client . '.' . $language, time()); return true; } /** * Method for searching language strings. * * @return array Array of results on success, Exception object otherwise. * * @since 2.5 */ public function search() { $results = array(); $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); $searchTerm = $input->getString('searchstring'); $limitstart = $input->getInt('more'); try { $searchstring = $this->_db->quote('%' . $filter->clean($searchTerm, 'TRIM') . '%'); // Create the search query. $query = $this->_db->getQuery(true) ->select('constant, string, file') ->from($this->_db->quoteName('#__overrider')); if ($input->get('searchtype') == 'constant') { $query->where('constant LIKE ' . $searchstring); } else { $query->where('string LIKE ' . $searchstring); } // Consider the limitstart according to the 'more' parameter and load the results. $this->_db->setQuery($query, $limitstart, 10); $results['results'] = $this->_db->loadObjectList(); // Check whether there are more results than already loaded. $query->clear('select')->clear('limit') ->select('COUNT(id)'); $this->_db->setQuery($query); if ($this->_db->loadResult() > $limitstart + 10) { // If this is set a 'More Results' link will be displayed in the view. $results['more'] = $limitstart + 10; } } catch (RuntimeException $e) { return $e; } return $results; } } forms/contact.xml000064400000003343152326013710010052 0ustar00<?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> forms/filter_contacts.xml000064400000007204152326013710011602 0ustar00<?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> forms/form.xml000064400000037134152326013710007367 0ustar00<?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> rules/contactemail.php000064400000003572152326013710011061 0ustar00<?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; } } rules/contactemailmessage.php000064400000003405152326013710012421 0ustar00<?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; } } rules/contactemailsubject.php000064400000003374152326013710012441 0ustar00<?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; } } rules/index.html000064400000000037152326013710007673 0ustar00<!DOCTYPE html><title></title> categories.php000064400000006377152326013710007417 0ustar00<?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2008 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; /** * This models supports retrieving lists of contact categories. * * @since 1.6 */ class ContactModelCategories extends JModelList { /** * Model context string. * * @var string */ public $_context = 'com_contact.categories'; /** * The category context (allows other extensions to derived from this model). * * @var string */ protected $_extension = 'com_contact'; private $_parent = null; private $_items = null; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $this->setState('filter.extension', $this->_extension); // Get the parent id if defined. $parentId = $app->input->getInt('id'); $this->setState('filter.parentId', $parentId); $params = $app->getParams(); $this->setState('params', $params); $this->setState('filter.published', 1); $this->setState('filter.access', true); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.extension'); $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.parentId'); return parent::getStoreId($id); } /** * Redefine the function an add some properties to make the styling more easy * * @return mixed An array of data items on success, false on failure. */ public function getItems() { if ($this->_items === null) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new Registry; if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Contact', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); } else { $this->_items = false; } } return $this->_items; } /** * Gets the id of the parent category for the selected list of categories * * @return integer The id of the parent category * * @since 1.6.0 */ public function getParent() { if (!is_object($this->_parent)) { $this->getItems(); } return $this->_parent; } } category.php000064400000025453152326013710007103 0ustar00<?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2006 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; /** * Single item model for a contact * * @package Joomla.Site * @subpackage com_contact * @since 1.5 */ class ContactModelCategory extends JModelList { /** * Category items data * * @var array */ protected $_item = null; protected $_articles = null; protected $_siblings = null; protected $_children = null; protected $_parent = null; /** * The category that applies. * * @access protected * @var object */ protected $_category = null; /** * The list of other contact categories. * * @access protected * @var array */ protected $_categories = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'name', 'a.name', 'con_position', 'a.con_position', 'suburb', 'a.suburb', 'state', 'a.state', 'country', 'a.country', 'ordering', 'a.ordering', 'sortname', 'sortname1', 'a.sortname1', 'sortname2', 'a.sortname2', 'sortname3', 'a.sortname3' ); } parent::__construct($config); } /** * Method to get a list of items. * * @return mixed An array of objects on success, false on failure. */ public function getItems() { // Invoke the parent getItems method to get the main list $items = parent::getItems(); // Convert the params field into an object, saving original in _params for ($i = 0, $n = count($items); $i < $n; $i++) { $item = &$items[$i]; if (!isset($this->_params)) { $item->params = new Registry($item->params); } // Some contexts may not use tags data at all, so we allow callers to disable loading tag data if ($this->getState('load_tags', true)) { $this->tags = new JHelperTags; $this->tags->getItemTags('com_contact.contact', $item->id); } } return $items; } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * * @since 1.6 */ protected function getListQuery() { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select required fields from the categories. // Changes for sqlsrv $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select($this->getState('list.select', 'a.*') . ',' . $case_when . ',' . $case_when1) /** * TODO: we actually should be doing it but it's wrong this way * . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' * . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug '); */ ->from($db->quoteName('#__contact_details') . ' AS a') ->join('LEFT', '#__categories AS c ON c.id = a.catid') ->where('a.access IN (' . $groups . ')'); // Filter by category. if ($categoryId = $this->getState('category.id')) { $query->where('a.catid = ' . (int) $categoryId) ->where('c.access IN (' . $groups . ')'); } // Join over the users for the author and modified_by names. $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author") ->select('ua.email AS author_email') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by') ->join('LEFT', '#__users AS uam ON uam.id = a.modified_by'); // Filter by state $state = $this->getState('filter.published'); if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); } else { $query->where('(a.published IN (0,1,2))'); } // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); if ($this->getState('filter.publish_date')) { $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by search in title $search = $this->getState('list.filter'); if (!empty($search)) { $search = $db->quote('%' . $db->escape($search, true) . '%'); $query->where('(a.name LIKE ' . $search . ')'); } // Filter by language if ($this->getState('filter.language')) { $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Set sortname ordering if selected if ($this->getState('list.ordering') === 'sortname') { $query->order($db->escape('a.sortname1') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) ->order($db->escape('a.sortname2') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) ->order($db->escape('a.sortname3') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); } else { $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); } return $query; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_contact'); // List state information $format = $app->input->getWord('format'); if ($format === 'feed') { $limit = $app->get('feed_limit'); } else { $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint'); } $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); // Optional filter text $itemid = $app->input->get('Itemid', 0, 'int'); $search = $app->getUserStateFromRequest('com_contact.category.list.' . $itemid . '.filter-search', 'filter-search', '', 'string'); $this->setState('list.filter', $search); // Get list ordering default from the parameters $menuParams = new Registry; if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $mergedParams = clone $params; $mergedParams->merge($menuParams); $orderCol = $app->input->get('filter_order', $mergedParams->get('initial_sort', 'ordering')); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Load the parameters. $this->setState('params', $params); } /** * Method to get category data for the current category * * @return object The category object * * @since 1.5 */ public function getCategory() { if (!is_object($this->_item)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new Registry; if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_items', 1) || $params->get('show_empty_categories', 0); $categories = JCategories::getInstance('Contact', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); if (is_object($this->_item)) { $this->_children = $this->_item->getChildren(); $this->_parent = false; if ($this->_item->getParent()) { $this->_parent = $this->_item->getParent(); } $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } else { $this->_children = false; $this->_parent = false; } } return $this->_item; } /** * Get the parent category. * * @return mixed An array of categories or false if an error occurs. */ public function getParent() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_parent; } /** * Get the sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. */ public function &getLeftSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_leftsibling; } /** * Get the sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. */ public function &getRightSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_rightsibling; } /** * Get the child categories. * * @return mixed An array of categories or false if an error occurs. */ public function &getChildren() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_children; } /** * Increment the hit counter for the category. * * @param integer $pk Optional primary key of the category to increment. * * @return boolean True if successful; false otherwise and internal error set. * * @since 3.2 */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id'); $table = JTable::getInstance('Category', 'JTable'); $table->hit($pk); } return true; } } contact.php000064400000045057152326013710006723 0ustar00<?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2006 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; /** * Single item model for a contact * * @package Joomla.Site * @subpackage com_contact * @since 1.5 */ class ContactModelContact extends JModelForm { /** * The name of the view for a single item * * @since 1.6 */ protected $view_item = 'contact'; /** * A loaded item * * @since 1.6 */ protected $_item = null; /** * Model context string. * * @var string */ protected $_context = 'com_contact.contact'; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication(); $this->setState('contact.id', $app->input->getInt('id')); $this->setState('params', $app->getParams()); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } } /** * Method to get the contact form. * The base form is loaded from XML and then an event is fired * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { $form = $this->loadForm('com_contact.contact', 'contact', array('control' => 'jform', 'load_data' => true)); if (empty($form)) { return false; } $temp = clone $this->getState('params'); $contact = $this->_item[$this->getState('contact.id')]; $active = JFactory::getApplication()->getMenu()->getActive(); if ($active) { // If the current view is the active item and a contact view for this contact, then the menu item params take priority if (strpos($active->link, 'view=contact') && strpos($active->link, '&id=' . (int) $contact->id)) { // $contact->params are the contact params, $temp are the menu item params // Merge so that the menu item params take priority $contact->params->merge($temp); } else { // Current view is not a single contact, so the contact params take priority here // Merge the menu item params with the contact params so that the contact params take priority $temp->merge($contact->params); $contact->params = $temp; } } else { // Merge so that contact params take priority $temp->merge($contact->params); $contact->params = $temp; } if (!$contact->params->get('show_email_copy', 0)) { $form->removeField('contact_email_copy'); } return $form; } /** * Method to get the data that should be injected in the form. * * @return array The default data is an empty array. * * @since 1.6.2 */ protected function loadFormData() { $data = (array) JFactory::getApplication()->getUserState('com_contact.contact.data', array()); if (empty($data['language']) && JLanguageMultilang::isEnabled()) { $data['language'] = JFactory::getLanguage()->getTag(); } // Add contact id to contact form data, so fields plugin can work properly if (empty($data['catid'])) { $data['catid'] = $this->getItem()->catid; } $this->preprocessData('com_contact.contact', $data); return $data; } /** * Gets a contact * * @param integer $pk Id for the contact * * @return mixed Object or null * * @since 1.6.0 */ public function &getItem($pk = null) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); if ($this->_item === null) { $this->_item = array(); } if (!isset($this->_item[$pk])) { try { $db = $this->getDbo(); $query = $db->getQuery(true); // Changes for sqlsrv $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select($this->getState('item.select', 'a.*') . ',' . $case_when . ',' . $case_when1) ->from('#__contact_details AS a') // Join on category table. ->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access') ->join('LEFT', '#__categories AS c on c.id = a.catid') // Join over the categories to get parent category titles ->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias') ->join('LEFT', '#__categories as parent ON parent.id = c.parent_id') ->where('a.id = ' . (int) $pk); // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); // Filter by published state. $published = $this->getState('filter.published'); $archived = $this->getState('filter.archived'); if (is_numeric($published)) { $query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } $db->setQuery($query); $data = $db->loadObject(); if (empty($data)) { JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND')); } // Check for published state if filter set. if ((is_numeric($published) || is_numeric($archived)) && (($data->published != $published) && ($data->published != $archived))) { JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND')); } /** * In case some entity params have been set to "use global", those are * represented as an empty string and must be "overridden" by merging * the component and / or menu params here. */ $registry = new Registry($data->params); $data->params = clone $this->getState('params'); $data->params->merge($registry); $registry = new Registry($data->metadata); $data->metadata = $registry; // Some contexts may not use tags data at all, so we allow callers to disable loading tag data if ($this->getState('load_tags', true)) { $data->tags = new JHelperTags; $data->tags->getItemTags('com_contact.contact', $data->id); } // Compute access permissions. if (($access = $this->getState('filter.access'))) { // If the access filter has been set, we already know this user can view. $data->params->set('access-view', true); } else { // If no access filter is set, the layout takes some responsibility for display of limited information. $user = JFactory::getUser(); $groups = $user->getAuthorisedViewLevels(); if ($data->catid == 0 || $data->category_access === null) { $data->params->set('access-view', in_array($data->access, $groups)); } else { $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); } } $this->_item[$pk] = $data; } catch (Exception $e) { $this->setError($e); $this->_item[$pk] = false; } } if ($this->_item[$pk]) { $this->buildContactExtendedData($this->_item[$pk]); } return $this->_item[$pk]; } /** * Load extended data (profile, articles) for a contact * * @param object $contact The contact object * * @return void */ protected function buildContactExtendedData($contact) { $db = $this->getDbo(); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $published = $this->getState('filter.published'); // If we are showing a contact list, then the contact parameters take priority // So merge the contact parameters with the merged parameters if ($this->getState('params')->get('show_contact_list')) { $this->getState('params')->merge($contact->params); } // Get the com_content articles by the linked user if ((int) $contact->user_id && $this->getState('params')->get('show_articles')) { $query = $db->getQuery(true) ->select('a.id') ->select('a.title') ->select('a.state') ->select('a.access') ->select('a.catid') ->select('a.created') ->select('a.language') ->select('a.publish_up'); // SQL Server changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select($case_when1 . ',' . $case_when) ->from('#__content as a') ->join('LEFT', '#__categories as c on a.catid=c.id') ->where('a.created_by = ' . (int) $contact->user_id) ->where('a.access IN (' . $groups . ')') ->order('a.publish_up DESC'); // Filter per language if plugin published if (JLanguageMultilang::isEnabled()) { $query->where('a.language IN (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } if (is_numeric($published)) { $query->where('a.state IN (1,2)') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Number of articles to display from config/menu params $articles_display_num = $this->getState('params')->get('articles_display_num', 10); // Use contact setting? if ($articles_display_num === 'use_contact') { $articles_display_num = $contact->params->get('articles_display_num', 10); // Use global? if ((string) $articles_display_num === '') { $articles_display_num = JComponentHelper::getParams('com_contact')->get('articles_display_num', 10); } } $db->setQuery($query, 0, (int) $articles_display_num); $articles = $db->loadObjectList(); $contact->articles = $articles; } else { $contact->articles = null; } // Get the profile information for the linked user JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel'); $userModel = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true)); $data = $userModel->getItem((int) $contact->user_id); JPluginHelper::importPlugin('user'); // Get the form. JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms'); JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields'); JForm::addFormPath(JPATH_SITE . '/components/com_users/model/form'); JForm::addFieldPath(JPATH_SITE . '/components/com_users/model/field'); $form = JForm::getInstance('com_users.profile', 'profile'); // Get the dispatcher. $dispatcher = JEventDispatcher::getInstance(); // Trigger the form preparation event. $dispatcher->trigger('onContentPrepareForm', array($form, $data)); // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data)); // Load the data into the form after the plugins have operated. $form->bind($data); $contact->profile = $form; } /** * Gets the query to load a contact item * * @param integer $pk The item to be loaded * * @return mixed The contact object on success, false on failure * * @throws Exception On database failure * @deprecated 4.0 Use ContactModelContact::getItem() instead */ protected function getContactQuery($pk = null) { // @todo Cache on the fingerprint of the arguments $db = $this->getDbo(); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $user = JFactory::getUser(); $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); $query = $db->getQuery(true); if ($pk) { // Sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('cc.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('cc.id'); $case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select( 'a.*, cc.access as category_access, cc.title as category_name, ' . $case_when . ',' . $case_when1 ) ->from('#__contact_details AS a') ->join('INNER', '#__categories AS cc on cc.id = a.catid') ->where('a.id = ' . (int) $pk); $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published IN (1,2)') ->where('cc.published IN (1,2)'); } $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); try { $db->setQuery($query); $result = $db->loadObject(); if (empty($result)) { return false; } } catch (Exception $e) { $this->setError($e->getMessage()); return false; } if ($result) { $contactParams = new Registry($result->params); // If we are showing a contact list, then the contact parameters take priority // So merge the contact parameters with the merged parameters if ($this->getState('params')->get('show_contact_list')) { $this->getState('params')->merge($contactParams); } // Get the com_content articles by the linked user if ((int) $result->user_id && $this->getState('params')->get('show_articles')) { $query = $db->getQuery(true) ->select('a.id') ->select('a.title') ->select('a.state') ->select('a.access') ->select('a.catid') ->select('a.created') ->select('a.language') ->select('a.publish_up'); // SQL Server changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select($case_when1 . ',' . $case_when) ->from('#__content as a') ->join('LEFT', '#__categories as c on a.catid=c.id') ->where('a.created_by = ' . (int) $result->user_id) ->where('a.access IN (' . $groups . ')') ->order('a.publish_up DESC'); // Filter per language if plugin published if (JLanguageMultilang::isEnabled()) { $query->where('a.language IN (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } if (is_numeric($published)) { $query->where('a.state IN (1,2)') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Number of articles to display from config/menu params $articles_display_num = $this->getState('params')->get('articles_display_num', 10); // Use contact setting? if ($articles_display_num === 'use_contact') { $articles_display_num = $contactParams->get('articles_display_num', 10); // Use global? if ((string) $articles_display_num === '') { $articles_display_num = JComponentHelper::getParams('com_contact')->get('articles_display_num', 10); } } $db->setQuery($query, 0, (int) $articles_display_num); $articles = $db->loadObjectList(); $result->articles = $articles; } else { $result->articles = null; } // Get the profile information for the linked user JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel'); $userModel = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true)); $data = $userModel->getItem((int) $result->user_id); JPluginHelper::importPlugin('user'); $form = new JForm('com_users.profile'); // Get the dispatcher. $dispatcher = JEventDispatcher::getInstance(); // Trigger the form preparation event. $dispatcher->trigger('onContentPrepareForm', array($form, $data)); // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data)); // Load the data into the form after the plugins have operated. $form->bind($data); $result->profile = $form; $this->contact = $result; return $result; } } return false; } /** * Increment the hit counter for the contact. * * @param integer $pk Optional primary key of the contact to increment. * * @return boolean True if successful; false otherwise and internal error set. * * @since 3.0 */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); $table = JTable::getInstance('Contact', 'ContactTable'); $table->hit($pk); } return true; } } featured.php000064400000014153152326013710007060 0ustar00<?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; use Joomla\Registry\Registry; /** * Featured contact model class. * * @since 1.6.0 */ class ContactModelFeatured extends JModelList { /** * Category items data * * @var array * @since 1.6.0-beta1 * @deprecated 4.0 Variable not used since 1.6.0-beta8 */ protected $_item = null; /** * Who knows what this was for? It has never been used * * @var array * @since 1.6.0-beta1 * @deprecated 4.0 Variable not used ever */ protected $_articles = null; /** * Get the siblings of the category * * @var array * @since 1.6.0-beta1 * @deprecated 4.0 Variable not used since 1.6.0-beta8 */ protected $_siblings = null; /** * Get the children of the category * * @var array * @since 1.6.0-beta1 * @deprecated 4.0 Variable not used since 1.6.0-beta8 */ protected $_children = null; /** * Get the parent of the category * * @var array * @since 1.6.0-beta1 * @deprecated 4.0 Variable not used since 1.6.0-beta8 */ protected $_parent = null; /** * The category that applies. * * @access protected * @var object * @deprecated 4.0 Variable not used ever */ protected $_category = null; /** * The list of other contact categories. * * @access protected * @var array * @deprecated 4.0 Variable not used ever */ protected $_categories = null; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'name', 'a.name', 'con_position', 'a.con_position', 'suburb', 'a.suburb', 'state', 'a.state', 'country', 'a.country', 'ordering', 'a.ordering', ); } parent::__construct($config); } /** * Method to get a list of items. * * @return mixed An array of objects on success, false on failure. */ public function getItems() { // Invoke the parent getItems method to get the main list $items = parent::getItems(); // Convert the params field into an object, saving original in _params for ($i = 0, $n = count($items); $i < $n; $i++) { $item = &$items[$i]; if (!isset($this->_params)) { $item->params = new Registry($item->params); } } return $items; } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * * @since 1.6 */ protected function getListQuery() { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select required fields from the categories. $query->select($this->getState('list.select', 'a.*')) ->from($db->quoteName('#__contact_details') . ' AS a') ->where('a.access IN (' . $groups . ')') ->where('a.featured=1') ->join('INNER', '#__categories AS c ON c.id = a.catid') ->where('c.access IN (' . $groups . ')'); // Filter by category. if ($categoryId = $this->getState('category.id')) { $query->where('a.catid = ' . (int) $categoryId); } // Change for sqlsrv... aliased c.published to cat_published $query->select('c.published as cat_published, c.published AS parents_published') ->where('c.published = 1'); // Filter by state $state = $this->getState('filter.published'); if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $date = JFactory::getDate(); $nowDate = $db->quote($date->toSql()); $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by language if ($this->getState('filter.language')) { $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_contact'); // List state information $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint'); $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); $orderCol = $app->input->get('filter_order', 'ordering'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Load the parameters. $this->setState('params', $params); } }
/home/digilove/public_html/cfa23e/./../41423/models.tar