diff --git a/src/configs/openphoto-SUSE-vhost.conf b/src/configs/openphoto-SUSE-vhost.conf index 274ea4142..a33371e48 100644 --- a/src/configs/openphoto-SUSE-vhost.conf +++ b/src/configs/openphoto-SUSE-vhost.conf @@ -35,6 +35,7 @@ ExpiresByType image/gif "A604800" ExpiresByType image/jpg "A604800" ExpiresByType image/jpeg "A604800" + ExpiresByType image/jpe "A604800" ExpiresByType image/png "A604800" Header set Cache-Control "must-revalidate" diff --git a/src/configs/openphoto-vhost.conf b/src/configs/openphoto-vhost.conf index 2e041bd0d..26253a8ce 100644 --- a/src/configs/openphoto-vhost.conf +++ b/src/configs/openphoto-vhost.conf @@ -34,6 +34,7 @@ ExpiresByType image/gif "A604800" ExpiresByType image/jpg "A604800" ExpiresByType image/jpeg "A604800" + ExpiresByType image/jpe "A604800" ExpiresByType image/png "A604800" Header set Cache-Control "must-revalidate" diff --git a/src/html/assets/themes/default/stylesheets/setup.css b/src/html/assets/themes/default/stylesheets/setup.css index 0d5fd7ae5..8924f2bd2 100644 --- a/src/html/assets/themes/default/stylesheets/setup.css +++ b/src/html/assets/themes/default/stylesheets/setup.css @@ -5,6 +5,8 @@ div#setup h3{ font-size:1em; margin:15px 0 5px 0; } div#setup ul.errors, div#setup p.error{ color:#ca1616; } div#setup form em{ font-size:.75em; } div#setup label{ font-size:1.15em; color:#404040; display:block; position:relative; } +div#setup p{ font-size:1.0em; color:#404040; display:block; position:relative; margin-bottom:20px; } +div#setup p code{ font-size:1.0em; font-family: monospace, sans-serif; background-color:#ddd; border: 1px solid #eee; color:#404040; display:block; position:relative; } div#setup label em{ font-size:.6em; position:relative; top:-2px; left:3px; } div#setup label + input, div#setup label + textarea, div#setup label + select{ margin-bottom:20px; display:block; } div#setup{ width:400px; margin:auto; } diff --git a/src/html/index.php b/src/html/index.php index 36284499f..23c15f282 100644 --- a/src/html/index.php +++ b/src/html/index.php @@ -8,6 +8,26 @@ require sprintf('%s/libraries/initialize.php', dirname(dirname(__FILE__))); +// If custom route is not being used, try some more common routing cases +if (!isset($_GET['__route__'])) +{ + if (isset($_SERVER['PATH_INFO'])) + { + $_GET['__route__'] = $_SERVER['PATH_INFO']; + } + else if (isset($_SERVER['REQUEST_URI'])) + { + if ($request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) + { + $_GET['__route__'] = $request_uri; + } + } + else if (isset($_SERVER['PHP_SELF'])) + { + $_GET['__route__'] = $_SERVER['PHP_SELF']; + } +} + // if we're not running setup and the config file exists, proceed as normal // else no config file then load up the setup dependencies if(!$runSetup && file_exists($configFile)) diff --git a/src/libraries/controllers/ApiPhotoController.php b/src/libraries/controllers/ApiPhotoController.php index 2a28f24b6..0307d5beb 100644 --- a/src/libraries/controllers/ApiPhotoController.php +++ b/src/libraries/controllers/ApiPhotoController.php @@ -237,7 +237,7 @@ public static function upload() { unset($attributes['photo']); $localFile = tempnam(getConfig()->get('paths')->temp, 'opme'); - $name = basename($localFile).'.jpg'; + $name = basename($localFile).'.jpe'; file_put_contents($localFile, base64_decode($_POST['photo'])); $photoId = Photo::upload($localFile, $name, $attributes); } diff --git a/src/libraries/controllers/SetupController.php b/src/libraries/controllers/SetupController.php index 837ae99eb..baa9722f9 100644 --- a/src/libraries/controllers/SetupController.php +++ b/src/libraries/controllers/SetupController.php @@ -42,12 +42,24 @@ public static function setup() $theme = getTheme()->getThemeName(); $themes = getTheme()->getThemes(); - $errors = self::verifyRequirements($imageLibs); + $warnings = self::verifyRequirements($imageLibs); - if(count($errors) > 0) - $step = 0; - else - $errors = ''; + $skipConfig = 0; + foreach ($warnings as $error => $message) { + switch ($error) + { + case 'config_not_writable': + $skipConfig = 1; + $step = 1; + break; + case 'cannot_create_generated': + case 'generated_not_writable': + case 'no_image_lib': + default: + $step = 0; + break; + } + } $email = ''; if(getConfig()->get('user') != null) @@ -61,7 +73,7 @@ public static function setup() $template = sprintf('%s/setup.php', getConfig()->get('paths')->templates); $body = getTemplate()->get($template, array('filesystem' => $filesystem, 'database' => $database, 'themes' => $themes, 'theme' => $theme, - 'imageLibs' => $imageLibs, 'imageLibrary' => $imageLibrary, 'appId' => $appId, 'step' => $step, 'email' => $email, 'qs' => $qs, 'errors' => $errors)); + 'imageLibs' => $imageLibs, 'imageLibrary' => $imageLibrary, 'appId' => $appId, 'step' => $step, 'email' => $email, 'qs' => $qs, 'errors' => $warnings, 'skipConfig' => $skipConfig)); getTheme()->display('template.php', array('body' => $body, 'page' => 'setup')); } @@ -167,11 +179,12 @@ public static function setupDropboxPost() */ public static function setupPost() { - $step = 1; - $appId = isset($_POST['appId']) ? $_POST['appId'] : ''; - $email = isset($_POST['email']) ? $_POST['email'] : ''; - $theme = isset($_POST['theme']) ? $_POST['theme'] : ''; - $input = array( + $step = 1; + $appId = isset($_POST['appId']) ? $_POST['appId'] : ''; + $email = isset($_POST['email']) ? $_POST['email'] : ''; + $theme = isset($_POST['theme']) ? $_POST['theme'] : ''; + $skipConfig = isset($_POST['skipConfig']) ? $_POST['skipConfig'] : ''; + $input = array( array('Email', $email, 'required') ); @@ -182,6 +195,7 @@ public static function setupPost() getSession()->set('appId', $appId); getSession()->set('ownerEmail', $email); getSession()->set('theme', $theme); + getSession()->set('skipConfig', $skipConfig); $qs = ''; if(isset($_GET['edit'])) @@ -558,7 +572,7 @@ public static function setup3Post() { $writeError = self::writeConfigFile(); if($writeErrors === false) - getRoute()->redirect('/?m=welcome'); + getRoute()->redirect('/'); else $writeErrors[] = "We were unable to save your settings file. Please make sure that the following user has proper permissions to write to src/configs ({$user})."; } @@ -640,36 +654,40 @@ private static function getDefaultConfigParams() */ private static function verifyRequirements($imageLibs) { - $errors = array(); + $warnings = array(); $configDir = Utility::getBaseDir() . '/configs'; $generatedDir = "{$configDir}/generated"; if(file_exists($generatedDir) && is_writable($generatedDir) && !empty($imageLibs)) # No errors, return empty array - return $errors; + return $warnings; $user = exec("whoami"); if(empty($user)) $user = 'Apache user'; if(!is_writable($configDir)) - $errors[] = "Insufficient privileges to complete setup.
Copy and paste the details below into a file named in the folder
(you may have to create this folder)
Once the configuration is in place, you're done!.
+