X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=579054d6ebd70a18caba3abd46612723c6e5474f;hp=860b5de0d97d73e5811d2d0270a283e1184afa22;hb=a63f899582afffadbabfdf422489b7937f0e6a1e;hpb=3d567f23a4e45ed8b082fbcd160bd0463b643529
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 860b5de..579054d 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -23,6 +23,12 @@ class PHPFSPOT {
$this->cfg = new PHPFSPOT_CFG;
$this->db = new PHPFSPOT_DB(&$this, $this->cfg->fspot_db);
+
+ if(!is_writeable(dirname($this->cfg->phpfspot_db))) {
+ print dirname($this->cfg->phpfspot_db) .": directory is not writeable!";
+ exit(1);
+ }
+
$this->cfg_db = new PHPFSPOT_DB(&$this, $this->cfg->phpfspot_db);
$this->check_config_table();
@@ -193,7 +199,7 @@ class PHPFSPOT {
}
if(!is_readable($orig_path)) {
- $this->_warning("Photo ". $orig_path ." is not readable for user ". get_current_user() ."
\n");
+ $this->_warning("Photo ". $orig_path ." is not readable for user ". $this->getuid() ."
\n");
}
/* If the thumbnail doesn't exist yet, try to create it */
@@ -885,7 +891,7 @@ class PHPFSPOT {
}
if(!is_readable($full_path)) {
- $this->_warning("File ". $full_path ." is not readable for ". get_current_user() ."\n");
+ $this->_warning("File ". $full_path ." is not readable for ". $this->getuid() ."\n");
return;
}
@@ -1252,6 +1258,9 @@ class PHPFSPOT {
if($current_tags != "") {
$orig_url.= "&tags=". $current_tags;
}
+ if(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
+ $orig_url.= "&from_date=". $_SESSION['from_date'] ."&to_date=". $_SESSION['to_date'];
+ }
$thumb_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
@@ -1310,6 +1319,18 @@ class PHPFSPOT {
} // whatToDo()
+ private function getuid()
+ {
+ if($uid = posix_getuid()) {
+ if($user = posix_getpwuid($uid)) {
+ return $user['name'];
+ }
+ }
+
+ return 'n/a';
+
+ } // getuid()
+
}
?>