<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to index.php</title><link>https://sourceforge.net/p/nononsencephp/wiki/index.php/</link><description>Recent changes to index.php</description><atom:link href="https://sourceforge.net/p/nononsencephp/wiki/index.php/feed" rel="self"/><language>en</language><lastBuildDate>Sat, 20 Oct 2012 11:22:02 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/nononsencephp/wiki/index.php/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage index.php modified by &lt;REDACTED&gt;</title><link>https://sourceforge.net/p/nononsencephp/wiki/index.php/</link><description>~~~~~
&lt;?php
error_reporting(0);
$default = 'controller/welcome.php';

// include header
if (file_exists('view/header.php')) {
	include('view/header.php');
}
// include navigation
if (file_exists('view/navigation.php')) {
	include('view/navigation.php');
}

// index.php == 9 characters
$location = substr($_SERVER['SCRIPT_NAME'], 0, -9);
// Entry point for application
$location_size = strlen($location);

// Get full URI
$uri = $_SERVER['REQUEST_URI'];
$route = substr($uri,$location_size);

// Turn Arguments into an array
$reqs = explode('/', $route);

/* Get number of arguments
1 = Controller
2 = Function (else index)
3+ = Arguments
*/
$num_args = sizeof($reqs);

$controller = 'controller/' . $reqs[0] . '.php';

if ($location == $uri) {
	/* on index page*/
	include($default);
} else {

// Load Controller (classes)
if (file_exists($controller)) {
	include($controller);
} else {
	include('notfound.php');
}

$controller_name = $reqs[0];

// Instantiate Controller
$$controller_name = new $controller_name();

if ($num_args == 1) {
	$$controller_name-&gt;index();
} else if ($num_args == 2) {
	$function_name = $reqs[1];
	$$controller_name-&gt;$function_name();
} else {
	$function_name = $reqs[1];
	// size of arguments array
	$arguments = $num_args - 2;
	
	// Put arguments into temporary array
	$arg_array = array();
	for ($i=2;$i&lt;$num_args;$i++) {
		array_push($arg_array, $reqs[$i]);
	}
	
	if ($arguments == 1) {
		$$controller_name-&gt;$function_name($arg_array[0]);
	} else if ($arguments == 2) {
		$$controller_name-&gt;$function_name($arg_array[0], $arg_array[1]);
	}

}

}

if (file_exists('view/footer.php')) {
	include('view/footer.php');
}


?&gt;
~~~~~</description><pubDate>Sat, 20 Oct 2012 11:22:02 -0000</pubDate><guid>https://sourceforge.netb790edc0462d61ce1eab98b1e38d14d1dafe304b</guid></item></channel></rss>