Skip to content

Commit

Permalink
bug 2202 fixed: invalidate_user_cache() must be called before any red…
Browse files Browse the repository at this point in the history
…irect in included files

git-svn-id: http://piwigo.org/svn/trunk@9368 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Feb 24, 2011
1 parent b645771 commit 1ffd201
Showing 1 changed file with 63 additions and 40 deletions.
103 changes: 63 additions & 40 deletions admin.php
Expand Up @@ -21,11 +21,14 @@
// | USA. |
// +-----------------------------------------------------------------------+

//----------------------------------------------------------- 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');

Expand All @@ -34,8 +37,13 @@
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+

check_status(ACCESS_ADMINISTRATOR);

// +-----------------------------------------------------------------------+
// | Direct actions |
// +-----------------------------------------------------------------------+

// tags
if (isset($_GET['fckb_tags']))
{
Expand Down Expand Up @@ -67,15 +75,16 @@
}

// +-----------------------------------------------------------------------+
// | synchronize user informations |
// | Synchronize user informations |
// +-----------------------------------------------------------------------+

if (mt_rand(0,9)==0)
{
sync_users();
}

// +-----------------------------------------------------------------------+
// | variables init |
// | Variables init |
// +-----------------------------------------------------------------------+

// ?page=plugin-community-pendings is an clean alias of
Expand Down Expand Up @@ -113,7 +122,11 @@

$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
$conf_link = $link_start.'configuration&section=';
//----------------------------------------------------- template initialization

// +-----------------------------------------------------------------------+
// | Template init |
// +-----------------------------------------------------------------------+

$title = l10n('Piwigo Administration'); // for include/page_header.php
$page['page_banner'] = '<h1>'.l10n('Piwigo Administration').'</h1>';
$page['body_id'] = 'theAdminPage';
Expand Down Expand Up @@ -158,7 +171,10 @@
)
);

//---------------------------------------------------------------- plugin menus
// +-----------------------------------------------------------------------+
// | Plugin menu |
// +-----------------------------------------------------------------------+

$plugin_menu_links = trigger_event('get_admin_plugin_menu_links', array() );

function UC_name_compare($a, $b)
Expand All @@ -168,43 +184,10 @@ function UC_name_compare($a, $b)
usort($plugin_menu_links, 'UC_name_compare');
$template->assign('plugin_menu_items', $plugin_menu_links);

include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');

//------------------------------------------------------------- content display

// +-----------------------------------------------------------------------+
// | errors & infos |
// | Refresh permissions |
// +-----------------------------------------------------------------------+

$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 |
// +-----------------------------------------------------------------------+
// Only for pages witch change permissions
if (
in_array($page['page'],
Expand Down Expand Up @@ -234,5 +217,45 @@ function UC_name_compare($a, $b)
invalidate_user_cache();
}

// +-----------------------------------------------------------------------+
// | 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');
?>

0 comments on commit 1ffd201

Please sign in to comment.