Example #1
0
 /**
  * Method to remove the root property from the configuration.
  *
  * @return  bool  True on success, false on failure.
  */
 public function removerootTask()
 {
     // Check for request forgeries.
     \Session::checkToken('get');
     // Check if the user is authorized to do this.
     if (!User::authorise('core.admin')) {
         App::redirect(Route::url('index.php', false), Lang::txt('JERROR_ALERTNOAUTHOR'));
         return;
     }
     // Initialise model.
     $model = new Models\Application();
     // Attempt to save the configuration and remove root.
     $return = $model->removeroot();
     // Check the return value.
     if ($return === false) {
         // Save failed, go back to the screen and display a notice.
         App::redirect(Route::url('index.php', false), Lang::txt('JERROR_SAVE_FAILED', $model->getError()), 'error');
         return;
     }
     // Set the redirect based on the task.
     App::redirect(Route::url('index.php', false), Lang::txt('COM_CONFIG_SAVE_SUCCESS'));
 }