Пример #1
0
function ReListHtmlMore($start, $classid, $from)
{
    global $empire, $public_r, $fun_r, $class_r, $dbtbpre;
    $start = (int) $start;
    $classid = eReturnInids($classid);
    if (empty($classid)) {
        printerror("ErrorUrl", $from);
    }
    $b = 0;
    $sql = $empire->query("select classid,classtempid,islast,islist from {$dbtbpre}enewsclass where classid>{$start} and classid in(" . $classid . ") order by classid limit " . $public_r[relistnum]);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        //大栏目
        if (!$r[islast]) {
            if ($r[islist] == 1) {
                ListHtml($r[classid], $ret_r, 3);
            } elseif ($r[islist] == 3) {
                ReClassBdInfo($r[classid]);
            } else {
                $classtemp = $r[islist] == 2 ? GetClassText($r[classid]) : GetClassTemp($r['classtempid']);
                NewsBq($r[classid], $classtemp, 0, 0);
            }
        } else {
            ListHtml($r[classid], $ret_r, 0);
        }
        $end_classid = $r[classid];
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror("ReClassidAllSuccess", $from);
    }
    echo $fun_r[OneReListNewsSuccess] . "(ID:<font color=red><b>" . $end_classid . "</b></font>)<script>self.location.href='ecmschtml.php?enews=ReListHtmlMore&start={$end_classid}&classid={$classid}&from=" . urlencode($from) . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Пример #2
0
function ReListHtml($classid, $enews = 0)
{
    global $empire, $class_r, $dbtbpre;
    $classid = (int) $classid;
    if (!$classid) {
        printerror("NotChangeReClassid", "history.go(-1)");
    }
    $r = $empire->fetch1("select classtempid,islist from {$dbtbpre}enewsclass where classid='{$classid}'");
    if ($class_r[$classid][islast]) {
        ListHtml($classid, $ret_r, 0);
    } else {
        if ($r[islist] == 1) {
            ListHtml($classid, $ret_r, 3);
        } elseif ($r[islist] == 3) {
            ReClassBdInfo($classid);
        } else {
            $classtemp = $r[islist] == 2 ? GetClassText($classid) : GetClassTemp($r['classtempid']);
            NewsBq($classid, $classtemp, 0, 0);
        }
    }
    if ($enews == 1) {
        return "";
    }
    insert_dolog("");
    //操作日志
    printerror("ReClassidSuccess", "history.go(-1)");
}
Пример #3
0
function EditClass($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre;
    //修改外部栏目
    if ($add[ecmsclasstype]) {
        EditWbClass($add, $userid, $username);
    }
    $add[classid] = (int) $add[classid];
    $add[classpath] = trim($add[classpath]);
    $checkclasspath = $add['classpath'];
    if ($add['oldclasspath'] != $add['pripath'] . $add['oldcpath']) {
        $add[classpath] = $add['oldcpath'];
    }
    if (!$add[classname] || !$add[classpath] || !$add[modid] || !$add[classid]) {
        printerror("EmptyClass", "");
    }
    if ($add[islast] && (!$add[newstempid] || !$add[listtempid])) {
        printerror("LastMustChange", "");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "class");
    $add = DoPostClassVar($add);
    $add[oldmodid] = (int) $add[oldmodid];
    //改变目录
    $classpath = $add[pripath] . $add[classpath];
    if ($add[oldclasspath] != $classpath && $checkclasspath == $add['oldcpath']) {
        if (file_exists("../../" . $classpath)) {
            //检测目录是否存在
            printerror("ReClasspath", "");
        }
    }
    //取得表名
    $tabler = GetModTable($add[modid]);
    $tabler[tid] = (int) $tabler[tid];
    //修改大栏目
    if (!$add[islast]) {
        //改变大栏目
        if ($add[bclassid] != $add[oldbclassid]) {
            //转到主栏目
            if (empty($add[bclassid])) {
                $sonclass = "";
                $featherclass = "";
                //取得本栏目的子栏目
                $r = $empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //改变父栏目的子栏目
                $where = ReturnClass($r[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($o = $empire->fetch($osql)) {
                    $newsonclass = str_replace($r[sonclass], "|", $o[sonclass]);
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$o['classid']}'");
                }
                //修改子栏目的父栏目
                $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "%|'");
                while ($o = $empire->fetch($osql)) {
                    $newclasspath = str_replace($r[classpath] . "/", $classpath . "/", $o[classpath]);
                    $newfeatherclass = str_replace($r[featherclass], "|", $o[featherclass]);
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$o['classid']}'");
                }
            } else {
                //大栏目跟原栏目相同
                if ($add[classid] == $add[bclassid]) {
                    printerror("BclassIsself", "");
                }
                //取得现在大栏目的值
                $b = $empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
                //检测大栏目是否为终级栏目
                if ($b[islast]) {
                    printerror("BclassNotLast", "");
                }
                if ($b[wburl]) {
                    printerror("BclassNotWb", "");
                }
                //是否非法父栏目
                if ($b[featherclass]) {
                    $c_nb_r = explode("|" . $add[classid] . "|", $b[featherclass]);
                    if (count($c_nb_r) != 1) {
                        printerror("BclassIssmall", "");
                    }
                }
                if (empty($b[featherclass])) {
                    $b[featherclass] = "|";
                }
                $featherclass = $b[featherclass] . $add[bclassid] . "|";
                //取得现在栏目本身的值
                $o = $empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //修改子栏目的父栏目
                $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "|%'");
                while ($or = $empire->fetch($osql)) {
                    $newclasspath = str_replace($o[classpath] . "/", $classpath . "/", $or[classpath]);
                    if (empty($o[featherclass])) {
                        $newfeatherclass = $b[featherclass] . $add[bclassid] . $or[featherclass];
                    } else {
                        $newfeatherclass = str_replace($o[featherclass], $featherclass, $or[featherclass]);
                    }
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$or['classid']}'");
                }
                //改变旧大栏目的所有子栏目
                $owhere = ReturnClass($o[featherclass]);
                if (empty($owhere)) {
                    $owhere = "classid=0";
                }
                $oosql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $owhere);
                while ($oo = $empire->fetch($oosql)) {
                    $newsonclass = str_replace($o[sonclass], "|", $oo[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$oo['classid']}'");
                }
                //改变新大栏目的子栏目
                $where = ReturnClass($featherclass);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $nbsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($nb = $empire->fetch($nbsql)) {
                    if (empty($nb[sonclass])) {
                        $nb[sonclass] = "|";
                    }
                    $newsonclass = $nb[sonclass] . substr($o[sonclass], 1);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'");
                }
            }
            $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'";
        }
        //绑定域名应用于子栏目
        if ($add['UrlToSmall']) {
            UpdateSmallClassDomain($add['classid'], $add['classurl'], $classpath);
        }
        //wap模板应用于子栏目
        if ($add['wapstylesclass']) {
            $empire->query("update {$dbtbpre}enewsclass set wapstyleid='{$add['wapstyleid']}' where featherclass like '%|" . $add[classid] . "|%'");
        }
        //修改数据库资料
        $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',islist={$add['islist']},listtempid={$add['listtempid']},lencord={$add['lencord']},searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},openadd={$add['openadd']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}'" . $change . " where classid='{$add['classid']}'");
        //副表
        $ret_cr = ReturnClassAddF($add, 1);
        $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . addslashes($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'");
        GetClass();
        //生成栏目文件
        if ($add[islist] == 0 || $add[islist] == 2) {
            $classtemp = $add[islist] == 2 ? GetClassText($add[classid]) : GetClassTemp($add['classtempid']);
            NewsBq($add[classid], $classtemp, 0, 1);
        } elseif ($add[islist] == 3) {
            ReClassBdInfo($add[classid]);
        }
        if ($add[islist] == 2) {
            //删除动态模板缓存文件
            DelOneTempTmpfile('classpage' . $add[classid]);
        }
    } else {
        if ($add[modid] != $add[oldmodid]) {
            $chmtbr = GetModTable($add[oldmodid]);
            if ($chmtbr[tid] != $tabler[tid] && $chmtbr[tbname]) {
                $chmchecknum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $chmtbr[tbname] . " where classid='{$add['classid']}'");
                if ($chmchecknum) {
                    printerror("ClassChangeModHaveInfo", "history.go(-1)");
                }
            }
        }
        //改变大栏目
        if ($add[bclassid] != $add[oldbclassid]) {
            //转到主栏目
            if (empty($add[bclassid])) {
                $sonclass = "";
                $featherclass = "";
                //取得栏目原本的大栏目
                $r = $empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //改变原本大栏目的子栏目
                $where = ReturnClass($r[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $bsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where);
                while ($br = $empire->fetch($bsql)) {
                    $newsonclass = str_replace("|" . $add[classid] . "|", "|", $br[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'");
                }
            } else {
                //取得现在大栏目的值
                $b = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
                //检测大栏目是否为终级栏目
                if ($b[islast]) {
                    printerror("BclassNotLast", "");
                }
                if ($b[wburl]) {
                    printerror("BclassNotWb", "");
                }
                if (empty($b[featherclass])) {
                    $b[featherclass] = "|";
                }
                $featherclass = $b[featherclass] . $add[bclassid] . "|";
                //改变新大栏目的子栏目
                $where = ReturnClass($featherclass);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($nb = $empire->fetch($bsql)) {
                    if (empty($nb[sonclass])) {
                        $nb[sonclass] = "|";
                    }
                    $newsonclass = $nb[sonclass] . $add[classid] . "|";
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'");
                }
                //改变旧大栏目的子栏目
                $o = $empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                $where = ReturnClass($o[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($ob = $empire->fetch($osql)) {
                    $newsonclass = str_replace("|" . $add[classid] . "|", "|", $ob[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$ob['classid']}'");
                }
            }
            $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'";
        }
        //应用于已生成的信息
        if ($add['tobetempinfo']) {
            $upsql = $empire->query("update {$dbtbpre}ecms_" . $tabler[tbname] . " set newstempid={$add['newstempid']} where classid='{$add['classid']}'");
        }
        //文件前缀
        $add[filename_qz] = RepFilenameQz($add[filename_qz]);
        $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',link_num={$add['link_num']},lencord={$add['lencord']},newstempid={$add['newstempid']},listtempid={$add['listtempid']},newspath='{$add['newspath']}',filename={$add['filename']},filetype='{$add['filetype']}',openpl={$add['openpl']},openadd={$add['openadd']},newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},addinfofen={$add['addinfofen']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},checkqadd={$add['checkqadd']},qaddlist={$add['qaddlist']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}'" . $change . " where classid='{$add['classid']}'");
        //副表
        $ret_cr = ReturnClassAddF($add, 1);
        $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . addslashes($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'");
        GetClass();
    }
    //移动目录
    if ($add[bclassid] != $add[oldbclassid] || $add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath']) {
        $opath = "../../" . $add[oldclasspath];
        $newpath = "../../" . $classpath;
        MovePath($opath, $newpath);
        $opath = "../../d/file/" . $add[oldclasspath];
        $npath = "../../d/file/" . $classpath;
        CopyPath($opath, $npath);
    } else {
        if ($add['oldcpath'] != $add['classpath']) {
            AlterClassPath($add['classid'], $add['islast'], $add['oldclasspath'], $classpath);
            GetClass();
        }
    }
    //删除缓存文件
    if ($add[oldclassname] != $add[classname] || $add[bclassid] != $add[oldbclassid]) {
        DelListEnews();
        GetSearch($add[modid]);
    } else {
        if ($add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath'] || $add[listdt] != $add[oldlistdt]) {
            DelListEnews();
        }
        if ($add[openadd] != $add[oldopenadd] || $add[modid] != $add[oldmodid]) {
            GetSearch($add[modid]);
            if ($add[modid] != $add[oldmodid]) {
                GetSearch($add[oldmodid]);
            }
        }
    }
    //修改栏目扩展名
    if ($add[oldclasstype] != $add[classtype]) {
        $todaytime = date("Y-m-d H:i:s");
        if ($add[islast]) {
            $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where checked=1 and classid='{$add['classid']}'";
            $lencord = $add[oldlencord];
            $num = $empire->gettotal($query);
        } else {
            $lencord = $add[oldlencord];
            if ($add[oldislist] == 1) {
                $where = ReturnClass($class_r[$add[classid]][sonclass]);
                $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where checked=1 and (" . $where . ")";
                $num = $empire->gettotal($query);
            } else {
                $num = 1;
            }
        }
        RenameListfile($add[classid], $lencord, $num, $add[oldclasstype], $add[classtype], $classpath);
    }
    //来源
    if ($add['from']) {
        $returnurl = "ListPageClass.php";
    } else {
        $returnurl = "ListClass.php";
    }
    TogNotReClass(1);
    if ($sql) {
        insert_dolog("classid=" . $add[classid] . "<br>classname=" . $add[classname]);
        //操作日志
        printerror("EditClassSuccess", $returnurl);
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Пример #4
0
function hReClassHtml($sonclass)
{
    global $empire, $dbtbpre, $class_r;
    $r = explode("|", $sonclass);
    $count = count($r);
    for ($i = 1; $i < $count - 1; $i++) {
        //终极栏目
        if ($class_r[$r[$i]]['islast']) {
            if (!$class_r[$r[$i]]['listdt']) {
                ListHtml($r[$i], '', 0, $userlistr);
            }
        } elseif ($class_r[$r[$i]]['islist'] == 1) {
            if (!$class_r[$r[$i]]['listdt']) {
                ListHtml($r[$i], '', 3);
            }
        } elseif ($class_r[$r[$i]]['islist'] == 3) {
            ReClassBdInfo($r[$i]);
        } else {
            $cr = $empire->fetch1("select classtempid from {$dbtbpre}enewsclass where classid='{$r[$i]}'");
            $classtemp = $class_r[$r[$i]]['islist'] == 2 ? GetClassText($r[$i]) : GetClassTemp($cr['classtempid']);
            NewsBq($r[$i], $classtemp, 0, 0);
        }
    }
}