3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Gestiona información de tabla "Estaciones" * * Gestiona información de tabla "Estaciones". * Centraliza lo relativo a la gestión de estaciones y salas * El objetivo es centralizar las distintas tareas e informaciones en una única * aplicación web, o que de ésta se invoquen las otras disponibles. * * @author Héctor Correa * @version 2 * Comienzo 2017 */ require_once 'gryt_config.php'; require (RUTA_LIBPHP.'/Classes/GRYT/class_estaciones.php'); require (RUTA_LIBPHP.'/Classes/GRYT/class_estaciones_excel.php'); require_once 'gryt_setupSmarty.php'; require_once 'gryt_funcs4devel.php'; // Funciones útiles para depurar el código en la etapa de desarrollo $_Version = '2'; $_Cambios = '09/02/2018'; // Tomo la solicitud enviada por la página $_opcion = !isset($_REQUEST['opcion']) ? 'por defecto' : $_REQUEST['opcion']; // diferencia que información se desplegará en en la caja de información de la estación $_caso = !isset($_REQUEST['caso']) ? null : $_REQUEST['caso']; // Fijando parámetros para cada campo de filtrado $_unidad = !isset($_REQUEST['unidad']) ? null : $_REQUEST['unidad']; $_departamento = !isset($_REQUEST['departamento']) ? null : $_REQUEST['departamento']; $_codigo = !isset($_REQUEST['codigotx']) ? null : $_REQUEST['codigotx']; $_estacion = !isset($_REQUEST['estacion']) ? null : $_REQUEST['estacion']; $_id_telelink = !isset($_REQUEST['idtelelink']) ? null : $_REQUEST['idtelelink']; $_tipo_edificio = !isset($_REQUEST['tipoedificio']) ? null : $_REQUEST['tipoedificio']; $_IDE = !isset($_REQUEST['esIDEstacion']) ? null : $_REQUEST['esIDEstacion']; $_Dir = !isset($_REQUEST['esDireccion']) ? null : $_REQUEST['esDireccion']; $_Clo = !isset($_REQUEST['esCoord_Abs_Longitud'])? null : $_REQUEST['esCoord_Abs_Longitud']; $_Cla = !isset($_REQUEST['esCoord_Abs_Latitud']) ? null : $_REQUEST['esCoord_Abs_Latitud']; $_TelB = !isset($_REQUEST['esTelefoniaB']) ? 'NO' : $_REQUEST['esTelefoniaB']; $_Trsms = !isset($_REQUEST['esTransmisiones']) ? 'NO' : $_REQUEST['esTransmisiones']; $_Agrcn = !isset($_REQUEST['esAgregacion']) ? 'NO' : $_REQUEST['esAgregacion']; $_Tel = !isset($_REQUEST['esTelefono']) ? null : $_REQUEST['esTelefono']; $_UTE = !isset($_REQUEST['esCuentaUTE']) ? null : $_REQUEST['esCuentaUTE']; $_Sec = !isset($_REQUEST['esSeccionalPolicial']) ? null : $_REQUEST['esSeccionalPolicial']; $_Bom = !isset($_REQUEST['esBomberos']) ? null : $_REQUEST['esBomberos']; $_Not = !isset($_REQUEST['esNota']) ? null : $_REQUEST['esNota']; $_PuertosCx = !isset($_REQUEST['esPuertosCx']) ? null : $_REQUEST['esPuertosCx']; $_Zona = !isset($_REQUEST['zona']) ? null : $_REQUEST['zona']; $_TipoEd = !isset($_REQUEST['tipoed']) ? null : $_REQUEST['tipoed']; // Parametros de jTable para paginar y ordenar la consulta $_jtParam = array(); $_jtParam[0]= !isset($_REQUEST['jtSorting']) ? 'esUnidad ASC, esEstacion ASC' : $_REQUEST['jtSorting']; $_jtParam[1]= !isset($_REQUEST['jtStartIndex']) ? 0 : $_REQUEST['jtStartIndex']; $_jtParam[2]= !isset($_REQUEST['jtPageSize']) ? 1000 : $_REQUEST['jtPageSize']; function throw_ex($ex) { throw new Exception($ex); }try{ /** * Acciones del script Estaciones * * @param string $_opcion * * actualizar, crear, borrar, listado, cargar, complemento, telelink, ubicacion, excel * default es cargar la página inicial de Estaciones */ switch ($_opcion){ // Actualizar valores en registros case 'actualizar': { /* $sSQL = 'UPDATE '.ESTACION.' SET ' .'esDepartamento ' .' = "' .$_Dep .'", ' .'esUnidad ' .' = "' .$_Uni .'", ' .'esCodigo ' .' = "' .$_Cod .'", ' .'esEstacion ' .' = "' .$_Est .'", ' .'esDireccion ' .' = "' .$_Dir .'", ' .'esCoord_Abs_Longitud ' .' = "' .$_Clo .'", ' .'esCoord_Abs_Latitud ' .' = "' .$_Cla .'", ' .'esTipoEdificacion ' .' = "' .$_Ted .'", ' .'esTelefoniaB ' .' = "' .$_TelB .'", ' .'esTransmisiones' .' = "' .$_Trsms .'", ' .'esAgregacion' .' = "' .$_Agrcn .'", ' .'esTelefono ' .' = "' .$_Tel .'", ' .'esCuentaUTE ' .' = "' .$_UTE .'", ' .'esSeccionalPolicial ' .' = "' .$_Sec .'", ' .'esBomberos ' .' = "' .$_Bom .'", ' .'esNota ' .' = "' .$_Not .'", ' .'esIDTelelink ' .' = "' .$_IDTelelink .'", ' .'esPuertosCx ' .' = "' .$_PuertosCx .'" ' .'WHERE esIDEstacion = ' .$_IDE .';'; $_dbLink = conectarBD(); $result = mysqli_query ($_dblink ,$sSQL) or throw_ex( " ACTUALIZANDO "."<br><br>". mysqli_error($_dblink )."<br><br>".$sSQL); mysqli_free_result($result); mysqli_close($_dblink ); //Return result to jTable $jTableResult = array(); $jTableResult['Result'] = "OK"; print json_encode($jTableResult); break; */ } // Crear nuevos registros case 'crear': { /* $sSQL = 'INSERT INTO '.ESTACION.' ('; .'esDepartamento, esUnidad, esCodigo, esEstacion, esDireccion, ' .'esCoord_Abs_Longitud, esCoord_Abs_Latitud, esTipoEdificacion, ' .'esTelefono, esCuentaUTE, esSeccionalPolicial, esBomberos, esNota, esIDTelelink, esPuertosCx) ' .'VALUES ("'.$_Dep.'", "'.$_Uni.'", "'.$_Cod.'", "'.$_Est.'", "' .$_Dir.'", "'.$_Clo.'", "'.$_Cla.'", "'.$_Ted.'", "'.$_Tel.'", "' .$_UTE.'", "'.$_Sec.'", "'.$_Bom.'", "'.$_Not.'", "'.$_IDTelelink.'", "'.$_PuertosCx.'");'; $_dblink = conectarBD(); $result = mysqli_query ($_dblink ,$sSQL) or throw_ex( ' CREANDO '.'<br /><br />'.mysqli_error($_dblink ).'<br /><br />'.$sSQL); // Obtiene el último registro ingresado para devolverlo a jTable $result = mysqli_query($_dblink ,'SELECT * FROM '.ESTACION.' WHERE esIDEstacion = LAST_INSERT_ID();'); $row = mysqli_fetch_array($result); mysqli_free_result($result); mysqli_close($_dblink ); // Devuelve los resultados a jTable $jTableResult = array(); $jTableResult['Result'] = 'OK'; $jTableResult['Record'] = $row; print json_encode($jTableResult); break; */ } // Borrar un registro case "borrar": { /* $sSQL = "DELETE FROM ".ESTACION." WHERE esIDEstacion = ".$_IDE.";"; $result = mysqli_query($_dblink ,$sSQL) or throw_ex( " BORRANDO "."<br><br>". mysqli_error($_dblink )."<br><br>".$sSQL); break; */ } case 'listado': { $smarty = new Smarty_GRYT(); $smarty-> caching = false; $smarty-> assign('RutaApp','../../../GRYT/'); $smarty-> assign('Nivel',$_SESSION['Nivel']); $smarty-> assign('Unidad',$_unidad); $smarty-> assign('Departamento',$_departamento); $smarty-> assign('Estacion',$_estacion); $smarty-> assign('TipoEd',$_tipo_edificio); $smarty-> assign('IdTelelink',$_id_telelink); $smarty-> assign('Codigo',$_codigo); $smarty-> display('estaciones_lista.tpl'); break; } // Cargar lista de registros por defecto. Equivalente a action=list case 'cargar': { // CondicionesDeFiltrado $_opciones_filtro = 'ID Estacion: ' .$_IDE .' Nombre: ' .$_estacion .' Unidad:' .$_unidad .' Departamento: ' .$_departamento .' Tipo de edificio: ' .$_tipo_edificio .' Id de Telelink: ' .$_id_telelink .' Código Tx: ' .$_codigo; guardarLOGaFichero('Estaciones', 'cargar:', $_opciones_filtro, 'DEBUG'); $_nodos = new Estacion; if (isset($_IDE)) { $_nodos-> set_ID_Estacion($_IDE); }else{ $_nodos-> set_Nombre_Estacion($_estacion); $_nodos-> set_Unidad($_unidad); $_nodos-> set_Departamento($_departamento); $_nodos-> set_Tipo_Edificio($_tipo_edificio); $_nodos-> set_ID_Telelink($_id_telelink); $_nodos-> set_Codigo_Tx($_codigo); $_nodos-> set_Orden($_jtParam); } $_nodos-> get(); print $_nodos->datos_json; break; } case 'complemento': { $_nodos = new Estacion; $smarty = new Smarty_GRYT(); // Crea las opciones que aparecerán en los combos del filtro $smarty-> caching = false; $_nodos->obtUnidades(); $smarty->assign('Zonas', ($_nodos->crearOptions())); $_nodos->obtDepartamentos(); $smarty->assign('Departamentos', ($_nodos->crearOptions())); $_nodos->obtTiposDeEdificio(); $smarty->assign('TiposEdificio', ($_nodos->crearOptions())); $smarty-> assign('Unidad',$_SESSION['Unidad']); $smarty-> assign('Usuario',$_SESSION['CedUsr']); $smarty-> assign('RutaApp',"../../../GRYT/"); $smarty-> assign('Version', $_Version); $smarty-> assign('Cambios', $_Cambios); $smarty-> assign('RutaApp','../../../GRYT/'); $smarty-> assign('Nivel',$_SESSION['Nivel']); $smarty-> assign('Unidad',$_unidad); $smarty-> assign('Departamento',$_departamento); $smarty-> assign('Estacion',$_estacion); $smarty-> assign('TipoEd',$_tipo_edificio); $smarty-> assign('IdTelelink',$_id_telelink); $smarty-> assign('Codigo',$_codigo); $smarty-> display('estaciones_main.tpl'); break; } case 'ubicacion': { $jTableResult = array(); $jTableResult =listarUNAestacion($_IDE); print json_encode($jTableResult); break; } case 'excel': { $_nodos = new Estacion; if (isset($_IDE)) { $_nodos-> set_ID_Estacion($_IDE); }else{ $_nodos-> set_Nombre_Estacion($_estacion); $_nodos-> set_Unidad($_unidad); $_nodos-> set_Departamento($_departamento); $_nodos-> set_Tipo_Edificio($_tipo_edificio); $_nodos-> set_ID_Telelink($_id_telelink); $_nodos-> set_Codigo_Tx($_codigo); } $_nodos-> get(); $_planilla = new ListaEstacion(); $_planilla->subtitulo = 'De prueba'; $_planilla->datos = $_nodos->datos_crudos; $_planilla->construirPlanilla(); break; } case 'datosEstacion': { $_nodos = new Estacion; $_nodos-> set_ID_Estacion($_IDE); $_nodos-> get(); switch ($_caso) { case 'telefonos': { print ($_nodos->obtCamposDeTelefonos()); break; } default: { print ($_nodos->obtCamposDeDatos()); } } break; } default: { $smarty = new Smarty_GRYT(); $smarty-> assign('Unidad',$_SESSION['Unidad']); $smarty-> assign('Nivel',$_SESSION['Nivel']); $smarty-> caching = false; $smarty-> assign('RutaApp',"../../../GRYT/"); $smarty-> assign('Version', $_Version); $smarty-> assign('Cambios', $_Cambios); $smarty-> display('estaciones.tpl'); break; } } } catch(Exception $ex) { // Registra la ocurrencia de un error $ex .= chr(9).chr(10). $_SESSION['Usuario']; guardarLOGaFichero('Log de Errores', 'estaciones.php', $ex, 'ERROR'); echo $ex; }
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: require_once(): open_basedir restriction in effect. File(gryt_config.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KolN4 on line 15 Warning: require_once(gryt_config.php): Failed to open stream: Operation not permitted in /in/KolN4 on line 15 Fatal error: Uncaught Error: Failed opening required 'gryt_config.php' (include_path='.:') in /in/KolN4:15 Stack trace: #0 {main} thrown in /in/KolN4 on line 15
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: require_once(): open_basedir restriction in effect. File(gryt_config.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KolN4 on line 15 Warning: require_once(gryt_config.php): Failed to open stream: Operation not permitted in /in/KolN4 on line 15 Fatal error: Uncaught Error: Failed opening required 'gryt_config.php' (include_path='.:') in /in/KolN4:15 Stack trace: #0 {main} thrown in /in/KolN4 on line 15
Process exited with code 255.
Output for 8.0.13
Warning: require_once(gryt_config.php): Failed to open stream: No such file or directory in /in/KolN4 on line 15 Fatal error: Uncaught Error: Failed opening required 'gryt_config.php' (include_path='.:') in /in/KolN4:15 Stack trace: #0 {main} thrown in /in/KolN4 on line 15
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: require_once(gryt_config.php): failed to open stream: No such file or directory in /in/KolN4 on line 15 Fatal error: require_once(): Failed opening required 'gryt_config.php' (include_path='.:') in /in/KolN4 on line 15
Process exited with code 255.
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(gryt_config.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KolN4 on line 15 Warning: require_once(gryt_config.php): failed to open stream: Operation not permitted in /in/KolN4 on line 15 Fatal error: require_once(): Failed opening required 'gryt_config.php' (include_path='.:') in /in/KolN4 on line 15
Process exited with code 255.

preferences:
224.45 ms | 403 KiB | 290 Q