# -----------------------
# Land Down Under - Website engine
# Copyright (C) 2003 Neocrome
# http://ldu.neocrome.net
# File : docs/ldu-upgrade-525-to-600.sql
# Version : 600
# Updated : 2003-aug-15
# -----------------------

# -----------------------
# Land Down Under v600-alpha > v600 upgrade
# Run this script in phpMyAdmin to update tables
# in your MySQL database
# -----------------------

CREATE TABLE ldu_pfs_folders (
  pff_id int(11) NOT NULL auto_increment,
  pff_userid int(11) NOT NULL default '0',
  pff_title varchar(64) NOT NULL default '',
  pff_desc varchar(255) NOT NULL default '',
  pff_ispublic tinyint(1) NOT NULL default '0',
  pff_isgallery tinyint(1) NOT NULL default '0',
  pff_minlevel tinyint(2) unsigned NOT NULL default '0',
  pff_count int(11) NOT NULL default '0',
  PRIMARY KEY  (pff_id),
  KEY pff_userid (pff_userid)
) TYPE=MyISAM;

INSERT INTO ldu_config VALUES ('10', 'maintenance', '3', '0');
INSERT INTO ldu_config VALUES ('10', 'maintenance_reason', '1', 'Upgrading');
INSERT INTO ldu_config VALUES ('10', 'gzip', '3', '1');
INSERT INTO ldu_config VALUES ('10', 'dateformat', '1', 'Y-m-d H:i');
INSERT INTO ldu_config VALUES ('10', 'formatmonthday', '1', 'm-d');
INSERT INTO ldu_config VALUES ('10', 'formatyearmonthday', '1', 'Y-m-d');
INSERT INTO ldu_config VALUES ('10', 'formatmonthdayhourmin', '1', 'm-d H:i');
INSERT INTO ldu_config VALUES ('10', 'servertimezone', '1', '0');
INSERT INTO ldu_config VALUES ('35', 'parsebbcodeevents', '3', '1');
INSERT INTO ldu_config VALUES ('35', 'parsesmiliesevents', '3', '1');
INSERT INTO ldu_config VALUES ('40', 'menu1', '0', '<a href=\'index.php\'><img src=\'system/img/icon-home.gif\' border=\'0\'></a><a href=\'forums.php\'><img src=\'system/img/icon-forums.gif\' border=\'0\'></a>\n<a href=\'pfs.php?m=galleries\'><img src=\'system/img/icon-gallery.gif\' border=\'0\'></a><a href=\'pfs.php\'><img src=\'system/img/icon-pfs.gif\' border=\'0\'></a>');
INSERT INTO ldu_config VALUES ('40', 'menu2', '0', '<a href=\'index.php\'>Home</a>\n<a href=\'forums.php\'>Forums</a>\n<a href=\'pfs.php?m=galleries\'>Galleries</a>\n<a href=\'journal.php?m=home\'>Journals</a>\n<a href=\'page.php?id=1\'>Contacts</a>\n<a href=\'page.php?id=2\'>IRC</a>\n<a href=\'list.php?c=art\'>Articles</a>\n<a href=\'list.php?c=files\'>Files</a>\n<a href=\'links.php?c=links\'>Links</a>\n<a href=\'events.php?filter=incoming\'>Events</a>\n<a href=\'plug.php?p=calendar\'>Calendar</a>\n<a href=\'list.php?c=private\'>Private</a>');
INSERT INTO ldu_config VALUES ('40', 'menu3', '0', '<a href=\'index.php\'>Home</a> : <a href=\'forums.php\'>Forums</a> : <a href=\'pfs.php?m=galleries\'>Galleries</a> : <a href=\'journal.php?m=home\'>Journals</a> : <a href=\'page.php?id=2\'>IRC</a> : <a href=\'page.php?id=1\'>Contacts</a> : <a href=\'list.php?c=art\'>Articles</a> : <a href=\'list.php?c=files\'>Files</a> : <a href=\'links.php?c=links\'>Links</a> : <a href=\'events.php?filter=incoming\'>Events</a> : <a href=\'plug.php?p=calendar\'>Calendar</a> : <a href=\'list.php?c=private\'>Private</a>');
INSERT INTO ldu_config VALUES ('40', 'menu4', '0', '');
INSERT INTO ldu_config VALUES ('40', 'menu5', '0', '');
INSERT INTO ldu_config VALUES ('40', 'menu6', '0', '<a href=\'plug.php?p=overview\'>Site map</a>\n<a href=\'plug.php?p=toprated\'>Top Rated pages</a>\n<a href=\'plug.php?p=toppages\'>Top Viewed pages</a>\n<a href=\'plug.php?p=topdownloads\'>Top Downloads</a>\n<a href=\'plug.php?p=toplinks\'>Top Links</a><br>\n<a href=\'plug.php?p=downloads\'>All downloads</a>\n<a href=\'plug.php?p=topcontributors\'>Best contributors</a>\n<a href=\'plug.php?p=buddies\'>Buddies</a>\n<a href=\'plug.php?p=newestuser\'>Newest user</a>\n<a href=\'plug.php?p=statistics\'>Statistics</a>\n<a href=\'plug.php?p=tagwall\'>Tagwall</a>\n<a href=\'plug.php?p=linktous\'>Link to us !</a>');
INSERT INTO ldu_config VALUES ('40', 'menu7', '0', '');
INSERT INTO ldu_config VALUES ('40', 'menu8', '0', '');
INSERT INTO ldu_config VALUES ('40', 'menu9', '0', '');

UPDATE ldu_config SET config_cat='23' WHERE config_name='av_maxx';
UPDATE ldu_config SET config_cat='23' WHERE config_name='av_maxy';
UPDATE ldu_config SET config_cat='23' WHERE config_name='av_maxsize';
UPDATE ldu_config SET config_value='0' WHERE config_name='latestlinksret';
UPDATE ldu_config SET config_value='0' WHERE config_name='latestpagesret';
DELETE FROM ldu_config WHERE config_name='access_galleriessub';
DELETE FROM ldu_config WHERE config_name='access_gal_under';
DELETE FROM ldu_config WHERE config_name='access_gal_columns';
DELETE FROM ldu_config WHERE config_name='access_galleries';
DELETE FROM ldu_config WHERE config_name='access_gal_comments';
DELETE FROM ldu_config WHERE config_name='access_gal_ratings';
DELETE FROM ldu_config WHERE config_name='onlinenet';

ALTER TABLE ldu_pfs CHANGE pfs_type pfs_extension varchar(8) NOT NULL default '';
UPDATE ldu_pfs SET pfs_folderid='-1' WHERE pfs_extension='Avatar';
UPDATE ldu_pfs SET pfs_extension='' WHERE 1;
ALTER TABLE ldu_pfs ADD COLUMN pfs_folderid int(11) NOT NULL default '0' AFTER pfs_extension;
ALTER TABLE ldu_online ADD COLUMN online_location varchar(32) NOT NULL default '' AFTER online_lastseen;

ALTER TABLE ldu_forum_sections ADD COLUMN fs_autoprune int(11) NOT NULL default '0' AFTER fs_icon;

ALTER TABLE ldu_levels ADD COLUMN level_adm_config tinyint(1)default '0' AFTER level_isdefault;
ALTER TABLE ldu_levels ADD COLUMN level_adm_comments tinyint(1)default '0' AFTER level_adm_config;
ALTER TABLE ldu_levels ADD COLUMN level_adm_events tinyint(1)default '0' AFTER level_adm_comments;
ALTER TABLE ldu_levels ADD COLUMN level_adm_allforums tinyint(1)default '0' AFTER level_adm_events;
ALTER TABLE ldu_levels ADD COLUMN level_adm_links tinyint(1)default '0' AFTER level_adm_allforums;
ALTER TABLE ldu_levels ADD COLUMN level_adm_news tinyint(1)default '0' AFTER level_adm_links;
ALTER TABLE ldu_levels ADD COLUMN level_adm_pages tinyint(1)default '0' AFTER level_adm_news;
ALTER TABLE ldu_levels ADD COLUMN level_adm_journal tinyint(1)default '0' AFTER level_adm_pages;
ALTER TABLE ldu_levels ADD COLUMN level_adm_panel tinyint(1)default '0' AFTER level_adm_journal;
ALTER TABLE ldu_levels ADD COLUMN level_adm_pfs tinyint(1)default '0' AFTER level_adm_panel;
ALTER TABLE ldu_levels ADD COLUMN level_adm_polls tinyint(1)default '0' AFTER level_adm_pfs;
ALTER TABLE ldu_levels ADD COLUMN level_adm_ratings tinyint(1)default '0' AFTER level_adm_polls;
ALTER TABLE ldu_levels ADD COLUMN level_adm_smilies tinyint(1)default '0' AFTER level_adm_ratings;
ALTER TABLE ldu_levels ADD COLUMN level_adm_structure tinyint(1)default '0' AFTER level_adm_smilies;
ALTER TABLE ldu_levels ADD COLUMN level_adm_tools tinyint(1)default '0' AFTER level_adm_structure;
ALTER TABLE ldu_levels ADD COLUMN level_adm_users tinyint(1)default '0' AFTER level_adm_tools;

UPDATE ldu_levels SET level_adm_config=1 WHERE level_level>49;
UPDATE ldu_levels SET level_adm_structure=1 WHERE level_level>49;
UPDATE ldu_levels SET level_adm_comments=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_events=1 WHERE level_level>29;
UPDATE ldu_levels SET level_adm_allforums=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_links=1 WHERE level_level>29;
UPDATE ldu_levels SET level_adm_news=1 WHERE level_level>29;
UPDATE ldu_levels SET level_adm_pages=1 WHERE level_level>29;
UPDATE ldu_levels SET level_adm_journal=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_panel=1 WHERE level_level>19;
UPDATE ldu_levels SET level_adm_pfs=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_polls=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_ratings=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_smilies=1 WHERE level_level>39;
UPDATE ldu_levels SET level_adm_tools=1 WHERE level_level>49;
UPDATE ldu_levels SET level_adm_users=1 WHERE level_level>49;

DROP TABLE ldu_rules;

ALTER TABLE ldu_config ADD COLUMN config_order char(2) NOT NULL default '00' AFTER config_cat;

UPDATE ldu_config SET config_order='10' WHERE 1;
UPDATE ldu_config SET config_order='04' WHERE config_name='access_pfs';
UPDATE ldu_config SET config_order='05' WHERE config_name='access_galleries';
UPDATE ldu_config SET config_order='20' WHERE config_name='filltagswithtext';
UPDATE ldu_config SET config_order='20' WHERE config_name='cache';
UPDATE ldu_config SET config_order='12' WHERE config_name='disablesysinfos';
UPDATE ldu_config SET config_order='12' WHERE config_name='shortldulink';
UPDATE ldu_config SET config_order='12' WHERE config_name='showsqlstats';
UPDATE ldu_config SET config_order='14' WHERE config_name='timedout';
UPDATE ldu_config SET config_order='20' WHERE config_name='antileech';
UPDATE ldu_config SET config_order='05' WHERE config_name='maxusersperpage';
UPDATE ldu_config SET config_order='05' WHERE config_name='posterminlevel';
UPDATE ldu_config SET config_order='05' WHERE config_name='userlistminlevel';
UPDATE ldu_config SET config_order='12' WHERE config_name='av_maxsize';
UPDATE ldu_config SET config_order='12' WHERE config_name='av_maxx';
UPDATE ldu_config SET config_order='12' WHERE config_name='av_maxy';
UPDATE ldu_config SET config_order='12' WHERE config_name='usertextmax';
UPDATE ldu_config SET config_order='07' WHERE config_name='regrequireadmin';
UPDATE ldu_config SET config_order='05' WHERE config_name='maxrowsperpage';
UPDATE ldu_config SET config_order='05' WHERE config_name='maintenance';
UPDATE ldu_config SET config_order='06' WHERE config_name='maintenance_reason';
UPDATE ldu_config SET config_order='25' WHERE config_name='gzip';
UPDATE ldu_config SET config_order='11' WHERE config_name='dateformat';
UPDATE ldu_config SET config_order='11' WHERE config_name='formatmonthday';
UPDATE ldu_config SET config_order='11' WHERE config_name='formatyearmonthday';
UPDATE ldu_config SET config_order='11' WHERE config_name='formatmonthdayhourmin';
UPDATE ldu_config SET config_order='11' WHERE config_name='servertimezone';
