Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php	(revision 9367)
+++ /trunk/admin.php	(revision 9368)
@@ -22,9 +22,12 @@
 // +-----------------------------------------------------------------------+
 
-//----------------------------------------------------------- include
+// +-----------------------------------------------------------------------+
+// | Basic constants and includes                                          |
+// +-----------------------------------------------------------------------+
+
 define('PHPWG_ROOT_PATH','./');
 define('IN_ADMIN', true);
-include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
-
+
+include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
 include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
@@ -35,5 +38,10 @@
 // | Check Access and exit when user status is not ok                      |
 // +-----------------------------------------------------------------------+
+
 check_status(ACCESS_ADMINISTRATOR);
+
+// +-----------------------------------------------------------------------+
+// | Direct actions                                                        |
+// +-----------------------------------------------------------------------+
 
 // tags
@@ -68,6 +76,7 @@
 
 // +-----------------------------------------------------------------------+
-// |                    synchronize user informations                      |
-// +-----------------------------------------------------------------------+
+// | Synchronize user informations                                         |
+// +-----------------------------------------------------------------------+
+
 if (mt_rand(0,9)==0)
 {
@@ -76,5 +85,5 @@
 
 // +-----------------------------------------------------------------------+
-// |                            variables init                             |
+// | Variables init                                                        |
 // +-----------------------------------------------------------------------+
 
@@ -114,5 +123,9 @@
 $link_start = PHPWG_ROOT_PATH.'admin.php?page=';
 $conf_link = $link_start.'configuration&amp;section=';
-//----------------------------------------------------- template initialization
+
+// +-----------------------------------------------------------------------+
+// | Template init                                                         |
+// +-----------------------------------------------------------------------+
+
 $title = l10n('Piwigo Administration'); // for include/page_header.php
 $page['page_banner'] = '<h1>'.l10n('Piwigo Administration').'</h1>';
@@ -159,5 +172,8 @@
   );
 
-//---------------------------------------------------------------- plugin menus
+// +-----------------------------------------------------------------------+
+// | Plugin menu                                                           |
+// +-----------------------------------------------------------------------+
+
 $plugin_menu_links = trigger_event('get_admin_plugin_menu_links', array() );
 
@@ -169,41 +185,8 @@
 $template->assign('plugin_menu_items', $plugin_menu_links);
 
-include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
-
-//------------------------------------------------------------- content display
-
-// +-----------------------------------------------------------------------+
-// |                            errors & infos                             |
-// +-----------------------------------------------------------------------+
-
-$template->assign('ACTIVE_MENU', get_active_menu($page['page']));
-
-if (count($page['errors']) != 0)
-{
-  $template->assign('errors', $page['errors']);
-}
-
-if (count($page['infos']) != 0)
-{
-  $template->assign('infos', $page['infos']);
-}
-
-if (count($page['warnings']) != 0)
-{
-  $template->assign('warnings', $page['warnings']);
-}
-
-// Add the Piwigo Official menu
-  $template->assign( 'pwgmenu', pwg_URL() );
-
-include(PHPWG_ROOT_PATH.'include/page_header.php');
-
-trigger_action('loc_end_admin');
-
-$template->pparse('admin');
-
-// +-----------------------------------------------------------------------+
-// |                     order permission refreshment                      |
-// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// | Refresh permissions                                                   |
+// +-----------------------------------------------------------------------+
+
 // Only for pages witch change permissions
 if (
@@ -235,4 +218,44 @@
 }
 
+// +-----------------------------------------------------------------------+
+// | Include specific page                                                 |
+// +-----------------------------------------------------------------------+
+
+include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
+
+// +-----------------------------------------------------------------------+
+// | Errors, Infos & Warnings                                              |
+// +-----------------------------------------------------------------------+
+
+$template->assign('ACTIVE_MENU', get_active_menu($page['page']));
+
+if (count($page['errors']) != 0)
+{
+  $template->assign('errors', $page['errors']);
+}
+
+if (count($page['infos']) != 0)
+{
+  $template->assign('infos', $page['infos']);
+}
+
+if (count($page['warnings']) != 0)
+{
+  $template->assign('warnings', $page['warnings']);
+}
+
+// +-----------------------------------------------------------------------+
+// | Sending html code                                                     |
+// +-----------------------------------------------------------------------+
+
+// Add the Piwigo Official menu
+$template->assign( 'pwgmenu', pwg_URL() );
+
+include(PHPWG_ROOT_PATH.'include/page_header.php');
+
+trigger_action('loc_end_admin');
+
+$template->pparse('admin');
+
 include(PHPWG_ROOT_PATH.'include/page_tail.php');
 ?>
