示例#1
0
文件: vbseo.php 项目: holandacz/nb4
        if ($vbseo_incf[0] != '/') {
            $vbseo_incf = dirname(__FILE__) . '/' . $vbseo_incf;
        }
        include $vbseo_incf;
        exit;
    } else {
        vbseo_404_routine($vbseo_url_);
    }
} else {
    if (preg_match('#\\.(css|php\\d?/?|html?|txt)$#', $vbseo_found_fn, $typematch) && !strstr($vbseo_found_fn, '://')) {
        if ($typematch[1] == 'css') {
            header('Content-type: text/css');
        }
        if (preg_match('#^(.+)/([^/]+)$#', $vbseo_found_fn, $vbseo_m)) {
            @chdir($vbseo_m[1]);
            $vbseo_found_fn = $vbseo_m[2];
        }
        if ($vbseo_found_fn == 'showthread.' . VBSEO_VB_EXT && isset($_POST) && isset($_POST['excerpt']) && VBSEO_IN_TRACKBACK) {
            @define('THIS_SCRIPT', 'showthread');
            include dirname(__FILE__) . '/global.' . VBSEO_VB_EXT;
            vbseo_extra_inc('linkback');
            vbseo_trackback_proc();
        }
        require getcwd() . '/' . $vbseo_found_fn;
        exit;
    } else {
        vbseo_404();
    }
}
vbseo_close_db();
exit;
示例#2
0
function vbseo_safe_redirect($vbseo_url_, $unset_par = array(), $unset_all = false)
{
    $vbroot = VBSEO_TOPREL_FULL;
    if (defined('VBSEO_UNREG_EXPIRED')) {
        return;
    }
    if ($vbroot[strlen($vbroot) - 1] != '/') {
        $vbroot .= '/';
    }
    if (!$unset_all) {
        $unset_par = array_merge($unset_par, array('grab_output', 'goto', 's', 'vbseourl', 'vbseorelpath', 'vbseoaddon'));
        $qstring = $_SERVER['QUERY_STRING'];
        if (strstr($vbseo_url_, '?')) {
            list($vbseo_url_, $qstring) = explode('?', $vbseo_url_);
        }
        $pars = $qstring ? explode('&', str_replace('&', '&', preg_replace('|#.*|', '', $qstring))) : array();
        $req = '';
        for ($i2 = 0; $i2 < count($pars); $i2++) {
            list($k, $v) = explode('=', $pars[$i2], 2);
            if (!in_array($k, $unset_par) && !strstr($k, 'redirect_')) {
                $req .= ($req ? '&' : '') . $k . '=' . $v;
            }
        }
    }
    if ($vbseo_url_[0] == '/') {
        $vbseo_url_ = substr($vbseo_url_, 1);
    }
    $fulluri = (strstr($vbseo_url_, '://') ? '' : $vbroot) . $vbseo_url_;
    if ($req) {
        $fulluri = preg_replace('#^([^\\#]*)#', '$1?' . $req, $fulluri);
    }
    header("HTTP/1.1 301 Moved Permanently");
    if (defined('VBSEO_STATUS_HEADER') && VBSEO_STATUS_HEADER) {
        header("Status: 301 Moved Permanently");
    }
    $fulluri = preg_replace('#[\\r\\n]#', '', $fulluri);
    header("Location: {$fulluri}");
    vbseo_close_db();
    exit;
}