示例#1
0
if (!defined("_GNUBOARD_")) {
    exit;
}
include_once G5_LIB_PATH . '/mw.permalink.lib.php';
include_once G5_LIB_PATH . '/mw.common.lib.php';
include_once G5_LIB_PATH . '/mw.popular.lib.php';
include_once G5_LIB_PATH . '/mw.widget.lib.php';
include_once G5_LIB_PATH . '/mw.host.lib.php';
include_once G5_LIB_PATH . '/latest.lib.php';
include_once G5_LIB_PATH . '/outlogin.lib.php';
include_once G5_LIB_PATH . '/poll.lib.php';
include_once G5_LIB_PATH . '/visit.lib.php';
include_once G5_LIB_PATH . '/connect.lib.php';
include_once G5_LIB_PATH . '/popular.lib.php';
// www 로만 접속
if ($mw['config']['cf_www']) {
    mw_sub_domain_only("www");
}
if ($mw['config']['cf_seo_url'] && $bo_table && !mw_seo_except($bo_table)) {
    if (strstr($_SERVER['REQUEST_URI'], $g4['bbs'] . '/board.php')) {
        $seo_etc = $qstr;
        $seo_etc .= mw_seo_query();
        //if ($cwin) $seo_etc .= '&cwin='.$cwin;
        if ($write['wr_is_comment']) {
            $wr_id = $write['wr_parent'];
            $seo_etc = '#c_' . $write['wr_id'];
        }
        goto_url2(mw_builder_seo_url($bo_table, $wr_id, $seo_etc));
    }
}
示例#2
0
function mw_builder_seo_url($bo_table, $wr_id = 0, $qstr = '', $mobile = 1)
{
    global $g4;
    global $mw;
    global $mw_basic;
    global $mw_mobile;
    global $is_admin;
    $url = $g4['url'];
    if (!$mobile && $mw_mobile['m_subdomain']) {
        $url = preg_replace("/^http:\\/\\/m\\./", "http://", $url);
    }
    if ($mobile && mw_is_mobile_builder() or $mobile == 2) {
        if ($mw_mobile['m_subdomain'] && !preg_match("/^http:\\/\\/m\\./", $url)) {
            $url = mw_sub_domain_url("m", $url);
        }
        $seo_path = '/plugin/mobile';
    } else {
        $seo_path = '/' . $g4['bbs'];
    }
    if ($bo_table) {
        $url .= $seo_path . '/board.php?bo_table=' . $bo_table;
    }
    if ($wr_id) {
        $url .= "&wr_id=" . $wr_id;
    }
    if ($qstr == '?') {
        $qstr = '';
    }
    if ($qstr) {
        $url .= $qstr;
    }
    if ($mw['config']['cf_seo_url']) {
        if (mw_seo_except($bo_table)) {
            return $url;
        }
        $url = $g4['url'];
        if (!$mobile && $mw_mobile['m_subdomain']) {
            $url = preg_replace("/^http:\\/\\/m\\./", "http://", $url);
        }
        $seo_path = '/b/';
        if ($mobile && mw_is_mobile_builder() or $mobile == 2) {
            if ($mw_mobile['m_subdomain'] && !preg_match("/^http:\\/\\/m\\./", $url)) {
                $url = mw_sub_domain_url("m", $url);
            }
            $url .= '/m/';
            $seo_path = 'b/';
        }
        if ($bo_table) {
            $url .= $seo_path . $bo_table;
        }
        if ($wr_id) {
            $url .= '-' . $wr_id;
        }
        if ($qstr) {
            $url .= '?' . $qstr;
        }
    }
    $url = str_replace("&", "&", $url);
    $url = preg_replace("/&page=0(&)/", "\$1", $url);
    $url = preg_replace("/&page=0\$/", '', $url);
    $url = preg_replace("/&page=1(&)/", "\$1", $url);
    $url = preg_replace("/&page=1\$/", '', $url);
    //$url = preg_replace("/&page=(&)/", "$1", $url);
    //$url = preg_replace("/&page=$/", '', $url);
    $url = str_replace("?&", '?', $url);
    $url = preg_replace("/\\?\$/", "", $url);
    return $url;
}