} $_SGLOBAL['db']->query('UPDATE ' . tname($tablename) . ' SET grade=\'-1\' WHERE itemid IN (\'' . $itemidstr . '\')'); break; case 'reply': $_SGLOBAL['db']->query('UPDATE ' . tname($tablename) . ' SET allowreply=\'' . intval($_POST['allowreply']) . '\' WHERE itemid IN (\'' . $itemidstr . '\')'); break; case 'delete': //ɾ³ýhtml deleteitems('itemid', '\'' . $itemidstr . '\'', 1); break; case 'movecat': $catarr = explode('_', $_POST['opcatid']); $_SGLOBAL['db']->query('UPDATE ' . tname($tablename) . ' SET type=\'' . $catarr[0] . '\', catid=\'' . $catarr[1] . '\' WHERE itemid IN (\'' . $itemidstr . '\')'); break; case 'republish': moveitemfolder('\'' . $itemidstr . '\'', 2, 0); break; case 'remove': if ($_GET['status'] != 'delete') { //·¢²¼Ïä->ɾ³ý deleteitems('itemid', $itemidstr, 0); } else { //´ýÉóÏä->ɾ³ý deleteitems('itemid', $itemidstr, 0, 1); } break; } showmessage('check_op_ok', $theurl . '&page=' . $page . '&type=' . $type . '&grade=' . $grade . '&status=' . $status . '&searchtype=' . $searchtype . '&searchkey=' . rawurlencode($searchkeys)); } //GET METHOD $viewclass_help = $viewclass_no = $viewclass_ban = $viewclass_delete = $viewclass_yes = '';
function deleteitems($colname, $idsarr, $undel = 0, $from = 0) { global $_SGLOBAL, $_SCONFIG; include_once S_ROOT . './function/tag.func.php'; if (is_array($idsarr)) { $ids = simplode($idsarr); } else { $ids = $idsarr; } if ($undel) { moveitemfolder($idsarr, $from, 2, $colname); //Òƶ¯µ½À¬»øÏä return true; } if (!$from) { $hasharr = $itemarr = array(); $itemidarr = array(); $uidarr = array(); $filearr = array(); //spaceitems//¸Ä±äÓû§Í³¼ÆÊý¾Ý $numarr = array(); $itemtypearr = array(); $itemuidarr = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceitems') . " WHERE {$colname} IN ({$ids})"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $type = $value['type']; $hasharr[] = md5($value['subject']); if (empty($itemarr[$type])) { $itemarr[$type] = array(); } if (empty($numarr[$value['uid']][$type])) { $numarr[$value['uid']][$type] = 0; } if (empty($numarr[$value['uid']]['all'])) { $numarr[$value['uid']]['all'] = 0; } $itemarr[$type][] = $value['itemid']; $uidarr[$value['uid']] = $value['uid']; $itemidarr[] = $value['itemid']; if ($type != 'news') { $numarr[$value['uid']]['all']++; $numarr[$value['uid']][$type]++; } $itemtypearr[$value['itemid']] = $value['type']; $itemuidarr[$value['itemid']] = $value['uid']; $delhtmlarr[$value['catid']][] = $value['itemid']; } if (empty($itemidarr)) { return false; } $itemids = implode('\',\'', $itemidarr); //ɾ³ý²É¼¯·ÀÖؼǼ if (!empty($hasharr)) { $hash = '\'' . implode('\',\'', $hasharr) . '\''; $_SGLOBAL['db']->query("DELETE FROM " . tname('robotlog') . " WHERE hash IN ({$hash})"); } //Ö÷ÌâÌù $_SGLOBAL['db']->query("DELETE FROM " . tname('spaceitems') . " WHERE itemid IN ('{$itemids}')"); //ÄÚÈÝ foreach ($_SGLOBAL['type'] as $type) { if (!in_array($type, $itemtypearr)) { continue; } $tablename = tname('spacenews'); $_SGLOBAL['db']->query("DELETE FROM {$tablename} WHERE itemid IN ('{$itemids}')"); } //attachments//²»¸Ä±äÓû§Í³¼ÆÊý¾Ý $uidattachs = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!empty($value['filepath'])) { $filearr[] = A_DIR . '/' . $value['filepath']; } if (!empty($value['thumbpath'])) { $filearr[] = A_DIR . '/' . $value['thumbpath']; } } $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); //spacecomments $_SGLOBAL['db']->query("DELETE FROM " . tname('spacecomments') . " WHERE itemid IN ('{$itemids}')"); //ɾ³ý²¢¸ü±ítag×ÜÊý $tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array()); foreach ($itemidarr as $id) { postspacetag('update', $type, $id, $tagarr, '1'); } //¾Ù±¨ÐÅÏ¢ $_SGLOBAL['db']->query("DELETE FROM " . tname('reports') . " WHERE itemid IN ('{$itemids}')"); //ɾ³ý¸½¼þ if (!empty($filearr)) { foreach ($filearr as $value) { if (!@unlink($value)) { errorlog('attachment', 'Unlink ' . $value . ' Error.'); } } } //ɾ³ýhtmlÎļþ if ($_SCONFIG['makehtml'] == 1) { include_once S_ROOT . '/data/system/htmlcat.cache.php'; foreach ($delhtmlarr as $catid => $itemidarr) { foreach ($itemidarr as $itemid) { $htmlpath = S_ROOT . '/' . substr($_SCONFIG['newspath'], 2) . '/' . substr($catarr[$catid]['htmlpath'], 2); $syear = sgmdate($value['dateline'], 'Y'); $smoon = sgmdate($value['dateline'], 'n'); $file = $htmlpath . '/' . $syear . '/' . $smoon . '/' . $catarr[$catid]['pre_html'] . $itemid . '.html'; @unlink($file); } } showmessage('delete_html', 'admincp.php?action=makehtml&op=updatehtml&do=updatelisthtml'); } else { foreach ($itemidarr as $itemid) { if ($itemtypearr[$itemid] == 'news') { $id = $itemid; } else { $id = $itemuidarr[$itemid]; } $idvalue = $id > 9 ? substr($id, -2, 2) : $id; $filedir = H_DIR . '/' . $idvalue; if (is_dir($filedir)) { $filearr = sreaddir($filedir); foreach ($filearr as $file) { if (preg_match("/\\-{$itemid}(\\.|\\-)/i", $file)) { @unlink($filedir . '/' . $file); } } } } } updatecredit('delinfo', $uidarr); } else { $itemidarr = array(); $oitemidarr = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('postitems') . " WHERE {$colname} IN ({$ids})"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $itemidarr[] = $value['itemid']; $oitemidarr[] = $value['oitemid']; $tag_itemid[] = empty($value['oitemid']) ? $value['itemid'] : $value['oitemid']; } $itemids = implode('\',\'', $itemidarr); $oitemids = implode('\',\'', $oitemidarr); $_SGLOBAL['db']->query("DELETE FROM " . tname('postitems') . " WHERE itemid IN ('{$itemids}')"); $_SGLOBAL['db']->query("DELETE FROM " . tname('postmessages') . " WHERE itemid IN ('{$itemids}')"); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!empty($value['filepath'])) { $filearr[] = A_DIR . '/' . $value['filepath']; } if (!empty($value['thumbpath'])) { $filearr[] = A_DIR . '/' . $value['thumbpath']; } } $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')"); //ɾ³ý¸½¼þ if (!empty($filearr)) { foreach ($filearr as $value) { if (!@unlink($value)) { errorlog('attachment', 'Unlink ' . $value . ' Error.'); } } } //ɾ³ý²¢¸ü±ítag×ÜÊý $tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array()); foreach ($tag_itemid as $id) { postspacetag('update', $type, $id, $tagarr, '0'); } } }
if (empty($_POST['fold'])) { $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET grade='{$_POST['grade']}' WHERE itemid IN ('{$itemids}')"); } else { $_SGLOBAL['db']->query("UPDATE " . tname('postitems') . " SET grade='{$_POST['grade']}' WHERE itemid IN ('{$itemids}')"); } } elseif ($_POST['theop'] == 'move') { if (empty($_POST['fold'])) { $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET catid='{$_POST['catid']}' WHERE itemid IN ('{$itemids}')"); } else { $_SGLOBAL['db']->query("UPDATE " . tname('postitems') . " SET catid='{$_POST['catid']}' WHERE itemid IN ('{$itemids}')"); } } elseif ($_POST['theop'] == 'changefolder') { if (empty($_POST['fold'])) { moveitemfolder("'{$itemids}'", 0, $_POST['folder']); } else { moveitemfolder("'{$itemids}'", $_POST['folder'], 0); } } showmessage('successful_management_of_the_theme', $theurl); } print <<<END <table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%"> \t<tr> \t\t<td><h1>{$alang['batch_management_theme']}</h1></td> \t\t<td class="actions"> \t\t</td> \t</tr> </table> END; if (empty($listarr) && empty($itemidarr)) { $starttime = sgmdate($_SGLOBAL['timestamp'] - 604800, 'Y-m-d');
$catarr = explode('_', $_POST['opcatid']); $_SGLOBAL['db']->query('UPDATE ' . tname($tablename) . ' SET type=\'' . $catarr[0] . '\', catid=\'' . $catarr[1] . '\' WHERE itemid IN (' . $itemidstr . ')'); break; case 'movefolder': //移动文件夹 if (!$_SGET['folder']) { //发件箱->待审箱 if ($_POST['opfolder'] == 2) { deleteitemhtml($itemidarr); //删除已生成的HTML文件 moveitemfolder($itemidstr); } } else { //待审箱->发件箱 if ($_POST['opfolder'] == 1) { moveitemfolder($itemidstr, 1, 0); } } break; case 'check': //等级审核 //更新等级 if ($_SGET['folder']) { showmessage('no_action_item'); } $_SGLOBAL['db']->query('UPDATE ' . tname($tablename) . ' SET grade=\'' . intval($_POST['opcheck']) . '\' WHERE itemid IN (' . $itemidstr . ')'); break; case 'digest': //设置精华 if ($_SGET['folder']) { showmessage('no_action_item');
$query = $_SGLOBAL['db']->query('SELECT f.*, ff.name AS upname FROM ' . tname('categories') . ' f LEFT JOIN ' . tname('categories') . ' ff ON ff.catid=f.upid WHERE f.catid=\'' . $news['catid'] . '\''); $thecat = $_SGLOBAL['db']->fetch_array($query); $channel = $thecat['type']; if (!checkperm('allowview')) { showmessage('no_permission'); } $listcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT COUNT(*) FROM ' . tname('spacenews') . ' WHERE itemid=\'' . $itemid . '\''), 0); if ($page > $listcount) { $_SHTML['page'] = $page = 1; } $start = $page - 1; $query = $_SGLOBAL['db']->query('SELECT ii.* FROM ' . tname('spacenews') . ' ii WHERE ii.itemid=\'' . $itemid . '\' ORDER BY ii.pageorder, ii.nid LIMIT ' . $start . ', 1'); if ($msg = $_SGLOBAL['db']->fetch_array($query)) { $news = array_merge($news, $msg); } else { moveitemfolder($itemid, 0, 2); } if (!empty($news['newsurl'])) { sheader($news['newsurl']); } $news['attacharr'] = array(); $multipage = ''; if ($listcount > 1) { $urlarr = array('action' => 'viewnews', 'itemid' => $itemid); $multipage = multi($listcount, 1, $page, $urlarr, 0); } else { if ($page == 1 && $news['haveattach']) { $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('attachments') . ' WHERE itemid=\'' . $itemid . '\''); while ($attach = $_SGLOBAL['db']->fetch_array($query)) { if (strpos($news['message'], $attach['thumbpath']) === false && strpos($news['message'], $attach['filepath']) === false && strpos($news['message'], 'batch.download.php?aid=' . $attach['aid']) === false) { $attach['filepath'] = A_URL . '/' . $attach['filepath'];