Commit d532b4f2 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Link.php: wrong detection of missing parameter for download button.

parent f2f58358
Pipeline #683 passed with stage
in 1 minute and 38 seconds
...@@ -237,6 +237,7 @@ class Link { ...@@ -237,6 +237,7 @@ class Link {
TOKEN_MAIL => LINK_ANCHOR, TOKEN_MAIL => LINK_ANCHOR,
TOKEN_PAGE => LINK_ANCHOR, TOKEN_PAGE => LINK_ANCHOR,
TOKEN_DOWNLOAD => LINK_ANCHOR, TOKEN_DOWNLOAD => LINK_ANCHOR,
TOKEN_FILE => NAME_FILE,
TOKEN_COPY_TO_CLIPBOARD => LINK_ANCHOR, TOKEN_COPY_TO_CLIPBOARD => LINK_ANCHOR,
TOKEN_PICTURE => LINK_PICTURE, TOKEN_PICTURE => LINK_PICTURE,
...@@ -701,6 +702,7 @@ class Link { ...@@ -701,6 +702,7 @@ class Link {
private function checkParam(array $tokenGiven, array $vars) { private function checkParam(array $tokenGiven, array $vars) {
$countLinkAnchor = 0; $countLinkAnchor = 0;
$countLinkPicture = 0; $countLinkPicture = 0;
$countSources = 0;
foreach ($tokenGiven as $token => $value) { foreach ($tokenGiven as $token => $value) {
if (isset($this->tokenMapping[$token])) { if (isset($this->tokenMapping[$token])) {
...@@ -711,6 +713,11 @@ class Link { ...@@ -711,6 +713,11 @@ class Link {
case LINK_PICTURE: case LINK_PICTURE:
$countLinkPicture++; $countLinkPicture++;
break; break;
case NAME_FILE:
case NAME_URL:
case NAME_PAGE:
$countSources++;
break;
default: default:
break; break;
} }
...@@ -729,7 +736,7 @@ class Link { ...@@ -729,7 +736,7 @@ class Link {
throw new UserReportException ("Token Mail and Target at the same time not possible'" . TOKEN_PAGE . "'", ERROR_MULTIPLE_DEFINITION); throw new UserReportException ("Token Mail and Target at the same time not possible'" . TOKEN_PAGE . "'", ERROR_MULTIPLE_DEFINITION);
} }
if (isset($tokenGiven[TOKEN_DOWNLOAD]) && count($vars[NAME_COLLECT_ELEMENTS]) == 0) { if (isset($tokenGiven[TOKEN_DOWNLOAD]) && count($vars[NAME_COLLECT_ELEMENTS]) == 0 && $countSources == 0) {
throw new UserReportException ("Missing element sources for download", ERROR_MISSING_REQUIRED_PARAMETER); throw new UserReportException ("Missing element sources for download", ERROR_MISSING_REQUIRED_PARAMETER);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment