Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

acp_jabber.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 4.71 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  * @todo Check/enter/update transport info
016  */
017   
018  /**
019  * @ignore
020  */
021  if (!defined('IN_PHPBB'))
022  {
023      exit;
024  }
025   
026  class acp_jabber
027  {
028      var $u_action;
029   
030      function main($id, $mode)
031      {
032          global $db, $user, $template, $phpbb_log, $request;
033          global $config, $phpbb_root_path, $phpEx;
034   
035          $user->add_lang('acp/board');
036   
037          if (!class_exists('jabber'))
038          {
039              include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
040          }
041   
042          $submit = (isset($_POST['submit'])) ? true : false;
043   
044          if ($mode != 'settings')
045          {
046              return;
047          }
048   
049          $this->tpl_name = 'acp_jabber';
050          $this->page_title = 'ACP_JABBER_SETTINGS';
051   
052          $jab_enable                = $request->variable('jab_enable',            (bool) $config['jab_enable']);
053          $jab_host                = $request->variable('jab_host',            (string) $config['jab_host']);
054          $jab_port                = $request->variable('jab_port',            (int) $config['jab_port']);
055          $jab_username            = $request->variable('jab_username',        (string) $config['jab_username']);
056          $jab_password            = $request->variable('jab_password',        (string) $config['jab_password']);
057          $jab_package_size        = $request->variable('jab_package_size',    (int) $config['jab_package_size']);
058          $jab_use_ssl            = $request->variable('jab_use_ssl',        (bool) $config['jab_use_ssl']);
059          $jab_verify_peer        = $request->variable('jab_verify_peer',        (bool) $config['jab_verify_peer']);
060          $jab_verify_peer_name    = $request->variable('jab_verify_peer_name',    (bool) $config['jab_verify_peer_name']);
061          $jab_allow_self_signed    = $request->variable('jab_allow_self_signed',    (bool) $config['jab_allow_self_signed']);
062   
063          $form_name = 'acp_jabber';
064          add_form_key($form_name);
065   
066          if ($submit)
067          {
068              if (!check_form_key($form_name))
069              {
070                  trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
071              }
072   
073              $message = $user->lang['JAB_SETTINGS_CHANGED'];
074              $log = 'JAB_SETTINGS_CHANGED';
075   
076              // Is this feature enabled? Then try to establish a connection
077              if ($jab_enable)
078              {
079                  $jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl, $jab_verify_peer, $jab_verify_peer_name, $jab_allow_self_signed);
080   
081                  if (!$jabber->connect())
082                  {
083                      trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
084                  }
085   
086                  // We'll try to authorise using this account
087                  if (!$jabber->login())
088                  {
089                      trigger_error($user->lang['ERR_JAB_AUTH'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
090                  }
091   
092                  $jabber->disconnect();
093              }
094              else
095              {
096                  // This feature is disabled.
097                  // We update the user table to be sure all users that have IM as notify type are set to both as notify type
098                  // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
099                  $sql_ary = array(
100                      'user_notify_type'        => NOTIFY_BOTH,
101                  );
102   
103                  $sql = 'UPDATE ' . USERS_TABLE . '
104                      SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
105                      WHERE user_notify_type = ' . NOTIFY_IM;
106                  $db->sql_query($sql);
107              }
108   
109              $config->set('jab_enable', $jab_enable);
110              $config->set('jab_host', $jab_host);
111              $config->set('jab_port', $jab_port);
112              $config->set('jab_username', $jab_username);
113              if ($jab_password !== '********')
114              {
115                  $config->set('jab_password', $jab_password);
116              }
117              $config->set('jab_package_size', $jab_package_size);
118              $config->set('jab_use_ssl', $jab_use_ssl);
119              $config->set('jab_verify_peer', $jab_verify_peer);
120              $config->set('jab_verify_peer_name', $jab_verify_peer_name);
121              $config->set('jab_allow_self_signed', $jab_allow_self_signed);
122   
123              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . $log);
124              trigger_error($message . adm_back_link($this->u_action));
125          }
126   
127          $template->assign_vars(array(
128              'U_ACTION'                => $this->u_action,
129              'JAB_ENABLE'            => $jab_enable,
130              'L_JAB_SERVER_EXPLAIN'    => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'),
131              'JAB_HOST'                => $jab_host,
132              'JAB_PORT'                => ($jab_port) ? $jab_port : '',
133              'JAB_USERNAME'            => $jab_username,
134              'JAB_PASSWORD'            => $jab_password !== '' ? '********' : '',
135              'JAB_PACKAGE_SIZE'        => $jab_package_size,
136              'JAB_USE_SSL'            => $jab_use_ssl,
137              'JAB_VERIFY_PEER'        => $jab_verify_peer,
138              'JAB_VERIFY_PEER_NAME'    => $jab_verify_peer_name,
139              'JAB_ALLOW_SELF_SIGNED'    => $jab_allow_self_signed,
140              'S_CAN_USE_SSL'            => jabber::can_use_ssl(),
141              'S_GTALK_NOTE'            => (!@function_exists('dns_get_record')) ? true : false,
142          ));
143      }
144  }
145