<?
if (!defined('INSTALL_MODULES')) {
	die ("You can't access this file directly...");
}

if ((!is_god($admin)) && (!is_user($user)) && (!is_admin($admin))) { 
redirect_url("".$admin_file.".php?op=modules"); }


$result1 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_accesses(
  `username` varchar(60) NOT NULL default '',
  `downloads` int(11) NOT NULL default '0',
  `uploads` int(11) NOT NULL default '0',
  PRIMARY KEY  (`username`))");

################################################################################

$result2 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_categories(
   `cid` int(11) NOT NULL auto_increment,
  `title` varchar(50) NOT NULL default '',
  `cdescription` text NOT NULL,
  `parentid` int(11) NOT NULL default '0',
  `whoadd` tinyint(2) NOT NULL default '0',
  `uploaddir` varchar(255) NOT NULL default '',
  `canupload` tinyint(2) NOT NULL default '0',
  `active` tinyint(2) NOT NULL default '1',
  PRIMARY KEY  (`cid`),
  KEY `cid` (`cid`),
  KEY `title` (`title`))");

################################################################################

$result3 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_config(
   `config_name` varchar(255) NOT NULL default '',
  `config_value` text NOT NULL,
  PRIMARY KEY  (`config_name`))");

$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('admperpage', '50')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('blockunregmodify', '0')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('dateformat', 'D M j G:i:s T Y')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('mostpopular', '25')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('mostpopulartrig', '0')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('perpage', '10')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('popular', '500')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('results', '10')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('show_download', '0')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('show_links_num', '0')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('usegfxcheck', '0')");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_config VALUES ('version_number', '1.0.2')");

################################################################################

$result4 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_downloads(
  `lid` int(11) NOT NULL auto_increment,
  `cid` int(11) NOT NULL default '0',
  `sid` int(11) NOT NULL default '0',
  `title` varchar(100) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `name` varchar(100) NOT NULL default '',
  `email` varchar(100) NOT NULL default '',
  `hits` int(11) NOT NULL default '0',
  `submitter` varchar(60) NOT NULL default '',
  `sub_ip` varchar(16) NOT NULL default '0.0.0.0',
  `filesize` bigint(20) NOT NULL default '0',
  `version` varchar(20) NOT NULL default '',
  `homepage` varchar(255) NOT NULL default '',
  `active` tinyint(2) NOT NULL default '1',
  PRIMARY KEY  (`lid`),
  KEY `lid` (`lid`),
  KEY `cid` (`cid`),
  KEY `sid` (`sid`),
  KEY `title` (`title`))");

################################################################################

$result5 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_extensions(
  `eid` int(11) NOT NULL auto_increment,
  `ext` varchar(6) NOT NULL default '',
  `file` tinyint(1) NOT NULL default '0',
  `image` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`eid`),
  KEY `ext` (`eid`))");

$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (1, '.ace', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (2, '.arj', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (3, '.bz', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (4, '.bz2', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (5, '.cab', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (6, '.exe', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (7, '.gif', 0, 1)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (8, '.gz', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (9, '.iso', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (10, '.jpeg', 0, 1)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (11, '.jpg', 0, 1)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (12, '.lha', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (13, '.lzh', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (14, '.png', 0, 1)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (15, '.rar', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (16, '.tar', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (17, '.tgz', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (18, '.uue', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (19, '.zip', 1, 0)");
$db2->sql_query("INSERT INTO ".$prefix_install."_nsngd_extensions VALUES (20, '.zoo', 1, 0)");
################################################################################
$result6 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_mods(
  `rid` int(11) NOT NULL auto_increment,
  `lid` int(11) NOT NULL default '0',
  `cid` int(11) NOT NULL default '0',
  `sid` int(11) NOT NULL default '0',
  `title` varchar(100) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `modifier` varchar(60) NOT NULL default '',
  `sub_ip` varchar(16) NOT NULL default '0.0.0.0',
  `brokendownload` int(3) NOT NULL default '0',
  `name` varchar(100) NOT NULL default '',
  `email` varchar(100) NOT NULL default '',
  `filesize` bigint(20) NOT NULL default '0',
  `version` varchar(20) NOT NULL default '',
  `homepage` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`rid`),
  UNIQUE KEY `rid` (`rid`))");

################################################################################

$result7 = $db2->sql_query("CREATE TABLE ".$prefix_install."_nsngd_new(
  `lid` int(11) NOT NULL auto_increment,
  `cid` int(11) NOT NULL default '0',
  `sid` int(11) NOT NULL default '0',
  `title` varchar(100) NOT NULL default '',
  `url` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `name` varchar(100) NOT NULL default '',
  `email` varchar(100) NOT NULL default '',
  `submitter` varchar(60) NOT NULL default '',
  `sub_ip` varchar(16) NOT NULL default '0.0.0.0',
  `filesize` bigint(20) NOT NULL default '0',
  `version` varchar(20) NOT NULL default '',
  `homepage` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`lid`),
  KEY `lid` (`lid`),
  KEY `cid` (`cid`),
  KEY `sid` (`sid`),
  KEY `title` (`title`))");

?>