1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-09-01 03:41:43 +02:00

alias now requires password to work. alias filename is without extension #47.

This commit is contained in:
Mikael Roos
2015-01-17 19:15:18 +01:00
parent f87dc2967f
commit 4fae208c4c
4 changed files with 31 additions and 23 deletions

View File

@@ -630,25 +630,26 @@ $postProcessing = getConfig('postprocessing', array(
/**
* alias - Save resulting image to another alias name.
* Password apply if defined.
* Password always apply, must be defined.
*/
$alias = get('alias', null);
$aliasPath = getConfig('alias_path', null);
$aliasTarget = null;
$alias = get('alias', null);
$aliasPath = getConfig('alias_path', null);
$validAliasname = getConfig('valid_aliasname', '#^[a-z0-9A-Z-_]+$#');
$aliasTarget = null;
if ($alias && $aliasPath) {
if ($alias && $aliasPath && $passwordMatch) {
$aliasTarget = $aliasPath . $alias;
$useCache = false;
($passwordMatch !== false)
or errorPage("Alias used and password check failed.");
is_writable($aliasPath)
or errorPage("Directory for alias is not writable.");
preg_match($validFilename, $alias)
or errorPage('Filename for alias contains invalid characters.');
preg_match($validAliasname, $alias)
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
} else if ($alias) {
errorPage('Alias is not enabled in the config file.');
errorPage('Alias is not enabled in the config file or password not matching.');
}
verbose("alias = $alias");