Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions php/Access/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static function init($fn) {

// Settings functions
case 'Settings::setImageOverlay': self::setImageOverlay(); break;
case 'Settings::setOverlayType': self::setOverlayType(); break;
case 'Settings::setLayout': self::setLayoutAction(); break;
case 'Settings::setLang': self::setLangAction(); break;
case 'Settings::setDefaultLicense': self::setDefaultLicenseAction(); break;
Expand Down Expand Up @@ -355,6 +356,13 @@ private static function setImageOverlay() {
Response::json(Settings::setImageOverlay($_POST['image_overlay']));
}

private static function setOverlayType() {

Validator::required(isset($_POST['image_overlay_type']), __METHOD__);

Response::json(Settings::setOverlayType($_POST['image_overlay_type']));
}

private static function setSortingAction() {

Validator::required(isset($_POST['typeAlbums'], $_POST['orderAlbums'], $_POST['typePhotos'], $_POST['orderPhotos']), __METHOD__);
Expand Down
8 changes: 7 additions & 1 deletion php/Locale/English.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static public function get_locale()
'UPDATE_AVAILABLE' => 'Update available!',
'DEFAULT_LICENSE' => 'Default license for new uploads:',
'SET_LICENSE' => 'Set License',
'SET_OVERLAY_TYPE' => 'Set Overlay',

'SMART_ALBUMS' => 'Smart albums',
'SHARED_ALBUMS' => 'Shared albums',
Expand Down Expand Up @@ -277,7 +278,12 @@ static public function get_locale()
'LANG_TITLE' => 'Change Language',

'LAYOUT_TEXT' => 'Use justified layout:',
'IMAGE_OVERLAY_TEXT' => 'Display EXIF data overlay by default:',
'IMAGE_OVERLAY_TEXT' => 'Display data overlay by default:',

'LAYOUT_TYPE' => 'Data to use in image overlay:',
'OVERLAY_EXIF' => 'Photo EXIF data',
'OVERLAY_DESCRIPTION' => 'Photo description',
'OVERLAY_DATE' => 'Photo date taken',

'VIEW_NO_RESULT' => 'No results',
'VIEW_NO_PUBLIC_ALBUMS' => 'No public albums',
Expand Down
2 changes: 1 addition & 1 deletion php/Modules/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ public static function prepareData(array $data) {
// Use takestamp
$photo['cameraDate'] = '1';
$photo['sysdate'] = strftime('%d %B %Y', substr($data['id'], 0, -4));
$photo['takedate'] = strftime('%d %B %Y', $data['takestamp']);
$photo['takedate'] = strftime('%d %B %Y - %k:%M', $data['takestamp']);

} else {

Expand Down
22 changes: 22 additions & 0 deletions php/Modules/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,28 @@ public static function setImageOverlay($imageOverlay) {
return true;
}

public static function setOverlayType($imageOverlayType) {
$overlays = [ 'exif', 'desc', 'takedate' ];

$found = false;
$i = 0;

while(!$found && $i < count($overlays)) {
if ($overlays[$i] === $imageOverlayType) $found = true;
$i++;
}

if(!$found) {
Log::error(Database::get(), __METHOD__, __LINE__, 'Cound not find the submitted overlay type');
}
else {
if (self::set('image_overlay_type', $imageOverlayType, true)===false) return false;
return true;
}
Log::error(Database::get(), __METHOD__, __LINE__, 'Could not update settings. Unknown overlay default.');
return false;

}

/**
* Sets a new sorting for the photos.
Expand Down
26 changes: 26 additions & 0 deletions php/database/update_030211.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* Update to version 3.2.11
*/

use Lychee\Modules\Database;
use Lychee\Modules\Response;

// Add image_overlay_type to settings
$query = Database::prepare($connection, "SELECT `key` FROM `?` WHERE `key` = 'image_overlay_type' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
$result = Database::execute($connection, $query, 'update_030211', __LINE__);

if ($result===false) Response::error('Could not get current image_overlay_type from database!');

if ($result->num_rows===0) {

$query = Database::prepare($connection, "INSERT INTO `?` (`key`, `value`) VALUES ('image_overlay_type', 'exif')", array(LYCHEE_TABLE_SETTINGS));
$result = Database::execute($connection, $query, 'update_030211', __LINE__);

if ($result===false) Response::error('Could not add image_overlay_type to database!');

}

// Set version
if (Database::setVersion($connection, 'update_030211')===false) Response::error('Could not update version of database!');