Skip to content

Commit 500de81

Browse files
authored
Merge branch 'master' into feature/v10
2 parents 1a1def2 + 9a90806 commit 500de81

37 files changed

+797
-667
lines changed

Classes/OpenidService.php

+19-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
use Psr\Log\LoggerAwareInterface;
1818
use Psr\Log\LoggerAwareTrait;
19-
use TYPO3\CMS\Core\Core\Environment;
2019
use TYPO3\CMS\Core\Crypto\Random;
2120
use TYPO3\CMS\Core\Database\Connection;
2221
use TYPO3\CMS\Core\Database\ConnectionPool;
@@ -34,7 +33,7 @@
3433
/**
3534
* Service "OpenID Authentication" for the "openid" extension.
3635
*/
37-
class OpenidService extends AbstractService implements SingletonInterface, LoggerAwareInterface
36+
class OpenidService extends AbstractService implements LoggerAwareInterface, SingletonInterface
3837
{
3938
use LoggerAwareTrait;
4039

@@ -92,6 +91,7 @@ class OpenidService extends AbstractService implements SingletonInterface, Logge
9291
*/
9392
public function init()
9493
{
94+
// this line needs to stay for TYPO3 v8 compatibility
9595
$this->setLogger(GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__));
9696

9797
$available = false;
@@ -252,7 +252,12 @@ protected function includePHPOpenIDLibrary()
252252
// Make sure that random generator is properly set up. Constant could be
253253
// defined by the previous inclusion of the file
254254
if (!defined('Auth_OpenID_RAND_SOURCE')) {
255-
if (Environment::isWindows()) {
255+
if (class_exists(\TYPO3\CMS\Core\Core\Environment::class)) {
256+
$isWindows = \TYPO3\CMS\Core\Core\Environment::isWindows();
257+
} else {
258+
$isWindows = defined('TYPO3_OS' ) && TYPO3_OS === 'WIN';
259+
}
260+
if ($isWindows) {
256261
// No random generator on Windows!
257262
define('Auth_OpenID_RAND_SOURCE', null);
258263
} elseif (!is_readable('/dev/urandom')) {
@@ -583,7 +588,6 @@ protected function getSignedParameter($parameterName)
583588
* @param string $message Message to output
584589
* @return void
585590
* @see GeneralUtility::sysLog()
586-
* @see \TYPO3\CMS\Core\TimeTracker\TimeTracker::setTSlogMessage()
587591
*/
588592
protected function writeLog($message)
589593
{
@@ -594,5 +598,16 @@ protected function writeLog($message)
594598
}
595599

596600
$this->logger->notice($message);
601+
602+
if (version_compare(TYPO3_branch, '8.7', '>')) {
603+
return;
604+
}
605+
606+
if (defined('TYPO3_MODE') && TYPO3_MODE === 'BE') {
607+
GeneralUtility::sysLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_NOTICE);
608+
}
609+
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG'])) {
610+
GeneralUtility::devLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_NOTICE);
611+
}
597612
}
598613
}

composer.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,17 @@
99
{
1010
"name": "Dmitry Dulepov",
1111
"email": "[email protected]",
12-
"role": "Developer"
13-
},
14-
{
15-
"name": "Markus Klein",
16-
"email": "[email protected]",
1712
"role": "Maintainer"
1813
}
1914
],
2015
"require": {
2116
"ext-gmp": "*",
2217
"ext-curl": "*",
2318
"ext-dom": "*",
24-
"typo3/cms-core": ">=10.0.0,<=10.999.999",
25-
"typo3/cms-setup": ">=10.0.0,<=10.999.999"
19+
"typo3/cms-core": "^8.7.19 || ^9.5 || ^10.0",
20+
"typo3/cms-setup": "*"
2621
},
2722
"replace": {
28-
"openid": "self.version",
2923
"typo3/cms-openid": "self.version",
3024
"typo3-ter/openid": "self.version"
3125
},

ext_emconf.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
'version' => '10.0.0',
1212
'constraints' => [
1313
'depends' => [
14-
'typo3' => '10.0.0-10.999.999',
15-
'setup' => '10.0.0-10.999.999',
14+
'typo3' => '8.7.19-10.999.999',
15+
'setup' => '8.7.19-10.999.999',
1616
],
1717
'conflicts' => [
1818
'naw_openid' => '',

lib/php-openid/Auth/OpenID.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static function isFailure($thing)
148148
*/
149149
static function getQuery($query_str=null)
150150
{
151-
$data = array();
151+
$data = [];
152152

153153
if ($query_str !== null) {
154154
$data = Auth_OpenID::params_from_string($query_str);
@@ -170,7 +170,7 @@ static function getQuery($query_str=null)
170170
$str = file_get_contents('php://input');
171171

172172
if ($str === false) {
173-
$post = array();
173+
$post = [];
174174
} else {
175175
$post = Auth_OpenID::params_from_string($str);
176176
}
@@ -186,7 +186,7 @@ static function params_from_string($str)
186186
{
187187
$chunks = explode("&", $str);
188188

189-
$data = array();
189+
$data = [];
190190
foreach ($chunks as $chunk) {
191191
$parts = explode("=", $chunk, 2);
192192

@@ -237,7 +237,7 @@ static function ensureDir($dir_name)
237237
*/
238238
static function addPrefix($values, $prefix)
239239
{
240-
$new_values = array();
240+
$new_values = [];
241241
foreach ($values as $s) {
242242
$new_values[] = $prefix . $s;
243243
}
@@ -286,7 +286,7 @@ static function parse_str($query)
286286

287287
$parts = explode('&', $query);
288288

289-
$new_parts = array();
289+
$new_parts = [];
290290
for ($i = 0; $i < count($parts); $i++) {
291291
$pair = explode('=', $parts[$i]);
292292

@@ -314,7 +314,7 @@ static function parse_str($query)
314314
*/
315315
static function httpBuildQuery($data)
316316
{
317-
$pairs = array();
317+
$pairs = [];
318318
foreach ($data as $key => $value) {
319319
if (is_array($value)) {
320320
$pairs[] = urlencode($value[0])."=".urlencode($value[1]);
@@ -354,9 +354,9 @@ static function appendArgs($url, $args)
354354
} else {
355355
$keys = array_keys($args);
356356
sort($keys);
357-
$new_args = array();
357+
$new_args = [];
358358
foreach ($keys as $key) {
359-
$new_args[] = array($key, $args[$key]);
359+
$new_args[] = [$key, $args[$key]];
360360
}
361361
$args = $new_args;
362362
}
@@ -440,7 +440,7 @@ static function normalizeUrl($url)
440440
if (isset($parsed['scheme']) &&
441441
isset($parsed['host'])) {
442442
$scheme = strtolower($parsed['scheme']);
443-
if (!in_array($scheme, array('http', 'https'))) {
443+
if (!in_array($scheme, ['http', 'https'])) {
444444
return null;
445445
}
446446
} else {
@@ -497,10 +497,10 @@ static function toBytes($str)
497497
$hex = bin2hex($str);
498498

499499
if (!$hex) {
500-
return array();
500+
return [];
501501
}
502502

503-
$b = array();
503+
$b = [];
504504
for ($i = 0; $i < strlen($hex); $i += 2) {
505505
$b[] = chr(base_convert(substr($hex, $i, 2), 16, 10));
506506
}
@@ -513,18 +513,18 @@ static function urldefrag($url)
513513
$parts = explode("#", $url, 2);
514514

515515
if (count($parts) == 1) {
516-
return array($parts[0], "");
516+
return [$parts[0], ""];
517517
} else {
518518
return $parts;
519519
}
520520
}
521521

522522
static function filter($callback, &$sequence)
523523
{
524-
$result = array();
524+
$result = [];
525525

526526
foreach ($sequence as $item) {
527-
if (call_user_func_array($callback, array($item))) {
527+
if (call_user_func_array($callback, [$item])) {
528528
$result[] = $item;
529529
}
530530
}

lib/php-openid/Auth/OpenID/AX.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function _checkMode($ax_args)
130130
*/
131131
function _newArgs()
132132
{
133-
return array('mode' => $this->mode);
133+
return ['mode' => $this->mode];
134134
}
135135
}
136136

@@ -248,7 +248,7 @@ function wantsUnlimitedValues()
248248
*/
249249
function Auth_OpenID_AX_toTypeURIs($namespace_map, $alias_list_s)
250250
{
251-
$uris = array();
251+
$uris = [];
252252

253253
if ($alias_list_s) {
254254
foreach (explode(',', $alias_list_s) as $alias) {
@@ -295,7 +295,7 @@ class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
295295
*
296296
* @var array
297297
*/
298-
private $requested_attributes = array();
298+
private $requested_attributes = [];
299299

300300
function __construct($update_url=null)
301301
{
@@ -331,8 +331,8 @@ function getExtensionArgs($request = null)
331331
{
332332
$aliases = new Auth_OpenID_NamespaceMap();
333333

334-
$required = array();
335-
$if_available = array();
334+
$required = [];
335+
$if_available = [];
336336

337337
$ax_args = $this->_newArgs();
338338

@@ -383,7 +383,7 @@ function getExtensionArgs($request = null)
383383
*/
384384
function getRequiredAttrs()
385385
{
386-
$required = array();
386+
$required = [];
387387
foreach ($this->requested_attributes as $type_uri => $attribute) {
388388
if ($attribute->required) {
389389
$required[] = $type_uri;
@@ -559,7 +559,7 @@ function contains($type_uri)
559559
class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
560560

561561
/** @var array */
562-
protected $data = array();
562+
protected $data = [];
563563

564564
/**
565565
* Add a single value for the given attribute type to the
@@ -574,7 +574,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
574574
function addValue($type_uri, $value)
575575
{
576576
if (!array_key_exists($type_uri, $this->data)) {
577-
$this->data[$type_uri] = array();
577+
$this->data[$type_uri] = [];
578578
}
579579

580580
$values =& $this->data[$type_uri];
@@ -609,7 +609,7 @@ function _getExtensionKpublicgs($aliases)
609609
$aliases = new Auth_OpenID_NamespaceMap();
610610
}
611611

612-
$ax_args = array();
612+
$ax_args = [];
613613

614614
foreach ($this->data as $type_uri => $values) {
615615
$alias = $aliases->add($type_uri);
@@ -683,7 +683,7 @@ function parseExtensionArgs($ax_args)
683683
);
684684
}
685685

686-
$values = array();
686+
$values = [];
687687
for ($i = 1; $i < $count + 1; $i++) {
688688
$value_key = sprintf('value.%s.%d', $alias, $i);
689689

@@ -710,9 +710,9 @@ function parseExtensionArgs($ax_args)
710710
$value = $ax_args['value.' . $alias];
711711

712712
if ($value == '') {
713-
$values = array();
713+
$values = [];
714714
} else {
715-
$values = array($value);
715+
$values = [$value];
716716
}
717717
}
718718

@@ -828,7 +828,7 @@ function getExtensionArgs($request=null)
828828
{
829829
$aliases = new Auth_OpenID_NamespaceMap();
830830

831-
$zero_value_types = array();
831+
$zero_value_types = [];
832832

833833
if ($request !== null) {
834834
// Validate the data in the context of the request (the
@@ -865,7 +865,7 @@ function getExtensionArgs($request=null)
865865
if (array_key_exists($attr_info->type_uri, $this->data)) {
866866
$values = $this->data[$attr_info->type_uri];
867867
} else {
868-
$values = array();
868+
$values = [];
869869
$zero_value_types[] = $attr_info;
870870
}
871871

0 commit comments

Comments
 (0)