Ignore:
Timestamp:
Oct 20, 2006, 4:17:53 AM (18 years ago)
Author:
rvelices
Message:

used in the code (generates mysql errors on session garbage collector)

  • fix auto_login (die mysql when session timed out, but user has remember)
  • when a user reconnects from identification.php, the remember cookie was not

deleted

  • fix all redirect warnings/errors (many changes - mainly in common.inc.php

and user.inc.php)

login the 60 days countdown restarts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r1502 r1568  
    133133or die ( "Could not connect to database" );
    134134
     135//
     136// Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
     137// since basic gallery information is not available
     138//
     139load_conf_from_db();
     140
     141include(PHPWG_ROOT_PATH.'include/user.inc.php');
     142
     143
     144// language files
     145include_once(get_language_filepath('common.lang.php'));
     146if (defined('IN_ADMIN') and IN_ADMIN)
     147{
     148  include_once(get_language_filepath('admin.lang.php'));
     149}
     150
     151// only now we can set the localized username of the guest user (and not in
     152// include/user.inc.php)
     153if ($user['is_the_guest'])
     154{
     155  $user['username'] = $lang['guest'];
     156}
     157
     158// template instance
     159$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
     160
     161if ($conf['gallery_locked'])
     162{
     163  $header_msgs[] = $lang['gallery_locked_message'];
     164
     165  if ( basename($_SERVER["SCRIPT_FILENAME"]) != 'identification.php'
     166      and !is_admin() )
     167  {
     168    //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
     169    $page['root_path'] = cookie_path();
     170    echo $lang['gallery_locked_message']
     171      .'<a href="'.get_root_url().'identification.php">.</a>';
     172    exit();
     173  }
     174}
     175
     176if ($user['is_the_guest'] and !$conf['guest_access']
     177    and !in_array( basename($_SERVER['SCRIPT_FILENAME']),
     178                      array('identification.php',
     179                            'password.php',
     180                            'register.php'
     181                        )
     182                  )
     183    )
     184{
     185  //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
     186  $page['root_path'] = cookie_path();
     187  redirect (get_root_url().'identification.php');
     188}
     189
    135190if ($conf['check_upgrade_feed']
    136191    and defined('PHPWG_IN_UPGRADE')
     
    150205  if (count(array_diff($existing, $applied)) > 0)
    151206  {
     207    //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG
     208    $page['root_path'] = cookie_path();
    152209    $header_msgs[] = 'Some database upgrades are missing, '
    153       .'<a href="'.PHPWG_ROOT_PATH.'upgrade_feed.php">upgrade now</a>';
    154   }
    155 }
    156 
    157 //
    158 // Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
    159 // since basic gallery information is not available
    160 //
    161 load_conf_from_db();
    162 
    163 include(PHPWG_ROOT_PATH.'include/user.inc.php');
    164 
    165 // language files
    166 include_once(get_language_filepath('common.lang.php'));
    167 
    168 if (defined('IN_ADMIN') and IN_ADMIN)
    169 {
    170   include_once(get_language_filepath('admin.lang.php'));
    171 }
    172 
    173 if ($conf['gallery_locked'])
    174 {
    175   $header_msgs[] = $lang['gallery_locked_message']
    176     . '<a href="'.PHPWG_ROOT_PATH.'identification.php">.</a>';
    177 
    178   if ( basename($_SERVER["PHP_SELF"]) != 'identification.php'
    179       and !is_admin() )
    180   {
    181     echo( $lang['gallery_locked_message'] );
    182     exit();
    183   }
    184 }
    185 
    186 // only now we can set the localized username of the guest user (and not in
    187 // include/user.inc.php)
    188 if ($user['is_the_guest'])
    189 {
    190   $user['username'] = $lang['guest'];
    191 }
    192 
    193 // include template/theme configuration
    194 if (defined('IN_ADMIN') and IN_ADMIN)
    195 {
    196   list($user['template'], $user['theme']) =
    197     explode
    198     (
    199       '/',
    200       isset($conf['default_admin_layout']) ? $conf['default_admin_layout']
    201                                            : $user['template']
    202     );
    203 // TODO : replace $conf['admin_layout'] by $user['admin_layout']
    204 }
    205 else
    206 {
    207   list($user['template'], $user['theme']) = explode('/', $user['template']);
    208 }
    209 // TODO : replace initial $user['template'] by $user['layout']
    210 
    211 include(
    212   PHPWG_ROOT_PATH
    213   .'template/'.$user['template']
    214   .'/theme/'.$user['theme']
    215   .'/themeconf.inc.php'
    216   );
     210      .'<a href="'.get_root_url().'upgrade_feed.php">upgrade now</a>';
     211  }
     212}
    217213
    218214if (is_adviser())
     
    220216  $header_msgs[] = $lang['adviser_mode_enabled'];
    221217}
    222 
    223 // template instance
    224 $template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
    225218
    226219if (count($header_msgs) > 0)
Note: See TracChangeset for help on using the changeset viewer.