Merge branch 'v2.5' of https://github.com/electerious/Lychee into uploader
Conflicts: assets/min/main.js
This commit is contained in:
commit
f90bfe0086
@ -277,7 +277,7 @@ album = {
|
||||
|
||||
if (!visible.message()&&album.json.public==0) {
|
||||
|
||||
modal.show("Share Album", "This album will be shared with one of the following properties:</p><form><div class='choice'><input type='radio' value='public' name='choice' checked><h2>Public</h2><p>The album can be shared and will be visible for everyone.</p></div><div class='choice'><input type='radio' value='password' name='choice'><h2>Password protected</h2><p>The album can be shared with everyone, but is only accessible with a valid password and won't be listed to visitors of your Lychee.<input class='text' type='password' placeholder='password' value='' style='display: none;'></p></div></form><p style='display: none;'>", [["Share Album", function() { album.setPublic(album.getID(), e) }], ["Cancel", function() {}]], -160);
|
||||
modal.show("Share Album", "This album will be shared with one of the following properties:</p><form><div class='choice'><input type='radio' value='public' name='choice' checked><h2>Public</h2><p>Visible and accessible for everyone.</p></div><div class='choice'><input type='radio' value='password' name='choice'><h2>Password protected</h2><p>Not visible to visitors and only accessible with a valid password.<input class='text' type='password' placeholder='password' value='' style='display: none;'></p></div></form><p style='display: none;'>", [["Share Album", function() { album.setPublic(album.getID(), e) }], ["Cancel", function() {}]], -160);
|
||||
|
||||
$(".message .choice input:radio").on("change", function() {
|
||||
|
||||
|
@ -99,7 +99,7 @@ $(document).ready(function(){
|
||||
})
|
||||
.bind(['i', 'ctrl+i'], function() {
|
||||
if (visible.infobox()) view.infobox.hide();
|
||||
else if (!visible.albums()) view.infobox.show();
|
||||
else if (visible.infoboxbutton()) view.infobox.show();
|
||||
})
|
||||
.bind(['command+backspace', 'ctrl+backspace'], function() {
|
||||
if (visible.photo()&&!visible.message()) photo.delete([photo.getID()]);
|
||||
|
@ -32,6 +32,13 @@ visible = {
|
||||
else return false;
|
||||
},
|
||||
|
||||
infoboxbutton: function() {
|
||||
if (visible.albums()) return false;
|
||||
if (visible.photo()) return true;
|
||||
if (visible.album()&&$('#button_info_album:visible').length>0) return true;
|
||||
else return false;
|
||||
},
|
||||
|
||||
controls: function() {
|
||||
if (lychee.loadingBar.css('opacity')<1) return false;
|
||||
else return true;
|
||||
|
File diff suppressed because one or more lines are too long
@ -292,8 +292,7 @@ class Album extends Module {
|
||||
if (!@is_readable($photo->url)) continue;
|
||||
|
||||
# Get extension of image
|
||||
$extension = array_reverse(explode('.', $photo->url));
|
||||
$extension = $extension[0];
|
||||
$extension = getExtension($photo->url);
|
||||
|
||||
# Set title for photo
|
||||
$zipFileName = $zipTitle . '/' . $photo->title . '.' . $extension;
|
||||
@ -304,7 +303,7 @@ class Album extends Module {
|
||||
while (in_array($zipFileName, $files)) {
|
||||
|
||||
# Set new title for photo
|
||||
$zipFileName = $zipTitle . '/' . $photo->title . '-' . $i . '.' . $extension;
|
||||
$zipFileName = $zipTitle . '/' . $photo->title . '-' . $i . $extension;
|
||||
|
||||
$i++;
|
||||
|
||||
@ -428,7 +427,7 @@ class Album extends Module {
|
||||
$public = ($album->public=='0' ? 1 : 0);
|
||||
|
||||
# Set public
|
||||
$result = $this->database->query("UPDATE lychee_albums SET public = '$public', password = NULL WHERE id = '$album->id';");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET public = '$public', visible = 1, password = NULL WHERE id = '$album->id';");
|
||||
if (!$result) {
|
||||
Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
|
||||
return false;
|
||||
@ -469,12 +468,12 @@ class Album extends Module {
|
||||
$password = get_hashed_password($password);
|
||||
|
||||
# Set hashed password
|
||||
$result = $this->database->query("UPDATE lychee_albums SET password = '$password' WHERE id IN ('$this->albumIDs');");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET visible = 0, password = '$password' WHERE id IN ('$this->albumIDs');");
|
||||
|
||||
} else {
|
||||
|
||||
# Unset password
|
||||
$result = $this->database->query("UPDATE lychee_albums SET password = NULL WHERE id IN ('$this->albumIDs');");
|
||||
$result = $this->database->query("UPDATE lychee_albums SET visible = 1, password = NULL WHERE id IN ('$this->albumIDs');");
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Photo extends Module {
|
||||
foreach ($files as $file) {
|
||||
|
||||
# Verify extension
|
||||
$extension = $this->getExtension($file['name']);
|
||||
$extension = getExtension($file['name']);
|
||||
if (!in_array(strtolower($extension), $this->validExtensions, true)) continue;
|
||||
|
||||
# Verify image
|
||||
@ -517,7 +517,7 @@ class Photo extends Module {
|
||||
$photo = $photos->fetch_object();
|
||||
|
||||
# Get extension
|
||||
$extension = $this->getExtension($photo->url);
|
||||
$extension = getExtension($photo->url);
|
||||
if ($extension===false) {
|
||||
Log::error($this->database, __METHOD__, __LINE__, 'Invalid photo extension');
|
||||
return false;
|
||||
@ -528,7 +528,7 @@ class Photo extends Module {
|
||||
|
||||
# Set headers
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Disposition: attachment; filename=\"$photo->title.$extension[0]\"");
|
||||
header("Content-Disposition: attachment; filename=\"" . $photo->title . $extension . "\"");
|
||||
header("Content-Length: " . filesize(LYCHEE_UPLOADS_BIG . $photo->url));
|
||||
|
||||
# Send file
|
||||
@ -541,16 +541,6 @@ class Photo extends Module {
|
||||
|
||||
}
|
||||
|
||||
public function getExtension($filename) {
|
||||
|
||||
$extension = strpos($filename, '.') !== false
|
||||
? strrchr($filename, '.')
|
||||
: '';
|
||||
|
||||
return $extension;
|
||||
|
||||
}
|
||||
|
||||
public function setTitle($title) {
|
||||
|
||||
# Check dependencies
|
||||
|
@ -9,36 +9,6 @@
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
|
||||
function getGraphHeader($database, $photoID) {
|
||||
|
||||
if (!isset($database, $photoID)) return false;
|
||||
|
||||
$photoID = mysqli_real_escape_string($database, $photoID);
|
||||
|
||||
$result = $database->query("SELECT title, description, url FROM lychee_photos WHERE id = '$photoID';");
|
||||
$row = $result->fetch_object();
|
||||
|
||||
$parseUrl = parse_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
||||
$picture = $parseUrl['scheme']."://".$parseUrl['host'].$parseUrl['path']."/../uploads/big/".$row->url;
|
||||
|
||||
$return = '<!-- General Meta Data -->';
|
||||
$return .= '<meta name="title" content="'.$row->title.'" />';
|
||||
$return .= '<meta name="description" content="'.$row->description.' - via Lychee" />';
|
||||
$return .= '<link rel="image_src" type="image/jpeg" href="'.$picture.'" />';
|
||||
|
||||
$return .= '<!-- Twitter Meta Data -->';
|
||||
$return .= '<meta name="twitter:card" content="photo">';
|
||||
$return .= '<meta name="twitter:title" content="'.$row->title.'">';
|
||||
$return .= '<meta name="twitter:image:src" content="'.$picture.'">';
|
||||
|
||||
$return .= '<!-- Facebook Meta Data -->';
|
||||
$return .= '<meta property="og:title" content="'.$row->title.'">';
|
||||
$return .= '<meta property="og:image" content="'.$picture.'">';
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
function search($database, $settings, $term) {
|
||||
|
||||
if (!isset($database, $settings, $term)) return false;
|
||||
@ -80,6 +50,46 @@ function search($database, $settings, $term) {
|
||||
|
||||
}
|
||||
|
||||
function getGraphHeader($database, $photoID) {
|
||||
|
||||
if (!isset($database, $photoID)) return false;
|
||||
|
||||
$photoID = mysqli_real_escape_string($database, $photoID);
|
||||
|
||||
$result = $database->query("SELECT title, description, url FROM lychee_photos WHERE id = '$photoID';");
|
||||
$row = $result->fetch_object();
|
||||
|
||||
$parseUrl = parse_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
||||
$picture = $parseUrl['scheme']."://".$parseUrl['host'].$parseUrl['path']."/../uploads/big/".$row->url;
|
||||
|
||||
$return = '<!-- General Meta Data -->';
|
||||
$return .= '<meta name="title" content="'.$row->title.'" />';
|
||||
$return .= '<meta name="description" content="'.$row->description.' - via Lychee" />';
|
||||
$return .= '<link rel="image_src" type="image/jpeg" href="'.$picture.'" />';
|
||||
|
||||
$return .= '<!-- Twitter Meta Data -->';
|
||||
$return .= '<meta name="twitter:card" content="photo">';
|
||||
$return .= '<meta name="twitter:title" content="'.$row->title.'">';
|
||||
$return .= '<meta name="twitter:image:src" content="'.$picture.'">';
|
||||
|
||||
$return .= '<!-- Facebook Meta Data -->';
|
||||
$return .= '<meta property="og:title" content="'.$row->title.'">';
|
||||
$return .= '<meta property="og:image" content="'.$picture.'">';
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
function getExtension($filename) {
|
||||
|
||||
$extension = strpos($filename, '.') !== false
|
||||
? strrchr($filename, '.')
|
||||
: '';
|
||||
|
||||
return $extension;
|
||||
|
||||
}
|
||||
|
||||
function get_hashed_password($password) {
|
||||
|
||||
# Inspired by http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/
|
||||
|
@ -13,6 +13,7 @@ $lychee = __DIR__ . '/../../';
|
||||
# Load requirements
|
||||
require($lychee . 'php/define.php');
|
||||
require($lychee . 'php/autoload.php');
|
||||
require($lychee . 'php/modules/misc.php');
|
||||
|
||||
# Set content
|
||||
header('content-type: text/plain');
|
||||
@ -53,22 +54,23 @@ if (!isset($dbHost)||$dbHost==='') $error .= ('Error 403: No property for $dbHos
|
||||
if (!isset($settings['username'])||$settings['username']=='') $error .= ('Error 404: Username empty or not set in database' . PHP_EOL);
|
||||
if (!isset($settings['password'])||$settings['password']=='') $error .= ('Error 405: Password empty or not set in database' . PHP_EOL);
|
||||
if (!isset($settings['thumbQuality'])||$settings['thumbQuality']=='') $error .= ('Error 406: No or wrong property for thumbQuality in database' . PHP_EOL);
|
||||
if (!isset($settings['sorting'])||$settings['sorting']=='') $error .= ('Error 407: Wrong property for sorting in database' . PHP_EOL);
|
||||
if (!isset($settings['sorting'])||$settings['sorting']=='') $error .= ('Error 407: Wrong property for sorting in database' . PHP_EOL);
|
||||
if (!isset($settings['plugins'])) $error .= ('Error 408: No property for plugins in database' . PHP_EOL);
|
||||
if (!isset($settings['checkForUpdates'])||($settings['checkForUpdates']!='0'&&$settings['checkForUpdates']!='1')) $error .= ('Error 409: No or wrong property for checkForUpdates in database' . PHP_EOL);
|
||||
|
||||
# Permissions
|
||||
if (substr(sprintf('%o', @fileperms(LYCHEE_UPLOADS_BIG)), -4)!='0777') $error .= ('Error 500: Wrong permissions for \'uploads/big\' (777 required)' . PHP_EOL);
|
||||
if (substr(sprintf('%o', @fileperms(LYCHEE_UPLOADS_THUMB)), -4)!='0777') $error .= ('Error 501: Wrong permissions for \'uploads/thumb\' (777 required)' . PHP_EOL);
|
||||
if (substr(sprintf('%o', @fileperms(LYCHEE_UPLOADS_IMPORT)), -4)!='0777') $error .= ('Error 502: Wrong permissions for \'uploads/import\' (777 required)' . PHP_EOL);
|
||||
if (substr(sprintf('%o', @fileperms(LYCHEE_UPLOADS)), -4)!='0777') $error .= ('Error 503: Wrong permissions for \'uploads/\' (777 required)' . PHP_EOL);
|
||||
if (substr(sprintf('%o', @fileperms(LYCHEE_DATA)), -4)!='0777') $error .= ('Error 504: Wrong permissions for \'data/\' (777 required)' . PHP_EOL);
|
||||
if (hasPermissions(LYCHEE_UPLOADS_BIG)===false) $error .= ('Error 500: Wrong permissions for \'uploads/big\' (777 required)' . PHP_EOL);
|
||||
if (hasPermissions(LYCHEE_UPLOADS_THUMB)===false) $error .= ('Error 501: Wrong permissions for \'uploads/thumb\' (777 required)' . PHP_EOL);
|
||||
if (hasPermissions(LYCHEE_UPLOADS_IMPORT)===false) $error .= ('Error 502: Wrong permissions for \'uploads/import\' (777 required)' . PHP_EOL);
|
||||
if (hasPermissions(LYCHEE_UPLOADS)===false) $error .= ('Error 503: Wrong permissions for \'uploads/\' (777 required)' . PHP_EOL);
|
||||
if (hasPermissions(LYCHEE_DATA)===false) $error .= ('Error 504: Wrong permissions for \'data/\' (777 required)' . PHP_EOL);
|
||||
|
||||
# Output
|
||||
if ($error=='') echo('Everything is fine. Lychee should work without problems!' . PHP_EOL . PHP_EOL); else echo $error;
|
||||
if ($error=='') echo('Everything is fine. Lychee should work without problems!' . PHP_EOL . PHP_EOL);
|
||||
else echo $error;
|
||||
|
||||
# Check dropboxKey
|
||||
if (!$settings['dropboxKey']) echo('Warning: Dropbox import not working. No property for dropboxKey.' . PHP_EOL);
|
||||
if (!$settings['dropboxKey']) echo('Warning: Dropbox import not working. No property for dropboxKey.' . PHP_EOL);
|
||||
|
||||
# Check php.ini Settings
|
||||
if (ini_get('max_execution_time')<200&&ini_set('upload_max_filesize', '20M')===false) echo('Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.' . PHP_EOL);
|
||||
|
54
plugins/displaylog/index.php
Normal file
54
plugins/displaylog/index.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
###
|
||||
# @name Display Log Plugin
|
||||
# @author Tobias Reich
|
||||
# @copyright 2014 by Tobias Reich
|
||||
# @description This file queries the database for log messages and displays them if present.
|
||||
###
|
||||
|
||||
# Location
|
||||
$lychee = __DIR__ . '/../../';
|
||||
|
||||
# Load requirements
|
||||
require($lychee . 'php/define.php');
|
||||
require($lychee . 'php/autoload.php');
|
||||
require($lychee . 'php/modules/misc.php');
|
||||
|
||||
# Set content
|
||||
header('content-type: text/plain');
|
||||
|
||||
# Load config
|
||||
if (!file_exists(LYCHEE_CONFIG_FILE)) exit('Error 001: Configuration not found. Please install Lychee first.');
|
||||
require(LYCHEE_CONFIG_FILE);
|
||||
|
||||
# Declare
|
||||
$result = '';
|
||||
|
||||
# Database
|
||||
$database = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);
|
||||
|
||||
if (mysqli_connect_errno()!=0) {
|
||||
echo 'Error 100: ' . mysqli_connect_errno() . ': ' . mysqli_connect_error() . '' . PHP_EOL;
|
||||
exit();
|
||||
}
|
||||
|
||||
# Result
|
||||
$result = $database->query('SELECT FROM_UNIXTIME(time), type, function, line, text FROM lychee_log;');
|
||||
|
||||
# Output
|
||||
if ($result === FALSE) {
|
||||
echo('Everything looks fine, Lychee has not reported any problems!' . PHP_EOL . PHP_EOL);
|
||||
} else {
|
||||
while ( $row = $result->fetch_row() ) {
|
||||
|
||||
# Encode result before printing
|
||||
htmlentities($row);
|
||||
|
||||
# Format: time TZ - type - function(line) - text
|
||||
printf ("%s %s - %s - %s (%s) \t- %s\n", $row[0], date_default_timezone_get(), $row[1], $row[2], $row[3], $row[4]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user