Rev 1086 | Rev 1130 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1086 | 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 OIDplusPagePublicLoginFacebook extends OIDplusPagePluginPublic { |
26 | class OIDplusPagePublicLoginFacebook extends OIDplusPagePluginPublic { |
27 | 27 | ||
- | 28 | /** |
|
- | 29 | * @param string $actionID |
|
- | 30 | * @param array $params |
|
- | 31 | * @return array |
|
- | 32 | * @throws OIDplusException |
|
- | 33 | */ |
|
28 | public function action($actionID, $params) { |
34 | public function action(string $actionID, array $params): array { |
29 | throw new OIDplusException(_L('Unknown action ID')); |
35 | return parent::action($actionID, $params); |
30 | } |
36 | } |
31 | 37 | ||
- | 38 | /** |
|
- | 39 | * @param bool $html |
|
- | 40 | * @return void |
|
- | 41 | */ |
|
32 | public function init($html=true) { |
42 | public function init(bool $html=true) { |
33 | // Nothing |
43 | // Nothing |
34 | } |
44 | } |
35 | 45 | ||
- | 46 | /** |
|
- | 47 | * @param string $id |
|
- | 48 | * @param array $out |
|
- | 49 | * @param bool $handled |
|
- | 50 | * @return void |
|
- | 51 | * @throws OIDplusException |
|
- | 52 | */ |
|
36 | public function gui($id, &$out, &$handled) { |
53 | public function gui(string $id, array &$out, bool &$handled) { |
37 | if ($id === 'oidplus:login_facebook') { |
54 | if ($id === 'oidplus:login_facebook') { |
38 | $handled = true; |
55 | $handled = true; |
39 | $out['title'] = _L('Login using Facebook'); |
56 | $out['title'] = _L('Login using Facebook'); |
40 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
57 | $out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
41 | 58 | ||
Line 53... | Line 70... | ||
53 | "scope=email"; |
70 | "scope=email"; |
54 | $out['text'] = '<p>'._L('Please wait...').'</p><script>window.location.href = '.js_escape($target).';</script>'; |
71 | $out['text'] = '<p>'._L('Please wait...').'</p><script>window.location.href = '.js_escape($target).';</script>'; |
55 | } |
72 | } |
56 | } |
73 | } |
57 | 74 | ||
- | 75 | /** |
|
- | 76 | * @param array $out |
|
- | 77 | * @return void |
|
- | 78 | */ |
|
58 | public function publicSitemap(&$out) { |
79 | public function publicSitemap(array &$out) { |
59 | $out[] = 'oidplus:login_facebook'; |
80 | $out[] = 'oidplus:login_facebook'; |
60 | } |
81 | } |
61 | 82 | ||
- | 83 | /** |
|
- | 84 | * @param array $json |
|
- | 85 | * @param string|null $ra_email |
|
- | 86 | * @param bool $nonjs |
|
- | 87 | * @param string $req_goto |
|
- | 88 | * @return bool |
|
- | 89 | */ |
|
62 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
90 | public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool { |
63 | return true; |
91 | return true; |
64 | } |
92 | } |
65 | 93 | ||
- | 94 | /** |
|
- | 95 | * @param string $request |
|
- | 96 | * @return array|false |
|
- | 97 | */ |
|
66 | public function tree_search($request) { |
98 | public function tree_search(string $request) { |
67 | return false; |
99 | return false; |
68 | } |
100 | } |
69 | 101 | ||
- | 102 | /** |
|
- | 103 | * @param string $id |
|
- | 104 | * @return bool |
|
- | 105 | */ |
|
70 | public function implementsFeature($id) { |
106 | public function implementsFeature(string $id): bool { |
71 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.5') return true; // alternativeLoginMethods() |
107 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.5') return true; // alternativeLoginMethods() |
72 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.8') return true; // getNotifications() |
108 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.8') return true; // getNotifications() |
73 | return false; |
109 | return false; |
74 | } |
110 | } |
75 | 111 | ||
- | 112 | /** |
|
- | 113 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.5 |
|
- | 114 | * @return array |
|
- | 115 | * @throws OIDplusException |
|
- | 116 | */ |
|
76 | public function alternativeLoginMethods() { |
117 | public function alternativeLoginMethods() { |
77 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.5 |
- | |
78 | $logins = array(); |
118 | $logins = array(); |
79 | if (OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_ENABLED', false)) { |
119 | if (OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_ENABLED', false)) { |
80 | $logins[] = array( |
120 | $logins[] = array( |
81 | 'oidplus:login_facebook', |
121 | 'oidplus:login_facebook', |
82 | _L('Login using Facebook'), |
122 | _L('Login using Facebook'), |
Line 84... | Line 124... | ||
84 | ); |
124 | ); |
85 | } |
125 | } |
86 | return $logins; |
126 | return $logins; |
87 | } |
127 | } |
88 | 128 | ||
- | 129 | /** |
|
- | 130 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.8 |
|
- | 131 | * @param $user |
|
- | 132 | * @return array |
|
- | 133 | * @throws OIDplusException |
|
- | 134 | */ |
|
89 | public function getNotifications($user=null): array { |
135 | public function getNotifications($user=null): array { |
90 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.8 |
- | |
91 | $notifications = array(); |
136 | $notifications = array(); |
92 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
137 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
93 | if (OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_ENABLED', false)) { |
138 | if (OIDplus::baseConfig()->getValue('FACEBOOK_OAUTH2_ENABLED', false)) { |
94 | if (!function_exists('curl_init')) { |
139 | if (!function_exists('curl_init')) { |
95 | $title = _L('Facebook OAuth Login'); |
140 | $title = _L('Facebook OAuth Login'); |