问题是:- function geturl($pstring, $urlmode=0) {
- global $_SGLOBAL, $_SCONFIG, $spaceself;
- //生成HTML
- if(defined('CREATEHTML')) {
- $theurl = gethtmlurl($pstring);
- if(!empty($theurl)) {
- return $theurl;
- }
- }
-
- //URL缓存
- $cachekey = $pstring.$urlmode;
- if(empty($_SGLOBAL['url_cache'])) $_SGLOBAL['url_cache'] = array();
- if(!empty($_SGLOBAL['url_cache'][$cachekey])) {
- return $_SGLOBAL['url_cache'][$cachekey];
- }
- //url结果
- $theurl = '';
- //强制php模式
- $isphp = !empty($spaceself)?1:strexists($pstring, 'php/1');
- //首页链接
- if($pstring == 'action/index') $pstring = '';
- //搜索友好模式
- if(!empty($_SCONFIG['htmlmode']) && $_SCONFIG['htmlmode'] == 2 && !$isphp && $urlmode != 1) {
- $htmlarr = array('uid'=>'', 'action'=>'', 'catid'=>'', 'fid'=>'', 'tagid'=>'', 'itemid'=>'', 'tid'=>'', 'type'=>'', 'view'=>'', 'mode'=>'', 'showpro'=>'', 'itemtypeid'=>'', 'page'=>'');
- $sarr = explode('/', $pstring);
- if(empty($sarr)) $sarr = array('action'=>'index');
- $htmlurlcheck = true;
- for($i=0; $i<count($sarr); $i=$i+2) {
- if(!empty($sarr[$i+1])) {
- if(key_exists($sarr[$i], $htmlarr)) {
- $htmlarr[$sarr[$i]] = addslashes(str_replace(array('/', '\\'), '', rawurldecode(stripslashes($sarr[$i+1])))); //stripslashes 去一个反斜线 rawurldecode 中文解码 addslashes 自动转义
- } else {
- $htmlurlcheck = false;
- break;
- }
- }
- }
- if($htmlurlcheck) {
- [color=Red] $htmls = gethtmlfile($htmlarr); //这里拿不到频道的英文ID 下面的条件 就没有办法成立!!![/color]
- if(file_exists($htmls['path'])) {
- $theurl = $htmls['url'];
- }
- }
- }
- //普通模式
- if(empty($theurl)) {
- if(empty($pstring)) {
- if($urlmode == 1) {
- $theurl = S_URL_ALL;
- } else {
- $theurl = S_URL;
- }
- } else {
- $pre = '';
- $para = str_replace('/', '-', $pstring);
- if($isphp || defined('S_ISPHP')) {
- $pre = '/index.php?';
- } else {
- if ($_SCONFIG['urltype'] == 5) {
- $pre = '/index.php/';
- } else {
- $pre = '/?';
- }
- }
- if(empty($para)) $pre = '/';
- if($urlmode == 1) {
- //全部路径
- $theurl = S_URL_ALL.$pre.$para;
- } elseif($urlmode == 2) {
- //处理
- $theurl = S_URL.$pre.$para;
- $theurl = url_remake($theurl);
- } else {
- //常规
- $theurl = S_URL.$pre.$para;
- }
- }
- }
- //url缓存
- $_SGLOBAL['url_cache'][$cachekey] = $theurl;
- return $theurl;
- }
复制代码 |