Esempio n. 1
0
function AddSpInfo($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $spid = (int) $add[spid];
    if (!$spid) {
        printerror('ErrorUrl', '');
    }
    //验证
    $spr = CheckSpInfoLevel($spid);
    if ($spr[sptype] == 1) {
        $log = AddSpInfo1($spid, $spr, $add);
    } elseif ($spr[sptype] == 2) {
        $log = AddSpInfo2($spid, $spr, $add);
    } else {
        printerror('ErrorUrl', '');
    }
    //删除多余碎片信息
    DelMoreSpInfo($spid, $spr);
    //操作日志
    insert_dolog($log);
    printerror("AddSpInfoSuccess", "AddSpInfo.php?enews=AddSpInfo&spid={$spid}");
}
Esempio n. 2
0
function LoadInSpInfo($add, $userid, $username)
{
    global $empire, $dbtbpre, $class_r, $emod_r, $etable_r;
    $spid = (int) $add[spid];
    if (!$spid) {
        printerror('ErrorUrl', '');
    }
    //验证
    $spr = CheckSpInfoLevel($spid);
    $tbname = RepPostVar($add['tbname']);
    $infoids = $add['infoids'];
    if (!$tbname || !$infoids) {
        printerror('ErrorUrl', '');
    }
    $tbr = $empire->fetch1("select tbname from {$dbtbpre}enewstable where tbname='{$tbname}' limit 1");
    if (!$tbr['tbname']) {
        printerror('ErrorUrl', '');
    }
    //简介字段
    $mid = $etable_r[$tbname]['mid'];
    $smalltextf = $emod_r[$mid]['smalltextf'];
    $sf = '';
    if ($smalltextf && $smalltextf != ',') {
        $smr = explode(',', $smalltextf);
        $sf = $smr[1];
    }
    $addf = '';
    if ($sf && !strstr($emod_r[$mid]['tbdataf'], ',' . $sf . ',')) {
        $addf = ',' . $sf;
    }
    //导入
    $infor = explode(',', $infoids);
    $count = count($infor);
    for ($i = 0; $i < $count; $i++) {
        $infoid = (int) $infor[$i];
        if (!$infoid) {
            continue;
        }
        $r = $empire->fetch1("select id,classid,isurl,titleurl,newstime,titlepic,title,stb" . $addf . " from {$dbtbpre}ecms_" . $tbname . " where id='{$infoid}' limit 1");
        if (!$r['id']) {
            continue;
        }
        if ($sf && !$addf) {
            $finfor = $empire->fetch1("select " . $sf . " from {$dbtbpre}ecms_" . $tbname . "_data_" . $r[stb] . " where id='{$infoid}' limit 1");
            $r['smalltext'] = $finfor[$sf];
        } else {
            $r['smalltext'] = $r[$sf];
        }
        $r['newstime'] = date("Y-m-d H:i:s", $r['newstime']);
        if ($spr[sptype] == 1) {
            $log = AddSpInfo1($spid, $spr, $r);
        } elseif ($spr[sptype] == 2) {
            $log = AddSpInfo2($spid, $spr, $r, 1);
        } else {
            printerror('ErrorUrl', '');
        }
    }
    //删除多余碎片信息
    DelMoreSpInfo($spid, $spr);
    //操作日志
    insert_dolog("tbname={$tbname}<br>id={$infoids}");
    printerror("LoadInSpInfoSuccess", "ListSpInfo.php?spid={$spid}" . hReturnEcmsHashStrHref2(0));
}