示例#1
0
 /**
  * Save Source Feed form
  *
  * @return  void
  */
 public function saveTask()
 {
     //do a Request instead of a bind()
     $feed = new Models\Feeds();
     //get the URL first in order to validate
     $feed->set('url', Request::getVar('url'));
     $feed->set('name', Request::getVar('name'));
     $feed->set('id', Request::getVar('id'));
     $feed->set('enabled', Request::getVar('enabled'));
     $feed->set('description', Request::getVar('description'));
     //validate url
     if (!filter_var($feed->get('url'), FILTER_VALIDATE_URL)) {
         $this->feed = $feed;
         //redirect
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=feeds&task=new'), Lang::txt('COM_FEEDAGGREGATOR_ERROR_INVALID_URL'), 'warning');
     } else {
         if ($feed->store()) {
             // Output messsage and redirect
             App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller), Lang::txt('COM_FEEDAGGREGATOR_INFORMATION_UPDATED'));
         } else {
             App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller), Lang::txt('COM_FEEDAGGREGATOR_ERROR_UPDATE_FAILED'), 'warning');
         }
     }
 }