X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=9d3f548a2f38e7d714687e9cbabf0c52375aa598;hp=825f92d098d55a8e602ee8c16bd5cf027ac89b31;hb=d017dda4269c5122cd522218357a11fcb4880a5d;hpb=75a329ec022ef21019afb17aecf776a10083e0cb
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 825f92d..9d3f548 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -105,6 +105,7 @@ class PHPFSPOT {
$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
$this->tmpl->assign('page_title', $this->cfg->page_title);
$this->tmpl->assign('current_condition', $_SESSION['tag_condition']);
+ $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name);
$_SESSION['start_action'] = $_GET['mode'];
@@ -146,11 +147,13 @@ class PHPFSPOT {
break;
}
+ if(isset($_SESSION['from_date']) && isset($_SESSION['to_date']))
+ $this->tmpl->assign('date_search_enabled', true);
+
$this->tmpl->assign('from_date', $this->get_calendar('from'));
$this->tmpl->assign('to_date', $this->get_calendar('to'));
$this->tmpl->assign('sort_field', $this->get_sort_field());
$this->tmpl->assign('content_page', 'welcome.tpl');
- $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name);
$this->tmpl->show("index.tpl");
@@ -293,11 +296,11 @@ class PHPFSPOT {
$thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->photo_width ."_". $this->getMD5($photo);
if(!file_exists($orig_path)) {
- $this->_warning("Photo ". $orig_path ." does not exist!
\n");
+ $this->_error("Photo ". $orig_path ." does not exist!
\n");
}
if(!is_readable($orig_path)) {
- $this->_warning("Photo ". $orig_path ." is not readable for user ". $this->getuid() ."
\n");
+ $this->_error("Photo ". $orig_path ." is not readable for user ". $this->getuid() ."
\n");
}
/* If the thumbnail doesn't exist yet, try to create it */
@@ -353,7 +356,7 @@ class PHPFSPOT {
$this->tmpl->assign('current', $current);
}
else {
- $this->_warning("Can't open file ". $thumb_path ."\n");
+ $this->_error("Can't open file ". $thumb_path ."\n");
return;
}
@@ -564,8 +567,8 @@ class PHPFSPOT {
$matched_photos = Array();
if(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
- $from_date = strtotime($_SESSION['from_date']);
- $to_date = strtotime($_SESSION['to_date']);
+ $from_date = strtotime($_SESSION['from_date'] ." 00:00:00");
+ $to_date = strtotime($_SESSION['to_date'] ." 23:59:59");
$additional_where_cond = "
p.time>='". $from_date ."'
AND
@@ -818,7 +821,7 @@ class PHPFSPOT {
for($i = 1; $i <= $last_page; $i++) {
if($current_page == $i)
- $style = "style=\"font-size: 125%;\"";
+ $style = "style=\"font-size: 125%; text-decoration: underline;\"";
elseif($current_page-1 == $i || $current_page+1 == $i)
$style = "style=\"font-size: 105%;\"";
elseif(($current_page-5 >= $i) && ($i != 1) ||
@@ -1112,12 +1115,12 @@ class PHPFSPOT {
$full_path = $this->translate_path($details['directory_path']) ."/". $details['name'];
if(!file_exists($full_path)) {
- $this->_warning("File ". $full_path ." does not exist\n");
+ $this->_error("File ". $full_path ." does not exist\n");
return;
}
if(!is_readable($full_path)) {
- $this->_warning("File ". $full_path ." is not readable for ". $this->getuid() ."\n");
+ $this->_error("File ". $full_path ." is not readable for ". $this->getuid() ."\n");
return;
}
@@ -1411,12 +1414,22 @@ class PHPFSPOT {
} // checkifImageSupported()
- public function _warning($text)
+ public function _error($text)
{
- print "\n";
- print $text;
+ switch($this->cfg->logging) {
+ case 'display':
+ print "\n";
+ print $text;
+ break;
+ case 'errorlog':
+ error_log($text);
+ break;
+ case 'logfile':
+ error_log($text, 3, $his->cfg->log_file);
+ break;
+ }
- } // _warning()
+ } // _error()
/**
* output calendard input fields
@@ -1551,8 +1564,13 @@ class PHPFSPOT {
break;
case 'MoinMoin':
- // [%pictureurl% %thumbnailurl%]
- print htmlspecialchars(" * [".$orig_url." ".$thumb_url."&fake=1.jpg]") ."
\n";
+ // "[%pictureurl% %thumbnailurl%]"
+ print htmlspecialchars("[".$orig_url." ".$thumb_url."&fake=1.jpg]") ."
\n";
+ break;
+
+ case 'MoinMoinList':
+ // " * [%pictureurl% %thumbnailurl%]"
+ print " " . htmlspecialchars("* [".$orig_url." ".$thumb_url."&fake=1.jpg]") ."
\n";
break;
}
@@ -1666,6 +1684,12 @@ class PHPFSPOT {
} // get_sort_order()
+ /***
+ * return the next to be shown slide show image
+ *
+ * this function returns the URL of the next image
+ * in the slideshow sequence.
+ */
public function getNextSlideShowImage()
{
$all_photos = $this->getPhotoSelection();
@@ -1683,6 +1707,29 @@ class PHPFSPOT {
} // getNextSlideShowImage()
+ /***
+ * return the previous to be shown slide show image
+ *
+ * this function returns the URL of the previous image
+ * in the slideshow sequence.
+ */
+ public function getPrevSlideShowImage()
+ {
+ $all_photos = $this->getPhotoSelection();
+
+ if(!isset($_SESSION['slideshow_img']) || $_SESSION['slideshow_img'] == 0)
+ $_SESSION['slideshow_img'] = 0;
+ else
+ $_SESSION['slideshow_img']--;
+
+ $server_name = $_SERVER['SERVER_NAME'];
+ if(!isset($_SERVER['HTTPS'])) $protocol = "http";
+ else $protocol = "https";
+
+ return $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
+
+ } // getPrevSlideShowImage()
+
public function resetSlideShow()
{
if(isset($_SESSION['slideshow_img']))
@@ -1709,10 +1756,10 @@ class PHPFSPOT {
");
while($row = $this->db->db_fetch_object($result)) {
- array_push($all, $row[0]);
+ array_push($all, $row['id']);
}
- return array_rand($all);
+ return $all[array_rand($all)];
} // get_random_photo()