Pagina 1 van 2

Heb gezocht maar niet gevonden DATABASE Troubles !

Geplaatst: 14 sep 2005, 20:49
door pinin39
heb een aantal mods geïnstalleerd waaronder de

Categories hierarchy - 2.1.0

om 1 of andere reden is er iets mis gegaan en moest dus een
backup terugzetten van mijn PHPBB directory !

dat heb ik gedaan maar omdat in de database nu dingen staan die
niet meer combineren met de PHPBB zoals gebruikt kan ik de mods
die ik had niet meer installeren , elke keer foutmeldingen en
er gebeurt niets !

weet iemand hoe je zo iets weer kunt oplossen ?

kan wel phpbb opnieuw installeren alleen zal het probleem blijven ben ik bang voor want de database zit vol met instellingen ...

kan wel een backup terugzetten van de database maar dan ben ik 3 dagen aan posts kwijt .

dank je voor jullie hulp ! :thumb:

Geplaatst: 15 sep 2005, 08:44
door Paul
Wat voor fouten krijg je?

Geplaatst: 16 sep 2005, 06:40
door pinin39
helaas is mijn server gecrasht dus moet nu weer opnieuw beginnen

heb wel de backup nog (phpbb backup gemaakt)
maar als ik die terugzet gebeurt er helemaal niets !

heeft iemand een oplossing ?

Re: Heb gezocht maar niet gevonden DATABASE Troubles !

Geplaatst: 16 sep 2005, 08:11
door mosymuis
pinin39 schreef:elke keer foutmeldingen
Waanzinnig nutteloze opmerking. Als we niet weten welke foutmeldingen, weten we niets.

pinin39 schreef:er gebeurt niets !
Er gebeurt altijd iets. Omschrijf dat.

pinin39 schreef:kan wel phpbb opnieuw installeren alleen zal het probleem blijven ben ik bang voor want de database zit vol met instellingen ...

kan wel een backup terugzetten van de database maar dan ben ik 3 dagen aan posts kwijt .
Is er geen database uninstall script bijgevoegd? Zo nee, geef ons dan de SQL instructies die je op je database hebt uitgevoerd. Je kunt alles terugdraaien.

Geplaatst: 16 sep 2005, 09:07
door pinin39
heb het hele forum overgezet op een andere server !
backup teruggezet met MySQL Admin !!!

en nu werkt het weer , de Chmod werkt niet goed
maar kun je zo iets ook uninstallen ????

ik gebruik easymod ?

Geplaatst: 16 sep 2005, 09:21
door mosymuis
pinin39 schreef:maar kun je zo iets ook uninstallen ????
Lees de laatste regel van mijn vorige post eens opnieuw? :roll:

pinin39 schreef:ik gebruik easymod ?
Ik heb geen idee of daar functionaliteit voor is bijgevoegd.

Geplaatst: 16 sep 2005, 09:27
door pinin39
heel dom van mij misschien maar heb alles via Easymod geïnstalleerd

wat nu eigenlijk nog het probleem is :

Heb allerlei leuke mods geïnstalleerd
en deze mods hebben dus ook de database aangepast !
alleen omdat de laatste mod (een mass email mod) de boel in het honderd liet lopen heb ik gewoon de map PhPbb vervangen door een versie van een paar dagen daarvoor !

geen nette oplossing denk ik maar wel doeltreffend .
wat er nu gebeurt is :

de database staat nog vol met instellingen van de mods alleen de mods zijn er dus niet meer ! (want die zijn na de backup er in gezet)
kortom installeer ik weer een mod die ik al heb gebruikt dan geeft ie allemaal foutmeldingen omdat hij natuurlijk leest in de database dat het modje er al is maar eigenlijk is dat niet meer zo.

hoe moet ik dat uitleggen ... lastig maar zeg maar :

Je gooit de map leeg van een programma op je pc
maar de-installeerd dat programma niet
je komt zo nooit meer van je registerinstellingen af .
zon soort probleem heb ik nu dus ook eigenlijk !

Re: Heb gezocht maar niet gevonden DATABASE Troubles !

Geplaatst: 16 sep 2005, 09:29
door mosymuis
Ik begreep je bij je eerste post ook al prima. Dus nogmaals;
mosymuis schreef:Is er geen database uninstall script bijgevoegd? Zo nee, geef ons dan de SQL instructies die je op je database hebt uitgevoerd. Je kunt alles terugdraaien.

Geplaatst: 16 sep 2005, 09:36
door pinin39
hoe heet zo'n bestandje dan ?
want dan zou ik het zelf kunnen

begrijp me goed .... heb er niet heel veel kennis van !
begin er langzaam wel kennis van te krijgen !

Geplaatst: 16 sep 2005, 09:39
door mosymuis
pinin39 schreef:hoe heet zo'n bestandje dan ?
want dan zou ik het zelf kunnen
Er zijn maar heel weinig mods die dit hebben, er is daarom ook geen vaste regel die bepaalt hoe ze dit bij zouden moeten voegen. Als het aanwezig is zal er een remove.txt, uninstall.php, undo.txt of soortgelijks aanwezig zijn in het archief.

pinin39 schreef:begrijp me goed .... heb er niet heel veel kennis van !
Dat geeft niets, maar het frustreert wel dat je mijn antwoorden niet goed doorleest voordat je reageert.

Geplaatst: 16 sep 2005, 09:40
door pinin39
nou waar ging het mis :

de mod : CH_210

## MOD Description:
## This mod will add sub-forums functionalities (and many more) to your phpBB board.
## Don't go blindly with easyMOD without having done what is quoted in Author's notes !
##
## MOD Version: 2.1.0
##
## Installation Level: Moderate
## Installation Time: 2 Hours
## Files To Edit:
## common.php
## faq.php
## groupcp.php
## login.php
## memberlist.php
## modcp.php
## posting.php
## privmsg.php
## profile.php
## search.php
## viewonline.php
## viewtopic.php
##
## admin/admin_board.php
## admin/admin_groups.php
## admin/admin_mass_email.php
## admin/admin_ranks.php
## admin/admin_smilies.php
## admin/admin_styles.php
## admin/admin_users.php
## admin/admin_words.php
## admin/index.php
## admin/page_footer_admin.php
## admin/page_header_admin.php
##
## includes/auth.php
## includes/bbcode.php
## includes/db.php
## includes/functions.php
## includes/functions_admin.php
## includes/functions_post.php
## includes/functions_search.php
## includes/page_header.php
## includes/page_tail.php
## includes/sessions.php
## includes/topic_review.php
## includes/usercp_register.php
##
## templates/subSilver/confirm_body.tpl
## templates/subSilver/faq_body.tpl
## templates/subSilver/groupcp_info_body.tpl
## templates/subSilver/groupcp_user_body.tpl
## templates/subSilver/login_body.tpl
## templates/subSilver/memberlist_body.tpl
## templates/subSilver/modcp_move.tpl
## templates/subSilver/modcp_split.tpl
## templates/subSilver/modcp_viewip.tpl
## templates/subSilver/overall_header.tpl
## templates/subSilver/posting_body.tpl
## templates/subSilver/posting_preview.tpl
## templates/subSilver/posting_topic_review.tpl
## templates/subSilver/privmsgs_body.tpl
## templates/subSilver/privmsgs_read_body.tpl
## templates/subSilver/profile_add_body.tpl
## templates/subSilver/profile_avatar_gallery.tpl
## templates/subSilver/profile_send_email.tpl
## templates/subSilver/profile_send_pass.tpl
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/search_body.tpl
## templates/subSilver/search_results_posts.tpl
## templates/subSilver/subSilver.cfg
## templates/subSilver/viewonline_body.tpl
##
## templates/subSilver/admin/group_edit_body.tpl
## templates/subSilver/admin/index_body.tpl
## templates/subSilver/admin/styles_edit_body.tpl
##
## Included Files:
## root/*.*
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## IMPORTANT, AND NOT OPTIONAL:
## ---------------------------
## Before willing to go any further, please make a save of your current phpBB directory, then
## do the following renames. It would be a bad idea to try to go quicker than the tempo !
##
## RENAME index.php INTO _sav_index.php
## RENAME viewforum.php INTO _sav_viewforum.php
##
## RENAME admin/admin_forum_prune.php INTO admin/_sav_admin_forum_prune.php
## RENAME admin/admin_forumauth.php INTO admin/_sav_admin_forumauth.php
## RENAME admin/admin_forums.php INTO admin/_sav_admin_forums.php
## RENAME admin/admin_ug_auth.php INTO admin/_sav_admin_ug_auth.php
##
## RENAME templates/subSilver/index_body.tpl INTO templates/subSilver/_sav_index_body.tpl
## RENAME templates/subSilver/modcp_body.tpl INTO templates/subSilver/_sav_modcp_body.tpl
## RENAME templates/subSilver/search_results_topics.tpl INTO templates/subSilver/_sav_search_results_topics.tpl
## RENAME templates/subSilver/viewforum_body.tpl INTO templates/subSilver/_sav_viewforum_body.tpl
## RENAME templates/subSilver/viewtopic_body.tpl INTO templates/subSilver/_sav_viewtopic_body.tpl
##
## RENAME templates/subSilver/admin/auth_forum_body.tpl INTO templates/subSilver/admin/_sav_auth_forum_body.tpl
## RENAME templates/subSilver/admin/auth_select_body.tpl INTO templates/subSilver/admin/_sav_auth_select_body.tpl
## RENAME templates/subSilver/admin/auth_ug_body.tpl INTO templates/subSilver/admin/_sav_auth_ug_body.tpl
## RENAME templates/subSilver/admin/category_edit_body.tpl INTO templates/subSilver/admin/_sav_category_edit_body.tpl
## RENAME templates/subSilver/admin/forum_admin_body.tpl INTO templates/subSilver/admin/_sav_forum_admin_body.tpl
## RENAME templates/subSilver/admin/forum_delete_body.tpl INTO templates/subSilver/admin/_sav_forum_delete_body.tpl
## RENAME templates/subSilver/admin/forum_edit_body.tpl INTO templates/subSilver/admin/_sav_forum_edit_body.tpl
## RENAME templates/subSilver/admin/forum_prune_body.tpl INTO templates/subSilver/admin/_sav_forum_prune_body.tpl
## RENAME templates/subSilver/admin/forum_prune_result_body.tpl INTO templates/subSilver/admin/_sav_forum_prune_result_body.tpl
## RENAME templates/subSilver/admin/forum_prune_select_body.tpl INTO templates/subSilver/admin/_sav_forum_prune_select_body.tpl
##
##
## Complementary notes :
## - This mod adds Markus Petrux's Fix message_die for multiple errors MOD (http://www.phpbb.com/phpBB/viewtopic.php?t=233542)
## - "Today/yesterday at" is based on Netclectic's one (http://www.phpbb.com/phpBB/viewtopic.php?t=158812)
## - Message Sub-title feature is based on Morpheus2matrix's "Topic description mod" (http://www.phpbb.com/phpBB/viewtopic.php?t=148241)
## and has been realised by Gilgraf (http://ggweb-fr.com/phpbbfre/)
## - Last post topic title on index is based on e-Sven idea
##
## Don't forget also to browse the goodies/ directory ! :)

Geplaatst: 16 sep 2005, 09:46
door mosymuis
Ik vroeg je al twee keer om de SQL instructies, en je geeft me zo ongeveer alles, behalve dat? :roll:

Geplaatst: 16 sep 2005, 10:32
door pinin39
mosymuis schreef:Ik vroeg je al twee keer om de SQL instructies, en je geeft me zo ongeveer alles, behalve dat? :roll:
wat zijn de sql instructies ?? waar vindt ik die ?

Geplaatst: 16 sep 2005, 10:38
door mosymuis
Kijk, nou komen we ergens. Als je al die tijd ergens niet op reageert omdat je neit weet wat het betekent schieten we natuurlijk niets op. De SQL instructies zijn de updates voor de database, deze vind je vrijwel altijd in het .txt install bestand van de mod onder -----[ SQL ]------------------------------------------

Geplaatst: 16 sep 2005, 10:51
door pinin39
dit is de gehele install.php

Code: Selecteer alles

<?php
/***************************************************************************
 *							install.php
 *							-----------
 *	begin		: 08/10/2004
 *	copyright	: Ptirhiik
 *	email		: ptirhiik@clanmckeen.com
 *
 *	Version		: 0.0.8 - 19/01/2005
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
define('IN_INSTALL', true);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
//--------------------------
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'common.'.$phpEx);
include($config->url('includes/class_forums'));
include($config->url('includes/class_cp'));

// try to modify the database
if ( defined('RUN_CH_INSTALL') )
{
	$sql_struct = array();
	switch( SQL_LAYER )
	{
		case 'mysql':
		case 'mysql4':
			$sql_struct = array(
// forums
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_type CHAR(1) BINARY NOT NULL DEFAULT \'f\' AFTER forum_status',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_main SMALLINT(5) UNSIGNED NOT NULL AFTER forum_status',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD auth_global_announce TINYINT( 2 ) NOT NULL AFTER auth_announce',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_title VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_poster MEDIUMINT( 8 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_username VARCHAR( 25 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_time INT( 11 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_hit_count TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_hit BIGINT(20) UNSIGNED NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_start INT(11) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_style TINYINT( 4 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_nav_icon VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_icon VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_ppage TINYINT( 2 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_sort VARCHAR( 25 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_order VARCHAR( 4 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_index_pack TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_index_split TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_board_box TINYINT( 1 ) NOT NULL',

// auths
'ALTER TABLE ' . AUTH_ACCESS_TABLE . ' ADD auth_global_announce TINYINT( 1 ) NOT NULL AFTER auth_announce',

// auths definitions
'CREATE TABLE ' . AUTHS_DEF_TABLE . ' (
  auth_id SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
  auth_type CHAR(1) BINARY NOT NULL DEFAULT \'\',
  auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  auth_desc VARCHAR(255) NOT NULL DEFAULT \'\',
  auth_title TINYINT(1) NOT NULL DEFAULT \'0\',
  auth_order MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (auth_id)
)',

// topics
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_sub_title VARCHAR( 255 ) DEFAULT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_first_username VARCHAR( 25 )',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_poster MEDIUMINT( 8 ) NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_username VARCHAR( 25 )',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_time INT( 11 ) NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_icon SMALLINT( 3 ) UNSIGNED NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_duration INT( 11 ) NOT NULL',

'ALTER TABLE ' . TOPICS_TABLE . ' CHANGE topic_title topic_title VARCHAR( 255 ) NOT NULL',

// posts
'ALTER TABLE ' . POSTS_TABLE . ' ADD post_icon SMALLINT( 3 ) UNSIGNED NOT NULL',

// posts text
'ALTER TABLE ' . POSTS_TEXT_TABLE . ' ADD post_sub_title VARCHAR( 255 ) DEFAULT NULL',
'ALTER TABLE ' . POSTS_TEXT_TABLE . ' CHANGE post_subject post_subject VARCHAR( 255 ) DEFAULT NULL',

// users
'ALTER TABLE ' . USERS_TABLE . ' ADD user_unread_date INT( 11 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_unread_topics TEXT',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_keep_unreads TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_topics_sort VARCHAR( 25 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_topics_order VARCHAR( 4 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_smart_date TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_board_box TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_index_pack TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_index_split TINYINT( 1 ) NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_session_logged TINYINT( 1 ) NOT NULL',

// groups
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_status TINYINT( 2 ) NOT NULL',
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_user_id MEDIUMINT( 8 ) DEFAULT 0 NOT NULL',
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_user_list TEXT NOT NULL',

// styles
'ALTER TABLE ' . THEMES_TABLE . ' ADD images_pack VARCHAR( 100 ) NOT NULL AFTER style_name',
'ALTER TABLE ' . THEMES_TABLE . ' ADD custom_tpls VARCHAR( 100 ) NOT NULL AFTER images_pack',

// user cache
'CREATE TABLE ' . USERS_CACHE_TABLE . ' (
  user_id MEDIUMINT(8) NOT NULL,
  cache_id VARCHAR(5) NOT NULL,
  cache_data TEXT,
  cache_time INT(11),
  PRIMARY KEY  ( user_id, cache_id )
)',

// presets names
'CREATE TABLE ' . PRESETS_TABLE . ' (
  preset_id MEDIUMINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
  preset_type VARCHAR(5) NOT NULL DEFAULT \'\',
  preset_name VARCHAR(50) NOT NULL DEFAULT \'\',
  PRIMARY KEY ( preset_id )
)',

// presets data
'CREATE TABLE ' . PRESETS_DATA_TABLE . ' (
  preset_id MEDIUMINT(5) UNSIGNED NOT NULL DEFAULT \'0\',
  preset_auth VARCHAR(50) NOT NULL DEFAULT \'\',
  preset_value TINYINT(1) DEFAULT NULL,
  PRIMARY KEY ( preset_id, preset_auth )
)',

// messages icons
'CREATE TABLE ' . ICONS_TABLE . ' (
  icon_id MEDIUMINT(3) NOT NULL AUTO_INCREMENT,
  icon_name VARCHAR(50) NOT NULL DEFAULT \'\',
  icon_url VARCHAR(255) NOT NULL DEFAULT \'\',
  icon_acl TINYINT(2) NOT NULL DEFAULT \'0\',
  icon_types VARCHAR(255) DEFAULT NULL,
  icon_order MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (icon_id)
)',

// control panels fields
'CREATE TABLE ' . CP_FIELDS_TABLE . ' (
  field_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  field_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  field_order MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  field_attr TEXT NOT NULL,
  PRIMARY KEY  (field_id),
  KEY panel_id (panel_id,field_name)
)',

// control panels defs
'CREATE TABLE ' . CP_PANELS_TABLE . ' (
  panel_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  panel_shortcut VARCHAR(30) NOT NULL DEFAULT \'\',
  panel_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_main MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  panel_order MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT \'0\',
  panel_file VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_auth_type CHAR(1) BINARY NOT NULL DEFAULT \'\',
  panel_auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_hidden TINYINT(1) NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (panel_id)
)',

// control panels patches
'CREATE TABLE ' . CP_PATCHES_TABLE . ' (
  patch_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  patch_file VARCHAR(255) NOT NULL DEFAULT \'\',
  patch_time int(11) NOT NULL DEFAULT \'0\',
  patch_version VARCHAR(25) NOT NULL DEFAULT \'\',
  patch_date VARCHAR(8) NOT NULL DEFAULT \'\',
  patch_ref VARCHAR(255) NOT NULL DEFAULT \'\',
  patch_author VARCHAR(255) NOT NULL DEFAULT \'\',
  PRIMARY KEY  (patch_id)
)',

// extended auths table
'CREATE TABLE ' . AUTHS_TABLE . ' (
  group_id MEDIUMINT(8) NOT NULL DEFAULT \'0\',
  obj_type CHAR(1) BINARY NOT NULL DEFAULT \'\',
  obj_id MEDIUMINT(8) NOT NULL DEFAULT \'0\',
  auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  auth_value TINYINT(1) NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (group_id,obj_type,obj_id,auth_name),
  KEY group_id (group_id,obj_type),
  KEY obj_type (obj_type,obj_id)
)',

// config
'ALTER TABLE ' . CONFIG_TABLE . ' ADD config_static SMALLINT(1) UNSIGNED NOT NULL DEFAULT 0',

// indexes addition
'ALTER TABLE ' . TOPICS_TABLE . ' ADD INDEX ( topic_last_time )',
'ALTER TABLE ' . POSTS_TABLE . ' ADD INDEX ( post_icon )',
'ALTER TABLE ' . GROUPS_TABLE . ' ADD INDEX ( group_user_id )',
'ALTER TABLE ' . CONFIG_TABLE . ' ADD INDEX ( config_static )',
			);
			break;

		case 'mssql':
		case 'mssql-odbc':
			$sql_struct = array(
// forums
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_type CHAR(1) NOT NULL DEFAULT \'f\'',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_main SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD auth_global_announce SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_title VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_poster BIGINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_username VARCHAR( 25 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_last_time INT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_hit_count SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_hit BIGINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_link_start INT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_style SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_nav_icon VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_icon VARCHAR( 255 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_ppage SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_sort VARCHAR( 25 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_topics_order VARCHAR( 4 )',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_index_pack SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_index_split SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . FORUMS_TABLE . ' ADD forum_board_box SMALLINT DEFAULT 0 NOT NULL',

// auths
'ALTER TABLE ' . AUTH_ACCESS_TABLE . ' ADD auth_global_announce SMALLINT DEFAULT 0 NOT NULL',

# auths definitions
'CREATE TABLE ' . AUTHS_DEF_TABLE . ' (
  auth_id SMALLINT NOT NULL IDENTITY (1,1),
  auth_type CHAR(1) NOT NULL DEFAULT \'\',
  auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  auth_desc VARCHAR(255) NOT NULL DEFAULT \'\',
  auth_title SMALLINT NOT NULL DEFAULT 0,
  auth_order BIGINT NOT NULL DEFAULT 0,
  PRIMARY KEY  (auth_id)
)',

# topics
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_sub_title VARCHAR( 255 ) DEFAULT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_first_username VARCHAR( 25 )',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_poster BIGINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_username VARCHAR( 25 )',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_last_time INT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_icon SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' ADD topic_duration INT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . TOPICS_TABLE . ' CHANGE topic_title topic_title VARCHAR( 255 ) DEFAULT \'\' NOT NULL',

# posts
'ALTER TABLE ' . POSTS_TABLE . ' ADD post_icon SMALLINT DEFAULT 0 NOT NULL',

# posts text
'ALTER TABLE ' . POSTS_TEXT_TABLE . ' ADD post_sub_title VARCHAR( 255 ) DEFAULT NULL',
'ALTER TABLE ' . POSTS_TEXT_TABLE . ' CHANGE post_subject post_subject VARCHAR( 255 ) DEFAULT NULL',

# users
'ALTER TABLE ' . USERS_TABLE . ' ADD user_unread_date INT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_unread_topics TEXT',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_keep_unreads SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_topics_sort VARCHAR( 25 ) DEFAULT \'\' NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_topics_order VARCHAR( 4 ) DEFAULT \'\' NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_smart_date SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_board_box SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_index_pack SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_index_split SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . USERS_TABLE . ' ADD user_session_logged SMALLINT DEFAULT 0 NOT NULL',

# groups
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_status SMALLINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_user_id BIGINT DEFAULT 0 NOT NULL',
'ALTER TABLE ' . GROUPS_TABLE . ' ADD group_user_list TEXT DEFAULT \'\' NOT NULL',

# styles
'ALTER TABLE ' . THEMES_TABLE . ' ADD images_pack VARCHAR( 100 ) DEFAULT \'\' NOT NULL',
'ALTER TABLE ' . THEMES_TABLE . ' ADD custom_tpls VARCHAR( 100 ) DEFAULT \'\' NOT NULL',

# user cache
'CREATE TABLE ' . USERS_CACHE_TABLE . ' (
  user_id BIGINT DEFAULT 0 NOT NULL,
  cache_id VARCHAR(5) DEFAULT \'\' NOT NULL,
  cache_data TEXT,
  cache_time INT,
  PRIMARY KEY  ( user_id, cache_id )
)',

# presets names
'CREATE TABLE ' . PRESETS_TABLE . ' (
  preset_id BIGINT NOT NULL IDENTITY (1,1),
  preset_type VARCHAR(5) NOT NULL DEFAULT \'\',
  preset_name VARCHAR(50) NOT NULL DEFAULT \'\',
  PRIMARY KEY ( preset_id )
)',

# presets data
'CREATE TABLE ' . PRESETS_DATA_TABLE . ' (
  preset_id BIGINT NOT NULL DEFAULT \'0\',
  preset_auth VARCHAR(50) NOT NULL DEFAULT \'\',
  preset_value SMALLINT DEFAULT NULL,
  PRIMARY KEY ( preset_id, preset_auth )
)',

# messages icons
'CREATE TABLE ' . ICONS_TABLE . ' (
  icon_id BIGINT NOT NULL IDENTITY (1,1),
  icon_name VARCHAR(50) NOT NULL DEFAULT \'\',
  icon_url VARCHAR(255) NOT NULL DEFAULT \'\',
  icon_acl SMALLINT NOT NULL DEFAULT \'0\',
  icon_types VARCHAR(255) DEFAULT NULL,
  icon_order BIGINT NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (icon_id)
)',

# control panels fields
'CREATE TABLE ' . CP_FIELDS_TABLE . ' (
  field_id BIGINT NOT NULL IDENTITY (1,1),
  field_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_id BIGINT NOT NULL DEFAULT \'0\',
  field_order BIGINT NOT NULL DEFAULT \'0\',
  field_attr TEXT DEFAULT \'\' NOT NULL,
  PRIMARY KEY  (field_id)
)',

# control panels defs
'CREATE TABLE ' . CP_PANELS_TABLE . ' (
  panel_id BIGINT NOT NULL IDENTITY (1,1),
  panel_shortcut VARCHAR(30) NOT NULL DEFAULT \'\',
  panel_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_main BIGINT NOT NULL DEFAULT \'0\',
  panel_order BIGINT NOT NULL DEFAULT \'0\',
  panel_file VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_auth_type CHAR(1) NOT NULL DEFAULT \'\',
  panel_auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  panel_hidden SMALLINT NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (panel_id)
)',

# control panels patches
'CREATE TABLE ' . CP_PATCHES_TABLE . ' (
  patch_id BIGINT NOT NULL IDENTITY (1,1),
  patch_file VARCHAR(255) NOT NULL DEFAULT \'\',
  patch_time INT NOT NULL DEFAULT \'0\',
  patch_version VARCHAR(25) NOT NULL DEFAULT \'\',
  patch_date VARCHAR(8) NOT NULL DEFAULT \'\',
  patch_ref VARCHAR(255) NOT NULL DEFAULT \'\',
  patch_author VARCHAR(255) NOT NULL DEFAULT \'\',
  PRIMARY KEY  (patch_id)
)',

# extended auths table
'CREATE TABLE ' . AUTHS_TABLE . ' (
  group_id BIGINT NOT NULL DEFAULT \'0\',
  obj_type CHAR(1) NOT NULL DEFAULT \'\',
  obj_id BIGINT NOT NULL DEFAULT \'0\',
  auth_name VARCHAR(50) NOT NULL DEFAULT \'\',
  auth_value SMALLINT NOT NULL DEFAULT \'0\',
  PRIMARY KEY  (group_id,obj_type,obj_id,auth_name)
)',

# config
'ALTER TABLE ' . CONFIG_TABLE . ' ADD config_static SMALLINT NOT NULL DEFAULT 0',

# indexes addition
'CREATE INDEX [IX_cp_fields_CH_1] ON [' . CP_FIELDS_TABLE . ']([panel_id], [field_name]) ON [PRIMARY]',
'CREATE INDEX [IX_auths_CH_1] ON [' . AUTHS_TABLE . ']([group_id], [obj_type]) ON [PRIMARY]',
'CREATE INDEX [IX_auths_CH_2] ON [' . AUTHS_TABLE . ']([obj_type], [obj_id]) ON [PRIMARY]',
'CREATE INDEX [IX_topics_CH_1] ON [' . TOPICS_TABLE . ']([topic_last_time]) ON [PRIMARY]',
'CREATE INDEX [IX_posts_CH_1] ON [' . POSTS_TABLE . ']([post_icon]) ON [PRIMARY]',
'CREATE INDEX [IX_groups_CH_1] ON [' . GROUPS_TABLE . ']([group_user_id]) ON [PRIMARY]',
'CREATE INDEX [IX_config_CH_1] ON [' . CONFIG_TABLE . ']([config_static]) ON [PRIMARY]',
			);
			break;

		default:
			die('Please run the SQL part from the mod installation description txt');
			break;
	}

	// run sql modifications
	$count_sql_struct = count($sql_struct);
	for ( $i = 0; $i < $count_sql_struct; $i++ )
	{
		$sql = $sql_struct[$i];
		if ( !$db->sql_query($sql, false, __LINE__, __FILE__, false) )
		{
			_output('Modification failed (may be already done) : ' . $sql);
		}
	}

	// read config table
	$config->read();
}

//--------------------------
function reorder($forum_id=0)
{
	global $subs, $ordered;

	$ordered[] = $forum_id;
	$count_subs = count($subs[$forum_id]);
	for ( $i = 0; $i < $count_subs; $i++ )
	{
		reorder($subs[$forum_id][$i]);
	}
}

function _output($message, $location='', $line='', $file='')
{
	echo '<div class="gensmall"><textarea rows="5" cols="100" wrap="virtual">' . ( empty($location) ? '' : '<u><b>location:</b> ' . $location . '</u>' . ( empty($line) ? '' : ' line: ' . $line ) . ( empty($file) ? '' : ' file: ' . $file ) . '<br />');
	if ( empty($message) )
	{
		echo 'Empty';
	}
	else if ( is_array($message) || is_object($message) )
	{
		print_r($message);
	}
	else
	{
		echo str_replace("\t", '&nbsp;&nbsp;', htmlspecialchars($message));
	}
	echo '</textarea></div>';
}

//--------------------------

class admin_auths_def extends auth_class
{
	function move($mode, $auth_id)
	{
		global $db;

		if ( !isset($this->data[$auth_id]) )
		{
			return;
		}

		// update the asked row
		$sql = 'UPDATE ' . AUTHS_DEF_TABLE . '
					SET auth_order = auth_order ' . (($mode == 'moveup') ? '-' : '+') . ' 15
					WHERE auth_id = ' . intval($auth_id);
		$db->sql_query($sql, false, __LINE__, __FILE__);

		// renum all
		$this->renum();
	}

	function import($auth_type)
	{
		global $error, $error_msg;

		switch ( $auth_type )
		{
			case POST_FORUM_URL:
				$this->import_forums();
				break;
			case POST_PANELS_URL:
				$this->import_panels();
				break;
			case POST_GROUPS_URL:
				$this->import_groups();
				break;
			default:
				_error('No_such_auth_type');
				break;
		}
		$this->renum();
	}

	function import_forums()
	{
		global $error, $error_msg;
		global $db, $config, $user;

		// get the max order for the type
		$order = 0;
		if ( !empty($this->keys[POST_FORUM_URL]) )
		{
			$tkeys = array_keys($this->keys[POST_FORUM_URL]);
			$order = $this->data[ $this->keys[POST_FORUM_URL][ $tkeys[(count($tkeys)-1)] ] ]['auth_order'];
			unset($tkeys);
		}

		// get auths def from forums
		include_once($config->url('includes/auth'));
		$req_auths_def = get_forums_auths_def();
		$no_req_auths_def = array('auth_mod', 'auth_mod_display', 'auth_manage');
		$auths_def = array_merge($req_auths_def, $no_req_auths_def);
		$count_auths_def = count($auths_def);

		// create or update the entries
		$db->sql_stack_reset();
		$auth_names = array();
		for ( $i = 0; $i < $count_auths_def; $i++ )
		{
			if ( !isset($this->keys[POST_FORUM_URL][ $auths_def[$i] ]) )
			{
				$order += 10;
				$fields = array(
					'auth_type' => POST_FORUM_URL,
					'auth_name' => $auths_def[$i],
					'auth_desc' => ($user->lang($auth_name) != $auth_name) ? $auths_def[$i] : '',
					'auth_title' => false,
					'auth_order' => $order,
				);
				$auth_names[] = $auths_def[$i];
				$db->sql_stack_statement($fields);
			}
		}
		if ( !empty($db->sql_stack_values) )
		{
			$db->sql_stack_insert(AUTHS_DEF_TABLE, false, __LINE__, __FILE__);
			$this->read(true);
			_error('Forums_auths_def_imported');
		}
		else
		{
			_error('Forums_auths_def_done');
		}

		// some requirements have been added : migrate the auths
		if ( !empty($auth_names) )
		{
			$count_auth_names = count($auth_names);

			// read authed groups
			$sql = 'SELECT *
						FROM ' . AUTH_ACCESS_TABLE . '
						ORDER BY forum_id';
			$result = $db->sql_query($sql, false, __LINE__, __FILE__);
			$acls = array();
			while ( $row = $db->sql_fetchrow($result) )
			{
				for ( $i = 0; $i < $count_auth_names; $i++ )
				{
					$auth_name = $auth_names[$i];

					// adjust some auths
					if ( $auth_name = 'auth_mod_display' )
					{
						$row[$auth_name] = $row['auth_mod'];
					}
					if ( $row[$auth_name] )
					{
						if ( !isset($acls[ intval($row['forum_id']) ]) )
						{
							$acls[ $row['forum_id'] ] = array();
						}
						if ( !isset($acls[ intval($row['forum_id']) ][$auth_name]) )
						{
							$acls[ intval($row['forum_id']) ][$auth_name] = array();
						}
						$acls[ intval($row['forum_id']) ][$auth_name][] = intval($row['group_id']);
					}
				}
			}
			$db->sql_freeresult($result);

			// get forums auths requirements
			$t_auth_names = array_flip($auth_names);
			$count_no_req_auths_def = count($no_req_auths_def);
			for ( $i = 0; $i < $count_no_req_auths_def; $i++ )
			{
				if ( isset($t_auth_names[ $no_req_auths_def[$i] ]) )
				{
					unset($t_auth_names[ $no_req_auths_def[$i] ]);
				}
			}
			$t_auth_names = array_flip($t_auth_names);
			$sql = 'SELECT forum_id' . (empty($t_auth_names) ? '' : ', ' . implode(', ', $t_auth_names)) . '
						FROM ' . FORUMS_TABLE;
			$result = $db->sql_query($sql, false, __LINE__, __FILE__);
			$db->sql_stack_reset();
			while ( $row = $db->sql_fetchrow($result) )
			{
				// check requirements
				for ( $i = 0; $i < $count_auth_names; $i++ )
				{
					switch ( $auth_names[$i] )
					{
						case 'auth_mod':
							$auth_req = AUTH_ACL;
							break;
						case 'auth_mod_display':
							$auth_req = AUTH_MOD;
							break;
						case 'auth_manage':
							$auth_req = AUTH_ADMIN;
							break;
						default:
							$auth_req = $row[ $auth_names[$i] ];
							break;
					}
					$group_ids = array();
					switch ( $auth_req )
					{
						case AUTH_ALL:
							$group_ids[] = GROUP_ANONYMOUS;
						case AUTH_REG:
							$group_ids[] = GROUP_REGISTERED;
							break;
						case AUTH_MOD:
						case AUTH_ACL:
							$auth_name = ($auth_req == AUTH_MOD) ? 'auth_mod' : $auth_names[$i];
							if ( !empty($acls[ intval($row['forum_id']) ][$auth_name]) )
							{
								$group_ids = $acls[ intval($row['forum_id']) ][$auth_name];
							}
							// we don't want to display admin as moderators
							if ( $auth_names[$i] == 'auth_mod_display' )
							{
								break;
							}
						case AUTH_ADMIN:
							$group_ids[] = GROUP_ADMIN;
							break;
					}

					// build the sql request
					if ( !empty($group_ids) )
					{
						$count_group_ids = count($group_ids);
						for ( $j = 0; $j < $count_group_ids; $j++ )
						{
							$fields = array(
								'group_id' => $group_ids[$j],
								'obj_type' => POST_FORUM_URL,
								'obj_id' => intval($row['forum_id']),
								'auth_name' => $auth_names[$i],
								'auth_value' => true,
							);
							$db->sql_stack_statement($fields);
						}
					}
				}
			}
			$db->sql_freeresult($result);

			// create the auths access
			if ( !empty($db->sql_stack_values) )
			{
				$db->sql_stack_insert(AUTHS_TABLE, false, __LINE__, __FILE__);
				_error('Forums_auths_imported');

				// clear the caches
				$sql = 'DELETE FROM ' . USERS_CACHE_TABLE . '
							WHERE cache_id LIKE \'' . POST_FORUM_URL . '%\'';
				$db->sql_query($sql, false, __LINE__, __FILE__);

				// update the forums requirements to AUTH_ACL
				$fields = array();
				$count_req_auths_def = count($req_auths_def);
				for ( $i = 0; $i < $count_req_auths_def; $i++ )
				{
					$fields[ $req_auths_def[$i] ] = AUTH_ACL;
				}
				$db->sql_statement($fields);
				if ( !empty($fields) )
				{
					$sql = 'UPDATE ' . FORUMS_TABLE . '
								SET ' . $db->sql_update;
					$db->sql_query($sql, false, __LINE__, __FILE__);
				}

				// clear the auths access table to prevent access by a script addressing directly the auths access table
//				$sql = 'DELETE FROM ' . AUTH_ACCESS_TABLE;
//				$db->sql_query($sql, false, __LINE__, __FILE__);

				// update mods status
				$moderators = new moderators();
				$moderators->set_users_status();
				$moderators->read(true);
			}
		}
	}

	function import_panels()
	{
		global $db, $user;
		global $error, $error_msg;

		// get the max order for the type
		$order = 0;
		if ( !empty($this->keys[POST_PANELS_URL]) )
		{
			$tkeys = array_keys($this->keys[POST_PANELS_URL]);
			$order = $this->data[ $this->keys[POST_PANELS_URL][ $tkeys[(count($tkeys)-1)] ] ]['auth_order'];
			unset($tkeys);
		}

		// read all panels having auths
		$sql = 'SELECT DISTINCT panel_auth_name
					FROM ' . CP_PANELS_TABLE . '
					WHERE panel_auth_type = \'' . POST_PANELS_URL . '\'
						AND panel_auth_name <> \'\'
					GROUP BY panel_auth_name';
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		$db->sql_stack_reset();
		while ( $row = $db->sql_fetchrow($result) )
		{
			if ( !isset($this->keys[POST_PANELS_URL][ $row['panel_auth_name'] ]) )
			{
				$order += 10;
				$fields = array(
					'auth_type' => POST_PANELS_URL,
					'auth_name' => $row['panel_auth_name'],
					'auth_desc' => ($user->lang($row['panel_auth_name']) != $row['panel_auth_name']) ? $row['panel_auth_name'] : '',
					'auth_title' => false,
					'auth_order' => $order,
				);

				// prepare insert rows
				$db->sql_stack_statement($fields);
			}
		}
		if ( !empty($db->sql_stack_values) )
		{
			$db->sql_stack_insert(AUTHS_DEF_TABLE, false, __LINE__, __FILE__);
			$this->read(true);
			_error('Panels_auths_def_imported');
		}
		else
		{
			_error('Panels_auths_def_done');
		}
	}

	function import_groups()
	{
		global $db, $user;
		global $error, $error_msg;

		// get the max order for the type
		$order = 0;
		if ( !empty($this->keys[POST_GROUPS_URL]) )
		{
			$tkeys = array_keys($this->keys[POST_GROUPS_URL]);
			$order = $this->data[ $this->keys[POST_GROUPS_URL][ $tkeys[(count($tkeys)-1)] ] ]['auth_order'];
			unset($tkeys);
		}

		// get all groups auths def
		$auths_def = array();

		// read all panels having auths
		$sql = 'SELECT DISTINCT panel_auth_name
					FROM ' . CP_PANELS_TABLE . '
					WHERE panel_auth_type = \'' . POST_GROUPS_URL . '\'
						AND panel_auth_name <> \'\'
					GROUP BY panel_auth_name';
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		while ( $row = $db->sql_fetchrow($result) )
		{
			if ( !isset($this->keys[POST_GROUPS_URL][ $row['panel_auth_name'] ]) )
			{
				$auths_def[ $row['panel_auth_name'] ] = true;
			}
		}

		// get also auths sat on fields
		$sql = 'SELECT field_attr
					FROM ' . CP_FIELDS_TABLE . '
					WHERE field_attr LIKE \'%field_auth%\'
						AND field_name <> \'\'';
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		while ( $row = $db->sql_fetchrow($result) )
		{
			// unpack data
			$field = unserialize(stripslashes($row['field_attr']));

			// check auths
			if ( !empty($field['field_auth']) && !isset($this->keys[POST_GROUPS_URL][ $field['field_auth'] ]) )
			{
				$auths_def[ $field['field_auth'] ] = true;
			}
		}

		// prepare auths defs creation
		$db->sql_stack_reset();
		if ( !empty($auths_def) )
		{
			foreach ( $auths_def as $auth_name => $dummy )
			{
				$order += 10;
				$fields = array(
					'auth_type' => POST_GROUPS_URL,
					'auth_name' => $auth_name,
					'auth_desc' => ($user->lang($auth_name) != $auth_name) ? $auth_name : '',
					'auth_title' => false,
					'auth_order' => $order,
				);

				// prepare insert rows
				$db->sql_stack_statement($fields);
			}
		}

		// create the relevant added auths def
		if ( !empty($db->sql_stack_values) )
		{
			$db->sql_stack_insert(AUTHS_DEF_TABLE, false, __LINE__, __FILE__);
			$this->read(true);
			_error('Groups_auths_def_imported');
		}
		else
		{
			_error('Groups_auths_def_done');
		}
	}
}
//--------------------------

//
// Start session management
//
$userdata = session_pagestart($user_ip, -1);
init_userprefs($userdata);
if ( $userdata['user_level'] != ADMIN )
{
	if ( !$user->data['session_logged_in'] )
	{
		header('Location: ./../login.' . $config->ext . '?redirect=./install_cat/install.' . $config->ext);
		exit;
	}
	else
	{
		die('<hr />The board is currently under maintenance : please retry later. <br /><br />Sorry for the inconvenience, <br />the management.<hr />');
	}
}
//
// End session management
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['ENCODING']; ?>">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Categories hierarchy 2.1.0 migration tool</title>
<style type="text/css">
<!--
font,th,td,p { font-family: Verdana, Arial, Helvetica, sans-serif }
.gen {font-size: 12px}
.gensmall {font-size: 11px}
hr	{ height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.background { background-color: #FFFFFF; border: 1px #98AAB1 solid; }
//-->
</style>
</head>
<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#5584AA">
<table cellpadding="10" cellspacing="1" border="0" class="background" width="100%"><tr><td>

<div align="center" class="background"><br /><br /><u><b><h1>Categories hierarchy 2.1.0 migration tool</h1></b></u><br /><br /></div>

<?php
if ( !_button('submit') )
{
?>
	<form method="post" name="form" action="<?php echo $config->url('install_cat/install'); ?>">
	<div class="gen" align="center">Welcome to the Categories hierarchy 2.1.0 migration tool.</div><div align="justify" class="gen"><br /><br />
	This tool is designed to fill the new fields added by the mod. It will create some new config entries also, you will be able to access through your Administration Control Panel/Forum management, Forum index edition.
	This config entries are made to enable or disable a number of new functionalities, so be sure to visit it after having finish the migration :).

	<br /><br /><u>if the tool fails with a runtime overflow error (over 30s) during the topic resynchronization, just run it till all the topics will be synchronized</u><br /><br /></justify>

	</div><div align="center" class="gen"><br />
	If you are ready to proceed, press:<br /><input type="submit" name="submit" value="Go" /><br /><br />
	</form>

<?php
}
else
{
?>
	<div align="justify" class="gen"><br /><br />
<?php
	//--------------------------
	// create config values
	//--------------------------
	echo '<b>Adding config values...</b><br /><br />';

	$sql = 'UPDATE ' . CONFIG_TABLE . '
				SET config_static = 1 
				WHERE config_name NOT IN(\'record_online_users\', \'record_online_date\')';
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	// config set definition
	$config_set = array(

		// mod : this one will be done at end to always re-enter the config tool if overtime error
//		'mod_cat_hierarchy' => array('config_value' => '2.1.0f', 'config_static' => 1),

		// stats
		'stat_total_posts' => array('config_value' => 0, 'config_static' => 0),
		'stat_total_topics' => array('config_value' => 0, 'config_static' => 0),
		'stat_total_users' => array('config_value' => 0, 'config_static' => 0),
		'stat_last_user' => array('config_value' => 0, 'config_static' => 0),
		'stat_last_username' => array('config_value' => 0, 'config_static' => 0),

		// board level
		'site_fav_icon' => array('config_value' => 'images/favicon.ico', 'config_static' => 1),
		'keep_unreads' => array('config_value' => 0, 'config_static' => 1),
		'keep_unreads_over' => array('config_value' => 0, 'config_static' => 1),
		'smart_date' => array('config_value' => 1, 'config_static' => 1),
		'smart_date_over' => array('config_value' => 0, 'config_static' => 1),
		'icons_path' => array('config_value' => 'images/icons/', 'config_static' => 1),

		'topics_split_global' => array('config_value' => 0, 'config_static' => 1),
		'topics_split_announces' => array('config_value' => 0, 'config_static' => 1),
		'topics_split_stickies' => array('config_value' => 0, 'config_static' => 1),

		'default_duration' => array('config_value' => 7, 'config_static' => 1),

		'pagination_min' => array('config_value' => 5, 'config_static' => 1),
		'pagination_max' => array('config_value' => 11, 'config_static' => 1),
		'pagination_percent' => array('config_value' => 10, 'config_static' => 1),

		'topic_title_length' => array('config_value' => 60, 'config_static' => 1),
		'sub_title_length' => array('config_value' => 100,  'config_static' => 1),

		// forum level
		'index_fav_icon' => array('config_value' => 'images/favicon.gif', 'config_static' => 1),
		'topics_sort' => array('config_value' => 'lastpost', 'config_static' => 1),
		'topics_order' => array('config_value' => 'DESC', 'config_static' => 1),
		'topics_sort_over' => array('config_value' => 0, 'config_static' => 1),
		'last_topic_title_length' => array('config_value' => 25, 'config_static' => 1),
		'index_pack' => array('config_value' => 0, 'config_static' => 1),
		'index_pack_over' => array('config_value' => 0, 'config_static' => 1),
		'index_split' => array('config_value' => 0, 'config_static' => 1),
		'index_split_over' => array('config_value' => 0, 'config_static' => 1),
		'board_box' => array('config_value' => 1, 'config_static' => 1),
		'board_box_over' => array('config_value' => 0, 'config_static' => 1),

		// cache (cfg cache, cache path & cache key have to remain dynamic)
		'cache_key' => array('config_value' => md5(uniqid(rand())), 'config_static' => 0),
		'cache_path' => array('config_value' => 'cache/', 'config_static' => 0),
		'cache_disabled_cfg' => array('config_value' => 0, 'config_static' => 0),
		'cache_disabled_f' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_mods' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_themes' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_ranks' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_words' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_smilies' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_icons' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_cp_patches' => array('config_value' => 0, 'config_static' => 1),
		'cache_disabled_cp_panels' => array('config_value' => 0, 'config_static' => 1),

		// users caches level time markers
		'cache_time_f' => array('config_value' => 0, 'config_static' => 1),
		'cache_time_m' => array('config_value' => 0, 'config_static' => 1),
		'cache_time_g' => array('config_value' => 0, 'config_static' => 1),
		'cache_time_fjbox' => array('config_value' => 0, 'config_static' => 1),

		// template cache
		'cache_disabled_template' => array('config_value' => 0, 'config_static' => 1),
		'cache_check_template' => array('config_value' => 1, 'config_static' => 1),
	);

	// do some cleaning
	$sql = 'DELETE FROM ' . CONFIG_TABLE . '
				WHERE config_name IN(\'' . implode('\', \'', array_keys($config_set)) . '\')';
	$db->sql_query($sql, false, __LINE__, __FILE__);

	// re insert config data
	$count_config_set = count($config_set);
	$db->sql_stack_reset();
	foreach ( $config_set as $config_name => $config_data )
	{
		$fields = array(
			'config_name' => $config_name,
			'config_value' => $config_data['config_value'],
			'config_static' => $config_data['config_static'],
		);
		$db->sql_stack_statement($fields);
	}
	$db->sql_stack_insert(CONFIG_TABLE, false, __LINE__, __FILE__);

	// recache
	$config->read(true);

	echo '... config values has been added.<br /><hr /><br /><br />';

	//--------------------------
	// cats/forums migration
	//--------------------------
	echo '<b>Creating forums with the categories...</b><br /><br />';

	$sql = 'SELECT *
				FROM ' . CATEGORIES_TABLE . '
				WHERE cat_order <> 0
				ORDER BY cat_order';
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$cats = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		$cats[ $row['cat_id'] ] = $row;
	}
	if ( empty($cats) )
	{
		echo '--- forums already created<br /><br /><hr /><br /><br />';
	}
	else
	{
		// Was a previous version of categories hierarchy installed ?
		$c_cat_hierarchy = $f_cat_hierarchy = false;

		// cat attached to forum or cat
		$sql = 'SELECT cat_main
					FROM ' . CATEGORIES_TABLE . '
					LIMIT 1';
		_output($sql);
		$c_cat_hierarchy = ($res = $db->sql_query($sql, false, __LINE__, __FILE__, false));

		// forum attached to a forum
		if ( $c_cat_hierarchy )
		{
			$sql = 'SELECT main_type
						FROM ' . FORUMS_TABLE . '
						LIMIT 1';
			_output($sql);
			$f_cat_hierarchy = ($res = $db->sql_query($sql, false, __LINE__, __FILE__, false));
			echo '--- info: a previous version of Categories hierarchy has been detected<br /><br />';
		}

		//
		// process the cats
		//
		$sql = 'SELECT MAX(forum_id) as last_forum_id
					FROM ' . FORUMS_TABLE;
		_output($sql);
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		$row = $db->sql_fetchrow($result);
		$forum_id = intval($row['last_forum_id']);
		$db->sql_stack_reset();
		foreach ( $cats as $cat_id => $cat )
		{
			$forum_id++;
			$cat['forum_id'] = $forum_id;
			$cats[$cat_id] = $cat;
			$fields = array(
				'forum_id' => $cat['forum_id'],
				'forum_name' => $cat['cat_title'],
				'forum_main' => 0,
				'forum_type' => POST_CAT_URL,
				'forum_order' => 0,
			);

			// recover the previous hierarchy
			if ( $c_cat_hierarchy )
			{
				$fields['forum_order'] = intval($cat['cat_order']);
				if ( !empty($cat['cat_main']) )
				{
					if ( $cat['cat_main_type'] == POST_FORUM_URL )
					{
						$fields['forum_main'] = intval($cat['cat_main']);
					}
					else if ( isset($cats[ intval($cat['cat_main']) ]) )
					{
						$fields['forum_main'] = intval($cats[ intval($cat['cat_main']) ]['forum_id']);
					}
				}
			}

			// add to the insert statement
			$db->sql_stack_statement($fields);

			// handle cat hierarchy attachement
			$sql_where = $f_cat_hierarchy ? ' AND main_type = \'' . POST_CAT_URL . '\'' : '';

			// re-attach forums
			$sql = 'UPDATE ' . FORUMS_TABLE . '
						SET forum_main = ' . $forum_id . '
						WHERE cat_id = ' . $cat_id . $sql_where;
			_output($sql);
			$db->sql_query($sql, false, __LINE__, __FILE__);
		}
		$db->sql_stack_insert(FORUMS_TABLE, false, __LINE__, __FILE__);
		$sql = 'UPDATE ' . CATEGORIES_TABLE . '
					SET cat_order = 0
					WHERE cat_id IN(' . implode(', ', array_keys($cats)) . ')';
		_output($sql);
		$db->sql_query($sql, false, __LINE__, __FILE__);

		// reset the forum link counter for previous version of categories hierarchy
		if ( $c_cat_hierarchy )
		{
			$fields = array(
				'forum_type' => POST_LINK_URL,
				'forum_link_start' => empty($config->data['board_startdate']) ? time() : intval($config->data['board_startdate']),
			);
			if ( empty($config->data['board_startdate']) )
			{
				$fields += array(
					'forum_link_count' => 0,
				);
			}
			$db->sql_statement($fields);
			$sql = 'UPDATE ' . FORUMS_TABLE . '
						SET ' . $db->sql_update . '
						WHERE (forum_link <> \'\' AND forum_link IS NOT NULL)';
			_output($sql);
			$db->sql_query($sql, false, __LINE__, __FILE__);
		}

		echo '... forums created and sub-forums attached<br /><hr /><br /><br />';
	}

	echo '<b>Re-order forums...</b><br /><br />';

	$sql = 'SELECT forum_id, forum_main
				FROM ' . FORUMS_TABLE . '
				ORDER BY forum_main, forum_order';
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$subs = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		if ( !isset($subs[ $row['forum_id'] ]) )
		{
			$subs[ $row['forum_id'] ] = array();
		}
		if ( !isset($subs[ $row['forum_main'] ]) )
		{
			$subs[ $row['forum_main'] ] = array();
		}
		$subs[ $row['forum_main'] ][] = $row['forum_id'];
	}

	$ordered = array();
	reorder();

	// update all tree order to 0
	$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET forum_order = 0';
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	// force type as forum for those missing
	$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET forum_type = \'' . POST_FORUM_URL . '\'
				WHERE forum_type IS NULL OR forum_type = \' \'';
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	// set the good order
	$count_ordered = count($ordered);
	$last_order = 0;
	for ( $i = 0; $i < $count_ordered; $i++ )
	{
		if ( !empty($ordered[$i]) )
		{
			$last_order += 10;
			$sql = 'UPDATE ' . FORUMS_TABLE . '
						SET forum_order = ' . $last_order . '
						WHERE forum_id = ' . $ordered[$i];
			_output($sql);
			$db->sql_query($sql, false, __LINE__, __FILE__);
		}
	}

	// attach unordered forums to root
	$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET forum_main = 0
				WHERE forum_order = 0';
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	echo '... forums reorder done<br /><hr /><br /><br />';

	// reclaim some memory
	if ( !empty($cats) )
	{
		unset($cats);
	}
	if ( !empty($subs) )
	{
		unset($subs);
	}
	if ( !empty($ordered) )
	{
		unset($ordered);
	}

	//--------------------------
	// synchronise topics
	//--------------------------
	// this is the big one

	echo '<b>Topic synchronisation...</b><br /><br />';

	$sql = 'SELECT t.topic_id, fp.post_username AS first_username, lp.poster_id AS last_poster, lp.post_username AS last_username, lp.post_time AS last_time
				FROM ' . TOPICS_TABLE . ' t
					LEFT JOIN ' . POSTS_TABLE . ' fp ON fp.post_id = t.topic_first_post_id
					LEFT JOIN ' . POSTS_TABLE . ' lp ON lp.post_id = t.topic_last_post_id
				WHERE t.topic_last_time = 0
					AND t.topic_moved_id = 0';
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	echo 'remaining : ' . $db->sql_numrows($result) . ' topics<br /><br />';
	flush();
	while ( $row = $db->sql_fetchrow($result) )
	{
		$fields = array(
			'topic_first_username' => $row['first_username'],
			'topic_last_poster' => intval($row['last_poster']),
			'topic_last_username' => $row['last_username'],
			'topic_last_time' => intval($row['last_time']),
		);
		$db->sql_statement($fields);
		$sql = 'UPDATE ' . TOPICS_TABLE . '
					SET ' . $db->sql_update . '
					WHERE topic_id = ' . $row['topic_id'];
		$db->sql_query($sql, false, __LINE__, __FILE__);
	}
	echo '... topic synchronisation done<br /><hr /><br /><br />';


	//--------------------------
	// synchronise last posts in forums
	//--------------------------

	echo '<b>Forums synchronisation...</b><br /><br />';

	$sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE;
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE);
	while ( $row = $db->sql_fetchrow($result) )
	{
		$forums[] = $row['forum_id'];
	}
	$count_forums = count($forums);
	for ( $i = 0; $i < $count_forums; $i++ )
	{
		$sql = 'SELECT t.topic_title, t.topic_last_post_id, t.topic_last_poster, t.topic_last_username, t.topic_last_time, u.username
					FROM ' . TOPICS_TABLE . ' t
						LEFT JOIN ' . USERS_TABLE . ' u ON u.user_id = t.topic_last_poster
						WHERE forum_id = ' . $forums[$i] . '
					ORDER BY t.topic_last_post_id DESC
					LIMIT 1';
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		$row = $db->sql_fetchrow($result);
		$fields = array(
			'forum_last_title' => $row['topic_title'],
			'forum_last_poster' => intval($row['topic_last_poster']),
			'forum_last_username' => (($row['topic_last_poster'] == ANONYMOUS) || empty($row['username'])) ? $row['topic_last_username'] : $row['username'],
			'forum_last_time' => intval($row['topic_last_time']),
		);
		$db->sql_statement($fields);
		$sql = 'UPDATE ' . FORUMS_TABLE . '
					SET ' . $db->sql_update . '
					WHERE forum_id = ' . $forums[$i];
		_output($sql);
		$db->sql_query($sql, false, __LINE__, __FILE__);
	}

	// force global announces auth requirement
	$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET auth_global_announce = 5
				WHERE auth_global_announce = 0';
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	// recache forums now
	$sql = 'DELETE FROM ' . USERS_CACHE_TABLE;
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	$forums = new forums();
	$forums->read(true);

	// synchornize the topics & posts count
	$sql = 'SELECT COUNT(topic_id) as total_topics
				FROM ' . TOPICS_TABLE;
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$row = $db->sql_fetchrow($result);
	$config->set('stat_total_topics', intval($row['total_topics']));

	$sql = 'SELECT COUNT(post_id) as total_posts
				FROM ' . POSTS_TABLE;
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$row = $db->sql_fetchrow($result);
	$config->set('stat_total_posts', intval($row['total_posts']));

	echo '... forums synchronisation done<br /><hr /><br /><br />';

	//--------------------------
	// set topic duration date to never for announces (we don't touch globals if any)
	//--------------------------

	echo '<b>Announces duration initialisation...</b><br /><br />';

	$sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_duration = topic_time
				WHERE topic_duration = 0
					AND topic_type = ' . POST_ANNOUNCE;
	_output($sql);
	$db->sql_query($sql, false, __LINE__, __FILE__);

	echo '... announces duration initialisation done<br /><hr /><br /><br />';


	//--------------------------
	// synchronise users
	//--------------------------

	echo '<b>Synchronise users...</b><br /><br />';

	$sql = 'SELECT user_id, username
				FROM ' . USERS_TABLE . '
				WHERE user_id <> ' . ANONYMOUS . '
				ORDER BY user_id DESC';
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$config->set('stat_total_users', intval($db->sql_numrows($result)));
	$row = $db->sql_fetchrow($result);
	$config->set('stat_last_user', intval($row['user_id']));
	$config->set('stat_last_username', $row['username']);

	$sql = 'UPDATE ' . USERS_TABLE . '
				SET user_unread_topics = NULL, user_unread_date = user_lastvisit';
	_output($sql);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);

	echo '... users synchronised<br /><hr /><br /><br />';


	//--------------------------
	// create panels
	//--------------------------

	echo '<b>create panels...</b><br /><br />';

	$cp_panels = new cp_panels();
	$cp_panels->read();
	$cp_panels->patch();

	echo '... panels created<br /><hr /><br /><br />';


	//--------------------------
	// create auths definitions & import auths settings
	//--------------------------

	echo '<b>create auths definitions...</b><br /><br />';

	$auths_def = new admin_auths_def();
	$auths_def->read();
	$auths_def->import(POST_FORUM_URL);
	$auths_def->import(POST_PANELS_URL);
	$auths_def->import(POST_GROUPS_URL);

	echo '... auths definitions created<br /><hr /><br /><br />';


	//--------------------------
	// synchronise users groups list
	//--------------------------

	echo '<b>Synchronise users groups membership...</b><br /><br />';

	$groups = new groups();
	$groups->resync_users_list();

	echo '... users groups membership synchronised<br /><hr /><br /><br />';


	//--------------------------
	// auths presets creation
	//--------------------------

	echo '<b>Permissions presets creation...</b><br /><br />';

	$sql = 'DELETE FROM ' . PRESETS_TABLE;
	$db->sql_query($sql, false, __LINE__, __FILE__);
	$db->sql_stack_reset();
	$db->sql_stack_fields = 'preset_id, preset_type, preset_name';
	$db->sql_stack_values = array(
		'(1, \'f\', \'Preset_read_only\')',
		'(2, \'f\', \'Preset_read_post_vote\')',
		'(3, \'f\', \'Preset_moderator\')',
		'(4, \'f\', \'Preset_moderator_hidden\')',
		'(5, \'f\', \'Preset_admin\')',
		'(6, \'f\', \'None\')',
		'(7, \'m\', \'Preset_access\')',
		'(8, \'m\', \'None\')',
		'(9, \'g\', \'Preset_admin\')',
		'(10, \'g\', \'Preset_view\')',
		'(11, \'g\', \'None\')',
	);
	$db->sql_stack_insert(PRESETS_TABLE, false, __LINE__, __FILE__);

	$sql = 'DELETE FROM ' . PRESETS_DATA_TABLE;
	$db->sql_query($sql, false, __LINE__, __FILE__);
	$db->sql_stack_reset();
	$db->sql_stack_fields = 'preset_id, preset_auth, preset_value';
	$db->sql_stack_values = array(
		'(1, \'auth_read\', 1)', '(1, \'auth_view\', 1)',
		'(2, \'auth_delete\', 1)', '(2, \'auth_edit\', 1)', '(2, \'auth_post\', 1)', '(2, \'auth_read\', 1)', '(2, \'auth_reply\', 1)', '(2, \'auth_view\', 1)', '(2, \'auth_vote\', 1)',
		'(3, \'auth_announce\', 1)', '(3, \'auth_delete\', 1)', '(3, \'auth_edit\', 1)', '(3, \'auth_global_announce\', 1)', '(3, \'auth_mod\', 1)', '(3, \'auth_mod_display\', 1)', '(3, \'auth_pollcreate\', 1)', '(3, \'auth_post\', 1)', '(3, \'auth_read\', 1)', '(3, \'auth_reply\', 1)', '(3, \'auth_sticky\', 1)', '(3, \'auth_view\', 1)', '(3, \'auth_vote\', 1)',
		'(4, \'auth_announce\', 1)', '(4, \'auth_delete\', 1)', '(4, \'auth_edit\', 1)', '(4, \'auth_global_announce\', 1)', '(4, \'auth_mod\', 1)', '(4, \'auth_pollcreate\', 1)', '(4, \'auth_post\', 1)', '(4, \'auth_read\', 1)', '(4, \'auth_reply\', 1)', '(4, \'auth_sticky\', 1)', '(4, \'auth_view\', 1)', '(4, \'auth_vote\', 1)',
		'(5, \'auth_announce\', 1)', '(5, \'auth_delete\', 1)', '(5, \'auth_edit\', 1)', '(5, \'auth_global_announce\', 1)', '(5, \'auth_mod\', 1)', '(5, \'auth_pollcreate\', 1)', '(5, \'auth_post\', 1)', '(5, \'auth_read\', 1)', '(5, \'auth_reply\', 1)', '(5, \'auth_sticky\', 1)', '(5, \'auth_view\', 1)', '(5, \'auth_vote\', 1)', '(5, \'auth_manage\', 1)',
		'(7, \'access\', 1)',
		'(9, \'ucp_edit_i18n\', 1)', '(9, \'ucp_edit_layout\', 1)', '(9, \'ucp_edit_posting\', 1)', '(9, \'ucp_edit_privacy\', 1)', '(9, \'ucp_edit_profile\', 1)', '(9, \'ucp_edit_topicread\', 1)',
		'(10, \'ucp_view_profile\', 1)',
	);
	$db->sql_stack_insert(PRESETS_DATA_TABLE, false, __LINE__, __FILE__);

	echo '... permissions presets created<br /><hr /><br /><br />';


	//--------------------------
	// icons creation
	//--------------------------

	echo '<b>Messages icons creation...</b><br /><br />';

	$sql = 'DELETE FROM ' . ICONS_TABLE;
	$db->sql_query($sql, false, __LINE__, __FILE__);
	$db->sql_stack_reset();
	$db->sql_stack_fields = 'icon_id, icon_name, icon_url, icon_acl, icon_types, icon_order';
	$db->sql_stack_values = array(
		'(1, \'icon_note\', \'images/icons/icon1.gif\', 0, \'0\', 10)',
		'(2, \'icon_important\', \'images/icons/icon2.gif\', 0, \'1\', 20)',
		'(3, \'icon_idea\', \'images/icons/icon3.gif\', 0, \'\', 30)',
		'(4, \'icon_warning\', \'images/icons/icon4.gif\', 0, \'2, 3\', 40)',
		'(5, \'icon_question\', \'images/icons/icon5.gif\', 0, \'\', 50)',
		'(6, \'icon_cool\', \'images/icons/icon6.gif\', 0, \'\', 60)',
		'(7, \'icon_funny\', \'images/icons/icon7.gif\', 0, \'\', 70)',
		'(8, \'icon_angry\', \'images/icons/icon8.gif\', 0, \'\', 80)',
		'(9, \'icon_sad\', \'images/icons/icon9.gif\', 0, \'\', 90)',
		'(10, \'icon_mocker\', \'images/icons/icon10.gif\', 0, \'\', 100)',
		'(11, \'icon_shocked\', \'images/icons/icon11.gif\', 0, \'\', 110)',
		'(12, \'icon_complicity\', \'images/icons/icon12.gif\', 0, \'\', 120)',
		'(13, \'icon_bad\', \'images/icons/icon13.gif\', 0, \'\', 130)',
		'(14, \'icon_great\', \'images/icons/icon14.gif\', 0, \'\', 140)',
		'(15, \'icon_disgusting\', \'images/icons/icon15.gif\', 0, \'\', 150)',
		'(16, \'icon_winner\', \'images/icons/icon16.gif\', 0, \'\', 160)',
		'(17, \'icon_impressed\', \'images/icons/icon17.gif\', 0, \'\', 170)',
		'(18, \'icon_roleplay\', \'images/icons/icon18.gif\', 0, \'\', 180)',
		'(19, \'icon_fight\', \'images/icons/icon19.gif\', 0, \'\', 190)',
		'(20, \'icon_loot\', \'images/icons/icon20.gif\', 0, \'\', 200)',
		'(21, \'icon_picture\', \'images/icons/icon21.gif\', 3, \'\', 210)',
		'(22, \'icon_calendar\', \'images/icons/icon22.gif\', 3, \'\', 220)',
	);
	$db->sql_stack_insert(ICONS_TABLE, false, __LINE__, __FILE__);

	echo '... messages icons created<br /><hr /><br /><br />';

	// mark the install over
	$config->set('mod_cat_hierarchy', '2.1.0f', true);

	// Achievement message
	echo '<br /><hr /><h1><b>All process done.</h1><br />';
	echo 'Delete now your install_cat/ directory.</b><hr /><br /><br /><br />';
	echo '</div><div align="center" class="gen">Click <a href="' . $config->url('index') . '">Here</a> to return to Board index<br /><br /><br /><hr /><br />';
}

?>

</div><div align="center" class="gensmall"><br /><a href="http://www.phpbb.com/" target="_phpbb" class="gensmall">phpBB</a> &copy; 2001,2002 phpBB Group
</div></form></td></tr></table>
</body>
</html>
Code voorkomt smilies! - bee

Geplaatst: 16 sep 2005, 13:25
door Bee
Hieruit haal ik het volgende:

Code: Selecteer alles

DROP TABLE phpbb_auths, phpbb_cp_patches, phpbb_cp_panels, phpbb_cp_fields, phpbb_icons, phpbb_presets_data, phpbb_presets, phpbb_users_cache, phpbb_auths_def;

ALTER TABLE phpbb_forums 
DROP forum_type,
DROP forum_main,
DROP auth_global_announce,
DROP forum_last_title,
DROP forum_last_poster,
DROP forum_last_username,
DROP forum_last_time,
DROP forum_link,
DROP forum_link_hit_count,
DROP forum_link_hit,
DROP forum_link_start,
DROP forum_style,
DROP forum_nav_icon,
DROP forum_icon,
DROP forum_topics_ppage,
DROP forum_topics_sort
DROP forum_topics_order
DROP forum_index_pack,
DROP forum_index_split,
DROP forum_board_box;

ALTER TABLE phpbb_auth_access DROP auth_global_announce;

ALTER TABLE phpbb_topics 
DROP topic_sub_title,
DROP topic_first_username,
DROP topic_last_poster,
DROP topic_last_username,
DROP topic_last_time,
DROP topic_icon,
DROP topic_duration;

ALTER TABLE phpbb_posts DROP post_icon;

ALTER TABLE phpbb_posts_text DROP post_sub_title;

ALTER TABLE phpbb_users 
DROP user_unread_date,
DROP user_unread_topics,
DROP user_keep_unreads,
DROP user_topics_sort,
DROP user_topics_order,
DROP user_smart_date,
DROP user_board_box,
DROP user_index_pack,
DROP user_index_split,
DROP user_session_logged;

ALTER TABLE phpbb_groups 
DROP group_status,
DROP group_user_id,
DROP group_user_list;

ALTER TABLE phpbb_config DROP config_static;

ALTER TABLE phpbb_themes 
DROP images_pack,
DROP custom_tpls;

ALTER TABLE phpbb_topics DROP INDEX topic_last_time;
ALTER TABLE phpbb_posts DROP INDEX post_icon;
ALTER TABLE phpbb_config DROP INDEX config_static;
ALTER TABLE phpbb_groups DROP INDEX group_user_id;
Voer dit uit in phpMyAdmin NADAT je een databasebackup hebt gehaald. Geen garantie dat het 100% werkt.

Geplaatst: 16 sep 2005, 13:38
door pinin39
oeps ... heb net phpadmin gedownload maar die start ook niet op !
heb de manual gelezen maar staat naar mijn idee allemaal goed

:oops:

Geplaatst: 16 sep 2005, 13:41
door pinin39
ik heb dus een eigen server thuis staan ! kan dat een probleem zijn ?
leek me toch niet ?

Geplaatst: 16 sep 2005, 14:06
door mosymuis
pinin39 schreef:oeps ... heb net phpadmin gedownload maar die start ook niet op !
heb de manual gelezen maar staat naar mijn idee allemaal goed

:oops:
http://www.phpmyadmin.net/home_page/docs.php

Maar dit heb je ook niet perse nodig, je kunt de SQL ook uitvoeren in een te maken PHP bestandje:
http://www.phpbbhacks.com/forums/db_generator.php

Geplaatst: 16 sep 2005, 15:16
door pinin39
het kan aan mij liggen maar dan ??

heb het PHP bestandje op mijn wwwroot staan

en dan : http://localhost/db_update.php

en dan gebeurt er niets , ik krijg de melding
kan pagina niet laden !

dat is dus dezelfde melding als met dat andere PhPAdmin programmaatje