function smarty_function_seacrh_url($paramer, $_smarty_tpl) { $paramer = formatparamer($paramer, $_smarty_tpl); extract($paramer); global $config; $url = $_GET; if ($thisdir != "") { $return_url = $thisdir . "/lietou/index.php?"; } else { $return_url = "index.php?"; } /*if($m){ $return_url_new[]="m=".$m; }*/ //W:二级路径20150418 $LevelTwoList = array('job', 'resume', 'zph', 'map', 'tiny', 'once', 'firm'); if (in_array($m, $LevelTwoList)) { $return_url = $config['sy_weburl'] . '/' . $m . '/' . $return_url; unset($m); unset($url['m']); } //W:二级路径20150418 foreach ($paramer as $key => $va) { if ($key != "m" && $key != "untype" && $key != "thisdir" && $key != "adt" && $key != "adv") { $return_url_new[] = $key . "=" . $va; } } unset($url['m']); $untype = @explode(",", $untype); foreach ($url as $key => $va) { if ($va != "" && !in_array($key, $untype)) { $return_url_new[] = $key . "=" . $va; } } if ($paramer['adt']) { $return_url_new[] = $paramer['adt'] . "=" . $paramer['adv']; } $return_url = $return_url . @implode('&', $return_url_new); $return_url = str_replace('/index.php?', '/?', $return_url); if (substr($return_url, 0, 10) == 'index.php?') { $return_url = substr($return_url, 9); } if (substr($return_url, strlen($return_url) - 10) == 'index.php?') { $return_url = substr($return_url, 0, strlen($return_url) - 10); } if (substr($return_url, strlen($return_url) - 9) == 'index.php') { $return_url = substr($return_url, 0, strlen($return_url) - 9); } if (substr($return_url, strlen($return_url) - 1) == '?') { $return_url = substr($return_url, 0, strlen($return_url) - 1); } return $return_url; }
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; }