I searched a gallery that is easy to set up and configure, and doesn't rely on a database like mysql. So I've found Gallery, installed it and it is good.
But some users couldn't log in? I've seen that gallery relies on cookie-based session management although transparent sid support was enabled.
But I wanted my users to be able to log in although cookies may be disabled in their browsers...
I've tested it on a linux box with PHP 4.3.10-16 and gallery 1.5.4. It first tries to use cookies and if not possible, puts session id in url.
It worked well for my basic purposes: predefined users (I didn't test registration) are allowed to log in, view albums/photos, upload new photos and post comments.
This is no official code, it has not been tested in every detail and you may use it at your own risk!
If not already done in php.ini, enable transparent sid support and specify temp folder in php.ini or in gallery folder's .htaccess file.
.htaccess:
php_flag session.use_trans_sid on
php_value session.save_path "/path_to_some_writable_temp_folder"
Code changes:
++ changes for using gallery with cookies disabled
albums.php:
27a28,37
> // test cookie
> if (!isset($_COOKIE[session_name()])) {
> if (ini_get('session.use_cookies')) {
> if (!isset($_REQUEST['sid'])) {
> setcookie(session_name(), '123', NULL, '/');
> $gallery->CookieSet = 1;
> }
> }
> }
>
login.php:
49c49,53
< dismissAndReload();
---
> if (isset($_COOKIE[session_name()])) {
> dismissAndReload();
> } else {
> dismissAndLoad(makeGalleryUrl("albums.php"));
> }
lib/url.php:
217a218,222
> // append SessionID, if necessary
> if (!isset($_COOKIE[session_name()]) && $gallery->CookieSet <> 1) {
> $args[session_name()] = session_id();
> }
>
session.php:
98c98
< session_name('GallerySession');
---
> session_name('sid');
--
Allow logged-in users to freely select displayed name (if comments_anonymous is enabled)
classes/Comment.php:
60c60,63
< if (!$user->isPseudo()) {
---
> if ($gallery->app->comments_anonymous == 'yes') {
> $name = $this->name;
> } else {
> //if (!$user->isPseudo()) {
If you don't have access to syslog, redirect these messages to log file in gallery subfolder log.
util.php:
38a39,45
> function write2log($logString) {
> $fp = fopen (dirname(__FILE__) . "/log/gallery.log", "a");
> $date_time = date("d.m.y H:i:s ");
> fwrite($fp, $date_time.$logString."\n");
> fclose ($fp);
> }
>
145a153
> write2log($message);