Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

delete_cookies.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 3.53 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  namespace phpbb\ucp\controller;
 015   
 016  use phpbb\config\config;
 017  use phpbb\event\dispatcher_interface;
 018  use phpbb\language\language;
 019  use phpbb\request\request_interface;
 020  use phpbb\user;
 021   
 022  class delete_cookies
 023  {
 024      /** @var config */
 025      private $config;
 026   
 027      /** @var dispatcher_interface */
 028      private $dispatcher;
 029   
 030      /** @var language */
 031      private $language;
 032   
 033      /** @var request_interface */
 034      private $request;
 035   
 036      /** @var user */
 037      private $user;
 038   
 039      /** @var string phpBB root path */
 040      private $phpbb_root_path;
 041   
 042      /** @var string PHP extension */
 043      private $php_ext;
 044   
 045      /**
 046       * Constructor for delete_cookies controller
 047       *
 048       * @param config $config
 049       * @param dispatcher_interface $dispatcher
 050       * @param language $language
 051       * @param request_interface $request
 052       * @param user $user
 053       */
 054      public function __construct(config $config, dispatcher_interface $dispatcher, language $language, request_interface $request, user $user, string $phpbb_root_path, string $php_ext)
 055      {
 056          $this->config = $config;
 057          $this->dispatcher = $dispatcher;
 058          $this->language = $language;
 059          $this->request = $request;
 060          $this->user = $user;
 061          $this->phpbb_root_path = $phpbb_root_path;
 062          $this->php_ext = $php_ext;
 063      }
 064   
 065      /**
 066       * Handle delete cookies requests
 067       *
 068       * @return void
 069       */
 070      public function handle()
 071      {
 072          $this->language->add_lang(['ucp']);
 073   
 074          // Delete Cookies with dynamic names (do NOT delete poll cookies)
 075          if (confirm_box(true))
 076          {
 077              $set_time = time() - 31536000;
 078   
 079              foreach ($this->request->variable_names(request_interface::COOKIE) as $cookie_name)
 080              {
 081                  // Only delete board cookies
 082                  if (strpos($cookie_name, $this->config['cookie_name'] . '_') !== 0)
 083                  {
 084                      continue;
 085                  }
 086   
 087                  $cookie_name = str_replace($this->config['cookie_name'] . '_', '', $cookie_name);
 088   
 089                  /**
 090                   * Event to save custom cookies from deletion
 091                   *
 092                   * @event core.ucp_delete_cookies
 093                   * @var    string    cookie_name        Cookie name to checking
 094                   * @var    bool    retain_cookie    Do we retain our cookie or not, true if retain
 095                   * @since 3.1.3-RC1
 096                   * @changed 3.3.13-RC1 Moved to new delete_cookies controller
 097                   */
 098                  $retain_cookie = false;
 099                  $vars = ['cookie_name', 'retain_cookie'];
 100                  extract($this->dispatcher->trigger_event('core.ucp_delete_cookies', compact($vars)));
 101                  if ($retain_cookie)
 102                  {
 103                      continue;
 104                  }
 105   
 106                  // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_
 107                  if (strpos($cookie_name, 'poll_') !== 0)
 108                  {
 109                      $this->user->set_cookie($cookie_name, '', $set_time);
 110                  }
 111              }
 112   
 113              $this->user->set_cookie('track', '', $set_time);
 114              $this->user->set_cookie('u', '', $set_time);
 115              $this->user->set_cookie('k', '', $set_time);
 116              $this->user->set_cookie('sid', '', $set_time);
 117   
 118              // We destroy the session here, the user will be logged out nevertheless
 119              $this->user->session_kill();
 120              $this->user->session_begin();
 121   
 122              meta_refresh(3, append_sid("{$this->phpbb_root_path}index.$this->php_ext"));
 123   
 124              $message = $this->language->lang('COOKIES_DELETED') . '<br><br>' . $this->language->lang('RETURN_INDEX', '<a href="' . append_sid("{$this->phpbb_root_path}index.$this->php_ext") . '">', '</a>');
 125              trigger_error($message);
 126          }
 127          else
 128          {
 129              confirm_box(false, 'DELETE_COOKIES', '');
 130          }
 131   
 132          redirect(append_sid("{$this->phpbb_root_path}index.$this->php_ext"));
 133      }
 134  }
 135