$a_field = new cls_field(); foreach ($mfields as $k => $v) { if ($v['available'] && !$v['issystem'] && !$v['isfunc']) { $a_field->init(); $a_field->field = $v; if (!$curuser->pmbypmids('field', $a_field->field['pmid'])) { continue; } $a_field->oldvalue = isset($actuser->info[$k]) ? $actuser->info[$k] : ''; $a_field->deal('minfosnew'); if (!empty($a_field->error)) { $c_upload->rollback(); amessage($a_field->error, M_REFERER); } $actuser->updatefield($k, $a_field->newvalue, $v['tbl']); if ($arr = multi_val_arr($a_field->newvalue, $v)) { foreach ($arr as $x => $y) { $actuser->updatefield($k . '_' . $x, $y, $v['tbl']); } } } } unset($a_field); if ($enable_uc && $actuser->info['password'] != $minfosnew['password']) { require_once M_ROOT . './include/ucenter/config.inc.php'; require_once M_ROOT . './uc_client/client.php'; if (1 != uc_user_edit($actuser->info['mname'], '', $minfosnew['password'], '', 1)) { amessage('mempassmodfai'); } } $actuser->updatedb();
} if ($channel['autobyte'] && isset($archiveadd[$channel['autobyte']])) { $archiveadd['bytenum'] = atm_byte(stripslashes($archiveadd[$channel['autobyte']]), $fields[$channel['autobyte']]['datatype']); $sqlmain .= ",bytenum='" . $archiveadd['bytenum'] . "'"; } $sqlsub = $sqlcustom = ''; foreach ($fields as $k => $v) { if ($v['available'] && !$v['isadmin'] && !$v['isfunc'] && !in_array($k, $additems)) { $a_field->field = $v; if ($curuser->pmbypmids('field', $v['pmid'])) { //字段附加权限设置 if (!empty($v['istxt'])) { $archiveadd[$k] = saveastxt(stripslashes($archiveadd[$k])); } ${'sql' . $v['tbl']} .= (${'sql' . $v['tbl']} ? ',' : '') . $k . "='" . $archiveadd[$k] . "'"; if ($arr = multi_val_arr($archiveadd[$k], $v)) { foreach ($arr as $x => $y) { ${'sql' . $v['tbl']} .= (${'sql' . $v['tbl']} ? ',' : '') . $k . '_' . $x . "='{$y}'"; } } } } } cu_sqls_deal($channel['cuid'], $archiveadd, $sqlmain, $sqlsub, $sqlcustom); //将字段之外的交互资料写入 $db->query("INSERT INTO {$tblprefix}archives SET " . $sqlmain); if (!($aid = $db->insert_id())) { $c_upload->closure(1); mcmessage('arcsaveerr', axaction(2, M_REFERER)); } else { $c_upload->closure(1, $aid);
function output_guid($guid = 0) { //禁止重复输出,未完结合辑需要输出辑内的内容 global $db, $tblprefix, $gmodels, $curuser, $timestamp, $cotypes, $c_upload, $sid, $progress; if (!$guid || !($item = $db->fetch_one("SELECT * FROM {$tblprefix}gurls WHERE guid='{$guid}' AND gatherdate<>'0'"))) { return false; } if (!$item['outputdate']) { $archivenew = empty($item['contents']) ? array() : unserialize($item['contents']); unset($item['contents']); if (empty($this->fields)) { $this->gather_fields(); } if (empty($this->oconfigs)) { $this->output_configs(); } if (empty($this->fields) || empty($this->oconfigs)) { return false; } if (!empty($this->oconfigs['musts'])) { $mustsarr = explode(',', $this->oconfigs['musts']); foreach ($mustsarr as $k) { if (empty($archivenew[$k])) { return false; } //缺少必有字段内容,输出中止 } } $c_upload->init(); $aid = $item['aid']; $gmid = $this->gmission['gmid']; $chid = $gmodels[$gmid]['chid']; $channel = read_cache('channel', $chid); $fields = read_cache('fields', $chid); $sqlmain = "sid='{$item['sid']}',chid='{$chid}',mid='" . $curuser->info['mid'] . "',mname='" . $curuser->info['mname'] . "',createdate='{$timestamp}',refreshdate='{$timestamp}'"; $sqlsub = $sqlcustom = ''; empty($this->oconfigs['caid']) || ($sqlmain .= ",caid='" . $this->oconfigs['caid'] . "'"); foreach ($cotypes as $k => $v) { $var = "ccid{$k}"; empty($this->oconfigs[$var]) || ($sqlmain .= ",{$var}='" . $this->oconfigs[$var] . "'"); } if ($fields['abstract']['available'] && !empty($this->oconfigs['autoabstract'])) { if (!empty($channel['autoabstract']) && !empty($archivenew[$channel['autoabstract']])) { $sqlmain .= ($sqlmain ? ',' : '') . "abstract='" . addslashes(autoabstract($archivenew[$channel['autoabstract']])) . "'"; } } if ($fields['thumb']['available'] && !empty($this->oconfigs['autothumb'])) { if (!empty($channel['autothumb']) && !empty($archivenew[$channel['autothumb']])) { $sqlmain .= ($sqlmain ? ',' : '') . "thumb='" . $c_upload->thumb_pick($archivenew[$channel['autothumb']], $fields[$channel['autothumb']]['datatype'], $fields['thumb']['rpid']) . "'"; } } if ($channel['autosize'] && !empty($archivenew[$channel['autosize']])) { include_once M_ROOT . '/include/fields.cls.php'; $archivenew['atmsize'] = atm_size($archivenew[$channel['autosize']], $fields[$channel['autosize']]['datatype'], $channel['autosizemode']); $sqlmain .= ",atmsize='" . $archivenew['atmsize'] . "'"; } if ($channel['autobyte'] && isset($archivenew[$channel['autobyte']])) { $archivenew['bytenum'] = atm_byte(stripslashes($archivenew[$channel['autobyte']]), $fields[$channel['autobyte']]['datatype']); $sqlmain .= ",bytenum='" . $archivenew['bytenum'] . "'"; } foreach ($fields as $k => $v) { if ($v['available'] && isset($archivenew[$k])) { if ($v['datatype'] == 'htmltext') { $archivenew[$k] = addslashes($archivenew[$k]); html_atm2tag($archivenew[$k]); $archivenew[$k] = stripslashes($archivenew[$k]); } if (!empty($v['istxt'])) { if ($aid) { if (empty($oldval)) { $oldval = $db->fetch_one("SELECT * FROM {$tblprefix}archives_{$chid} WHERE aid={$aid}"); } saveastxt($archivenew[$k], $oldval[$k]); continue; } else { $archivenew[$k] = saveastxt($archivenew[$k]); } } ${'sql' . $v['tbl']} .= (${'sql' . $v['tbl']} ? ',' : '') . $k . "='" . addslashes($archivenew[$k]) . "'"; if ($arr = multi_val_arr($archivenew[$k], $v)) { foreach ($arr as $x => $y) { ${'sql' . $v['tbl']} .= (${'sql' . $v['tbl']} ? ',' : '') . $k . '_' . $x . "='{$y}'"; } } } } unset($fields, $archivenew, $mustarr); if ($aid) { $sqlcustom && $db->query("UPDATE {$tblprefix}archives_{$chid} SET " . $sqlcustom); } else { $db->query("INSERT INTO {$tblprefix}archives SET {$sqlmain}"); if (!($aid = $db->insert_id())) { return false; } else { $db->query("INSERT INTO {$tblprefix}archives_rec SET aid='{$aid}'"); $sqlsub = "aid='{$aid}'" . ($sqlsub ? ',' : '') . $sqlsub; $needstatics = ''; for ($i = 0; $i <= $channel['addnum']; $i++) { $needstatics .= $timestamp . ','; } $sqlsub .= ",needstatics='{$needstatics}'"; $db->query("INSERT INTO {$tblprefix}archives_sub SET " . $sqlsub); $sqlcustom = "aid='{$aid}'" . ($sqlcustom ? ',' : '') . $sqlcustom; $db->query("INSERT INTO {$tblprefix}archives_{$chid} SET " . $sqlcustom); $curuser->basedeal('archive', 1, 1, 1); } $aedit = new cls_arcedit(); $aedit->set_aid($aid); $aedit->set_arcurl(); $aedit->set_cpid($aid); $curuser->pmautocheck($channel['autocheck']) && $aedit->arc_check(1, 0); $aedit->updatedb(); //归辑设置,与文档数据库无关 if (!empty($item['pid'])) { $pid = $db->result_one("SELECT aid FROM {$tblprefix}gurls WHERE guid='{$item['pid']}'"); $pid && $aedit->set_album($pid); } if ($channel['autostatic']) { arc_static($aid); } $ufids = $c_upload->ufids + explode(',', $item['ufids']); empty($ufids) || $db->query("UPDATE {$tblprefix}userfiles SET aid={$aid} WHERE ufid " . multi_str($ufids)); } $db->query("UPDATE {$tblprefix}gurls SET aid='{$aid}',outputdate='{$timestamp}',contents='',ufids='' WHERE guid='{$item['guid']}'"); $progress && $progress->output(1); } if ($this->gmission['sonid'] && !$item['abover']) { $this->output_sonid($guid, $this->gmission['sonid']); } //将合辑中的内容入库 unset($aedit, $arc, $fields, $field, $item, $archivenew, $channel, $sqlmain, $sqlsub, $sqlcustom); return true; }
$archivenew['atmsize'] = atm_size(stripslashes($archivenew[$channel['autosize']]), $fields[$channel['autosize']]['datatype'], $channel['autosizemode']); $aedit->updatefield('atmsize', $archivenew['atmsize'], 'main'); } if ($channel['autobyte'] && isset($archivenew[$channel['autobyte']])) { $archivenew['bytenum'] = atm_byte(stripslashes($archivenew[$channel['autobyte']]), $fields[$channel['autobyte']]['datatype']); $aedit->updatefield('bytenum', $archivenew['bytenum'], 'main'); } foreach ($fields as $k => $v) { if (isset($archivenew[$k])) { if ($v['available'] && !$v['isfunc']) { if ($curuser->pmbypmids('field', $v['pmid'])) { if (!empty($v['istxt'])) { $archivenew[$k] = saveastxt(stripslashes($archivenew[$k]), $aedit->namepres[$k]); } $aedit->updatefield($k, $archivenew[$k], $v['tbl']); if ($arr = multi_val_arr($archivenew[$k], $v)) { foreach ($arr as $x => $y) { $aedit->updatefield($k . '_' . $x, $y, $v['tbl']); } } } } } } $c_upload->closure(1, $aid); $aedit->updatedb(); if (!empty($archivenew['cpupdate'])) { $aedit->updatecopy($archivenew['cpupdate']); } if ($channel['autostatic']) { include_once M_ROOT . "./include/arc_static.fun.php";
function arc_ccid($ids, $coid, $updatedb = 0) { //修改分类或取消分类的操作 global $cotypes, $timestamp, $vcps; $this->basic_data(); if ($ids == $this->archive["ccid{$coid}"]) { return; } if ($ids = array_filter(explode(',', $ids))) { $oids = array_filter(explode(',', $this->archive["ccid{$coid}"])); foreach ($ids as $k => $id) { if (in_array($id, $oids)) { continue; } if (!($coclass = read_cache('coclass', $coid, $id)) || !$this->auser->pmbypmids('aadd', $coclass['apmid']) || !in_array($this->archive['chid'], explode(',', $coclass['chids']))) { unset($ids[$id]); continue; } if ($this->archive['checked'] && $cotypes[$coid]['awardcp']) { //只有已审的文档才去奖励积分 $crids = array(); if (!empty($coclass['awardcp']) && !empty($vcps['award'][$coclass['awardcp']])) { $cparr = explode('_', $coclass['awardcp']); $crids[$cparr[0]] = $cparr[1]; } if ($crids) { if (!$this->auser->crids_enough($crids)) { unset($ids[$id]); continue; } $this->auser->updatecrids($crids, 1, lang('awardcurrency')); } } } unset($coclass); } $this->updatefield("ccid{$coid}", $ids ? empty($cotypes[$coid]['asmode']) ? $ids[0] : ',' . implode(',', $ids) . ',' : '', 'main'); if ($arr = multi_val_arr($this->archive["ccid{$coid}"], $cotypes[$coid], 1)) { foreach ($arr as $x => $y) { $this->updatefield("ccid{$coid}_{$x}", $y, 'main'); } } $this->sale_define(); //校正当前文档出售设置 $updatedb && $this->updatedb(); }