<?php /** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> */ require_once dirname(__FILE__) . '/config.php'; $_GET['name'] && $iCMS->tag(irawurldecode($_GET['name']));
$dir = $_GET['dir']; if (empty($fid)) { $fid = $iCMS->getCache('system/forum.dir2fid', $_GET['dir']); } if (empty($fid)) { header("HTTP/1.1 404 Not Found"); exit; } $F = $iCMS->getCache('system/forum.cache', $fid); $iCMS->htmlConf = array('enable' => true, 'ext' => empty($F['htmlext']) ? $iCMS->config['htmlext'] : $F['htmlext']); $iCMS->url = $iCMS->getCache('system/forum.url', $fid)->href . "/index_"; $iCMS->iList($fid); break; case 'show': $id = (int) $_GET['id']; if (empty($id)) { $id = iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__article` WHERE `clink`='" . irawurldecode($_GET['clink']) . "'"); } if (empty($id)) { header("HTTP/1.1 404 Not Found"); exit; } $iCMS->htmlConf = array('enable' => true, 'ext' => $iCMS->config['htmlext']); $iCMS->Show($id, $page); break; case 'tag': $name = irawurldecode($_GET['name']); $iCMS->htmlConf = array('enable' => true, 'ext' => $iCMS->config['htmlext']); $iCMS->tag($name); break; }
function iurl($uri, $a = array(), $p = 1) { $i = new stdClass(); $htmldir = $this->config['htmldir']; $htmlURL = $this->config['htmlURL']; switch ($uri) { case 'forum': $rule = $a['mode'] == 0 ? '{PHP}' : $a['forumRule']; $i->href = $a['url']; break; case 'show': unset($a[1]['url']); $Furl = $this->iurl('forum', $a[1]); $rule = $a[1]['mode'] == 0 ? '{PHP}' : $a[1]['contentRule']; $i->href = $this->config['publicURL'] . "/link.php?id=" . $a[0]['id'] . "&url=" . irawurldecode($a[0]['url']); $a = array_merge($a[0], (array) $a[1]); break; case 'content': $rule = $this->config['ctRule']; $i->href = $this->config['publicURL'] . "/link.php?id=" . $a['id'] . "&url=" . irawurldecode($a['url']); break; case 'tag': //$Furl = $this->iurl('forum',$a[1]); //$rule = $a[1]['mode']==0?'{PHP}':($a[1]['tagRule']?$a[1]['tagRule']:$this->config['tagRule']); $a[0]['tName'] = $a[0]['name']; $a = array_merge($a[0], (array) $a[1]); $rule = $this->config['tagRule']; $htmldir = $this->config['tagDir']; $htmlURL = $this->config['tagURL']; break; } if ($a['url']) { return $i; } $url = preg_replace("/\\{(.*?)\\}/e", '$this->irule($uri,"\\1",$a,$p)', $rule); if (strstr($rule, '{PHP}') === false) { $i->path = FS::path(iPATH . $htmldir . '/' . $url); $i->href = FS::path($htmlURL . '/' . $url); if (in_array($uri, array('show', 'content'))) { $i->path = FS::path($Furl->dmdir . '/' . $url); $i->href = FS::path($Furl->domain . '/' . $url); } $i->hdir = dirname($i->href); $i->file = basename($i->path); $i->name = substr($i->file, 0, strrpos($i->file, '.')); empty($i->name) && ($i->name = $i->file); $i->ext = strrchr($i->file, "."); if (empty($i->file) || substr($url, -1) == '/' || empty($i->ext)) { $i->name = 'index'; $i->ext = empty($a['htmlext']) ? $this->config['htmlext'] : $a['htmlext']; $i->file = $i->name . $i->ext; $i->path = $i->path . '/' . $i->file; $i->hdir = dirname($i->href . '/' . $i->file); } // var_dump($i); $i->dir = dirname($i->path); if (in_array($uri, array('show', 'content'))) { if (strstr($rule, '{P}') === false && $p > 1) { $fn = $i->name . '_' . $p . $i->ext; $i->path = $i->dir . '/' . $fn; $i->href = $i->hdir . '/' . $fn; } } if ($uri == 'forum') { $m = $this->domain($a['fid']); if ($m->domain) { $i->href = str_replace($i->hdir, $m->dmpath, $i->href); $i->hdir = $m->dmpath; $__dir__ = $i->dir . '#iCMS#' . $m->pdir; $i->path = str_replace($i->dir, $__dir__, $i->path); $i->dir = str_replace($m->sdir . '#iCMS#' . $m->pdir, $m->pdir, $__dir__); $i->path = str_replace($__dir__, $i->dir, $i->path); $i->dmdir = FS::path(iPATH . $htmldir . '/' . $m->pd . '/'); $bits = parse_url($i->href); $i->domain = $bits['scheme'] . '://' . $bits['host']; } else { $i->dmdir = FS::path(iPATH . $htmldir . '/'); $i->domain = $htmlURL; } } // var_dump($i); } else { $i->href = $url; $p > 1 && ($i->href .= '&p=' . $p); } return $i; }
<?php /** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> */ require_once dirname(__FILE__) . '/config.php'; require_once iPATH . 'include/UI.class.php'; $_GET['q'] && $iCMS->search(irawurldecode($_GET['q']));