AAAAhome/academiac/www/administrator/components/com_redirect/controllers/links.php000064400000003114151447320350024115 0ustar00getModel(); JArrayHelper::toInteger($ids); // Remove the items. if (!$model->activate($ids, $newUrl, $comment)) { JError::raiseWarning(500, $model->getError()); } else { $this->setMessage(JText::plural('COM_REDIRECT_N_LINKS_UPDATED', count($ids))); } } $this->setRedirect('index.php?option=com_redirect&view=links'); } /** * Proxy for getModel. * @since 1.6 */ public function getModel($name = 'Link', $prefix = 'RedirectModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); return $model; } } home/academiac/www/administrator/components/com_redirect/models/links.php000064400000007413151453302350023035 0ustar00getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); // Load the parameters. $params = JComponentHelper::getParams('com_redirect'); $this->setState('params', $params); // List state information. parent::populateState('a.old_url', 'asc'); } /** * 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 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.state'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.*' ) ); $query->from($db->quoteName('#__redirect_links').' AS a'); // Filter by published state $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where('a.published = '.(int) $state); } elseif ($state === '') { $query->where('(a.published IN (0,1,2))'); } // Filter the items over the search string if set. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = '.(int) substr($search, 3)); } else { $search = $db->Quote('%'.$db->escape($search, true).'%'); $query->where( '('.$db->quoteName('old_url').' LIKE '.$search . ' OR '.$db->quoteName('new_url').' LIKE '.$search . ' OR '.$db->quoteName('comment').' LIKE '.$search . ' OR '.$db->quoteName('referer').' LIKE '.$search.')' ); } } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.old_url')).' '.$db->escape($this->getState('list.direction', 'ASC'))); //echo nl2br(str_replace('#__','jos_',$query)); return $query; } }