From b50897cb0fdf0d42d306b20b8e38f19f8e2832e3 Mon Sep 17 00:00:00 2001
From: jimmacfx cannot create dabase. check permissions.$sql
\n";
+ print sqlite_error_string (sqlite_last_error($this->dbres));
+ $page->footer();
+ exit;
+ }
+ }
+
+ function count() {
+ return sqlite_num_rows($this->result);
+ }
+
+ function rewind() { //just to abstract from sqlite
+ sqlite_rewind($this->result);
+ }
+
+}
+
+
+$db = new SQLiteDatabase("$dbfile");
+
+?>
diff --git a/www/inc/exif.inc.php b/www/inc/exif.inc.php
index f78741e..7b8262d 100644
--- a/www/inc/exif.inc.php
+++ b/www/inc/exif.inc.php
@@ -99,7 +99,7 @@ if ($exif_prog=="php4") {
}
echo "\n";
echo " \n";
echo "\n";
@@ -136,7 +136,7 @@ if ($exif_prog=="php4") {
}
}
- echo "" . __("More info");
+ echo "" . __("More info");
echo "";
- echo " " . __("Less info");
+ echo " " . __("Less info");
echo " ";
echo "
'; + $comment_data = stripslashes(strip_tags($comment_data,$allowedTags)); + // thanks google: + // http://www.google.com/googleblog/2005/01/preventing-comment-spam.html + $comment_data = eregi_replace("error( __('No comment spam'), __('Your comment includes blacklisted word') . __('No comment spam') ); + $this->footer(); + exit; //stop everything + } + } + + if ($comment_kolacek!=md5($comment_spamcheck)) { + $this->error( __('No comment spam'), __('You ve written the check number wrong' ) ); + $this->footer(); + exit; //stop everything + } + + if (!$comment_name) { + $comment_name = $_COOKIE["username"]; + } + + // ok so we got a comment + if ($comment_name && $save_comment_name) { + // save out name in a cookie + if (!setcookie("username","$comment_name", + mktime(0, 0, 0, 12, 30, 2030))) { + print __('Could not set name cookie!'); + exit; + } + } + + // create a user_comment file if not existant or append to it + if (!$picture) { + require_once("$root/inc/photo.class.inc.php"); + $path = "$gallery_dir/$galerie/lq"; + $file = "$path/img-$snimek.jpg"; + $picture = new C_photo($file, $snimek); + } + $picture->addcomment($comment_name, $comment_data); + } + } } # return dirs sorted diff --git a/www/index.php b/www/index.php index 011a614..1483b84 100644 --- a/www/index.php +++ b/www/index.php @@ -2,14 +2,6 @@ # uncomment this to check for uninitialized variables etc.: # error_reporting (E_ALL); -# get variables from the _SERVER array in order to not -# rely on register_globals = On -# (this will not work with standalone PHP) -$ThisScript=preg_replace('/\?.*$/', '', $_SERVER['REQUEST_URI']); -$ScriptFileName=$_SERVER['SCRIPT_FILENAME']; -$HostName=$_SERVER['SERVER_NAME']; -$ThisUrl = $_SERVER['REQUEST_URI']; - #language support require_once ("lib/lib.l10n.php"); require_once("inc/config.inc.php"); @@ -68,78 +60,7 @@ if ($galerie) { } } -// processing of the user comment data -if($comments && @$_POST["commentdata"]) { - $username = @$_COOKIE["username"]; - $comment_name = @$_POST["commentname"]; - $save_comment_name = @$_POST["savecommentname"]; - $comment_data = @$_POST["commentdata"]; - $comment_kolacek = @$_POST["commentkolacek"]; - $comment_spamcheck = @$_POST["commentspamcheck"]; - - #check for HTML tags - - $comment_name = stripslashes(strip_tags($comment_name)); - $allowedTags = '\n > Photo"; + print " $snimek"; $path = "$gallery_dir/$galerie/thumbs"; $imgfiles = new SortDir("$path"); check($galerie); $path = "$gallery_dir/$galerie/lq"; $file = "$path/img-$snimek.jpg"; if (!file_exists($file)) { - echo __('No such image'); + print __('No such image'); $page->footer(); exit; } - $imgsize = getimagesize("$root/$file"); - /* - navigation($galerie, $snimek, null); - */ + + if (!$picture) { //picture may have been created if commentform submitted + require_once("$root/inc/photo.class.inc.php"); + $picture = new C_photo($file, $snimek); + } // mini thumbnail roll if ($show_thumbs) { - echo "\n\n
'; - $comment_data = stripslashes(strip_tags($comment_data,$allowedTags)); - // thanks google: - // http://www.google.com/googleblog/2005/01/preventing-comment-spam.html - $comment_data = eregi_replace("error( __('No comment spam'), __('Your comment includes blacklisted word') . __('No comment spam') ); - $page->footer(); - exit; //stop everything - } - } - - if ($comment_kolacek!=md5($comment_spamcheck)) { - $page->error( __('No comment spam'), __('You ve written the check number wrong' ) ); - $page->footer(); - exit; //stop everything - } - - if (!$comment_name) { - $comment_name = $_COOKIE["username"]; - } - - // ok so we got a comment - if ($comment_name && $save_comment_name) { - // save out name in a cookie - if (!setcookie("username","$comment_name", - mktime(0, 0, 0, 12, 30, 2030))) { - print __('Could not set name cookie!'); - exit; - } - } - - // create a user_comment file if not existant or append to it - if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms - $comment = "$root/$gallery_dir/$galerie/comments/user_$snimek.txt"; - $fh = fopen("$comment", "a"); - - if (!$comment_name) { - $comment_name = __('Anonymous'); - } - if (!fwrite($fh, "\n")) { - $page->error( __('Could not write to') . $comment . "!" ); - $page->footer(); - exit; //stop everything - } - fwrite($fh, "\n"); - - fclose($fh); - } -} - +$page->process_comment_form(); //START RENDERING @@ -148,15 +69,15 @@ $page->header("Photos"); require("inc/header.inc.php"); // folder > tree -//echo " \n";}// end last year if this is + if (@$thisyear) { print " \n\n";}// end last year if this is // not the first one #This is a new year unset($thismonth); - echo "" . __('Comment from') . "$comment_name\n",90); - fwrite($fh, "$comment_data\n",280); - fwrite($fh, "\n"; } // end of last month if // this is not the first one #new month $monthindex = $month - 1; $monthname = $months[$monthindex]; - echo "$year
\n"; - echo ""; + print "\n"; } // end of last month if + if (@$thismonth) { print "$year
\n"; + print ""; } $month=$galeriemonth["$foldername"]; # now months if (@$thismonth!=$month) { #first one - if (@$thismonth) { echo "\n\n"); + if ($one_out) print (" \n\n\n"); ############################## # Individual Gallery Index # @@ -264,16 +185,16 @@ if (!$galerie) { # finish off navigation header - echo "\n > "; + print "\n > "; if ($galeriename[$galerie]) { - echo $galeriename[$galerie]; + print $galeriename[$galerie]; } else { - echo $galerie; + print $galerie; } - echo "\n\n"; + print "\n\n"; //thumbnails - echo "$monthname
\n"; + print "\n$monthname
\n"; } #galleries within month if ($galerielogin[$foldername]) { - echo ""; - echo $galeriename[$foldername]; - echo ""; + print " href=\"$ThisScript?galerie=$foldername\">"; + print $galeriename[$foldername]; + print ""; } else { - echo " href=\"$ThisScript?galerie=$foldername\">$foldername"; + print " href=\"$ThisScript?galerie=$foldername\">$foldername"; } if (@$galeriedesc[$foldername]) { - echo "" . $galeriedesc[$foldername]; - echo "\n"; + print "" . $galeriedesc[$foldername]; + print "\n"; } if (@$galerieauthor[$foldername]) { - echo " \n"; + print " \n"; } if (@$galerieday[$foldername]) { - echo ""; - echo "$monthname " . $galerieday[$foldername]; - echo "\n"; + print ""; + print "$monthname " . $galerieday[$foldername]; + print "\n"; } - echo "
\n"; + print "\n"; $thisyear=$year; $thismonth=$month; } - if ($one_out) echo ("\n"; + print "
\n"; $path = "$gallery_dir/$galerie/thumbs"; $imgfiles = new SortDir($path); check($galerie); // check for nasty input @@ -316,223 +237,166 @@ if (!$galerie) { } else $title = "Photo ${x[1]}"; - echo " "; - echo ""; + print ""; - echo "\n"; + print " src=\"$thumb\" "; + print "alt=\"photo No. ${x[1]}\" />"; + print "
\n"; } } - echo "\n"; + print "\n"; //info - echo "\n"; + print "\n"; //and links to archived images: - echo "\n\n"; if ($galeriedesc[$galerie]) { - echo "\n"; + print ""; - echo ""; - echo $galeriedesc[$galerie] . "
\n"; + print ""; + print ""; + print $galeriedesc[$galerie] . "
\n"; } if ($galerieauthor[$galerie]) { - echo "Author: "; - echo ""; - echo $galerieauthor[$galerie] . "
\n"; + print "Author: "; + print ""; + print $galerieauthor[$galerie] . "
\n"; } - echo "\n"; + print "\n
\n"; if (file_exists("$gallery_dir/$galerie/zip/mq.zip")) { - echo "[ " . __('zipped MQ images') . " ] "; + print "[ " . __('zipped MQ images') . " ] "; } if (file_exists("$gallery_dir/$galerie/zip/mq.tar.bz2")) { - echo "[ " . __('MQ images tarball') . " ] "; + print "[ " . __('MQ images tarball') . " ] "; } if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) { - echo "[ " . __('zipped HQ images') . " ]"; + print "[ " . __('zipped HQ images') . " ]"; } if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) { - echo "[ " . __('HQ images tarball') . " ]"; + print "[ " . __('HQ images tarball') . " ]"; } - echo "
"; + print ""; ####################### # Individual Image # ####################### } else { //low-res image # finish off header - echo "\n > "; + print "\n > "; if ($galeriename[$galerie]) { - echo $galeriename[$galerie]; + print $galeriename[$galerie]; } else { - echo $galerie; + print $galerie; } - echo "\n > Photo"; - echo " $snimek"; + print ""; - echo ""; - echo "\n"; - echo " : \n"; + print "\n\n\n"; } else { // show the popup button - echo "\n\n"; + print ""; + print "\n"; + print " : \n"; while ($thumbfile = $imgfiles->read()) { if ( eregi("^img-([0-9]+)\.(png|jpe?g)", $thumbfile, $x)) { $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}"; - echo " "; - echo ""; + print ""; - echo " \n"; + print " src=\"$thumb\" "; + print "alt=\"photo No. ${x[1]}\" />"; + print " \n"; } } if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) { - echo ""; - echo "zip"; + print ""; + print "zip"; } if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) { - echo ""; - echo "zip"; + print ""; + print "zip"; } - echo "\n"; + print ""; - echo ""; - echo "\n"; - echo "\n"; + print "\n\n"; + print ""; + print "\n"; + print "\n"; } /* main image + thumbnail navigation (prev/next) */ - - $divheight = $imgsize[1] + 10; - echo "\n"; // extra kludge - // because of tall - // images - echo "\n"; - navigation($galerie, $snimek, "prev"); - navigation($galerie, $snimek, "next"); - echo "\n"; //image + $picture->renderPreview(); + $page->navigation($galerie, $snimek, "prev"); + $page->navigation($galerie, $snimek, "next"); + print "\n"; //end image div + if ($exif_prog) require("$root/inc/exif.inc.php"); - /* Image comment (caption really) */ - $comment = "$root/$gallery_dir/$galerie/comments/$snimek.txt"; - if (file_exists($comment)) { - echo ""; - include($comment); - echo ""; - } - /* Counter/Access Log - also requires comments dir world writable */ - if ($log_access==1) { - //simple counter - if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms - $log = "$root/$gallery_dir/$galerie/comments/log_$snimek.txt"; - if (file_exists($log)){ - $fh = fopen($log, "r"); - $counter = rtrim(fgets($fh)); - fclose($fh); - } else { - $counter = 0; - } - $counter++; - $fh = fopen($log,"w"); - if (!fwrite($fh, "$counter\n")) { - $page->error( __('Could not write to') . $log . "!"); - $page->footer(); - exit; //stop everything - } - fclose($fh); - //Now display something - echo "\n\n"; - echo __('This image has been viewed') . " "; - echo "$counter". " " . __('times') . "."; - //echo date("F dS, Y",filectime($log)); - echo "\n\n"; - } else { - echo "\n"; - } - } elseif ($logaccess==2) { - // log time, IP, UA - // TODO - is this really a good thing to do? + /* Image comment + really poor naming here, it is caption. + */ + $picture->renderCaption(); + + + //show page counter + if ($log_access) { + $picture->renderCounter(); } - - if (file_exists("$gallery_dir/$galerie/mq/img-$snimek.jpg") || file_exists("$gallery_dir/$galerie/hq/img-$snimek.jpg")) { - echo ""; - if (file_exists("$gallery_dir/$galerie/mq/img-$snimek.jpg")) { - echo "". __('MQ') . " "; - } - if (file_exists("$gallery_dir/$galerie/hq/img-$snimek.jpg")) { - echo "" . __('HQ') . ""; - } - echo "\n"; //mqhq - } + $picture->renderBigSize(); - /* User comments */ - if ($comments) { - if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms - require("inc/comment.inc.php"); - $user_comment = "$root/$gallery_dir/$galerie/comments/user_$snimek.txt"; - - if (file_exists($user_comment)) { - echo ""; - include($user_comment); - echo ""; - } - } else { - echo "\n"; - } - } - navigation($galerie, $snimek, null); + $page->user_comments($picture->number); + $page->navigation($galerie, $snimek, null); } require("inc/footer.inc.php"); diff --git a/www/l10n/cs/main.lang b/www/l10n/cs/main.lang index 2c2dc57..cff278b 100644 --- a/www/l10n/cs/main.lang +++ b/www/l10n/cs/main.lang @@ -109,3 +109,6 @@ PÅ™edchozà ;Next NásledujÃcà + +;Photo +Fotografie diff --git a/www/l10n/it/date.lang b/www/l10n/it/date.lang new file mode 100644 index 0000000..2446779 --- /dev/null +++ b/www/l10n/it/date.lang @@ -0,0 +1,79 @@ +;Jan +Gen +;Feb +Feb +;Mar +Mar +;Apr +Apr +;May +Mag +;Jun +Giu +;Jul +Lug +;Aug +Ago +;Sep +Set +;Oct +Ott +;Nov +Nov +;Dec +Dic + +;January +Gennaio +;February +Febbraio +;March +Marzo +;April +Aprile +;May +Maggio +;June +Giugno +;July +Luglio +;August +Agosto +;September +Settembre +;October +Ottobre +;November +Novembre +;December +Dicembre + +;Mon +Lun +;Tue +Mar +;Wed +Mer +;Thu +Gio +;Fri +Ven +;Sat +Sab +;Sun +Dom + +;Monday +Lunedi +;Tuesday +Martedi +;Wednesday +Mercoledi +;Thursday +Giovedi +;Friday +Venerdi +;Saturday +Sabato +;Sunday +Domenica diff --git a/www/l10n/it/exif.lang b/www/l10n/it/exif.lang new file mode 100644 index 0000000..4dc411f --- /dev/null +++ b/www/l10n/it/exif.lang @@ -0,0 +1,21 @@ +;Time Taken +Orario scatto +;Camera Manufacturer +Produttore macchina fotografica +;Camera Model +Modello +;Real Focal Length +Lunghezza focale reale +;Focal Length Relative to 35mm Film +Lunghezza focale (relativa a pellicola da 35mm) +;F Stop +Stop +;Time of Exposure +Tempo d'esposizione +;Flash +Flash + +;More info +Maggiori informazioni +;Less info +Meno informazioni diff --git a/www/l10n/it/main.lang b/www/l10n/it/main.lang new file mode 100644 index 0000000..4f52454 --- /dev/null +++ b/www/l10n/it/main.lang @@ -0,0 +1,111 @@ +;No comment spam +No spam nei commenti + +;Your comment includes blacklisted word +Il vostro commento contiene parole non consentite + +;You ve written the check number wrong +Il numero di verifica e' errato + +;Could not set name cookie! +Impossibile impostare il cookie + +;Anonymous +Anonimo + +;Could not write to +Impossibile scrivere su + +;Comment from +Commento da + +;Comment +Commento + +;Comments +Commenti + +;zipped MQ images +Immagini MQ zippate + +;MQ images tarball +File .tgz delle immagini MQ + +;zipped HQ images +Immagini HQ zippate + +;HQ images tarball +File .tgz delle immagini HQ + +;No such image +Immagine inesistente + +;Show Thumbnail Navigation +Mostr al navigazione delle anteprime + +;Could not write to +Impossibile scrivere su + +;This image has been viewed +Quest'immagine e' stata vista + +;times +volte + +;WARNING: comment dir not writable +ATTENZIONE: cartella per i commenti non e' scrivibile + +;MQ +MQ + +;HQ +HQ + +;Generated by +Generato da + +;Post a Comment +Aggiungi un commento + +;Show Form +Mostra + +;Hide Form +Nascondi + +;Name: +Nome: + +;Enter your name. +Inserire il proprio nome. + +;Remember Name: +Ricorda il proprio nome: + +;Should the browser remember your name? +Il browser deve ricordare il nome inserito? + +;Retype PIN Above: +Inserire il PIN sopra: + +;Enter the number shown above. +Inserire il numero mostrato sopra. + +;Send +Invia + +;Allowed HTML tags: a,b,i,ul,li,blockquote,br. +Tag HTML consentiti: a,b,i,ul,li,blockquote,br. + + +;display line +mostra linea + +;display table +mostra tabella + +;Previous +Precedente + +;Next +Next diff --git a/www/l10n/no/date.lang b/www/l10n/no/date.lang new file mode 100644 index 0000000..dd5b9a8 --- /dev/null +++ b/www/l10n/no/date.lang @@ -0,0 +1,79 @@ +;Jan +Jan +;Feb +Feb +;Mar +Mar +;Apr +Apr +;May +Mai +;Jun +Jun +;Jul +Jul +;Aug +Aug +;Sep +Sep +;Oct +Okt +;Nov +Nov +;Dec +Des + +;January +januar +;February +februar +;March +mars +;April +april +;May +mai +;June +juni +;July +juli +;August +august +;September +september +;October +oktober +;November +november +;December +desember + +;Mon +Man +;Tue +Tir +;Wed +Ons +;Thu +Tor +;Fri +Fre +;Sat +Lør +;Sun +Søn + +;Monday +Mandag +;Tuesday +Tirsdag +;Wednesday +Onsdag +;Thursday +Torsdag +;Friday +Fredag +;Saturday +Lørdag +;Sunday +Søndag diff --git a/www/l10n/no/exif.lang b/www/l10n/no/exif.lang new file mode 100644 index 0000000..3912ecc --- /dev/null +++ b/www/l10n/no/exif.lang @@ -0,0 +1,21 @@ +;Time Taken +Tidspunkt +;Camera Manufacturer +Kameraprodusent +;Camera Model +Modell +;Real Focal Length +Brennvidde +;Focal Length Relative to 35mm Film +Brennvidde (i forhold til 35mm) +;F Stop +BlenderÃ¥pning +;Time of Exposure +Lukketid +;Flash +Blitz + +;More info +Mer informasjon +;Less info +Mindre informasjon diff --git a/www/l10n/no/main.lang b/www/l10n/no/main.lang new file mode 100644 index 0000000..d89c699 --- /dev/null +++ b/www/l10n/no/main.lang @@ -0,0 +1,110 @@ +;No comment spam +Ingen kommentarspam + +;Your comment includes blacklisted word +Din kommentar inneholder svartelistede ord. + +;You ve written the check number wrong +Pinkoden stemmer ikke + +;Could not set name cookie! +Kunne ikke sette informasjonskapsel! + +;Anonymous +Annonym + +;Could not write to +Kunne ikke skrive til + +;Comment from +Kommentar fra + +;Comment +Kommentar + +;Comments +Kommentarer + +;zipped MQ images +arkiv zip (MQ) + +;MQ images tarball +arkiv tgz (MQ) + +;zipped HQ images +arkiv zip (HQ) + +;HQ images tarball +arkiv tgz (HQ) + +;No such image +Bildet finnes ikke + +;Show Thumbnail Navigation +Vis miniatyrbilde-navigasjon + +;Could not write to +Kunne ikke skrive til + +;This image has been viewed +Dette bildet har blitt vist + +;times +ganger + +;WARNING: comment dir not writable +ADVARSEL: kommentarkatalogen er ikke skrivbar + +;MQ +MQ + +;HQ +HQ + +;Generated by +Generert av + +;Post a Comment +Legg til en kommentar + +;Show Form +Vis skjema + +;Hide Form +Gjem skjema + +;Name: +Navn: + +;Enter your name. +Skriv inn navnet ditt. + +;Remember Name: +Husk navn: + +;Should the browser remember your name? +Skal nettleseren husk ditt navn? + +;Retype PIN Above: +Gjenngi PIN-koden over: + +;Enter the number shown above. +Skriv inn tallet over. + +;Send +Send + +;Allowed HTML tags: a,b,i,ul,li,blockquote,br. +;Tillatte HTML-tagger: a,b,i,ul,li,blockquote,br. + +;display line +vis linje + +;display table +vis tabell + +;Previous +Forrige + +;Next +Neste diff --git a/www/stats.php b/www/stats.php new file mode 100644 index 0000000..1a47ee7 --- /dev/null +++ b/www/stats.php @@ -0,0 +1,25 @@ +header("Photo Statistics"); + require("inc/header.inc.php"); + //recent views + print "Recently Viewed
"; + //recently commented + print "Recently Commented
"; + //most viewed + print "Most Viewed
"; + //most discussed + print "Most Discussed
"; +} else { + $page->error("No SQLite", "You need SQLite to use view statistics."); +} +$page->footer(); +?> -- cgit v1.2.3