Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: class_moderation.php 4041 2008-07-25 20:13:08Z Tikitiki $
| * $Id: class_moderation.php 4368 2009-05-08 10:30:37Z Tomm $
|
*/
class Moderation
| */
class Moderation
|
Zeile 27 | Zeile 27 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$plugins->run_hooks("class_moderation_close_threads", $tids);
| $plugins->run_hooks("class_moderation_close_threads", $tids);
|
Zeile 36 | Zeile 36 |
---|
$openthread = array( "closed" => 1, );
|
$openthread = array( "closed" => 1, );
|
$db->update_query("threads", $openthread, "tid IN ($tid_list)");
| $db->update_query("threads", $openthread, "tid IN ($tid_list) AND closed NOT LIKE 'moved|%'");
|
return true; }
| return true; }
|
Zeile 58 | Zeile 58 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$plugins->run_hooks("class_moderation_open_threads", $tids);
| $plugins->run_hooks("class_moderation_open_threads", $tids);
|
Zeile 88 | Zeile 88 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$plugins->run_hooks("class_moderation_stick_threads", $tids);
| $plugins->run_hooks("class_moderation_stick_threads", $tids);
|
Zeile 118 | Zeile 118 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$plugins->run_hooks("class_moderation_unstick_threads", $tids);
| $plugins->run_hooks("class_moderation_unstick_threads", $tids);
|
Zeile 311 | Zeile 311 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
foreach($tids as $tid) {
| foreach($tids as $tid) {
|
Zeile 342 | Zeile 342 |
---|
if(is_array($tid_list)) {
|
if(is_array($tid_list)) {
|
| $tid_moved_list = ""; $comma = ""; foreach($tid_list as $tid) { $tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ","; }
|
$tid_list = implode(',', $tid_list); $approve = array( "visible" => 1 );
|
$tid_list = implode(',', $tid_list); $approve = array( "visible" => 1 );
|
$db->update_query("threads", $approve, "tid IN ($tid_list)");
| $db->update_query("threads", $approve, "tid IN ($tid_list) OR closed IN ({$tid_moved_list})");
|
$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");
$plugins->run_hooks("class_moderation_approve_threads", $tids);
| $db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_approve).")");
$plugins->run_hooks("class_moderation_approve_threads", $tids);
|
Zeile 382 | Zeile 389 |
---|
if(!is_array($tids)) { $tids = array($tids);
|
if(!is_array($tids)) { $tids = array($tids);
|
}
| }
|
// Make sure we only have valid values
|
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$tid_list = implode(',', $tids);
|
$tid_list = implode(',', $tids);
|
| $tid_moved_list = ""; $comma = ""; foreach($tids as $tid) { $tid_moved_list .= "{$comma}'moved|{$tid}'"; $comma = ","; }
|
foreach($tids as $tid) {
| foreach($tids as $tid) {
|
Zeile 406 | Zeile 420 |
---|
while($counter = $db->fetch_array($query)) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-{$counter['posts']} WHERE uid='".$counter['uid']."'");
|
while($counter = $db->fetch_array($query)) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-{$counter['posts']} WHERE uid='".$counter['uid']."'");
|
} } }
| } } }
|
$posts_to_unapprove[] = $thread['firstpost']; }
$approve = array( "visible" => 0 );
|
$posts_to_unapprove[] = $thread['firstpost']; }
$approve = array( "visible" => 0 );
|
$db->update_query("threads", $approve, "tid IN ($tid_list)");
| $db->update_query("threads", $approve, "tid IN ($tid_list) OR closed IN ({$tid_moved_list})");
|
$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");
|
$db->update_query("posts", $approve, "pid IN (".implode(',', $posts_to_unapprove).")");
|
|
|
$plugins->run_hooks("class_moderation_unapprove_threads", $tids);
if(is_array($forum_counters))
| $plugins->run_hooks("class_moderation_unapprove_threads", $tids);
if(is_array($forum_counters))
|
Zeile 433 | Zeile 447 |
---|
); update_forum_counters($fid, $update_array); }
|
); update_forum_counters($fid, $update_array); }
|
}
| }
|
return true; }
| return true; }
|
Zeile 473 | Zeile 487 |
---|
$num_unapproved_posts = $num_approved_posts = 0; // Update unapproved post count if($post['visible'] == 0)
|
$num_unapproved_posts = $num_approved_posts = 0; // Update unapproved post count if($post['visible'] == 0)
|
{ --$num_unaproved_posts;
| { ++$num_unapproved_posts;
|
} else {
| } else {
|
Zeile 514 | Zeile 528 |
---|
global $db, $plugins;
// Make sure we only have valid values
|
global $db, $plugins;
// Make sure we only have valid values
|
array_walk($pids, 'intval');
| $pids = array_map('intval', $pids);
|
$tid = intval($tid);
$pidin = implode(',', $pids);
| $tid = intval($tid);
$pidin = implode(',', $pids);
|
Zeile 589 | Zeile 603 |
---|
$query = $db->simple_select("posts", "pid", "tid = '{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => '1')); $lastpostpid = $db->fetch_field($query, 'pid');
|
$query = $db->simple_select("posts", "pid", "tid = '{$post['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => '1')); $lastpostpid = $db->fetch_field($query, 'pid');
|
$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND pid != '{$masterpid}' AND visible='1'");
| $query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND visible='1'");
|
$attachment_count = $db->fetch_field($query2, "count"); $db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");
| $attachment_count = $db->fetch_field($query2, "count"); $db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");
|
Zeile 668 | Zeile 682 |
---|
case "redirect": // move (and leave redirect) thread $arguments = array("tid" => $tid, "new_fid" => $new_fid); $plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
|
case "redirect": // move (and leave redirect) thread $arguments = array("tid" => $tid, "new_fid" => $new_fid); $plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);
|
if($thread['visible'] == 1) {
| if($thread['visible'] == 1) {
|
$num_threads++;
|
$num_threads++;
|
| $num_posts = $thread['replies']+1;
|
} else { $num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
|
} else { $num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
|
}
$num_posts = $thread['replies']+1;
| }
|
$num_unapproved_posts += $thread['unapprovedposts'];
$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'");
| $num_unapproved_posts += $thread['unapprovedposts'];
$db->delete_query("threads", "closed='moved|$tid' AND fid='$new_fid'");
|
Zeile 691 | Zeile 705 |
---|
$db->update_query("posts", $changefid, "tid='$tid'"); $threadarray = array( "fid" => $thread['fid'],
|
$db->update_query("posts", $changefid, "tid='$tid'"); $threadarray = array( "fid" => $thread['fid'],
|
"subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'], "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
| "subject" => $db->escape_string($thread['subject']), "icon" => $thread['icon'], "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => $thread['dateline'],
|
"lastpost" => $thread['lastpost'], "lastposteruid" => $thread['lastposteruid'], "lastposter" => $db->escape_string($thread['lastposter']), "views" => 0, "replies" => 0, "closed" => "moved|$tid",
|
"lastpost" => $thread['lastpost'], "lastposteruid" => $thread['lastposteruid'], "lastposter" => $db->escape_string($thread['lastposter']), "views" => 0, "replies" => 0, "closed" => "moved|$tid",
|
"sticky" => $thread['sticky'], "visible" => $thread['visible'],
| "sticky" => $thread['sticky'], "visible" => $thread['visible'],
|
"notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray); if($redirect_expire)
|
"notes" => '' ); $redirect_tid = $db->insert_query("threads", $threadarray); if($redirect_expire)
|
{
| {
|
$this->expire_thread($redirect_tid, $redirect_expire);
|
$this->expire_thread($redirect_tid, $redirect_expire);
|
| } // If we're moving back to a forum where we left a redirect, delete the rediect $query = $db->simple_select("threads", "tid", "closed LIKE 'moved|".intval($tid)."' AND fid='".intval($new_fid)."'"); while($movedthread = $db->fetch_array($query)) { $db->delete_query("threads", "tid='".intval($movedthread['tid'])."'", 1);
|
} break; case "copy":// copy thread
| } break; case "copy":// copy thread
|
Zeile 732 | Zeile 753 |
---|
"unapprovedposts" => $thread['unapprovedposts'], "attachmentcount" => $thread['attachmentcount'], "notes" => ''
|
"unapprovedposts" => $thread['unapprovedposts'], "attachmentcount" => $thread['attachmentcount'], "notes" => ''
|
);
if($thread['visible'] == 1) {
| );
if($thread['visible'] == 1) {
|
++$num_threads; $num_posts = $thread['replies']+1;
| ++$num_threads; $num_posts = $thread['replies']+1;
|
Zeile 850 | Zeile 871 |
---|
if($thread['visible'] == 1) { $num_threads++;
|
if($thread['visible'] == 1) { $num_threads++;
|
| $num_posts = $thread['replies']+1;
|
} else { $num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
|
} else { $num_unapproved_threads++; // Implied forum unapproved count for unapproved threads $num_unapproved_posts = $thread['replies']+1;
|
}
$num_posts = $thread['replies']+1;
| }
|
$num_unapproved_posts = $thread['unapprovedposts'];
$sqlarray = array(
| $num_unapproved_posts = $thread['unapprovedposts'];
$sqlarray = array(
|
Zeile 866 | Zeile 887 |
---|
); $db->update_query("threads", $sqlarray, "tid='$tid'"); $db->update_query("posts", $sqlarray, "tid='$tid'");
|
); $db->update_query("threads", $sqlarray, "tid='$tid'"); $db->update_query("posts", $sqlarray, "tid='$tid'");
|
| // If we're moving back to a forum where we left a redirect, delete the rediect $query = $db->simple_select("threads", "tid", "closed LIKE 'moved|".intval($tid)."' AND fid='".intval($new_fid)."'"); while($movedthread = $db->fetch_array($query)) { $db->delete_query("threads", "tid='".intval($movedthread['tid'])."'", 1); }
|
break; }
| break; }
|
Zeile 998 | Zeile 1026 |
---|
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'"); update_first_post($tid);
|
$db->update_query("threadsubscriptions", $sqlarray, "tid='{$mergetid}'"); update_first_post($tid);
|
$arguments = array("mergetid" => $tid, "tid" => $tid, "subject" => $subject);
| $arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
|
$plugins->run_hooks("class_moderation_merge_threads", $arguments);
$this->delete_thread($mergetid);
$updated_stats = array( "replies" => '+'.($mergethread['replies']+1),
|
$plugins->run_hooks("class_moderation_merge_threads", $arguments);
$this->delete_thread($mergetid);
$updated_stats = array( "replies" => '+'.($mergethread['replies']+1),
|
"unapprovedposts" => "+{$mergethread['unapprovedposts']}"
| "unapprovedposts" => "+{$mergethread['unapprovedposts']}", "attachmentcount" => "+{$mergethread['attachmentcount']}",
|
); update_thread_counters($tid, $updated_stats);
| ); update_thread_counters($tid, $updated_stats);
|
Zeile 1059 | Zeile 1088 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($pids, 'intval');
| $pids = array_map('intval', $pids);
|
$pids_list = implode(',', $pids);
| $pids_list = implode(',', $pids);
|
Zeile 1303 | Zeile 1332 |
---|
global $db, $plugins;
// Make sure we only have valid values
|
global $db, $plugins;
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$tid_list = implode(',', $tids);
| $tid_list = implode(',', $tids);
|
Zeile 1419 | Zeile 1448 |
---|
$num_posts = 0;
// Make sure we only have valid values
|
$num_posts = 0;
// Make sure we only have valid values
|
array_walk($pids, 'intval');
| $pids = array_map('intval', $pids);
|
$pid_list = implode(',', $pids); $pids = $threads_to_update = array();
| $pid_list = implode(',', $pids); $pids = $threads_to_update = array();
|
Zeile 1525 | Zeile 1554 |
---|
global $db, $cache;
// Make sure we only have valid values
|
global $db, $cache;
// Make sure we only have valid values
|
array_walk($pids, 'intval');
| $pids = array_map('intval', $pids);
|
$pid_list = implode(',', $pids); $pids = $threads_to_update = array();
| $pid_list = implode(',', $pids); $pids = $threads_to_update = array();
|
Zeile 1640 | Zeile 1669 |
---|
// Make sure we only have valid values
|
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$tid_list = implode(',', $tids);
| $tid_list = implode(',', $tids);
|
Zeile 1701 | Zeile 1730 |
---|
global $db;
// Make sure we only have valid values
|
global $db;
// Make sure we only have valid values
|
array_walk($pids, 'intval');
| $pids = array_map('intval', $pids);
|
$pid_list = implode(',', $pids); $query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");
| $pid_list = implode(',', $pids); $query = $db->simple_select("posts", 'pid, visible', "pid IN ($pid_list)");
|
Zeile 1739 | Zeile 1768 |
---|
global $db;
// Make sure we only have valid values
|
global $db;
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$fid = intval($fid);
$tid_list = implode(',', $tids);
| $fid = intval($fid);
$tid_list = implode(',', $tids);
|
Zeile 1777 | Zeile 1806 |
---|
global $db;
// Make sure we only have valid values
|
global $db;
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$tid_list = implode(',', $tids); $query = $db->simple_select("threads", 'tid, closed', "tid IN ($tid_list)");
| $tid_list = implode(',', $tids); $query = $db->simple_select("threads", 'tid, closed', "tid IN ($tid_list)");
|
Zeile 1822 | Zeile 1851 |
---|
}
// Make sure we only have valid values
|
}
// Make sure we only have valid values
|
array_walk($tids, 'intval');
| $tids = array_map('intval', $tids);
|
$fid = intval($fid);
$tids_csv = implode(',', $tids);
| $fid = intval($fid);
$tids_csv = implode(',', $tids);
|