shell bypass 403
<?
App::uses('PrivateController', 'Controller');
class PrivateNoticiasCategoriasController extends PrivateController {
public function beforeFilter() {
parent::beforeFilter();
array_push($this->uses, 'NoticiaCategoria');
}
public function home() {
//die;
//Generamos el filtro...
$filtro = array(
'nombre' => null,
);
$this->set('filtro', $filtro);
$this->getListado('NoticiaCategoria', 20, array("NoticiaCategoria.nombre_$this->idioma" => 'ASC'), $this->getConditionsFiltro($filtro, array(), 'NoticiaCategoria'));
$this->renderView();
}
public function add() {
if ($this->request->is('post')) {
$this->NoticiaCategoria->create();
unset($this->request->data['NoticiaCategoria']['id']); //campos que no son modificables por el usuario
// $this->miUnset($this->request->data['NoticiaCategoria'], array('seo'));
if ($this->NoticiaCategoria->save($this->request->data)) {
$this->Session->setFlash('Categoría añadida con éxito.' . $this->btnClose, 'default', array('class' => 'alert alert-success'));
$this->redirect(array('controller' => 'private_noticias_categorias', 'action' => 'edit', 'id' => $this->NoticiaCategoria->id));
} else {
$this->errores = $this->NoticiaCategoria->validationErrors;
}
}
$this->renderView();
}
public function edit() {
$this->NoticiaCategoria->id = $this->params->id;
if (!$this->NoticiaCategoria->exists()) {
$this->Session->setFlash('Categoría no encontrada.' . $this->btnClose, 'default', array('class' => 'alert alert-danger'));
$this->redirect(array('controller' => 'private_noticias_categorias', 'action' => 'home'));
}
$categoria = $this->NoticiaCategoria->findById($this->NoticiaCategoria->id);
if ($this->request->is('put')) {
unset($this->request->data['NoticiaCategoria']['id']); //campos que no son modificables por el usuario
//$this->miUnset($this->request->data['NoticiaCategoria'], array('seo'));
if ($this->NoticiaCategoria->save($this->request->data)) {
$this->Session->setFlash('Categoría actualizada con éxito.' . $this->btnClose, 'default', array('class' => 'alert alert-success'));
$this->redirect(array('controller' => 'private_noticias_categorias', 'action' => 'edit', 'id' => $this->NoticiaCategoria->id, 'tab' => $this->params->tab));
} else {
$this->errores = $this->NoticiaCategoria->validationErrors;
}
} else {
$this->request->data = $categoria;
}
$this->set('categoria', $categoria);
$this->renderView();
}
public function delete() {
$this->NoticiaCategoria->id = $this->params->id;
if (!$this->NoticiaCategoria->exists()) {
$this->Session->setFlash('Categoría no encontrada.' . $this->btnClose, 'default', array('class' => 'alert alert-danger'));
$this->redirect(array('controller' => 'private_noticias_categorias', 'action' => 'home'));
}
if ($this->NoticiaCategoria->delete()) {
$this->Session->setFlash('Categoría eliminada con éxito.' . $this->btnClose, 'default', array('class' => 'alert alert-success'));
} else {
$this->Session->setFlash('La categoría no pudo ser eliminada.' . $this->btnClose, 'default', array('class' => 'alert alert-danger'));
}
$this->redirect(array('controller' => 'private_noticias_categorias', 'action' => 'home'));
}
}