Index: /extensions/vkbutton/admin.css
===================================================================
--- /extensions/vkbutton/admin.css	(revision 21069)
+++ /extensions/vkbutton/admin.css	(revision 21069)
@@ -0,0 +1,18 @@
+input[name="modified"] {
+	visibility: hidden;
+}
+form[name="config_form"] {
+	text-align: center;
+}
+form[name="config_form"] fieldset table tr td:nth-child(2n+1) {
+	text-align: right;
+	width: 150px;
+}
+input[type="text"], select {
+	width: 350px;
+}
+fieldset {
+	margin: 0 auto;
+	width: 500px;
+	margin-bottom: 5px;
+}
Index: /extensions/vkbutton/admin.php
===================================================================
--- /extensions/vkbutton/admin.php	(revision 21069)
+++ /extensions/vkbutton/admin.php	(revision 21069)
@@ -0,0 +1,71 @@
+<?php
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $template, $conf, $page, $lang;
+
+if ((!empty($_POST['modified'])) and ($_POST['modified']=true)) {
+	switch ($_POST['main_button_type']) {
+		case $lang['round']: $_POST['main_button_type'] = 'round'; break;
+		case $lang['round_nocount']: $_POST['main_button_type'] = 'round_nocount'; break;
+		case $lang['button']: $_POST['main_button_type'] = 'button'; break;
+		case $lang['button_nocount']: $_POST['main_button_type'] = 'button_nocount'; break;
+		case $lang['link']: $_POST['main_button_type'] = 'link'; break;
+		case $lang['link_noicon']: $_POST['main_button_type'] = 'link_noicon'; break;
+		case $lang['icon']: $_POST['main_button_type'] = 'icon'; break;
+	}
+	switch ($_POST['pic_button_type']) {
+		case $lang['round']: $_POST['pic_button_type'] = 'round'; break;
+		case $lang['round_nocount']: $_POST['pic_button_type'] = 'round_nocount'; break;
+		case $lang['button']: $_POST['pic_button_type'] = 'button'; break;
+		case $lang['button_nocount']: $_POST['pic_button_type'] = 'button_nocount'; break;
+		case $lang['link']: $_POST['pic_button_type'] = 'link'; break;
+		case $lang['link_noicon']: $_POST['pic_button_type'] = 'link_noicon'; break;
+		case $lang['icon']: $_POST['pic_button_type'] = 'icon'; break;
+	}
+	$vkb_conf = array(	
+		'main_button_type' => $_POST['main_button_type'],
+		'record_title' => $_POST['record_title'],
+		'record_text' => $_POST['record_text'],
+		'record_img' => $_POST['record_img'],
+		'pic_button_type' => $_POST['pic_button_type']
+		);
+	if (!empty($_POST['show_main_button'])) {
+		$vkb_conf['show_main_button'] = $_POST['show_main_button'];
+		}else{
+		$vkb_conf['show_main_button'] = false;
+		}
+	if (!empty($_POST['show_pic_button'])) {
+		$vkb_conf['show_pic_button'] = $_POST['show_pic_button'];
+		}else{
+		$vkb_conf['show_pic_button'] = false;
+		}
+	pwg_query('
+		UPDATE '.CONFIG_TABLE.' 
+		SET '.CONFIG_TABLE.'.value = "'.pwg_db_real_escape_string(serialize($vkb_conf)).'" 
+		WHERE '.CONFIG_TABLE.'.param = "vkbutton" LIMIT 1 ;
+		');
+	array_push($page['infos'], l10n('config_is_saved'));
+	}else{
+	$vkb_conf = @unserialize($conf['vkbutton']);
+	}
+
+$template->assign('show_main_button', $vkb_conf['show_main_button']);
+$template->assign('main_button_type', $vkb_conf['main_button_type']);
+$template->assign('record_title', $vkb_conf['record_title']);
+$template->assign('record_text', $vkb_conf['record_text']);
+$template->assign('record_img', $vkb_conf['record_img']);
+$template->assign('show_pic_button', $vkb_conf['show_pic_button']);
+$template->assign('pic_button_type', $vkb_conf['pic_button_type']);
+
+$template->func_combine_css(array(
+        'path' => vkbutton_PATH.'admin.css',
+        )
+      );
+//определяем адрес шаблона плагина
+$template->set_template_dir(vkbutton_PATH);
+$template->set_filename('admin', 'admin.tpl');
+		
+$template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/admin.tpl') );
+$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/vkbutton/admin.tpl
===================================================================
--- /extensions/vkbutton/admin.tpl	(revision 21069)
+++ /extensions/vkbutton/admin.tpl	(revision 21069)
@@ -0,0 +1,66 @@
+<div class="titrePage">
+	<h2>{'Customize'|@translate} vkbutton</h2>
+</div>
+<div>
+<form name="config_form" action="#" method="POST">
+	<input type="checkbox" name="modified">
+	
+	<!--<fieldset>
+		<legend>
+			<input type="checkbox" name="show_like_button" {if isset($show_like_button) and $show_like_button}checked="checked"{/if} onChange="document.config_form.modified.checked=true;">
+			{'like_buttons'|@translate}
+		</legend>
+	</fieldset>-->
+	
+	<fieldset>
+		<legend>
+			<input type="checkbox" name="show_main_button" {if isset($show_main_button) and $show_main_button}checked="checked"{/if} onChange="document.config_form.modified.checked=true;">
+			{'button_for_all_site'|@translate}
+		</legend>
+		<table>
+		<tr>
+			<td><b>{'button_type'|@translate}</b></td>
+			<td><select name="main_button_type" onChange="document.config_form.modified.checked=true;">
+				<option{if $main_button_type=='round'} selected{/if}>{'round'|@translate}</option>
+				<option{if $main_button_type=='round_nocount'} selected{/if}>{'round_nocount'|@translate}</option>
+				<option{if $main_button_type=='button'} selected{/if}>{'button'|@translate}</option>
+				<option{if $main_button_type=='button_nocount'} selected{/if}>{'button_nocount'|@translate}</option>
+				<option{if $main_button_type=='link'} selected{/if}>{'link'|@translate}</option>
+				<option{if $main_button_type=='link_noicon'} selected{/if}>{'link_noicon'|@translate}</option>
+				<option{if $main_button_type=='icon'} selected{/if}>{'icon'|@translate}</option>
+			</select></td>
+		</tr>
+		<tr>
+			<td><b>{'record_title'|@translate}</b></td>
+			<td><input type="text" name="record_title" value="{$record_title}" onChange="document.config_form.modified.checked=true;"></td>
+		</tr>
+		<tr>
+			<td><b>{'record_text'|@translate}</b></td>
+			<td><input type="text" name="record_text" value="{$record_text}" onChange="document.config_form.modified.checked=true;"></td>
+		</tr>
+		<tr>
+			<td><b>{'record_img'|@translate}</b></td>
+			<td><input type="text" name="record_img" value="{$record_img}" onChange="document.config_form.modified.checked=true;"></td>
+		</tr>
+		</table>
+	</fieldset>
+	<fieldset>
+		<legend>
+			<input type="checkbox" name="show_pic_button" {if isset($show_pic_button) and $show_pic_button}checked="checked"{/if} onChange="document.config_form.modified.checked=true;">
+			{'button_for_pictures'|@translate}
+		</legend>
+		<table>
+			<td><b>{'button_type'|@translate}</b></td>
+			<td><select name="pic_button_type" onChange="document.config_form.modified.checked=true;">
+				<option{if $pic_button_type=='round'} selected{/if}>{'round'|@translate}</option>
+				<option{if $pic_button_type=='round_nocount'} selected{/if}>{'round_nocount'|@translate}</option>
+				<option{if $pic_button_type=='button'} selected{/if}>{'button'|@translate}</option>
+				<option{if $pic_button_type=='button_nocount'} selected{/if}>{'button_nocount'|@translate}</option>
+				<option{if $pic_button_type=='link'} selected{/if}>{'link'|@translate}</option>
+				<option{if $pic_button_type=='link_noicon'} selected{/if}>{'link_noicon'|@translate}</option>
+				<option{if $pic_button_type=='icon'} selected{/if}>{'icon'|@translate}</option>
+			</select></td>
+		</table>
+	</fieldset>
+	<input name="submit_cinfig" type="submit" value="{'Submit'|@translate}">
+</form>
Index: /extensions/vkbutton/index.php
===================================================================
--- /extensions/vkbutton/index.php	(revision 21069)
+++ /extensions/vkbutton/index.php	(revision 21069)
@@ -0,0 +1,10 @@
+<?php
+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/vkbutton/language/en_UK/description.txt
===================================================================
--- /extensions/vkbutton/language/en_UK/description.txt	(revision 21069)
+++ /extensions/vkbutton/language/en_UK/description.txt	(revision 21069)
@@ -0,0 +1,1 @@
+"Like" button for vk.com
Index: /extensions/vkbutton/language/en_UK/index.php
===================================================================
--- /extensions/vkbutton/language/en_UK/index.php	(revision 21069)
+++ /extensions/vkbutton/language/en_UK/index.php	(revision 21069)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/vkbutton/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/vkbutton/language/en_UK/plugin.lang.php	(revision 21069)
+++ /extensions/vkbutton/language/en_UK/plugin.lang.php	(revision 21069)
@@ -0,0 +1,18 @@
+<?php
+	$lang['like_buttons'] = '"Like" buttons';
+	$lang['button_for_all_site'] = 'Button for repost link to site';
+	$lang['button_type'] = 'button type';
+		$lang['round'] = 'button with rounded corners';
+		$lang['round_nocount'] = 'button with rounded corners with no counter';
+		$lang['button'] = 'button';
+		$lang['button_nocount'] = 'button with no counter';
+		$lang['link'] = 'link';
+		$lang['link_noicon'] = 'link without an icon';
+		$lang['icon'] = 'icon';
+	$lang['record_title'] = 'title of record';
+	$lang['record_text'] = 'text of record';
+	$lang['record_img'] = 'Image of record';
+	$lang['config_is_saved'] = 'Configuration is saved';
+	
+	$lang['button_for_pictures'] = 'button for repost pictures';
+?>
Index: /extensions/vkbutton/language/ru_RU/description.txt
===================================================================
--- /extensions/vkbutton/language/ru_RU/description.txt	(revision 21069)
+++ /extensions/vkbutton/language/ru_RU/description.txt	(revision 21069)
@@ -0,0 +1,1 @@
+"Like" кнопка для vk.com
Index: /extensions/vkbutton/language/ru_RU/index.php
===================================================================
--- /extensions/vkbutton/language/ru_RU/index.php	(revision 21069)
+++ /extensions/vkbutton/language/ru_RU/index.php	(revision 21069)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/vkbutton/language/ru_RU/plugin.lang.php
===================================================================
--- /extensions/vkbutton/language/ru_RU/plugin.lang.php	(revision 21069)
+++ /extensions/vkbutton/language/ru_RU/plugin.lang.php	(revision 21069)
@@ -0,0 +1,18 @@
+<?php
+	$lang['like_buttons'] = 'Кнопки "Like"';
+	$lang['button_for_all_site'] = 'Кнопка репоста ссылки на сайт';
+	$lang['button_type'] = 'Вид кнопки';
+		$lang['round'] = 'кнопка со скругленными углами';
+		$lang['round_nocount'] = 'кнопка со скругленными углами без счетчика';
+		$lang['button'] = 'кнопка';
+		$lang['button_nocount'] = 'кнопка без счетчика';
+		$lang['link'] = 'ссылка';
+		$lang['link_noicon'] = 'ссылка без иконки';
+		$lang['icon'] = 'иконка';
+	$lang['record_title'] = 'Заголовок записи';
+	$lang['record_text'] = 'Текст записи';
+	$lang['record_img'] = 'Картинка записи';
+	$lang['config_is_saved'] = 'Изменения сохранены';
+	
+	$lang['button_for_pictures'] = 'Кнопка репоста изображений';
+?>
Index: /extensions/vkbutton/main.inc.php
===================================================================
--- /extensions/vkbutton/main.inc.php	(revision 21069)
+++ /extensions/vkbutton/main.inc.php	(revision 21069)
@@ -0,0 +1,89 @@
+<?php
+/*
+Version: 1.0.2
+Plugin Name: vkbutton
+Plugin URI: http://ru.piwigo.org/forum/viewtopic.php?pid=112788#p112788
+Author: EvilKant
+Description: "Like" button for russian social net vk.com
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Определяем директорию плагина
+define('vkbutton_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+define('vkbutton_Admin', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
+
+//Включаем перевод плагина
+load_language('plugin.lang', vkbutton_PATH);
+
+//Делаем пункт меню в админке
+add_event_handler('get_admin_plugin_menu_links', 'vkbutton_admin_menu');
+
+function vkbutton_admin_menu($menu) {
+ array_push(
+   $menu,
+   array(
+     'NAME'  => 'vkbutton',
+     'URL'   => get_admin_plugin_menu_link(dirname(__FILE__)).'/admin.php'
+   )
+ );
+ return $menu;
+}
+
+//описываем действия во время собырия loc_begin_index, ну тобишь выводим плагин на странице
+
+add_event_handler('loc_begin_index', 'vkbutton_main');
+add_event_handler('loc_begin_picture', 'vkbutton_main');
+
+function vkbutton_main() {
+	global $template, $page, $conf;
+	
+	$vkb_conf = @unserialize($conf['vkbutton']);
+	
+	if (isset($page['image_id'])){
+	
+		$result = pwg_query("SELECT id, name, path, comment
+							FROM `piwigo_images`
+							WHERE id = ".$page['image_id']);
+		$row = pwg_db_fetch_assoc($result);
+		$thumb = DerivativeImage::thumb_url($row);
+		/*foreach ($page as $key => $value){
+			echo $key.' = '.$value.'<br>';
+		}*/
+
+		if ($vkb_conf['pic_button_type']=='icon'){
+			$template->assign('pic_button_type', 'custom');
+			$template->assign('pic_button_type_text', '<img src=\"http://vk.com/images/vk32.png?1\" />');
+			}else{
+			$template->assign('pic_button_type', $vkb_conf['pic_button_type']);
+			$template->assign('pic_button_type_text', 'сохранить');
+			}
+		$template->assign('pic_button_title', $row['name']);
+		$template->assign('pic_button_comment', $row['comment']);
+		$template->assign('pic_button_thumb', $thumb);
+	}
+	$template->assign('show_pic_button', $vkb_conf['show_pic_button']);
+	
+	if ($vkb_conf['main_button_type']=='icon'){
+		$template->assign('main_button_type', 'custom');
+		$template->assign('main_button_type_text', '<img src=\"http://vk.com/images/vk32.png?1\" />');
+		}else{
+		$template->assign('main_button_type', $vkb_conf['main_button_type']);
+		$template->assign('main_button_type_text', 'сохранить');
+		}
+	$template->assign('record_title', $vkb_conf['record_title']);
+	$template->assign('record_text', $vkb_conf['record_text']);
+	$template->assign('record_img', $vkb_conf['record_img']);
+	$template->assign('show_main_button', $vkb_conf['show_main_button']);
+	
+	//определяем адрес шаблона плагина
+	$template->set_template_dir(vkbutton_PATH);
+	$template->set_filename('vkbutton', 'vkbutton.tpl');
+	$template->func_combine_css(array('path' => vkbutton_PATH.'style.css',));
+		
+	//объявляем где конкретно на странице должен вывестись наш шаблон плагина. Вся суть в 'PLUGIN_INDEX_CONTENT_BEFORE'.
+	$template->concat('PLUGIN_INDEX_CONTENT_END',  $template->parse('vkbutton', true));
+	
+}
+?>
Index: /extensions/vkbutton/maintain.inc.php
===================================================================
--- /extensions/vkbutton/maintain.inc.php	(revision 21069)
+++ /extensions/vkbutton/maintain.inc.php	(revision 21069)
@@ -0,0 +1,50 @@
+<?php
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_activate()
+{
+	global $conf;
+	
+	$config = array(
+		'show_main_button' => 'on',
+		'main_button_type' => 'button',
+		'record_title' => 'Title',
+		'record_text' => 'Description',
+		'record_img' => '',
+		'show_pic_button' => 'on',
+		'pic_button_type' => 'button'
+	);
+	
+if (empty($conf['vkbutton']))
+  {
+	pwg_query('INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+		VALUES ("vkbutton" , "'.pwg_db_real_escape_string(serialize($config)).'" , "vkbutton configuration");');
+    }
+}
+function plugin_install()
+{
+	global $conf;
+	
+	$config = array(
+		'show_main_button' => 'on',
+		'main_button_type' => 'button',
+		'record_title' => 'Title',
+		'record_text' => 'Description',
+		'record_img' => '',
+		'show_pic_button' => 'on',
+		'pic_button_type' => 'button'
+	);
+	
+if (empty($conf['vkbutton']))
+  {
+	pwg_query('INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+		VALUES ("vkbutton" , "'.pwg_db_real_escape_string(serialize($config)).'" , "vkbutton configuration");');
+    }
+}
+
+function plugin_uninstall()
+{
+  pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE '.CONFIG_TABLE.'.param="vkbutton" LIMIT 1;');
+  unset($conf['vkbutton']);
+}
Index: /extensions/vkbutton/style.css
===================================================================
--- /extensions/vkbutton/style.css	(revision 21069)
+++ /extensions/vkbutton/style.css	(revision 21069)
@@ -0,0 +1,8 @@
+#header_vkBut {
+	float: right;
+	padding: 3px;
+}
+#image_vkpBut {
+	padding: 3px;
+	float: left;
+}
Index: /extensions/vkbutton/vkbutton.tpl
===================================================================
--- /extensions/vkbutton/vkbutton.tpl	(revision 21069)
+++ /extensions/vkbutton/vkbutton.tpl	(revision 21069)
@@ -0,0 +1,30 @@
+{combine_script id="vk_share" load='footer' path="http://vk.com/js/api/share.js" charset="windows-1251"}
+{footer_script} 
+	{if isset($show_main_button) and $show_main_button}
+		$('<li><div id="header_vkBut" class="vkBut"></div></li>').appendTo($('.categoryActions'));
+	{/if}
+	
+	$('.vkBut').html(VK.Share.button({ldelim}
+		url: document.location.href,
+		title: '{$record_title}',
+		description: '{$record_text}',
+		image: '{$record_img}',
+		},{ldelim}
+		type: "{$main_button_type}",
+		text: "{$main_button_type_text}"
+		}));
+		
+	{if isset($show_pic_button) and $show_pic_button}	
+		$('<div id="image_vkpBut" class="vkpBut"></div>').appendTo($('#imageToolBar'));
+	{/if}
+	
+	$('.vkpBut').html(VK.Share.button({ldelim}
+		url: document.location.href,
+		title: '{$pic_button_title}',
+		description: '{$pic_button_comment}',
+		image: '/{$pic_button_thumb}',
+		},{ldelim}
+		type: "{$pic_button_type}",
+		text: "{$pic_button_type_text}"
+		}));
+{/footer_script}
