Example #1
0
function EditSp($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $add['varname'] = RepPostVar($add['varname']);
    $spid = (int) $add[spid];
    if (!$spid || !$add[spname] || !$add[varname]) {
        printerror("EmptySp", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "sp");
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssp where varname='{$add['varname']}' and spid<>{$spid} limit 1");
    if ($num) {
        printerror("HaveSp", "history.go(-1)");
    }
    $add[sptype] = (int) $add[sptype];
    $add[cid] = (int) $add[cid];
    $add[classid] = (int) $add[classid];
    $add[tempid] = (int) $add[tempid];
    $add[maxnum] = (int) $add[maxnum];
    $sptime = time();
    $groupid = ReturnSpGroup($add[groupid]);
    $userclass = ReturnSpGroup($add[userclass]);
    $username = '******' . $add[username] . ',';
    $add[isclose] = (int) $add[isclose];
    $add[cladd] = (int) $add[cladd];
    $sql = $empire->query("update {$dbtbpre}enewssp set spname='{$add['spname']}',varname='{$add['varname']}',sppic='{$add['sppic']}',spsay='{$add['spsay']}',sptype='{$add['sptype']}',cid='{$add['cid']}',classid='{$add['classid']}',tempid='{$add['tempid']}',maxnum='{$add['maxnum']}',groupid='{$groupid}',userclass='{$userclass}',username='******',isclose='{$add['isclose']}',cladd='{$add['cladd']}' where spid='{$spid}'");
    if ($sql) {
        //操作日志
        insert_dolog("spid=" . $spid . "<br>spname=" . $add[spname]);
        printerror("EditSpSuccess", "ListSp.php?cid={$add['fcid']}&fclassid={$add['fclassid']}&fsptype={$add['fsptype']}");
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Example #2
0
function EditSp($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $add['varname'] = RepPostVar($add['varname']);
    $spid = (int) $add[spid];
    if (!$spid || !$add[spname] || !$add[varname]) {
        printerror("EmptySp", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "sp");
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssp where varname='{$add['varname']}' and spid<>{$spid} limit 1");
    if ($num) {
        printerror("HaveSp", "history.go(-1)");
    }
    $add[sptype] = (int) $add[sptype];
    $add[cid] = (int) $add[cid];
    $add[classid] = (int) $add[classid];
    $add[tempid] = (int) $add[tempid];
    $add[maxnum] = (int) $add[maxnum];
    $sptime = time();
    $groupid = ReturnSpGroup($add[groupid]);
    $userclass = ReturnSpGroup($add[userclass]);
    $username = '******' . $add[username] . ',';
    $add[isclose] = (int) $add[isclose];
    $add[cladd] = (int) $add[cladd];
    $add['refile'] = (int) $add['refile'];
    $add['spfile'] = DoRepFileXg($add['spfile']);
    $add['oldspfile'] = DoRepFileXg($add['oldspfile']);
    $add['spfileline'] = (int) $add['spfileline'];
    $add['spfilesub'] = (int) $add['spfilesub'];
    $add['filepass'] = (int) $add['filepass'];
    $sql = $empire->query("update {$dbtbpre}enewssp set spname='{$add['spname']}',varname='{$add['varname']}',sppic='{$add['sppic']}',spsay='{$add['spsay']}',sptype='{$add['sptype']}',cid='{$add['cid']}',classid='{$add['classid']}',tempid='{$add['tempid']}',maxnum='{$add['maxnum']}',groupid='{$groupid}',userclass='{$userclass}',username='******',isclose='{$add['isclose']}',cladd='{$add['cladd']}',refile='{$add['refile']}',spfile='{$add['spfile']}',spfileline='{$add['spfileline']}',spfilesub='{$add['spfilesub']}' where spid='{$spid}'");
    //更新附件
    UpdateTheFileEditOther(7, $spid, 'other');
    //生成碎片文件
    if ($add['refile']) {
        //旧文件
        if ($add['spfile'] != $add['oldspfile']) {
            DelSpReFile($add['oldspfile']);
        }
        DoSpReFile($add, 0);
    }
    if ($sql) {
        //操作日志
        insert_dolog("spid=" . $spid . "<br>spname=" . $add[spname]);
        printerror("EditSpSuccess", "ListSp.php?cid={$add['fcid']}&fclassid={$add['fclassid']}&fsptype={$add['fsptype']}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}