Index: /extensions/AdditionalPages/admin/admin.php
===================================================================
--- /extensions/AdditionalPages/admin/admin.php	(revision 9261)
+++ /extensions/AdditionalPages/admin/admin.php	(revision 9262)
@@ -9,13 +9,26 @@
 $my_base_url = get_admin_plugin_menu_link(__FILE__);
 
+$query = 'SELECT id
+FROM ' . ADD_PAGES_TABLE . '
+LIMIT 1
+;';
+$page_exist = array_from_query($query, 'id');
+
 if (!isset($_GET['tab']))
-  $page['tab'] = 'manage';
+{
+  $page['tab'] = $page_exist ? 'manage' : 'add_page';
+}
 else
+{
   $page['tab'] = $_GET['tab'];
+}
 
 include(AP_PATH.'admin/'.$page['tab'].'.inc.php');
 
 $tabsheet = new tabsheet();
-$tabsheet->add('manage', l10n('Manage'), $my_base_url.'&amp;tab=manage');
+if ($page_exist)
+{
+  $tabsheet->add('manage', l10n('Manage'), $my_base_url.'&amp;tab=manage');
+}
 $tabsheet->add('add_page', l10n('ap_add_page'), $my_base_url.'&amp;tab=add_page');
 $tabsheet->add('config', l10n('Configuration'), $my_base_url.'&amp;tab=config');
Index: /extensions/AdditionalPages/admin/config.inc.php
===================================================================
--- /extensions/AdditionalPages/admin/config.inc.php	(revision 9261)
+++ /extensions/AdditionalPages/admin/config.inc.php	(revision 9262)
@@ -6,5 +6,5 @@
 if (isset($_POST['submit']))
 {
-  $params = array('show_menu', 'show_home', 'redirect', 'group_perm', 'user_perm');
+  $params = array('show_home', 'group_perm', 'user_perm');
 
   $new_conf = array();
Index: /extensions/AdditionalPages/admin/template/config.tpl
===================================================================
--- /extensions/AdditionalPages/admin/template/config.tpl	(revision 9261)
+++ /extensions/AdditionalPages/admin/template/config.tpl	(revision 9262)
@@ -8,26 +8,5 @@
 	<table>
 		<tr>
-			<td><br>{'ap_menu_name'|@translate} : &nbsp;&nbsp;</td>
-			<td><br>{'Default'|@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" {if $ap_conf.show_menu}checked="checked"{/if}/> {'ap_show_menu'|@translate}</td>
-		</tr>
-		<tr>
 			<td colspan="3"><input type="checkbox" name="show_home" value="on" {if $ap_conf.show_home}checked="checked"{/if}/> {'ap_show_home'|@translate}</td>
-		</tr>
-		<tr>
-			<td colspan="3"><input type="checkbox" name="redirect" value="on" {if $ap_conf.redirect}checked="checked"{/if}/> {'ap_redirect'|@translate}</td>
 		</tr>
 		<tr>
@@ -43,5 +22,19 @@
 			<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="group_perm" value="on" {if $ap_conf.group_perm}checked="checked"{/if}/> <i>{'ap_group_perm'|@translate}</i></td>
 		</tr>
-
+    <tr>
+			<td colspan="3"><br><hr><br></td>
+		</tr>
+		<tr>
+			<td><br>{'ap_menu_name'|@translate} : &nbsp;&nbsp;</td>
+			<td><br>{'Default'|@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}
 	</table>
 
Index: /extensions/AdditionalPages/admin/upgrade_from_21.php
===================================================================
--- /extensions/AdditionalPages/admin/upgrade_from_21.php	(revision 9262)
+++ /extensions/AdditionalPages/admin/upgrade_from_21.php	(revision 9262)
@@ -0,0 +1,89 @@
+<?php
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $prefixeTable, $conf;
+
+$query = 'ALTER TABLE ' . $prefixeTable . 'additionalpages
+CHANGE `id` `id` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
+CHANGE `pos` `pos` SMALLINT( 5 ) NULL DEFAULT NULL ,
+CHANGE `lang` `lang` VARCHAR( 255 ) NULL DEFAULT NULL ,
+CHANGE `text` `content` LONGTEXT NOT NULL ,
+ADD `users` VARCHAR( 255 ) NULL DEFAULT NULL ,
+ADD `groups` VARCHAR( 255 ) NULL DEFAULT NULL ,
+ADD `permalink` VARCHAR( 64 ) NULL DEFAULT NULL;';
+pwg_query($query);
+
+$query = '
+SELECT id, pos, title, lang
+FROM '.$prefixeTable.'additionalpages
+ORDER BY pos ASC, id ASC
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_assoc($result))
+{
+  $title = $row['title'];
+  $authorized_users = 'NULL';
+  $authorized_groups = 'NULL';
+
+  if (strpos($title , '/user_id='))
+  {
+    $array = explode('/user_id=' , $title);
+    $title = $array[0];
+    $authorized_users = '"'.$array[1].'"';
+  }
+  if (strpos($title , '/group_id='))
+  {
+    $array = explode('/group_id=' , $title);
+    $title = $array[0];
+    $authorized_groups = '"'.$array[1].'"';
+  }
+
+  $position = $row['pos'];
+  if ($row['pos'] === '0')
+    $position = '-1';
+  elseif (empty($row['pos']))
+    $position = '0';
+
+  $language = $row['lang'] != 'ALL' ? '"'.$row['lang'].'"' : 'NULL';
+
+  $query = '
+UPDATE '.$prefixeTable.'additionalpages
+SET title = "'.addslashes($title).'",
+    pos = '.$position.',
+    lang = '.$language.',
+    users = '.$authorized_users.',
+    groups = '.$authorized_groups.'
+WHERE id = '.$row['id'].'
+;';
+  pwg_query($query);
+}
+
+$old_conf = explode ("," , $conf['additional_pages']);
+
+$new_conf = array(
+  'show_home' => @($old_conf[2] == 'on'),
+  'group_perm' => @($old_conf[6] == 'on'),
+  'user_perm' => @($old_conf[7] == 'on'),
+  'homepage' => null,
+  );
+
+$languages = explode('/', $old_conf[0]);
+$new_conf['languages'] = array();
+foreach($languages as $language)
+{
+  $array = explode(':', $language);
+  if (!isset($array[1])) $new_conf['languages']['default'] = $array[0];
+  else $new_conf['languages'][$array[0]] = $array[1];
+}
+
+$conf['additional_pages'] = $new_conf;
+
+$query = '
+UPDATE '.CONFIG_TABLE.'
+SET value = "'.addslashes(serialize($new_conf)).'"
+WHERE param = "additional_pages"
+;';
+pwg_query($query);
+
+?>
Index: /extensions/AdditionalPages/index_menu.php
===================================================================
--- /extensions/AdditionalPages/index_menu.php	(revision 9261)
+++ /extensions/AdditionalPages/index_menu.php	(revision 9262)
@@ -41,5 +41,5 @@
 FROM ' . ADD_PAGES_TABLE . '
 WHERE (lang = "' . $user['language'] . '" OR lang IS NULL)
-  AND pos > 0
+  AND pos >= 0
 ORDER BY pos ASC, id ASC
 ;';
Index: /extensions/AdditionalPages/main.inc.php
===================================================================
--- /extensions/AdditionalPages/main.inc.php	(revision 9261)
+++ /extensions/AdditionalPages/main.inc.php	(revision 9262)
@@ -17,5 +17,8 @@
 define('ADD_PAGES_TABLE' , $prefixeTable . 'additionalpages');
 
-$conf['additional_pages'] = unserialize($conf['additional_pages']);
+$conf['additional_pages'] = @unserialize($conf['additional_pages']);
+
+if ($conf['additional_pages'] === false)
+  include(AP_PATH.'admin/upgrade_from_21.php');
 
 function additional_pages_admin_menu($menu)
Index: /extensions/AdditionalPages/maintain.inc.php
===================================================================
--- /extensions/AdditionalPages/maintain.inc.php	(revision 9261)
+++ /extensions/AdditionalPages/maintain.inc.php	(revision 9262)
@@ -27,7 +27,5 @@
     $config = array(
       'languages' => array('default' => 'Additional Pages'),
-      'show_menu' => true,
       'show_home' => true,
-      'redirect' => false,
       'group_perm' => false,
       'user_perm' => false,
@@ -62,9 +60,4 @@
     upgrade_ap_from_17();
   }
-  $result = array_from_query($query, 'Field');
-  if (!in_array('permalink', $result))
-  {
-    upgrade_ap_from_21();
-  }
 }
 
@@ -93,90 +86,3 @@
 }
 
-function upgrade_ap_from_21()
-{
-  global $prefixeTable, $conf;
-
-  $query = 'ALTER TABLE ' . $prefixeTable . 'additionalpages
-CHANGE `id` `id` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
-CHANGE `pos` `pos` SMALLINT( 5 ) NULL DEFAULT NULL ,
-CHANGE `lang` `lang` VARCHAR( 255 ) NULL DEFAULT NULL ,
-CHANGE `text` `content` LONGTEXT NOT NULL ,
-ADD `users` VARCHAR( 255 ) NULL DEFAULT NULL ,
-ADD `groups` VARCHAR( 255 ) NULL DEFAULT NULL ,
-ADD `permalink` VARCHAR( 64 ) NULL DEFAULT NULL;';
-  pwg_query($query);
-
-  $query = '
-SELECT id, pos, title, lang
-FROM '.$prefixeTable.'additionalpages
-ORDER BY pos ASC, id ASC
-;';
-  $result = pwg_query($query);
-  while ($row = mysql_fetch_assoc($result))
-  {
-    $title = $row['title'];
-    $authorized_users = 'NULL';
-    $authorized_groups = 'NULL';
-
-    if (strpos($title , '/user_id='))
-    {
-      $array = explode('/user_id=' , $title);
-      $title = $array[0];
-      $authorized_users = '"'.$array[1].'"';
-    }
-    if (strpos($title , '/group_id='))
-    {
-      $array = explode('/group_id=' , $title);
-      $title = $array[0];
-      $authorized_groups = '"'.$array[1].'"';
-    }
-
-    $position = $row['pos'];
-    if ($row['pos'] === '0')
-      $position = '-1';
-    elseif (empty($row['pos']))
-      $position = '0';
-
-    $language = $row['lang'] != 'ALL' ? '"'.$row['lang'].'"' : 'NULL';
-
-    $query = '
-UPDATE '.$prefixeTable.'additionalpages
-  SET title = "'.addslashes($title).'",
-      pos = '.$position.',
-      lang = '.$language.',
-      users = '.$authorized_users.',
-      groups = '.$authorized_groups.'
-  WHERE id = '.$row['id'].'
-;';
-    pwg_query($query);
-  }
-
-  $old_conf = explode ("," , $conf['additional_pages']);
-
-  $new_conf = array(
-    'show_menu' => @($old_conf[1] == 'on'),
-    'show_home' => @($old_conf[2] == 'on'),
-    'redirect' => @($old_conf[4] == 'on'),
-    'group_perm' => @($old_conf[6] == 'on'),
-    'user_perm' => @($old_conf[7] == 'on'),
-    'homepage' => null,
-    );
-
-  $languages = explode('/', $old_conf[0]);
-  $new_conf['languages'] = array();
-  foreach($languages as $language)
-  {
-    $array = explode(':', $language);
-    if (!isset($array[1])) $new_conf['languages']['default'] = $array[0];
-    else $new_conf['languages'][$array[0]] = $array[1];
-  }
-
-  $query = '
-UPDATE '.CONFIG_TABLE.'
-  SET value = "'.addslashes(serialize($new_conf)).'"
-  WHERE param = "additional_pages"
-;';
-  pwg_query($query);
-}
-
 ?>
