source: trunk/include/user.inc.php @ 1051

Last change on this file since 1051 was 1036, checked in by plg, 18 years ago

improvement: $pagewhere string replaced by $pageitems.
$pagewhere was an SQL clause used to retrieve pictures in #images
table. $pageitems is the list of picture ids of the current section.

improvement: function initialize_category replaced by dedicated included PHP
script include/section_init.inc.php. Code was refactored to improve
readibility and maintenability. $pagenavigation_bar is now build in
category.php instead of initialize_category function. Function check_cat_id
was also replaced by a piece of code in the new file. The file to include to
display thumbnails from category.php is now set in section_init.inc.php
instead of calculated in category.php.

bug fix: the test for rel="up" link for standard HTML navigation links in
category menu was not working with non numeric categories, such as
"favorites".

improvement: function check_login_authorization removed because useless but
in profile.php.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2006-02-12 21:52:16 +0000 (Sun, 12 Feb 2006) $
10// | last modifier : $Author: plg $
11// | revision      : $Revision: 1036 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28// retrieving connected user informations
29if (isset($_COOKIE[session_name()])) 
30{
31 session_start();
32 if (isset($_SESSION['id'])) 
33 {
34   $user['id'] = $_SESSION['id'];   
35   $user['is_the_guest'] = false;
36 }
37 else 
38 {
39   // session timeout
40   $user['id'] = $conf['guest_id'];
41   $user['is_the_guest'] = true;
42 }
43} 
44else 
45{
46 $user['id'] = $conf['guest_id'];
47 $user['is_the_guest'] = true;
48}
49
50// using Apache authentication override the above user search
51if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER']))
52{
53  if (!($user['id'] = get_userid($_SERVER['REMOTE_USER'])))
54  {
55    register_user($_SERVER['REMOTE_USER'], '', '');
56    $user['id'] = get_userid($_SERVER['REMOTE_USER']);
57  }
58 
59  $user['is_the_guest'] = false;
60}
61
62$user = array_merge(
63  $user,
64  getuserdata(
65    $user['id'],
66    defined('IN_ADMIN') and IN_ADMIN ? false : true // use cache ?
67    )
68  );
69
70// properties of user guest are found in the configuration
71if ($user['is_the_guest'])
72{
73  $user['template'] = $conf['default_template'];
74  $user['nb_image_line'] = $conf['nb_image_line'];
75  $user['nb_line_page'] = $conf['nb_line_page'];
76  $user['language'] = $conf['default_language'];
77  $user['maxwidth'] = $conf['default_maxwidth'];
78  $user['maxheight'] = $conf['default_maxheight'];
79  $user['recent_period'] = $conf['recent_period'];
80  $user['expand'] = $conf['auto_expand'];
81  $user['show_nb_comments'] = $conf['show_nb_comments'];
82}
83
84// calculation of the number of picture to display per page
85$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
86?>
Note: See TracBrowser for help on using the repository browser.