Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
bf238262
Commit
bf238262
authored
Feb 27, 2018
by
Carsten Rose
Browse files
Bug: adding Parameter '__dbIndex=X' broken under special situations.
parent
c04152e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/AbstractBuildForm.php
View file @
bf238262
...
...
@@ -214,6 +214,9 @@ abstract class AbstractBuildForm {
}
}
else
{
$recordId
=
$this
->
store
->
getVar
(
SIP_RECORD_ID
,
STORE_SIP
);
if
(
!
(
$recordId
==
''
||
is_numeric
(
$recordId
)))
{
throw
new
UserFormException
(
'Invalid record ID: r="'
.
$recordId
,
'"'
,
ERROR_INVALID_VALUE
);
}
$htmlElements
=
$this
->
elements
(
$recordId
,
$filter
,
0
,
$json
,
$modeCollectFe
,
$htmlElementNameIdZero
,
$storeUse
,
$mode
);
if
(
$mode
===
FORM_SAVE
&&
$recordId
!=
0
)
{
...
...
extension/qfq/qfq/helper/Support.php
View file @
bf238262
...
...
@@ -651,16 +651,21 @@ class Support {
* Concatenate URL and Parameter. Depending of if there is a '?' in URL or not, append the param with '?' or '&'..
*
* @param string $url
* @param string $param
* @param string
|array
$param
*
* @return string
*/
public
static
function
concatUrlParam
(
$url
,
$param
)
{
if
(
is_array
(
$param
))
{
$param
=
implode
(
'&'
,
$param
);
}
if
(
$param
==
''
)
{
return
$url
;
}
$token
=
(
strpos
(
$url
,
'?'
)
===
false
)
?
'?'
:
'&'
;
$token
=
(
(
strpos
(
$url
,
'?'
)
===
false
)
&&
(
strpos
(
$url
,
'&'
))
===
false
)
?
'?'
:
'&'
;
return
$url
.
$token
.
$param
;
}
...
...
extension/qfq/qfq/report/Link.php
View file @
bf238262
...
...
@@ -795,9 +795,11 @@ class Link {
if
(
$vars
[
NAME_URL_PARAM
]
!=
''
)
{
$vars
[
NAME_URL_PARAM
]
.
=
'&'
;
}
$vars
[
NAME_URL_PARAM
]
.
=
PARAM_DB_INDEX_DATA
.
'='
.
$this
->
dbIndexData
;
}
// Normalize '?pagealias' to 'index.php?pagealias'
if
(
substr
(
$vars
[
NAME_URL
],
0
,
1
)
===
'?'
)
{
$vars
[
NAME_URL
]
=
INDEX_PHP
.
$vars
[
NAME_URL
];
}
...
...
extension/qfq/tests/phpunit/SupportTest.php
View file @
bf238262
...
...
@@ -362,23 +362,56 @@ class SupportTest extends \PHPUnit_Framework_TestCase {
$url
=
Support
::
concatUrlParam
(
''
,
''
);
$this
->
assertEquals
(
''
,
$url
);
$url
=
Support
::
concatUrlParam
(
''
,
[]);
$this
->
assertEquals
(
''
,
$url
);
$url
=
Support
::
concatUrlParam
(
''
,
[
''
]);
$this
->
assertEquals
(
''
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
''
);
$this
->
assertEquals
(
'http://example.com'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
[]);
$this
->
assertEquals
(
'http://example.com'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
[
''
]);
$this
->
assertEquals
(
'http://example.com'
,
$url
);
$url
=
Support
::
concatUrlParam
(
''
,
'a=1'
);
$this
->
assertEquals
(
'?a=1'
,
$url
);
$url
=
Support
::
concatUrlParam
(
''
,
[
'a=1'
]);
$this
->
assertEquals
(
'?a=1'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
'a=100'
);
$this
->
assertEquals
(
'http://example.com?a=100'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
[
'a=100'
]);
$this
->
assertEquals
(
'http://example.com?a=100'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com?id=2'
,
'a=100'
);
$this
->
assertEquals
(
'http://example.com?id=2&a=100'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com?id=2'
,
[
'a=100'
]);
$this
->
assertEquals
(
'http://example.com?id=2&a=100'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
'a=100&b=201'
);
$this
->
assertEquals
(
'http://example.com?a=100&b=201'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
[
'a=100&b=201'
]);
$this
->
assertEquals
(
'http://example.com?a=100&b=201'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com'
,
[
'a=100'
,
'b=201'
]);
$this
->
assertEquals
(
'http://example.com?a=100&b=201'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com?id=34'
,
'a=100&b=201'
);
$this
->
assertEquals
(
'http://example.com?id=34&a=100&b=201'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com?id=34'
,
[
'a=100&b=201'
]);
$this
->
assertEquals
(
'http://example.com?id=34&a=100&b=201'
,
$url
);
$url
=
Support
::
concatUrlParam
(
'http://example.com?id=34'
,
[
'a=100'
,
'b=201'
]);
$this
->
assertEquals
(
'http://example.com?id=34&a=100&b=201'
,
$url
);
}
public
function
testSetIfNotSet
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment