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. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
acp_listener.php
001 <?php
002 /**
003 *
004 * VigLink extension for the phpBB Forum Software package.
005 *
006 * @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 */
010
011 namespace phpbb\viglink\event;
012
013 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
014
015 /**
016 * ACP Event listener
017 */
018 class acp_listener implements EventSubscriberInterface
019 {
020 /** @var \phpbb\config\config $config Config object */
021 protected $config;
022
023 /** @var \phpbb\request\request_interface $request Request interface */
024 protected $request;
025
026 /** @var \phpbb\template\template $template Template object */
027 protected $template;
028
029 /** @var \phpbb\language\language $language Language object */
030 protected $language;
031
032 /** @var \phpbb\user $user User object */
033 protected $user;
034
035 /** @var \phpbb\viglink\acp\viglink_helper $helper VigLink helper object */
036 protected $helper;
037
038 /** @var string $phpbb_root_path phpBB root path */
039 protected $phpbb_root_path;
040
041 /** @var string $php_ext PHP file extension */
042 protected $php_ext;
043
044 /**
045 * Constructor
046 *
047 * @param \phpbb\config\config $config
048 * @param \phpbb\language\language $language
049 * @param \phpbb\request\request_interface $request phpBB request
050 * @param \phpbb\template\template $template
051 * @param \phpbb\user $user User object
052 * @param \phpbb\viglink\acp\viglink_helper $viglink_helper Viglink helper object
053 * @param string $phpbb_root_path phpBB root path
054 * @param string $php_ext PHP file extension
055 */
056 public function __construct(\phpbb\config\config $config, \phpbb\language\language $language, \phpbb\request\request_interface $request,
057 \phpbb\template\template $template, \phpbb\user $user, \phpbb\viglink\acp\viglink_helper $viglink_helper,
058 $phpbb_root_path, $php_ext)
059 {
060 $this->config = $config;
061 $this->language = $language;
062 $this->request = $request;
063 $this->template = $template;
064 $this->user = $user;
065 $this->helper = $viglink_helper;
066 $this->phpbb_root_path = $phpbb_root_path;
067 $this->php_ext = $php_ext;
068 }
069
070 /**
071 * {@inheritDoc}
072 */
073 public static function getSubscribedEvents()
074 {
075 return array(
076 'core.acp_main_notice' => 'set_viglink_services',
077 'core.acp_help_phpbb_submit_before' => 'update_viglink_settings',
078 );
079 }
080
081 /**
082 * Check if phpBB is allowing VigLink services to run.
083 *
084 * VigLink will be disabled if phpBB is disallowing it to run.
085 *
086 * @return void
087 */
088 public function set_viglink_services()
089 {
090 try
091 {
092 $this->helper->set_viglink_services();
093 }
094 catch (\RuntimeException $e)
095 {
096 $this->helper->log_viglink_error($e->getMessage());
097 }
098
099 // Only redirect once every 24 hours
100 if (empty($this->config['viglink_ask_admin']) && $this->user->data['user_type'] == USER_FOUNDER && (time() - intval($this->config['viglink_ask_admin_last']) > 86400))
101 {
102 $this->config->set('viglink_ask_admin_last', time());
103 redirect(append_sid($this->phpbb_root_path . 'adm/index.' . $this->php_ext, 'i=acp_help_phpbb&mode=help_phpbb'));
104 }
105 }
106
107 /**
108 * Update VigLink settings
109 *
110 * @param array $event Event data
111 *
112 * @return void
113 */
114 public function update_viglink_settings($event)
115 {
116 $this->language->add_lang('viglink_module_acp', 'phpbb/viglink');
117
118 $viglink_setting = $this->request->variable('enable-viglink', false);
119
120 if (!empty($event['submit']))
121 {
122 $this->config->set('viglink_enabled', $viglink_setting);
123 if (empty($this->config['viglink_ask_admin']))
124 {
125 $this->config->set('viglink_ask_admin', time());
126 }
127 }
128
129 $this->template->assign_vars(array(
130 'S_ENABLE_VIGLINK' => !empty($this->config['viglink_enabled']) || !$this->config['help_send_statistics_time'],
131 'S_VIGLINK_ASK_ADMIN' => empty($this->config['viglink_ask_admin']) && $this->user->data['user_type'] == USER_FOUNDER,
132 'ACP_VIGLINK_SETTINGS_CHANGE' => $this->language->lang('ACP_VIGLINK_SETTINGS_CHANGE', append_sid($this->phpbb_root_path . 'adm/index.' . $this->php_ext, 'i=-phpbb-viglink-acp-viglink_module&mode=settings')),
133 ));
134 }
135 }
136