$complain = $value; } } $dv = null; $doclist = array(); if ($complain) { $theurl = "space.php?do=complain_item&doid={$doid}"; $query = $_SGLOBAL['db']->query("select * from " . tname('doing') . " where doid = {$doid}"); $dv = $_SGLOBAL['db']->fetch_array($query); if ($dv) { if ($_SGLOBAL['supe_uid'] != $complain['uid']) { $space = getspace($complain['uid']); } } else { include_once S_ROOT . './source/function_delete.php'; deleteComplains(array($doid)); showmessage('complain_no_doing', "space.php?do=complain"); } include_once S_ROOT . './source/class_tree.php'; $tree = new tree(); $dv['replynum'] = 0; $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('docomment') . " USE INDEX(dateline) WHERE doid = {$doid} ORDER BY dateline"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); if (empty($value['upid'])) { $value['upid'] = "do{$doid}"; } $tree->setNode($value['id'], $value['upid'], $value); $dv['replynum']++; } $values = $tree->getChilds("do{$doid}");
function deletedoings($ids) { global $_SGLOBAL; $allowmanage = checkperm('managedoing'); $managebatch = checkperm('managebatch'); $delnum = 0; //»ñÈ¡»ý·Ö $reward = getreward('deldoing', 0); $spaces = $doings = $newdoids = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE doid IN (" . simplode($ids) . ")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if ($allowmanage || $value['uid'] == $_SGLOBAL['supe_uid']) { //¹ÜÀíÔ±/×÷Õß $doings[] = $value; if (!$managebatch && $value['uid'] != $_SGLOBAL['supe_uid']) { $delnum++; } } } if (empty($doings) || !$managebatch && $delnum > 1) { return array(); } foreach ($doings as $key => $value) { $newdoids[] = $value['doid']; if ($allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) { //¿Û³ý»ý·Ö $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET credit=credit-{$reward['credit']}, experience=experience-{$reward['experience']} WHERE uid='{$value['uid']}'"); } } $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE doid IN (" . simplode($newdoids) . ")"); //ɾ³ýÆÀÂÛ $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($newdoids) . ")"); //ɾ³ýfeed $_SGLOBAL['db']->query("UPDATE " . tname('feed') . " SET isdeleted=1 WHERE id IN (" . simplode($newdoids) . ") AND idtype='doid'"); //ɾ³ýÏàÓ¦µÄËßÇó¼Ç¼ÐÅÏ¢ //$_SGLOBAL['db']->query("DELETE FROM ".tname('complain')." WHERE doid IN (".simplode($newdoids).")"); deleteComplains($newdoids); clearRelatedShares($newdoids, "doing"); return $doings; }