aboutsummaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorjimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003>2006-02-14 20:52:54 +0000
committerjimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003>2006-02-14 20:52:54 +0000
commitb50897cb0fdf0d42d306b20b8e38f19f8e2832e3 (patch)
tree101066455a67bc4c1be5244f6fbdf608df5f021e /www
parent20407702b92cb93970eaa4a71e659f383d2f92a5 (diff)
downloadoriginal-b50897cb0fdf0d42d306b20b8e38f19f8e2832e3.tar.gz
original-b50897cb0fdf0d42d306b20b8e38f19f8e2832e3.tar.bz2
add sqlite hooks
git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@9 4fa712ea-3c06-0410-9261-c11b4c06c003
Diffstat (limited to 'www')
-rw-r--r--www/inc/comment_form.inc.php33
-rw-r--r--www/inc/config.inc.php17
-rw-r--r--www/inc/db.class.inc.php63
-rw-r--r--www/inc/exif.inc.php4
-rw-r--r--www/inc/funkce.inc.php62
-rw-r--r--www/inc/global.js13
-rw-r--r--www/inc/header.inc.php24
-rw-r--r--www/inc/photo.class.inc.php279
-rw-r--r--www/inc/www.class.inc.php145
-rw-r--r--www/index.php356
-rw-r--r--www/l10n/cs/main.lang3
-rw-r--r--www/l10n/it/date.lang79
-rw-r--r--www/l10n/it/exif.lang21
-rw-r--r--www/l10n/it/main.lang111
-rw-r--r--www/l10n/no/date.lang79
-rw-r--r--www/l10n/no/exif.lang21
-rw-r--r--www/l10n/no/main.lang110
-rw-r--r--www/stats.php25
18 files changed, 1111 insertions, 334 deletions
diff --git a/www/inc/comment_form.inc.php b/www/inc/comment_form.inc.php
new file mode 100644
index 0000000..5ac8348
--- /dev/null
+++ b/www/inc/comment_form.inc.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * The HTML contained in this file is valid XHTML 1.0 Strict
+ */
+
+echo "<div id=\"comment_block\">\n";
+
+?>
+ <?php echo"<div id=\"showhideform\"><strong> " . __('Post a Comment') . "</strong>:"; ?>
+ <span class="comment_toggle">
+ [&nbsp;
+ <?php echo"<a href=\"javascript:toggle_comment()\"><span id=\"showlink\">" . __('Show Form') . "</span><span id=\"hidelink\" style=\"display:none;\">" . __('Hide Form') . "</span></a>"; ?>
+ &nbsp;]
+ </span>
+ </div>
+
+ <div id="comment_form" style="display: none;">
+<?php
+$this->form_start($ThisUrl, "post", NULL);
+$this->input("text", "commentname", $username, __('Name:'), NULL, _('Enter your name.') );
+$this->input("checkbox", "savecommentname", "1", __('Remember Name:'), "yes",
+ __('Should the browser remember your name?'));
+$magic_number = random_digits(4);
+//temporary. should generate an image instead
+echo "<div class=\"row\"><div class=\"control\">$magic_number</div></div>\n";
+$this->input("hidden", "commentkolacek", md5($magic_number), NULL, NULL, NULL);
+$this->input("text", "commentspamcheck", "", __('Retype PIN Above:'), NULL, __('Enter the number shown above.'));
+$this->input("textarea", "commentdata", "", __('Comment') . " :" , NULL, __('Allowed HTML tags: a,b,i,ul,li,blockquote,br.') );
+$this->input("submit", "", __('Send') , NULL, NULL, NULL);
+$this->form_end();
+?>
+ </div>
+</div>
diff --git a/www/inc/config.inc.php b/www/inc/config.inc.php
index 1f0bbd3..c800fac 100644
--- a/www/inc/config.inc.php
+++ b/www/inc/config.inc.php
@@ -1,8 +1,12 @@
<?php
#base dirname
//dirname("__FILE__/..")
- eregi("^(.*)/[^/]*$", $ScriptFileName, $x);
- $root = $x[1];
+ $ThisScript=preg_replace('/\?.*$/', '', $_SERVER['REQUEST_URI']);
+ $ScriptFileName=$_SERVER['SCRIPT_FILENAME'];
+ $HostName=$_SERVER['SERVER_NAME'];
+ $ThisUrl = $_SERVER['REQUEST_URI'];
+ eregi("^(.*)/[^/]*$", $ScriptFileName, $x);
+ $root = $x[1];
# ===========================================================================
# dir index
$sortinmonth = 0;// 1 - alphabetically
@@ -46,7 +50,7 @@ $scnamegallery = "Photo Gallery Index";
$app["name"] = "Original"; // opensource remote image gallery,
// initialy not as lovely
$app["url"] = "http://jimmac.musichall.cz/original.php3";
- $app["version"] = "0.11";
+ $app["version"] = "0.12pre";
# ===========================================================================
# EXIF metadata app path (helper app for php3 and older php4)
# uncomment the method you want to use if you want EXIF data reported
@@ -95,15 +99,16 @@ $scnamegallery = "Photo Gallery Index";
# eg. it can be "../galleries" to use a galleries dir above the original dir.
$gallery_dir="../galleries";
+#Enable this to access extended tracking functionality
+#depends on sqlite
+$have_sqlite = 1;
+
# This controls wheather web visitors will be able to post
# comments to images
$comments = 1;
# Access Log/Counter
# $log_access = 0; // no access logging
-# $log_access = 1; // simple counter
-# $log_access = 2; // detailed log FIXME: TODO (not sure about doing this, as
- // it duplicates server's access log and tends to grow large
$log_access = 1;
#css styles
diff --git a/www/inc/db.class.inc.php b/www/inc/db.class.inc.php
new file mode 100644
index 0000000..00804a7
--- /dev/null
+++ b/www/inc/db.class.inc.php
@@ -0,0 +1,63 @@
+<?php
+/* SQLite DB class for storing
+ - image views,
+ - user comments
+*/
+
+$dbfile = "$root/$gallery_dir/photos.db";
+
+//unfortunately in php4, the SQLiteDatabse class isn't created so we have to
+
+class SQLiteDatabase {
+ var $dbfile;
+
+ function SQLiteDatabase ($dbfile) {
+
+ $this->dbfile = $dbfile;
+ //if db file doesn't exist, fill with skeleton
+ if (file_exists($this->dbfile)) {
+ $this->dbres = sqlite_open($this->dbfile, 0666, $sqliteerror);
+ } else {
+ //fill with skeleton
+ $folder = dirname($this->dbfile);
+ if (!is_writable($folder)) { //we need write permission to create database
+ die("<p style=\"color:red;\">cannot create dabase. check permissions.</p>\n");
+ } else {
+ $this->dbres = sqlite_open($this->dbfile, 0666, $sqliteerror);
+ //photo table
+ $sql = "create table photo (id INTEGER PRIMARY KEY, caption TEXT, ";
+ $sql .= "counter INTEGER, number INTEGER, album TEXT, name TEXT)";
+ $this->query($sql);
+ //comment table
+ $sql = "create table comment (id INTEGER PRIMARY KEY, user TEXT, ";
+ $sql .= "comment_body TEXT, photo_id INT, date DATETIME)";
+ $this->query($sql);
+ }
+ }
+ }
+
+ function query($sql) {
+ global $page;
+
+ if (!$this->result = sqlite_query($this->dbres, $sql)) {
+ print "Query failed, <span style=\"color: blue;\"><pre>$sql</pre></style>\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 "<tr>\n";
echo "<td></td>";
- echo "<td><a href=\"javascript:toggle_exif()\">" . __("Less info");
+ echo "<td><a href=\"javascript:toggle_div('exif_table');toggle_div('exif_line');\">" . __("Less info");
echo "</a></td>";
echo "</tr>\n";
echo "</table>\n";
@@ -136,7 +136,7 @@ if ($exif_prog=="php4") {
}
}
- echo "<a href=\"javascript:toggle_exif()\">" . __("More info");
+ echo "<a href=\"javascript:toggle_div('exif_table');toggle_div('exif_line');\">" . __("More info");
echo "</a></p>\n";
echo "</div>\n";
}
diff --git a/www/inc/funkce.inc.php b/www/inc/funkce.inc.php
index be897f7..e45d725 100644
--- a/www/inc/funkce.inc.php
+++ b/www/inc/funkce.inc.php
@@ -1,66 +1,4 @@
<?php
-function navigation ($gallery, $snapshot, $image) {
- global $gallery_dir, $root, $ThisScript, $textnav, $img,
- $show_thumbs, $exif_style, $PNthumbScale;
-
- $next = $snapshot + 1;
- $prev = $snapshot - 1;
-
- if (!$image) { // this will render a navigation bar - max 3 buttons
- echo "\n<div class=\"navbuttons\">\n";
- echo "<div class=\"navbuttonsshell\">\n";
- if ($snapshot > 1) { //previous
- echo "<a id=\"previcon\" href=\"$ThisScript?galerie=$gallery&amp;photo=$prev";
- echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\"";
- echo " accesskey=\"p\">";
- echo "&lt; <span class=\"accesskey\">P</span>revious</a>\n";
- }
- echo "&nbsp;";
- if (is_file("$gallery_dir/$gallery/lq/img-$next.jpg")) { //next
- echo "<a id=\"nexticon\" href=\"$ThisScript?galerie=$gallery&amp;photo=$next";
- echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\"";
- echo " accesskey=\"n\">";
- echo "<span class=\"accesskey\">N</span>ext &gt;</a>\n";
- }
- echo "</div>\n</div>\n";
- } elseif ($image=="prev") { //previous thumbnail
- if ($snapshot > 1) { //previous
- echo "<div class=\"prevthumb\">";
- echo "<a href=\"$ThisScript?galerie=$gallery&amp;photo=$prev";
- echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\">";
- if (file_exists("$gallery_dir/$gallery/thumbs/img-$prev.png")) {
- $Pthumb = "$gallery_dir/$gallery/thumbs/img-$prev.png";
- } else {
- $Pthumb = "$gallery_dir/$gallery/thumbs/img-$prev.jpg";
- }
- $v = getimagesize("$root/$Pthumb");
- echo "<img alt=\"Previous\" src=\"";
- echo $Pthumb . "\" width=\"" . round($v[0]/$PNthumbScale);
- echo "\" height=\"" . round($v[1]/$PNthumbScale) . "\" />";
- echo "<br />" . __('Previous');
- echo "</a></div>\n";
- }
- } else { //next thumbnail
- if (is_file("$gallery_dir/$gallery/lq/img-$next.jpg")) {
- echo "<div class=\"nextthumb\">";
- echo "<a href=\"$ThisScript?galerie=$gallery&amp;photo=$next";
- echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\">";
- if (file_exists("$gallery_dir/$gallery/thumbs/img-$next.png")) {
- $Nthumb = "$gallery_dir/$gallery/thumbs/img-$next.png";
- } else {
- $Nthumb = "$gallery_dir/$gallery/thumbs/img-$next.jpg";
- }
- $v = getimagesize("$root/$Nthumb");
- echo "<img alt=\"Next\" src=\"";
- echo $Nthumb . "\" width=\"" . round($v[0]/$PNthumbScale);
- echo "\" height=\"" . round($v[1]/$PNthumbScale) . "\" />";
- //echo "<br /><span class=\"accesskey\">N</span>ext";
- echo "<br />" . __('Next') ;
- echo "</a></div>\n";
- }
- }
-
-}
function check($file) {
global $gallery_dir, $page;
diff --git a/www/inc/global.js b/www/inc/global.js
index ff8ec21..048af85 100644
--- a/www/inc/global.js
+++ b/www/inc/global.js
@@ -65,15 +65,12 @@ function toggle_comment() {
}
}
-function toggle_exif() {
- var exif_table = document.getElementById('exif_table');
- var exif_line = document.getElementById('exif_line');
- if(exif_table.style.display == 'none') {
- exif_table.style.display = 'block';
- exif_line.style.display = 'none';
+function toggle_div(classname) {
+ var div = document.getElementById(classname);
+ if(div.style.display == 'none') {
+ div.style.display = 'block';
} else {
- exif_table.style.display = 'none';
- exif_line.style.display = 'block';
+ div.style.display = 'none';
}
}
diff --git a/www/inc/header.inc.php b/www/inc/header.inc.php
index 483b6ef..970c651 100644
--- a/www/inc/header.inc.php
+++ b/www/inc/header.inc.php
@@ -1,14 +1,20 @@
<div class="stylenavbar">
-[ style:
-<?php
-foreach ($themes as $skin => $url) {
- echo "<a href=\"#\" title=\"$skin\"";
- echo " onclick=\"setActiveStyleSheet('$skin')\">";
- echo "$skin</a> \n";
-}
-?>
-]
+ <div id="styleshiden" style="display: block;">
+ <p><a href="javascript:toggle_div('styleshiden');toggle_div('stylesshown');">show styles</a></p>
+ </div>
+ <div id="stylesshown" style="display: none;">
+ <ul>
+ <?php
+ foreach ($themes as $skin => $url) {
+ echo "<li><a href=\"javascript:setActiveStyleSheet('$skin')\" title=\"$skin\">";
+ echo "$skin</a></li> \n";
+ }
+ ?>
+ </ul>
+ <p><a href="javascript:toggle_div('styleshiden');toggle_div('stylesshown');">hide styles</a></p>
+ </div>
</div>
+
<?php
echo "<h1 class=\"title\"><a href=\"http://$HostName$ThisScript\">Photo Gallery<span /></a></h1>\n\n";
?>
diff --git a/www/inc/photo.class.inc.php b/www/inc/photo.class.inc.php
new file mode 100644
index 0000000..10b507d
--- /dev/null
+++ b/www/inc/photo.class.inc.php
@@ -0,0 +1,279 @@
+<?php
+/* Photo class for dealing with individual images
+
+*/
+
+class C_photo {
+ var $id;
+ var $preview;
+ var $previewsize;
+ var $mq;
+ var $hq;
+ var $name;
+ var $caption;
+ var $file;
+ var $number;
+ var $counter;
+ var $album;
+ var $comments; //rendered string
+
+ function C_photo($file, $number) {
+ global $root, $gallery_dir, $galerie, $db;
+
+ $this->file = $file;
+ $this->number = $number;
+ $this->album = $galerie;
+ //init from filesystem
+ //preview
+ $this->preview = "$gallery_dir/$galerie/lq/img-" . $this->number . ".jpg";
+ $this->previewsize = getimagesize($this->preview);
+ //MQ
+ if (file_exists("$root/$gallery_dir/$galerie/mq/img-" . $this->number . ".jpg")) {
+ $this->mq = "$gallery_dir/$galerie/mq/img-" . $this->number . ".jpg";
+ }
+ //HQ
+ if (file_exists("$root/$gallery_dir/$galerie/hq/img-" . $this->number . ".jpg")) {
+ $this->hq = "$gallery_dir/$galerie/hq/img-" . $this->number . ".jpg";
+ }
+ if ($GLOBALS['have_sqlite']) { //query just once
+ require_once("$root/inc/db.class.inc.php");
+ $sql = "select * from photo where ";
+ $sql .= "number=" . $this->number . " and ";
+ $sql .= "album='" . $this->album . "'";
+ $db->query($sql);
+ }
+ $this->readCaption();
+ $this->readCounter(); //reads access log number
+ if ($GLOBALS['have_sqlite']) { //need to get photo id first
+ if (!$db->count()) {//no record for this photo, let's update the record
+ //FIXME - if no photo data in db, create a unique index for it
+ //and add number, album, caption and views.
+ $sql = "insert into photo (name, caption, counter, number, album)";
+ $sql .= " values (";
+ $sql .= "\"" . $this->name . "\", ";
+ $sql .= "\"" . $this->caption . "\", ";
+ $sql .= $this->counter . ", ";
+ $sql .= $this->number . ", ";
+ $sql .= "\"" . $this->album . "\"";
+ $sql .= ")";
+ $db->query($sql);
+ print "\n\n<!-- We've moved the data to the database.-->";
+ //now we still need to query for the id
+ $sql = "select id from photo where ";
+ $sql .= "number=" . $this->number . " and ";
+ $sql .= "album='" . $this->album . "'";
+ $db->query($sql);
+ }
+ $db->rewind();
+ $resultarray = sqlite_fetch_array($db->result);
+ $this->id = $resultarray["id"];
+ print "\n\n<!-- image id: " . $this->id . " -->\n";
+ }
+ $this->readComments();
+ }
+
+ function readCaption() {
+ global $have_sqlite, $root, $gallery_dir, $galerie, $db;
+
+ /* reads name and caption of a photo
+ - either from sqlite database or filesystem
+ */
+ if ($have_sqlite) {
+ //try reading from sqlite
+ if ($db->count()) {
+ $result = sqlite_fetch_array($db->result);
+ $this->name = $result["name"];
+ $this->caption = $result["caption"];
+ return; //no need to fallback anymore
+ }
+ }
+
+ //we falback to filesystem
+ $buffer = "";
+ $captionfile = "$root/$gallery_dir/$galerie/comments/" . $this->number . ".txt";
+ $fh = @fopen($captionfile, "r");
+ if ($fh) {
+ while (!feof($fh)) {
+ $buffer .= fgets($fh, 4096);
+ }
+ fclose($fh);
+ } else { // no caption file
+ $this->name = __("Photo ") . $this->number;
+ return;
+ }
+ //parse buffer
+ if(eregi("^<span>(.*)</span>( - )?(.*)", $buffer, $x)) {
+ $this->name = $x[1]; //mostly "Photo"
+ $this->caption = chop($x[3]);
+ } else {
+ $this->caption = $buffer;
+ }
+ }
+
+ function readCounter() {
+ global $log_access, $root, $gallery_dir, $galerie, $db;
+
+ if ($GLOBALS['have_sqlite']) {
+ //try reading from sqlite
+ if ($db->count()) {
+ $db->rewind();
+ $result = sqlite_fetch_array($db->result);
+ $this->counter = $result["counter"];
+ return; //no need to fallback anymore
+ }
+ }
+ //we fallback to filesystem :/
+ if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms
+ $log = "$root/$gallery_dir/$galerie/comments/log_" . $this->number . ".txt";
+ if (file_exists($log)){
+ $fh = @fopen($log, "r");
+ $this->counter = rtrim(fgets($fh));
+ fclose($fh);
+ } else {
+ $this->counter = 0;
+ }
+ } else {
+ //doesn't do anything if no perms
+ print "<!-- ". __('WARNING: comment dir not writable') . "-->\n";
+ return 0; //failure
+ }
+ return 1; //success
+ }
+
+ function readComments() {
+ global $root, $gallery_dir, $galerie, $db;
+
+ if ($GLOBALS['have_sqlite']) {
+ //we have and will use SQLite
+ //FIXME
+ print "\n<!--SQLITE comments FIXME-->\n\n";
+ return 1;
+ } else {
+ //filesystem
+ $comments = "$root/$gallery_dir/$galerie/comments/user_" . $this->number . ".txt";
+ if (file_exists($comments)){
+ $buffer = "";
+ $fh = @fopen($comments, "r");
+ if ($fh) {
+ while (!feof($fh)) {
+ $buffer .= fgets($fh, 4096);
+ }
+ $this->comments = $buffer;
+ fclose($fh);
+ }
+ }
+ }
+ }
+
+ function renderCounter() {
+
+ print "\n<div id=\"log\">\n";
+ print __('This image has been viewed') . " ";
+ print "<strong>" . $this->counter . "</strong>". " " . __('times') . ".";
+ print "</div>\n\n";
+ $this->writeCounter(); //save state
+
+ }
+
+ function writeCounter() {
+ global $log_access, $root, $gallery_dir, $galerie, $page, $db;
+
+ $this->counter++; //we add to counter
+ if ($GLOBALS['have_sqlite']) {
+ //we have SQLite
+ $sql = "update photo set counter=" . $this->counter;
+ $sql .= " where id=" . $this->id;
+ $db->query($sql);
+ return; //no need to fallback anymore
+ }
+ //fallback to filesystem
+ if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms
+ $log = "$root/$gallery_dir/$galerie/comments/log_". $this->number .".txt";
+ if (!is_writable($log)) {
+ print "\n\n\n<!-- cannot open $log. Check permissions.";
+ print "\nAborting counter write -->\n";
+ return 0;
+ }
+ $fh = fopen($log,"w");
+ if (!fwrite($fh, $this->counter . "\n")) {
+ $page->error( __('Could not write to') . $log . "!");
+ $page->footer();
+ exit; //stop everything
+ }
+ fclose($fh);
+ }
+ }
+
+ function renderBigSize() {
+
+ if ($this->mq || $this->hq) {
+ print "<div id=\"mqhq\">";
+ if ($this->mq) {
+ print "<a href=\"" . $this->mq . "\">". __('MQ') . "</a> ";
+ }
+ if ($this->hq) {
+ print "<a href=\"" . $this->hq . "\">" . __('HQ') . "</a>";
+ }
+ print "</div>\n";
+ }
+ }
+
+ function renderPreview() {
+
+ $divheight = $this->previewsize[1] + 10;
+ print "<div id=\"image\" style=\"height: ${divheight}px\">\n"; // extra kludge
+ // because of tall
+ // images
+
+ print "<img id=\"preview\" " . $this->previewsize[3] . " src=\"". $this->file;
+ print "\" alt=\"$snimek\" />\n";
+ }
+
+ function renderCaption() {
+
+ print "<div class=\"comment\">";
+ print "<span>" . $this->name . "</span>";
+ if ($this->caption) {
+ print " &ndash; ";
+ print $this->caption;
+ print "</div>";
+ }
+ }
+
+ function addComment($comment_name, $comment_data) { //adds comment to file or database
+ global $log_access, $root, $gallery_dir, $galerie, $page;
+
+ if ($GLOBALS['have_sqlite']) {
+ //sqlite
+ print "\n<!--SQLITE comments addition FIXME-->\n\n";
+ } else {
+ //filesystem
+ if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms
+ $comment = "$root/$gallery_dir/$galerie/comments/user_";
+ $comment .= $this->number . ".txt";
+ if (file_exists($comment) && !is_writable($comment)) {
+ $page->error("Permission Denied", __('Could not write to') . $comment .
+ "!\n Check permissions.\n");
+ $page->footer();
+ exit; //stop everything
+ }
+
+ $fh = fopen("$comment", "a");
+ if (!$comment_name) {
+ $comment_name = __('Anonymous');
+ }
+ if (!fwrite($fh, "<div class=\"commententry\">\n")) {
+ $page->error("Write Failed", __('Could not write to') . $comment . "!" );
+ $page->footer();
+ exit; //stop everything
+ }
+ fwrite($fh, " <div class=\"name\">" . __('Comment from') . "<em>$comment_name</em></div>\n",90);
+ fwrite($fh, " <div class=\"commentdata\">$comment_data</div>\n",280);
+ fwrite($fh, "</div>\n");
+
+ fclose($fh);
+ }
+ }
+ }
+}
+?>
diff --git a/www/inc/www.class.inc.php b/www/inc/www.class.inc.php
index 2206382..27683cc 100644
--- a/www/inc/www.class.inc.php
+++ b/www/inc/www.class.inc.php
@@ -188,7 +188,150 @@ class C_www {
echo "</div>\n";
}
-
+
+ function navigation ($gallery, $snapshot, $image) {
+ global $gallery_dir, $root, $ThisScript, $textnav, $img,
+ $show_thumbs, $exif_style, $PNthumbScale;
+
+ $next = $snapshot + 1;
+ $prev = $snapshot - 1;
+
+ if (!$image) { // this will render a navigation bar - max 3 buttons
+ echo "\n<div class=\"navbuttons\">\n";
+ echo "<div class=\"navbuttonsshell\">\n";
+ if ($snapshot > 1) { //previous
+ echo "<a id=\"previcon\" href=\"$ThisScript?galerie=$gallery&amp;photo=$prev";
+ echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\"";
+ echo " accesskey=\"p\">";
+ echo "&lt; <span class=\"accesskey\">P</span>revious</a>\n";
+ }
+ echo "&nbsp;";
+ if (is_file("$gallery_dir/$gallery/lq/img-$next.jpg")) { //next
+ echo "<a id=\"nexticon\" href=\"$ThisScript?galerie=$gallery&amp;photo=$next";
+ echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\"";
+ echo " accesskey=\"n\">";
+ echo "<span class=\"accesskey\">N</span>ext &gt;</a>\n";
+ }
+ echo "</div>\n</div>\n";
+ } elseif ($image=="prev") { //previous thumbnail
+ if ($snapshot > 1) { //previous
+ echo "<div class=\"prevthumb\">";
+ echo "<a href=\"$ThisScript?galerie=$gallery&amp;photo=$prev";
+ echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\">";
+ if (file_exists("$gallery_dir/$gallery/thumbs/img-$prev.png")) {
+ $Pthumb = "$gallery_dir/$gallery/thumbs/img-$prev.png";
+ } else {
+ $Pthumb = "$gallery_dir/$gallery/thumbs/img-$prev.jpg";
+ }
+ $v = getimagesize("$root/$Pthumb");
+ echo "<img alt=\"Previous\" src=\"";
+ echo $Pthumb . "\" width=\"" . round($v[0]/$PNthumbScale);
+ echo "\" height=\"" . round($v[1]/$PNthumbScale) . "\" />";
+ echo "<br />" . __('Previous');
+ echo "</a></div>\n";
+ }
+ } else { //next thumbnail
+ if (is_file("$gallery_dir/$gallery/lq/img-$next.jpg")) {
+ echo "<div class=\"nextthumb\">";
+ echo "<a href=\"$ThisScript?galerie=$gallery&amp;photo=$next";
+ echo "&amp;exif_style=$exif_style&amp;show_thumbs=$show_thumbs\">";
+ if (file_exists("$gallery_dir/$gallery/thumbs/img-$next.png")) {
+ $Nthumb = "$gallery_dir/$gallery/thumbs/img-$next.png";
+ } else {
+ $Nthumb = "$gallery_dir/$gallery/thumbs/img-$next.jpg";
+ }
+ $v = getimagesize("$root/$Nthumb");
+ echo "<img alt=\"Next\" src=\"";
+ echo $Nthumb . "\" width=\"" . round($v[0]/$PNthumbScale);
+ echo "\" height=\"" . round($v[1]/$PNthumbScale) . "\" />";
+ //echo "<br /><span class=\"accesskey\">N</span>ext";
+ echo "<br />" . __('Next') ;
+ echo "</a></div>\n";
+ }
+ }
+ }
+
+ function user_comments($photo) {
+ global $root, $gallery_dir, $galerie, $comments, $picture;
+
+ if ($comments) {
+ if (is_writable("$root/$gallery_dir/$galerie/comments")) { // needs perms
+ require("inc/comment_form.inc.php");
+
+ if ($picture->comments) {
+ print "<div class=\"user_comment\">";
+ print $picture->comments;
+ print "</div>";
+ }
+ } else {
+ print "<!-- WARNING: comment dir not writable -->\n";
+ }
+ }
+ }
+
+ function process_comment_form() { // processing of the user comment data
+ global $comments, $root, $gallery_dir, $galerie, $snimek;
+
+ 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 = '<a><b><i><ul><li><blockquote><br>';
+ $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("<a ","<a rel=\"nofollow\" ",$comment_data);
+
+ #further comment spam
+ $comment_blacklist = array("pharmacy", "poker", "Viagra");
+
+ foreach($comment_blacklist as $blackword) {
+ $check = addslashes($blackword);
+ if (eregi($check,$comment_data)) {
+ #write error message
+ $this->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 = '<a><b><i><ul><li><blockquote><br>';
- $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("<a ","<a rel=\"nofollow\" ",$comment_data);
-
- #further comment spam
- $comment_blacklist = array("pharmacy", "poker", "Viagra");
-
- foreach($comment_blacklist as $blackword) {
- $check = addslashes($blackword);
- if (eregi($check,$comment_data)) {
- #write error message
- $page->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, "<div class=\"commententry\">\n")) {
- $page->error( __('Could not write to') . $comment . "!" );
- $page->footer();
- exit; //stop everything
- }
- fwrite($fh, " <div class=\"name\">" . __('Comment from') . "<em>$comment_name</em></div>\n",90);
- fwrite($fh, " <div class=\"commentdata\">$comment_data</div>\n",280);
- fwrite($fh, "</div>\n");
-
- fclose($fh);
- }
-}
-
+$page->process_comment_form();
//START RENDERING
@@ -148,15 +69,15 @@ $page->header("Photos");
require("inc/header.inc.php");
// folder > tree
-//echo "<div class=\"navigation\"><a href=\"$ThisScript\">" . $scnamegallery . "</a>";
-echo "<div class=\"navigation\"><a href=\"./\">" . $scnamegallery . "</a>";
+//print "<div class=\"navigation\"><a href=\"$ThisScript\">" . $scnamegallery . "</a>";
+print "<div class=\"navigation\"><a href=\"./\">" . $scnamegallery . "</a>";
#############################
# Overall Gallery Index #
#############################
if (!$galerie) {
# finish off navigation bar
- echo "</div>\n\n<!-- listing galleries-->\n\n";
+ print "</div>\n\n<!-- listing galleries-->\n\n";
# I've nuked date.txt to replace it with a more generic info.txt
# It optionally supplies i18n name, camera model, author and date
# TODO: imgconv script support
@@ -207,55 +128,55 @@ if (!$galerie) {
$one_out = true;
if (@$thisyear!=$year) { #if the year is not equal to the current year
#This is the first year
- if (@$thisyear) { echo " </div>\n</div>\n";}// end last year if this is
+ if (@$thisyear) { print " </div>\n</div>\n";}// end last year if this is
// not the first one
#This is a new year
unset($thismonth);
- echo "<div class=\"year\"><h3>$year</h3>\n";
- echo "";
+ print "<div class=\"year\"><h3>$year</h3>\n";
+ print "";
}
$month=$galeriemonth["$foldername"];
# now months
if (@$thismonth!=$month) {
#first one
- if (@$thismonth) { echo " </div>\n"; } // end of last month if
+ if (@$thismonth) { print " </div>\n"; } // end of last month if
// this is not the first one
#new month
$monthindex = $month - 1;
$monthname = $months[$monthindex];
- echo " <div class=\"month\"><h4>$monthname</h4>\n";
+ print " <div class=\"month\"><h4>$monthname</h4>\n";
}
#galleries within month
if ($galerielogin[$foldername]) {
- echo " <p class=\"restricted\"><a ";
+ print " <p class=\"restricted\"><a ";
} else {
- echo " <p><a ";
+ print " <p><a ";
}
if (@$galeriename[$foldername]) {
- echo " href=\"$ThisScript?galerie=$foldername\">";
- echo $galeriename[$foldername];
- echo "</a>";
+ print " href=\"$ThisScript?galerie=$foldername\">";
+ print $galeriename[$foldername];
+ print "</a>";
} else {
- echo " href=\"$ThisScript?galerie=$foldername\">$foldername</a>";
+ print " href=\"$ThisScript?galerie=$foldername\">$foldername</a>";
}
if (@$galeriedesc[$foldername]) {
- echo "<span class=\"desc\">" . $galeriedesc[$foldername];
- echo "</span>\n";
+ print "<span class=\"desc\">" . $galeriedesc[$foldername];
+ print "</span>\n";
}
if (@$galerieauthor[$foldername]) {
- echo "<span class=\"author\">by&nbsp;" . $galerieauthor[$foldername];
- echo "</span>\n";
+ print "<span class=\"author\">by&nbsp;" . $galerieauthor[$foldername];
+ print "</span>\n";
}
if (@$galerieday[$foldername]) {
- echo "<span class=\"date\">";
- echo "$monthname&nbsp;" . $galerieday[$foldername];
- echo "</span>\n";
+ print "<span class=\"date\">";
+ print "$monthname&nbsp;" . $galerieday[$foldername];
+ print "</span>\n";
}
- echo "</p>\n";
+ print "</p>\n";
$thisyear=$year;
$thismonth=$month;
}
- if ($one_out) echo (" </div>\n</div>\n\n");
+ if ($one_out) print (" </div>\n</div>\n\n");
##############################
# Individual Gallery Index #
@@ -264,16 +185,16 @@ if (!$galerie) {
# finish off navigation header
- echo "\n &gt; ";
+ print "\n &gt; ";
if ($galeriename[$galerie]) {
- echo $galeriename[$galerie];
+ print $galeriename[$galerie];
} else {
- echo $galerie;
+ print $galerie;
}
- echo "</div>\n\n";
+ print "</div>\n\n";
//thumbnails
- echo "<p class=\"bigthumbnails\">\n";
+ print "<p class=\"bigthumbnails\">\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 " <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}\"";
- echo " title=\"$title, $NumOfComments\"";
- if ($class) echo " class=\"$class\"";
- echo ">";
- echo "<img ";
+ print " <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}\"";
+ print " title=\"$title, $NumOfComments\"";
+ if ($class) print " class=\"$class\"";
+ print ">";
+ print "<img ";
if ($thumbsize) {
- echo "width=\"120\" height=\"80\" ";
+ print "width=\"120\" height=\"80\" ";
} else {
// scale portraits to 80 height
if ($portrait) {
//portrait
- echo "width=\"";
+ print "width=\"";
$scaled = round($imgsize[0] / 1.5);
- echo $scaled;
- echo "\" height=\"${imgsize[0]}\"";
+ print $scaled;
+ print "\" height=\"${imgsize[0]}\"";
} else {
//landscape
- echo $imgsize[3];
+ print $imgsize[3];
}
}
- echo " src=\"$thumb\" ";
- echo "alt=\"photo No. ${x[1]}\" />";
- echo "</a>\n";
+ print " src=\"$thumb\" ";
+ print "alt=\"photo No. ${x[1]}\" />";
+ print "</a>\n";
}
}
- echo "</p>\n";
+ print "</p>\n";
//info
- echo "<div id=\"info\">\n";
+ print "<div id=\"info\">\n";
if ($galeriedesc[$galerie]) {
- echo "<p>";
- echo "<span class=\"value\">";
- echo $galeriedesc[$galerie] . "</span></p>\n";
+ print "<p>";
+ print "<span class=\"value\">";
+ print $galeriedesc[$galerie] . "</span></p>\n";
}
if ($galerieauthor[$galerie]) {
- echo "<p><span class=\"key\">Author: </span>";
- echo "<span class=\"value\">";
- echo $galerieauthor[$galerie] . "</span></p>\n";
+ print "<p><span class=\"key\">Author: </span>";
+ print "<span class=\"value\">";
+ print $galerieauthor[$galerie] . "</span></p>\n";
}
- echo "</div>\n";
+ print "</div>\n";
//and links to archived images:
- echo "\n<p class=\"archives\">\n";
+ print "\n<p class=\"archives\">\n";
if (file_exists("$gallery_dir/$galerie/zip/mq.zip")) {
- echo "[ <a href=\"$gallery_dir/$galerie/zip/mq.zip\">" . __('zipped MQ images') . "</a> ] ";
+ print "[ <a href=\"$gallery_dir/$galerie/zip/mq.zip\">" . __('zipped MQ images') . "</a> ] ";
}
if (file_exists("$gallery_dir/$galerie/zip/mq.tar.bz2")) {
- echo "[ <a href=\"$gallery_dir/$galerie/zip/mq.tar.bz2\">" . __('MQ images tarball') . "</a> ] ";
+ print "[ <a href=\"$gallery_dir/$galerie/zip/mq.tar.bz2\">" . __('MQ images tarball') . "</a> ] ";
}
if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) {
- echo "[ <a href=\"$gallery_dir/$galerie/zip/hq.zip\">" . __('zipped HQ images') . "</a> ]";
+ print "[ <a href=\"$gallery_dir/$galerie/zip/hq.zip\">" . __('zipped HQ images') . "</a> ]";
}
if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) {
- echo "[ <a href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">" . __('HQ images tarball') . "</a> ]";
+ print "[ <a href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">" . __('HQ images tarball') . "</a> ]";
}
- echo "</p>";
+ print "</p>";
#######################
# Individual Image #
#######################
} else { //low-res image
# finish off header
- echo "\n &gt; <a href=\"$ThisScript?galerie=$galerie\">";
+ print "\n &gt; <a href=\"$ThisScript?galerie=$galerie\">";
if ($galeriename[$galerie]) {
- echo $galeriename[$galerie];
+ print $galeriename[$galerie];
} else {
- echo $galerie;
+ print $galerie;
}
- echo "</a>\n &gt; Photo";
- echo " $snimek</div>";
+ print "</a>\n &gt; Photo";
+ print " $snimek</div>";
$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<!--mini thumbnail roll-->\n<div class=\"thumbroll\">";
- echo "<a id=\"minus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
- echo "&amp;exif_style=$exif_style\">";
- echo "</a>\n";
- echo " : \n";
+ print "\n<!--mini thumbnail roll-->\n<div class=\"thumbroll\">";
+ print "<a id=\"minus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
+ print "&amp;exif_style=$exif_style\">";
+ print "</a>\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 " <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}";
- echo "&amp;show_thumbs=$show_thumbs\"";
- echo " title=" . get_photo_title($galerie, $x[1]) . ">";
- echo "<img class=\"thumb\" ";
+ print " <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}";
+ print "&amp;show_thumbs=$show_thumbs\"";
+ print " title=" . get_photo_title($galerie, $x[1]) . ">";
+ print "<img class=\"thumb\" ";
// hadess' hack (TM) ;)
if ($thumbsize) {
- echo " width=\"24\" height=\"16\"";
+ print " width=\"24\" height=\"16\"";
} else {
$minithumb=getimagesize("$root/$thumb");
$w=$minithumb[0]/6;
$h=$minithumb[1]/6;
- echo " width=\"$w\" height=\"$h\"";
+ print " width=\"$w\" height=\"$h\"";
}
- echo " src=\"$thumb\" ";
- echo "alt=\"photo No. ${x[1]}\" />";
- echo "</a> \n";
+ print " src=\"$thumb\" ";
+ print "alt=\"photo No. ${x[1]}\" />";
+ print "</a> \n";
}
}
if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) {
- echo "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.zip\">";
- echo "zip<span /></a>";
+ print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.zip\">";
+ print "zip<span /></a>";
}
if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) {
- echo "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">";
- echo "zip<span /></a>";
+ print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">";
+ print "zip<span /></a>";
}
- echo "</div>\n";
+ print "</div>\n";
} else {
// show the popup button
- echo "\n<!--mini thumbnail popup-->\n<div class=\"thumbroll\">";
- echo "<a id=\"plus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
- echo "&amp;exif_style=$exif_style&amp;show_thumbs=yes\"";
- echo " title=\"" . __('Show Thumbnail Navigation') . "\">";
- echo "</a>\n";
- echo "</div>\n";
+ print "\n<!--mini thumbnail popup-->\n<div class=\"thumbroll\">";
+ print "<a id=\"plus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
+ print "&amp;exif_style=$exif_style&amp;show_thumbs=yes\"";
+ print " title=\"" . __('Show Thumbnail Navigation') . "\">";
+ print "</a>\n";
+ print "</div>\n";
}
/* main image + thumbnail navigation (prev/next) */
-
- $divheight = $imgsize[1] + 10;
- echo "<div id=\"image\" style=\"height: ${divheight}px\">\n"; // extra kludge
- // because of tall
- // images
- echo "<img id=\"preview\" ${imgsize[3]} src=\"$file\" alt=\"$snimek\" />\n";
- navigation($galerie, $snimek, "prev");
- navigation($galerie, $snimek, "next");
- echo "</div>\n"; //image
+ $picture->renderPreview();
+ $page->navigation($galerie, $snimek, "prev");
+ $page->navigation($galerie, $snimek, "next");
+ print "</div>\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 "<div class=\"comment\">";
- include($comment);
- echo "</div>";
- }
- /* 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<div id=\"log\">\n";
- echo __('This image has been viewed') . " ";
- echo "<strong>$counter</strong>". " " . __('times') . ".";
- //echo date("F dS, Y",filectime($log));
- echo "</div>\n\n";
- } else {
- echo "<!-- ". __('WARNING: comment dir not writable') . "-->\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 "<div id=\"mqhq\">";
- if (file_exists("$gallery_dir/$galerie/mq/img-$snimek.jpg")) {
- echo "<a href=\"$gallery_dir/$galerie/mq/img-$snimek.jpg\">". __('MQ') . "</a> ";
- }
- if (file_exists("$gallery_dir/$galerie/hq/img-$snimek.jpg")) {
- echo "<a href=\"$gallery_dir/$galerie/hq/img-$snimek.jpg\">" . __('HQ') . "</a>";
- }
- echo "</div>\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 "<div class=\"user_comment\">";
- include($user_comment);
- echo "</div>";
- }
- } else {
- echo "<!-- WARNING: comment dir not writable -->\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 @@
+<?php
+require_once ("lib/lib.l10n.php");
+require_once("inc/config.inc.php");
+require_once("inc/www.class.inc.php");
+require_once("inc/funkce.inc.php");
+
+l10n::set("$root/l10n/".$sclang."/main.lang");
+
+$page = new C_www;
+if ($GLOBALS['have_sqlite']) {
+ $page->header("Photo Statistics");
+ require("inc/header.inc.php");
+ //recent views
+ print "<h2>Recently Viewed</h2>";
+ //recently commented
+ print "<h2>Recently Commented</h2>";
+ //most viewed
+ print "<h2>Most Viewed</h2>";
+ //most discussed
+ print "<h2>Most Discussed</h2>";
+} else {
+ $page->error("No SQLite", "You need SQLite to use view statistics.");
+}
+$page->footer();
+?>