예제 #1
0
function translateSdefFeildlabel($template)
{
    global $id;
    //文章id
    $id = $_GET["articleid"] != NULL ? $_GET["articleid"] : $id;
    $columnid = $_GET["columnid"] != NULL ? $_GET["columnid"] : getarticleinfo($_GET["articleid"], "columnid");
    if ($columnid == NULL && $id != NULL) {
        $columnid = getarticleinfo($id, "columnid");
    }
    if ($columnid != NULL && $columnid > 0 || $id != NULL && $id > 0) {
        //如果栏目id为空或者小于1,则不对模板进行处理
        $sdef_fields = getresult("select * from I_field where columnid in (" . getChanelidByColumnid($columnid) . ")");
        //echo "select * from I_field where columnid in (".getChanelidByColumnid($columnid).")";
        $fieldname = "";
        $fieldvalue = "";
        while ($row = getresultarray($sdef_fields)) {
            $fieldname = $row["fieldname"];
            $temparticle = getresult("select * from I_article where id={$id}");
            if (!$temparticle) {
                continue;
            }
            $fieldvalue = getresultData($temparticle, 0, $fieldname);
            //如果值为空,则替换为空串
            if ($fieldvalue == NULL) {
                $fieldvalue = "";
            }
            $template = str_replace("【#" . $fieldname . "】", $fieldvalue, $template);
        }
    }
    return $template;
}
예제 #2
0
}
//得到频道id
$channelid = $columnid;
//echo "郝学峰";
for (;;) {
    if ($channelid == null || $channelid == "") {
        break;
    }
    $tempid = getcolumnformationBycolumnid($channelid, "parentid");
    if ($tempid == null || $tempid == "" || $tempid == "0") {
        break;
    }
    $channelid = $tempid;
}
//对文章没有权限
if ($_GET["articleid"] != NULL && $functionarray[$channelid] == "1" && getarticleinfo($_GET["articleid"], "adminid") != getlogininfo("adminid")) {
    //如果不是超管或频道管理员
    die("<script type='text/javascript'>alert('" . gettext_r("noRight") . "');history.back('-1');</script>\n");
}
//对此频道没有权限
//print_r($functionarray);
if ($functionarray[$channelid] != "1" && $functionarray[$channelid] != "2" && getlogininfo("adminrole") != "0") {
    die("<script type='text/javascript'>alert('" . gettext_r("noRight") . "');history.back('-1');</script>\n");
}
switch ($action) {
    case "add":
        if ($_POST["submmit2"] == gettext_r("submit")) {
            $columnid = $_POST["columnid"];
            $title = $_POST["title"];
            $keywords = $_POST["keywords"];
            $author = $_POST["author"];