Example #1
0
function WGProcMIME() {
	global $APPL;
		
	$MIME=WGLoadMIME();

	if (!$APPL['file']) FatalError("File name requested");
	$ext = strtolower($APPL['file']['extension']);

	if ($ext=='app') {
		$fi = WGParseFile($APPL['file']['path']);
		if ($fi===false or !$fi['D']) FatalError("Invalid application");
		$APPL['bin'] = $fi;
		$APPL['executor'] = $fi['w'];
		return;
		}


	$f=null;
	if (isset($MIME[$ext])) $f = $MIME[$ext];

	if (isset($f['r'])) {
		if (!isset($MIME[$f['r']])) FatalError("Invalid MIME redirector");
		$f=$MIME[$f['r']];
		}
		
	if ($f==null and isset($MIME['.def'])) $f=$MIME['.def'];
	if ($f==null) FatalError("Unsupported file type $ext");

	if (isset($f['dir']) or isset($f['fil'])) {
		$fi = WGParseFile($APPL['file']['path']);
		if ($fi===false) FatalError("Invalid file name");
		$APPL['bin'] = $fi;
		} else {
		if (isset($f['db'])) {
			$f=$f['db'];
			} else FatalError("Entry type not supported");	
		}

	if ($APPL['bin']['F']) {
			if (!isset($f['fil'])) FatalError("File type not supported");
			$f = $f['fil'];
			}
	if ($APPL['bin']['D']) {
			if (!isset($f['dir'])) FatalError("Directory type not supported");
			$f = $f['dir'];
		}

	$APPL['executor'] = "/bin/mime/".$f;	
	if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$APPL['excutor'])) FatalError("Exceutor not found `$f`");
	}
Example #2
0
File: dir.php Project: epto/webgui8
<?
	
$MIME=WGLoadMIME();

$po = WGParseFile($APPL['file']['path']);
if (!$po['D']) return;
$dh=opendir($po['f']);
if (!$dh) return;

Window($APPL['file']['filename'],'/img/form.gif','600','400');
$ls=array();
$ax=0;
$ld=array();  
 
$canUP=rtrim($APPL['file']['path'],'/');
$canUP=explode('/',$canUP);
$cx=count($canUP);

if ($cx>1) {
	$canUP[$cx-1]='';
	$canUP=implode('/',$canUP);
	$canUP=rtrim($canUP,'/');
	if (preg_match('/\\.dir$/',$canUP)==0) $canUP=false;
	} else $canUP=false;
     
if ($canUP) {
	$ld['0000']=array(
	    'i'	=>	'<img src="/bin/mime/ico/dir.gif">',
		'f'	=>	'..',
	    's'	=>	'-',
		'd'	=>	'Parent dir.',