Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

admin_form.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 4.70 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\message;
015   
016  /**
017  * Class admin_form
018  * Displays a message to the user and allows him to send an email
019  */
020  class admin_form extends form
021  {
022      /** @var \phpbb\config\db_text */
023      protected $config_text;
024   
025      /** @var string */
026      protected $subject;
027      /** @var string */
028      protected $sender_name;
029      /** @var string */
030      protected $sender_address;
031   
032      /**
033      * Construct
034      *
035      * @param \phpbb\auth\auth $auth
036      * @param \phpbb\config\config $config
037      * @param \phpbb\config\db_text $config_text
038      * @param \phpbb\db\driver\driver_interface $db
039      * @param \phpbb\user $user
040      * @param string $phpbb_root_path
041      * @param string $phpEx
042      */
043      public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $phpEx)
044      {
045          parent::__construct($auth, $config, $db, $user, $phpbb_root_path, $phpEx);
046          $this->config_text = $config_text;
047      }
048   
049      /**
050      * {inheritDoc}
051      */
052      public function check_allow()
053      {
054          $error = parent::check_allow();
055          if ($error)
056          {
057              return $error;
058          }
059   
060          if (!$this->config['contact_admin_form_enable'])
061          {
062              return 'NO_CONTACT_PAGE';
063          }
064   
065          return false;
066      }
067   
068      /**
069      * {inheritDoc}
070      */
071      public function bind(\phpbb\request\request_interface $request)
072      {
073          parent::bind($request);
074   
075          $this->subject = $request->variable('subject', '', true);
076          $this->sender_address = $request->variable('email', '');
077          $this->sender_name = $request->variable('name', '', true);
078      }
079   
080      /**
081      * {inheritDoc}
082      */
083      public function submit(\messenger $messenger)
084      {
085          if (!$this->subject)
086          {
087              $this->errors[] = $this->user->lang['EMPTY_SUBJECT_EMAIL'];
088          }
089          if (!$this->body)
090          {
091              $this->errors[] = $this->user->lang['EMPTY_MESSAGE_EMAIL'];
092          }
093   
094          if ($this->user->data['is_registered'])
095          {
096              $this->message->set_sender_from_user($this->user);
097              $this->sender_name = $this->user->data['username'];
098              $this->sender_address = $this->user->data['user_email'];
099          }
100          else
101          {
102              if (!$this->sender_name)
103              {
104                  $this->errors[] = $this->user->lang['EMPTY_SENDER_NAME'];
105              }
106   
107              if (!function_exists('validate_data'))
108              {
109                  require($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
110              }
111   
112              $validate_array = validate_data(
113                  array(
114                      'email' => $this->sender_address,
115                  ),
116                  array(
117                      'email' => array(
118                          array('string', false, 6, 60),
119                          array('email'),
120                      ),
121                  )
122              );
123   
124              foreach ($validate_array as $error)
125              {
126                  $this->errors[] = $this->user->lang[$error];
127              }
128   
129              $this->message->set_sender($this->user->ip, $this->sender_name, $this->sender_address, $this->user->lang_name);
130              $this->message->set_sender_notify_type(NOTIFY_EMAIL);
131          }
132   
133          $this->message->set_template('contact_admin');
134          $this->message->set_subject($this->subject);
135          $this->message->set_body($this->body);
136          $this->message->add_recipient(
137              $this->user->lang['ADMINISTRATOR'],
138              $this->config['board_contact'],
139              $this->config['default_lang'],
140              NOTIFY_EMAIL
141          );
142   
143          $this->message->set_template_vars(array(
144              'FROM_EMAIL_ADDRESS'    => $this->sender_address,
145              'FROM_IP_ADDRESS'        => $this->user->ip,
146              'S_IS_REGISTERED'        => $this->user->data['is_registered'],
147   
148              'U_FROM_PROFILE'        => generate_board_url() . '/memberlist.' . $this->phpEx . '?mode=viewprofile&u=' . $this->user->data['user_id'],
149          ));
150   
151          parent::submit($messenger);
152      }
153   
154      /**
155      * {inheritDoc}
156      */
157      public function render(\phpbb\template\template $template)
158      {
159          $l_admin_info = $this->config_text->get('contact_admin_info');
160          if ($l_admin_info)
161          {
162              $contact_admin_data            = $this->config_text->get_array(array(
163                  'contact_admin_info',
164                  'contact_admin_info_uid',
165                  'contact_admin_info_bitfield',
166                  'contact_admin_info_flags',
167              ));
168   
169              $l_admin_info = generate_text_for_display(
170                  $contact_admin_data['contact_admin_info'],
171                  $contact_admin_data['contact_admin_info_uid'],
172                  $contact_admin_data['contact_admin_info_bitfield'],
173                  $contact_admin_data['contact_admin_info_flags']
174              );
175          }
176   
177          $template->assign_vars(array(
178              'S_CONTACT_ADMIN'    => true,
179              'S_CONTACT_FORM'    => $this->config['contact_admin_form_enable'],
180              'S_IS_REGISTERED'    => $this->user->data['is_registered'],
181              'S_POST_ACTION'        => append_sid($this->phpbb_root_path . 'memberlist.' . $this->phpEx, 'mode=contactadmin'),
182   
183              'CONTACT_INFO'        => $l_admin_info,
184              'MESSAGE'            => $this->body,
185              'SUBJECT'            => $this->subject,
186              'NAME'                => $this->sender_name,
187              'EMAIL'                => $this->sender_address,
188          ));
189   
190          parent::render($template);
191      }
192  }
193