Subversion Repositories oidplus

Rev

Rev 1116 | Rev 1131 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1116 Rev 1130
Line 43... Line 43...
43
                $parts = explode('$',$id);
43
                $parts = explode('$',$id);
44
                $id = $parts[0];
44
                $id = $parts[0];
45
 
45
 
46
                if ($id == 'oidplus:notifications') {
46
                if ($id == 'oidplus:notifications') {
47
                        $handled = true;
47
                        $handled = true;
48
                        $ra_email = isset($parts[1]) ? $parts[1] : null/*no filter*/;
48
                        $ra_email = $parts[1] ?? null/*no filter*/;
49
 
49
 
50
                        $out['title'] = _L('Notifications');
50
                        $out['title'] = _L('Notifications');
51
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
51
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
52
 
52
 
53
                        if ($ra_email == 'admin') {
53
                        if ($ra_email == 'admin') {
Line 192... Line 192...
192
        /**
192
        /**
193
         * @param string $dir
193
         * @param string $dir
194
         * @return array
194
         * @return array
195
         * @throws OIDplusException
195
         * @throws OIDplusException
196
         */
196
         */
197
        private function getNotificationsCheckDirAccess(string $dir) {
197
        private function getNotificationsCheckDirAccess(string $dir): array {
198
                $notifications = array();
198
                $notifications = array();
199
                if (($url = $this->webAccessWorks($dir)) !== false) {
199
                if (($url = $this->webAccessWorks($dir)) !== false) {
200
                        // Re-use message taken from setup/includes/setup_base.js
200
                        // Re-use message taken from setup/includes/setup_base.js
201
                        $msg = _L('Attention: The following directory is world-readable: %1 ! You need to configure your web server to restrict access to this directory! (For Apache see <i>.htaccess</i>, for Microsoft IIS see <i>web.config</i>, for Nginx see <i>nginx.conf</i>).','<a target="_blank" href="'.$url.'">'.$dir.'</a>');
201
                        $msg = _L('Attention: The following directory is world-readable: %1 ! You need to configure your web server to restrict access to this directory! (For Apache see <i>.htaccess</i>, for Microsoft IIS see <i>web.config</i>, for Nginx see <i>nginx.conf</i>).','<a target="_blank" href="'.$url.'">'.$dir.'</a>');
202
                        $notifications[] = array('CRIT', $msg);
202
                        $notifications[] = array('CRIT', $msg);
Line 205... Line 205...
205
        }
205
        }
206
 
206
 
207
        /**
207
        /**
208
         * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.8
208
         * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.8
209
         * These are some basic "system" checks, no checks from other plugin. So we add them to our plugin instead.
209
         * These are some basic "system" checks, no checks from other plugin. So we add them to our plugin instead.
210
         * @param $user
210
         * @param string|null $user
211
         * @return array
211
         * @return array
212
         * @throws OIDplusException
212
         * @throws OIDplusException
213
         */
213
         */
214
        public function getNotifications($user=null): array {
214
        public function getNotifications(string $user=null): array {
215
                $notifications = array();
215
                $notifications = array();
216
                if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) {
216
                if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) {
217
                        // Check if critical directories are world-readable
217
                        // Check if critical directories are world-readable
218
                        if ($this->webAccessWorks('index.php') === false) {
218
                        if ($this->webAccessWorks('index.php') === false) {
219
                                $notifications[] = array('INFO', _L("The system can't check if critical directories (%1) are readable via web-browser. Please verify it manually.", 'userdata, res, dev, includes, setup/includes'));
219
                                $notifications[] = array('INFO', _L("The system can't check if critical directories (%1) are readable via web-browser. Please verify it manually.", 'userdata, res, dev, includes, setup/includes'));