Typewriter apostrophe

This commit is contained in:
Tobias Reich 2014-02-08 17:52:38 +01:00
parent f671077c26
commit 96bd4a5e90
2 changed files with 8 additions and 16 deletions

View File

@ -2,7 +2,6 @@
/** /**
* @name API * @name API
* @author Philipp Maurer
* @author Tobias Reich * @author Tobias Reich
* @copyright 2014 by Philipp Maurer, Tobias Reich * @copyright 2014 by Philipp Maurer, Tobias Reich
*/ */

View File

@ -23,32 +23,25 @@ function dbConnect() {
if (!$database->select_db($dbName)) if (!$database->select_db($dbName))
if (!dbCreate($dbName, $database)) exit('Error: Could not create database!'); if (!dbCreate($dbName, $database)) exit('Error: Could not create database!');
dbCheck($database); if (!$database->query('SELECT * FROM lychee_photos, lychee_albums, lychee_settings LIMIT 0;'))
if (!dbCreateTables($database)) exit('Error: Could not create tables!');
return $database; return $database;
} }
function dbCheck($database) {
if (!$database->query("SELECT * FROM lychee_photos, lychee_albums, lychee_settings LIMIT 1;"))
if (!dbCreateTables($database)) exit('Error: Could not create tables!');
}
function dbCreateConfig($dbHost = 'localhost', $dbUser, $dbPassword, $dbName = 'lychee') { function dbCreateConfig($dbHost = 'localhost', $dbUser, $dbPassword, $dbName = 'lychee') {
$dbPassword = urldecode($dbPassword); $dbPassword = urldecode($dbPassword);
$database = new mysqli($dbHost, $dbUser, $dbPassword); $database = new mysqli($dbHost, $dbUser, $dbPassword);
if ($database->connect_errno) return "Warning: Connection failed!"; if ($database->connect_errno) return 'Warning: Connection failed!';
else { else {
$config = "<?php $config = "<?php
/** /**
* @name Config * @name Config
* @author Philipp Maurer
* @author Tobias Reich * @author Tobias Reich
* @copyright 2014 by Philipp Maurer, Tobias Reich * @copyright 2014 by Philipp Maurer, Tobias Reich
*/ */
@ -66,7 +59,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
?>"; ?>";
if (file_put_contents("../data/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;
@ -90,7 +83,7 @@ function dbCreate($dbName, $database) {
function dbCreateTables($database) { function dbCreateTables($database) {
if (!$database->query("SELECT * FROM lychee_settings LIMIT 1;")) { if (!$database->query('SELECT * FROM lychee_settings LIMIT 0;')) {
$query = " $query = "
@ -120,7 +113,7 @@ function dbCreateTables($database) {
} }
if (!$database->query("SELECT * FROM lychee_albums LIMIT 1;")) { if (!$database->query('SELECT * FROM lychee_albums LIMIT 0;')) {
$query = " $query = "
@ -140,7 +133,7 @@ function dbCreateTables($database) {
} }
if (!$database->query("SELECT * FROM lychee_photos LIMIT 1;")) { if (!$database->query('SELECT * FROM lychee_photos LIMIT 0;')) {
$query = " $query = "
@ -186,7 +179,7 @@ function dbClose() {
global $database; global $database;
if (!$database->close()) exit("Error: Closing the connection failed!"); if (!$database->close()) exit('Error: Closing the connection failed!');
return true; return true;