diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index ea661c7a9a28f64f543335f576c5ea447ed58212..b656f350f28aaacba7ce6ecba13195732dc9b2c0 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -849,10 +849,13 @@ abstract class BaseFacebook $params['api_key'] = $this->getAppId(); $params['format'] = 'json-strings'; - $result = json_decode($this->_oauthRequest( - $this->getApiUrl($params['method']), - $params - ), true); + $result = json_decode( + $this->_oauthRequest( + $this->getApiUrl($params['method']), + $params + ), + true + ); // results are returned, errors are thrown if (is_array($result) && isset($result['error_code'])) { @@ -910,10 +913,13 @@ abstract class BaseFacebook $domainKey = 'graph'; } - $result = json_decode($this->_oauthRequest( - $this->getUrl($domainKey, $path), - $params - ), true); + $result = json_decode( + $this->_oauthRequest( + $this->getUrl($domainKey, $path), + $params + ), + true + ); // results are returned, errors are thrown if (is_array($result) && isset($result['error'])) { diff --git a/modules/core/lib/Auth/Process/PHP.php b/modules/core/lib/Auth/Process/PHP.php index 5f6168522bf062b696b91f6246952540e6f89b03..cd424c76e9a01e1b4705eb217014eab2c9ec5ed1 100644 --- a/modules/core/lib/Auth/Process/PHP.php +++ b/modules/core/lib/Auth/Process/PHP.php @@ -49,7 +49,10 @@ class PHP extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($request)); assert(array_key_exists('Attributes', $request)); - $function = function (/** @scrutinizer ignore-unused */ &$attributes, /** @scrutinizer ignore-unused */ &$state) { + $function = function ( + /** @scrutinizer ignore-unused */ &$attributes, + /** @scrutinizer ignore-unused */ &$state + ) { eval($this->code); }; $function($request['Attributes'], $request); diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 1d00be38e7873e5702d2331965dad4fb20bb1b28..267a54a53ff1c0911924375e53cf60a6562d656f 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -121,7 +121,7 @@ foreach ($metaentries['hosted'] as $index => $entity) { $metaentries['hosted'][$index][$new] = $entity[$old][$defaultLanguage]; } elseif (isset($entity[$old][$fallbackLanguage])) { $metaentries['hosted'][$index][$new] = $entity[$old][$fallbackLanguage]; - } + } } } foreach ($metaentries['remote'] as $key => $set) { diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php index 0ff3b5105fed72f94ca1d3d13fa210d488ed73c0..0939be6f410ce90c587c388c7ffa15e7cbc89c12 100644 --- a/modules/oauth/lib/Registry.php +++ b/modules/oauth/lib/Registry.php @@ -11,6 +11,17 @@ namespace SimpleSAML\Module\oauth; class Registry { + public static function requireOwnership($entry, $userid) + { + if (!isset($entry['owner'])) { + throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); + } elseif ($entry['owner'] !== $userid) { + throw new \Exception( + 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' + ); + } + } + protected function getStandardField($request, &$entry, $key) { if (array_key_exists('field_'.$key, $request)) { diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index c9a50b2f32f5fd4f683f122910f89a6b9e9779eb..a367c482050addb0af428e566bcdc40a6b1564bc 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -22,22 +22,10 @@ if ($session->isValid($authsource)) { $as->initLogin(\SimpleSAML\Utils\HTTP::getSelfURL()); } -function requireOwnership($entry, $userid) -{ - if (!isset($entry['owner'])) { - throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); - } - if ($entry['owner'] !== $userid) { - throw new \Exception( - 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' - ); - } -} - if (array_key_exists('editkey', $_REQUEST)) { $entryc = $store->get('consumers', $_REQUEST['editkey'], ''); $entry = $entryc['value']; - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); } else { $entry = [ 'owner' => $userid, @@ -53,7 +41,7 @@ if (isset($_POST['submit'])) { $entry = $editor->formToMeta($_POST, [], ['owner' => $userid]); - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); $store->set('consumers', $entry['key'], '', $entry); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 3f3403bf1193b9400332adf41b511f18b1b89642..4431835a63786095977605465fdb10254b097940 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -21,23 +21,11 @@ if ($session->isValid($authsource)) { $as->initLogin(\SimpleSAML\Utils\HTTP::getSelfURL()); } -function requireOwnership($entry, $userid) -{ - if (!isset($entry['owner'])) { - throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); - } - if ($entry['owner'] !== $userid) { - throw new \Exception( - 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' - ); - } -} - if (isset($_REQUEST['delete'])) { $entryc = $store->get('consumers', $_REQUEST['delete'], ''); $entry = $entryc['value']; - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); $store->remove('consumers', $entry['key'], ''); }