<?php //如果缓存中存在,则直接输出缓存 session_start(); include_once 'conn.php'; include_once 'library/basefunction.php'; include_once 'lang/envinit.php'; include_once 'templatefunction/Iron.article.php'; include_once 'templatefunction/Iron.label.php'; $articleid = $_GET["articleid"]; getresult("update I_article set hits=hits+1 where id = {$articleid} and ifpass=1"); //readcache(); //echo $articleid; $templateid = getcolumnformation($articleid, "articletemplate"); $templatepath = getresultData(getresult("select * from I_template where id={$templateid}"), 0, "path"); $templatefile = getroot() . "/templates/" . $templatepath; //echo $templatefile; $template = file_get_contents($templatefile); if (!$template) { die("<script type='text/javascript'>alert('The template doesn't exists!')window.location='error.html'</script>"); } $template = translatelabel($template); $template = translateArticlelist($template); $template = translateCommonlabel($template); echo $template; ob_flush(); buildcache($template);
function getPath() { $siteconfig = getresult("select * from I_siteconfig limit 0,1"); $path = ""; $articleid = $_GET["articleid"]; $columnid = $_GET["columnid"]; if ($articleid != NULL && $articleid != "") { //文章页 //得到栏目串再加上”-正文“ $tempcolumnid = getcolumnformation($articleid, "id"); //文章所在栏目 for (;;) { if ($tempcolumnid != "0") { //echo $tempcolumnid."|"; //如果有父栏目,则将其加到当前$path的前面 if ($path == "") { $path = "<a href='showcolumn.php?columnid=" . $tempcolumnid . "'>" . getcolumnformationBycolumnid($tempcolumnid, "columnname") . "</a>" . $path; } else { $path = "<a href='showcolumn.php?columnid=" . $tempcolumnid . "'>" . getcolumnformationBycolumnid($tempcolumnid, "columnname") . "</a>>>" . $path; } } else { break; } $tempcolumnid = getcolumnformationBycolumnid($tempcolumnid, "parentid"); } return "<a href=\"" . getresultData($siteconfig, 0, "domain") . "\">" . gettext_r("home") . "</a>>>" . $path; } elseif ($columnid != NULL && $columnid != "") { //栏目页 //得到栏目串的链接 $tempcolumnid = $columnid; //当前栏目id $path = getcolumnformationBycolumnid($tempcolumnid, "columnname"); for (;;) { $tempcolumnid = getcolumnformationBycolumnid($tempcolumnid, "parentid"); if ($tempcolumnid != "0") { //如果有父栏目,则将其加到当前$path的前面 $path = "<a href='showcolumn.php?columnid=" . $tempcolumnid . "'>" . getcolumnformationBycolumnid($tempcolumnid, "columnname") . "</a>>>" . $path; } else { break; } } return "<a href=\"" . getresultData($siteconfig, 0, "domain") . "\">" . gettext_r("home") . "</a>>>" . $path; } else { //未知页面 return gettext_r("home"); } }
function showarticle($columnid, $currentpage, $pagesize = 10) { global $childcolumnString, $functionarray; getchildcolumnid_improveed($columnid); //echo $childcolumnString."haoxuefeng"; /*if($functionarray[$columnid]==="2"||getlogininfo("adminrole")==="0") $tempresult = getresult("select count(*) as countofarticle from I_article where columnid in (".$childcolumnString.")"); else $tempresult = getresult("select count(*) as countofarticle from I_article where columnid in (".$childcolumnString.") and ifpass=0 and adminid=".getlogininfo("adminid")); $countofarticle = getresultData($tempresult, 0, "countofarticle"); if($countofarticle<1) { echo "<tr class='list'>\n"; echo "<td colspan='8' align='center'>暂无文章</td>\n"; echo "</tr>"; return; }*/ //echo $countofarticle."|"; //分页显示 if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") { $query = "select * from I_article where columnid in (" . $childcolumnString . ") order by id desc limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}"; } else { $query = "select * from I_article where columnid in (" . $childcolumnString . ") and ifpass=0 and adminid=" . getlogininfo("adminid") . " order by id desc limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}"; } //echo $query; $result = getresult($query); if ($currentpage > 1 && getresultNumrows($result) < 1) { //echo $currentpage; echo "<script type=\"text/javascript\">window.location='admin_article.php?columnid={$columnid}¤tpage=" . ($currentpage - 1) . "'</script>"; return; } else { if ($currentpage <= 1 && getresultNumrows($result) < 1) { echo "<tr class='list'>\n"; echo "<td colspan='8' align='center'>" . gettext_r("haveNot") . gettext_r("article") . "</td>\n"; echo "</tr>"; return; } } while ($row = getresultArray($result)) { echo "<tr class='list'>\n"; echo "<td align='center'><input type='checkbox' name='list' value='" . $row["id"] . "' /></td>"; echo "<td> " . $row["id"] . "</td>"; echo "<td> " . getcolumnformation($row["id"], "columnname") . "</td>"; echo "<td> " . $row["title"] . "</td>"; echo "<td> " . $row["author"] . "</td>"; echo "<td> " . $row["hits"] . "</td>"; if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") { if ($row["ifpass"] == 1) { echo "<td> <a href='javascript:passarticle(" . $row["id"] . ",0)'>" . gettext_r("havePass") . "</a></td>"; } else { echo "<td> <a href='javascript:passarticle(" . $row["id"] . ",1)'>" . gettext_r("notPass") . "</a></td>"; } } else { if ($row["ifpass"] == 1) { echo "<td> " . gettext_r("havePass") . "</td>"; } else { echo "<td> " . gettext_r("notPass") . "</td>"; } } //操作权限 echo "<td>"; echo " <a href=\"javascript:jump('admin_article.php','modify'," . $row["id"] . ",'columnid',{$columnid})\">" . gettext_r("update") . "</a> "; echo "| <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_article.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>"; echo "</td>"; echo "</tr>\n"; } }
function getColumnkeywords() { global $siteconfig, $article, $column; if ($article) { return "<meta name=\"Keywords\" content=\"" . getcolumnformation(getresultData($article, 0, "id"), "keywords") . "\">"; } elseif ($column && getresultData($column, 0, "keywords") != "") { return "<meta name=\"Keywords\" content=\"" . getresultData($column, 0, "keywords") . "\">"; } //未知地址返回空 return ""; }
//前台页面 if ($_SESSION["frontlang"] == "Auto") { if (is_file(getroot() . "/lang/" . $language . ".php")) { require $language . ".php"; } } else { if (is_file(getroot() . "/lang/" . $_SESSION["frontlang"] . ".php")) { require $_SESSION["frontlang"] . ".php"; } } } //以下代码支持栏目及相关页面国际化操作 if (preg_match("/.*(showcolumn|showarticle|showcomment)\\.php.*/", $_SERVER['URL'], $matchs) > 0) { $columnid = -1; if ($_GET["articleid"] != NULL && $_GET["articleid"] != "") { $columnid = getcolumnformation($_GET["articleid"], "id"); } if ($_GET["columnid"] != NULL && $_GET["columnid"] != "") { $columnid = $_GET["columnid"]; } $columnLanguage = trim(getcolumnformationBycolumnid($columnid, "lang")); //栏目的语言如果为Auto,则继承父栏目语言,如果没有父栏目,则继承前台页面语言 while ($columnLanguage == "Auto") { $parentid = (int) getcolumnformationBycolumnid($columnid, "parentid"); if ($parentid == 0) { //已经查询至一级栏目 break; } if ($parentid > 0) { $columnid = $parentid; $columnLanguage = trim(getcolumnformationBycolumnid($columnid, "lang"));