Projet

Général

Profil

Révision 4fcec884

Voir les différences:

www/inc/config.inc.php
1 1
<?php
2
#base dirname
3
  $root = dirname(dirname(__FILE__) . "../");
4
# ===========================================================================
5
# dir index
6
	 $sortinmonth = 0;// 1 - alphabetically
7
	 								  // 0 - by date (reverse)
2
//base dirname
3
$root = dirname(dirname(__FILE__) . "../");
4
// ===========================================================================
5
// dir index
6
$sortinmonth = 0;// 1 - alphabetically
7
// 0 - by date (reverse)
8 8

  
9
# ===========================================================================
10
# default languages
11
# use UA's accept language
9
// ===========================================================================
10
// default languages
11
// use UA's accept language
12 12
require_once("$root/inc/l10nget.inc.php"); //get from UA
13 13
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
14
	$sclang = get_lang_from_agent($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
15
} else {
16
	$sclang = "en";
14
  $sclang = get_lang_from_agent($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
15
 } else {
16
  $sclang = "fr";
17 17
}
18 18
l10n::set("$root/l10n/".$GLOBALS['sclang']."/exif.lang");
19 19

  
20
# ===========================================================================
21
#Name to dsplay on the gallery
22
$scnamegallery = "Photo Gallery Index";
20
// ===========================================================================
21
//Name to dsplay on the gallery
22
$scnamegallery = "Album photo";
23 23

  
24
// ===========================================================================
25
// albums to show
26
$yearsince = 2009;
27
//images FIXME - this is stylesheet's job
28
$img["left"] = "left.png";
29
$img["right"] = "right.png";
30
$img["top"] = "top.png";
31
// ===========================================================================
32
//thumbnail behaviour
33
//keep this unset for dynamic thumbnail size
34
//$thumbsize = "fixed";
35
//How the previous and Next thumbnails should be scaled
36
// 1 is 1:1, >1 is smaller, <1 is bigger
37
$PNthumbScale = 1.5;
38
// Photos Copyright
39
//	CHANGE THIS! I am not trying to take over the world ;)
40
$copy = "Software : GNU/GPL <a href=\"http://jimmac.musichall.cz/original.php\">Original</a> Copyright &copy; 1999-2005 Jakub Steiner - End user interface <a href=\"http://www.ryxeo.com/WebPhotoAlbum.html\">RyXeo WebPhotoAlbum</a> &copy; 2012 Eric Seigne";
41
//app info
42
$app["name"] = "RyXeo WebPhotoAlbum"; // opensource remote image gallery,
43
// initialy not as lovely 
44
$app["url"] = "http://www.ryxeo.com/WebPhotoAlbum.html";
45
$app["version"] = "1.0";
46
$exif_show = array("DateTime"=>__("Time Taken"), 
47
		   "Make"=>__("Camera Manufacturer"), 
48
		   "Model"=>__("Camera Model"), 
49
		   "FocalLength"=>__("Real Focal Length"), 
50
		   "FocalLengthIn35mmFilm"=>__("Focal Length Relative to 35mm Film"),
51
		   "FNumber"=>__("F Stop"), 
52
		   "Copyright"=>__("Copyright"), 
53
		   "Artist"=>__("Artist"), 
54
		   "ExposureTime"=>__("Time of Exposure"), 
55
		   "ISOSpeedRatings"=>__("Film/Chip Sensitivity"),
56
		   "Flash"=>__("Flash"));
57
// ===========================================================================
58
// Gallery Directory
59
// This is a path relative to the directory where original is installed
60
// eg. it can be "../galleries" to use a galleries dir above the original dir.
61
$gallery_dir="galleries";
24 62

  
25
# ===========================================================================
26
# albums to show
27
   $yearsince = 1999;
28
#images FIXME - this is stylesheet's job
29
   $img["left"] = "left.png";
30
   $img["right"] = "right.png";
31
   $img["top"] = "top.png";
32
# ===========================================================================
33
#thumbnail behaviour
34
   //keep this unset for dynamic thumbnail size
35
   //$thumbsize = "fixed";
36
   //How the previous and Next thumbnails should be scaled
37
   // 1 is 1:1, >1 is smaller, <1 is bigger
38
   $PNthumbScale = 1.5;
39
# Photos Copyright
40
#	CHANGE THIS! I am not trying to take over the world ;)
41
	 $copy = "Software : GNU/GPL <a href=\"http://jimmac.musichall.cz/original.php\">Original</a> Copyright &copy; 1999-2005 Jakub Steiner - End user interface <a href=\"http://www.ryxeo.com/WebPhotoAlbum.html\">RyXeo WebPhotoAlbum</a> &copy; 2012 Eric Seigne";
42
#app info
43
   $app["name"] = "RyXeo WebPhotoAlbum"; // opensource remote image gallery,
44
                              // initialy not as lovely 
45
   $app["url"] = "http://www.ryxeo.com/WebPhotoAlbum.html";
46
   $app["version"] = "1.0";
47
   $exif_show = array("DateTime"=>__("Time Taken"), 
48
		      "Make"=>__("Camera Manufacturer"), 
49
		      "Model"=>__("Camera Model"), 
50
		      "FocalLength"=>__("Real Focal Length"), 
51
		      "FocalLengthIn35mmFilm"=>__("Focal Length Relative to 35mm Film"),
52
		      "FNumber"=>__("F Stop"), 
53
		      "Copyright"=>__("Copyright"), 
54
		      "Artist"=>__("Artist"), 
55
		      "ExposureTime"=>__("Time of Exposure"), 
56
		      "ISOSpeedRatings"=>__("Film/Chip Sensitivity"),
57
		      "Flash"=>__("Flash"));
58
# ===========================================================================
59
## Gallery Directory
60
# This is a path relative to the directory where original is installed
61
# eg. it can be "../galleries" to use a galleries dir above the original dir.
62
  $gallery_dir="galleries";
63

  
64
#Enable this to access extended tracking functionality
65
#depends on sqlite
63
//Enable this to access extended tracking functionality
64
//depends on sqlite
66 65
$have_sqlite = 0;
67 66

  
68
# This controls wheather web visitors will be able to post
69
# comments to images
67
// This controls wheather web visitors will be able to post
68
// comments to images
70 69
$comments = 1;
71 70

  
72
# Access Log/Counter
73
# $log_access = 0; // no access logging
71
// Access Log/Counter
72
// $log_access = 0; // no access logging
74 73
$log_access = 1; 
75 74

  
76
#css styles
77
   $themes = array(
78
               "dark" => "inc/styles/dark/dark.css",
79
               "classic" => "inc/styles/classic/classic.css",
80
               "gorilla" => "inc/styles/gorilla/gorilla.css"
81
   );
75
//css styles
76
$themes = array(
77
		"dark" => "inc/styles/dark/dark.css",
78
		"classic" => "inc/styles/classic/classic.css",
79
		"gorilla" => "inc/styles/gorilla/gorilla.css"
80
		);
82 81

  
83 82
?>
www/inc/funkce.inc.php
1 1
<?php
2 2

  
3 3
function check($file) {
4
   global $gallery_dir, $page;
4
  global $gallery_dir, $page;
5 5
   
6
#   if (eregi("[^0-9a-z\_\-\ ]",$file) || !file_exists("$gallery_dir/$file")) {
7
#   if (eregi("CVS",$file) || !file_exists("$gallery_dir/$file")) {
8
   if (!file_exists("$gallery_dir/$file")) {
9
      echo "funkce.inc.php/check(): Bad input";
10
      $page->footer();
11
      exit;
12
   }
13
}
6
  //   if (eregi("[^0-9a-z\_\-\ ]",$file) || !file_exists("$gallery_dir/$file")) {
7
  //   if (eregi("CVS",$file) || !file_exists("$gallery_dir/$file")) {
8
  if (!file_exists("$gallery_dir/$file")) {
9
    echo "funkce.inc.php/check(): Bad input";
10
    $page->footer();
11
    exit;
12
  }
13
  }
14 14

  
15 15
function browserCheck() {
16
   global $HTTP_USER_AGENT;
16
  global $HTTP_USER_AGENT;
17 17
   
18
	 $HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
19
   if (eregi("(MSIE.[456789]).*Mac.*",$HTTP_USER_AGENT)) {
20
        return("macie4+");
21
   } elseif (eregi("(MSIE.[678])",$HTTP_USER_AGENT)) {
22
        return("ie6+");
23
   } elseif (eregi("(MSIE.[45])",$HTTP_USER_AGENT)) {
24
        return("ie4+");
25
   } elseif (eregi("Opera",$HTTP_USER_AGENT)) {
26
        return("opera");
27
   } elseif (eregi("(Mozilla.4)",$HTTP_USER_AGENT)) {
28
        return("netscape4");
29
   } elseif (eregi("(Mozilla.[5-9])",$HTTP_USER_AGENT)) {
30
        return("mozilla");
31
   } elseif (eregi("KMeleon",$HTTP_USER_AGENT)) {
32
        return("mozilla");
33
   } else {
34
        return("Netscape3");
35
   }
18
  $HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
19
  if (eregi("(MSIE.[456789]).*Mac.*",$HTTP_USER_AGENT)) {
20
    return("macie4+");
21
  } elseif (eregi("(MSIE.[678])",$HTTP_USER_AGENT)) {
22
    return("ie6+");
23
  } elseif (eregi("(MSIE.[45])",$HTTP_USER_AGENT)) {
24
    return("ie4+");
25
  } elseif (eregi("Opera",$HTTP_USER_AGENT)) {
26
    return("opera");
27
  } elseif (eregi("(Mozilla.4)",$HTTP_USER_AGENT)) {
28
    return("netscape4");
29
  } elseif (eregi("(Mozilla.[5-9])",$HTTP_USER_AGENT)) {
30
    return("mozilla");
31
  } elseif (eregi("KMeleon",$HTTP_USER_AGENT)) {
32
    return("mozilla");
33
  } else {
34
    return("Netscape3");
35
  }
36 36
}
37 37

  
38 38
function infoParse ($infofile) {
39 39
	
40
	$info_array = file($infofile);
41
	foreach ($info_array as $line) {
42
		list($key,$value) = split("\|",$line);
43
		$result[$key]=$value;
44
	}
45
	return $result;
40
  $info_array = file($infofile);
41
  foreach ($info_array as $line) {
42
    list($key,$value) = split("\|",$line);
43
    $result[$key]=$value;
44
  }
45
  return $result;
46 46
}
47 47

  
48 48
function readInfo ($infofile, $file) {
49
	global $galerieyear, $galeriemonth, $galerieday, $galeriedesc, $galerieauthor,
50
	       $galeriename, $galerielogin, $galeriepw, $gallery_dir;
49
  global $galerieyear, $galeriemonth, $galerieday, $galeriedesc, $galerieauthor,
50
    $galeriename, $galerielogin, $galeriepw, $gallery_dir;
51 51
	
52
	if (file_exists($infofile)) {
53
		//read from info.txt
54
		$info_array = infoParse($infofile);
55
		if ($info_array["date"]) {
56
			// try to be a little smarter about format
57
			if (ereg("([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})",
58
				$info_array["date"])) {
59
				// remain compatible - DD.MM.YYYY
60
				list($day,$month,$year) = split("\.", $info_array["date"]);
61
				$year = rtrim($year);
62
				$month = rtrim($month);
63
				$day = rtrim($day);
64
				$info_array["date"] = "$year-$month-$day"; //make it US date
65
			}
66
			// US date format at this point
67
			$tstamp = strtotime($info_array["date"]);
68
		} else {
69
			$tstamp = filemtime("$gallery_dir/$file");// Get from filesystem
70
		}
71
		$galerieyear["$file"] = date("Y", $tstamp);
72
		$galeriemonth["$file"] = date("m", $tstamp);
73
		$galerieday["$file"] = date("d", $tstamp);
52
  if (file_exists($infofile)) {
53
    //read from info.txt
54
    $info_array = infoParse($infofile);
55
    if ($info_array["date"]) {
56
      // try to be a little smarter about format
57
      if (ereg("([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})",
58
	       $info_array["date"])) {
59
	// remain compatible - DD.MM.YYYY
60
	list($day,$month,$year) = split("\.", $info_array["date"]);
61
	$year = rtrim($year);
62
	$month = rtrim($month);
63
	$day = rtrim($day);
64
	$info_array["date"] = "$year-$month-$day"; //make it US date
65
      }
66
      // US date format at this point
67
      $tstamp = strtotime($info_array["date"]);
68
    } else {
69
      $tstamp = filemtime("$gallery_dir/$file");// Get from filesystem
70
    }
71
    $galerieyear["$file"] = date("Y", $tstamp);
72
    $galeriemonth["$file"] = date("m", $tstamp);
73
    $galerieday["$file"] = date("d", $tstamp);
74 74
		
75
		if (@$info_array["description"]) {
76
			$galeriedesc["$file"] = rtrim($info_array["description"]);
77
		}
75
    if (@$info_array["description"]) {
76
      $galeriedesc["$file"] = rtrim($info_array["description"]);
77
    }
78 78
		
79
		if (@$info_array["author"]) {
80
			$galerieauthor["$file"] = rtrim($info_array["author"]);
81
		}
79
    if (@$info_array["author"]) {
80
      $galerieauthor["$file"] = rtrim($info_array["author"]);
81
    }
82 82
		
83
		if (@$info_array["name"]) {
84
			$galeriename["$file"] = rtrim($info_array["name"]);
85
		}
83
    if (@$info_array["name"]) {
84
      $galeriename["$file"] = rtrim($info_array["name"]);
85
    }
86 86
		
87
		if (@$info_array["restricted_user"]) {
88
			$galerielogin["$file"] = rtrim($info_array["restricted_user"]);
89
			$galeriepw["$file"] = rtrim($info_array["restricted_password"]);
90
		}
91
 } else { // Get Dates from modification stamp
92
		$mtime = filemtime("$gallery_dir/$file");
93
		$galerieyear["$file"] = date("Y", $mtime);
94
		$galeriemonth["$file"] = date("m", $mtime); //F
95
		$galerieday["$file"] = date("d", $mtime);
96
 }
87
    if (@$info_array["restricted_user"]) {
88
      $galerielogin["$file"] = rtrim($info_array["restricted_user"]);
89
      $galeriepw["$file"] = rtrim($info_array["restricted_password"]);
90
    }
91
  } else { // Get Dates from modification stamp
92
    $mtime = filemtime("$gallery_dir/$file");
93
    $galerieyear["$file"] = date("Y", $mtime);
94
    $galeriemonth["$file"] = date("m", $mtime); //F
95
    $galerieday["$file"] = date("d", $mtime);
96
  }
97 97
}
98 98

  
99 99
function access_check($login, $password,$realm) {
100
   if (!($_SERVER['PHP_AUTH_USER']=="$login" && $_SERVER['PHP_AUTH_PW']=="$password")) {
101
      header("WWW-authenticate: Basic Realm=$realm");
102
      Header("HTTP/1.0 401 Unauthorized");
103
			$err = new C_www;
104
      $err->header("Access Denied");
105
			echo "<div class=\"error\">\n";
106
			echo "<h1>Access Denied</h1>\n";
107
			echo "<p>Sorry, this gallery is restricted</p>\n";
108
			echo "<p><a href=\"index.php\">Return to index</a></p>\n";
109
			echo "</div>\n";
110
			$err->footer();
111
      exit;
112
   }
100
  if (!($_SERVER['PHP_AUTH_USER']=="$login" && $_SERVER['PHP_AUTH_PW']=="$password")) {
101
    header("WWW-authenticate: Basic Realm=$realm");
102
    Header("HTTP/1.0 401 Unauthorized");
103
    $err = new C_www;
104
    $err->header("Access Denied");
105
    echo "<div class=\"error\">\n";
106
    echo "<h1>Access Denied</h1>\n";
107
    echo "<p>Sorry, this gallery is restricted</p>\n";
108
    echo "<p><a href=\"index.php\">Return to index</a></p>\n";
109
    echo "</div>\n";
110
    $err->footer();
111
    exit;
112
  }
113 113

  
114 114
}
115 115

  
116 116
function random_digits($times) {
117
	$random="";
118
	for ($i=0;$i<$times;$i++) {
119
		$random .= rand(0,9);
120
	}
121
	return $random;
117
  $random="";
118
  for ($i=0;$i<$times;$i++) {
119
    $random .= rand(0,9);
120
  }
121
  return $random;
122 122
}
123 123

  
124 124
function get_photo_title($galerie, $id) {
www/index.php
1 1
<?php
2
# uncomment this to check for uninitialized variables etc.:
3
# error_reporting (E_ALL);
2
// uncomment this to check for uninitialized variables etc.:
3
// error_reporting (E_ALL);
4 4

  
5
#language support
5
//language support
6 6
require_once ("lib/lib.l10n.php");
7 7
require_once("inc/config.inc.php");
8 8
require_once("inc/www.class.inc.php");
......
10 10
//session_name("navstevnik");
11 11
//session_register("page");
12 12

  
13
#set the language translation
13
//set the language translation
14 14
l10n::set("$root/l10n/".$sclang."/main.lang");
15 15
l10n::set("$root/l10n/".$sclang."/date.lang");
16 16

  
17

  
18

  
19

  
20
# always get sorted directory entries
17
// always get sorted directory entries
21 18
$adr = new SortDir("$gallery_dir");
22 19

  
23
# get variables passed in from the URL:
20
// get variables passed in from the URL:
24 21
$galerie='';
25 22
if (isset($_GET['galerie'])) $galerie=$_GET["galerie"];
26 23
if (isset($_GET['gallery'])) $galerie=$_GET["gallery"];
......
42 39

  
43 40
if (!is_dir("$gallery_dir/$galerie/thumbs")) {
44 41
  $galerie = "";
45
}
42
 }
46 43

  
47 44
//read interesting stuff from info.txt
48 45
if ($galerie) { 
49
	readInfo("$root/$gallery_dir/$galerie/info.txt", $galerie);
50
//check for restricted access
51
	if ($galerielogin[$galerie]) {
52
			 access_check($galerielogin[$galerie],$galeriepw[$galerie],$galerie);
53
	}
54
}
46
  readInfo("$root/$gallery_dir/$galerie/info.txt", $galerie);
47
  //check for restricted access
48
  if ($galerielogin[$galerie]) {
49
    access_check($galerielogin[$galerie],$galeriepw[$galerie],$galerie);
50
  }
51
 }
55 52

  
56 53
$page->process_comment_form();
57 54

  
......
60 57
//ryxeo
61 58
if($_GET['slideshow'] == 'play')
62 59
  $slideshow = true;
63
else
64
  $slideshow = false;
60
 else
61
   $slideshow = false;
65 62

  
66 63
if($_GET['directdownload'] == "true") {
67 64
  require_once("$root/inc/photo.class.inc.php");
......
78 75
  readfile($picture->preview);
79 76
  //print_r($picture);
80 77
  exit;
81
}
78
 }
82 79

  
83 80
$page->header("Photos");
84 81
require("inc/header.inc.php");
......
87 84
//print "<div class=\"navigation\"><a href=\"$ThisScript\">" . $scnamegallery . "</a>";
88 85
print "<div class=\"navigation\"><a href=\"./\">" . $scnamegallery . "</a>";
89 86

  
90
#############################
91
# 	Overall Gallery Index		#
92
#############################
87
//############################
88
// 	Overall Gallery Index
89
//############################
93 90
if (!$galerie) {
94
   # finish off navigation bar
95
   print "</div>\n\n<!-- listing galleries-->\n\n";  
96
	 # I've nuked date.txt to replace it with a more generic info.txt
97
   # It optionally supplies i18n name, camera model, author and date
98
	 # TODO: imgconv script support
99
   while ($file = $adr->Read()) {
100
      // checking for inc is only really needed when gallery_dir == $root
101
      // hopefully not many galleries will be named inc ;)
102
      if (is_dir("$gallery_dir/$file") && !ereg("\.", $file) && $file!="inc") { 
103
         // Use date file for gallery date if avaliable
104
				 // info.txt format described in README
105
         readInfo("$root/$gallery_dir/$file/info.txt", $file);
106
         
107
      }
108
   }
109

  
110
	 if (!isset($galeriemonth)) $galeriemonth = array();
111
   if (!isset($galerieday)) $galerieday = array();
112
	 //sort within month depending on $sortinmonth
113
	 if ($sortinmonth) {
114
		 //alphabetically
115
		 ksort($galeriemonth);
116
		 reset($galeriemonth);
117
	 } else {//by date
118
		 arsort($galerieday);
119
		 reset($galerieday);
120
	 }
121

  
122

  
123
	 $thisyear = 0;
124
	 if (!$yearto) $yearto = date("Y");
125
   for ($i = $yearto; $i >= $yearsince; $i--) {
126
      for ($thismonth=12; $thismonth>0; $thismonth--) { // go year by year, month by month
127
																												// down
128
				 foreach ($galerieday as $foldername => $day) { //using $galerieday (for when sorted)
129
						if ($galeriemonth["$foldername"] == $thismonth && 
130
							      $galerieyear["$foldername"] == $i) { //such Y/M exists
131

  
132
								$galerieyearordered["$foldername"]=$galerieyear["$foldername"];
133
								$galeriemonthordered["$foldername"]=$galeriemonth["$foldername"];
134
						}
135
				 }
91
  // finish off navigation bar
92
  print "</div>\n\n<!-- listing galleries-->\n\n";  
93
  // I've nuked date.txt to replace it with a more generic info.txt
94
  // It optionally supplies i18n name, camera model, author and date
95
  // TODO: imgconv script support
96
  while ($file = $adr->Read()) {
97
    // checking for inc is only really needed when gallery_dir == $root
98
    // hopefully not many galleries will be named inc ;)
99
    if (is_dir("$gallery_dir/$file") && !ereg("\.", $file) && $file!="inc") { 
100
      // Use date file for gallery date if avaliable
101
      // info.txt format described in README
102
      readInfo("$root/$gallery_dir/$file/info.txt", $file);
103
      
104
    }
105
  }
106
  
107
  if (!isset($galeriemonth)) $galeriemonth = array();
108
  if (!isset($galerieday)) $galerieday = array();
109
  //sort within month depending on $sortinmonth
110
  if ($sortinmonth) {
111
    //alphabetically
112
    ksort($galeriemonth);
113
    reset($galeriemonth);
114
  } else {//by date
115
    arsort($galerieday);
116
    reset($galerieday);
117
  }
118
  
119
  
120
  $thisyear = 0;
121
  if (!$yearto) $yearto = date("Y");
122
  for ($i = $yearto; $i >= $yearsince; $i--) {
123
    for ($thismonth=12; $thismonth>0; $thismonth--) { // go year by year, month by month
124
      // down
125
      foreach ($galerieday as $foldername => $day) { //using $galerieday (for when sorted)
126
	if ($galeriemonth["$foldername"] == $thismonth && 
127
	    $galerieyear["$foldername"] == $i) { //such Y/M exists
128
	  
129
	  $galerieyearordered["$foldername"]=$galerieyear["$foldername"];
130
	  $galeriemonthordered["$foldername"]=$galeriemonth["$foldername"];
131
	}
136 132
      }
137
   }
138

  
139

  
140
	 $months = array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'),
141
	 __('September'), __('October'), __('November'), __('December'));
142
	 $one_out = false;
143
	 foreach ($galerieyearordered as $foldername => $year) {
144
		  $one_out = true;
145
			if (@$thisyear!=$year) { #if the year is not equal to the current year
146
				 #This is the first year
147
				 if (@$thisyear) { print "   </div>\n</div>\n";}// end last year if this is 
148
																				 // not the first one
149
				 #This is a new year
150
				 unset($thismonth);
151
				 print "<div class=\"year\"><h3>$year</h3>\n";
152
				 print "";
153
			}
154
			$month=$galeriemonth["$foldername"];
155
			# now months
156
			if (@$thismonth!=$month) {
157
				 #first one
158
				 if (@$thismonth) { print "   </div>\n"; } // end of last month if
159
																							// this is not the first one
160
				 #new month
161
				 $monthindex = $month - 1;
162
				 $monthname = $months[$monthindex];
163
				 print "   <div class=\"month\"><h4>$monthname</h4>\n";
164
			}
165
			#galleries within month	
166
			if ($galerielogin[$foldername]) {
167
				print "      <p class=\"restricted\"><a ";
168
			} else {
169
				print "      <p><a ";
170
			}
171
			if (@$galeriename[$foldername]) {
172
				print " href=\"$ThisScript?galerie=$foldername\">";
173
				print $galeriename[$foldername];
174
				print "</a>";
175
			} else {
176
				print " href=\"$ThisScript?galerie=$foldername\">$foldername</a>";
177
			}
178
			if (@$galeriedesc[$foldername]) {
179
				print "<span class=\"desc\">" . $galeriedesc[$foldername];
180
				print "</span>\n";
181
			}
182
			if (@$galerieauthor[$foldername]) {
183
				print "<span class=\"author\">by&nbsp;" . $galerieauthor[$foldername];
184
				print "</span>\n";
185
			}
186
			if (@$galerieday[$foldername]) {
187
				print "<span class=\"date\">";
188
				print "$monthname&nbsp;" . $galerieday[$foldername];
189
				print "</span>\n";
190
			}
191
			print "</p>\n";
192
			$thisyear=$year;
193
			$thismonth=$month;
194
	 }
195
	 if ($one_out) print ("   </div>\n</div>\n\n");
133
    }
134
  }
135
  
136
  
137
  $months = array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'),
138
		  __('September'), __('October'), __('November'), __('December'));
139
  $one_out = false;
140
  foreach ($galerieyearordered as $foldername => $year) {
141
    $one_out = true;
142
    if (@$thisyear!=$year) { //if the year is not equal to the current year
143
      //This is the first year
144
      if (@$thisyear) { print "   </div>\n</div>\n";}// end last year if this is 
145
      // not the first one
146
      //This is a new year
147
      unset($thismonth);
148
      print "<div class=\"year\"><h3>$year</h3>\n";
149
      print "";
150
    }
151
    $month=$galeriemonth["$foldername"];
152
    // now months
153
    if (@$thismonth!=$month) {
154
      //first one
155
      if (@$thismonth) { print "   </div>\n"; } // end of last month if
156
      // this is not the first one
157
      //new month
158
      $monthindex = $month - 1;
159
      $monthname = $months[$monthindex];
160
      print "   <div class=\"month\"><h4>$monthname</h4>\n";
161
    }
162
    //galleries within month	
163
    if ($galerielogin[$foldername]) {
164
      print "      <p class=\"restricted\"><a ";
165
    } else {
166
      print "      <p><a ";
167
    }
168
    if (@$galeriename[$foldername]) {
169
      print " href=\"$ThisScript?galerie=$foldername\">";
170
      print $galeriename[$foldername];
171
      print "</a>";
172
    } else {
173
      print " href=\"$ThisScript?galerie=$foldername\">$foldername</a>";
174
    }
175
    if (@$galeriedesc[$foldername]) {
176
      print "<span class=\"desc\">" . $galeriedesc[$foldername];
177
      print "</span>\n";
178
    }
179
    if (@$galerieauthor[$foldername]) {
180
      print "<span class=\"author\">by&nbsp;" . $galerieauthor[$foldername];
181
      print "</span>\n";
182
    }
183
    if (@$galerieday[$foldername]) {
184
      print "<span class=\"date\">";
185
      print "$monthname&nbsp;" . $galerieday[$foldername];
186
      print "</span>\n";
187
    }
188
    print "</p>\n";
189
    $thisyear=$year;
190
    $thismonth=$month;
191
  }
192
  if ($one_out) print ("   </div>\n</div>\n\n");
196 193
   
197
##############################
198
#  Individual Gallery Index  #
199
##############################
200
} elseif (!$snimek) {
194
  //#############################
195
  //  Individual Gallery Index  #
196
  //#############################
197
 } elseif (!$snimek) {
201 198
	 
202
   # finish off navigation header
199
   // finish off navigation header
203 200
	 
204 201
   print "\n &gt; ";
205
	 if ($galeriename[$galerie]) {
206
		 print $galeriename[$galerie];
207
	 } else {
208
		 print $galerie;
209
	 }
210
	 print "</div>\n\n";
202
   if ($galeriename[$galerie]) {
203
     print $galeriename[$galerie];
204
   } else {
205
     print $galerie;
206
   }
207
   print "</div>\n\n";
211 208

  
212
	 //thumbnails
213
	 print "<p class=\"bigthumbnails\">\n";
209
   //thumbnails
210
   print "<p class=\"bigthumbnails\">\n";
214 211
   $path = "$gallery_dir/$galerie/thumbs";
215 212
   $imgfiles = new SortDir($path);
216 213
   check($galerie); // check for nasty input
217 214
   while ($file = $imgfiles->read()) {
218
      if (is_file("$path/$file") && eregi("^img-([0-9]+)\.(png|jpe?g)", $file, $x)) {
215
     if (is_file("$path/$file") && eregi("^img-([0-9]+)\.(png|jpe?g)", $file, $x)) {
219 216
				 				 
220
         $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
221
         $imgsize = getimagesize("$root/$thumb");
222
				 //check for portraits
223
				 $portrait = "false";
224
				 $class = "";
225
				 if($imgsize[0]<100) {
226
					 //portraits need a special class for styling
227
					 $class = "portrait";
228
				 }
229
				 //check for number of comments per photo
230
				 if ($comments) { //there probably won't be user comments if it's off
231
				   $NumOfComments = 0;
232
					 if (file_exists("$gallery_dir/$galerie/comments/user_${x[1]}.txt")) {
233
							if ($class) $class .= " ";
234
							$class .= "hascomments";
235
							//now let's count'em
236
							$fh = fopen("$gallery_dir/$galerie/comments/user_${x[1]}.txt","r");
237
							while (!feof($fh)) {
238
								$line = fgets($fh);
239
								if (eregi("commententry",$line)) $NumOfComments++;
240
							}
241
							fclose($fh);
242
					 }
243
					 if ($NumOfComments==1) {
244
						 $NumOfComments = $NumOfComments . " " . __('Comment');
245
					 } else {
246
						 $NumOfComments = $NumOfComments . " " . __('Comments');
247
					 }
248
				 }
249
	 if (file_exists("$gallery_dir/$galerie/comments/${x[1]}.txt") &&
250
		   $title = file_get_contents("$gallery_dir/$galerie/comments/${x[1]}.txt")) {
251
	     $title = ereg_replace("(\"|\')","",trim(strip_tags($title)));
252
	     $title = ereg_replace("(.{77}).*","\\1",$title);
253
	 } else 
254
	   $title = "Photo ${x[1]}";
255

  
256
         print "   <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}\"";
257
				 print " title=\"$title, $NumOfComments\"";
258
				 if ($class) print " class=\"$class\"";
259
				 print ">";
260
         print "<img ";
261
         if (isset($thumbsize)) {
262
            print "width=\"120\" height=\"80\" ";
263
         } else {
264
            // scale portraits to 80 height
265
            if ($portrait) {
266
							//portrait
267
               print "width=\"";
268
               $scaled = round($imgsize[0] / 1.5);
269
               print $scaled;
270
               print "\" height=\"${imgsize[0]}\"";
271
            } else {
272
							//landscape
273
               print $imgsize[3]; 
274
            }
275
         }
276
         print " src=\"$thumb\" ";
277
         print "alt=\"photo No. ${x[1]}\" />";
278
         print "</a>\n";
279
      }
217
       $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
218
       $imgsize = getimagesize("$root/$thumb");
219
       //check for portraits
220
       $portrait = "false";
221
       $class = "";
222
       if($imgsize[0]<100) {
223
	 //portraits need a special class for styling
224
	 $class = "portrait";
225
       }
226
       //check for number of comments per photo
227
       if ($comments) { //there probably won't be user comments if it's off
228
	 $NumOfComments = 0;
229
	 if (file_exists("$gallery_dir/$galerie/comments/user_${x[1]}.txt")) {
230
	   if ($class) $class .= " ";
231
	   $class .= "hascomments";
232
	   //now let's count'em
233
	   $fh = fopen("$gallery_dir/$galerie/comments/user_${x[1]}.txt","r");
234
	   while (!feof($fh)) {
235
	     $line = fgets($fh);
236
	     if (eregi("commententry",$line)) $NumOfComments++;
237
	   }
238
	   fclose($fh);
239
	 }
240
	 if ($NumOfComments==1) {
241
	   $NumOfComments = $NumOfComments . " " . __('Comment');
242
	 } else {
243
	   $NumOfComments = $NumOfComments . " " . __('Comments');
244
	 }
245
       }
246
       if (file_exists("$gallery_dir/$galerie/comments/${x[1]}.txt") &&
247
	   $title = file_get_contents("$gallery_dir/$galerie/comments/${x[1]}.txt")) {
248
	 $title = ereg_replace("(\"|\')","",trim(strip_tags($title)));
249
	 $title = ereg_replace("(.{77}).*","\\1",$title);
250
       } else 
251
	 $title = "Photo ${x[1]}";
252

  
253
       print "   <a href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}\"";
254
       print " title=\"$title, $NumOfComments\"";
255
       if ($class) print " class=\"$class\"";
256
       print ">";
257
       print "<img ";
258
       if (isset($thumbsize)) {
259
	 print "width=\"120\" height=\"80\" ";
260
       } else {
261
	 // scale portraits to 80 height
262
	 if ($portrait) {
263
	   //portrait
264
	   print "width=\"";
265
	   $scaled = round($imgsize[0] / 1.5);
266
	   print $scaled;
267
	   print "\" height=\"${imgsize[0]}\"";
268
	 } else {
269
	   //landscape
270
	   print $imgsize[3]; 
271
	 }
272
       }
273
       print " src=\"$thumb\" ";
274
       print "alt=\"photo No. ${x[1]}\" />";
275
       print "</a>\n";
276
     }
280 277
   }
281 278
   print "</p>\n";
282 279

  
283
	 //info
284
	 print "<div id=\"info\">\n";
285
	 if ($galeriedesc[$galerie]) {
286
		 print "<p>";
287
		 print "<span class=\"value\">";
288
		 print $galeriedesc[$galerie] . "</span></p>\n";
289
	 }
290
	 if ($galerieauthor[$galerie]) {
291
		 print "<p><span class=\"key\">Author: </span>";
292
		 print "<span class=\"value\">";
293
		 print $galerieauthor[$galerie] . "</span></p>\n";
294
	 }
295
	 print "</div>\n";
280
   //info
281
   print "<div id=\"info\">\n";
282
   if ($galeriedesc[$galerie]) {
283
     print "<p>";
284
     print "<span class=\"value\">";
285
     print $galeriedesc[$galerie] . "</span></p>\n";
286
   }
287
   if ($galerieauthor[$galerie]) {
288
     print "<p><span class=\"key\">Author: </span>";
289
     print "<span class=\"value\">";
290
     print $galerieauthor[$galerie] . "</span></p>\n";
291
   }
292
   print "</div>\n";
296 293

  
297 294
   //and links to archived images:
298 295
   print "\n<p class=\"archives\">\n";
299 296
   if (file_exists("$gallery_dir/$galerie/zip/mq.zip")) {
300
      print "[ <a href=\"$gallery_dir/$galerie/zip/mq.zip\">" . __('zipped MQ images') . "</a> ] ";
297
     print "[ <a href=\"$gallery_dir/$galerie/zip/mq.zip\">" . __('zipped MQ images') . "</a> ] ";
301 298
   }
302 299
   if (file_exists("$gallery_dir/$galerie/zip/mq.tar.bz2")) {
303
      print "[ <a href=\"$gallery_dir/$galerie/zip/mq.tar.bz2\">" . __('MQ images tarball') . "</a> ] ";
300
     print "[ <a href=\"$gallery_dir/$galerie/zip/mq.tar.bz2\">" . __('MQ images tarball') . "</a> ] ";
304 301
   }
305 302
   if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) {
306
      print "[ <a href=\"$gallery_dir/$galerie/zip/hq.zip\">" . __('zipped HQ images') . "</a> ]";
303
     print "[ <a href=\"$gallery_dir/$galerie/zip/hq.zip\">" . __('zipped HQ images') . "</a> ]";
307 304
   }
308 305
   if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) {
309
      print "[ <a href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">" . __('HQ images tarball') . "</a> ]";
306
     print "[ <a href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">" . __('HQ images tarball') . "</a> ]";
310 307
   }
311 308
   print "</p>";
312 309

  
313
#######################
314
# 	Individual Image	#
315
#######################
316
} else { //low-res image
317
   # finish off header
318
   print "\n &gt; <a href=\"$ThisScript?galerie=$galerie\">";
319
	 if ($galeriename[$galerie]) {
320
		 print $galeriename[$galerie];
321
	 } else {
322
		 print $galerie;
323
	 }
324
	 print "</a>\n &gt; Photo";
325
   print " $snimek</div>";
326
   $path = "$gallery_dir/$galerie/thumbs";
327
   $imgfiles = new SortDir("$path");
328
   check($galerie);
329
   $path = "$gallery_dir/$galerie/lq";
330
   $file = "$path/img-$snimek.jpg";
331
   if (!file_exists($file)) {
332
      print __('No such image');
333
      $page->footer();
334
      exit;
335
   }
310
   //######################
311
   // 	Individual Image
312
   //######################
313
   } else { //low-res image
314
  // finish off header
315
  print "\n &gt; <a href=\"$ThisScript?galerie=$galerie\">";
316
  if ($galeriename[$galerie]) {
317
    print $galeriename[$galerie];
318
  } else {
319
    print $galerie;
320
  }
321
  print "</a>\n &gt; Photo";
322
  print " $snimek</div>";
323
  $path = "$gallery_dir/$galerie/thumbs";
324
  $imgfiles = new SortDir("$path");
325
  check($galerie);
326
  $path = "$gallery_dir/$galerie/lq";
327
  $file = "$path/img-$snimek.jpg";
328
  if (!file_exists($file)) {
329
    print __('No such image');
330
    $page->footer();
331
    exit;
332
  }
336 333
	 
337
	 if (!$picture) { //picture may have been created if commentform submitted
338
	    require_once("$root/inc/photo.class.inc.php");
339
	    $picture = new C_photo($file, $snimek);
340
	 }
341

  
342
   // mini thumbnail roll
343

  
344
   if ($show_thumbs) {
345
     print "\n<!--mini thumbnail roll-->\n<div id=\"thumbs\" class=\"navigation\" style=\"visibility: hidden\"><ul class=\"thumbs noscript\" style=\"display:none\">";
346
      print "<a id=\"minus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
347
      print "\">";
348
      print "</a>\n";
349
      print " : \n";
350
      while ($thumbfile = $imgfiles->read()) {
351
         if ( eregi("^img-([0-9]+)\.(png|jpe?g)",
352
             $thumbfile, $x)) {
353
            $thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
354
            print "   <li><a class=\"thumb\" href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}&amp;directdownload=true\"";
355
	    print " name=\"" . get_photo_title($galerie, $x[1]) . "\" title=\"" . get_photo_title($galerie, $x[1]) . "\">";
356
            print "</a></li> \n";
357
         }
334
  if (!$picture) { //picture may have been created if commentform submitted
335
    require_once("$root/inc/photo.class.inc.php");
336
    $picture = new C_photo($file, $snimek);
337
  }
338

  
339
  // mini thumbnail roll
340

  
341
  if ($show_thumbs) {
342
    print "\n<!--mini thumbnail roll-->\n<div id=\"thumbs\" class=\"navigation\" style=\"visibility: hidden\"><ul class=\"thumbs noscript\" style=\"display:none\">";
343
    print "<a id=\"minus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
344
    print "\">";
345
    print "</a>\n";
346
    print " : \n";
347
    while ($thumbfile = $imgfiles->read()) {
348
      if ( eregi("^img-([0-9]+)\.(png|jpe?g)",
349
		 $thumbfile, $x)) {
350
	$thumb = "$gallery_dir/$galerie/thumbs/img-${x[1]}.${x[2]}";
351
	print "   <li><a class=\"thumb\" href=\"$ThisScript?galerie=$galerie&amp;photo=${x[1]}&amp;directdownload=true\"";
352
	print " name=\"" . get_photo_title($galerie, $x[1]) . "\" title=\"" . get_photo_title($galerie, $x[1]) . "\">";
353
	print "</a></li> \n";
358 354
      }
359
      if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) {
360
         print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.zip\">";
361
         print "zip<span /></a>";
362
      }
363
      if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) {
364
         print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">";
365
         print "zip<span /></a>";
366
      }
367
      print "</ul></div>\n";
368
   } else {
369
      // show the popup button
370
      print "\n<!--mini thumbnail popup-->\n<div class=\"thumbroll\">";
371
      print "<a id=\"plus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
372
      print "&amp;show_thumbs=yes\"";
373
			print " title=\"" . __('Show Thumbnail Navigation') . "\">";
374
      print "</a>\n";
375
      print "</div>\n";
376
   }
377

  
378
   /* main image + thumbnail navigation (prev/next) */
379

  
380
   if($slideshow) {
381
     print "
355
    }
356
    if (file_exists("$gallery_dir/$galerie/zip/hq.zip")) {
357
      print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.zip\">";
358
      print "zip<span /></a>";
359
    }
360
    if (file_exists("$gallery_dir/$galerie/zip/hq.tar.bz2")) {
361
      print "<a id=\"zip\" href=\"$gallery_dir/$galerie/zip/hq.tar.bz2\">";
362
      print "zip<span /></a>";
363
    }
364
    print "</ul></div>\n";
365
  } else {
366
    // show the popup button
367
    print "\n<!--mini thumbnail popup-->\n<div class=\"thumbroll\">";
368
    print "<a id=\"plus\" href=\"$ThisScript?galerie=$galerie&amp;photo=$snimek";
369
    print "&amp;show_thumbs=yes\"";
370
    print " title=\"" . __('Show Thumbnail Navigation') . "\">";
371
    print "</a>\n";
372
    print "</div>\n";
373
  }
374

  
375
  /* main image + thumbnail navigation (prev/next) */
376

  
377
  if($slideshow) {
378
    print "
382 379
<div id=\"gallery\" class=\"content\">
383 380
  <div class=\"slideshow-container\">
384 381
   <div id=\"loading\" class=\"loader\"></div>
385 382
   <div id=\"slideshow\" class=\"slideshow\" style=\"height:480;\"></div>
386 383
  </div>
387 384
</div>\n";
388
   }
389
   else {
390
     $picture->renderPreview();
391
     $page->navigation($galerie, $snimek, "prev");
392
     $page->navigation($galerie, $snimek, "next");
393
   }
394
   print "</div>\n"; //end image div
395

  
396

  
397
   if(!$slideshow) {
398
     if (function_exists(exif_read_data)) require("$root/inc/exif.inc.php"); 
399
     /* Image comment
400
	really poor naming here, it is caption.
401
     */
402
     $picture->renderCaption();
385
  }
386
  else {
387
    $picture->renderPreview();
388
    $page->navigation($galerie, $snimek, "prev");
389
    $page->navigation($galerie, $snimek, "next");
390
  }
391
  print "</div>\n"; //end image div
392

  
393

  
394
  if(!$slideshow) {
395
    if (function_exists(exif_read_data)) require("$root/inc/exif.inc.php"); 
396
    /* Image comment
397
       really poor naming here, it is caption.
398
    */
399
    $picture->renderCaption();
403 400
     
404 401
     
405
     //show page counter
406
     if ($log_access) {
407
       $picture->renderCounter();
408
     }
402
    //show page counter
403
    if ($log_access) {
404
      $picture->renderCounter();
405
    }
409 406
     
410
     $picture->renderBigSize();
407
    $picture->renderBigSize();
411 408
     
412
     $page->user_comments($picture->number);
413
     $page->navigation($galerie, $snimek, null);
414
   }
415
}
409
    $page->user_comments($picture->number);
410
    $page->navigation($galerie, $snimek, null);
411
  }
412
 }
416 413

  
417 414
require("inc/footer.inc.php");
418 415

  
......
430 427
  });
431 428
});
432 429
</script>\n";
433
}
430
 }
434 431

  
435 432
$page->footer();
436 433
?>

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux