function path_replace($html) { $exp = array(); $exp[] = '/<(link|a)(.*?)(href)="(.*?)"/i'; $exp[] = '/<(img|script|input)(.*?)(src)="(.*?)"/i'; $exp[] = '/<(form)(.*?)(action)="(.*?)"/i'; return preg_replace_callback($exp, function ($matches) { $tag = $matches[1]; $_ = $matches[2]; $attr = $matches[3]; $url = $matches[4]; $new_url = rewrite_url($url, $tag); return "<{$tag}{$_}{$attr}=\"{$new_url}\""; }, $html); }
<?php if ($webdb['run_time'] == 1) { $speed_endtime = explode(' ', microtime()); $speed_totaltime .= "TIME " . number_format(($speed_endtime[0] + $speed_endtime[1] - $speed_headtime) / 1, 6) . " second(s)"; } if ($webdb[AvoidGather]) { echo "<SCRIPT LANGUAGE='JavaScript'>avoidgather('{$webdb['AvoidGatherPre']}');</SCRIPT>"; } require html("foot", $foot_tpl); $content = ob_get_contents(); $content = str_replace("<!---->", "", $content); $content = preg_replace("/<!--include(.*?)include-->/is", "\\1", $content); ob_end_clean(); ob_start(); /*方便后面再次调用*/ $content = kill_badword($content); if ($webdb[cookieDomain] && strstr($content, 'ewebeditor/ewebeditor.php?')) { $content = preg_replace("/document.domain([^<]+)/is", "", $content); } if ($webdb[www_url] == '/.') { $content = str_replace('/./', '/', $content); } if ($webdb[RewriteUrl] == 1) { //全站伪静态 rewrite_url($content); } echo $content;
function sll() { global $_G; $goods = DB::fetch_all("SELECT aid FROM " . DB::table('goods') . " WHERE `check`=1 AND hide = 0 ORDER BY aid DESC LIMIT " . $this->size); $url = array(); $url[] = 'a=today'; $url[] = 'a=tomorrow'; $url[] = 'a=all'; $url[] = 'a=over'; $url[] = 'a=history'; $url[] = 'a=map'; foreach ($_G[channels] as $k => $v) { $url[] = 'fid=' . $v[fid]; } foreach ($_G[cate] as $k => $v) { $url[] = 'cate=' . $v[id]; } foreach ($goods as $k => $v) { $url[] = 'aid=' . $v[aid]; } $content = ''; foreach ($url as $k => $v) { $content .= $_G[siteurl] . rewrite_url($v) . ' ' . $_G[siteurl] . rewrite_url($v) . "\n"; } echo $content; }
exit; } elseif ($type == 'sonfid') { $fid && ($rs = $db->get_one("SELECT fup FROM {$pre}spsort WHERE fid='{$fid}'")); $show = get_fidName($rs[fup], $rows, $class ? $class : 3); if (!$show) { $show = "暂无..."; } //真静态 if ($webdb[NewsMakeHtml] == 1 || $gethtmlurl) { $show = make_html($show, $pagetype = 'N'); } elseif ($webdb[NewsMakeHtml] == 2) { $show = fake_html($show); } if ($webdb[RewriteUrl] == 1) { //全站伪静态 rewrite_url($show); } $show = "<ul>{$show}</ul>"; $show = str_Replace("'", '"', $show); $show = str_Replace("\r", '', $show); $show = str_Replace("\n", '', $show); $show = "document.write('{$show}');"; echo $show; } else { die("document.write('指定的类型不存在');"); } function get_fid($fid) { global $db, $pre; $fid = intval($fid); $F[] = " fid={$fid} ";