aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xplugins/AMenuManager/admin/amm_admin.tpl13
-rw-r--r--plugins/AMenuManager/admin/amm_linksconfig.tpl108
-rw-r--r--plugins/AMenuManager/admin/amm_linkslist.tpl56
-rw-r--r--plugins/AMenuManager/admin/amm_linkslist_detail.tpl28
-rw-r--r--plugins/AMenuManager/admin/amm_linkslist_edit.tpl97
-rw-r--r--plugins/AMenuManager/admin/amm_sectionslist.tpl47
-rw-r--r--plugins/AMenuManager/admin/amm_sectionslist_detail.tpl24
-rw-r--r--plugins/AMenuManager/admin/go-down.pngbin0 -> 720 bytes
-rw-r--r--plugins/AMenuManager/admin/go-up.pngbin0 -> 630 bytes
-rwxr-xr-xplugins/AMenuManager/admin/index.php33
-rwxr-xr-xplugins/AMenuManager/admin/plugin_admin.php28
-rw-r--r--plugins/AMenuManager/amm.css4
-rw-r--r--plugins/AMenuManager/amm.sql25
-rwxr-xr-xplugins/AMenuManager/amm_aim.class.inc.php39
-rwxr-xr-xplugins/AMenuManager/amm_aip.class.inc.php642
-rw-r--r--plugins/AMenuManager/amm_install.class.inc.php84
-rw-r--r--plugins/AMenuManager/amm_pip.class.inc.php92
-rw-r--r--plugins/AMenuManager/amm_root.class.inc.php113
-rwxr-xr-xplugins/AMenuManager/index.php33
-rwxr-xr-xplugins/AMenuManager/language/en_UK/index.php33
-rwxr-xr-xplugins/AMenuManager/language/en_UK/plugin.lang.php58
-rwxr-xr-xplugins/AMenuManager/language/fr_FR/index.php33
-rwxr-xr-xplugins/AMenuManager/language/fr_FR/plugin.lang.php58
-rwxr-xr-xplugins/AMenuManager/language/index.php33
-rw-r--r--plugins/AMenuManager/links_pictures/internet-url.pngbin0 -> 828 bytes
-rw-r--r--plugins/AMenuManager/links_pictures/internet.pngbin0 -> 844 bytes
-rwxr-xr-xplugins/AMenuManager/main.inc.php66
-rwxr-xr-xplugins/AMenuManager/maintain.inc.php66
-rw-r--r--plugins/AMenuManager/menu_templates/menubar_links.tpl16
-rwxr-xr-xplugins/grum_plugins_classes-2/ajax.class.inc.php56
-rwxr-xr-xplugins/grum_plugins_classes-2/ajax.js104
-rwxr-xr-xplugins/grum_plugins_classes-2/common_plugin.class.inc.php209
-rwxr-xr-xplugins/grum_plugins_classes-2/css.class.inc.php76
-rwxr-xr-xplugins/grum_plugins_classes-2/genericjs.class.inc.php41
-rwxr-xr-xplugins/grum_plugins_classes-2/genericjs.js49
-rwxr-xr-xplugins/grum_plugins_classes-2/google_translate.js47
-rwxr-xr-xplugins/grum_plugins_classes-2/index.php33
-rwxr-xr-xplugins/grum_plugins_classes-2/main.inc.php50
-rwxr-xr-xplugins/grum_plugins_classes-2/maintain.inc.php26
-rwxr-xr-xplugins/grum_plugins_classes-2/pages_navigation.class.inc.php294
-rwxr-xr-xplugins/grum_plugins_classes-2/public_integration.class.inc.php202
-rwxr-xr-xplugins/grum_plugins_classes-2/tables.class.inc.php447
-rwxr-xr-xplugins/grum_plugins_classes-2/translate.class.inc.php192
-rwxr-xr-xplugins/grum_plugins_classes-2/users_groups.class.inc.php290
-rwxr-xr-xplugins/test_menu/index.php33
-rwxr-xr-xplugins/test_menu/main.inc.php53
-rw-r--r--plugins/test_menu/maintain.inc.php44
-rw-r--r--plugins/test_menu/menu.class.inc.php500
-rw-r--r--plugins/test_menu/menu_templates/menubar.tpl165
-rw-r--r--plugins/test_menu/menu_templates/menubar_categories.tpl24
-rw-r--r--plugins/test_menu/menu_templates/menubar_generic.tpl10
-rw-r--r--plugins/test_menu/menu_templates/menubar_identification.tpl67
-rw-r--r--plugins/test_menu/menu_templates/menubar_links.tpl17
-rw-r--r--plugins/test_menu/menu_templates/menubar_main.tpl15
-rw-r--r--plugins/test_menu/menu_templates/menubar_menu.tpl17
-rw-r--r--plugins/test_menu/menu_templates/menubar_special.tpl10
-rw-r--r--plugins/test_menu/menu_templates/menubar_tags.tpl19
-rw-r--r--plugins/test_menu/menubar.inc.php288
58 files changed, 5207 insertions, 0 deletions
diff --git a/plugins/AMenuManager/admin/amm_admin.tpl b/plugins/AMenuManager/admin/amm_admin.tpl
new file mode 100755
index 000000000..313937722
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_admin.tpl
@@ -0,0 +1,13 @@
+<div class="titrePage">
+ <h2 style="position:absolute;right:0px;top:32px;height:auto;font-size:12px;font-weight:normal;">:: {$plugin.AMM_VERSION} ::</h2>
+ <h2>{'g002_title_page'|@translate} <span style="font-size:-1;font-weight:normal;">{$TABSHEET_TITLE}</span></h2>
+
+ {$tabsheet}
+</div>
+
+{if isset($page_nfo)}
+<p>{$page_nfo}</p>
+{/if}
+
+{$AMM_BODY_PAGE}
+
diff --git a/plugins/AMenuManager/admin/amm_linksconfig.tpl b/plugins/AMenuManager/admin/amm_linksconfig.tpl
new file mode 100644
index 000000000..55ee8b6a0
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_linksconfig.tpl
@@ -0,0 +1,108 @@
+{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('iamm_links_title');
+ var objinput = new Array(); //input text from form => objinput[name]
+ var objhidden = new Array(); //input hidden from form => objhidden[name][lang]
+
+ 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}
+
+
+
+<h3><span style="font-weight:normal"><a href="{$datas.lnk_list}" title="{'g002_configlinks'|@translate}">{'g002_linkslist'|@translate} </span></a> / {'g002_configlinks'|@translate}
+</h3>
+
+
+<form method="post" action="" class="general">
+ <fieldset>
+ <legend>{'g002_setting_link_block_menu'|@translate}</legend>
+
+ {if isset($datas.language_list) and count($datas.language_list)}
+ {foreach from=$datas.language_list key=name item=language_row}
+ <input type="hidden" name="famm_links_title_{$language_row.LANG}"
+ id="iamm_links_title_{$language_row.LANG}" value="{$language_row.MENUBARTIT}">
+ {/foreach}
+ {/if}
+
+ <table class="formtable">
+ <tr>
+ <td>{'g002_setting_link_block_active'|@translate}</td>
+ <td>
+ <select name="famm_links_active" id="iamm_links_active">
+ {html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.active_selected}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_setting_link_block_title'|@translate}</td>
+ <td>
+ <input type="text" id="iamm_links_title" value="" maxlength="50" onkeyup="apply_changes('iamm_links_title');" />
+ <select onchange="change_lang();" id="islang">
+ {html_options values=$datas.language_list_values output=$datas.language_list_labels selected=$datas.lang_selected}
+ </select>
+ </td>
+ </tr>
+
+ </table>
+
+
+ </fieldset>
+
+ <fieldset>
+ <legend>{'g002_setting_link_links'|@translate}</legend>
+ <table class="formtable">
+ <tr>
+ <td>{'g002_setting_link_show_icon'|@translate}</td>
+ <td>
+ <select name="famm_links_show_icons" id="iamm_links_show_icons">
+ {html_options values=$datas.yesno_values output=$datas.yesno_labels selected=$datas.show_icons_selected}
+ </select>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <p>
+ <input type="submit" name="famm_submit_apply" id="iamm_submit_apply" value="{'g002_apply'|@translate}" >
+ </p>
+
+ <input type="hidden" name="famm_modeedit" value="config">
+
+</form>
+
+<script type="text/javascript">
+ init();
+ change_lang();
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_linkslist.tpl b/plugins/AMenuManager/admin/amm_linkslist.tpl
new file mode 100644
index 000000000..1b197c8b4
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_linkslist.tpl
@@ -0,0 +1,56 @@
+{literal}
+<script type="text/javascript">
+
+ function load_list(do_action, item, permut)
+ {
+ /*
+ do_action
+ 'list' : just load list
+ 'permut' : permut items in list
+ 'delete' : delete the item in list
+ */
+ var doc = document.getElementById("iurls");
+
+ action_todo='';
+ if(do_action=='permut')
+ {
+ action_todo='links_permut&fItem='+item+'&fPermut='+permut;
+ }
+ else if(do_action=='delete')
+ {
+ if(confirm('{/literal}{'g002_confirm_delete_link'|@translate}{literal}'))
+ {
+ action_todo='links_delete&fItem='+item;
+ }
+ }
+ else
+ {
+ action_todo='links_list';
+ }
+
+ if(action_todo!='')
+ {
+ http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
+ http_request.send(null);
+ doc.innerHTML=http_request.responseText;
+ }
+ }
+
+</script>
+{/literal}
+
+
+<h3>{'g002_linkslist'|@translate} / <span style="font-weight:normal"><a href="{$datas.lnk_config}" title="{'g002_configlinks'|@translate}">{'g002_configlinks'|@translate}</a></span>
+</h3>
+
+[{$datas.nburl}]<br/>
+<a href="{$datas.lnk_create}" title="{'g002_addlink'|@translate}">{'g002_addlink'|@translate}</a>
+
+<br/>
+
+<div id="iurls"></div>
+
+
+<script type="text/javascript">
+ load_list('list', 0, 0);
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_linkslist_detail.tpl b/plugins/AMenuManager/admin/amm_linkslist_detail.tpl
new file mode 100644
index 000000000..e97c0ff07
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_linkslist_detail.tpl
@@ -0,0 +1,28 @@
+
+{if isset($datas.urls) and count($datas.urls)}
+ <table class="table2 littlefont">
+ <tr class="throw">
+ <th width='15'>&nbsp;</th>
+ <th>{'g002_label'|@translate}</th>
+ <th>{'g002_url'|@translate}</th>
+ <th>{'g002_mode'|@translate}</th>
+ <th>{'g002_visible'|@translate}</th>
+ <th colspan=4>&nbsp;</th>
+ </tr>
+
+ {foreach from=$datas.urls key=name item=url}
+ <tr>
+ <td>{if $url.img!=""}<img src='{$url.img}'/>{else}&nbsp;{/if}</td>
+ <td>{$url.label}</td>
+ <td>{$url.url}</td>
+ <td>{$url.mode}</td>
+ <td style="text-align:center;">{$url.visible}</td>
+ <td width="15px">{if $url.up}<a style="cursor:pointer;" onclick="load_list('permut', {$url.ID}, {$url.IDPREV})"><img src='{$plugin.PATH}/admin/go-up.png'/></a>{else}&nbsp;{/if}</td>
+ <td width="15px">{if $url.down}<a style="cursor:pointer;" onclick="load_list('permut', {$url.ID}, {$url.IDNEXT})"><img src='{$plugin.PATH}/admin/go-down.png'/></a>{else}&nbsp;{/if}</td>
+ <td width="15px"><a href="{$url.edit}"><img src='{$themeconf.icon_dir}/category_edit.png'/></a></td>
+ <td width="15px"><a style="cursor:pointer;" onclick="load_list('delete', {$url.ID}, 0)"><img src='{$themeconf.icon_dir}/delete.png'/></a></td>
+ </tr>
+ {/foreach}
+
+ </table>
+{/if}
diff --git a/plugins/AMenuManager/admin/amm_linkslist_edit.tpl b/plugins/AMenuManager/admin/amm_linkslist_edit.tpl
new file mode 100644
index 000000000..0cf874dc2
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_linkslist_edit.tpl
@@ -0,0 +1,97 @@
+{literal}
+<script type="text/javascript">
+
+ function change_selected_icon()
+ {
+ var doc = document.getElementById("iamm_icon");
+
+ var icon_list = Array();
+
+ {/literal}
+ {foreach from=$datas.icons_values key=name item=icon}
+ icon_list.push('{$icon.img}');
+ {/foreach}
+ {literal}
+
+ doc.style.backgroundImage='url('+icon_list[doc.options.selectedIndex]+')';
+ }
+
+</script>
+{/literal}
+
+
+{if isset($datas.modeedit)}
+
+ <h3>
+ {if $datas.modeedit=='create'}
+ {'g002_createoflink'|@translate}
+ {else}
+ {'g002_editoflink'|@translate}
+ {/if}
+ / <span style="font-weight:normal"><a href="{$datas.lnk_list}">{'g002_linkslist'|@translate}</a></span></h3>
+ </h3>
+
+ <form method="post" action="" class="general">
+ <fieldset>
+ <table class="formtable">
+ <tr>
+ <td>{'g002_label'|@translate}<td>
+ <td><input type='text' name="famm_label" id='iamm_label' value='{$datas.label}' maxlength=50 size=50></td>
+ </tr>
+
+ <tr>
+ <td>{'g002_url'|@translate}<td>
+ <td><input type='text' name="famm_url" id='iamm_url' value='{$datas.url}' maxlength=255 size=50></td>
+ </tr>
+
+ <tr>
+ <td>{'g002_icon'|@translate}<td>
+ <td>
+ <select name="famm_icon" id="iamm_icon" onchange="change_selected_icon();" style="background-image:url('{$datas.icons_img}');background-position:2px 1px;background-repeat:no-repeat;padding-left:18px;">
+ {foreach from=$datas.icons_values key=name item=icon}
+ <option value="{$icon.value}" style="background: transparent url('{$icon.img}') no-repeat scroll 0px 0px;padding-left:20px;" {if $icon.value==$datas.icons_selected}selected{/if}>{$icon.label}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_mode'|@translate}<td>
+ <td>
+ <select name="famm_mode" id="iamm_mode">
+ {html_options values=$datas.mode_values output=$datas.mode_labels selected=$datas.mode_selected}
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>{'g002_visible'|@translate}<td>
+ <td>
+ <select name="famm_visible" id="iamm_visible">
+ {html_options values=$datas.visible_values output=$datas.visible_labels selected=$datas.visible_selected}
+ </select>
+ </td>
+ </tr>
+
+ </table>
+ </fieldset>
+
+
+ {if $datas.modeedit=='create'}
+ <p>
+ <input type="submit" name="famm_submit_create" id="iamm_submit_create" value="{'g002_createthelink'|@translate}" >
+ </p>
+ {/if}
+
+ {if $datas.modeedit=='modify'}
+ <p>
+ <input type="submit" name="famm_submit_modify" id="iamm_submit_modify" value="{'g002_editthelink'|@translate}" >
+ </p>
+ {/if}
+
+ <input type="hidden" name="famm_modeedit" value="{$datas.modeedit}">
+ <input type="hidden" name="famm_id" value="{$datas.id}">
+
+ </form>
+
+{/if} \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_sectionslist.tpl b/plugins/AMenuManager/admin/amm_sectionslist.tpl
new file mode 100644
index 000000000..b9b49b074
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_sectionslist.tpl
@@ -0,0 +1,47 @@
+{literal}
+<script type="text/javascript">
+
+ function load_list(do_action, item, position)
+ {
+ /*
+ do_action
+ 'list' : just load list
+ 'permut' : permut items in list
+ 'delete' : delete the item in list
+ */
+ var doc = document.getElementById("isections");
+
+ action_todo='';
+ if(do_action=='position')
+ {
+ action_todo='sections_position&fItem='+item+'&fPosition='+position;
+ }
+ else if(do_action=='showhide')
+ {
+ action_todo='sections_showhide&fItem='+item;
+ }
+ else
+ {
+ action_todo='sections_list';
+ }
+
+ if(action_todo!='')
+ {
+ http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false);
+ http_request.send(null);
+ doc.innerHTML=http_request.responseText;
+ }
+ }
+
+</script>
+{/literal}
+
+
+<h3>{'g002_sectionslist'|@translate}</h3>
+
+<div id="isections"></div>
+
+
+<script type="text/javascript">
+ load_list('list', 0, 0);
+</script> \ No newline at end of file
diff --git a/plugins/AMenuManager/admin/amm_sectionslist_detail.tpl b/plugins/AMenuManager/admin/amm_sectionslist_detail.tpl
new file mode 100644
index 000000000..b94258119
--- /dev/null
+++ b/plugins/AMenuManager/admin/amm_sectionslist_detail.tpl
@@ -0,0 +1,24 @@
+
+{if isset($datas.sections) and count($datas.sections)}
+ <table class="table2 littlefont">
+ <tr class="throw">
+ <th>{'g002_owner'|@translate}</th>
+ <th>{'g002_sectionid'|@translate}</th>
+ <th>{'g002_name'|@translate}</th>
+ <th>{'g002_visible'|@translate}</th>
+ <th colspan=2>&nbsp;</th>
+ </tr>
+
+ {foreach from=$datas.sections key=name item=section}
+ <tr>
+ <td>{$section.OWNER}</td>
+ <td>{$section.ID}</td>
+ <td>{$section.NAME}</td>
+ <td style="text-align:center;"><a style="cursor:pointer;" onclick="load_list('showhide', '{$section.ID}', '')">{$section.VISIBLE}</a></td>
+ <td width="15px">{if $section.up}<a style="cursor:pointer;" onclick="load_list('position', '{$section.ID}', '{$section.PREVPOS}')"><img src='{$plugin.PATH}/admin/go-up.png'/></a>{else}&nbsp;{/if}</td>
+ <td width="15px">{if $section.down}<a style="cursor:pointer;" onclick="load_list('position', '{$section.ID}', '{$section.NEXTPOS}')"><img src='{$plugin.PATH}/admin/go-down.png'/></a>{else}&nbsp;{/if}</td>
+ </tr>
+ {/foreach}
+
+ </table>
+{/if}
diff --git a/plugins/AMenuManager/admin/go-down.png b/plugins/AMenuManager/admin/go-down.png
new file mode 100644
index 000000000..7eeb16d2e
--- /dev/null
+++ b/plugins/AMenuManager/admin/go-down.png
Binary files differ
diff --git a/plugins/AMenuManager/admin/go-up.png b/plugins/AMenuManager/admin/go-up.png
new file mode 100644
index 000000000..bd84e76ad
--- /dev/null
+++ b/plugins/AMenuManager/admin/go-up.png
Binary files differ
diff --git a/plugins/AMenuManager/admin/index.php b/plugins/AMenuManager/admin/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/AMenuManager/admin/index.php
@@ -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();
+?>
diff --git a/plugins/AMenuManager/admin/plugin_admin.php b/plugins/AMenuManager/admin/plugin_admin.php
new file mode 100755
index 000000000..4669ac5b2
--- /dev/null
+++ b/plugins/AMenuManager/admin/plugin_admin.php
@@ -0,0 +1,28 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include(AMM_PATH."amm_aip.class.inc.php");
+
+global $prefixeTable;
+
+load_language('plugin.lang', AMM_PATH);
+
+$main_plugin_object = get_plugin_data($plugin_id);
+
+$plugin_ai = new AMM_AIP($prefixeTable, $main_plugin_object->get_filelocation());
+$plugin_ai->manage();
+
+?> \ No newline at end of file
diff --git a/plugins/AMenuManager/amm.css b/plugins/AMenuManager/amm.css
new file mode 100644
index 000000000..1293d87ca
--- /dev/null
+++ b/plugins/AMenuManager/amm.css
@@ -0,0 +1,4 @@
+
+.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; }
diff --git a/plugins/AMenuManager/amm.sql b/plugins/AMenuManager/amm.sql
new file mode 100644
index 000000000..ab9c2f2b1
--- /dev/null
+++ b/plugins/AMenuManager/amm.sql
@@ -0,0 +1,25 @@
+
+-- *************************************************************** -- EOQ
+-- * SQL export made with Grum Plugins Classes (Export tool r1.3) -- EOQ
+-- * Export date :2008-08-02 02:51:37 -- EOQ
+-- * Export options : [drop] [create] [insert] -- EOQ
+-- *************************************************************** -- EOQ
+
+
+
+-- *************************************************************** -- EOQ
+-- * Statements for piwigo_amm_urls table -- EOQ
+-- *************************************************************** -- EOQ
+DROP TABLE `piwigo_amm_urls`; -- EOQ
+CREATE TABLE `piwigo_amm_urls` (
+ `id` int(11) NOT NULL auto_increment,
+ `label` varchar(50) NOT NULL default '',
+ `url` varchar(255) NOT NULL default '',
+ `mode` int(11) NOT NULL default '0',
+ `icon` varchar(50) NOT NULL default '',
+ `position` int(11) NOT NULL default '0',
+ `visible` char(1) NOT NULL default 'y',
+ PRIMARY KEY (`id`),
+ KEY `order_key` (`position`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- EOQ
+INSERT INTO `piwigo_amm_urls` VALUES('1', 'Test', 'http://192.168.1.1', '0', 'internet.png', '0', 'y'); -- EOQ
diff --git a/plugins/AMenuManager/amm_aim.class.inc.php b/plugins/AMenuManager/amm_aim.class.inc.php
new file mode 100755
index 000000000..0556fd6b1
--- /dev/null
+++ b/plugins/AMenuManager/amm_aim.class.inc.php
@@ -0,0 +1,39 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ AMM_AIM : classe to manage plugin integration into plugin menu
+
+ --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once('amm_root.class.inc.php');
+
+class AMM_AIM extends AMM_root
+{
+ function AMM_AIM($prefixeTable, $filelocation)
+ {
+ parent::__construct($prefixeTable, $filelocation);
+ }
+
+ /*
+ initialize events call for the plugin
+ */
+ function init_events()
+ {
+ add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
+ }
+
+} // amm_aim class
+
+
+?>
diff --git a/plugins/AMenuManager/amm_aip.class.inc.php b/plugins/AMenuManager/amm_aip.class.inc.php
new file mode 100755
index 000000000..de0901eac
--- /dev/null
+++ b/plugins/AMenuManager/amm_aip.class.inc.php
@@ -0,0 +1,642 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ AIP classe => manage integration in administration interface
+
+ --------------------------------------------------------------------------- */
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.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');
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php');
+
+class AMM_AIP extends AMM_root
+{
+ protected $tabsheet;
+ protected $css; //the css object
+ protected $ajax;
+
+ protected $urls_modes=array(0 => 'new_window', 1 => 'current_window');
+
+ function AMM_AIP($prefixeTable, $filelocation)
+ {
+ parent::__construct($prefixeTable, $filelocation);
+
+ $this->load_config();
+ $this->init_events();
+
+ $this->tabsheet = new tabsheet();
+ $this->tabsheet->add('setmenu',
+ l10n('g002_setmenu'),
+ $this->page_link.'&amp;fAMM_tabsheet=setmenu');
+ $this->tabsheet->add('links',
+ l10n('g002_addlinks'),
+ $this->page_link.'&amp;fAMM_tabsheet=links');
+ $this->tabsheet->add('randompict',
+ l10n('g002_randompict'),
+ $this->page_link.'&amp;fAMM_tabsheet=randompict');
+ $this->tabsheet->add('personnalblock',
+ l10n('g002_personnalblock'),
+ $this->page_link.'&amp;fAMM_tabsheet=personnalblock');
+ $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
+ $this->ajax = new Ajax();
+ }
+
+
+ /* ---------------------------------------------------------------------------
+ Public classe functions
+ --------------------------------------------------------------------------- */
+
+ /*
+ manage plugin integration into piwigo's admin interface
+ */
+ public function manage()
+ {
+ global $template;
+
+
+ $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/amm_admin.tpl");
+
+ $this->return_ajax_content();
+
+ $this->init_request();
+
+ $this->tabsheet->select($_REQUEST['fAMM_tabsheet']);
+ $this->tabsheet->assign();
+ $selected_tab=$this->tabsheet->get_selected();
+ $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
+
+ $template_plugin["AMM_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('g002_version').AMM_VERSION;
+ $template_plugin["AMM_PAGE"] = $_REQUEST['fAMM_tabsheet'];
+ $template_plugin["PATH"] = AMM_PATH;
+
+ $template->assign('plugin', $template_plugin);
+
+
+ if(isset($_POST['famm_modeedit']))
+ {
+ $post_action=$_POST['famm_modeedit'];
+ }
+ else
+ {
+ $post_action="";
+ }
+
+ $page_nfo="";
+ if($_REQUEST['fAMM_tabsheet']=='links')
+ {
+ $page_nfo=l10n('g002_addlinks_nfo');
+
+ switch($_REQUEST['action'])
+ {
+ case 'list':
+ $this->display_links_list_page();
+ break;
+ case 'create':
+ case 'modify':
+ if($post_action==$_REQUEST['action'])
+ {
+ if(!$this->adviser_abort())
+ {
+ $this->action_create_modify_url();
+ }
+ $this->display_links_list_page();
+ }
+ else
+ {
+ $this->display_links_manage_page($_REQUEST['action']);
+ }
+ break;
+ case 'config':
+ if($post_action==$_REQUEST['action'])
+ {
+ if(!$this->adviser_abort())
+ {
+ $this->action_modify_config();
+ }
+ }
+ $this->display_links_config_page();
+ break;
+ }
+ }
+ elseif($_REQUEST['fAMM_tabsheet']=='randompict')
+ {
+ $page_nfo=l10n('g002_randompict_nfo');
+ }
+ elseif($_REQUEST['fAMM_tabsheet']=='personnalblock')
+ {
+ $page_nfo=l10n('g002_personnalblock_nfo');
+ }
+ elseif($_REQUEST['fAMM_tabsheet']=='setmenu')
+ {
+ $page_nfo=l10n('g002_setmenu_nfo');
+ $this->display_sections_list_page();
+ }
+
+ $template->assign('page_nfo', $page_nfo);
+
+ $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+ }
+
+ /*
+ initialize events call for the plugin
+ */
+ public function init_events()
+ {
+ add_event_handler('menubar_file', array(&$this, 'plugin_public_menu') );
+ add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
+ }
+
+ /* ---------------------------------------------------------------------------
+ Private classe functions
+ --------------------------------------------------------------------------- */
+
+ /*
+ return ajax content
+ */
+ protected function return_ajax_content()
+ {
+ global $ajax, $template;
+
+ if(isset($_REQUEST['ajaxfct']))
+ {
+ //$this->debug("AJAXFCT:".$_REQUEST['ajaxfct']);
+ $result="<p class='errors'>".l10n('g002_error_invalid_ajax_call')."</p>";
+ switch($_REQUEST['ajaxfct'])
+ {
+ case 'links_list':
+ $result=$this->ajax_amm_links_list();
+ break;
+ case 'links_permut':
+ $result=$this->ajax_amm_links_permut($_REQUEST['fItem'], $_REQUEST['fPermut']);
+ break;
+ case 'links_delete':
+ $result=$this->ajax_amm_links_delete($_REQUEST['fItem']);
+ break;
+ case 'sections_list':
+ $result=$this->ajax_amm_section_list();
+ break;
+ case 'sections_position':
+ $result=$this->ajax_amm_section_position($_REQUEST['fItem'], $_REQUEST['fPosition']);
+ break;
+ case 'sections_showhide':
+ $result=$this->ajax_amm_section_showhide($_REQUEST['fItem']);
+ break;
+ }
+ //$template->
+ $this->ajax->return_result($result);
+ }
+ }
+
+ /*
+ if empty, initialize $_request
+ */
+ private function init_request()
+ {
+ //initialise $REQUEST values if not defined
+ if(!array_key_exists('fAMM_tabsheet', $_REQUEST))
+ {
+ $_REQUEST['fAMM_tabsheet']='setmenu';
+ }
+
+ if(($_REQUEST['fAMM_tabsheet']=='links') and !isset($_REQUEST['action']))
+ {
+ $_REQUEST['action']='list';
+ }
+
+
+ } //init_request
+
+
+ /*
+ manage display for urls table page
+ */
+ private function display_links_list_page()
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_linkslist.tpl');
+
+ $tmp=$this->get_count_url();
+ if($tmp==0)
+ {
+ $tmp=l10n("g002_nolinks");
+ }
+ elseif($tmp==1)
+ {
+ $tmp="1 ".l10n("g002_link");
+ }
+ else
+ {
+ $tmp=$tmp." ".l10n("g002_links");
+ }
+
+
+ $template_datas=array(
+ 'lnk_create' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=create',
+ 'lnk_config' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=config',
+ 'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
+ 'nburl' => $tmp
+ );
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+ /*
+ manage display for urls config page
+ */
+ private function display_links_config_page()
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_linksconfig.tpl');
+
+ $template_datas=array(
+ 'lnk_list' => $this->page_link.'&amp;fAMM_tabsheet=links',
+ 'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
+ 'show_icons_selected' => $this->my_config['amm_links_show_icons'],
+ 'active_selected' => $this->my_config['amm_links_active'],
+ 'lang_selected' => $user['language']
+ );
+
+ $template_datas['language_list'] = array();
+ foreach($this->my_config['amm_links_title'] as $key => $val)
+ {
+ $template_datas['language_list'][] = array(
+ 'LANG' => $key,
+ 'MENUBARTIT' => base64_decode($val)
+ );
+ }
+
+
+
+ $lang=get_languages();
+ foreach($lang as $key => $val)
+ {
+ $template_datas['language_list_values'][] = $key;
+ $template_datas['language_list_labels'][] = $val;
+ }
+
+
+ $template_datas['yesno_values'] = array('y','n');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_y');
+ $template_datas['yesno_labels'][] = l10n('g002_yesno_n');
+
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+ /*
+ manage display for urls create/modify page
+ */
+ private function display_links_manage_page($modeedit = 'create', $urlid=0)
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_linkslist_edit.tpl');
+
+ $extensions_list=array('jpg'=>0,'jpeg'=>0,'gif'=>0,'png'=>0);
+ $template_icons_list=array();
+ $directory=dir(dirname($this->filelocation).'/links_pictures/');
+ while($file=$directory->read())
+ {
+ if(isset($extensions_list[get_extension(strtolower($file))]))
+ {
+ $template_icons_list[]=$file;
+ }
+ }
+
+
+ if($modeedit=='modify')
+ {
+ $url=$this->get_url($urlid);
+
+ $template_datas=array(
+ 'id' => $urlid,
+ 'modeedit' => 'modify',
+ 'label' => $url['label'],
+ 'url' => $url['url'],
+ 'icons_selected' => $url['icon'],
+ 'mode_selected' => $url['mode'],
+ 'visible_selected' => $url['visible']
+ );
+ }
+ else
+ {
+ $template_datas=array(
+ 'id' => '',
+ 'modeedit' => 'create',
+ 'label' => '',
+ 'url' => '',
+ 'icons_selected' => $template_icons_list[0],
+ 'mode_selected' => 0,
+ 'visible_selected' => 'y'
+ );
+ }
+
+ $template_datas['lnk_list'] = $this->page_link.'&amp;fAMM_tabsheet=links';
+ $template_datas['icons_img'] = AMM_PATH."links_pictures/".$template_datas['icons_selected'];
+ $template_datas['icons_values'] = array();
+ foreach($template_icons_list as $key => $val)
+ {
+ $template_datas['icons_values'][] = array(
+ 'img' => AMM_PATH."links_pictures/".$val,
+ 'value' => $val,
+ 'label' => $val
+ );
+ }
+ $template_datas['mode_values'] = array(0,1);
+ $template_datas['mode_labels'][] = l10n("g002_mode_".$this->urls_modes[0]);
+ $template_datas['mode_labels'][] = l10n("g002_mode_".$this->urls_modes[1]);
+ $template_datas['visible_values'] = array('y','n');
+ $template_datas['visible_labels'][] = l10n('g002_yesno_y');
+ $template_datas['visible_labels'][] = l10n('g002_yesno_n');
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+ /*
+ manage create/modify url into database and display result
+ */
+ protected function action_create_modify_url()
+ {
+ $datas=array(
+ 'id' => $_POST['famm_id'],
+ 'label' => $_POST['famm_label'],
+ 'url' => $_POST['famm_url'],
+ 'mode' => $_POST['famm_mode'],
+ 'icon' => $_POST['famm_icon'],
+ 'position' => 0,
+ 'visible' => $_POST['famm_visible']
+ );
+
+ switch($_POST['famm_modeedit'])
+ {
+ case 'create':
+ $this->add_url($datas);
+ break;
+ case 'modify':
+ $this->modify_url($datas);
+ }
+ }
+
+ /*
+ manage urls config save into database
+ */
+ protected function action_modify_config()
+ {
+ $this->my_config['amm_links_show_icons']=$_POST['famm_links_show_icons'];
+ $this->my_config['amm_links_active']=$_POST['famm_links_active'];
+ $languages=get_languages();
+ foreach($languages as $key => $val)
+ {
+ $this->my_config['amm_links_title'][$key]=base64_encode(stripslashes($_POST['famm_links_title_'.$key]));
+ }
+ $this->save_config();
+ }
+
+ /*
+ manage display for sections table page
+ */
+ private function display_sections_list_page()
+ {
+ global $template, $user;
+ $template->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_sectionslist.tpl');
+
+ $template_datas=array(
+ 'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=",
+ );
+
+ $template->assign("datas", $template_datas);
+ $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page');
+ }
+
+
+
+
+
+ /*
+ manage adviser profile
+ return true if user is adviser
+ */
+ protected function adviser_abort()
+ {
+ if(is_adviser())
+ {
+ $this->display_result(l10n("g002_adviser_not_allowed"), false);
+ return(true);
+ }
+ return(false);
+ }
+
+ /* ---------------------------------------------------------------------------
+ functions to manage urls tables
+ --------------------------------------------------------------------------- */
+ // protected function get_urls()
+ // protected function get_count_url()
+ // => defined in root class
+
+ // return properties of an given url
+ private function get_url($url_id)
+ {
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['urls']." WHERE id = '".$url_id."'";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $returned=mysql_fetch_array($result);
+ }
+ return($returned);
+ }
+
+ // permut position of two 2 urls
+ private function permut_url($url_id, $url_permut)
+ {
+ $sql="SELECT id, position FROM ".$this->tables['urls']." WHERE id IN ('".$url_id."','".$url_permut."')";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $tmp=array();
+ while($row=mysql_fetch_array($result))
+ {
+ $tmp[$row['id']]=$row['position'];
+ }
+ $sql="UPDATE ".$this->tables['urls']." SET position = ".$tmp[$url_id]." WHERE id = '".$url_permut."'";
+ pwg_query($sql);
+ $sql="UPDATE ".$this->tables['urls']." SET position = ".$tmp[$url_permut]." WHERE id = '".$url_id."'";
+ pwg_query($sql);
+ }
+ }
+
+ // delete an url
+ private function delete_url($url_id)
+ {
+ $sql="DELETE FROM ".$this->tables['urls']." WHERE id = '".$url_id."' ";
+ return(pwg_query($sql));
+ }
+
+ // add an url
+ private function add_url($datas)
+ {
+ $numurl=$this->get_count_url();
+ $sql="INSERT INTO ".$this->tables['urls']." (id, label, url, mode, icon, position, visible)
+ VALUES ('', '".addslashes($datas['label'])."', '".$datas['url']."', '".$datas['mode']."',
+ '".$datas['icon']."', '".$numurl."', '".$datas['visible']."')";
+ return(pwg_query($sql));
+ }
+
+ // modify an url
+ private function modify_url($datas)
+ {
+ $sql="UPDATE ".$this->tables['urls']." SET label = '".addslashes($datas['label'])."',
+ url = '".$datas['url']."', mode = '".$datas['mode']."', icon = '".$datas['icon']."',
+ visible = '".$datas['visible']."'
+ WHERE id = '".$datas['id']."'";
+ return(pwg_query($sql));
+ }
+
+ // just modify url visibility
+ private function set_url_visibility($urlid, $visible)
+ {
+ $sql="UPDATE ".$this->tables['urls']." SET visible = '".$visible."'
+ WHERE id = '".$urlid."'";
+ return(pwg_query($sql));
+ }
+
+
+ /* ---------------------------------------------------------------------------
+ ajax functions
+ --------------------------------------------------------------------------- */
+
+ // return a html formatted list of urls
+ private function ajax_amm_links_list()
+ {
+ global $template, $user;
+ $local_tpl = new Template(AMM_PATH."admin/", "");
+ $local_tpl->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_linkslist_detail.tpl');
+
+ $template_datas['urls']=array();
+ $urls=$this->get_urls();
+ for($i=0;$i<count($urls);$i++)
+ {
+ $template_datas['urls'][]=array(
+ 'img' => AMM_PATH."links_pictures/".$urls[$i]['icon'],
+ 'label' => $urls[$i]['label'],
+ 'url' => $urls[$i]['url'],
+ 'mode' => l10n("g002_mode_".$this->urls_modes[$urls[$i]['mode']]),
+ 'up' => ($i==0)?false:true,
+ 'down' => ($i<(count($urls)-1))?true:false,
+ 'edit' => $this->page_link.'&amp;fAMM_tabsheet=links&amp;action=modify&amp;fItem='.$urls[$i]['id'],
+ 'ID' => $urls[$i]['id'],
+ 'IDPREV' => ($i==0)?0:$urls[$i-1]['id'],
+ 'IDNEXT' => ($i<(count($urls)-1))?$urls[$i+1]['id']:0,
+ 'visible' => l10n('g002_yesno_'.$urls[$i]['visible'])
+ );
+ }
+
+ $themeconf=array(
+ 'icon_dir' => $template->get_themeconf('icon_dir')
+ );
+
+ $local_tpl->assign('themeconf', $themeconf);
+ $local_tpl->assign('datas', $template_datas);
+ $local_tpl->assign('plugin', array('PATH' => AMM_PATH));
+
+ return($local_tpl->parse('body_page', true));
+ }
+
+ // permut position of 2 urls and returns a html formatted list of urls
+ private function ajax_amm_links_permut($urlid, $urlpermut)
+ {
+ $this->permut_url($urlid, $urlpermut);
+ return($this->ajax_amm_links_list());
+ }
+
+ // delete an url and returns a html formatted list of urls
+ private function ajax_amm_links_delete($urlid)
+ {
+ if(!$this->adviser_abort())
+ {
+ $this->delete_url($urlid);
+ }
+ return($this->ajax_amm_links_list());
+ }
+
+
+
+
+ // return a html formatted list of menu's sections
+ private function ajax_amm_section_list()
+ {
+ global $menu;
+ $local_tpl = new Template(AMM_PATH."admin/", "");
+ $local_tpl->set_filename('body_page',
+ dirname($this->filelocation).'/admin/amm_sectionslist_detail.tpl');
+
+ $sections=$menu->registered();
+ $i=0;
+ foreach($sections as $key => $val)
+ {
+ $template_datas['sections'][]=array(
+ 'OWNER' => $val['OWNER'],
+ 'NAME' => l10n($val['NAME']),
+ 'ID' => $key,
+ 'VISIBLE' => l10n('g002_yesno_'.$this->my_config['amm_sections_visible'][$key]),
+ 'POSITION' => $val['POSITION'],
+ 'NEXTPOS' => $val['POSITION']+2,
+ 'PREVPOS' => $val['POSITION']-1,
+ 'up' => ($i==0)?false:true,
+ 'down' => ($i<(count($sections)-1))?true:false
+ );
+ $i++;
+ }
+
+ $local_tpl->assign('datas', $template_datas);
+ $local_tpl->assign('plugin', array('PATH' => AMM_PATH));
+
+ return($local_tpl->parse('body_page', true));
+ }
+
+ // move item to the specified position
+ private function ajax_amm_section_position($urlid, $position)
+ {
+ global $menu;
+
+ $menu->register_position($urlid, $position);
+ return($this->ajax_amm_section_list());
+ }
+
+ // move item to the specified position
+ private function ajax_amm_section_showhide($urlid)
+ {
+ global $menu;
+
+ $switchvisible=array('y'=>'n', 'n'=>'y');
+
+ $this->my_config['amm_sections_visible'][$urlid]=$switchvisible[$this->my_config['amm_sections_visible'][$urlid]];
+ $this->save_config();
+
+ return($this->ajax_amm_section_list());
+ }
+
+
+} // AMM_AIP class
+
+
+?>
diff --git a/plugins/AMenuManager/amm_install.class.inc.php b/plugins/AMenuManager/amm_install.class.inc.php
new file mode 100644
index 000000000..4a71d1b14
--- /dev/null
+++ b/plugins/AMenuManager/amm_install.class.inc.php
@@ -0,0 +1,84 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ MyPolls_Install : classe to manage plugin install
+
+ --------------------------------------------------------------------------- */
+ @include_once('amm_root.class.inc.php');
+ include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
+
+
+ class AMM_install extends AMM_root
+ {
+ private $tablef;
+ private $exportfile;
+
+ public function AMM_install($prefixeTable, $filelocation)
+ {
+ parent::__construct($prefixeTable, $filelocation);
+ $this->tablef= new manage_tables($this->tables);
+ $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['urls']."` (
+ `id` int(11) NOT NULL auto_increment,
+ `label` varchar(50) NOT NULL default '',
+ `url` varchar(255) NOT NULL default '',
+ `mode` int(11) NOT NULL default '0',
+ `icon` varchar(50) NOT NULL default '',
+ `position` int(11) NOT NULL default '0',
+ `visible` char(1) NOT NULL default 'y',
+ PRIMARY KEY (`id`),
+ KEY `order_key` (`position`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1"
+ );
+ //$table_def array
+
+ $result=$this->tablef->create_tables($tables_def);
+ return($result);
+ }
+
+
+ /*
+ function for uninstall process
+ */
+ public function uninstall()
+ {
+ $this->tablef->export($this->exportfile);
+ $this->delete_config();
+ $this->tablef->drop_tables();
+ }
+
+ public function activate()
+ {
+ global $template;
+
+ $this->init_config();
+ $this->load_config();
+ $this->save_config();
+ }
+
+ public function deactivate()
+ {
+ }
+
+ } //class
+
+?>
diff --git a/plugins/AMenuManager/amm_pip.class.inc.php b/plugins/AMenuManager/amm_pip.class.inc.php
new file mode 100644
index 000000000..57ba0db78
--- /dev/null
+++ b/plugins/AMenuManager/amm_pip.class.inc.php
@@ -0,0 +1,92 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ PIP classe => manage integration in public interface
+
+ --------------------------------------------------------------------------- */
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php');
+
+class AMM_PIP extends AMM_root
+{
+ function AMM_PIP($prefixeTable, $filelocation)
+ {
+ parent::__construct($prefixeTable, $filelocation);
+
+ $this->load_config();
+ $this->init_events();
+ }
+
+
+ /* ---------------------------------------------------------------------------
+ Public classe functions
+ --------------------------------------------------------------------------- */
+
+
+ /*
+ initialize events call for the plugin
+ */
+ public function init_events()
+ {
+ add_event_handler('loc_begin_menubar', array(&$this, 'modify_menu') );
+ }
+
+ /* ---------------------------------------------------------------------------
+ protected classe functions
+ --------------------------------------------------------------------------- */
+ public function modify_menu()
+ {
+ global $menu, $user;
+
+
+
+ /*
+ Add a new section (links)
+ */
+ $urls=$this->get_urls(true);
+ if(($this->my_config['amm_links_active']=='y')and(count($urls)>0))
+ {
+ if($this->my_config['amm_links_show_icons']=='y')
+ {
+ for($i=0;$i<count($urls);$i++)
+ {
+ $urls[$i]['icon']=AMM_PATH."links_pictures/".$urls[$i]['icon'];
+ }
+ }
+
+ $section = new Section('mbAMM_links', base64_decode($this->my_config['amm_links_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_links.tpl');
+ $section->set_items(array(
+ 'LINKS' => $urls,
+ 'icons' => 'y'
+ ));
+ $menu->add($section->get());
+ }
+
+ /*
+ Hide sections
+ */
+ foreach($this->my_config['amm_sections_visible'] as $key => $val)
+ {
+ if($val=='n')
+ {
+ $menu->remove($key);
+ }
+ }
+
+ }
+
+
+} // AMM_PIP class
+
+
+?>
diff --git a/plugins/AMenuManager/amm_root.class.inc.php b/plugins/AMenuManager/amm_root.class.inc.php
new file mode 100644
index 000000000..50d9742e2
--- /dev/null
+++ b/plugins/AMenuManager/amm_root.class.inc.php
@@ -0,0 +1,113 @@
+<?php
+/* -----------------------------------------------------------------------------
+ Plugin : Advanced Menu Manager
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+ See main.inc.php for release information
+
+ AMM_root : root classe for plugin
+
+ --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
+
+class AMM_root extends common_plugin
+{
+ function AMM_root($prefixeTable, $filelocation)
+ {
+ $this->plugin_name="Advanced Menu Manager";
+ $this->plugin_name_files="amm";
+ parent::__construct($prefixeTable, $filelocation);
+
+ $list=array('urls');
+ $this->set_tables_list($list);
+ }
+
+ /* ---------------------------------------------------------------------------
+ common AIP & PIP functions
+ --------------------------------------------------------------------------- */
+
+ /* this function initialize var $my_config with default values */
+ public function init_config()
+ {
+ global $menu;
+
+ $this->my_config=array(
+ 'amm_links_show_icons' => 'y',
+ 'amm_links_active' => 'y',
+ 'amm_links_title' => array(),
+ 'amm_sections_visible' => array()
+ );
+
+ $languages=get_languages();
+ foreach($languages as $key => $val)
+ {
+ if($key=='fr_FR')
+ {
+ $this->my_config['amm_links_title'][$key]='Liens';
+ }
+ else
+ {
+ $this->my_config['amm_links_title'][$key]='Links';
+ }
+ }
+
+ $sections=$menu->registered();
+ foreach($sections as $key => $val)
+ {
+ $this->my_config['amm_sections_visible'][$key]='y';
+ }
+ }
+
+
+ // return an array of urls (each url is an array)
+ protected function get_urls($only_visible=false)
+ {
+ $returned=array();
+ $sql="SELECT * FROM ".$this->tables['urls'];
+ if($only_visible)
+ {
+ $sql.=" WHERE visible = 'y' ";
+ }
+ $sql.=" ORDER BY position";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_array($result))
+ {
+ $returned[]=$row;
+ }
+ }
+ return($returned);
+ }
+
+ //return number of url
+ protected function get_count_url($only_visible=false)
+ {
+ $returned=0;
+ $sql="SELECT count(id) FROM ".$this->tables['urls'];
+ if($only_visible)
+ {
+ $sql.=" WHERE visible = 'y' ";
+ }
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $tmp=mysql_fetch_row($result);
+ $returned=$tmp[0];
+ }
+ return($returned);
+ }
+
+
+} // amm_root class
+
+
+?>
diff --git a/plugins/AMenuManager/index.php b/plugins/AMenuManager/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/AMenuManager/index.php
@@ -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();
+?>
diff --git a/plugins/AMenuManager/language/en_UK/index.php b/plugins/AMenuManager/language/en_UK/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/AMenuManager/language/en_UK/index.php
@@ -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();
+?>
diff --git a/plugins/AMenuManager/language/en_UK/plugin.lang.php b/plugins/AMenuManager/language/en_UK/plugin.lang.php
new file mode 100755
index 000000000..79b1bdd11
--- /dev/null
+++ b/plugins/AMenuManager/language/en_UK/plugin.lang.php
@@ -0,0 +1,58 @@
+<?php
+
+$lang['Grum Plugin Classes is not installed'] = 'Plugin <b>Grum Plugin Classes</b> in not installed';
+
+$lang['g002_title_page'] = 'Advanced Menu Management';
+$lang['g002_version'] = 'r';
+
+$lang['g002_error_invalid_ajax_call'] = "Invalid function call !";
+
+$lang['g002_setmenu'] = 'Menu management';
+$lang['g002_addlinks'] = 'Links';
+$lang['g002_randompict'] = 'Random picture';
+$lang['g002_personnalblock'] = 'Personalised menu';
+
+$lang['g002_setmenu_nfo'] = 'Management of displayed menu\'s blocks';
+$lang['g002_addlinks_nfo'] = 'Menu\'s block allowing to display a list of hyperlink';
+$lang['g002_randompict_nfo'] = 'Menu\'s block allowing to display a random picture from the gallery';
+$lang['g002_personnalblock_nfo'] = 'Display personalised blocks into menu';
+
+
+$lang['g002_mode_new_window'] = 'New window';
+$lang['g002_mode_current_window'] = 'Current window';
+$lang['g002_addlink'] = 'Add a link';
+$lang['g002_label'] = 'Label';
+$lang['g002_url'] = 'URL';
+$lang['g002_mode'] = 'Mode';
+$lang['g002_icon'] = 'Representative picture';
+$lang['g002_visible'] = 'Visible';
+$lang['g002_linkslist'] = "Links list";
+$lang['g002_confirm_delete_link'] = "Delete link ?";
+$lang['g002_nolinks'] = 'No links';
+$lang['g002_link'] = 'link';
+$lang['g002_links'] = 'links';
+
+$lang['g002_createoflink'] = 'Add link';
+$lang['g002_editoflink'] = 'Edit link';
+$lang['g002_createthelink'] = 'Add link';
+$lang['g002_editthelink'] = 'Edit link';
+
+$lang['g002_configlinks'] = 'Links settings';
+$lang['g002_setting_link_block_menu'] = 'Menu integration';
+$lang['g002_setting_link_links']='Links';
+$lang['g002_setting_link_show_icon'] = 'Display links representative picture';
+$lang['g002_setting_link_block_active'] = 'Display block in menu';
+$lang['g002_setting_link_block_title'] = 'Block title';
+$lang['g002_apply'] = 'Apply';
+
+$lang['g002_sectionslist'] = 'Menu\'s blocks';
+
+$lang['g002_yesno_y'] = 'Yes';
+$lang['g002_yesno_n'] = 'No';
+
+$lang['g002_owner'] = 'Owner';
+$lang['g002_sectionid'] = 'Identifier';
+$lang['g002_name'] = 'Label';
+
+
+?>
diff --git a/plugins/AMenuManager/language/fr_FR/index.php b/plugins/AMenuManager/language/fr_FR/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/AMenuManager/language/fr_FR/index.php
@@ -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();
+?>
diff --git a/plugins/AMenuManager/language/fr_FR/plugin.lang.php b/plugins/AMenuManager/language/fr_FR/plugin.lang.php
new file mode 100755
index 000000000..828bf9d98
--- /dev/null
+++ b/plugins/AMenuManager/language/fr_FR/plugin.lang.php
@@ -0,0 +1,58 @@
+<?php
+
+$lang['Grum Plugin Classes is not installed'] = 'Le plugin <b>Grum Plugin Classes</b> n\'est pas installé';
+
+$lang['g002_title_page'] = 'Gestion avancée du menu';
+$lang['g002_version'] = 'v';
+
+$lang['g002_error_invalid_ajax_call'] = "Appel de fonction invalide !";
+
+$lang['g002_setmenu'] = 'Gestion du menu';
+$lang['g002_addlinks'] = 'Liens';
+$lang['g002_randompict'] = 'Image aléatoire';
+$lang['g002_personnalblock'] = 'Menu personnalisé';
+
+$lang['g002_setmenu_nfo'] = 'Gestion de l\'affichage des sections affichées dans le menu';
+$lang['g002_addlinks_nfo'] = 'Section permettant d\'afficher dans le menu une liste d\'hyperliens vers d\'autres sites internet';
+$lang['g002_randompict_nfo'] = 'Section permettant d\'afficher dans le menu une image prise au hasard dans la gallerie';
+$lang['g002_personnalblock_nfo'] = 'Afficher dans le menu des sections au contenu personnalisés';
+
+
+$lang['g002_mode_new_window'] = 'Nouvelle fenêtre';
+$lang['g002_mode_current_window'] = 'Fenêtre courante';
+$lang['g002_addlink'] = 'Ajouter un lien';
+$lang['g002_label'] = 'Libellé';
+$lang['g002_url'] = 'URL';
+$lang['g002_mode'] = 'Mode';
+$lang['g002_icon'] = 'Image';
+$lang['g002_visible'] = 'Visible';
+$lang['g002_linkslist'] = "Liste des liens";
+$lang['g002_confirm_delete_link'] = "Supprimer le lien ?";
+$lang['g002_nolinks'] = 'Pas de liens';
+$lang['g002_link'] = 'lien';
+$lang['g002_links'] = 'liens';
+
+$lang['g002_createoflink'] = 'Ajout d\'un lien';
+$lang['g002_editoflink'] = 'Modification d\'un lien';
+$lang['g002_createthelink'] = 'Ajouter le lien';
+$lang['g002_editthelink'] = 'Modifier le lien';
+
+$lang['g002_configlinks'] = 'Configuration des liens';
+$lang['g002_setting_link_block_menu'] = 'Intégration dans le menu';
+$lang['g002_setting_link_links']='Liens';
+$lang['g002_setting_link_show_icon'] = 'Afficher les icônes de liens';
+$lang['g002_setting_link_block_active'] = 'Afficher la section dans le menu';
+$lang['g002_setting_link_block_title'] = 'Titre de la section dans le menu';
+$lang['g002_apply'] = 'Appliquer';
+
+$lang['g002_sectionslist'] = 'Sections du menu';
+
+$lang['g002_yesno_y'] = 'Oui';
+$lang['g002_yesno_n'] = 'Non';
+
+$lang['g002_owner'] = 'Propriétaire';
+$lang['g002_sectionid'] = 'Identifiant';
+$lang['g002_name'] = 'Libellé';
+
+
+?>
diff --git a/plugins/AMenuManager/language/index.php b/plugins/AMenuManager/language/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/AMenuManager/language/index.php
@@ -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();
+?>
diff --git a/plugins/AMenuManager/links_pictures/internet-url.png b/plugins/AMenuManager/links_pictures/internet-url.png
new file mode 100644
index 000000000..4796da70d
--- /dev/null
+++ b/plugins/AMenuManager/links_pictures/internet-url.png
Binary files differ
diff --git a/plugins/AMenuManager/links_pictures/internet.png b/plugins/AMenuManager/links_pictures/internet.png
new file mode 100644
index 000000000..e5d80c172
--- /dev/null
+++ b/plugins/AMenuManager/links_pictures/internet.png
Binary files differ
diff --git a/plugins/AMenuManager/main.inc.php b/plugins/AMenuManager/main.inc.php
new file mode 100755
index 000000000..766b478e8
--- /dev/null
+++ b/plugins/AMenuManager/main.inc.php
@@ -0,0 +1,66 @@
+<?php
+/*
+Plugin Name: Advanced Menu Manager
+Version: 1.0.0
+Description: Gestion avancée du menu / Advanced management of menu
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=
+*/
+
+/*
+--------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.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
+
+1.0.0 - 27/07/08 -
+
+:: TO DO
+
+--------------------------------------------------------------------------------
+
+:: NFO
+ AMM_AIM : classe to manage plugin integration into plugin menu
+ AMM_AIP : classe to manage plugin admin pages
+ AMM_PIP : classe to manage plugin public integration
+
+--------------------------------------------------------------------------------
+*/
+
+// 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('AMM_DIR' , basename(dirname(__FILE__)));
+define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
+
+define('AMM_VERSION' , '1.0.0'); // => ne pas oublier la version dans l'entête !!
+
+global $prefixeTable, $menu;
+
+if(basename($_SERVER["PHP_SELF"])=='admin.php')
+{
+ //AMM admin part loaded and active only if in admin page
+ include_once("amm_aim.class.inc.php");
+
+ $obj = new AMM_AIM($prefixeTable, __FILE__);
+ $obj->init_events();
+ set_plugin_data($plugin['id'], $obj);
+}
+else
+{
+ //AMM public part loaded and active only if in admin page
+ include_once("amm_pip.class.inc.php");
+
+ $obj = new AMM_PIP($prefixeTable, __FILE__);
+ set_plugin_data($plugin['id'], $obj);
+}
+
+?>
diff --git a/plugins/AMenuManager/maintain.inc.php b/plugins/AMenuManager/maintain.inc.php
new file mode 100755
index 000000000..543ec5c1f
--- /dev/null
+++ b/plugins/AMenuManager/maintain.inc.php
@@ -0,0 +1,66 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+ini_set('error_reporting', E_ALL);
+ini_set('display_errors', true);
+
+define('AMM_DIR' , basename(dirname(__FILE__)));
+define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
+@include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
+
+
+global $gpc_installed, $lang; //needed for plugin manager compatibility
+
+$gpc_installed=false;
+if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
+{
+ @include_once("amm_install.class.inc.php");
+ $gpc_installed=true;
+}
+
+load_language('plugin.lang', AMM_PATH);
+
+function plugin_install($plugin_id, $plugin_version, &$errors)
+{
+ global $prefixeTable, $gpc_installed, $menu;
+ if($gpc_installed)
+ {
+ $menu->register('mbAMM_links', 'Links', 0, 'AMM');
+ $menu->register('mbAMM_randompict', 'Random pictures', 0, 'AMM');
+ $amm=new AMM_install($prefixeTable, __FILE__);
+ $result=$amm->install();
+ }
+ else
+ {
+ array_push($errors, l10n('Grum Plugin Classes is not installed'));
+ }
+}
+
+function plugin_activate($plugin_id, $plugin_version, &$errors)
+{
+}
+
+function plugin_deactivate($plugin_id)
+{
+}
+
+function plugin_uninstall($plugin_id)
+{
+ global $prefixeTable, $gpc_installed, $menu;
+ if($gpc_installed)
+ {
+ $menu->unregister('mbAMM_links');
+ $menu->unregister('mbAMM_randompict');
+ $amm=new AMM_install($prefixeTable, __FILE__);
+ $result=$amm->uninstall();
+ }
+ else
+ {
+ array_push($errors, l10n('Grum Plugin Classes is not installed'));
+ }
+}
+
+
+
+?>
diff --git a/plugins/AMenuManager/menu_templates/menubar_links.tpl b/plugins/AMenuManager/menu_templates/menubar_links.tpl
new file mode 100644
index 000000000..7d9360c5a
--- /dev/null
+++ b/plugins/AMenuManager/menu_templates/menubar_links.tpl
@@ -0,0 +1,16 @@
+
+<!-- links menu bar -->
+{if $section.NAME!=""}
+ <dt>{$section.NAME|@translate}</dt>
+{/if}
+<dd>
+ <ul>
+ {foreach from=$section.ITEMS.LINKS item=link}
+ <li>
+ {if $section.ITEMS.icons=='y'}<img src='{$link.icon}' style="position:relative;top:3px;"/>{/if}
+ <a href="{$link.url}"
+ {if $link.mode == 0} target = '_blank' {/if}>{$link.label}</a>
+ </li>
+ {/foreach}
+ </ul>
+</dd> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/ajax.class.inc.php b/plugins/grum_plugins_classes-2/ajax.class.inc.php
new file mode 100755
index 000000000..c1b8ccfa3
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/ajax.class.inc.php
@@ -0,0 +1,56 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: ajax
+ class version: 2.0
+ date: 2008-07-20
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to add ajax.js file into html page ;
+ just instanciate an ajax object, and call return_result
+ $ajax_content_to_be_returned = "...............";
+ $ajax = new ajax();
+ $ajax->return_result($ajax_content_to_be_returned);
+
+ - constructor ajax()
+ - function return_result($str)
+ ---------------------------------------------------------------------- */
+
+
+
+class ajax
+{
+ function ajax()
+ {
+ add_event_handler('loc_end_page_header', array(&$this, 'load_JS'));
+ }
+
+ function load_JS()
+ {
+ global $template;
+
+ $name='plugins/'.basename(dirname(__FILE__)).'/ajax.js';
+
+ $template->append('head_elements', '<script src="'.$name.'" type="text/javascript"></script>');
+ }
+
+ function return_result($str)
+ {
+ //$chars=get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES);
+ $chars['<']='<';
+ $chars['>']='>';
+ $chars['&']='&';
+ exit(strtr($str, $chars));
+ }
+} //class
+
+/*
+ it's better to make $ajax instance into the plugin object, otherwise an object
+ made here cannot be acceeded..
+*/
+//$ajax=new ajax();
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/ajax.js b/plugins/grum_plugins_classes-2/ajax.js
new file mode 100755
index 000000000..1b8008191
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/ajax.js
@@ -0,0 +1,104 @@
+/* -----------------------------------------------------------------------------
+ file: ajax.js
+ file version: 1.1.0
+ date: 2008-05-25
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to add ajax into html page
+
+ + create_httpobject provide a simple function to create an HTML request to a
+ server ; return an XMLHttpRequest object (or compatible object for IE)
+
+ + tHttpObject is a class providing :
+ - an XMLHttpRequest object
+ -
+
+ ------------------------------------------------------------------------------
+ HISTORY VERSION
+ v1.0.1 + [create_httpobject] overrideMimeType unknown by IE 7.0 ;
+ v1.1.0 + add create_httpobject2 with mimetype parameter
+
+ -------------------------------------------------------------------------- */
+
+
+ function create_httpobject(requesttype, charset, ajaxurl, async)
+ {
+ return(create_httpobject2(requesttype, charset, ajaxurl, async, ''));
+ }
+
+ function create_httpobject2(requesttype, charset, ajaxurl, async, mimetype)
+ {
+ if (window.XMLHttpRequest)
+ {
+ // IE7 & FF method
+ http_request = new XMLHttpRequest();
+ }
+ else
+ {
+ //Other IE method.....
+ if (window.ActiveXObject)
+ {
+ try
+ {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e)
+ {
+ window.alert("Your browser is unable to use XMLHTTPRequest");
+ } // try-catch
+ } // try-catch
+ }
+ } // if-else
+
+ if(charset=='') { charset='utf-8'; }
+
+ http_request.onreadystatechange = function() { };
+ http_request.open(requesttype.toUpperCase(), ajaxurl, async);
+
+ if(mimetype=='')
+ {
+ mimetype='text/html';
+ }
+
+ try
+ {
+ http_request.overrideMimeType(mimetype+'; charset='+charset);
+ }
+ catch(e)
+ {
+ }
+
+ if(requesttype.toUpperCase()=='POST')
+ {
+ http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+
+ //method to restitute an XML object ; needed for compatibility between FF&IE
+ http_request.XML = httpobject_responseXML;
+
+ return(http_request);
+ }
+
+
+ function httpobject_responseXML()
+ {
+ if (document.implementation && document.implementation.createDocument)
+ {
+ //ff method
+ return(this.responseXML);
+ }
+ else
+ {
+ //ie method
+ return(xmlCreateFromString(this.responseText));
+ }
+ } \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/common_plugin.class.inc.php b/plugins/grum_plugins_classes-2/common_plugin.class.inc.php
new file mode 100755
index 000000000..c87581c12
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/common_plugin.class.inc.php
@@ -0,0 +1,209 @@
+<?php
+/* -----------------------------------------------------------------------------
+ class name: common_plugin
+ class version: 2.0
+ date: 2008-07-13
+
+ ------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+
+ this class provides base functions to manage a plugin
+ public
+ ADMINISTRATION RELATED
+ - manage()
+ - plugin_admin_menu($menu)
+ INITIALIZATION RELATED
+ - init_events()
+ CONFIG RELATED
+ - get_filelocation()
+ - get_admin_link()
+ - init_config()
+ - load_config()
+ - save_config()
+ - delete_config()
+
+ protected
+ INITIALIZATION RELATED
+ - set_tables_list($list)
+ ------------------------------------------------------------------------------
+ :: HISTORY
+
+ 2.0.0 - 2008-07-13
+ migrate to piwigo 2.0 ; use of PHP5 classes possibilities
+
+ --------------------------------------------------------------------------- */
+
+class common_plugin
+{
+ protected $prefixeTable; // prefixe for tables names
+ protected $page_link; //link to admin page
+ protected $filelocation; //files plugin location on server
+ protected $display_result_ok;
+ protected $display_result_ko;
+ protected $plugin_name; // used for interface display
+ protected $plugin_name_files; // used for files
+ protected $plugin_admin_file = "plugin_admin";
+ protected $tables; // list of all tables names used by plugin
+ public $my_config; // array of config parameters
+
+ /* constructor allows to initialize $prefixeTable value */
+ public function common_plugin($prefixeTable, $filelocation)
+ {
+ $this->filelocation=$filelocation;
+ $this->prefixeTable=$prefixeTable;
+ $this->page_link="admin.php?page=plugin&section=". basename(dirname($this->filelocation))."/admin/".$this->plugin_admin_file.".php";
+ //$this->page_link=get_admin_plugin_menu_link($filelocation);
+ $this->init_config();
+ $this->display_result_ok="OK";
+ $this->display_result_ko="KO";
+ }
+
+ public function get_filelocation()
+ {
+ return($this->filelocation);
+ }
+
+ public function get_admin_link()
+ {
+ return($this->page_link);
+ }
+
+
+ /* ---------------------------------------------------------------------------
+ CONFIGURATION RELATED FUNCTIONS
+ --------------------------------------------------------------------------- */
+
+ /* this function initialize var $my_config with default values */
+ public function init_config()
+ {
+ $this->my_config=array();
+ }
+
+ /* load config from CONFIG_TABLE into var $my_config */
+ public function load_config()
+ {
+ $this->init_config();
+ $sql="SELECT value FROM ".CONFIG_TABLE."
+ WHERE param = '".$this->plugin_name_files."_config'";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $row=mysql_fetch_row($result);
+ if(is_string($row[0]))
+ {
+ $config = unserialize($row[0]);
+ reset($config);
+ while (list($key, $val) = each($config))
+ { $this->my_config[$key] =$val; }
+ }
+ }
+ }
+
+ /* save var $my_config into CONFIG_TABLE */
+ public function save_config()
+ {
+ $sql="REPLACE INTO ".CONFIG_TABLE."
+ VALUES('".$this->plugin_name_files."_config', '"
+ .serialize($this->my_config)."', '')";
+ $result=pwg_query($sql);
+ if($result)
+ { return true; }
+ else
+ { return false; }
+ }
+
+ /* delete config from CONFIG_TABLE */
+ public function delete_config()
+ {
+ $sql="DELETE FROM ".CONFIG_TABLE."
+ WHERE param='".$this->plugin_name_files."_config'";
+ $result=pwg_query($sql);
+ if($result)
+ { return true; }
+ else
+ { return false; }
+ }
+
+ /* ---------------------------------------------------------------------------
+ PLUGIN INITIALIZATION RELATED FUNCTIONS
+ --------------------------------------------------------------------------- */
+
+ /*
+ initialize tables list used by the plugin
+ $list = array('table1', 'table2')
+ $this->tables_list['table1'] = $prefixeTable.$plugin_name.'_table1'
+ */
+ protected function set_tables_list($list)
+ {
+ for($i=0;$i<count($list);$i++)
+ {
+ $this->tables[$list[$i]]=$this->prefixeTable.$this->plugin_name_files.'_'.$list[$i];
+ }
+ }
+
+ /* ---------------------------------------------------------------------------
+ ADMINISTRATOR CONSOLE RELATED FUNCTIONS
+ --------------------------------------------------------------------------- */
+
+ /* add plugin into administration menu */
+ public function plugin_admin_menu($menu)
+ {
+ array_push($menu,
+ array(
+ 'NAME' => $this->plugin_name,
+ 'URL' => get_admin_plugin_menu_link(dirname($this->filelocation).
+ '/admin/'.$this->plugin_admin_file.'.php')
+ ));
+ return $menu;
+ }
+
+ /*
+ manage plugin integration into piwigo's admin interface
+
+ to be surcharged by child's classes
+ */
+ public function manage()
+ {
+ }
+
+ /*
+ intialize plugin's events
+ to be surcharged by child's classes
+ */
+ public function init_events()
+ {
+ }
+
+ protected function debug($text)
+ {
+ global $page;
+ array_push($page['infos'], "DEBUG MODE: ".$text);
+ }
+
+ /*
+ manage infos & errors display
+ */
+ protected function display_result($action_msg, $result)
+ {
+ global $page;
+
+ if($result)
+ {
+ array_push($page['infos'], $action_msg);
+ array_push($page['infos'], $this->display_result_ok);
+ }
+ else
+ {
+ array_push($page['errors'], $action_msg);
+ array_push($page['errors'], $this->display_result_ko);
+ }
+ }
+} //class common_plugin
+
+?>
diff --git a/plugins/grum_plugins_classes-2/css.class.inc.php b/plugins/grum_plugins_classes-2/css.class.inc.php
new file mode 100755
index 000000000..cbd6bb1da
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/css.class.inc.php
@@ -0,0 +1,76 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: css
+ class version: 2.0
+ date: 2008-07-13
+
+ ------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to manage css
+ classe consider that $filename is under plugins/ directory
+
+
+ - constructor css($filename)
+ - (public) function css_file_exists()
+ - (public) function make_CSS($css)
+ - (public) function apply_CSS()
+ ---------------------------------------------------------------------- */
+class css
+{
+ private $filename;
+
+ public function css($filename)
+ {
+ $this->filename=$filename;
+ }
+
+ /*
+ make the css file
+ */
+ public function make_CSS($css)
+ {
+ if($css!="")
+ {
+ $handle=fopen($this->filename, "w");
+ if($handle)
+ {
+ fwrite($handle, $css);
+ fclose($handle);
+ }
+ }
+ }
+
+ /*
+ return true if css file exists
+ */
+ public function css_file_exists()
+ {
+ return(file_exists($this->filename));
+ }
+
+ /*
+ put a link in the template to load the css file
+ this function have to be called in a 'loc_end_page_header' trigger
+
+ if $text="", insert link to css file, otherwise insert directly a <style> markup
+ */
+ public function apply_CSS()
+ {
+ global $template;
+
+ if($this->css_file_exists())
+ {
+ $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="plugins/'.basename(dirname($this->filename))."/".basename($this->filename).'">');
+ }
+ }
+} //class
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/genericjs.class.inc.php b/plugins/grum_plugins_classes-2/genericjs.class.inc.php
new file mode 100755
index 000000000..d5038c0d9
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/genericjs.class.inc.php
@@ -0,0 +1,41 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: genericjs
+ class version: 2.0
+ date: 2008-07-20
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to add genericjs.js file into html page
+
+ > see genericjs.js file to know javascript functions added
+
+ - constructor genericjs()
+ ---------------------------------------------------------------------- */
+
+
+class genericjs
+{
+ function genericjs()
+ {
+ add_event_handler('loc_end_page_header', array(&$this, 'load_JS'));
+ }
+
+ function load_JS()
+ {
+ global $template;
+
+ $name='plugins/'.basename(dirname(__FILE__)).'/genericjs.js';
+
+ $template->append('head_elements', '<script src="'.$name.'" type="text/javascript"></script>');
+
+ }
+
+} //class
+
+$genericjs=new genericjs();
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/genericjs.js b/plugins/grum_plugins_classes-2/genericjs.js
new file mode 100755
index 000000000..656f8efad
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/genericjs.js
@@ -0,0 +1,49 @@
+/* -----------------------------------------------------------------------------
+ file: genricjs.js
+ file version: 1.0
+ date: 2008-01-02
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to make easiest a compliant code with
+ FF2.0 & IE7.0
+
+
+ ------------------------------------------------------------------------------
+ HISTORY VERSION
+
+ -------------------------------------------------------------------------- */
+
+
+
+/*
+ this is an implementation of the function <indexOf> to the Array class, as
+ defined in the ECMA-262 standard
+ for more information, see at http://developer.mozilla.org/fr/docs/R%C3%A9f%C3%A9rence_de_JavaScript_1.5_Core:Objets_globaux:Array:indexOf
+
+ not implemented in IE 7.0
+*/
+if (!Array.prototype.indexOf)
+{
+ Array.prototype.indexOf = function(elt /*, from*/)
+ {
+ var len = this.length;
+
+ var from = Number(arguments[1]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ for (; from < len; from++)
+ {
+ if (from in this &&
+ this[from] === elt)
+ return from;
+ }
+ return -1;
+ };
+}
diff --git a/plugins/grum_plugins_classes-2/google_translate.js b/plugins/grum_plugins_classes-2/google_translate.js
new file mode 100755
index 000000000..2798150e2
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/google_translate.js
@@ -0,0 +1,47 @@
+/* -----------------------------------------------------------------------------
+ file: google_translate.js
+ file version: 2.0.0
+ date: 2008-05-25
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to use Google Translate AJAX API
+ >> http://code.google.com/apis/ajaxlanguage/
+
+ ------------------------------------------------------------------------------
+ HISTORY VERSION
+ v2.0.0 +
+
+ -------------------------------------------------------------------------- */
+
+ google.load("language", "1");
+
+
+ var global_google_translate_plugin_objdest;
+ var global_google_translate_plugin_objproperty;
+
+
+ function google_translate(text, pfrom, pto, objdest, objproperty)
+ {
+ global_google_translate_plugin_objdest = objdest;
+ global_google_translate_plugin_objproperty = objproperty;
+ google.language.translate(text, pfrom, pto, google_translate_do);
+ }
+
+ function google_translate_do(result)
+ {
+ if (!result.error)
+ {
+ if(global_google_translate_plugin_objproperty=='value')
+ {
+ global_google_translate_plugin_objdest.value = result.translation;
+ }
+ else if(global_google_translate_plugin_objproperty=='innerHTML')
+ {
+ global_google_translate_plugin_objdest.innerHTML = result.translation;
+ }
+ }
+ }
+
diff --git a/plugins/grum_plugins_classes-2/index.php b/plugins/grum_plugins_classes-2/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/index.php
@@ -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();
+?>
diff --git a/plugins/grum_plugins_classes-2/main.inc.php b/plugins/grum_plugins_classes-2/main.inc.php
new file mode 100755
index 000000000..3ff10fc29
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/main.inc.php
@@ -0,0 +1,50 @@
+<?php
+/*
+Plugin Name: Grum Plugins Classes.2
+Version: 2.0.0
+Description: Collection de classes partagées entre mes plugins (existants, ou à venir) / Partaged classes between my plugins (actuals or futures)
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=199
+*/
+
+/*
+--------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.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
+ 2.0.0 - 20/07/08 +convert classes for piwigo 2.0
+
+:: TO DO
+
+:: WHAT ? WHY ?
+This plugin doesn't do anything itself. It just provide classes for others plugins.
+
+Classes version for this package
+ ajax.class.php -v2.0 + ajax.js -v1.0.1
+ common_plugin.class.php -v2.0
+ css.class.php -v2.0
+ pages_navigation.class.php -v1.0
+ public_integration.class.php -v1.0
+ tables.class.php -v1.3
+ tabsheets.class.inc.php -v1.1
+ translate.class.inc.php -v2.0.0 + google_translate.js -v2.0.0
+ users_groups.class.inc.php -v1.0
+ genericjs.class.inc.php -v1.0 + genericjs.js -v1.0
+
+See each file to know more about them
+--------------------------------------------------------------------------------
+*/
+
+if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+define('GPC_DIR' , basename(dirname(__FILE__)));
+define('GPC_PATH' , PHPWG_PLUGINS_PATH . GPC_DIR . '/');
+
+define('GPC_VERSION' , '2.0.0');
+
+?>
diff --git a/plugins/grum_plugins_classes-2/maintain.inc.php b/plugins/grum_plugins_classes-2/maintain.inc.php
new file mode 100755
index 000000000..684e8ebdf
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/maintain.inc.php
@@ -0,0 +1,26 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+// ini_set('error_reporting', E_ALL);
+// ini_set('display_errors', true);
+
+
+function plugin_install($plugin_id, $plugin_version, &$errors)
+{
+}
+
+function plugin_activate($plugin_id, $plugin_version, &$errors)
+{
+}
+
+function plugin_deactivate($plugin_id)
+{
+}
+
+function plugin_uninstall($plugin_id)
+{
+}
+
+
+?>
diff --git a/plugins/grum_plugins_classes-2/pages_navigation.class.inc.php b/plugins/grum_plugins_classes-2/pages_navigation.class.inc.php
new file mode 100755
index 000000000..86b3a50cc
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/pages_navigation.class.inc.php
@@ -0,0 +1,294 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: pages_navigation
+ class version: 1.0
+ date: 2007-11-17
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to manage pages navigation
+
+ - constructor pages_navigation($url)
+ - (public) function set_nb_items($nbitems)
+ - (public) function get_nb_items()
+ - (public) function set_nb_items_per_page($nbitems)
+ - (public) function get_nb_items_per_page()
+ - (public) function get_nb_pages()
+ - (public) function set_current_page($page)
+ - (public) function get_current_page()
+ - (public) function set_base_url($url)
+ - (public) function get_base_url()
+ - (public) function make_navigation()
+ - (public) function make_navigation_function()
+ - (private) function calc_nb_pages()
+ ---------------------------------------------------------------------- */
+class pages_navigation
+{
+ var $nbitems;
+ var $nbitemsperpages;
+ var $nbpages;
+ var $currentpage;
+ var $baseurl;
+ var $pagevarurl;
+ var $options;
+
+ function pages_navigation()
+ {
+ $this->nbitems=0;
+ $this->nbitemsperpages=0;
+ $this->nbpages=0;
+ $this->currentpage=0;
+ $this->baseurl='';
+ $this->pagevarurl='';
+ $this->options=array(
+ 'prev_next' => true,
+ 'first_last' => true,
+ 'display_all' => true,
+ 'number_displayed' => 2 //number of page displayed before and after current page
+ );
+ }
+
+ /*
+ define value for total number of items
+ */
+ function set_nb_items($nbitems)
+ {
+ if($nbitems!=$this->nbitems)
+ {
+ $this->nbitems=$nbitems;
+ $this->calc_nb_pages();
+ }
+ return($nbitems);
+ }
+
+ function get_nb_items()
+ {
+ return($nbitems);
+ }
+
+ /*
+ define value for number of items displayed per pages
+ */
+ function set_nb_items_per_page($nbitems)
+ {
+ if(($nbitems!=$this->nbitemsperpages)&&($nbitems>0))
+ {
+ $this->nbitemsperpages=$nbitems;
+ $this->calc_nb_pages();
+ }
+ return($this->nbitemsperpages);
+ }
+
+ function get_nb_items_per_page()
+ {
+ return($this->nbitemsperpages);
+ }
+
+ /*
+ return numbers of pages
+ */
+ function get_nb_pages()
+ {
+ return($this->nbpages);
+ }
+
+ /*
+ define the current page number
+ */
+ function set_current_page($page)
+ {
+ if(($page!=$this->currentpage)&&($page<=$this->nbpages)&&($page>0))
+ {
+ $this->currentpage=$page;
+ }
+ return($this->currentpage);
+ }
+
+ /*
+ returns the current page number
+ */
+ function get_current_page()
+ {
+ return($this->currentpage);
+ }
+
+ /*
+ define the value for url
+ ex: "http://mysite.com/admin.php?var1=xxx&var2=xxx"
+ */
+ function set_base_url($url)
+ {
+ if($url!=$this->baseurl)
+ {
+ $this->baseurl=$url;
+ }
+ return($this->baseurl);
+ }
+
+ function get_base_url()
+ {
+ return($this->baseurl);
+ }
+
+ /*
+ define the value for variables's name
+ ex: url = "http://mysite.com/admin.php?var1=xxx&var2=xxx"
+ pagevar = "pagenumber"
+ url made is "http://mysite.com/admin.php?var1=xxx&var2=xxx&pagenumber=xxx"
+ */
+ function set_pagevar_url($var)
+ {
+ if($var!=$this->pagevarurl)
+ {
+ $this->pagevarurl=$var;
+ }
+ return($this->pagevarurl);
+ }
+
+ function get_pagevar_url()
+ {
+ return($this->pagevarurl);
+ }
+
+
+ /*
+ returns an html formatted string
+ */
+ function make_navigation($functionname='')
+ {
+ $text='';
+ if(($this->options['display_all'])||($this->options['number_displayed']>=$this->nbpages))
+ {
+ for($i=1;$i<=$this->nbpages;$i++)
+ {
+ if($i!=$this->currentpage)
+ {
+ if($functionname=='')
+ {
+ $text.='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'='.$i.'">'.$i.'</a>&nbsp;';
+ }
+ else
+ {
+ $text.='<a style="cursor:pointer;" onclick="'.$functionname.'('.$i.');">'.$i.'</a>&nbsp;';
+ }
+ }
+ else
+ {
+ $text.=$i.'&nbsp;';
+ }
+ }
+ }
+ else
+ {
+ for($i=$this->currentpage-$this->options['number_displayed'];$i<=$this->currentpage+$this->options['number_displayed'];$i++)
+ {
+ if(($i>0)&&($i<=$this->nbpages))
+ {
+ if($i!=$this->currentpage)
+ {
+ if($functionname=='')
+ {
+ $text.='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'='.$i.'">'.$i.'</a>&nbsp;';
+ }
+ else
+ {
+ $text.='<a style="cursor:pointer;" onclick="'.$functionname.'('.$i.');">'.$i.'</a>&nbsp;';
+ }
+ }
+ else
+ {
+ $text.=$i.'&nbsp;';
+ }
+ }
+ }
+ if($this->currentpage-$this->options['number_displayed']>0)
+ {
+ $text='&nbsp;...&nbsp;'.$text;
+ }
+ if($this->currentpage+$this->options['number_displayed']<$this->nbpages)
+ {
+ $text.='&nbsp;...&nbsp;';
+ }
+ }
+
+ if($this->options['prev_next'])
+ {
+ $prevp='';
+ $nextp='';
+ if($this->currentpage>1)
+ {
+ if($functionname=='')
+ {
+ $prevp='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'='.($this->currentpage-1).'"> Prev </a>';
+ }
+ else
+ {
+ $prevp='<a style="cursor:pointer;" onclick="'.$functionname.'('.($this->currentpage-1).');"> Prev </a>';
+ }
+ }
+ if($this->currentpage<$this->nbpages)
+ {
+ if($functionname=='')
+ {
+ $nextp='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'='.($this->currentpage+1).'"> Next </a>';
+ }
+ else
+ {
+ $nextp='<a style="cursor:pointer;" onclick="'.$functionname.'('.($this->currentpage+1).');"> Next </a>';
+ }
+ }
+
+ $text=$prevp.$text.$nextp;
+ }
+
+ if($this->options['first_last'])
+ {
+ $firstp='';
+ $lastp='';
+ if($this->currentpage>1)
+ {
+ if($functionname=='')
+ {
+ $firstp='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'=1"> First </a>';
+ }
+ else
+ {
+ $firstp='<a style="cursor:pointer;" onclick="'.$functionname.'(1);"> First </a>';
+ }
+ }
+ if($this->currentpage<$this->nbpages)
+ {
+ if($functionname=='')
+ {
+ $lastp='<a href="'.$this->baseurl.'&'.$this->pagevarurl.'='.$this->nbpages.'"> Last </a>';
+ }
+ else
+ {
+ $lastp='<a style="cursor:pointer;" onclick="'.$functionname.'('.$this->nbpages.');"> Last </a>';
+ }
+ }
+
+ $text=$firstp.$text.$lastp;
+ }
+
+ return($text);
+ }
+
+
+ /*
+ calculate the number of pages...
+ */
+ function calc_nb_pages()
+ {
+ if($this->nbitemsperpages>0)
+ {
+ $this->nbpages=ceil($this->nbitems/$this->nbitemsperpages);
+ }
+ }
+
+} //class
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/public_integration.class.inc.php b/plugins/grum_plugins_classes-2/public_integration.class.inc.php
new file mode 100755
index 000000000..db61e51b3
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/public_integration.class.inc.php
@@ -0,0 +1,202 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: public_integration
+ class version: 1.0
+ date: 2007-10-31
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this class provides base functions to manage an integration into main index
+ page
+ the class use plugin MenuBarManager function if installed
+
+ - constructor public_integration($section)
+ - (public) function init_events()
+ - (public) function set_callback_page_function($value)
+ - (public) function set_callback_init_menu_function($value)
+ - (public) function set_menu_tpl($tpl_code)
+ - (public) function set_menu_list($list)
+ - (public) function set_menu_title($title)
+ - (public) function set_lnk_admin_add($text, $link)
+ - (public) function set_lnk_admin_edit($text, $link)
+ - (private) function update_menubar()
+ - (private) function init_section()
+ - (private) function call_page()
+
+ use init_events() function to initialize needed triggers for updating menubar
+ use set_menu_tpl() function to initialize the template of menu
+ use set_menu_title() function to initialize the title of menu
+ use set_menu_list() function to initialize the elements of menu (see function for use)
+ use set_lnk_admin_add() and set_lnk_admin_edit() functions for displaying specific admin links
+
+ the "callback_page_function" is called everytime a specific page is displayed
+ the "callback_init_menu_function" is called everytime the menu is made (allows
+ for example to prepare menu's title and list using user's language)
+
+----------------------------------------------------------------------------- */
+
+class public_integration
+{
+ var $menu_tpl; //template definition for the menu
+ var $menu_list; //an array of arrays array(array('text' => '', 'id' => '', 'link' => ''), array... )
+ var $menu_title; //menu's title
+ var $lnk_admin_add; //if set array('text'=>'', 'link'=>''), add a link "add" to the menu
+ var $lnk_admin_edit; //if set array('text'=>'', 'link'=>''), add a link "edit" to the menu's elements
+ var $section; //section applied to the page viewed
+ var $callback_page_function; //called function to display page
+ var $callback_init_menu_function; //called function to initialize menu
+
+ function public_integration($section)
+ {
+ $this->menu_tpl="";
+ $this->menu_list=array();
+ $this->menu_title="";
+ $this->lnk_admin_add=array();
+ $this->lnk_admin_edit=array();
+ $this->section=$section;
+ $this->callback_page_function='';
+ $this->callback_init_menu_function='';
+ }
+
+ //initialize events to manage menu & page integration
+ function init_events()
+ {
+ add_event_handler('loc_begin_menubar', array(&$this, 'init_smarty'));
+ add_event_handler('loc_end_menubar', array(&$this, 'update_menubar'));
+ add_event_handler('loc_end_section_init', array(&$this, 'init_section'));
+ add_event_handler('loc_end_index', array(&$this, 'call_page'));
+ }
+
+ function set_callback_page_function($value)
+ {
+ $this->callback_page_function=$value;
+ }
+
+ function set_callback_init_menu_function($value)
+ {
+ $this->callback_init_menu_function=$value;
+ }
+
+ // set template definition for menu
+ function set_menu_tpl($tpl_code)
+ {
+ $this->menu_tpl = $tpl_code;
+ }
+
+ //set menu list
+ function set_menu_list($list)
+ {
+ $this->menu_list = $list;
+ }
+
+ //set menu title
+ function set_menu_title($title)
+ {
+ $this->menu_title = $title;
+ }
+
+ //set 'add' link to menu
+ function set_lnk_admin_add($text, $link)
+ {
+ $this->lnk_admin_add = array('text' => $text, 'link' => $link);
+ }
+
+ //set 'edit' link to menu
+ function set_lnk_admin_edit($text, $link)
+ {
+ $this->lnk_admin_edit = array('text' => $text, 'link' => $link);
+ }
+
+ function init_smarty()
+ {
+ global $template;
+
+ $template->smarty->register_prefilter(array(&$this, 'modify_tpl'));
+ }
+
+ function modify_tpl($tpl_source, &$smarty)
+ {
+ return(str_replace('<div id="menubar">', '<div id="menubar">(test3)'.$this->menu_tpl, $tpl_source));
+ }
+
+ /*
+ Update PWG menubar
+ - add a MyPolls block
+ - add a MyPolls menu inside
+ */
+ function update_menubar()
+ {
+ global $template;
+
+ @call_user_func($this->callback_init_menu_function);
+
+ //echo "update_menubar****".$this->menu_tpl."****".$this->menu_title."****".count($this->menu_list)."****";
+ //do not do nothing because nothing to do
+ if((($this->menu_tpl=="") ||
+ (count($this->menu_list)==0) ||
+ ($this->menu_title=="")
+ ) and !is_admin())
+ {
+ return(false);
+ }
+
+ $template_datas=array();
+ $template_datas['links']=array();
+ $template_datas['TITLE']='toto'.$this->menu_title;
+
+ if(is_admin() && (count($this->lnk_admin_add)>0))
+ {
+ $template_datas['links'][]=array(
+ 'LABEL' => "<i>".$this->lnk_admin_add['text']."</i>",
+ 'URL' => $this->lnk_admin_add['link']
+ );
+ }
+
+ foreach($this->menu_list as $key => $val)
+ {
+ if(is_admin() && (count($this->lnk_admin_edit)>0))
+ { $lnk_edit = "</a> --- <a href='".$this->lnk_admin_edit['link'].
+ $val['id']."'>[".$this->lnk_admin_edit['text']."]"; }
+ else
+ { $lnk_edit = ''; }
+
+ $template_datas['links'][]=array(
+ 'LABEL' => $val['text'].$lnk_edit,
+ 'URL' => $val['link']
+ );
+ }
+
+ $template->assign("datas", $template_datas);
+ }
+
+ /*
+ init section
+ */
+ function init_section()
+ {
+ global $tokens, $page;
+
+ if ($tokens[0] == $this->section)
+ { $page['section'] = $this->section; }
+ }
+
+ /*
+ loads a page
+ */
+ function call_page()
+ {
+ global $page, $user;
+
+ if($page['section'] == $this->section)
+ {
+ @call_user_func($this->callback_page_function);
+ }
+ }
+
+} //class public_integration
+
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/tables.class.inc.php b/plugins/grum_plugins_classes-2/tables.class.inc.php
new file mode 100755
index 000000000..f29092caa
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/tables.class.inc.php
@@ -0,0 +1,447 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: manage_tables
+ class version: 1.3
+ date: 2007-12-02
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this class provides base functions to manage tables while plugin installation
+ - constructor manage_tables($tables)
+ - (public) function create_tables($tables_def)
+ - (public) function update_tables_fields($tables_alteration)
+ - (public) function drop_tables()
+ - (public) function rename_tables($list) -v1.1
+ - (public) function tables_exists() -v1.1
+ - (public) function export($filename, $options, $tables, $infos) -v1.3
+ - (public) function multi_queries($queries) -v1.3
+ - (public) function import($filename) -v1.3
+
+ ------------------------------------------------------------------------------
+ v1.1 + add rename_tables($list) function
+ + add tables_exists() function
+ v1.2 + add export($filename, $options, $tables) function
+ v1.3 + modify export($filename, $options, $tables, $infos, $resultboolean) function
+ + new parameters '$infos' allows to add some information on the
+ exported file
+ + add 'delete' and 'colnames' options
+ + $resultbooelan option for return
+ + add multi_queries($queries) function
+ + add import($filename) function
+
+ -------------------------------------------------------------------------- */
+class manage_tables
+{
+ var $tables; //array of tables names
+ var $version = "1.3";
+
+ function manage_tables($tables)
+ {
+ $this->tables = $tables;
+ }
+
+ /*
+ create tables
+ $tables_def is an array of SQL CREATE queries
+
+ return true if everything is ok, otherwise tablename
+ */
+ function create_tables($tables_def)
+ {
+ //deleting tables if exists
+ $this->drop_tables();
+
+ for($i=0;$i<count($tables_def);$i++)
+ {
+ $result=pwg_query($tables_def[$i]);
+ if(!$result)
+ {
+ //if an error occurs, deleting created tables
+ $this->drop_tables();
+ return(false);
+ }
+ }
+ return(true);
+ }
+
+ /* update tables definition
+ $tables_alteration : array of arrays
+ example :
+ $tables_alteration['table1']=array(
+ "attribute1" => " ADD COLUMN `attribute1` text null default ''",
+ "attribute2" => " ADD COLUMN `attribute2` text null default ''"));
+ $tables_alteration['table2']=array(
+ "attribute1" => " ADD COLUMN `attribute1` text null default ''",
+ "attribute2" => " ADD COLUMN `attribute2` text null default ''"));
+
+ return true if no error, otherwise return table.fields of error
+ */
+ function update_tables_fields($tables_alteration)
+ {
+ if(!is_array($tables_alteration))
+ {
+ return('');
+ }
+
+ reset($tables_alteration);
+ while (list($key, $val) = each($tables_alteration))
+ {
+ $sql="SHOW COLUMNS FROM $key";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $columns=array();
+ while($row=mysql_fetch_assoc($result))
+ {
+ array_push($columns, $row['Field']);
+ }
+
+ reset($val);
+ while (list($attname, $sql) = each($val))
+ {
+ if(!in_array($attname, $columns))
+ {
+ $result=pwg_query("ALTER TABLE `$key` ".$sql);
+ if(!$result)
+ {
+ return($key.".".$attname);
+ }
+ }
+ }
+ }
+ }
+ return(true);
+ }
+
+
+ /*
+ delete tables listed in $this->tables_list
+ */
+ function drop_tables()
+ {
+ foreach($this->tables as $key => $table_name)
+ {
+ $sql="DROP TABLE IF EXISTS ".$table_name;
+ $result=pwg_query($sql);
+ }
+ }
+
+ /*
+ rename tables name of list
+ $list is an array('old_name' => 'new_name')
+ return true if ok, else old table name
+ */
+ function rename_tables($list)
+ {
+ $tmplist=array_flip($this->tables);
+ foreach($list as $key => $val)
+ {
+ if(isset($tmplist[$key]))
+ {
+ $this->tables[$tmplist[$key]] = $val;
+ $sql="ALTER TABLE `$key` RENAME TO `$val`";
+ if(!pwg_query($sql))
+ {
+ return($key);
+ }
+ }
+ else
+ {
+ return($key);
+ }
+ }
+ return(true);
+ }
+
+ /*
+ return true if all listed tables exists
+ */
+ function tables_exists()
+ {
+ $list=array_flip($this->tables);
+ $sql="SHOW TABLES";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_row($result))
+ {
+ if(isset($list[$row[0]]))
+ {
+ array_splice($list, $row[0],1);
+ }
+ }
+ }
+ if(count($list)>0)
+ {
+ return(false);
+ }
+ else
+ {
+ return(true);
+ }
+ }
+
+ /*
+ export all tables as SQL in a text file
+
+ each query end with a " -- EOQ" ; it's just a method to increase parsing for
+ import function
+
+ $filename : name of the file
+ $options : array of options like
+ array(
+ 'drop' => true/false, //add DROP TABLE statements
+ 'create' => true/false, //add CREATE TABLE statements
+ 'insert' => true/false, //add INSERT statements
+ 'delete' => true/false, //add delete statements
+ 'colnames' => true/false, //add columns names for inserts statements
+ )
+ $tables : array of tables names to export
+ array('tablename1', 'tablenamen', 'tablename3', ...)
+ if empty, assume that all tables have to be exported
+ $infos : additional info written in exported file (as comment)
+ $resultboolean : if true, result is true/false ;
+ if false, if result, return a string with nfo about export
+ */
+ function export($filename, $options=array(), $tables=array(), $infos="", $resultboolean=true)
+ {
+ $defaultopt=array(
+ 'drop' => true,
+ 'create' => true,
+ 'insert' => true,
+ 'delete' => false,
+ 'colnames' => false
+ );
+
+ if(!isset($options['drop']))
+ {
+ $options['drop']=$defaultopt['drop'];
+ }
+ if(!isset($options['create']))
+ {
+ $options['create']=$defaultopt['create'];
+ }
+ if(!isset($options['insert']))
+ {
+ $options['insert']=$defaultopt['insert'];
+ }
+ if(!isset($options['delete']))
+ {
+ $options['delete']=$defaultopt['delete'];
+ }
+ if(!isset($options['colnames']))
+ {
+ $options['colnames']=$defaultopt['colnames'];
+ }
+ if(count($tables)==0)
+ {
+ $tables=$this->tables;
+ }
+
+ $resultnfo='';
+
+ $returned=true;
+ $text='
+-- *************************************************************** -- EOQ
+-- * SQL export made with Grum Plugins Classes (Export tool r'.$this->version.') -- EOQ
+-- * Export date :'.date('Y-m-d H:i:s').' -- EOQ
+-- * Export options :';
+if($options['drop']){$text.=' [drop]';}
+if($options['delete']){$text.=' [delete]';}
+if($options['create']){$text.=' [create]';}
+if($options['insert']){$text.=' [insert]';}
+if($options['colnames']){$text.=' [colnames]';}
+$text.=" -- EOQ";
+if($infos!="")
+{
+ $text.='
+-- * '.$infos." -- EOQ";
+}
+$text.='
+-- *************************************************************** -- EOQ
+
+';
+ foreach($tables as $key => $val)
+ {
+ $countelems=0;
+
+ $text.="
+
+-- *************************************************************** -- EOQ
+-- * Statements for ".$this->tables[$key]." table -- EOQ
+-- *************************************************************** -- EOQ
+";
+
+ if($options['drop'])
+ {
+ $text.=sprintf("DROP TABLE `%s`; -- EOQ\n", $this->tables[$key]);
+ }
+
+ if($options['delete'])
+ {
+ $text.=sprintf("DELETE FROM `%s`; -- EOQ\n", $this->tables[$key]);
+ }
+
+ if($options['create'])
+ {
+ $sql='SHOW CREATE TABLE '.$this->tables[$key];
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_row($result))
+ {
+ $text.=sprintf("%s; -- EOQ\n", $row[1]);
+ }
+ }
+ else
+ {
+ $returned=false;
+ }
+ }
+
+ if($options['insert'])
+ {
+ $colnames="";
+ if($options['colnames'])
+ {
+ $sql='SHOW COLUMNS FROM `'.$this->tables[$key].'`';
+ $result=pwg_query($sql);
+ if($result)
+ {
+ $tmp=array();
+ while($row=mysql_fetch_row($result))
+ {
+ $tmp[]=$row[0];
+ }
+ }
+ $colnames='('.implode(',', $tmp).')';
+ }
+
+ $sql='SELECT * FROM '.$this->tables[$key];
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_row($result))
+ {
+ foreach($row as $key2 => $val2)
+ {
+ $row[$key2]="'".addslashes($val2)."'";
+ }
+ $text.=sprintf("INSERT INTO `%s` %s VALUES(%s); -- EOQ\n", $this->tables[$key], $colnames, implode(', ', $row));
+ $countelems++;
+ }
+ }
+ else
+ {
+ $returned=false;
+ }
+ $resultnfo.=$key.':'.$countelems.'@';
+ }
+ }
+ $fhandle=fopen($filename, 'wb');
+ if($fhandle)
+ {
+ fwrite($fhandle, $text);
+ fclose($fhandle);
+ }
+ else
+ {
+ $returned=false;
+ }
+ if(($resultboolean==false)&&($returned))
+ {
+ $returned=$resultnfo;
+ }
+ return($returned);
+ }
+
+ /*
+ import an .sql file
+ $filename : name of the file
+ 'errors' : -1 file don't exists
+ -2 can't open file
+ */
+ function import($filename)
+ {
+ $return = array(
+ 'numinsert'=>0,
+ 'numdelete'=>0,
+ 'numdrop'=>0,
+ 'numcreate'=>0,
+ 'errors'=>array(),
+ 'total_ok'=>0
+ );
+
+ if(file_exists($filename))
+ {
+ $fhandle=fopen($filename, 'r');
+ if($fhandle)
+ {
+ $queries=fread($fhandle, filesize($filename));
+ fclose($fhandle);
+ $return=$this->multi_queries($queries);
+ }
+ else
+ {
+ $return['errors']=-2;
+ }
+ }
+ else
+ {
+ $return['errors']=-1;
+ }
+ return($return);
+ }
+
+ /*
+ execute multiple query
+ each query have to be separated by a "-- EOQ\n"
+
+ $queries : sql queries
+ */
+ function multi_queries($queries)
+ {
+ $queries_list=preg_split(
+ '/\s*;?\s*--\s+EOQ[\r\n]{1}/i', $queries, -1, PREG_SPLIT_NO_EMPTY);
+
+ $return = array(
+ 'numinsert'=>0,
+ 'numdelete'=>0,
+ 'numdrop'=>0,
+ 'numcreate'=>0,
+ 'errors'=>array(),
+ 'total_ok'=>0
+ );
+
+ $i=0;
+ foreach($queries_list as $key => $sql)
+ {
+ $i++;
+ @$result=pwg_query($sql);
+ if($result)
+ {
+ $return['total_ok']++;
+ if(preg_match('/\b[\s]*insert[\s]+/i', $sql)>0)
+ {$return['numinsert']++;}
+ elseif(preg_match('/\b[\s]*drop[\s]+/i', $sql)>0)
+ {$return['numdrop']++;}
+ elseif(preg_match('/\b[\s]*delete[\s]+/i', $sql)>0)
+ {$return['numdelete']++;}
+ elseif(preg_match('/\b[\s]*create[\s]+/i',$sql)>0)
+ {$return['numcreate']++;}
+ }
+ else
+ {
+ array_push($return['errors'], '['.$i.'] '.$sql);
+ }
+ }
+ return($return);
+ }
+
+} //class
+
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/translate.class.inc.php b/plugins/grum_plugins_classes-2/translate.class.inc.php
new file mode 100755
index 000000000..255e5542d
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/translate.class.inc.php
@@ -0,0 +1,192 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: translate
+ class version: 2.0.1
+ date: 2008-05-25
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to manage call to "translate.google.com"
+
+ release 2.x use durect call to Google Translate AJAX API, so all functions
+ from PHP class are removed (except for "can_translate")
+ class call API in HTML header, and provide a .js file manage API call
+
+ - constructor translate()
+ - (public) function can_translate($from, $to) //v1.1
+
+ version 1.1.1
+ - google have changed HTML code for translation page ; change search string of translation result
+ - bug corrected : if language given with uppercase, force them to lowercase
+ version 2.0.0
+ - use of Google Translate javascript API
+ >> http://code.google.com/apis/ajaxlanguage/
+
+ ---------------------------------------------------------------------- */
+class translate
+{
+ var $language_list;
+
+ function translate()
+ {
+ //alloweds from->to transations languages
+ $this->language_list=array_flip(
+ array(
+ 'ar', //arabic
+ 'bg', //Bulgarian
+ 'zh', //Chinese (simplified)
+ 'hr', //Croatian
+ 'cs', //Czech
+ 'da', //Danish
+ "nl", //Dutch
+ 'en', //English
+ 'fi', //Finnish
+ "fr", //French
+ "de", //German
+ "el", //Greek
+ 'hi', //Hindi
+ "it", //Italian
+ "ja", //Japanese
+ "ko", //Korean
+ 'no', //Norwegian
+ 'pl', //Polish
+ "pt", //Portuguese
+ 'ro', //Romanian
+ "ru", //Russian
+ "es", //Spanish
+ 'sv' //Swedish
+ )
+ );
+ add_event_handler('loc_end_page_header', array(&$this, 'load_JS'));
+ }
+
+ function load_JS()
+ {
+ global $template;
+
+ $googleload='
+<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript" src="plugins/'.basename(dirname(__FILE__)).'/google_translate.js"></script>';
+
+ $template->append('head_elements', $googleload);
+
+
+ }
+
+ function can_translate($from, $to)
+ {
+ if(isset($this->language_list[strtolower($from)])&&isset($this->language_list[strtolower($to)]))
+ {
+ return(true);
+ }
+ else
+ {
+ return(false);
+ }
+ }
+
+
+/*
+ theses methods are removed for direct use of the Google AJAX API (better choice for
+ performance)
+
+ how to :
+ create one instance of this classe
+ classe can be used by server to know authorized language to be translated
+ all translations have to be made with javascript functions
+
+ =8<===========================================================================
+
+ function set_languages($lang)
+ {
+ $pair=explode('|', strtolower($lang));
+
+ if(isset($this->language_list[$pair[0]])&&isset($this->language_list[$pair[1]]))
+ {
+ $this->from_to_lang=strtolower($lang);
+ }
+ return($this->from_to_lang);
+ }
+
+ function get_languages()
+ {
+ return($this->from_to_lang);
+ }
+
+ function set_input_charset($charset)
+ {
+ $this->input_charset=$charset;
+ }
+
+ function get_input_charset($charset)
+ {
+ return($this->input_charset);
+ }
+
+ function set_output_charset($charset)
+ {
+ $this->output_charset=$charset;
+ }
+
+ function get_output_charset($charset)
+ {
+ return($this->output_charset);
+ }
+
+ function do_translation($text)
+ {
+ if(ini_get('allow_url_fopen')!="1")
+ {
+ return("");
+ }
+
+ $req="http://translate.google.com/translate_t?text=".urlencode($text).
+ "&langpair=".strtolower($this->from_to_lang);
+ if($this->input_charset!="")
+ {
+ $req.="&ie=".$this->input_charset;
+ }
+ if($this->output_charset!="")
+ {
+ $req.="&oe=".$this->output_charset;
+ }
+
+ $handle=fopen($req, "r");
+ if($handle)
+ {
+ $contents="";
+ while (!feof($handle))
+ {
+ $contents .= fread($handle, 4196);
+ }
+ fclose($handle);
+
+ $search="<div id=result_box dir=\"ltr\">";
+ $p = strpos($contents, $search);
+ if($p>0)
+ {
+ $contents=substr($contents, $p+strlen($search));
+ $search="</div>";
+ $p = strpos($contents, $search);
+ $contents=substr($contents, 0, $p);
+ }
+ else
+ {
+ $contents="";
+ }
+
+ return($contents);
+ }
+ else
+ {
+ return("");
+ }
+ }
+*/
+
+} //class
+
+?> \ No newline at end of file
diff --git a/plugins/grum_plugins_classes-2/users_groups.class.inc.php b/plugins/grum_plugins_classes-2/users_groups.class.inc.php
new file mode 100755
index 000000000..235199f7c
--- /dev/null
+++ b/plugins/grum_plugins_classes-2/users_groups.class.inc.php
@@ -0,0 +1,290 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: allowed_access, groups, users
+ class version: 1.0
+ date: 2007-10-31
+ ------------------------------------------------------------------------------
+ author: grum at grum.dnsalias.com
+ << May the Little SpaceFrog be with you >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to manage users/groups access
+ groups and users classes extends allowed_access classes
+
+ - constructor allowed_access($alloweds="")
+ - constructor groups($alloweds="")
+ - constructor users($alloweds="")
+ - (public) function get_list()
+ - (public) function set_allowed($id, $allowed)
+ - (public) function set_alloweds()
+ - (public) function get_alloweds($return_type)
+ - (public) function is_allowed($id)
+ - (public) function html_view($sep=", ", $empty="")
+ - (public) function html_form($basename)
+ - (private) function init_list()
+ ---------------------------------------------------------------------- */
+class allowed_access
+{
+ var $access_list;
+
+ /*
+ constructor initialize the groups_list
+ */
+ function allowed_access($alloweds = "")
+ {
+ $this->init_list();
+ $this->set_alloweds($alloweds);
+ }
+
+ /*
+ initialize the groups list
+ */
+ function init_list()
+ {
+ $this->access_list=array();
+ }
+
+ /*
+ returns list (as an array)
+ */
+ function get_list()
+ {
+ return($this->access_list);
+ }
+
+ /*
+ set element an allowed state
+ */
+ function set_allowed($id, $allowed)
+ {
+ if(isset($this->access_list[$id]))
+ {
+ $this->access_list[$id]['allowed']=$allowed;
+ }
+ }
+
+ /*
+ set a group enabled/disabled state
+ */
+ function set_state($id, $enabled)
+ {
+ if(isset($this->access_list[$id]))
+ {
+ $this->access_list[$id]['enabled']=$enabled;
+ }
+ }
+
+ /*
+ set alloweds list
+ $list is string of id, separated with "/"
+ */
+ function set_alloweds($list)
+ {
+ $alloweds=explode("/", $list);
+ $alloweds=array_flip($alloweds);
+ foreach($this->access_list as $key => $val)
+ {
+ if(isset($alloweds[$key]))
+ {
+ $this->access_list[$key]['allowed']=true;
+ }
+ else
+ {
+ $this->access_list[$key]['allowed']=false;
+ }
+ }
+ }
+
+ /*
+ get alloweds list
+ return a string of groups, separated with "/"
+ */
+ function get_alloweds($return_type = 'name')
+ {
+ $returned="";
+ foreach($this->access_list as $key => $val)
+ {
+ if($val['allowed'])
+ { $returned.=$val[$return_type]."/"; }
+ }
+ return($returned);
+ }
+
+
+ /*
+ returns true if is allowed
+ */
+ function is_allowed($id)
+ {
+ if(isset($this->access_list[$id]))
+ { return($this->access_list[$id]['allowed']); }
+ else
+ { return(false); }
+ }
+
+ /*
+ returns true if all or one is allowed
+ ids is an array
+ */
+ function are_allowed($ids, $all=false)
+ {
+ foreach($ids as $val)
+ {
+ if($all)
+ {
+ if(!$this->is_allowed($val))
+ {
+ return(false);
+ }
+ }
+ else
+ {
+ if($this->is_allowed($val))
+ {
+ return(true);
+ }
+ }
+ }
+ return(false);
+ }
+
+ /*
+ returns an HTML list with label rather than id
+ */
+ function html_view($sep=", ", $empty="")
+ {
+ $returned="";
+ foreach($this->access_list as $key => $val)
+ {
+ if($val['allowed'])
+ {
+ if($returned!="")
+ {
+ $returned.=$sep;
+ }
+ $returned.=$val['name'];
+ }
+ }
+ if($returned=="")
+ {
+ $returned=$empty;
+ }
+ return($returned);
+ }
+ /*
+ returns a generic HTML form to manage the groups access
+ */
+ function html_form($basename)
+ {
+ /*
+ <!-- BEGIN allowed_group_row -->
+ <label><input type="checkbox" name="fmypolls_att_allowed_groups_{allowed_group_row.ID}" {allowed_group_row.CHECKED}/>&nbsp;{allowed_group_row.NAME}</label>
+ <!-- END allowed_group_row -->
+ */
+ $text='';
+ foreach($this->access_list as $key => $val)
+ {
+ if($val['allowed'])
+ {
+ $checked=' checked';
+ }
+ else
+ {
+ $checked='';
+ }
+
+ if($val['enabled'])
+ {
+ $enabled='';
+ }
+ else
+ {
+ $enabled=' disabled';
+ }
+
+ $text.='<label><input type="checkbox" name="'.$basename.$val['id'].'" '.$checked.$enabled.'/>
+ &nbsp;'.$val['name'].'</label>&nbsp;';
+ }
+ return($text);
+ }
+} //allowed_access
+
+
+
+
+
+
+
+
+/* ----------------------------------------------------------------------
+ this class provides base functions to manage groups access
+ init_list redefined to initialize access_list from database GROUPS
+ ---------------------------------------------------------------------- */
+class groups extends allowed_access
+{
+ /*
+ initialize the groups list
+ */
+ function init_list()
+ {
+ $this->access_list=array();
+ $sql="SELECT id, name FROM ".GROUPS_TABLE." ORDER BY name";
+ $result=pwg_query($sql);
+ if($result)
+ {
+ while($row=mysql_fetch_assoc($result))
+ {
+ $this->access_list[$row['id']] =
+ array('id' => $row['id'],
+ 'name' => $row['name'],
+ 'allowed' => false,
+ 'enabled' => true);
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+/* -----------------------------------------------------------------------------
+ this class provides base functions to manage users access
+----------------------------------------------------------------------------- */
+class users extends allowed_access
+{
+ /*
+ constructor
+ */
+ function users($alloweds = "")
+ {
+ parent::allowed_access($alloweds);
+ $this->set_state('admin', false);
+ $this->set_allowed('admin', true);
+ }
+
+ /*
+ initialize the groups list
+ */
+ function init_list()
+ {
+ $users_list = array('guest', 'generic', 'normal', 'admin');
+ $this->access_list=array();
+ foreach($users_list as $val)
+ {
+ $this->access_list[$val] =
+ array('id' => $val,
+ 'name' => l10n('user_status_'.$val),
+ 'allowed' => false,
+ 'enabled' => true);
+ }
+ }
+} //class users
+
+
+
+?> \ No newline at end of file
diff --git a/plugins/test_menu/index.php b/plugins/test_menu/index.php
new file mode 100755
index 000000000..db1eae0d9
--- /dev/null
+++ b/plugins/test_menu/index.php
@@ -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();
+?>
diff --git a/plugins/test_menu/main.inc.php b/plugins/test_menu/main.inc.php
new file mode 100755
index 000000000..72abbe9e6
--- /dev/null
+++ b/plugins/test_menu/main.inc.php
@@ -0,0 +1,53 @@
+<?php
+/*
+Plugin Name: Test Menu
+Version: 1.0.0
+Description: Plugin pour montrer l'usage de la classe Menu / Plugin to show usage of the class Menu
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=
+*/
+
+/*
+--------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.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
+
+--------------------------------------------------------------------------------
+*/
+
+// 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('TEST_MENU_DIR' , basename(dirname(__FILE__)));
+define('TEST_MENU_PATH' , PHPWG_PLUGINS_PATH . TEST_MENU_DIR . '/');
+
+define('TEST_MENU_VERSION' , '1.0.0'); // => ne pas oublier la version dans l'entête !!
+
+global $prefixeTable, $menu;
+
+include_once("menu.class.inc.php");
+
+function filemenu()
+{
+ return(TEST_MENU_PATH."menubar.inc.php");
+}
+
+$menu = new Menu();
+
+if(basename($_SERVER["PHP_SELF"])!='admin.php')
+{
+ add_event_handler('menubar_file', 'filemenu');
+}
+
+
+?>
diff --git a/plugins/test_menu/maintain.inc.php b/plugins/test_menu/maintain.inc.php
new file mode 100644
index 000000000..5aa42e213
--- /dev/null
+++ b/plugins/test_menu/maintain.inc.php
@@ -0,0 +1,44 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+ini_set('error_reporting', E_ALL);
+ini_set('display_errors', true);
+
+define('TEST_MENU_DIR' , basename(dirname(__FILE__)));
+define('TEST_MENU_PATH' , PHPWG_PLUGINS_PATH . TEST_MENU_DIR . '/');
+
+include_once("menu.class.inc.php");
+
+function plugin_install($plugin_id, $plugin_version, &$errors)
+{
+/* -[note]----------------------------------------------------------------------
+In normal case, piwigo's registered items of the $menu object are not
+initialized by a plugin, but by piwigo (while the install process).
+Piwigo's default registered items are initialized here to give a "how to"
+example of the classe
+----------------------------------------------------------------------------- */
+ $menu=new Menu();
+ $menu->register('mbLinks', 'Links', 1, 'piwigo');
+ $menu->register('mbCategories', 'Categories', 2, 'piwigo');
+ $menu->register('mbTags', 'Related tags', 3, 'piwigo');
+ $menu->register('mbSpecial', 'special_categories', 4, 'piwigo');
+ $menu->register('mbMenu', 'title_menu', 5, 'piwigo');
+ $menu->register('mbIdentification', 'identification', 6, 'piwigo');
+}
+
+function plugin_activate($plugin_id, $plugin_version, &$errors)
+{
+}
+
+function plugin_deactivate($plugin_id)
+{
+}
+
+function plugin_uninstall($plugin_id)
+{
+}
+
+
+
+?>
diff --git a/plugins/test_menu/menu.class.inc.php b/plugins/test_menu/menu.class.inc.php
new file mode 100644
index 000000000..d37a8345e
--- /dev/null
+++ b/plugins/test_menu/menu.class.inc.php
@@ -0,0 +1,500 @@
+<?php
+
+/* -----------------------------------------------------------------------------
+ class name: menu, blocks
+ class version: 1.0
+ date: 2008-07-25
+
+ ------------------------------------------------------------------------------
+ Author : Grum
+ email : grum@grum.dnsalias.com
+ website : http://photos.grum.dnsalias.com
+ PWG user : http://forum.phpwebgallery.net/profile.php?id=3706
+
+ << May the Little SpaceFrog be with you ! >>
+ ------------------------------------------------------------------------------
+
+ this classes provides base functions to manage the public gallery menu
+
+ ** The Section class **
+ This class allows you to easily make a section block for the menu
+ Public methods
+ get_id()
+ get_name()
+ get_template()
+ get_position()
+ get_tag()
+ get_items()
+ set_name($value)
+ set_template($value)
+ set_tag($value)
+ set_items($value)
+ items_count()
+ get()
+ Constructor
+ $id : section's id have to be unique in the menu
+ $name : section's name is displayed on the menu
+ $template : name of smarty template file ; if file doesn't exist, use of the
+ generic template
+ $tag : a facultative data ; use it as you want !
+ $items : items of the menu : no specfic structure because it depends of
+ the template model
+
+ ** The Menu class **
+ This class allows to easily manage the menu
+ Public methods
+ add($section_datas)
+ remove($id)
+ replace($section_datas)
+ clear()
+ section($id)
+ sections()
+ ids()
+ count()
+ register($id, $name, $position, $owner)
+ register_position($id, $position)
+ unregister($id)
+ registered()
+ apply()
+
+ How to use Menu class :
+ 1/ create an instance
+ $menu = new Menu();
+ instance have to be created by piwigo, plugin have to use of a global
+ variable
+
+ 2/ register your menu section
+ register a section allows to know sections even if $menu is not loaded
+ register a section allows to manage position into menu
+ register function only reference some information about section, it does
+ not create the section of menu (an only registered section is not
+ displayed in menu)
+ best place to register a section : when plugin is activated
+ when deactivate plugin, unregister the section
+
+ 3/ add section to menu
+ add a section allows to really create section into menu
+
+
+
+
+ ------------------------------------------------------------------------------
+ :: HISTORY
+
+ 1.0.0 - 2008-07-25
+ first lines of code...
+
+ --------------------------------------------------------------------------- */
+
+// theses constant ave to be adapted for a piwigo's integration
+define('MENU_TEMPLATES_DIR' , dirname(__FILE__));
+define('MENU_TEMPLATES_PATH' , MENU_TEMPLATES_DIR . '/menu_templates/');
+define('MENU_REGISTERED_PATH' ,
+ PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+
+
+class Menu
+{
+ protected $sections=array(); //array key is unique ID of sections
+ protected $registered_sections=array();
+ protected $registered_file="registered.dat";
+
+ public function Menu()
+ {
+ $this->load_registered();
+ }
+
+ /*
+ public functions
+ */
+ public function add($section_datas)
+ {
+ // add a section to the menu ; datas can be made with the Section class
+ if($this->section_is_valid($section_datas) and
+ !isset($this->sections[$section_datas['ID']]) )
+ {
+ $this->sections[$section_datas['ID']]=$section_datas;
+
+ if(isset($this->registered_sections[$section_datas['ID']]))
+ {
+ $this->sections[$section_datas['ID']]['POSITION']=$this->registered_sections[$section_datas['ID']]['POSITION'];
+ }
+ else
+ {
+ $this->sections[$section_datas['ID']]['POSITION']=0;
+ }
+ return(true);
+ }
+ return(false);
+ }
+
+ public function remove($id)
+ {
+ // remove a section from the menu
+ unset($this->sections[$id]);
+ }
+
+ public function replace($section_datas)
+ {
+ // replace an existing section description by another one
+ if($this->section_is_valid($section_datas) and
+ isset($this->sections[$section_datas['ID']]) )
+ {
+ $this->sections[$section_datas['ID']]=$section_datas;
+ return(true);
+ }
+ return(false);
+ }
+
+ public function clear()
+ {
+ // clear all sections of the menu
+ $this->sections=array();
+ }
+
+ public function section($id)
+ {
+ //return a section structure or false if requested ID not exists
+ if(isset($this->sections[$id]))
+ {
+ return($this->sections[$id]);
+ }
+ return(false);
+ }
+
+ public function sections()
+ {
+ //return all sections
+ return($this->sections);
+ }
+
+ public function ids()
+ {
+ //return all section's ids
+ return(array_keys($this->sections));
+ }
+
+ public function count()
+ {
+ //return number of sections
+ return(count($this->sections));
+ }
+
+ public function register($id, $name, $position, $owner)
+ {
+ /*
+ register section for menu ; register a section allows to know sections list
+ even if menu is not made (ie: we are in admin interface)
+
+ register a section is not adding a section : it's just for making a list of
+ potential sections.
+ you can add in the menu a section who is not registered
+
+ $id : section id
+ $name : name of section
+ $position : position of section
+ $owner : owner of section (piwigo or plugin's name)
+ */
+ if(!isset($this->registered_sections[$id]))
+ {
+ if($position<1)
+ {
+ $position=1;
+ }
+ $this->registered_sections[$id]=array(
+ 'NAME' => $name,
+ 'POSITION'=>$position,
+ 'OWNER' => $owner
+ );
+ $this->register_position($id, $position);
+ //$this->save_registered(); ==> made with register_position
+ return(true);
+ }
+ return(false);
+ }
+
+ public function unregister($id)
+ {
+ // just unregister a section from menu
+ if(isset($this->registered_sections[$id]))
+ {
+ unset($this->registered_sections[$id]);
+ $this->registered_sections=$this->renum_position($this->registered_sections);
+ $this->save_registered();
+ return(true);
+ }
+ return(false);
+ }
+
+ public function register_position($id, $position)
+ {
+ // register a new position for section
+ // if a section already have the same position, all section are shifted
+
+ // sort registered sections by position
+ $this->sort_registered();
+ //preparing sections
+ $incpos=false;
+ foreach($this->registered_sections as $key => $val)
+ {
+ if(($val['POSITION']==$position)and($key!=$id))
+ {
+ $incpos=true;
+ }
+ if(($incpos)and($key!=$id))
+ {
+ $this->registered_sections[$key]['POSITION']++;
+ }
+ }
+ //affect new position
+ $this->registered_sections[$id]['POSITION']=$position;
+ //sort
+ $this->sort_registered();
+ //renum positions
+ $this->registered_sections=$this->renum_position($this->registered_sections);
+ $this->save_registered();
+ }
+
+ public function registered()
+ {
+ // return list of registered sections
+ return($this->registered_sections);
+ }
+
+ public function apply()
+ {
+ //apply datas on the template
+ global $template;
+
+ $template->set_filenames(
+ array('menubar' => MENU_TEMPLATES_PATH.'menubar_main.tpl')
+ );
+
+ trigger_action('loc_begin_menubar');
+ $this->sort();
+ $template->assign('sections', $this->sections);
+ trigger_action('loc_end_menubar');
+
+ $template->assign_var_from_handle('MENUBAR', 'menubar');
+ }
+
+ /*
+ protected functions
+ */
+ protected function section_is_valid($section_datas)
+ {
+ if(is_array($section_datas) and
+ isset($section_datas['ID']) and
+ isset($section_datas['NAME']) and
+ isset($section_datas['TEMPLATE']) and
+ isset($section_datas['ITEMS']) and
+ isset($section_datas['TAG']))
+ {
+ return(true);
+ }
+ return(false);
+ }
+
+ protected function load_registered()
+ {
+ //load registered sections : database or file ??
+ $this->registered_sections=array();
+
+ $filename=MENU_REGISTERED_PATH.$this->registered_file;
+
+ if(file_exists($filename))
+ {
+ $fhandle=fopen($filename, "r");
+ if($fhandle)
+ {
+ $datas=fread($fhandle, filesize($filename));
+ fclose($fhandle);
+ $this->registered_sections=unserialize($datas);
+ return(true);
+ }
+ }
+ return(false);
+ }
+
+ protected function save_registered()
+ {
+ //save registered sections : database or file ??
+ $filename=MENU_REGISTERED_PATH.$this->registered_file;
+
+ $fhandle=fopen($filename, "w");
+ if($fhandle)
+ {
+ $written=fwrite($fhandle, serialize($this->registered_sections));
+ fclose($fhandle);
+ return($written);
+ }
+ return(false);
+ }
+
+
+ protected function sort()
+ {
+ $tmp=$this->sections;
+ uksort($tmp, array(&$this, 'sort_sections_cmpfct'));
+ $this->sections=$tmp;
+ }
+
+ protected function sort_registered()
+ {
+ $tmp=$this->registered_sections;
+ uksort($tmp, array(&$this, 'sort_registered_cmpfct'));
+ $this->registered_sections=$tmp;
+ }
+
+
+ private function sort_sections_cmpfct($a, $b)
+ {
+ if($this->sections[$a]['POSITION']==$this->sections[$b]['POSITION'])
+ {
+ return(($this->sections[$a]['ID']<$this->sections[$b]['ID'])?-1:1);
+ }
+ return(($this->sections[$a]['POSITION']<$this->sections[$b]['POSITION'])?-1:1);
+ }
+
+ private function sort_registered_cmpfct($a, $b)
+ {
+ return(($this->registered_sections[$a]['POSITION']<$this->registered_sections[$b]['POSITION'])?-1:1);
+ }
+
+ private function renum_position($datas)
+ {
+ $i=1;
+ foreach($datas as $key => $val)
+ {
+ $datas[$key]['POSITION']=$i;
+ $i+=1;
+ }
+ return($datas);
+ }
+
+
+
+
+} // class Menu
+
+
+
+
+
+class Section
+{
+ protected $name;
+ protected $template="generic.tpl";
+ protected $id;
+ protected $tag;
+ protected $items=array();
+
+ public function Section($id, $name, $template="", $tag="")
+ {
+ $this->id = $id;
+ $this->tag = $tag;
+ $this->set_name($name);
+ if(!$this->set_template($template))
+ {
+ $this->template=MENU_TEMPLATES_PATH."generic.tpl";
+ }
+
+ } // constructor
+
+ /*
+ public functions
+ */
+ public function get()
+ {
+ //this method returns a data structure ready to be used with the Menu class
+ return(
+ array(
+ 'ID' => $this->id,
+ 'NAME' => $this->name,
+ 'TEMPLATE' => $this->template,
+ 'ITEMS' => $this->items,
+ 'TAG' => $this->tag
+ )
+ );
+ }
+
+ public function get_id()
+ {
+ return($this->id);
+ }
+
+ public function get_name()
+ {
+ return($this->name);
+ }
+
+ public function get_template()
+ {
+ return($this->template);
+ }
+
+ public function get_tag()
+ {
+ return($this->tag);
+ }
+
+ public function get_items()
+ {
+ return($this->items);
+ }
+
+ public function set_name($value)
+ {
+ $this->name=$value;
+ }
+
+ public function set_template($value)
+ {
+ if($this->is_template($value))
+ {
+ $this->template=$value;
+ return(true);
+ }
+ return(false);
+ }
+
+ public function set_tag($value)
+ {
+ $this->tag=$value;
+ }
+
+ public function set_items($value)
+ {
+ $this->items=$value;
+ }
+
+ public function items_count()
+ {
+ if(is_array($this->items))
+ {
+ return(count($this->items));
+ }
+ else
+ {
+ return(-1);
+ }
+ }
+
+ /*
+ protected functions
+ */
+ protected function is_template($templatename)
+ {
+ if(file_exists($templatename) and (preg_match('/.+\.tpl$/i',$templatename)))
+ {
+ return(true);
+ }
+ return(false);
+ } // is_template
+
+} //class Section
+
+
+
+
+?> \ No newline at end of file
diff --git a/plugins/test_menu/menu_templates/menubar.tpl b/plugins/test_menu/menu_templates/menubar.tpl
new file mode 100644
index 000000000..0bc538e87
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar.tpl
@@ -0,0 +1,165 @@
+{* $Id: menubar.tpl 2409 2008-07-01 02:09:21Z rvelices $ *}
+
+<div id="menubar">
+{if not empty($links)}
+<dl id="mbLinks">
+ <dt>{'Links'|@translate}</dt>
+ <dd>
+ <ul>
+ {foreach from=$links item=link}
+ <li>
+ <a href="{$link.URL}"
+ {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME|@escape:'javascript'}','{$link.new_window.FEATURES|@escape:'javascript'}'); return false;"{/if}
+ >
+ {$link.LABEL}
+ </a>
+ </li>
+ {/foreach}{*links*}
+ </ul>
+ </dd>
+</dl>
+{/if}{*links*}
+
+ {if isset($U_START_FILTER)}
+ <a href="{$U_START_FILTER}" title="{'start_filter_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_filter.png" class="button" alt="start filter"></a>
+ {/if}
+ {if isset($U_STOP_FILTER)}
+ <a href="{$U_STOP_FILTER}" title="{'stop_filter_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_filter.png" class="button" alt="stop filter"></a>
+ {/if}
+
+<dl id="mbCategories">
+ <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
+ <dd>
+ {$MENU_CATEGORIES_CONTENT}
+ {if isset($U_UPLOAD)}
+ <ul><li>
+ <a href="{$U_UPLOAD}">{'upload_picture'|@translate}</a>
+ </li></ul>
+ {/if}
+ <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
+ </dd>
+</dl>
+
+
+{if not empty($related_tags)}
+<dl id="mbTags">
+ <dt>{'Related tags'|@translate}</dt>
+ <dd>
+ <ul id="menuTagCloud">
+ {foreach from=$related_tags item=tag}
+ <li>
+ {if !empty($tag.U_ADD) }
+ <a href="{$tag.U_ADD}"
+ title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.counter)}"
+ rel="nofollow">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
+ </a>
+ {/if}
+ <a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{'See elements linked to this tag only'|@translate}">{$tag.name}</a>
+ </li>
+ {/foreach}
+ </ul>
+ </dd>
+</dl>
+{/if}
+
+
+<dl id="mbSpecial">
+ <dt>{'special_categories'|@translate}</dt>
+ <dd>
+ <ul>
+ {foreach from=$special_categories item=cat}
+ <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
+ {/foreach}
+ </ul>
+ </dd>
+</dl>
+
+
+<dl id="mbMenu">
+ <dt>{'title_menu'|@translate}</dt>
+ <dd>
+ <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
+ <p>
+ <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
+ </p>
+ </form>
+ <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
+
+ <ul>
+ {foreach from=$summaries item=sum}
+ <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
+ {/foreach}
+ </ul>
+ </dd>
+</dl>
+
+
+<dl id="mbIdentification">
+ <dt>{'identification'|@translate}</dt>
+ <dd>
+ {if isset($USERNAME)}
+ <p>{'hello'|@translate}&nbsp;{$USERNAME}&nbsp;!</p>
+ {/if}
+
+ <ul>
+ {if isset($U_REGISTER)}
+ <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_IDENTIFY)}
+ <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_LOGOUT)}
+ <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_PROFILE)}
+ <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_ADMIN)}
+ <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
+ {/if}
+ </ul>
+
+ {if isset($U_IDENTIFY)}
+ <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
+ <fieldset>
+ <legend>{'Quick connect'|@translate}</legend>
+
+ <label>
+ {'Username'|@translate}
+ <input type="text" name="username" size="15" value="">
+ </label>
+
+ <label>
+ {'Password'|@translate}
+ <input type="password" name="password" size="15">
+ </label>
+
+ {if $AUTHORIZE_REMEMBERING}
+ <label>
+ {'remember_me'|@translate}
+ <input type="checkbox" name="remember_me" value="1">
+ </label>
+ {/if}
+ <p>
+ <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
+ </p>
+
+ <ul class="actions">
+ <li><a href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/lost_password.png" class="button" alt="{'Forgot your password?'|@translate}"></a></li>
+ {if isset($U_REGISTER)}
+ <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/register.png" class="button" alt="{'Register'|@translate}"/></a></li>
+ {/if}
+ </ul>
+
+ </fieldset>
+ </form>
+ {/if}
+
+ </dd>
+</dl>
+</div> <!-- menubar -->
diff --git a/plugins/test_menu/menu_templates/menubar_categories.tpl b/plugins/test_menu/menu_templates/menubar_categories.tpl
new file mode 100644
index 000000000..050f503c3
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_categories.tpl
@@ -0,0 +1,24 @@
+
+<!-- categories menu bar -->
+
+<dt>
+ {if isset($section.ITEMS.U_START_FILTER)}
+ <a href="{$section.ITEMS.U_START_FILTER}" title="{'start_filter_hint'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_filter.png" class="button" alt="start filter"></a>
+ {/if}
+ {if isset($section.ITEMS.U_STOP_FILTER)}
+ <a href="{$section.ITEMS.U_STOP_FILTER}" title="{'stop_filter_hint'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_filter.png" class="button" alt="stop filter"></a>
+ {/if}
+
+ <a href="{$section.ITEMS.U_CATEGORIES}">{$section.NAME|@translate}</a>
+</dt>
+<dd>
+ {$section.ITEMS.MENU_CATEGORIES_CONTENT}
+ {if isset($section.ITEMS.U_UPLOAD)}
+ <ul>
+ <li>
+ <a href="{$section.ITEMS.U_UPLOAD}">{'upload_picture'|@translate}</a>
+ </li>
+ </ul>
+ {/if}
+ <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $section.ITEMS.NB_PICTURE)}</p>
+</dd>
diff --git a/plugins/test_menu/menu_templates/menubar_generic.tpl b/plugins/test_menu/menu_templates/menubar_generic.tpl
new file mode 100644
index 000000000..e9991c280
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_generic.tpl
@@ -0,0 +1,10 @@
+
+<!-- generic menu bar -->
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ <ul>
+ {foreach from=$section.ITEMS item=item}
+ <li><a href="{$item.URL}" title="{$item.TITLE}">{$item.NAME}</a></li>
+ {/foreach}
+ </ul>
+</dd>
diff --git a/plugins/test_menu/menu_templates/menubar_identification.tpl b/plugins/test_menu/menu_templates/menubar_identification.tpl
new file mode 100644
index 000000000..a09f12425
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_identification.tpl
@@ -0,0 +1,67 @@
+
+<!-- identification menu bar -->
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ {if isset($section.ITEMS.USERNAME)}
+ <p>{'hello'|@translate}&nbsp;{$section.ITEMS.USERNAME}&nbsp;!</p>
+ {/if}
+
+<ul>
+ {if isset($section.ITEMS.U_REGISTER)}
+ <li><a href="{$section.ITEMS.U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
+ {/if}
+
+ {if isset($section.ITEMS.U_IDENTIFY)}
+ <li><a href="{$section.ITEMS.U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
+ {/if}
+
+ {if isset($section.ITEMS.U_LOGOUT)}
+ <li><a href="{$section.ITEMS.U_LOGOUT}">{'logout'|@translate}</a></li>
+ {/if}
+
+ {if isset($section.ITEMS.U_PROFILE)}
+ <li><a href="{$section.ITEMS.U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
+ {/if}
+
+ {if isset($section.ITEMS.U_ADMIN)}
+ <li><a href="{$section.ITEMS.U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
+ {/if}
+</ul>
+
+{if isset($section.ITEMS.U_IDENTIFY)}
+<form method="post" action="{$section.ITEMS.U_IDENTIFY}" class="filter" id="quickconnect">
+<fieldset>
+ <legend>{'Quick connect'|@translate}</legend>
+
+ <label>
+ {'Username'|@translate}
+ <input type="text" name="username" size="15" value="">
+ </label>
+
+ <label>
+ {'Password'|@translate}
+ <input type="password" name="password" size="15">
+ </label>
+
+ {if $section.ITEMS.AUTHORIZE_REMEMBERING}
+ <label>
+ {'remember_me'|@translate}
+ <input type="checkbox" name="remember_me" value="1">
+ </label>
+ {/if}
+ <p>
+ <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
+ </p>
+
+ <ul class="actions">
+ <li><a href="{$section.ITEMS.U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/lost_password.png" class="button" alt="{'Forgot your password?'|@translate}"></a></li>
+ {if isset($section.ITEMS.U_REGISTER)}
+ <li><a href="{$section.ITEMS.U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/register.png" class="button" alt="{'Register'|@translate}"/></a></li>
+ {/if}
+ </ul>
+
+</fieldset>
+</form>
+ {/if}
+
+</dd>
diff --git a/plugins/test_menu/menu_templates/menubar_links.tpl b/plugins/test_menu/menu_templates/menubar_links.tpl
new file mode 100644
index 000000000..87862f1d6
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_links.tpl
@@ -0,0 +1,17 @@
+
+<!-- links menu bar -->
+
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ <ul>
+ {foreach from=$section.ITEMS item=link}
+ <li>
+ <a href="{$link.URL}"
+ {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME|@escape:'javascript'}','{$link.new_window.FEATURES|@escape:'javascript'}'); return false;"{/if}
+ >
+ {$link.LABEL}
+ </a>
+ </li>
+ {/foreach}
+ </ul>
+</dd> \ No newline at end of file
diff --git a/plugins/test_menu/menu_templates/menubar_main.tpl b/plugins/test_menu/menu_templates/menubar_main.tpl
new file mode 100644
index 000000000..82d7cb208
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_main.tpl
@@ -0,0 +1,15 @@
+
+<!-- main menu bar -->
+
+{if isset($sections) and count($sections)}
+ <div id="menubar">
+ {foreach from=$sections key=name item=section}
+ {if not(empty($section.ITEMS))}
+ <dl id="{$section.ID}">
+
+ {include file=$section.TEMPLATE section=$section}
+ </dl>
+ {/if}
+ {/foreach}
+ </div>
+{/if} \ No newline at end of file
diff --git a/plugins/test_menu/menu_templates/menubar_menu.tpl b/plugins/test_menu/menu_templates/menubar_menu.tpl
new file mode 100644
index 000000000..9d42eeea5
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_menu.tpl
@@ -0,0 +1,17 @@
+
+<!-- menu menu bar -->
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
+ <p>
+ <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
+ </p>
+ </form>
+ <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
+
+ <ul>
+ {foreach from=$section.ITEMS item=sum}
+ <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
+ {/foreach}
+ </ul>
+</dd>
diff --git a/plugins/test_menu/menu_templates/menubar_special.tpl b/plugins/test_menu/menu_templates/menubar_special.tpl
new file mode 100644
index 000000000..0bc9588ee
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_special.tpl
@@ -0,0 +1,10 @@
+
+<!-- special menu bar -->
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ <ul>
+ {foreach from=$section.ITEMS item=cat}
+ <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
+ {/foreach}
+ </ul>
+</dd>
diff --git a/plugins/test_menu/menu_templates/menubar_tags.tpl b/plugins/test_menu/menu_templates/menubar_tags.tpl
new file mode 100644
index 000000000..b0fd9cf04
--- /dev/null
+++ b/plugins/test_menu/menu_templates/menubar_tags.tpl
@@ -0,0 +1,19 @@
+
+<!-- tags menu bar -->
+<dt>{$section.NAME|@translate}</dt>
+<dd>
+ <ul id="menuTagCloud">
+ {foreach from=$section.ITEMS item=tag}
+ <li>
+ {if !empty($tag.U_ADD) }
+ <a href="{$tag.U_ADD}"
+ title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.counter)}"
+ rel="nofollow">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
+ </a>
+ {/if}
+ <a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{'See elements linked to this tag only'|@translate}">{$tag.name}</a>
+ </li>
+ {/foreach}
+ </ul>
+</dd>
diff --git a/plugins/test_menu/menubar.inc.php b/plugins/test_menu/menubar.inc.php
new file mode 100644
index 000000000..0bcca0a08
--- /dev/null
+++ b/plugins/test_menu/menubar.inc.php
@@ -0,0 +1,288 @@
+<?php
+/*
+ to use Menu class in piwigo, just replace the original menubar.inc.php file by
+ this one
+*/
+
+
+$datas=array();
+
+//-------------------------------------------------------------- categories
+$datas['categories']=array(
+ 'NB_PICTURE' => $user['nb_total_images'],
+ 'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
+ 'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
+ 'U_UPLOAD' => get_upload_menu_link()
+);
+
+//------------------------------------------------------------------------ filter
+if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
+{
+ if ($filter['enabled'])
+ {
+ $datas['categories']['U_STOP_FILTER']=
+ add_url_params(make_index_url(array()), array('filter' => 'stop'));
+ }
+ else
+ {
+ $datas['categories']['U_START_FILTER']=
+ add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']));
+ }
+}
+
+
+
+//-------------------------------------------------------------- external links
+$datas['links']=array();
+foreach ($conf['links'] as $url => $url_data)
+{
+ if (!is_array($url_data))
+ {
+ $url_data = array('label' => $url_data);
+ }
+
+ if
+ (
+ (!isset($url_data['eval_visible']))
+ or
+ (eval($url_data['eval_visible']))
+ )
+ {
+ $tpl_var = array(
+ 'URL' => $url,
+ 'LABEL' => $url_data['label']
+ );
+
+ if (!isset($url_data['new_window']) or $url_data['new_window'])
+ {
+ $tpl_var['new_window'] =
+ array(
+ 'NAME' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
+ 'FEATURES' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
+ );
+ }
+ $datas['links'][]=$tpl_var;
+ }
+}
+
+
+
+
+
+//------------------------------------------------------------------------ tags
+$datas['tags']=array();
+if ('tags' == @$page['section'])
+{
+ // display tags associated to currently tagged items, less current tags
+ $tags = array();
+ if ( !empty($page['items']) )
+ {
+ $tags = get_common_tags($page['items'],
+ $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
+ }
+
+ $tags = add_level_to_tags($tags);
+
+ foreach ($tags as $tag)
+ {
+ $datas['tags'][]=
+ array_merge( $tag,
+ array(
+ 'URL' => make_index_url(
+ array(
+ 'tags' => array($tag)
+ )
+ ),
+
+ 'U_ADD' => make_index_url(
+ array(
+ 'tags' => array_merge(
+ $page['tags'],
+ array($tag)
+ )
+ )
+ ),
+ )
+ );
+ }
+}
+
+
+
+//---------------------------------------------------------- special categories
+// favorites categories
+$datas['special']=array();
+if ( !is_a_guest() )
+{
+ $datas['special']['favorite_cat']=array(
+ 'URL' => make_index_url(array('section' => 'favorites')),
+ 'TITLE' => l10n('favorite_cat_hint'),
+ 'NAME' => l10n('favorite_cat')
+ );
+}
+// most visited
+ $datas['special']['most_visited_cat']=array(
+ 'URL' => make_index_url(array('section' => 'most_visited')),
+ 'TITLE' => l10n('most_visited_cat_hint'),
+ 'NAME' => l10n('most_visited_cat')
+ );
+// best rated
+if ($conf['rate'])
+{
+ $datas['special']['best_rated_cat']=array(
+ 'URL' => make_index_url(array('section' => 'best_rated')),
+ 'TITLE' => l10n('best_rated_cat_hint'),
+ 'NAME' => l10n('best_rated_cat')
+ );
+}
+// random
+ $datas['special']['random_cat']=array(
+ 'URL' => get_root_url().'random.php',
+ 'TITLE' => l10n('random_cat_hint'),
+ 'NAME' => l10n('random_cat'),
+ 'REL'=> 'rel="nofollow"'
+ );
+
+// recent pics
+ $datas['special']['recent_pics_cat']=array(
+ 'URL' => make_index_url(array('section' => 'recent_pics')),
+ 'TITLE' => l10n('recent_pics_cat_hint'),
+ 'NAME' => l10n('recent_pics_cat'),
+ );
+// recent cats
+ $datas['special']['recent_cats_cat']=array(
+ 'URL' => make_index_url(array('section' => 'recent_cats')),
+ 'TITLE' => l10n('recent_cats_cat_hint'),
+ 'NAME' => l10n('recent_cats_cat'),
+ );
+
+// calendar
+ $datas['special']['calendar']=array(
+ 'URL' =>
+ make_index_url(
+ array(
+ 'chronology_field' => ($conf['calendar_datefield']=='date_available'
+ ? 'posted' : 'created'),
+ 'chronology_style'=> 'monthly',
+ 'chronology_view' => 'calendar'
+ )
+ ),
+ 'TITLE' => l10n('calendar_hint'),
+ 'NAME' => l10n('calendar'),
+ 'REL'=> 'rel="nofollow"'
+ );
+
+
+
+//--------------------------------------------------------------- identification
+$datas['identification']=array();
+if (is_a_guest())
+{
+ $datas['identification']=array(
+ 'U_IDENTIFY' => get_root_url().'identification.php',
+ 'AUTHORIZE_REMEMBERING' => $conf['authorize_remembering'],
+ 'U_LOST_PASSWORD' => get_root_url().'password.php',
+ );
+
+ if ($conf['allow_user_registration'])
+ {
+ $datas['identification']['U_REGISTER']=get_root_url().'register.php';
+ }
+}
+else
+{
+ $datas['identification']['USERNAME']= $user['username'];
+
+ if (is_autorize_status(ACCESS_CLASSIC))
+ {
+ $datas['identification']['U_PROFILE']=get_root_url().'profile.php';
+ }
+
+ // the logout link has no meaning with Apache authentication : it is not
+ // possible to logout with this kind of authentication.
+ if (!$conf['apache_authentication'])
+ {
+ $datas['identification']['U_LOGOUT']= get_root_url().'?act=logout';
+ }
+
+ if (is_admin())
+ {
+ $datas['identification']['U_ADMIN']= get_root_url().'admin.php';
+ }
+}
+
+
+//--------------------------------------------------------------- menu summaries
+$datas['menu']=array();
+// tags link
+$datas['menu']['tags']=array(
+ 'TITLE' => l10n('See available tags'),
+ 'NAME' => l10n('Tags'),
+ 'U_SUMMARY'=> get_root_url().'tags.php',
+ );
+
+// search link
+$datas['menu']['search']=array(
+ 'TITLE'=>l10n('hint_search'),
+ 'NAME'=>l10n('Search'),
+ 'U_SUMMARY'=> get_root_url().'search.php',
+ 'REL'=> 'rel="search"'
+ );
+
+// comments link
+$datas['menu']['comments']=array(
+ 'TITLE'=>l10n('hint_comments'),
+ 'NAME'=>l10n('comments'),
+ 'U_SUMMARY'=> get_root_url().'comments.php',
+ );
+
+// about link
+$datas['menu']['about']=array(
+ 'TITLE' => l10n('about_page_title'),
+ 'NAME' => l10n('About'),
+ 'U_SUMMARY' => get_root_url().'about.php',
+ );
+
+// notification
+$datas['menu']['notification']=array(
+ 'TITLE'=>l10n('RSS feed'),
+ 'NAME'=>l10n('Notification'),
+ 'U_SUMMARY'=> get_root_url().'notification.php',
+ 'REL'=> 'rel="nofollow"'
+ );
+
+
+
+
+$section = new Section('mbLinks', 'links', MENU_TEMPLATES_PATH.'menubar_links.tpl');
+$section->set_items($datas['links']);
+$menu->add($section->get());
+
+
+$section = new Section('mbTags', 'Related tags', MENU_TEMPLATES_PATH.'menubar_tags.tpl');
+$section->set_items($datas['tags']);
+$menu->add($section->get());
+
+$section = new Section('mbSpecial', 'special_categories', MENU_TEMPLATES_PATH.'menubar_special.tpl');
+$section->set_items($datas['special']);
+$menu->add($section->get());
+
+$section = new Section('mbMenu', 'title_menu', MENU_TEMPLATES_PATH.'menubar_menu.tpl');
+$section->set_items($datas['menu']);
+$menu->add($section->get());
+
+$section = new Section('mbIdentification', 'identification', MENU_TEMPLATES_PATH.'menubar_identification.tpl');
+$section->set_items($datas['identification']);
+$menu->add($section->get());
+
+$section = new Section('mbCategories', 'Categories', MENU_TEMPLATES_PATH.'menubar_categories.tpl');
+$section->set_items($datas['categories']);
+$menu->add($section->get());
+
+
+$menu->apply();
+
+
+
+
+?>