Commit 65501a4c authored by Marc Egger's avatar Marc Egger
Browse files

Refs #11035 move all path constants into Path.php

parent cb051f41
Pipeline #3714 failed with stages
in 2 minutes and 55 seconds
......@@ -6,15 +6,10 @@
echo $_SERVER['DOCUMENT_ROOT'];
// TODO: replace the following with a better method
const API_DIR = "./";
const GFX_INFO = '/../../Resources/Public/icons/note.gif';
const PATH_ICONS = '/../../Resources/Public/icons';
require_once(__DIR__ . '/../../vendor/autoload.php');
use http\Exception;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\QuickFormQuery;
// TODO: use Path:: for paths that are defined in config
......@@ -40,6 +35,8 @@ use IMATHUZH\Qfq\Core\QuickFormQuery;
////
Path::setExtRelToCwd('../../');
class User {
public $user;
public function __construct()
......
......@@ -2545,7 +2545,7 @@ abstract class AbstractBuildForm {
}
if (isset($control[SUBRECORD_COLUMN_ICON][$columnName])) {
$cell = ($cell === '') ? '' : "<image src='" . Path::extRelToCwd(PATH_ICONS_REL_TO_EXT) . "/$cell'>";
$cell = ($cell === '') ? '' : "<image src='" . Path::extRelToCwd(Path::PATH_ICONS_REL_TO_EXT) . "/$cell'>";
}
if (isset($control[SUBRECORD_COLUMN_MAILTO][$columnName])) {
......
......@@ -11,14 +11,6 @@ const CONFIG_QFQ_INI = "config.qfq.ini"; // QFQ configuration file: db access -
const CONFIG_QFQ_PHP = "config.qfq.php"; // QFQ configuration file: db access
const CONFIG_T3 = 'LocalConfiguration.php'; // T3 config file
const GFX_INFO = 'typo3conf/ext/qfq/Resources/Public/icons/note.gif'; // Deprecated! Use Path::extRelToCwd(GFX_INFO_REL_TO_EXT) instead!
const GFX_INFO_REL_TO_EXT = 'Resources/Public/icons/note.gif';
const API_DIR = 'typo3conf/ext/qfq/Classes/Api'; // Deprecated! Use Path::apiRelToCwd() instead!
const API_DIR_EXT = 'Classes/Api'; // Deprecated! Use Path::apiRelToExt() instead!
const PATH_ICONS = 'typo3conf/ext/qfq/Resources/Public/icons'; // Deprecated! Use Path::extRelToCwd(PATH_ICONS_REL_TO_EXT) instead!
const PATH_ICONS_REL_TO_EXT = 'Resources/Public/icons';
const QFQ_TEMP_FILE_PATTERN = 'qfq.split.XXXXX';
const QFQ_TEMP_SOURCE = '.temp.source';
......@@ -492,25 +484,16 @@ const SYSTEM_DB_INDEX_QFQ = "indexQfq";
//const SYSTEM_DB_INDEX_DATA_DEPRECATED = "DB_INDEX_DATA";
//const SYSTEM_DB_INDEX_QFQ_DEPRECATED = "DB_INDEX_QFQ";
const SYSTEM_FILEADMIN_PROTECTED_LOG = 'fileadmin/protected/log'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_FILEADMIN_PROTECTED_LOG_REL_TO_APP)
const SYSTEM_FILEADMIN_PROTECTED_LOG_REL_TO_APP = 'fileadmin/protected/log';
// Automatically filled by QFQ
const SYSTEM_DB_NAME_DATA = 'dbNameData';
const SYSTEM_DB_NAME_QFQ = 'dbNameQfq';
const SYSTEM_DB_NAME_T3 = 'dbNameT3';
const SYSTEM_QFQ_LOG = 'qfqLog'; // Logging to file
const SYSTEM_QFQ_LOG_FILE = 'fileadmin/protected/log/qfq.log'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_QFQ_LOG_FILE_REL_TO_APP)
const SYSTEM_QFQ_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/qfq.log';
const SYSTEM_MAIL_LOG = 'mailLog';
const SYSTEM_MAIL_LOG_FILE = 'fileadmin/protected/log/mail.log'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_MAIL_LOG_FILE_REL_TO_APP)
const SYSTEM_MAIL_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/mail.log';
const SYSTEM_SQL_LOG = 'sqlLog'; // Logging to file
const SYSTEM_SQL_LOG_FILE = 'fileadmin/protected/log/sql.log'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_SQL_LOG_FILE_REL_TO_APP)
const SYSTEM_SQL_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/sql.log';
const SYSTEM_SQL_LOG_MODE = 'sqlLogMode'; // Mode, which statements to log.
const SYSTEM_SQL_LOG_MODE_AUTOCRON = 'sqlLogModeAutoCron'; // Mode, which statements to log in AutoCron Environments.
......@@ -659,11 +642,7 @@ const SYSTEM_CMD_PDFUNITE = 'cmdPdfunite';
// Thumbnail
const SYSTEM_THUMBNAIL_DIR_SECURE = 'thumbnailDirSecure';
const SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT = 'fileadmin/protected/qfqThumbnail'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP)
const SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP = 'fileadmin/protected/qfqThumbnail';
const SYSTEM_THUMBNAIL_DIR_PUBLIC = 'thumbnailDirPublic';
const SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT = 'typo3temp/qfqThumbnail'; // Deprecated! Use: Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP)
const SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP = 'typo3temp/qfqThumbnail';
// Form/Report as file
const SYSTEM_QFQ_PROJECT_DIR_SECURE = 'qfqProjectDir'; // where form and report files are saved
......@@ -1484,8 +1463,6 @@ const COLUMN_PATH_FILE_NAME = 'pathFileName';
const EXISTING_PATH_FILE_NAME = '_existingPathFileName';
const THUMBNAIL_WIDTH_DEFAULT = '150x';
const THUMBNAIL_UNKNOWN_TYPE = 'typo3/sysext/frontend/Resources/Public/Icons/FileIcons/'; // Deprecated! Use: Path::appRelToCwd(THUMBNAIL_UNKNOWN_TYPE_REL_TO_APP)
const THUMBNAIL_UNKNOWN_TYPE_REL_TO_APP = 'typo3/sysext/frontend/Resources/Public/Icons/FileIcons/';
const THUMBNAIL_MAX_SECONDS = 60;
const THUMBNAIL_PREPARE = 'prepare';
const THUMBNAIL_VIA_DOWNLOAD = 'secureFile';
......@@ -1902,8 +1879,6 @@ const AUTOCRON_COUNT = 'count';
// Annotate
const ANNOTATE_GRAPHIC_CSS_CLASS = 'annotate-graphic'; // Ex 'fabric'
const ANNOTATE_TEXT_CSS_CLASS = 'annotate-text'; // Ex 'codeCorrection
const DIR_HIGHLIGHT_JSON = 'typo3conf/ext/qfq/Resources/Public/Json'; // Deprecated! Use: Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP)
const DIR_HIGHLIGHT_JSON_REL_TO_APP = 'typo3conf/ext/qfq/Resources/Public/Json';
// DataImport
const IMPORT_MODE_APPEND = 'append';
......
......@@ -14,6 +14,7 @@ use IMATHUZH\Qfq\Core\Helper\HelperFile;
use IMATHUZH\Qfq\Core\Helper\HelperFormElement;
use IMATHUZH\Qfq\Core\Helper\Logger;
use IMATHUZH\Qfq\Core\Helper\OnArray;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\Store\Store;
/**
......@@ -1044,7 +1045,7 @@ class Database {
* @throws \UserFormException
*/
public function getQfqLogFile() {
return ($this->store == null) ? Path::appRelToCwd(SYSTEM_QFQ_LOG_FILE_REL_TO_APP) : $this->store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
return ($this->store == null) ? Path::appRelToCwd(Path::SYSTEM_QFQ_LOG_FILE_REL_TO_APP) : $this->store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
}
/**
......
......@@ -294,7 +294,7 @@ class DatabaseUpdate {
if ($actionSpecialColumn === ACTION_SPECIAL_COLUMN_DO_REPLACE) {
// save log file
$message = '<h1>Special column names replaced</h1>The following special column names were replaced.<hr>' . $message;
Logger::logMessage($message, Path::appRelToCwd(SYSTEM_FILEADMIN_PROTECTED_LOG_REL_TO_APP) . '/' . date("YmdHi") . '_special_columns_auto_update.html');
Logger::logMessage($message, Path::appRelToCwd(Path::SYSTEM_LOG_REL_TO_APP) . '/' . date("YmdHi") . '_special_columns_auto_update.html');
} elseif ($actionSpecialColumn === ACTION_SPECIAL_COLUMN_DO_SKIP_REPLACE) {
// do nothing
} else {
......@@ -306,7 +306,7 @@ class DatabaseUpdate {
. 'Click <a href="?' . http_build_query(array_merge($_GET, array(ACTION_SPECIAL_COLUMN_UPDATE => ACTION_SPECIAL_COLUMN_DO_REPLACE))) . '">Auto-Replace</a>'
. ' to automatically prepend the found column names with an underscore.'
. ' In the report below the missing underscores are marked by "<span style="font-weight: bold; color: red;">>>>_</span>".'
. ' This report will be saved in ' . Path::appRelToCwd(SYSTEM_FILEADMIN_PROTECTED_LOG_REL_TO_APP) . ' after the automatic replacement.'
. ' This report will be saved in ' . Path::appRelToCwd(Path::SYSTEM_LOG_REL_TO_APP) . ' after the automatic replacement.'
. ' <br><br>To update qfq without changing the special columns (your app will probably be broken): '
. '<a href="?' . http_build_query(array_merge($_GET, array(ACTION_SPECIAL_COLUMN_UPDATE => ACTION_SPECIAL_COLUMN_DO_SKIP_REPLACE))) . '">Skip Auto-Replace</a>'
. '<h2>Report</h2>'
......
......@@ -190,7 +190,7 @@ class AbstractException extends \Exception {
}
}
$qfqLog = ($store == null) ? Path::appRelToCwd(SYSTEM_QFQ_LOG_FILE_REL_TO_APP) : $store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
$qfqLog = ($store == null) ? Path::appRelToCwd(Path::SYSTEM_QFQ_LOG_FILE_REL_TO_APP) : $store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
$arrDebugHidden[EXCEPTION_STACKTRACE] = PHP_EOL . implode($arrTrace, PHP_EOL);
$arrLogAll = array_merge($arrMsg, $arrShow, $arrDebugShow, $arrDebugHidden);
$logAll = OnArray::arrayToLog($arrLogAll);
......
......@@ -475,7 +475,7 @@ class HelperFile {
}
if (isset($extToFileType[$ext])) {
return Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/' . $extToFileType[$ext];
return Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/' . $extToFileType[$ext];
}
return '';
......
......@@ -34,18 +34,33 @@ Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) === DIR_HIGHLIGHT_JSON
class Path
{
/*
public static function overrideExtPath(string $path)
{
// const QFQ_EXT_DOMAIN_PATH_GLOBALS_KEY = "qfq_path_to_extension_directory_relative_to_domain_root";
// const QFQ_EXT_FILE_PATH_GLOBALS_KEY = "qfq_absolute_file_path_to_extension_directory";
// const APPLICATION_DOMAIN_PATH_GLOBALS_KEY = "qfq_absolute_file_path_to_application_root_directory";
// const APPLICATION_FILE_PATH_GLOBALS_KEY = "qfq_absolute_file_path_to_application_root_directory";
// $GLOBALS[];
private static $extRelToCwd = 'typo3conf/ext/qfq';
// API
const API_REL_TO_EXT = 'Classes/Api';
// Icons
const GFX_INFO_REL_TO_EXT = 'Resources/Public/icons/note.gif';
const PATH_ICONS_REL_TO_EXT = 'Resources/Public/icons';
// Log files
const SYSTEM_LOG_REL_TO_APP = 'fileadmin/protected/log';
const SYSTEM_QFQ_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/qfq.log';
const SYSTEM_MAIL_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/mail.log';
const SYSTEM_SQL_LOG_FILE_REL_TO_APP = 'fileadmin/protected/log/sql.log';
// TODO: if global with key not exists, then set path to global. Only the first time this function is called it has en effect.
// Thumbnail
const SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP = 'fileadmin/protected/qfqThumbnail';
const SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP = 'typo3temp/qfqThumbnail';
const THUMBNAIL_UNKNOWN_TYPE_REL_TO_APP = 'typo3/sysext/frontend/Resources/Public/Icons/FileIcons/';
// Annotate
const DIR_HIGHLIGHT_JSON_REL_TO_APP = 'typo3conf/ext/qfq/Resources/Public/Json';
public static function setExtRelToCwd(string $newPath)
{
self::$extRelToCwd = $newPath;
}
*/
/**
* Return path relative to CWD
......@@ -60,14 +75,12 @@ class Path
*/
public static function extRelToCwd(string $pathRelToExt = ''): string
{
$extPathRelToCwd = 'typo3conf/ext/qfq';
return self::join($extPathRelToCwd, $pathRelToExt);
return self::join(self::$extRelToCwd, $pathRelToExt);
}
public static function apiRelToExt(string $pathRelToApi = ''): string
{
$apiPathRelToExt = 'Classes/Api';
return self::join($apiPathRelToExt, $pathRelToApi);
return self::join(self::API_REL_TO_EXT, $pathRelToApi);
}
public static function apiRelToCwd(string $pathRelToApi = ''): string
......@@ -81,7 +94,7 @@ class Path
return self::join($appPathRelToCwd, $pathRelToExt);
}
public static function join(): string
public static function join(/* path pieces */): string
{
// Filter out empty string and null arguments
$pieces = array_filter(func_get_args(), function($value) { return !is_null($value) && $value !== ''; });
......
......@@ -123,7 +123,7 @@ class Support {
throw new \CodeException('Unknown mode: ' . $formLogMode, ERROR_UNKNOWN_TOKEN);
}
$filename = Path::appRelToCwd(SYSTEM_FILEADMIN_PROTECTED_LOG_REL_TO_APP) . '/' . $formName . "." . $perBeSession . "log";
$filename = Path::appRelToCwd(Path::SYSTEM_LOG_REL_TO_APP) . '/' . $formName . "." . $perBeSession . "log";
return sanitize::safeFilename($filename, false, true);
}
......@@ -236,7 +236,7 @@ class Support {
*/
public static function doTooltip($htmlId, $tooltipText) {
return "<img " . self::doAttribute('id', $htmlId) . " src='" . Path::extRelToCwd(GFX_INFO_REL_TO_EXT) . "' title=\"" . htmlentities($tooltipText) . "\">";
return "<img " . self::doAttribute('id', $htmlId) . " src='" . Path::extRelToCwd(Path::GFX_INFO_REL_TO_EXT) . "' title=\"" . htmlentities($tooltipText) . "\">";
}
/**
......
......@@ -1705,7 +1705,7 @@ EOF;
$vars[NAME_ALT_TEXT] = "Bullet " . $value;
}
$vars[NAME_IMAGE] = Path::extRelToCwd(PATH_ICONS_REL_TO_EXT) . "/bullet-" . $value . '.gif';
$vars[NAME_IMAGE] = Path::extRelToCwd(Path::PATH_ICONS_REL_TO_EXT) . "/bullet-" . $value . '.gif';
$vars[NAME_IMAGE_TITLE] = $value;
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......@@ -1730,7 +1730,7 @@ EOF;
$vars[NAME_ALT_TEXT] = "Checked " . $value;
}
$vars[NAME_IMAGE] = Path::extRelToCwd(PATH_ICONS_REL_TO_EXT) . "/checked-" . $value . '.gif';
$vars[NAME_IMAGE] = Path::extRelToCwd(Path::PATH_ICONS_REL_TO_EXT) . "/checked-" . $value . '.gif';
$vars[NAME_IMAGE_TITLE] = $value;
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
......
......@@ -221,7 +221,7 @@ class Thumbnail {
break;
default:
$placeholder = Support::joinPath(Path::appRelToCwd(THUMBNAIL_UNKNOWN_TYPE_REL_TO_APP), $ext . '.gif');
$placeholder = Support::joinPath(Path::appRelToCwd(Path::THUMBNAIL_UNKNOWN_TYPE_REL_TO_APP), $ext . '.gif');
if (is_readable($placeholder)) {
return $placeholder;
}
......
......@@ -267,7 +267,7 @@ class Config {
}
Logger::logMessage(Logger::linePre() . 'Security: attack detected' . PHP_EOL . $reason,
$config[SYSTEM_QFQ_LOG] ?? Path::appRelToCwd(SYSTEM_QFQ_LOG_FILE_REL_TO_APP));
$config[SYSTEM_QFQ_LOG] ?? Path::appRelToCwd(Path::SYSTEM_QFQ_LOG_FILE_REL_TO_APP));
// In case of an attack: log out the current user.
Session::destroy();
......@@ -315,9 +315,9 @@ class Config {
SYSTEM_RENDER => SYSTEM_RENDER_SINGLE,
SYSTEM_DATE_FORMAT => 'yyyy-mm-dd',
SYSTEM_SHOW_DEBUG_INFO => SYSTEM_SHOW_DEBUG_INFO_AUTO,
SYSTEM_MAIL_LOG => Path::appRelToCwd(SYSTEM_MAIL_LOG_FILE_REL_TO_APP),
SYSTEM_QFQ_LOG => Path::appRelToCwd(SYSTEM_QFQ_LOG_FILE_REL_TO_APP),
SYSTEM_SQL_LOG => Path::appRelToCwd(SYSTEM_SQL_LOG_FILE_REL_TO_APP),
SYSTEM_MAIL_LOG => Path::appRelToCwd(Path::SYSTEM_MAIL_LOG_FILE_REL_TO_APP),
SYSTEM_QFQ_LOG => Path::appRelToCwd(Path::SYSTEM_QFQ_LOG_FILE_REL_TO_APP),
SYSTEM_SQL_LOG => Path::appRelToCwd(Path::SYSTEM_SQL_LOG_FILE_REL_TO_APP),
SYSTEM_SQL_LOG_MODE => 'modify',
SYSTEM_SQL_LOG_MODE_AUTOCRON => 'error',
F_BS_COLUMNS => 'col-md-12 col-lg-10',
......@@ -379,8 +379,8 @@ class Config {
SYSTEM_CMD_GS => 'gs',
SYSTEM_CMD_PDFUNITE => 'pdfunite',
SYSTEM_THUMBNAIL_DIR_SECURE => Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_PUBLIC => Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_SECURE => Path::appRelToCwd(Path::SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_PUBLIC => Path::appRelToCwd(Path::SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP),
F_FE_DATA_REQUIRED_ERROR => F_FE_DATA_REQUIRED_ERROR_DEFAULT,
F_FE_DATA_MATCH_ERROR => F_FE_DATA_MATCH_ERROR_DEFAULT,
......
......@@ -33,21 +33,21 @@ class HelperFileTest extends TestCase {
$this->assertEquals('', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO,''));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT,''));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_QFQ,''));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_PYTHON,''));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_MATLAB,''));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT,'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_QFQ, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_PYTHON, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_MATLAB, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.php.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.php'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.qfq'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.py'));
$this->assertEquals(Path::appRelToCwd(DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.m'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT,''));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_QFQ,''));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_PYTHON,''));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_MATLAB,''));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_JAVASCRIPT,'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_QFQ, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_PYTHON, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_MATLAB, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/javascript.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.js'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.php.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.php'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.qfq.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.qfq'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.py.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.py'));
$this->assertEquals(Path::appRelToCwd(Path::DIR_HIGHLIGHT_JSON_REL_TO_APP) . '/highlight.m.json', HelperFile::getFileTypeHighlight(FE_HIGHLIGHT_AUTO, 'fileadmin/test.m'));
}
public function testJoinPathFilename() {
......
......@@ -342,8 +342,8 @@ class StoreTest extends TestCase {
SYSTEM_DB_1_NAME => '<DB>',
SYSTEM_DOCUMENTATION_QFQ => SYSTEM_DOCUMENTATION_QFQ_URL,
SYSTEM_FLAG_PRODUCTION => 'yes',
SYSTEM_THUMBNAIL_DIR_SECURE => Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_PUBLIC => Path::appRelToCwd(SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_SECURE => Path::appRelToCwd(Path::SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT_REL_TO_APP),
SYSTEM_THUMBNAIL_DIR_PUBLIC => Path::appRelToCwd(Path::SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT_REL_TO_APP),
SYSTEM_CMD_INKSCAPE => 'inkscape',
SYSTEM_CMD_CONVERT => 'convert',
SYSTEM_CMD_WKHTMLTOPDF => '/opt/wkhtmltox/bin/wkhtmltopdf',
......
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