<?php
/*
  ===============================================================

  inGenio X
  http://ingenio.area421.com

  Created by 
  Julian Moreno Hidalgo (Software developer)
  Jesus Moreno Hidalgo (Communication's tree)

  inGenio X is a free software licensed under CC-GNU GPL

  ===============================================================
*/

	// valor "1" en desarrollo y "0" en internet
	ini_set("display_errors", "0");

	// Attempt...
	define("IGNX", 1);

	// conex, config, login  global
	require("inc.global.php");

/******* CONFIGURACION  **********/

$titulo = INGENIO_NOMBRE." ".INGENIO_VERSION;
$archivo_php = $_SERVER['SCRIPT_NAME'];

/****** CONFIGURACION FIN ********/


	$cadena_get_comple = $_SERVER['QUERY_STRING'];
	$no_get = $cadena_get_comple == "" ? 1 : 0 ;
	$ig = $_GET;

	/* GET variables */
	if (isset($ig["php"])) { $phpvar = $ig["php"]; } else { $phpvar = ""; }
	if (isset($ig["gd"])) { $gdvar = $ig["gd"]; } else { $gdvar = ""; }
	if (isset($ig["ext"])) { $ext = $ig["ext"]; } else { $ext = ""; }

	/* funciones usadas */ 
	function phpinfo_contents( $str )
	{
        	$contentArr = preg_split( '~(\r\n|\r|\n)~', $str );
        
        	$extract = array();
        	$startCapture = false;
        
        	foreach ( $contentArr as $line )
        	{
            	$line = trim( $line );
            
            	if ( preg_match( '~^\<table~', $line ) )
            	{
                	$startCapture = true;
                	$extract[] = $line;
            	}
            	elseif ( preg_match( '~\</table\>~', $line ) )
           	 {
                	$startCapture = false;
                	$extract[] = $line;
            	}
            	elseif ( $startCapture && !empty( $line ) )
            	{
                	$extract[] = $line;
            	}
            	else
            	{
                	//skip
            	}
        	}
        
        	$extract = implode( "\n", $extract );
        
        	return $extract;
    	}
	/* FIN funciones usadas */
?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<?php echo '<meta http-equiv="content-type" content="text/html; charset='.CONFIG_2.'" />'; ?>
<title><?php echo $titulo; ?></title>
<?php include("inc.head.php"); ?>

<?php
	
	// se imprime el <style> de phpinfo() sin body{}, sin a{} ... y con las clases modificadas
	/*
	
	**** original CSS de phpinfo() ****
	
	body {background-color: #ffffff; color: #000000;}
	body, td, th, h1, h2 {font-family: sans-serif;}
	pre {margin: 0px; font-family: monospace;}
	a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
	a:hover {text-decoration: underline;}
	table {border-collapse: collapse;}
	.center {text-align: center;}
	.center table { margin-left: auto; margin-right: auto; text-align: left;}
	.center th { text-align: center !important; }
	td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
	h1 {font-size: 150%;}
	h2 {font-size: 125%;}
	.p {text-align: left;}
	.e {background-color: #ccccff; font-weight: bold; color: #000000;}
	.h {background-color: #9999cc; font-weight: bold; color: #000000;}
	.v {background-color: #cccccc; color: #000000;}
	.vr {background-color: #cccccc; text-align: right; color: #000000;}
	img {float: right; border: 0px;}
	hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
	
	*/
	
	if ($phpvar != "" && $phpvar == 1) {

		echo '<style type="text/css">
	h1, h2 {font-family: sans-serif;}
	pre {margin: 0px; font-family: monospace;}
	.center {text-align: center;}
	.center { margin-left: auto; margin-right: auto; text-align: left;}
	h1 {font-size: 150%;text-align: center;}
	h2 {font-size: 125%;text-align: center;}
	.p {text-align: left;}
	.e {background-color: #ccccff; font-weight: bold; color: #000000;}
	.h {background-color: #9999cc; font-weight: bold; color: #000000;}
	.v {background-color: #cccccc; color: #000000;}
	.vr {background-color: #cccccc; text-align: right; color: #000000;}
	hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
	.center table { margin-left: auto; margin-right: auto; text-align: left;}
	.center img {float: right; border: 0px;}
	.center td, th {font-family: sans-serif;border: 1px solid #000000;}
	.center th { text-align: center !important; }
			</style>';
	
	}
?>

</head>

<body>

<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td valign="top">

<?php include("inc.menu.php"); ?>

</td><td valign="top" width="100%">

<?php include("inc.copy.php"); ?>

<div class="contenido">

<div class="div_rotulo_top_sec">
<img class="img_icon_pag" src="../skins_admin/<?php echo substr($row_comp['skin_admin'],0,-4); ?>/imgs/icon_sistema.png" />
&nbsp;&nbsp;&nbsp;
<span class="rotulo_top_sec"><?php  echo LEN_ADMIN_62; ?></span>
</div>

<?php

	// botones de navegacion */
	echo '<a href="'.$archivo_php.'?php=1" class="conex_gral">PHP Info</a>';
	echo '&nbsp;&nbsp;<a href="'.$archivo_php.'?php=2" class="conex_gral">PHP Extensions</a>';
	echo '<br /><br />';


	if ($phpvar == 1) {

		ob_start();
        	phpinfo();
        	$content = ob_get_contents();
        	ob_end_clean();

        	echo phpinfo_contents( $content );
	
	} else if ($phpvar == 2) {

		// carga las extensiones de PHP //
		$extensions = @get_loaded_extensions();
        	echo '<strong>'.count($extensions).'</strong> PHP Extensions<br /><br />';
        	@sort($extensions);

        	foreach($extensions as $extension)
        	{
			// ancla de extension
			echo '<a name="anc_'.$extension.'"></a>'."\n";	
			echo $extension.' &nbsp; <a href="'.$archivo_php.'?php=2&ext='.$extension.'#anc_'.$extension.'" >PHP Extensions: Functions</a><br />'."\n";
            		if( $extension == $ext )
            		{
                		$functions = @get_extension_funcs($ext);
				@sort($functions);
				if( is_array($functions) )
				{
                    			echo '<ol>';
                    			foreach($functions as $function)
                    		{
                        		echo '<li>' . $function . '</li>';
                    		}
                    			echo '</ol>';
                		}
                		else
                		{
					// No hay funciones para esta PHP extension
					echo '<br /><span class="mensaje">- - -</span><br /><br />';
                		}
           	 	}
        	}
	
	} else if ($gdvar == 1) {
	
		$array = gd_info();
		foreach ($array as $key=>$val) {
	
		if ($val===true) {
			$val="(1) GD: OK";
		}
	
		if ($val===false) {
			$val="(0) - - -";
		}
		
		echo "$key: $val <br />\n";
	
		}
	
	}

?>

</div>

</td></tr></table>

</body>
</html>
<?php
	include("inc.fin.php");
?>