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 @@
+
+
:: {$plugin.AMM_VERSION} ::
+ {'g002_title_page'|@translate} {$TABSHEET_TITLE}
+
+ {$tabsheet}
+
+
+{if isset($page_nfo)}
+{$page_nfo}
+{/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}
+
+{/literal}
+
+
+
+
+
+
+
+
+
\ 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}
+
+{/literal}
+
+
+
+
+[{$datas.nburl}]
+{'g002_addlink'|@translate}
+
+
+
+
+
+
+
\ 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)}
+
+
+ | |
+ {'g002_label'|@translate} |
+ {'g002_url'|@translate} |
+ {'g002_mode'|@translate} |
+ {'g002_visible'|@translate} |
+ |
+
+
+ {foreach from=$datas.urls key=name item=url}
+
+ {if $url.img!=""} {else} {/if} |
+ {$url.label} |
+ {$url.url} |
+ {$url.mode} |
+ {$url.visible} |
+ {if $url.up} {else} {/if} |
+ {if $url.down} {else} {/if} |
+  |
+  |
+
+ {/foreach}
+
+
+{/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}
+
+{/literal}
+
+
+{if isset($datas.modeedit)}
+
+
+ {if $datas.modeedit=='create'}
+ {'g002_createoflink'|@translate}
+ {else}
+ {'g002_editoflink'|@translate}
+ {/if}
+ / {'g002_linkslist'|@translate}
+
+
+
+
+{/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}
+
+{/literal}
+
+
+{'g002_sectionslist'|@translate}
+
+
+
+
+
\ 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)}
+
+
+ | {'g002_owner'|@translate} |
+ {'g002_sectionid'|@translate} |
+ {'g002_name'|@translate} |
+ {'g002_visible'|@translate} |
+ |
+
+
+ {foreach from=$datas.sections key=name item=section}
+
+ | {$section.OWNER} |
+ {$section.ID} |
+ {$section.NAME} |
+ {$section.VISIBLE} |
+ {if $section.up} {else} {/if} |
+ {if $section.down} {else} {/if} |
+
+ {/foreach}
+
+
+{/if}
diff --git a/plugins/AMenuManager/admin/go-down.png b/plugins/AMenuManager/admin/go-down.png
new file mode 100644
index 000000000..7eeb16d2e
Binary files /dev/null and b/plugins/AMenuManager/admin/go-down.png differ
diff --git a/plugins/AMenuManager/admin/go-up.png b/plugins/AMenuManager/admin/go-up.png
new file mode 100644
index 000000000..bd84e76ad
Binary files /dev/null and b/plugins/AMenuManager/admin/go-up.png 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 @@
+
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 @@
+>
+ ------------------------------------------------------------------------------
+ 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 @@
+>
+ ------------------------------------------------------------------------------
+ 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 @@
+>
+ ------------------------------------------------------------------------------
+ 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.'&fAMM_tabsheet=setmenu');
+ $this->tabsheet->add('links',
+ l10n('g002_addlinks'),
+ $this->page_link.'&fAMM_tabsheet=links');
+ $this->tabsheet->add('randompict',
+ l10n('g002_randompict'),
+ $this->page_link.'&fAMM_tabsheet=randompict');
+ $this->tabsheet->add('personnalblock',
+ l10n('g002_personnalblock'),
+ $this->page_link.'&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"] = "".$this->plugin_name." ".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="".l10n('g002_error_invalid_ajax_call')."
";
+ 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.'&fAMM_tabsheet=links&action=create',
+ 'lnk_config' => $this->page_link.'&fAMM_tabsheet=links&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.'&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.'&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 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.'&fAMM_tabsheet=links&action=modify&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 @@
+>
+ ------------------------------------------------------------------------------
+ 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 @@
+>
+ ------------------------------------------------------------------------------
+ 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;$imy_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 @@
+>
+ ------------------------------------------------------------------------------
+ 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 @@
+
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 @@
+
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 @@
+Grum Plugin Classes 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 @@
+
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 @@
+Grum Plugin Classes 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 @@
+
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
Binary files /dev/null and b/plugins/AMenuManager/links_pictures/internet-url.png differ
diff --git a/plugins/AMenuManager/links_pictures/internet.png b/plugins/AMenuManager/links_pictures/internet.png
new file mode 100644
index 000000000..e5d80c172
Binary files /dev/null and b/plugins/AMenuManager/links_pictures/internet.png 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 @@
+>
+--------------------------------------------------------------------------------
+
+:: 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 @@
+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 @@
+
+
+{if $section.NAME!=""}
+ {$section.NAME|@translate}
+{/if}
+
+
+ {foreach from=$section.ITEMS.LINKS item=link}
+ -
+ {if $section.ITEMS.icons=='y'}
{/if}
+ {$link.label}
+
+ {/foreach}
+
+
\ 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 @@
+>
+ ------------------------------------------------------------------------------
+
+ 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', '');
+ }
+
+ 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 @@
+>
+ ------------------------------------------------------------------------------
+
+ 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§ion=". 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;$itables[$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 @@
+>
+ ------------------------------------------------------------------------------
+
+ 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