Commit 638a542a authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge remote-tracking branch 'origin/master'

parents 072c1960 d2c38305
Pipeline #1003 passed with stage
in 1 minute and 38 seconds
......@@ -3524,10 +3524,13 @@ See also `downloadButton`_ to offer a download of an uploaded file.
* Excel Import: QFQ offers functionality to directly import excel data into the database. This functionality can
optionally be combined with saving the file by using the above parameters like `fileDestination`.
The data is imported without formatting. Please note that this means Excel dates will be imported as a number
(e.g. 43214), which is the serial value date in Excel. To convert such a number to a MariaDb date, use:
`DATE_ADD('1899-12-30', INTERVAL serialValue DAY)`.
* *importToTable*: <mariadb.tablename> - **Required**. Providing this parameter activates the import. If the table
doesn't exist, it will be created.
* *importToColumn*: <col1>,<col2>,... - If none provided, the Excel column names A, B, ... are used. Note: These
* *importToColumns*: <col1>,<col2>,... - If none provided, the Excel column names A, B, ... are used. Note: These
have to match the table's column names if the table already exists.
* *importRegion*: [tab],[startColumn],[startRow],[endColumn],[endRow]|... - All parts are optional (default:
entire 1st sheet). Tab can either be given as an index (1-based) or a name. start/endColumn can be given either
......@@ -6319,8 +6322,8 @@ Parameter and (element) sources
* If only one `file` is specified, the default is `file`.
* If there is a) a page defined or b) multiple elements, the default is `pdf`.
* *element sources* - for `M:pdf` or `M:zip`, all of the following three element sources might be specified multiple times.
Any combination and order of the three options are allowed.
* *element sources* - for `M:pdf` or `M:zip`, all of the following element sources may be specified multiple times.
Any combination and order of these options are allowed.
* *file*: `F:<pathFileName>` - relative or absolute pathFileName offered for a) download (single), or to be concatenated
in a PDF or ZIP.
......@@ -6340,6 +6343,12 @@ Parameter and (element) sources
* *url*: `u:<url>` - any URL, pointing to an internal or external destination.
* *uid*: `uid:<int>` - the tt_contents.uid of a QFQ PageContent record (shown on hover in the backend). This will render
only the raw QFQ processed bodytext of the specified PageContent, without additional tags, styles, or CSS includes.
QFQ will retrieve the PageContent's bodytext from the Typo3 database, parse it, and render it as a PDF. Parameters can be
passed: `uid:<int>[?arg1=value1][&arg2=value2][...]` and will be available in the SIP store for the QFQ PageContent,
or passed as wkhtmltopdf arguments, if applicable.
* *WKHTML Options* for `page`, `urlParam` or `url`:
* The 'HTML to PDF' will be done via `wkhtmltopdf`.
......@@ -6531,33 +6540,23 @@ Injecting data into the Excel file is done in the same way in both modes: a Typo
or tags) contains one or more Typo3 QFQ records. Those QFQ records will create plain ASCII output.
If the export file has to be customized (colors, pictures, headlines, ...), the `Template` mode is the preferred option.
IT's much easier to do all cusomizations via Excel and creating a template than by coding in QFQ / Excel export notation.
It's much easier to do all customizations via Excel and creating a template than by coding in QFQ / Excel export notation.
Setup
'''''
* Create a special column name `_excel` (or `_link`) in QFQ/Report. As a source, define a T3 page, which have to deliver
the dynamic content (also: `excel-export-sample_`). ::
SELECT CONCAT('d:final.xlsx|M:excel|s:1|t:Excel (new)|p:?id=exceldata') AS _link
* Create a T3 page which delivers the content.
* Disable all HTML header and wrapping code on that page. It's also a good idea to limit access to such page on localhost,
your development network and your webserver address. Typoscript setup: ::
* Create a special column name `_excel` (or `_link`) in QFQ/Report. As a source, define a T3 PageContent, which has to
deliver the dynamic content (also `_excel-export-sample`). ::
config.disableAllHeaderCode = 1
tt_content.stdWrap >
page >
page = PAGE
SELECT CONCAT('d:final.xlsx|M:excel|s:1|t:Excel (new)|uid:43') AS _link
[usergroup = *] || [IP = 127.0.0.1,192.168.1.*,<webserver IP>]
page.10 < styles.content.get
[else]
page.10 = TEXT
page.10.value = access forbidden
[global]
* Create a T3 PageContent which delivers the content.
* It is recommended to use the `uid:<int>` syntax for excel imports, because there should be no html code on the
resulting content. QFQ will retrieve the PageContent's bodytext from the Typo3 database, parse it, and pass the
result as the instructions for filling the excel file.
* Parameters can be passed: `uid:43?param=value&param2=value2` and will be accessible in the SIP Store (S) in the
QFQ PageContent.
* Use the regular QFQ Report syntax to create some output.
* The newline at the end of every line needs to be CHAR(10). To make it simpler, the special column name `... AS _XLS`
(see _XLS, _XLSs, _XLSb, _XLSn) can be used.
......@@ -6628,14 +6627,14 @@ In Report Syntax: ::
Excel export samples: ::
# From scratch (both are the same, one with '_excel' the other with '_link')
SELECT CONCAT('d:new.xlsx|t:Excel (new)|p:?id=exceldata') AS _excel
SELECT CONCAT('d:new.xlsx|t:Excel (new)|p:?id=exceldata|M:excel|s:1') AS _link
SELECT CONCAT('d:new.xlsx|t:Excel (new)|uid:54') AS _excel
SELECT CONCAT('d:new.xlsx|t:Excel (new)|uid:54|M:excel|s:1') AS _link
# Template
SELECT CONCAT('d:final.xlsx|t:Excel (template)|F:fileadmin/template.xlsx|p:?id=exceldata') AS _excel
SELECT CONCAT('d:final.xlsx|t:Excel (template)|F:fileadmin/template.xlsx|uid:24') AS _excel
# With parameter (via SIP) - get the Parameter on page 'exceldata' with '{{arg1:S}}' and '{{arg2:S}}'
SELECT CONCAT('d:final.xlsx|t:Excel (parameter)|p:?id=exceldata&_sip=1&arg1=hello&arg2=world') AS _excel
SELECT CONCAT('d:final.xlsx|t:Excel (parameter)|uid:32&arg1=hello&arg2=world') AS _excel
.. _drag_and_drop:
......
......@@ -720,41 +720,37 @@ EOF;
$htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass);
}
$html .= $this->customWrap($formElement, $htmlLabel, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
[$this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_END]], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL);
$html .= $this->customWrap($formElement, $htmlLabel, WRAP_SETUP_LABEL, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL);
// Input
$html .= $this->customWrap($formElement, $htmlElement, FE_WRAP_INPUT, $formElement[FE_BS_INPUT_COLUMNS],
[$this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_END]],
$html .= $this->customWrap($formElement, $htmlElement, WRAP_SETUP_INPUT, FE_WRAP_INPUT, $formElement[FE_BS_INPUT_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_INPUT, $classHideElement);
// Note
$note = $formElement[FE_NOTE];
$html .= $this->customWrap($formElement, $note, FE_WRAP_NOTE, $formElement[FE_BS_NOTE_COLUMNS],
[$this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_END]], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_NOTE);
$html .= $this->customWrap($formElement, $note, WRAP_SETUP_NOTE, FE_WRAP_NOTE, $formElement[FE_BS_NOTE_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_NOTE);
// Row
$openTag = $formElement[FE_FLAG_ROW_OPEN_TAG] ? $this->getRowOpenTag($classHideRow) : '';
$closeTag = $formElement[FE_FLAG_ROW_CLOSE_TAG] ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] : '';
$html = $this->customWrap($formElement, $html, FE_WRAP_ROW, -1, [$openTag, $closeTag], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW);
$html = $this->customWrap($formElement, $html, WRAP_SETUP_ELEMENT, FE_WRAP_ROW -1, $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW, $classHideRow);
return $html;
}
/**
* Wrap content with $wrapArray or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
* Wrap content as defined in this->wrap or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
*
* Result:
* - if $bsColumns==0 and empty $formElement[$wrapName]: no wrap
* - if $formElement[$wrapName] is given: wrap with that one. Else: wrap with $wrapArray
* - if $htmlId is give, inject it in $wrap.
* - if $formElement[$customWrapName] is given: wrap with that one.
* - if $htmlId is given, inject it in $wrap.
*
* @param array $formElement Complete FormElement, especially some FE_WRAP
* @param string $htmlElement Content to wrap.
* @param string $wrapType WRAP_SETUP_ELEMENT, WRAP_SETUP_LABEL, WRAP_SETUP_INPUT, WRAP_SETUP_NOTE
* @param string $wrapName FE_WRAP_ROW, FE_WRAP_LABEL, FE_WRAP_INPUT, FE_WRAP_NOTE
* @param int $bsColumns
* @param array $wrapArray Systemwide Defaults: [ 'open wrap', 'close wrap' ]
* @param string $htmlId
* @param string $class
*
......@@ -762,29 +758,46 @@ EOF;
* @throws CodeException
* @throws \qfq\UserFormException
*/
private function customWrap(array $formElement, $htmlElement, $wrapName, $bsColumns, array $wrapArray, $htmlId = '', $class = '') {
private function customWrap(array $formElement, $htmlElement, $wrapType, $wrapName, $bsColumns, $htmlId = '', $class = '') {
$openTag = '';
$closeTag = '';
// If $bsColumns==0: do not wrap with default.
if ($bsColumns == 0) {
$wrapArray[0] = '';
$wrapArray[1] = '';
if ($bsColumns != 0) {
switch ($wrapType) {
case WRAP_SETUP_ELEMENT;
$openTag = $formElement[FE_FLAG_ROW_OPEN_TAG] ? $this->getRowOpenTag($class) : '';
$closeTag = $formElement[FE_FLAG_ROW_CLOSE_TAG] ? $this->wrap[$wrapType][WRAP_SETUP_END] : '';
break;
case WRAP_SETUP_LABEL:
case WRAP_SETUP_INPUT:
case WRAP_SETUP_NOTE:
$hasOpen = Support::findInSet($wrapType, $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$hasClose = Support::findInSet("/$wrapType", $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$openTag = $hasOpen ? $this->wrap[$wrapType][WRAP_SETUP_START] : '';
$closeTag = $hasClose ? $this->wrap[$wrapType][WRAP_SETUP_END] : '';
break;
default:
throw new UserFormException("Unknown wrap for FormElement.parameter '$wrapType'.", ERROR_MISSING_VALUE);
break;
}
}
// If there is a 'per FormElement'-wrap, take it.
if (isset($formElement[$wrapName])) {
$wrapArray = explode('|', $formElement[$wrapName], 2);
$openTag = $wrapArray[0] ?? '';
$closeTag = $wrapArray[1] ?? '';
}
if (count($wrapArray) != 2) {
throw new UserFormException("Need open & close wrap token for FormElement.parameter" . $wrapName . " - E.g.: <div ...>|</div>", ERROR_MISSING_VALUE);
}
if ($wrapArray[0] != '') {
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'id', $htmlId);
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'class', $class); // might be problematic, if there is already a 'class' defined.
if ($openTag != '') {
$openTag = Support::insertAttribute($openTag, 'id', $htmlId);
$openTag = Support::insertAttribute($openTag, 'class', $class); // might be problematic, if there is already a 'class' defined.
}
return $wrapArray[0] . $htmlElement . $wrapArray[1];
return $openTag . $htmlElement . $closeTag;
}
......
......@@ -1449,6 +1449,7 @@ const PARAM_TOKEN_DELIMITER = ':';
const TOKEN_URL = 'u';
const TOKEN_MAIL = 'm';
const TOKEN_PAGE = 'p';
const TOKEN_UID = 'uid';
const TOKEN_DOWNLOAD = 'd';
const TOKEN_COPY_TO_CLIPBOARD = 'y';
......
......@@ -87,13 +87,18 @@ class QuickFormQuery {
/**
* @var array
*/
private $t3data = array(); // FormEelement Definition: all formElement.class='native' of the loaded form
private $t3data = array(); // FormElement Definition: all formElement.class='native' of the loaded form
/**
* @var bool
*/
private $phpUnit = false;
/**
* @var bool
*/
private $inlineReport = false;
/**
* @var Session
*/
......@@ -122,15 +127,16 @@ class QuickFormQuery {
*
* @param array $t3data
* @param bool $phpUnit
* @param bool $inlineReport
*
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public function __construct(array $t3data = array(), $phpUnit = false) {
public function __construct(array $t3data = array(), $phpUnit = false, $inlineReport = true) {
$this->phpUnit = $phpUnit;
$this->inlineReport = $inlineReport;
mb_internal_encoding("UTF-8");
......@@ -1369,7 +1375,8 @@ class QuickFormQuery {
$report = new Report($this->t3data, $this->eval, $this->phpUnit);
$html = '';
if ($this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX)) {
$beUserLoggedIn = $this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX);
if ($beUserLoggedIn && $this->inlineReport) {
$html .= $this->buildInlineReport();
}
$html .= $report->process($this->t3data[T3DATA_BODYTEXT]);
......@@ -1435,11 +1442,7 @@ class QuickFormQuery {
}
$bodytext = Support::htmlEntityEncodeDecode(MODE_DECODE, $_POST[REPORT_INLINE_BODYTEXT]);
$dbT3 = $this->store->getVar(SYSTEM_T3_DB_NAME, STORE_SYSTEM . STORE_EMPTY, SANITIZE_ALLOW_ALNUMX);
if ($dbT3 == '') {
$dbData = $this->store->getVar(SYSTEM_DB_NAME_DATA, STORE_SYSTEM, SANITIZE_ALLOW_ALNUMX);
$dbT3 = substr($dbData, 0, strrpos($dbData, "_") + 1) . 't3';
}
$dbT3 = $this->store->getDbT3Name();
// Update bodytext
$sql = "UPDATE $dbT3.tt_content SET bodytext = ?, tstamp = UNIX_TIMESTAMP(NOW()) WHERE uid = ?";
......
......@@ -378,6 +378,8 @@ class Save {
$newValues[COLUMN_MIME_TYPE] = $vars[VAR_FILE_MIME_TYPE];
}
}
} elseif (isset($formElement[FE_IMPORT_TO_TABLE]) && !isset($formElement[FE_SLAVE_ID])) {
// Excel import on nonexisting column -> no upload
} else {
// 'Advanced Upload'
$this->doUploadSlave($formElement, $modeUpload);
......
......@@ -824,8 +824,8 @@ class Support {
// Will be used to change dynamicUpdate behaviour
if (isset($formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE])) {
$formElement[FE_FLAG_ROW_OPEN_TAG] = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$formElement[FE_FLAG_ROW_CLOSE_TAG] = Support::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$formElement[FE_FLAG_ROW_OPEN_TAG] = self::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$formElement[FE_FLAG_ROW_CLOSE_TAG] = self::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
} else {
$formElement[FE_FLAG_ROW_OPEN_TAG] = true;
$formElement[FE_FLAG_ROW_CLOSE_TAG] = false;
......
......@@ -27,6 +27,7 @@ require_once(__DIR__ . '/Monitor.php');
require_once(__DIR__ . '/../exceptions/DownloadException.php');
require_once(__DIR__ . '/Excel.php');
require_once(__DIR__ . '/../helper/DownloadPage.php');
require_once(__DIR__ . '/../QuickFormQuery.php');
//require_once(__DIR__ . '/../Evaluate.php');
//require_once(__DIR__ . '/../helper/KeyValueStringParser.php');
......@@ -134,7 +135,7 @@ class Download {
foreach ($files AS $filename) {
$mimetype = mime_content_type($filename);
if ($mimetype != 'application/pdf') {
throw new downloadException("Error concat file $filename. Mimetype 'application/pdf' expected, got: $mimetype", ERROR_DOWNLOAD_UNEXPECTED_MIME_TYPE);
throw new DownloadException("Error concat file $filename. Mimetype 'application/pdf' expected, got: $mimetype", ERROR_DOWNLOAD_UNEXPECTED_MIME_TYPE);
}
}
......@@ -214,9 +215,13 @@ class Download {
* @param string $rcData - With $downloadMode=DOWNLOAD_MODE_EXCEL, this contains the rendered code from the given T3 page.
* @return string filename - already ready or fresh exported. Fresh exported needs to be deleted later.
* @throws CodeException
* @throws DbException
* @throws DownloadException
* @throws UserFormException
* @throws UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function getElement($element, $downloadMode, &$rcData) {
......@@ -232,24 +237,49 @@ class Download {
$token = $arr[0];
$value = $arr[1];
if ($token === TOKEN_UID) { // extract uid
$uidParamsArr = explode('&', $value, 2);
$uid = $uidParamsArr[0];
$value = $uidParamsArr[1] ?? ''; // additional params
}
switch ($token) {
case TOKEN_URL:
case TOKEN_URL_PARAM:
case TOKEN_PAGE:
if ($downloadMode == DOWNLOAD_MODE_EXCEL) {
case TOKEN_UID:
$urlParam = OnString::splitParam($value, $rcArgs, $rcSipEncode);
$urlParamString = KeyValueStringParser::unparse($urlParam, '=', '&');
if ($rcSipEncode) {
$sip = new Sip();
$urlParamString = $sip->queryStringToSip($urlParamString, RETURN_URL);
}
$urlParam = OnString::splitParam($value, $rcArgs, $rcSipEncode);
$urlParamString = KeyValueStringParser::unparse($urlParam, '=', '&');
if ($rcSipEncode) {
$sip = new Sip();
$urlParamString = $sip->queryStringToSip($urlParamString, RETURN_URL);
if ($downloadMode == DOWNLOAD_MODE_EXCEL) {
if ($token === TOKEN_UID) {
$rcData = $this->getEvaluatedBodytext($uid, $urlParam);
} else {
$baseUrl = $this->store->getVar(SYSTEM_BASE_URL, STORE_SYSTEM);
$rcData = DownloadPage::getContent($urlParamString, $baseUrl);
}
$baseUrl = $this->store->getVar(SYSTEM_BASE_URL, STORE_SYSTEM);
$rcData = DownloadPage::getContent($urlParamString, $baseUrl);
} else {
$filename = $this->html2pdf->page2pdf($token, $value);
if ($token === TOKEN_UID) {
// create tmp html document with bodytext
$htmlText = $this->getEvaluatedBodytext($uid, $urlParam);
$tmpFilename = HelperFile::tempnam() . '.html';
$tmpFile = fopen($tmpFilename, "w") or die('Cannot create file: '.$tmpFilename);
fwrite($tmpFile, $htmlText);
fclose($tmpFile);
$rcArgsString = KeyValueStringParser::unparse($rcArgs, '=', '&');
$url = Support::mergeUrlComponents('', $tmpFilename, $rcArgsString);
$filename = $this->html2pdf->page2pdf($token, $url);
HelperFile::cleanTempFiles([$tmpFilename]);
} else {
$filename = $this->html2pdf->page2pdf($token, $value);
}
}
break;
......@@ -265,6 +295,34 @@ class Download {
return $filename;
}
/**
* @param $uid
* @param array $urlParam
*
* @return string
* @throws CodeException
* @throws DbException
* @throws DownloadException
* @throws UserFormException
* @throws UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function getEvaluatedBodyText($uid, $urlParam) {
foreach($urlParam as $key => $paramValue) {
$this->store->setVar($key, $paramValue, STORE_SIP);
}
$dbT3 = $this->store->getDbT3Name();
$sql = "SELECT bodytext FROM $dbT3.tt_content WHERE uid = ?";
$tt_content = $this->db->sql($sql, ROW_EXPECT_1, [$uid]);
$qfq = new QuickFormQuery([T3DATA_BODYTEXT => $tt_content[T3DATA_BODYTEXT]], false,false);
return $qfq->process();
}
/**
* Creates a ZIP Files of all given $files
......@@ -318,6 +376,7 @@ class Download {
* @param string $outputMode OUTPUT_MODE_DIRECT | OUTPUT_MODE_FILE
* @return string Filename of the generated file. The filename only points to a real existing filename with $outputMode=OUTPUT_MODE_FILE
* @throws CodeException
* @throws DbException
* @throws DownloadException
* @throws UserFormException
* @throws UserReportException
......
......@@ -121,7 +121,7 @@ class Html2Pdf {
* Converts a Webpage (URL) to a PDF file.
* The URL might be a local Typo3 page (without hostname, starting with the parameter) or a full URL.
*
* @param string $token TOKEN_URL | TOKEN_URL_PARAM
* @param string $token TOKEN_URL | TOKEN_URL_PARAM | TOKEN_PAGE | TOKEN_UID
* @param string $url id=exportPage&r=123, www.nzz.ch/issue?id=456
*
* @return string rendered file - please delete later
......@@ -135,10 +135,11 @@ class Html2Pdf {
$host = '';
switch ($token) {
case TOKEN_UID:
case TOKEN_URL:
$arr = explode('?', $url, 2);
$host = $arr[0];
$urlParamString = empty($arr[1]) ? '' : $arr[1];
$urlParamString = $arr[1] ?? '';
break;
case TOKEN_URL_PARAM:
case TOKEN_PAGE:
......@@ -160,11 +161,9 @@ class Html2Pdf {
$urlParamString = $this->sip->queryStringToSip($urlParamString, RETURN_URL);
}
if ($urlParamString != '') {
$url = Support::mergeUrlComponents('', $host, $urlParamString);
}
$url = Support::mergeUrlComponents('', $host, $urlParamString);
if (substr($url, 0, 4) != 'http') {
if (substr($url, 0, 4) != 'http' && $token != TOKEN_UID) {
$url = 'http://' . $url;
}
......
......@@ -74,6 +74,7 @@ require_once(__DIR__ . '/Thumbnail.php');
const NAME_URL = 'url';
const NAME_MAIL = 'mail';
const NAME_PAGE = 'page';
const NAME_UID = 'uid';
const NAME_TEXT = 'text';
const NAME_DOWNLOAD = DOWNLOAD_EXPORT_FILENAME;
const NAME_COLLECT_ELEMENTS = 'downloadElements'; // array with element sources
......@@ -190,6 +191,7 @@ class Link {
TOKEN_URL => NAME_URL,
TOKEN_MAIL => NAME_MAIL,
TOKEN_PAGE => NAME_PAGE,
TOKEN_UID => NAME_UID,
TOKEN_DOWNLOAD => NAME_DOWNLOAD,
TOKEN_DOWNLOAD_MODE => NAME_DOWNLOAD_MODE,
TOKEN_TEXT => NAME_TEXT,
......@@ -235,6 +237,7 @@ class Link {
TOKEN_URL => LINK_ANCHOR,
TOKEN_MAIL => LINK_ANCHOR,
TOKEN_PAGE => LINK_ANCHOR,
TOKEN_UID => LINK_ANCHOR,
TOKEN_DOWNLOAD => LINK_ANCHOR,
TOKEN_FILE => NAME_FILE,
TOKEN_COPY_TO_CLIPBOARD => LINK_ANCHOR,
......@@ -542,7 +545,8 @@ class Link {
// Store value
if ((isset($rcTokenGiven[TOKEN_DOWNLOAD]) || isset($rcTokenGiven[TOKEN_COPY_TO_CLIPBOARD])) &&
($key == TOKEN_PAGE || $key == TOKEN_URL || $key == TOKEN_URL_PARAM || $key == TOKEN_FILE || $key == TOKEN_FILE_DEPRECATED)) {
($key == TOKEN_PAGE || $key == TOKEN_URL || $key == TOKEN_URL_PARAM || $key == TOKEN_UID ||
$key == TOKEN_FILE || $key == TOKEN_FILE_DEPRECATED)) {
$vars[NAME_COLLECT_ELEMENTS][] = $key . ':' . $value;
......
......@@ -962,4 +962,27 @@ class Store {
$store->setStore(array_merge($store->getStore($storeName), $append), $storeName, true);
}
/**
* Gets the db T3 name:
* - if defined by T3_DB_NAME in config
* - else: construct databasename_t3 from databasename_db
*
* @return string
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public static function getDbT3Name() {
$dbT3Name = self::getVar(SYSTEM_T3_DB_NAME, STORE_SYSTEM . STORE_EMPTY, SANITIZE_ALLOW_ALNUMX);
if (!$dbT3Name) {
$dbIndexData = self::getVar(SYSTEM_DB_INDEX_DATA, STORE_SYSTEM);
$dbData = new Database($dbIndexData);
$dbDataName = $dbData->getDbName();
$dbT3Name = substr($dbDataName, 0, strrpos($dbDataName, "_") + 1) . 't3';
}
return $dbT3Name;
}
}
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