function delforum($fid) { global $db, $db_guestdir, $db_guestthread, $db_guestread; $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . pwEscape($fid)); $db->update("DELETE FROM pw_forums WHERE fid=" . pwEscape($fid)); $db->update("DELETE FROM pw_forumdata WHERE fid=" . pwEscape($fid)); $db->update("DELETE FROM pw_forumsextra WHERE fid=" . pwEscape($fid)); $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . pwEscape($fid)); if ($foruminfo['forumadmin']) { $forumadmin = explode(",", $foruminfo['forumadmin']); foreach ($forumadmin as $key => $value) { if ($value) { $gid = $db->get_one("SELECT uid,groupid FROM pw_members WHERE username="******"UPDATE pw_members SET groupid='-1' WHERE username="******"{$db_guestdir}/T_{$fid}"); } P_unlink(D_P . "data/forums/fid_{$fid}.php"); $ttable_a = $ptable_a = array(); $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . pwEscape($fid)); while ($tpc = $db->fetch_array($query)) { $tid = $tpc['tid']; $ttable_a[GetTtable($tid)][] = $tid; $ptable_a[$tpc['ptable']] = 1; $db_guestread && clearguestcache($tid, $tpc['replies']); } foreach ($ttable_a as $pw_tmsgs => $val) { $val = pwImplode($val, false); $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})"); } # $db->update("DELETE FROM pw_threads WHERE fid=".pwEscape($fid)); # ThreadManager $threadManager = L::loadClass("threadmanager"); $threadManager->deleteByForumId($fid); foreach ($ptable_a as $key => $val) { $pw_posts = GetPtable($key); $db->update("DELETE FROM {$pw_posts} WHERE fid=" . pwEscape($fid)); } updateforum($foruminfo['fup']); }
$upmembers['safecv'] = questcode($question, $customquest, $answer); } $newgroups = $groups ? ',' . implode(',', $groups) . ',' : ''; $newgroups = str_replace(',' . $groupid . ',', ',', $newgroups); if (($oldinfo['groupid'] == '3' || strpos($oldinfo['groups'], ',3,') !== false) && !If_manager) { adminmsg('manager_right'); } elseif ($oldinfo['groupid'] != '3' && ($groupid == '3' || strpos($newgroups, ',3,') !== false) && !If_manager) { adminmsg('manager_right'); } if (ifadmin($oldinfo['username']) && $groupid != '5' && strpos($newgroups, ',5,') === false) { if (strpos($oldinfo['groups'], ',5,') !== false) { adminmsg('setuser_forumadmin'); } else { $newgroups .= $newgroups ? '5,' : ',5,'; } } elseif (!ifadmin($oldinfo['username']) && ($groupid == '5' || strpos($newgroups, ',5,') !== false)) { adminmsg('setuser_forumadmin'); } $newgroups == ',' && ($newgroups = ''); if ($groupid != '-1' || $newgroups) { admincheck($uid, $username, $groupid, $newgroups, 'update'); } elseif ($oldinfo['groupid'] != '-1' || $oldinfo['groups']) { admincheck($uid, $username, $groupid, $newgroups, 'delete'); } $newgroups != $oldinfo['groups'] && ($upmembers['groups'] = $newgroups); /* list($iconurl,$icontype,$iconwidth,$iconheight,$iconfile,$iconpig,$ifhavasmallicon) = showfacedesign(addslashes($oldinfo['icon']),true); if ($facetype == 2) { if (substr($_POST['i_http'],0,4) != 'http' || strrpos($_POST['i_http'],'|') !== false) { adminmsg('illegal_customimg'); }
function delforum($fid) { global $db, $db_guestdir, $db_guestthread, $db_guestread; $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . S::sqlEscape($fid)); //$db->update("DELETE FROM pw_forums WHERE fid=".S::sqlEscape($fid)); pwQuery::delete('pw_forums', 'fid=:fid', array($fid)); //* $db->update("DELETE FROM pw_forumdata WHERE fid=".S::sqlEscape($fid)); pwQuery::delete('pw_forumdata', 'fid=:fid', array($fid)); $db->update("DELETE FROM pw_forumsextra WHERE fid=" . S::sqlEscape($fid)); $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . S::sqlEscape($fid)); if ($foruminfo['forumadmin']) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $forumadmin = explode(",", $foruminfo['forumadmin']); foreach ($forumadmin as $key => $value) { if ($value) { $gid = $userService->getByUserName($value); if ($gid['groupid'] == 5 && !ifadmin($value)) { $userService->update($gid['uid'], array('groupid' => -1)); admincheck($gid['uid'], $value, $gid['groupid'], '', 'delete'); } } } } if ($db_guestthread || $db_guestread) { require_once R_P . 'require/guestfunc.php'; $db_guestthread && deldir(D_P . "{$db_guestdir}/T_{$fid}"); } //* P_unlink(D_P."data/forums/fid_{$fid}.php"); pwCache::deleteData(D_P . "data/forums/fid_{$fid}.php"); require_once R_P . 'require/functions.php'; require_once R_P . 'require/updateforum.php'; $pw_attachs = L::loadDB('attachs', 'forum'); $ttable_a = $ptable_a = array(); $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . S::sqlEscape($fid)); while ($tpc = $db->fetch_array($query)) { $tid = $tpc['tid']; $ttable_a[GetTtable($tid)][] = $tid; $ptable_a[$tpc['ptable']] = 1; $db_guestread && clearguestcache($tid, $tpc['replies']); if ($attachdb = $pw_attachs->getByTid($tid)) { delete_att($attachdb); } } pwFtpClose($GLOBALS['ftp']); foreach ($ttable_a as $pw_tmsgs => $val) { //* $val = S::sqlImplode($val,false); //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)"); pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val)); } # $db->update("DELETE FROM pw_threads WHERE fid=".S::sqlEscape($fid)); # ThreadManager //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByForumId($fid); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByForumId($fid); //* Perf::gatherInfo('changeThreadWithForumIds', array('fid'=>$fid)); foreach ($ptable_a as $key => $val) { $pw_posts = GetPtable($key); //$db->update("DELETE FROM $pw_posts WHERE fid=".S::sqlEscape($fid)); pwQuery::delete($pw_posts, 'fid=:fid', array($fid)); } updateforum($foruminfo['fup']); }