Merge pull request #490 from qligier/pr-extension

Modifications arround getExtension
This commit is contained in:
Tobias Reich 2016-03-18 22:03:11 +01:00
commit f7b294e358
6 changed files with 9 additions and 3 deletions

BIN
dist/main.js vendored

Binary file not shown.

BIN
dist/view.js vendored

Binary file not shown.

View File

@ -278,7 +278,7 @@ final class Album {
if (!@is_readable($photo->url)) continue;
// Get extension of image
$extension = getExtension($photo->url, true);
$extension = getExtension($photo->url, false);
// Set title for photo
$zipFileName = $zipTitle . '/' . $photo->title . $extension;

View File

@ -845,7 +845,7 @@ final class Photo {
}
// Get extension
$extension = getExtension($photo->url, true);
$extension = getExtension($photo->url, false);
if (empty($extension)===true) {
Log::error(Database::get(), __METHOD__, __LINE__, 'Invalid photo extension');
return false;

View File

@ -6,11 +6,14 @@
*/
function getExtension($filename, $isURI = false) {
// If $filename is an URI, get only the path component
# If $filename is an URI, get only the path component
if ($isURI===true) $filename = parse_url($filename, PHP_URL_PATH);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
# Special cases
if (strpos($extension, ':')!==false) list($extension, ) = explode(':', $extension, 2);
if (empty($extension)===false) $extension = '.' . $extension;
return $extension;

View File

@ -275,11 +275,14 @@ upload.start = {
basicModal.close()
/*
// Only check for file validity on PHP side
let extension = data.link.split('.').pop()
if (extension!=='jpeg' && extension!=='jpg' && extension!=='png' && extension!=='gif' && extension!=='webp') {
loadingBar.show('error', 'File format of link not supported.')
return false
}
*/
files[0] = {
name : data.link,