':?/', // redirect to dashboard '!^/$!' => 'dashboard', // dashboard '!^/confirm/(.+)$!' => 'confirm', // confirm action (if javascript didn't work) '!^/log$!' => 'log', // modlog '!^/log/(\d+)$!' => 'log', // modlog '!^/users$!' => 'users', // manage users '!^/new_PM/([^/]+)$!' => 'new_pm', // create a new pm '!^/ban$!' => 'ban', // new ban '!^/IP/([\w.:]+)$!' => 'ip', // view ip address '!^/IP/([\w.:]+)/remove_note/(\d+)$!' => 'ip_remove_note', // remove note from ip address '!^/(\w+)/delete/(\d+)$!' => 'delete', // delete post // This should always be at the end: '!^/(\w+)/' . preg_quote($config['file_index'], '!') . '?$!' => 'view_board', '!^/(\w+)/' . str_replace('%d', '(\d+)', preg_quote($config['file_page'], '!')) . '$!' => 'view_board', '!^/(\w+)/' . preg_quote($config['dir']['res'], '!') . str_replace('%d', '(\d+)', preg_quote($config['file_page'], '!')) . '$!' => 'view_thread', ); if (!$mod) $pages = array('//' => 'login'); foreach ($pages as $uri => $handler) { if (preg_match($uri, $query, $matches)) { $matches = array_slice($matches, 1); if ($config['debug']) { $debug['mod_page'] = array( 'req' => $query, 'match' => $uri, 'handler' => $handler ); } if ($handler[0] == ':') { header('Location: ' . substr($handler, 1), true, $config['redirect_http']); } elseif (is_callable("mod_page_$handler")) { call_user_func_array("mod_page_$handler", $matches); } elseif (is_callable("mod_$handler")) { call_user_func_array("mod_$handler", $matches); } else { error("Mod page '$handler' not found!"); } exit; } } error($config['error']['404']);