<tr class="tab">' . $tabs . '</tr> </table>'; } } /* moving or deleting a message */ if (isset($_POST['sel']) || isset($_GET['sel'])) { $sel = isset($_POST['sel']) ? $_POST['sel'] : $_GET['sel']; if (!is_array($sel)) { $sel = array($sel); } $move_to = !isset($_POST['btn_delete']) && isset($_POST['moveto'], $folders[$_POST['moveto']]) ? (int) $_POST['moveto'] : 0; foreach ($sel as $m) { if ($move_to) { pmsg_move((int) $m, $move_to, false); } else { pmsg_del((int) $m); } } } if (isset($_GET['folder_id']) && isset($folders[$_GET['folder_id']])) { $folder_id = $_GET['folder_id']; } else { if (isset($_POST['folder_id']) && isset($folders[$_POST['folder_id']])) { $folder_id = $_POST['folder_id']; } else { $folder_id = 1; } } ses_update_status($usr->sid, 'Using private messaging'); $cur_ppage = tmpl_cur_ppage($folder_id, $folders); $lnk = $folder_id == 4 ? '/egroupware/fudforum/3814588639/index.php?t=pmsg&msg_id' : '';
draw_stat('Rebuilding moderators'); rebuildmodlist(); draw_stat('Done: Rebuilding moderators'); draw_stat('Checking if all private messages have users'); $c = uq('SELECT pm.id FROM ' . $tbl . 'pmsg pm LEFT JOIN ' . $tbl . 'users u ON u.id=pm.ouser_id WHERE (pm.pmsg_opt & 16)=0 AND u.id IS NULL'); while ($r = db_rowarr($c)) { $dpm[] = $r[0]; } $c = uq('SELECT pm.id FROM ' . $tbl . 'pmsg pm LEFT JOIN ' . $tbl . 'users u ON u.id=pm.duser_id WHERE ((pm.pmsg_opt & 16) > 0 AND pm.pmsg_opt>=16) AND u.id IS NULL'); while ($r = db_rowarr($c)) { $dpm[] = $r[0]; } if (isset($dpm)) { $cnt = count($dpm); foreach ($dpm as $v) { pmsg_del($v, 5); } } else { $cnt = 0; } draw_info($cnt); draw_stat('Checking messages against users & threads'); delete_zero($tbl . 'msg', 'SELECT m.id FROM ' . $tbl . 'msg m LEFT JOIN ' . $tbl . 'users u ON u.id=m.poster_id LEFT JOIN ' . $tbl . 'thread t ON t.id=m.thread_id LEFT JOIN ' . $tbl . 'forum f ON f.id=t.forum_id WHERE (m.poster_id!=0 AND u.id IS NULL) OR t.id IS NULL OR f.id IS NULL'); draw_stat('Checking threads against forums'); delete_zero($tbl . 'thread', 'SELECT t.id FROM ' . $tbl . 'thread t LEFT JOIN ' . $tbl . 'forum f ON f.id=t.forum_id WHERE f.id IS NULL'); draw_stat('Checking message approvals'); $m = array(); $c = uq('SELECT m.id FROM ' . $tbl . 'msg m INNER JOIN ' . $tbl . 'thread t ON m.thread_id=t.id INNER JOIN ' . $tbl . 'forum f ON t.forum_id=f.id WHERE m.apr=0 AND (f.forum_opt & 2) > 0'); while ($r = db_rowarr($c)) { $m[] = $r[0]; }