Esempio n. 1
0
 public function makemainurl()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // find and store edited item id
     $cid = JRequest::getVar('cid', array(0), 'default', 'array');
     // check invalid data
     if (!is_array($cid) || count($cid) != 1 || intval($cid[0]) == 0) {
         $redirect = array('c' => "duplicates", 'tmpl' => 'component', 'cid[]' => JRequest::getInt('mainurl_id'));
         $this->setRedirect($this->_getDefaultRedirect($redirect), JText16::_('COM_SH404SEF_SELECT_ONE_URL'), 'error');
         // send back response through default view
         $this->display();
     }
     // now make that url the main url
     // while also setting the previous
     // with this url current rank
     // get the model to do it, actually
     // Get/Create the model
     if ($model =& $this->getModel($this->_defaultModel, 'Sh404sefModel')) {
         // store initial context in model
         $model->setContext($this->_context);
         // call the delete method on our list
         $model->makeMainUrl(intval($cid[0]));
         // check errors and enqueue them for display if any
         $errors = $model->getErrors();
         if (!empty($errors)) {
             $this > enqueuemessages($errors, 'error');
         }
     }
     // send back response through default view
     $this->display();
 }
Esempio n. 2
0
 public function confirmed()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // find and store edited item id
     $cid = JRequest::getVar('cid', array(0), 'default', 'array');
     // check invalid data
     if (!is_array($cid) || count($cid) < 1 || $cid[0] == 0) {
         $this->setRedirect($this->_getDefaultRedirect(), JText16::_('COM_SH404SEF_SELECT_ALIAS'));
     }
     // now perform alias deletion
     // get the model to do it, actually
     // Get/Create the model
     if ($model =& $this->getModel($this->_defaultModel, 'Sh404sefModel')) {
         // store initial context in model
         $model->setContext($this->_context);
         // call the delete method on our list
         $model->deleteByIds($cid);
         // check errors and enqueue them for display if any
         $errors = $model->getErrors();
         if (!empty($errors)) {
             $this > enqueuemessages($errors, 'error');
             // clear success message, as we have just queued some error messages
             $status = '';
         }
     }
     // send back response through default view
     $this->display();
 }