Changeset 702 for trunk/forum/mcp.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/mcp.php
r400 r702 3 3 * 4 4 * @package mcp 5 * @version $Id : mcp.php 9015 2008-10-14 18:29:50Z toonarmy$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 78 78 $topic_id = request_var('t', 0); 79 79 $forum_id = request_var('f', 0); 80 $report_id = request_var('r', 0); 80 81 $user_id = request_var('u', 0); 81 82 $username = utf8_normalize_nfc(request_var('username', '', true)); … … 171 172 172 173 case 'topic_logs': 174 // Reset start parameter if we jumped from the quickmod dropdown 175 if (request_var('start', 0)) 176 { 177 $_REQUEST['start'] = 0; 178 } 179 173 180 $module->set_active('logs', 'topic_logs'); 174 181 break; … … 206 213 } 207 214 208 if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' )215 if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'pm_report_details') 209 216 { 210 217 $module->set_display('reports', 'report_details', false); 218 } 219 220 if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'report_details') 221 { 222 $module->set_display('pm_reports', 'pm_report_details', false); 211 223 } 212 224 … … 318 330 function extra_url() 319 331 { 320 global $forum_id, $topic_id, $post_id, $ user_id;332 global $forum_id, $topic_id, $post_id, $report_id, $user_id; 321 333 322 334 $url_extra = ''; … … 325 337 $url_extra .= ($post_id) ? "&p=$post_id" : ''; 326 338 $url_extra .= ($user_id) ? "&u=$user_id" : ''; 339 $url_extra .= ($report_id) ? "&r=$report_id" : ''; 327 340 328 341 return $url_extra; … … 559 572 560 573 /** 574 * Get simple pm data 575 */ 576 function get_pm_data($pm_ids) 577 { 578 global $db, $auth, $config, $user; 579 580 $rowset = array(); 581 582 if (!sizeof($pm_ids)) 583 { 584 return array(); 585 } 586 587 $sql_array = array( 588 'SELECT' => 'p.*, u.*', 589 590 'FROM' => array( 591 USERS_TABLE => 'u', 592 PRIVMSGS_TABLE => 'p', 593 ), 594 595 'WHERE' => $db->sql_in_set('p.msg_id', $pm_ids) . ' 596 AND u.user_id = p.author_id', 597 ); 598 599 $sql = $db->sql_build_query('SELECT', $sql_array); 600 $result = $db->sql_query($sql); 601 unset($sql_array); 602 603 while ($row = $db->sql_fetchrow($result)) 604 { 605 $rowset[$row['msg_id']] = $row; 606 } 607 $db->sql_freeresult($result); 608 609 return $rowset; 610 } 611 612 /** 561 613 * sorting in mcp 562 614 * 563 615 * @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR 616 * 617 * $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table 618 * $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table 564 619 */ 565 620 function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') … … 609 664 $default_key = 't'; 610 665 $default_dir = 'd'; 611 $where_sql .= ($topic_id) ? ' topic_id = ' . $topic_id . ' AND' : ''; 612 613 $sql = 'SELECT COUNT(post_id) AS total 614 FROM ' . POSTS_TABLE . " 615 $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' 616 AND post_approved = 0'; 666 $where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : ''; 667 668 $sql = 'SELECT COUNT(p.post_id) AS total 669 FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t 670 $where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' 671 AND p.post_approved = 0 672 AND t.topic_id = p.topic_id 673 AND t.topic_first_post_id <> p.post_id'; 617 674 618 675 if ($min_time) … … 638 695 break; 639 696 697 case 'pm_reports': 698 case 'pm_reports_closed': 640 699 case 'reports': 641 700 case 'reports_closed': 642 $type = 'reports'; 701 $pm = (strpos($mode, 'pm_') === 0) ? true : false; 702 703 $type = ($pm) ? 'pm_reports' : 'reports'; 643 704 $default_key = 't'; 644 705 $default_dir = 'd'; … … 647 708 if ($topic_id) 648 709 { 649 $where_sql .= ' p.topic_id = ' . $topic_id ;710 $where_sql .= ' p.topic_id = ' . $topic_id . ' AND '; 650 711 } 651 712 else if ($forum_id) 652 713 { 653 $where_sql .= ' p.forum_id = ' . $forum_id; 714 $where_sql .= ' p.forum_id = ' . $forum_id . ' AND '; 715 } 716 else if (!$pm) 717 { 718 $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND '; 719 } 720 721 if ($mode == 'reports' || $mode == 'pm_reports') 722 { 723 $where_sql .= ' r.report_closed = 0 AND '; 654 724 } 655 725 else 656 726 { 657 $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true); 658 } 659 660 if ($mode == 'reports') 661 { 662 $where_sql .= ' AND r.report_closed = 0'; 727 $where_sql .= ' r.report_closed = 1 AND '; 728 } 729 730 if ($pm) 731 { 732 $sql = 'SELECT COUNT(r.report_id) AS total 733 FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p 734 $where_sql r.post_id = 0 735 AND p.msg_id = r.pm_id 736 $limit_time_sql"; 663 737 } 664 738 else 665 739 { 666 $where_sql .= ' AND r.report_closed = 1'; 667 } 668 669 $sql = 'SELECT COUNT(r.report_id) AS total 670 FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p 671 $where_sql 672 AND p.post_id = r.post_id 673 $limit_time_sql"; 740 $sql = 'SELECT COUNT(r.report_id) AS total 741 FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p 742 $where_sql r.pm_id = 0 743 AND p.post_id = r.post_id 744 $limit_time_sql"; 745 } 674 746 break; 675 747 … … 712 784 $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); 713 785 $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); 786 break; 787 788 case 'pm_reports': 789 $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); 790 $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); 791 $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject'); 714 792 break; 715 793
Note:
See TracChangeset
for help on using the changeset viewer.