summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php50
-rw-r--r--phpfspot_cfg.php.dist3
-rw-r--r--rpc.php2
-rw-r--r--themes/default/templates/index.tpl2
4 files changed, 52 insertions, 5 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 094746c..badc728 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -244,6 +244,11 @@ class PHPFSPOT {
$this->tmpl->assign('current_condition', $_SESSION['tag_condition']);
$this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name);
+ /* parse URL */
+ if(isset($this->cfg->user_friendly_url) && $this->cfg->user_friendly_url) {
+ $content = $this->parse_user_friendly_url($_SERVER['REQUEST_URI']);
+ }
+
if(isset($_GET['mode'])) {
$_SESSION['start_action'] = $_GET['mode'];
@@ -306,7 +311,12 @@ class PHPFSPOT {
$this->tmpl->register_function("sort_select_list", array(&$this, "smarty_sort_select_list"), false);
$this->tmpl->assign('from_date', $this->get_calendar('from'));
$this->tmpl->assign('to_date', $this->get_calendar('to'));
- $this->tmpl->assign('content_page', 'welcome.tpl');
+
+ if(!isset($content))
+ $this->tmpl->assign('content_page', $this->tmpl->fetch('welcome.tpl'));
+ else
+ $this->tmpl->assign('content_page', $content);
+
$this->tmpl->show("index.tpl");
} // show()
@@ -609,7 +619,11 @@ class PHPFSPOT {
$this->tmpl->assign('ExifOrigResolution', $meta_res);
$this->tmpl->assign('ExifFileSize', $meta_size);
- $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width);
+ 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
+ $this->tmpl->assign('image_url', '/photo/'. $photo ."/". $this->cfg->photo_width);
+
$this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo);
$this->tmpl->assign('image_filename', $this->parse_uri($details['uri'], 'filename'));
@@ -631,7 +645,7 @@ class PHPFSPOT {
$this->tmpl->assign('photo_number', $i);
$this->tmpl->assign('photo_count', count($all_photos));
- $this->tmpl->show("single_photo.tpl");
+ return $this->tmpl->fetch("single_photo.tpl");
} // showPhoto()
@@ -3045,6 +3059,36 @@ class PHPFSPOT {
} // get_tag_name()
+
+ private function parse_user_friendly_url($request_uri)
+ {
+ if(preg_match('/\/photoview\/|\/photo\//', $request_uri)) {
+
+ $options = explode('/', $request_uri);
+
+ switch($options[1]) {
+ case 'photoview':
+ if(is_numeric($options[2])) {
+ return $this->showPhoto($options[2]);
+ }
+ break;
+ case 'photo':
+ if(is_numeric($options[2])) {
+ require_once "phpfspot_img.php";
+ $img = new PHPFSPOT_IMG;
+ if(isset($options[3]) && is_numeric($options[3]))
+ $img->showImg($options[2], $options[3]);
+ else
+ $img->showImg($options[2]);
+ }
+ exit;
+ break;
+ }
+ }
+
+ } // parse_user_friendly_url()
+
+
} // class PHPFSPOT
?>
diff --git a/phpfspot_cfg.php.dist b/phpfspot_cfg.php.dist
index 4eb5894..3793c54 100644
--- a/phpfspot_cfg.php.dist
+++ b/phpfspot_cfg.php.dist
@@ -116,6 +116,9 @@ class PHPFSPOT_CFG {
/* path to dcraw to decode Nikon's NEF format */
// var $dcraw_bin = "/usr/bin/dcraw";
+ /* user friendly URLs */
+ var $user_friendly_url = false;
+
public function __construct()
{
diff --git a/rpc.php b/rpc.php
index bdb6206..5ff334e 100644
--- a/rpc.php
+++ b/rpc.php
@@ -65,7 +65,7 @@ class PHPFSPOT_RPC {
switch($action) {
case 'showphoto':
if(isset($_GET['id']) && is_numeric($_GET['id'])) {
- $phpfspot->showPhoto($_GET['id']);
+ print $phpfspot->showPhoto($_GET['id']);
}
break;
diff --git a/themes/default/templates/index.tpl b/themes/default/templates/index.tpl
index 0bd7a7b..59b4b56 100644
--- a/themes/default/templates/index.tpl
+++ b/themes/default/templates/index.tpl
@@ -39,7 +39,7 @@
<!-- content column -->
<div id="content" class="content">
- {include file="welcome.tpl"}
+ { $content_page }
</div>
</span>