Пример #1
0
function EditZt($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre;
    $add[ztid] = (int) $add[ztid];
    $add[ztpath] = trim($add[ztpath]);
    if (!$add[ztname] || !$add[listtempid] || !$add[ztpath] || !$add[ztid]) {
        printerror("EmptyZt", "");
    }
    CheckLevel($userid, $username, $classid, "zt");
    $add = DoPostZtVar($add);
    //改变目录
    if ($add[oldztpath] != $add[ztpath]) {
        $createpath = '../../' . $add[ztpath];
        if (file_exists($createpath)) {
            printerror("ReZtpath", "");
        }
        if ($add['oldpripath'] == $add['pripath']) {
            $new = "../../";
            @rename($new . $add[oldztpath], $new . $add[ztpath]);
            //改变目录名
        } else {
            CreateZtPath($add[ztpath]);
            //建立专题目录
        }
    }
    //取得表名
    $tabler = GetModTable(GetListtempMid($add[listtempid]));
    $tabler[tid] = (int) $tabler[tid];
    $sql = $empire->query("update {$dbtbpre}enewszt set ztname='{$add['ztname']}',ztnum={$add['ztnum']},listtempid={$add['listtempid']},ztpath='{$add['ztpath']}',zttype='{$add['zttype']}',newline={$add['newline']},zturl='{$add['zturl']}',hotline={$add['hotline']},goodline={$add['goodline']},classid={$add['classid']},hotplline={$add['hotplline']},firstline={$add['firstline']},islist={$add['islist']},maxnum={$add['maxnum']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',reorder='{$add['reorder']}',intro='{$add['intro']}',ztimg='{$add['ztimg']}',zcid={$add['zcid']},jstempid={$add['jstempid']},showzt={$add['showzt']},ztpagekey='{$add['ztpagekey']}',classtempid='{$add['classtempid']}',myorder={$add['myorder']},nrejs={$add['nrejs']},usezt='{$add['usezt']}',yhid='{$add['yhid']}' where ztid='{$add['ztid']}'");
    //副表
    $ret_zr = ReturnZtAddF($add, 1);
    $empire->query("update {$dbtbpre}enewsztadd set classtext='" . addslashes($add[classtext]) . "'" . $ret_zr[0] . " where ztid='{$add['ztid']}'");
    GetClass();
    //更新缓存
    //生成页面
    if ($add[islist] == 0 || $add[islist] == 2) {
        $classtemp = $add[islist] == 2 ? GetZtText($add[ztid]) : GetClassTemp($add['classtempid']);
        NewsBq($add[ztid], $classtemp, 3, 1);
    }
    if ($sql) {
        insert_dolog("ztid=" . $add[ztid] . "<br>ztname=" . $add[ztname]);
        //操作日志
        printerror("EditZtSuccess", "ListZt.php");
    } else {
        printerror("DbError", "");
    }
}
Пример #2
0
function ReClassPath($start = 0)
{
    global $empire, $public_r, $dbtbpre;
    $start = (int) $start;
    $sql = $empire->query("select classid,classpath,islast from {$dbtbpre}enewsclass where wburl='' and classid>{$start} order by classid limit " . $public_r[relistnum]);
    $b = 0;
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[classid];
        $returnpath = FormatClassPath($r[classpath], $r[islast]);
        echo "Create Path:" . $returnpath . " success!<br>";
    }
    //恢复专题目录
    if (empty($b)) {
        $zsql = $empire->query("select ztid,ztpath from {$dbtbpre}enewszt order by ztid");
        while ($zr = $empire->fetch($zsql)) {
            CreateZtPath($zr[ztpath]);
        }
        //恢复标题分类目录
        $tsql = $empire->query("select typeid,tpath from {$dbtbpre}enewsinfotype order by typeid");
        while ($tr = $empire->fetch($tsql)) {
            CreateInfoTypePath($tr['tpath']);
        }
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror("ReClassPathSuccess", "ReHtml/ChangeData.php" . hReturnEcmsHashStrHref2(1));
    }
    echo "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ecmschtml.php?enews=ReClassPath&start={$newstart}" . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Пример #3
0
function EditZt($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre, $loginlevel;
    $add[ztid] = (int) $add[ztid];
    $add[ztpath] = trim($add[ztpath]);
    if (!$add[ztname] || !$add[listtempid] || !$add[ztpath] || !$add[ztid]) {
        printerror("EmptyZt", "");
    }
    $add = DoPostZtVar($add);
    //CheckLevel($userid,$username,$classid,"zt");
    $returnandlevel = CheckAndUsernamesLevel('dozt', $add[ztid], $userid, $username, $loginlevel);
    $upusernames = '';
    if ($returnandlevel == 2) {
        $upusernames = ",usernames='{$add['usernames']}'";
    }
    //改变目录
    if ($add[oldztpath] != $add[ztpath]) {
        $createpath = '../../' . $add[ztpath];
        if (file_exists($createpath)) {
            printerror("ReZtpath", "");
        }
        if ($add['oldpripath'] == $add['pripath']) {
            $new = "../../";
            @rename($new . $add[oldztpath], $new . $add[ztpath]);
            //改变目录名
        } else {
            CreateZtPath($add[ztpath]);
            //建立专题目录
        }
    }
    //取得表名
    $tabler = GetModTable(GetListtempMid($add[listtempid]));
    $tabler[tid] = (int) $tabler[tid];
    $sql = $empire->query("update {$dbtbpre}enewszt set ztname='{$add['ztname']}',ztnum={$add['ztnum']},listtempid={$add['listtempid']},ztpath='{$add['ztpath']}',zttype='{$add['zttype']}',zturl='{$add['zturl']}',classid={$add['classid']},islist={$add['islist']},maxnum={$add['maxnum']},reorder='{$add['reorder']}',intro='{$add['intro']}',ztimg='{$add['ztimg']}',zcid={$add['zcid']},showzt={$add['showzt']},ztpagekey='{$add['ztpagekey']}',classtempid='{$add['classtempid']}',myorder={$add['myorder']},usezt='{$add['usezt']}',yhid='{$add['yhid']}',endtime='{$add['endtime']}',closepl='{$add['closepl']}',checkpl='{$add['checkpl']}',pltempid='{$add['pltempid']}'" . $upusernames . " where ztid='{$add['ztid']}'");
    //副表
    $ret_zr = ReturnZtAddF($add, 1);
    $empire->query("update {$dbtbpre}enewsztadd set classtext='" . eaddslashes2($add[classtext]) . "'" . $ret_zr[0] . " where ztid='{$add['ztid']}'");
    //更新专题子类
    if ($add['endtime'] != $add['oldendtime']) {
        $empire->query("update {$dbtbpre}enewszttype set endtime='{$add['endtime']}' where ztid='{$add['ztid']}'");
    }
    //更新附件
    UpdateTheFileEditOther(2, $add['ztid'], 'other');
    GetClass();
    //更新缓存
    //生成页面
    if ($add[islist] == 0 || $add[islist] == 2) {
        $classtemp = $add[islist] == 2 ? GetZtText($add[ztid]) : GetClassTemp($add['classtempid']);
        NewsBq($add[ztid], $classtemp, 3, 1);
    }
    if ($sql) {
        $returnurl = 'special/ListZt.php' . hReturnEcmsHashStrHref2(1);
        if ($add['from']) {
            $returnurl = 'special/AddZt.php?enews=EditZt&ztid=' . $add[ztid] . '&from=1' . hReturnEcmsHashStrHref2(0);
        }
        insert_dolog("ztid=" . $add[ztid] . "<br>ztname=" . $add[ztname]);
        //操作日志
        printerror("EditZtSuccess", $returnurl);
    } else {
        printerror("DbError", "");
    }
}