<?php
//v1.0 www.exoops.info 2006/05
error_reporting(2039);
//---------------------------------------------------------------------------------------//
// Update mylinks
$sql[] = "CREATE TABLE ".$db->prefix("mylinks_comments")." (
			comment_id mediumint(8) unsigned NOT NULL auto_increment,
  			pid mediumint(8) unsigned NOT NULL default '0',
 			item_id mediumint(8) unsigned NOT NULL default '0',
  			date int(10) unsigned NOT NULL default '0',
  			user_id mediumint(8) unsigned NOT NULL default '0',
  			ip varchar(15) NOT NULL default '',
  			subject varchar(60) NOT NULL default '',
  			comment text NOT NULL,
  			allow_html tinyint(1) unsigned NOT NULL default '0',
  			allow_smileys tinyint(1) unsigned NOT NULL default '0',
  			allow_bbcode tinyint(1) unsigned NOT NULL default '0',
  			type enum('admin','user') NOT NULL default 'user',
  			icon varchar(255) NOT NULL default '',
  			PRIMARY KEY  (comment_id),
  			KEY idx (item_id))";
//---------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------//
// Update mydownloads
$sql[] = "CREATE TABLE ".$db->prefix("mydownloads_comments")." (
			comment_id mediumint(8) unsigned NOT NULL auto_increment,
  			pid mediumint(8) unsigned NOT NULL default '0',
 			item_id mediumint(8) unsigned NOT NULL default '0',
  			date int(10) unsigned NOT NULL default '0',
  			user_id mediumint(8) unsigned NOT NULL default '0',
  			ip varchar(15) NOT NULL default '',
  			subject varchar(60) NOT NULL default '',
  			comment text NOT NULL,
  			allow_html tinyint(1) unsigned NOT NULL default '0',
  			allow_smileys tinyint(1) unsigned NOT NULL default '0',
  			allow_bbcode tinyint(1) unsigned NOT NULL default '0',
  			type enum('admin','user') NOT NULL default 'user',
  			icon varchar(255) NOT NULL default '',
  			PRIMARY KEY  (comment_id),
  			KEY idx (item_id))";
//---------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------//
// Create mime table
$sql[] = "CREATE TABLE `".$db->prefix("mimes")."` (
`id` MEDIUMINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`mime` VARCHAR( 100 ) NOT NULL ,
`extension` VARCHAR( 10 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM" ;
//---------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------//
// Fill mime
$sql[] = "INSERT INTO `".$db->prefix("mimes")."` ( `id` , `mime` , `extension` )
VALUES ( '', 'application/x-gzip', '.gz'),
('', 'application/gzip', '.gz'),
('', 'application/octet-stream', '.zip'),
('', 'application/x-zip', '.zip'),
('', 'application/x-tar', '.tar'),
('', 'application/x-rar', '.rar'),
('', 'application/x-ace', '.ace'),
('', 'text/plain', '.php'),
('', 'text/html', '.html'),
('', 'image/bmp', '.bmp'),
('', 'image/gif', '.gif'),
('', 'image/jpg', '.jpg'),
('', 'image/pjpeg', '.jpeg'),
('', 'image/jpeg', '.jpeg'),
('', 'image/png', '.png'),
('', 'image/x-png', '.png'),
('', 'audio/mpeg', '.mp3'),
('', 'application/pdf', '.pdf')
";
//---------------------------------------------------------------------------------------//
// Execute the above SQL
$count = count($sql);
for ($i=0; $i<$count; $i++) {
	$db->query($sql[$i]) or print("<li>".$db->error()."</li><br />");
}
//---------------------------------------------------------------------------------------//
// Now update the modules
include_once(XOOPS_ROOT_PATH."/class/xoopsmodule.php");
$modules =& XoopsModule::getInstalledModules();
foreach ($modules as $module) {
	switch($module->dirname) {
		case 'news':
			@$module->update();
			break;
		case 'mydownloads':
			@$module->update();
			break;
		case 'mylinks':
			@$module->update();
			break;
	}
}
//---------------------------------------------------------------------------------------//
?>
