Server IP : 195.201.23.43 / Your IP : 18.218.44.61 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/cwd/administrator/components/com_redirect/controllers/ |
Upload File : |
<?php /** * @package Joomla.Administrator * @subpackage com_redirect * * @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; /** * Redirect link list controller class. * * @since 1.6 */ class RedirectControllerLinks extends JControllerAdmin { /** * Method to update a record. * * @return void * * @since 1.6 */ public function activate() { // Check for request forgeries. $this->checkToken(); $ids = (array) $this->input->get('cid', array(), 'int'); // Remove zero values resulting from input filter $ids = array_filter($ids); if (empty($ids)) { JError::raiseWarning(500, JText::_('COM_REDIRECT_NO_ITEM_SELECTED')); } else { $newUrl = $this->input->getString('new_url'); $comment = $this->input->getString('comment'); // Get the model. $model = $this->getModel(); // 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'); } /** * Method to duplicate URLs in records. * * @return void * * @since 3.6.0 */ public function duplicateUrls() { // Check for request forgeries. $this->checkToken(); $ids = (array) $this->input->get('cid', array(), 'int'); // Remove zero values resulting from input filter $ids = array_filter($ids); if (empty($ids)) { JError::raiseWarning(500, JText::_('COM_REDIRECT_NO_ITEM_SELECTED')); } else { $newUrl = $this->input->getString('new_url'); $comment = $this->input->getString('comment'); // Get the model. $model = $this->getModel(); // Remove the items. if (!$model->duplicateUrls($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. * * @param string $name The name of the model. * @param string $prefix The prefix of the model. * @param array $config An array of settings. * * @return JModel instance * * @since 1.6 */ public function getModel($name = 'Link', $prefix = 'RedirectModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } /** * Executes the batch process to add URLs to the database * * @return void */ public function batch() { // Check for request forgeries. $this->checkToken(); $batch_urls_request = $this->input->post->get('batch_urls', array(), 'array'); $batch_urls_lines = array_map('trim', explode("\n", $batch_urls_request[0])); $batch_urls = array(); foreach ($batch_urls_lines as $batch_urls_line) { if (!empty($batch_urls_line)) { $params = JComponentHelper::getParams('com_redirect'); $separator = $params->get('separator', '|'); // Basic check to make sure the correct separator is being used if (!\Joomla\String\StringHelper::strpos($batch_urls_line, $separator)) { $this->setMessage(JText::sprintf('COM_REDIRECT_NO_SEPARATOR_FOUND', $separator), 'error'); $this->setRedirect('index.php?option=com_redirect&view=links'); return false; } $batch_urls[] = array_map('trim', explode($separator, $batch_urls_line)); } } // Set default message on error - overwrite if successful $this->setMessage(JText::_('COM_REDIRECT_NO_ITEM_ADDED'), 'error'); if (!empty($batch_urls)) { $model = $this->getModel('Links'); // Execute the batch process if ($model->batchProcess($batch_urls)) { $this->setMessage(JText::plural('COM_REDIRECT_N_LINKS_ADDED', count($batch_urls))); } } $this->setRedirect('index.php?option=com_redirect&view=links'); } /** * Clean out the unpublished links. * * @return void * * @since 3.5 */ public function purge() { // Check for request forgeries. $this->checkToken(); $model = $this->getModel('Links'); if ($model->purge()) { $message = JText::_('COM_REDIRECT_CLEAR_SUCCESS'); } else { $message = JText::_('COM_REDIRECT_CLEAR_FAIL'); } $this->setRedirect('index.php?option=com_redirect&view=links', $message); } }Private