'Á' , 'É' => 'É' , 'Í' => 'Í' , 'Ó' => 'Ó' , 'Ú' => 'Ú' , 'Ñ' => 'Ñ' , 'á' => 'á' , 'é' => 'é' , 'í' => 'í' , 'ó' => 'ó' , 'ú' => '%uacute;' , 'ñ' => 'ñ' , '«' => '«' , '»' => '»' , '¿' => '¿' ); $sale=strtr( $entra , $traduce ); return $sale; } /* Recepcionar datos del formulario (POST) */ function getPostVar( $name, $defaultValue = '', $validar=true ) { $value = ''; if ( isset( $_POST[$name] ) && !empty( $_POST[$name] ) ) { $value = $_POST[$name]; } else { $value = $defaultValue; } if ( $validar ) { if ( is_Array( $value ) ) { foreach( $value as $currId=>$currCaption ) { $value[$currId]=strtoupper( trim( strip_tags( $currCaption ) ) ); } } else { $value = strtoupper( trim( strip_tags( $value ) ) ); } } return $value; } /* Recepcionar datos del formulario (GET) */ function getGetVar( $name, $defaultValue = '', $validar=true ) { $value = ''; if ( isset( $_GET[$name] ) && !empty( $_GET[$name] ) ) { $value = $_GET[$name]; } else { $value = $defaultValue; } if ( $validar ) { if ( is_Array( $value ) ) { foreach( $value as $currId=>$currCaption ) { $value[$currId]=strtoupper( trim( strip_tags( $currCaption ) ) ); } } else { $value = strtoupper( trim( strip_tags( $value ) ) ); } } return $value; } /* Recepcionar datos de los coockies (COOKIE) */ function getCookieVar( $name, $defaultValue = '' ) { $value = ''; if ( isset( $_COOKIE[$name] ) && !empty( $_COOKIE[$name] ) ) { $value = $_COOKIE[$name]; } else { $value = $defaultValue; } return $value; } function terminate( $extensionCode = 100, $errorText = '' ) { if ( $extensionCode == 100 ) { $reasonPhrase = 'Continue'; } elseif ( $extensionCode == 101 ){ $reasonPhrase = 'Switching Protocols'; } elseif ( $extensionCode == 200 ){ $reasonPhrase = 'OK'; } elseif ( $extensionCode == 201 ){ $reasonPhrase = 'Created'; } elseif ( $extensionCode == 202 ){ $reasonPhrase = 'Accepted'; } elseif ( $extensionCode == 203 ){ $reasonPhrase = 'Non-Authoritative Information'; } elseif ( $extensionCode == 204 ){ $reasonPhrase = 'No Content'; } elseif ( $extensionCode == 205 ){ $reasonPhrase = 'Reset Content'; } elseif ( $extensionCode == 206 ){ $reasonPhrase = 'Partial Content'; } elseif ( $extensionCode == 300 ){ $reasonPhrase = 'Multiple Choices'; } elseif ( $extensionCode == 301 ){ $reasonPhrase = 'Moved Permanently'; } elseif ( $extensionCode == 302 ){ $reasonPhrase = 'Found'; } elseif ( $extensionCode == 303 ){ $reasonPhrase = 'See Other'; } elseif ( $extensionCode == 304 ){ $reasonPhrase = 'Not Modified'; } elseif ( $extensionCode == 305 ){ $reasonPhrase = 'Use Proxy'; } elseif ( $extensionCode == 307 ){ $reasonPhrase = 'Temporary Redirect'; } elseif ( $extensionCode == 400 ){ $reasonPhrase = 'Bad Request'; } elseif ( $extensionCode == 401 ){ $reasonPhrase = 'Unathorized'; } elseif ( $extensionCode == 402 ){ $reasonPhrase = 'Payment Required'; } elseif ( $extensionCode == 403 ){ $reasonPhrase = 'Forbidden'; } elseif ( $extensionCode == 404 ){ $reasonPhrase = 'Not Found'; } elseif ( $extensionCode == 405 ){ $reasonPhrase = 'Method Not Allowed'; } elseif ( $extensionCode == 406 ){ $reasonPhrase = 'Not Aceptable'; } elseif ( $extensionCode == 407 ){ $reasonPhrase = 'Proxy Authentication Required'; } elseif ( $extensionCode == 408 ){ $reasonPhrase = 'Request Time-out'; } elseif ( $extensionCode == 409 ){ $reasonPhrase = 'Conflict'; } elseif ( $extensionCode == 410 ){ $reasonPhrase = 'Gone'; } elseif ( $extensionCode == 411 ){ $reasonPhrase = 'Lenght Required'; } elseif ( $extensionCode == 412 ){ $reasonPhrase = 'Precondition Failed'; } elseif ( $extensionCode == 413 ){ $reasonPhrase = 'Request Entity Too Large'; } elseif ( $extensionCode == 414 ){ $reasonPhrase = 'Request-URI Too Large'; } elseif ( $extensionCode == 415 ){ $reasonPhrase = 'Unsupported Media Type'; } elseif ( $extensionCode == 416 ){ $reasonPhrase = 'Requested range not satisfiable'; } elseif ( $extensionCode == 417 ){ $reasonPhrase = 'Expectation Failed'; } elseif ( $extensionCode == 500 ){ $reasonPhrase = 'Internal Server Error'; } elseif ( $extensionCode == 501 ){ $reasonPhrase = 'Not Implemented'; } elseif ( $extensionCode == 502 ){ $reasonPhrase = 'Bad Gateway'; } elseif ( $extensionCode == 503 ){ $reasonPhrase = 'Service Unavailable'; } elseif ( $extensionCode == 504 ){ $reasonPhrase = 'Gateway Time-out'; } elseif ( $extensionCode == 505 ){ $reasonPhrase = 'HTTP Version not supported'; } else { $reasonPhrase = 'Unknow'; } // header( "http/1.0 $extensionCode $reasonPhrase" ); // header( "Status: $extensionCode $reasonPhrase" ); echo ''; echo ''; echo "$extensionCode $reasonPhrase"; echo ''; echo ''; echo "

$extensionCode $reasonPhrase

"; if ( assert_options( ASSERT_ACTIVE ) ) { echo $errorText; } echo '

'.date( 'd-m-Y h:i:s' ) . ''; echo '
' //. $GLOBALS['HTTP_SERVER_VARS']['SERVER_SIGNATURE'] . '© HachaCorp 2007'; echo ''; die(); } function getDbError( $fatalError ) { return '

' . $fatalError->getMessage() . '

' . $fatalError->getDebugInfo(); } /** * Función de verificación para el método POST * * Verifica que existe una variable específica generada en POST * @abstract Verifica si un formulario ha sido procesado * @param string Nombre de la variable post a evaluar * @return bool true si la variable consultada existe y ha sido creada * en un formulario HTML y entregada vía POST. */ function checkPost( $button ) { return $_SERVER['REQUEST_METHOD'] == 'POST' && ( isset( $_POST[$button] ) || ( isset( $_POST[$button . '_x'] ) && ( isset( $_POST[$button . '_y'] ) ) ) ) ; } function checkGet( $button ) { return $_SERVER['REQUEST_METHOD'] == 'GET' && isset( $_GET[$button] ); } /** * Construye las opciones de un control SELECT desde un array * * Crea las opciones de un control SELECT, marcando la opción actual * seleccionada. * @abstract Crear un control HTML SELECT, a partir de un array * @param array Valores y etiquetas a ser almacenadas en los controles. * El array es asociativo, por lo que los valores son los índices y las * etiquetas, los textos a ser mostrados en el control select * @param value Valor actualmente seleccionado * @return string Código HTML de las opciones del control SELECT */ function selectList( $array, $value, $zeroLabel='' ) { $listResult = ''; $flag = false; if ( is_Array( $array ) ) { foreach( $array as $currId=>$currCaption ) { if ( empty( $currId ) ) { $flag = true; } $listResult .= '"; } if ( is_Array( $arrayPossible ) ) { foreach( $arrayPossible as $currId=>$currCaption ) { $listResult .= '