Commit 1bdb42d6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

WIP: Refs #12085 Fix sanitize bug

parent fe63e172
Pipeline #5030 passed with stages
in 3 minutes and 58 seconds
......@@ -691,10 +691,10 @@ class Download {
* @throws \UserReportException
*/
private function getDirectDownloadSql() {
$scriptName = $this->store->getVar('SCRIPT_NAME', STORE_CLIENT . STORE_EMPTY);
$scriptName = str_replace('.', '', $this->store->getVar('SCRIPT_NAME', STORE_CLIENT . STORE_EMPTY));
// Example: /var/www/html/qfq/dl.php >> dl.php
$scriptName = substr($scriptName, strrpos('/', $scriptName));
$scriptName = substr($scriptName, strrpos($scriptName, '/') + 1);
return $this->store->getVar(SYSTEM_SQL_DIRECT_DOWNLOAD . $scriptName, STORE_SYSTEM . STORE_EMPTY);
}
......@@ -707,10 +707,11 @@ class Download {
* @throws \UserReportException
*/
private function getDirectDownloadModeDetails() {
//TODO was ist wenn sql leer ist
$sql = $this->getDirectDownloadSql();
// Get, Clean: with http://loclhost/qfq/typo3conf/ext/qfq/Classes/Api/download.php/help is $_SERVER['PATH_INFO']='/help'.
$pathInfo = $this->store->getVar('PATH_INFO', STORE_CLIENT . STORE_EMPTY);
$pathInfo = $this->store->getVar('PATH_INFO', STORE_CLIENT . STORE_EMPTY, SANITIZE_ALLOW_ALNUMX);
$pathInfo = Sanitize::sanitize(urldecode($pathInfo), SANITIZE_ALLOW_ALNUMX);
$param = OnString::splitPathToArray($pathInfo);
......@@ -721,7 +722,7 @@ class Download {
while ($questionMark > count($param)) {
$param[] = $last;
}
//TODO SQL Fehler abfangen: SQL Fehler ausgeben!!
// Get cmd which defines the download
$param = $this->db->sql($sql, ROW_EXPECT_1, $param);
// In case there are more than on column: implode
......
......@@ -388,13 +388,13 @@ custom29 =
custom30 =
# cat=file/file; type=string; label=Query for direct download mode. Access via download.php. No default.: SELECT CONCAT('d:output.pdf|F:', n.pathFileName) FROM notiz AS n WHERE n.id=? AND NOW()<n.expire
sqlDirectdownload.php =
sqlDirectdownloadphp =
# cat=file/file; type=string; label=Query for direct download mode. Access via dl.php. No default.: SELECT CONCAT('d:output.pdf|F:', n.pathFileName) FROM notiz AS n WHERE n.id=? AND NOW()<n.expire
sqlDirectdl.php =
sqlDirectdlphp =
# cat=file/file; type=string; label=Query for direct download mode. Access via dl2.php. No default.: SELECT CONCAT('d:output.pdf|F:', n.pathFileName) FROM notiz AS n WHERE n.id=? AND NOW()<n.expire
sqlDirectdl2.php =
sqlDirectdl2php =
# cat=file/file; type=string; label=Query for direct download mode. Access via dl3.php. No default.: SELECT CONCAT('d:output.pdf|F:', n.pathFileName) FROM notiz AS n WHERE n.id=? AND NOW()<n.expire
sqlDirectdl3.php =
sqlDirectdl3php =
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