Esempio n. 1
0
function change_uri($cmd = '', $force = 0)
{
    global $script, $script_abs, $absolute_uri, $script_directory_index;
    static $onece, $bkup, $bkup_script, $bkup_script_abs, $bkup_absolute_uri;
    static $target_fields = array('script' => 'bkup_script', 'script_abs' => 'bkup_script_abs', 'absolute_uri' => 'bkup_absolute_uri');
    if (!isset($bkup)) {
        $bkup = true;
        foreach ($target_fields as $org => $bkup) {
            if (!isset(${$bkup}) && isset($org)) {
                ${$bkup} = ${$org};
            }
        }
    }
    if (isset($onece)) {
        return;
    }
    switch ($cmd) {
        case 'reset':
            foreach ($target_fields as $org => $bkup) {
                if (isset(${$bkup})) {
                    ${$org} = ${$bkup};
                } else {
                    if (isset(${$org})) {
                        unset(${$org});
                    }
                }
            }
            return;
        case 'net':
        case 'abs':
        case 'rel':
            change_uri('reset');
            $absolute_uri = 0;
            break;
        default:
            $absolute_uri = 1;
    }
    $script = get_baseuri($cmd);
    if (!isset($script_directory_index)) {
        $script .= init_script_filename();
    }
    if ($force === 1) {
        $onece = 1;
    }
    return;
}
Esempio n. 2
0
function get_script_uri($path = '')
{
    global $absolute_uri, $script_directory_index;
    if ($absolute_uri) {
        return get_script_absuri();
    }
    $uri = get_baseuri($path);
    if (!isset($script_directory_index)) {
        $uri .= init_script_filename();
    }
    return $uri;
}