aboutsummaryrefslogtreecommitdiffstats
path: root/include/common.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/common.inc.php107
1 files changed, 50 insertions, 57 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index d7b557679..d0376afe8 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -132,28 +132,6 @@ or die ( "Could not connect to database server" );
mysql_select_db( $cfgBase )
or die ( "Could not connect to database" );
-if ($conf['check_upgrade_feed']
- and defined('PHPWG_IN_UPGRADE')
- and PHPWG_IN_UPGRADE)
-{
- // retrieve already applied upgrades
- $query = '
-SELECT id
- FROM '.UPGRADE_TABLE.'
-;';
- $applied = array_from_query($query, 'id');
-
- // retrieve existing upgrades
- $existing = get_available_upgrade_ids();
-
- // which upgrades need to be applied?
- if (count(array_diff($existing, $applied)) > 0)
- {
- $header_msgs[] = 'Some database upgrades are missing, '
- .'<a href="'.PHPWG_ROOT_PATH.'upgrade_feed.php">upgrade now</a>';
- }
-}
-
//
// Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
// since basic gallery information is not available
@@ -162,67 +140,82 @@ load_conf_from_db();
include(PHPWG_ROOT_PATH.'include/user.inc.php');
+
// language files
include_once(get_language_filepath('common.lang.php'));
-
if (defined('IN_ADMIN') and IN_ADMIN)
{
include_once(get_language_filepath('admin.lang.php'));
}
+// only now we can set the localized username of the guest user (and not in
+// include/user.inc.php)
+if ($user['is_the_guest'])
+{
+ $user['username'] = $lang['guest'];
+}
+
+// template instance
+$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
+
if ($conf['gallery_locked'])
{
- $header_msgs[] = $lang['gallery_locked_message']
- . '<a href="'.PHPWG_ROOT_PATH.'identification.php">.</a>';
+ $header_msgs[] = $lang['gallery_locked_message'];
- if ( basename($_SERVER["PHP_SELF"]) != 'identification.php'
+ if ( basename($_SERVER["SCRIPT_FILENAME"]) != 'identification.php'
and !is_admin() )
{
- echo( $lang['gallery_locked_message'] );
+ //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
+ $page['root_path'] = cookie_path();
+ echo $lang['gallery_locked_message']
+ .'<a href="'.get_root_url().'identification.php">.</a>';
exit();
}
}
-// only now we can set the localized username of the guest user (and not in
-// include/user.inc.php)
-if ($user['is_the_guest'])
+if ($user['is_the_guest'] and !$conf['guest_access']
+ and !in_array( basename($_SERVER['SCRIPT_FILENAME']),
+ array('identification.php',
+ 'password.php',
+ 'register.php'
+ )
+ )
+ )
{
- $user['username'] = $lang['guest'];
+ //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
+ $page['root_path'] = cookie_path();
+ redirect (get_root_url().'identification.php');
}
-// include template/theme configuration
-if (defined('IN_ADMIN') and IN_ADMIN)
-{
- list($user['template'], $user['theme']) =
- explode
- (
- '/',
- isset($conf['default_admin_layout']) ? $conf['default_admin_layout']
- : $user['template']
- );
-// TODO : replace $conf['admin_layout'] by $user['admin_layout']
-}
-else
+if ($conf['check_upgrade_feed']
+ and defined('PHPWG_IN_UPGRADE')
+ and PHPWG_IN_UPGRADE)
{
- list($user['template'], $user['theme']) = explode('/', $user['template']);
-}
-// TODO : replace initial $user['template'] by $user['layout']
+ // retrieve already applied upgrades
+ $query = '
+SELECT id
+ FROM '.UPGRADE_TABLE.'
+;';
+ $applied = array_from_query($query, 'id');
-include(
- PHPWG_ROOT_PATH
- .'template/'.$user['template']
- .'/theme/'.$user['theme']
- .'/themeconf.inc.php'
- );
+ // retrieve existing upgrades
+ $existing = get_available_upgrade_ids();
+
+ // which upgrades need to be applied?
+ if (count(array_diff($existing, $applied)) > 0)
+ {
+ //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
+ $page['root_path'] = cookie_path();
+ $header_msgs[] = 'Some database upgrades are missing, '
+ .'<a href="'.get_root_url().'upgrade_feed.php">upgrade now</a>';
+ }
+}
if (is_adviser())
{
$header_msgs[] = $lang['adviser_mode_enabled'];
}
-// template instance
-$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
-
if (count($header_msgs) > 0)
{
$template->assign_block_vars('header_msgs',array());
@@ -232,4 +225,4 @@ if (count($header_msgs) > 0)
array('HEADER_MSG'=>$header_msg));
}
}
-?>
+?> \ No newline at end of file