Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

mcp_notes.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 7.08 KiB


001  <?php
002  /**
003  *
004  * @package mcp
005  * @version $Id$
006  * @copyright (c) 2005 phpBB Group
007  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
008  *
009  */
010   
011  /**
012  * @ignore
013  */
014  if (!defined('IN_PHPBB'))
015  {
016      exit;
017  }
018   
019  /**
020  * mcp_notes
021  * Displays notes about a user
022  * @package mcp
023  */
024  class mcp_notes
025  {
026      var $p_master;
027      var $u_action;
028   
029      function mcp_notes(&$p_master)
030      {
031          $this->p_master = &$p_master;
032      }
033   
034      function main($id, $mode)
035      {
036          global $auth, $db, $user, $template;
037          global $config, $phpbb_root_path, $phpEx;
038   
039          $action = request_var('action', array('' => ''));
040   
041          if (is_array($action))
042          {
043              list($action, ) = each($action);
044          }
045   
046          $this->page_title = 'MCP_NOTES';
047   
048          switch ($mode)
049          {
050              case 'front':
051                  $template->assign_vars(array(
052                      'U_FIND_USERNAME'    => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
053                      'U_POST_ACTION'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes'),
054   
055                      'L_TITLE'            => $user->lang['MCP_NOTES'],
056                  ));
057   
058                  $this->tpl_name = 'mcp_notes_front';
059              break;
060   
061              case 'user_notes':
062                  $user->add_lang('acp/common');
063   
064                  $this->mcp_notes_user_view($action);
065                  $this->tpl_name = 'mcp_notes_user';
066              break;
067          }
068      }
069   
070      /**
071      * Display user notes
072      */
073      function mcp_notes_user_view($action)
074      {
075          global $phpEx, $phpbb_root_path, $config;
076          global $template, $db, $user, $auth;
077   
078          $user_id = request_var('u', 0);
079          $username = request_var('username', '', true);
080          $start = request_var('start', 0);
081          $st    = request_var('st', 0);
082          $sk    = request_var('sk', 'b');
083          $sd    = request_var('sd', 'd');
084   
085          add_form_key('mcp_notes');
086   
087          $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
088   
089          $sql = 'SELECT *
090              FROM ' . USERS_TABLE . "
091              WHERE $sql_where";
092          $result = $db->sql_query($sql);
093          $userrow = $db->sql_fetchrow($result);
094          $db->sql_freeresult($result);
095   
096          if (!$userrow)
097          {
098              trigger_error('NO_USER');
099          }
100   
101          $user_id = $userrow['user_id'];
102   
103          // Populate user id to the currently active module (this module)
104          // The following method is another way of adjusting module urls. It is the easy variant if we want
105          // to directly adjust the current module url based on data retrieved within the same module.
106          if (strpos($this->u_action, "&amp;u=$user_id") === false)
107          {
108              $this->p_master->adjust_url('&amp;u=' . $user_id);
109              $this->u_action .= "&amp;u=$user_id";
110          }
111   
112          $deletemark = ($action == 'del_marked') ? true : false;
113          $deleteall    = ($action == 'del_all') ? true : false;
114          $marked        = request_var('marknote', array(0));
115          $usernote    = utf8_normalize_nfc(request_var('usernote', '', true));
116   
117          // Handle any actions
118          if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
119          {
120              $where_sql = '';
121              if ($deletemark && $marked)
122              {
123                  $sql_in = array();
124                  foreach ($marked as $mark)
125                  {
126                      $sql_in[] = $mark;
127                  }
128                  $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in);
129                  unset($sql_in);
130              }
131   
132              if ($where_sql || $deleteall)
133              {
134                  if (check_form_key('mcp_notes'))
135                  {
136                      $sql = 'DELETE FROM ' . LOG_TABLE . '
137                          WHERE log_type = ' . LOG_USERS . "
138                              AND reportee_id = $user_id
139                              $where_sql";
140                      $db->sql_query($sql);
141   
142                      add_log('admin', 'LOG_CLEAR_USER', $userrow['username']);
143   
144                      $msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED';
145                  }
146                  else
147                  {
148                      $msg = 'FORM_INVALID';
149                  }
150                  $redirect = $this->u_action . '&amp;u=' . $user_id;
151                  meta_refresh(3, $redirect);
152                  trigger_error($user->lang[$msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
153              }
154          }
155   
156          if ($usernote && $action == 'add_feedback')
157          {
158              if (check_form_key('mcp_notes'))
159              {
160                  add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']);
161                  add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $userrow['username']);
162   
163                  add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote);
164                  $msg = $user->lang['USER_FEEDBACK_ADDED'];
165              }
166              else
167              {
168                  $msg = $user->lang['FORM_INVALID'];
169              }
170              $redirect = $this->u_action;
171              meta_refresh(3, $redirect);
172   
173              trigger_error($msg .  '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
174          }
175   
176          // Generate the appropriate user information for the user we are looking at
177          if (!function_exists('get_user_avatar'))
178          {
179              include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
180          }
181   
182          $rank_title = $rank_img = '';
183          $avatar_img = get_user_avatar($userrow['user_avatar'], $userrow['user_avatar_type'], $userrow['user_avatar_width'], $userrow['user_avatar_height']);
184   
185          $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'], 365 => $user->lang['1_YEAR']);
186          $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']);
187          $sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation');
188   
189          $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
190          gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
191   
192          // Define where and sort sql for use in displaying logs
193          $sql_where = ($st) ? (time() - ($st * 86400)) : 0;
194          $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
195   
196          $log_data = array();
197          $log_count = 0;
198          view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
199   
200          if ($log_count)
201          {
202              $template->assign_var('S_USER_NOTES', true);
203   
204              foreach ($log_data as $row)
205              {
206                  $template->assign_block_vars('usernotes', array(
207                      'REPORT_BY'        => $row['username_full'],
208                      'REPORT_AT'        => $user->format_date($row['time']),
209                      'ACTION'        => $row['action'],
210                      'IP'            => $row['ip'],
211                      'ID'            => $row['id'])
212                  );
213              }
214          }
215   
216          $template->assign_vars(array(
217              'U_POST_ACTION'            => $this->u_action,
218              'S_CLEAR_ALLOWED'        => ($auth->acl_get('a_clearlogs')) ? true : false,
219              'S_SELECT_SORT_DIR'        => $s_sort_dir,
220              'S_SELECT_SORT_KEY'        => $s_sort_key,
221              'S_SELECT_SORT_DAYS'    => $s_limit_days,
222   
223              'L_TITLE'            => $user->lang['MCP_NOTES_USER'],
224   
225              'PAGE_NUMBER'        => on_page($log_count, $config['posts_per_page'], $start),
226              'PAGINATION'        => generate_pagination($this->u_action . "&amp;st=$st&amp;sk=$sk&amp;sd=$sd", $log_count, $config['posts_per_page'], $start),
227              'TOTAL_REPORTS'        => ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count),
228   
229              'USERNAME'            => $userrow['username'],
230              'USER_COLOR'        => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '',
231              'RANK_TITLE'        => $rank_title,
232              'JOINED'            => $user->format_date($userrow['user_regdate']),
233              'POSTS'                => ($userrow['user_posts']) ? $userrow['user_posts'] : 0,
234              'WARNINGS'            => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0,
235   
236              'AVATAR_IMG'        => $avatar_img,
237              'RANK_IMG'            => $rank_img,
238              )
239          );
240      }
241   
242  }
243   
244  ?>