aboutsummaryrefslogtreecommitdiffstats
path: root/BSF/install
diff options
context:
space:
mode:
Diffstat (limited to 'BSF/install')
-rw-r--r--BSF/install/config.sql29
-rw-r--r--BSF/install/db/1-database.php42
-rw-r--r--BSF/install/db/10-database.php52
-rw-r--r--BSF/install/db/11-database.php65
-rw-r--r--BSF/install/db/12-database.php99
-rw-r--r--BSF/install/db/13-database.php69
-rw-r--r--BSF/install/db/14-database.php59
-rw-r--r--BSF/install/db/15-database.php46
-rw-r--r--BSF/install/db/16-database.php50
-rw-r--r--BSF/install/db/17-database.php60
-rw-r--r--BSF/install/db/18-database.php88
-rw-r--r--BSF/install/db/19-database.php149
-rw-r--r--BSF/install/db/2-database.php74
-rw-r--r--BSF/install/db/20-database.php87
-rw-r--r--BSF/install/db/21-database.php48
-rw-r--r--BSF/install/db/22-database.php54
-rw-r--r--BSF/install/db/23-database.php46
-rw-r--r--BSF/install/db/24-database.php46
-rw-r--r--BSF/install/db/25-database.php47
-rw-r--r--BSF/install/db/26-database.php43
-rw-r--r--BSF/install/db/27-database.php43
-rw-r--r--BSF/install/db/28-database.php42
-rw-r--r--BSF/install/db/29-database.php42
-rw-r--r--BSF/install/db/3-database.php53
-rw-r--r--BSF/install/db/30-database.php50
-rw-r--r--BSF/install/db/31-database.php43
-rw-r--r--BSF/install/db/32-database.php43
-rw-r--r--BSF/install/db/33-database.php51
-rw-r--r--BSF/install/db/34-database.php56
-rw-r--r--BSF/install/db/35-database.php58
-rw-r--r--BSF/install/db/36-database.php43
-rw-r--r--BSF/install/db/37-database.php63
-rw-r--r--BSF/install/db/38-database.php46
-rw-r--r--BSF/install/db/39-database.php40
-rw-r--r--BSF/install/db/4-database.php50
-rw-r--r--BSF/install/db/40-database.php40
-rw-r--r--BSF/install/db/41-database.php61
-rw-r--r--BSF/install/db/42-database.php84
-rw-r--r--BSF/install/db/43-database.php47
-rw-r--r--BSF/install/db/44-database.php47
-rw-r--r--BSF/install/db/45-database.php48
-rw-r--r--BSF/install/db/46-database.php46
-rw-r--r--BSF/install/db/47-database.php52
-rw-r--r--BSF/install/db/48-database.php48
-rw-r--r--BSF/install/db/49-database.php54
-rw-r--r--BSF/install/db/5-database.php46
-rw-r--r--BSF/install/db/50-database.php50
-rw-r--r--BSF/install/db/51-database.php57
-rw-r--r--BSF/install/db/52-database.php69
-rw-r--r--BSF/install/db/53-database.php57
-rw-r--r--BSF/install/db/54-database.php69
-rw-r--r--BSF/install/db/55-database.php59
-rw-r--r--BSF/install/db/56-database.php49
-rw-r--r--BSF/install/db/57-database.php63
-rw-r--r--BSF/install/db/58-database.php48
-rw-r--r--BSF/install/db/59-database.php79
-rw-r--r--BSF/install/db/6-database.php53
-rw-r--r--BSF/install/db/60-database.php86
-rw-r--r--BSF/install/db/61-database.php50
-rw-r--r--BSF/install/db/62-database.php48
-rw-r--r--BSF/install/db/63-database.php73
-rw-r--r--BSF/install/db/64-database.php50
-rw-r--r--BSF/install/db/65-database.php319
-rw-r--r--BSF/install/db/66-database.php48
-rw-r--r--BSF/install/db/67-database.php48
-rw-r--r--BSF/install/db/68-database.php55
-rw-r--r--BSF/install/db/69-database.php58
-rw-r--r--BSF/install/db/7-database.php65
-rw-r--r--BSF/install/db/70-database.php53
-rw-r--r--BSF/install/db/71-database.php58
-rw-r--r--BSF/install/db/8-database.php83
-rw-r--r--BSF/install/db/9-database.php86
-rw-r--r--BSF/install/db/index.php30
-rw-r--r--BSF/install/index.php30
-rw-r--r--BSF/install/piwigo_structure.sql457
-rw-r--r--BSF/install/upgrade_1.3.0.php126
-rw-r--r--BSF/install/upgrade_1.3.1.php601
-rw-r--r--BSF/install/upgrade_1.4.0.php292
-rw-r--r--BSF/install/upgrade_1.5.0.php469
-rw-r--r--BSF/install/upgrade_1.6.0.php54
-rw-r--r--BSF/install/upgrade_1.6.2.php346
81 files changed, 6787 insertions, 0 deletions
diff --git a/BSF/install/config.sql b/BSF/install/config.sql
new file mode 100644
index 000000000..36ec2088a
--- /dev/null
+++ b/BSF/install/config.sql
@@ -0,0 +1,29 @@
+-- initial configuration for Piwigo
+
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('log','false','keep an history of visits on your website');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_validation','false','administrators validate users comments before becoming visible');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_forall','false','even guest not registered can post comments');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_locked','false','Lock your gallery temporary for non admin users');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_title','Piwigo demonstration site','Title at top of each page and for RSS feed');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('gallery_url','http://demo.piwigo.net','URL given in RSS feed');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('rate','true','Rating pictures feature is enabled');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('rate_anonymous','true','Rating pictures feature is also enabled for visitors');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('page_banner','<h1>Piwigo demonstration site</h1><p>My photos web site</p>','html displayed on the top each page of your gallery');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('history_admin','false','keep a history of administrator visits on your website');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('history_guest','true','keep a history of guest visits on your website');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('allow_user_registration','true','allow visitors to register?');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('secret_key', MD5(RAND()), 'a secret key specific to the gallery for internal use');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_html_mail','true','Send mail on HTML format for notification by mail');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_recent_post_dates','true','Send recent post by dates for notification by mail');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to theadministrators when a user registers');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the administrators when a valid comment is entered');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_link_everytime','false','Show upload link every time');
+INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_user_access',2 /*ACCESS_CLASSIC*/,'User access level to upload');
diff --git a/BSF/install/db/1-database.php b/BSF/install/db/1-database.php
new file mode 100644
index 000000000..5cc4ac96f
--- /dev/null
+++ b/BSF/install/db/1-database.php
@@ -0,0 +1,42 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Just a beginning test';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+list($now) = mysql_fetch_row(pwg_query('SELECT NOW()'));
+echo
+$now
+."\n"
+.'This upgrade script is for test purpose only'
+."\n"
+;
+?>
diff --git a/BSF/install/db/10-database.php b/BSF/install/db/10-database.php
new file mode 100644
index 000000000..47b9a17f1
--- /dev/null
+++ b/BSF/install/db/10-database.php
@@ -0,0 +1,52 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'New table #categories_link';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+CREATE TABLE phpwebgallery_categories_link (
+ source smallint(5) unsigned NOT NULL default '0',
+ destination smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (source,destination)
+) TYPE=MyISAM;";
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'categories_link created'
+."\n"
+;
+?>
diff --git a/BSF/install/db/11-database.php b/BSF/install/db/11-database.php
new file mode 100644
index 000000000..c4b3a485c
--- /dev/null
+++ b/BSF/install/db/11-database.php
@@ -0,0 +1,65 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description =
+ 'Table #categories_link created once again with correct prefix';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+if (PREFIX_TABLE == 'phpwebgallery_')
+{
+ echo
+ "\n"
+ .'Table '.PREFIX_TABLE.'categories_link was already correctly created'
+ ."\n"
+ ;
+}
+else
+{
+ $query = '
+DROP TABLE phpwebgallery_categories_link;
+;';
+ pwg_query($query);
+
+ $query = "
+CREATE TABLE ".PREFIX_TABLE."categories_link (
+ source smallint(5) unsigned NOT NULL default '0',
+ destination smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (source,destination)
+) TYPE=MyISAM;";
+ pwg_query($query);
+
+ echo
+ "\n"
+ .'Table '.PREFIX_TABLE.'categories_link created'
+ ."\n"
+ ;
+}
+?>
diff --git a/BSF/install/db/12-database.php b/BSF/install/db/12-database.php
new file mode 100644
index 000000000..b63495276
--- /dev/null
+++ b/BSF/install/db/12-database.php
@@ -0,0 +1,99 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Field "Status" Table #user_infos changed';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Alter table ".USER_INFOS_TABLE;
+$query = "
+alter table ".USER_INFOS_TABLE."
+ modify column `status` enum('webmaster', 'admin', 'normal', 'generic', 'guest') NOT NULL default 'guest'
+;";
+pwg_query($query);
+
+echo "Define webmaster";
+$query = '
+update
+ '.USER_INFOS_TABLE.'
+set status = \'webmaster\'
+where
+ user_id = '.$conf['webmaster_id'].' and status = \'admin\'
+;';
+$result = pwg_query($query);
+
+echo "Define normal";
+$query = '
+select
+ user_id
+from
+ '.USER_INFOS_TABLE.'
+where
+ user_id != '.$conf['guest_id'].' and status = \'guest\'
+;';
+$result = pwg_query($query);
+
+$datas = array();
+
+while ($row = mysql_fetch_array($result))
+{
+ array_push(
+ $datas,
+ array(
+ 'user_id' => $row['user_id'],
+ 'status' => 'normal'
+ )
+ );
+}
+
+mass_updates(
+ USER_INFOS_TABLE,
+ array(
+ 'primary' => array('user_id'),
+ 'update' => array('status')
+ ),
+ $datas
+ );
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Column '.USER_INFOS_TABLE.'.status changed'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/13-database.php b/BSF/install/db/13-database.php
new file mode 100644
index 000000000..d6df66fad
--- /dev/null
+++ b/BSF/install/db/13-database.php
@@ -0,0 +1,69 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = '#config (gallery_description out page_banner in)';
+
+$query = "
+ALTER TABLE ".PREFIX_TABLE."config MODIFY COLUMN `value` TEXT;";
+pwg_query($query);
+
+
+$query = '
+SELECT value
+ FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_title\'
+;';
+list($t) = array_from_query($query, 'value');
+
+$query = '
+SELECT value
+ FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_description\'
+;';
+list($d) = array_from_query($query, 'value');
+
+$page_banner='<div id="theHeader"><h1>'.$t.'</h1><p>'.$d.'</p></div>';
+$page_banner=addslashes($page_banner);
+$query = '
+INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' .
+"'page_banner','$page_banner','html displayed on the top each page of your gallery');";
+pwg_query($query);
+
+$query = '
+DELETE FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_description\'
+;';
+pwg_query($query);
+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'config updated'
+."\n"
+;
+?>
diff --git a/BSF/install/db/14-database.php b/BSF/install/db/14-database.php
new file mode 100644
index 000000000..596673814
--- /dev/null
+++ b/BSF/install/db/14-database.php
@@ -0,0 +1,59 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update database to new pwg_high structure';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Alter table ".USER_INFOS_TABLE. ' add field enabled_high';
+$query = "
+alter table ".USER_INFOS_TABLE."
+ add column `enabled_high` enum('true','false') NOT NULL default 'true'
+;";
+pwg_query($query);
+
+echo "Update ".USER_INFOS_TABLE.".enabled_high with default value";
+$query = "
+update ".USER_INFOS_TABLE." set enabled_high = '".$conf['newuser_default_enabled_high']."'
+where enabled_high <> '".$conf['newuser_default_enabled_high']."'
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/15-database.php b/BSF/install/db/15-database.php
new file mode 100644
index 000000000..0b393d629
--- /dev/null
+++ b/BSF/install/db/15-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = '#user_cache, add column nb_total_pictures (feature 262)';
+
+$query = "
+ALTER TABLE ".PREFIX_TABLE."user_cache ADD COLUMN `nb_total_images` MEDIUMINT(8) UNSIGNED;";
+pwg_query($query);
+
+$query = "
+UPDATE ".PREFIX_TABLE."user_cache SET need_update='true'";
+pwg_query($query);
+
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/16-database.php b/BSF/install/db/16-database.php
new file mode 100644
index 000000000..ad7a49883
--- /dev/null
+++ b/BSF/install/db/16-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update database from adviser functionnality';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Alter table ".USER_INFOS_TABLE. ' add field adviser';
+$query = "
+alter table ".USER_INFOS_TABLE."
+ add column `adviser` enum('true','false') NOT NULL default 'false' after `status`
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/17-database.php b/BSF/install/db/17-database.php
new file mode 100644
index 000000000..d707c55d1
--- /dev/null
+++ b/BSF/install/db/17-database.php
@@ -0,0 +1,60 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add notification by mail param';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Add param on ".CONFIG_TABLE;
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail');
+";
+pwg_query($query);
+
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/18-database.php b/BSF/install/db/18-database.php
new file mode 100644
index 000000000..52aa0e9fa
--- /dev/null
+++ b/BSF/install/db/18-database.php
@@ -0,0 +1,88 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Reduce length of #_user_mail_notification.check_key';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+echo "Compute new check_key";
+$query = '
+select
+ user_id
+from
+ '.USER_MAIL_NOTIFICATION_TABLE.'
+;';
+$result = pwg_query($query);
+
+$datas = array();
+
+while ($row = mysql_fetch_array($result))
+{
+ array_push(
+ $datas,
+ array(
+ 'user_id' => $row['user_id'],
+ 'check_key' => find_available_check_key()
+ )
+ );
+}
+
+mass_updates(
+ USER_MAIL_NOTIFICATION_TABLE,
+ array(
+ 'primary' => array('user_id'),
+ 'update' => array('check_key')
+ ),
+ $datas
+ );
+
+echo "Alter table ".USER_MAIL_NOTIFICATION_TABLE;
+$query = "
+alter table ".USER_MAIL_NOTIFICATION_TABLE."
+ modify column `check_key` varchar(16) binary NOT NULL default ''
+;";
+pwg_query($query);
+
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Column '.USER_MAIL_NOTIFICATION_TABLE.'.check_key changed'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/19-database.php b/BSF/install/db/19-database.php
new file mode 100644
index 000000000..e26b502f7
--- /dev/null
+++ b/BSF/install/db/19-database.php
@@ -0,0 +1,149 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = '#images.keywords moved to new table #tags';
+
+// +-----------------------------------------------------------------------+
+// | New tables |
+// +-----------------------------------------------------------------------+
+
+$query = '
+CREATE TABLE '.PREFIX_TABLE.'tags (
+ id smallint(5) UNSIGNED NOT NULL auto_increment,
+ name varchar(255) BINARY NOT NULL,
+ url_name varchar(255) BINARY NOT NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM
+;';
+pwg_query($query);
+
+$query = '
+CREATE TABLE '.PREFIX_TABLE.'image_tag (
+ image_id mediumint(8) UNSIGNED NOT NULL,
+ tag_id smallint(5) UNSIGNED NOT NULL,
+ PRIMARY KEY (image_id,tag_id)
+) TYPE=MyISAM
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | Move keywords to tags |
+// +-----------------------------------------------------------------------+
+
+// each tag label is associated to a numeric identifier
+$tag_id = array();
+// to each tag id (key) a list of image ids (value) is associated
+$tag_images = array();
+
+$current_id = 1;
+
+$query = '
+SELECT id, keywords
+ FROM '.PREFIX_TABLE.'images
+ WHERE keywords IS NOT NULL
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ foreach(preg_split('/[,]+/', $row['keywords']) as $keyword)
+ {
+ if (!isset($tag_id[$keyword]))
+ {
+ $tag_id[$keyword] = $current_id++;
+ }
+
+ if (!isset($tag_images[ $tag_id[$keyword] ]))
+ {
+ $tag_images[ $tag_id[$keyword] ] = array();
+ }
+
+ array_push($tag_images[ $tag_id[$keyword] ], $row['id']);
+ }
+}
+
+$datas = array();
+foreach ($tag_id as $tag_name => $tag_id)
+{
+ array_push(
+ $datas,
+ array(
+ 'id' => $tag_id,
+ 'name' => $tag_name,
+ 'url_name' => str2url($tag_name),
+ )
+ );
+}
+if (!empty($datas))
+mass_inserts(
+ PREFIX_TABLE.'tags',
+ array_keys($datas[0]),
+ $datas
+ );
+
+$datas = array();
+foreach ($tag_images as $tag_id => $images)
+{
+ foreach (array_unique($images) as $image_id)
+ {
+ array_push(
+ $datas,
+ array(
+ 'tag_id' => $tag_id,
+ 'image_id' => $image_id,
+ )
+ );
+ }
+}
+
+if (!empty($datas))
+mass_inserts(
+ PREFIX_TABLE.'image_tag',
+ array_keys($datas[0]),
+ $datas
+ );
+
+// +-----------------------------------------------------------------------+
+// | Delete images.keywords |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'images DROP COLUMN keywords
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'tags created and filled'."\n"
+.'Table '.PREFIX_TABLE.'image_tag created and filled'."\n"
+.'Column '.PREFIX_TABLE.'images.keywords dropped'."\n"
+;
+?>
diff --git a/BSF/install/db/2-database.php b/BSF/install/db/2-database.php
new file mode 100644
index 000000000..14c4cbfc2
--- /dev/null
+++ b/BSF/install/db/2-database.php
@@ -0,0 +1,74 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update template preference for every user';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+// configuration update
+$query = '
+UPDATE '.PREFIX_TABLE.'config
+ SET value = \'yoga/clear\'
+ WHERE param = \'default_template\'
+;';
+pwg_query($query);
+
+// set yoga/clear as default value for user_infos.template column
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'user_infos
+ CHANGE COLUMN template template varchar(255) NOT NULL default \'yoga/clear\'
+;';
+pwg_query($query);
+
+// users having yoga-dark for template now have yoga/dark
+$query = '
+UPDATE '.PREFIX_TABLE.'user_infos
+ SET template = \'yoga/dark\'
+ WHERE template = \'yoga-dark\'
+;';
+pwg_query($query);
+
+// all other users have yoga/clear
+$query = '
+UPDATE '.PREFIX_TABLE.'user_infos
+ SET template = \'yoga/clear\'
+ WHERE template != \'yoga/dark\'
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'Default template modified to yoga/clear'
+."\n"
+.'Template preference modified for every users : yoga/dark'
+.' (for yoga-dark users) and yoga/clear as default'
+."\n"
+;
+?>
diff --git a/BSF/install/db/20-database.php b/BSF/install/db/20-database.php
new file mode 100644
index 000000000..4561e44ec
--- /dev/null
+++ b/BSF/install/db/20-database.php
@@ -0,0 +1,87 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description =
+ '#image_category.is_storage replaced by #image.storage_category_id';
+
+// +-----------------------------------------------------------------------+
+// | New column |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'images
+ ADD storage_category_id smallint(5) unsigned default NULL
+;';
+pwg_query($query);
+
+$query = '
+SELECT category_id, image_id
+ FROM '.PREFIX_TABLE.'image_category
+ WHERE is_storage = \'true\'
+;';
+$result = pwg_query($query);
+
+$datas = array();
+while ($row = mysql_fetch_array($result))
+{
+ array_push(
+ $datas,
+ array(
+ 'id' => $row['image_id'],
+ 'storage_category_id' => $row['category_id'],
+ )
+ );
+}
+mass_updates(
+ PREFIX_TABLE.'images',
+ array(
+ 'primary' => array('id'),
+ 'update' => array('storage_category_id'),
+ ),
+ $datas
+ );
+
+// +-----------------------------------------------------------------------+
+// | Delete obsolete column |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'image_category DROP COLUMN is_storage
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Column '.PREFIX_TABLE.'image_category'
+.' replaced by '.PREFIX_TABLE.'images.storage_category_id'."\n"
+;
+?>
diff --git a/BSF/install/db/21-database.php b/BSF/install/db/21-database.php
new file mode 100644
index 000000000..743bbcbe6
--- /dev/null
+++ b/BSF/install/db/21-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'drop table #categories_link';
+
+// +-----------------------------------------------------------------------+
+// | New column |
+// +-----------------------------------------------------------------------+
+
+$query = '
+DROP TABLE '.PREFIX_TABLE.'categories_link
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'categories_link dropped'."\n"
+;
+?>
diff --git a/BSF/install/db/22-database.php b/BSF/install/db/22-database.php
new file mode 100644
index 000000000..a402b57d1
--- /dev/null
+++ b/BSF/install/db/22-database.php
@@ -0,0 +1,54 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'add index on #tags.url_name and #image_tag.tag_id ';
+
+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'tags ADD INDEX `tags_i1`(`url_name`);
+;';
+pwg_query($query);
+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'image_tag ADD INDEX `image_tag_i1`(`tag_id`);
+;';
+pwg_query($query);
+
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Tables '.PREFIX_TABLE.'tags and '.PREFIX_TABLE.'image_tag updated'."\n"
+;
+echo $upgrade_description;
+?>
diff --git a/BSF/install/db/23-database.php b/BSF/install/db/23-database.php
new file mode 100644
index 000000000..78b0fe2a3
--- /dev/null
+++ b/BSF/install/db/23-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'index images_i1 on storage_category_id comes back';
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'images
+ ADD INDEX images_i1(storage_category_id)
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.$upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/24-database.php b/BSF/install/db/24-database.php
new file mode 100644
index 000000000..21467fd7b
--- /dev/null
+++ b/BSF/install/db/24-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'increase categories.rank size, up to 65535';
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'categories
+ CHANGE COLUMN rank rank SMALLINT(5) UNSIGNED DEFAULT NULL
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.$upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/25-database.php b/BSF/install/db/25-database.php
new file mode 100644
index 000000000..9afa5e5ac
--- /dev/null
+++ b/BSF/install/db/25-database.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'reinitialize page_banner';
+
+$query = '
+UPDATE '.PREFIX_TABLE.'config
+ SET value = \'<h1>Piwigo demonstration site</h1><p>My photos web site</p>\'
+ WHERE param = \'page_banner\'
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.$upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/26-database.php b/BSF/install/db/26-database.php
new file mode 100644
index 000000000..9e614f5d5
--- /dev/null
+++ b/BSF/install/db/26-database.php
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'add an auto login key in users table';
+
+// add column auto_login_key
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ ADD auto_login_key varchar(64) NOT NULL
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/27-database.php b/BSF/install/db/27-database.php
new file mode 100644
index 000000000..600002550
--- /dev/null
+++ b/BSF/install/db/27-database.php
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'change username length in users table';
+
+// add column auto_login_key
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ CHANGE username username VARCHAR(100) NOT NULL
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/28-database.php b/BSF/install/db/28-database.php
new file mode 100644
index 000000000..93758cbba
--- /dev/null
+++ b/BSF/install/db/28-database.php
@@ -0,0 +1,42 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Delete old file index.htm';
+
+@unlink(PHPWG_ROOT_PATH.'/admin/images/index.htm');
+@unlink(PHPWG_ROOT_PATH.'/admin/include/index.htm');
+@unlink(PHPWG_ROOT_PATH.'/admin/index.htm');
+@unlink(PHPWG_ROOT_PATH.'/language/index.htm');
+@unlink(PHPWG_ROOT_PATH.'/galleries/index.htm');
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/29-database.php b/BSF/install/db/29-database.php
new file mode 100644
index 000000000..04f65c0cb
--- /dev/null
+++ b/BSF/install/db/29-database.php
@@ -0,0 +1,42 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add column #categories.image_order';
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'categories
+ ADD COLUMN image_order VARCHAR(128) DEFAULT NULL
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/3-database.php b/BSF/install/db/3-database.php
new file mode 100644
index 000000000..3a53f27a8
--- /dev/null
+++ b/BSF/install/db/3-database.php
@@ -0,0 +1,53 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update session table for new session system';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+// delete content of old session table
+$query = '
+DELETE FROM '.PREFIX_TABLE.'sessions
+;';
+pwg_query($query);
+
+// column user_id becomes data of type text
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'sessions
+ CHANGE COLUMN user_id data text NOT NULL
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'Column modified in sessions table'
+."\n"
+;
+?>
diff --git a/BSF/install/db/30-database.php b/BSF/install/db/30-database.php
new file mode 100644
index 000000000..d6442965c
--- /dev/null
+++ b/BSF/install/db/30-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add history_guest and login_history to #config';
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('history_admin',".
+((isset($conf['history_admin']) and $conf['history_admin']) ? 'true' : 'false').
+",'keep a history of administrator visits on your website');";
+pwg_query($query);
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('history_guest','true','keep a history of guest visits on your website');";
+pwg_query($query);
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('login_history','true','keep a history of user logins on your website');";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/31-database.php b/BSF/install/db/31-database.php
new file mode 100644
index 000000000..1463a826f
--- /dev/null
+++ b/BSF/install/db/31-database.php
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'change the upgrade 27 - username is binary';
+
+// add column auto_login_key
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ CHANGE username username VARCHAR(100) binary NOT NULL
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/32-database.php b/BSF/install/db/32-database.php
new file mode 100644
index 000000000..72990ff76
--- /dev/null
+++ b/BSF/install/db/32-database.php
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'add active_plugins to config';
+
+// add column auto_login_key
+$query = '
+INSERT INTO '.PREFIX_TABLE.'config (param,value,comment)
+ VALUES (\'active_plugins\',\'\',\'activated plugins\')
+;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/33-database.php b/BSF/install/db/33-database.php
new file mode 100644
index 000000000..2f771a62f
--- /dev/null
+++ b/BSF/install/db/33-database.php
@@ -0,0 +1,51 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add column #group.is_default';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Add column is_default on ".GROUPS_TABLE;
+$query = '
+alter table '.GROUPS_TABLE.' add column
+`is_default` enum(\'true\',\'false\') NOT NULL default \'false\'
+;';
+pwg_query($query);
+
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/34-database.php b/BSF/install/db/34-database.php
new file mode 100644
index 000000000..95092b074
--- /dev/null
+++ b/BSF/install/db/34-database.php
@@ -0,0 +1,56 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add #plugins and remove active_plugins from #config';
+
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+DELETE FROM '.PREFIX_TABLE.'config WHERE param="active_plugins"';
+pwg_query($query);
+
+$query = '
+CREATE TABLE '.PREFIX_TABLE.'plugins (
+ `id` varchar(64) binary NOT NULL default "",
+ `state` enum("inactive","active") NOT NULL default "inactive",
+ `version` varchar(64) NOT NULL default "0",
+ PRIMARY KEY (`id`)
+);';
+pwg_query($query);
+
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/35-database.php b/BSF/install/db/35-database.php
new file mode 100644
index 000000000..8b9e4448f
--- /dev/null
+++ b/BSF/install/db/35-database.php
@@ -0,0 +1,58 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add email_admin_on_new_user, email_admin_on_comment, email_admin_on_comment_validation';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to the admin when a user registers');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the admin when a valid comment is entered');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the admin when a comment requires validation');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/36-database.php b/BSF/install/db/36-database.php
new file mode 100644
index 000000000..e1eccbe3b
--- /dev/null
+++ b/BSF/install/db/36-database.php
@@ -0,0 +1,43 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'get rid of #users.auto_login_key';
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ DROP COLUMN auto_login_key
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/37-database.php b/BSF/install/db/37-database.php
new file mode 100644
index 000000000..05362e33a
--- /dev/null
+++ b/BSF/install/db/37-database.php
@@ -0,0 +1,63 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Cache user categories update';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Create table ".USER_CACHE_CATEGORIES_TABLE;
+$query = '
+CREATE TABLE '.USER_CACHE_CATEGORIES_TABLE.' (
+ `user_id` smallint(5) NOT NULL default \'0\',
+ `cat_id` smallint(5) unsigned NOT NULL default \'0\',
+ `is_child_date_last` enum(\'true\',\'false\') NOT NULL default \'false\',
+ `max_date_last` datetime default NULL,
+ `count_images` mediumint(8) unsigned default 0,
+ `count_categories` mediumint(8) unsigned default 0,
+ PRIMARY KEY (`user_id`, `cat_id`)
+) TYPE=MyISAM;';
+pwg_query($query);
+
+echo "Update table cache ".USER_CACHE_TABLE;
+$query = '
+UPDATE '.USER_CACHE_TABLE.'
+ SET need_update = \'true\'
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/38-database.php b/BSF/install/db/38-database.php
new file mode 100644
index 000000000..ff9a3e788
--- /dev/null
+++ b/BSF/install/db/38-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'delete #user_cache_categories.is_child_date_last';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+$query = '
+ALTER TABLE '.USER_CACHE_CATEGORIES_TABLE.' DROP COLUMN is_child_date_last';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/39-database.php b/BSF/install/db/39-database.php
new file mode 100644
index 000000000..7adc8be61
--- /dev/null
+++ b/BSF/install/db/39-database.php
@@ -0,0 +1,40 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add allow_user_registration to #config';
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('allow_user_registration','true','allow visitors to register?');";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/4-database.php b/BSF/install/db/4-database.php
new file mode 100644
index 000000000..5385575b9
--- /dev/null
+++ b/BSF/install/db/4-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Table #search is required for search engine redesign';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+// column user_id becomes data of type text
+$query = '
+CREATE TABLE '.PREFIX_TABLE.'search (
+ id int UNSIGNED NOT NULL AUTO_INCREMENT,
+ last_seen date DEFAULT NULL,
+ rules text,
+ PRIMARY KEY (id)
+);';
+pwg_query($query);
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'search created'
+."\n"
+;
+?>
diff --git a/BSF/install/db/40-database.php b/BSF/install/db/40-database.php
new file mode 100644
index 000000000..bc5543f0d
--- /dev/null
+++ b/BSF/install/db/40-database.php
@@ -0,0 +1,40 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add ws_status to #config';
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('ws_status','true','Web Service is active/inactive');";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/41-database.php b/BSF/install/db/41-database.php
new file mode 100644
index 000000000..6810fbad1
--- /dev/null
+++ b/BSF/install/db/41-database.php
@@ -0,0 +1,61 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Web service access table creation';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Create table ".WEB_SERVICES_ACCESS_TABLE;
+$query = '
+CREATE TABLE '.WEB_SERVICES_ACCESS_TABLE." (
+ id smallint(5) unsigned NOT NULL auto_increment,
+ name varchar(32) NOT NULL default '',
+ access varchar(255) default NULL,
+ `start` datetime default NULL,
+ `end` datetime default NULL,
+ request varchar(255) default NULL,
+ high enum('true','false') NOT NULL default 'true',
+ normal enum('true','false') NOT NULL default 'true',
+ `limit` smallint(5) unsigned default NULL,
+ `comment` varchar(255) default NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY name (name)
+) ENGINE=MyISAM COMMENT='Access for Web Services';";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/42-database.php b/BSF/install/db/42-database.php
new file mode 100644
index 000000000..12d40b140
--- /dev/null
+++ b/BSF/install/db/42-database.php
@@ -0,0 +1,84 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'History table new model and new table history_summary';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Recreate table ".HISTORY_TABLE."\n";
+
+$query = 'DROP TABLE '.HISTORY_TABLE.';';
+pwg_query($query);
+
+$query = "
+CREATE TABLE `".HISTORY_TABLE."` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `date` date NOT NULL default '0000-00-00',
+ `time` time NOT NULL default '00:00:00',
+ `year` smallint(4) NOT NULL default '0',
+ `month` tinyint(2) NOT NULL default '0',
+ `day` tinyint(2) NOT NULL default '0',
+ `hour` tinyint(2) NOT NULL default '0',
+ `user_id` smallint(5) NOT NULL default '0',
+ `IP` varchar(15) NOT NULL default '',
+ `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
+ `category_id` smallint(5) default NULL,
+ `tag_ids` varchar(50) default NULL,
+ `image_id` mediumint(8) default NULL,
+ `summarized` enum('true','false') default 'false',
+ PRIMARY KEY (`id`),
+ KEY `history_i1` (`summarized`)
+) TYPE=MyISAM
+;";
+pwg_query($query);
+
+echo "Create table ".HISTORY_SUMMARY_TABLE."\n";
+$query = "
+CREATE TABLE `".HISTORY_SUMMARY_TABLE."` (
+ `id` varchar(13) NOT NULL default '',
+ `year` smallint(4) NOT NULL default '0',
+ `month` tinyint(2) default NULL,
+ `day` tinyint(2) default NULL,
+ `hour` tinyint(2) default NULL,
+ `nb_pages` int(11) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/43-database.php b/BSF/install/db/43-database.php
new file mode 100644
index 000000000..cc50f4a50
--- /dev/null
+++ b/BSF/install/db/43-database.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Insert secret_key into #config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment) VALUES ('secret_key', MD5(RAND()), 'a secret key specific to the gallery for internal use');";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/44-database.php b/BSF/install/db/44-database.php
new file mode 100644
index 000000000..45f98f06e
--- /dev/null
+++ b/BSF/install/db/44-database.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'None efficient index removed for performance reasons';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'image_category DROP INDEX `image_category_i1;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/45-database.php b/BSF/install/db/45-database.php
new file mode 100644
index 000000000..79221ae35
--- /dev/null
+++ b/BSF/install/db/45-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Index rename without any reason except human logic';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'image_category DROP INDEX image_category_i2 ,
+ADD INDEX image_category ( category_id ) ;';
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/46-database.php b/BSF/install/db/46-database.php
new file mode 100644
index 000000000..07e9e9d53
--- /dev/null
+++ b/BSF/install/db/46-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'remove login_history from #config (partial revert 30-database.php)';
+
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+DELETE FROM '.PREFIX_TABLE.'config WHERE param="login_history"';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/47-database.php b/BSF/install/db/47-database.php
new file mode 100644
index 000000000..e5248187b
--- /dev/null
+++ b/BSF/install/db/47-database.php
@@ -0,0 +1,52 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Remove ws_status from #config';
+
+$query = '
+DELETE FROM '.PREFIX_TABLE."config WHERE param ='ws_status';";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+$upgrade_description = 'Add show_nb_hits to #user_infos';
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE."user_infos ADD `show_nb_hits`
+ENUM( 'true', 'false' ) DEFAULT 'false' NOT NULL AFTER `show_nb_comments` ;";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+?>
diff --git a/BSF/install/db/48-database.php b/BSF/install/db/48-database.php
new file mode 100644
index 000000000..888d2f8ee
--- /dev/null
+++ b/BSF/install/db/48-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Insert show_nb_hits into #config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+INSERT INTO '.PREFIX_TABLE."config (param,value,comment)
+VALUES ('show_nb_hits', 'false', 'Show hits count under thumbnails');";
+pwg_query($query);
+
+echo
+"\n"
+. $upgrade_description
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/49-database.php b/BSF/install/db/49-database.php
new file mode 100644
index 000000000..50f04bcc1
--- /dev/null
+++ b/BSF/install/db/49-database.php
@@ -0,0 +1,54 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add notification by mail params (HTML mail and new informartions)';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Add params on ".CONFIG_TABLE;
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_html_mail','true','Send mail on HTML format for notification by mail');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_recent_post_dates','true','Send recent post by dates for notification by mail');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/5-database.php b/BSF/install/db/5-database.php
new file mode 100644
index 000000000..d7c8d6903
--- /dev/null
+++ b/BSF/install/db/5-database.php
@@ -0,0 +1,46 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update images table with has_high column';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+// column user_id becomes data of type text
+$query = "
+ALTER TABLE ".PREFIX_TABLE."images ADD COLUMN has_high ENUM('true') DEFAULT NULL AFTER average_rate;
+";
+pwg_query($query);
+
+echo
+"\n"
+.'Column has_high '.PREFIX_TABLE.'images added'
+."\n"
+;
+?>
diff --git a/BSF/install/db/50-database.php b/BSF/install/db/50-database.php
new file mode 100644
index 000000000..ee7589e84
--- /dev/null
+++ b/BSF/install/db/50-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Remove high and normal columns from #ws_access';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+echo "Drop some columns from ".WEB_SERVICES_ACCESS_TABLE;
+$query = "
+ALTER TABLE ".WEB_SERVICES_ACCESS_TABLE."
+ DROP `high`,
+ DROP `normal`;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/51-database.php b/BSF/install/db/51-database.php
new file mode 100644
index 000000000..6ccac09a6
--- /dev/null
+++ b/BSF/install/db/51-database.php
@@ -0,0 +1,57 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add #history.is_high column';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+ALTER TABLE ".HISTORY_TABLE."
+ ADD COLUMN is_high ENUM('true', 'false') DEFAULT NULL
+;";
+pwg_query($query);
+
+$query = "
+UPDATE ".HISTORY_TABLE."
+ SET is_high = 'false'
+ WHERE image_id IS NOT NULL
+ AND is_high IS NULL
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.', ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/52-database.php b/BSF/install/db/52-database.php
new file mode 100644
index 000000000..fb5a117d2
--- /dev/null
+++ b/BSF/install/db/52-database.php
@@ -0,0 +1,69 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Replace #history.is_high by #history.image_type';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+ALTER TABLE ".HISTORY_TABLE."
+ ADD COLUMN image_type ENUM('picture', 'high', 'other') DEFAULT NULL
+;";
+pwg_query($query);
+
+$query = "
+UPDATE ".HISTORY_TABLE."
+ SET image_type = 'high'
+ WHERE is_high = 'true'
+;";
+pwg_query($query);
+
+$query = "
+UPDATE ".HISTORY_TABLE."
+ SET image_type = 'picture'
+ WHERE is_high = 'false'
+;";
+pwg_query($query);
+
+$query = "
+ALTER TABLE ".HISTORY_TABLE."
+ DROP COLUMN is_high
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.', ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/53-database.php b/BSF/install/db/53-database.php
new file mode 100644
index 000000000..2618bd41e
--- /dev/null
+++ b/BSF/install/db/53-database.php
@@ -0,0 +1,57 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = '#comments.content is not html escaped anymore';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+
+$replacements = array(
+ array('&#039;', '\''),
+ array('&quot;', '"'),
+ array('&lt;', '<'),
+ array('&gt;', '>'),
+ array('&amp;', '&') // <- this must be the last one
+ );
+
+foreach ($replacements as $replacement)
+{
+ $query = '
+UPDATE '.COMMENTS_TABLE.'
+ SET content = REPLACE(content, "'.addslashes($replacement[0]).'", "'.addslashes($replacement[1]).'")
+;';
+ pwg_query($query);
+}
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.', ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/54-database.php b/BSF/install/db/54-database.php
new file mode 100644
index 000000000..332b556f8
--- /dev/null
+++ b/BSF/install/db/54-database.php
@@ -0,0 +1,69 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'add column #categories.permalink and table #old_permalinks';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+defined('OLD_PERMALINKS_TABLE') or die('OLD_PERMALINKS_TABLE is not defined');
+
+$query = "
+CREATE TABLE `".OLD_PERMALINKS_TABLE."` (
+ `cat_id` smallint(5) unsigned NOT NULL,
+ `permalink` VARCHAR(64) NOT NULL,
+ `date_deleted` datetime NOT NULL,
+ `last_hit` datetime default NULL,
+ `hit` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`permalink`)
+) TYPE=MyISAM
+;";
+pwg_query($query);
+
+$query = "
+ALTER TABLE `".CATEGORIES_TABLE."`
+ ADD COLUMN `permalink` VARCHAR(64) default NULL
+;";
+pwg_query($query);
+
+$query = "
+ALTER TABLE `".CATEGORIES_TABLE."`
+ ADD UNIQUE INDEX `categories_i3` (`permalink`)
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/55-database.php b/BSF/install/db/55-database.php
new file mode 100644
index 000000000..72d85c5f3
--- /dev/null
+++ b/BSF/install/db/55-database.php
@@ -0,0 +1,59 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description =
+ 'Update #history.image_type to "picture" by default when image_id is not null';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+UPDATE ".HISTORY_TABLE."
+ SET image_type = 'picture'
+ WHERE image_id IS NOT NULL
+ AND image_type IS NULL
+;";
+pwg_query($query);
+
+$query = "
+UPDATE ".HISTORY_TABLE."
+ SET image_type = NULL
+ WHERE image_id IS NULL
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.', ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/56-database.php b/BSF/install/db/56-database.php
new file mode 100644
index 000000000..05837b217
--- /dev/null
+++ b/BSF/install/db/56-database.php
@@ -0,0 +1,49 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add #images.high_filesize';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+ALTER TABLE ".IMAGES_TABLE."
+ ADD COLUMN high_filesize mediumint(9) unsigned default NULL
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.', ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/57-database.php b/BSF/install/db/57-database.php
new file mode 100644
index 000000000..ba760f4e1
--- /dev/null
+++ b/BSF/install/db/57-database.php
@@ -0,0 +1,63 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Update email_admin_on_new_user, email_admin_on_comment, email_admin_on_comment_validation & Add email_admin_on_picture_uploaded';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a user registers' where param = 'email_admin_on_new_user';
+";
+pwg_query($query);
+
+$query = "
+UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a valid comment is entered' where param = 'email_admin_on_comment';
+";
+pwg_query($query);
+
+$query = "
+UPDATE ".CONFIG_TABLE." set comment = 'Send an email to the administrators when a comment requires validation' where param = 'email_admin_on_comment_validation';
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/58-database.php b/BSF/install/db/58-database.php
new file mode 100644
index 000000000..c7a5b77a3
--- /dev/null
+++ b/BSF/install/db/58-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Change default value for #user_infos.language';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+ALTER TABLE ".USER_INFOS_TABLE." CHANGE `language` `language` varchar(50) NOT NULL default 'en_UK.iso-8859-1'
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/59-database.php b/BSF/install/db/59-database.php
new file mode 100644
index 000000000..adcbbb3e3
--- /dev/null
+++ b/BSF/install/db/59-database.php
@@ -0,0 +1,79 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Rename some indexes following PWG naming rules';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+DROP INDEX image_category ON ".IMAGE_CATEGORY_TABLE."
+;
+";
+pwg_query($query);
+
+$query = "
+CREATE INDEX image_category_i1 ON ".IMAGE_CATEGORY_TABLE." (category_id)
+;
+";
+pwg_query($query);
+
+$query = "
+DROP INDEX uidx_check_key ON ".USER_MAIL_NOTIFICATION_TABLE."
+;
+";
+pwg_query($query);
+
+$query = "
+CREATE UNIQUE INDEX user_mail_notification_ui1 ON ".USER_MAIL_NOTIFICATION_TABLE." (check_key)
+;
+";
+pwg_query($query);
+
+$query = "
+DROP INDEX name ON ".WEB_SERVICES_ACCESS_TABLE."
+;
+";
+pwg_query($query);
+
+$query = "
+CREATE UNIQUE INDEX ws_access_ui1 ON ".WEB_SERVICES_ACCESS_TABLE." (name)
+;
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?> \ No newline at end of file
diff --git a/BSF/install/db/6-database.php b/BSF/install/db/6-database.php
new file mode 100644
index 000000000..cc21c009e
--- /dev/null
+++ b/BSF/install/db/6-database.php
@@ -0,0 +1,53 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Table #user_mail_notification is required for NBM';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+// Creating table user_mail_notification
+$query = '
+CREATE TABLE '.PREFIX_TABLE.'user_mail_notification
+(
+ user_id smallint(5) NOT NULL default \'0\',
+ check_key varchar(128) binary NOT NULL,
+ enabled enum(\'true\',\'false\') NOT NULL default \'false\',
+ last_send datetime default NULL,
+ PRIMARY KEY (`user_id`),
+ UNIQUE KEY `uidx_check_key` (`check_key`)
+) TYPE=MyISAM;';
+pwg_query($query);
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'user_mail_notification created'
+."\n"
+;
+?>
diff --git a/BSF/install/db/60-database.php b/BSF/install/db/60-database.php
new file mode 100644
index 000000000..cc5d8ccfb
--- /dev/null
+++ b/BSF/install/db/60-database.php
@@ -0,0 +1,86 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Change default value on #user_infos for guest';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+load_conf_from_db();
+
+$query = "
+update ".USER_INFOS_TABLE."
+set
+ template = '".$conf['default_template']."',
+ nb_image_line = ".$conf['nb_image_line'].",
+ nb_line_page = ".$conf['nb_line_page'].",
+ language = '".$conf['default_language']."',
+ maxwidth = ".(empty($conf['default_maxwidth']) ? "null" : $conf['default_maxwidth']).",
+ maxheight = ".(empty($conf['default_maxheight']) ? "null" : $conf['default_maxheight']).",
+ recent_period = ".$conf['recent_period'].",
+ expand = '".boolean_to_string($conf['auto_expand'])."',
+ show_nb_comments = '".boolean_to_string($conf['show_nb_comments'])."',
+ show_nb_hits = '".boolean_to_string($conf['show_nb_hits'])."',
+ enabled_high = '".boolean_to_string(
+ (isset($conf['newuser_default_enabled_high']) ?
+ $conf['newuser_default_enabled_high'] : true))."'
+where
+ user_id = ".$conf['default_user_id'].";";
+pwg_query($query);
+
+
+$query = "
+delete from ".CONFIG_TABLE."
+where
+ param in
+(
+ 'default_template',
+ 'nb_image_line',
+ 'nb_line_page',
+ 'default_language',
+ 'default_maxwidth',
+ 'default_maxheight',
+ 'recent_period',
+ 'auto_expand',
+ 'show_nb_comments',
+ 'show_nb_hits'
+);";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/61-database.php b/BSF/install/db/61-database.php
new file mode 100644
index 000000000..83090473a
--- /dev/null
+++ b/BSF/install/db/61-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add unique index on #_groups for name';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+
+$query = "
+alter table ".GROUPS_TABLE."
+ add UNIQUE KEY `groups_ui1` (`name`)
+;";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/62-database.php b/BSF/install/db/62-database.php
new file mode 100644
index 000000000..18d2d7fa8
--- /dev/null
+++ b/BSF/install/db/62-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add obligatory_user_mail config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/63-database.php b/BSF/install/db/63-database.php
new file mode 100644
index 000000000..69e6dd972
--- /dev/null
+++ b/BSF/install/db/63-database.php
@@ -0,0 +1,73 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add #user_infos.level, #images.level and #user_cache.forbidden_images';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN level TINYINT UNSIGNED NOT NULL DEFAULT 0
+';
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.USER_INFOS_TABLE.' ADD COLUMN level TINYINT UNSIGNED NOT NULL DEFAULT 0
+';
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.USER_CACHE_TABLE.' ADD COLUMN image_access_type enum("NOT IN","IN") NOT NULL default "NOT IN"
+';
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.USER_CACHE_TABLE.' ADD COLUMN image_access_list TEXT DEFAULT NULL
+';
+pwg_query($query);
+
+$query = '
+UPDATE '.USER_INFOS_TABLE.' SET level=8 WHERE status="webmaster"
+';
+pwg_query($query);
+
+$query = '
+UPDATE '.USER_CACHE_TABLE.' SET need_update=true
+';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/64-database.php b/BSF/install/db/64-database.php
new file mode 100644
index 000000000..37dca478f
--- /dev/null
+++ b/BSF/install/db/64-database.php
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Activation of c13_upgrade plugin';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+REPLACE INTO '.PLUGINS_TABLE.'
+ (id, state)
+ VALUES (\'c13y_upgrade\', \'active\')
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/65-database.php b/BSF/install/db/65-database.php
new file mode 100644
index 000000000..daa59de30
--- /dev/null
+++ b/BSF/install/db/65-database.php
@@ -0,0 +1,319 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+function upgrade65_change_table_to_blob($table, $field_definitions)
+{
+ $types = array('varchar' => 'varbinary',
+ 'text' => 'blob',
+ 'mediumtext' => 'mediumblob',
+ 'longtext' => 'longblob');
+
+ $changes=array();
+ foreach( $field_definitions as $row)
+ {
+ if ( !isset($row['Collation']) or $row['Collation']=='NULL' )
+ continue;
+ list ($type) = explode('(', $row['Type']);
+ if (!isset($types[$type]))
+ continue; // no need
+ $binaryType = preg_replace('/'. $type .'/i', $types[$type], $row['Type'] );
+ $changes[] = 'MODIFY COLUMN '.$row['Field'].' '.$binaryType;
+ }
+ if (count($changes))
+ {
+ $query = 'ALTER TABLE '.$table.' '.implode(', ', $changes);
+ pwg_query($query);
+ }
+}
+
+function upgrade65_change_table_to_charset($table, $field_definitions, $db_charset)
+{
+ $changes=array();
+ foreach( $field_definitions as $row)
+ {
+ if ( !isset($row['Collation']) or $row['Collation']=='NULL' )
+ continue;
+ $query = $row['Field'].' '.$row['Type'];
+ $query .= ' CHARACTER SET '.$db_charset;
+ if (strpos($row['Collation'],'_bin')!==false)
+ {
+ $query .= ' BINARY';
+ }
+ if ($row['Null']!='YES')
+ {
+ $query.=' NOT NULL';
+ if (isset($row['Default']))
+ $query.=' DEFAULT "'.addslashes($row['Default']).'"';
+ }
+ else
+ {
+ if (!isset($row['Default']))
+ $query.=' DEFAULT NULL';
+ else
+ $query.=' DEFAULT "'.addslashes($row['Default']).'"';
+ }
+
+ if ($row['Extra']=='auto_increment')
+ {
+ $query.=' auto_increment';
+ }
+ $changes[] = 'MODIFY COLUMN '.$query;
+ }
+
+ if (count($changes))
+ {
+ $query = 'ALTER TABLE `'.$table.'` '.implode(', ', $changes);
+ pwg_query($query);
+ }
+}
+
+
+$upgrade_description = 'PWG charset migration';
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+if ( !defined('PWG_CHARSET') )
+{
+ $upgrade_log = '';
+
+// +-----------------------------------------------------------------------+
+// load the config file
+ $config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
+ $config_file_contents = @file_get_contents($config_file);
+ if ($config_file_contents === false)
+ {
+ die('CANNOT LOAD '.$config_file);
+ }
+ $php_end_tag = strrpos($config_file_contents, '?'.'>');
+ if ($php_end_tag === false)
+ {
+ die('CANNOT FIND PHP END TAG IN '.$config_file);
+ }
+ if (!is_writable($config_file))
+ {
+ die('FILE NOT WRITABLE '.$config_file);
+ }
+
+
+// +-----------------------------------------------------------------------+
+// load all the user languages
+ $all_langs=array();
+ $query='
+SELECT language, COUNT(user_id) AS count FROM '.USER_INFOS_TABLE.'
+ GROUP BY language';
+ $result = pwg_query($query);
+ while ( $row=mysql_fetch_assoc($result) )
+ {
+ $lang = $row["language"];
+ $lang_def = explode('.', $lang);
+ if ( count($lang_def)==2 )
+ {
+ $new_lang = $lang_def[0];
+ $charset = strtolower($lang_def[1]);
+ }
+ else
+ {
+ $new_lang = 'en_UK';
+ $charset = 'iso-8859-1';
+ }
+ $all_langs[$lang] = array(
+ 'count' => $row['count'],
+ 'new_lang' => $new_lang,
+ 'charset' => $charset,
+ );
+ $upgrade_log .= ">>user_lang\t".$lang."\t".$row['count']."\n";
+ }
+ $upgrade_log .= "\n";
+
+
+// +-----------------------------------------------------------------------+
+// get admin charset
+ include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
+ @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+ $admin_charset='iso-8859-1';
+ $query='
+SELECT language FROM '.USER_INFOS_TABLE.'
+ WHERE user_id='.$conf['webmaster_id'];
+ $result = pwg_query($query);
+ if (mysql_num_rows($result)==0)
+ {
+ $query='
+SELECT language FROM '.USER_INFOS_TABLE.'
+ WHERE status="webmaster" and adviser="false"
+ LIMIT 1';
+ $result = pwg_query($query);
+ }
+
+ if ( $row=mysql_fetch_assoc($result) )
+ {
+ $admin_charset = $all_langs[$row['language']]['charset'];
+ }
+ $upgrade_log .= ">>admin_charset\t".$admin_charset."\n";
+
+
+// +-----------------------------------------------------------------------+
+// get mysql version and structure of tables
+ $mysql_version = mysql_get_server_info();
+ $upgrade_log .= ">>mysql_ver\t".$mysql_version."\n";
+
+ $all_tables = array();
+ $query = 'SHOW TABLES LIKE "'.$prefixeTable.'%"';
+ $result = pwg_query($query);
+ while ( $row=mysql_fetch_array($result) )
+ {
+ array_push($all_tables, $row[0]);
+ }
+
+ $all_tables_definition = array();
+ foreach( $all_tables as $table)
+ {
+ $query = 'SHOW FULL COLUMNS FROM '.$table;
+ $result = pwg_query($query);
+ $field_definitions=array();
+ while ( $row=mysql_fetch_array($result) )
+ {
+ if ( !isset($row['Collation']) or $row['Collation']=='NULL' )
+ continue;
+ array_push($field_definitions, $row);
+ }
+ $all_tables_definition[$table] = $field_definitions;
+ }
+
+// +-----------------------------------------------------------------------+
+// calculate the result and convert the tables
+
+//tables that can be converted without going through binary (they contain only ascii data)
+ $safe_tables=array('history','history_backup','history_summary','old_permalinks','plugins','rate','upgrade','user_cache','user_feed','user_infos','user_mail_notification', 'users', 'waiting','ws_access');
+ $safe_tables=array_flip($safe_tables);
+
+ $pwg_charset = 'iso-8859-1';
+ $db_charset = 'latin1';
+ $db_collate = '';
+ if ( version_compare($mysql_version, '4.1', '<') )
+ { // below 4.1 no charset support
+ $upgrade_log .= "< conversion\tnothing\n";
+ }
+ elseif ($admin_charset=='iso-8859-1')
+ {
+ $pwg_charset = 'utf-8';
+ $db_charset = 'utf8';
+ foreach($all_tables as $table)
+ {
+ upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' );
+ $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8';
+ pwg_query($query);
+ }
+ $upgrade_log .= "< conversion\tchange utf8\n";
+ }
+/*ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name; (or change column character set)
+
+Warning: The preceding operation converts column values between the character sets. This is not what you want if you have a column in one character set (like latin1) but the stored values actually use some other, incompatible character set (like utf8). In this case, you have to do the following for each such column:
+
+ALTER TABLE t1 CHANGE c1 c1 BLOB;
+ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8;
+*/
+ elseif ( $admin_charset=='utf-8')
+ {
+ $pwg_charset = 'utf-8';
+ $db_charset = 'utf8';
+ foreach($all_tables as $table)
+ {
+ if ( !isset($safe_tables[ substr($table, strlen($prefixeTable)) ]) )
+ upgrade65_change_table_to_blob($table, $all_tables_definition[$table] );
+ upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' );
+ $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8';
+ pwg_query($query);
+ }
+ $upgrade_log .= "< conversion\tchange binary\n";
+ $upgrade_log .= "< conversion\tchange utf8\n";
+ }
+ elseif ( $admin_charset=='iso-8859-2'/*Central European*/)
+ {
+ $pwg_charset = 'utf-8';
+ $db_charset = 'utf8';
+ foreach($all_tables as $table)
+ {
+ if ( !isset($safe_tables[ substr($table, strlen($prefixeTable)) ]) )
+ {
+ upgrade65_change_table_to_blob($table, $all_tables_definition[$table] );
+ upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'latin2' );
+ }
+ upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' );
+ $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8';
+ pwg_query($query);
+ }
+ $upgrade_log .= "< conversion\tchange binary\n";
+ $upgrade_log .= "< conversion\tchange latin2\n";
+ $upgrade_log .= "< conversion\tchange utf8\n";
+ }
+
+
+// +-----------------------------------------------------------------------+
+// write the result to file and update #user_infos.language
+ $config_file_contents =
+ substr($config_file_contents, 0, $php_end_tag).'
+define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
+define(\'DB_CHARSET\', \''.$db_charset.'\');
+define(\'DB_COLLATE\', \'\');
+'.substr($config_file_contents, $php_end_tag);
+
+ $fp = @fopen( $config_file, 'w' );
+ @fputs($fp, $config_file_contents, strlen($config_file_contents));
+ @fclose($fp);
+
+ foreach ($all_langs as $old_lang=>$lang_data)
+ {
+ $query='
+ UPDATE '.USER_INFOS_TABLE.' SET language="'.$lang_data['new_lang'].'"
+ WHERE language="'.$old_lang.'"';
+ pwg_query($query);
+ }
+
+ define('PWG_CHARSET', $pwg_charset);
+ define('DB_CHARSET', $db_charset);
+ define('DB_COLLATE', '');
+
+ echo $upgrade_log;
+ $fp = @fopen( PHPWG_ROOT_PATH.'upgrade65.log', 'w' );
+ if ($fp)
+ {
+ @fputs($fp, $upgrade_log, strlen($upgrade_log));
+ @fclose($fp);
+ }
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+}
+else
+{
+ echo 'PWG_CHARSET already defined - nada';
+}
+?>
diff --git a/BSF/install/db/66-database.php b/BSF/install/db/66-database.php
new file mode 100644
index 000000000..d6a861ae2
--- /dev/null
+++ b/BSF/install/db/66-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add c13y_ignore config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/67-database.php b/BSF/install/db/67-database.php
new file mode 100644
index 000000000..993f5dd21
--- /dev/null
+++ b/BSF/install/db/67-database.php
@@ -0,0 +1,48 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Uninstall dew plugin';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+delete from ".PLUGINS_TABLE." where id ='dew';
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/68-database.php b/BSF/install/db/68-database.php
new file mode 100644
index 000000000..39283a7a2
--- /dev/null
+++ b/BSF/install/db/68-database.php
@@ -0,0 +1,55 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Change type from text to mediumtext for #sessions.data #user_cache.forbidden_categories and #user_cache.image_access_list';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.SESSIONS_TABLE.'
+ MODIFY COLUMN data MEDIUMTEXT NOT NULL';
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.USER_CACHE_TABLE.'
+ MODIFY COLUMN forbidden_categories MEDIUMTEXT,
+ MODIFY COLUMN image_access_list MEDIUMTEXT
+ ';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/69-database.php b/BSF/install/db/69-database.php
new file mode 100644
index 000000000..dad302401
--- /dev/null
+++ b/BSF/install/db/69-database.php
@@ -0,0 +1,58 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Move #categories.date_last and nb_images to #user_cache_categories';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.USER_CACHE_CATEGORIES_TABLE.'
+ ADD COLUMN date_last datetime default NULL AFTER cat_id,
+ ADD COLUMN nb_images mediumint(8) unsigned NOT NULL default 0 AFTER max_date_last';
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.CATEGORIES_TABLE.'
+ DROP COLUMN date_last,
+ DROP COLUMN nb_images
+ ';
+pwg_query($query);
+
+invalidate_user_cache(); // just to force recalculation
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/7-database.php b/BSF/install/db/7-database.php
new file mode 100644
index 000000000..d6f37e164
--- /dev/null
+++ b/BSF/install/db/7-database.php
@@ -0,0 +1,65 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Anonymous rating';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'rate DROP PRIMARY KEY;'
+;
+pwg_query($query);
+
+$query ='
+ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN anonymous_id VARCHAR(45) NOT NULL DEFAULT \'\' AFTER element_id;'
+;
+pwg_query($query);
+
+$query ='
+ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN date DATE NOT NULL AFTER rate;'
+;
+pwg_query($query);
+
+$query ='
+UPDATE '.PREFIX_TABLE.'rate SET date=NOW() WHERE date<"1990-01-01";'
+;
+pwg_query($query);
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'rate ADD PRIMARY KEY (element_id, user_id, anonymous_id);'
+;
+pwg_query($query);
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'rate upgraded'
+."\n"
+;
+?>
diff --git a/BSF/install/db/70-database.php b/BSF/install/db/70-database.php
new file mode 100644
index 000000000..50dfc161b
--- /dev/null
+++ b/BSF/install/db/70-database.php
@@ -0,0 +1,53 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add upload config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+replace into ".CONFIG_TABLE."
+ (param, value, comment)
+values
+('upload_link_everytime','false','Show Upload link every time'),
+('upload_user_access',".ACCESS_CLASSIC.",'Minimal user status allowed to upload pictures')
+;";
+
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/71-database.php b/BSF/install/db/71-database.php
new file mode 100644
index 000000000..ef453509f
--- /dev/null
+++ b/BSF/install/db/71-database.php
@@ -0,0 +1,58 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Delete unnecessary #history_summary.id, #history.year, #history.month, #history.day and #history.hour';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = 'ALTER TABLE '.HISTORY_SUMMARY_TABLE.'
+DROP PRIMARY KEY,
+DROP COLUMN id,
+ADD UNIQUE KEY history_summary_ymdh (`year`, `month`, `day`, `hour`)
+;';
+pwg_query($query);
+
+$query = 'ALTER TABLE '.HISTORY_TABLE.'
+DROP COLUMN year,
+DROP COLUMN month,
+DROP COLUMN day,
+DROP COLUMN hour
+;';
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/BSF/install/db/8-database.php b/BSF/install/db/8-database.php
new file mode 100644
index 000000000..5971ef8ea
--- /dev/null
+++ b/BSF/install/db/8-database.php
@@ -0,0 +1,83 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Move rate, rate_anonymous and gallery_url from config file to database';
+
+$params = array(
+ 'gallery_url' => array('http://demo.phpwebgallery.net','URL given in RSS feed'),
+ 'rate' => array('true','Rating pictures feature is enabled') ,
+ 'rate_anonymous' => array('true','Rating pictures feature is also enabled for visitors')
+ );
+
+
+
+// +-Get real values from config file--------------------------------------+
+
+$conf_save = $conf;
+unset($conf);
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+if ( isset($conf['gallery_url']) )
+{
+ $params['gallery_url'][0] = $conf['gallery_url'];
+}
+if ( isset($conf['rate']) and is_bool($conf['rate']) )
+{
+ $params['rate'][0] = $conf['rate'] ? 'true' : 'false';
+}
+if ( isset($conf['rate_anonymous']) and is_bool($conf['rate_anonymous']) )
+{
+ $params['rate_anonymous'][0] = $conf['rate_anonymous'] ? 'true' : 'false';
+}
+$conf = $conf_save;
+
+
+
+// +-Do I already have them in DB ?----------------------------------------+
+$query = 'SELECT param FROM '.PREFIX_TABLE.'config';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ unset( $params[ $row['param'] ] );
+}
+
+// +-Perform the insert query----------------------------------------------+
+foreach ($params as $param_key => $param_values)
+{
+ $query = '
+INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' .
+"'$param_key','$param_values[0]','$param_values[1]');";
+ pwg_query($query);
+}
+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'config upgraded'
+."\n"
+;
+?>
diff --git a/BSF/install/db/9-database.php b/BSF/install/db/9-database.php
new file mode 100644
index 000000000..2a8c0034a
--- /dev/null
+++ b/BSF/install/db/9-database.php
@@ -0,0 +1,86 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description =
+ 'Column #image_category.is_storage replaces #images.storage_category_id';
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+ALTER TABLE ".PREFIX_TABLE."image_category
+ ADD COLUMN is_storage ENUM('true','false') DEFAULT 'false'
+;";
+pwg_query($query);
+
+$query = '
+SELECT id, storage_category_id
+ FROM '.PREFIX_TABLE.'images
+;';
+$result = pwg_query($query);
+
+$datas = array();
+
+while ($row = mysql_fetch_array($result))
+{
+ array_push(
+ $datas,
+ array(
+ 'image_id' => $row['id'],
+ 'category_id' => $row['storage_category_id'],
+ 'is_storage' => 'true',
+ )
+ );
+}
+
+mass_updates(
+ PREFIX_TABLE.'image_category',
+ array(
+ 'primary' => array('image_id', 'category_id'),
+ 'update' => array('is_storage')
+ ),
+ $datas
+ );
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'images
+ DROP COLUMN storage_category_id
+;';
+pwg_query($query);
+
+// +-----------------------------------------------------------------------+
+// | End notification |
+// +-----------------------------------------------------------------------+
+
+echo
+"\n"
+.'Column '.PREFIX_TABLE.'image_category.is_storage created and filled'
+."\n"
+;
+?>
diff --git a/BSF/install/db/index.php b/BSF/install/db/index.php
new file mode 100644
index 000000000..c15b15795
--- /dev/null
+++ b/BSF/install/db/index.php
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/BSF/install/index.php b/BSF/install/index.php
new file mode 100644
index 000000000..c15b15795
--- /dev/null
+++ b/BSF/install/index.php
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/BSF/install/piwigo_structure.sql b/BSF/install/piwigo_structure.sql
new file mode 100644
index 000000000..aa290149f
--- /dev/null
+++ b/BSF/install/piwigo_structure.sql
@@ -0,0 +1,457 @@
+-- MySQL dump 9.11
+--
+-- Host: localhost Database: pwg-bsf
+-- ------------------------------------------------------
+-- Server version 4.0.24_Debian-10-log
+
+--
+-- Table structure for table `piwigo_caddie`
+--
+
+DROP TABLE IF EXISTS `piwigo_caddie`;
+CREATE TABLE `piwigo_caddie` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `element_id` mediumint(8) NOT NULL default '0',
+ PRIMARY KEY (`user_id`,`element_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_categories`
+--
+
+DROP TABLE IF EXISTS `piwigo_categories`;
+CREATE TABLE `piwigo_categories` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(255) NOT NULL default '',
+ `id_uppercat` smallint(5) unsigned default NULL,
+ `comment` text,
+ `dir` varchar(255) default NULL,
+ `rank` smallint(5) unsigned default NULL,
+ `status` enum('public','private') NOT NULL default 'public',
+ `site_id` tinyint(4) unsigned default '1',
+ `visible` enum('true','false') NOT NULL default 'true',
+ `uploadable` enum('true','false') NOT NULL default 'false',
+ `representative_picture_id` mediumint(8) unsigned default NULL,
+ `uppercats` varchar(255) NOT NULL default '',
+ `commentable` enum('true','false') NOT NULL default 'true',
+ `global_rank` varchar(255) default NULL,
+ `image_order` varchar(128) default NULL,
+ `permalink` varchar(64) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `categories_i3` (`permalink`),
+ KEY `categories_i2` (`id_uppercat`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_comments`
+--
+
+DROP TABLE IF EXISTS `piwigo_comments`;
+CREATE TABLE `piwigo_comments` (
+ `id` int(11) unsigned NOT NULL auto_increment,
+ `image_id` mediumint(8) unsigned NOT NULL default '0',
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `author` varchar(255) default NULL,
+ `content` longtext,
+ `validated` enum('true','false') NOT NULL default 'false',
+ `validation_date` datetime default NULL,
+ PRIMARY KEY (`id`),
+ KEY `comments_i2` (`validation_date`),
+ KEY `comments_i1` (`image_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_config`
+--
+
+DROP TABLE IF EXISTS `piwigo_config`;
+CREATE TABLE `piwigo_config` (
+ `param` varchar(40) NOT NULL default '',
+ `value` text,
+ `comment` varchar(255) default NULL,
+ PRIMARY KEY (`param`)
+) TYPE=MyISAM COMMENT='configuration table';
+
+--
+-- Table structure for table `piwigo_favorites`
+--
+
+DROP TABLE IF EXISTS `piwigo_favorites`;
+CREATE TABLE `piwigo_favorites` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `image_id` mediumint(8) unsigned NOT NULL default '0',
+ PRIMARY KEY (`user_id`,`image_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_group_access`
+--
+
+DROP TABLE IF EXISTS `piwigo_group_access`;
+CREATE TABLE `piwigo_group_access` (
+ `group_id` smallint(5) unsigned NOT NULL default '0',
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`group_id`,`cat_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_groups`
+--
+
+DROP TABLE IF EXISTS `piwigo_groups`;
+CREATE TABLE `piwigo_groups` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(255) NOT NULL default '',
+ `is_default` enum('true','false') NOT NULL default 'false',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `groups_ui1` (`name`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_history`
+--
+
+DROP TABLE IF EXISTS `piwigo_history`;
+CREATE TABLE `piwigo_history` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `date` date NOT NULL default '0000-00-00',
+ `time` time NOT NULL default '00:00:00',
+ `user_id` smallint(5) NOT NULL default '0',
+ `IP` varchar(15) NOT NULL default '',
+ `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
+ `category_id` smallint(5) default NULL,
+ `tag_ids` varchar(50) default NULL,
+ `image_id` mediumint(8) default NULL,
+ `summarized` enum('true','false') default 'false',
+ `image_type` enum('picture','high','other') default NULL,
+ PRIMARY KEY (`id`),
+ KEY `history_i1` (`summarized`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_history_summary`
+--
+
+DROP TABLE IF EXISTS `piwigo_history_summary`;
+CREATE TABLE `piwigo_history_summary` (
+ `year` smallint(4) NOT NULL default '0',
+ `month` tinyint(2) default NULL,
+ `day` tinyint(2) default NULL,
+ `hour` tinyint(2) default NULL,
+ `nb_pages` int(11) default NULL,
+ UNIQUE KEY history_summary_ymdh (`year`,`month`,`day`,`hour`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_image_category`
+--
+
+DROP TABLE IF EXISTS `piwigo_image_category`;
+CREATE TABLE `piwigo_image_category` (
+ `image_id` mediumint(8) unsigned NOT NULL default '0',
+ `category_id` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`image_id`,`category_id`),
+ KEY `image_category_i1` (`category_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_image_tag`
+--
+
+DROP TABLE IF EXISTS `piwigo_image_tag`;
+CREATE TABLE `piwigo_image_tag` (
+ `image_id` mediumint(8) unsigned NOT NULL default '0',
+ `tag_id` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`image_id`,`tag_id`),
+ KEY `image_tag_i1` (`tag_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_images`
+--
+
+DROP TABLE IF EXISTS `piwigo_images`;
+CREATE TABLE `piwigo_images` (
+ `id` mediumint(8) unsigned NOT NULL auto_increment,
+ `file` varchar(255) NOT NULL default '',
+ `date_available` datetime NOT NULL default '0000-00-00 00:00:00',
+ `date_creation` date default NULL,
+ `tn_ext` varchar(4) default '',
+ `name` varchar(255) default NULL,
+ `comment` text,
+ `author` varchar(255) default NULL,
+ `hit` int(10) unsigned NOT NULL default '0',
+ `filesize` mediumint(9) unsigned default NULL,
+ `width` smallint(9) unsigned default NULL,
+ `height` smallint(9) unsigned default NULL,
+ `representative_ext` varchar(4) default NULL,
+ `date_metadata_update` date default NULL,
+ `average_rate` float(5,2) unsigned default NULL,
+ `has_high` enum('true') default NULL,
+ `path` varchar(255) NOT NULL default '',
+ `storage_category_id` smallint(5) unsigned default NULL,
+ `high_filesize` mediumint(9) unsigned default NULL,
+ `level` tinyint unsigned NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `images_i2` (`date_available`),
+ KEY `images_i3` (`average_rate`),
+ KEY `images_i4` (`hit`),
+ KEY `images_i5` (`date_creation`),
+ KEY `images_i1` (`storage_category_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_old_permalinks`
+--
+
+DROP TABLE IF EXISTS `piwigo_old_permalinks`;
+CREATE TABLE `piwigo_old_permalinks` (
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ `permalink` varchar(64) NOT NULL default '',
+ `date_deleted` datetime NOT NULL default '0000-00-00 00:00:00',
+ `last_hit` datetime default NULL,
+ `hit` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`permalink`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_plugins`
+--
+
+DROP TABLE IF EXISTS `piwigo_plugins`;
+CREATE TABLE `piwigo_plugins` (
+ `id` varchar(64) binary NOT NULL default '',
+ `state` enum('inactive','active') NOT NULL default 'inactive',
+ `version` varchar(64) NOT NULL default '0',
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_rate`
+--
+
+DROP TABLE IF EXISTS `piwigo_rate`;
+CREATE TABLE `piwigo_rate` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `element_id` mediumint(8) unsigned NOT NULL default '0',
+ `anonymous_id` varchar(45) NOT NULL default '',
+ `rate` tinyint(2) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ PRIMARY KEY (`element_id`,`user_id`,`anonymous_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_search`
+--
+
+DROP TABLE IF EXISTS `piwigo_search`;
+CREATE TABLE `piwigo_search` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `last_seen` date default NULL,
+ `rules` text,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_sessions`
+--
+
+DROP TABLE IF EXISTS `piwigo_sessions`;
+CREATE TABLE `piwigo_sessions` (
+ `id` varchar(255) binary NOT NULL default '',
+ `data` mediumtext NOT NULL,
+ `expiration` datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_sites`
+--
+
+DROP TABLE IF EXISTS `piwigo_sites`;
+CREATE TABLE `piwigo_sites` (
+ `id` tinyint(4) NOT NULL auto_increment,
+ `galleries_url` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `sites_ui1` (`galleries_url`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_tags`
+--
+
+DROP TABLE IF EXISTS `piwigo_tags`;
+CREATE TABLE `piwigo_tags` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(255) binary NOT NULL default '',
+ `url_name` varchar(255) binary NOT NULL default '',
+ PRIMARY KEY (`id`),
+ KEY `tags_i1` (`url_name`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_upgrade`
+--
+
+DROP TABLE IF EXISTS `piwigo_upgrade`;
+CREATE TABLE `piwigo_upgrade` (
+ `id` varchar(20) NOT NULL default '',
+ `applied` datetime NOT NULL default '0000-00-00 00:00:00',
+ `description` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_access`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_access`;
+CREATE TABLE `piwigo_user_access` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`user_id`,`cat_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_cache`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_cache`;
+CREATE TABLE `piwigo_user_cache` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `need_update` enum('true','false') NOT NULL default 'true',
+ `forbidden_categories` mediumtext,
+ `nb_total_images` mediumint(8) unsigned default NULL,
+ `image_access_type` enum('NOT IN','IN') NOT NULL default 'NOT IN',
+ `image_access_list` mediumtext default NULL,
+ PRIMARY KEY (`user_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_cache_categories`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_cache_categories`;
+CREATE TABLE `piwigo_user_cache_categories` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ `date_last` datetime default NULL,
+ `max_date_last` datetime default NULL,
+ `nb_images` mediumint(8) unsigned NOT NULL default '0',
+ `count_images` mediumint(8) unsigned default '0',
+ `count_categories` mediumint(8) unsigned default '0',
+ PRIMARY KEY (`user_id`,`cat_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_feed`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_feed`;
+CREATE TABLE `piwigo_user_feed` (
+ `id` varchar(50) binary NOT NULL default '',
+ `user_id` smallint(5) NOT NULL default '0',
+ `last_check` datetime default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_group`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_group`;
+CREATE TABLE `piwigo_user_group` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `group_id` smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (`group_id`,`user_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_infos`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_infos`;
+CREATE TABLE `piwigo_user_infos` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `nb_image_line` tinyint(1) unsigned NOT NULL default '5',
+ `nb_line_page` tinyint(3) unsigned NOT NULL default '3',
+ `status` enum('webmaster','admin','normal','generic','guest') NOT NULL default 'guest',
+ `adviser` enum('true','false') NOT NULL default 'false',
+ `language` varchar(50) NOT NULL default 'en_UK',
+ `maxwidth` smallint(6) default NULL,
+ `maxheight` smallint(6) default NULL,
+ `expand` enum('true','false') NOT NULL default 'false',
+ `show_nb_comments` enum('true','false') NOT NULL default 'false',
+ `show_nb_hits` enum('true','false') NOT NULL default 'false',
+ `recent_period` tinyint(3) unsigned NOT NULL default '7',
+ `template` varchar(255) NOT NULL default 'yoga/clear',
+ `registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `enabled_high` enum('true','false') NOT NULL default 'true',
+ `level` tinyint unsigned NOT NULL default '0',
+ UNIQUE KEY `user_infos_ui1` (`user_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_user_mail_notification`
+--
+
+DROP TABLE IF EXISTS `piwigo_user_mail_notification`;
+CREATE TABLE `piwigo_user_mail_notification` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `check_key` varchar(16) binary NOT NULL default '',
+ `enabled` enum('true','false') NOT NULL default 'false',
+ `last_send` datetime default NULL,
+ PRIMARY KEY (`user_id`),
+ UNIQUE KEY `user_mail_notification_ui1` (`check_key`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_users`
+--
+
+DROP TABLE IF EXISTS `piwigo_users`;
+CREATE TABLE `piwigo_users` (
+ `id` smallint(5) NOT NULL auto_increment,
+ `username` varchar(100) binary NOT NULL default '',
+ `password` varchar(32) default NULL,
+ `mail_address` varchar(255) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `users_ui1` (`username`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_waiting`
+--
+
+DROP TABLE IF EXISTS `piwigo_waiting`;
+CREATE TABLE `piwigo_waiting` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `storage_category_id` smallint(5) unsigned NOT NULL default '0',
+ `file` varchar(255) NOT NULL default '',
+ `username` varchar(255) NOT NULL default '',
+ `mail_address` varchar(255) NOT NULL default '',
+ `date` int(10) unsigned NOT NULL default '0',
+ `tn_ext` char(3) default NULL,
+ `validated` enum('true','false') NOT NULL default 'false',
+ `infos` text,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `piwigo_ws_access`
+--
+
+DROP TABLE IF EXISTS `piwigo_ws_access`;
+CREATE TABLE `piwigo_ws_access` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(32) NOT NULL default '',
+ `access` varchar(255) default NULL,
+ `start` datetime default NULL,
+ `end` datetime default NULL,
+ `request` varchar(255) default NULL,
+ `limit` smallint(5) unsigned default NULL,
+ `comment` varchar(255) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ws_access_ui1` (`name`)
+) TYPE=MyISAM COMMENT='Access for Web Services';
+
diff --git a/BSF/install/upgrade_1.3.0.php b/BSF/install/upgrade_1.3.0.php
new file mode 100644
index 000000000..ef2d1f8f7
--- /dev/null
+++ b/BSF/install/upgrade_1.3.0.php
@@ -0,0 +1,126 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+
+/**
+ * Upgrade from 1.3.0 to 1.3.1
+ */
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+$queries = array(
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD COLUMN uppercats varchar(255) NOT NULL default ''
+;",
+
+ "
+CREATE TABLE phpwebgallery_user_category (
+ user_id smallint(5) unsigned NOT NULL default '0'
+)
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD INDEX id (id)
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD INDEX id_uppercat (id_uppercat)
+;",
+
+ "
+ALTER TABLE phpwebgallery_image_category
+ ADD INDEX category_id (category_id)
+;",
+
+ "
+ALTER TABLE phpwebgallery_image_category
+ ADD INDEX image_id (image_id)
+;",
+ );
+
+foreach ($queries as $query)
+{
+ $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query);
+ pwg_query($query);
+}
+// filling the new column categories.uppercats
+$id_uppercats = array();
+
+$query = '
+SELECT id, id_uppercat
+ FROM '.CATEGORIES_TABLE.'
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '')
+ {
+ $row['id_uppercat'] = 'NULL';
+ }
+ $id_uppercats[$row['id']] = $row['id_uppercat'];
+}
+
+$datas = array();
+
+foreach (array_keys($id_uppercats) as $id)
+{
+ $data = array();
+ $data['id'] = $id;
+ $uppercats = array();
+
+ array_push($uppercats, $id);
+ while (isset($id_uppercats[$id]) and $id_uppercats[$id] != 'NULL')
+ {
+ array_push($uppercats, $id_uppercats[$id]);
+ $id = $id_uppercats[$id];
+ }
+ $data['uppercats'] = implode(',', array_reverse($uppercats));
+
+ array_push($datas, $data);
+}
+
+mass_updates(
+ CATEGORIES_TABLE,
+ array(
+ 'primary' => array('id'),
+ 'update' => array('uppercats')
+ ),
+ $datas
+ );
+
+// now we upgrade from 1.3.1 to 1.6.0
+include_once(PHPWG_ROOT_PATH.'install/upgrade_1.3.1.php');
+?> \ No newline at end of file
diff --git a/BSF/install/upgrade_1.3.1.php b/BSF/install/upgrade_1.3.1.php
new file mode 100644
index 000000000..0ce03ece6
--- /dev/null
+++ b/BSF/install/upgrade_1.3.1.php
@@ -0,0 +1,601 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+/**
+ * Upgrade from 1.3.x (x >= 1) to 1.4.0
+ */
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+// save data before deletion
+$query = '
+SELECT prefix_thumbnail, mail_webmaster
+ FROM '.PREFIX_TABLE.'config
+;';
+$save = mysql_fetch_array(mysql_query($query));
+
+$queries = array(
+ "
+DROP TABLE phpwebgallery_config
+;",
+
+ "
+CREATE TABLE phpwebgallery_config (
+ param varchar(40) NOT NULL default '',
+ value varchar(255) default NULL,
+ comment varchar(255) default NULL,
+ PRIMARY KEY (param)
+) TYPE=MyISAM COMMENT='configuration table'
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1'
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD COLUMN commentable enum('true','false') NOT NULL default 'true'
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD COLUMN global_rank varchar(255) default NULL
+;",
+
+ "
+ALTER TABLE phpwebgallery_categories
+ ADD INDEX categories_i2 (id_uppercat)
+;",
+
+ "
+ALTER TABLE phpwebgallery_comments
+ ADD COLUMN date_temp int(11) unsigned
+;",
+
+ "
+UPDATE phpwebgallery_comments
+ SET date_temp = date
+;",
+
+ "
+ALTER TABLE phpwebgallery_comments
+ CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00'
+;",
+
+ "
+UPDATE phpwebgallery_comments
+ SET date = FROM_UNIXTIME(date_temp)
+;",
+
+ "
+ALTER TABLE phpwebgallery_comments
+ DROP COLUMN date_temp
+;",
+
+ "
+ALTER TABLE phpwebgallery_favorites
+ DROP INDEX user_id
+;",
+
+ "
+ALTER TABLE phpwebgallery_favorites
+ ADD PRIMARY KEY (user_id,image_id)
+;",
+
+ "
+ALTER TABLE phpwebgallery_history
+ ADD COLUMN date_temp int(11) unsigned
+;",
+
+ "
+UPDATE phpwebgallery_history
+ SET date_temp = date
+;",
+
+ "
+ALTER TABLE phpwebgallery_history
+ CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00'
+;",
+
+ "
+UPDATE phpwebgallery_history
+ SET date = FROM_UNIXTIME(date_temp)
+;",
+
+ "
+ALTER TABLE phpwebgallery_history
+ DROP COLUMN date_temp
+;",
+
+ "
+ALTER TABLE phpwebgallery_history
+ ADD INDEX history_i1 (date)
+;",
+
+ "
+ALTER TABLE phpwebgallery_image_category
+ ADD INDEX image_category_i1 (image_id),
+ ADD INDEX image_category_i2 (category_id)
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ CHANGE COLUMN tn_ext tn_ext varchar(4) default ''
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD COLUMN path varchar(255) NOT NULL default ''
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD COLUMN date_metadata_update date default NULL
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD COLUMN average_rate float(5,2) unsigned default NULL
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD COLUMN representative_ext varchar(4) default NULL
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ DROP INDEX storage_category_id
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD INDEX images_i1 (storage_category_id)
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD INDEX images_i2 (date_available)
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD INDEX images_i3 (average_rate)
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD INDEX images_i4 (hit)
+;",
+
+ "
+ALTER TABLE phpwebgallery_images
+ ADD INDEX images_i5 (date_creation)
+;",
+
+ "
+ALTER TABLE phpwebgallery_sessions
+ DROP COLUMN ip
+;",
+
+ "
+ALTER TABLE phpwebgallery_sessions
+ ADD COLUMN expiration_temp int(11) unsigned
+;",
+
+ "
+UPDATE phpwebgallery_sessions
+ SET expiration_temp = expiration
+;",
+
+ "
+ALTER TABLE phpwebgallery_sessions
+ CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00'
+;",
+
+ "
+UPDATE phpwebgallery_sessions
+ SET expiration = FROM_UNIXTIME(expiration_temp)
+;",
+
+ "
+ALTER TABLE phpwebgallery_sessions
+ DROP COLUMN expiration_temp
+;",
+
+ "
+ALTER TABLE phpwebgallery_sites
+ DROP INDEX galleries_url
+;",
+
+ "
+ALTER TABLE phpwebgallery_sites
+ ADD UNIQUE sites_ui1 (galleries_url)
+;",
+
+ "
+DROP TABLE phpwebgallery_user_category
+;",
+
+ "
+ALTER TABLE phpwebgallery_users
+ DROP COLUMN long_period
+;",
+
+ "
+ALTER TABLE phpwebgallery_users
+ DROP COLUMN short_period
+;",
+
+ "
+ALTER TABLE phpwebgallery_users
+ ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7'
+;",
+
+ "
+ALTER TABLE phpwebgallery_users
+ DROP INDEX username
+;",
+
+ "
+ALTER TABLE phpwebgallery_users
+ ADD UNIQUE users_ui1 (username)
+;",
+
+ "
+CREATE TABLE phpwebgallery_rate (
+ user_id smallint(5) unsigned NOT NULL default '0',
+ element_id mediumint(8) unsigned NOT NULL default '0',
+ rate tinyint(2) unsigned NOT NULL default '0',
+ PRIMARY KEY (user_id,element_id)
+) TYPE=MyISAM
+;",
+
+ "
+CREATE TABLE phpwebgallery_user_forbidden (
+ user_id smallint(5) unsigned NOT NULL default '0',
+ need_update enum('true','false') NOT NULL default 'true',
+ forbidden_categories text,
+ PRIMARY KEY (user_id)
+) TYPE=MyISAM
+;",
+
+ "
+UPDATE phpwebgallery_users
+ SET language = 'en_UK.iso-8859-1'
+ , template = 'default'
+;",
+
+ "
+DELETE FROM phpwebgallery_user_access
+;",
+
+ "
+DELETE FROM phpwebgallery_group_access
+;"
+
+ );
+
+foreach ($queries as $query)
+{
+ $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query);
+ pwg_query($query);
+}
+
+//
+// check indexes
+//
+$indexes_of = array(
+ 'categories' => array(
+ 'categories_i2' => array(
+ 'columns' => array('id_uppercat'),
+ 'unique' => false,
+ )
+ ),
+ 'image_category' => array(
+ 'image_category_i1' => array(
+ 'columns' => array('image_id'),
+ 'unique' => false,
+ ),
+ 'image_category_i2' => array(
+ 'columns' => array('category_id'),
+ 'unique' => false,
+ ),
+ ),
+ );
+
+foreach (array_keys($indexes_of) as $table)
+{
+ $existing_indexes = array();
+
+ $query = '
+SHOW INDEX
+ FROM '.PREFIX_TABLE.$table.'
+;';
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ if ($row['Key_name'] != 'PRIMARY')
+ {
+ if (!in_array($row['Key_name'], array_keys($indexes_of[$table])))
+ {
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.$table.'
+ DROP INDEX '.$row['Key_name'].'
+;';
+ pwg_query($query);
+ }
+ else
+ {
+ array_push($existing_indexes, $row['Key_name']);
+ }
+ }
+ }
+
+ foreach ($indexes_of[$table] as $index_name => $index)
+ {
+ if (!in_array($index_name, $existing_indexes))
+ {
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.$table.'
+ ADD '.($index['unique'] ? 'UNIQUE' : 'INDEX').' '
+ .$index_name.' ('.implode(',', $index['columns']).')
+;';
+ pwg_query($query);
+ }
+ }
+}
+
+//
+// insert params in new configuration table
+//
+$params = array(
+ array(
+ 'param' => 'prefix_thumbnail',
+ 'value' => $save['prefix_thumbnail'],
+ 'comment' => 'thumbnails filename prefix'
+ ),
+ array(
+ 'param' => 'mail_webmaster',
+ 'value' => $save['mail_webmaster'],
+ 'comment' => 'webmaster mail'
+ ),
+ array(
+ 'param' => 'default_language',
+ 'value' => 'en_UK.iso-8859-1',
+ 'comment' => 'Default gallery language'
+ ),
+ array(
+ 'param' => 'default_template',
+ 'value' => 'default',
+ 'comment' => 'Default gallery style'
+ ),
+ array(
+ 'param' => 'default_maxwidth',
+ 'value' => '',
+ 'comment' => 'maximum width authorized for displaying images'
+ ),
+ array(
+ 'param' => 'default_maxheight',
+ 'value' => '',
+ 'comment' => 'maximum height authorized for the displaying images'
+ ),
+ array(
+ 'param' => 'nb_comment_page',
+ 'value' => '10',
+ 'comment' => 'number of comments to display on each page'
+ ),
+ array(
+ 'param' => 'upload_maxfilesize',
+ 'value' => '150',
+ 'comment' => 'maximum filesize for the uploaded pictures'
+ ),
+ array(
+ 'param' => 'upload_maxwidth',
+ 'value' => '800',
+ 'comment' => 'maximum width authorized for the uploaded images'
+ ),
+ array(
+ 'param' => 'upload_maxheight',
+ 'value' => '600',
+ 'comment' => 'maximum height authorized for the uploaded images'
+ ),
+ array(
+ 'param' => 'upload_maxwidth_thumbnail',
+ 'value' => '150',
+ 'comment' => 'maximum width authorized for the uploaded thumbnails'
+ ),
+ array(
+ 'param' => 'upload_maxheight_thumbnail',
+ 'value' => '100',
+ 'comment' => 'maximum height authorized for the uploaded thumbnails'
+ ),
+ array(
+ 'param' => 'log',
+ 'value' => 'false',
+ 'comment' => 'keep an history of visits on your website'
+ ),
+ array(
+ 'param' => 'comments_validation',
+ 'value' => 'false',
+ 'comment' => 'administrators validate users comments before becoming visible'
+ ),
+ array(
+ 'param' => 'comments_forall',
+ 'value' => 'false',
+ 'comment' => 'even guest not registered can post comments'
+ ),
+ array(
+ 'param' => 'mail_notification',
+ 'value' => 'false',
+ 'comment' => 'automated mail notification for adminsitrators'
+ ),
+ array(
+ 'param' => 'nb_image_line',
+ 'value' => '5',
+ 'comment' => 'Number of images displayed per row'
+ ),
+ array(
+ 'param' => 'nb_line_page',
+ 'value' => '3',
+ 'comment' => 'Number of rows displayed per page'
+ ),
+ array(
+ 'param' => 'recent_period',
+ 'value' => '7',
+ 'comment' => 'Period within which pictures are displayed as new (in days)'
+ ),
+ array(
+ 'param' => 'auto_expand',
+ 'value' => 'false',
+ 'comment' => 'Auto expand of the category tree'
+ ),
+ array(
+ 'param' => 'show_nb_comments',
+ 'value' => 'false',
+ 'comment' => 'Show the number of comments under the thumbnails'
+ ),
+ array(
+ 'param' => 'use_iptc',
+ 'value' => 'false',
+ 'comment' => 'Use IPTC data during database synchronization with files metadata'
+ ),
+ array(
+ 'param' => 'use_exif',
+ 'value' => 'false',
+ 'comment' => 'Use EXIF data during database synchronization with files metadata'
+ ),
+ array(
+ 'param' => 'show_iptc',
+ 'value' => 'false',
+ 'comment' => 'Show IPTC metadata on picture.php if asked by user'
+ ),
+ array(
+ 'param' => 'show_exif',
+ 'value' => 'true',
+ 'comment' => 'Show EXIF metadata on picture.php if asked by user'
+ ),
+ array(
+ 'param' => 'authorize_remembering',
+ 'value' => 'true',
+ 'comment' => 'Authorize users to be remembered, see $conf{remember_me_length}'
+ ),
+ array(
+ 'param' => 'gallery_locked',
+ 'value' => 'false',
+ 'comment' => 'Lock your gallery temporary for non admin users'
+ ),
+ );
+
+mass_inserts(
+ CONFIG_TABLE,
+ array_keys($params[0]),
+ $params
+ );
+
+// refresh calculated datas
+update_global_rank();
+update_category();
+
+// update calculated field "images.path"
+$cat_ids = array();
+
+$query = '
+SELECT DISTINCT(storage_category_id) AS unique_storage_category_id
+ FROM '.IMAGES_TABLE.'
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ array_push($cat_ids, $row['unique_storage_category_id']);
+}
+$fulldirs = get_fulldirs($cat_ids);
+
+foreach ($cat_ids as $cat_id)
+{
+ $query = '
+UPDATE '.IMAGES_TABLE.'
+ SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file)
+ WHERE storage_category_id = '.$cat_id.'
+;';
+ pwg_query($query);
+}
+
+// all sub-categories of private categories become private
+$cat_ids = array();
+
+$query = '
+SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ WHERE status = \'private\'
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ array_push($cat_ids, $row['id']);
+}
+
+if (count($cat_ids) > 0)
+{
+ $privates = get_subcat_ids($cat_ids);
+
+ $query = '
+UPDATE '.CATEGORIES_TABLE.'
+ SET status = \'private\'
+ WHERE id IN ('.implode(',', $privates).')
+;';
+ pwg_query($query);
+}
+
+$page['infos'] = array_merge(
+ $page['infos'],
+ array(
+ 'all sub-categories of private categories become private',
+
+ 'user permissions and group permissions have been erased',
+
+ 'only thumbnails prefix and webmaster mail address have been saved from
+previous configuration',
+
+ 'in include/mysql.inc.php, before
+<pre style="background-color:lightgray">?&gt;</pre>
+insert
+<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>'
+ )
+ );
+
+
+// now we upgrade from 1.4.0
+include_once(PHPWG_ROOT_PATH.'install/upgrade_1.4.0.php');
+?> \ No newline at end of file
diff --git a/BSF/install/upgrade_1.4.0.php b/BSF/install/upgrade_1.4.0.php
new file mode 100644
index 000000000..f49e2f9f2
--- /dev/null
+++ b/BSF/install/upgrade_1.4.0.php
@@ -0,0 +1,292 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+$last_time = get_moment();
+
+// will the user have to edit include/config_local.inc.php for
+// prefix_thumbnail configuration parameter
+$query = '
+SELECT value
+ FROM '.CONFIG_TABLE.'
+ WHERE param = \'prefix_thumbnail\'
+;';
+list($prefix_thumbnail) = mysql_fetch_array(pwg_query($query));
+
+// delete obsolete configuration
+$query = '
+DELETE
+ FROM '.PREFIX_TABLE.'config
+ WHERE param IN (
+ \'prefix_thumbnail\',
+ \'mail_webmaster\',
+ \'upload_maxfilesize\',
+ \'upload_maxwidth\',
+ \'upload_maxheight\',
+ \'upload_maxwidth_thumbnail\',
+ \'upload_maxheight_thumbnail\',
+ \'mail_notification\',
+ \'use_iptc\',
+ \'use_exif\',
+ \'show_iptc\',
+ \'show_exif\',
+ \'authorize_remembering\'
+ )
+;';
+mysql_query($query);
+
+$queries = array(
+
+ "
+ALTER TABLE piwigo_categories
+ CHANGE COLUMN date_last date_last datetime default NULL
+;",
+
+ "
+ALTER TABLE piwigo_comments
+ ADD COLUMN validation_date datetime default NULL
+;",
+
+ "
+UPDATE piwigo_comments
+ SET validation_date = date
+",
+
+ "
+ALTER TABLE piwigo_comments
+ ADD INDEX comments_i1 (image_id)
+;",
+
+ "
+ALTER TABLE piwigo_comments
+ ADD INDEX comments_i2 (validation_date)
+;",
+
+ "
+ALTER TABLE piwigo_favorites
+ CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0'
+;",
+
+ "
+ALTER TABLE piwigo_images
+ CHANGE COLUMN date_available
+ date_available datetime NOT NULL default '0000-00-00 00:00:00'
+;",
+
+ "
+ALTER TABLE piwigo_rate
+ CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0'
+;",
+
+ "
+ALTER TABLE piwigo_sessions
+ CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0'
+;",
+
+ "
+ALTER TABLE piwigo_user_access
+ CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0'
+;",
+
+ "
+DROP TABLE piwigo_user_forbidden
+;",
+
+ "
+ALTER TABLE piwigo_user_group
+ CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0'
+;",
+
+ "
+ALTER TABLE piwigo_users
+ CHANGE COLUMN id id smallint(5) NOT NULL auto_increment
+;",
+
+ "
+CREATE TABLE piwigo_caddie (
+ user_id smallint(5) NOT NULL default '0',
+ element_id mediumint(8) NOT NULL default '0',
+ PRIMARY KEY (user_id,element_id)
+) TYPE=MyISAM
+;",
+
+ "
+CREATE TABLE piwigo_user_cache (
+ user_id smallint(5) NOT NULL default '0',
+ need_update enum('true','false') NOT NULL default 'true',
+ forbidden_categories text,
+ PRIMARY KEY (user_id)
+) TYPE=MyISAM
+;",
+
+ "
+CREATE TABLE piwigo_user_feed (
+ id varchar(50) binary NOT NULL default '',
+ user_id smallint(5) NOT NULL default '0',
+ last_check datetime default NULL,
+ PRIMARY KEY (id)
+) TYPE=MyISAM
+;",
+
+ "
+CREATE TABLE piwigo_user_infos (
+ user_id smallint(5) NOT NULL default '0',
+ nb_image_line tinyint(1) unsigned NOT NULL default '5',
+ nb_line_page tinyint(3) unsigned NOT NULL default '3',
+ status enum('admin','guest') NOT NULL default 'guest',
+ language varchar(50) NOT NULL default 'english',
+ maxwidth smallint(6) default NULL,
+ maxheight smallint(6) default NULL,
+ expand enum('true','false') NOT NULL default 'false',
+ show_nb_comments enum('true','false') NOT NULL default 'false',
+ recent_period tinyint(3) unsigned NOT NULL default '7',
+ template varchar(255) NOT NULL default 'yoga',
+ registration_date datetime NOT NULL default '0000-00-00 00:00:00',
+ UNIQUE KEY user_infos_ui1 (user_id)
+) TYPE=MyISAM
+;"
+ );
+
+foreach ($queries as $query)
+{
+ $query = str_replace('piwigo_', PREFIX_TABLE, $query);
+ pwg_query($query);
+}
+
+// user datas migration from piwigo_users to piwigo_user_infos
+$query = '
+SELECT *
+ FROM '.USERS_TABLE.'
+;';
+
+$datas = array();
+list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
+
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ $row['user_id'] = $row['id'];
+ $row['registration_date'] = $dbnow;
+ array_push($datas, $row);
+}
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+mass_inserts(
+ USER_INFOS_TABLE,
+ array(
+ 'user_id',
+ 'nb_image_line',
+ 'nb_line_page',
+ 'status',
+ 'language',
+ 'maxwidth',
+ 'maxheight',
+ 'expand',
+ 'show_nb_comments',
+ 'recent_period',
+ 'template',
+ 'registration_date'
+ ),
+ $datas
+ );
+
+$queries = array(
+
+ "
+UPDATE ".USER_INFOS_TABLE."
+ SET template = 'yoga'
+;",
+
+ "
+UPDATE ".USER_INFOS_TABLE."
+ SET language = 'en_UK.iso-8859-1'
+ WHERE language NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1')
+;",
+
+ "
+UPDATE ".CONFIG_TABLE."
+ SET value = 'en_UK.iso-8859-1'
+ WHERE param = 'default_language'
+ AND value NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1')
+;",
+
+ "
+UPDATE ".CONFIG_TABLE."
+ SET value = 'yoga'
+ WHERE param = 'default_template'
+;",
+
+ "
+INSERT INTO ".CONFIG_TABLE."
+ (param,value,comment)
+ VALUES
+ (
+ 'gallery_title',
+ 'Piwigo demonstration site',
+ 'Title at top of each page and for RSS feed'
+ )
+;",
+
+ "
+INSERT INTO ".CONFIG_TABLE."
+ (param,value,comment)
+ VALUES
+ (
+ 'gallery_description',
+ 'My photos web site',
+ 'Short description displayed with gallery title'
+ )
+;"
+
+ );
+
+foreach ($queries as $query)
+{
+ $query = str_replace('piwigo_', PREFIX_TABLE, $query);
+ pwg_query($query);
+}
+
+if ($prefix_thumbnail != 'TN-')
+{
+ array_push(
+ $page['infos'],
+ 'the thumbnail prefix configuration parameter was moved to configuration
+file, copy config_local.inc.php from "tools" directory to "include" directory
+and edit $conf[\'prefix_thumbnail\'] = '.$prefix_thumbnail
+ );
+}
+
+// now we upgrade from 1.5.0 to 1.6.0
+include_once(PHPWG_ROOT_PATH.'install/upgrade_1.5.0.php');
+?> \ No newline at end of file
diff --git a/BSF/install/upgrade_1.5.0.php b/BSF/install/upgrade_1.5.0.php
new file mode 100644
index 000000000..1d9627c58
--- /dev/null
+++ b/BSF/install/upgrade_1.5.0.php
@@ -0,0 +1,469 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+/**
+ * replace old style #images.keywords by #tags. Requires a big data
+ * migration.
+ *
+ * @return void
+ */
+function tag_replace_keywords()
+{
+ // code taken from upgrades 19 and 22
+
+ $query = '
+CREATE TABLE '.PREFIX_TABLE.'tags (
+ id smallint(5) UNSIGNED NOT NULL auto_increment,
+ name varchar(255) BINARY NOT NULL,
+ url_name varchar(255) BINARY NOT NULL,
+ PRIMARY KEY (id)
+)
+;';
+ pwg_query($query);
+
+ $query = '
+CREATE TABLE '.PREFIX_TABLE.'image_tag (
+ image_id mediumint(8) UNSIGNED NOT NULL,
+ tag_id smallint(5) UNSIGNED NOT NULL,
+ PRIMARY KEY (image_id,tag_id)
+)
+;';
+ pwg_query($query);
+
+ //
+ // Move keywords to tags
+ //
+
+ // each tag label is associated to a numeric identifier
+ $tag_id = array();
+ // to each tag id (key) a list of image ids (value) is associated
+ $tag_images = array();
+
+ $current_id = 1;
+
+ $query = '
+SELECT id, keywords
+ FROM '.PREFIX_TABLE.'images
+ WHERE keywords IS NOT NULL
+;';
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ foreach(preg_split('/[,]+/', $row['keywords']) as $keyword)
+ {
+ if (!isset($tag_id[$keyword]))
+ {
+ $tag_id[$keyword] = $current_id++;
+ }
+
+ if (!isset($tag_images[ $tag_id[$keyword] ]))
+ {
+ $tag_images[ $tag_id[$keyword] ] = array();
+ }
+
+ array_push(
+ $tag_images[ $tag_id[$keyword] ],
+ $row['id']
+ );
+ }
+ }
+
+ $datas = array();
+ foreach ($tag_id as $tag_name => $tag_id)
+ {
+ array_push(
+ $datas,
+ array(
+ 'id' => $tag_id,
+ 'name' => $tag_name,
+ 'url_name' => str2url($tag_name),
+ )
+ );
+ }
+
+ if (!empty($datas))
+ {
+ mass_inserts(
+ PREFIX_TABLE.'tags',
+ array_keys($datas[0]),
+ $datas
+ );
+ }
+
+ $datas = array();
+ foreach ($tag_images as $tag_id => $images)
+ {
+ foreach (array_unique($images) as $image_id)
+ {
+ array_push(
+ $datas,
+ array(
+ 'tag_id' => $tag_id,
+ 'image_id' => $image_id,
+ )
+ );
+ }
+ }
+
+ if (!empty($datas))
+ {
+ mass_inserts(
+ PREFIX_TABLE.'image_tag',
+ array_keys($datas[0]),
+ $datas
+ );
+ }
+
+ //
+ // Delete images.keywords
+ //
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.'images DROP COLUMN keywords
+;';
+ pwg_query($query);
+
+ //
+ // Add useful indexes
+ //
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.'tags
+ ADD INDEX tags_i1(url_name)
+;';
+ pwg_query($query);
+
+
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.'image_tag
+ ADD INDEX image_tag_i1(tag_id)
+;';
+ pwg_query($query);
+
+ // print_time('tags have replaced keywords');
+}
+
+tag_replace_keywords();
+
+$queries = array(
+ "
+CREATE TABLE ".PREFIX_TABLE."search (
+ id int UNSIGNED NOT NULL AUTO_INCREMENT,
+ last_seen date DEFAULT NULL,
+ rules text,
+ PRIMARY KEY (id)
+);",
+
+ "
+CREATE TABLE ".PREFIX_TABLE."user_mail_notification (
+ user_id smallint(5) NOT NULL default '0',
+ check_key varchar(16) binary NOT NULL default '',
+ enabled enum('true','false') NOT NULL default 'false',
+ last_send datetime default NULL,
+ PRIMARY KEY (user_id),
+ UNIQUE KEY uidx_check_key (check_key)
+);",
+
+ "
+CREATE TABLE ".PREFIX_TABLE."upgrade (
+ id varchar(20) NOT NULL default '',
+ applied datetime NOT NULL default '0000-00-00 00:00:00',
+ description varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+);",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."config
+ MODIFY COLUMN value TEXT
+;",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."images
+ ADD COLUMN has_high enum('true') default NULL
+;",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."rate
+ ADD COLUMN anonymous_id varchar(45) NOT NULL default ''
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."rate
+ ADD COLUMN date date NOT NULL default '0000-00-00'
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."rate
+ DROP PRIMARY KEY
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."rate
+ ADD PRIMARY KEY (element_id,user_id,anonymous_id)
+;",
+ "
+UPDATE ".PREFIX_TABLE."rate
+ SET date = CURDATE()
+;",
+
+ "
+DELETE
+ FROM ".PREFIX_TABLE."sessions
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."sessions
+ DROP COLUMN user_id
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."sessions
+ ADD COLUMN data text NOT NULL
+;",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."user_cache
+ ADD COLUMN nb_total_images mediumint(8) unsigned default NULL
+;",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."user_infos
+ CHANGE COLUMN status
+ status enum('webmaster','admin','normal','generic','guest')
+ NOT NULL default 'guest'
+;",
+ "
+UPDATE ".PREFIX_TABLE."user_infos
+ SET status = 'normal'
+ WHERE status = 'guest'
+;",
+ "
+UPDATE ".PREFIX_TABLE."user_infos
+ SET status = 'guest'
+ WHERE user_id = ".$conf['guest_id']."
+;",
+ "
+UPDATE ".PREFIX_TABLE."user_infos
+ SET status = 'webmaster'
+ WHERE user_id = ".$conf['webmaster_id']."
+;",
+
+ "
+ALTER TABLE ".PREFIX_TABLE."user_infos
+ CHANGE COLUMN template template varchar(255) NOT NULL default 'yoga/clear'
+;",
+
+ "
+UPDATE ".PREFIX_TABLE."user_infos
+ SET template = 'yoga/dark'
+ WHERE template = 'yoga-dark'
+;",
+ "
+UPDATE ".PREFIX_TABLE."user_infos
+ SET template = 'yoga/clear'
+ WHERE template != 'yoga/dark'
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."user_infos
+ ADD COLUMN adviser enum('true','false') NOT NULL default 'false'
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."user_infos
+ ADD COLUMN enabled_high enum('true','false') NOT NULL default 'true'
+;",
+ "
+ALTER TABLE ".PREFIX_TABLE."categories
+ CHANGE COLUMN rank rank SMALLINT(5) UNSIGNED DEFAULT NULL
+;",
+ // configuration table
+ "
+UPDATE ".PREFIX_TABLE."config
+ SET value = 'yoga/clear'
+ WHERE param = 'default_template'
+;"
+ );
+
+foreach ($queries as $query)
+{
+ pwg_query($query);
+}
+
+//
+// Move rate, rate_anonymous and gallery_url from config file to database
+//
+$params = array(
+ 'gallery_url' => array(
+ 'http://demo.phpwebgallery.net',
+ 'URL given in RSS feed'
+ ),
+ 'rate' => array(
+ 'true',
+ 'Rating pictures feature is enabled'
+ ),
+ 'rate_anonymous' => array(
+ 'true',
+ 'Rating pictures feature is also enabled for visitors'
+ )
+ );
+// Get real values from config file
+$conf_save = $conf;
+unset($conf);
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+if ( isset($conf['gallery_url']) )
+{
+ $params['gallery_url'][0] = $conf['gallery_url'];
+}
+if ( isset($conf['rate']) and is_bool($conf['rate']) )
+{
+ $params['rate'][0] = $conf['rate'] ? 'true' : 'false';
+}
+if ( isset($conf['rate_anonymous']) and is_bool($conf['rate_anonymous']) )
+{
+ $params['rate_anonymous'][0] = $conf['rate_anonymous'] ? 'true' : 'false';
+}
+$conf = $conf_save;
+
+// Do I already have them in DB ?
+$query = 'SELECT param FROM '.PREFIX_TABLE.'config';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ unset( $params[ $row['param'] ] );
+}
+
+// Perform the insert query
+foreach ($params as $param_key => $param_values)
+{
+ $query = '
+INSERT INTO '.PREFIX_TABLE.'config
+ (param,value,comment)
+ VALUES
+ ('."'$param_key','$param_values[0]','$param_values[1]')
+;";
+ pwg_query($query);
+}
+
+$query = "
+ALTER TABLE ".PREFIX_TABLE."config MODIFY COLUMN `value` TEXT;";
+pwg_query($query);
+
+
+//
+// replace gallery_description by page_banner
+//
+$query = '
+SELECT value
+ FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_title\'
+;';
+list($t) = array_from_query($query, 'value');
+
+$query = '
+SELECT value
+ FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_description\'
+;';
+list($d) = array_from_query($query, 'value');
+
+$page_banner='<h1>'.$t.'</h1><p>'.$d.'</p>';
+$page_banner=addslashes($page_banner);
+$query = '
+INSERT INTO '.PREFIX_TABLE.'config
+ (param,value,comment)
+ VALUES
+ (
+ \'page_banner\',
+ \''.$page_banner.'\',
+ \'html displayed on the top each page of your gallery\'
+ )
+;';
+pwg_query($query);
+
+$query = '
+DELETE FROM '.PREFIX_TABLE.'config
+ WHERE param=\'gallery_description\'
+;';
+pwg_query($query);
+
+//
+// configuration for notification by mail
+//
+$query = "
+INSERT INTO ".CONFIG_TABLE."
+ (param,value,comment)
+ VALUES
+ (
+ 'nbm_send_mail_as',
+ '',
+ 'Send mail as param value for notification by mail'
+ ),
+ (
+ 'nbm_send_detailed_content',
+ 'true',
+ 'Send detailed content for notification by mail'
+ ),
+ (
+ 'nbm_complementary_mail_content',
+ '',
+ 'Complementary mail content for notification by mail'
+ )
+;";
+pwg_query($query);
+
+// depending on the way the 1.5.0 was installed (from scratch or by upgrade)
+// the database structure has small differences that should be corrected.
+
+$query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ CHANGE COLUMN password password varchar(32) default NULL
+;';
+pwg_query($query);
+
+$to_keep = array('id', 'username', 'password', 'mail_address');
+
+$query = '
+DESC '.PREFIX_TABLE.'users
+;';
+
+$result = pwg_query($query);
+
+while ($row = mysql_fetch_array($result))
+{
+ if (!in_array($row['Field'], $to_keep))
+ {
+ $query = '
+ALTER TABLE '.PREFIX_TABLE.'users
+ DROP COLUMN '.$row['Field'].'
+;';
+ pwg_query($query);
+ }
+}
+
+// now we upgrade from 1.6.0 to 1.6.2
+include_once(PHPWG_ROOT_PATH.'install/upgrade_1.6.0.php');
+?>
diff --git a/BSF/install/upgrade_1.6.0.php b/BSF/install/upgrade_1.6.0.php
new file mode 100644
index 000000000..76a5bc453
--- /dev/null
+++ b/BSF/install/upgrade_1.6.0.php
@@ -0,0 +1,54 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+$queries = array(
+ "
+ALTER TABLE ".PREFIX_TABLE."user_infos
+ ADD auto_login_key varchar(64) NOT NULL
+;",
+ '
+ALTER TABLE '.PREFIX_TABLE.'users
+ CHANGE username username VARCHAR(100) binary NOT NULL
+;',
+ );
+
+foreach ($queries as $query)
+{
+ pwg_query($query);
+}
+
+// now we upgrade from 1.6.2
+include_once(PHPWG_ROOT_PATH.'install/upgrade_1.6.2.php');
+?>
diff --git a/BSF/install/upgrade_1.6.2.php b/BSF/install/upgrade_1.6.2.php
new file mode 100644
index 000000000..af5789b1c
--- /dev/null
+++ b/BSF/install/upgrade_1.6.2.php
@@ -0,0 +1,346 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ('This page cannot be loaded directly, load upgrade.php');
+}
+else
+{
+ if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
+ {
+ die ('Hacking attempt!');
+ }
+}
+
+$queries = array(
+"
+ALTER TABLE `".PREFIX_TABLE."categories`
+ ADD COLUMN `permalink` varchar(64) default NULL
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."categories`
+ ADD COLUMN `image_order` varchar(128) default NULL
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."categories`
+ ADD UNIQUE `categories_i3` (`permalink`)
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."groups`
+ ADD COLUMN `is_default` enum('true','false') NOT NULL default 'false'
+;",
+
+"
+RENAME TABLE `".PREFIX_TABLE."history` TO `".PREFIX_TABLE."history_backup`
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."history` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `date` date NOT NULL default '0000-00-00',
+ `time` time NOT NULL default '00:00:00',
+ `year` smallint(4) NOT NULL default '0',
+ `month` tinyint(2) NOT NULL default '0',
+ `day` tinyint(2) NOT NULL default '0',
+ `hour` tinyint(2) NOT NULL default '0',
+ `user_id` smallint(5) NOT NULL default '0',
+ `IP` varchar(15) NOT NULL default '',
+ `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
+ `category_id` smallint(5) default NULL,
+ `tag_ids` varchar(50) default NULL,
+ `image_id` mediumint(8) default NULL,
+ `summarized` enum('true','false') default 'false',
+ `image_type` enum('picture','high','other') default NULL,
+ PRIMARY KEY (`id`),
+ KEY `history_i1` (`summarized`)
+) TYPE=MyISAM
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."image_category`
+ DROP INDEX `image_category_i1`
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."image_category`
+ ADD INDEX `image_category_i1` (`category_id`)
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."image_category`
+ DROP INDEX `image_category_i2`
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."images`
+ ADD COLUMN `high_filesize` mediumint(9) unsigned default NULL
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."user_infos`
+ CHANGE COLUMN `language`
+ `language` varchar(50) NOT NULL default 'en_UK.iso-8859-1'
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."user_infos`
+ DROP COLUMN `auto_login_key`
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."user_infos`
+ ADD COLUMN `show_nb_hits` enum('true','false') NOT NULL default 'false'
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."user_mail_notification`
+ DROP INDEX `uidx_check_key`
+;",
+
+"
+ALTER TABLE `".PREFIX_TABLE."user_mail_notification`
+ ADD UNIQUE `user_mail_notification_ui1` (`check_key`)
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."history_summary` (
+ `id` varchar(13) NOT NULL default '',
+ `year` smallint(4) NOT NULL default '0',
+ `month` tinyint(2) default NULL,
+ `day` tinyint(2) default NULL,
+ `hour` tinyint(2) default NULL,
+ `nb_pages` int(11) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."old_permalinks` (
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ `permalink` varchar(64) NOT NULL default '',
+ `date_deleted` datetime NOT NULL default '0000-00-00 00:00:00',
+ `last_hit` datetime default NULL,
+ `hit` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`permalink`)
+) TYPE=MyISAM
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."plugins` (
+ `id` varchar(64) binary NOT NULL default '',
+ `state` enum('inactive','active') NOT NULL default 'inactive',
+ `version` varchar(64) NOT NULL default '0',
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."user_cache_categories` (
+ `user_id` smallint(5) NOT NULL default '0',
+ `cat_id` smallint(5) unsigned NOT NULL default '0',
+ `max_date_last` datetime default NULL,
+ `count_images` mediumint(8) unsigned default '0',
+ `count_categories` mediumint(8) unsigned default '0',
+ PRIMARY KEY (`user_id`,`cat_id`)
+) TYPE=MyISAM
+;",
+
+"
+CREATE TABLE `".PREFIX_TABLE."ws_access` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(32) NOT NULL default '',
+ `access` varchar(255) default NULL,
+ `start` datetime default NULL,
+ `end` datetime default NULL,
+ `request` varchar(255) default NULL,
+ `limit` smallint(5) unsigned default NULL,
+ `comment` varchar(255) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ws_access_ui1` (`name`)
+) TYPE=MyISAM COMMENT='Access for Web Services'
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('show_nb_hits', 'false', 'Show hits count under thumbnails')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('history_admin','false','keep a history of administrator visits on your website')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('history_guest','true','keep a history of guest visits on your website')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('allow_user_registration','true','allow visitors to register?')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('secret_key', MD5(RAND()), 'a secret key specific to the gallery for internal use')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('nbm_send_html_mail','true','Send mail on HTML format for notification by mail')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('nbm_send_recent_post_dates','true','Send recent post by dates for notification by mail')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('email_admin_on_new_user','false','Send an email to theadministrators when a user registers')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('email_admin_on_comment','false','Send an email to the administrators when a valid comment is entered')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation')
+;",
+
+"
+INSERT INTO ".PREFIX_TABLE."config
+ (param,value,comment)
+ VALUES
+ ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded')
+;",
+
+"
+UPDATE ".PREFIX_TABLE."user_cache
+ SET need_update = 'true'
+;",
+
+);
+
+foreach ($queries as $query)
+{
+ pwg_query($query);
+}
+
+$replacements = array(
+ array('&#039;', '\''),
+ array('&quot;', '"'),
+ array('&lt;', '<'),
+ array('&gt;', '>'),
+ array('&amp;', '&') // <- this must be the last one
+ );
+
+foreach ($replacements as $replacement)
+{
+ $query = '
+UPDATE '.PREFIX_TABLE.'comments
+ SET content = REPLACE(content, "'.
+ addslashes($replacement[0]).
+ '", "'.
+ addslashes($replacement[1]).
+ '")
+;';
+ pwg_query($query);
+}
+
+load_conf_from_db();
+
+$query = "
+UPDATE ".USER_INFOS_TABLE."
+SET
+ template = '".$conf['default_template']."',
+ nb_image_line = ".$conf['nb_image_line'].",
+ nb_line_page = ".$conf['nb_line_page'].",
+ language = '".$conf['default_language']."',
+ maxwidth = ".
+ (empty($conf['default_maxwidth']) ? "NULL" : $conf['default_maxwidth']).
+ ",
+ maxheight = ".
+ (empty($conf['default_maxheight']) ? "NULL" : $conf['default_maxheight']).
+ ",
+ recent_period = ".$conf['recent_period'].",
+ expand = '".boolean_to_string($conf['auto_expand'])."',
+ show_nb_comments = '".boolean_to_string($conf['show_nb_comments'])."',
+ show_nb_hits = '".boolean_to_string($conf['show_nb_hits'])."',
+ enabled_high = '".boolean_to_string(
+ (isset($conf['newuser_default_enabled_high']) ?
+ $conf['newuser_default_enabled_high'] : true)
+ ).
+ "'
+WHERE
+ user_id = ".$conf['default_user_id'].";";
+pwg_query($query);
+
+$query = "
+DELETE FROM ".CONFIG_TABLE."
+WHERE
+ param IN
+(
+ 'default_template',
+ 'nb_image_line',
+ 'nb_line_page',
+ 'default_language',
+ 'default_maxwidth',
+ 'default_maxheight',
+ 'recent_period',
+ 'auto_expand',
+ 'show_nb_comments',
+ 'show_nb_hits'
+)
+;";
+pwg_query($query);
+
+// now we upgrade from 1.7.0
+// include_once(PHPWG_ROOT_PATH.'install/upgrade_1.7.0.php');
+?>