1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | // +-----------------------------------------------------------------------+ |
---|
24 | // | PhpWebGallery - a PHP based picture gallery | |
---|
25 | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
---|
26 | // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | |
---|
27 | // +-----------------------------------------------------------------------+ |
---|
28 | // | file : $Id: 60-database.php 2297 2008-04-04 22:57:23Z plg $ |
---|
29 | // | last update : $Date: 2008-04-04 22:57:23 +0000 (Fri, 04 Apr 2008) $ |
---|
30 | // | last modifier : $Author: plg $ |
---|
31 | // | revision : $Revision: 2297 $ |
---|
32 | // +-----------------------------------------------------------------------+ |
---|
33 | // | This program is free software; you can redistribute it and/or modify | |
---|
34 | // | it under the terms of the GNU General Public License as published by | |
---|
35 | // | the Free Software Foundation | |
---|
36 | // | | |
---|
37 | // | This program is distributed in the hope that it will be useful, but | |
---|
38 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
39 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
40 | // | General Public License for more details. | |
---|
41 | // | | |
---|
42 | // | You should have received a copy of the GNU General Public License | |
---|
43 | // | along with this program; if not, write to the Free Software | |
---|
44 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
45 | // | USA. | |
---|
46 | // +-----------------------------------------------------------------------+ |
---|
47 | |
---|
48 | if (!defined('PHPWG_ROOT_PATH')) |
---|
49 | { |
---|
50 | die('Hacking attempt!'); |
---|
51 | } |
---|
52 | |
---|
53 | $upgrade_description = 'Change default value on #user_infos for guest'; |
---|
54 | |
---|
55 | include_once(PHPWG_ROOT_PATH.'include/constants.php'); |
---|
56 | include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); |
---|
57 | @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); |
---|
58 | |
---|
59 | // +-----------------------------------------------------------------------+ |
---|
60 | // | Upgrade content | |
---|
61 | // +-----------------------------------------------------------------------+ |
---|
62 | |
---|
63 | load_conf_from_db(); |
---|
64 | |
---|
65 | $query = " |
---|
66 | update ".USER_INFOS_TABLE." |
---|
67 | set |
---|
68 | template = '".$conf['default_template']."', |
---|
69 | nb_image_line = ".$conf['nb_image_line'].", |
---|
70 | nb_line_page = ".$conf['nb_line_page'].", |
---|
71 | language = '".$conf['default_language']."', |
---|
72 | maxwidth = ".(empty($conf['default_maxwidth']) ? "null" : $conf['default_maxwidth']).", |
---|
73 | maxheight = ".(empty($conf['default_maxheight']) ? "null" : $conf['default_maxheight']).", |
---|
74 | recent_period = ".$conf['recent_period'].", |
---|
75 | expand = '".boolean_to_string($conf['auto_expand'])."', |
---|
76 | show_nb_comments = '".boolean_to_string($conf['show_nb_comments'])."', |
---|
77 | show_nb_hits = '".boolean_to_string($conf['show_nb_hits'])."', |
---|
78 | enabled_high = '".boolean_to_string( |
---|
79 | (isset($conf['newuser_default_enabled_high']) ? |
---|
80 | $conf['newuser_default_enabled_high'] : true))."' |
---|
81 | where |
---|
82 | user_id = ".$conf['default_user_id'].";"; |
---|
83 | pwg_query($query); |
---|
84 | |
---|
85 | |
---|
86 | $query = " |
---|
87 | delete from ".CONFIG_TABLE." |
---|
88 | where |
---|
89 | param in |
---|
90 | ( |
---|
91 | 'default_template', |
---|
92 | 'nb_image_line', |
---|
93 | 'nb_line_page', |
---|
94 | 'default_language', |
---|
95 | 'default_maxwidth', |
---|
96 | 'default_maxheight', |
---|
97 | 'recent_period', |
---|
98 | 'auto_expand', |
---|
99 | 'show_nb_comments', |
---|
100 | 'show_nb_hits' |
---|
101 | );"; |
---|
102 | pwg_query($query); |
---|
103 | |
---|
104 | echo |
---|
105 | "\n" |
---|
106 | .'"'.$upgrade_description.'"'.' ended' |
---|
107 | ."\n" |
---|
108 | ; |
---|
109 | |
---|
110 | ?> |
---|