Config in data/

This commit is contained in:
Tobias Reich 2014-02-08 00:08:18 +01:00
parent c91b2829e6
commit 4fd302f3d0
9 changed files with 75 additions and 63 deletions

0
data/.gitignore vendored Normal file → Executable file
View File

View File

@ -17,11 +17,19 @@ To use Lychee without restrictions, we recommend to increase the values of the f
upload_max_filesize = 20M upload_max_filesize = 20M
max_file_uploads = 100 max_file_uploads = 100
### Download Lychee
The easiest way to download Lychee is with git:
git clone https://github.com/electerious/Lychee.git
You can also use the [direct download](https://github.com/electerious/Lychee/archive/master.zip).
### Folder permissions ### Folder permissions
Change the permissions of `uploads/` and `php/` to 777, including all subfolders: Change the permissions of `uploads/` and `data/` to 777, including all subfolders:
chmod -R 777 uploads/ php/ chmod -R 777 uploads/ data/
### Lychee installation ### Lychee installation

View File

@ -27,7 +27,7 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
require('modules/tags.php'); require('modules/tags.php');
require('modules/misc.php'); require('modules/misc.php');
if (file_exists('config.php')) require('config.php'); if (file_exists('../data/config.php')) require('../data/config.php');
else { else {
/** /**

View File

@ -237,53 +237,54 @@ function getAlbumArchive($albumID) {
global $database; global $database;
switch($albumID) { switch($albumID) {
case 's': case 's':
$query = "SELECT * FROM lychee_photos WHERE public = '1';"; $query = "SELECT * FROM lychee_photos WHERE public = '1';";
$zipTitle = "Public"; $zipTitle = "Public";
break; break;
case 'f': case 'f':
$query = "SELECT * FROM lychee_photos WHERE star = '1';"; $query = "SELECT * FROM lychee_photos WHERE star = '1';";
$zipTitle = "Starred"; $zipTitle = "Starred";
break; break;
default: default:
$query = "SELECT * FROM lychee_photos WHERE album = '$albumID';"; $query = "SELECT * FROM lychee_photos WHERE album = '$albumID';";
$zipTitle = "Unsorted"; $zipTitle = "Unsorted";
} }
$result = $database->query($query); $zip = new ZipArchive();
$files = array(); $result = $database->query($query);
$i=0; $files = array();
while($row = $result->fetch_object()) { $i=0;
$files[$i] = "../uploads/big/".$row->url;
$i++;
}
$result = $database->query("SELECT * FROM lychee_albums WHERE id = '$albumID';");
$row = $result->fetch_object();
if ($albumID!=0&&is_numeric($albumID))$zipTitle = $row->title;
$filename = "../uploads/".$zipTitle.".zip";
$zip = new ZipArchive(); while($row = $result->fetch_object()) {
$files[$i] = "../uploads/big/".$row->url;
$i++;
}
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) { $result = $database->query("SELECT * FROM lychee_albums WHERE id = '$albumID';");
return false; $row = $result->fetch_object();
} if ($albumID!=0&&is_numeric($albumID)) $zipTitle = $row->title;
$filename = "../data/$zipTitle.zip";
foreach($files AS $zipFile) { if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
$newFile = explode("/",$zipFile); return false;
$newFile = array_reverse($newFile); }
$zip->addFile($zipFile, $zipTitle."/".$newFile[0]);
}
$zip->close(); foreach($files AS $zipFile) {
$newFile = explode("/",$zipFile);
$newFile = array_reverse($newFile);
$zip->addFile($zipFile, $zipTitle."/".$newFile[0]);
}
header("Content-Type: application/zip"); $zip->close();
header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
header("Content-Length: ".filesize($filename));
readfile($filename);
unlink($filename);
return true; header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=\"$zipTitle.zip\"");
header("Content-Length: ".filesize($filename));
readfile($filename);
unlink($filename);
return true;
} }

View File

@ -61,6 +61,9 @@ $config = "<?php
if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
// Config version
\$configVersion = '2.1';
// Database configurations // Database configurations
\$dbHost = '$dbHost'; //Host of the Database \$dbHost = '$dbHost'; //Host of the Database
\$dbUser = '$dbUser'; //Username of the database \$dbUser = '$dbUser'; //Username of the database
@ -69,7 +72,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
?>"; ?>";
if (file_put_contents("config.php", $config)===false) return "Warning: Could not create file!"; if (file_put_contents("../data/config.php", $config)===false) return "Warning: Could not create file!";
else { else {
$_SESSION['login'] = true; $_SESSION['login'] = true;

0
php/modules/tags.php Normal file → Executable file
View File

View File

@ -16,8 +16,8 @@ header('content-type: text/plain');
$error = ''; $error = '';
// Include // Include
if (!file_exists('../php/config.php')) exit('Error 001: Configuration not found. Please install Lychee first.'); if (!file_exists('../data/config.php')) exit('Error 001: Configuration not found. Please install Lychee first.');
require('../php/config.php'); require('../data/config.php');
require('../php/modules/settings.php'); require('../php/modules/settings.php');
// Database // Database
@ -54,7 +54,7 @@ if (substr(sprintf('%o', @fileperms('../uploads/big/')), -4)!='0777') $error .=
if (substr(sprintf('%o', @fileperms('../uploads/thumb/')), -4)!='0777') $error .= ('Error 501: Wrong permissions for \'uploads/thumb\' (777 required)' . PHP_EOL); if (substr(sprintf('%o', @fileperms('../uploads/thumb/')), -4)!='0777') $error .= ('Error 501: Wrong permissions for \'uploads/thumb\' (777 required)' . PHP_EOL);
if (substr(sprintf('%o', @fileperms('../uploads/import/')), -4)!='0777') $error .= ('Error 502: Wrong permissions for \'uploads/import\' (777 required)' . PHP_EOL); if (substr(sprintf('%o', @fileperms('../uploads/import/')), -4)!='0777') $error .= ('Error 502: Wrong permissions for \'uploads/import\' (777 required)' . PHP_EOL);
if (substr(sprintf('%o', @fileperms('../uploads/')), -4)!='0777') $error .= ('Error 503: Wrong permissions for \'uploads/\' (777 required)' . PHP_EOL); if (substr(sprintf('%o', @fileperms('../uploads/')), -4)!='0777') $error .= ('Error 503: Wrong permissions for \'uploads/\' (777 required)' . PHP_EOL);
if (substr(sprintf('%o', @fileperms('../php/')), -4)!='0777') $error .= ('Error 504: Wrong permissions for \'php/\' (777 required)' . PHP_EOL); if (substr(sprintf('%o', @fileperms('../data/')), -4)!='0777') $error .= ('Error 504: Wrong permissions for \'data/\' (777 required)' . PHP_EOL);
if ($error=='') echo('Lychee is ready. Lets rock!' . PHP_EOL . PHP_EOL); else echo $error; if ($error=='') echo('Lychee is ready. Lets rock!' . PHP_EOL . PHP_EOL); else echo $error;

View File

@ -17,11 +17,11 @@ You can use Lychee right after the installation. Here are some advanced features
### Settings ### Settings
Sign in and click the gear on the top left corner to change your settings. If you want to edit them manually: MySQL details are stored in `php/config.php`. Other options and settings are stored directly in the database. [Settings &#187;](docs/md/Settings.md) Sign in and click the gear on the top left corner to change your settings. If you want to edit them manually: MySQL details are stored in `data/config.php`. Other options and settings are stored directly in the database. [Settings &#187;](docs/md/Settings.md)
### Update ### Update
1. Replace all files, excluding `uploads/` 1. Replace all files, excluding `uploads/` and `data/`
2. Open Lychee and enter your database details 2. Open Lychee and enter your database details
### FTP Upload ### FTP Upload

View File

@ -24,7 +24,7 @@
define("LYCHEE", true); define("LYCHEE", true);
require("php/config.php"); require("data/config.php");
require("php/modules/db.php"); require("php/modules/db.php");
require("php/modules/misc.php"); require("php/modules/misc.php");