summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php91
-rw-r--r--phpfspot.js2
-rw-r--r--rpc.php2
-rw-r--r--themes/default/templates/single_photo.tpl24
-rw-r--r--themes/default/templates/tags.tpl6
5 files changed, 96 insertions, 29 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index badc728..99b0d7b 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -245,7 +245,7 @@ class PHPFSPOT {
$this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name);
/* parse URL */
- if(isset($this->cfg->user_friendly_url) && $this->cfg->user_friendly_url) {
+ if($this->is_user_friendly_url()) {
$content = $this->parse_user_friendly_url($_SERVER['REQUEST_URI']);
}
@@ -619,12 +619,15 @@ class PHPFSPOT {
$this->tmpl->assign('ExifOrigResolution', $meta_res);
$this->tmpl->assign('ExifFileSize', $meta_size);
- if(!isset($this->cfg->user_friendly_url) || !$this->cfg->user_friendly_url)
- $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width);
- else
+ if($this->is_user_friendly_url()) {
$this->tmpl->assign('image_url', '/photo/'. $photo ."/". $this->cfg->photo_width);
+ $this->tmpl->assign('image_url_full', '/photo/'. $photo);
+ }
+ else {
+ $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width);
+ $this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo);
+ }
- $this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo);
$this->tmpl->assign('image_filename', $this->parse_uri($details['uri'], 'filename'));
$this->tmpl->assign('tags', $this->get_photo_tags($photo));
@@ -1353,17 +1356,19 @@ class PHPFSPOT {
$this->tmpl->assign('thumbs', $thumbs);
$this->tmpl->assign('selected_tags', $this->getSelectedTags('img'));
- $this->tmpl->show("photo_index.tpl");
+ $result = $this->tmpl->fetch("photo_index.tpl");
/* if we are returning to photo index from an photo-view,
scroll the window to the last shown photo-thumbnail.
after this, unset the last_photo session variable.
*/
if(isset($_SESSION['last_photo'])) {
- print "<script language=\"JavaScript\">moveToThumb(". $_SESSION['last_photo'] .");</script>\n";
+ $result.= "<script language=\"JavaScript\">moveToThumb(". $_SESSION['last_photo'] .");</script>\n";
unset($_SESSION['last_photo']);
}
+ return $result;
+
} // showPhotoIndex()
/**
@@ -2277,7 +2282,7 @@ class PHPFSPOT {
foreach($pictures as $picture) {
- $orig_url = $this->get_phpfspot_url() ."index.php?mode=showp&id=". $picture;
+ $orig_url = $this->get_phpfspot_url() ."/index.php?mode=showp&id=". $picture;
if($current_tags != "") {
$orig_url.= "&tags=". $current_tags;
}
@@ -2285,7 +2290,12 @@ class PHPFSPOT {
$orig_url.= "&from_date=". $_SESSION['from_date'] ."&to_date=". $_SESSION['to_date'];
}
- $thumb_url = $this->get_phpfspot_url() ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
+ if($this->is_user_friendly_url()) {
+ $thumb_url = $this->get_phpfspot_url() ."/photo/". $picture ."/". $this->cfg->thumb_width;
+ }
+ else {
+ $thumb_url = $this->get_phpfspot_url() ."/phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
+ }
switch($mode) {
@@ -2334,7 +2344,7 @@ class PHPFSPOT {
foreach($pictures as $picture) {
- $orig_url = $this->get_phpfspot_url() ."index.php?mode=showp&id=". $picture;
+ $orig_url = $this->get_phpfspot_url() ."/index.php?mode=showp&id=". $picture;
if($current_tags != "") {
$orig_url.= "&tags=". $current_tags;
}
@@ -2344,7 +2354,13 @@ class PHPFSPOT {
$details = $this->get_photo_details($picture);
- $thumb_url = $this->get_phpfspot_url() ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
+ if($this->is_user_friendly_url()) {
+ $thumb_url = $this->get_phpfspot_url() ."/photo/". $picture ."/". $this->cfg->thumb_width;
+ }
+ else {
+ $thumb_url = $this->get_phpfspot_url() ."/phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
+ }
+
$thumb_html = htmlspecialchars("
<a href=\"". $orig_url ."\"><img src=\"". $thumb_url ."\" /></a>
<br>
@@ -2527,7 +2543,11 @@ class PHPFSPOT {
else
$_SESSION['slideshow_img']++;
- return $this->get_phpfspot_url() ."phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
+ if($this->is_user_friendly_url()) {
+ return $this->get_phpfspot_url() ."/photo/". $all_photos[$_SESSION['slideshow_img']] ."/". $this->cfg->photo_width;
+ }
+
+ return $this->get_phpfspot_url() ."/phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
} // getNextSlideShowImage()
@@ -2547,7 +2567,11 @@ class PHPFSPOT {
else
$_SESSION['slideshow_img']--;
- return $this->get_phpfspot_url() ."phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
+ if($this->is_user_friendly_url()) {
+ return $this->get_phpfspot_url() ."/photo/". $all_photos[$_SESSION['slideshow_img']] ."/". $this->cfg->photo_width;
+ }
+
+ return $this->get_phpfspot_url() ."/phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
} // getPrevSlideShowImage()
@@ -2747,7 +2771,16 @@ class PHPFSPOT {
*/
private function get_phpfspot_url()
{
- return $this->get_web_protocol() ."://". $this->get_server_name() . $this->cfg->web_path;
+ if($this->cfg->web_path == "/")
+ $web_path = "";
+ /* remove trailing slash */
+ elseif(preg_match('/\/$/', $this->cfg->web_path))
+ $web_path = preg_replace('/\/$/', '', $this->cfg->web_path);
+ else
+ $web_path = $this->cfg->web_path;
+
+ return $this->get_web_protocol() ."://". $this->get_server_name() . $web_path;
+
} // get_phpfspot_url()
/**
@@ -3062,7 +3095,10 @@ class PHPFSPOT {
private function parse_user_friendly_url($request_uri)
{
- if(preg_match('/\/photoview\/|\/photo\//', $request_uri)) {
+ if(preg_match('/\/photoview\/|\/photo\/|\/tag\//', $request_uri)) {
+
+ unset($_SESSION['start_action']);
+ unset($_SESSION['selected_tags']);
$options = explode('/', $request_uri);
@@ -3083,11 +3119,36 @@ class PHPFSPOT {
}
exit;
break;
+ case 'tag':
+ if(is_numeric($options[2])) {
+ $_GET['mode'] = 'showpi';
+ $_SESSION['selected_tags'] = Array($options[2]);
+ $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
+ $_GET['tags'] = $options[2];
+ return $this->showPhotoIndex();
+ }
+ break;
}
}
} // parse_user_friendly_url()
+ /**
+ * check if user-friendly-urls are enabled
+ *
+ * this function will return true, if the config option
+ * $user_friendly_url has been set. Otherwise false.
+ * @return boolean
+ */
+ private function is_user_friendly_url()
+ {
+ if(isset($this->cfg->user_friendly_url) && $this->cfg->user_friendly_url)
+ return true;
+
+ return false;
+
+ } // is_user_friendly_url()
+
} // class PHPFSPOT
diff --git a/phpfspot.js b/phpfspot.js
index 6c0054d..47ebe32 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -373,6 +373,8 @@ function init_phpfspot(mode)
/* ask the server what we are currently displaying */
whattodo = AskServerWhatToDo();
+ window.alert(whattodo);
+
if(whattodo == 'showpi' || whattodo == 'showpi_date') {
showPhotoIndex();
}
diff --git a/rpc.php b/rpc.php
index 5ff334e..e2da768 100644
--- a/rpc.php
+++ b/rpc.php
@@ -117,7 +117,7 @@ class PHPFSPOT_RPC {
if(isset($_GET['last_photo']) && is_numeric($_GET['last_photo']))
$_SESSION['last_photo'] = $_GET['last_photo'];
- $phpfspot->showPhotoIndex();
+ return $phpfspot->showPhotoIndex();
break;
case 'showcredits':
diff --git a/themes/default/templates/single_photo.tpl b/themes/default/templates/single_photo.tpl
index 04a3502..8526053 100644
--- a/themes/default/templates/single_photo.tpl
+++ b/themes/default/templates/single_photo.tpl
@@ -15,14 +15,14 @@
{/if}
</div>
<div style="text-align: right;">
- <a href="javascript:zoom(-10);" title="zoom_out" onclick="click(this);"><img src="resources/zoom-out.png" /></a>
- <a href="javascript:zoom(0);" title="zoom_100" onclick="click(this);"><img src="resources/zoom-100.png" /></a>
- <a href="javascript:zoom(10);" title="zoom_in" onclick="click(this);"><img src="resources/zoom-in.png" /></a>
+ <a href="javascript:zoom(-10);" title="zoom_out" onfocus="click(this);"><img src="resources/zoom-out.png" /></a>
+ <a href="javascript:zoom(0);" title="zoom_100" onfocus="click(this);"><img src="resources/zoom-100.png" /></a>
+ <a href="javascript:zoom(10);" title="zoom_in" onfocus="click(this);"><img src="resources/zoom-in.png" /></a>
<a href="javascript:startAutoBrowse();" title="auto browsing"><img id="autobrowse_ico" src="resources/16_play.png" />&nbsp;Auto-Browse</a>
{if $extern_link }
<a href="{$extern_link}" title="Use this link to return to the current view"><img src="resources/link.png" />&nbsp;External Link</a>
{/if}
- <a href="{$image_url_full}" title="orig_image" target="_blank" onclick="click(this);"><img src="resources/original.png" alt="original resolution" />&nbsp;Fullsize</a>
+ <a href="{$image_url_full}" title="orig_image" target="_blank" onfocus="click(this);"><img src="resources/original.png" alt="original resolution" />&nbsp;Fullsize</a>
</div>
</div>
@@ -45,19 +45,19 @@
<br />
<u><img src="resources/small_available_tags.png" alt="available tags" />&nbsp;Tagged with:</u><br />
{ foreach from=$tags key=id item=name }
- <a class="smalltag" href="javascript:Tags('add', '{$id}');" onclick="click(this);" onclick="click(this);">{$name}</a><br />
+ <a class="smalltag" href="javascript:Tags('add', '{$id}');" onfocus="click(this);">{$name}</a><br />
{ /foreach }
{ /if }
<hr>
{ if $prev_img }
<u><img src="resources/photo.png" alt="photo icon" />&nbsp;Previous:</u><br />
- <a href="{$previous_url}" onclick="click(this);" id="prev_link">
+ <a href="{$previous_url}" onfocus="click(this);" id="prev_link">
<img src="phpfspot_img.php?idx={$prev_img}&amp;width={$mini_width}" /><br />
</a>
{ /if}
{ if $next_img }
<u><img src="resources/photo.png" alt="photo icon" />&nbsp;Next:</u><br />
- <a href="{$next_url}" onclick="click(this);" id="next_link">
+ <a href="{$next_url}" onfocus="click(this);" id="next_link">
<img src="phpfspot_img.php?idx={$next_img}&amp;width={$mini_width}" /><br />
</a>
{ /if}
@@ -67,9 +67,9 @@
<div style="text-align: left; margin-top: 20px; margin-left: 20px;">
{ if $next_url == "" }
- <a href="javascript:showPhotoIndex();" onclick="click(this);" name="photo">
+ <a href="{$image_url}" onclick="showPhotoIndex(); return false;" onfocus="click(this);" name="photo">
{ else }
- <a href="{$next_url}" onclick="click(this);" title="click for the next photo" name="photo">
+ <a href="{$image_url}" onclick="{$next_url}; return false;" onfocus="click(this);" title="click for the next photo" name="photo">
{ /if }
<img src="{$image_url}" width="{$width}" height="{$height}" alt="{$image_filename}" name="photo" id="photo" />
</a>
@@ -81,17 +81,17 @@
{ if $previous_url == "" }
<img src="resources/arrow_left_gray.png" alt="first photo reached" />
{ else }
- <a href="{$previous_url}" onclick="click(this);" title="click for the previous photo (left cursor)">
+ <a href="{$previous_url}" onfocus="click(this);" title="click for the previous photo (left cursor)">
<img src="resources/arrow_left.png" alt="previous photo" />
</a>
{ /if }
- <a href="javascript:showPhotoIndex({$current_page}, {$current_img});" onclick="click(this);" title="click to go back to the index">
+ <a href="javascript:showPhotoIndex({$current_page}, {$current_img});" onfocus="click(this);" title="click to go back to the index">
<img src="resources/arrow_up.png" alt="photo index" />
</a>
{ if $next_url == "" }
<img src="resources/arrow_right_gray.png" alt="last photo reached" />
{ else }
- <a href="{$next_url}" onclick="click(this);" title="click for the next photo (right cursor)">
+ <a href="{$next_url}" onfocus="click(this);" title="click for the next photo (right cursor)">
<img src="resources/arrow_right.png" alt="next photo" />
</a>
{ /if}
diff --git a/themes/default/templates/tags.tpl b/themes/default/templates/tags.tpl
index 326c095..42a20ff 100644
--- a/themes/default/templates/tags.tpl
+++ b/themes/default/templates/tags.tpl
@@ -8,4 +8,8 @@
&nbsp;
<input type="radio" name="condition" value="or" onclick="Tags('condition', this);" {if $current_condition == "or" } checked="checked" { /if } title="OR condition" />||
<input type="radio" name="condition" value="and" onclick="Tags('condition', this);" {if $current_condition == "and" } checked="checked" { /if } title="AND condition" />&amp;&amp;
-<div id="selected_tags">no tags selected</div>
+{ if $preset_selected_tags }
+ <div id="selected_tags">{ $preset_selected_tags }</div>
+{ else }
+ <div id="selected_tags">no tags selected</div>
+{ /if }