if (isset($_POST[$indiceasociativo])) { $datos->addUsuario($var); } } foreach ($_SESSION['funcionalidadesSistema'] as &$var) { $indiceasociativo = str_replace(" ", "_", "ckbxF_" . $var . ""); if (isset($_POST[$indiceasociativo])) { $datos->addFuncionalidad($var); } } // ----------------------------------------- COMPROBACION DE ERRORES --------------------------------------------------------- try { if ($datos->PAG_nombre != $PAG_nombreAnt && Pagina::existePagina($datos->PAG_nombre)) { $_SESSION["error"] = 'ERR CLAVE P'; } else { if (!$datos->existeDirectorioUbicacion()) { $_SESSION["error"] = 'ERR DIRECTORIO'; } else { if ($_FILES["PAG_fichero"]["error"] != 4 && $_FILES["PAG_fichero"]["error"] != 0) { $_SESSION["error"] = 'ERR UPLOAD=>Error PHP UPLOAD CODE ' . $_FILES["PAG_fichero"]["error"] . ' -------> http://php.net/manual/es/features.file-upload.errors.php'; } } } /* Añadir tantos 'else if' como errores se quieran comprobar y en cada uno de ellos establecer el error producido */ } catch (Exception $e) { $_SESSION["error"] = $e->getMessage(); } if (isset($_SESSION["error"])) {
} } //Se agregan a la Pagina las funcionalidades que va a tener en funcion de los 'checks' del formulario foreach ($_SESSION['funcionalidadesSistema'] as &$var) { $indiceasociativo = str_replace(" ", "_", "ckbxF_" . $var . ""); if (isset($_POST[$indiceasociativo])) { $objeto->addFuncionalidad($var); } } // ----------------------------------------- COMPROBACION DE ERRORES --------------------------------------------------------- //Se comprueba errores en los datos try { if (Pagina::existePagina($objeto->PAG_nombre)) { $_SESSION["error"] = 'ERR CLAVE P'; } else { if (!$objeto->existeDirectorioUbicacion()) { $_SESSION["error"] = 'ERR DIRECTORIO'; } else { if ($_FILES["PAG_fichero"]["error"] > 0) { $_SESSION["error"] = 'ERR UPLOAD=>Error PHP UPLOAD CODE ' . $_FILES["PAG_fichero"]["error"] . ' -------> http://php.net/manual/es/features.file-upload.errors.php'; } else { if (!move_uploaded_file($_FILES["PAG_fichero"]["tmp_name"], explode('?', '../../..' . $objeto->PAG_ubicacion)[0])) { $_SESSION["error"] = 'ERR UPLOAD=>Error PHP move_uploaded_file(' . $_FILES["PAG_fichero"]["tmp_name"] . ' , ' . explode('?', $objeto->PAG_ubicacion)[0] . ')'; } } } } } catch (Exception $e) { $_SESSION["error"] = $e->getMessage(); } if (isset($_SESSION["error"])) {