Index: trunk/web/install/dist/sql/tables.sql
===================================================================
--- trunk/web/install/dist/sql/tables.sql	(revision 10)
+++ trunk/web/install/dist/sql/tables.sql	(revision 1)
@@ -1,3 +1,3 @@
-CREATE TABLE `[prefix]albums` (
+CREATE TABLE IF NOT EXISTS `[prefix]albums` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id_artiste` int(11) NOT NULL,
@@ -16,5 +16,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]artistes` (
+CREATE TABLE IF NOT EXISTS `[prefix]artistes` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(255) DEFAULT NULL,
@@ -40,5 +40,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]artistes_admins` (
+CREATE TABLE IF NOT EXISTS `[prefix]artistes_admins` (
   `id_artiste` int(11) NOT NULL,
   `pun_user` int(11) NOT NULL,
@@ -46,5 +46,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]boxes` (
+CREATE TABLE IF NOT EXISTS `[prefix]boxes` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(64) DEFAULT NULL,
@@ -63,5 +63,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=162 ;
 # --
-CREATE TABLE `[prefix]categories` (
+CREATE TABLE IF NOT EXISTS `[prefix]categories` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(64) DEFAULT NULL,
@@ -74,5 +74,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=103 ;
 # --
-CREATE TABLE `[prefix]categories_tree` (
+CREATE TABLE IF NOT EXISTS `[prefix]categories_tree` (
   `parent` int(11) NOT NULL,
   `child` int(11) NOT NULL,
@@ -80,5 +80,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]concerts` (
+CREATE TABLE IF NOT EXISTS `[prefix]concerts` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id_artiste` int(11) DEFAULT NULL,
@@ -94,5 +94,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]configuration` (
+CREATE TABLE IF NOT EXISTS `[prefix]configuration` (
   `key` varchar(255) NOT NULL,
   `value` text NOT NULL,
@@ -100,5 +100,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]contenus` (
+CREATE TABLE IF NOT EXISTS `[prefix]contenus` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(64) DEFAULT NULL,
@@ -117,5 +117,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=935 ;
 # --
-CREATE TABLE `[prefix]downloads` (
+CREATE TABLE IF NOT EXISTS `[prefix]downloads` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id_artiste` int(11) DEFAULT NULL,
@@ -131,5 +131,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]download_urls` (
+CREATE TABLE IF NOT EXISTS `[prefix]download_urls` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id_download` int(11) DEFAULT NULL,
@@ -143,5 +143,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]formats` (
+CREATE TABLE IF NOT EXISTS `[prefix]formats` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(32) DEFAULT NULL,
@@ -150,5 +150,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
 # --
-CREATE TABLE `[prefix]licences` (
+CREATE TABLE IF NOT EXISTS `[prefix]licences` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `nom` varchar(255) NOT NULL DEFAULT '',
@@ -158,5 +158,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;
 # --
-CREATE TABLE `[prefix]playlists` (
+CREATE TABLE IF NOT EXISTS `[prefix]playlists` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `pun_user` int(11) NOT NULL,
@@ -167,5 +167,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]playlist_download` (
+CREATE TABLE IF NOT EXISTS `[prefix]playlist_download` (
   `id` int(11) NOT NULL,
   `id_download` int(11) NOT NULL,
@@ -173,17 +173,15 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]pun_bans` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_bans` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `username` varchar(200) DEFAULT NULL,
   `ip` varchar(255) DEFAULT NULL,
-  `email` varchar(80) DEFAULT NULL,
+  `email` varchar(50) DEFAULT NULL,
   `message` varchar(255) DEFAULT NULL,
   `expire` int(10) unsigned DEFAULT NULL,
-  `ban_creator` int(10) unsigned NOT NULL DEFAULT '0',
-  PRIMARY KEY (`id`),
-  KEY `[prefix]pun_bans_username_idx` (`username`(25))
+  PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
 # --
-CREATE TABLE `[prefix]pun_categories` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_categories` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `cat_name` varchar(80) NOT NULL DEFAULT 'New Category',
@@ -192,5 +190,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ;
 # --
-CREATE TABLE `[prefix]pun_censoring` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_censoring` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `search_for` varchar(60) NOT NULL DEFAULT '',
@@ -199,5 +197,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]pun_config` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_config` (
   `conf_name` varchar(255) NOT NULL DEFAULT '',
   `conf_value` text,
@@ -205,5 +203,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]pun_forums` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_forums` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `forum_name` varchar(80) NOT NULL DEFAULT 'New forum',
@@ -222,5 +220,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=103 ;
 # --
-CREATE TABLE `[prefix]pun_forum_perms` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_forum_perms` (
   `group_id` int(10) NOT NULL DEFAULT '0',
   `forum_id` int(10) NOT NULL DEFAULT '0',
@@ -231,23 +229,12 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]pun_forum_subscriptions` (
-  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
-  `forum_id` int(10) unsigned NOT NULL DEFAULT '0',
-  PRIMARY KEY (`user_id`,`forum_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-# --
-CREATE TABLE `[prefix]pun_groups` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_groups` (
   `g_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `g_title` varchar(50) NOT NULL DEFAULT '',
   `g_user_title` varchar(50) DEFAULT NULL,
-  `g_moderator` tinyint(1) NOT NULL DEFAULT '0',
-  `g_mod_edit_users` tinyint(1) NOT NULL DEFAULT '0',
-  `g_mod_rename_users` tinyint(1) NOT NULL DEFAULT '0',
-  `g_mod_change_passwords` tinyint(1) NOT NULL DEFAULT '0',
-  `g_mod_ban_users` tinyint(1) NOT NULL DEFAULT '0',
   `g_read_board` tinyint(1) NOT NULL DEFAULT '1',
-  `g_view_users` tinyint(1) NOT NULL DEFAULT '1',
   `g_post_replies` tinyint(1) NOT NULL DEFAULT '1',
   `g_post_topics` tinyint(1) NOT NULL DEFAULT '1',
+  `g_post_polls` tinyint(1) NOT NULL DEFAULT '1',
   `g_edit_posts` tinyint(1) NOT NULL DEFAULT '1',
   `g_delete_posts` tinyint(1) NOT NULL DEFAULT '1',
@@ -256,32 +243,25 @@
   `g_search` tinyint(1) NOT NULL DEFAULT '1',
   `g_search_users` tinyint(1) NOT NULL DEFAULT '1',
-  `g_send_email` tinyint(1) NOT NULL DEFAULT '1',
+  `g_edit_subjects_interval` smallint(6) NOT NULL DEFAULT '300',
   `g_post_flood` smallint(6) NOT NULL DEFAULT '30',
   `g_search_flood` smallint(6) NOT NULL DEFAULT '30',
-  `g_email_flood` smallint(6) NOT NULL DEFAULT '60',
-  `g_report_flood` smallint(6) NOT NULL DEFAULT '60',
   PRIMARY KEY (`g_id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
 # --
-CREATE TABLE `[prefix]pun_online` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_online` (
   `user_id` int(10) unsigned NOT NULL DEFAULT '1',
   `ident` varchar(200) NOT NULL DEFAULT '',
   `logged` int(10) unsigned NOT NULL DEFAULT '0',
   `idle` tinyint(1) NOT NULL DEFAULT '0',
-  `last_post` int(10) unsigned DEFAULT NULL,
-  `last_search` int(10) unsigned DEFAULT NULL,
-  UNIQUE KEY `[prefix]pun_online_user_id_ident_idx` (`user_id`,`ident`(25)),
-  KEY `pun_online_user_id_idx` (`user_id`),
-  KEY `[prefix]pun_online_ident_idx` (`ident`(25)),
-  KEY `[prefix]pun_online_logged_idx` (`logged`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-# --
-CREATE TABLE `[prefix]pun_posts` (
+  KEY `pun_online_user_id_idx` (`user_id`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+# --
+CREATE TABLE IF NOT EXISTS `[prefix]pun_posts` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `poster` varchar(200) NOT NULL DEFAULT '',
   `poster_id` int(10) unsigned NOT NULL DEFAULT '1',
-  `poster_ip` varchar(39) DEFAULT NULL,
-  `poster_email` varchar(80) DEFAULT NULL,
-  `message` mediumtext,
+  `poster_ip` varchar(15) DEFAULT NULL,
+  `poster_email` varchar(50) DEFAULT NULL,
+  `message` text NOT NULL,
   `hide_smilies` tinyint(1) NOT NULL DEFAULT '0',
   `posted` int(10) unsigned NOT NULL DEFAULT '0',
@@ -294,5 +274,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=21233 ;
 # --
-CREATE TABLE `[prefix]pun_ranks` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_ranks` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `rank` varchar(50) NOT NULL DEFAULT '',
@@ -301,5 +281,5 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
 # --
-CREATE TABLE `[prefix]pun_reports` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_reports` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `post_id` int(10) unsigned NOT NULL DEFAULT '0',
@@ -315,13 +295,13 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
 # --
-CREATE TABLE `[prefix]pun_search_cache` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_search_cache` (
   `id` int(10) unsigned NOT NULL DEFAULT '0',
   `ident` varchar(200) NOT NULL DEFAULT '',
-  `search_data` mediumtext,
+  `search_data` text NOT NULL,
   PRIMARY KEY (`id`),
   KEY `pun_search_cache_ident_idx` (`ident`(8))
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]pun_search_matches` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_search_matches` (
   `post_id` int(10) unsigned NOT NULL DEFAULT '0',
   `word_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
@@ -331,5 +311,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]pun_search_words` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_search_words` (
   `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
   `word` varchar(20) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
@@ -338,5 +318,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]pun_smilies` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_smilies` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `image` varchar(60) NOT NULL DEFAULT '',
@@ -346,10 +326,15 @@
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=89 ;
 # --
-CREATE TABLE `[prefix]pun_topics` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_subscriptions` (
+  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
+  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`topic_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+# --
+CREATE TABLE IF NOT EXISTS `[prefix]pun_topics` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `poster` varchar(200) NOT NULL DEFAULT '',
   `subject` varchar(255) NOT NULL DEFAULT '',
   `posted` int(10) unsigned NOT NULL DEFAULT '0',
-  `first_post_id` int(10) unsigned NOT NULL DEFAULT '0',
   `last_post` int(10) unsigned NOT NULL DEFAULT '0',
   `last_post_id` int(10) unsigned NOT NULL DEFAULT '0',
@@ -363,36 +348,29 @@
   PRIMARY KEY (`id`),
   KEY `pun_topics_forum_id_idx` (`forum_id`),
-  KEY `pun_topics_moved_to_idx` (`moved_to`),
-  KEY `[prefix]pun_topics_last_post_idx` (`last_post`),
-  KEY `[prefix]pun_topics_first_post_id_idx` (`first_post_id`)
+  KEY `pun_topics_moved_to_idx` (`moved_to`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2441 ;
 # --
-CREATE TABLE `[prefix]pun_topic_subscriptions` (
-  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
-  `topic_id` int(10) unsigned NOT NULL DEFAULT '0',
-  PRIMARY KEY (`user_id`,`topic_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-# --
-CREATE TABLE `[prefix]pun_users` (
+CREATE TABLE IF NOT EXISTS `[prefix]pun_users` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `group_id` int(10) unsigned NOT NULL DEFAULT '4',
   `username` varchar(200) NOT NULL DEFAULT '',
   `password` varchar(40) NOT NULL DEFAULT '',
-  `email` varchar(80) NOT NULL DEFAULT '',
+  `email` varchar(50) NOT NULL DEFAULT '',
   `title` varchar(50) DEFAULT NULL,
   `realname` varchar(40) DEFAULT NULL,
   `url` varchar(100) DEFAULT NULL,
-  `jabber` varchar(80) DEFAULT NULL,
+  `jabber` varchar(75) DEFAULT NULL,
   `icq` varchar(12) DEFAULT NULL,
-  `msn` varchar(80) DEFAULT NULL,
+  `msn` varchar(50) DEFAULT NULL,
   `aim` varchar(30) DEFAULT NULL,
   `yahoo` varchar(30) DEFAULT NULL,
   `location` varchar(30) DEFAULT NULL,
+  `use_avatar` tinyint(1) NOT NULL DEFAULT '0',
   `signature` text,
   `disp_topics` tinyint(3) unsigned DEFAULT NULL,
   `disp_posts` tinyint(3) unsigned DEFAULT NULL,
   `email_setting` tinyint(1) NOT NULL DEFAULT '1',
+  `save_pass` tinyint(1) NOT NULL DEFAULT '1',
   `notify_with_post` tinyint(1) NOT NULL DEFAULT '0',
-  `auto_notify` tinyint(1) NOT NULL DEFAULT '0',
   `show_smilies` tinyint(1) NOT NULL DEFAULT '1',
   `show_img` tinyint(1) NOT NULL DEFAULT '1',
@@ -401,32 +379,25 @@
   `show_sig` tinyint(1) NOT NULL DEFAULT '1',
   `timezone` float NOT NULL DEFAULT '0',
-  `dst` tinyint(1) NOT NULL DEFAULT '0',
-  `date_format` tinyint(1) NOT NULL DEFAULT '0',
-  `time_format` tinyint(1) NOT NULL DEFAULT '0',
   `language` varchar(25) NOT NULL DEFAULT 'English',
   `style` varchar(25) NOT NULL DEFAULT 'Oxygen',
   `num_posts` int(10) unsigned NOT NULL DEFAULT '0',
   `last_post` int(10) unsigned DEFAULT NULL,
-  `last_search` int(10) unsigned DEFAULT NULL,
-  `last_email_sent` int(10) unsigned DEFAULT NULL,
-  `last_report_sent` int(10) unsigned DEFAULT NULL,
   `registered` int(10) unsigned NOT NULL DEFAULT '0',
-  `registration_ip` varchar(39) NOT NULL DEFAULT '0.0.0.0',
+  `registration_ip` varchar(15) NOT NULL DEFAULT '0.0.0.0',
   `last_visit` int(10) unsigned NOT NULL DEFAULT '0',
   `admin_note` varchar(30) DEFAULT NULL,
-  `activate_string` varchar(80) DEFAULT NULL,
+  `activate_string` varchar(50) DEFAULT NULL,
   `activate_key` varchar(8) DEFAULT NULL,
   PRIMARY KEY (`id`),
-  UNIQUE KEY `[prefix]_pun_users_username_idx` (`username`(25)),
   KEY `pun_users_registered_idx` (`registered`),
   KEY `pun_users_username_idx` (`username`(8))
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1559 ;
 # --
-CREATE TABLE `[prefix]super_admins` (
+CREATE TABLE IF NOT EXISTS `[prefix]super_admins` (
   `id_pun_user` int(11) NOT NULL,
   PRIMARY KEY (`id_pun_user`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 # --
-CREATE TABLE `[prefix]thumbs` (
+CREATE TABLE IF NOT EXISTS `[prefix]thumbs` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `src` varchar(255) NOT NULL DEFAULT '',
@@ -442,5 +413,5 @@
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 # --
-CREATE TABLE `[prefix]videos` (
+CREATE TABLE IF NOT EXISTS `[prefix]videos` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `id_artiste` int(11) DEFAULT NULL,
