Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: Редирект после отправки формы Phoca Guestbook | Joomla 3.5.1
Форумы портала PHP.SU » PHP » Напишите за меня, пожалуйста » Редирект после отправки формы Phoca Guestbook | Joomla 3.5.1

Страниц (1): [1]
 

1. 1-F7 - 25 Ноября, 2016 - 12:59:03 - перейти к сообщению
Добрый день уважаемые пользователи форума. Подскажите пожалуйста, как сделать редирект после отправки формы в Phoca Guestbook. Мне подсказали, что в controllers нужно это делать. По этому я выкладываю components/com_phocaguestbook/co ntrollers/phocaguestbook.php

PHP:
скопировать код в буфер обмена
  1. <?PHP
  2. /**
  3.  * @package    PhocaGuestbook
  4.  * @subpackage Helpers
  5.  * @copyright  Copyright (C) 2012 Jan Pavelka www.phoca.cz
  6.  * @license    http://www.gnu.org/copyleft/gpl.html GNU/GPL
  7.  */
  8. defined('_JEXEC') or die();
  9. require_once JPATH_COMPONENT.'/helpers/phocaguestbookonlinecheck.php';
  10.  
  11. class PhocaguestbookControllerPhocaguestbook extends JControllerForm
  12. {
  13.         function cancel($key = NULL) {
  14.                 $uri    = JFactory::getURI();
  15.                 $app    = JFactory::getApplication();
  16.                
  17.                 // Delete the data in the session.
  18.                 $app->setUserState('com_phocaguestbook.guestbook.data', '');
  19.                
  20.                 // Redirect back to the guestbook form.
  21.                 $this->setRedirect(JRoute::_($uri));
  22.                 return false;
  23.         }
  24.                
  25.         function submit() {
  26.                 // Check for request forgeries.
  27.                 JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  28.                 $session = JFactory::getSession();
  29.                
  30.                 // default session test always enabled!
  31.                 $valid = $session->get('form_id', NULL, 'phocaguestbook');
  32.                 $session->clear('form_id', 'phocaguestbook');
  33.                 if (!$valid){
  34.                         jexit(JText::_('COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED'));
  35.                 }
  36.                                
  37.                 $data  = $this->input->post->get('jform', array(), 'array');
  38.                 $id     = $this->input->getInt('cid');
  39.                 $model  = $this->getModel('guestbook');
  40.                 $app    = JFactory::getApplication();
  41.                 $uri    = JFactory::getURI();
  42.                 $user   = JFactory::getUser();
  43.                
  44.                 $model->setState('category.id', $id);
  45.  
  46.                
  47.                 // lets start processing               
  48.                
  49.  
  50.        
  51.                 $guestbook = $model->getGuestbook();
  52.                 if (!$guestbook) {
  53.                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  54.                         return false;
  55.                 }
  56.                
  57.                 // Load Logging        
  58.                 $logging = $model->getTable('phocaguestbookLogging');
  59.                 $logging->catid = $id;
  60.                 $logging->incoming_page = htmlspecialchars(JFactory::getURI()->toString());
  61.                                
  62.                 // Load the parameters.
  63.                 // Merge Global => GUESTBOOK => Menu Item params into new object in view
  64.                 $applparams = $app->getParams();               
  65.                 $bookparams = new JRegistry;
  66.                 $menuParams = new JRegistry;
  67.                 $bookparams->loadString($guestbook->get('params'));
  68.                 if ($menu = $app->getMenu()->getActive()) {
  69.                         $menuParams->loadString($menu->params);
  70.                 }              
  71.                 $params = clone $applparams;
  72.                 $params->merge($bookparams);
  73.                 $params->merge($menuParams);
  74.                
  75.                 $namespace  = 'pgb' . $params->get('session_suffix');
  76.                
  77.                 $captcha_id = $session->get('captcha_id',   null, $namespace);
  78.                 $params->set('captcha_id', $captcha_id );
  79.                 // Captcha not for registered
  80.                 if ($params->get('enable_captcha_users') == 1 && $user->id > 0) {
  81.                         $params->set('enable_captcha', 0);
  82.                 }
  83.                 $logging->captchaid = $captcha_id;
  84.                
  85.                 // Save params
  86.                 $model->setState('params', $params);
  87.                
  88.                 // Get the data from POST
  89.                 $data['published'] = 1;
  90.                 $data['catid'] = $id;
  91.                 $data['userid'] = $user->id;
  92.                
  93.                 if (!isset($data['website'])) {
  94.                         $data['website'] = '';
  95.                 }
  96.                 //ipaddr
  97.                 if(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) {
  98.                         $data['userip']  = $_SERVER['REMOTE_ADDR'];
  99.                 } else {
  100.                         $data['userip']  = getenv('HTTP_X_FORWARDED_FOR');
  101.                 }
  102.                 $logging->ip = $data['userip'];
  103.        
  104.                 //captcha
  105.                 switch ($params->get('captcha_id')) {
  106.                         case 1: //COM_PHOCAGUESTBOOK_JOOMLA_CAPTCHA -> use diffent fields
  107.                         case 5: //COM_PHOCAGUESTBOOK_RECAPTCHA_CAPTCHA -> use diffent fields
  108.                                 $data['captcha'] = 'dummy';
  109.                                 break;
  110.                 }
  111.                
  112.                 // Hidden Field check
  113.                 if ($params->get('enable_hidden_field')         == 1) {
  114.                         $params->set('hidden_field_id', $session->get('hidden_field_id', 'fieldnotvalid', $namespace));
  115.                         $params->set('hidden_field_name', $session->get('hidden_field_name', 'fieldnotvalid', $namespace));
  116.  
  117.                         $session->clear('hidden_field_id', $namespace);
  118.                         $session->clear('hidden_field_name', $namespace);
  119.                         $session->clear('hidden_field_class', $namespace);
  120.                        
  121.                         if ($params->get('hidden_field_id') == 'fieldnotvalid') {
  122.                                 $logging->hidden_field = 2;
  123.                                 $model->doLog($logging,false);
  124.                                 //no session id available
  125.                                 JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  126.                                 return false;
  127.                         }
  128.                         $logging->hidden_field = 1;
  129.                 }
  130.                
  131.                 // Check for a valid session cookie
  132.                 if($session->getState()!= 'active'){
  133.                         // Save the data in the session.
  134.                         $app->setUserState('com_phocaguestbook.guestbook.data', $data);
  135.                         $logging->session = 2;
  136.                         $model->doLog($logging,false);
  137.  
  138.                         JError::raiseWarning(403, JText::_('COM_PHOCAGUESTBOOK_SESSION_INVALID'));
  139.  
  140.                         // Redirect back to the contact form.
  141.                         $this->setRedirect(JRoute::_($uri));
  142.                         return false;
  143.                 }
  144.                
  145.                 // Security
  146.                 $task = $this->input->get('task');
  147.  
  148.                 if ($task == 'phocaguestbook.submit') {
  149.                         $task = 'submit';
  150.                 }
  151.                 if (($this->input->get('view')!= 'guestbook') || ($this->input->get('option')!= 'com_phocaguestbook') || ($task != 'submit')) {
  152.                         $app->setUserState('com_phocaguestbook.guestbook.data', '');
  153.                         $session->clear('time', 'pgb'.$params->get('session_suffix'));
  154.                        
  155.                         $logging->session = 3;
  156.                         $model->doLog($logging,false);
  157.                        
  158.                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  159.                         return false;
  160.                 }
  161.                                
  162.                 //Check if we are authorized to post to the guestbook
  163.                 if(!$params->get('access-post')) {
  164.                         $logging->session = 4;
  165.                         $model->doLog($logging,false);
  166.                        
  167.                         $app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('COM_PHOCAGUESTBOOK_NOT_AUTHORIZED_DO_ACTION'). '. ');
  168.                         return;
  169.                 }
  170.                 $logging->session = 1;
  171.                
  172.                 //Check Time
  173.             if($params->get('enable_time_check') || $params->get('enable_logging')) {
  174.             $time = $session->get('time', null, 'pgb'.$params->get('session_suffix'));
  175.             $delta = time() - $time;
  176.                         $logging->used_time = $delta;
  177.                        
  178.                         if($params->get('enable_time_check') && $delta <= $params->get('time_check_s'))
  179.             {
  180.                                 JError::raiseWarning(403, JText::_('COM_PHOCAGUESTBOOK_SUBMIT_TOO_FAST'));
  181.  
  182.                                 // Save the data in the session.
  183.                                 $app->setUserState('com_phocaguestbook.guestbook.data', $data);
  184.                                 $model->doLog($logging,false);
  185.  
  186.                                 // Redirect back to the contact form.
  187.                                 $this->setRedirect(JRoute::_($uri));
  188.                                 return false;
  189.             }
  190.         }
  191.                
  192.                 // IP BAN Check
  193.                 if ($params->get('form_action_banned_ip')!= 2) {
  194.                        
  195.                         $isSpam = PhocaguestbookOnlineCheckHelper::checkIpAddress($data['userip'], $params, $logging);
  196.                        
  197.                         if ($isSpam) {
  198.                                 if ($params->get('form_action_banned_ip') == 1){
  199.                                         $data['published'] = 0;
  200.                                         //break;
  201.                                 } else {
  202.                                         $session->clear('time', 'pgb'.$params->get('session_suffix'));
  203.                                         $model->doLog($logging,false);
  204.                                        
  205.                                         /*$app->setUserState('com_phocaguestbook.guestbook.data', '');
  206.                                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  207.                                         return false;*/
  208.                                         $app->setUserState('com_phocaguestbook.guestbook.data', $data); // Save the data in the session.
  209.                                         $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_PHOCA_GUESTBOOK_SPAM_BLOCKED' ), 'error');
  210.                                
  211.                                         // Redirect back to the guestbook form.
  212.                                         $this->setRedirect(JRoute::_($uri));
  213.                                         return false;
  214.                                 }
  215.                         }
  216.                 } //end of IP check
  217.        
  218.                 $continueValidate = true;       //validate all fields
  219.                 $logging->fields = 1;
  220.                
  221.                 // Validate the posted data.
  222.                 $form = $model->getForm();
  223.                 if (!$form) {
  224.                         $app->setUserState('com_phocaguestbook.guestbook.data', $data); // Save the data in the session.
  225.                         $logging->fields = 10;
  226.                         $model->doLog($logging,false);
  227.                        
  228.                         JError::raiseError(500, $model->getError());
  229.                         return false;
  230.                 }
  231.                
  232.                 $validate = $model->validate($form, $data);    
  233.                 if ($validate === false) {
  234.                         $errors                 = $model->getErrors();
  235.                         // Get (possible) attack issues
  236.                         for ($i = 0, $n = count($errors); $i < $n && $i < 5; $i++) {
  237.                                 if (($errors[$i] instanceof JException) && ($errors[$i]->get('Level') == E_ERROR)) {
  238.                                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  239.                                        
  240.                                         $logging->fields = 11;
  241.                                         $model->doLog($logging,false);
  242.                                         return false;
  243.                                 } else {
  244.                                         $app->enqueueMessage($errors[$i]->getMessage(), 'warning');
  245.                                         $continueValidate = false;
  246.                                         $logging->fields = 2;
  247.                                 }
  248.                         }
  249.                 }
  250.                
  251.  
  252.  
  253.                 //check url and hidden word
  254.                 $ffa    = explode( ',', trim( $params->get('deny_url_words', '') ) );
  255.                 $fwfa   = explode( ',', trim( $params->get('forbidden_word_filter', '') ) );
  256.                 $fwwfa  = explode( ',', trim( $params->get('forbidden_whole_word_filter', '') ) );
  257.                 $logging->forbidden_word = 1;
  258.  
  259.                 //FORBIDDEN URL identication
  260.                 foreach ($ffa as $word) {
  261.                         if ($word != '') {
  262.                                 if ((strpos($data['content'], $word)!== false)  ||
  263.                                         (strpos($data['title'], $word)!== false) ||
  264.                                         (strpos($data['username'], $word)!== false)) {
  265.                                                
  266.                                         $logging->forbidden_word = 2;
  267.                                         switch ($params->get('form_action_denied_url')){
  268.                                                 case 0: default://throw error
  269.                                                         $continueValidate = false;
  270.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_DENY_URL' ), 'warning');
  271.                                                         break;
  272.                                                 case 1: // save item, but do not publish
  273.                                                         $data['published'] = 0;
  274.                                                         break;
  275.                                                 case 2: // save item - ignore error
  276.                                                         break;
  277.                                         }
  278.                                 }
  279.                         }
  280.                 }
  281.                
  282.                 //FORBIDDEN WORD
  283.                 foreach ($fwfa as $item) {
  284.                         if (trim($item)!= '') {
  285.                                 switch ($params->get('form_action_hidden_word')){
  286.                                         case 0: default://throw error
  287.                                                 if (stripos($data['content'], trim($item))!== false) {
  288.                                                         $continueValidate = false;
  289.                                                         $logging->forbidden_word = 4;
  290.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_CONTENT' ), 'warning');
  291.                                                 }
  292.                                                 if (stripos($data['username'], trim($item))!== false) {
  293.                                                         $continueValidate = false;
  294.                                                         $logging->forbidden_word = 4;
  295.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_USERNAME' ), 'warning');
  296.                                                 }
  297.                                                 if (stripos($data['title'], trim($item))!== false) {
  298.                                                         $continueValidate = false;
  299.                                                         $logging->forbidden_word = 4;
  300.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_SUBJECT' ), 'warning');
  301.                                                 }
  302.                                                 if (stripos($data['email'], trim($item))!== false) {
  303.                                                         $continueValidate = false;
  304.                                                         $logging->forbidden_word = 4;
  305.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_EMAIL' ), 'warning');
  306.                                                 }
  307.                                                 if (stripos($data['website'], trim($item))!== false) {
  308.                                                         $continueValidate = false;
  309.                                                         $logging->forbidden_word = 4;
  310.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_WEBSITE' ), 'warning');
  311.                                                 }
  312.                                                 break;
  313.                                         case 1: // save item, but do not publish
  314.                                                 if ((stripos($data['content'], trim($item))!== false) ||
  315.                                                         (stripos($data['username'], trim($item))!== false) ||
  316.                                                         (stripos($data['title'], trim($item))!== false) ||
  317.                                                         (stripos($data['email'], trim($item))!== false) ||
  318.                                                         (stripos($data['website'], trim($item))!== false)) {
  319.                                                         $logging->forbidden_word = 4;
  320.                                                         $data['published'] = 0;
  321.                                                 }
  322.                                                 break;
  323.                                         case 2: // save item - ignore error
  324.                                                 break;
  325.                                 }
  326.                         }
  327.                 }
  328.                 foreach ($fwwfa as $item) {
  329.                         if ($item != '') {
  330.                                 $item                   = "/(^|[^a-zA-Z0-9_]){1}(".preg_quote(($item),"/").")($|[^a-zA-Z0-9_]){1}/i";
  331.  
  332.                                 switch ($params->get('form_action_hidden_word')){
  333.                                         case 0: default://throw error
  334.                                                 if (preg_match( $item, $data['content']) == 1) {
  335.                                                         $continueValidate = false;
  336.                                                         $logging->forbidden_word = 8;
  337.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_CONTENT' ), 'warning');
  338.                                                 }
  339.                                                 if (preg_match( $item, $data['username']) == 1) {
  340.                                                         $continueValidate = false;
  341.                                                         $logging->forbidden_word = 8;
  342.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_USERNAME' ), 'warning');
  343.                                                 }
  344.                                                 if (preg_match( $item, $data['title']) == 1) {
  345.                                                         $continueValidate = false;
  346.                                                         $logging->forbidden_word = 8;
  347.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_SUBJECT' ), 'warning');
  348.                                                 }
  349.                                                 if (preg_match( $item, $data['email']) == 1) {
  350.                                                         $continueValidate = false;
  351.                                                         $logging->forbidden_word = 8;
  352.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_EMAIL' ), 'warning');
  353.                                                 }
  354.                                                 if (preg_match( $item, $data['website']) == 1) {
  355.                                                         $continueValidate = false;
  356.                                                         $logging->forbidden_word = 8;
  357.                                                         $app->enqueueMessage(JText::_('COM_PHOCAGUESTBOOK_BAD_WEBSITE' ), 'warning');
  358.                                                 }
  359.                                                 break;
  360.                                         case 1: // save item, but do not publish
  361.                                                 if ((preg_match( $item, $data['content']) == 1) ||
  362.                                                         (preg_match( $item, $data['username']) == 1) ||
  363.                                                         (preg_match( $item, $data['title']) == 1) ||
  364.                                                         (preg_match( $item, $data['email']) == 1) ||
  365.                                                         (preg_match( $item, $data['website']) == 1)) {
  366.                                                         $logging->forbidden_word = 8;
  367.                                                         $data['published'] = 0;
  368.                                                 }
  369.                                                 break;
  370.                                         case 2: // save item - ignore error
  371.                                                 break;
  372.                                 }
  373.                         }
  374.                 }              
  375.                                
  376.                 //remove captcha from data after check
  377.                 $data['captcha'] = '';
  378.                 if ($continueValidate == false) {                      
  379.                         // Save the data in the session.
  380.                         $app->setUserState('com_phocaguestbook.guestbook.data', $data);
  381.                         $model->doLog($logging,false);
  382.  
  383.                         // Redirect back to the guestbook form.
  384.                         $this->setRedirect(JRoute::_($uri));
  385.                         return false;
  386.                 }
  387.                
  388.                 //Check  spam:
  389.                 // Akismet,        see http://akismet.com/
  390.                 // Mollom,         see http://mollom.com/
  391.                 // StopforumSpam,  see http://www.stopforumspam.com/
  392.                 // Honeypot,       see http://www.projecthoneypot.org/
  393.                 // Botscout,       see http://botscout.com/
  394.                 if ($params->get('contentcheck_block_spam')!= 2){
  395.                         $suspectSpam = PhocaguestbookOnlineCheckHelper::checkSpam($data, $params, $logging);  //print_r($feedback);
  396.                         if ($suspectSpam){
  397.                                 if ($params->get('contentcheck_block_spam')!= 1){
  398.                                         $model->doLog($logging,false);
  399.  
  400.                                         $app->setUserState('com_phocaguestbook.guestbook.data', $data); // Save the data in the session.
  401.                                         $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_PHOCA_GUESTBOOK_SPAM_BLOCKED' ), 'error');
  402.                        
  403.                                         // Redirect back to the guestbook form.
  404.                                         $this->setRedirect(JRoute::_($uri));
  405.                                         return false;
  406.                                 } else {
  407.                                         $data['published'] = 0;
  408.                                 }
  409.                         }
  410.                 }
  411.                
  412.                 // CHECKS DONE - store entry   
  413.                                        
  414.  
  415.                 if ($model->store($data)) {
  416.                         $logging->postid = $data['id'];
  417.  
  418.                         if ($data['published'] == 0) {
  419.                                 $logging->state = 2;
  420.                                 $msg = JText::_( 'COM_PHOCAGUESTBOOK_SUCCESS_SAVE_ITEM' ). ", " .JText::_( 'COM_PHOCAGUESTBOOK_REVIEW_MESSAGE' );
  421.                         } else {
  422.                                 $logging->state = 1;
  423.                                 $msg = JText::_( 'COM_PHOCAGUESTBOOK_SUCCESS_SAVE_ITEM' );
  424.                         }
  425.                        
  426.                         $model->doLog($logging,true);
  427.                 } else {
  428.                         $model->doLog($logging,false);
  429.                 }
  430.                        
  431.                 // Flush the data from the session
  432.                 $session->clear('time', 'pgb'.$params->get('session_suffix'));
  433.                 $app->setUserState('com_phocaguestbook.guestbook.data', null);
  434.                 $app->enqueueMessage($msg, 'success');
  435.                 $this->setRedirect($uri->toString());
  436.                 return true;
  437.  
  438.         }
  439.        
  440.         function delete() {
  441.                 $app    = JFactory::getApplication();
  442.                 $model  = $this->getModel('guestbook');
  443.                 $id     = $this->input->getInt('cid');
  444.                 $model->setState('category.id', $id);
  445.                
  446.                 // Load the parameters.
  447.                 $guestbook = $model->getGuestbook();
  448.                 if (!$guestbook) {
  449.                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  450.                         return false;
  451.                 }
  452.                 $bookparams = new JRegistry;
  453.                 $bookparams->loadString($guestbook->get('params'));                    
  454.                 $model->setState('params', $bookparams);
  455.                
  456.                 $cid            = $this->input->getInt( 'mid', '');
  457.                 $itemid         = $this->input->getInt( 'Itemid', '');
  458.                 $limitstart     = $this->input->getInt( 'start', '');
  459.        
  460.                 if ($bookparams->get('access-delete')) {
  461.                        
  462.                         if (count( $cid ) < 1) {
  463.                                 JError::raiseError(500, JText::_( 'COM_PHOCAGUESTBOOK_WARNING_SELECT_ITEM_DELETE' ) );
  464.                         }
  465.                         if(!$model->delete($cid)) {
  466.                                 $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_ERROR_DELETE_ITEM' ));
  467.                         } else {
  468.                                 $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_SUCCESS_DELETE_ITEM'), 'success');
  469.                         }
  470.                 } else {
  471.                         $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_NOT_AUTHORIZED_DO_ACTION' ));
  472.                 }
  473.  
  474.                 // Redirect
  475.                 $link   = 'index.php?option=com_phocaguestbook&task=phocaguestbook.guestbook&id='.$id.'&Itemid='.$itemid.'&start='.$limitstart;
  476.                 $link   = JRoute::_($link, false);
  477.                 $this->setRedirect( $link );
  478.         }
  479.        
  480.         function unpublish() {
  481.                 $this->changeState(0);
  482.         }
  483.                
  484.         function publish() {
  485.                 $this->changeState(1);
  486.         }
  487.        
  488.         function changeState($newState) {
  489.                 $app    = JFactory::getApplication();
  490.                 $model  = $this->getModel('guestbook');
  491.                 $catid  = $this->input->getInt('cid');
  492.                 $model->setState('category.id', $catid);
  493.                
  494.                 // Load the parameters.
  495.                 $guestbook = $model->getGuestbook();
  496.                 if (!$guestbook) {
  497.                         JError::raiseError(500, JText::_("COM_PHOCAGUESTBOOK_POSSIBLE_SPAM_DETECTED"));
  498.                         return false;
  499.                 }
  500.                
  501.                 $bookparams = new JRegistry;
  502.                 $bookparams->loadString($guestbook->get('params'));                    
  503.                 $model->setState('params', $bookparams);
  504.                
  505.                 $entryid        = $this->input->getInt( 'mid', '');
  506.                 $itemid         = $this->input->getInt( 'Itemid', '');
  507.                 $limitstart     = $this->input->getInt( 'start', '');
  508.                                
  509.                 if ($bookparams->get('access-state')) {
  510.                         if (count( $entryid ) < 1) {
  511.                                 JError::raiseError(500, JText::_( 'COM_PHOCAGUESTBOOK_WARNING_SELECT_ITEM_UNPUBLISH' ) );
  512.                         }
  513.                         if(!$model->publish($entryid, $catid, $newState)) {
  514.                                 $app->enqueueMessage($newState ? JText::_( 'COM_PHOCAGUESTBOOK_ERROR_PUBLISH_ITEM' ) : JText::_( 'COM_PHOCAGUESTBOOK_ERROR_UNPUBLISH_ITEM' ));
  515.                         }
  516.                         else {
  517.                                 $app->enqueueMessage($newState ? JText::_( 'COM_PHOCAGUESTBOOK_SUCCESS_PUBLISH_ITEM') : JText::_( 'COM_PHOCAGUESTBOOK_SUCCESS_UNPUBLISH_ITEM'), 'success');
  518.                         }
  519.                 } else {
  520.                         $app->enqueueMessage(JText::_( 'COM_PHOCAGUESTBOOK_NOT_AUTHORIZED_DO_ACTION' ));
  521.                 }
  522.                                
  523.                 // Redirect
  524.                 $link   = 'index.php?option=com_phocaguestbook&task=phocaguestbook.guestbook&id='.$id.'&Itemid='.$itemid.'&start='.$limitstart;
  525.                 $link   = JRoute::_($link, false);
  526.                 $this->setRedirect ( $link);
  527.         }
  528.        
  529. }
  530. ?>


Тут есть текст Redirect, только я не знаю куда нужно ее вставить, вставлял в разные места не работает.

 

Powered by ExBB FM 1.0 RC1