Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/models.zip
Назад
PK Ft!] 9P�� � suggestions.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_finder * * @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\String\StringHelper; define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer'); JLoader::register('FinderIndexerHelper', FINDER_PATH_INDEXER . '/helper.php'); /** * Suggestions model class for the Finder package. * * @since 2.5 */ class FinderModelSuggestions extends JModelList { /** * Context string for the model type. * * @var string * @since 2.5 */ protected $context = 'com_finder.suggestions'; /** * Method to get an array of data items. * * @return array An array of data items. * * @since 2.5 */ public function getItems() { // Get the items. $items = parent::getItems(); // Convert them to a simple array. foreach ($items as $k => $v) { $items[$k] = $v->term; } return $items; } /** * Method to build a database query to load the list data. * * @return JDatabaseQuery A database query * * @since 2.5 */ protected function getListQuery() { $user = JFactory::getUser(); $groups = \Joomla\Utilities\ArrayHelper::toInteger($user->getAuthorisedViewLevels()); // Create a new query object. $db = $this->getDbo(); $termIdQuery = $db->getQuery(true); $termQuery = $db->getQuery(true); // Limit term count to a reasonable number of results to reduce main query join size $termIdQuery->select('ti.term_id') ->from($db->quoteName('#__finder_terms', 'ti')) ->where('ti.term LIKE ' . $db->quote($db->escape(StringHelper::strtolower($this->getState('input')), true) . '%', false)) ->where('ti.common = 0') ->where('ti.language IN (' . $db->quote($this->getState('language')) . ', ' . $db->quote('*') . ')') ->order('ti.links DESC') ->order('ti.weight DESC'); $termIds = $db->setQuery($termIdQuery, 0, 100)->loadColumn(); // Early return on term mismatch if (!count($termIds)) { return $termIdQuery; } $termIdString = implode(',', $termIds); // Select required fields $termQuery->select('DISTINCT(t.term)') ->select('t.links') ->select('t.weight') ->from($db->quoteName('#__finder_terms') . ' AS t') ->where('t.term_id IN (' . $termIdString . ')') ->order('t.links DESC') ->order('t.weight DESC'); // Determine the relevant mapping table suffix by inverting the logic from drivers $mappingTableSuffix = StringHelper::substr(md5(StringHelper::substr(StringHelper::strtolower($this->getState('input')), 0, 1)), 0, 1); // Join mapping table for term <-> link relation $mappingTable = $db->quoteName('#__finder_links_terms' . $mappingTableSuffix); $termQuery->join('INNER', $mappingTable . ' AS tm ON tm.term_id = t.term_id'); // Join links table $termQuery->join('INNER', $db->quoteName('#__finder_links') . ' AS l ON (tm.link_id = l.link_id)') ->where('l.access IN (' . implode(',', $groups) . ')') ->where('l.state = 1') ->where('l.published = 1'); return $termQuery; } /** * Method to get a store id based on model the 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 An identifier string to generate the store id. [optional] * * @return string A store id. * * @since 2.5 */ protected function getStoreId($id = '') { // Add the search query state. $id .= ':' . $this->getState('input'); $id .= ':' . $this->getState('language'); // Add the list state. $id .= ':' . $this->getState('list.start'); $id .= ':' . $this->getState('list.limit'); return parent::getStoreId($id); } /** * Method to auto-populate the model state. 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 = null, $direction = null) { // Get the configuration options. $app = JFactory::getApplication(); $input = $app->input; $params = JComponentHelper::getParams('com_finder'); $user = JFactory::getUser(); // Get the query input. $this->setState('input', $input->request->get('q', '', 'string')); // Set the query language if (JLanguageMultilang::isEnabled()) { $lang = JFactory::getLanguage()->getTag(); } else { $lang = FinderIndexerHelper::getDefaultLanguage(); } $lang = FinderIndexerHelper::getPrimaryLanguage($lang); $this->setState('language', $lang); // Load the list state. $this->setState('list.start', 0); $this->setState('list.limit', 10); // Load the parameters. $this->setState('params', $params); // Load the user state. $this->setState('user.id', (int) $user->get('id')); } } PK Ft!] �6 6 search.phpnu &1i� <?php /** * @package Joomla.Site * @subpackage com_search * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Search Component Search Model * * @since 1.5 */ class SearchModelSearch extends JModelLegacy { /** * Search data array * * @var array */ protected $_data = null; /** * Search total * * @var integer */ protected $_total = null; /** * Search areas * * @var integer */ protected $_areas = null; /** * Pagination object * * @var object */ protected $_pagination = null; /** * Constructor * * @since 1.5 */ public function __construct() { parent::__construct(); // Get configuration $app = JFactory::getApplication(); $config = JFactory::getConfig(); // Get the pagination request variables $this->setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint')); $this->setState('limitstart', $app->input->get('limitstart', 0, 'uint')); // Get parameters. $params = $app->getParams(); if ($params->get('searchphrase') == 1) { $searchphrase = 'any'; } elseif ($params->get('searchphrase') == 2) { $searchphrase = 'exact'; } else { $searchphrase = 'all'; } // Set the search parameters $keyword = urldecode($app->input->getString('searchword')); $match = $app->input->get('searchphrase', $searchphrase, 'word'); $ordering = $app->input->get('ordering', $params->get('ordering', 'newest'), 'word'); $this->setSearch($keyword, $match, $ordering); // Set the search areas $areas = $app->input->get('areas', null, 'array'); $this->setAreas($areas); } /** * Method to set the search parameters * * @param string $keyword string search string * @param string $match matching option, exact|any|all * @param string $ordering option, newest|oldest|popular|alpha|category * * @access public * * @return void */ public function setSearch($keyword, $match = 'all', $ordering = 'newest') { if (isset($keyword)) { $this->setState('origkeyword', $keyword); if ($match !== 'exact') { $keyword = preg_replace('#\xE3\x80\x80#', ' ', $keyword); } $this->setState('keyword', $keyword); } if (isset($match)) { $this->setState('match', $match); } if (isset($ordering)) { $this->setState('ordering', $ordering); } } /** * Method to get weblink item data for the category * * @access public * @return array */ public function getData() { // Lets load the content if it doesn't already exist if (empty($this->_data)) { $areas = $this->getAreas(); JPluginHelper::importPlugin('search'); $dispatcher = JEventDispatcher::getInstance(); $results = $dispatcher->trigger('onContentSearch', array( $this->getState('keyword'), $this->getState('match'), $this->getState('ordering'), $areas['active']) ); $rows = array(); foreach ($results as $result) { $rows = array_merge((array) $rows, (array) $result); } $this->_total = count($rows); if ($this->getState('limit') > 0) { $this->_data = array_splice($rows, $this->getState('limitstart'), $this->getState('limit')); } else { $this->_data = $rows; } } return $this->_data; } /** * Method to get the total number of weblink items for the category * * @access public * * @return integer */ public function getTotal() { return $this->_total; } /** * Method to set the search areas * * @param array $active areas * @param array $search areas * * @return void * * @access public */ public function setAreas($active = array(), $search = array()) { $this->_areas['active'] = $active; $this->_areas['search'] = $search; } /** * Method to get a pagination object of the weblink items for the category * * @access public * @return integer */ public function getPagination() { // Lets load the content if it doesn't already exist if (empty($this->_pagination)) { $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit')); } return $this->_pagination; } /** * Method to get the search areas * * @return integer * * @since 1.5 */ public function getAreas() { // Load the Category data if (empty($this->_areas['search'])) { $areas = array(); JPluginHelper::importPlugin('search'); $dispatcher = JEventDispatcher::getInstance(); $searchareas = $dispatcher->trigger('onContentSearchAreas'); foreach ($searchareas as $area) { if (is_array($area)) { $areas = array_merge($areas, $area); } } $this->_areas['search'] = $areas; } return $this->_areas; } } PK wt!]&�� forms/filter_items.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?> <form> <field name="client_id" type="list" label="" filtermode="selector" onchange="this.form.submit();" > <option value="0">JSITE</option> <option value="1">JADMINISTRATOR</option> </field> <field name="menutype" type="menu" label="COM_MENUS_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" accesstype="manage" clientid="" showAll="false" filtermode="selector" onchange="this.form.submit();" > <option value="">COM_MENUS_SELECT_MENU</option> </field> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_MENUS_ITEMS_SEARCH_FILTER_LABEL" description="COM_MENUS_ITEMS_SEARCH_FILTER" hint="JSEARCH_FILTER" noresults="JGLOBAL_NO_MATCHING_RESULTS" /> <field name="published" type="status" label="COM_MENUS_FILTER_PUBLISHED" description="COM_MENUS_FILTER_PUBLISHED_DESC" filter="*,0,1,-2" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</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="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> <field name="parent_id" type="menuitembytype" label="COM_MENUS_FILTER_PARENT_MENU_ITEM_LABEL" description="COM_MENUS_FILTER_PARENT_MENU_ITEM_DESC" onchange="this.form.submit();" > <option value="">COM_MENUS_FILTER_SELECT_PARENT_MENU_ITEM</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" statuses="*,0,1,2,-2" onchange="this.form.submit();" default="a.lft ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.lft ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.lft 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="menutype_title ASC">COM_MENUS_HEADING_MENU_ASC</option> <option value="menutype_title DESC">COM_MENUS_HEADING_MENU_DESC</option> <option value="a.home ASC">COM_MENUS_HEADING_HOME_ASC</option> <option value="a.home DESC">COM_MENUS_HEADING_HOME_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access 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 ASC">JGRID_HEADING_LANGUAGE_ASC</option> <option value="language 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_MENUS_LIST_LIMIT" description="COM_MENUS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> PK �t!]�l\� � mailjet.phpnu &1i� <?php /** * @author Mailjet SAS * * @copyright Copyright (C) 2014 Mailjet SAS. * @license GNU General Public License version 2 or later; see LICENSE */ // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.application.component.model' ); if (!function_exists('class_alias')) { // For php older then 5.3 function class_alias($orig, $alias) { eval('abstract class ' . $alias . ' extends ' . $orig . ' {}'); } } if (!class_exists('JModelLegacy')) { class_alias('JModel','JModelLegacy'); } class MailjetModelMailjet extends JModelLegacy { public function getAsPost () { $post = JRequest::get ('post'); $data ['enable'] = isSet ($post ['enable']); $data ['test'] = isSet ($post ['test']); $data ['test_address'] = $post ['test_address']; $data ['username'] = $post ['username']; $data ['password'] = $post ['password']; $data ['api_token'] = serialize(false); return $data; } public function getAsRecord () { $mailjetConfig = sPrintF ('%s/config.php', JPATH_COMPONENT); require_once ($mailjetConfig); $conf = new JMailjetConfig (); $host = $conf->host; $prev = new JConfig(); $prev = JArrayHelper::fromObject($prev); $fields ['bak_mailer'] = $prev ['mailer']; $fields ['bak_smtpauth'] = $prev ['smtpauth']; $fields ['bak_smtpuser'] = $prev ['smtpuser']; $fields ['bak_smtppass'] = $prev ['smtppass']; $fields ['bak_smtphost'] = $prev ['smtphost']; $fields ['bak_smtpsecure'] = $prev ['smtpsecure']; $fields ['bak_smtpport'] = $prev ['smtpport']; $data ['enable'] = $conf->enable && 'smtp' == $prev ['mailer'] && $conf->host == $prev ['smtphost']; $data ['test'] = $conf->test; $data ['test_address'] = $conf->test_address; $data ['username'] = $conf->username; $data ['password'] = $conf->password; $data ['host'] = $host; if(isset($data['api_token']) && $data['api_token']) { $data['api_token'] = unserialize($conf->api_token); } return $data; } public function saveRecord($key, $value) { jimport ('joomla.filesystem.path'); jimport ('joomla.filesystem.file'); $mailjetConfig = sPrintF ('%s/components/%s/config.php', JPATH_ADMINISTRATOR, 'com_mailjet'); require_once ($mailjetConfig); $config = new JRegistry ('config'); $config->loadArray ($this->getAsRecord()); $jversion = new JVersion(); if (version_compare($jversion->getShortVersion(), '2.5.6', 'lt')) { $config->setValue($key, $value); } else { $config->set($key, $value); } $configString = $config->toString ('PHP', array ('class' => 'JMailjetConfig', 'closingtag' => false)); if (! JFile::write ($mailjetConfig, $configString)) { JError::raiseWarning (0, JText::_ ('Unable to write configuration file for Mailjet\'s settings.')); } $mailjetData = sPrintF ('%s/components/%s/lib/db/data', JPATH_ADMINISTRATOR, 'com_mailjet'); $JSONString = '{"apiKey":"'.$post ['username'].'","apiSecret":"'.$post ['password'].'","token":null}'; if (! JFile::write ($mailjetData, $JSONString)) { JError::raiseWarning (0, JText::_ ('Unable to write data file for Mailjet\'s settings.')); } } } PK �t!]��&