File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 55
66 class ClientRegistration {
77 public static function getRegistration ($ clientId ) {
8+ if (preg_match ("/^http(s)?:/ " , $ clientId )) {
9+ return self ::getRemoteRegistration ($ clientId );
10+ }
11+
812 Db::connect ();
913 $ query = Db::$ pdo ->prepare (
1014 'SELECT clientData FROM clients WHERE clientId=:clientId '
@@ -18,7 +22,13 @@ public static function getRegistration($clientId) {
1822 }
1923 return false ;
2024 }
21-
25+
26+ public static function getRemoteRegistration ($ url ) {
27+ $ clientDocument = file_get_contents ($ url );
28+ $ clientRegistration = json_decode ($ clientDocument , true );
29+ return $ clientRegistration ;
30+ }
31+
2232 public static function saveClientRegistration ($ clientData ) {
2333 Db::connect ();
2434 if (!isset ($ clientData ['client_name ' ])) {
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public static function respondToAuthorize() {
6868 $ approval = true ;
6969 } else {
7070 $ clientRegistration = ClientRegistration::getRegistration ($ clientId );
71- if (in_array ($ clientRegistration ['origin ' ], TRUSTED_APPS )) {
71+ if (isset ( $ clientRegistration [ ' origin ' ]) && in_array ($ clientRegistration ['origin ' ], TRUSTED_APPS )) {
7272 $ approval = true ;
7373 }
7474 }
You can’t perform that action at this time.
0 commit comments