X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=33d4e24ffe0a5b99469ecb75a62f23b8cf048d9a;hp=32c2df71cd647ec1fd3f1e6ef4c8f30eae234aba;hb=a504ea9f15aa4235014022c6d777563396332360;hpb=086cf84bfd20fcccdc978a0200ab97cdeca2c172 diff --git a/phpfspot.class.php b/phpfspot.class.php index 32c2df7..33d4e24 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -64,6 +64,11 @@ class PHPFSPOT { $_SESSION['selected_tags'] = split(',', $_GET['tags']); } break; + case 'export': + $this->tmpl->show("export.tpl"); + return; + break; + } $this->tmpl->assign('content_page', 'welcome.tpl'); @@ -114,18 +119,14 @@ class PHPFSPOT { } // get_photo_details - public function getPhotoName($idx) + public function getPhotoName($idx, $limit = 0) { if($details = $this->get_photo_details($idx)) { - $name = $details['name']; - - if(strlen($name) > 15) { - $name = substr($name, 0, 10) ."...". substr($name, -10); + if($limit != 0 && strlen($name) > $limit) { + $name = substr($name, 0, $limit-5) ."...". substr($name, -($limit-5)); } - return $name; - } } // getPhotoName() @@ -287,15 +288,18 @@ class PHPFSPOT { public function getSelectedTags() { + $output = ""; foreach($this->avail_tags as $tag) { // return all selected tags if(isset($_SESSION['selected_tags']) && in_array($tag, $_SESSION['selected_tags'])) { - print "". $this->tags[$tag] .", "; + $output.= "". $this->tags[$tag] .", "; } - } + $output = substr($output, 0, strlen($output)-2); + print $output; + } // getSelectedTags() public function addTag($tag) @@ -474,12 +478,14 @@ class PHPFSPOT { $img_width[$rows] = Array(); $img_id[$rows] = Array(); $img_name[$rows] = Array(); + $img_title = Array(); for($i = $begin_with; $i < $end_with; $i++) { $images[$rows][$cols] = $photos[$i]; $img_id[$rows][$cols] = $i; - $img_name[$rows][$cols] = $this->getPhotoName($photos[$i]); + $img_name[$rows][$cols] = htmlspecialchars($this->getPhotoName($photos[$i], 15)); + $img_title[$rows][$cols] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0)); $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->thumb_width ."_". $this->getMD5($photos[$i]); @@ -586,12 +592,15 @@ class PHPFSPOT { $current_tags = substr($current_tags, 0, strlen($current_tags)-1); } - $extern_link = "http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=showpi"; + $extern_link = "index.php?mode=showpi"; if($current_tags != "") { $extern_link.= "&tags=". $current_tags; } + $export_link = "index.php?mode=export"; + $this->tmpl->assign('extern_link', $extern_link); + $this->tmpl->assign('export_link', $export_link); $this->tmpl->assign('count', $count); $this->tmpl->assign('width', $this->cfg->thumb_width); $this->tmpl->assign('images', $images); @@ -599,6 +608,7 @@ class PHPFSPOT { $this->tmpl->assign('img_height', $img_height); $this->tmpl->assign('img_id', $img_id); $this->tmpl->assign('img_name', $img_name); + $this->tmpl->assign('img_title', $img_title); $this->tmpl->assign('rows', $rows); $this->tmpl->assign('columns', $this->cfg->thumbs_per_row); @@ -1126,6 +1136,37 @@ class PHPFSPOT { } // get_calendar() + public function getExport($mode) + { + $pictures = $this->getPhotoSelection(); + + if(!isset($_SERVER['HTTPS'])) $protocol = "http"; + else $protocol = "https"; + + $server_name = $_SERVER['SERVER_NAME']; + + foreach($pictures as $picture) { + + $orig_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->photo_width; + $thumb_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width; + + switch($mode) { + + case 'HTML': + // + print htmlspecialchars("") ."
\n"; + break; + + case 'MoinMoin': + // [%pictureurl% %thumbnailurl%] + print htmlspecialchars(" * [".$orig_url." ".$thumb_url."&fake=1.jpg]") ."
\n"; + break; + } + + } + + } // getExport() + } ?>