diff -r 9dbd5193ff4b README_VERSION_COLAS.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README_VERSION_COLAS.txt Tue Aug 19 01:24:05 2008 +0200
@@ -0,0 +1,42 @@
+This is my phpgraphy version, with some patches.
+(based on phpgraphy-0.9.13b).
+
+These patches will work only on linux+apache.
+And I only made the language files changes for english & french.
+I will try to maintain them against changes to phpgraphy.
+
+ * a new link is added at the top right to download a whole album as a zip
+ file (only the top-level images, do not recurse). The zip file is
+ saved in a tmp dir at the root of the site.
+ This is done by the "zipdir" bash
+ file in the new "cgi/" subdir, using the "zip" command. To be able
+ to execute zipdir as a cgi script, a ".htaccess" file is provided in
+ the cgi/ dir. If you are not using apache in "AllowOverride All" mode
+ please configure your web server to make cgi/zipdir a working cgi script.
+
+ * some texts have non-breaking spaces instead of spaces in them for a
+ better layout
+
+ * the righmost menu has line breaks between items for a better layout
+
+NOTE: you may want to clean the tmp dir from old files by a crontab entry
+like:
+00 06 * * * find your-phpgraphy-dir/tmp -type f -mtime +30 -exec rm {} \;
+(This entry cleans old caches older than 30 days)
+
+See http://colas.nahaboo.net/Software/PhpGraphy
+
+Colas Nahaboo - http://colas.nahaboo.net
+
+Files modified:
+ * base/lang/lang_en.inc.php
+ * base/lang/lang_fr.inc.php
+ * index.php
+Files added:
+ * README_VERSION_COLAS.txt
+ * cgi/zipdir
+ * cgi/.htaccess
+Install by (if DIR is where you installed phpgraphy):
+ * rsync -av --exclude='.hg*' . $DIR/.
+ * chmod -R a+rwX $DIR 2>/dev/null
+
diff -r 9dbd5193ff4b base/lang/lang_en.inc.php
--- a/base/lang/lang_en.inc.php Sat Aug 16 12:52:49 2008 +0200
+++ b/base/lang/lang_en.inc.php Tue Aug 19 01:24:05 2008 +0200
@@ -61,10 +61,10 @@
// Picture/Thumbs viewing/navigation
$txt_files='file(s)';
$txt_dirs='dir(s)';
-$txt_last_commented="last commented pictures";
-$txt_top_rated="top rated pictures";
-$txt_last_added="last added pictures";
-$txt_last_added_per_directory="last added pictures per directory";
+$txt_last_commented="last commented pictures";
+$txt_top_rated="top rated pictures";
+$txt_last_added="last added pictures";
+$txt_last_added_per_directory="last added pictures per directory";
// Rating (if activated)
$txt_no_rating="";
@@ -164,6 +164,9 @@
$txt['Slideshow faster'] = '-';
$txt['Slideshow hide captions'] = 'hide captions';
$txt['Slideshow show captions'] = 'show captions';
+
+// DOWNLOAD_ALBUM
+$txt['download_album'] = 'download the whole album';
/********************************************************************************
* ADMIN Section
diff -r 9dbd5193ff4b base/lang/lang_fr.inc.php
--- a/base/lang/lang_fr.inc.php Sat Aug 16 12:52:49 2008 +0200
+++ b/base/lang/lang_fr.inc.php Tue Aug 19 01:24:05 2008 +0200
@@ -60,10 +60,10 @@
// Picture/Thumbs viewing/naviguation
$txt_files='fichier(s)';
$txt_dirs='rep(s)';
-$txt_last_commented="dernières images commentées";
-$txt_top_rated="images les mieux notées";
-$txt_last_added="dernières images rajoutées";
-$txt_last_added_per_directory="dernières images rajoutées par répertoire";
+$txt_last_commented="dernières images commentées";
+$txt_top_rated="images les mieux notées";
+$txt_last_added="dernières images rajoutées";
+$txt_last_added_per_directory="dernières images rajoutées par répertoire";
// Rating (if activated)
@@ -164,6 +164,9 @@
$txt['Slideshow faster'] = '-';
$txt['Slideshow hide captions'] = 'cacher la légende';
$txt['Slideshow show captions'] = 'afficher la légende';
+
+// DOWNLOAD_ALBUM
+$txt['download_album'] = "télécharger tout l'album";
/********************************************************************************
* ADMIN Section
diff -r 9dbd5193ff4b cgi/.htaccess
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi/.htaccess Tue Aug 19 01:24:05 2008 +0200
@@ -0,0 +1,2 @@
+SetHandler cgi-script
+Options +ExecCGI
diff -r 9dbd5193ff4b cgi/zipdir
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi/zipdir Tue Aug 19 01:24:05 2008 +0200
@@ -0,0 +1,50 @@
+#!/bin/bash
+shopt -s nullglob
+
+# found on http://geni.ath.cx/unix.html
+urldecode(){
+ echo -e "$(sed 'y/+/ /; s/%/\\x/g')"
+}
+
+param="${QUERY_STRING%[%]2F}"
+fname="${param#*d=}"
+path=`echo "$fname" | urldecode`
+name="${path##*/}"
+wname="${name//[^-a-zA-Z0-9_+.,]/_}"
+
+cd ..
+pname=$PWD/tmp$fname.zip
+mkdir -p tmp
+
+if cd "pictures$path"; then
+ dozip=false
+ if test ! -e $pname; then dozip=true
+ elif test . -nt $pname; then dozip=true
+ else
+ for i in *.[jJ][pP][gG] *.[jJ][pP][eE][gG]; do
+ if test "$i" -nt $pname; then dozip=true; break; fi
+ done
+ fi
+
+ if $dozip; then
+ until mkdir $pname.lock 2>/dev/null; do
+ if ps `cat $pname.lock/pid` >/dev/null; then sleep 3
+ else rm -rf $pname.lock
+ fi
+ done
+ echo $$ >$pname.lock/pid
+ for i in *.[jJ][pP][gG] *.[jJ][pP][eE][gG]; do echo "$i"; done |\
+ zip -q -0 -@ $pname
+ rm -rf $pname.lock
+ fi
+ size=`stat -c "%s" $pname`
+ echo "Content-Type:application/zip"
+ echo "Content-Disposition: attachment; filename=$wname.zip"
+ echo "Content-length:$size"
+ echo
+ cat $pname
+else
+ echo "Content-Type:text/plain";echo
+ echo "ERROR: Cannot find directory $path, pname=$pname"
+fi
+exit 0
diff -r 9dbd5193ff4b index.php
--- a/index.php Sat Aug 16 12:52:49 2008 +0200
+++ b/index.php Tue Aug 19 01:24:05 2008 +0200
@@ -1718,18 +1718,25 @@ if ($mode == 'slideshow') {
// -> $navbar_menu
if (!$logged) {
- $navbar_menu[] = ''.$txt_login.'';
+ $navbar_menu[] = ''.$txt_login.'
';
} else {
- $navbar_menu[] = $user_row["login"].' - '.$txt_logout.'';
+ $navbar_menu[] = $user_row["login"].' - '.$txt_logout.'
';
}
- $navbar_menu[] = ''.$txt_random_pic.'';
+ $navbar_menu[] = ''.$txt_random_pic.'
';
if ($nb_files > 1) {
- $navbar_menu[] = "".$txt['slideshow']."";
+ $navbar_menu[] = "".$txt['slideshow']."
";
+ }
+ if ($nb_files > 0) {
+ # DOWNLOAD_ALBUM START: uses cgi/zipdir & cgi/.htaccess
+ $navbar_menu[] = "".
+ $txt['download_album']."
";
+ # DOWNLOAD_ALBUM END
}
if ($admin) {
$html = '';
- $html .= ''.$txt_admin['admin'].'';
+ $html .= ''.$txt_admin['admin'].'
';
$html .= '