function showchildcolumncomment($columnid) { $result = getresult("select * from I_column where id={$columnid}"); if (getresultData($result, 0, "childcount") >= 1) { $childcolumn = getresultData($result, 0, "childcolumn"); //echo $childcolumn; $childid = explode("|", $childcolumn); foreach ($childid as $id) { echo "<a href='admin_comment.php?columnid={$id}'>" . getcolumnformationBycolumnid($id, "columnname") . "</a> "; } } else { echo gettext_r("haveNot") . gettext_r("child") . gettext_r("column"); } }
function translatecolumnlist($template) { //匹配自定义文章列表标签正则 $flag = "/【columnlist】([\\s\\S]*?)【\\/columnlist】/"; preg_match_all($flag, $template, $matches, PREG_SET_ORDER); //替换所有articlelist标签 $html = $template; //echo $template."<br>".$flag; //得到需要循环的部分 $str = $matches[0][1]; //echo $str ; //得到子栏目id数组 $columnid = $_GET["columnid"]; $query = "select childcolumn,columnname from I_column where id={$columnid}"; $result = getresult($query); if (getresultNumrows($result) < 1) { //没有才此栏目 return str_replace($str, "No such column!", $html); return; } $columnname = getresultData($result, 0, "columnname"); $childColumnId = getresultData($result, 0, "childcolumn"); if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") { //没有子栏目 return str_replace($str, "No child column!", $html); return; } $temphtml = ""; $childId = explode("|", $childColumnId); foreach ($childId as $id) { $tempstr = str_replace("【#columnid】", "{$id}", $str); $tempstr = str_replace("【#columnname】", getcolumnformationBycolumnid($id, "columnname"), $tempstr); $temphtml .= $tempstr; } $html = str_replace($matches[0][0], $temphtml, $html); return $html; }
<?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.column.php'; include_once 'templatefunction/Iron.label.php'; include_once 'templatefunction/Iron.search.php'; $columnid = $_GET["columnid"]; $templatefile = getroot() . "/templates/searchresult.html"; if ($columnid != NULL && $columnid != '') { $templateid = getcolumnformationBycolumnid($columnid, "searchtemplate"); $templatepath = getresultData(getresult("select * from I_template where id={$templateid}"), 0, "path"); $templatefile = getroot() . "/templates/" . $templatepath; } //echo $templatefile; if (!file_exists($templatefile)) { die("The template file doesn'n exit!"); } $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 = translateSearchlist($template); $template = translateArticlelist($template); $template = translateCommonlabel($template); echo $template;
function getChanelidByColumnid($columnid) { $tempcolumnid = $columnid; $chanelId = -1; for (;;) { if ($tempcolumnid != "0") { $chanelId = $tempcolumnid; $tempcolumnid = getcolumnformationBycolumnid($tempcolumnid, "parentid"); } else { break; } } return $chanelId; }
<?php include "../conn.php"; include_once "../library/basefunction.php"; include_once "../lang/envinit.php"; include "../library/admin.column.php"; $columnid = $_GET["columnid"]; $action = $_GET["action"]; $preurl = $_GET["url"]; $functionarray = translatefunctioncode($_SESSION["functioncode"]); //检查权限 //得到频道id $channelid = $columnid; if ($columnid != "0") { //如果不是频道管理 for (;;) { $tempid = getcolumnformationBycolumnid($channelid, "parentid"); if ($tempid == "0") { break; } $channelid = $tempid; } } if ($functionarray[$channelid] != "2" && getlogininfo("adminrole") != "0") { //如果不是超管或频道管理员 die("<script type='text/javascript'>alert('" . gettext_r("noRight") . "');history.back('-1');</script>\n"); } switch ($action) { case "delete": $result = getresult("select parentid,childcount from I_column where id=" . $columnid); $parentid = getresultData($result, 0, "parentid"); $childcount = getresultData($result, 0, "childcount");
include_once 'library/basefunction.php'; include_once 'lang/envinit.php'; include_once 'templatefunction/Iron.article.php'; include_once 'templatefunction/Iron.column.php'; include_once 'templatefunction/Iron.label.php'; $columnid = $_GET["columnid"]; //echo $articleid; if (getcolumnformationBycolumnid($columnid, "isopen") == "0") { if (getaffectedrows() < 1) { //如果没有此栏目,跳转到error.html die("<script type='text/javascript'>window.location='error.html'</script>"); } die("This column is locked!"); } readcache(); $templateid = getcolumnformationBycolumnid($columnid, "columntemplate"); $templatepath = getresultData(getresult("select * from I_template where id={$templateid}"), 0, "path"); $templatefile = getroot() . "/templates/" . $templatepath; //echo $templatefile; if (!file_exists($templatefile)) { die("The template file doesn'n exit!"); } $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 = translatecolumnlist($template); $template = translateArticlelist($template); $template = translateCommonlabel($template);
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")); } } if ($columnLanguage != "Auto" && $columnLanguage != "" && is_file(getroot() . "/lang/" . $columnLanguage . ".php")) { require $columnLanguage . ".php"; } }