Index: /extensions/mypolls/admin/index.php
===================================================================
--- /extensions/mypolls/admin/index.php	(revision 3397)
+++ /extensions/mypolls/admin/index.php	(revision 3397)
@@ -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/mypolls/admin/mypolls_admin.tpl
===================================================================
--- /extensions/mypolls/admin/mypolls_admin.tpl	(revision 3397)
+++ /extensions/mypolls/admin/mypolls_admin.tpl	(revision 3397)
@@ -0,0 +1,13 @@
+<!-- $Id: plugin_admin.tpl $ -->
+
+<div class="titrePage">
+  <h2 style="position:absolute;right:0px;top:32px;height:auto;font-size:12px;font-weight:normal;">:: {$plugin.MYPOLLS_VERSION} ::</h2>
+  <h2>{'mypolls_title'|@translate} <span style="font-size:-1;font-weight:normal;">{$TABSHEET_TITLE}</span></h2>
+
+  {$tabsheet}
+</div>
+
+<h3>{$datas.MYPOLLS_TITLE}</h3>
+
+{$MYPOLLS_BODY_PAGE}
+
Index: /extensions/mypolls/admin/plugin_admin.php
===================================================================
--- /extensions/mypolls/admin/plugin_admin.php	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin.php	(revision 3397)
@@ -0,0 +1,26 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include(MYPOLLS_PATH."mypolls_aip.class.inc.php");
+
+global $prefixeTable;
+
+load_language('plugin.lang', MYPOLLS_PATH);
+
+$main_plugin_object = get_plugin_data($plugin_id);
+
+$plugin_aip = new MyPolls_AIP($prefixeTable, $main_plugin_object->get_filelocation());
+$plugin_aip->manage();
+?>
Index: /extensions/mypolls/admin/plugin_admin_config.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_config.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_config.tpl	(revision 3397)
@@ -0,0 +1,195 @@
+{literal}
+<script type="text/javascript">
+
+    //global var ; need to not have to initialize them every time a value is changed
+    var objlang; 
+    var objnames = new Array('imenbartit', 'igentexuser', 'igentexguest', 'inotpubrestex');
+    var objinput = new Array();   //input text from form => objinput[name]
+    var objhidden = new Array();  //input hidden from form => objhidden[name][lang]
+
+
+  function change_color(inputzone, colorsquare)
+  {
+    var objinp = document.getElementById(inputzone);
+    var objcol = document.getElementById(colorsquare);
+    var colvalue = objinp.value;
+
+    while(colvalue.length<6) { colvalue+='0'; }
+
+    objcol.style.background = '#'+colvalue;
+  }
+
+  function change_width(inputzone, widthbar)
+  {
+    var objinp = document.getElementById(inputzone);
+    var objbar = document.getElementById(widthbar);
+    objbar.style.width = objinp.value+'px';
+  }
+
+  function init()
+  {
+    objlang = document.getElementById('islang');
+    for(i=0;i<objnames.length;i++)
+    {
+      objinput[i] = document.getElementById(objnames[i]);
+      objhidden[i] = new Array();
+      for(j=0;j<objlang.options.length;j++)
+      {
+        objhidden[i][j] = document.getElementById(objnames[i]+'_'+objlang.options[j].value);
+      }
+    }
+  }
+
+  function change_lang()
+  {
+    for(i=0;i<objnames.length;i++)
+    {
+      objinput[i].value = objhidden[i][objlang.options.selectedIndex].value;
+    }
+  }
+
+  function apply_changes(input_id)
+  {
+    var obj=document.getElementById(input_id);
+    objhidden[objnames.indexOf(input_id)][objlang.options.selectedIndex].value = obj.value;
+
+  }
+
+</script>
+{/literal}
+
+
+<form method="post" action="" class="general">
+
+  <fieldset >
+    <legend>{'mypolls_poll_display_config'|@translate}</legend>
+    <table class="formtable"  >
+      <tr>
+        <td>{'mypolls_config_color_bars'|@translate}</td>
+        <td>
+          <input type="text" name="f_mypolls_color_bars" size="6"
+                 value="{$datas.MYPOLLS_CFG_COLOR_BARS}" maxlength="6" id="idz1"
+                 onkeyup="change_color('idz1', 'ids1');change_color('idz1', 'ids4')"/>
+        </td>
+        <td>
+          <div id="ids1" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.MYPOLLS_CFG_COLOR_BARS};"/>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_maxbarwidth'|@translate}</td>
+        <td>
+          <input type="text" name="f_mypolls_maxbarwidth" value="{$datas.MYPOLLS_CFG_MAXBARWIDTH}"
+                 maxlength="4" size="6" id="idz4" onkeyup="change_width('idz4', 'ids4')"/>
+        </td>
+        <td>
+          <div id="ids4" style="display:block;width:{$datas.MYPOLLS_CFG_MAXBARWIDTH}px;height:8px;top:3px;border:0px;background-color:#{$datas.MYPOLLS_CFG_COLOR_BARS}"/>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_display_type'|@translate}</td>
+        <td colspan="2">
+          <select name="f_mypolls_display_type_default">
+            {html_options values=$mypolls_display_list_values output=$mypolls_display_list_labels selected=$mypolls_display_selected}
+          </select>
+        </td>
+      </tr>
+
+    </table>
+  </fieldset>
+
+  <fieldset>
+    <legend>{'mypolls_integration_config'|@translate}</legend>
+
+    {if isset($mypolls_language_list) and count($mypolls_language_list)}
+      {foreach from=$mypolls_language_list key=name item=mypolls_language_row}
+        <input type="hidden" name="f_mypolls_menubar_title_{$mypolls_language_row.LANG}"
+                id="imenbartit_{$mypolls_language_row.LANG}" value="{$mypolls_language_row.MENUBARTIT}">
+        <input type="hidden" name="f_mypolls_generic_text_users_{$mypolls_language_row.LANG}"
+                id="igentexuser_{$mypolls_language_row.LANG}" value="{$mypolls_language_row.GENTEXUSER}">
+        <input type="hidden" name="f_mypolls_generic_text_guests_{$mypolls_language_row.LANG}"
+                id="igentexguest_{$mypolls_language_row.LANG}" value="{$mypolls_language_row.GENTEXGUEST}">
+        <input type="hidden" name="f_mypolls_not_public_results_{$mypolls_language_row.LANG}"
+                id="inotpubrestex_{$mypolls_language_row.LANG}" value="{$mypolls_language_row.NOTPUBRESTEX}">
+      {/foreach}
+    {/if}
+
+    <table class="formtable">
+      <tr>
+        <td>{'mypolls_config_language'|@translate}</td>
+        <td>
+          <select onchange="change_lang();" id="islang">
+            {html_options values=$mypolls_language_list_values output=$mypolls_language_list_labels selected=$mypolls_language_selected}
+          </select>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_menubar_title'|@translate}</td>
+        <td><input type="text" id="imenbartit" value="" maxlength="20" onkeyup="apply_changes('imenbartit');" /></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_generic_text_users'|@translate}</td>
+        <td><input type="text" id="igentexuser" value="" maxlength="250" size="60" onkeyup="apply_changes('igentexuser');" /></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_generic_text_guests'|@translate}</td>
+        <td><input type="text" id="igentexguest" value="" maxlength="250" size="60" onkeyup="apply_changes('igentexguest');" /></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_not_public_result_text'|@translate}</td>
+        <td><textarea id="inotpubrestex" rows="5" cols="60" onkeyup="apply_changes('inotpubrestex');" /></textarea>
+      </tr>
+    </table>
+  </fieldset>
+
+  <fieldset>
+    <legend>{'mypolls_general_config'|@translate}</legend>
+    <table class="formtable"  >
+      <tr>
+        <td>{'mypolls_config_admincolor'|@translate}</td>
+        <td><input type="text" name="f_mypolls_admincolor" value="{$datas.MYPOLLS_CFG_ADMINCOLOR}"
+                    maxlength="6" size="6" id="idz2" onkeyup="change_color('idz2', 'ids2')"/>
+        </td>
+        <td>
+          <div id="ids2" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.MYPOLLS_CFG_ADMINCOLOR}"/>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_mouseovercolor'|@translate}</td>
+        <td><input type="text" name="f_mypolls_mouseovercolor" value="{$datas.MYPOLLS_CFG_MOUSEOVERCOLOR}"
+                  maxlength="6" size="6" id="idz5" onkeyup="change_color('idz5', 'ids5')"/>
+        </td>
+
+        <td>
+          <div id="ids5" style="display:block;width:15px;height:15px;border:0px;background-color:#{$datas.MYPOLLS_CFG_MOUSEOVERCOLOR}"/>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_nbuser_per_page'|@translate}</td>
+        <td><input type="text" name="f_mypolls_nbuser_per_page" value="{$datas.MYPOLLS_CFG_NBUSER_PER_PAGE}" maxlength="4" size="6"/></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_config_nbcomment_per_page'|@translate}</td>
+        <td><input type="text" name="f_mypolls_nbcomment_per_page" value="{$datas.MYPOLLS_CFG_NBCOMMENT_PER_PAGE}" maxlength="4" size="6"/></td>
+      </tr>
+    </table>
+  </fieldset>
+
+
+  <p>
+    <input type="submit" value="{'mypolls_do_save'|@translate}" name="submit_save_config"/>
+  </p>
+</form>
+
+<script type="text/javascript">
+  init();
+  change_lang();
+</script>
Index: /extensions/mypolls/admin/plugin_admin_create.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_create.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_create.tpl	(revision 3397)
@@ -0,0 +1,266 @@
+<!-- manage poll -->
+
+{literal}
+<script type="text/javascript">
+ 
+  function enabled_submit()
+  {
+    var objtitle = document.getElementById('ititle');
+    var objbutton = document.getElementById('isubmit');
+
+    if(objtitle.value.length>0)
+    { objbutton.disabled=false; } else { objbutton.disabled=true; }
+  }
+
+  function change_color(inputzone, colorsquare)
+  {
+      var objinp = document.getElementById(inputzone);
+      var objcol = document.getElementById(colorsquare);
+      var colvalue = objinp.value;
+
+      while(colvalue.length<6) { colvalue+='0'; }
+
+      objcol.style.background = '#'+colvalue;
+  }
+
+  function change_lang()
+  {
+    var objdeflang = document.getElementById('ilang');
+    var objslang = document.getElementById('islang');
+    objdeflang.value = objslang.value;
+  }
+
+  function change_enabled()
+  {
+    var objenabled = document.getElementById('ienabled');
+    var objsenabled = document.getElementById('isenabled');
+    objenabled.value = objsenabled.value;
+  }
+</script>
+{/literal}
+
+<div>
+  <div style="text-align:right;margin:0px;margin-right:8px;float:right;{$datas.MYPOLLS_ICN_HIDDEN}">
+    <a href="{$datas.MYPOLLS_LNK_VIEW}" title="{'mypolls_list_lnk_view'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'mypolls_list_lnk_view'|@translate}"/></a>
+  </div>
+  <i>{'mypolls_cm_stars_are_needed'|@translate}</i>
+</div>
+
+
+<form method="post" action="" class="general">
+  <fieldset >
+    <legend>{'mypolls_cm_nfo'|@translate}</legend>
+      <table class="formtable">
+        <tr>
+          <td>{'mypolls_att_language'|@translate}</td>
+          <td>
+            <input type="hidden" name="fmypolls_att_default_lang" id="ilang" value="">
+            <select {$datas.MYPOLLS_LANG_DISABLED} onchange="change_lang();" id="islang">
+              {html_options values=$mypolls_language_list_values output=$mypolls_language_list_labels selected=$mypolls_language_selected }
+            </select>
+          </td>
+        </tr>
+
+        <tr>
+          <td>{'mypolls_att_title'|@translate}<sup style="color:rgb(255,255,0)">*</sup></td>
+          <td>
+            <input type="text" name="fmypolls_att_title" id="ititle" 
+                  value="{$datas.MYPOLLS_ATT_TITLE}" maxlength=250 size=80 
+                  onkeyup="enabled_submit()" 
+                  onblur="enabled_submit()">
+          </td>
+        </tr>
+        <tr>
+          <td>{'mypolls_att_description'|@translate}</td>
+          <td><textarea name="fmypolls_att_description" rows=6 cols=80>{$datas.MYPOLLS_ATT_DESCRIPTION}</textarea></td>
+        </tr>
+        <tr>
+          <td>{'mypolls_att_after_vote_text'|@translate}</td>
+          <td><textarea name="fmypolls_att_after_vote_text" rows=6 cols=80>{$datas.MYPOLLS_ATT_AFTER_VOTE_TEXT}</textarea></td>
+        </tr>
+      </table>
+  </fieldset>
+
+  <fieldset >
+    <legend>{'mypolls_cm_settings'|@translate}</legend>
+    <table class="formtable">
+
+      <tr>
+        <td>{'mypolls_att_allowed_users_default'|@translate}</td>
+        <td colspan=2>{$datas.GENERIC_USERS_ACCESS}</td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_allowed_groups_default'|@translate}</td>
+        <td colspan=2>{$datas.GENERIC_GROUPS_ACCESS}</td>
+      </tr>
+
+      <tr>
+        <td colspan=3><hr></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_enabled'|@translate}</td>
+        <td colspan=2>
+        <input type="hidden" name="fmypolls_att_enabled" value="" id="ienabled">
+        <select {$datas.MYPOLLS_ENABLED} onchange="change_enabled();" id="isenabled">
+          <option value="y" {$datas.MYPOLLS_ATT_ENABLED_YES}>{'mypolls_yes'|@translate}</option>
+          <option value="n" {$datas.MYPOLLS_ATT_ENABLED_NO}>{'mypolls_no'|@translate}</option>
+        </select></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_visible'|@translate}</td>
+        <td colspan=2><select name="fmypolls_att_visible">
+          <option value="y" {$datas.MYPOLLS_ATT_VISIBLE_YES}>{'mypolls_yes'|@translate}</option>
+          <option value="n" {$datas.MYPOLLS_ATT_VISIBLE_NO}>{'mypolls_no'|@translate}</option>
+        </select></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_allow_comment'|@translate}</td>
+        <td colspan=2><select name="fmypolls_att_allow_comment">
+          <option value="y" {$datas.MYPOLLS_ATT_ALLOW_COMMENT_YES}>{'mypolls_yes'|@translate}</option>
+          <option value="n" {$datas.MYPOLLS_ATT_ALLOW_COMMENT_NO}>{'mypolls_no'|@translate}</option>
+        </select></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_show_user_comment'|@translate}</td>
+        <td colspan=2><select name="fmypolls_att_show_comments">
+          <option value="y" {$datas.MYPOLLS_ATT_SHOW_USER_COMMENT_YES}>{'mypolls_yes'|@translate}</option>
+          <option value="n" {$datas.MYPOLLS_ATT_SHOW_USER_COMMENT_NO}>{'mypolls_no'|@translate}</option>
+        </select></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_public_results'|@translate}</td>
+        <td colspan=2><select name="fmypolls_att_public_results">
+          <option value="y" {$datas.MYPOLLS_ATT_PUBLIC_RESULTS_YES}>{'mypolls_yes'|@translate}</option>
+          <option value="n" {$datas.MYPOLLS_ATT_PUBLIC_RESULTS_NO}>{'mypolls_no'|@translate}</option>
+        </select></td>
+      </tr>
+
+      <tr>
+        <td colspan=3><hr></td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_display_type'|@translate}</td>
+        <td colspan=2>
+          <select name="fmypolls_att_display_type">
+            {html_options from=$mypolls_display_rows values=$mypolls_display_list_values output=$mypolls_display_list_labels selected=$mypolls_display_selected   }
+          </select>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_color_bars'|@translate}</td>
+        <td><input type="text" name="fmypolls_att_color_bars" value="{$datas.fmypolls_att_color_bars}" maxlength=6 id="idz1" onkeyup="change_color('idz1', 'ids1')"/></td>
+        <td>
+          <div id="ids1" style="left:0px;display:block;width:15px;height:15px;border:0px;background-color:#{$datas.fmypolls_att_color_bars}"/>
+        </td>
+      </tr>
+
+
+    </table>
+  </fieldset>
+
+  <input type="hidden" name="mypolls_step" id="istep" value="{$datas.MYPOLLS_NEXT_STEP}">
+  <input type="hidden" name="action" value="{$datas.MYPOLLS_ACTION}">
+
+  {if isset($datas.mypolls_en_creation) and $datas.mypolls_en_creation=='yes'}
+    <p>
+      <input type="submit" name="fmypolls_create_new_poll" id="isubmit" value="{'mypolls_cnp_submit1'|@translate}" >
+    </p>
+  {/if}
+
+  {if isset($datas.mypolls_en_modification) and $datas.mypolls_en_modification=='yes'}
+    {literal}
+      <script type="text/javascript">
+        function load_page()
+        {
+          var obj = document.getElementById('iqid');
+          var objstep = document.getElementById('istep');
+          var objsub = document.getElementById('isubmit2');
+
+          objstep.value=obj.value;
+          objsub.click();
+        }
+
+        function load_trans_page()
+        {
+          var objstid = document.getElementById('istid');
+          var objtid = document.getElementById('itid');
+          var objsub = document.getElementById('isubmit4');
+
+          if(objstid.options[objstid.selectedIndex].disabled==false)
+          {
+            objtid.value=objstid.value;
+            objsub.click();
+          }
+          else
+          {
+            objstid.selectedIndex=0;
+          }
+        }
+
+      </script>
+    {/literal}
+
+    <input type="hidden" name="fmypolls_att_id" value="{$datas.ID}">
+    <p>
+      <input type="submit" name="fmypolls_modify_poll" id="isubmit" value="{'mypolls_mp_submit'|@translate}" >
+      <input type="submit" name="fmypolls_delete_poll" value="{'mypolls_dp_submit'|@translate}" >
+    </p>
+    <fieldset>
+      <legend>{'mypolls_modify_questions'|@translate} [{$datas.NBQUESTIONS}]</legend>
+      <table width="100%">
+        <tr>
+          <td>
+            <label>{'mypolls_modify_a_question'|@translate}
+              <select name="fmypolls_att_question_id" id="iqid" onchange="load_page();">
+                <option value="0" disabled selected>[{'mypolls_select_question'|@translate}]</option>
+                {html_options values=$mypolls_questions_list_values output=$mypolls_questions_list_labels}
+              </select>
+            </label>
+            <input type="submit" name="fmypolls_gomodify_question" id="isubmit2" style="visibility:hidden;" >
+          </td>
+          <td>
+            <input type="submit" name="fmypolls_goadd_question" id="isubmit3" value="{'mypolls_mp_add_a_question'|@translate}" >
+          </td>
+        </tr>
+      </table>
+    </fieldset>
+
+    <fieldset>
+      <legend>{'mypolls_trans_list'|@translate}</legend>
+      <table width="100%">
+        <tr>
+          <td>
+            <label>{'mypolls_modify_a_translation'|@translate}
+              <input type="hidden" name="fmypolls_translation_id" id="itid" value="">
+              <select id="istid" onchange="load_trans_page();">
+                <option value="" disabled selected>[{'mypolls_select_translation'|@translate}]</option>
+                {html_options values=$mypolls_translations_list_values output=$mypolls_translations_list_labels}
+              </select>
+            </label>
+            <input type="submit" name="fmypolls_gomodify_translation" id="isubmit4" style="visibility:hidden;" >
+          </td>
+          <td>
+            <input type="submit" name="fmypolls_goadd_translation" id="isubmit5"
+                    value="{'mypolls_mp_add_a_translation'|@translate}" {$datas.DISABLE_ADD_TRANS}>
+          </td>
+        </tr>
+      </table>
+    </fieldset>
+  {/if}
+
+</form>
+
+<script type="text/javascript">
+  enabled_submit();
+  change_lang();
+  change_enabled();
+</script>
Index: /extensions/mypolls/admin/plugin_admin_create2.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_create2.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_create2.tpl	(revision 3397)
@@ -0,0 +1,173 @@
+<!-- manage poll's questions -->
+
+{literal}
+<script type="text/javascript">
+
+var answers = new Array();
+var next_question_id = 0;
+
+  function enabled_submit()
+  {
+    var objquestion = document.getElementById('iquestion');
+    var objansw1 = document.getElementById('iansw0');
+    var objansw2 = document.getElementById('iansw1');
+    var objbutton = document.getElementById('isubmit1');
+    var objqtype = document.getElementById('iqtype');
+    var objmax = document.getElementById('imaxanswers');
+    var objallowcreate = document.getElementById('iallowcreate');
+
+    if((objquestion.value.length>0)&&(objansw1.value.length>0)&&(objansw2.value.length>0))
+    { objbutton.disabled=false; } else { objbutton.disabled=true; }
+    if((objqtype.value=='multi')&&(objmax.value.length==0))
+    { objbutton.disabled=true; }
+    if(objbutton.disabled==true)
+    { objallowcreate.value="n"; } else { objallowcreate.value="y"; }
+  }
+
+  function change_qtype()
+  {
+    var objqtype = document.getElementById('iqtype');
+    var objmax = document.getElementById('imaxanswers');
+
+    if(objqtype.value=='multi')
+    { objmax.disabled=false; } else { objmax.disabled=true; }
+    enabled_submit();
+  }
+
+  function add_answer(ans_value, ans_id)
+  {
+    answers[answers.length] = new Array(ans_value, ans_id);
+    next_question_id++;
+  }
+
+  function init_answers_list()
+  {
+    {/literal}{$datas.MYPOLLS_INIT_ANSWERS_LIST}{literal}
+    next_question_id={/literal}{$datas.MYPOLLS_NEXT_QUESTION}{literal};
+  }
+
+  function display_answers_list()
+  {
+    var objanswers = document.getElementById('ianswers');
+
+    text='<ol>';
+    for(i=0;i<answers.length;i++)
+    {
+      obj=document.getElementById('iansw'+answers[i][1]);
+
+      if(obj!=null)
+      {answers[i][0]=obj.value;}
+
+      text+='<li style="padding-bottom:3px;">';
+      text+='<input type="text" name="fmypolls_att_answ'+answers[i][1]+'" id="iansw'+answers[i][1]+'" maxlength=250 size=80 value="'+answers[i][0]+'" ';
+      if(i<=1)
+      {
+        text+='onkeyup="enabled_submit()" onblur="enabled_submit()">';
+        text+='&nbsp;<sup style="color:rgb(255,255,0)">*</sup';
+      }
+      text+='></li>';
+    }
+    text+='</ol>';
+    text+='<input type="button" value="{/literal}{'mypolls_add_answer'|@translate}{literal}" onclick="add_answer(\'\', next_question_id);display_answers_list();">';
+
+    objanswers.innerHTML = text;
+
+  }
+</script>
+{/literal}
+
+<div>
+  <div style="text-align:right;margin:0px;margin-right:8px;float:right;{$datas.MYPOLLS_ICN_HIDDEN}">
+    <a href="{$datas.MYPOLLS_LNK_VIEW}" title="{'mypolls_list_lnk_view'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'mypolls_list_lnk_view'|@translate}"/></a>
+    <a href="{$datas.MYPOLLS_LNK_MODIFY}" title="{'mypolls_list_lnk_modify_parent'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'mypolls_list_lnk_modify_parent'|@translate}"/></a>
+  </div>
+  <i>{'mypolls_cm_stars_are_needed'|@translate}</i>
+</div>
+
+
+<form method="post" action="" class="general">
+
+  <fieldset >
+    <table class="formtable">
+      <tr>
+        <td>{'mypolls_att_language'|@translate}</td>
+        <td>
+          <input type="hidden" name="fmypolls_att_default_lang" value="{$datas.MYPOLLS_ATT_LANG}">
+          <select  disabled>
+            {html_options values=$mypolls_language_list_values output=$mypolls_language_list_labels selected=$mypolls_language_selected}
+          </select>
+        </td>
+      </tr>
+    </table>
+  </fieldset >
+
+  <fieldset >
+    <legend>{'mypolls_cm_question'|@translate}</legend>
+    <table class="formtable">
+      <tr>
+        <td>{'mypolls_cm_question'|@translate}<sup style="color:rgb(255,255,0)">*</sup></td>
+        <td>
+          <textarea name="fmypolls_att_description"
+                    id="iquestion"
+                    rows=6 cols=80
+                    onkeyup="enabled_submit()"
+                    onblur="enabled_submit()">{$datas.MYPOLLS_ATT_DESCRIPTION}</textarea>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_question_type'|@translate}</td>
+        <td>
+          <select name="fmypolls_att_question_type" onchange="change_qtype();" id="iqtype">
+            {html_options values=$mypolls_question_type_list_values output=$mypolls_question_type_list_labels selected=$mypolls_question_type_selected}
+          </select>
+        </td>
+      </tr>
+
+      <tr>
+        <td>{'mypolls_att_multi_max_answers'|@translate}</td>
+        <td>
+          <input type="text" name="fmypolls_att_multi_max_answers" id="imaxanswers"
+                  value="{$datas.MYPOLLS_ATT_MULTI_MAX_ANSWERS}" maxlength=2 size=5
+                  onkeyup="enabled_submit()" 
+                  onblur="enabled_submit()">
+        </td>
+      </tr>
+
+    </table>
+  </fieldset>
+
+  <fieldset >
+    <legend>{'mypolls_cm_answers'|@translate}</legend>
+    <div class="formtable" id="ianswers">
+      <script type="text/javascript">init_answers_list();display_answers_list();</script>
+    </div>
+  </fieldset>
+
+
+  <input type="hidden" name="mypolls_step" value="{$datas.MYPOLLS_STEP_VALUE}">
+  <input type="hidden" name="fmypolls_att_id" value="{$datas.MYPOLLS_ATT_ID}">
+  <input type="hidden" name="mypolls_allow_create" value="n" id="iallowcreate">
+  <input type="hidden" name="action" value="{$datas.MYPOLLS_ACTION}">
+
+  {if isset($datas.mypolls_adding_question) and $datas.mypolls_adding_question=='yes'}
+    <p>
+      <input type="submit" name="fmypolls_add_question" id="isubmit1" value="{'mypolls_cnp_submit4'|@translate}" >
+    </p>
+  {/if}
+
+  {if isset($datas.mypolls_en_modification) and $datas.mypolls_en_modification=='yes'}
+    <p>
+      <input type="submit" name="fmypolls_modify_question" id="isubmit1" value="{'mypolls_mp_submit'|@translate}" >
+      <input type="submit" name="fmypolls_delete_question" value="{'mypolls_dqp_submit'|@translate}" >
+    </p>
+  {/if}
+
+</form>
+
+<script type="text/javascript">
+  change_qtype();
+  enabled_submit();
+</script>
Index: /extensions/mypolls/admin/plugin_admin_detail.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_detail.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_detail.tpl	(revision 3397)
@@ -0,0 +1,28 @@
+<table width="100%">
+  <tr>
+    <td class="throw">{'mypolls_langs'|@translate}</td>
+    <td colspan=2>{$datas.MYPOLLS_POLL_LANGS}</td>
+  </tr>
+
+  <tr>
+    <td class="throw">{'mypolls_visits'|@translate}</td>
+    <td><i>{'mypolls_without_vote'|@translate}&nbsp;:</i>&nbsp;{$datas.MYPOLLS_ATT_VISIT_WO_VOTE}</td>
+    <td><i>{'mypolls_after_vote'|@translate}&nbsp;:</i>&nbsp;{$datas.MYPOLLS_ATT_VISIT_A_VOTE}</td>
+  </tr>
+
+  <tr>
+    <td class="throw">{'mypolls_comments'|@translate}{$datas.MYPOLLS_NB_COMMENTS}</td>
+    <td><i>{'mypolls_att_allow_comment'|@translate}&nbsp;:</i>&nbsp;{$datas.MYPOLLS_ATT_ALLOW_COMMENT}</td>
+    <td><i>{'mypolls_att_show_user_comment'|@translate}&nbsp;:</i>&nbsp;{$datas.MYPOLLS_ATT_SHOW_COMMENTS}</td>
+  </tr>
+
+  <tr>
+    <td class="throw">{'mypolls_att_display_type'|@translate}</td>
+    <td colspan=2>{$datas.MYPOLLS_ATT_DISPLAY_TYPE}</td>
+  </tr>
+  <tr>
+    <td class="throw">{'mypolls_att_public_results'|@translate}</td>
+    <td colspan=2>{$datas.MYPOLLS_ATT_PUBLIC_RESULTS}</td>
+  </tr>
+</table>
+<hr/>
Index: /extensions/mypolls/admin/plugin_admin_list.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_list.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_list.tpl	(revision 3397)
@@ -0,0 +1,59 @@
+{literal}
+<script type="text/javascript">
+
+  function load_poll_detail(poll_id)
+  {
+    var doc = document.getElementById("idetail"+poll_id);
+
+    if(doc.innerHTML == '')
+    {
+      http_request=create_httpobject('get', '', '{/literal}{$datas.MYPOLLS_AJAX_URL_POLL_DETAIL}{literal}'+poll_id, false);
+      http_request.send(null);
+      doc.innerHTML=http_request.responseText;
+    }
+    else
+    {
+      doc.innerHTML = '';
+    }
+  }
+
+</script>
+{/literal}
+
+{$datas.MYPOLLS_NB_POLLS}<br>
+
+<a href="{$datas.LNK_CREATE}" title="{'mypolls_new_poll'|@translate}">{'mypolls_new_poll'|@translate}</a>
+
+<table class="table2 littlefont" id="polls_list">
+  <tr class="throw">
+    <th>{'mypolls_list_id'|@translate}</th>
+    <th>{'mypolls_list_date'|@translate}</th>
+    <th>{'mypolls_list_title'|@translate}</th>
+    <th>{'mypolls_list_enabled'|@translate}</th>
+    <th>{'mypolls_list_visible'|@translate}</th>
+    <th>{'mypolls_list_nbquestions'|@translate}</th>
+    <th>{'mypolls_list_total'|@translate}</th>
+    <th>{'mypolls_list_last_vote'|@translate}</th>
+    <th colspan=2>{'mypolls_list_actions'|@translate}</th>
+  </tr>
+  {if isset($mypolls_nb_polls_rows) and count($mypolls_nb_polls_rows)}
+    {foreach from=$mypolls_nb_polls_rows key=name item=mypolls_nb_polls_row}
+      <tr class="TableRow" style="cursor:pointer;" onclick="load_poll_detail({$mypolls_nb_polls_row.ID});">
+        <td>{$mypolls_nb_polls_row.ID}</a></td>
+        <td>{$mypolls_nb_polls_row.DATE}</td>
+        <td>{$mypolls_nb_polls_row.TITLE}</td>
+        <td>{$mypolls_nb_polls_row.ENABLED}</td>
+        <td>{$mypolls_nb_polls_row.VISIBLE}</td>
+        <td>{$mypolls_nb_polls_row.NBQUESTIONS}</td>
+        <td>{$mypolls_nb_polls_row.TOTAL}</td>
+        <td>{$mypolls_nb_polls_row.LAST_VOTE}</td>
+        <td><a href="{$mypolls_nb_polls_row.LNK_VIEW}" title="{'mypolls_list_lnk_view'|@translate}">
+          <img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'mypolls_list_lnk_view'|@translate}"/></a></td>
+        <td><a href="{$mypolls_nb_polls_row.LNK_MODIFY}" title="{'mypolls_list_lnk_modify'|@translate}">
+          <img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'mypolls_list_lnk_modify'|@translate}"/></a></td>
+      </tr>
+      <tr style="height:0px;"><td colspan=10 id="idetail{$mypolls_nb_polls_row.ID}"></td></tr>
+    {/foreach}
+  {/if}
+</table>
+
Index: /extensions/mypolls/admin/plugin_admin_translate.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_translate.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_translate.tpl	(revision 3397)
@@ -0,0 +1,159 @@
+<!-- manage poll's translations -->
+
+{literal}
+<script type="text/javascript">
+
+  function enabled_submit()
+  {
+    var objquestion = document.getElementById('ititle');
+    var objbutton = document.getElementById('isubmit1');
+
+    if(objquestion.value.length>0)
+    { objbutton.disabled=false; } else { objbutton.disabled=true; }
+  }
+
+
+  function change_lang()
+  {
+    var objtolang = document.getElementById('ilangto');
+    var objslang = document.getElementById('islangto');
+    objtolang.value = objslang.value;
+  }
+
+  function do_translation(input_id)
+  {
+    var inputid = document.getElementById(input_id);
+
+    google_translate(inputid.value,document.getElementById('ilangfrom').value.substr(0,2), document.getElementById('ilangto').value.substr(0,2), inputid, 'value');
+  }
+</script>
+{/literal}
+
+<div>
+  <div style="text-align:right;margin:0px;margin-right:8px;float:right;{$datas.MYPOLLS_ICN_HIDDEN}">
+    <a href="{$datas.MYPOLLS_LNK_VIEW}" title="{'mypolls_list_lnk_view'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'mypolls_list_lnk_view'|@translate}"/></a>
+    <a href="{$datas.MYPOLLS_LNK_MODIFY}" title="{'mypolls_list_lnk_modify_parent'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'mypolls_list_lnk_modify_parent'|@translate}"/></a>
+  </div>
+  <i>{'mypolls_cm_stars_are_needed'|@translate}</i>
+</div>
+
+
+<form method="post" action="" class="general" name="ftranslate_form">
+
+  <fieldset>
+    <legend>{'mypolls_trans_fromto'|@translate}</legend>
+      <table class="formtable">
+        <tr>
+          <td>
+            <label>{'mypolls_trans_from'|@translate}
+              <input type="hidden" name="fmypolls_trans_from" id="ilangfrom" value="{$datas.MYPOLLS_TRANS_FROM}">
+              <select disabled>
+                <option selected>{$datas.MYPOLLS_TRANS_FROM_TEXT}</option>
+              </select>
+            </label>
+          </td>
+          <td width="20px">&nbsp;</td>
+
+          <td>
+            <label>{'mypolls_trans_to'|@translate}
+              <input type="hidden" name="fmypolls_trans_to" id="ilangto" value="">
+              <select {$datas.MYPOLLS_LANG_DISABLED} onchange="change_lang();" id="islangto">
+                {html_options values=$mypolls_langto_list_values output=$mypolls_langto_list_labels selected=$mypolls_langto_selected}
+              </select>
+          </td>
+        </tr>
+      </table>
+    
+  </fieldset>
+
+
+  <fieldset class="formtable">
+    <legend>{'mypolls_cm_nfo'|@translate}</legend>
+      <ul>
+        <li>{'mypolls_att_title'|@translate}<sup style="color:rgb(255,255,0)">*</sup>
+          <p>{$datas.MYPOLLS_ATT_TITLE}&nbsp;</p>
+          <p>
+            <input type="text" name="fmypolls_att_tto_title" id="ititle"
+                   value="{$datas.MYPOLLS_ATT_TTO_TITLE}" maxlength=250 size=80 
+                   onkeyup="enabled_submit()" 
+                   onblur="enabled_submit()">
+            <input type="button" name="bttranslate" onclick="do_translation('ititle');" value="{'mypolls_auto_translate'|@translate}">
+          </p>
+        </li>
+        <li>{'mypolls_att_description'|@translate}
+          <p>{$datas.MYPOLLS_ATT_DESCRIPTION}&nbsp;</p>
+          <p>
+            <textarea name="fmypolls_att_tto_description" id="itto_description" rows=6 cols=80>{$datas.MYPOLLS_ATT_TTO_DESCRIPTION}
+            </textarea>
+            <input type="button" name="bttranslate" onclick="do_translation('itto_description');" value="{'mypolls_auto_translate'|@translate}">
+          </p>
+        </li>
+
+        <li>{'mypolls_att_after_vote_text'|@translate}
+          <p>{$datas.MYPOLLS_ATT_AFTER_VOTE_TEXT}&nbsp;</p>
+          <p>
+            <textarea name="fmypolls_att_tto_after_vote_text" id="itto_after_vote_text" rows=6 cols=80>{$datas.MYPOLLS_ATT_TTO_AFTER_VOTE_TEXT}
+            </textarea>
+            <input type="button" name="bttranslate" onclick="do_translation('itto_after_vote_text');" value="{'mypolls_auto_translate'|@translate}">
+          </p>
+        </li>
+      </ul>
+  </fieldset>
+
+
+  {if isset($questions) and count($questions)}
+    {foreach from=$questions key=name item=question}
+      <fieldset class="formtable">
+        <legend>{'mypolls_cm_question'|@translate} #{$question.NUMQUESTION}</legend>
+          <ul>
+            <li>{'mypolls_cm_question'|@translate}
+              <p>{$question.DESCRIPTION}&nbsp;</p>
+              <p>
+                <textarea name="fmypolls_att_tto_qdescription_{$question.IDQUESTION}"
+                          id="itto_qdescription_{$question.IDQUESTION}"
+                          rows=6 cols=80>{$question.TTO_DESCRIPTION}
+                </textarea>
+                <input type="button" name="bttranslate" onclick="do_translation('itto_qdescription_{$question.IDQUESTION}');" value="{'mypolls_auto_translate'|@translate}">
+              </p>
+            </li>
+            {foreach from=$question.answers key=name2 item=answer}
+              <li>{'mypolls_cm_answer'|@translate} #{$answer.NUMANSWER}
+                <p>{$answer.ANSWER}&nbsp;</p>
+                <p>
+                  <input type="text" name="fmypolls_att_tto_adescription_{$answer.IDANSWER}"
+                        id="itto_adescription_{$answer.IDANSWER}"
+                        value="{$answer.TTO_ANSWER}" maxlength=250 size=80>
+                  <input type="button" name="bttranslate" onclick="do_translation('itto_adescription_{$answer.IDANSWER}');" value="{'mypolls_auto_translate'|@translate}">
+                </p>
+              </li>
+            {/foreach}
+          </ul>
+      </fieldset>
+    {/foreach}
+  {/if}
+
+
+  <input type="hidden" name="action" value="{$datas.MYPOLLS_ACTION}">
+  <input type="hidden" name="fmypolls_att_id" value="{$datas.MYPOLLS_ATT_ID}">
+
+  {if isset($datas.mypolls_add_translation) and $datas.mypolls_add_translation=='yes'}
+    <p>
+      <input type="submit" name="fmypolls_add_translation" id="isubmit1" value="{'mypolls_cmt_submit_add'|@translate}" >
+    </p>
+  {/if}
+
+  {if isset($datas.mypolls_modify_translation) and $datas.mypolls_modify_translation=='yes'}
+    <p>
+      <input type="submit" name="fmypolls_modify_translation" id="isubmit1" value="{'mypolls_cmt_submit_modify'|@translate}" >
+      <input type="submit" name="fmypolls_delete_translation" value="{'mypolls_cmt_submit_delete'|@translate}" >
+    </p>
+  {/if}
+
+
+</form>
+
+<script type="text/javascript">
+  change_lang();
+</script>
Index: /extensions/mypolls/admin/plugin_admin_view.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_view.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_view.tpl	(revision 3397)
@@ -0,0 +1,156 @@
+<!-- manage poll's view -->
+{literal}
+<script type="text/javascript">
+
+  function change_lang()
+  {
+    var objstid = document.getElementById('islang');
+    var objtid = document.getElementById('ilang');
+    var objsub = document.getElementById('isubmit');
+
+    objtid.value=objstid.value;
+    objsub.click();
+  }
+
+  function load_poll_voter_list(page)
+  {
+    var doc = document.getElementById("ivoter_list");
+
+    http_request=create_httpobject('get', '', '{/literal}{$datas.MYPOLLS_AJAX_URL_POLL_VOTER_LIST}{literal}'+page, false);
+    http_request.send(null);
+    doc.innerHTML = http_request.responseText;
+  }
+
+  function load_poll_comment_list(page)
+  {
+    var doc = document.getElementById("icomment_list");
+
+    http_request=create_httpobject('get', '', '{/literal}{$datas.MYPOLLS_AJAX_URL_POLL_COMMENT_LIST}{literal}'+page, false);
+    http_request.send(null);
+    doc.innerHTML = http_request.responseText;
+  }
+
+  function poll_delete_comment(id, page)
+  {
+    var doc = document.getElementById("icomment_list");
+    http_request=create_httpobject('get', '', '{/literal}{$datas.MYPOLLS_AJAX_URL_POLL_DELETE_COMMENT}{literal}'+id+"&vpage="+page, false);
+    http_request.send(null);
+    doc.innerHTML = http_request.responseText;
+  }
+</script>
+{/literal}
+
+<div>
+  <div style="text-align:right;margin:0px;margin-right:8px;float:right;">
+    <a href="{$datas.MYPOLLS_LNK_MODIFY}" title="{'mypolls_list_lnk_modify_parent'|@translate}">
+    <img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'mypolls_list_lnk_modify_parent'|@translate}"/></a>
+  </div>
+  &nbsp;
+</div>
+
+
+<!-- lang -->
+<form method="post" action="" class="general">
+  <input type="hidden" name="fmypolls_att_id" value="{$datas.MYPOLLS_ATT_ID}">
+  <input type="hidden" name="action" value="view">
+  <fieldset>
+    <legend>{'mypolls_options_view'|@translate}</legend>
+      <table class="formtable">
+        <tr><td><label>{'mypolls_lang'|@translate}
+          <input type="hidden" name="mypolls_lang" id="ilang" value="">
+          <input type="submit" name="fmypolls_view" id="isubmit" style="visibility:hidden;" >
+          <select onchange="change_lang();" id="islang">
+            {html_options values=$mypolls_langs_list_values output=$mypolls_langs_list_labels selected=$mypolls_langs_selected}
+          </select></label>
+        </td></tr>
+      </table>
+  </fieldset>
+</form>
+
+<!-- general nfo -->
+<fieldset class="formtable">
+  <legend>{'mypolls_cm_nfo'|@translate}</legend>
+    <p>{$datas.MYPOLLS_ATT_TITLE}&nbsp;</p>
+    <hr/>
+    <ul class="compact">
+      <li>{'mypolls_att_creation_date'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_DATE}</li>
+      <li>{'mypolls_poll_enabled'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_ENABLED}</li>
+      <li>{'mypolls_poll_visible'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_VISIBLE}</li>
+      <li>{'mypolls_att_allow_comment'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_ALLOW_COMMENT}</li>
+      <li>{'mypolls_att_show_user_comment'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_SHOW_COMMENTS}</li>
+      <li>{'mypolls_att_allowed_users_default'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_ALLOWED_USERS}</li>
+      <li>{'mypolls_att_allowed_groups_default'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_ALLOWED_GROUPS}</li>
+    </ul>
+    <hr/>
+    <ul>
+      <li>{'mypolls_att_description'|@translate}
+        <p>{$datas.MYPOLLS_ATT_DESCRIPTION}&nbsp;</p>
+      </li>
+      <li>{'mypolls_att_after_vote_text'|@translate}
+        <p>{$datas.MYPOLLS_ATT_AFTER_VOTE_TEXT}&nbsp;</p>
+      </li>
+    </ul>
+    <hr/>
+    <ul class="compact">
+      <li>{'mypolls_att_display_type'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_DISPLAY_TYPE}</li>
+      <li>{'mypolls_att_nb_questions'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_NB_QUESTIONS}</li>
+      <li>{'mypolls_att_total_votes'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_TOTAL_VOTES}</li>
+      <li>{'mypolls_att_last_vote'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_LAST_VOTE}</li>
+      <li>{'mypolls_att_visit_without_vote'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_VISIT_WITHOUT_VOTE}</li>
+      <li>{'mypolls_att_visit_after_vote'|@translate}&nbsp;:&nbsp;{$datas.MYPOLLS_ATT_VISIT_AFTER_VOTE}</li>
+    </ul>
+</fieldset>
+
+{if isset($questions) and count($questions)}
+  {foreach from=$questions key=name item=question}
+    <fieldset class="formtable">
+      <legend>{'mypolls_cm_question'|@translate} #{$question.NUMQUESTION}</legend>
+        <p>{$question.DESCRIPTION}&nbsp;</p>
+        <ul class="compact">
+          <li>{'mypolls_att_question_type'|@translate}&nbsp;:&nbsp;{$question.QUESTION_TYPE}</li>
+        </ul>
+        <table class="table2 littlefont" width='100%'>
+          <tr class="throw">
+            <th colspan=2>{'mypolls_cm_answer'|@translate}</th>
+            {if $question.NBVOTES != ""}
+                <th width='10%'>{$question.NBVOTES}</th>
+            {/if}
+            <th colspan=2 width='{$question.MAXGRAPH}px'>{'mypolls_result_pct'|@translate}</th>
+          </tr>
+          {if isset($question.answers) and count($question.answers)}
+            {foreach from=$question.answers key=name3 item=answer}
+              <tr class="TableRow">
+                <td width='20px'>{$answer.NUMANSWER}</td>
+                <td>{$answer.ANSWER}</td>
+                {if $answer.NBANSWERS != ""}
+                    <td>{$answer.NBANSWERS}</td>
+                {/if}
+                <td>{$answer.PCT}</td>
+                <td>
+                  <div class='graphbarx' style='width:{$answer.MAXGRAPH}px'/>
+                  <div class='graphbar1' style='width:{$answer.GRAPH}px'/>
+                </td>
+              </tr>
+            {/foreach}
+          {/if}
+        </table>
+    </fieldset>
+  {/foreach}
+{/if}
+
+<fieldset class="formtable">
+  <legend>{'mypolls_voter_list'|@translate}</legend>
+  <div id="ivoter_list">
+  </div>
+</fieldset>
+
+<fieldset class="formtable">
+  <legend>{'mypolls_comment_list'|@translate}</legend>
+  <div id="icomment_list">
+  </div>
+</fieldset>
+
+<script type="text/javascript">
+  load_poll_voter_list(1);
+  load_poll_comment_list(1);
+</script>
Index: /extensions/mypolls/admin/plugin_admin_voter_list.tpl
===================================================================
--- /extensions/mypolls/admin/plugin_admin_voter_list.tpl	(revision 3397)
+++ /extensions/mypolls/admin/plugin_admin_voter_list.tpl	(revision 3397)
@@ -0,0 +1,9 @@
+{if isset($voter_list_rows) and count($voter_list_rows)}
+  <ul class=compact>
+  {foreach from=$voter_list_rows key=name item=voter_list_row}
+    <li>{$voter_list_row.USERNAME}</li>
+  {/foreach}
+  </ul>
+{/if}
+
+{$datas.PAGES}
Index: /extensions/mypolls/index.php
===================================================================
--- /extensions/mypolls/index.php	(revision 3397)
+++ /extensions/mypolls/index.php	(revision 3397)
@@ -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/mypolls/language/en_UK/index.php
===================================================================
--- /extensions/mypolls/language/en_UK/index.php	(revision 3397)
+++ /extensions/mypolls/language/en_UK/index.php	(revision 3397)
@@ -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/mypolls/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/mypolls/language/en_UK/plugin.lang.php	(revision 3397)
+++ /extensions/mypolls/language/en_UK/plugin.lang.php	(revision 3397)
@@ -0,0 +1,162 @@
+<?php
+
+
+
+$lang['mypolls_action_ko'] = 'The action failed';
+$lang['mypolls_action_ok'] = 'The action has been conducted properly';
+$lang['mypolls_add_answer'] = 'Add answer';
+$lang['mypolls_admin_add'] = 'Create a new poll';
+$lang['mypolls_admin_edit'] = 'Edit';
+$lang['mypolls_adviser_not_allowed'] = 'The adviser profile did not allow this type of action';
+$lang['mypolls_after_vote'] = 'With vote';
+$lang['mypolls_allowed_groups_empty'] = 'This survey is given to any group';
+$lang['mypolls_allowed_users_empty'] = 'This survey is accessible to any type of user';
+$lang['mypolls_answer_maxi'] = '(%s answers maximum)';
+$lang['mypolls_answer_order'] = '(Insert your order of preference)';
+$lang['mypolls_att_after_vote_text'] = 'Text shown after the vote';
+$lang['mypolls_att_allow_comment'] = 'Allow comments';
+$lang['mypolls_att_allowed_groups_default'] = 'Groups allowed to enter the poll';
+$lang['mypolls_att_allowed_users_default'] = 'Users allowed to enter the poll';
+$lang['mypolls_att_color_bars'] = 'Color chart';
+$lang['mypolls_att_creation_date'] = 'Creation date';
+$lang['mypolls_att_description'] = 'Description';
+$lang['mypolls_att_display_type'] = 'Display type';
+$lang['mypolls_att_enabled'] = 'Active';
+$lang['mypolls_att_language'] = 'Default language';
+$lang['mypolls_att_last_vote'] = 'Last vote';
+$lang['mypolls_att_multi_max_answers'] = 'Maximum number of answers';
+$lang['mypolls_att_nb_questions'] = 'Number of issues';
+$lang['mypolls_att_public_results'] = 'Results are in public access';
+$lang['mypolls_att_question_type'] = 'Question type';
+$lang['mypolls_att_show_user_comment'] = 'Show comments';
+$lang['mypolls_att_title'] = 'Title';
+$lang['mypolls_att_total_votes'] = 'Number of votes';
+$lang['mypolls_att_visible'] = 'Published';
+$lang['mypolls_att_visit_after_vote'] = 'Number of visits after vote';
+$lang['mypolls_att_visit_without_vote'] = 'The number of visits without a vote';
+$lang['mypolls_auto_translate'] = 'Proposal translation';
+$lang['mypolls_cm_answer'] = 'Answer';
+$lang['mypolls_cm_answers'] = 'Answers';
+$lang['mypolls_cm_nfo'] = 'Poll\'s description';
+$lang['mypolls_cm_question'] = 'Question';
+$lang['mypolls_cm_questions'] = 'Questions';
+$lang['mypolls_cm_settings'] = 'Options';
+$lang['mypolls_cm_stars_are_needed'] = 'Items marked with an asterisk <sup style=\\\"color:rgb(255,255,0)\\\">*</sup> are required';
+$lang['mypolls_cmt_submit_add'] = 'Add translation';
+$lang['mypolls_cmt_submit_delete'] = 'Remove translation';
+$lang['mypolls_cmt_submit_modify'] = 'Apply changes';
+$lang['mypolls_cnp_submit1'] = 'Create poll';
+$lang['mypolls_cnp_submit2'] = 'Add a question';
+$lang['mypolls_cnp_submit3'] = 'Finalizing the survey';
+$lang['mypolls_cnp_submit4'] = 'Add the question';
+$lang['mypolls_comment_list'] = 'Comment list';
+$lang['mypolls_comments'] = 'Comments';
+$lang['mypolls_config'] = 'Configuration';
+$lang['mypolls_config_admincolor'] = 'Color data (administration\'s pages)';
+$lang['mypolls_config_color_bars'] = 'Color charts';
+$lang['mypolls_config_display_type'] = 'Display type';
+$lang['mypolls_config_generic_text_guests'] = 'Default text for guests';
+$lang['mypolls_config_generic_text_users'] = 'Default text for visitors';
+$lang['mypolls_config_language'] = '(Enter the setup for)';
+$lang['mypolls_config_maxbarwidth'] = 'Maximum width of the graph';
+$lang['mypolls_config_menubar_title'] = 'Menu title';
+$lang['mypolls_config_mouseovercolor'] = 'Line overflown';
+$lang['mypolls_config_nbcomment_per_page'] = 'Number of comments displayed per page';
+$lang['mypolls_config_nbuser_per_page'] = 'Number of voters displayed per page';
+$lang['mypolls_config_not_public_result_text'] = 'Text shown in the non-public results ';
+$lang['mypolls_delete_comment'] = '[Delete this comment]';
+$lang['mypolls_display_mono'] = 'A single page with all the questions';
+$lang['mypolls_display_multi'] = 'One page per question';
+$lang['mypolls_do_save'] = 'Save';
+$lang['mypolls_dp_submit'] = 'Delete poll';
+$lang['mypolls_dqp_submit'] = 'Delete question';
+$lang['mypolls_error_on_tranlsation_number'] = 'The translations are incomplete, the survey can not be activated until all elements are not translated.';
+$lang['mypolls_errors_deleting_comment'] = 'An error occurred, the comment could not be deleted';
+$lang['mypolls_general_config'] = 'General settings';
+$lang['mypolls_gpc_not_installed'] = 'The plugin <i>grum_plugins_classes</i> isn\'t installed ; this plugin need plugin <i>grum_plugins_classes</i> be installed to work. The install process is canceled.';
+$lang['mypolls_infos_deleted_comment'] = 'The comment was deleted';
+$lang['mypolls_integration_config'] = 'Integrating MyPolls in PWG\'s interface';
+$lang['mypolls_lang'] = 'Lang';
+$lang['mypolls_langs'] = 'Langs';
+$lang['mypolls_list_actions'] = 'Actions';
+$lang['mypolls_list_date'] = 'Date';
+$lang['mypolls_list_enabled'] = 'Active';
+$lang['mypolls_list_id'] = '#Id';
+$lang['mypolls_list_lang'] = 'Langs';
+$lang['mypolls_list_last_vote'] = 'Last vote';
+$lang['mypolls_list_lnk_modify'] = 'Modify';
+$lang['mypolls_list_lnk_modify_parent'] = 'Back to change on the poll';
+$lang['mypolls_list_lnk_view'] = 'Consult';
+$lang['mypolls_list_nbquestions'] = 'Questions';
+$lang['mypolls_list_title'] = 'Title';
+$lang['mypolls_list_total'] = 'Votes';
+$lang['mypolls_list_visible'] = 'Published';
+$lang['mypolls_menu_not_enabled'] = '!A';
+$lang['mypolls_menu_not_publicr'] = '!R';
+$lang['mypolls_menu_not_visible'] = '!P';
+$lang['mypolls_modify_a_question'] = 'Edit/delete a question';
+$lang['mypolls_modify_a_translation'] = 'Edit/delete a translation';
+$lang['mypolls_modify_questions'] = 'Modifications required on the issues';
+$lang['mypolls_mp_add_a_question'] = 'Add a question';
+$lang['mypolls_mp_add_a_translation'] = 'Adding a translation';
+$lang['mypolls_mp_submit'] = 'Apply changes';
+$lang['mypolls_msg_add_question'] = 'Adding a question';
+$lang['mypolls_msg_add_translation'] = 'Adding a translation';
+$lang['mypolls_msg_create_new_poll'] = 'Creating a new poll';
+$lang['mypolls_msg_delete_poll'] = 'Delete poll';
+$lang['mypolls_msg_delete_question'] = 'Delete the question';
+$lang['mypolls_msg_delete_translation'] = 'Delete translation';
+$lang['mypolls_msg_modify_poll'] = 'Modify poll';
+$lang['mypolls_msg_modify_question'] = 'Modify the question';
+$lang['mypolls_msg_modify_translation'] = 'Changing the translation';
+$lang['mypolls_new_poll'] = 'Create a new poll';
+$lang['mypolls_next_question'] = 'Next question';
+$lang['mypolls_no'] = 'No';
+$lang['mypolls_no_comment_to_delete'] = 'There is no comment to delete';
+$lang['mypolls_not_able_to_call_google'] = 'The features offered by your host does not permit to have the function <i>proposed translation</i>';
+$lang['mypolls_not_public_results'] = 'Sorry, the survey results are not public';
+$lang['mypolls_number_of_polls0'] = '[There are no polls]';
+$lang['mypolls_number_of_polls1'] = '[1 poll]';
+$lang['mypolls_number_of_pollsn'] = '[%s polls]';
+$lang['mypolls_options_view'] = 'Consultation options';
+$lang['mypolls_page_label'] = 'Page';
+$lang['mypolls_pages_label'] = 'Pages';
+$lang['mypolls_poll_display_config'] = 'Polls viewing';
+$lang['mypolls_poll_enabled'] = 'Poll activated';
+$lang['mypolls_poll_visible'] = 'Poll published';
+$lang['mypolls_polls'] = 'Polls';
+$lang['mypolls_put_comment'] = 'You can leave a comment on the poll';
+$lang['mypolls_question_mono'] = 'One possible answer';
+$lang['mypolls_question_multi'] = 'Several possible answers';
+$lang['mypolls_question_order'] = 'Responses in order of preference';
+$lang['mypolls_result_nbanswers'] = 'Votes';
+$lang['mypolls_result_nbanswers_lang'] = 'Nb. of votes<br>(%s)';
+$lang['mypolls_result_no_vote'] = 'there has not yet been votes';
+$lang['mypolls_result_pct'] = '%of answers';
+$lang['mypolls_save_config'] = 'Saving settings';
+$lang['mypolls_select_question'] = 'Select the question to modify';
+$lang['mypolls_select_translation'] = 'Select the translation to modify';
+$lang['mypolls_submit_results'] = 'Submit my vote';
+$lang['mypolls_title'] = 'MyPolls-II';
+$lang['mypolls_title_adding'] = 'Modification of a poll - Add of a question';
+$lang['mypolls_title_config'] = 'Setting default settings';
+$lang['mypolls_title_create'] = 'Creating a new poll';
+$lang['mypolls_title_list'] = 'Polls list';
+$lang['mypolls_title_modify'] = 'Modification of a poll';
+$lang['mypolls_title_translation_adding'] = 'Modification of a poll - Add of a translation';
+$lang['mypolls_title_translation_modify'] = 'Modification of a poll - Modification of a translation';
+$lang['mypolls_title_view'] = 'Consultation of a poll';
+$lang['mypolls_trans_from'] = 'Translate from';
+$lang['mypolls_trans_fromto'] = 'Languages of translation';
+$lang['mypolls_trans_list'] = 'Translations';
+$lang['mypolls_trans_to'] = 'Translate to';
+$lang['mypolls_version'] = 'v';
+$lang['mypolls_visits'] = 'Visits';
+$lang['mypolls_voter_list'] = 'List of voting';
+$lang['mypolls_without_vote'] = 'Without a vote';
+$lang['mypolls_yes'] = 'Yes';
+$lang['mypolls_yesno_n'] = 'No';
+$lang['mypolls_yesno_y'] = 'Yes';
+
+
+?>
Index: /extensions/mypolls/language/fr_FR/index.php
===================================================================
--- /extensions/mypolls/language/fr_FR/index.php	(revision 3397)
+++ /extensions/mypolls/language/fr_FR/index.php	(revision 3397)
@@ -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/mypolls/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/mypolls/language/fr_FR/plugin.lang.php	(revision 3397)
+++ /extensions/mypolls/language/fr_FR/plugin.lang.php	(revision 3397)
@@ -0,0 +1,165 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+
+----------------------------------------------------------------------------- */
+
+
+$lang['mypolls_action_ko'] = 'L\'action a échouée';
+$lang['mypolls_action_ok'] = 'L\'action a correctement été menée';
+$lang['mypolls_add_answer'] = 'Ajouter une réponse';
+$lang['mypolls_admin_add'] = 'Créer un nouveau sondage';
+$lang['mypolls_admin_edit'] = 'Edit';
+$lang['mypolls_adviser_not_allowed'] = 'Le profil de conseiller ne permet pas d\'effectuer ce type d\'action';
+$lang['mypolls_after_vote'] = 'Avec vote';
+$lang['mypolls_allowed_groups_empty'] = 'Ce sondage n\'est réservé à aucun groupe';
+$lang['mypolls_allowed_users_empty'] = 'Ce sondage n\'est accessible à aucun type d\'utilisateur';
+$lang['mypolls_answer_maxi'] = '(%s réponses maximum)';
+$lang['mypolls_answer_order'] = '(indiquez votre ordre de préférence)';
+$lang['mypolls_att_after_vote_text'] = 'Texte affiché après le vote';
+$lang['mypolls_att_allow_comment'] = 'Autoriser les commentaires';
+$lang['mypolls_att_allowed_groups_default'] = 'Groupes autorisés à accéder au sondage';
+$lang['mypolls_att_allowed_users_default'] = 'Utilisateurs autorisés à accéder au sondage';
+$lang['mypolls_att_color_bars'] = 'Couleur du graphique';
+$lang['mypolls_att_creation_date'] = 'Date de création';
+$lang['mypolls_att_description'] = 'Description';
+$lang['mypolls_att_display_type'] = 'Type d\'affichage';
+$lang['mypolls_att_enabled'] = 'Actif';
+$lang['mypolls_att_language'] = 'Langue par défaut';
+$lang['mypolls_att_last_vote'] = 'Date du dernier vote';
+$lang['mypolls_att_multi_max_answers'] = 'Nombre maximum de réponses';
+$lang['mypolls_att_nb_questions'] = 'Nombre de questions';
+$lang['mypolls_att_public_results'] = 'Résultats en accès publique';
+$lang['mypolls_att_question_type'] = 'Type de question';
+$lang['mypolls_att_show_user_comment'] = 'Afficher les commentaires';
+$lang['mypolls_att_title'] = 'Titre';
+$lang['mypolls_att_total_votes'] = 'Nombre de votes';
+$lang['mypolls_att_visible'] = 'Publié';
+$lang['mypolls_att_visit_after_vote'] = 'Nombre de visites après vote';
+$lang['mypolls_att_visit_without_vote'] = 'Nombre de visites sans vote';
+$lang['mypolls_auto_translate'] = 'Proposition de traduction';
+$lang['mypolls_cm_answer'] = 'Réponse';
+$lang['mypolls_cm_answers'] = 'Réponses';
+$lang['mypolls_cm_nfo'] = 'Description du sondage';
+$lang['mypolls_cm_question'] = 'Question';
+$lang['mypolls_cm_questions'] = 'Questions';
+$lang['mypolls_cm_settings'] = 'Options';
+$lang['mypolls_cm_stars_are_needed'] = 'Les éléments marqués d\'une étoile<sup style=\"color:rgb(255,255,0)\">*</sup> sont requis';
+$lang['mypolls_cmt_submit_add'] = 'Ajouter la traduction';
+$lang['mypolls_cmt_submit_delete'] = 'Supprimer la traduction';
+$lang['mypolls_cmt_submit_modify'] = 'Appliquer les modifications';
+$lang['mypolls_cnp_submit1'] = 'Créer le sondage';
+$lang['mypolls_cnp_submit2'] = 'Ajouter une question';
+$lang['mypolls_cnp_submit3'] = 'Finaliser le sondage';
+$lang['mypolls_cnp_submit4'] = 'Ajouter la question';
+$lang['mypolls_comment_list'] = 'Liste des commentaires';
+$lang['mypolls_comments'] = 'Commentaires';
+$lang['mypolls_config'] = 'Configuration';
+$lang['mypolls_config_admincolor'] = 'Couleur des données (partie administration)';
+$lang['mypolls_config_color_bars'] = 'Couleur des graphiques';
+$lang['mypolls_config_display_type'] = 'Type d\'affichage';
+$lang['mypolls_config_generic_text_guests'] = 'Texte par défaut pour les invités';
+$lang['mypolls_config_generic_text_users'] = 'Texte par défaut pour les visiteurs';
+$lang['mypolls_config_language'] = '(Saisir le paramétrage pour)';
+$lang['mypolls_config_maxbarwidth'] = 'Largeur maximale du graphique';
+$lang['mypolls_config_menubar_title'] = 'Titre de la barre de menu';
+$lang['mypolls_config_mouseovercolor'] = 'Ligne survolée';
+$lang['mypolls_config_nbcomment_per_page'] = 'Nombre de commentaires affichés par page';
+$lang['mypolls_config_nbuser_per_page'] = 'Nombre de votants affichés par page';
+$lang['mypolls_config_not_public_result_text'] = 'Texte affiché pour les résultats non publiques';
+$lang['mypolls_delete_comment'] = '[Supprimer ce commentaire]';
+$lang['mypolls_display_mono'] = 'Une seule page avec toutes les questions';
+$lang['mypolls_display_multi'] = 'Une page par question';
+$lang['mypolls_do_save'] = 'Enregistrer';
+$lang['mypolls_dp_submit'] = 'Supprimer le sondage';
+$lang['mypolls_dqp_submit'] = 'Supprimer la question';
+$lang['mypolls_error_on_tranlsation_number'] = 'Les traductions sont incomplètes, le sondage ne peut être activé tant que tous les éléments ne sont pas traduits.';
+$lang['mypolls_errors_deleting_comment'] = 'Une erreur est survenue, le commentaire n\'a pas pu être supprimé';
+$lang['mypolls_general_config'] = 'Configuration générale';
+$lang['mypolls_gpc_not_installed'] = 'Le plugin <i>grum_plugins_classes</i> n\'est pas installé ; ce plugin nécessite que le plugin <i>grum_plugins_classes</i> soit installé pour fonctionner. Le processus d\'installation est annulé.';
+$lang['mypolls_infos_deleted_comment'] = 'Le commentaire a été supprimé';
+$lang['mypolls_integration_config'] = 'Intégration de MyPolls dans l\'interface de PWG';
+$lang['mypolls_lang'] = 'Langue';
+$lang['mypolls_langs'] = 'Langues';
+$lang['mypolls_list_actions'] = 'Actions';
+$lang['mypolls_list_date'] = 'Date';
+$lang['mypolls_list_enabled'] = 'Actif';
+$lang['mypolls_list_id'] = '#Id';
+$lang['mypolls_list_lang'] = 'Langues';
+$lang['mypolls_list_last_vote'] = 'Dernier vote';
+$lang['mypolls_list_lnk_modify'] = 'Modifier';
+$lang['mypolls_list_lnk_modify_parent'] = 'Retour en modification sur le sondage';
+$lang['mypolls_list_lnk_view'] = 'Consulter';
+$lang['mypolls_list_nbquestions'] = 'Questions';
+$lang['mypolls_list_title'] = 'Titre';
+$lang['mypolls_list_total'] = 'Votes';
+$lang['mypolls_list_visible'] = 'Publié';
+$lang['mypolls_menu_not_enabled'] = '!A';
+$lang['mypolls_menu_not_publicr'] = '!R';
+$lang['mypolls_menu_not_visible'] = '!P';
+$lang['mypolls_modify_a_question'] = 'Modifier/supprimer une question';
+$lang['mypolls_modify_a_translation'] = 'Modifier/supprimer une traduction';
+$lang['mypolls_modify_questions'] = 'Modifications à apporter sur les questions ';
+$lang['mypolls_mp_add_a_question'] = 'Ajouter une question';
+$lang['mypolls_mp_add_a_translation'] = 'Ajout d\'une traduction';
+$lang['mypolls_mp_submit'] = 'Appliquer les modifications';
+$lang['mypolls_msg_add_question'] = 'Ajout d\'une question';
+$lang['mypolls_msg_add_translation'] = 'Ajout d\'une traduction';
+$lang['mypolls_msg_create_new_poll'] = 'Création d\'un nouveau sondage';
+$lang['mypolls_msg_delete_poll'] = 'Suppression du sondage';
+$lang['mypolls_msg_delete_question'] = 'Suppression de la question';
+$lang['mypolls_msg_delete_translation'] = 'Suppression de la traduction';
+$lang['mypolls_msg_modify_poll'] = 'Modification du sondage';
+$lang['mypolls_msg_modify_question'] = 'Modification de la question';
+$lang['mypolls_msg_modify_translation'] = 'Modification de la traduction';
+$lang['mypolls_new_poll'] = 'Créer un nouveau sondage';
+$lang['mypolls_next_question'] = 'Question suivante';
+$lang['mypolls_no'] = 'Non';
+$lang['mypolls_no_comment_to_delete'] = 'Il n\'y a de commentaire à supprimer';
+$lang['mypolls_not_able_to_call_google'] = 'Les fonctionnalités proposées par votre hébergeur ne permettent pas de disposer de la fonction <i>proposition de traduction</i>';
+$lang['mypolls_not_public_results'] = 'Désolé, les résultats du sondage ne sont pas rendus publiques';
+$lang['mypolls_number_of_polls0'] = '[il n\'y a pas de sondages]';
+$lang['mypolls_number_of_polls1'] = '[1 sondage]';
+$lang['mypolls_number_of_pollsn'] = '[%s sondages]';
+$lang['mypolls_options_view'] = 'Options de consultation';
+$lang['mypolls_page_label'] = 'Page';
+$lang['mypolls_pages_label'] = 'Pages';
+$lang['mypolls_poll_display_config'] = 'Affichage des sondages';
+$lang['mypolls_poll_enabled'] = 'Sondage actif';
+$lang['mypolls_poll_visible'] = 'Sondage publié';
+$lang['mypolls_polls'] = 'Sondages';
+$lang['mypolls_put_comment'] = 'Vous pouvez laisser un commentaire sur le sondage';
+$lang['mypolls_question_mono'] = 'Une seule réponse possible';
+$lang['mypolls_question_multi'] = 'Plusieurs réponses possibles';
+$lang['mypolls_question_order'] = 'Réponses par ordre de préférence';
+$lang['mypolls_result_nbanswers'] = 'Votes';
+$lang['mypolls_result_nbanswers_lang'] = 'Nb. de votes<br>(%s)';
+$lang['mypolls_result_no_vote'] = 'il n\'y a pas encore eu de votes';
+$lang['mypolls_result_pct'] = '%des réponses';
+$lang['mypolls_save_config'] = 'Enregistrement de la configuration';
+$lang['mypolls_select_question'] = 'Sélectionnez la question à modifier';
+$lang['mypolls_select_translation'] = 'Sélectionnez la traduction à modifier';
+$lang['mypolls_submit_results'] = 'Soumettre mon vote';
+$lang['mypolls_title'] = 'MyPolls-II';
+$lang['mypolls_title_adding'] = 'Modification d\'un sondage - Ajout d\'une question';
+$lang['mypolls_title_config'] = 'Configuration des paramètrages par défaut';
+$lang['mypolls_title_create'] = 'Création d\'un nouveau sondage';
+$lang['mypolls_title_list'] = 'Liste des sondages';
+$lang['mypolls_title_modify'] = 'Modification d\'un sondage';
+$lang['mypolls_title_translation_adding'] = 'Modification d\'un sondage - Ajout d\'une traduction';
+$lang['mypolls_title_translation_modify'] = 'Modification d\'un sondage - Modification d\'une traduction';
+$lang['mypolls_title_view'] = 'Consultation d\'un sondage';
+$lang['mypolls_trans_from'] = 'Traduire de';
+$lang['mypolls_trans_fromto'] = 'Langues de la traduction';
+$lang['mypolls_trans_list'] = 'Traductions';
+$lang['mypolls_trans_to'] = 'Traduire vers';
+$lang['mypolls_version'] = 'v';
+$lang['mypolls_visits'] = 'Visites';
+$lang['mypolls_voter_list'] = 'Liste des votants';
+$lang['mypolls_without_vote'] = 'Sans vote';
+$lang['mypolls_yes'] = 'Oui';
+$lang['mypolls_yesno_n'] = 'Non';
+$lang['mypolls_yesno_y'] = 'Oui';
+
+
+?>
Index: /extensions/mypolls/language/index.php
===================================================================
--- /extensions/mypolls/language/index.php	(revision 3397)
+++ /extensions/mypolls/language/index.php	(revision 3397)
@@ -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/mypolls/main.inc.php
===================================================================
--- /extensions/mypolls/main.inc.php	(revision 3397)
+++ /extensions/mypolls/main.inc.php	(revision 3397)
@@ -0,0 +1,89 @@
+<?php
+/*
+Plugin Name: MyPolls.2
+Version: 2.1.0
+Description: Plugin pour faire des sondages sur sa gallerie / Plugin to carry out surveys on its gallery 
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=181
+Author: grum@piwigo.org
+Author URI: http://photos.grum.dnsaliascom/
+*/
+
+/*
+--------------------------------------------------------------------------------
+  Author     : Grum
+    email    : grum@piwigo.com
+    website  : http://photos.grum.dnsalias.com
+    PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+    << May the Little SpaceFrog be with you ! >>
+--------------------------------------------------------------------------------
+
+:: HISTORY
+:: HISTORY
+  2.0.0-beta  - 04/11/07  +refonte complète du plugin
+  2.0.1-beta  - 10/11/07  +conservation & récupération des sondages de la version 1.x
+                          -correction de messages d'erreurs js
+                          -couleur du graphique d'un sondage correspond à la couleur affectée
+                          -bloque l'activation d'un sondage si une traduction n'est faite qu'en partie
+                          -procédure d'export (fichier SQL) automatique lors de la désinstallation
+                          -usage du plugin GRUM_PLUGIN_CORE
+  2.0.2       - 02/01/08  - correction template (ajax) pour être compatible avec IE7.0
+                          - remplacement des "&" dans les URL par des "&amp;" pour être aux normes
+  2.0.3       - 06/01/08  - correction insertions avec MySQL 5  
+  2.0.4       - 06/01/08  - correction insertions&maj
+                          - correction pb sur affichage de mypolls_action_ok
+  2.0.5       - 25/05/08  - adaption du plugin suite à modification de la gestion
+                            de google translator (cf. grum_plugin_classes v1.2.0)
+  2.0.6       - 01/06/08  - correction pour compatibilité avec le plugin manager
+                            http://forum.phpwebgallery.net/viewtopic.php?pid=89458#p89458
+  2.0.7       - 01/06/08  - correction du bug 'lang'
+                            http://forum.phpwebgallery.net/viewtopic.php?pid=89560#p89560
+  2.1.0       - 06/11/08  - release for piwigo 2.0
+                          + PHP5 classe
+                          + install process can import database file (.sql) if present
+
+:: TO DO
+
+--------------------------------------------------------------------------------
+
+:: NFO
+  MyPolls_root : common classe for admin and public classes
+  MyPolls_AIM  : classe to manage plugin integration into plugin menu
+  MyPolls_AIP  : classe to manage plugin admin pages
+  MyPolls_PIP  : classe to manage plugin public pages
+
+--------------------------------------------------------------------------------
+*/
+
+// pour faciliter le debug :o)
+// ini_set('error_reporting', E_ALL);
+// ini_set('display_errors', true);
+
+if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+
+define('MYPOLLS_DIR' , basename(dirname(__FILE__)));
+define('MYPOLLS_PATH' , PHPWG_PLUGINS_PATH . MYPOLLS_DIR . '/');
+
+define('MYPOLLS_VERSION' , '2.1.0'); // => ne pas oublier la version dans l'entête !!
+
+global $prefixeTable;
+
+
+if(defined('IN_ADMIN'))
+{
+  //MyPolls admin interface loaded and active only if in admin page
+  include_once("mypolls_aim.class.inc.php");
+  $obj=new MyPolls_AIM($prefixeTable, __FILE__);
+  $obj->init_events();
+}
+else
+{
+  //MyPolls public interface loaded and active only if in public page
+  include_once("mypolls_pip.class.inc.php");
+  $obj=new MyPolls_PIP($prefixeTable, __FILE__);
+}
+
+set_plugin_data($plugin['id'], $obj);
+
+?>
Index: /extensions/mypolls/maintain.inc.php
===================================================================
--- /extensions/mypolls/maintain.inc.php	(revision 3397)
+++ /extensions/mypolls/maintain.inc.php	(revision 3397)
@@ -0,0 +1,119 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+define('MYPOLLS_DIR' , basename(dirname(__FILE__)));
+define('MYPOLLS_PATH' , PHPWG_PLUGINS_PATH . MYPOLLS_DIR . '/');
+
+//ini_set('error_reporting', E_ALL);
+//ini_set('display_errors', true);
+
+global $gpc_installed, $lang; //needed for plugin manager compatibility
+
+/* -----------------------------------------------------------------------------
+MyPolls-2 needs the Grum Plugin Classe
+----------------------------------------------------------------------------- */
+$gpc_installed=false;
+if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
+{
+  @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
+  // need GPC release greater or equal than 2.0.1
+  if(checkGPCRelease(2,0,1))
+  {
+    @include_once('mypolls_install.class.inc.php');
+    $gpc_installed=true;
+  }
+}
+
+function gpcMsgError(&$errors)
+{
+  array_push($errors, sprintf(l10n('mypolls_gpc2_not_installed'), "2.0.1"));
+}
+// -----------------------------------------------------------------------------
+
+
+
+
+load_language('plugin.lang', MYPOLLS_PATH);
+
+
+function plugin_install($plugin_id, $plugin_version, &$errors) 
+{
+  global $prefixeTable, $gpc_installed;
+
+  if($gpc_installed)
+  {
+    $obj = new MyPolls_Install($prefixeTable, __FILE__);
+    $result=$obj->install();
+    if(!$result)
+    {
+      array_push($errors, "error");
+    }
+  }
+  else
+  {
+    gpcMsgError($errors);
+  }
+}
+
+function plugin_activate($plugin_id, $plugin_version, &$errors)
+{
+  global $prefixeTable, $gpc_installed;
+
+  if($gpc_installed)
+  {
+    $obj = new MyPolls_Install($prefixeTable, __FILE__);
+    $result=$obj->activate();
+    if($result===false or $result!='')
+    {
+      if(is_string($result))
+      {
+        array_push($errors, $result);
+      }
+      else
+      {
+        array_push($errors, "");
+      }
+    }
+  }
+  else
+  {
+    gpcMsgError($errors);
+  }
+}
+
+function plugin_deactivate($plugin_id)
+{
+/*  global $prefixeTable;
+  $obj = new install_mypolls($prefixeTable, __FILE__);
+  $obj->deactivate(); */
+}
+
+function plugin_uninstall($plugin_id)
+{
+  global $prefixeTable, $gpc_installed;
+
+  if($gpc_installed)
+  {
+    $obj = new MyPolls_Install($prefixeTable, __FILE__);
+    $obj->uninstall();
+  }
+  else
+  {
+    gpcMsgError($errors);
+  }
+}
+
+
+?>
Index: /extensions/mypolls/mypolls_aim.class.inc.php
===================================================================
--- /extensions/mypolls/mypolls_aim.class.inc.php	(revision 3397)
+++ /extensions/mypolls/mypolls_aim.class.inc.php	(revision 3397)
@@ -0,0 +1,43 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  MyPolls_AIM : classe to manage plugin integration into plugin menu
+
+  --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once('mypolls_root.class.inc.php');
+
+class MyPolls_AIM extends MyPolls_root
+{ 
+  public function MyPolls_AIM($prefixeTable, $filelocation)
+  {
+    parent::__construct($prefixeTable, $filelocation);
+  }
+
+  /*
+    initialize events call for the plugin
+  */
+  public function init_events()
+  {
+    parent::init_events();
+    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
+  }
+
+  /* ---------------------------------------------------------------------------
+  Function needed for plugin activation
+  --------------------------------------------------------------------------- */
+
+} // MyPolls_AIM class
+
+
+?>
Index: /extensions/mypolls/mypolls_aip.class.inc.php
===================================================================
--- /extensions/mypolls/mypolls_aip.class.inc.php	(revision 3397)
+++ /extensions/mypolls/mypolls_aip.class.inc.php	(revision 3397)
@@ -0,0 +1,2092 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  MyPolls_AIP : classe to manage plugin admin pages 
+
+  --------------------------------------------------------------------------- */
+
+include_once('mypolls_root.class.inc.php');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+class MyPolls_AIP extends MyPolls_root
+{
+  protected $google_translate;
+  protected $tabsheet;
+
+  public function MyPolls_AIP($prefixeTable, $filelocation)
+  {
+    parent::__construct($prefixeTable, $filelocation);
+    $this->load_config();
+    $this->init_events();
+
+    $this->tabsheet = new tabsheet();
+    $this->tabsheet->add('polls',
+                          l10n('mypolls_polls'),
+                          $this->page_link."&amp;f_tabsheet=polls");
+    $this->tabsheet->add('config',
+                          l10n('mypolls_config'),
+                          $this->page_link."&amp;f_tabsheet=config");
+
+    // don't create this object inside root classe otherwise header is modified
+    // everywhere in admin pages
+    $this->ajax = new Ajax();
+
+    // don't create the google_translate object everytime, otherwise google's js 
+    // code is always included in the header even if translation functionalities
+    // aren't needed
+    // translation is needed only if we are in a ajax request
+    if((isset($_POST['fmypolls_gomodify_translation'])||isset($_POST['fmypolls_goadd_translation'])))
+    {
+      $this->google_translate = new translate();
+    }
+  }
+
+
+  /*
+    initialize events call for the plugin
+  */
+  public function init_events()
+  {
+    parent::init_events();
+    add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
+  }
+
+  /*
+    display administration page
+  */
+  public function manage()
+  {
+    global $template;
+
+    $this->return_ajax_content();
+
+    $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/mypolls_admin.tpl");
+
+    if(!isset($_REQUEST['f_tabsheet']))
+    {
+      $_REQUEST['f_tabsheet']='polls';
+    }
+
+    switch($_REQUEST['f_tabsheet'])
+    {
+      case 'polls':
+        $this->display_polls_page();
+        break;
+      case 'config':
+        $this->display_config_page();
+        break;
+    }
+
+    $this->tabsheet->select($_REQUEST['f_tabsheet']);
+    $this->tabsheet->assign();
+    $selected_tab=$this->tabsheet->get_selected();
+    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
+
+    $template_plugin["MYPOLLS_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('mypolls_version').MYPOLLS_VERSION;
+    $template_plugin["MYPOLLS_PAGE"] = $_REQUEST['f_tabsheet'];
+
+    $template->assign('plugin', $template_plugin);
+    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+  }
+
+
+  /*
+    return ajax content
+  */
+  protected function return_ajax_content()
+  {
+    global $ajax, $template;
+
+    if(isset($_REQUEST['ajaxfct']))
+    {
+      //$this->debug("AJAXFCT:".$_REQUEST['ajaxfct']);
+      $result="<p class='errors'>An error has occured</p>";
+      switch($_REQUEST['ajaxfct'])
+      {
+        case 'poll_detail_list':
+          $result=$this->ajax_poll_detail_list($_REQUEST['poll_id']);
+          break;
+        case 'poll_user_list':
+          $result=$this->ajax_poll_user_list($_REQUEST['poll_id']);
+          break;
+        case 'poll_comment_list':
+          $result=$this->ajax_poll_comment_list($_REQUEST['poll_id']);
+          break;
+        case 'poll_delete_comment':
+          $result=$this->ajax_poll_delete_comment($_REQUEST['poll_id']);
+          break;
+      }
+      //$template->
+      $this->ajax->return_result($result);
+    }
+  }
+
+
+  /*
+    manage display of config page & save config
+  */
+  protected function display_config_page()
+  {
+    $languages=get_languages();
+    if(!$this->adviser_abort())
+    {
+      if(isset($_POST['submit_save_config']))
+      {
+        foreach($this->my_config as $key => $val)
+        {
+          if(is_array($val))
+          {
+            foreach($languages as $key2 => $val2)
+            {
+              if(isset($_REQUEST[str2url('f_'.$key.'_'.$key2)]))
+              {
+                $this->my_config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES);
+              }
+            }
+          }
+          else
+          {
+            if(isset($_REQUEST['f_'.$key]))
+            {
+              $this->my_config[$key] = $_REQUEST['f_'.$key];
+            }
+          }
+
+        }
+        $this->display_result(l10n('mypolls_save_config'), $this->save_config());
+      }
+    }
+    $this->display_config();
+  }
+
+
+
+  /*
+    manage display of polls pages actions :
+    - list
+    - create
+    - view
+    - modify/delete
+  */
+  protected function display_polls_page()
+  {
+    //default action if not specified into URL's page
+    if(!isset($_REQUEST['action']))
+    {
+      $_REQUEST['action']='list';
+    }
+    if(!isset($_REQUEST['fmypolls_att_id']))
+    {
+      $_REQUEST['fmypolls_att_id']='';
+    }
+    if(($_REQUEST['action']!='create') and ($_REQUEST['fmypolls_att_id']=='') )
+    {
+      $_REQUEST['action']='list';
+    }
+    if(!isset($_REQUEST['mypolls_step']))
+    {
+      $_REQUEST['mypolls_step']=0;
+    }
+    if(!isset($_REQUEST['mypolls_lang']))
+    {
+      $_REQUEST['mypolls_lang']="";
+    }
+
+    //$this->debug('action:'.$_REQUEST['action']);
+    //$this->debug('fmypolls_att_id:'.$_REQUEST['fmypolls_att_id']);
+    //$this->debug('step:'.$_REQUEST['mypolls_step']);
+    switch($_REQUEST['action'])
+    {
+      case 'list':
+            $this->display_list();
+            break;
+      case 'create':
+              if(isset($_POST['fmypolls_create_new_poll']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                $poll_id=$this->do_create_poll(0);
+                $this->display_result(l10n('mypolls_msg_create_new_poll'), $poll_id);
+                $this->display_cm_page0($this->init_poll_array($poll_id), 'modify', $poll_id);
+              }
+              else
+              {
+                $this->display_cm_page0();
+              }
+            break;
+      case 'view':
+            $this->display_view($_REQUEST['fmypolls_att_id'],  $_REQUEST['mypolls_lang']);
+            break;
+      case 'modify':
+      case 'adding':
+              if(isset($_POST['fmypolls_modify_poll']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //modify a poll
+                $result=$this->do_modify_poll(0, $_REQUEST['fmypolls_att_id']);
+                $this->display_result(l10n('mypolls_msg_modify_poll'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_delete_poll']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //delete a poll
+                $result=$this->do_delete_poll($_REQUEST['fmypolls_att_id']);
+                $this->display_result(l10n('mypolls_msg_delete_poll'), $result);
+                //go back to list
+                $this->display_list();
+              }
+              elseif(isset($_POST['fmypolls_add_question']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //add a question on poll
+                $result=$this->do_create_poll($_REQUEST['mypolls_step']);
+                $this->display_result(l10n('mypolls_msg_add_question'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_modify_question']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //modify a poll's question
+                $result=$this->do_modify_poll($_REQUEST['mypolls_step'],
+                                              $_REQUEST['fmypolls_att_id']);
+                $this->display_result(l10n('mypolls_msg_modify_question'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_delete_question']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //delete a poll's question
+                $result=$this->do_delete_question($_REQUEST['mypolls_step'], $_REQUEST['fmypolls_att_id']);
+                $this->display_result(l10n('mypolls_msg_delete_question'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_add_translation']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //add a translation on poll
+                $result=$this->do_translate_poll($_REQUEST['fmypolls_att_id'], 'adding');
+                $this->display_result(l10n('mypolls_msg_add_translation'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_modify_translation']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //delete a poll's question
+                $result=$this->do_translate_poll($_REQUEST['fmypolls_att_id'], 'modify');
+                $this->display_result(l10n('mypolls_msg_modify_translation'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_delete_translation']))
+              {
+                if($this->adviser_abort())
+                {
+                  $this->display_list();
+                  break;
+                }
+                //delete a poll's question
+                $result=$this->do_delete_poll_translation($_REQUEST['fmypolls_att_id'], $_REQUEST['fmypolls_trans_to']);
+                $this->display_result(l10n('mypolls_msg_delete_translation'), $result);
+                //go back to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+              elseif(isset($_POST['fmypolls_gomodify_question']))
+              {
+                $ansid=explode(".", $_REQUEST['mypolls_step']);
+                //go to poll's question page in 'modify' mode
+                $this->display_cm_pagen($_REQUEST['mypolls_step'],
+                                        $_REQUEST['fmypolls_att_id'],
+                                        $this->init_poll_question_array($_REQUEST['fmypolls_att_id'], $ansid[0]),
+                                        'modify');
+              }
+              elseif(isset($_POST['fmypolls_goadd_question']))
+              {
+                //go to poll's question page in 'adding' mode
+                $this->display_cm_pagen($_REQUEST['mypolls_step'],
+                                        $_REQUEST['fmypolls_att_id'], array(), 'adding');
+              }
+              elseif(isset($_POST['fmypolls_gomodify_translation']))
+              {
+                //go to poll's translation page in 'modify' mode
+                $this->display_translation_page($_REQUEST['fmypolls_att_id'], $_REQUEST['fmypolls_translation_id'],'modify');
+              }
+              elseif(isset($_POST['fmypolls_goadd_translation']))
+              {
+                //go to poll's translation page in 'modify' mode
+                $this->display_translation_page($_REQUEST['fmypolls_att_id'], '', 'adding');
+              }
+              else
+              {
+                //go to poll's main page in 'modify' mode
+                $this->display_cm_page0($this->init_poll_array($_REQUEST['fmypolls_att_id']),
+                                        'modify',
+                                        $_REQUEST['fmypolls_att_id']);
+              }
+            break;
+    }
+  }
+
+  /*
+    display list page of polls and allow to :
+      - view a poll
+      - modify a poll
+      - create a new poll
+  */
+  protected function display_list()
+  {
+    global $template, $user;
+    $template->set_filename('body_page',
+                            dirname($this->filelocation).'/admin/plugin_admin_list.tpl');
+
+    $polls_list=$this->get_polls_list(1,true);
+    if(count($polls_list)>1)
+    { $nb='n'; } else { $nb=count($polls_list); }
+
+    $template_datas=array();
+    $template_datarows=array();
+
+    for($i=0;$i<count($polls_list);$i++)
+    {
+      if($polls_list[$i]['total_votes']>0)
+      {
+        $last_vote = $polls_list[$i]['last_vote'];
+      }
+      else
+      {
+        $last_vote = "";
+      }
+      $template_datarows[]=array(
+        'ID' => $polls_list[$i]['id'],
+        'DATE' => substr($polls_list[$i]['date'],0,10),
+        'TITLE' => $polls_list[$i]['title'],
+        'NBQUESTIONS' => $polls_list[$i]['nb_questions'],
+        'VISIBLE' => l10n('mypolls_yesno_'.$polls_list[$i]['visible']),
+        'ENABLED' => l10n('mypolls_yesno_'.$polls_list[$i]['enabled']),
+        'TOTAL' => $polls_list[$i]['total_votes'],
+        'LAST_VOTE' => $last_vote,
+        'LNK_VIEW' => $this->page_link.
+                '&amp;f_tabsheet=polls&amp;action=view&amp;fmypolls_att_id='.
+                $polls_list[$i]['id'],
+        'LNK_MODIFY' => $this->page_link.
+                '&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id='.
+                $polls_list[$i]['id']
+      );
+    }
+
+    $template_datas=array(
+      "MYPOLLS_TITLE" => l10n('mypolls_title_list'),
+      "MYPOLLS_NB_POLLS" => sprintf(l10n('mypolls_number_of_polls'.$nb), count($polls_list)),
+      "LNK_CREATE" => $this->page_link.'&amp;f_tabsheet=polls&amp;action=create',
+      "MYPOLLS_AJAX_URL_POLL_DETAIL" => $this->page_link.'&ajaxfct=poll_detail_list&poll_id=',
+      "MYPOLLS_CHARSET" => substr($user['language'],6)
+    );
+
+    $template->assign("datas", $template_datas);
+    $template->assign("mypolls_nb_polls_rows", $template_datarows);
+    $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  }
+
+
+  /*
+    display first page to create/modify a poll (poll's attributes)
+      page can be acceded :
+        - when poll is created (no default_values)
+        - when poll is created but with an error (default_values are form's values)
+        - when poll is modified (default_values are database values)
+        - when poll is modified but with an error (default_values are form's values)
+
+      $access_type = "create", "modify"
+  */
+  protected function display_cm_page0($default_values=array(), $access_type = "create", $poll_id=0)
+  {
+    global $template, $user, $page;
+
+    $template->set_filename('body_page',
+                dirname($this->filelocation).'/admin/plugin_admin_create.tpl');
+
+    $template_datas=array();
+
+    if($access_type=='create')
+    {
+      $template_datas['MYPOLLS_ICN_HIDDEN']='visibility:hidden;';
+      $template_datas['MYPOLLS_NEXT_STEP']='0.1';
+      $template_datas['MYPOLLS_ENABLED']=' disabled';
+    }
+    else
+    {
+      $template_datas['MYPOLLS_LANG_DISABLED']='disabled';
+      $template_datas['MYPOLLS_LNK_VIEW'] = $this->page_link.'&amp;f_tabsheet=polls&amp;action=view&amp;fmypolls_att_id='.$poll_id;
+      $template_datas['MYPOLLS_NEXT_STEP'] = ($default_values['counter_questions']+1).".".($default_values['nb_questions']+1);
+
+
+      //check if number of questions/answers is the same for each language
+      $sql="SELECT count(id_answer), lang
+            FROM ".$this->tables['polls_answers_lang']."
+            WHERE id_poll = '".$poll_id."'
+            GROUP BY lang";
+      $result=pwg_query($sql);
+      if($result)
+      {
+        $nb=-1;
+        while($row=mysql_fetch_row($result))
+        {
+          if($nb<0)
+          {
+            $nb=$row[0];
+          }
+          elseif($nb!=$row[0])
+          {
+            $nb=-2;
+            array_push($page['errors'], l10n('mypolls_error_on_tranlsation_number'));
+            break;
+          }
+        }
+      }
+
+      if(($default_values['nb_questions']<1)||($nb==-2))
+      {
+        $template_datas['MYPOLLS_ENABLED']= ' disabled';
+        $default_values['enabled']='n';
+        $this->deactivate_poll($poll_id);
+      }
+    }
+    $template_datas['MYPOLLS_ACTION']= $access_type;
+
+    //no default value, so initialization
+    if(count($default_values)==0)
+    {
+      $allowed_users="";
+      if($this->my_config['mypolls_allowed_users_default_guest']=='y')
+      { $allowed_users.="guest/"; }
+      if($this->my_config['mypolls_allowed_users_default_generic']=='y')
+      { $allowed_users.="generic/"; }
+      if($this->my_config['mypolls_allowed_users_default_normal']=='y')
+      { $allowed_users.="normal/"; }
+
+      $default_values=array(
+        'default_lang' => $user['language'],
+        'title' => '',
+        'description' => '',
+        'after_vote_text' => '',
+        'allowed_users' => $allowed_users,
+        'allowed_groups' => $this->my_config['mypolls_allowed_groups_default'],
+        'enabled' => 'n',
+        'visible' => $this->my_config['mypolls_visible_default'],
+        'allow_comment' => $this->my_config['mypolls_allow_comment_default'],
+        'show_comments' => $this->my_config['mypolls_show_user_comment_default'],
+        'display_type' => $this->my_config['mypolls_display_type_default'],
+        'color_bars' => $this->my_config['mypolls_color_bars'],
+        'public_results' => $this->my_config['mypolls_public_results']
+      );
+    }
+
+
+    $template_datas['MYPOLLS_ATT_TITLE'] = $default_values['title'];
+    $template_datas['MYPOLLS_ATT_DESCRIPTION'] = $default_values['description'];
+    $template_datas['MYPOLLS_ATT_AFTER_VOTE_TEXT'] = $default_values['after_vote_text'];
+
+    //users and groups access management
+    $users = new users($default_values['allowed_users']);
+    $template_datas['GENERIC_USERS_ACCESS'] = $users->html_form('fmypolls_att_allowed_users_');
+
+    $groups = new groups($default_values['allowed_groups']);
+    $template_datas['GENERIC_GROUPS_ACCESS'] = $groups->html_form('fmypolls_att_allowed_groups_');
+
+
+    //poll's main language selection
+    $template_language_list_values=array();
+    $template_language_list_labels=array();
+    $template_language_selected=$default_values['default_lang'];
+    $languages=get_languages();
+    foreach($languages as $key => $val)
+    {
+      $template_language_list_values[]=$key;
+      $template_language_list_labels[]=$val;
+    }
+
+    //poll's type of display (one page for all question / a page per question)
+    $template_display_list_values=array();
+    $template_display_list_labels=array();
+    $template_display_selected=$default_values['display_type'];
+    for($i=0;$i<count($this->display_types);$i++)
+    {
+      $template_display_list_values[]=$this->display_types[$i];
+      $template_display_list_labels[]=l10n('mypolls_display_'.$this->display_types[$i]);
+    }
+
+    if($default_values['enabled']=='y')
+    { $template_datas['MYPOLLS_ATT_ENABLED_YES'] = 'selected'; }
+    else
+    { $template_datas['MYPOLLS_ATT_ENABLED_NO'] = 'selected'; }
+
+    if($default_values['visible']=='y')
+    { $template_datas['MYPOLLS_ATT_VISIBLE_YES'] = 'selected'; }
+    else
+    { $template_datas['MYPOLLS_ATT_VISIBLE_NO'] = 'selected'; }
+
+    if($default_values['allow_comment']=='y')
+    { $template_datas['MYPOLLS_ATT_ALLOW_COMMENT_YES'] = 'selected'; }
+    else
+    { $template_datas['MYPOLLS_ATT_ALLOW_COMMENT_NO'] = 'selected'; }
+
+    if($default_values['show_comments']=='y')
+    { $template_datas['MYPOLLS_ATT_SHOW_USER_COMMENT_YES'] = 'selected'; }
+    else
+    { $template_datas['MYPOLLS_ATT_SHOW_USER_COMMENT_NO'] = 'selected'; }
+
+    if($default_values['public_results']=='y')
+    { $template_datas['MYPOLLS_ATT_PUBLIC_RESULTS_YES'] = 'selected'; }
+    else
+    { $template_datas['MYPOLLS_ATT_PUBLIC_RESULTS_NO'] = 'selected'; }
+
+    $template_datas['fmypolls_att_color_bars'] = $default_values['color_bars'];
+
+
+    if($access_type=='create')
+    {
+      $template_datas['mypolls_en_creation']='yes';
+    }
+    else
+    {
+      $nbquestions = $default_values['nb_questions']."&nbsp;";
+      $poll_languages=$this->get_poll_languages($poll_id);
+
+      if($default_values['nb_questions']>1)
+      { $nbquestions.=l10n('mypolls_cm_questions'); }
+      else
+      { $nbquestions.=l10n('mypolls_cm_question'); }
+      //modify poll, display specifics block for actions
+      $template_datas['mypolls_en_modification']='yes';
+
+      $template_datas['ID'] = $poll_id;
+      $template_datas['NBQUESTIONS'] = $nbquestions;
+      $template_datas['DISABLE_ADD_TRANS'] = (count($poll_languages)==count($languages))?' disabled':'';
+
+      // block : questions
+      $template_questions_list_values=array();
+      $template_questions_list_labels=array();
+      $num=1;
+      $questions=$this->get_poll_questions($poll_id);
+      foreach($questions as $val)
+      {
+        if(strlen($val['description'])>37)
+        {
+          $text=substr($val['description'],0,34)."...";
+        }
+        else
+        {
+          $text=$val['description'];
+        }
+
+        $template_questions_list_values[] = $val['question_num'].".".$num;
+        $template_questions_list_labels[] = "[".$num."] ".$text;
+
+        $num++;
+      }
+
+      // block : translations
+      $template_translations_list_values=array();
+      $template_translations_list_labels=array();
+      foreach($poll_languages as $val)
+      {
+        if($val != $default_values['default_lang'])
+        {
+          $template_translations_list_values[]=$val;
+          $template_translations_list_labels[]=$languages[$val];
+        }
+      }
+
+      $template->assign('mypolls_questions_list_values', $template_questions_list_values);
+      $template->assign('mypolls_questions_list_labels', $template_questions_list_labels);
+      $template->assign('mypolls_translations_list_values', $template_translations_list_values);
+      $template->assign('mypolls_translations_list_labels', $template_translations_list_labels);
+    }
+
+    $template_datas["MYPOLLS_TITLE"] = l10n('mypolls_title_'.$access_type);
+
+    $template->assign('mypolls_language_list_values', $template_language_list_values);
+    $template->assign('mypolls_language_list_labels', $template_language_list_labels);
+    $template->assign('mypolls_language_selected', $template_language_selected);
+    $template->assign('mypolls_display_list_values', $template_display_list_values);
+    $template->assign('mypolls_display_list_labels', $template_display_list_labels);
+    $template->assign('mypolls_display_selected', $template_display_selected);
+    $template->assign('datas', $template_datas);
+    $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  } //display_cm_page0
+
+
+
+  /*
+    display other pages to create/modify a poll (poll's questions)
+      page can be acceded :
+        - when poll is created (no default_values)
+        - when poll is created but with an error (default_values are form's values)
+        - when poll is modified (default_values are database values)
+        - when poll is modified but with an error (default_values are form's values)
+
+          $access_type = "create", "modify"
+  */
+  protected function display_cm_pagen($step, $poll_id, $default_values=array(), $access_type = "create")
+  {
+    global $template;
+
+    $template->set_filename('body_page',
+                dirname($this->filelocation).'/admin/plugin_admin_create2.tpl');
+
+    //$step format : id.num
+    $steps=explode(".", $step);
+
+    $template_datas["MYPOLLS_TITLE"] = l10n('mypolls_title_'.$access_type)." - ".l10n('mypolls_cm_question')." ".$steps[1];
+    $template_datas['MYPOLLS_STEP_VALUE'] = $steps[0];
+    $template_datas['MYPOLLS_ATT_ID'] = $poll_id;
+
+    if($access_type=='create')
+    {
+      $template_datas['MYPOLLS_ICN_HIDDEN'] = 'visibility:hidden;';
+    }
+    else
+    {
+      $template_datas['MYPOLLS_LNK_VIEW'] = $this->page_link.'&amp;f_tabsheet=polls&amp;action=view&amp;fmypolls_att_id='.$poll_id;
+      $template_datas['MYPOLLS_LNK_MODIFY'] = $this->page_link.'&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id='.$poll_id;
+    }
+    $template_datas['MYPOLLS_ACTION'] = $access_type;
+
+    if(count($default_values)==0)
+    {
+      $default_values=array(
+        'default_lang' => $_REQUEST['fmypolls_att_default_lang'],
+        'description' => '',
+        'question_type' => $this->my_config['mypolls_question_type_default'],
+        'multi_max_answers' => $this->my_config['mypolls_multi_max_answers_default'],
+        'answ0' => '',
+        'answ1' => '',
+        'counter_answers' => '1'
+      );
+    }
+
+    $template_datas['MYPOLLS_ATT_DESCRIPTION'] = $default_values['description'];
+    $template_datas['MYPOLLS_ATT_MULTI_MAX_ANSWERS'] = $default_values['multi_max_answers'];
+    $template_datas['MYPOLLS_NEXT_QUESTION'] = $default_values['counter_answers']+1;
+
+    //poll's main language selection
+    $languages=get_languages();
+    $template_datas['MYPOLLS_ATT_LANG'] =  $default_values['default_lang'];
+    $template_language_list_values=array();
+    $template_language_list_labels=array();
+    $template_language_list_values[]=$default_values['default_lang'];
+    $template_language_list_labels[]=$languages[$default_values['default_lang']];
+    $template_language_selected[]=$default_values['default_lang'];
+
+    //poll's type of display (one page for all question / a page per question)
+    $template_question_type_list_values=array();
+    $template_question_type_list_labels=array();
+    $template_question_type_selected=$default_values['question_type'];
+    for($i=0;$i<count($this->questions_types);$i++)
+    {
+      $template_question_type_list_values[]=$this->questions_types[$i];
+      $template_question_type_list_labels[]=l10n('mypolls_question_'.$this->questions_types[$i]);
+    }
+
+    //poll's answers
+    $init="";
+    foreach($default_values as $key => $val)
+    {
+      if(substr($key,0,4)=="answ")
+      {
+        $init.="add_answer('".$val."', ".substr($key,4).");";
+      }
+    }
+    $template_datas['MYPOLLS_INIT_ANSWERS_LIST'] = $init;
+
+    if($access_type=='create')
+    {
+      $template_datas['mypolls_en_creation'] = 'yes';
+    }
+    elseif($access_type=='modify')
+    {
+      //modify poll, display specifics block for actions
+      $template_datas['mypolls_en_modification'] = 'yes';
+    }
+    elseif($access_type=='adding')
+    {
+      //add a question (modify poll)), display specifics block for actions
+      $template_datas['mypolls_adding_question'] = 'yes';
+    }
+
+    $template->assign('datas', $template_datas);
+    $template->assign('mypolls_language_list_values', $template_language_list_values);
+    $template->assign('mypolls_language_list_labels', $template_language_list_labels);
+    $template->assign('mypolls_language_selected', $template_language_selected);
+    $template->assign('mypolls_question_type_list_values', $template_question_type_list_values);
+    $template->assign('mypolls_question_type_list_labels', $template_question_type_list_labels);
+    $template->assign('mypolls_question_type_selected', $template_question_type_selected);
+
+    $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  } //display_cm_pagen
+
+
+  /*
+    display translation page
+  */
+  protected function display_translation_page($poll_id, $lang="", $access_type="adding")
+  {
+    global $template, $user, $page;
+
+
+    $template->set_filename('body_page',
+                dirname($this->filelocation).'/admin/plugin_admin_translate.tpl');
+
+
+    if($access_type=="adding")
+    {
+    }
+    else
+    {
+      $template_datas['MYPOLLS_LANG_DISABLED'] = ' disabled';
+    }
+
+    $poll_langs=$this->get_poll_languages($poll_id);
+    $poll_dlang=$this->get_poll_values($poll_id);
+    $poll_tolang=$this->get_poll_values($poll_id, $lang);
+    $languages=get_languages();
+
+    $template_langto_list_values=array();
+    $template_langto_list_labels=array();
+    $template_langto_selected=$lang;
+
+    // initialize "to lang" list
+    foreach($languages as $key => $val)
+    {
+      if($key!=$poll_dlang['default_lang'])
+      {
+        if((($access_type=="adding")&&(!in_array($key, $poll_langs)))||($access_type=="modify"))
+        {
+          $template_langto_list_values[]=$key;
+          $template_langto_list_labels[]=$val;
+        }
+      }
+    }
+
+    $questions_dlang=$this->get_poll_questions($poll_id);
+    $questions_tolang=$this->get_poll_questions($poll_id, "", $lang);
+    $numq=1;
+    $template_questions_list=array();
+    foreach($questions_dlang as $key => $val)
+    {
+      $template_answers_list=array();
+      $numa=1;
+      $answers_dlang=$this->get_poll_answers($poll_id, $val['question_num']);
+      $answers_tolang=$this->get_poll_answers($poll_id, $val['question_num'], $lang);
+      foreach($answers_dlang as $key2 => $val2)
+      {
+        $template_answers_list[]=array(
+          'NUMANSWER' => $numa,
+          'IDANSWER' => $val['question_num']."_".$val2['answer_num'],
+          //from lang
+          'ANSWER' => $val2['answer'],
+          //to lang
+          'TTO_ANSWER' => isset($answers_tolang[$key2]['answer'])?$answers_tolang[$key2]['answer']:$val2['answer']
+        );
+
+        $numa++;
+      }
+
+      $template_questions_list[]=array(
+        'NUMQUESTION' => $numq,
+        'IDQUESTION' => $val['question_num'],
+        //from lang
+        'DESCRIPTION' => $val['description'],
+        //to lang
+        'TTO_DESCRIPTION' => isset($questions_tolang[$key]['description'])?$questions_tolang[$key]['description']:$val['description'],
+        'answers' => $template_answers_list
+      );
+
+      $numq++;
+    }
+
+    if($access_type=='adding')
+    {
+      $template_datas['mypolls_add_translation'] = 'yes';
+    }
+    elseif($access_type=='modify')
+    {
+      $template_datas['mypolls_modify_translation'] = 'yes';
+    }
+
+    $template_datas["MYPOLLS_TITLE"] = l10n('mypolls_title_translation_'.$access_type);
+    $template_datas['MYPOLLS_ATT_ID'] = $poll_id;
+    $template_datas['MYPOLLS_ACTION'] = $access_type;
+    $template_datas['MYPOLLS_LNK_VIEW'] = $this->page_link.'&amp;f_tabsheet=polls&amp;action=view&amp;fmypolls_att_id='.$poll_id;
+    $template_datas['MYPOLLS_LNK_MODIFY'] = $this->page_link.'&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id='.$poll_id;
+    $template_datas['MYPOLLS_CHARSET'] = substr($user['language'], 6);
+    $template_datas['MYPOLLS_ATT_TITLE'] = $poll_dlang['title'];
+    $template_datas['MYPOLLS_ATT_DESCRIPTION'] = $poll_dlang['description'];
+    $template_datas['MYPOLLS_ATT_AFTER_VOTE_TEXT'] = $poll_dlang['after_vote_text'];
+    $template_datas['MYPOLLS_TRANS_FROM'] = $poll_dlang['default_lang'];
+    $template_datas['MYPOLLS_TRANS_FROM_TEXT'] = $languages[$poll_dlang['default_lang']];
+    $template_datas['MYPOLLS_ATT_TTO_TITLE'] = $poll_tolang['title'];
+    $template_datas['MYPOLLS_ATT_TTO_DESCRIPTION'] = $poll_tolang['description'];
+    $template_datas['MYPOLLS_ATT_TTO_AFTER_VOTE_TEXT'] = $poll_tolang['after_vote_text'];
+
+    $template->assign('datas', $template_datas);
+    $template->assign('mypolls_langto_list_values', $template_langto_list_values);
+    $template->assign('mypolls_langto_list_labels', $template_langto_list_labels);
+    $template->assign('mypolls_langto_selected', $template_langto_selected);
+    $template->assign('questions', $template_questions_list);
+
+    $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  }//display_translation_page
+
+
+  /*
+    display view page
+  */
+  protected function display_view($poll_id, $lang="")
+  {
+      global $template;
+
+      $template->set_filename('body_page',
+                  dirname($this->filelocation).'/admin/plugin_admin_view.tpl');
+
+      $poll_langs=$this->get_poll_languages($poll_id);
+      $poll_values=$this->get_poll_values($poll_id, $lang);
+      $languages=get_languages();
+
+      if($lang=="")
+      {
+        $lang=$poll_values['default_lang'];
+      }
+
+
+      $template_langs_list_values=array();
+      $template_langs_list_labels=array();
+      $template_langs_selected=$lang;
+
+      // initialize "view langs" list
+      foreach($poll_langs as $key => $val)
+      {
+        $template_langs_list_values[]=$val;
+        $template_langs_list_labels[]=$languages[$val];
+      }
+      $users=new users($poll_values['allowed_users']);
+      $users->set_allowed('admin', false);
+      $groups=new groups($poll_values['allowed_groups']);
+
+
+      $this->display_results_block($poll_id, $lang, $poll_values);
+
+      $template_datas['MYPOLLS_TITLE'] = l10n('mypolls_title_view');
+      $template_datas['MYPOLLS_ATT_ID'] = $poll_id;
+      $template_datas['MYPOLLS_LNK_MODIFY'] =  $this->page_link.'&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id='.$poll_id;
+      $template_datas['MYPOLLS_AJAX_URL_POLL_VOTER_LIST'] = $this->page_link.'&ajaxfct=poll_user_list&poll_id='.$poll_id.'&vpage=';
+      $template_datas['MYPOLLS_AJAX_URL_POLL_COMMENT_LIST'] =  $this->page_link.'&ajaxfct=poll_comment_list&poll_id='.$poll_id.'&vpage=';
+      $template_datas['MYPOLLS_AJAX_URL_POLL_DELETE_COMMENT'] =  $this->page_link.'&ajaxfct=poll_delete_comment&poll_id='.$poll_id.'&comment_id=';
+      $template_datas['MYPOLLS_CHARSET'] = substr($lang, 6);
+      $template_datas['MYPOLLS_ATT_TITLE'] = $poll_values['title'];
+      $template_datas['MYPOLLS_ATT_DESCRIPTION'] = html_entity_decode($poll_values['description'], ENT_QUOTES);
+      $template_datas['MYPOLLS_ATT_AFTER_VOTE_TEXT'] = html_entity_decode($poll_values['after_vote_text'], ENT_QUOTES);
+      $template_datas['MYPOLLS_ATT_DATE'] = $poll_values['date'];
+      $template_datas['MYPOLLS_ATT_ENABLED'] = l10n('mypolls_yesno_'.$poll_values['enabled']);
+      $template_datas['MYPOLLS_ATT_VISIBLE'] = l10n('mypolls_yesno_'.$poll_values['visible']);
+      $template_datas['MYPOLLS_ATT_ALLOW_COMMENT'] = l10n('mypolls_yesno_'.$poll_values['allow_comment']);
+      $template_datas['MYPOLLS_ATT_SHOW_COMMENTS'] = l10n('mypolls_yesno_'.$poll_values['show_comments']);
+      $template_datas['MYPOLLS_ATT_ALLOWED_USERS'] = $users->html_view(", ", l10n('mypolls_allowed_users_empty'));
+      $template_datas['MYPOLLS_ATT_ALLOWED_GROUPS'] = $groups->html_view(", ", l10n('mypolls_allowed_groups_empty'));
+      $template_datas['MYPOLLS_ATT_NB_QUESTIONS'] = $poll_values['nb_questions'];
+      $template_datas['MYPOLLS_ATT_TOTAL_VOTES'] = $poll_values['total_votes'];
+      $template_datas['MYPOLLS_ATT_LAST_VOTE'] = ($poll_values['last_vote']=="0000-00-00 00:00:00")?l10n('mypolls_result_no_vote'):$poll_values['last_vote'];
+      $template_datas['MYPOLLS_ATT_VISIT_WITHOUT_VOTE'] = $poll_values['visit_without_vote'];
+      $template_datas['MYPOLLS_ATT_VISIT_AFTER_VOTE'] = $poll_values['visit_after_vote'];
+      $template_datas['MYPOLLS_ATT_DISPLAY_TYPE'] = strtolower(l10n('mypolls_display_'.$poll_values['display_type']));
+      $template_datas['MYPOLLS_ATT_PUBLIC_RESULTS'] = $poll_values['public_results'];
+
+      $template->assign('datas', $template_datas);
+      $template->assign('mypolls_langs_list_values', $template_langs_list_values);
+      $template->assign('mypolls_langs_list_labels', $template_langs_list_labels);
+      $template->assign('mypolls_langs_selected', $template_langs_selected);
+
+      $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  } //display_view
+
+  /*
+    display config page
+  */
+  protected function display_config()
+  {
+    global $template;
+
+    $template->set_filename('body_page',
+                dirname($this->filelocation).'/admin/plugin_admin_config.tpl');
+
+    //poll's type of display (one page for all question / a page per question)
+    $template_display_list_values=array();
+    $template_display_list_labels=array();
+    $template_display_selected=$this->my_config['mypolls_display_type_default'];
+    foreach($this->display_types as $val)
+    {
+      $template_display_list_values[]=$val;
+      $template_display_list_labels[]=l10n('mypolls_display_'.$val);
+    }
+
+    //langs list & texts
+
+    $template_language_list=array();
+    $template_language_list_values=array();
+    $template_language_list_labels=array();
+    $template_language_selected=str2url(get_default_language());
+    $languages=get_languages();
+    foreach($languages as $key => $val)
+    {
+      $template_language_list_values[]=str2url($key);
+      $template_language_list_labels[]=$val;
+
+      $template_language_list[]=array(
+        'LANG' => str2url($key),
+        'MENUBARTIT' => $this->my_config['mypolls_menubar_title'][$key],
+        'GENTEXUSER' => $this->my_config['mypolls_generic_text_users'][$key],
+        'GENTEXGUEST' => $this->my_config['mypolls_generic_text_guests'][$key],
+        'NOTPUBRESTEX' => $this->my_config['mypolls_not_public_results'][$key]
+      );
+    }
+    $template_datas["MYPOLLS_TITLE"] = l10n('mypolls_title_config');
+
+    $template_datas['MYPOLLS_CFG_COLOR_BARS'] = $this->my_config['mypolls_color_bars'];
+    $template_datas['MYPOLLS_CFG_MAXBARWIDTH'] = $this->my_config['mypolls_maxbarwidth'];
+    $template_datas['MYPOLLS_CFG_ADMINCOLOR'] = $this->my_config['mypolls_admincolor'];
+    $template_datas['MYPOLLS_CFG_MOUSEOVERCOLOR'] = $this->my_config['mypolls_mouseovercolor'];
+    $template_datas['MYPOLLS_CFG_NBUSER_PER_PAGE'] = $this->my_config['mypolls_nbuser_per_page'];
+    $template_datas['MYPOLLS_CFG_NBCOMMENT_PER_PAGE'] = $this->my_config['mypolls_nbcomment_per_page'];
+
+    $template->assign('datas', $template_datas);
+    $template->assign('mypolls_language_list', $template_language_list);
+    $template->assign('mypolls_language_list_values', $template_language_list_values);
+    $template->assign('mypolls_language_list_labels', $template_language_list_labels);
+    $template->assign('mypolls_language_selected', $template_language_selected);
+    $template->assign('mypolls_display_list_values', $template_display_list_values);
+    $template->assign('mypolls_display_list_labels', $template_display_list_labels);
+    $template->assign('mypolls_display_selected', $template_display_selected);
+
+    $template->assign_var_from_handle('MYPOLLS_BODY_PAGE', 'body_page');
+  } //display_config
+
+  /*
+    manage adviser profile
+      return true if user is adviser
+  */
+  protected function adviser_abort()
+  {
+    if(is_adviser())
+    {
+      $this->display_result(l10n("mypolls_adviser_not_allowed"), false);
+      return(true);
+    }
+    return(false);
+  }
+
+  /*
+    deactivate a poll
+  */
+  protected function deactivate_poll($poll_id)
+  {
+    $sql="UPDATE ".$this->tables['polls']."
+          SET enabled = 'n'
+          WHERE id = '".$poll_id."'";
+    $result=pwg_query($sql);
+    return($result);
+  }
+
+  /*
+    create a poll
+      if $page = 0, create general nfo else create question
+  */
+  protected function do_create_poll($step)
+  {
+    if($step==0)
+    {
+      //step 0 : create root caracteristics of poll
+      $groups = new groups();
+      $users = new users();
+      foreach($_REQUEST as $key => $val)
+      {
+        if((substr($key, 0, 28)=='fmypolls_att_allowed_groups_') and ($val=="on"))
+        {
+          $groups->set_allowed(substr($key,28),true);
+        }
+
+        if((substr($key, 0, 27)=='fmypolls_att_allowed_users_') and ($val=="on"))
+        {
+          $users->set_allowed(substr($key,27),true);
+        }
+      }
+
+      $values = array(
+        'allowed_users' => $users->get_alloweds('id'),
+        'allowed_groups' => $groups->get_alloweds('id'),
+        'visible' => $_REQUEST['fmypolls_att_visible'],
+        'enabled' => $_REQUEST['fmypolls_att_enabled'],
+        'allow_comment' => $_REQUEST['fmypolls_att_allow_comment'],
+        'show_comments' => $_REQUEST['fmypolls_att_show_comments'],
+        'color_bars' => $_REQUEST['fmypolls_att_color_bars'],
+        'display_type' => $_REQUEST['fmypolls_att_display_type'],
+        'default_lang' => $_REQUEST['fmypolls_att_default_lang'],
+        'public_results' => $_REQUEST['fmypolls_att_public_results']
+      );
+      $poll_id=$this->create_poll($values);
+      if($poll_id>0)
+      {
+        $values = array(
+          'lang' => $_REQUEST['fmypolls_att_default_lang'],
+          'title' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_title']), ENT_QUOTES),
+          'description' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_description']), ENT_QUOTES),
+          'after_vote_text' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_after_vote_text']), ENT_QUOTES),
+        );
+        if($this->create_poll_lang($poll_id, $values))
+        {
+          return($poll_id);
+        }
+      }
+    }
+    else
+    { //step >0 : create questions
+      $poll_id=$_REQUEST['fmypolls_att_id'];
+      $values = array(
+        'id_poll' => $poll_id,
+        'question_num' => $step,
+        'question_type' => $_REQUEST['fmypolls_att_question_type'],
+        'multi_max_answers' => isset($_REQUEST['fmypolls_att_multi_max_answers']) ? $_REQUEST['fmypolls_att_multi_max_answers'] : '0'
+      );
+      if($this->create_poll_questions($values))
+      {
+        $values = array(
+          'id_poll' => $poll_id,
+          'id_question' => $step,
+          'lang' => $_REQUEST['fmypolls_att_default_lang'],
+          'description' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_description']), ENT_QUOTES)
+        );
+        if($this->create_poll_questions_lang($values))
+        {
+          foreach($_REQUEST as $key => $val)
+          {
+            if((substr($key, 0, 17)=='fmypolls_att_answ') and ($val!=''))
+            {
+              $values = array(
+                'id_poll' => $poll_id,
+                'id_question' => $step,
+                'answer_num' => substr($key,17),
+                '0'
+              );
+              if($this->create_poll_answers($values))
+              {
+                $values = array(
+                  'id_poll' => $poll_id,
+                  'id_question' => $step,
+                  'id_answer' => substr($key,17),
+                  'lang' => $_REQUEST['fmypolls_att_default_lang'],
+                  'answer' => htmlspecialchars(stripslashes($val), ENT_QUOTES),
+                  'nb_votes' => '0'
+                );
+                if(!$this->create_poll_answers_lang($values))
+                {
+                  return(false);
+                }
+              }
+            }
+          }
+        }
+        return($poll_id);
+      }
+    }
+    return(false);
+  } //do_create_poll
+
+  /*
+    modify a poll
+      if $page = 0, modify general nfo else modify question
+  */
+  protected function do_modify_poll($step, $poll_id)
+  {
+    if($step==0)
+    {
+      //step 0 : modify root caracteristics of poll
+      $groups = new groups();
+      $users = new users();
+      foreach($_REQUEST as $key => $val)
+      {
+        if((substr($key, 0, 28)=='fmypolls_att_allowed_groups_') and ($val=="on"))
+        {
+          $groups->set_allowed(substr($key,28),true);
+        }
+
+        if((substr($key, 0, 27)=='fmypolls_att_allowed_users_') and ($val=="on"))
+        {
+          $users->set_allowed(substr($key,27),true);
+        }
+      }
+
+      $values = array(
+        'allowed_users' => $users->get_alloweds('id'),
+        'allowed_groups' => $groups->get_alloweds('id'),
+        'visible' => $_REQUEST['fmypolls_att_visible'],
+        'enabled' => $_REQUEST['fmypolls_att_enabled'],
+        'allow_comment' => $_REQUEST['fmypolls_att_allow_comment'],
+        'show_comments' => $_REQUEST['fmypolls_att_show_comments'],
+        'color_bars' => $_REQUEST['fmypolls_att_color_bars'],
+        'display_type' => $_REQUEST['fmypolls_att_display_type'],
+        'public_results' => $_REQUEST['fmypolls_att_public_results']
+      );
+      $result=$this->modify_poll($poll_id, $values);
+      if($result>0)
+      {
+        $values = array(
+          'title' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_title']), ENT_QUOTES),
+          'description' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_description']), ENT_QUOTES),
+          'after_vote_text' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_after_vote_text']), ENT_QUOTES)
+        );
+        if($this->modify_poll_lang($poll_id, $_REQUEST['fmypolls_att_default_lang'], $values))
+        {
+          return($poll_id);
+        }
+      }
+    }
+    else
+    { //step >0 :modify questions
+      $poll_id=$_REQUEST['fmypolls_att_id'];
+      $values = array(
+        'question_type' => $_REQUEST['fmypolls_att_question_type'],
+        'multi_max_answers' => isset($_REQUEST['fmypolls_att_multi_max_answers']) ? $_REQUEST['fmypolls_att_multi_max_answers'] : '0'
+      );
+      if($this->modify_poll_questions($poll_id, $step, $values))
+      {
+        $values = array(
+          'description' => htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_description']), ENT_QUOTES)
+        );
+        if($this->modify_poll_questions_lang($poll_id, $step, $_REQUEST['fmypolls_att_default_lang'], $values))
+        {
+          foreach($_REQUEST as $key => $val)
+          {
+            if((substr($key, 0, 17)=='fmypolls_att_answ'))
+            {
+              if($val=='')
+              {
+                if($this->delete_poll_answers($poll_id, $step, substr($key,17)))
+                {
+                  if(!$this->delete_poll_answers_lang($poll_id, $step, substr($key,17)))
+                  {
+                    return(false);
+                  }
+                }
+              }
+              else
+              {
+                $values = array(
+                  'answer' => htmlspecialchars(stripslashes($val), ENT_QUOTES)
+                );
+                if(!$this->modify_poll_answers_lang($poll_id, $step, substr($key,17), $_REQUEST['fmypolls_att_default_lang'], $values))
+                {
+                  return(false);
+                }
+              }
+            }
+          }
+        }
+        return($poll_id);
+      }
+    }
+    return(false);
+  } //do_modify_poll
+
+
+  /*
+    delete a poll's question
+  */
+  protected function do_delete_question($step, $poll_id)
+  {
+    if($this->delete_poll_questions($poll_id, $step))
+    {
+      if($this->delete_poll_questions_lang($poll_id, $step))
+      {
+        if($this->delete_poll_answers($poll_id, $step))
+        {
+          if($this->delete_poll_answers_lang($poll_id, $step))
+          {
+            return($poll_id);
+          }
+        }
+      }
+    }
+    return(false);
+  }
+
+  /*
+    delete a poll
+  */
+  protected function do_delete_poll($poll_id)
+  {
+    if($this->delete_poll($poll_id))
+    {
+      if($this->delete_poll_lang($poll_id))
+      {
+        if($this->do_delete_question("", $poll_id))
+        {
+          return($poll_id);
+        }
+      }
+    }
+    return(false);
+  }
+
+  /*
+    translate a poll (add / modify)
+      nfo are from $_REQUEST global var
+  */
+  protected function do_translate_poll($poll_id)
+  {
+    $sql="REPLACE INTO ".$this->tables['polls_lang']." VALUES (
+          '".$poll_id."',
+          '".$_REQUEST['fmypolls_trans_to']."',
+          '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_tto_title']), ENT_QUOTES)."',
+          '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_tto_description']), ENT_QUOTES)."',
+          '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_tto_after_vote_text']), ENT_QUOTES)."'
+          )";
+    if(pwg_query($sql))
+    {
+      $poll_questions=$this->get_poll_questions($poll_id);
+      foreach($poll_questions as $key => $val)
+      {
+        $sql="REPLACE INTO ".$this->tables['polls_questions_lang']." VALUES (
+              '".$poll_id."',
+              '".$val['question_num']."',
+              '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_trans_to']), ENT_QUOTES)."',
+              '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_tto_qdescription_'.$val['question_num']]), ENT_QUOTES)."'
+              )";
+        if(pwg_query($sql))
+        {
+          $poll_answers=$this->get_poll_answers($poll_id, $val['question_num']);
+          $poll_danswers=$this->get_poll_answers($poll_id, $val['question_num'],$_REQUEST['fmypolls_trans_to']);
+          foreach($poll_answers as $key2 => $val2)
+          {
+            if(isset($poll_danswers[$key2]))
+            {
+              $nbvotes=$poll_danswers[$key2]['nb_votes'];
+            }
+            else
+            {
+              $nbvotes=0;
+            }
+            $sql="REPLACE INTO ".$this->tables['polls_answers_lang']." VALUES (
+                  '".$poll_id."',
+                  '".$val['question_num']."',
+                  '".$val2['answer_num']."',
+                  '".$_REQUEST['fmypolls_trans_to']."',
+                  '".htmlspecialchars(stripslashes($_REQUEST['fmypolls_att_tto_adescription_'.$val['question_num']."_".$val2['answer_num']]), ENT_QUOTES)."',
+                  '".$nbvotes."'
+                  )";
+            if(!pwg_query($sql))
+            {
+              return(false);
+            }
+          }
+        }
+        else
+        {
+          return(false);
+        }
+      }
+      return(true);
+    }
+    return(false);
+  }
+
+  protected function do_delete_poll_translation($poll_id, $lang)
+  {
+    $sql="DELETE FROM ".$this->tables['polls_lang']."
+          WHERE id_poll = '".$poll_id."'
+            AND lang = '".$lang."' ";
+    if(pwg_query($sql))
+    {
+      $sql="DELETE FROM ".$this->tables['polls_questions_lang']."
+          WHERE id_poll = '".$poll_id."'
+            AND lang = '".$lang."' ";
+      if(pwg_query($sql))
+      {
+        $sql="DELETE FROM ".$this->tables['polls_answers_lang']."
+            WHERE id_poll = '".$poll_id."'
+              AND lang = '".$lang."' ";
+        if(pwg_query($sql))
+        {
+          return(true);
+        }
+      }
+    }
+    return(false);
+  }
+
+  /* ---------------------------------------------------------------------------
+    function to manage database manipulation
+  --------------------------------------------------------------------------- */
+
+
+  /*
+    insert poll general info (no language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function create_poll($values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls']." VALUES (
+      '0', '".date('Y-m-d H:i:s')."',
+      '".$values['allowed_users']."',
+      '".$values['allowed_groups']."',
+      '".$values['visible']."',
+      '".$values['enabled']."',
+      '0',
+      '0000-00-00 00:00:00',
+      '0',
+      '0',
+      '".$values['allow_comment']."',
+      '".$values['show_comments']."',
+      '".$values['color_bars']."',
+      '0',
+      '".$values['display_type']."',
+      '".$values['default_lang']."',
+      '0',
+      '0',
+      '".$values['public_results']."'
+    )";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return(mysql_insert_id());
+    }
+    return(false);
+  }
+
+  /*
+    insert poll general info (langage needed)
+      input : poll_id, an array(lang, title, description, after_vote_text)
+      return 1 if OK, else -1
+  */
+  protected function create_poll_lang($poll_id, $values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls_lang']." VALUES (
+      '".$poll_id."',
+      '".$values['lang']."',
+      '".$values['title']."',
+      '".$values['description']."',
+      '".$values['after_vote_text']."'
+    )";
+    $result=pwg_query($sql);
+    if(!$result)
+    {
+      return(false);
+    }
+    return($poll_id);
+  }
+
+  /*
+    insert poll question info (no language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function create_poll_questions($values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls_questions']." VALUES (
+      '".$values['id_poll']."',
+      '".$values['question_num']."',
+      '".$values['question_type']."',
+      '".$values['multi_max_answers']."',
+      '0',
+      '0'
+    )";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      $sql="UPDATE ".$this->tables['polls']."
+            SET nb_questions = nb_questions+1,
+                counter_questions = counter_questions+1
+            WHERE id = '".$values['id_poll']."'";
+      $result=pwg_query($sql);
+      if($result)
+      {
+        return($values['id_poll']);
+      }
+    }
+    return(false);
+  }
+
+  /*
+    insert poll question info (language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function create_poll_questions_lang($values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls_questions_lang']." VALUES (
+      '".$values['id_poll']."',
+      '".$values['id_question']."',
+      '".$values['lang']."',
+      '".$values['description']."'
+    )";
+    $result=pwg_query($sql);
+    if(!$result)
+    {
+      return(false);
+    }
+    return($values['id_poll']);
+  }
+
+  /*
+    insert poll answers info (no language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function create_poll_answers($values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls_answers']." VALUES (
+      '".$values['id_poll']."',
+      '".$values['id_question']."',
+      '".$values['answer_num']."',
+      '0',
+      '0',
+      '0'
+    )";
+    $result=pwg_query($sql);
+    if(!$result)
+    {
+      return(false);
+    }
+    //every answer created increment a counter on the question
+    //needed to maintain properly answers's id when modify/delete/add one
+    $sql="UPDATE ".$this->tables['polls_questions']."
+          SET counter_answers = counter_answers+1
+          WHERE id_poll = '".$values['id_poll']."'
+            AND question_num = '".$values['id_question']."' ";
+    pwg_query($sql);
+    return($values['id_poll']);
+  }
+
+  /*
+    insert poll question info (language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function create_poll_answers_lang($values)
+  {
+    $sql="INSERT INTO ".$this->tables['polls_answers_lang']." VALUES (
+      '".$values['id_poll']."',
+      '".$values['id_question']."',
+      '".$values['id_answer']."',
+      '".$values['lang']."',
+      '".$values['answer']."',
+      '0'
+    )";
+    $result=pwg_query($sql);
+    if(!$result)
+    {
+      return(false);
+    }
+    return($values['id_poll']);
+  }
+
+  /*
+    initialise an array from database to prepare form
+      input : poll_id
+      return an array if OK, else -1
+  */
+  protected function init_poll_array($poll_id, $lang="")
+  {
+    $sql="SELECT ".$this->tables['polls'].".*, ".$this->tables['polls_lang'].".*
+          FROM ".$this->tables['polls']." INNER JOIN ".$this->tables['polls_lang']."
+            ON ".$this->tables['polls'].".id = ".$this->tables['polls_lang'].".id_poll
+            AND ".$this->tables['polls'].".id = '".$poll_id."' ";
+    if($lang=="")
+    {
+      $sql.=" AND ".$this->tables['polls'].".default_lang = ".$this->tables['polls_lang'].".lang ";
+    }
+    else
+    {
+      $sql.=" AND ".$this->tables['polls_lang'].".lang = '".$lang."' ";
+    }
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return(mysql_fetch_array($result));
+    }
+    return(false);
+  }
+
+  /*
+    initialise an array from database to prepare form
+      input : poll_id, question_num
+      return an array if OK, else -1
+  */
+  protected function init_poll_question_array($poll_id, $question_num, $lang="")
+  {
+    $sql="SELECT ".$this->tables['polls_questions'].".*,
+                ".$this->tables['polls_questions_lang'].".*,
+                ".$this->tables['polls_answers_lang'].".*
+          FROM ".$this->tables['polls_questions']." INNER JOIN ".$this->tables['polls_questions_lang']."
+            ON ".$this->tables['polls_questions'].".id_poll = ".$this->tables['polls_questions_lang'].".id_poll
+            AND ".$this->tables['polls_questions'].".question_num = ".$this->tables['polls_questions_lang'].".id_question,
+            ".$this->tables['polls'].",
+            ".$this->tables['polls_answers_lang']."
+          WHERE ".$this->tables['polls'].".id = '".$poll_id."'
+            AND ".$this->tables['polls'].".id = ".$this->tables['polls_questions'].".id_poll
+            AND ".$this->tables['polls_answers_lang'].".id_poll = ".$this->tables['polls_questions'].".id_poll
+            AND ".$this->tables['polls_answers_lang'].".id_question = ".$this->tables['polls_questions'].".question_num
+            AND ".$this->tables['polls_answers_lang'].".lang = ".$this->tables['polls_questions_lang'].".lang
+            AND ".$this->tables['polls_questions'].".question_num = '".$question_num."' ";
+    if($lang=="")
+    {
+      $sql.=" AND ".$this->tables['polls'].".default_lang = ".$this->tables['polls_questions_lang'].".lang ";
+    }
+    else
+    {
+      $sql.=" AND ".$this->tables['polls_lang'].".lang = '".$lang."' ";
+    }
+    $sql.=" ORDER BY id_answer ASC ";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      $returned=array();
+
+      $answnum=0;
+      while($row=mysql_fetch_array($result))
+      {
+        if($answnum==0)
+        {
+          $returned['default_lang'] = $row['lang'];
+          $returned['question_type'] = $row['question_type'];
+          $returned['multi_max_answers'] = $row['multi_max_answers'];
+          $returned['description'] = $row['description'];
+          $returned['counter_answers'] = $row['counter_answers'];
+        }
+        $returned['answ'.$row['id_answer']] = $row['answer'];
+        $answnum++;
+      }
+      return($returned);
+    }
+    return(false);
+  }
+
+
+  /*
+    modify poll general info (no language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function modify_poll($poll_id, $values)
+  {
+    $sql="UPDATE ".$this->tables['polls']."
+          SET allowed_users = '".$values['allowed_users']."',
+              allowed_groups = '".$values['allowed_groups']."',
+              visible = '".$values['visible']."',
+              enabled = '".$values['enabled']."',
+              allow_comment = '".$values['allow_comment']."',
+              show_comments = '".$values['show_comments']."',
+              color_bars = '".$values['color_bars']."',
+              display_type = '".$values['display_type']."',
+              public_results = '".$values['public_results']."'
+          WHERE id = '".$poll_id."'";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($poll_id);
+    }
+    return(false);
+  }
+
+  /*
+    modify poll general info (language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function modify_poll_lang($poll_id, $lang, $values)
+  {
+    $sql="UPDATE ".$this->tables['polls_lang']."
+          SET title = '".$values['title']."',
+              description = '".$values['description']."',
+              after_vote_text = '".$values['after_vote_text']."'
+          WHERE id_poll = '".$poll_id."'
+          AND lang = '".$lang."'";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($poll_id);
+    }
+    return(false);
+  }
+
+  /*
+    modify poll question info (no language needed)
+      input : an array of general values
+      return poll_id if OK, else -1
+  */
+  protected function modify_poll_questions($poll_id, $question_num, $values)
+  {
+    $sql="UPDATE ".$this->tables['polls_questions']."
+        SET question_type = '".$values['question_type']."',
+            multi_max_answers = '".$values['multi_max_answers']."'
+        WHERE id_poll = '".$poll_id."'
+          AND question_num = '".$question_num."' ";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($poll_id);
+    }
+    return(false);
+  }
+
+  /*
+    modify poll question info (language needed)
+      return poll_id if OK, else -1
+  */
+  protected function modify_poll_questions_lang($poll_id, $id_question, $lang, $values)
+  {
+    $sql="UPDATE ".$this->tables['polls_questions_lang']."
+        SET description = '".$values['description']."'
+        WHERE id_poll = '".$poll_id."'
+          AND id_question = '".$id_question."'
+          AND lang = '".$lang."' ";
+    $result=pwg_query($sql);
+    if(!$result)
+    {
+      return(false);
+    }
+    return($poll_id);
+  }
+
+  /*
+    modify poll question info (language needed)
+      return poll_id if OK, else -1
+  */
+  protected function modify_poll_answers_lang($id_poll, $id_question, $id_answer, $lang, $values)
+  {
+    $sql="SELECT id_poll
+          FROM ".$this->tables['polls_answers_lang']."
+          WHERE id_poll = '".$id_poll."'
+            AND id_question = '".$id_question."'
+            AND id_answer = '".$id_answer."'
+            AND lang = '".$lang."' ";
+    $result=pwg_query($sql);
+    if(mysql_num_rows($result)==0)
+    {
+      $values=array(
+        'id_poll' => $id_poll,
+        'id_question' => $id_question,
+        'id_answer' => $id_answer,
+        'answer_num' => $id_answer,
+        'lang' => $lang,
+        'answer' => $values['answer']
+      );
+      if($this->create_poll_answers($values))
+      {
+        if($this->create_poll_answers_lang($values))
+        {
+          return($id_poll);
+        }
+      };
+      return(false);
+    }
+    else
+    {
+      $sql="UPDATE ".$this->tables['polls_answers_lang']."
+          SET answer = '".$values['answer']."'
+          WHERE id_poll = '".$id_poll."'
+            AND id_question = '".$id_question."'
+            AND id_answer = '".$id_answer."'
+            AND lang = '".$lang."' ";
+      $result=pwg_query($sql);
+      if(!$result)
+      {
+        return(false);
+      }
+      return($id_poll);
+    }
+  }
+
+  protected function delete_poll($id_poll)
+  {
+    $sql="DELETE FROM ".$this->tables['polls']."
+          WHERE id = '".$id_poll."' ";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($id_poll);
+    }
+    return(false);
+  }
+
+  protected function delete_poll_lang($id_poll, $lang="")
+  {
+    $sql="DELETE FROM ".$this->tables['polls_lang']."
+          WHERE id_poll = '".$id_poll."' ";
+    if($lang!="")
+    {
+      $sql.=" AND lang = '".$lang."' ";
+    }
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($id_poll);
+    }
+    return(false);
+  }
+
+  protected function delete_poll_questions($id_poll, $id_question="")
+  {
+    $sql="DELETE FROM ".$this->tables['polls_questions']."
+          WHERE id_poll = '".$id_poll."' ";
+    if($id_question!="")
+    {
+      $sql.=" AND question_num = '".$id_question."' ";
+    }
+    $result=pwg_query($sql);
+    if($result)
+    {
+      $sql="UPDATE ".$this->tables['polls'];
+      if($id_question=="")
+      {
+        $sql.=" SET nb_questions = 0 ";
+      }
+      else
+      {
+        $sql.=" SET nb_questions = nb_questions-1 ";
+      }
+      $sql.=" WHERE id = '".$id_poll."'";
+      $result=pwg_query($sql);
+      if($result)
+      {
+        return($id_poll);
+      }
+    }
+    return(false);
+  }
+
+  protected function delete_poll_questions_lang($id_poll, $id_question="", $lang="")
+  {
+    if($id_question=="")
+    {
+      $lang="";
+    }
+    $sql="DELETE FROM ".$this->tables['polls_questions_lang']."
+          WHERE id_poll = '".$id_poll."' ";
+    if($id_question!="")
+    {
+      $sql.=" AND id_question = '".$id_question."' ";
+    }
+    if($lang!="")
+    {
+      $sql.=" AND lang = '".$lang."' ";
+    }
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($id_poll);
+    }
+    return(false);
+  }
+
+
+  protected function delete_poll_answers($id_poll, $id_question="", $id_answer="")
+  {
+    if($id_question=="")
+    {
+      $id_answer="";
+    }
+    $sql="DELETE FROM ".$this->tables['polls_answers']."
+          WHERE id_poll = '".$id_poll."' ";
+    if($id_question!="")
+    {
+      $sql.=" AND id_question = '".$id_question."' ";
+    }
+    if($id_answer!="")
+    {
+      $sql.=" AND answer_num = '".$id_answer."' ";
+    }
+
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($id_poll);
+    }
+    return(false);
+  }
+
+  protected function delete_poll_answers_lang($id_poll, $id_question="", $id_answer="", $lang="")
+  {
+    if($id_question=="")
+    {
+      $id_answer="";
+    }
+    if($id_answer=="")
+    {
+      $lang="";
+    }
+    $sql="DELETE FROM ".$this->tables['polls_answers_lang']."
+          WHERE id_poll = '".$id_poll."' ";
+    if($id_question!="")
+    {
+      $sql.=" AND id_question = '".$id_question."' ";
+    }
+    if($id_answer!="")
+    {
+      $sql.=" AND id_answer = '".$id_answer."' ";
+    }
+    if($lang!="")
+    {
+      $sql.=" AND lang = '".$lang."' ";
+    }
+    $result=pwg_query($sql);
+    if($result)
+    {
+      return($id_poll);
+    }
+    return(false);
+  }
+
+
+  /*
+    return a list of user/ip making a vote on the poll
+    list is paged with $my_config['mypolls_nbuser_per_page'] value
+
+    an array is returned :
+      array[0] : list
+      array[1] : total number of pages
+  */
+  protected function get_poll_users_vote($poll_id, $num_page=1)
+  {
+    $returned=array(array(), -1);
+    $sql="SELECT SQL_CALC_FOUND_ROWS IF(username IS NULL, user_id, CONCAT(' ',username)) AS name
+          FROM ".$this->tables['polls_votes']." LEFT JOIN ".USERS_TABLE."
+            ON ".$this->tables['polls_votes'].".user_id = ".USERS_TABLE.".id
+          WHERE poll_id = '".$poll_id."'
+          ORDER BY name
+          LIMIT ".(($num_page-1)*$this->my_config['mypolls_nbuser_per_page']).", ".$this->my_config['mypolls_nbuser_per_page'];
+
+    $result = pwg_query($sql);
+    if($result)
+    {
+      while($row = mysql_fetch_row($result))
+      { array_push($returned[0], $row[0]); }
+
+      //compute number of pages
+      $sql="select FOUND_ROWS()";
+      $result=pwg_query($sql);
+      if($result)
+      { $row = mysql_fetch_row($result); $returned[1] = ceil($row[0]/$this->my_config['mypolls_nbuser_per_page']); }
+      else
+      { $returned[1] = -1; }
+    }
+    return($returned);
+  }
+
+
+  /* ---------------------------------------------------------------------------
+    ajax functions
+  --------------------------------------------------------------------------- */
+
+  /*
+    return html formatted informations for a poll
+    (need by poll's list view)
+  */
+  protected function ajax_poll_detail_list($poll_id)
+  {
+    $local_tpl = new Template(MYPOLLS_PATH."admin/", "");
+    $local_tpl->set_filename('body_page',
+                  dirname($this->filelocation).'/admin/plugin_admin_detail.tpl');
+
+    $languages=get_languages();
+    $poll_values=$this->get_poll_values($poll_id);
+    $poll_langs=$this->get_poll_languages($poll_id);
+
+    $langs="<b>".$languages[$poll_values['default_lang']]."</b>";
+    foreach($poll_langs as $key => $val)
+    {
+      if($val!=$poll_values['default_lang'])
+      {
+        $langs.=", ".$languages[$val];
+      }
+    }
+
+    $local_tpl->assign('datas',
+      array(
+        'MYPOLLS_ATT_VISIT_WO_VOTE' => $poll_values['visit_without_vote'],
+        'MYPOLLS_ATT_VISIT_A_VOTE' => $poll_values['visit_after_vote'],
+        'MYPOLLS_NB_COMMENTS' => ($poll_values['allow_comment']=='y')?"(".$poll_values['nb_comments'].")":"",
+        'MYPOLLS_ATT_ALLOW_COMMENT' => l10n('mypolls_yesno_'.$poll_values['allow_comment']),
+        'MYPOLLS_ATT_SHOW_COMMENTS' => l10n('mypolls_yesno_'.$poll_values['show_comments']),
+        'MYPOLLS_ATT_DISPLAY_TYPE' => l10n('mypolls_display_'.$poll_values['display_type']),
+        'MYPOLLS_POLL_LANGS' => $langs,
+        'MYPOLLS_ATT_PUBLIC_RESULTS' => l10n('mypolls_yesno_'.$poll_values['public_results'])
+      )
+    );
+
+    return($local_tpl->parse('body_page', true));
+  }
+
+  /*
+    return html formatted informations about poll's voting users
+  */
+  protected function ajax_poll_user_list($poll_id)
+  {
+    if(!isset($_REQUEST['vpage']))
+    {
+      $page=1;
+    }
+    else
+    {
+      $page=$_REQUEST['vpage'];
+    }
+
+    $voter_list=$this->get_poll_users_vote($poll_id, $page);
+
+    $local_tpl = new Template(MYPOLLS_PATH."admin/", "");
+    $local_tpl->set_filename('body_page',
+                  dirname($this->filelocation).'/admin/plugin_admin_voter_list.tpl');
+
+    //users list
+    $voter_list_rows=array();
+    foreach($voter_list[0] as $key => $val)
+    {
+      $voter_list_rows[]=array('USERNAME' => $val);
+    }
+
+    //make pages links
+    if($voter_list[1]>1)
+    {
+      $plural="s";
+    }
+    else
+    {
+      $plural="";
+    }
+    $pages_links=l10n("mypolls_page".$plural."_label")." : ";
+
+    if($voter_list[1]<=0)
+    {
+      $pages_links="";
+    }
+    else
+    {
+      for($i=1;$i<=$voter_list[1];$i++)
+      {
+        if($i==$page)
+        { $pages_links.=" $i "; }
+        else
+        {
+          $pages_links.="<a style='cursor:pointer;' onclick='load_poll_voter_list($i);'> $i </a>";
+        }
+      }
+    }
+
+
+    $local_tpl->assign("datas", array('PAGES' => $pages_links));
+    $local_tpl->assign("voter_list_rows", $voter_list_rows);
+
+    return($local_tpl->parse('body_page', true));
+  }
+
+
+  /*
+    delete a comment
+  */
+  protected function ajax_poll_delete_comment($poll_id)
+  {
+    if(!isset($_REQUEST['comment_id']))
+    {
+      return("<div class='errors'>".l10n("mypolls_no_comment_to_delete")."<br>&nbsp;</div>");
+    }
+
+    if((!is_admin()) || (is_adviser()))
+    {
+      $returned="<div class='errors'>".l10n("mypolls_adviser_not_allowed")."<br>&nbsp;</div>";
+    }
+    else
+    {
+      $sql="UPDATE ".$this->tables['polls_votes']."
+            SET user_comment = ''
+            WHERE poll_id = '".$poll_id."'
+              AND user_id = '".$_REQUEST['comment_id']."' ";
+      $result=pwg_query($sql);
+      if(!$result)
+      {
+        $returned="<div class='errors'>".l10n("mypolls_errors_deleting_comment")."<br>&nbsp;</div>";
+      }
+      else
+      {
+        $returned="<div class='infos'>".l10n("mypolls_infos_deleted_comment")."<br>&nbsp;</div>";
+      }
+    }
+    $returned.=$this->ajax_poll_comment_list($poll_id);
+    return($returned);
+  }
+
+
+
+
+} //class
+
+?>
Index: /extensions/mypolls/mypolls_install.class.inc.php
===================================================================
--- /extensions/mypolls/mypolls_install.class.inc.php	(revision 3397)
+++ /extensions/mypolls/mypolls_install.class.inc.php	(revision 3397)
@@ -0,0 +1,410 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  MyPolls_Install : classe to manage plugin install
+
+  --------------------------------------------------------------------------- */
+  @include_once('mypolls_root.class.inc.php');
+  @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
+
+
+  /* mypolls class for install process */
+  class MyPolls_Install extends MyPolls_root
+  {
+    private $tablef;
+    private $exportfile;
+
+    public function MyPolls_Install($prefixeTable, $filelocation)
+    {
+      parent::__construct($prefixeTable, $filelocation);
+      $this->tablef= new manage_tables($this->tables);
+      $this->tablev1x= new manage_tables(
+        array(
+          $this->prefixeTable.'MyPolls_polls',
+          $this->prefixeTable.'MyPolls_polls_by_user'
+        )
+      );
+      $this->exportfile=dirname($this->filelocation).'/'.$this->plugin_name_files.'.sql';
+    }
+
+    /* 
+        function for installation process 
+        return true if install process is ok, otherwise false 
+    */ 
+    public function install()
+    {
+
+      $tables_def=array(
+"CREATE TABLE `".$this->tables['polls']."` (
+  `id` int(11) NOT NULL auto_increment,
+  `date` datetime NOT NULL default '0000-00-00 00:00:00',
+  `allowed_users` varchar(35) NOT NULL default 'guest/generic/normal/',
+  `allowed_groups` varchar(250) NOT NULL default '',
+  `visible` char(1) NOT NULL default 'n',
+  `enabled` char(1) NOT NULL default 'n',
+  `total_votes` int(11) NOT NULL default '0',
+  `last_vote` datetime NOT NULL default '0000-00-00 00:00:00',
+  `visit_without_vote` int(11) NOT NULL default '0',
+  `visit_after_vote` int(11) NOT NULL default '0',
+  `allow_comment` char(1) NOT NULL default 'n',
+  `show_comments` char(1) NOT NULL default 'n',
+  `color_bars` varchar(6) NOT NULL default '',
+  `nb_questions` smallint(6) NOT NULL default '1',
+  `display_type` enum('mono','multi') NOT NULL default 'mono',
+  `default_lang` varchar(25) NOT NULL default '',
+  `counter_questions` int(10) unsigned NOT NULL default '0',
+  `nb_comments` int(11) NOT NULL default '0',
+  `public_results` char(1) NOT NULL default 'y',
+PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_lang']."` (
+  `id_poll` int(11) NOT NULL default '0',
+  `lang` varchar(25) NOT NULL default '',
+  `title` varchar(250) NOT NULL default '',
+  `description` text NOT NULL,
+  `after_vote_text` text NOT NULL,
+  PRIMARY KEY  (`id_poll`,`lang`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_questions']."` (
+  `id_poll` int(11) NOT NULL default '0',
+  `question_num` int(11) NOT NULL default '1',
+  `question_type` enum('mono','multi','order') NOT NULL default 'mono',
+  `multi_max_answers` smallint(6) NOT NULL default '2',
+  `counter_answers` int(10) unsigned NOT NULL default '0',
+  `nb_votes` int(11) NOT NULL default '0',
+PRIMARY KEY  (`id_poll`,`question_num`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_questions_lang']."` (
+  `id_poll` int(11) NOT NULL default '0',
+  `id_question` int(11) NOT NULL default '0',
+  `lang` varchar(25) NOT NULL default '',
+  `description` text NOT NULL,
+  PRIMARY KEY  (`id_poll`,`id_question`,`lang`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_answers']."` (
+  `id_poll` int(11) NOT NULL default '0',
+  `id_question` int(11) NOT NULL default '0',
+  `answer_num` int(11) NOT NULL default '0',
+  `nb_votes` int(11) NOT NULL default '0',
+  `frequency` int(11) NOT NULL default '0',
+  `ans_order` smallint(6) NOT NULL default '0',
+PRIMARY KEY  (`id_poll`,`id_question`,`answer_num`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_answers_lang']."` (
+  `id_poll` int(11) NOT NULL default '0',
+  `id_question` int(11) NOT NULL default '0',
+  `id_answer` int(11) NOT NULL default '0',
+  `lang` varchar(25) NOT NULL default '',
+  `answer` varchar(250) NOT NULL default '',
+  `nb_votes` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`id_poll`,`id_question`,`id_answer`,`lang`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1",
+
+"CREATE TABLE `".$this->tables['polls_votes']."` (
+  `poll_id` INTEGER  NOT NULL DEFAULT '0',
+  `user_id` VARCHAR(15)  NOT NULL DEFAULT '2',
+  `date` DATETIME  NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `user_comment` TEXT  NOT NULL,
+  PRIMARY KEY(`poll_id`, `user_id`)
+) ENGINE = MYISAM DEFAULT CHARSET=latin1"
+      );
+      //$table_def array
+
+      //if present, try to import backup
+      //if backup file 
+      $import=$this->tablef->import($this->exportfile);
+      if($import['errors']<0)
+      {
+        $result=$this->tablef->create_tables($tables_def);
+        if($result)
+        {
+          $result=$this->add_enum_to_history();
+        }
+        return($result);
+      }
+      else
+      {
+        return($this->add_enum_to_history());
+      }
+    }
+
+
+    /*
+        function for uninstall process
+    */
+    public function uninstall()
+    {
+      $this->tablef->export($this->exportfile);
+      $this->delete_config();
+      $this->tablef->drop_tables();
+    }
+
+    public function activate()
+    {
+      global $template;
+
+      $upgrade='';
+      if($this->tablev1x->tables_exists())
+      {
+        //tables exists, upgrade from MyPolls v1.x
+        $upgrade='1.x';
+        //step 1: rename tables
+        if($this->tablev1x->rename_tables(
+          array(
+            $this->prefixeTable.'MyPolls_polls' => $this->prefixeTable.$this->plugin_name_files.'_polls_v1x',
+            $this->prefixeTable.'MyPolls_polls_by_user' => $this->prefixeTable.$this->plugin_name_files.'_polls_by_user_v1x'
+          )
+        )!==true)
+        {
+          return('mypolls_cant_rename_old_table');
+        }
+      }
+
+      switch($upgrade)
+      {
+        case '1.x':
+            //create current version tables
+            $this->install();
+            //load v1.x polls into current version tables
+            if($this->migrate_from_v1x())
+            {
+              $this->tablev1x->drop_tables();
+            }
+            else
+            {
+              $this->tablef->drop_tables();
+              $this->tablev1x->rename_tables(
+                array(
+                  $this->prefixeTable.$this->plugin_name_files.'_polls_v1x' => $this->prefixeTable.'MyPolls_polls',
+                  $this->prefixeTable.$this->plugin_name_files.'_polls_by_user_v1x' => $this->prefixeTable.'MyPolls_polls_by_user'
+                )
+              );
+              return('mypolls_cant_migrate_old_table');
+            }
+          break;
+        /*
+          //code for futures versions
+          //from 2.x to 3.x, no tables upgrades needed
+        case '2.x':
+          $this->tablef->update_tables_fields(false);
+          break;
+        */
+      }
+
+      $this->init_config();
+      $this->load_config();
+      $this->save_config();
+      $template->delete_compiled_templates(); 
+      return('');
+    }
+
+    public function deactivate()
+    {
+    }
+
+
+    /* specific function to obtain field 'section' enumeration */
+    private function get_section_enum($add)
+    {
+      $sql = 'SHOW COLUMNS FROM '.HISTORY_TABLE.' LIKE "section"';
+      $result=pwg_query($sql);
+      if($result)
+      {
+        $row = mysql_fetch_array($result);
+        $list=substr($row['Type'], 5, strlen($row['Type'])-6);
+        $returned=explode(',', $list);
+        if((strpos($list, "'$add'")===false)&&($add!='')) 
+        { 
+          array_push($returned, "'$add'"); 
+        }
+        return($returned);
+      }
+    }
+
+    private function add_enum_to_history()
+    {
+      $enums=implode(',', $this->get_section_enum($this->section_name));
+      $sql="ALTER TABLE ".HISTORY_TABLE."
+             CHANGE `section` `section` 
+             ENUM (".$enums.") ;";
+      $result=pwg_query($sql);
+      return($result);
+    }
+
+
+    /*
+      do migration from v1.x tables to current version tables
+    */
+    private function migrate_from_v1x()
+    {
+      global $user;
+
+      /*
+        language for migration is user language
+      */
+      $sql="SELECT * FROM ".$this->prefixeTable.$this->plugin_name_files.'_polls_v1x';
+      $result=pwg_query($sql);
+      if($result)
+      {
+        while($row=mysql_fetch_array($result))
+        {
+          // create poll
+          $sql="INSERT INTO ".$this->tables['polls']." VALUES (
+            '0',
+            '".$row['date']."',
+            '".$row['allowed_users']."',
+            '".$row['allowed_groups']."',
+            '".substr($row['visible'],0,1)."',
+            '".substr($row['enabled'],0,1)."',
+            '".$row['total']."',
+            '0000-00-00 00:00:00',
+            '".$row['visit_without_vote']."',
+            '".$row['visit_after_vote']."',
+            'n',
+            'n',
+            '".$this->my_config['mypolls_color_bars']."',
+            '1',
+            'mono',
+            '".$user['language']."',
+            '1',
+            '0',
+            'n'
+          )";
+          if(pwg_query($sql))
+          {
+            $id=mysql_insert_id();
+
+            // create poll's nfo 
+            $sql="INSERT INTO ".$this->tables['polls_lang']." VALUES(
+              '".$id."',
+              '".$user['language']."',
+              '".addslashes($row['title'])."',
+              '',
+              '".addslashes($row['after_vote_text'])."'
+            )";
+
+            if(pwg_query($sql))
+            { 
+              //create poll's question's answers (before question to count nb answers)
+              $nbanswers=0;
+              
+              for($i=1;$i<=10;$i++)
+              {
+                if($row['c'.$i.'_text']!="")
+                {
+                  $nbanswers++;
+                  //answer
+                  $sql="INSERT INTO ".$this->tables['polls_answers']." VALUES (
+                    '".$id."',
+                    '1',
+                    '".$i."',
+                    '".$row['c'.$i.'_choose']."',
+                    '0',
+                    '0'
+                  )";
+                  if(!pwg_query($sql))
+                  {
+                    return(false);
+                  }
+
+                  //answer's lang
+                  $sql="INSERT INTO ".$this->tables['polls_answers_lang']." VALUES (
+                    '".$id."',
+                    '1',
+                    '".$i."',
+                    '".$user['language']."',
+                    '".addslashes($row['c'.$i.'_text'])."',
+                    '".addslashes($row['c'.$i.'_choose'])."'
+                  )";
+                  if(!pwg_query($sql))
+                  {
+                    return(false);
+                  }
+                }
+              }
+
+              //create question
+              $sql="INSERT INTO ".$this->tables['polls_questions']." VALUES (
+                '".$id."',
+                '1',
+                'mono',
+                '2',
+                '".$nbanswers."',
+                '".$row['total']."'
+              )";
+              if(pwg_query($sql))
+              {
+                $sql="INSERT INTO ".$this->tables['polls_questions_lang']." VALUES (
+                  '".$id."',
+                  '1',
+                  '".$user['language']."',
+                  '".addslashes($row['description'])."'
+                )";
+                if(!pwg_query($sql))
+                {
+                  return(false);
+                }
+              }
+              else
+              {
+                return(false);
+              }
+
+            }
+            else
+            {
+              return(false);
+            }
+
+            //create user's list votes and comments
+            $sql="SELECT * FROM ".$this->prefixeTable.$this->plugin_name_files."_polls_by_user_v1x
+              WHERE poll_id = '".$row['id']."'";
+            $result2=pwg_query($sql);
+            if($result2)
+            {
+              while($row2=mysql_fetch_assoc($result2))
+              {
+                $sql="INSERT INTO ".$this->tables['polls_votes']." VALUES (
+                  '".$id."',
+                  '".$row2['user_id']."',
+                  '".$row2['date']."',
+                  '".addslashes($row2['user_comment'])."'
+                )";
+                if(!pwg_query($sql))
+                {
+                  return(false);
+                }
+              }
+            }
+          }
+          else
+          {
+            return(false);
+          }
+        }
+      }
+      else
+      {
+        return(false);
+      }
+
+      return(true);
+    }
+
+
+  } //class
+
+?>
Index: /extensions/mypolls/mypolls_pip.class.inc.php
===================================================================
--- /extensions/mypolls/mypolls_pip.class.inc.php	(revision 3397)
+++ /extensions/mypolls/mypolls_pip.class.inc.php	(revision 3397)
@@ -0,0 +1,575 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  MyPolls_PIP : classe to manage plugin public pages
+
+  --------------------------------------------------------------------------- */
+
+include_once('mypolls_root.class.inc.php');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/public_integration.class.inc.php');
+
+class MyPolls_PIP extends MyPolls_root
+{
+  protected $section_page;
+
+  public function MyPolls_PIP($prefixeTable, $filelocation)
+  {
+    parent::__construct($prefixeTable, $filelocation);
+    $this->load_config();
+
+    // don't create this object inside root classe otherwise header is modified
+    // everywhere in admin pages
+    $this->ajax = new Ajax();
+
+    $this->section_page = new public_integration($this->section_name);
+    $this->init_events();
+  }
+
+  /*
+    load language file
+  */
+  public function load_lang()
+  {
+    global $lang;
+
+    load_language('plugin.lang', MYPOLLS_PATH);
+
+    // ajax is managed here ; this permit to use user&language properties inside
+    // ajax content
+    $this->return_ajax_content();
+  }
+
+  /*
+    initialize events call for the plugin
+  */
+  public function init_events()
+  {
+    parent::init_events();
+    $this->section_page->set_callback_page_function(array(&$this, 'manage_page'));
+    $this->section_page->init_events();
+    add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') );
+    add_event_handler('loading_lang', array(&$this, 'load_lang'));
+    add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
+  }
+
+
+
+  /* -------------------------------------------------------------------------
+    FUNCTIONS TO MANAGE POLL'S DISPLAY
+  ------------------------------------------------------------------------- */
+
+  /*
+    display mypolls page ; no parameters, all is in $_REQUEST
+    this function is a called by a menubar's callback only when it is necessary
+  */
+  protected function display_page($poll_id)
+  {
+    global $template, $user;
+
+    $poll_values=$this->get_poll_values($poll_id, $user['language']);
+    if(!$poll_values)
+    {
+      page_not_found('This page does not exist', 'index.php?');
+      return(false);
+    }
+
+    $users = new users($poll_values['allowed_users']);
+    $groups = new groups($poll_values['allowed_groups']);
+    $datas = array();
+
+    $user_groups=$this->get_user_groups($user['id']);
+
+    //looks if user/group is allowed to access page
+    if((!$users->is_allowed($user['status']) ||
+      (($poll_values['allowed_groups']!='') && !$groups->are_allowed($user_groups))) &&
+      !is_admin())
+    {
+      page_not_found('User not allowed', 'index.php?');
+    }
+
+    if($user['id']!=2)
+    {
+      $datas['GENERIC_TEXT']=$this->my_config['mypolls_generic_text_users'][$user['language']];
+    }
+    else
+    {
+      $datas['GENERIC_TEXT']=$this->my_config['mypolls_generic_text_guests'][$user['language']];
+    }
+
+    $datas['TITLE']=$poll_values['title'];
+    //displayed nfo even if results are not public
+    $datas['DESCRIPTION']=html_entity_decode($poll_values['description'], ENT_QUOTES);
+
+
+    if(!$this->get_user_already_vote($poll_id, $user['id'], $_SERVER['REMOTE_ADDR']))
+    {
+      // no vote for this poll by user, display poll in 'vote' mode
+
+      //count visit on page
+      $this->count_visit($poll_id, 'before');
+      $first_question=array('mono' => 0, 'multi' => 1);
+
+      $template_file=dirname($this->filelocation).'/templates/mypolls_public_question.tpl';
+
+      $datas['ATT_ID']=$poll_id;
+      $datas['AJAX_URL_POLL_DETAIL']='./index.php?/'.$this->section_name.'/'.$poll_id.'&ajaxfct=poll_question_blocks';
+      $datas['LANG']=$user['language'];
+      $datas['FIRST_QUESTION']=$first_question[$poll_values['display_type']];
+      $datas['NBQUESTIONS']=$poll_values['nb_questions'];
+    }
+    else
+    {
+      //user/ip have already voted
+      $template_file=dirname($this->filelocation).'/templates/mypolls_public_results.tpl';
+
+      $datas['AFTER_VOTE_TEXT']=html_entity_decode($poll_values['after_vote_text'], ENT_QUOTES);
+
+      if($poll_values['public_results']=='n')
+      {
+        $not_public_text=html_entity_decode($this->my_config['mypolls_not_public_results'][$user['language']]);
+        if($not_public_text=="")
+        {
+          $not_public_text=l10n('mypolls_not_public_results');
+        }
+        $datas['NOT_PUBLIC_RESULT_TEXT']=$not_public_text;
+      }
+      else
+      {
+        if($poll_values['show_comments']=='y')
+        {
+          $datas["AJAX_URL_POLL_COMMENT_LIST"]='./index.php?/'.$this->section_name.'/'.$poll_id.'&ajaxfct=poll_comment_list&vpage=';
+        }
+         $this->display_results_block($poll_id, $user['language'], $poll_values);
+      }
+
+      //count visit on page
+      $this->count_visit($poll_id, 'after');
+    }
+
+    $template->set_filename('body_page', $template_file);
+    $template->assign('TITLE', $datas['TITLE']);
+    $template->assign('datas', $datas);
+
+
+    // add icon in title bar
+    if (is_admin())
+    {
+      $this->make_icons(PHPWG_ROOT_PATH.$this->page_link."&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id=".$poll_id, 'mypolls_msg_modify_poll','preferences.png', 'edit', 'icon_category_edit');
+    }
+    $this->make_icons(make_index_url(),'return to homepage', 'home.png', 'home', 'icon_home');
+
+    //remote icons from the title bar
+    unset($template->smarty->_tpl_vars["U_MODE_CREATED"]);
+    unset($template->smarty->_tpl_vars["U_MODE_POSTED"]);
+
+    $template->assign_var_from_handle('PLUGIN_INDEX_CONTENT_BEGIN', 'body_page');
+  }
+
+  protected function make_icons($url, $title, $icon, $alt, $id="")
+  {
+    global $template;
+
+    //method to make icon change with template
+    // assume yoga method by default
+    switch($template->smarty->_tpl_vars["themeconf"]['template'])
+    {
+      case 'gally':
+        $template->concat( 'PLUGIN_INDEX_ACTIONS',
+            '<li><a href="'.$url.'" title="'.l10n($title).'" class="button" '.(($id=="")?'':'id="'.$id.'"').'></a></li>');
+
+        break;
+      default:
+        $template->concat( 'PLUGIN_INDEX_ACTIONS',
+            '<li><a href="'.$url.'" title="'.l10n($title).'">
+            <img src="'.$template->smarty->_tpl_vars["themeconf"]['icon_dir'].'/'.$icon.'" class="button" alt="'.l10n($alt).'"/></a></li>');
+    }
+  }
+  
+
+  /*
+    analyse uri request, do vote and load the page
+  */
+  public function manage_page()
+  {
+    global $page, $user;
+
+    $this->load_lang();
+
+    if($page['section'] == $this->section_name)
+    {
+
+      $poll_id=$this->extract_poll_id_from_uri();
+
+      if((isset($_POST['submit_results']))&&(!$this->get_user_already_vote($poll_id, $user['user_id'], $_SERVER['REMOTE_ADDR'])))
+      {
+
+        if(!isset($_REQUEST['fmypolls_comment']))
+        { $_REQUEST['fmypolls_comment']=''; }
+        $this->do_vote($poll_id, $_REQUEST['fmypolls_results'], $_REQUEST['fmypolls_comment'], $user['user_id'], $_SERVER['REMOTE_ADDR'],  $user['language']);
+      }
+      $this->display_page($poll_id);
+    }
+  }
+
+  /*
+    initialise menubar's menu
+    called by menubar object when making menu
+  */
+  public function blockmanager_apply( $menu_ref_arr )
+  {
+    global $user, $template;
+    $menu = & $menu_ref_arr[0];
+
+    if ( ($block = $menu->get_block( 'mbMYPOLLS_menu' ) ) != null )
+    {
+      if($user['id']==2)
+      {
+        $vote_id = $_SERVER['REMOTE_ADDR'];
+      }
+      else
+      {
+        $vote_id = $user['id'];
+      }
+
+      $polls_list=$this->get_polls_list($vote_id, is_admin(), $user['language']);
+      $menu_list=array();
+
+      if(is_admin())
+      {
+        array_push($menu_list,
+          array(
+            'nfo' => "",
+            'text' => l10n('mypolls_admin_add'),
+            'link' => PHPWG_ROOT_PATH.$this->page_link.'&amp;f_tabsheet=polls&amp;action=create',
+            'edit' => ""
+          )
+        );
+      }
+
+      foreach($polls_list as $key => $val)
+      {
+        $nfo="";
+        if($val['enabled']=='n')
+        { $nfo.='<i>['.l10n('mypolls_menu_not_enabled').']</i>'; }
+        if($val['visible']=='n')
+        { $nfo.='<i>['.l10n('mypolls_menu_not_visible').']</i>'; }
+        if($val['public_results']=='n')
+        { $nfo.='<i>['.l10n('mypolls_menu_not_publicr').']</i>'; }
+        array_push($menu_list,
+          array(
+            'nfo' => $nfo,
+            'text' => $val['title'],
+            'link' => './index.php?/'.$this->section_name.'/'.$val['id'],
+            'edit' => (is_admin())?PHPWG_ROOT_PATH.$this->page_link."&amp;f_tabsheet=polls&amp;action=modify&amp;fmypolls_att_id=".$val['id']:""
+          )
+        );
+      }
+
+      $block->set_title($this->my_config['mypolls_menubar_title'][$user['language']]);
+      $block->template = dirname(__FILE__).'/templates/mypolls_public_menu.tpl';
+      $block->data = $menu_list;
+    }
+
+  }
+
+
+  protected function extract_poll_id_from_uri()
+  {
+    $poll_id=explode($this->section_name.'/', $_SERVER['REQUEST_URI']);
+    $poll_id=explode('&', $poll_id[1]);
+
+    return($poll_id[0]);
+  }
+
+
+
+  /* ---------------------------------------------------------------------------
+    FUNCTIONS TO MANAGE POLL'S VOTES
+  --------------------------------------------------------------------------- */
+
+  /*
+    analyse formated string "fq_N_a_M_P"
+    return an array(N,M,P)
+  */
+  protected function analyse_answer($answer)
+  {
+    $tmp=explode("_",$answer);
+    if(!isset($tmp[4]))
+    { $tmp[4]=1; }
+    $return=array($tmp[1],$tmp[3],$tmp[4]);
+    return($return);
+  }
+
+  /*
+    do vote
+    return true if Ok, else a number
+      -1 : database problem
+      -2 : user has already vote
+      -3 : ip has already vote
+  */
+  protected function do_vote($poll_id, $vote_results, $vote_comment, $user_id, $ip, $lang)
+  {
+    $vote_resultsa=unserialize(stripslashes($vote_results));
+
+    if($user_id==2) { $vote_id = $ip; } else { $vote_id = $user_id; }
+    $sql='INSERT INTO '.$this->tables['polls_votes']."
+          VALUES ('".$poll_id."',
+                  '".$vote_id."',
+                  '".date('Y-m-d H:i:s')."',
+                  '".htmlspecialchars(stripslashes($vote_comment), ENT_QUOTES)."')";
+    if(pwg_query($sql))
+    {
+      $sql="UPDATE ".$this->tables['polls']."
+            SET total_votes = total_votes + 1,
+                last_vote = '".date('Y-m-d H:i:s')."',
+                visit_without_vote = visit_without_vote - 1";
+      if($vote_comment!="")
+      {
+        $sql.=", nb_comments = nb_comments + 1 ";
+      }
+      $sql.=" WHERE id = '".$poll_id."' ";
+      if(pwg_query($sql))
+      {
+        foreach($vote_resultsa as $key => $val)
+        {
+          $nb_votes=0;
+          //first, updating "nb_votes, used for ordering result and apply frequency
+          foreach($val as $key2 => $val2)
+          {
+            $vote_result=$this->analyse_answer($val2);
+            $sql="UPDATE ".$this->tables['polls_answers']."
+                  SET nb_votes = nb_votes + ".$vote_result[2]."
+                  WHERE id_poll = '".$poll_id."'
+                    AND id_question = '".$vote_result[0]."'
+                    AND answer_num = '".$vote_result[1]."'; ";
+            $result=pwg_query($sql);
+
+            $sql="UPDATE ".$this->tables['polls_answers_lang']."
+                  SET nb_votes = nb_votes + ".$vote_result[2]."
+                  WHERE id_poll = '".$poll_id."'
+                    AND id_question = '".$vote_result[0]."'
+                    AND id_answer = '".$vote_result[1]."'
+                    AND lang = '".$lang."' ";
+            $result=pwg_query($sql);
+            $nb_votes+=$vote_result[2];
+          }
+          //"nb_votes" updated, reload order and apply frequency
+          $question_num=$vote_result[0];
+          $poll_answers=$this->get_poll_answers($poll_id, $question_num, $lang, " nb_votes ASC, ans_order ASC", true);
+          $num=0;
+          foreach($val as $key2 => $val2)
+          {
+            $vote_result=$this->analyse_answer($val2);
+            if($vote_result[2]!=$poll_answers[$vote_result[1]]['order'])
+            {
+              $sql="UPDATE ".$this->tables['polls_answers']."
+                    SET frequency = frequency + 1,
+                        ans_order = '".$poll_answers[$vote_result[1]]['order']."'
+                    WHERE id_poll = '".$poll_id."'
+                    AND id_question = '".$vote_result[0]."'
+                    AND answer_num = '".$vote_result[1]."'; ";
+              $result=pwg_query($sql);
+            }
+            else
+            {
+              $sql="UPDATE ".$this->tables['polls_answers']."
+                    SET ans_order = '".$poll_answers[$vote_result[1]]['order']."'
+                    WHERE id_poll = '".$poll_id."'
+                    AND id_question = '".$vote_result[0]."'
+                    AND answer_num = '".$vote_result[1]."'; ";
+              $result=pwg_query($sql);
+            }
+          }
+
+          $sql="UPDATE ".$this->tables['polls_questions']."
+                SET nb_votes = nb_votes + ".$nb_votes."
+                WHERE id_poll = '".$poll_id."'
+                  AND question_num = '".$vote_result[0]."' ;";
+          $result=pwg_query($sql);
+        }
+      }
+    }
+  }
+
+  /*
+    looks if user/ip has already make a vote
+      return true if yes, else false
+  */
+  protected function get_user_already_vote($poll_id, $user_id, $ip)
+  {
+    $sql="SELECT user_id FROM ".$this->tables['polls_votes']."
+          WHERE poll_id = '".$poll_id."'
+            AND user_id = '".$ip."'
+          UNION
+          SELECT user_id FROM ".$this->tables['polls_votes']."
+          WHERE poll_id = '".$poll_id."'
+            AND user_id = '".$user_id."'";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      if(mysql_num_rows($result)>0)
+      { return(true); }
+    }
+    return(false);
+  }
+
+  /*
+    count visit on vote's page
+    $step=
+      'before' = before vote
+      'after' = after vote
+  */
+  protected function count_visit($poll_id, $step)
+  {
+    $field=array('before' => 'visit_without_vote', 'after' => 'visit_after_vote');
+    $sql="UPDATE ".$this->tables['polls']."
+          SET ".$field[$step]." = ".$field[$step]." + 1
+          WHERE id = '".$poll_id."'";
+    pwg_query($sql);
+  }
+
+  /*
+    return user's group as an array
+  */
+  protected function get_user_groups($user_id)
+  {
+    $returned=array();
+    $sql="SELECT group_id FROM ".USER_GROUP_TABLE."
+          WHERE user_id = ".$user_id." ";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      while($row=mysql_fetch_assoc($result))
+      {
+        array_push($returned, $row['group_id']);
+      }
+    }
+    return($returned);
+  }
+
+  /* ---------------------------------------------------------------------------
+    ajax functions
+  --------------------------------------------------------------------------- */
+  /*
+    return ajax content if request is ajax else return nothing (script allowed to continue)
+  */
+  public function return_ajax_content()
+  {
+    global $user, $ajax;
+    if(isset($_REQUEST['ajaxfct']))
+    {
+      $poll_id=$this->extract_poll_id_from_uri();
+      //$user['language'] = $_REQUEST['lang'];
+      switch($_REQUEST['ajaxfct'])
+      {
+        case 'poll_question_blocks':
+          $result=$this->ajax_poll_question_blocks($poll_id, $_REQUEST['question'], $_REQUEST['lang']);
+          break;
+        case 'poll_comment_list':
+          $result=$this->ajax_poll_comment_list($poll_id, $_REQUEST['vpage']);
+          break;
+      }
+      $this->ajax->return_result($result);
+    }
+  }
+
+  protected function ajax_poll_question_blocks($poll_id, $question_num, $lang)
+  {
+    $local_tpl = new Template(MYPOLLS_PATH."templates/", "");
+    $local_tpl->set_filename('body_page',
+                  dirname($this->filelocation).'/templates/mypolls_public_question2.tpl');
+
+
+    $poll_values=$this->get_poll_values($poll_id, $lang);
+    $poll_questions=$this->get_poll_questions($poll_id, "", $lang);
+    $datas=array();
+
+    $numq=1;
+    foreach($poll_questions as $key => $val)
+    {
+      if(($question_num==0)||($numq==$question_num))
+      {
+        $ansnfo="";
+        switch($val['question_type'])
+        {
+          case 'multi':
+            $ansnfo=sprintf(l10n('mypolls_answer_maxi'), $val['multi_max_answers']);
+            break;
+          case 'order':
+            $ansnfo=l10n("mypolls_answer_order");
+            break;
+        }
+
+        $datas['question'][$numq]=array(
+          'NUMQ' => $numq,
+          'NBQ' => $poll_values['nb_questions'],
+          'DESCRIPTION' => html_entity_decode($val['description']),
+          'ANSNFO' => $ansnfo
+        );
+
+        $poll_answers=$this->get_poll_answers($poll_id, $val['question_num'], $lang);
+        foreach($poll_answers as $key2 => $val2)
+        {
+          $inputfield="";
+          switch($val['question_type'])
+          {
+            case 'mono':
+              $inputfield="<input type='radio' name='fq_".$val['question_num']."'
+                            id='iq_".$val['question_num']."_a_".$val2['answer_num']."'
+                            value='".$val2['answer_num']."'
+                            onclick='check_mono(\"fq_".$val['question_num']."\", ".$numq.")' > ";
+              break;
+            case 'multi':
+              $inputfield="<input type='checkbox' name='fq_".$val['question_num']."'
+                            id='iq_".$val['question_num']."_a_".$val2['answer_num']."'
+                            value='".$val2['answer_num']."'
+                            onclick='check_multi(".$val['multi_max_answers'].", \"fq_".$val['question_num']."\", ".$numq.")' >";
+              break;
+            case 'order':
+              $inputfield="<select name='fq_".$val['question_num']."'
+                            id='iq_".$val['question_num']."_a_".$val2['answer_num']."'
+                            onchange='check_order(\"fq_".$val['question_num']."\", ".$numq.", \"iq_".$val['question_num']."_a_".$val2['answer_num']."\")' >";
+              $inputfield.="<option value='-'>-</option>";
+              for($i=1;$i<=count($poll_answers);$i++)
+              {
+                $inputfield.="<option value='$i'>$i</option>";
+              }
+              $inputfield.="</select>";
+              break;
+          }
+
+          $datas['question'][$numq]['answers'][$val2['answer_num']]=array(
+            'INPUTFIELD' => $inputfield,
+            'ANSWER' => html_entity_decode($val2['answer'])
+          );
+        }
+      }
+      $numq++;
+    }
+
+    if(($question_num==$poll_values['nb_questions'])||($question_num==0))
+    {
+      $datas['LASTQUESTION']='y';
+      $datas['ALLOWCOMMENT']=$poll_values['allow_comment'];
+    }
+    else
+    {
+      $datas['NEXTQUESTION']=$question_num+1;
+    }
+
+    $local_tpl->assign("datas", $datas);
+
+    return($local_tpl->parse('body_page', true));
+  }
+
+} //class
+
+?>
Index: /extensions/mypolls/mypolls_root.class.inc.php
===================================================================
--- /extensions/mypolls/mypolls_root.class.inc.php	(revision 3397)
+++ /extensions/mypolls/mypolls_root.class.inc.php	(revision 3397)
@@ -0,0 +1,624 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : MyPolls.2
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.dnsalias.com
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  MyPolls_root : common classe for admin and public classes
+
+  --------------------------------------------------------------------------- */  
+  include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
+  include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/users_groups.class.inc.php');
+  include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
+  include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php');
+  global $ajax;
+
+
+  class MyPolls_root extends common_plugin
+  {
+    protected $questions_types;
+    protected $display_types;
+    protected $section_name;    //name of mypolls's section
+    protected $css;   //the css object
+    protected $ajax;
+
+    public function MyPolls_root($prefixeTable, $filelocation)
+    {
+      $this->plugin_name='MyPolls.2';
+      $this->plugin_name_files="mypolls";
+      parent::common_plugin($prefixeTable, $filelocation);
+      $this->section_name=$this->plugin_name_files;
+
+      $list=array('polls', 'polls_lang', 'polls_questions', 'polls_questions_lang',
+                  'polls_answers', 'polls_answers_lang', 'polls_votes');
+      $this->set_tables_list($list);
+
+      $this->questions_types=array('mono', 'multi', 'order');
+      $this->display_types=array('mono', 'multi');
+      $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
+    }
+
+  public function init_events()
+  {
+    add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') );
+  }
+
+  public function register_blocks( $menu_ref_arr )
+  {
+    $menu = & $menu_ref_arr[0];
+    if ($menu->get_id() != 'menubar')
+      return;
+    $menu->register_block( new RegisteredBlock( 'mbMYPOLLS_menu', 'Polls', 'MYPOLLS'));
+  }
+
+
+    /*
+      surchage of common_plugin->save_config function
+    */
+    public function save_config()
+    {
+      if(parent::save_config())
+      {
+        $this->css->make_CSS($this->generate_CSS());
+        return(true);
+      }
+      return(false);
+    }
+
+    /*
+      surchage of common_plugin->save_config function
+    */
+    public function load_config()
+    {
+      parent::load_config();
+      if(!$this->css->css_file_exists())
+      {
+        $this->css->make_CSS($this->generate_CSS());
+      }
+    }
+
+
+    /*
+      intialize default values 
+    */
+    public function init_config()
+    {
+      //global $user;
+      $this->my_config=array(
+        'mypolls_color_bars' => '6666ff', /**/
+        'mypolls_maxbarwidth' => '400', /**/
+        'mypolls_display_type_default' => 'mono', /**/
+        'mypolls_admincolor' => 'ffff66', /**/
+        'mypolls_mouseovercolor' => '303030', /**/
+        'mypolls_nbuser_per_page' => 15, /**/
+        'mypolls_nbcomment_per_page' => 15, /**/
+        /* not present in config panel, but needed by mypolls */
+        'mypolls_visible_default' => 'y',
+        'mypolls_allow_comment_default' => 'n',
+        'mypolls_show_user_comment_default' => 'n',
+        'mypolls_allowed_users_default_guest' => 'y',
+        'mypolls_allowed_users_default_generic' => 'y',
+        'mypolls_allowed_users_default_normal' => 'y',
+        'mypolls_allowed_groups_default' => '',
+        'mypolls_question_type_default' => 'mono',
+        'mypolls_multi_max_answers_default' => '3',
+        'mypolls_public_results' => 'y',
+        /* 'mypolls_default_language' => $user['language'], */
+        'mypolls_menubar_title' => array(),
+        'mypolls_generic_text_users' => array(),
+        'mypolls_generic_text_guests' => array(),
+        'mypolls_not_public_results' => array()
+      );
+
+      $languages=get_languages();
+      foreach($languages as $key => $val)
+      {
+        $this->my_config['mypolls_menubar_title'][$key]='MyPolls';
+        $this->my_config['mypolls_generic_text_users'][$key]='';
+        $this->my_config['mypolls_generic_text_guests'][$key]='';
+        $this->my_config['mypolls_not_public_results'][$key]='';
+      }
+    }
+
+    /*
+      generate the css code
+    */
+    protected function generate_CSS()
+    {
+      $text = "
+.graphbar1,
+.graphbarx {
+    border:0px;
+    height:8px;
+    display: block;
+    margin:0px;
+    padding:0px;
+    left:0;
+    position:relative;
+  }
+.graphbar1 { background-color:#".$this->my_config['mypolls_color_bars']."; top:-3px;  }
+.graphbarx { background-color:transparent; top:0px; height:1px; }
+
+.formtable P,
+.formtable UL,
+.formtable UL LI P
+{
+  text-align:left;
+  display:block;
+  margin-top:0px;
+  margin-bottom:0px;
+}
+
+.formtable UL LI
+{
+  margin-bottom:1em;
+}
+
+.formtable UL LI P,
+.formtable P
+{
+  color:#".$this->my_config['mypolls_admincolor'].";
+  padding-left:1.5em;
+}
+
+.TableRow:hover
+{
+  background-color:#".$this->my_config['mypolls_mouseovercolor'].";
+}
+
+.formtable UL.compact LI
+{
+  margin-bottom:0em;
+}
+
+.mypolls_page
+{
+  text-align:justify;
+  margin:8px;
+}
+
+.mypolls_page FORM P
+{
+  text-align:justify;
+  margin:0px;
+  margin-bottom:1em;
+}
+
+.littlefont { font-size:90%; }
+table.littlefont th { text-align:center; padding:3px;padding-left:9px;padding-right:9px; }
+table.littlefont td { text-align:left; padding:0px;padding-left:3px;padding-right:3px; }
+
+      ";
+      return($text);
+    }
+
+    /* -------------------------------------------------------------------------
+     return an array of poll's values
+      if no lang given, return nfo with poll's default language
+    ------------------------------------------------------------------------- */
+    protected function get_poll_values($poll_id, $lang="")
+    {
+      $sql="SELECT ".$this->tables['polls'].".*,
+                   ".$this->tables['polls_lang'].".title,
+                   ".$this->tables['polls_lang'].".description,
+                   ".$this->tables['polls_lang'].".after_vote_text
+            FROM ".$this->tables['polls'].",
+                 ".$this->tables['polls_lang']." 
+            WHERE id = '$poll_id'
+              AND ".$this->tables['polls'].".id = ".$this->tables['polls_lang'].".id_poll ";
+      if($lang=="")
+      {
+        $sql.=" AND ".$this->tables['polls'].".default_lang = ".$this->tables['polls_lang'].".lang ";
+      }
+      else
+      {
+        $sql.=" AND ".$this->tables['polls_lang'].".lang = '".$lang."' ";
+      }
+
+      $result=pwg_query($sql);
+      if($result)
+      {
+        return(mysql_fetch_array($result));
+      }
+      return(false); 
+    }
+
+    /* -------------------------------------------------------------------------
+     return an array of poll's translation
+    ------------------------------------------------------------------------- */
+    protected function get_poll_languages($poll_id)
+    {
+      $sql="SELECT lang FROM ".$this->tables['polls_lang']." WHERE id_poll = '$poll_id'";
+      $result=pwg_query($sql);
+      if($result)
+      {
+        $returned=array();
+        while($row=mysql_fetch_row($result))
+        {
+          array_push($returned, $row[0]);
+        }
+        return($returned);
+      }  
+      return(false); 
+    }
+
+
+    /* -------------------------------------------------------------------------
+     returns poll's question
+      if no question id given, return an array of all question
+      if no lang given, return question with poll's default language
+    ------------------------------------------------------------------------- */
+    protected function get_poll_questions($poll_id, $id_question="", $lang="")
+    {
+      $sql="SELECT ".$this->tables['polls_questions_lang'].".description,
+                ".$this->tables['polls_questions'].".* 
+            FROM ".$this->tables['polls_questions_lang'].",
+                 ".$this->tables['polls_questions'];
+      $sql_where=" WHERE ".$this->tables['polls_questions'].".id_poll = ".$poll_id."
+                   AND ".$this->tables['polls_questions_lang'].".id_poll = "
+                        .$this->tables['polls_questions'].".id_poll
+                   AND ".$this->tables['polls_questions_lang'].".id_question = "
+                        .$this->tables['polls_questions'].".question_num ";
+
+      if($id_question!="")
+      {
+        $sql_where.=" AND ".$this->tables['polls_questions'].".question_num = ".
+                      $id_question." ";
+      }
+
+      if($lang=="")
+      {
+        $sql.=" , ".$this->tables['polls']." ";
+        $sql_where.=" AND ".$this->tables['polls'].".default_lang =
+                          ".$this->tables['polls_questions_lang'].".lang
+                      AND ".$this->tables['polls'].".id =
+                          ".$this->tables['polls_questions'].".id_poll ";
+      }
+      else
+      {
+        $sql_where.=" AND ".$this->tables['polls_questions_lang'].".lang = '".$lang."' ";
+      }
+      $sql_order=" ORDER BY question_num asc ";
+      $result=pwg_query($sql.$sql_where.$sql_order);
+      if($result)
+      {
+        $returned=array();
+        while($row=mysql_fetch_assoc($result))
+        {
+          array_push($returned, $row);
+        }
+        return($returned);
+      }  
+      return(false); 
+    }
+
+    /* -------------------------------------------------------------------------
+     returns poll's question's answers
+      if no lang given, return answers with poll's default language
+    ------------------------------------------------------------------------- */
+    protected function get_poll_answers($poll_id, $id_question, $lang="", $order_by="", $array_by_answer_id=false)
+    {
+      $sql="SELECT ".$this->tables['polls_answers'].".*,
+                   ".$this->tables['polls_answers_lang'].".nb_votes as vote_lang,
+                   ".$this->tables['polls_answers_lang'].".answer
+            FROM ".$this->tables['polls_answers']." INNER JOIN
+                 ".$this->tables['polls_answers_lang']."
+              ON ".$this->tables['polls_answers'].".id_poll = ".$this->tables['polls_answers_lang'].".id_poll
+              AND ".$this->tables['polls_answers'].".id_question = ".$this->tables['polls_answers_lang'].".id_question
+              AND ".$this->tables['polls_answers'].".answer_num = ".$this->tables['polls_answers_lang'].".id_answer ";
+      $sql_where=" WHERE ".$this->tables['polls_answers'].".id_poll = '".$poll_id."'
+                     AND ".$this->tables['polls_answers'].".id_question = '".$id_question."' ";
+      if($order_by=="")
+      {
+        $sql_order=" ORDER BY ".$this->tables['polls_answers'].".answer_num ASC ";
+      }
+      else
+      {
+        $sql_order=" ORDER BY ".$order_by;
+      }
+
+      if($lang=="")
+      {
+        $sql.=" , ".$this->tables['polls']." ";
+        $sql_where.=" AND ".$this->tables['polls_answers'].".id_poll = ".$this->tables['polls'].".id
+                      AND ".$this->tables['polls_answers_lang'].".lang = ".$this->tables['polls'].".default_lang ";
+      }
+      else
+      {
+        $sql_where.=" AND ".$this->tables['polls_answers_lang'].".lang = '".$lang."' ";
+      }
+      $result=pwg_query($sql.$sql_where.$sql_order);
+      if($result)
+      {
+        $returned=array();
+        $num=0;
+        while($row=mysql_fetch_assoc($result))
+        {
+          if(!$array_by_answer_id)
+          { array_push($returned, $row); }
+          else
+          {
+            $num++;
+            $returned[$row['answer_num']] = $row;
+            $returned[$row['answer_num']]['order'] = $num;
+          }
+        }
+        return($returned);
+      }
+      return(false);
+    }
+
+
+    /* -------------------------------------------------------------------------
+       return an array of all polls 
+    ------------------------------------------------------------------------- */
+    protected function get_polls_list($user_id=2, $view_all=true, $lang="")
+    {
+      $returned=array();
+
+
+      $sql="SELECT ".$this->tables['polls'].".*, 
+                       ".$this->tables['polls_lang'].".title
+          FROM ".$this->tables['polls_lang'].",
+                     ".$this->tables['polls'];
+
+      $sql_where=" WHERE ".$this->tables['polls'].".id =
+                          ".$this->tables['polls_lang'].".id_poll
+                      AND ".$this->tables['polls_lang'].".lang = ";
+
+      if($lang=="")
+      {
+        $sql_where.=" ".$this->tables['polls'].".default_lang ";
+      }
+      else
+      {
+        $sql_where.=" '".$lang."' ";
+      }
+
+      if(!$view_all)
+      {
+        $sql.=" LEFT OUTER JOIN (SELECT poll_id, count(*) as as_voted
+                  FROM ".$this->tables['polls_votes']."
+                  WHERE user_id = '".$user_id."'
+                  GROUP BY poll_id, user_id ) as vote_list
+              ON id = poll_id ";
+        $sql_where.=" AND visible = 'y' AND enabled = 'y' AND nb_questions>0
+                      AND ((".$this->tables['polls'].".public_results = 'n'
+                            AND vote_list.as_voted = 0
+                           )
+                           OR (".$this->tables['polls'].".public_results = 'y'))";
+      }
+
+      $sql_order=" ORDER BY id desc";
+
+      $result=pwg_query($sql.$sql_where.$sql_order);
+      if($result)
+      {
+        while($row=mysql_fetch_assoc($result))
+        { 
+          array_push($returned, $row);
+        }
+      }  
+      return($returned); 
+    }
+
+
+    /*
+      return a list of user/ip making a comment on the poll
+      list is paged with $my_config['mypolls_nbcomment_per_page'] value
+
+      an array is returned :
+        array[0] : list
+        array[1] : total number of pages
+    */
+    protected function get_poll_users_comment($poll_id, $num_page=1)
+    {
+      $returned=array(array(), -1);
+      $sql="SELECT SQL_CALC_FOUND_ROWS IF(username IS NULL, user_id, CONCAT(' ',username)) AS name, date, user_comment, user_id 
+        FROM ".$this->tables['polls_votes']." LEFT JOIN ".USERS_TABLE."
+          ON ".$this->tables['polls_votes'].".user_id = ".USERS_TABLE.".id
+        WHERE poll_id = $poll_id and user_comment != ''
+        ORDER BY date desc
+        LIMIT ".(($num_page-1)*$this->my_config['mypolls_nbcomment_per_page']).", ".$this->my_config['mypolls_nbcomment_per_page'];
+
+      $result = pwg_query($sql);
+      if($result)
+      {
+        while($row = mysql_fetch_assoc($result))
+        { array_push($returned[0], $row); }
+
+        $sql="select FOUND_ROWS()";
+        $result=pwg_query($sql);
+        if($result) 
+        { $row = mysql_fetch_row($result); $returned[1] = ceil($row[0]/$this->my_config['mypolls_nbcomment_per_page']); } 
+        else 
+        { $returned[1] = -1; }
+      }
+      return($returned);
+    }
+
+
+    /*
+      common fo&bo function to display results
+        //$poll_values is by ref, because it can be a huge array
+    */
+    protected function display_results_block($poll_id, $lang, &$poll_values)
+    {
+      global $template;
+
+      /*
+        function used with this templates
+            mypolls_public_results.tpl
+            mypolls_public_question.tpl
+            plugin_admin_view.tpl
+        only affect $questions values
+
+        $datas values are affected outside of this function
+      */
+
+      
+      $template_questions=array();
+
+      $questions_values=$this->get_poll_questions($poll_id, "", $lang);
+      $numq=1;
+      foreach($questions_values as $key => $val)
+      {
+        if($val['question_type']=='multi')
+        {
+          $show_maxi='&nbsp;'.sprintf(l10n('mypolls_answer_maxi'), $val['multi_max_answers']);
+        }
+        else
+        {
+          $show_maxi="";
+        }
+        if($val['question_type']=='order')
+        {
+          $nbvotes_label='';
+          $order_by=" nb_votes ASC";
+        }
+        else
+        {
+          $nbvotes_label=l10n('mypolls_result_nbanswers')." (".$val['nb_votes'].")";
+          $order_by=" nb_votes DESC";
+        }
+
+
+        $template_questions_answers=array();
+
+        $numa=1;
+        $answers_values=$this->get_poll_answers($poll_id, $val['question_num'], $lang, $order_by.", ans_order ASC");
+        foreach($answers_values as $key2 => $val2)
+        {
+          if(($val['nb_votes']>0)&&($poll_values['total_votes']>0))
+          {
+            if($val['question_type']=='order')
+            { 
+              $pct=100*($poll_values['total_votes']-$val2['frequency'])/$poll_values['total_votes'];
+            }
+            else
+            { 
+              $pct=100*$val2['nb_votes']/$val['nb_votes'];
+            }
+            $graph=ceil($pct*$this->my_config['mypolls_maxbarwidth']/100);
+          }
+          else
+          {
+            $pct=0;
+            $graph=0;
+          }
+          $template_questions_answers[]=array(
+            'NUMANSWER' => $numa,
+            'ANSWER' => html_entity_decode($val2['answer']),
+            'PCT' => number_format($pct, 2, '.', '').'% ',
+            'GRAPH' => $graph,
+            'MAXGRAPH' => $this->my_config['mypolls_maxbarwidth'],
+            'NBANSWSERS' => ($val['question_type']!='order')?$val2['nb_votes']:""
+          );
+
+          $numa++;
+        }
+
+        $template_questions[]=array(
+            'MAXGRAPH' => ceil($this->my_config['mypolls_maxbarwidth']*1.10),
+            'NUMQUESTION' => $numq,
+            'DESCRIPTION' => html_entity_decode($val['description']),
+            'QUESTION_TYPE' => strtolower(l10n('mypolls_question_'.$val['question_type']).$show_maxi),
+            'NBVOTES' => $nbvotes_label,
+            'answers' => $template_questions_answers
+        );
+
+        $numq++;
+      }
+      $template->assign('questions', $template_questions);
+
+      if($poll_values['color_bars']!=$this->my_config['mypolls_color_bars'])
+      {
+        $template->append('head_elements', '<style type="text/css">.graphbar1 { background-color:#'.$poll_values['color_bars'].'; }</style>');
+      }
+
+    } //display_results_block
+
+
+    /* ---------------------------------------------------------------------------
+      ajax functions
+    --------------------------------------------------------------------------- */
+
+    /*
+      return html formatted informations about poll's comments users 
+    */
+    protected function ajax_poll_comment_list($poll_id)
+    {
+      global $user;
+
+      if(!isset($_REQUEST['vpage']))
+      {
+        $page=1;
+      }
+      else
+      {
+        $page=$_REQUEST['vpage'];
+      }
+
+      $comment_list=$this->get_poll_users_comment($poll_id, $page);
+
+      $local_tpl = new Template(MYPOLLS_PATH."templates/", "");
+      $local_tpl->set_filename('body_page',
+                    dirname($this->filelocation).'/templates/plugin_comment_list.tpl');
+
+
+      $template_datas=array();
+      $template_datarows=array();
+
+      //users list
+      foreach($comment_list[0] as $key => $val)
+      {
+        $template_datarows[] =array(
+          'USERNAME' => $val['name'],
+          'DATE' => $val['date'],
+          'COMMENT' => nl2br($val['user_comment']),
+          'display_delete' => (defined('IN_ADMIN') and IN_ADMIN)?'yes':'',
+          'ID' => (defined('IN_ADMIN') and IN_ADMIN)?$val['user_id']:'',
+          'PAGE' => (defined('IN_ADMIN') and IN_ADMIN)?$page :''
+        );
+      }
+
+      //make pages links
+      if($comment_list[1]>1)
+      {
+        $plural="s";
+      }
+      else
+      {
+        $plural="";
+      }
+      $pages_links=l10n("mypolls_page".$plural."_label")." : ";
+      if($comment_list[1]<=0)
+      {
+        $pages_links="";
+      }
+      else
+      {
+        for($i=1;$i<=$comment_list[1];$i++)
+        {
+          if($i==$page)
+          { $pages_links.=" $i "; } 
+          else
+          {
+            $pages_links.="<a style='cursor:pointer;' onclick='load_poll_comment_list($i);'> $i </a>";
+          }
+        }
+      }
+
+      $local_tpl->assign('datas', array("PAGES" => $pages_links));
+      $local_tpl->assign('comment_list_rows',  $template_datarows);
+      return($local_tpl->parse('body_page', true));
+    }
+
+  } //class
+
+?>
Index: /extensions/mypolls/templates/index.php
===================================================================
--- /extensions/mypolls/templates/index.php	(revision 3397)
+++ /extensions/mypolls/templates/index.php	(revision 3397)
@@ -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/mypolls/templates/mypolls_public_menu.tpl
===================================================================
--- /extensions/mypolls/templates/mypolls_public_menu.tpl	(revision 3397)
+++ /extensions/mypolls/templates/mypolls_public_menu.tpl	(revision 3397)
@@ -0,0 +1,18 @@
+
+{if isset($block->data) and count($block->data)}
+  <!-- mypolls menu bar -->
+  {if $block->get_title() !="" }
+    <dt>{$block->get_title()}</dt>
+  {/if}
+  <dd>
+    <ul>
+      {foreach from=$block->data key=name item=link}
+        <li>
+          {$link.nfo}<a href="{$link.link}">{$link.text}</a>
+          {if $link.edit!=""} [<a href="{$link.edit}">{"mypolls_admin_edit"|@translate}</a>]
+          {/if}
+        </li>
+      {/foreach}
+    </ul>
+  </dd>
+{/if}
Index: /extensions/mypolls/templates/mypolls_public_question.tpl
===================================================================
--- /extensions/mypolls/templates/mypolls_public_question.tpl	(revision 3397)
+++ /extensions/mypolls/templates/mypolls_public_question.tpl	(revision 3397)
@@ -0,0 +1,244 @@
+<!-- main page -->
+{literal}
+<script type="text/javascript">
+
+  var poll_id='{/literal}{$datas.ATT_ID}'; //set as a global variable
+  var results = new Array({$datas.NBQUESTIONS}{literal});
+  var current_question = 0;
+
+  //format results (string)
+  function format_string(txt)
+  {
+    return('s:'+txt.length+':"'+txt+'";');
+  }
+  //format results (array)
+  function format_array(an_array)
+  {
+    result='a:'+an_array.length+':{';
+    for(i=0;i<an_array.length;i++)
+    {
+      result+='i:'+i+';'+an_array[i];
+    }
+    result+='}';
+
+    return(result);
+  }
+
+  //memorize answer's results
+  function memorise_result(question_num, result)
+  {
+    results[question_num] = result;
+  }
+
+  //prepare results into form
+  function prepare_results()
+  {
+    var objresult = document.getElementById("iresults");
+
+    objresult.value=format_array(results);
+  }
+
+  //load question(s)
+  function load_poll_questions(question_num)
+  {
+    var doc = document.getElementById('display_questions');
+
+    {/literal}
+    http_request=create_httpobject('get', '', '{$datas.AJAX_URL_POLL_DETAIL}'+'&question='+question_num+'&lang={$datas.LANG}', false);
+    {literal}
+    http_request.send(null);
+    doc.innerHTML = http_request.responseText;
+    current_question=question_num;
+    if(question_num==0)
+    {
+      for(i=0;i<{/literal}{$datas.NBQUESTIONS}{literal};i++)
+      { results[i]=''; }
+    }
+    else
+    { results[question_num-1]=''; }
+
+    global_check();
+  }
+
+  /*
+    for multi answers, check that number of checked answers are not superior to maximal
+    and set result in results array
+  */
+  function check_multi(nbmax, names, qid)
+  {
+    var local_result=new Array();
+    var nbselected=0;
+  
+
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(document.forms['poll_form'].elements[i].checked)
+        {
+          local_result.push(format_string(document.forms['poll_form'].elements[i].id));
+          nbselected++;
+        }
+      }
+    }
+    //disabled/enabled unchecked elements 
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(!document.forms['poll_form'].elements[i].checked)
+        { document.forms['poll_form'].elements[i].disabled=(nbselected==nbmax); }
+      }
+    }
+
+    qid--;
+    if(nbselected==0)
+    {
+      results[qid]='';
+    }
+    else
+    {
+      results[qid]=format_array(local_result);
+    }
+    global_check();
+  }
+
+  /*
+    this function permit to test in <option> of a <select> element is enabled/disabled
+    if disabled, force choice to value "-" (index 0)
+    function needed because some browsers like IE don't implement this property...
+  */
+  function check_option_enabled(id)
+  {
+    var doc = document.getElementById(id);
+    if(doc.options[doc.selectedIndex].disabled==true)
+    {
+      doc.selectedIndex=0;
+    }
+  }
+
+  /*
+    for order answers, when order is selected on an answer, disabled this choice for
+    other answers and set result in results array
+  */
+  function check_order(names, qid, id)
+  {
+    var local_result = new Array();
+    var all_selected = true;
+
+    check_option_enabled(id);
+
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        local_result.push(format_string(document.forms['poll_form'].elements[i].id+'_'+document.forms['poll_form'].elements[i].selectedIndex));
+        if(document.forms['poll_form'].elements[i].selectedIndex==0)
+        { all_selected=false; }
+        for(k=1;k<document.forms['poll_form'].elements[i].options.length;k++)
+        {
+          document.forms['poll_form'].elements[i].options[k].disabled=false;
+          for(j=0;j<document.forms['poll_form'].elements.length;j++)
+          {
+            if((document.forms['poll_form'].elements[j].name==names)&&
+              (document.forms['poll_form'].elements[j].selectedIndex==k)&&
+              (i!=j))
+            {
+              document.forms['poll_form'].elements[i].options[k].disabled=true;
+            }
+          }
+        }
+      }
+    }
+
+    qid--;
+    if(all_selected==false)
+    {
+      results[qid]='';
+    }
+    else
+    {
+      results[qid]=format_array(local_result);
+    }
+    global_check();
+  }
+
+  /*
+    for mono answers set result in results array
+  */
+  function check_mono(names, qid)
+  {
+    var local_result = new Array();
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(document.forms['poll_form'].elements[i].checked)
+        {
+          local_result[0]=format_string(document.forms['poll_form'].elements[i].id);
+        }
+      }
+    }
+    qid--;
+    results[qid]=format_array(local_result);
+    global_check();
+  }
+
+
+  /*
+    check all question and determine if disable or not the next step
+  */
+  function global_check()
+  {
+    disable_next_step=false;
+    if(current_question==0)
+    {
+      for(i=1;i<=results.length;i++)
+      {
+        if(results[i]=='')
+        {
+          disable_next_step=true;
+        }
+      }
+    }
+    else
+    {
+      if(results[current_question-1]=='')
+      {
+        disable_next_step=true;
+      }
+    }
+    obj = document.getElementById('inext_step');
+    obj.disabled=disable_next_step;
+    if(!disable_next_step)
+    {
+      prepare_results();
+    }
+  }
+
+
+
+</script>
+{/literal}
+
+<div class="mypolls_page">
+
+{if isset($datas.GENERIC_TEXT) and $datas.GENERIC_TEXT!=""}
+<p>{$datas.GENERIC_TEXT}</p>
+<hr/>
+{/if}
+
+<p>{$datas.DESCRIPTION}</p>
+
+<form method="post" action="" class="general" name="poll_form" id="poll_form">
+  <input type="hidden" name="fmypolls_results" id="iresults" value="">
+  <div id="display_questions">
+
+  </div>
+</form>
+
+</div>
+
+<script type="text/javascript">
+  load_poll_questions({$datas.FIRST_QUESTION});
+</script>
Index: /extensions/mypolls/templates/mypolls_public_question2.tpl
===================================================================
--- /extensions/mypolls/templates/mypolls_public_question2.tpl	(revision 3397)
+++ /extensions/mypolls/templates/mypolls_public_question2.tpl	(revision 3397)
@@ -0,0 +1,28 @@
+<!-- question's blocks -->
+
+{foreach from=$datas.question key=name item=question}
+  <fieldset  class="mypolls_page">
+    <legend>{"mypolls_cm_question"|@translate} #{$question.NUMQ}/{$question.NBQ}</legend>
+    <p>{$question.DESCRIPTION}</p>
+    <i>{"mypolls_cm_answer"|@translate}&nbsp;{$question.ANSNFO}</i>
+    <ol class="compact">
+    {foreach from=$question.answers key=qname item=qvalue}
+      <li><label>{$qvalue.INPUTFIELD}&nbsp;{$qvalue.ANSWER}</label></li>
+    {/foreach}
+    </ol>
+  </fieldset>
+{/foreach}
+
+{if isset($datas.NEXTQUESTION) and $datas.NEXTQUESTION!=""}
+  <input type="button" value="{"mypolls_next_question"|@translate}" id="inext_step"
+        onclick="load_poll_questions('{$datas.NEXTQUESTION}');">
+{/if}
+
+{if isset($datas.LASTQUESTION) and $datas.LASTQUESTION=='y'}
+  {if isset($datas.ALLOWCOMMENT) and $datas.ALLOWCOMMENT=='y'}
+    <p><br><i>{"mypolls_put_comment"|@translate}</i><br>
+    <textarea name="fmypolls_comment" rows=4 cols=80></textarea></p>
+  {/if}
+  <input type="submit" value="{'mypolls_submit_results'|@translate}" name="submit_results" id="inext_step" >
+{/if}
+
Index: /extensions/mypolls/templates/mypolls_public_results.tpl
===================================================================
--- /extensions/mypolls/templates/mypolls_public_results.tpl	(revision 3397)
+++ /extensions/mypolls/templates/mypolls_public_results.tpl	(revision 3397)
@@ -0,0 +1,96 @@
+
+{if isset($datas.AJAX_URL_POLL_COMMENT_LIST) and $datas.AJAX_URL_POLL_COMMENT_LIST!=""}
+{literal}
+  <script type="text/javascript">
+    function load_poll_comment_list(page)
+    {
+      var doc = document.getElementById("icomment_list");
+
+      {/literal}
+      http_request=create_httpobject('get', '', '{$datas.AJAX_URL_POLL_COMMENT_LIST}'+page, false);
+      {literal}
+      http_request.send(null);
+      doc.innerHTML = http_request.responseText;
+    }
+  </script>
+{/literal}
+{/if}
+
+
+
+<div class="mypolls_page">
+
+{if isset($datas.GENERIC_TEXT) and $datas.GENERIC_TEXT!=""}
+  <p>{$datas.GENERIC_TEXT}</p>
+  <hr/>
+{/if}
+
+<p>{$datas.DESCRIPTION}</p>
+
+{if isset($datas.AFTER_VOTE_TEXT) and $datas.AFTER_VOTE_TEXT!=""}
+  <hr/>
+  <p>{$datas.AFTER_VOTE_TEXT}</p>
+{/if}
+
+
+{if isset($datas.NOT_PUBLIC_RESULT_TEXT) and $datas.NOT_PUBLIC_RESULT_TEXT!=""}
+  <br>
+  <fieldset class="mypolls_page">
+  <div>{$datas.NOT_PUBLIC_RESULT_TEXT}</div>
+  </fieldset>
+{/if}
+
+
+{if isset($questions) and count($questions)}
+  {foreach from=$questions key=name item=question}
+    <fieldset class="formtable">
+      <legend>{'mypolls_cm_question'|@translate} #{$question.NUMQUESTION}</legend>
+        <p>{$question.DESCRIPTION}&nbsp;</p>
+        <ul class="compact">
+          <li>{'mypolls_att_question_type'|@translate}&nbsp;:&nbsp;{$question.QUESTION_TYPE}</li>
+        </ul>
+        <table class="table2 littlefont" width='100%'>
+          <tr class="throw">
+            <th colspan=2>{'mypolls_cm_answer'|@translate}</th>
+            {if $question.NBVOTES != ""}
+                <th width='10%'>{$question.NBVOTES}</th>
+            {/if}
+            <th colspan=2 width='{$question.MAXGRAPH}px'>{'mypolls_result_pct'|@translate}</th>
+          </tr>
+          {if isset($question.answers) and count($question.answers)}
+            {foreach from=$question.answers key=name3 item=answer}
+              <tr class="TableRow">
+                <td width='20px'>{$answer.NUMANSWER}</td>
+                <td>{$answer.ANSWER}</td>
+                {if $answer.NBANSWERS != ""}
+                    <td>{$answer.NBANSWERS}</td>
+                {/if}
+                <td>{$answer.PCT}</td>
+                <td>
+                  <div class='graphbarx' style='width:{$answer.MAXGRAPH}px'/>
+                  <div class='graphbar1' style='width:{$answer.GRAPH}px'/>
+                </td>
+              </tr>
+            {/foreach}
+          {/if}
+        </table>
+    </fieldset>
+  {/foreach}
+{/if}
+
+
+{if isset($datas.AJAX_URL_POLL_COMMENT_LIST) and $datas.AJAX_URL_POLL_COMMENT_LIST!=""}
+  <fieldset class="formtable">
+    <legend>{"mypolls_comment_list"|@translate}</legend>
+    <div id="icomment_list">
+    </div>
+  </fieldset>
+
+  <script type="text/javascript">
+    load_poll_comment_list(1);
+  </script>
+{/if}
+
+
+</div>
+
Index: /extensions/mypolls/templates/plugin_comment_list.tpl
===================================================================
--- /extensions/mypolls/templates/plugin_comment_list.tpl	(revision 3397)
+++ /extensions/mypolls/templates/plugin_comment_list.tpl	(revision 3397)
@@ -0,0 +1,23 @@
+{* used by public&admin interface *}
+
+{if isset($comment_list_rows) and count($comment_list_rows)}
+  <ul class=compact>
+    {foreach from=$comment_list_rows key=name item=comment_list_row}
+      <li class="TableRow">
+        {if $comment_list_row.display_delete == 'yes'}
+          <a style='cursor:pointer;float:right;'
+            onclick='poll_delete_comment("{$comment_list_row.ID}", {$comment_list_row.PAGE});'>
+            {'mypolls_delete_comment'|@translate}
+          </a>
+        {/if}
+        [{$comment_list_row.DATE}]&nbsp;<i>{$comment_list_row.USERNAME}</i>
+        <p>{$comment_list_row.COMMENT}</p>
+        <hr/>
+      </li>
+    {/foreach}
+  </ul>
+{/if}
+
+{if $datas.PAGES!=""}
+  {$datas.PAGES}
+{/if}
Index: /extensions/mypolls/templates/plugin_public_question.tpl
===================================================================
--- /extensions/mypolls/templates/plugin_public_question.tpl	(revision 3397)
+++ /extensions/mypolls/templates/plugin_public_question.tpl	(revision 3397)
@@ -0,0 +1,240 @@
+<!-- main page -->
+<script type="text/javascript">
+
+  var poll_id='{$block->data.ATT_ID}'; //set as a global variable
+  var results = new Array({$block->data.NBQUESTIONS});
+  var current_question = 0;
+
+  //format results (string)
+  function format_string(txt)
+  {
+    return('s:'+txt.length+':"'+txt+'";');
+  }
+  //format results (array)
+  function format_array(an_array)
+  {
+    result='a:'+an_array.length+':{';
+    for(i=0;i<an_array.length;i++)
+    {
+      result+='i:'+i+';'+an_array[i];
+    }
+    result+='}';
+
+    return(result);
+  }
+
+  //memorize answer's results
+  function memorise_result(question_num, result)
+  {
+    results[question_num] = result;
+  }
+
+  //prepare results into form
+  function prepare_results()
+  {
+    var objresult = document.getElementById("iresults");
+
+    objresult.value=format_array(results);
+  }
+
+  //load question(s)
+  function load_poll_questions(question_num)
+  {
+    var doc = document.getElementById('display_questions');
+
+    http_request=create_httpobject('get', '', '{$block->data.AJAX_URL_POLL_DETAIL}'+'&question='+question_num+'&lang={$block->data.LANG}', false);
+    http_request.send(null);
+    doc.innerHTML = http_request.responseText;
+    current_question=question_num;
+    if(question_num==0)
+    {
+      for(i=0;i<{$block->data.NBQUESTIONS};i++)
+      { results[i]=''; }
+    }
+    else
+    { results[question_num-1]=''; }
+
+    global_check();
+  }
+
+  /*
+    for multi answers, check that number of checked answers are not superior to maximal
+    and set result in results array
+  */
+  function check_multi(nbmax, names, qid)
+  {
+    var local_result=new Array();
+    var nbselected=0;
+  
+
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(document.forms['poll_form'].elements[i].checked)
+        {
+          local_result.push(format_string(document.forms['poll_form'].elements[i].id));
+          nbselected++;
+        }
+      }
+    }
+    //disabled/enabled unchecked elements 
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(!document.forms['poll_form'].elements[i].checked)
+        { document.forms['poll_form'].elements[i].disabled=(nbselected==nbmax); }
+      }
+    }
+
+    qid--;
+    if(nbselected==0)
+    {
+      results[qid]='';
+    }
+    else
+    {
+      results[qid]=format_array(local_result);
+    }
+    global_check();
+  }
+
+  /*
+    this function permit to test in <option> of a <select> element is enabled/disabled
+    if disabled, force choice to value "-" (index 0)
+    function needed because some browsers like IE don't implement this property...
+  */
+  function check_option_enabled(id)
+  {
+    var doc = document.getElementById(id);
+    if(doc.options[doc.selectedIndex].disabled==true)
+    {
+      doc.selectedIndex=0;
+    }
+  }
+
+  /*
+    for order answers, when order is selected on an answer, disabled this choice for
+    other answers and set result in results array
+  */
+  function check_order(names, qid, id)
+  {
+    var local_result = new Array();
+    var all_selected = true;
+
+    check_option_enabled(id);
+
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        local_result.push(format_string(document.forms['poll_form'].elements[i].id+'_'+document.forms['poll_form'].elements[i].selectedIndex));
+        if(document.forms['poll_form'].elements[i].selectedIndex==0)
+        { all_selected=false; }
+        for(k=1;k<document.forms['poll_form'].elements[i].options.length;k++)
+        {
+          document.forms['poll_form'].elements[i].options[k].disabled=false;
+          for(j=0;j<document.forms['poll_form'].elements.length;j++)
+          {
+            if((document.forms['poll_form'].elements[j].name==names)&&
+              (document.forms['poll_form'].elements[j].selectedIndex==k)&&
+              (i!=j))
+            {
+              document.forms['poll_form'].elements[i].options[k].disabled=true;
+            }
+          }
+        }
+      }
+    }
+
+    qid--;
+    if(all_selected==false)
+    {
+      results[qid]='';
+    }
+    else
+    {
+      results[qid]=format_array(local_result);
+    }
+    global_check();
+  }
+
+  /*
+    for mono answers set result in results array
+  */
+  function check_mono(names, qid)
+  {
+    var local_result = new Array();
+    for(i=0;i<document.forms['poll_form'].elements.length;i++)
+    {
+      if(document.forms['poll_form'].elements[i].name==names)
+      {
+        if(document.forms['poll_form'].elements[i].checked)
+        {
+          local_result[0]=format_string(document.forms['poll_form'].elements[i].id);
+        }
+      }
+    }
+    qid--;
+    results[qid]=format_array(local_result);
+    global_check();
+  }
+
+
+  /*
+    check all question and determine if disable or not the next step
+  */
+  function global_check()
+  {
+    disable_next_step=false;
+    if(current_question==0)
+    {
+      for(i=1;i<=results.length;i++)
+      {
+        if(results[i]=='')
+        {
+          disable_next_step=true;
+        }
+      }
+    }
+    else
+    {
+      if(results[current_question-1]=='')
+      {
+        disable_next_step=true;
+      }
+    }
+    obj = document.getElementById('inext_step');
+    obj.disabled=disable_next_step;
+    if(!disable_next_step)
+    {
+      prepare_results();
+    }
+  }
+
+
+
+</script>
+
+<div class="mypolls_page">
+
+{if isset($block->data.GENERIC_TEXT) and $block->data.GENERIC_TEXT!=""}
+<p>{mypolls_generic_text.GENERIC_TEXT}</p>
+<hr/>
+{/if}
+
+<p>{$block->data.DESCRIPTION}</p>
+
+<form method="post" action="" class="general" name="poll_form" id="poll_form">
+  <input type="hidden" name="fmypolls_results" id="iresults" value="">
+  <div id="display_questions">
+
+  </div>
+</form>
+
+</div>
+
+<script type="text/javascript">
+  load_poll_questions({$block->data.FIRST_QUESTION});
+</script>
Index: /extensions/mypolls/templates/plugin_public_question2.tpl
===================================================================
--- /extensions/mypolls/templates/plugin_public_question2.tpl	(revision 3397)
+++ /extensions/mypolls/templates/plugin_public_question2.tpl	(revision 3397)
@@ -0,0 +1,28 @@
+<!-- question's blocks -->
+
+<fieldset  class="mypolls_page">
+  <legend>{lang:mypolls_cm_question} #{mypolls_questions_block.NUMQ}/{mypolls_questions_block.NBQ}</legend>
+  <p>{mypolls_questions_block.DESCRIPTION}</p>
+  <i>{lang:mypolls_cm_answer}&nbsp;{mypolls_questions_block.ANSNFO}</i>
+  <ol class="compact">
+    <!-- BEGIN answers -->
+      <li><label>{mypolls_questions_block.answers.INPUTFIELD}&nbsp;{mypolls_questions_block.answers.ANSWER}</label></li>
+    <!-- END answers -->
+  </ol>
+</fieldset>
+<!-- END mypolls_questions_block -->
+
+
+<!-- BEGIN mypolls_next_question -->
+<input type="button" value="{lang:mypolls_next_question}" id="inext_step"
+        onclick="load_poll_questions('{mypolls_next_question.NEXTQUESTION}');">
+<!-- END mypolls_next_question -->
+
+<!-- BEGIN mypolls_last_question -->
+  <!-- BEGIN comment -->
+  <p><br><i>{lang:mypolls_put_comment}</i><br>
+  <textarea name="fmypolls_comment" rows=4 cols=80></textarea></p>
+  <!-- END comment -->
+<input type="submit" value="{lang:mypolls_submit_results}" name="submit_results" id="inext_step" >
+<!-- END mypolls_last_question -->
+
