Index: /extensions/AdditionalPages/additional_page.php
===================================================================
--- /extensions/AdditionalPages/additional_page.php	(revision 3292)
+++ /extensions/AdditionalPages/additional_page.php	(revision 3292)
@@ -0,0 +1,71 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $template, $conf, $user;
+
+load_language('plugin.lang.php', AP_PATH);
+
+$ap_id = explode('additional_page/' , $_SERVER['REQUEST_URI']);
+$ap_id = explode('&' , $ap_id[1]);
+$ap_conf = explode ("," , $conf['additional_pages']);
+
+// Récupération des données de la page
+$q = 'SELECT title , pos , text
+FROM ' . ADD_PAGES_TABLE . '
+WHERE id = ' . $ap_id[0] . ';';
+$result = mysql_fetch_assoc(pwg_query($q));
+
+if (empty($result))
+{
+  page_not_found('This page does not exist', 'index.php?');
+}
+
+// Utilisateurs autorisés
+if (strpos($result['title'] , 'user_id='))
+{
+  $array = explode('/user_id=' , $result['title']);
+  $result['title'] = $array[0];
+  $authorized_users = explode(',', $array[1]);
+  if (!is_admin() and $ap_conf[7] == 'on' and !in_array($user['status'], $authorized_users))
+  {
+  	page_not_found('User not allowed', 'index.php?');
+  }
+}
+
+// Groupe autorisé
+if (strpos($result['title'] , 'group_id='))
+{
+  $array = explode('/group_id=' , $result['title']);
+  $result['title'] = $array[0];
+  $authorized_groups = $array[1];
+
+  $q = 'SELECT *
+FROM ' . USER_GROUP_TABLE . '
+WHERE user_id = ' . $user['id'] . ' AND group_id IN (' . $authorized_groups . ');';
+  $array = mysql_fetch_array(pwg_query($q));
+  if (!is_admin() and $ap_conf[6] == 'on' and empty($array))
+  {
+  	page_not_found('User not allowed', 'index.php?');
+  }
+}
+
+// Envoi de la page
+$template->assign(array(
+  'TITLE' => $result['title'],
+  'PLUGIN_INDEX_CONTENT_BEGIN' => $result['text']));
+if (isset($ap_conf[2]) and $ap_conf[2] == 'on')
+{
+  $template->assign('PLUGIN_INDEX_ACTIONS' , '
+    <li><a href="' . make_index_url() . '" title="' . l10n('return to homepage') . '">
+      <img src="' . $template->get_themeconf('icon_dir') . '/home.png" class="button" alt="' . l10n('home') . '"/></a>
+    </li>');
+}
+if (is_admin())
+{
+  $template->assign('U_EDIT', PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&amp;edit=' . $ap_id[0]);
+}
+
+$template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED'));
+
+?>
Index: /extensions/AdditionalPages/admin/add_page.php
===================================================================
--- /extensions/AdditionalPages/admin/add_page.php	(revision 3292)
+++ /extensions/AdditionalPages/admin/add_page.php	(revision 3292)
@@ -0,0 +1,156 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', AP_PATH);
+$ap_conf = explode(',' , $conf['additional_pages']);
+$edited_page = array();
+$page_title = l10n('ap_create');
+
+if (isset($_GET['saved']) and isset($_GET['edit']))
+{
+	array_push($page['infos'], sprintf(l10n('ap_saved_page') , $_GET['edit']));
+}
+
+// Suppression
+if (isset($_POST['delete']) and isset($_GET['edit']))
+{
+	pwg_query('DELETE FROM ' . ADD_PAGES_TABLE . ' WHERE id = ' . $_GET['edit'] . ';');
+  array_push($page['infos'], l10n('ap_deleted_page'));
+  @unlink(AP_PATH . 'backup/' . $_GET['edit'] . '.txt');
+  return;
+}
+
+// Enregistrement
+if (isset($_POST['save']))
+{
+  $group_access = (!empty($_POST['groups']) ? implode(',', $_POST['groups']) : '');
+  $user_access = (!empty($_POST['users']) ? implode(',', $_POST['users']) : '');
+  if (empty($_POST['name']))
+  {
+    array_push($page['errors'], l10n('ap_no_name'));
+    $edited_page['title'] = '';
+    $edited_page['pos'] = $_POST['pos'];
+    $edited_page['text'] = stripslashes($_POST['ap_content']);
+    $edited_page['group'] = (!empty($_POST['groups']) ? $_POST['groups'] : array());
+    $edited_page['user'] = (!empty($_POST['users']) ? $_POST['users'] :  array());
+  }
+  else
+  {
+    $PageTitle = $_POST['name'];
+    if (!empty($group_access))
+    {
+      $PageTitle .= '/group_id=' . $group_access ;
+    }
+    if ($ap_conf[7] == 'on')
+    {
+      $PageTitle .= '/user_id=' . $user_access ;
+    }
+    if (isset($_GET['edit']))
+    {
+      $next_element_id = $_GET['edit'];
+      pwg_query('DELETE FROM ' . ADD_PAGES_TABLE . ' WHERE id = ' . $_GET['edit'] . ';');
+    }
+    else
+    {
+      $q = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id  FROM ' . ADD_PAGES_TABLE . ' ;';
+      list($next_element_id) = mysql_fetch_array(pwg_query($q));
+    }
+    if ($_POST['pos'] == '') $_POST['pos'] = 'NULL';
+    $q = 'INSERT INTO ' . ADD_PAGES_TABLE . ' ( id , pos , lang , title , text )
+VALUES (' . $next_element_id . ' , ' . $_POST['pos'] . ' , "' . $_POST['lang'] . '" , "' . $PageTitle . '" , "' . $_POST['ap_content'] . '");';
+    pwg_query($q);
+
+    // Enregistrement du fichier de sauvegarde
+    $sav_file = @fopen(AP_PATH . 'backup/' . $next_element_id . '.txt', "w");
+    @fwrite($sav_file, "Title: " . $_POST['name'] . "
+Position: " . $_POST['pos'] . "
+Language: " . $_POST['lang'] . "
+
+" . $_POST['ap_content']);
+    @fclose($sav_file);
+
+    if (isset($ap_conf[4]) and $ap_conf[4] == 'on')
+    {
+      redirect(get_root_url() . 'index.php?/additional_page/' . $next_element_id);
+    }
+    else
+    {
+      redirect(get_root_url() . 'admin.php?page=plugin&section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&saved=1&edit=' . $next_element_id);
+    }
+  }
+}
+
+// Chargement des données
+if (isset($_GET['edit']))
+{
+  $q = 'SELECT id , pos , lang , title , text
+FROM ' . ADD_PAGES_TABLE . '
+WHERE id = ' . $_GET['edit'] . ';';
+  $edited_page = mysql_fetch_assoc(pwg_query($q));
+  $page_title = l10n('ap_modify');
+  // Utilisateurs autorisés
+  if (strpos($edited_page['title'] , '/user_id='))
+  {
+    $array = explode('/user_id=' , $edited_page['title']);
+    $edited_page['title'] = $array[0];
+    $edited_page['user'] = explode(',', $array[1]);
+  }
+  // Groupes autorisés
+  if (strpos($edited_page['title'] , '/group_id='))
+  {
+    $array = explode('/group_id=' , $edited_page['title']);
+    $edited_page['title'] = $array[0];
+    $edited_page['group'] = explode(',', $array[1]);
+  }
+  // Lien de suppression
+  $template->assign('delete', true);
+}
+
+// Selection des langues
+$options['ALL'] = l10n('ap_all_lang');
+$selected = 'ALL';
+foreach (get_languages() as $language_code => $language_name)
+{
+  $options[$language_code] = $language_name;
+  if (isset($edited_page['lang']) and $edited_page['lang'] == $language_code)
+  {
+    $selected = $language_code;
+  }
+}
+$template->assign('lang', array(
+  'OPTIONS' => $options,
+  'SELECTED' => $selected));
+
+// Selection des groupes
+if (isset($ap_conf[6]) and $ap_conf[6] == 'on')
+{
+	include_once(AP_PATH . 'admin/functions_groups.php');
+	$template->assign('GROUPSELECTION', get_html_groups_selection(get_all_groups(), 'groups', (!empty($edited_page['group']) ? $edited_page['group'] : array())));
+}
+
+// Selection des utilisateurs
+if (isset($ap_conf[7]) and $ap_conf[7] == 'on')
+{
+	$selected_users = (isset($edited_page['user']) ? $edited_page['user'] : array('guest', 'generic', 'normal'));
+	$template->assign('user_perm', array(
+    'GUEST' => (in_array('guest', $selected_users) ? 'checked="checked"' : ''),
+		'GENERIC' => (in_array('generic', $selected_users) ? 'checked="checked"' : ''),
+		'NORMAL' => (in_array('normal', $selected_users) ? 'checked="checked"' : '')));
+}
+
+// Chargement des données pour l'édition
+if (!empty($edited_page))
+{
+  $template->assign(array(
+    'NAME' => $edited_page['title'],
+    'POS' => $edited_page['pos'],
+    'CONTENT' => $edited_page['text']));
+}
+
+// Parametrage du template
+$template->assign('AP_TITLE', $page_title);
+
+$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/add_page.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/AdditionalPages/admin/add_page.tpl
===================================================================
--- /extensions/AdditionalPages/admin/add_page.tpl	(revision 3292)
+++ /extensions/AdditionalPages/admin/add_page.tpl	(revision 3292)
@@ -0,0 +1,88 @@
+{literal}
+<script type="text/javascript">
+function GereChkbox(conteneur, a_faire) {
+var blnEtat=null;
+var Chckbox = document.getElementById(conteneur).firstChild;
+	while (Chckbox!=null) {
+		if (Chckbox.nodeName=="INPUT")
+			if (Chckbox.getAttribute("type")=="checkbox") {
+				blnEtat = (a_faire=='0') ? false : (a_faire=='1') ? true : (document.getElementById(Chckbox.getAttribute("id")).checked) ? false : true;
+				document.getElementById(Chckbox.getAttribute("id")).checked=blnEtat;
+			}
+		Chckbox = Chckbox.nextSibling;
+	}
+}
+</script>
+{/literal}
+{$TINYMCE_SCRIPT}
+
+<div class="titrePage">
+	<h2>{$AP_TITLE}</h2>
+</div>
+<form method="post" action="" class="properties"  ENCTYPE="multipart/form-data">
+	<table>
+		<tr>
+			<td align="right">{'ap_page_name'|@translate} &nbsp;&nbsp;</td>
+			<td><input type="text" size="80" maxlength="255" value="{$NAME}" name="name"/></td>
+		</tr>
+		<tr>
+			<td align="right">{'ap_page_pos'|@translate} &nbsp;&nbsp;</td>
+			<td><input type="text" size="3" maxlength="3" value="{$POS}" name="pos"/>&nbsp; ({'ap_pos0'|@translate})</td>
+		</tr>
+		<tr>
+			<td align="right">{'ap_page_lang'|@translate} &nbsp;&nbsp;</td>
+			<td>
+        {html_options name=lang options=$lang.OPTIONS selected=$lang.SELECTED}
+			</td>
+		</tr>
+
+		{if isset($user_perm)}
+		<tr>
+			<td colspan="2"><hr></td>
+		</tr>
+		<tr>
+			<td align="right">{'ap_authorized_users'|@translate} &nbsp;&nbsp;</td>
+			<td>
+				<div id="users">
+				<input type="checkbox" name="users[]" id="guest" value="guest" {$user_perm.GUEST}><label>&nbsp;{'user_status_guest'|@translate}</label>
+				<input type="checkbox" name="users[]" id="generic" value="generic" {$user_perm.GENERIC}><label>&nbsp;{'user_status_generic'|@translate}</label>
+				<input type="checkbox" name="users[]" id="normal" value="normal" {$user_perm.NORMAL}><label>&nbsp;{'user_status_normal'|@translate}</label>
+				<input type="checkbox" name="users[]" id="admin" value="admin" checked="checked" disabled onclick="return false;"><label>&nbsp;{'user_status_admin'|@translate}</label>
+				</div>
+			</td>
+        </tr>
+    {/if}
+
+		{if !empty($GROUPSELECTION)}
+		<tr>
+			<td colspan="2"><hr></td>
+		</tr>
+		<tr>
+			<td align="right">{'ap_authorized_group'|@translate} &nbsp;&nbsp;</td>
+			<td>{$GROUPSELECTION}</td>
+        </tr>
+        <tr>
+        	<td></td>
+			<td><a href="javascript:GereChkbox('groups','1');">{'ap_select_all'|@translate}</a> / <a href="javascript:GereChkbox('groups','0');">{'ap_unselect_all'|@translate}</a>
+			<i>&nbsp;&nbsp; {'ap_guest'|@translate}</i></td>
+        </tr>
+    {/if}
+</table>
+<table style="width:95%;">
+		<tr>
+			<td colspan="2" align="center"><br>
+				<b>{'ap_page_content'|@translate}</b><br>
+				<textarea name="ap_content" id="ap_content" rows="30" cols="50" style="width:100%;">{$CONTENT}</textarea>
+      </td>
+		</tr>
+
+		<tr>
+		<td colspan="2" align="center"><br>
+		<input class="submit" type="submit" value="{'ap_save'|@translate}" name="save" {$TAG_INPUT_ENABLED}>
+		{if isset($delete)}
+		<input class="submit" type="submit" value="{'ap_delete'|@translate}" name="delete" onclick="return confirm('Are you sure?'|@translate);" {$TAG_INPUT_ENABLED}/>
+		{/if}
+		</tr>
+</table>
+
+</form>
Index: /extensions/AdditionalPages/admin/admin.php
===================================================================
--- /extensions/AdditionalPages/admin/admin.php	(revision 3292)
+++ /extensions/AdditionalPages/admin/admin.php	(revision 3292)
@@ -0,0 +1,85 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+load_language('plugin.lang', AP_PATH);
+
+global $conf, $template, $lang;
+
+$ap_conf = explode ("," , $conf['additional_pages']);
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+	foreach($_POST['menu_lang'] as $language_code => $name)
+  {
+		if ($language_code == 'default') $save_languages[] = $name;
+		elseif (!empty($name)) $save_languages[] = $language_code . ':' . $name;
+	}
+	$languages = implode('/', $save_languages);
+    if (!isset($_POST['show_menu']))
+        $_POST['show_menu'] = 'off';
+    if (!isset($_POST['show_home']))
+        $_POST['show_home'] = 'off';
+    if (!isset($_POST['show_edit']))
+        $_POST['show_edit'] = 'off';
+    if (!isset($_POST['redirect']))
+        $_POST['redirect'] = 'off';
+    if (!isset($_POST['group_perm']))
+        $_POST['group_perm'] = 'off';
+    if (!isset($_POST['user_perm']))
+        $_POST['user_perm'] = 'off';
+    $ap_conf = array($languages,
+        $_POST['show_menu'],
+        $_POST['show_home'],
+        $_POST['show_edit'],
+        $_POST['redirect'],
+        $ap_conf[5], //Ancien emplacement du bbcode
+        $_POST['group_perm'],
+        $_POST['user_perm']);
+    $query = '
+UPDATE ' . CONFIG_TABLE . '
+  SET value="' . implode ("," , $ap_conf) . '"
+  WHERE param="additional_pages"
+  LIMIT 1';
+    pwg_query($query);
+    array_push($page['infos'], l10n('ap_conf_saved'));
+}
+
+// Gestion des langues pour le bloc menu
+$languages = explode('/', $ap_conf[0]);
+foreach($languages as $language)
+{
+	$array = explode(':', $language);
+	if (!isset($array[1])) $menu_langs['default'] = $array[0];
+	else $menu_langs[$array[0]] = $array[1];
+}
+
+$template->assign('LANG_DEFAULT_VALUE', $menu_langs['default']);
+foreach (get_languages() as $language_code => $language_name)
+{
+	$template->append('language', array(
+    'LANGUAGE_NAME' => $language_name,
+    'LANGUAGE_CODE' => $language_code,
+    'VALUE' => (isset($menu_langs[$language_code]) ? $menu_langs[$language_code] : '')));
+}
+
+// Parametrage du template
+$template->assign(array(
+  'MENU_NAME' => $ap_conf[0],
+  'SHOW_MENU' => (isset($ap_conf[1]) and $ap_conf[1] == 'on') ? 'checked="checked"' : '',
+  'SHOW_HOME' => (isset($ap_conf[2]) and $ap_conf[2] == 'on') ? 'checked="checked"' : '',
+  'SHOW_EDIT' => (isset($ap_conf[3]) and $ap_conf[3] == 'on') ? 'checked="checked"' : '',
+  'REDIRECT' => (isset($ap_conf[4]) and $ap_conf[4] == 'on') ? 'checked="checked"' : '',
+  'GROUP_PERM' => (isset($ap_conf[6]) and $ap_conf[6] == 'on') ? 'checked="checked"' : '',
+  'USER_PERM' => (isset($ap_conf[7]) and $ap_conf[7] == 'on') ? 'checked="checked"' : ''));
+		
+// Lien de conversion bbcode
+if (isset($ap_conf[5]) and $ap_conf[5] == 'on')
+{
+	$template->assign('convert_bbcode', array('PATH' => get_admin_plugin_menu_link(AP_PATH . 'admin/parse_bbcode.php')));
+}
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/AdditionalPages/admin/admin.tpl
===================================================================
--- /extensions/AdditionalPages/admin/admin.tpl	(revision 3292)
+++ /extensions/AdditionalPages/admin/admin.tpl	(revision 3292)
@@ -0,0 +1,58 @@
+<div class="titrePage">
+	<h2>Additional Pages</h2>
+</div>
+
+<form name="apform" method="post" action="" class="properties"  ENCTYPE="multipart/form-data">
+<fieldset>
+	<legend>{'ap_config'|@translate}</legend>
+	<table>
+		<tr>
+			<td><br>{'ap_menu_name'|@translate} : &nbsp;&nbsp;</td>
+			<td><br>{'default_sort'|@translate}&nbsp;&nbsp;</td>
+			<td><br><input type="text" size="50" maxlength="255" value="{$LANG_DEFAULT_VALUE}" name="menu_lang[default]"/></td>
+		</tr>
+		{foreach from=$language item=lang}
+		<tr>
+			<td></td>
+			<td>{$lang.LANGUAGE_NAME}&nbsp;&nbsp;</td>
+			<td><input type="text" size="50" maxlength="255" value="{$lang.VALUE}" name="menu_lang[{$lang.LANGUAGE_CODE}]"/></td>
+		</tr>
+		{/foreach}
+		<tr>
+			<td colspan="3"><br><hr><br></td>
+		</tr>
+		<tr>
+			<td colspan="3"><input type="checkbox" name="show_menu" value="on" {$SHOW_MENU}/> {'ap_show_menu'|@translate}</td>
+		</tr>
+		<tr>
+			<td colspan="3"><input type="checkbox" name="show_home" value="on" {$SHOW_HOME}/> {'ap_show_home'|@translate}</td>
+		</tr>
+		<tr>
+			<td colspan="3"><input type="checkbox" name="show_edit" value="on" {$SHOW_EDIT}/> {'ap_show_edit'|@translate}</td>
+		</tr>
+		<tr>
+			<td colspan="3"><input type="checkbox" name="redirect" value="on" {$REDIRECT}/> {'ap_redirect'|@translate}</td>
+		</tr>
+		<tr>
+			<td colspan="3"><br><hr><br></td>
+		</tr>
+		<tr>
+			<td colspan="3">{'ap_perm'|@translate}</td>
+		</tr>
+		<tr>
+			<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="user_perm" value="on" {$USER_PERM}/> <i>{'ap_user_perm'|@translate}</i></td>
+		</tr>
+		<tr>
+			<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="group_perm" value="on" {$GROUP_PERM}/> <i>{'ap_group_perm'|@translate}</i></td>
+		</tr>
+
+	</table>
+
+<br>
+</fieldset>
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/></p>
+</form>
+
+{if isset($convert_bbcode)}
+	<p><a href="{$convert_bbcode.PATH}">{'ap_parse_bbcode'|@translate}</a></p>
+{/if}
Index: /extensions/AdditionalPages/admin/functions_groups.php
===================================================================
--- /extensions/AdditionalPages/admin/functions_groups.php	(revision 3292)
+++ /extensions/AdditionalPages/admin/functions_groups.php	(revision 3292)
@@ -0,0 +1,69 @@
+<?php
+
+function get_html_groups_selection(
+  $groups,
+  $fieldname,
+  $selecteds = array()
+  )
+{
+  global $conf;
+  if (count ($groups) == 0 )
+  {
+    return '';
+  }
+  $output = '<div id="'.$fieldname.'">';
+  $id = 1;
+  foreach ($groups as $group)
+  {
+    $output.=
+
+      '<input type="checkbox" name="'.$fieldname.'[]"'
+      .' id="'.$id++.'"'
+      .' value="'.$group['id'].'"'
+      ;
+
+    if (in_array($group['id'], $selecteds))
+    {
+      $output.= ' checked="checked"';
+    }
+
+    $output.=
+      '><label>'
+      .'&nbsp;'. $group['name']
+      .'</label>'
+      ."\n"
+      ;
+  }
+  $output.= '</div>';
+
+  return $output;
+}
+
+
+function get_all_groups()
+{
+$query = '
+SELECT id, name
+  FROM '.GROUPS_TABLE.'
+  ORDER BY name ASC
+;';
+$result = pwg_query($query);
+
+$groups = array();
+  while ($row = mysql_fetch_assoc($result))
+  {
+    array_push($groups, $row);
+  }
+
+  usort($groups, 'groups_name_compare');
+
+  return $groups;
+}
+
+
+function groups_name_compare($a, $b)
+{
+  return strcmp(strtolower($a['name']), strtolower($b['name']));
+}
+
+?>
Index: /extensions/AdditionalPages/admin/index.php
===================================================================
--- /extensions/AdditionalPages/admin/index.php	(revision 3292)
+++ /extensions/AdditionalPages/admin/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/admin/parse_bbcode.php
===================================================================
--- /extensions/AdditionalPages/admin/parse_bbcode.php	(revision 3292)
+++ /extensions/AdditionalPages/admin/parse_bbcode.php	(revision 3292)
@@ -0,0 +1,165 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $lang, $conf;
+
+include(get_language_filepath('plugin.lang.php', AP_PATH));
+
+function ap_CheckTags($str){
+	//array of known tags
+	$known = array('p','b','i','u','s','center','right','ol','ul','li','quote', 'img','url','email','color', 'size');
+	//storage stack
+	$tags = array();
+	
+	for ($pos = 0; $pos<strlen($str); $pos++)
+	{
+		if ($str{$pos} == '[')
+			{
+			$end_pos = strpos($str, ']', $pos);
+			$tag = substr($str, ++$pos, $end_pos-$pos);
+			//deals with tags which contains arguments (ie quote)
+			if ( ($equal_pos = strpos($tag, '=', 0)) !== FALSE)
+				$tag = substr($tag, 0, $equal_pos);
+			//check whether we have a defined tag or not.
+			if (in_array(strtolower($tag),$known) || in_array(strtolower(substr($tag,1)),$known))
+				{
+			//closing tag
+			if ($tag{0} == '/')
+				{
+					//cleaned tag
+					$tag = substr($tag, 1);		
+					$before_tag = substr($str, 0, $pos-1);
+					$after_tag = substr($str, $end_pos+1);	
+					//pop stack
+					while (($temp = array_pop($tags)))
+							{
+							if ($temp != $tag)
+								$before_tag.='[/'.$temp.']';
+							else 
+								{
+								$before_tag.='[/'.$tag.']';
+								break;
+								}
+
+							}
+					$end_pos += strlen($before_tag)+strlen($after_tag)-strlen($str);
+					$str = $before_tag.$after_tag;
+				}
+			else 
+				{ // push stack
+				array_push($tags,$tag);
+				}
+			}
+		$pos = $end_pos;	
+		}
+	}
+	// empty stack and closing tags
+	while ($temp = array_pop($tags))
+		{		
+		$str.='[/'.$temp.']';
+		}
+
+	return $str;
+}
+
+function ap_parse_bbcode($comment)
+{
+	$comment = nl2br($comment);
+	$comment = ap_CheckTags($comment);
+			
+	$patterns = array();
+	$replacements = array();
+	
+	//Paragraph
+	$patterns[] = '#\[p\](.*?)\[/p\]#is';
+	$replacements[] = '<p>\\1</p>';
+    // Bold
+	$patterns[] = '#\[b\](.*?)\[/b\]#is';
+	$replacements[] = '<strong>\\1</strong>';
+	//Italic
+	$patterns[] = '#\[i\](.*?)\[/i\]#is';
+	$replacements[] = '<em>\\1</em>';
+	//Underline	
+	$patterns[] = '#\[u\](.*?)\[\/u\]#is';
+	$replacements[] = '<u>\\1</u>';
+	//Strikethrough
+	$patterns[] = '#\[s\](.*?)\[/s\]#is';
+	$replacements[] = '<del>\\1</del>';
+	//Center
+	$patterns[] = '#\[center\](.*?)\[/center\]#is';
+	$replacements[] = '</p><div align="center"><p>\\1</p></div><p>';
+	//Right
+	$patterns[] = '#\[right\](.*?)\[/right\]#is';
+	$replacements[] = '</p><div align="right"><p>\\1</p></div><p>';
+	//Olist
+	$patterns[] = '#\[ol\](.*?)\[/ol\]#is';
+	$replacements[] = '<ol>\\1</ol>';
+	//Ulist
+	$patterns[] = '#\[ul\](.*?)\[/ul\]#is';
+	$replacements[] = '<ul>\\1</ul>';
+	//List
+	$patterns[] = '#\[li\](.*?)\[/li\]#is';
+	$replacements[] = '<li>\\1</li>';
+	// Quotes
+	$patterns[] = "#\[quote\](.*?)\[/quote\]#is";
+	$replacements[] = '</p><blockquote><span style="font-size: 11px; line-height: normal">\\1</span></blockquote><p>';
+	//Quotes with "user"
+	$patterns[] = "#\[quote=&quot;(.*?)&quot;\](.*?)\[/quote\]#is";
+	$replacements[] = '</p><blockquote><span style="font-size: 11px; line-height: normal"><b>\\1 : </b><br/>\\2</span></blockquote><p>';
+	//Quotes with user
+	$patterns[] = "#\[quote=(.*?)\](.*?)\[/quote\]#is";
+	$replacements[] = '</p><blockquote><span style="font-size: 11px; line-height: normal"><b>\\1 : </b><br/>\\2</span></blockquote><p>';
+	//Images
+	$patterns[] = "#\[img\](.*?)\[/img\]#si";
+	$replacements[] = "<img src='\\1' alt='' />";
+	//[url]xxxx://www.zzzz.yyy[/url]
+	$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; 
+	$replacements[] = '<a href="\\1" target="_blank">\\1</a>'; 
+	//[url]www.zzzzz.yyy[/url]
+	$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is"; 
+	$replacements[] = '<a href="http://\\1" target="_blank">\\1</a>'; 
+	//[url=xxxx://www.zzzzz.yyy]ZzZzZ[/url] /*No I ain't sleeping yet*/
+	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
+	$replacements[] = '<a href="\\1" target="_blank">\\2</a>'; 
+	// [url=www.zzzzz.yyy]zZzZz[/url] /*But I'm thinking about*/
+	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
+	$replacements[] = '<a href="http://\\1" target="_blank">\\2</a>'; 
+	// [url="www.zzzzz.yyy"]zZzZz[/url]   /* It's nearly 2 am now */
+	$patterns[] = "#\[url=&quot;((www|ftp)\.[^ \n\r\t<]*?)&quot;\](.*?)\[/url\]#is";
+	$replacements[] = '<a href="http://\\1" target="_blank">\\3</a>';
+	//[url="http://www.zzzzz.yyy"]zZzZz[/url] /*I really dislike commenting code*/
+	$patterns[] = "#\[url=&quot;([\w]+?://[^ \n\r\t<]*?)&quot;\](.*?)\[/url\]#is";
+	$replacements[] = '<a href="\\1" target="_blank">\\2</a>';
+	//[email]samvure@gmail.com[/email]
+	$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#is";
+	$replacements[] = '<a href="mailto:\\1">\\1</a>';
+	//Size
+	$patterns[] = "#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si";
+	$replacements[] = '<span style="font-size: \\1px; line-height: normal">\\2</span>';
+	//Colours
+	$patterns[] = "#\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*?)\[/color\]#si";
+	$replacements[] = '<span style="color: \\1">\\2</span>';
+	
+	$comment = preg_replace($patterns, $replacements, $comment);
+		
+	return $comment;
+}
+
+// Traitement des pages
+$result= pwg_query('SELECT id, text FROM ' . ADD_PAGES_TABLE);
+while ($row = mysql_fetch_assoc($result)) {
+	$text = ap_parse_bbcode($row['text']);
+	pwg_query('UPDATE ' . ADD_PAGES_TABLE . ' SET text="' . addslashes($text) . '" WHERE id=' . $row['id'] . ' LIMIT 1');
+}
+
+// Mise à jour de la configuration
+$ap_conf = explode ("," , $conf['additional_pages']);
+if (isset($ap_conf[5])) {
+	$ap_conf[5] = '';
+	pwg_query('UPDATE ' . CONFIG_TABLE . ' SET value="' . implode ("," , $ap_conf) . '" WHERE param="additional_pages" LIMIT 1');
+}
+
+redirect(str_replace('&amp;', '&', get_admin_plugin_menu_link(AP_PATH . 'admin/admin.php')), l10n('ap_convert_bbcode_ok'), 3);
+
+?>
Index: /extensions/AdditionalPages/index.php
===================================================================
--- /extensions/AdditionalPages/index.php	(revision 3292)
+++ /extensions/AdditionalPages/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/index_menu.php
===================================================================
--- /extensions/AdditionalPages/index_menu.php	(revision 3292)
+++ /extensions/AdditionalPages/index_menu.php	(revision 3292)
@@ -0,0 +1,114 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+add_event_handler('blockmanager_register_blocks', 'register_ap_menubar_blocks');
+add_event_handler('blockmanager_apply', 'ap_apply');
+
+function register_ap_menubar_blocks( $menu_ref_arr )
+{
+  $menu = & $menu_ref_arr[0];
+  if ($menu->get_id() != 'menubar')
+    return;
+  $menu->register_block( new RegisteredBlock( 'mbAdditionalPages', 'Additional Pages', 'AP'));
+}
+
+function ap_apply($menu_ref_arr)
+{
+  global $template, $conf, $user, $lang;
+
+  $ap_conf = explode ("," , $conf['additional_pages']);
+
+  $menu = & $menu_ref_arr[0];
+  
+  if ( ($block = $menu->get_block( 'mbAdditionalPages' ) ) != null )
+  {
+    if (!file_exists(AP_PATH . 'template/' . $user['template'] . '.tpl'))
+    {
+      $user['template'] = 'yoga';
+    }
+
+    load_language('plugin.lang', AP_PATH);
+    
+    // Gestion des langues pour le nom du menu
+    $languages = explode('/', $ap_conf[0]);
+    foreach($languages as $language)
+    {
+      $array = explode(':', $language);
+      if (!isset($array[1])) $menu_langs['default'] = $array[0];
+      else $menu_langs[$array[0]] = $array[1];
+    }
+
+    $data = array();
+
+    if (is_admin())
+    {
+      array_push($data, array(
+        'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . AP_DIR . '%2Fadmin%2Fadd_page.php',
+        'LABEL' => l10n('ap_add_page')));
+      $clauses = '';
+    }
+    else
+    {
+      $clauses = 'WHERE (lang = "' . $user['language'] . '" OR lang = "ALL")';
+    }
+  
+    // Recupération des groupes de l'utilisateur
+    $q = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user['id'] . ';';
+    $result = pwg_query($q);
+    $groups = array();
+    while ($row = mysql_fetch_assoc($result))
+    {
+      array_push($groups, $row['group_id']);
+    }
+  
+    // Récupération des pages
+    $q = 'SELECT id , pos , title
+FROM ' . ADD_PAGES_TABLE . '
+' . $clauses . '
+ORDER BY pos ASC;';
+    $result = pwg_query($q);
+
+    while ($row = mysql_fetch_assoc($result))
+    {
+      if ($row['pos'] != '0' or is_admin())
+      {
+        if (strpos($row['title'] , '/user_id='))
+        {
+          $array = explode('/user_id=' , $row['title']);
+          $row['title'] = $array[0];
+          $authorized_users = explode(',', $array[1]);
+        }
+        if (strpos($row['title'] , '/group_id='))
+        {
+          $array = explode('/group_id=' , $row['title']);
+          $row['title'] = $array[0];
+          $auth = explode(',', $array[1]);
+          $authorized_groups = array_intersect($groups, $auth);
+        }
+        if (is_admin() and isset($ap_conf[3]) and $ap_conf[3] == 'on')
+        {
+          $row['title'] .= '</a> --- <a href=' . PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . AP_DIR . '%2Fadmin%2Fadd_page.php&amp;edit=' . $row['id'] . '>[edit]';
+        }
+        if (is_admin() or (
+          (isset($ap_conf[6]) and $ap_conf[6] == 'off' or !isset($authorized_groups) or !empty($authorized_groups)) and
+          (isset($ap_conf[7]) and $ap_conf[7] == 'off' or !isset($authorized_users) or in_array($user['status'], $authorized_users))))
+        {
+          array_push($data, array(
+            'URL' => PHPWG_ROOT_PATH . 'index.php?/additional_page/' . $row['id'],
+            'LABEL' => $row['title']));
+        }
+        unset($authorized_groups);
+        unset($authorized_users);
+      }
+    }
+
+    if (!empty($data))
+    {
+      $block->set_title(isset($menu_langs[$user['language']]) ? $menu_langs[$user['language']] : $menu_langs['default']);
+      $block->template = dirname(__FILE__) . '/template/' . $user['template'] . '.tpl';
+      $block->data = $data;
+    }
+  }
+}
+?>
Index: /extensions/AdditionalPages/language/en_UK/index.php
===================================================================
--- /extensions/AdditionalPages/language/en_UK/index.php	(revision 3292)
+++ /extensions/AdditionalPages/language/en_UK/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/AdditionalPages/language/en_UK/plugin.lang.php	(revision 3292)
+++ /extensions/AdditionalPages/language/en_UK/plugin.lang.php	(revision 3292)
@@ -0,0 +1,41 @@
+<?php
+
+$lang['ap_add_page'] = 'Add a page';
+
+$lang['ap_create'] = 'Create new additional page';
+$lang['ap_deleted_page'] = 'Page deleted (<a href="' .PHPWG_ROOT_PATH . '">back to home</a>)';
+$lang['ap_no_name'] = 'You do not fill name field.';
+$lang['ap_saved_page'] = 'Page saved (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">see the page</a>)';
+$lang['ap_modify'] = 'Modify the additional page';
+$lang['ap_all_lang'] = 'All';
+$lang['ap_all_group'] = 'All';
+
+$lang['ap_conf_saved'] = 'Configuration saved.';
+
+$lang['ap_page_name'] = 'Page\'s name';
+$lang['ap_page_lang'] = 'Language';
+$lang['ap_default_language'] = 'Default';
+$lang['ap_page_pos'] = 'Position';
+$lang['ap_authorized_group'] = 'Authorized groups';
+$lang['ap_authorized_users'] = 'Authorized users';
+$lang['ap_select_all'] = 'Select all';
+$lang['ap_unselect_all'] = 'Unselect all';
+$lang['ap_guest'] = '(leave empty for public page)';
+$lang['ap_pos0'] = '0 to do not show page on menu';
+$lang['ap_page_content'] = 'Content';
+$lang['ap_save'] = 'Save';
+$lang['ap_delete'] = 'Delete';
+
+$lang['ap_config'] = 'Configuration';
+$lang['ap_menu_name'] = 'Menu\'s name';
+$lang['ap_show_menu'] = 'Show block menu';
+$lang['ap_redirect'] = 'Automatically redirect to saved page';
+$lang['ap_show_home'] = 'Show "back home" button on additional pages';
+$lang['ap_show_edit'] = 'Show edit link on block menu';
+$lang['ap_perm'] = 'Activate authorization management:';
+$lang['ap_group_perm'] = 'by groups';
+$lang['ap_user_perm'] = 'by user type';
+$lang['ap_parse_bbcode'] = 'Convert pages written with BBCode';
+$lang['ap_convert_bbcode_ok'] = 'Conversion effectuée.';
+
+?>
Index: /extensions/AdditionalPages/language/es_ES/index.php
===================================================================
--- /extensions/AdditionalPages/language/es_ES/index.php	(revision 3292)
+++ /extensions/AdditionalPages/language/es_ES/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/AdditionalPages/language/es_ES/plugin.lang.php	(revision 3292)
+++ /extensions/AdditionalPages/language/es_ES/plugin.lang.php	(revision 3292)
@@ -0,0 +1,41 @@
+<?php
+
+$lang['ap_add_page'] = 'Añadir una página';
+
+$lang['ap_create'] = 'Crear una nueva página additionelle';
+$lang['ap_deleted_page'] = 'Página suprimida (<a href="' .PHPWG_ROOT_PATH . '">vuelta a la acogida</a>)';
+$lang['ap_no_name'] = 'Usted no indicó el nombre.';
+$lang['ap_saved_page'] = 'Página registrada (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">Ver la página</a>)';
+$lang['ap_modify'] = 'Modificar la página additionelle';
+$lang['ap_all_lang'] = 'Ellas todas';
+$lang['ap_all_group'] = 'Ellos todos';
+
+$lang['ap_conf_saved'] = 'Configuración salvaguardada.';
+
+$lang['ap_page_name'] = 'Nombre de la página';
+$lang['ap_page_lang'] = 'Lengua';
+$lang['ap_default_language'] = 'Por defecto';
+$lang['ap_page_pos'] = 'Posición';
+$lang['ap_authorized_group'] = 'Grupos autorizados';
+$lang['ap_authorized_users'] = 'Utilizadores autorizados';
+$lang['ap_select_all'] = 'Seleccionar todo ';
+$lang['ap_unselect_all'] = 'Deseleccionar todo ';
+$lang['ap_guest'] = '(Dejar vacío para una página pública)';
+$lang['ap_pos0'] = '0 para no mostrar la página en el menú';
+$lang['ap_page_content'] = 'Contenido';
+$lang['ap_save'] = 'Registrar';
+$lang['ap_delete'] = 'Suprimir';
+
+$lang['ap_config'] = 'Configuración';
+$lang['ap_menu_name'] = 'Nombre del menú';
+$lang['ap_show_menu'] = 'Mostrar el bloque menudo';
+$lang['ap_redirect'] = 'Redirigir automáticamente hacia la página registrada';
+$lang['ap_show_home'] = 'Mostrar el botón de vuelta hacia la acogida sobre las páginas adicionales';
+$lang['ap_show_edit'] = 'Mostrar el lazo de edición de las páginas additionelles en el bloque menudo';
+$lang['ap_perm'] = 'Acelerar la gestión de los derechos de acceso a las páginas additionelles :';
+$lang['ap_group_perm'] = 'Por grupos';
+$lang['ap_user_perm'] = 'Por tipo de utilizadores';
+$lang['ap_parse_bbcode'] = 'Convertir les pages déjà écrites avec le BBCode';
+$lang['ap_convert_bbcode_ok'] = 'Conversion effectuée.';
+
+?>
Index: /extensions/AdditionalPages/language/fr_FR/index.php
===================================================================
--- /extensions/AdditionalPages/language/fr_FR/index.php	(revision 3292)
+++ /extensions/AdditionalPages/language/fr_FR/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/AdditionalPages/language/fr_FR/plugin.lang.php	(revision 3292)
+++ /extensions/AdditionalPages/language/fr_FR/plugin.lang.php	(revision 3292)
@@ -0,0 +1,40 @@
+<?php
+
+$lang['ap_add_page'] = 'Ajouter une page';
+
+$lang['ap_create'] = 'Créer une nouvelle page additionelle';
+$lang['ap_deleted_page'] = 'Page supprimée (<a href="' .PHPWG_ROOT_PATH . '">retour à l\'accueil</a>)';
+$lang['ap_no_name'] = 'Vous n\'avez pas indiqué le nom.';
+$lang['ap_saved_page'] = 'Page enregistrée (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">voir la page</a>)';
+$lang['ap_modify'] = 'Modifier la page additionelle';
+$lang['ap_all_lang'] = 'Toutes';
+$lang['ap_all_group'] = 'Tous';
+
+$lang['ap_conf_saved'] = 'Configuration sauvegardée.';
+
+$lang['ap_page_name'] = 'Nom de la page';
+$lang['ap_page_lang'] = 'Langue';
+$lang['ap_default_language'] = 'Par défaut';
+$lang['ap_page_pos'] = 'Position';
+$lang['ap_authorized_group'] = 'Groupes autorisés';
+$lang['ap_authorized_users'] = 'Utilisateurs autorisés';
+$lang['ap_select_all'] = 'Sélectionner tout';
+$lang['ap_unselect_all'] = 'Déselectionner tout';
+$lang['ap_guest'] = '(Laisser vide pour une page publique)';
+$lang['ap_pos0'] = '0 pour ne pas afficher la page dans le menu';
+$lang['ap_page_content'] = 'Contenu';
+$lang['ap_save'] = 'Enregistrer';
+$lang['ap_delete'] = 'Supprimer';
+
+$lang['ap_config'] = 'Configuration';
+$lang['ap_menu_name'] = 'Nom du menu';
+$lang['ap_show_menu'] = 'Montrer le bloc menu';
+$lang['ap_redirect'] = 'Rediriger automatiquement vers la page enregistrée';
+$lang['ap_show_home'] = 'Montrer le bouton de retour vers l\'accueil sur les pages additionnelles';
+$lang['ap_show_edit'] = 'Montrer le lien d\'édition des pages additionelles dans le bloc menu';
+$lang['ap_perm'] = 'Activer la gestion des droits d\'accès aux pages additionelles:';
+$lang['ap_group_perm'] = 'par groupes';
+$lang['ap_user_perm'] = 'par type d\'utilisateurs';
+$lang['ap_parse_bbcode'] = 'Convertir les pages déjà écrites avec le BBCode';
+$lang['ap_convert_bbcode_ok'] = 'Conversion effectuée.';
+?>
Index: /extensions/AdditionalPages/language/index.php
===================================================================
--- /extensions/AdditionalPages/language/index.php	(revision 3292)
+++ /extensions/AdditionalPages/language/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/language/it_IT/index.php
===================================================================
--- /extensions/AdditionalPages/language/it_IT/index.php	(revision 3292)
+++ /extensions/AdditionalPages/language/it_IT/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/language/it_IT/plugin.lang.php
===================================================================
--- /extensions/AdditionalPages/language/it_IT/plugin.lang.php	(revision 3292)
+++ /extensions/AdditionalPages/language/it_IT/plugin.lang.php	(revision 3292)
@@ -0,0 +1,40 @@
+<?php
+
+$lang['ap_add_page'] = 'Aggiungere una pagina';
+
+$lang['ap_create'] = 'Creare una nuova pagina addizionale';
+$lang['ap_deleted_page'] = 'Pagina soppressa (<a href="' .PHPWG_ROOT_PATH . '">ritorno alla home page</a>)';
+$lang['ap_no_name'] = 'Dovete indicare un nome.';
+$lang['ap_saved_page'] = 'Pagina registrata (<a href="' .PHPWG_ROOT_PATH . 'index.php?/additional_page/%s">visualizzare pagina</a>)';
+$lang['ap_modify'] = 'Modificare la pagina addizionale';
+$lang['ap_all_lang'] = 'Tutte';
+$lang['ap_all_group'] = 'Tutti';
+
+$lang['ap_conf_saved'] = 'Configurazione salvata.';
+
+$lang['ap_page_name'] = 'Nome della pagina';
+$lang['ap_page_lang'] = 'Lingue';
+$lang['ap_default_language'] = 'Di default';
+$lang['ap_page_pos'] = 'Posizione';
+$lang['ap_authorized_group'] = 'Gruppi autorizzati';
+$lang['ap_authorized_users'] = 'Utenti autorizzati';
+$lang['ap_select_all'] = 'Selezionare tutto';
+$lang['ap_unselect_all'] = 'Deselezionare tutto';
+$lang['ap_guest'] = '(Lsciare vuoto per una pagina pubblica)';
+$lang['ap_pos0'] = '0 per non visualizzare la pagina nel menù';
+$lang['ap_page_content'] = 'Contenuto';
+$lang['ap_save'] = 'Registrare';
+$lang['ap_delete'] = 'Cancellare';
+
+$lang['ap_config'] = 'Configurazione';
+$lang['ap_menu_name'] = 'Nome del menù';
+$lang['ap_show_menu'] = 'Mostrare il blocco menù';
+$lang['ap_redirect'] = 'Ridirigere automaticamente verso la pagina registrata';
+$lang['ap_show_home'] = 'Mostrare il pulsante di ritorno verso la home page sulla pagina addizionale';
+$lang['ap_show_edit'] = 'Mostrare il link di modifica delle pagine addizionali nel blocco menù';
+$lang['ap_perm'] = 'Attivare la gestione dei diritti d\'accesso alle pagine addizionali :';
+$lang['ap_group_perm'] = 'per gruppo';
+$lang['ap_user_perm'] = 'per typo d\'utente';
+$lang['ap_parse_bbcode'] = 'Convertire le pagini già scritte con BBCode';
+$lang['ap_convert_bbcode_ok'] = 'Conversione effettuata.';
+?>
Index: /extensions/AdditionalPages/main.inc.php
===================================================================
--- /extensions/AdditionalPages/main.inc.php	(revision 3292)
+++ /extensions/AdditionalPages/main.inc.php	(revision 3292)
@@ -0,0 +1,51 @@
+<?php
+/*
+Plugin Name: Additional Pages
+Version: 2.0.b
+Description: Add additional pages in menubar.
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=153
+Author: P@t
+Author URI: http://www.gauchon.com
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $prefixeTable, $conf;
+
+define('AP_DIR' , basename(dirname(__FILE__)));
+define('AP_PATH' , PHPWG_PLUGINS_PATH . AP_DIR . '/');
+define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages');
+
+function additional_pages_admin_menu($menu)
+{
+    array_push($menu, array(
+      'NAME' => 'Additional Pages',
+      'URL' => get_admin_plugin_menu_link(AP_PATH . 'admin/admin.php')));
+    return $menu;
+}
+
+function section_init_additional_page()
+{
+    global $tokens, $page;
+    if ($tokens[0] == 'additional_page')
+        $page['section'] = 'additional_page';
+}
+
+function index_additional_page()
+{
+    global $page;
+    if ($page['section'] == 'additional_page')
+        include(AP_PATH . 'additional_page.php');
+}
+
+$ap_conf = explode ("," , $conf['additional_pages']);
+if (isset($ap_conf[1]) and $ap_conf[1] == 'on' or is_admin())
+{
+  include(AP_PATH . 'index_menu.php');
+}
+
+add_event_handler('get_admin_plugin_menu_links', 'additional_pages_admin_menu');
+add_event_handler('loc_end_section_init', 'section_init_additional_page');
+add_event_handler('loc_end_index', 'index_additional_page');
+
+?>
Index: /extensions/AdditionalPages/maintain.inc.php
===================================================================
--- /extensions/AdditionalPages/maintain.inc.php	(revision 3292)
+++ /extensions/AdditionalPages/maintain.inc.php	(revision 3292)
@@ -0,0 +1,80 @@
+<?php
+
+function plugin_install()
+{
+  global $prefixeTable, $conf;
+
+  $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'additionalpages"';
+  $result = pwg_query($query);
+  if (!mysql_fetch_row($result))
+  {
+    $query = 'CREATE TABLE ' . $prefixeTable . 'additionalpages (
+id SMALLINT( 5 ) UNSIGNED NOT NULL ,
+pos SMALLINT( 5 ) UNSIGNED default NULL ,
+lang VARCHAR( 255 ) NOT NULL ,
+title VARCHAR( 255 ) NOT NULL ,
+text LONGTEXT NOT NULL ,
+PRIMARY KEY (id) ,
+INDEX (pos) ,
+INDEX (lang))
+DEFAULT CHARACTER SET utf8;';
+    pwg_query($query);
+  }
+
+  if (!isset($conf['additional_pages']))
+  {
+    $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+VALUES ("additional_pages" , "Additional Pages,on,on,off,off,,off,off" , "Parametres du plugin Additional Pages");';
+    pwg_query($query);
+  }
+}
+
+function plugin_activate()
+{
+  global $prefixeTable;
+
+  $q = pwg_query('SHOW COLUMNS FROM ' . HISTORY_TABLE . ' LIKE "section"');
+  $section = mysql_fetch_array($q);
+  $type = $section['Type'];
+
+  // Add additional page section into history table
+  if (strpos($type, 'additional_page') === false)
+  {
+    $type = strtr($type , array(')' => ',\'additional_page\')'));
+    pwg_query('ALTER TABLE ' . HISTORY_TABLE . ' CHANGE section section ' . $type . ' DEFAULT NULL');
+  }
+  
+  // Check if upgrade is needed
+  $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'additionalpages;';
+  $result = array_from_query($query, 'Collation');
+  if (strpos($result[4], 'utf8') === false)
+  {
+    upgrade_ap_from_17();
+  }
+}
+
+function plugin_uninstall()
+{
+  global $prefixeTable;
+
+	$q = 'DROP TABLE ' . $prefixeTable . 'additionalpages;';
+  pwg_query($q);
+
+	$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="additional_pages" LIMIT 1;';
+  pwg_query($q);
+}
+
+function upgrade_ap_from_17()
+{
+  global $prefixeTable;
+
+  $query = 'ALTER TABLE ' . $prefixeTable . 'additionalpages
+MODIFY COLUMN lang varchar(255) CHARACTER SET utf8 NOT NULL,
+MODIFY COLUMN title varchar(255) CHARACTER SET utf8 NOT NULL,
+MODIFY COLUMN text longtext CHARACTER SET utf8 NOT NULL,
+DEFAULT CHARACTER SET utf8;';
+
+  pwg_query($query);
+}
+
+?>
Index: /extensions/AdditionalPages/template/index.php
===================================================================
--- /extensions/AdditionalPages/template/index.php	(revision 3292)
+++ /extensions/AdditionalPages/template/index.php	(revision 3292)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/AdditionalPages/template/yoga.tpl
===================================================================
--- /extensions/AdditionalPages/template/yoga.tpl	(revision 3292)
+++ /extensions/AdditionalPages/template/yoga.tpl	(revision 3292)
@@ -0,0 +1,10 @@
+<dt>{$block->get_title()}</dt>
+  <dd>
+    <ul>
+    {foreach from=$block->data item=data}
+      <li>
+        <a href="{$data.URL}">{$data.LABEL}</a>
+      </li>
+    {/foreach}
+    </ul>
+  </dd>
