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

messenger_base.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 2.52 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * For full copyright and license information, please see
10  * the docs/CREDITS.txt file.
11  *
12  */
13   
14  namespace phpbb\notification\method;
15   
16  /**
17  * Abstract notification method handling email and jabber notifications
18  * using the phpBB messenger.
19  */
20  abstract class messenger_base extends \phpbb\notification\method\base
21  {
22      /**
23      * Notify using phpBB messenger
24      *
25      * @param int $notify_method                Notify method for messenger (e.g. NOTIFY_IM)
26      * @param string $template_dir_prefix    Base directory to prepend to the email template name
27      *
28      * @return null
29      */
30      protected function notify_using_messenger($notify_method, $template_dir_prefix = '')
31      {
32          if (empty($this->queue))
33          {
34              return;
35          }
36   
37          // Load all users we want to notify (we need their email address)
38          $user_ids = $users = array();
39          foreach ($this->queue as $notification)
40          {
41              $user_ids[] = $notification->user_id;
42          }
43   
44          // We do not send emails to banned users
45          if (!function_exists('phpbb_get_banned_user_ids'))
46          {
47              include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
48          }
49          $banned_users = phpbb_get_banned_user_ids($user_ids);
50   
51          // Load all the users we need
52          $this->user_loader->load_users($user_ids);
53   
54          // Load the messenger
55          if (!class_exists('messenger'))
56          {
57              include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
58          }
59          $messenger = new \messenger();
60          $board_url = generate_board_url();
61   
62          // Time to go through the queue and send emails
63          foreach ($this->queue as $notification)
64          {
65              if ($notification->get_email_template() === false)
66              {
67                  continue;
68              }
69   
70              $user = $this->user_loader->get_user($notification->user_id);
71   
72              if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users))
73              {
74                  continue;
75              }
76   
77              $messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']);
78   
79              $messenger->set_addresses($user);
80   
81              $messenger->assign_vars(array_merge(array(
82                  'USERNAME'                        => $user['username'],
83   
84                  'U_NOTIFICATION_SETTINGS'        => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications',
85              ), $notification->get_email_template_variables()));
86   
87              $messenger->send($notify_method);
88          }
89   
90          // Save the queue in the messenger class (has to be called or these emails could be lost?)
91          $messenger->save_queue();
92   
93          // We're done, empty the queue
94          $this->empty_queue();
95      }
96  }
97