Exemple #1
0
    //  Site won't and don't work if this file ain't included, yo..
	require_once $root . '/application/core/functions.php';

    //	We've done as much as we can without connecting to the database
	$db_cnx = db_connect();

	//	Handle routes
	require_once $root . '/application/core/routes.php';

	//	Where's the content coming from, then?
	$content_file = $root . '/application/views/' . $controller . '/' . $action . '.php';

	//	Has anything been posted?
	if (!empty($_POST)) {
		$post_values = clean_post_values($_POST);
	}

	//	Get the model, if there is one
	$model_file = $root . '/application/models/' . $controller . '.php';

	if (file_exists($model_file)) {
		require_once $model_file;
	}

	//	Get section specific functions
	$functions_file = $root . '/application/controllers/' . $controller . '.php';

	if (file_exists($functions_file)) {
		require_once $functions_file;
	}
Exemple #2
0
	function clean_post_values($values)
	{

		if ($values) {
		    $cleaned = array();

			foreach ($values as $key => $val) {
				if (is_array($val)) {
					$cleaned[$key] = clean_post_values($val);
				}
				else {
					$cleaned[$key] = stripslashes($val);
				}
			}

			return $cleaned;
		}

	}