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

acp_jabber.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 3.86 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, $auth, $template;
033          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
034   
035          $user->add_lang('acp/board');
036   
037          include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
038   
039          $action    = request_var('action', '');
040          $submit = (isset($_POST['submit'])) ? true : false;
041   
042          if ($mode != 'settings')
043          {
044              return;
045          }
046   
047          $this->tpl_name = 'acp_jabber';
048          $this->page_title = 'ACP_JABBER_SETTINGS';
049   
050          $jab_enable            = request_var('jab_enable',            (bool) $config['jab_enable']);
051          $jab_host            = request_var('jab_host',            (string) $config['jab_host']);
052          $jab_port            = request_var('jab_port',            (int) $config['jab_port']);
053          $jab_username        = request_var('jab_username',        (string) $config['jab_username']);
054          $jab_password        = request_var('jab_password',        (string) $config['jab_password']);
055          $jab_package_size    = request_var('jab_package_size',    (int) $config['jab_package_size']);
056          $jab_use_ssl        = request_var('jab_use_ssl',        (bool) $config['jab_use_ssl']);
057   
058          $form_name = 'acp_jabber';
059          add_form_key($form_name);
060   
061          if ($submit)
062          {
063              if (!check_form_key($form_name))
064              {
065                  trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
066              }
067   
068              $error = array();
069   
070              $message = $user->lang['JAB_SETTINGS_CHANGED'];
071              $log = 'JAB_SETTINGS_CHANGED';
072   
073              // Is this feature enabled? Then try to establish a connection
074              if ($jab_enable)
075              {
076                  $jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl);
077   
078                  if (!$jabber->connect())
079                  {
080                      trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
081                  }
082   
083                  // We'll try to authorise using this account
084                  if (!$jabber->login())
085                  {
086                      trigger_error($user->lang['ERR_JAB_AUTH'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
087                  }
088   
089                  $jabber->disconnect();
090              }
091              else
092              {
093                  // This feature is disabled.
094                  // We update the user table to be sure all users that have IM as notify type are set to both as notify type
095                  // 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.
096                  $sql_ary = array(
097                      'user_notify_type'        => NOTIFY_BOTH,
098                  );
099   
100                  $sql = 'UPDATE ' . USERS_TABLE . '
101                      SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
102                      WHERE user_notify_type = ' . NOTIFY_IM;
103                  $db->sql_query($sql);
104              }
105   
106              set_config('jab_enable', $jab_enable);
107              set_config('jab_host', $jab_host);
108              set_config('jab_port', $jab_port);
109              set_config('jab_username', $jab_username);
110              set_config('jab_password', $jab_password);
111              set_config('jab_package_size', $jab_package_size);
112              set_config('jab_use_ssl', $jab_use_ssl);
113   
114              add_log('admin', 'LOG_' . $log);
115              trigger_error($message . adm_back_link($this->u_action));
116          }
117   
118          $template->assign_vars(array(
119              'U_ACTION'                => $this->u_action,
120              'JAB_ENABLE'            => $jab_enable,
121              'L_JAB_SERVER_EXPLAIN'    => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'),
122              'JAB_HOST'                => $jab_host,
123              'JAB_PORT'                => ($jab_port) ? $jab_port : '',
124              'JAB_USERNAME'            => $jab_username,
125              'JAB_PASSWORD'            => $jab_password,
126              'JAB_PACKAGE_SIZE'        => $jab_package_size,
127              'JAB_USE_SSL'            => $jab_use_ssl,
128              'S_CAN_USE_SSL'            => jabber::can_use_ssl(),
129              'S_GTALK_NOTE'            => (!@function_exists('dns_get_record')) ? true : false,
130          ));
131      }
132  }
133