Merge pull request #4 from electerious/develop

Develop
This commit is contained in:
Quentin Ligier 2016-03-20 19:47:58 +01:00
commit 456e881105
3 changed files with 10 additions and 8 deletions

View File

@ -65,13 +65,12 @@ final class Import {
continue; continue;
} }
$pathinfo = pathinfo($url); $filename = pathinfo($url, PATHINFO_FILENAME) . $extension;
$filename = $pathinfo['filename'] . '.' . $pathinfo['extension'];
$tmp_name = LYCHEE_DATA . $filename; $tmp_name = LYCHEE_DATA . $filename;
if (@copy($url, $tmp_name)===false) { if (@copy($url, $tmp_name)===false) {
$error = true; $error = true;
Log::error(Database::get(), __METHOD__, __LINE__, 'Could not copy file (' . $tmp_name . ') to temp-folder (' . $tmp_name . ')'); Log::error(Database::get(), __METHOD__, __LINE__, 'Could not copy file (' . $url . ') to temp-folder (' . $tmp_name . ')');
continue; continue;
} }

View File

@ -70,14 +70,15 @@ final class Session {
// Call plugins // Call plugins
Plugins::get()->activate(__METHOD__, 0, func_get_args()); Plugins::get()->activate(__METHOD__, 0, func_get_args());
$username = crypt($username, Settings::get()['username']); $username_crypt = crypt($username, Settings::get()['username']);
$password = crypt($password, Settings::get()['password']); $password_crypt = crypt($password, Settings::get()['password']);
// Check login with crypted hash // Check login with crypted hash
if (Settings::get()['username']===$username&& if (Settings::get()['username']===$username_crypt&&
Settings::get()['password']===$password) { Settings::get()['password']===$password_crypt) {
$_SESSION['login'] = true; $_SESSION['login'] = true;
$_SESSION['identifier'] = Settings::get()['identifier']; $_SESSION['identifier'] = Settings::get()['identifier'];
Log::notice(Database::get(), __METHOD__, __LINE__, 'User (' . $username . ') has logged in from ' . $_SERVER['REMOTE_ADDR']);
return true; return true;
} }
@ -87,6 +88,9 @@ final class Session {
// Call plugins // Call plugins
Plugins::get()->activate(__METHOD__, 1, func_get_args()); Plugins::get()->activate(__METHOD__, 1, func_get_args());
// Log failed log in
Log::error(Database::get(), __METHOD__, __LINE__, 'User (' . $username . ') has tried to log in from ' . $_SERVER['REMOTE_ADDR']);
return false; return false;
} }

View File

@ -14,7 +14,6 @@ function getExtension($filename, $isURI = false) {
// Special cases // Special cases
// https://github.com/electerious/Lychee/issues/482 // https://github.com/electerious/Lychee/issues/482
list($extension) = explode(':', $extension, 2); list($extension) = explode(':', $extension, 2);
list($extension) = explode('?', $extension, 2);
if (empty($extension)===false) $extension = '.' . $extension; if (empty($extension)===false) $extension = '.' . $extension;