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

viewonline_helper.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 2.55 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;
 015   
 016  /**
 017   * Class to handle viewonline related tasks
 018   */
 019  class viewonline_helper
 020  {
 021      /** @var \phpbb\filesystem\filesystem_interface */
 022      protected $filesystem;
 023   
 024      /** @var \phpbb\db\driver\driver_interface */
 025      protected $db;
 026   
 027      /**
 028       * @param \phpbb\filesystem\filesystem_interface $filesystem    phpBB's filesystem service
 029       * @param \phpbb\db\driver\driver_interface $db
 030       */
 031      public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\db\driver\driver_interface $db)
 032      {
 033          $this->filesystem = $filesystem;
 034          $this->db = $db;
 035      }
 036   
 037      /**
 038       * Get forum IDs for topics
 039       *
 040       * Retrieve forum IDs and add the data into the session data array
 041       * Array structure matches sql_fethrowset() result array
 042       *
 043       * @param array $session_data_rowset Users' session data array
 044       * @return void
 045       */
 046      public function get_forum_ids(array &$session_data_rowset): void
 047      {
 048          $topic_ids = $match = [];
 049          foreach ($session_data_rowset as $number => $row)
 050          {
 051              if ($row['session_forum_id'] == 0 && preg_match('#t=([0-9]+)#', $row['session_page'], $match))
 052              {
 053                  $topic_ids[$number] = (int) $match[1];
 054              }
 055          }
 056   
 057          if (count($topic_ids = array_unique($topic_ids)))
 058          {
 059              $sql_ary = [
 060                  'SELECT'    => 't.topic_id, t.forum_id',
 061                  'FROM'        => [
 062                      TOPICS_TABLE => 't',
 063                  ],
 064                  'WHERE'        => $this->db->sql_in_set('t.topic_id', $topic_ids),
 065                  'ORDER_BY'    => 't.topic_id',
 066              ];
 067              $result = $this->db->sql_query($this->db->sql_build_query('SELECT', $sql_ary));
 068              $forum_ids_rowset = $this->db->sql_fetchrowset($result);
 069              $this->db->sql_freeresult($result);
 070   
 071              foreach ($forum_ids_rowset as $forum_ids_row)
 072              {
 073                  $session_data_row_number = array_search((int) $forum_ids_row['topic_id'], $topic_ids);
 074                  $session_data_rowset[$session_data_row_number]['session_forum_id'] = (int) $forum_ids_row['forum_id'];
 075              }
 076          }
 077      }
 078   
 079      /**
 080       * Get user page
 081       *
 082       * @param string $session_page User's session page
 083       * @return array Match array filled by preg_match()
 084       */
 085      public function get_user_page($session_page)
 086      {
 087          $session_page = $this->filesystem->clean_path($session_page);
 088          if (strpos($session_page, './') === 0)
 089          {
 090              $session_page = substr($session_page, 2);
 091          }
 092   
 093          preg_match('#^((\.\./)*([a-z0-9/_-]+))#i', $session_page, $on_page);
 094          if (empty($on_page))
 095          {
 096              $on_page[1] = '';
 097          }
 098   
 099          return $on_page;
 100      }
 101  }
 102