From: Andreas Unterkircher Date: Sun, 11 May 2008 07:42:36 +0000 (+0200) Subject: fix conflicts during merge of Arun's tree X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=d97a057346bebb98be293d903a86987273cbee3e;hp=-c fix conflicts during merge of Arun's tree Signed-off-by: Andreas Unterkircher --- d97a057346bebb98be293d903a86987273cbee3e diff --combined phpfspot.class.php index 49d0c7d,eba23ca..1e07ccc --- a/phpfspot.class.php +++ b/phpfspot.class.php @@@ -201,8 -201,6 +201,8 @@@ class PHPFSPOT require_once "phpfspot_tmpl.php"; $this->tmpl = new PHPFSPOT_TMPL(); + $this->tmpl->assign('web_path', $this->cfg->web_path); + /* check if all necessary indices exist */ $this->checkDbIndices(); @@@ -246,11 -244,6 +246,11 @@@ $this->tmpl->assign('current_condition', $_SESSION['tag_condition']); $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name); + /* parse URL */ + if($this->is_user_friendly_url()) { + $content = $this->parse_user_friendly_url($_SERVER['REQUEST_URI']); + } + if(isset($_GET['mode'])) { $_SESSION['start_action'] = $_GET['mode']; @@@ -313,19 -306,7 +313,19 @@@ $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'); + + $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags()); + $this->tmpl->assign('preset_available_tags', $this->getAvailableTags()); + + if(!isset($content)) { + if(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) + $this->tmpl->assign('initial_content', $this->showPhotoIndex()); + else + $this->tmpl->assign('initial_content', $this->tmpl->fetch('welcome.tpl')); + } + else + $this->tmpl->assign('initial_content', $content); + $this->tmpl->show("index.tpl"); } // show() @@@ -628,15 -609,8 +628,15 @@@ $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); - $this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo); + 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_filename', $this->parse_uri($details['uri'], 'filename')); $this->tmpl->assign('tags', $this->get_photo_tags($photo)); @@@ -657,7 -631,7 +657,7 @@@ $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() @@@ -734,15 -708,13 +734,15 @@@ $b = '88'; if(isset($this->tags[$key])) { - $output.= "". $this->tags[$key] .", "; + if($this->is_user_friendly_url()) + $output.= "cfg->web_path ."/tag/". $key ."\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] .", "; + else + $output.= "cfg->web_path ."/index.php?mode=showpi\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] .", "; } - } $output = substr($output, 0, strlen($output)-2); - print $output; + return $output; } // getAvailableTags() @@@ -1182,7 -1154,6 +1182,7 @@@ * * this function provides all the necessary information * for the photo index template. + * @return string */ public function showPhotoIndex() { @@@ -1368,19 -1339,17 +1368,19 @@@ $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 "\n"; + $result.= "\n"; unset($_SESSION['last_photo']); } + return $result; + } // showPhotoIndex() /** @@@ -1641,7 -1610,7 +1641,7 @@@ */ public function get_meta_informations($file) { - return exif_read_data($file); + return @exif_read_data($file); } // get_meta_informations() @@@ -2294,7 -2263,7 +2294,7 @@@ 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; } @@@ -2302,12 -2271,7 +2302,12 @@@ $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) { @@@ -2356,7 -2320,7 +2356,7 @@@ 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; } @@@ -2366,13 -2330,7 +2366,13 @@@ $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("
@@@ -2449,6 -2407,7 +2449,6 @@@ public function whatToDo() { if(isset($_SESSION['current_photo']) && $_SESSION['start_action'] == 'showp') { - return "show_photo"; } elseif(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) { return "showpi_tags"; @@@ -2457,6 -2416,8 +2457,6 @@@ return "showpi"; } - return "nothing special"; - } // whatToDo() /** @@@ -2552,11 -2513,7 +2552,11 @@@ 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() @@@ -2576,11 -2533,7 +2576,11 @@@ 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() @@@ -2781,7 -2734,6 +2781,7 @@@ private function get_phpfspot_url() { return $this->get_web_protocol() ."://". $this->get_server_name() . $this->cfg->web_path; + } // get_phpfspot_url() /** @@@ -2974,11 -2926,9 +2974,11 @@@ } - /* check for pending slash on web_path */ - if(!preg_match("/\/$/", $this->cfg->web_path)) - $this->cfg->web_path.= "/"; + /* remove trailing slash, if set */ + if($this->cfg->web_path == "/") + $this->cfg->web_path = ""; + elseif(preg_match('/\/$/', $this->cfg->web_path)) + $this->cfg->web_path = preg_replace('/\/$/', '', $this->cfg->web_path); return $this->runtime_error; @@@ -3095,67 -3045,6 +3095,67 @@@ } // get_tag_name() + /** + * parse user friendly url which got rewritten by the websever + * @param string $request_uri + * @return string + */ + private function parse_user_friendly_url($request_uri) + { + if(preg_match('/\/photoview\/|\/photo\/|\/tag\//', $request_uri)) { + + unset($_SESSION['start_action']); + unset($_SESSION['selected_tags']); + + $options = explode('/', $request_uri); + + switch($options[1]) { + case 'photoview': + if(is_numeric($options[2])) { + $_GET['mode'] = 'showp'; + 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; + case 'tag': + if(is_numeric($options[2])) { + $_GET['tags'] = $options[2]; + $_SESSION['selected_tags'] = Array($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 --combined themes/default/stylesheet.css index d67f3ac,9fe2c4e..93e56b7 --- a/themes/default/stylesheet.css +++ b/themes/default/stylesheet.css @@@ -55,6 -55,10 +55,10 @@@ div.searchfor border-bottom: solid 1px #000000; } + div.searchfor td.nowrap { + white-space: nowrap; + } + .menu { position: absolute; left: 0px; @@@ -81,6 -85,7 +85,7 @@@ div.header padding: 10px; vertical-align: middle; white-space: nowrap; + text-align: left; } div.subheader { @@@ -88,6 -93,68 +93,68 @@@ padding: 5px 10px 5px 10px; vertical-align: middle; white-space: nowrap; + text-align: left; + float: left; + } + + div.tagresult{ + height: 1px; + background-color: #ffffff; + } + + div.tagresulttags{ + display: table-cell; + vertical-align: middle; + } + + div.photo{ + text-align: left; + margin-top: 20px; + margin-left: 20px; + } + + div.photonavigation{ + margin-left: 20px; + } + + div.indexnavigation{ + width: 100%; + margin-top: 20px; + } + + div.indexnavigationright{ + float: right; + width: 40px; + margin-right: 0px; + padding-right: 10px; + } + + div.indexnavigationleft{ + float: left; + margin: 0px; + padding-left: 10px; + width: 40px; + } + + div.indexnavigationcenter{ + text-align: center; + } + + div.textright { + text-align: right; + } + + div.welcome { + padding: 10px; + margin-left: 10px; + margin-right: 10px; + } + + div.welcome span { + float: left; + padding-right: 10px; + width: 150px; + text-align: center; } img { @@@ -192,6 -259,16 +259,16 @@@ div.thumb a.thumblink:hover line-height: 21px; } + span.tags { + vertical-align: middle; + text-decoration: underline; + } + + div.credits{ + margin-top: 10px; + margin-left: 10px; + } + table.calendar tr td { border: solid 1px #ffffff; padding: 1px; @@@ -225,13 -302,14 +302,14 @@@ vertical-align: middle; } - #whiteline { - height: 1px; - background-color: #ffffff; + #slide_close { + margin: 0 auto; + padding: 10px; } - #index { - margin-top: 5px; + #slide_close img { + padding: 15px; + background-color: #000000; } input.submit,input.checkbox { @@@ -245,3 -323,7 +323,7 @@@ input, select, textarea border: 1px solid #888888; border-collapse: collapse; } + + #slider-1{ + margin: 0 auto; -} ++} diff --combined themes/default/templates/header.tpl index 1cd9cb4,39b42ca..c1d7a0c --- a/themes/default/templates/header.tpl +++ b/themes/default/templates/header.tpl @@@ -3,19 -3,19 +3,19 @@@ {$page_title} - - - - - + + + + + { if $use_lightbox } - - - - + + + + { /if } { if $use_autocomplete } - - - ++ + { /if } diff --combined themes/default/templates/index.tpl index 46effe2,87c58b9..694f86a --- a/themes/default/templates/index.tpl +++ b/themes/default/templates/index.tpl @@@ -1,10 -1,10 +1,10 @@@ {include file="header.tpl"} - +
-   Loading... - Loading...  Loading... ++ Loading...  Loading...
@@@ -12,20 -12,20 +12,20 @@@ - +
@@@ -39,8 -39,8 +39,8 @@@
- {include file="welcome.tpl"} + { $initial_content }
- +
{include file="footer.tpl"} diff --combined themes/default/templates/photo_index.tpl index 2c1b6ac,413ec26..2dedf86 --- a/themes/default/templates/photo_index.tpl +++ b/themes/default/templates/photo_index.tpl @@@ -1,9 -1,6 +1,9 @@@ + + +
-
+
Photo Index {if $searchfor } {if $count == 1} @@@ -29,37 -26,31 +29,37 @@@ Results are limited to a date within {$from_date} to {$to_date}. {/if}
-
+
{if $slideshow_link } - +  Slideshow {/if} {if $extern_link } - +  External Link {/if} {if $export_link } - +  Export {/if} {if $rss_link } - +  RSS-Feed {/if}
+ + + { if $tag_result } -
+
-
+
Tags:
{ $selected_tags }
{ /if } + +
{section name="thumb" loop=$thumbs step=1} @@@ -73,7 -64,7 +73,7 @@@ {$img_name[thumb]} { if $use_lightbox } - + { /if }
@@@ -83,36 -74,36 +83,36 @@@

-
+
-
+
{ if $next_url == "" } { if $count != 0 } - last page reached + last page reached { /if } { else } - next photo + next photo { /if}
-
+
{ if $previous_url == "" } { if $count != 0 } - first page reached + first page reached { /if } { else } - previous photo + previous photo { /if }
-
+
{ if $page_selector != "" } {$page_selector} { /if} @@@ -130,7 -121,7 +130,7 @@@ {section name="thumb" loop=$thumbs step=1} {if $images[thumb] } - image_urls[{counter}] = 'phpfspot_img.php?idx={$images[thumb]}&width={$width}'; + image_urls[{counter}] = '{$web_path}/phpfspot_img.php?idx={$images[thumb]}&width={$width}'; last_thumb = {$images[thumb]}; {/if} {/section} diff --combined themes/default/templates/search.tpl index ca7042e,77ed7ad..401d9af --- a/themes/default/templates/search.tpl +++ b/themes/default/templates/search.tpl @@@ -1,5 -1,5 +1,5 @@@ - + - loupeSearch: + loupeSearch:
@@@ -12,7 -12,7 +12,7 @@@ { literal } diff --combined themes/default/templates/slideshow.tpl index 84b6a6b,22c86a8..9a8f1fe --- a/themes/default/templates/slideshow.tpl +++ b/themes/default/templates/slideshow.tpl @@@ -1,22 -1,22 +1,22 @@@ {include file="header.tpl"} - - - - + + + +
- - - - + + + +
-
+ -
+
diff --combined themes/default/templates/tags.tpl index f0e3a47,e4b04a8..817cfbc --- a/themes/default/templates/tags.tpl +++ b/themes/default/templates/tags.tpl @@@ -1,15 -1,11 +1,15 @@@ - + - available tagsAvailable Tags: + available tagsAvailable Tags: -
+
{ $preset_available_tags }
- + - selected tagsSelected Tags: + selected tagsSelected Tags:   || && -
no tags selected
+{ if $preset_selected_tags } +
{ $preset_selected_tags }
+{ else } +
no tags selected
+{ /if } diff --combined themes/default/templates/welcome.tpl index 6e6613c,fbb21a1..073af00 --- a/themes/default/templates/welcome.tpl +++ b/themes/default/templates/welcome.tpl @@@ -1,35 -1,35 +1,35 @@@ -
+
phpfspot welcomes you to a dynamic photo gallery for F-Spot
-
+
-
- -
-
+

+ - random image ++ random image + This application targets to provide an easy way, to presentate your F-Spot
pictures in the web, in a way where you do not need any of the current
web2.0 providers or setup complex apps like gallery -

+

-
+
-
- -
-
+

+ - random image ++ random image + You can adapt this welcome page in the file "welcome.tpl" in the template
directory of your current theme. -

+

-
+
-
- -
- +