function get_url($paramer, $config, $seo, $type = '', $index = '', $_smarty_tpl) { global $ModuleName, $adminDir; $paramer = formatparamer($paramer, $_smarty_tpl); if ($type) { if ($config['sy_' . $type . 'domain'] && $type != 'index') { $defaultUrl = "http://" . $config['sy_' . $type . 'domain']; $defaultUrlRewrite = $defaultUrl; unset($paramer['m']); } else { if ($ModuleName != $adminDir && $ModuleName != 'siteadmin' || !$ModuleName) { $typeDir = $config['sy_' . $type . 'dir']; } $defaultUrl = $config['sy_weburl']; $defaultUrlRewrite = $config['sy_weburl']; } } else { $defaultUrl = $config['sy_weburl']; $defaultUrlRewrite = $config['sy_weburl']; } if ($typeDir) { $defaultUrl .= "/" . $typeDir; $defaultUrlRewrite .= "/" . $typeDir; unset($paramer['m']); } else { if (empty($paramer['m']) && (!$config['sy_' . $type . 'domain'] || $type == 'index')) { $m = 'index'; } else { $m = $paramer['m']; } } if (is_array($paramer)) { foreach ($paramer as $k => $v) { if ($k != "m" && $k != "con") { $paramers[] = $k . ":" . $v; } } } if ($index == 'admin') { global $ModuleName; $url = $ModuleName . '/' . $url; } if ($config['sy_seo_rewrite'] && $index != 'admin' && $index != 'member' && !$paramer['page'] && !$paramer['keyword'] && $paramer['m'] != 'ajax') { $seourl = get_seo_url($paramer, $config, $seo, $type); if ($seourl) { return $seourl; } if ($m != 'index' && !empty($m)) { $urlarr['m'] = str_replace('_', '', str_replace('-', '', $m)); } if ($paramers) { $p = ''; foreach ($paramers as $v) { if (!empty($v)) { $url_info = @explode(":", $v); $urlarr[$url_info[0]] = str_replace('_', '', str_replace('-', '', $url_info[1])); } } } if ($urlarr) { foreach ($urlarr as $k => $v) { $a[] = $k . '_' . $v; } $urltemp = @implode('-', $a); $url .= $urltemp . '.html'; $url = $defaultUrlRewrite . "/" . $url; } else { $url = $defaultUrlRewrite . "/"; } } else { if ($m == 'wap' && $index == 'member') { $url = $url . 'member/'; } if ($index != 'admin' && $config['sy_' . $m . '_web'] == 1 && trim($config['sy_' . $m . 'dir']) && !trim($config['sy_' . $m . 'domain'])) { $url = $config['sy_' . $m . 'dir'] . '/' . $url; unset($m); unset($paramer['m']); } if ($m == 'index') { $url .= 'index.php'; } elseif ($m == 'member') { $url .= 'member/index.php?'; } else { if ($m) { $url .= 'index.php?' . ($m ? '&m=' . $m : ''); } } if ($paramers) { $p = ''; foreach ($paramers as $v) { if (!empty($v)) { $url_info = @explode(":", $v); $p .= '&' . $url_info[0] . '=' . $url_info[1]; } } if (strpos($url, '?')) { $url .= $p; } else { if ($m == 'index') { $url .= '?' . substr($p, 1); } else { $url .= 'index.php?' . substr($p, 1); } } } $url = $defaultUrl . '/' . $url; } $url = FormatUrl($url); return $url; }
function get_index_url($paramer, $config, $seo, $type = '', $index) { if ($type) { $type = $type; $typeDir = $config['sy_' . $type . 'dir']; if ($config['sy_' . $type . 'domain']) { $defaultUrl = "http://" . $config['sy_' . $type . 'domain']; $defaultUrlRewrite = $defaultUrl; } else { $defaultUrl = $config['sy_weburl'] . "/" . $typeDir; $defaultUrlRewrite = $config['sy_weburl'] . "/" . $typeDir; } } else { $defaultUrl = $config['sy_weburl']; $defaultUrlRewrite = $config['sy_weburl']; } if ($config['sy_seo_rewrite'] && $index == "1") { $url = get_seo_url($paramer, $config, $seo); if ($url) { return $url; } $con = $paramer['con']; $m = $paramer['m']; unset($paramer['con']); unset($paramer['m']); if ($con != 'index' && !empty($con)) { $urlarr['con'] = str_replace('_', '', str_replace('-', '', $con)); } if (!empty($m)) { $urlarr['m'] = str_replace('_', '', str_replace('-', '', $m)); } if ($paramer) { $p = ''; foreach ($paramer as $k => $v) { if (!empty($v)) { $urlarr[$k] = str_replace('_', '', str_replace('-', '', $v)); } } } if ($urlarr) { foreach ($urlarr as $k => $v) { $a[] = $k . '_' . $v; } $urltemp = @implode('-', $a); $url .= $urltemp . '.html'; if ($type) { $url = $defaultUrlRewrite . "-" . $url; } else { $url = $defaultUrlRewrite . "/" . $url; } } else { $url = $defaultUrlRewrite; } } else { $con = $paramer['con']; $m = $paramer['m']; unset($paramer['con']); unset($paramer['m']); if ($con == 'index' && $m == 'index') { $url .= 'index.php'; } elseif ($con == 'index') { $url .= 'index.php?m=' . $m; } elseif ($m == 'index') { $url .= 'index.php?con=' . $con; } else { $url .= 'index.php?con=' . $con . '&M=' . $m; } if ($paramer) { $p = ''; foreach ($paramer as $k => $v) { if (!empty($v)) { $p .= '&' . $k . '=' . $v; } } if (strpos($url, '?')) { $url .= $p; } else { $url .= '?' . substr($p, 1); } } $url = $defaultUrl . '/' . $url; } return $url; }