function sanitize_uri()
{
    global $PATH_INFO, $SCRIPT_NAME, $REQUEST_URI;
    if (isset($PATH_INFO) && $PATH_INFO != "") {
        $SCRIPT_NAME = $PATH_INFO;
        $REQUEST_URI = "";
    }
    if ($REQUEST_URI == "") {
        //necessary for some IIS installations (CGI in particular)
        $get = httpallget();
        if (count($get) > 0) {
            $REQUEST_URI = $SCRIPT_NAME . "?";
            reset($get);
            $i = 0;
            while (list($key, $val) = each($get)) {
                if ($i > 0) {
                    $REQUEST_URI .= "&";
                }
                $REQUEST_URI .= "{$key}=" . URLEncode($val);
                $i++;
            }
        } else {
            $REQUEST_URI = $SCRIPT_NAME;
        }
        $_SERVER['REQUEST_URI'] = $REQUEST_URI;
    }
    $SCRIPT_NAME = substr($SCRIPT_NAME, strrpos($SCRIPT_NAME, "/") + 1);
    if (strpos($REQUEST_URI, "?")) {
        $REQUEST_URI = $SCRIPT_NAME . substr($REQUEST_URI, strpos($REQUEST_URI, "?"));
    } else {
        $REQUEST_URI = $SCRIPT_NAME;
    }
}
                     $modules = array();
                 }
             }
             reset($modules);
             while (list($key, $module) = each($modules)) {
                 $content = wizard_scanfile("modules/{$module}.php");
                 wizard_insertfile($content, $languageschema);
             }
         }
     }
     if (get_module_setting("translationdelete")) {
         if (httpget('op') == "uninstall") {
             $get = rawurlencode(serialize(httpallget()));
             require_once "./modules/translationwizard/deleteuninstalled.php";
         } elseif (httpget('op') == "mass" && httppost("uninstall")) {
             $get = rawurlencode(serialize(httpallget()));
             $post = rawurlencode(serialize(httpallpost()));
             require_once "./modules/translationwizard/deleteuninstalled.php";
         }
     }
     break;
     /*case "footer-modules":
     		output_notl("Get:");
     		debug(httpallget());
     	break;
     	*/
 /*case "footer-modules":
 		output_notl("Get:");
 		debug(httpallget());
 	break;
 	*/
function module_do_event($type, $module, $allowinactive = false, $baseLink = false)
{
    global $navsection;
    if ($baseLink === false) {
        global $PHP_SELF;
        $baseLink = substr($PHP_SELF, strrpos($PHP_SELF, "/") + 1) . "?";
    } else {
        //debug("Base link was specified as $baseLink");
        //debug(debug_backtrace());
    }
    // Save off the mostrecent module since having that change can change
    // behaviour especially if a module calls modulehooks itself or calls
    // library functions which cause them to be called.
    if (!isset($mostrecentmodule)) {
        $mostrecentmodule = "";
    }
    $mod = $mostrecentmodule;
    $_POST['i_am_a_hack'] = 'true';
    if (injectmodule($module, $allowinactive)) {
        $oldnavsection = $navsection;
        tlschema("module-{$module}");
        $fname = $module . "_runevent";
        $fname($type, $baseLink);
        tlschema();
        //hook into the running event, but only in *this* running event, not in all
        modulehook("runevent_{$module}", array("type" => $type, "baselink" => $baseLink, "get" => httpallget(), "post" => httpallpost()));
        //revert nav section after we're done here.
        $navsection = $oldnavsection;
    }
    $mostrecentmodule = $mod;
}