12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- if (isset($_POST['function'])) $fn = $_POST['function'];
- else if (isset($_GET['function'])) $fn = $_GET['function'];
- else $fn = null;
- if (!empty($fn)) {
-
- session_start();
- date_default_timezone_set('UTC');
-
- require(__DIR__ . '/define.php');
- require(__DIR__ . '/autoload.php');
- require(__DIR__ . '/modules/misc.php');
-
- if (isset($_POST['albumIDs'])&&preg_match('/^[0-9\,]{1,}$/', $_POST['albumIDs'])!==1) exit('Error: Wrong parameter type for albumIDs!');
- if (isset($_POST['photoIDs'])&&preg_match('/^[0-9\,]{1,}$/', $_POST['photoIDs'])!==1) exit('Error: Wrong parameter type for photoIDs!');
- if (isset($_POST['albumID'])&&preg_match('/^[0-9sfr]{1,}$/', $_POST['albumID'])!==1) exit('Error: Wrong parameter type for albumID!');
- if (isset($_POST['photoID'])&&preg_match('/^[0-9]{14}$/', $_POST['photoID'])!==1) exit('Error: Wrong parameter type for photoID!');
-
- if (file_exists(LYCHEE_CONFIG_FILE)) require(LYCHEE_CONFIG_FILE);
- else {
-
-
-
-
- define('LYCHEE_ACCESS_INSTALLATION', true);
- $installation = new Installation(null, null, null);
- $installation->check($_POST['function']);
- exit();
- }
-
- defineTablePrefix(@$dbTablePrefix);
-
- $database = Database::connect($dbHost, $dbUser, $dbPassword, $dbName);
-
- $settings = new Settings($database);
- $settings = $settings->get();
-
- $plugins = explode(';', $settings['plugins']);
- $plugins = new Plugins($plugins, $database, $settings);
-
- if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
- (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
-
-
-
-
- define('LYCHEE_ACCESS_ADMIN', true);
- $admin = new Admin($database, $plugins, $settings);
- $admin->check($fn);
- } else {
-
-
-
-
- define('LYCHEE_ACCESS_GUEST', true);
- $guest = new Guest($database, $plugins, $settings);
- $guest->check($fn);
- }
- } else {
- exit('Error: No API function specified!');
- }
- ?>
|