Merge branch 'v2.5' of https://github.com/electerious/Lychee into uploader

This commit is contained in:
Tobias Reich 2014-05-17 23:04:49 +02:00
commit 647367a62d
2 changed files with 24 additions and 5 deletions

View File

@ -82,13 +82,16 @@ class Import extends Module {
foreach ($files as $file) {
# Prevent index.html from being moved
if (basename($file)==='index.html') continue;
# Prevent unsupported files from being moved
if (is_dir($file)===false&&@exif_imagetype($file)===false) continue;
$out = '';
$ret = '';
$file = escapeshellarg($file);
$cmd = $osmv . " $file " . LYCHEE_DATA . $tmpdirname;
@exec($cmd, $out, $ret);
@exec($osmv . ' ' . $file . ' ' . LYCHEE_DATA . $tmpdirname, $out, $ret);
if (isset($ret)&&($ret>0)) Log::error($database, __METHOD__, __LINE__, "Failed to move directory or file ($ret):" . $file);
}
@ -116,7 +119,13 @@ class Import extends Module {
if (!isset($path)) $path = LYCHEE_UPLOADS_IMPORT;
if ($useTemp===true) $path = Import::move($database, $path);
if ($useTemp===true) {
$path = Import::move($database, $path);
if ($path===false) {
Log::error($database, __METHOD__, __LINE__, 'Failed to move import to temporary directory');
return false;
}
}
$error = false;
$contains['photos'] = false;

View File

@ -26,8 +26,18 @@ class Plugins implements \SplSubject {
# Load plugins
foreach ($this->files as $file) {
if ($file==='') continue;
include(LYCHEE_PLUGINS . $file);
$file = LYCHEE_PLUGINS . $file;
if (file_exists($file)===false) {
Log::warning($database, __METHOD__, __LINE__, 'Could not include plugin. File does not exist (' . $file . ').');
continue;
}
include($file);
}
return true;