Index: /extensions/stripped-galleria/readme.txt
===================================================================
--- /extensions/stripped-galleria/readme.txt	(revision 13088)
+++ /extensions/stripped-galleria/readme.txt	(revision 13089)
@@ -13,4 +13,8 @@
 Changelog
 ---------
+*** version 1.3.0
+- Piwigo history is now working (thanks to P@t's script from Lightbox plugin)
+- download link added for HD pictures (if authorized in Piwigo config)
+- many new translations available
 
 *** version 1.2.0
Index: /extensions/stripped-galleria/save_history.php
===================================================================
--- /extensions/stripped-galleria/save_history.php	(revision 13089)
+++ /extensions/stripped-galleria/save_history.php	(revision 13089)
@@ -0,0 +1,78 @@
+<?php
+
+define('PHPWG_ROOT_PATH','../../');
+include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
+include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
+
+check_status(ACCESS_GUEST);
+
+if (!isset($_POST['imgid'])
+  or !($imgid = explode('img-', $_POST['imgid']))
+  or !is_numeric(@$imgid[1]))
+{
+  die;
+}
+
+$image_id = mysql_real_escape_string($imgid[1]);
+
+$query = 'UPDATE '.IMAGES_TABLE.' SET hit=hit+1 WHERE id = '.$image_id.';';
+pwg_query($query);
+
+$do_log = $conf['log'];
+if (is_admin())
+{
+  $do_log = $conf['history_admin'];
+}
+if (is_a_guest())
+{
+  $do_log = $conf['history_guest'];
+}
+
+if (!$do_log)
+{
+  exit();
+}
+
+if (!empty($_POST['section']))
+{
+  $page['section'] = mysql_real_escape_string($_POST['section']);
+}
+if (!empty($_POST['catid']))
+{
+  $page['category']['id'] = mysql_real_escape_string($_POST['catid']);
+}
+if ('tags'==@$page['section'] and !empty($_POST['tagids']))
+{
+  $tags_string = mysql_real_escape_string($_POST['tagids']);
+}
+
+  $query = '
+INSERT INTO '.HISTORY_TABLE.'
+  (
+    date,
+    time,
+    user_id,
+    IP,
+    section,
+    category_id,
+    image_id,
+    image_type,
+    tag_ids
+  )
+  VALUES
+  (
+    CURDATE(),
+    CURTIME(),
+    '.$user['id'].',
+    \''.$_SERVER['REMOTE_ADDR'].'\',
+    '.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
+    '.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').',
+    '.$image_id.',
+    "picture",
+    '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').'
+  )
+;';
+
+pwg_query($query);
+
+?>
Index: /extensions/stripped-galleria/template/index.tpl
===================================================================
--- /extensions/stripped-galleria/template/index.tpl	(revision 13088)
+++ /extensions/stripped-galleria/template/index.tpl	(revision 13089)
@@ -1,6 +1,5 @@
 {php}
-	global $pwg_loaded_plugins;
-	$this->assign('GMaps_loaded', isset($pwg_loaded_plugins[ 'GMaps' ]));
-	$this->assign('ThumbScroller_loaded', isset($pwg_loaded_plugins[ 'rv_tscroller' ]));
+	global $conf;
+	$this->assign('downloadLink', $conf['picture_download_icon']);
 {/php}
 <div class="titrePage">
@@ -11,5 +10,5 @@
 		<h2>{$TITLE}</h2>
 	</div>
-	{if isset($U_EDIT) or isset($U_SLIDESHOW) or !empty($PLUGIN_INDEX_ACTIONS)}
+	{if isset($U_EDIT) or isset($U_SLIDESHOW) or !empty($PLUGIN_INDEX_ACTIONS) or !empty($THUMBNAILS) }
 		<div class="categoryActionsContainer">
 			<ul class="categoryActions group1">
@@ -20,4 +19,7 @@
 				{if isset($U_CADDIE) }
 					<li class="mainAction"><a href="{$U_CADDIE}" title="{'add to caddie'|@translate}">{'caddie'|@translate}</a></li>
+				{/if}
+				{if (!empty($THUMBNAILS) && $downloadLink) }
+					<li class="mainAction"><a id="downloadlink" href="" title="{'download this file'|@translate}" style="display: none;">{'download'|@translate}</a></li>
 				{/if}
 			</ul>
Index: /extensions/stripped-galleria/template/thumbnails.tpl
===================================================================
--- /extensions/stripped-galleria/template/thumbnails.tpl	(revision 13088)
+++ /extensions/stripped-galleria/template/thumbnails.tpl	(revision 13089)
@@ -1,23 +1,28 @@
 {if !empty($thumbnails)}
 {php}
-	global $stripped, $strippedgalleria;
+	global $stripped, $strippedgalleria, $page;
 	$this->assign( 'stripped', $stripped );
 	$this->assign( 'strippedgalleria', $strippedgalleria );
+	$this->assign( 'get_root_url', get_root_url() );
+	$this->assign( 'catid', @$page['category']['id'] );
+	$this->assign( 'section', @$page['section'] );
+	$this->assign( 'tagids',  @implode(',', @$page['tag_ids']) );
 {/php}
-<div id="gallery" class="test">
-	{strip}{foreach from=$thumbnails item=thumbnail}
-		<a href="{$thumbnail.FILE_PATH}" {if (($thumbnail.FILE_HAS_HD) && ($strippedgalleria.lightbox == 'hd'))}rel="{$thumbnail.HD_PATH}"{/if}>
-		<img src="{$thumbnail.TN_SRC}"
-		{if ($stripped.imageCaption == 'description' )}
-			alt="{$thumbnail.FILE_DESC|strip_tags:false}"
-		{/if}
-		{if ($stripped.imageCaption == 'title' )}
-			alt="{$thumbnail.NAME}"
-		{/if}
-		/></a>
-	{/foreach}{/strip}
-</div>
+<div id="gallery"></div>
 {footer_script}
 {literal}
+	var data = [
+		{/literal}{foreach from=$thumbnails item=thumbnail name=thumb}{literal}
+		{
+			thumb: '{/literal}{$thumbnail.TN_SRC}{literal}',
+			image: '{/literal}{$thumbnail.FILE_PATH}{literal}',
+			big: '{/literal}{if (($thumbnail.FILE_HAS_HD) && ($strippedgalleria.lightbox == 'hd'))}{$thumbnail.HD_PATH}{else}{$thumbnail.FILE_PATH}{/if}{literal}',
+			title: '{/literal}{$thumbnail.NAME|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'}{literal}',
+			description: '{/literal}{$thumbnail.FILE_DESC|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'}{literal}',
+			piwigo_id: {/literal}{$thumbnail.ID}{literal},
+			piwigo_hashd: {/literal}{if ($thumbnail.FILE_HAS_HD)}true{else}false{/if}{literal}
+		}{/literal}{if (!$smarty.foreach.thumb.last)},{/if}
+		{/foreach}{literal}
+		];
 			var Htotal=jQuery(window).height();
 			var Hheader=jQuery("#content").position().top;
@@ -25,5 +30,6 @@
 			var Hgallery = Htotal - Hheader - Hfooter - 2;
             jQuery("#gallery").galleria({
-                height: Hgallery,
+				dataSource: data,
+				height: Hgallery,
 				lightbox:{/literal}{if ($strippedgalleria.lightbox != 'none')}true{else}false{/if}{literal},
 				clicknext:{/literal}{if ($strippedgalleria.clicknext)}true{else}false{/if}{literal},
@@ -35,6 +41,37 @@
 					this.attachKeyboard({
 						left: this.prev,
-						right: this.next
+						right: this.next,
 					});
+					this.bind("image", function(e) {
+						var gid = e.index;
+						var pid = this.getData(gid).piwigo_id;
+						var hashd = this.getData(gid).piwigo_hashd;
+						if (hashd) {
+							jQuery("#downloadlink").show();
+							jQuery("#downloadlink").prop("href","action.php?id="+pid+"&part=h");
+						} else {
+							jQuery("#downloadlink").hide();
+						}
+						jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
+							imgid: "img-"+pid,
+							catid: "{/literal}{$catid}{literal}",
+							section: "{/literal}{$section}{literal}",
+							tagids: "{/literal}{$tagids}{literal}"
+						});
+				    });
+					this.bind("lightbox_image", function() {
+						var image=jQuery("img",".galleria-lightbox-content");
+						image.css("width","100%");
+						image.css("height","100%");
+						var gid=parseInt(jQuery(".galleria-lightbox-counter").text())-1;
+						var pid = this.getData(gid).piwigo_id;
+						var hashd = this.getData(gid).piwigo_hashd;
+						jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
+							imgid: "img-"+pid,
+							catid: "{/literal}{$catid}{literal}",
+							section: "{/literal}{$section}{literal}",
+							tagids: "{/literal}{$tagids}{literal}"
+						});
+				    });
 				}
             });
Index: /extensions/stripped-galleria/theme.css
===================================================================
--- /extensions/stripped-galleria/theme.css	(revision 13088)
+++ /extensions/stripped-galleria/theme.css	(revision 13089)
@@ -1,6 +1,6 @@
 .galleria-container {background:none!important;}
 .galleria-thumbnails {margin: 0 auto;}
+.galleria-info-text {text-transform:none}
 .galleria-info-link {left:0}
-.galleria-lightbox-content .galleria-image {width:99.5%; left:0.25%;}
 #galleria_page #the_page {max-width:none; width:auto; margin:0 10px; }
 #galleria_page #content {background:none; padding:0; max-width:none;}
