"mmtemplates/utilities/eventsfeed.php", "~^productions/([^/]+)/?~i" => "mmtemplates/eto/production-view.php", // category "~^tour-dates/([^/]+)/?~i" => "mmtemplates/eto/season-view.php", ); $route_exclusions = array( ); $is_excluded_route = false; foreach($route_exclusions as $exclusion){ if(stripos($request, $exclusion) !== FALSE){ $is_excluded_route = true; break; } } if(!$is_excluded_route){ // Try and match routes foreach( $routes as $match => $route ) { $matches = array(); if( preg_match( $match, $request, $matches ) ) { include( $route ); //$cache->end(); die(); } } } unset($routes); // Try and find page matching the URL path part $split = explode("/", rtrim($request,'/')); $db = new db_object(); // Get homepage ID $request_config = new config_object(); $page_id = $request_config->home_id(); $count = 0; $error = false; $request = "/".$request; if(substr($request, -1) != "/"){ $request.= "/"; } // You end up with '//' for some reason $request = str_replace('//', '/', $request); // If auto-RSS is enabled, trim /rss from the URL if( $request_config->allow_rss_requests(false) ) { if( strripos( $request, 'rss' ) == strlen($request)-4 ) { $request = substr($request, 0, -4 ); } } $query = sprintf("SELECT * FROM tree WHERE full_url = '%s'", mysql_real_escape_string($request), intval($page_id)); $db->exec($query); if(mysql_num_rows($db->result)){ $db->fetch_record(); $page_id = $db->fields["id"]; }else{ if( is_numeric( $split[$count] ) ) { $pageoffset = $split[$count]; } else { $error = true; } } // Show RSS Page if( $request_config->allow_rss_requests(false) ) { if(!$error && end($split) == 'rss') { $tree = new tree_object(); $tree->fetch_page($page_id); // Is custom field set? if($tree->get_custom_field("redirect_to")){ $id = $tree->get_custom_field("redirect_to"); $tree = new tree_object(); $tree->fetch_page($id); header("Location: ".$tree->href(), true, 301); exit(); } include( 'mmtemplates/utilities/rss.php' ); return; } } unset( $request_config ); require "mmsys/core/component.php"; $site_config = new config_object(); // If we didnt error, load the page if( !$error ) { $tree = new tree_object(); $tree->fetch_page($page_id); // Is custom field set? if($tree->get_custom_field("redirect_to")){ $id = $tree->get_custom_field("redirect_to"); $tree = new tree_object(); $tree->fetch_page($id); header("Location: ".$tree->href(), true, 301); exit(); } // Which template should be included? $override_id = $page_id; if($override_id){ include( substr($tree->fields['path'], 1) ); }else{ header("HTTP/1.0 404 Not Found"); include( "mmtemplates/errors/404.php" ); } } else { header("HTTP/1.0 404 Not Found"); include( "mmtemplates/errors/404.php" ); } //$cache->end(); ?>