Index: /extensions/Public_Piwigo_WordPress_Widget/Public_WP_Piwigo_Widget.php
===================================================================
--- /extensions/Public_Piwigo_WordPress_Widget/Public_WP_Piwigo_Widget.php	(revision 4031)
+++ /extensions/Public_Piwigo_WordPress_Widget/Public_WP_Piwigo_Widget.php	(revision 4031)
@@ -0,0 +1,93 @@
+<?php
+/*
+Plugin Name: Public Piwigo WordPress Widget
+Version: auto
+Description: Public Piwigo WordPress Widget (PW^2) is a WordPress 2.8 widget, it links a public picture in your Piwigo gallery (<a href="http://piwigo.org/">Piwigo</a>). In other words, it's a WordPress Sidebar Widget with some available public pictures in your Piwigo gallery as a prereq.
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
+Author: VDigital
+Author URI: http://www.vdigital.org/
+*/
+if (defined('PHPWG_ROOT_PATH')) return;
+
+class Public_Piwigo_WordPress_Widget extends WP_Widget
+{
+    function Public_Piwigo_WordPress_Widget(){
+      $widget_ops = array('classname' => 'Public_Piwigo_WordPress_Widget',
+        'description' => __( "Adds a thumbnail and its link (to the picture) inside your blog sidebar.") );
+      $control_ops = array('width' => 300, 'height' => 300);
+      $this->WP_Widget('Public_Piwigo_WordPress_Widget', 'Public Piwigo WordPress Widget', $widget_ops, $control_ops);
+    }
+
+    function widget($args, $gallery){
+      extract($args);
+      $title = apply_filters('widget_title', empty($gallery['title']) ? '&nbsp;' : $gallery['title']);
+      $piwigo = empty($gallery['piwigo']) ? '' : $gallery['piwigo'];
+      $piwigo_url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $piwigo ;
+      if (!empty($gallery['external'])) $piwigo_url = $gallery['external'];
+      if (substr($piwigo_url,-1)!='/') $piwigo_url .= '/';
+      $options = '';
+      if (!empty($gallery['category'])) $options = '&cat_id=' . intval($gallery['category']);
+
+      echo $before_widget;
+      if ( $title ) echo $before_title . $title . $after_title;
+
+      # Make the Piwigo link
+      $response = file_get_contents( $piwigo_url . 'ws.php?method=pwg.categories.getImages&format=php'
+        . $options . '&recursive=true&order=random&f_with_thumbnail=true');
+      $thumbc = unserialize($response);
+      if ($thumbc["stat"] == 'ok') {
+          $picture = $thumbc["result"]["images"]["_content"][0];
+          echo '<a title="' . $title . '" href="' . $piwigo_url . 'picture.php?/' . $picture['id'] . '"><img src="' . $picture['tn_url'] . '" alt="" /></a>';
+      }
+
+      echo $after_widget;
+    }
+
+    function update($new_gallery, $old_gallery){
+      $gallery = $old_gallery;
+      $gallery['title'] = strip_tags(stripslashes($new_gallery['title']));
+      $gallery['piwigo'] = strip_tags(stripslashes($new_gallery['piwigo']));
+      $gallery['external'] = strip_tags(stripslashes($new_gallery['external']));
+      $gallery['category'] = strip_tags(stripslashes($new_gallery['category']));
+
+    return $gallery;
+    }
+
+    function form($gallery){
+      //Defaults
+      $gallery = wp_parse_args( (array) $gallery, array('title'=>__('Random picture'), 
+        'piwigo'=>'piwigo', 'external'=>'', 'category'=>0, ) );
+
+      $title = htmlspecialchars($gallery['title']);
+      $piwigo = htmlspecialchars($gallery['piwigo']);
+      $external = htmlspecialchars($gallery['external']);
+      $category = intval($gallery['category']);
+
+      # Options
+      echo '<p style="text-align:right;"><label for="' . $this->get_field_name('title') . '">' . __('Public Piwigo WordPress Widget Title:') 
+      . ' <input style="width: 250px;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title')
+      . '" type="text" value="' . $title . '" /></label></p>';
+      # Piwigo directory
+      echo '<p style="text-align:right;"><label for="' . $this->get_field_name('piwigo') . '">' . __('Your Piwigo directory (local):') 
+      . ' <input style="width: 200px;" id="' . $this->get_field_id('piwigo') . '" name="' . $this->get_field_name('piwigo')
+      . '" type="text" value="' . $piwigo . '" /></label></p>';
+      # External website
+      echo '<p style="text-align:right;"><label for="' . $this->get_field_name('external') . '">' . __('Optional Piwigo gallery URL (external):') 
+      . ' <input style="width: 200px;" id="' . $this->get_field_id('external') . '" name="' . $this->get_field_name('external')
+      . '" type="text" value="' . $external . '" /></label></p>';
+      # Category
+      echo '<p style="text-align:right;"><label for="' . $this->get_field_name('category') . '">' . __('Select a category id (empty = all):') 
+      . ' <input style="width: 200px;" id="' . $this->get_field_id('category') . '" name="' . $this->get_field_name('category')
+      . '" type="text" value="' . $category . '" /></label></p>';
+     }
+
+}
+
+/**
+  * Register Public Piwigo WordPress Widget
+  */
+  function Public_Piwigo_WordPress_Widget_Init() {
+        register_widget('Public_Piwigo_WordPress_Widget');
+  }
+  add_action('widgets_init', 'Public_Piwigo_WordPress_Widget_Init');
+?>
Index: /extensions/Public_Piwigo_WordPress_Widget/index.php
===================================================================
--- /extensions/Public_Piwigo_WordPress_Widget/index.php	(revision 4031)
+++ /extensions/Public_Piwigo_WordPress_Widget/index.php	(revision 4031)
@@ -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$
+// | last update   : $Date$
+// | last modifier : $Author$
+// | revision      : $Revision$
+// +-----------------------------------------------------------------------+
+// | 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();
+?>
