function redirectToUrlIfNecessary()
{
    $pageCompleteName = stripslashesPmv($_GET['pagename']);
    if (isset($_GET['url']) && $_GET['url'] != "") {
        $pageUrl = stripslashesPmv($_GET['url']);
    } else {
        $pageUrl = null;
    }
    //	if(substr($pageCompleteName, 0, 5) == PREFIX_FILES)
    if (isPrefixTag($pageCompleteName)) {
        if (DEBUG) {
            printDebug("=====================<br>Header() to file to download<br>=====================");
        } else {
            if ($pageUrl != null) {
                if (defined(PMV_REWRITE_MODE) && PMV_REWRITE_MODE == 'PEAR_REQUEST') {
                    // Debut version PEAR
                    setIncludePath();
                    require_once INCLUDE_PATH . "/libs/Request/Request.php";
                    $a =& new HTTP_Request(str_replace("&amp;", "&", $pageUrl));
                    $a->sendRequest();
                    foreach ($a->getResponseHeader() as $key => $value) {
                        if ($key != "transfer-encoding") {
                            // IE does not support this parameter
                            header($key . ": " . $value);
                        }
                    }
                    $cookies = $a->getResponseCookies();
                    if ($cookies) {
                        foreach ($cookies as $value) {
                            setCookieFromPear($value);
                        }
                    }
                    print $a->getResponseBody();
                    exit;
                    // Fin version PEAR
                } else {
                    header('Location:' . str_replace("&amp;", "&", $pageUrl), false, 302);
                    exit;
                }
            } else {
                trigger_error("Error : There is no url to redirect", E_USER_ERROR);
            }
            exit;
        }
    }
}
/**
 * get a variable from the $_REQUEST superglobal
 * 
 * it tests the var type and exit if the variable doesn't have default value and
 * if the type doesn't match
 * 
 * @param string $varName name of the variable
 * @param string $varDefault default value. If '', and if the type doesn't match, exit() !
 * @param string $varType variable type
 */
function getRequestVar($varName, $varDefault = null, $varType = "string")
{
    $varDefault = secureVar(stripslashesPmv($varDefault));
    if (!isset($_REQUEST[$varName]) || empty($_REQUEST[$varName])) {
        if ($varDefault === null) {
            trigger_error("Error : \$varName '{$varName}' doesn't have value in \$_REQUEST and doesn't have a" . " \$varDefault value", E_USER_ERROR);
            exit;
            return;
        } else {
            if ($varType == "numeric") {
                $varType = "string";
            }
            settype($varDefault, $varType);
            return $varDefault;
        }
    } else {
        $content = secureVar(stripslashesPmv($_REQUEST[$varName]));
        if ($varType == 'string') {
            if (is_string($content)) {
                $ok = true;
            }
        } elseif ($varType == 'numeric' || $varType == 'int' || $varType == 'float') {
            if (is_numeric($content)) {
                $ok = true;
            }
        } elseif ($varType == 'array') {
            if (is_array($content)) {
                $ok = true;
            }
        } else {
            $ok = true;
        }
        if (!isset($ok)) {
            if ($varDefault === null) {
                trigger_error("Error : \$varName '{$varName}' doesn't have a correct type in \$_REQUEST and doesn't " . "have a \$varDefault value", E_USER_ERROR);
                exit;
                return;
            } else {
                if ($varType == "numeric") {
                    $varType = "string";
                }
                settype($varDefault, $varType);
                return $varDefault;
            }
        } else {
            return $content;
        }
    }
}