/** Reorder the $_FILES array. @autor jess@semlabs.co.uk http://www.php.net/manual/en/features.file-upload.multiple.php Uploading multiple files jess at semlabs dot co dot uk 03-Mar-2009 08:32 */ function reorder_files_array($files, $name = null, &$new = false, $path = false) { $names = array('name' => 'name', 'type' => 'type', 'tmp_name' => 'tmp_name', 'error' => 'error', 'size' => 'size'); foreach ($files as $key => &$part) { $key = (string) $key; if (in_array($key, $names)) { $name = $key; } if (!in_array($key, $names)) { $path[] = $key; } if (is_array($part)) { $part = reorder_files_array($part, $name, $new, $path); } elseif (!is_array($part)) { $current =& $new; foreach ($path as $p) { $current =& $current[$p]; } $current[$name] = $part; unset($path); $name = null; } } return $new; }
return array("controller" => $m[1], "action" => $m[2]); } if (preg_match("/^([a-z0-9_]+)\\/?.*\$/", $str_url, $m)) { return array("controller" => $m[1], "action" => "index"); } return array("controller" => "user", "action" => "login"); } // end function route(). if (empty($_GET)) { $_SERVER['QUERY_STRING'] = preg_replace('#^.*\\?#', '', $_SERVER['REQUEST_URI']); parse_str($_SERVER['QUERY_STRING'], $_GET); } $__in = array_merge($_COOKIE, $_GET, $_POST); $__in = array_merge(route($_SERVER['REQUEST_URI']), $__in); if ($_FILES) { $_FILES = reorder_files_array($_FILES); if (!is_array($_FILES)) { $_FILES = array(); } $__in = array_merge_recursive($_FILES, $__in); } /**< Stop post repetition */ if (ENABLE_POST_REPITITION_STOPPER) { if ($_SESSION['__POST_REPITITION_STOPPER_TIMESTAMP'] && $_SESSION['__POST_REPITITION_STOPPER_TIMESTAMP'] == $_POST['__POST_REPITITION_STOPPER_TIMESTAMP']) { $__in['action'] = 'index'; } if ($_POST['__POST_REPITITION_STOPPER_TIMESTAMP']) { $_SESSION['__POST_REPITITION_STOPPER_TIMESTAMP'] = $_POST['__POST_REPITITION_STOPPER_TIMESTAMP']; } if ($_GET['t']) { if ($_GET['t'] == $_SESSION['t']) {