Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

ucp.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 9.98 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  /**
 015  * @ignore
 016  */
 017  define('IN_PHPBB', true);
 018  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
 019  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 020  require($phpbb_root_path . 'common.' . $phpEx);
 021  require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
 022  require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
 023   
 024  // Basic parameter data
 025  $id     = request_var('i', '');
 026  $mode    = request_var('mode', '');
 027   
 028  if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate')))
 029  {
 030      define('IN_LOGIN', true);
 031  }
 032   
 033  // Start session management
 034  $user->session_begin();
 035  $auth->acl($user->data);
 036  $user->setup('ucp');
 037   
 038  // Setting a variable to let the style designer know where he is...
 039  $template->assign_var('S_IN_UCP', true);
 040   
 041  $module = new p_master();
 042  $default = false;
 043   
 044  // Basic "global" modes
 045  switch ($mode)
 046  {
 047      case 'activate':
 048          $module->load('ucp', 'activate');
 049          $module->display($user->lang['UCP_ACTIVATE']);
 050   
 051          redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 052      break;
 053   
 054      case 'resend_act':
 055          $module->load('ucp', 'resend');
 056          $module->display($user->lang['UCP_RESEND']);
 057      break;
 058   
 059      case 'sendpassword':
 060          $module->load('ucp', 'remind');
 061          $module->display($user->lang['UCP_REMIND']);
 062      break;
 063   
 064      case 'register':
 065          if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
 066          {
 067              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 068          }
 069   
 070          $module->load('ucp', 'register');
 071          $module->display($user->lang['REGISTER']);
 072      break;
 073   
 074      case 'confirm':
 075          $module->load('ucp', 'confirm');
 076      break;
 077   
 078      case 'login':
 079          if ($user->data['is_registered'])
 080          {
 081              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 082          }
 083   
 084          login_box(request_var('redirect', "index.$phpEx"));
 085      break;
 086   
 087      case 'login_link':
 088          if ($user->data['is_registered'])
 089          {
 090              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 091          }
 092   
 093          $module->load('ucp', 'login_link');
 094          $module->display($user->lang['UCP_LOGIN_LINK']);
 095      break;
 096   
 097      case 'logout':
 098          if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
 099          {
 100              $user->session_kill();
 101          }
 102          else if ($user->data['user_id'] != ANONYMOUS)
 103          {
 104              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
 105   
 106              $message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
 107              trigger_error($message);
 108          }
 109   
 110          redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 111      break;
 112   
 113      case 'terms':
 114      case 'privacy':
 115   
 116          $message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY';
 117          $title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY';
 118   
 119          if (empty($user->lang[$message]))
 120          {
 121              if ($user->data['is_registered'])
 122              {
 123                  redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 124              }
 125   
 126              login_box();
 127          }
 128   
 129          $template->set_filenames(array(
 130              'body'        => 'ucp_agreement.html')
 131          );
 132   
 133          // Disable online list
 134          page_header($user->lang[$title]);
 135   
 136          $template->assign_vars(array(
 137              'S_AGREEMENT'            => true,
 138              'AGREEMENT_TITLE'        => $user->lang[$title],
 139              'AGREEMENT_TEXT'        => sprintf($user->lang[$message], $config['sitename'], generate_board_url()),
 140              'U_BACK'                => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
 141              'L_BACK'                => $user->lang['BACK_TO_LOGIN'],
 142          ));
 143   
 144          page_footer();
 145   
 146      break;
 147   
 148      case 'delete_cookies':
 149   
 150          // Delete Cookies with dynamic names (do NOT delete poll cookies)
 151          if (confirm_box(true))
 152          {
 153              $set_time = time() - 31536000;
 154   
 155              foreach ($request->variable_names(\phpbb\request\request_interface::COOKIE) as $cookie_name)
 156              {
 157                  $cookie_data = $request->variable($cookie_name, '', true, \phpbb\request\request_interface::COOKIE);
 158   
 159                  // Only delete board cookies, no other ones...
 160                  if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0)
 161                  {
 162                      continue;
 163                  }
 164   
 165                  $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name);
 166   
 167                  // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_
 168                  if (strpos($cookie_name, 'poll_') !== 0)
 169                  {
 170                      $user->set_cookie($cookie_name, '', $set_time);
 171                  }
 172              }
 173   
 174              $user->set_cookie('track', '', $set_time);
 175              $user->set_cookie('u', '', $set_time);
 176              $user->set_cookie('k', '', $set_time);
 177              $user->set_cookie('sid', '', $set_time);
 178   
 179              // We destroy the session here, the user will be logged out nevertheless
 180              $user->session_kill();
 181              $user->session_begin();
 182   
 183              meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
 184   
 185              $message = $user->lang['COOKIES_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 186              trigger_error($message);
 187          }
 188          else
 189          {
 190              confirm_box(false, 'DELETE_COOKIES', '');
 191          }
 192   
 193          redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 194   
 195      break;
 196   
 197      case 'switch_perm':
 198   
 199          $user_id = request_var('u', 0);
 200   
 201          $sql = 'SELECT *
 202              FROM ' . USERS_TABLE . '
 203              WHERE user_id = ' . (int) $user_id;
 204          $result = $db->sql_query($sql);
 205          $user_row = $db->sql_fetchrow($result);
 206          $db->sql_freeresult($result);
 207   
 208          if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash(request_var('hash', ''), 'switchperm'))
 209          {
 210              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 211          }
 212   
 213          include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
 214   
 215          $auth_admin = new auth_admin();
 216          if (!$auth_admin->ghost_permissions($user_id, $user->data['user_id']))
 217          {
 218              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 219          }
 220   
 221          add_log('admin', 'LOG_ACL_TRANSFER_PERMISSIONS', $user_row['username']);
 222   
 223          $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 224          trigger_error($message);
 225   
 226      break;
 227   
 228      case 'restore_perm':
 229   
 230          if (!$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm'))
 231          {
 232              redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 233          }
 234   
 235          $auth->acl_cache($user->data);
 236   
 237          $sql = 'SELECT username
 238              FROM ' . USERS_TABLE . '
 239              WHERE user_id = ' . $user->data['user_perm_from'];
 240          $result = $db->sql_query($sql);
 241          $username = $db->sql_fetchfield('username');
 242          $db->sql_freeresult($result);
 243   
 244          add_log('admin', 'LOG_ACL_RESTORE_PERMISSIONS', $username);
 245   
 246          $message = $user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 247          trigger_error($message);
 248   
 249      break;
 250   
 251      default:
 252          $default = true;
 253      break;
 254  }
 255   
 256  // We use this approach because it does not impose large code changes
 257  if (!$default)
 258  {
 259      return true;
 260  }
 261   
 262  // Only registered users can go beyond this point
 263  if (!$user->data['is_registered'])
 264  {
 265      if ($user->data['is_bot'])
 266      {
 267          redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
 268      }
 269   
 270      if ($id == 'pm' && $mode == 'view' && isset($_GET['p']))
 271      {
 272          $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx?i=pm&p=" . request_var('p', 0));
 273          login_box($redirect_url, $user->lang['LOGIN_EXPLAIN_UCP']);
 274      }
 275   
 276      login_box('', $user->lang['LOGIN_EXPLAIN_UCP']);
 277  }
 278   
 279  // Instantiate module system and generate list of available modules
 280  $module->list_modules('ucp');
 281   
 282  // Check if the zebra module is set
 283  if ($module->is_active('zebra', 'friends'))
 284  {
 285      // Output listing of friends online
 286      $update_time = $config['load_online_time'] * 60;
 287   
 288      $sql_ary = array(
 289          'SELECT'    => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',
 290   
 291          'FROM'        => array(
 292              USERS_TABLE        => 'u',
 293              ZEBRA_TABLE        => 'z',
 294          ),
 295   
 296          'LEFT_JOIN'    => array(
 297              array(
 298                  'FROM'    => array(SESSIONS_TABLE => 's'),
 299                  'ON'    => 's.session_user_id = z.zebra_id',
 300              ),
 301          ),
 302   
 303          'WHERE'        => 'z.user_id = ' . $user->data['user_id'] . '
 304              AND z.friend = 1
 305              AND u.user_id = z.zebra_id',
 306   
 307          'GROUP_BY'    => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username',
 308   
 309          'ORDER_BY'    => 'u.username_clean ASC',
 310      );
 311   
 312      $sql = $db->sql_build_query('SELECT_DISTINCT', $sql_ary);
 313      $result = $db->sql_query($sql);
 314   
 315      while ($row = $db->sql_fetchrow($result))
 316      {
 317          $which = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? 'online' : 'offline';
 318   
 319          $template->assign_block_vars("friends_{$which}", array(
 320              'USER_ID'        => $row['user_id'],
 321   
 322              'U_PROFILE'        => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
 323              'USER_COLOUR'    => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
 324              'USERNAME'        => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
 325              'USERNAME_FULL'    => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))
 326          );
 327      }
 328      $db->sql_freeresult($result);
 329  }
 330   
 331  // Do not display subscribed topics/forums if not allowed
 332  if (!$config['allow_topic_notify'] && !$config['allow_forum_notify'])
 333  {
 334      $module->set_display('main', 'subscribed', false);
 335  }
 336   
 337  /**
 338  * Use this event to enable and disable additional UCP modules
 339  *
 340  * @event core.ucp_display_module_before
 341  * @var    p_master    module    Object holding all modules and their status
 342  * @var    mixed        id        Active module category (can be the int or string)
 343  * @var    string        mode    Active module
 344  * @since 3.1.0-a1
 345  */
 346  $vars = array('module', 'id', 'mode');
 347  extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars)));
 348   
 349  // Select the active module
 350  $module->set_active($id, $mode);
 351   
 352  // Load and execute the relevant module
 353  $module->load_active();
 354   
 355  // Assign data to the template engine for the list of modules
 356  $module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx"));
 357   
 358  // Generate the page, do not display/query online list
 359  $module->display($module->get_page_title());
 360