<?php
// $Id: core.php,v 1.1 2004/07/11 10:27:17 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Author      : <name> ( <url> )
// Additions by: <name> ( <url> )
// Licence     : <licence>: See /manual/LICENCES/<licence>.txt
// ------------------------------------------------------------------------- //


//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
class core_api {

	var $env;

	function core_api() {
	}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function getenv($var, $type='E') {

$types = explode(' ', $type);
$size  = count($types);

if ( !empty($size) ) {
	for ($i=0; $i<$size; $i++) {
		$sw = strtoupper($types[$i]);
		switch ($sw) {
			case 'G':
				global $HTTP_GET_VARS;
				return isset($HTTP_GET_VARS[$var]) ? $HTTP_GET_VARS[$var] : false;

			case 'P':
				global $HTTP_POST_VARS;
				return isset($HTTP_POST_VARS[$var]) ? $HTTP_POST_VARS[$var] : false;

			case 'C':
				global $HTTP_COOKIE_VARS;
				return isset($HTTP_COOKIE_VARS[$var]) ? $HTTP_COOKIE_VARS[$var] : false;

			case 'E':
				global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
				return isset($HTTP_SERVER_VARS[$var]) ? $HTTP_SERVER_VARS[$var] : $HTTP_ENV_VARS[$var];

			case 'F':
				global $HTTP_POST_FILES;
				return isset($HTTP_POST_FILES[$var]) ? $HTTP_POST_FILES[$var] : false;

			case 'S':
				global $HTTP_SESSION_VARS;
				return isset($HTTP_SESSION_VARS[$var]) ? $HTTP_SESSION_VARS[$var] : false;
		}
	}
}

return false;
}

//---------------------------------------------------------------------------------------//
}
?>
