diff options
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 20 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_notes.php | 231 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 20 | ||||
-rw-r--r-- | phpBB/mcp.php | 8 | ||||
-rwxr-xr-x | phpBB/styles/subSilver/template/mcp_notes_front.html | 21 | ||||
-rwxr-xr-x | phpBB/styles/subSilver/template/mcp_notes_user.html | 86 | ||||
-rw-r--r-- | phpBB/styles/subSilver/template/viewtopic_body.html | 2 |
7 files changed, 347 insertions, 41 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 22e9d520f5..cbe8227bae 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -183,26 +183,6 @@ class mcp_main trigger_error("Unknown mode: $mode"); } } - - function install() - { - } - - function uninstall() - { - } - - function module() - { - $details = array( - 'name' => 'MCP - Main', - 'description' => 'Front end for Moderator Control Panel', - 'filename' => 'main', - 'version' => '0.1.0', - 'phpbbversion' => '2.2.0' - ); - return $details; - } } /** diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php new file mode 100755 index 0000000000..890b3d0a81 --- /dev/null +++ b/phpBB/includes/mcp/mcp_notes.php @@ -0,0 +1,231 @@ +<?php +/** +* +* @package mcp +* @version $Id$ +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +/** +* @package mcp +* mcp_notes +* Displays notes about a user +*/ +class mcp_notes +{ + + var $p_master; + + function mcp_main(&$p_master) + { + $this->p_master = &$p_master; + } + + function main($id, $mode) + { + global $auth, $db, $user, $template; + global $config, $phpbb_root_path, $phpEx, $SID; + + $action = request_var('action', array('' => '')); + + if (is_array($action)) + { + list($action, ) = each($action); + } + + switch ($mode) + { + case 'front': + $template->assign_vars(array( + 'U_FIND_MEMBER' => "memberlist.$phpEx$SID&mode=searchuser&field=username", + 'U_POST_ACTION' => "mcp.$phpEx$SID&i=notes&mode=user_notes", + ) + ); + + $this->tpl_name = 'mcp_notes_front'; + break; + case 'user_notes': + mcp_notes_user_view($id, $mode, $action); + $this->tpl_name = 'mcp_notes_user'; + break; + } + } +} + +/** +* @package module_install +*/ +class mcp_notes_info +{ + function module() + { + return array( + 'filename' => 'mcp_notes', + 'title' => 'MCP_NOTES', + 'version' => '1.0.0', + 'modes' => array( + 'front' => array('title' => 'MCP_NOTES_FRONT', 'auth' => 'acl_m_'), + 'user_notes' => array('title' => 'MCP_NOTES_USER', 'auth' => 'acl_m_'), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} + +// +// Functions +// + +function mcp_notes_user_view($id, $mode, $action) +{ + global $SID, $phpEx, $phpbb_root_path, $config; + global $template, $db, $user, $auth; + + $user_id = request_var('u', 0); + $username = request_var('username', ''); + $start = request_var('start', 0); + $st = request_var('st', 0); + $sk = request_var('sk', 'a'); + $sd = request_var('sd', 'd'); + + $sql_where = ($user_id) ? "user_id = $user_id" : "username = '" . $db->sql_escape($username) . "'"; + + $sql = 'SELECT * FROM ' . USERS_TABLE . " WHERE $sql_where"; + $result = $db->sql_query($sql); + + if (!$userrow = $db->sql_fetchrow($result)) + { + trigger_error($user->lang['NO_USER']); + } + $db->sql_freeresult($result); + + $user_id = $userrow['user_id']; + + $deletemark = ($action == 'del_marked') ? true : false; + $deleteall = ($action == 'del_all') ? true : false; + $marked = request_var('marknote', 0); + $usernote = request_var('usernote', ''); + + // Handle any actions + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')'; + unset($sql_in); + } + + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + $where_sql"; + $db->sql_query($sql); + + add_log('admin', 'LOG_USERS_CLEAR'); + + $msg = ($deletemark) ? 'MARKED_DELETED' : 'ALL_DELETED'; + $redirect = "mcp.$phpEx$SID&i=$id&mode=$mode&u=$user_id"; + meta_refresh(2, $redirect); + trigger_error($user->lang[$msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + } + + if ($usernote && $action == 'add_feedback') + { + add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']); + add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote); + + $redirect = "mcp.$phpEx$SID&i=$id&mode=$mode&u=$user_id"; + meta_refresh(2, $redirect); + trigger_error($user->lang['USER_FEEDBACK_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + } + + // Generate the appropriate user information for the user we are looking at + $rank_title = $rank_img = ''; +// get_user_rank($userrow['user_rank'], $userrow['user_posts'], $rank_title, $rank_img); + + $avatar_img = ''; + if (!empty($userrow['user_avatar'])) + { + switch ($userrow['user_avatar_type']) + { + case AVATAR_UPLOAD: + $avatar_img = $config['avatar_path'] . '/'; + break; + case AVATAR_GALLERY: + $avatar_img = $config['avatar_gallery_path'] . '/'; + break; + } + $avatar_img .= $userrow['user_avatar']; + + $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" border="0" alt="" />'; + } + else + { + $avatar_img = '<img src="adm/images/no_avatar.gif" alt="" />'; + } + + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 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'], 364 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('a' => 'l.user_id', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir); + + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + + $log_data = array(); + $log_count = 0; + view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + + if ($log_count) + { + $template->assign_var('S_USER_NOTES', true); + + foreach ($log_data as $row) + { + $template->assign_block_vars('usernotes', array( + 'REPORT_BY' => $row['username'], + 'REPORT_AT' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'ID' => $row['id']) + ); + } + } + + $pagination = generate_pagination("mcp.$phpEx$SID&i=$id&mode=$mode&u=$user_id&st=$st&sk=$sk&sd=$sd", $log_count, $config['posts_per_page'], $start); + + $template->assign_vars(array( + 'U_POST_ACTION' => "mcp.$phpEx$SID&i=$id&mode=$mode&u=$user_id", + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'PAGINATION' => $pagination, + + 'USERNAME' => $userrow['username'], + 'USER_COLOR' => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '', + 'RANK_TITLE' => $rank_title, + 'JOINED' => $user->format_date($userrow['user_regdate'], $user->lang['DATE_FORMAT']), + 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $rank_img, + ) + ); + +} + +?>
\ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index db0291f7ad..f188de4633 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -289,26 +289,6 @@ class mcp_queue break; } } - - function install() - { - } - - function uninstall() - { - } - - function module() - { - $details = array( - 'name' => 'MCP - Queue', - 'description' => 'Module for management of items waiting for approval', - 'filename' => 'queue', - 'version' => '0.1.0', - 'phpbbversion' => '2.2.0' - ); - return $details; - } } // Approve Post/Topic diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 06ccc6d58e..ab6cfc38b8 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -99,6 +99,9 @@ if (!$quickmod) $post_id = request_var('p', 0); $topic_id = request_var('t', 0); $forum_id = request_var('f', 0); + $user_id = request_var('u', 0); + $username = request_var('username', ''); + if ($post_id) { @@ -150,6 +153,7 @@ if (!$quickmod) if (!$post_id) { $module->set_display('post_details', false); + $module->set_display('post', false); } if (!$topic_id) { @@ -159,6 +163,10 @@ if (!$quickmod) { $module->set_display('forum_view', false); } + if (!$user_id && $username == '') + { + $module->set_display('user_notes', false); + } // Load and execute the relevant module $module->load_active(); diff --git a/phpBB/styles/subSilver/template/mcp_notes_front.html b/phpBB/styles/subSilver/template/mcp_notes_front.html new file mode 100755 index 0000000000..1a2e6d588a --- /dev/null +++ b/phpBB/styles/subSilver/template/mcp_notes_front.html @@ -0,0 +1,21 @@ +<!-- INCLUDE mcp_header.html --> + + <!-- $Id$ --> + <form method="post" name="mcp" action="{U_POST_ACTION}"> + <table class="bg" width="75%" cellspacing="1" cellpadding="4" border="0" align="center"> + <tr> + <th colspan="2"align="center">{L_SELECT_USER}</th> + </tr> + <tr> + <td class="row1" width="40%"><b class="gen">{L_FIND_USERNAME}: </b><br /><span class="gensmall">[ <a href="{U_FIND_MEMBER}" onclick="window.open('{U_FIND_MEMBER}', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;">{L_FIND_USERNAME}</a> ]</span></td> + <td class="row2"><input type="text" class="post" name="username" maxlength="50" size="20" /></td> + </tr> + <tr> + <td class="cat" colspan="2" align="center"><input type="submit" name="submituser" value="{L_SUBMIT}" class="btnmain" /></td> + </tr> + </table> + </form> + + <br clear="all" /><br /> + +<!-- INCLUDE mcp_footer.html -->
\ No newline at end of file diff --git a/phpBB/styles/subSilver/template/mcp_notes_user.html b/phpBB/styles/subSilver/template/mcp_notes_user.html new file mode 100755 index 0000000000..46520d7694 --- /dev/null +++ b/phpBB/styles/subSilver/template/mcp_notes_user.html @@ -0,0 +1,86 @@ +<!-- INCLUDE mcp_header.html --> + + <!-- $Id$ --> + + <form method="post" name="mcp" action="{U_POST_ACTION}"> + + <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> + <tr> + <th colspan="2" height="28" align="center">{USERNAME}</th> + </tr> + <tr> + <td class="row1" align="center"><table cellspacing="1" cellpadding="2" border="0"> + <tr> + <td class="gen" align="center"><!-- IF USER_COLOR --><b style="color: #{USER_COLOR}"><!-- ELSE --><b><!-- ENDIF -->{USERNAME}</b></td> + </tr> + <!-- IF RANK --> + <tr> + <td class="postdetails" align="center">{RANK}</td> + </tr> + <!-- ENDIF --> + <!-- IF RANK_IMG --> + <tr> + <td align="center">{RANK_IMG}</td> + </tr> + <!-- ENDIF --> + <!-- IF AVATAR_IMG --> + <tr> + <td align="center">{AVATAR_IMG}</td> + </tr> + <!-- ENDIF --> + </table></td> + <td class="row1"><table width="100%" cellspacing="1" cellpadding="2" border="0"> + <tr> + <td class="gen" align="right" nowrap="nowrap">{L_JOINED}: </td> + <td width="100%"><b class="gen">{JOINED}</b></td> + </tr> + <tr> + <td class="gen" align="right" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}: </td> + <td><b class="gen">{POSTS}</b></td> + </tr> + </table></td> + </tr> + </table> + <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> + <tr> + <th colspan="2" height="28" align="center">{L_FEEDBACK}</th> + </tr> + <!-- IF S_USER_NOTES --> + <!-- BEGIN usernotes --> + <!-- IF usernotes.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> + <td<!-- IF not S_CLEAR_ALLOWED --> colspan="2"<!-- ENDIF -->><span class="gensmall">{L_REPORT_BY}: <b>{usernotes.REPORT_BY}</b> {L_ON} {usernotes.REPORT_AT}</span><hr /><span class="gen">{usernotes.ACTION}</span></td> + <!-- IF S_CLEAR_ALLOWED --><td width="5%" align="center"><input type="checkbox" name="marknote[]" value="{usernotes.ID}" /></td><!-- ENDIF --> + </tr> + <!-- END usernotes --> + <!-- IF S_CLEAR_ALLOWED --> + <tr> + <td class="cat" colspan="2" align="center"><input class="btnlite" type="submit" name="action[del_marked]" value="{L_DELETE_MARKED}" /> <input class="btnlite" type="submit" name="action[del_all]" value="{L_DELETE_ALL}" /></td> + </tr> + <!-- ENDIF --> + <!-- ELSE --> + <tr> + <td class="row1" colspan="2" align="center">{L_NO_USER_NOTES}</td> + </tr> + <!-- ENDIF --> + </table> + <br clear="all" /> + + <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> + <tr> + <th colspan="2" height="28" align="center">{L_ADD_FEEDBACK}</th> + </tr> + <tr> + <td class="row3" align="center" colspan="2"><span class="genmed">{L_ADD_FEEDBACK_EXPLAIN}</span></td> + <tr> + <td colspan="2" class="row1" align="center"><textarea name="usernote" rows="10" cols="76"></textarea></td> + </tr> + <tr> + <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="action[add_feedback]" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> + </tr> + </table> + + </form> + + <br clear="all" /><br /> + +<!-- INCLUDE mcp_footer.html -->
\ No newline at end of file diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html index c20c8832db..7aaeb8c4e8 100644 --- a/phpBB/styles/subSilver/template/viewtopic_body.html +++ b/phpBB/styles/subSilver/template/viewtopic_body.html @@ -244,7 +244,7 @@ <!-- IF postrow.S_CAN_RATE --> <td class="gensmall"><b>{L_RATE}:</b> <a style="color:green" href="{postrow.U_RATE_GOOD}">{L_RATE_GOOD}</a> / <a style="color:red" href="{postrow.U_RATE_BAD}">{L_RATE_BAD}</a></td> <!-- ENDIF --> - <td class="gensmall" align="right"><!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF --></td> + <td class="gensmall" align="right"><!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}">{INFO_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}">{WARN_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF --></td> </tr> </table> |