Subversion Repositories oidplus

Rev

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

Rev 1099 Rev 1116
Line 23... Line 23...
23
\defined('INSIDE_OIDPLUS') or die;
23
\defined('INSIDE_OIDPLUS') or die;
24
// phpcs:enable PSR1.Files.SideEffects
24
// phpcs:enable PSR1.Files.SideEffects
25
 
25
 
26
class OIDplusPageAdminPlugins extends OIDplusPagePluginAdmin {
26
class OIDplusPageAdminPlugins extends OIDplusPagePluginAdmin {
27
 
27
 
-
 
28
        /**
-
 
29
         * @param bool $html
-
 
30
         * @return void
-
 
31
         */
28
        public function init($html=true) {
32
        public function init(bool $html=true) {
29
        }
33
        }
30
 
34
 
-
 
35
        /**
-
 
36
         * @param $out
-
 
37
         * @return void
-
 
38
         */
31
        private function pluginTableHead(&$out) {
39
        private function pluginTableHead(&$out) {
32
                $out['text'] .= '       <tr>';
40
                $out['text'] .= '       <tr>';
33
                $out['text'] .= '               <th width="30%">'._L('Class name').'</th>';
41
                $out['text'] .= '               <th width="30%">'._L('Class name').'</th>';
34
                $out['text'] .= '               <th width="30%">'._L('Plugin name').'</th>';
42
                $out['text'] .= '               <th width="30%">'._L('Plugin name').'</th>';
35
                $out['text'] .= '               <th width="10%">'._L('Version').'</th>';
43
                $out['text'] .= '               <th width="10%">'._L('Version').'</th>';
36
                $out['text'] .= '               <th width="15%">'._L('Author').'</th>';
44
                $out['text'] .= '               <th width="15%">'._L('Author').'</th>';
37
                $out['text'] .= '               <th width="15%">'._L('License').'</th>';
45
                $out['text'] .= '               <th width="15%">'._L('License').'</th>';
38
                $out['text'] .= '       </tr>';
46
                $out['text'] .= '       </tr>';
39
        }
47
        }
40
 
48
 
-
 
49
        /**
-
 
50
         * @param $out
-
 
51
         * @param $plugin
-
 
52
         * @param $modifier
-
 
53
         * @param $na_reason
-
 
54
         * @return void
-
 
55
         */
41
        private function pluginTableLine(&$out, $plugin, $modifier=0, $na_reason='') {
56
        private function pluginTableLine(&$out, $plugin, $modifier=0, $na_reason='') {
42
                $html_reason = empty($na_reason) ? '' : ' ('.htmlentities($na_reason).')';
57
                $html_reason = empty($na_reason) ? '' : ' ('.htmlentities($na_reason).')';
43
                $out['text'] .= '       <tr>';
58
                $out['text'] .= '       <tr>';
44
                if ($modifier == 0) {
59
                if ($modifier == 0) {
45
                        // normal line
60
                        // normal line
Line 56... Line 71...
56
                $out['text'] .= '               <td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>';
71
                $out['text'] .= '               <td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>';
57
                $out['text'] .= '               <td>' . htmlentities(empty($plugin->getManifest()->getLicense()) ? _L('n/a') : $plugin->getManifest()->getLicense()) . '</td>';
72
                $out['text'] .= '               <td>' . htmlentities(empty($plugin->getManifest()->getLicense()) ? _L('n/a') : $plugin->getManifest()->getLicense()) . '</td>';
58
                $out['text'] .= '       </tr>';
73
                $out['text'] .= '       </tr>';
59
        }
74
        }
60
 
75
 
-
 
76
        /**
-
 
77
         * @param string $id
-
 
78
         * @param array $out
-
 
79
         * @param bool $handled
-
 
80
         * @return void
-
 
81
         * @throws OIDplusConfigInitializationException
-
 
82
         * @throws OIDplusException
-
 
83
         */
61
        public function gui($id, &$out, &$handled) {
84
        public function gui(string $id, array &$out, bool &$handled) {
62
                $tmp = explode('$',$id);
85
                $tmp = explode('$',$id);
63
                $classname = isset($tmp[1]) ? $tmp[1] : null;
86
                $classname = isset($tmp[1]) ? $tmp[1] : null;
64
 
87
 
65
                $parts = explode('.',$tmp[0],2);
88
                $parts = explode('.',$tmp[0],2);
66
                if (!isset($parts[1])) $parts[1] = '';
89
                if (!isset($parts[1])) $parts[1] = '';
Line 389... Line 412...
389
                                                $reason_verify = '';
412
                                                $reason_verify = '';
390
                                                $can_verify = $plugin->availableForHash($reason_verify);
413
                                                $can_verify = $plugin->availableForHash($reason_verify);
391
 
414
 
392
                                                if ($can_hash && !$can_verify) {
415
                                                if ($can_hash && !$can_verify) {
393
                                                        $note = _L('Only hashing, no verification');
416
                                                        $note = _L('Only hashing, no verification');
394
                                                        if (!empty($reason_verify)) $note .= '. '.$reason_verify; /* @phpstan-ignore-line */
417
                                                        if (!empty($reason_verify)) $note .= '. '.$reason_verify;
395
                                                        $modifier = $default ? 1 : 0;
418
                                                        $modifier = $default ? 1 : 0;
396
                                                }
419
                                                }
397
                                                else if (!$can_hash && $can_verify) {
420
                                                else if (!$can_hash && $can_verify) {
398
                                                        $note = _L('Only verification, no hashing');
421
                                                        $note = _L('Only verification, no hashing');
399
                                                        if (!empty($reason_hash)) $note .= '. '.$reason_hash; /* @phpstan-ignore-line */
422
                                                        if (!empty($reason_hash)) $note .= '. '.$reason_hash;
400
                                                        $modifier = $default ? 1 : 0;
423
                                                        $modifier = $default ? 1 : 0;
401
                                                }
424
                                                }
402
                                                else if (!$can_hash && !$can_verify) {
425
                                                else if (!$can_hash && !$can_verify) {
403
                                                        $note = _L('Not available on this system');
426
                                                        $note = _L('Not available on this system');
404
                                                        $app1 = '';
427
                                                        $app1 = '';
405
                                                        $app2 = '';
428
                                                        $app2 = '';
406
                                                        if (!empty($reason_verify)) $app1 = $reason_verify; /* @phpstan-ignore-line */
429
                                                        if (!empty($reason_verify)) $app1 = $reason_verify;
407
                                                        if (!empty($reason_hash)) $app2 = $reason_hash; /* @phpstan-ignore-line */
430
                                                        if (!empty($reason_hash)) $app2 = $reason_hash;
408
                                                        if ($app1 != $app2) {
431
                                                        if ($app1 != $app2) {
409
                                                                $note .= '. '.$app1.'. '.$app2;
432
                                                                $note .= '. '.$app1.'. '.$app2;
410
                                                        } else {
433
                                                        } else {
411
                                                                $note .= '. '.$app1;
434
                                                                $note .= '. '.$app1;
412
                                                        }
435
                                                        }
Line 495... Line 518...
495
                                }
518
                                }
496
                        }
519
                        }
497
                }
520
                }
498
        }
521
        }
499
 
522
 
-
 
523
        /**
-
 
524
         * @param array $json
-
 
525
         * @param string|null $ra_email
-
 
526
         * @param bool $nonjs
-
 
527
         * @param string $req_goto
-
 
528
         * @return bool
-
 
529
         * @throws OIDplusConfigInitializationException
-
 
530
         * @throws OIDplusException
-
 
531
         */
500
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
532
        public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool {
501
                if (!OIDplus::authUtils()->isAdminLoggedIn()) return false;
533
                if (!OIDplus::authUtils()->isAdminLoggedIn()) return false;
502
 
534
 
503
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
535
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
504
                        $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
536
                        $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
505
                } else {
537
                } else {
Line 782... Line 814...
782
                );
814
                );
783
 
815
 
784
                return true;
816
                return true;
785
        }
817
        }
786
 
818
 
-
 
819
        /**
-
 
820
         * @param string $request
-
 
821
         * @return array|false
-
 
822
         */
787
        public function tree_search($request) {
823
        public function tree_search(string $request) {
788
                // Not required, because all sub-nodes are loaded at the same time; no lazy-loading
824
                // Not required, because all sub-nodes are loaded at the same time; no lazy-loading
789
                return false;
825
                return false;
790
        }
826
        }
791
}
827
}