public function tag($val, $field = 'name', $tpl = 'tag') { $val or iPHP::throw404('运行出错!TAG不能为空', 30002); $tag = iDB::row("SELECT * FROM `#iCMS@__tags` where `{$field}`='{$val}' AND `status`='1' LIMIT 1;", ARRAY_A); if (empty($tag)) { if ($tpl) { iPHP::throw404('运行出错!找不到标签: <b>' . $field . ':' . $val . '</b>', 30003); } else { return false; } } $tag = $this->value($tag); $tag['param'] = array("appid" => $tag['appid'], "iid" => $tag['id'], "cid" => $tag['cid'], "suid" => $tag['uid'], "title" => $tag['name'], "url" => $tag['url']); if ($tpl) { iCMS::hooks('enable_comment', true); iPHP::assign('category', $tag['category']); iPHP::assign('tag_category', $tag['tag_category']); unset($tag['category'], $tag['tag_category']); iPHP::assign("tag", $tag); if (strstr($tpl, '.htm')) { return iPHP::view($tpl, 'tag'); } $html = iPHP::view($tag['tpl'] ? $tag['tpl'] : '{iTPL}/tag.index.htm', 'tag'); if (iPHP::$iTPL_MODE == "html") { return array($html, $tag); } } else { return $tag; } }
public function API_form() { $_GET['_display'] = $_GET['display']; $_GET['display'] = 'default'; $_GET = iS::escapeStr($_GET); iCMS::hooks('enable_comment', true); iPHP::app('comment.func'); return comment_form($_GET); }
public function category($id, $tpl = 'index') { $category = iCache::get('iCMS/category/' . $id); if (empty($category) && $tpl) { iPHP::throw404('运行出错!找不到该栏目<b>cid:' . $id . '</b> 请更新栏目缓存或者确认栏目是否存在', 20001); } if ($category['status'] == 0) { return false; } $iurl = iURL::get('category', $category); if ($tpl) { if (iPHP::$iTPL_MODE == "html" && (strstr($category['contentRule'], '{PHP}') || $category['outurl'] || empty($category['mode']))) { return false; } $category['url'] && iPHP::gotourl($category['url']); $category['mode'] == '1' && iCMS::gotohtml($iurl->path, $iurl->href); } $category['iurl'] = (array) $iurl; $category['subid'] = iCache::get('iCMS/category/rootid', $id); $category['subids'] = implode(',', (array) $category['subid']); $category = array_merge($category, $this->get_lite($category)); // if($category['password']){ // $category_auth = iPHP::get_cookie('category_auth_'.$id); // list($ca_cid,$ca_psw) = explode('#=iCMS!=#',authcode($category_auth,'DECODE')); // if($ca_psw!=md5($category['password'])){ // iPHP::assign('forward',__REF__); // iPHP::view('{iTPL}/category.password.htm','category.password'); // exit; // } // } if ($category['hasbody']) { $category['body'] = iCache::get('iCMS/category/' . $category['cid'] . '.body'); $category['body'] && ($category['body'] = stripslashes($category['body'])); } $category['appid'] = iCMS_APP_CATEGORY; $category['param'] = array("appid" => $category['appid'], "iid" => $category['cid'], "cid" => $category['rootid'], "suid" => $category['userid'], "title" => $category['name'], "url" => $category['url']); if ($tpl) { $category['mode'] && iCMS::set_html_url($iurl); iCMS::hooks('enable_comment', true); iPHP::assign('category', $category); if (strpos($tpl, '.htm') !== false) { return iPHP::view($tpl, 'category'); } $GLOBALS['page'] > 1 && ($tpl = 'list'); $html = iPHP::view($category[$tpl . 'TPL'], 'category.' . $tpl); if (iPHP::$iTPL_MODE == "html") { return array($html, $category); } } else { return $category; } }
public function category($id, $tpl = 'index') { $category = iCache::get('iCMS/category/' . $id); if (empty($category) && $tpl) { iPHP::throw404('运行出错!找不到该栏目<b>cid:' . $id . '</b> 请更新栏目缓存或者确认栏目是否存在', 20001); } if ($category['status'] == 0) { return false; } $iurl = iURL::get('category', $category); if ($tpl) { if (iPHP::$iTPL_MODE == "html" && (strstr($category['contentRule'], '{PHP}') || $category['outurl'] || empty($category['mode']))) { return false; } $category['url'] && iPHP::gotourl($category['url']); $category['mode'] == '1' && iCMS::gotohtml($iurl->path, $iurl->href); } $category['iurl'] = (array) $iurl; $category['subid'] = iCache::get('iCMS/category/rootid', $id); $category['subids'] = implode(',', (array) $category['subid']); $category = array_merge($category, $this->get_lite($category)); if ($category['hasbody']) { $category['body'] = iCache::get('iCMS/category/' . $category['cid'] . '.body'); $category['body'] && ($category['body'] = stripslashes($category['body'])); } $category['appid'] = iCMS_APP_CATEGORY; $category['param'] = array("appid" => $category['appid'], "iid" => $category['cid'], "cid" => $category['rootid'], "suid" => $category['userid'], "title" => $category['name'], "url" => $category['url']); if ($tpl) { $category['mode'] && iCMS::set_html_url($iurl); iCMS::hooks('enable_comment', true); iPHP::assign('category', $category); if (isset($_GET['tpl'])) { $tpl = iS::escapeStr($_GET['tpl']); if (strpos($tpl, '..') !== false) { exit('what the f**k!!'); } else { $tpl = $tpl . '.htm'; } } if (strpos($tpl, '.htm') !== false) { return iPHP::view($tpl, 'category'); } $GLOBALS['page'] > 1 && ($tpl = 'list'); $html = iPHP::view($category[$tpl . 'TPL'], 'category.' . $tpl); if (iPHP::$iTPL_MODE == "html") { return array($html, $category); } } else { return $category; } }
public function article($id, $page = 1, $tpl = true) { $article = iDB::row("SELECT * FROM `#iCMS@__article` WHERE id='" . (int) $id . "' AND `status` ='1' LIMIT 1;", ARRAY_A); $article or iPHP::throw404('运行出错!找不到文章: <b>ID:' . $id . '</b>', 10001); if ($article['url']) { if (iPHP::$iTPL_MODE == "html") { return false; } else { $this->API_hits($id); iPHP::gotourl($article['url']); } } if (iCMS_ARTICLE_DATA === "TEXT") { iPHP::app('article.table'); $article_data = articleTable::get_text($id); } else { $article && ($article_data = iDB::row("SELECT body,subtitle FROM `#iCMS@__article_data` WHERE aid='" . (int) $id . "' LIMIT 1;", ARRAY_A)); } $vars = array('tags' => true, 'user' => true, 'meta' => true, 'prev_next' => true, 'category_lite' => false); $article = $this->value($article, $article_data, $vars, $page, $tpl); unset($article_data); if ($article === false) { return false; } if ($tpl) { iCMS::hooks('enable_comment', true); $article_tpl = empty($article['tpl']) ? $article['category']['contentTPL'] : $article['tpl']; strstr($tpl, '.htm') && ($article_tpl = $tpl); iPHP::assign('category', $article['category']); unset($article['category']); iPHP::assign('article', $article); $html = iPHP::view($article_tpl, 'article'); if (iPHP::$iTPL_MODE == "html") { return array($html, $article); } } else { return $article; } }