function getItem() { $app = JFactory::getApplication(); $id = JRequest::getVar('id', 0, '', 'int'); $token = JRequest::getCMD('token', ''); $row = JTable::getInstance('Items', 'DJClassifiedsTable'); $db = JFactory::getDBO(); if ($id > 0) { $user = JFactory::getUser(); $row->load($id); if ($user->id != $row->user_id || $user->id == 0) { $message = JText::_("COM_DJCLASSIFIEDS_WRONG_AD"); $redirect = 'index.php?option=com_djclassifieds&view=additem'; $app->redirect($redirect, $message, 'error'); } } else { if ($token) { $query = "SELECT i.id FROM #__djcf_items i " . "WHERE i.user_id=0 AND i.token=" . $db->Quote($db->escape($token)); $db->setQuery($query); $id = $db->loadResult(); if ($id) { $row->load($id); } } } return $row; }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $app =& JFactory::getApplication(); $helper = new comZonalesHelper(); // url de retorno según sección del menu actual $menu =& JSite::getMenu(); $item = $menu->getActive(); $return = $item ? $item->link . '&Itemid=' . $item->id : 'index.php'; // si debe retornarse una respuesta mediante ajax $this->ajax = JRequest::getBool('ajax'); $this->task = JRequest::getBool('ajax') ? 'setZonalAjax' : 'setZonal'; $zName = $helper->getZonal(); $this->zonal = is_object($zName) ? $zName->name : $zName; // parametros - alto y ancho $zonalesParams =& JFactory::getApplication('site')->getParams('com_zonales'); $this->width = $zonalesParams->get('width_mapa_flash', ''); $this->height = $zonalesParams->get('height_mapa_flash', ''); $this->flashfile = $zonalesParams->get('flash_file', ''); $this->assignRef('j2f', $helper->getZif2SifMap()); $this->assignRef('template', $app->getTemplate()); $this->assignRef('return', $return); parent::display($tpl); }
/** * Create and return the pagination result set counter string, ie. Results 1-10 of 42 * * @access public * @return string Pagination result set counter string * @since 1.5 */ function getResultsCounter() { // Initialize variables $app = JFactory::getApplication(); $view = JRequest::getCMD('view'); $html = null; $fromResult = $this->limitstart + 1; // If the limit is reached before the end of the list if ($this->limitstart + $this->limit < $this->total) { $toResult = $this->limitstart + $this->limit; } else { $toResult = $this->total; } // If there are results found $fc_view_total = 0; //(int) $app->getUserState('fc_view_total_'.$view); if (!$fc_view_total) { $fc_view_total = $this->total; } if ($fc_view_total > 0) { // Check for maximum allowed of results $fc_view_limit_max = JRequest::getWord('view') != 'search' ? 0 : (int) $app->getUserState('fc_view_limit_max_' . $view); $items_total_msg = $fc_view_limit_max && $this->total >= $fc_view_limit_max ? 'FLEXI_ITEM_S_OR_MORE' : 'FLEXI_ITEM_S'; $html = "<span class='flexi label item_total_label'>" . JText::_('FLEXI_TOTAL') . "</span> " . "<span class='flexi item_total_value'>" . $fc_view_total . " " . JText::_($items_total_msg) . "</span>" . "<span class='flexi label item_total_label'>" . JText::_('FLEXI_DISPLAYING') . "</span> " . "<span class='flexi item_total_value'>" . $fromResult . " - " . $toResult . " " . JText::_('FLEXI_ITEM_S') . "</span>"; } else { $html .= "\n" . JText::_('JLIB_HTML_NO_RECORDS_FOUND'); } return $html; }
/** * Setea o actualiza la variable de sesión con el zonal actualmente * seleccionado por el usuario, y redirecciona a la URL de retorno * especificada. */ function setZonal($zname = null) { $option = JRequest::getCMD('option'); // parametros if (is_null($zname)) { $zname = JRequest::getVar('zname', NULL, 'post', 'string'); } $return = JRequest::getVar('return', 'index.php', 'post', 'string'); // al utilizar flashbar & para separar variables el url puede estar divido $view = JRequest::getVar('view', NULL, 'post', 'string'); $item = JRequest::getVar('Itemid', NULL, 'post', 'int'); if ($view && $item) { $return .= '&view=' . $view . '&Itemid=' . $item; } $session = JFactory::getSession(); if ($zname) { $zonal = $this->_zonalesHelper->getZonal($zname); if ($zonal) { $session->set('zonales_zonal_name', $zonal->name); $session->set('zonales_zonal_label', $zonal->label); } else { $session->set('zonales_zonal_name', NULL); $session->set('zonales_zonal_label', NULL); } } else { $session->set('zonales_zonal_name', NULL); $session->set('zonales_zonal_label', NULL); } $this->setRedirect($return); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); if ($user->get('guest')) { // Redirect to login $uri = JFactory::getURI(); $mainframe->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), null); return; } else { $groups = JUserHelper::getUserGroups($user->get('id')); if (!in_array(4, $groups)) { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); return; } } $document =& JFactory::getDocument(); //$document->addScript( '/media/system/js/viewutils.js'); //$document->addScript('/media/system/js/mootools1.js'); //$document->addStyleSheet('/media/system/css/global.css'); //$document->addStyleSheet('/media/system/css/content.css'); $document->addStylesheet('/media/system/css/ZoneStyle.css'); $helper = new comZonalesHelper(); $this->assignRef('template', $mainframe->getTemplate()); $this->assignRef('user', $user); $host = 'localhost'; $this->assignRef('tomcat_host', $host); $port = '38080'; $this->assignRef('tomcat_port', $port); $this->assignRef('zonal_id', ucwords(str_replace("_", "+", $helper->getZonalActual()))); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_context = $option . 'ListaMenu'; // nombre del contexto $this->_orderfield = 'm.id'; // campo de ordenamiento $this->_searchfield = 'm.id'; // campo de búsqueda $this->configure(); $this->setPagination(); // setea la paginación $menus =& $this->get('All'); foreach ($menus as $menu) { $menu->link = JRoute::_('index.php?option=' . $option . '&cid[]=' . $menu->id . '&task=editMenu'); $menu->jmenu_edit_link = JRoute::_('index.php?option=com_menus&menutype=mainmenu&task=edit&cid[]=' . $menu->menu_id); } // Titulo $document =& JFactory::getDocument(); $document->setTitle(JText::_('Administrar Asociaciones de Menu')); // Asigna variables en la vista y la muestra $this->assignRef('menus', $menus); parent::display($tpl); }
function copy() { $plugins = JRequest::getVar('cid', array(), '', 'array'); $result = true; if (!empty($plugins)) { $type = JRequest::getCMD('plugin_type'); if (!in_array($type, array('payment', 'shipping'))) { $this->listing(); return false; } $pluginsClass = hikashop_get('class.' . $type); foreach ($plugins as $plugin) { $data = $pluginsClass->get($plugin); if ($data) { $key = $type . '_id'; unset($data->{$key}); if (!$pluginsClass->save($data)) { $result = false; } } } } if ($result) { $app = JFactory::getApplication(); if (!HIKASHOP_J30) { $app->enqueueMessage(JText::_('HIKASHOP_SUCC_SAVED'), 'success'); } else { $app->enqueueMessage(JText::_('HIKASHOP_SUCC_SAVED')); } return $this->listing(); } return $this->listing(); }
/** * Constructor * * @access protected * @param array $options options */ function __construct($options) { $this->_options =& $options; // Get the default group and caching if (isset($options['language'])) { $this->_options['language'] = $options['language']; } else { $options['language'] = 'en-GB'; } if (isset($options['cachebase'])) { $this->_options['cachebase'] = $options['cachebase']; } else { $this->_options['cachebase'] = JPATH_ROOT . DS . 'cache'; } if (isset($options['defaultgroup'])) { $this->_options['defaultgroup'] = $options['defaultgroup']; } else { $this->_options['defaultgroup'] = 'default'; } if (isset($options['caching'])) { $this->_options['caching'] = $options['caching']; } else { $this->_options['caching'] = true; } if (isset($options['storage'])) { $this->_options['storage'] = $options['storage']; } else { $this->_options['storage'] = 'file'; } //Fix to detect if template positions are enabled... if (JRequest::getCMD('tpl', 0)) { $this->_options['caching'] = false; } }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_context = $option . 'ListAttributes'; // nombre del contexto $this->_orderfield = 'a.label'; // campo de ordenamiento $this->_searchfield = 'a.label'; // campo de búsqueda $this->configure(); $this->setPagination(); // setea la paginación $attributes =& $this->get('All'); foreach ($attributes as $attribute) { if ($attribute->id > 3) { $attribute->link = JRoute::_('index.php?option=' . $option . '&cid[]=' . $attribute->id . '&task=editAttribute'); } else { $attribute->link = JRoute::_('index.php?option=' . $option . '&task=listAttributes'); } } // Titulo $document =& JFactory::getDocument(); $document->setTitle(JText::_('Attributes administration')); // Asigna variables en la vista y la muestra $this->assignRef('attributes', $attributes); parent::display($tpl); }
/** * Tareas comunes a pantalla de listas * */ function configure() { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); // orden $filter_order = $mainframe->getUserStateFromRequest($this->_context . 'filter_order', 'filter_order', $this->_orderfield, 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($this->_context . 'filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); // cadena de búsqueda $search = $mainframe->getUserStateFromRequest($this->_context . 'search', 'search', '', 'string'); $search = JString::strtolower($search); // Configuramos el modelo $model =& $this->getModel(); $model->_orderby_filter_order = $filter_order; $model->_orderby_filter_order_dir = $filter_order_Dir; // seteamos búsqueda en el modelo $db = JFactory::getDBO(); if ($search) { $model->setWhere('LOWER(' . $this->_searchfield . ') LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false)); } // table ordering $this->_lists['order_Dir'] = $filter_order_Dir; $this->_lists['order'] = $filter_order; $this->_lists['search'] = $search; $this->assignRef('lists', $this->_lists); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_context = $option . 'ListTabs'; // nombre del contexto $this->_orderfield = 'ac.label'; // campo de ordenamiento $this->_searchfield = 'ac.label'; // campo de búsqueda $this->configure(); $this->setPagination(); // setea la paginación $tabs =& $this->get('All'); foreach ($tabs as $tabkey => $tab) { $tab->link = JRoute::_('index.php?option=' . $option . '&cid[]=' . $tab->id . '&task=editTab'); if ($tab->id == 1) { unset($tabs[$tabkey]); } } // Titulo $document =& JFactory::getDocument(); $document->setTitle(JText::_('Tabs administration')); // Asigna variables en la vista y la muestra $this->assignRef('tabs', $tabs); parent::display($tpl); }
function site() { $mainframe = JFactory::getApplication(); $acl = JFactory::getACL(); $user = JFactory::getUser(); $option = JRequest::getCMD('option'); if ($acl->acl_check($option, 'site.block', 'users', $user->get('usertype'))) { $mainframe->redirect('index.php', JText::_('You dont have permission to access')); } }
/** * Constructor * * @access protected * @param array $options options */ function __construct($options) { $this->_options = array('language' => 'en-GB', 'cachebase' => JPATH_ROOT . DS . 'cache', 'defaultgroup' => 'default', 'caching' => true, 'storage' => 'file'); // Overwrite default options with given options $this->_options = array_merge($this->_options, $options); //@todo:or with the ampersand here? Like "...& $options);" for speed if array_merge or this construct would make a deep copy otherwise // Fix to detect if template positions are enabled... if (JRequest::getCMD('tpl', 0)) { $this->_options['caching'] = false; } }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $app =& JFactory::getApplication(); $helper = new comZonalesHelper(); $this->assignRef('template', $app->getTemplate()); $this->assignRef('zonales', $helper->getZonales()); $this->assignRef('zonal_id', $helper->getZonalActual()); parent::display($tpl); }
function showApplications() { $mainframe =& JFactory::getApplication(); global $option; $option = JRequest::getCMD('option'); $db =& JFactory::getDBO(); $filter_order = $mainframe->getUserStateFromRequest("{$option}.filter_order", 'filter_order', 'm.id'); $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir", 'filter_order_Dir', ''); $filter_state = $mainframe->getUserStateFromRequest("{$option}.filter_state", 'filter_state', '*'); $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', ''); $search = $db->getEscaped(trim(JString::strtolower($search))); $limit = JRequest::getVar('global.list.limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . 'limitstart', 'limitstart', 0); $where = array(); if ($filter_state) { if ($filter_state == 'P') { $where[] = 'm.published = 1'; } elseif ($filter_state == 'U') { $where[] = 'm.published = 0'; } } if ($search) { $where[] = 'LOWER(m.title) LIKE "%' . $search . '%"'; } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir; //$query = 'SELECT COUNT(m.id) FROM #__jumi as m left join #__groups as g on (m.access = g.id) '.$where; $query = 'SELECT COUNT(m.id) FROM #__jumi as m ' . $where; $db->setQuery($query); $total = $db->loadResult(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); //$query = 'SELECT m.*, g.name as groupname FROM #__jumi as m left join #__groups as g on (m.access = g.id) '.$where.' '.$orderby; $query = 'SELECT m.*, \'depracated\' as groupname FROM #__jumi as m ' . $where . ' ' . $orderby; $db->setQuery($query, $pageNav->limitstart, $pageNav->limit); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } // state filter $lists['state'] = JHTML::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; JumiView::showApplications($rows, $pageNav, $option, $lists); }
function publish() { JRequest::checkToken() or jexit('Invalid Token'); $option = JRequest::getCMD('option'); $cid = JRequest::getVar('cid', array()); $row =& JTable::getInstance('documents', 'Table'); $publish = $this->getTask() == 'publish' ? 1 : 0; if (!$row->publish($cid, $publish)) { JError::raiseError(500, $row->getError()); } $msg = 'Document'; $msg .= count($cid) > 1 ? 's ' : ' '; $msg .= $this->getTask() . 'ed'; $this->setRedirect('index.php?option=' . $option . '&view=documents', $msg); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $document =& JFactory::getDocument(); //$document->addScript( '/media/system/js/viewutils.js'); //$document->addScript( '/media/system/js/zgram.js'); //$document->addScript('/media/system/js/mootools1.js'); //$document->addStyleSheet('/media/system/css/global.css'); //$document->addStyleSheet('/media/system/css/content.css'); $document->addStyleSheet('/media/system/css/ZoneStyle.css'); $app =& JFactory::getApplication(); $helper = new comZonalesHelper(); $this->assignRef('template', $app->getTemplate()); $this->assignRef('zonal_id', ucwords(str_replace("_", "+", $helper->getZonalActual()))); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_tipotag =& $this->get('Data'); // Setea la barra de menúes y el titulo del documento según la accion $document =& JFactory::getDocument(); if (!$this->_tipotag) { JToolBarHelper::title(JText::_('EDITAR_TIPO_TAG') . ': <small><small>[ ' . JText::_('New') . ' ]</small></small>', 'menu.png'); $document->setTitle(JText::_('EDITAR_TIPO_TAG') . ': [' . JText::_('New') . ']'); } else { JToolBarHelper::title(JText::_('EDITAR_TIPO_TAG') . ': <small><small>[ ' . JText::_('Edit') . ' ]</small></small>', 'menu.png'); $document->setTitle(JText::_('EDITAR_TIPO_TAG') . ': [' . JText::_('Edit') . ']'); } // Asigna variables en la vista y la muestra $this->assignRef('tipotag', $this->_tipotag); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_menu =& $this->get('Data'); // Setea la barra de menúes y el titulo del documento según la accion $document =& JFactory::getDocument(); if (!$this->_menu) { $accion = 'New'; } else { $accion = 'Edit'; } JToolBarHelper::title(JText::_('Asociar Item de Menú a Tag') . ': <small><small>[ ' . JText::_($accion) . ' ]</small></small>', 'menu.png'); $document->setTitle(JText::_('Asociar Item de Menù a Tag') . ': [' . JText::_($accion) . ']'); $lists = $this->getSelectLists($this->_menu); // Asigna variables en la vista y la muestra $this->assignRef('menu', $this->_menu); $this->assignRef('lists', $this->getSelectLists($this->_menu)); parent::display($tpl); }
function __construct() { parent::__construct(); $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); // obtenemos las variables para paginacion $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int'); // si se cambio el limite $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->_limit = $limit; $this->_limitstart = $limitstart; $array = JRequest::getVar('cid', 0, '', 'array'); $this->setId((int) $array[0]); $path = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_aapu' . DS . 'tables'; $this->addTablePath($path); $table =& $this->getTable(); $this->_table_name = $table->getTableName(); $this->_cache =& JFactory::getCache('com_aapu'); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_context = $option . 'ListaCp2TipoTag'; // nombre del contexto $this->_orderfield = 'c.id'; // campo de ordenamiento $this->_searchfield = 'c.id'; // campo de búsqueda $this->configure(); $this->setPagination(); // setea la paginación $tipos =& $this->get('All'); foreach ($tipos as $tipo) { $tipo->link = JRoute::_('index.php?option=' . $option . '&cid[]=' . $tipo->id . '&task=editCp2TipoTag'); } // Titulo $document =& JFactory::getDocument(); $document->setTitle(JText::_('ADMINISTRAR_ASOCIACIONES')); // Asigna variables en la vista y la muestra $this->assignRef('tipos', $tipos); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $this->_attribute =& $this->get('Data'); // Setea la barra de menúes y el titulo del documento según la accion $document =& JFactory::getDocument(); if (!$this->_attribute->id) { JToolBarHelper::title(JText::_('EDIT_ATTRIBUTE') . ': <small><small>[ ' . JText::_('New') . ' ]</small></small>', 'menu.png'); $document->setTitle(JText::_('EDIT_ATTRIBUTE') . ': [' . JText::_('New') . ']'); } else { JToolBarHelper::title(JText::_('EDIT_ATTRIBUTE') . ': <small><small>[ ' . JText::_('Edit') . ' ]</small></small>', 'menu.png'); $document->setTitle(JText::_('EDIT_ATTRIBUTE') . ': [' . JText::_('Edit') . ']'); } $typesModel =& $this->getModel('tabs'); $types = $typesModel->getAll(); $dataTypesModel =& $this->getModel('datatypes'); $dataTypes = $dataTypesModel->getAll(); // Asigna variables en la vista y la muestra $this->assignRef('attribute', $this->_attribute); $this->assignRef('types', $types); $this->assignRef('dataTypes', $dataTypes); parent::display($tpl); }
public function onAfterDispatch() { $contentpluginFile = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_noixacl" . DS . "adapters" . DS . "content" . DS . "plugin.php"; if (file_exists($contentpluginFile)) { include_once $contentpluginFile; //instance application $app =& JFactory::getApplication(); //get component $option = JRequest::getCMD('option'); //get name of application $applicationName = $app->getName(); //get task $task = JRequest::getCMD('task'); if ($option == 'com_content') { $instancePlugin = new PluginContent(); $applicationName = "after" . $applicationName; if (method_exists($instancePlugin, $applicationName)) { $instancePlugin->{$applicationName}(); } } } }
/** * Send the message and display a notice * * @access public * @since 1.5 */ function send() { // Check for request forgeries JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $session = JFactory::getSession(); $db = JFactory::getDbo(); $timeout = $session->get('com_mailto.formtime', 0); if ($timeout == 0 || time() - $timeout < 20) { JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT')); return $this->mailto(); } jimport('joomla.mail.helper'); $SiteName = $app->getCfg('sitename'); $MailFrom = $app->getCfg('mailfrom'); $FromName = $app->getCfg('fromname'); $link = MailtoHelper::validateHash(JRequest::getCMD('link', '', 'post')); // Verify that this is a local link if (!$link || !JURI::isInternal($link)) { //Non-local url... JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT')); return $this->mailto(); } // An array of email headers we do not want to allow as input $headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:'); // An array of the input fields to scan for injected headers $fields = array('mailto', 'sender', 'from', 'subject'); /* * Here is the meat and potatoes of the header injection test. We * iterate over the array of form input and check for header strings. * If we find one, send an unauthorized header and die. */ foreach ($fields as $field) { foreach ($headers as $header) { if (strpos($_POST[$field], $header) !== false) { JError::raiseError(403, ''); } } } /* * Free up memory */ unset($headers, $fields); $email = JRequest::getString('mailto', '', 'post'); $sender = JRequest::getString('sender', '', 'post'); $from = JRequest::getString('from', '', 'post'); $subject_default = JText::sprintf('COM_MAILTO_SENT_BY', $sender); $subject = JRequest::getString('subject', $subject_default, 'post'); // Check for a valid to address $error = false; if (!$email || !JMailHelper::isEmailAddress($email)) { $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $email); JError::raiseWarning(0, $error); } // Check for a valid from address if (!$from || !JMailHelper::isEmailAddress($from)) { $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $from); JError::raiseWarning(0, $error); } if ($error) { return $this->mailto(); } // Build the message to send $msg = JText::_('COM_MAILTO_EMAIL_MSG'); $body = sprintf($msg, $SiteName, $sender, $from, $link); // Clean the email data $subject = JMailHelper::cleanSubject($subject); $body = JMailHelper::cleanBody($body); $sender = JMailHelper::cleanAddress($sender); // Send the email if (JUtility::sendMail($from, $sender, $email, $subject, $body) !== true) { JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT')); return $this->mailto(); } JRequest::setVar('view', 'sent'); $this->display(); }
*/ defined('_JEXEC') or die('Restricted access'); //jimport('joomla.media.images'); JHTML::_('behavior.framework', 'More'); JHTML::_('behavior.keepalive'); JHTML::_('behavior.formvalidation'); JHTML::_('behavior.modal'); JHTML::_('behavior.calendar'); $toolTipArray = array('className' => 'djcf_label'); //JHTML::_('behavior.tooltip', '.Tips1', $toolTipArray); $par = JComponentHelper::getParams('com_djclassifieds'); $user = JFactory::getUser(); $mod_attribs = array(); $mod_attribs['style'] = 'xhtml'; $document = JFactory::getDocument(); $token = JRequest::getCMD('token', ''); ?> <div id="dj-classifieds" class="clearfix"> <?php $modules_djcf =& JModuleHelper::getModules('djcf-top'); if (count($modules_djcf) > 0) { echo '<div class="djcf-ad-top clearfix">'; foreach (array_keys($modules_djcf) as $m) { echo JModuleHelper::renderModule($modules_djcf[$m], $mod_attribs); } echo '</div>'; } $modules_djcf =& JModuleHelper::getModules('djcf-profileedit-top'); if (count($modules_djcf) > 0) { echo '<div class="djcf-ad-items-top clearfix">'; foreach (array_keys($modules_djcf) as $m) {
/** * Utility Function: * Force frontend specific redirestions most notably redirecting the joomla ARTICLE VIEW to the FLEXIcontent ITEM VIEW * Some special cases are handled e.g. redirecting the joomla article form to FLEXIcontent item form * * @access public * @return void */ function redirectSiteComContent() { $app = JFactory::getApplication(); $option = JRequest::getCMD('option'); $view = JRequest::getCMD('view'); $db = JFactory::getDBO(); // Let's Redirect/Reroute Joomla's article view & form to FLEXIcontent item view & form respectively !! // NOTE: we do not redirect/reroute Joomla's category views (blog,list,featured for J2.5 etc), // thus site administrator can still utilize them if ($option == 'com_content' && ($view == 'article' || $view == FLEXI_ITEMVIEW || $view == 'form')) { // In J2.5, in case of form we need to use a_id instead of id, this will also be set in HTTP Request too and JRouter too $id = JRequest::getInt('id'); $id = $view == 'form' ? JRequest::getInt('a_id') : $id; // Get article category id, if it is not already in url $catid = JRequest::getInt('catid'); if (!$catid) { $db->setQuery('SELECT catid FROM #__content WHERE id = ' . $id); $catid = $db->loadResult(); } $in_limits = $catid >= FLEXI_LFT_CATEGORY && $catid <= FLEXI_RGT_CATEGORY; // Allow Joomla article view for non-bound items or for specific content types if ($in_limits && $view == 'article') { $db->setQuery('SELECT attribs' . ' FROM #__flexicontent_types AS ty ' . ' JOIN #__flexicontent_items_ext AS ie ON ie.type_id = ty.id ' . ' WHERE ie.item_id = ' . $id); $type_params = $db->loadResult(); if (!$type_params) { $in_limits = false; } else { $type_params = new JRegistry($type_params); $in_limits = $type_params->get('allow_jview') == 0; // Allow viewing by article view, if so configured } } if (empty($in_limits)) { return; } if ($this->params->get('redirect_method_fe', 1) == 1) { // Set new request variables: // NOTE: we only need to set REQUEST variable that must be changed, // but setting any other variables to same value will not hurt if ($view == 'article' || $view == FLEXI_ITEMVIEW) { $newRequest = array('option' => $this->extension, 'view' => FLEXI_ITEMVIEW, 'Itemid' => JRequest::getInt('Itemid'), 'lang' => JRequest::getCmd('lang')); } else { if ($view == 'form') { $newRequest = array('option' => $this->extension, 'view' => FLEXI_ITEMVIEW, 'task' => 'edit', 'layout' => 'form', 'id' => $id, 'Itemid' => JRequest::getInt('Itemid'), 'lang' => JRequest::getCmd('lang')); } else { // Unknown CASE ?? unreachable ? return; } } JRequest::set($newRequest, 'get'); // Set variable also in the router, for best compatibility $router = $app->getRouter(); $router->setVars($newRequest, false); //$app->enqueueMessage( "Set com_flexicontent item view instead of com_content article view", 'message'); } else { if ($view == 'form') { $urlItem = 'index.php?option=' . $this->extension . '&view=' . FLEXI_ITEMVIEW . '&id=' . $id . '&task=edit&layout=form'; } else { // Include the route helper files require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php'; $itemslug = JRequest::getVar('id'); $catslug = JRequest::getVar('catid'); // Warning current menu item id must not be passed to the routing functions since it points to com_content, and thus it will break FC SEF URLs $urlItem = $catslug ? FlexicontentHelperRoute::getItemRoute($itemslug, $catslug) : FlexicontentHelperRoute::getItemRoute($itemslug); $urlItem = JRoute::_($urlItem); } //$app->enqueueMessage( "Redirected to com_flexicontent item view instead of com_content article view", 'message'); $app->redirect($urlItem); } } }
function sendConf($subid) { if ($this->confirmationSent) { return false; } $myuser = $this->get($subid); $config = acymailing_config(); if (!empty($myuser->confirmed)) { return false; } if (!$config->get('require_confirmation', false)) { return false; } $mailClass = acymailing_get('helper.mailer'); $mailClass->checkConfirmField = false; $mailClass->checkEnabled = false; $mailClass->checkAccept = false; $mailClass->report = $config->get('confirm_message', 0); $alias = "confirmation"; if (JRequest::getCMD('acy_source')) { $sourceparams = explode('_', JRequest::getCMD('acy_source')); $this->database->setQuery('SELECT alias FROM #__acymailing_mail WHERE published = 1 AND alias IN ("confirmation",' . $this->database->Quote('confirmation-' . $sourceparams[0]) . ',' . $this->database->Quote('confirmation-' . $sourceparams[0] . '-' . @$sourceparams[1]) . ',' . $this->database->Quote('confirmation-' . $sourceparams[0] . '-' . @$sourceparams[1] . '-' . @$sourceparams[2]) . ') ORDER BY alias DESC'); $alias = $this->database->loadResult(); } $this->confirmationSentSuccess = $mailClass->sendOne($alias, $myuser); $this->confirmationSentError = $mailClass->reportMessage; $this->confirmationSent = true; return true; }
/** * Search method * * The sql must return the following fields that are used in a common display routine: * * href, title, section, created, text, browsernav * * @param string Target search string * @param string matching option, natural|natural_expanded|exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category * @param mixed An array if restricted to areas, null if search all */ function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $app = JFactory::getApplication(); $view = JRequest::getCMD('view'); $app->setUserState('fc_view_total_' . $view, 0); $app->setUserState('fc_view_limit_max_' . $view, 0); // Check if not requested search areas, inside this search areas of this plugin if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } // Initialize some variables $db = JFactory::getDBO(); $user = JFactory::getUser(); $menu = $app->getMenu()->getActive(); // Get the COMPONENT only parameters and merge current menu item parameters $params = clone JComponentHelper::getParams('com_flexicontent'); if ($menu) { $params->merge($menu->params); } // some parameter shortcuts for SQL query $show_noauth = $params->get('show_noauth', 0); $orderby_override = $params->get('orderby_override', 1); // Compatibility text search (LIKE %word%) for language without spaces $filter_word_like_any = $params->get('filter_word_like_any', 0); // ************************************************ // some parameter shortcuts common with search view // ************************************************ $canseltypes = $params->get('canseltypes', 1); $txtmode = $params->get('txtmode', 0); // 0: BASIC Index, 1: ADVANCED Index without search fields user selection, 2: ADVANCED Index with search fields user selection // Get if text searching according to specific (single) content type $show_txtfields = $params->get('show_txtfields', 1); //0:hide, 1:according to content, 2:use custom configuration $show_txtfields = $txtmode ? 0 : $show_txtfields; // disable this flag if using BASIC index for text search // Get if filtering according to specific (single) content type $show_filters = $params->get('show_filters', 1); //0:hide, 1:according to content, 2:use custom configuration // Force single type selection and showing the content type selector $type_based_search = $show_filters == 1 || $show_txtfields == 1; $canseltypes = $type_based_search ? 1 : $canseltypes; // ******************************************************************** // Get Content Types allowed for user selection in the Search Form // Also retrieve their configuration, plus the currently selected types // ******************************************************************** // Get them from configuration $contenttypes = $params->get('contenttypes', array()); // Sanitize them $contenttypes = !is_array($contenttypes) ? array($contenttypes) : $contenttypes; $contenttypes = array_unique(array_map('intval', $contenttypes)); // Make sure these are integers since we will be using them UNQUOTED // Force hidden content type selection if only 1 content type was initially configured $canseltypes = count($contenttypes) == 1 ? 0 : $canseltypes; // Type data and configuration (parameters), if no content types specified then all will be retrieved $typeData = flexicontent_db::getTypeData(implode(",", $contenttypes)); $contenttypes = array(); foreach ($typeData as $tdata) { $contenttypes[] = $tdata->id; } // Get Content Types to use either those currently selected in the Search Form, or those hard-configured in the search menu item if ($canseltypes) { $form_contenttypes = JRequest::getVar('contenttypes', array()); // Sanitize them $form_contenttypes = !is_array($form_contenttypes) ? array($form_contenttypes) : $form_contenttypes; $form_contenttypes = array_unique(array_map('intval', $form_contenttypes)); // Make sure these are integers since we will be using them UNQUOTED $_contenttypes = array_intersect($contenttypes, $form_contenttypes); if (!empty($_contenttypes)) { $contenttypes = $_contenttypes; } // catch empty case: no content types were given or not-allowed content types were passed } // Check for zero content type (can occur during sanitizing content ids to integers) if (!empty($contenttypes)) { foreach ($contenttypes as $i => $v) { if (!strlen($contenttypes[$i])) { unset($contenttypes[$i]); } } } // Type based seach, get a single content type (first one, if more than 1 were given ...) if ($type_based_search && !empty($contenttypes)) { $single_contenttype = reset($contenttypes); $contenttypes = array($single_contenttype); } else { $single_contenttype = false; } // ************************************* // Text Search Fields of the search form // ************************************* if (!$txtmode) { $txtflds = array(); $fields_text = array(); } else { $txtflds = ''; if ($show_txtfields) { if ($show_txtfields == 1) { $txtflds = $single_contenttype ? $typeData[$single_contenttype]->params->get('searchable', '') : ''; } else { $txtflds = $params->get('txtflds', ''); } } // Sanitize them $txtflds = preg_replace("/[\"'\\\\]/u", "", $txtflds); $txtflds = array_unique(preg_split("/\\s*,\\s*/u", $txtflds)); if (!strlen($txtflds[0])) { unset($txtflds[0]); } // Create a comma list of them $txtflds_list = count($txtflds) ? "'" . implode("','", $txtflds) . "'" : ''; // Retrieve field properties/parameters, verifying the support to be used as Text Search Fields // This will return all supported fields if field limiting list is empty $fields_text = FlexicontentFields::getSearchFields($key = 'id', $indexer = 'advanced', $txtflds_list, $contenttypes, $load_params = true, 0, 'search'); if (empty($fields_text)) { // all entries of field limiting list were invalid , get ALL if (!empty($contenttypes)) { $fields_text = FlexicontentFields::getSearchFields($key = 'id', $indexer = 'advanced', null, $contenttypes, $load_params = true, 0, 'search'); } else { $fields_text = array(); } } } // ******************************** // Filter Fields of the search form // ******************************** // Get them from type configuration or from search menu item $filtflds = ''; if ($show_filters) { if ($show_filters == 1) { $filtflds = $single_contenttype ? $typeData[$single_contenttype]->params->get('filters', '') : ''; } else { $filtflds = $params->get('filtflds', ''); } } // Sanitize them $filtflds = preg_replace("/[\"'\\\\]/u", "", $filtflds); $filtflds = array_unique(preg_split("/\\s*,\\s*/u", $filtflds)); if (!strlen($filtflds[0])) { unset($filtflds[0]); } // Create a comma list of them $filtflds_list = count($filtflds) ? "'" . implode("','", $filtflds) . "'" : ''; // Retrieve field properties/parameters, verifying the support to be used as Filter Fields // This will return all supported fields if field limiting list is empty if (count($filtflds)) { $filters_tmp = FlexicontentFields::getSearchFields($key = 'name', $indexer = 'advanced', $filtflds_list, $contenttypes, $load_params = true, 0, 'filter'); // Use custom order $filters = array(); if ($canseltypes && $show_filters) { foreach ($filtflds as $field_name) { if (empty($filters_tmp[$field_name])) { continue; } $filter_id = $filters_tmp[$field_name]->id; $filters[$filter_id] = $filters_tmp[$field_name]; } } else { foreach ($filters_tmp as $filter) { $filters[$filter->id] = $filter; // index by filter_id in this case too (for consistency, although we do not use the array index ?) } } unset($filters_tmp); } // If configured filters were not found/invalid for the current content type(s) // then retrieve all fields marked as filterable for the give content type(s) this is useful to list per content type filters automatically, even when not set or misconfigured if (empty($filters)) { if (!empty($contenttypes)) { $filters = FlexicontentFields::getSearchFields($key = 'id', $indexer = 'advanced', null, $contenttypes, $load_params = true, 0, 'filter'); } else { $filters = array(); } } // ********************** // Load Plugin parameters // ********************** $plugin = JPluginHelper::getPlugin('search', 'flexiadvsearch'); $pluginParams = new JRegistry($plugin->params); // Shortcuts for plugin parameters $search_limit = $params->get('search_limit', $pluginParams->get('search_limit', 20)); // Limits the returned results of this seach plugin $filter_lang = $params->get('filter_lang', $pluginParams->get('filter_lang', 1)); // Language filtering enabled $search_archived = $params->get('search_archived', $pluginParams->get('search_archived', 1)); // Include archive items into the search $browsernav = $params->get('browsernav', $pluginParams->get('browsernav', 2)); // Open search in window (for value 1) // *************************************************************************************************************** // Varous other variable USED in the SQL query like (a) current frontend language and (b) -this- plugin specific ordering, (c) null / now dates, (d) etc // *************************************************************************************************************** // Get current frontend language (fronted user selected) $lang = flexicontent_html::getUserCurrentLang(); // NULL and CURRENT dates, // NOTE: the current date needs to use built-in MYSQL function, otherwise filter caching can not work because the CURRENT DATETIME is continuously different !!! //$now = JFactory::getDate()->toSql(); $_nowDate = 'UTC_TIMESTAMP()'; //$db->Quote($now); $nullDate = $db->getNullDate(); // Section name $searchFlexicontent = JText::_('FLEXICONTENT'); // REMOVED / COMMENTED OUT this feature: // Require any OR all Filters ... this can be user selectable //$show_filtersop = $params->get('show_filtersop', 1); //$default_filtersop = $params->get('default_filtersop', 'all'); //$FILTERSOP = !$show_filtersop ? $default_filtersop : JRequest::getVar('filtersop', $default_filtersop); // **************************************** // Create WHERE clause part for Text Search // **************************************** $si_tbl = !$txtmode ? 'flexicontent_items_ext' : 'flexicontent_advsearch_index'; $search_prefix = JComponentHelper::getParams('com_flexicontent')->get('add_search_prefix') ? 'vvv' : ''; // SEARCH WORD Prefix $text = preg_replace('/(\\b[^\\s,\\.]+\\b)/u', $search_prefix . '$0', trim($text)); if (strlen($text)) { $ts = !$txtmode ? 'ie' : 'ts'; $escaped_text = $db->escape($text, true); $quoted_text = $db->Quote($escaped_text, false); switch ($phrase) { case 'natural': if ($filter_word_like_any) { $_text_match = ' LOWER (' . $ts . '.search_index) LIKE ' . $db->Quote('%' . $escaped_text . '%', false); } else { $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ') '; } break; case 'natural_expanded': $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' WITH QUERY EXPANSION) '; break; case 'exact': $words = preg_split('/\\s\\s*/u', $text); $stopwords = array(); $shortwords = array(); if (!$search_prefix) { $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 0); } if (empty($words)) { // All words are stop-words or too short, we could try to execute a query that only contains a LIKE %...% , but it would be too slow JRequest::setVar('ignoredwords', implode(' ', $stopwords)); JRequest::setVar('shortwords', implode(' ', $shortwords)); $_text_match = ' 0=1 '; } else { // speed optimization ... 2-level searching: first require ALL words, then require exact text $newtext = '+' . implode(' +', $words); $quoted_text = $db->escape($newtext, true); $quoted_text = $db->Quote($quoted_text, false); $exact_text = $db->Quote('%' . $escaped_text . '%', false); $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) AND ' . $ts . '.search_index LIKE ' . $exact_text; } break; case 'all': $words = preg_split('/\\s\\s*/u', $text); $stopwords = array(); $shortwords = array(); if (!$search_prefix) { $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 1); } JRequest::setVar('ignoredwords', implode(' ', $stopwords)); JRequest::setVar('shortwords', implode(' ', $shortwords)); $newtext = '+' . implode('* +', $words) . '*'; $quoted_text = $db->escape($newtext, true); $quoted_text = $db->Quote($quoted_text, false); $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) '; break; case 'any': default: if ($filter_word_like_any) { $_text_match = ' LOWER (' . $ts . '.search_index) LIKE ' . $db->Quote('%' . $escaped_text . '%', false); } else { $words = preg_split('/\\s\\s*/u', $text); $stopwords = array(); $shortwords = array(); if (!$search_prefix) { $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 1); } JRequest::setVar('ignoredwords', implode(' ', $stopwords)); JRequest::setVar('shortwords', implode(' ', $shortwords)); $newtext = implode('* ', $words) . '*'; $quoted_text = $db->escape($newtext, true); $quoted_text = $db->Quote($quoted_text, false); $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) '; } break; } // Construct TEXT SEARCH limitation SUB-QUERY (contained in a AND-WHERE clause) $text_where = ' AND ' . $_text_match; } else { $text_where = ''; } // ******************* // Create ORDER clause // ******************* // FLEXIcontent search view, use FLEXIcontent ordering $orderby_join = ''; $orderby_col = ''; if (JRequest::getVar('option') == 'com_flexicontent') { $order = ''; $orderby = flexicontent_db::buildItemOrderBy($params, $order, $_request_var = 'orderby', $_config_param = 'orderby', $_item_tbl_alias = 'i', $_relcat_tbl_alias = 'rel', $_default_order = '', $_default_order_dir = '', $sfx = '', $support_2nd_lvl = false); // Create JOIN for ordering items by a custom field (Level 1) if ('field' == $order[1]) { $orderbycustomfieldid = (int) $params->get('orderbycustomfieldid', 0); $orderby_join .= ' LEFT JOIN #__flexicontent_fields_item_relations AS f ON f.item_id = i.id AND f.field_id=' . $orderbycustomfieldid; } // Create JOIN for ordering items by a custom field (Level 2) if ('field' == $order[2]) { $orderbycustomfieldid_2nd = (int) $params->get('orderbycustomfieldid' . '_2nd', 0); $orderby_join .= ' LEFT JOIN #__flexicontent_fields_item_relations AS f2 ON f2.item_id = i.id AND f2.field_id=' . $orderbycustomfieldid_2nd; } // Create JOIN for ordering items by author's name if (in_array('author', $order) || in_array('rauthor', $order)) { $orderby_col = ''; $orderby_join .= ' LEFT JOIN #__users AS u ON u.id = i.created_by'; } // Create JOIN for ordering items by a most commented if (in_array('commented', $order)) { $orderby_col = ', count(com.object_id) AS comments_total'; $orderby_join .= ' LEFT JOIN #__jcomments AS com ON com.object_id = i.id'; } // Create JOIN for ordering items by a most rated if (in_array('rated', $order)) { $orderby_col = ', (cr.rating_sum / cr.rating_count) * 20 AS votes'; $orderby_join .= ' LEFT JOIN #__content_rating AS cr ON cr.content_id = i.id'; } // Create JOIN for ordering items by their ordering attribute (in item's main category) if (in_array('order', $order)) { $orderby_join .= ' LEFT JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id AND rel.catid = i.catid'; } } else { switch ($ordering) { //case 'relevance': $orderby = ' ORDER BY score DESC, i.title ASC'; break; case 'oldest': $orderby = 'i.created ASC'; break; case 'popular': $orderby = 'i.hits DESC'; break; case 'alpha': $orderby = 'i.title ASC'; break; case 'category': $orderby = 'c.title ASC, i.title ASC'; break; case 'newest': $orderby = 'i.created DESC'; break; default: $orderby = 'i.created DESC'; break; } $orderby = ' ORDER BY ' . $orderby; } // **************************************************************************************** // Create JOIN clause and WHERE clause part for filtering by current (viewing) access level // **************************************************************************************** $joinaccess = ''; $andaccess = ''; $select_access = ''; // Extra access columns for main category and content type (item access will be added as 'access') $select_access .= ', c.access as category_access, ty.access as type_access'; if (!$show_noauth) { // User not allowed to LIST unauthorized items $aid_arr = JAccess::getAuthorisedViewLevels($user->id); $aid_list = implode(",", $aid_arr); $andaccess .= ' AND ty.access IN (0,' . $aid_list . ')'; $andaccess .= ' AND c.access IN (0,' . $aid_list . ')'; $andaccess .= ' AND i.access IN (0,' . $aid_list . ')'; $select_access .= ', 1 AS has_access'; } else { // Access Flags for: content type, main category, item $aid_arr = JAccess::getAuthorisedViewLevels($user->id); $aid_list = implode(",", $aid_arr); $select_access .= ', ' . ' CASE WHEN ' . ' ty.access IN (' . $aid_list . ') AND ' . ' c.access IN (' . $aid_list . ') AND ' . ' i.access IN (' . $aid_list . ') ' . ' THEN 1 ELSE 0 END AS has_access'; } // ********************************************************************************************************************************************************** // Create WHERE clause part for filtering by current active language, and current selected contend types ( !! although this is possible via a filter too ...) // ********************************************************************************************************************************************************** $andlang = ''; if ($app->isSite() && (FLEXI_FISH || FLEXI_J16GE && $app->getLanguageFilter()) && $filter_lang) { $andlang .= ' AND ( ie.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR ie.language="*" ' : '') . ' ) '; } // Filter by currently selected content types $andcontenttypes = count($contenttypes) ? ' AND ie.type_id IN (' . implode(",", $contenttypes) . ') ' : ''; // *********************************************************************** // Create the AND-WHERE clause parts for the currentl active Field Filters // *********************************************************************** $return_sql = 2; $filters_where = array(); foreach ($filters as $field) { // Get value of current filter, and SKIP it if value is EMPTY $filtervalue = JRequest::getVar('filter_' . $field->id, ''); $empty_filtervalue_array = is_array($filtervalue) && !strlen(trim(implode('', $filtervalue))); $empty_filtervalue_string = !is_array($filtervalue) && !strlen(trim($filtervalue)); if ($empty_filtervalue_array || $empty_filtervalue_string) { continue; } // Call field filtering of advanced search to find items matching the field filter (an SQL SUB-QUERY is returned) $field_filename = $field->iscore ? 'core' : $field->field_type; $filtered = FLEXIUtilities::call_FC_Field_Func($field_filename, 'getFilteredSearch', array(&$field, &$filtervalue, &$return_sql)); // An empty return value means no matching values were found $filtered = empty($filtered) ? ' AND 0 ' : $filtered; // A string mean a subquery was returned, while an array means that item ids we returned $filters_where[$field->id] = is_array($filtered) ? ' AND i.id IN (' . implode(',', $filtered) . ')' : $filtered; /*if ($filters_where[$field->id]) { echo "\n<br/>Filter:". $field->name ." : "; print_r($filtervalue); echo "<br>".$filters_where[$field->id]."<br/>"; }*/ } //echo "\n<br/><br/>Filters Active: ". count($filters_where)."<br/>"; //echo "<pre>"; print_r($filters_where); //exit; // ****************************************************** // Create Filters JOIN clauses and AND-WHERE clause parts // ****************************************************** // JOIN clause - USED - to limit returned 'text' to the text of TEXT-SEARCHABLE only fields ... (NOT shared with filters) if (!$txtmode) { $onBasic_textsearch = $text_where; $onAdvanced_textsearch = ''; $join_textsearch = ''; $join_textfields = ''; } else { $onBasic_textsearch = ''; $onAdvanced_textsearch = $text_where; $join_textsearch = ' JOIN #__flexicontent_advsearch_index as ts ON ts.item_id = i.id ' . (count($fields_text) ? 'AND ts.field_id IN (' . implode(',', array_keys($fields_text)) . ')' : ''); $join_textfields = ' JOIN #__flexicontent_fields as f ON f.id=ts.field_id'; } // JOIN clauses ... (shared with filters) $join_clauses = '' . ' JOIN #__categories AS c ON c.id = i.catid' . ' JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id'; $join_clauses_with_text = '' . ' JOIN #__categories AS c ON c.id = i.catid' . ' JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . $onBasic_textsearch . ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ($text_where ? $join_textsearch . $onAdvanced_textsearch . $join_textfields : ''); // AND-WHERE sub-clauses ... (shared with filters) $where_conf = ' WHERE 1 ' . ' AND i.state IN (1,-5' . ($search_archived ? ',' . (FLEXI_J16GE ? 2 : -1) : '') . ') ' . ' AND c.published = 1 ' . ' AND ( i.publish_up = ' . $db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' )' . ' AND ( i.publish_down = ' . $db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' )' . $andaccess . $andlang . $andcontenttypes; // AND-WHERE sub-clauses for text search ... (shared with filters) $and_where_filters = count($filters_where) ? implode(" ", $filters_where) : ''; // ************************************************ // Set variables used by filters creation mechanism // ************************************************ global $fc_searchview; $fc_searchview['join_clauses'] = $join_clauses; $fc_searchview['join_clauses_with_text'] = $join_clauses_with_text; $fc_searchview['where_conf_only'] = $where_conf; // WHERE of the view (mainly configuration dependent) $fc_searchview['filters_where'] = $filters_where; // WHERE of the filters $fc_searchview['search'] = $text_where; // WHERE for text search $fc_searchview['params'] = $params; // view's parameters // ***************************************************************************************************** // Execute search query. NOTE this is skipped it if (a) no text-search and no (b) no filters are active // ***************************************************************************************************** // Do not check for 'contentypes' this are based on configuration and not on form submitted data, // considering contenttypes or other configuration based parameters, will return all items on initial search view display ! if (!count($filters_where) && !strlen($text)) { return array(); } $print_logging_info = $params->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } // ***************************************** // Overcome possible group concat limitation // ***************************************** $query = "SET SESSION group_concat_max_len = 9999999"; $db->setQuery($query); $db->execute(); // ************* // Get the items // ************* $query = 'SELECT SQL_CALC_FOUND_ROWS i.id' . $orderby_col . ' FROM #__content AS i' . $join_clauses_with_text . $orderby_join . $joinaccess . $where_conf . $and_where_filters . ' GROUP BY i.id ' . $orderby; //echo "Adv search plugin main SQL query: ".nl2br($query)."<br/><br/>"; // NOTE: The plugin will return a PRECONFIGURED limited number of results, the SEARCH VIEW to do the pagination, splicing (appropriately) the data returned by all search plugins try { // Get items, we use direct query because some extensions break the SQL_CALC_FOUND_ROWS, so let's bypass them (at this point it is OK) // *** Usage of FOUND_ROWS() will fail when (e.g.) Joom!Fish or Falang are installed, in this case we will be forced to re-execute the query ... // PLUS, we don't need Joom!Fish or Falang layer at --this-- STEP which may slow down the query considerably in large sites $query_limited = $query . ' LIMIT ' . $search_limit . ' OFFSET 0'; $rows = flexicontent_db::directQuery($query_limited); $item_ids = array(); foreach ($rows as $row) { $item_ids[] = $row->id; } // Get current items total for pagination $db->setQuery("SELECT FOUND_ROWS()"); $fc_searchview['view_total'] = $db->loadResult(); $app->setUserState('fc_view_total_' . $view, $fc_searchview['view_total']); } catch (Exception $e) { // Get items via normal joomla SQL layer $db->setQuery(str_replace('SQL_CALC_FOUND_ROWS', '', $query), 0, $search_limit); $item_ids = $db->loadColumn(0); } if (!count($item_ids)) { return array(); } // No items found // ***************** // Get the item data // ***************** $query_data = 'SELECT i.id, i.title AS title, i.created, i.id AS fc_item_id, i.access, ie.type_id, i.language' . (!$txtmode ? ', ie.search_index AS text' : ', GROUP_CONCAT(ts.search_index ORDER BY f.ordering ASC SEPARATOR \' \') AS text') . ', CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug' . ', CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ', CONCAT_WS( " / ", ' . $db->Quote($searchFlexicontent) . ', c.title, i.title ) AS section' . $select_access . ' FROM #__content AS i' . $join_clauses . $join_textsearch . $join_textfields . ' WHERE i.id IN (' . implode(',', $item_ids) . ') ' . ' GROUP BY i.id ' . ' ORDER BY FIELD(i.id, ' . implode(',', $item_ids) . ')'; //echo nl2br($query)."<br/><br/>"; $db->setQuery($query_data); $list = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->getErrorMsg(); } if ($print_logging_info) { @($fc_run_times['search_query_runtime'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // ************************************* // Create item links and other variables // ************************************* //echo "<pre>"; print_r($list); echo "</pre>"; if ($list) { if (count($list) >= $search_limit) { $app->setUserState('fc_view_limit_max_' . $view, $search_limit); } $item_cats = FlexicontentFields::_getCategories($list); foreach ($list as $key => $item) { $item->text = preg_replace('/\\b' . $search_prefix . '/', '', $item->text); $item->categories = isset($item_cats[$item->id]) ? $item_cats[$item->id] : array(); // in case of item categories missing // If joomla article view is allowed allowed and then search view may optional create Joomla article links if ($typeData[$item->type_id]->params->get('allow_jview', 0) && $typeData[$item->type_id]->params->get('search_jlinks', 1)) { $item->href = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->categoryslug, $item->language)); } else { $item->href = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)); } $item->browsernav = $browsernav; } } return $list; }
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display') { if (!in_array($field->field_type, self::$field_types)) { return; } $field->{$prop} = ''; $option = JRequest::getCmd('option'); $view = JRequest::getString('view', FLEXI_ITEMVIEW); $print = JRequest::getCMD('print'); // No output if it is not FLEXIcontent item view or view is "print" if ($view != FLEXI_ITEMVIEW || $option != 'com_flexicontent' || $print) { return; } // parameters shortcuts $load_css = $field->parameters->get('load_css', 1); $use_tooltip = $field->parameters->get('use_tooltip', 1); $use_title = $field->parameters->get('use_title', 0); $use_category_link = $field->parameters->get('use_category_link', 0); $show_prevnext_count = $field->parameters->get('show_prevnext_count', 1); $tooltip_title_next = JText::_($field->parameters->get('tooltip_title_next', 'FLEXI_FIELDS_PAGENAV_GOTONEXT')); $tooltip_title_prev = JText::_($field->parameters->get('tooltip_title_prev', 'FLEXI_FIELDS_PAGENAV_GOTOPREV')); $prev_label = JText::_($field->parameters->get('prev_label', 'FLEXI_FIELDS_PAGENAV_GOTOPREV')); $next_label = JText::_($field->parameters->get('next_label', 'FLEXI_FIELDS_PAGENAV_GOTONEXT')); $category_label = JText::_($field->parameters->get('category_label', 'FLEXI_FIELDS_PAGENAV_CATEGORY')); $cid = JRequest::getInt('cid'); $cid = $cid ? $cid : (int) $item->catid; // Get active category parameters $db = JFactory::getDBO(); $query = 'SELECT * FROM #__categories WHERE id = ' . $cid; $db->setQuery($query); $catdata = $db->loadObject(); $catdata->parameters = FLEXI_J16GE ? new JRegistry($catdata->params) : new JParameter($catdata->params); // Get list of ids of selected, TODO retrieve item ids from view: // --> this will allow special navigating layouts "mcats,author,myitems,tags,favs" and also utilize current filtering $ids = null; $list = $this->getItemList($field, $item, $ids, $cid, $catdata->parameters); // Location of current content item in array list $loc_to_ids = array_keys($list); $ids_to_loc = array_flip($loc_to_ids); $location = isset($ids_to_loc[$item->id]) ? $ids_to_loc[$item->id] : false; // Get previous and next item data $field->prev = null; $field->prevtitle = null; $field->prevurl = null; $field->next = null; $field->nexttitle = null; $field->nexturl = null; $field->category = null; $field->categorytitle = null; $field->categoryurl = null; // Get item data $rows = false; $prev_id = null; $next_id = null; if ($location !== false) { $prev_id = $location - 1 >= 0 ? $loc_to_ids[$location - 1] : null; $next_id = $location + 1 < count($list) ? $loc_to_ids[$location + 1] : null; $ids = array(); // Previous item if it exists if ($prev_id) { $ids[] = $prev_id; } // Current item may belong may not be list in main category so retrieve it to get a proper categoryslug $ids[] = $item->id; // Next item if it exists if ($next_id) { $ids[] = $next_id; } // Query specific ids $rows = $this->getItemList($field, $item, $ids, $cid, $catdata->parameters); // previous content item if ($prev_id) { $field->prev = $rows[$prev_id]; $field->prevtitle = $field->prev->title; $field->prevurl = JRoute::_(FlexicontentHelperRoute::getItemRoute($field->prev->slug, $field->prev->categoryslug, 0, $field->prev)); } // next content item if ($next_id) { $field->next = $rows[$next_id]; $field->nexttitle = $field->next->title; $field->nexturl = JRoute::_(FlexicontentHelperRoute::getItemRoute($field->next->slug, $field->next->categoryslug, 0, $field->next)); } } // Check if displaying nothing and stop if (!$field->prev && !$field->next && !$use_category_link) { return; } $html = '<span class="flexi fc-pagenav">'; $tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; // CATEGORY back link if ($use_category_link) { $cat_image = $this->getCatThumb($catdata, $field->parameters); $limit = count($list); $limit = $limit ? $limit : 10; $start = floor($location / $limit) * $limit; if (!empty($rows[$item->id]->categoryslug)) { $html .= ' <span class="fc-pagenav-return"> <a class="btn btn-info" href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($rows[$item->id]->categoryslug)) . '?start=' . $start . '">' . htmlspecialchars($category_label, ENT_NOQUOTES, 'UTF-8') . ($cat_image ? ' <br/> <img src="' . $cat_image . '" alt="Return"/>' : '') . ' </a> </span>'; } } // Item location and total count $html .= $show_prevnext_count ? '<span class="fc-pagenav-items-cnt badge badge-info">' . ($location + 1) . '/' . count($list) . '</span>' : ''; // Get images $items_arr = array(); if ($field->prev) { $items_arr[$field->prev->id] = $field->prev; } if ($field->next) { $items_arr[$field->next->id] = $field->next; } $thumbs = $this->getItemThumbs($field->parameters, $items_arr); // Next item linking if ($field->prev) { $tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_prev, $field->prevtitle, 0) . '"' : ''; $html .= ' <span class="fc-pagenav-prev' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '> <a class="btn" href="' . $field->prevurl . '"> <i class="icon-previous"></i> ' . ($use_title ? $field->prevtitle : htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8')) . ' ' . (isset($thumbs[$field->prev->id]) ? ' <br/> <img src="' . $thumbs[$field->prev->id] . '" alt="Previous"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-prev"> <span class="btn disabled"> <i class="icon-previous"></i> ' . htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8') . ' </span> </span>'; } // Previous item linking if ($field->next) { $tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_next, $field->nexttitle, 0) . '"' : ''; $html .= ' <span class="fc-pagenav-next' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '> <a class="btn" href="' . $field->nexturl . '"> <i class="icon-next"></i> ' . ($use_title ? $field->nexttitle : htmlspecialchars($next_label, ENT_NOQUOTES, 'UTF-8')) . ' ' . (isset($thumbs[$field->next->id]) ? ' <br/> <img src="' . $thumbs[$field->next->id] . '" alt="Next"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-next"> <span class="btn disabled"> <i class="icon-next"></i> ' . htmlspecialchars($next_label, ENT_NOQUOTES, 'UTF-8') . ' </span> </span>'; } $html .= '</span>'; // Load needed JS/CSS if ($use_tooltip) { FLEXI_J30GE ? JHtml::_('bootstrap.tooltip') : JHTML::_('behavior.tooltip'); } if ($load_css) { JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/plugins/flexicontent_fields/fcpagenav/' . (FLEXI_J16GE ? 'fcpagenav/' : '') . 'fcpagenav.css'); } $field->{$prop} = $html; }
function administrator() { $result = array('task' => JRequest::getCMD('task'), 'params' => array('$menutype' => JRequest::getVar('menutype'))); return $result; }