Exemple #1
0
 function mw_seo_url($bo_table, $wr_id = 0, $qstr = '', $mobile = 1)
 {
     global $g4;
     global $mw;
     global $mw_basic;
     global $mw_mobile;
     global $is_admin;
     global $mw_mobile;
     $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 = '/' . $mw_mobile['dir'];
     } 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) {
         $url .= $qstr;
     }
     return $url;
 }
function mw_seo_bbs_path($path)
{
    global $g4;
    global $bo_table;
    $wr_id = null;
    if (preg_match("/&wr_id=([0-9]+)&/iUs", $path, $mat)) {
        $wr_id = $mat[1];
        $path = str_replace('&wr_id=' . $wr_id, '', $path);
    }
    $path = preg_replace("/&page=[01]?[&\$]?/i", '', $path);
    if (mw_is_mobile_builder()) {
        $path = str_replace('../../plugin/mobile/board.php?bo_table=' . $bo_table, mw_seo_url($bo_table, $wr_id) . '?', $path);
    } else {
        $path = str_replace('../bbs/board.php?bo_table=' . $bo_table, mw_seo_url($bo_table, $wr_id) . '?', $path);
    }
    $path = preg_replace("/\\?\$/", "", $path);
    return $path;
}