$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']);
}
$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));
$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()
/**
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;
}
$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) {
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;
}
$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>
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()
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()
*/
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()
/**
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);
}
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
{/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" /> 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" /> 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" /> Fullsize</a>
+ <a href="{$image_url_full}" title="orig_image" target="_blank" onfocus="click(this);"><img src="resources/original.png" alt="original resolution" /> Fullsize</a>
</div>
</div>
<br />
<u><img src="resources/small_available_tags.png" alt="available tags" /> 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" /> 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}&width={$mini_width}" /><br />
</a>
{ /if}
{ if $next_img }
<u><img src="resources/photo.png" alt="photo icon" /> 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}&width={$mini_width}" /><br />
</a>
{ /if}
<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>
{ 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}