<?php
//$langA checked
//
//		this file is used by index.php
//			it cannot be directly accessed

defined('WikyBlog') or die("Not an entry point...");


//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//

//Redirect to /index.php or set REDIRECT_URL
//$url = parse_url($_SERVER['REQUEST_URI']);
//PHP 4.3 fix from Chris Weiss 
if(wbStrpos('http://',$_SERVER['REQUEST_URI']) === false){
	$url = parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}else{
	$url = parse_url($_SERVER['REQUEST_URI']);
}


$pos = wbStrpos($url['path'],'/index.php');
if( $pos === false){
	$location = 'index.php';
	if( !empty($_SERVER['QUERY_STRING']) ){
		$location .= '?'.$_SERVER['QUERY_STRING'];
	}
	header('Location: '.$location);
	exit();
}

$url['path'] = wbSubstr($url['path'],$pos+10);
//$_SERVER['REDIRECT_URL'] = rawurldecode($url['path']); // does not decode plus symbols ('+') into spaces.
$_SERVER['REDIRECT_URL'] = urldecode($url['path']);


if( empty($_GET['WBRWLinks']) ){
	
	global $wbLinkPrefix;		//this doesn't fix links in templates..
	$wbLinkPrefix .= '/index.php';
	
	//message('Prefix: '.$wbLinkPrefix);
}
global $wbIndexPHP;
$wbIndexPHP = true;



doWikiThing();

