Kod:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="yet_another_award_system" active="1">
<title>Yet Another Award System 3.8</title>
<description>Yet Another Awards System for vBulletin 3.8.x</description>
<version>3.8.4</version>
<url>http://www.vbulletin.org/forum/showthread.php?t=196244</url>
<versioncheckurl><![CDATA[http://www.vbulletin.org/forum/misc.php?do=checkversion&t=196244]]></versioncheckurl>
<dependencies>
<dependency dependencytype="vbulletin" minversion="3.7" maxversion="" />
</dependencies>
<codes>
<code version="2.0.0">
<installcode><![CDATA[ // PRE-PRODUCT MANAGEMENT VERSION CHECKING
$db->reporterror = 0;
// Version checking for 1.0.0.
$award_table = $db->query_first("SELECT award_id FROM ".TABLE_PREFIX."award");
$award_cat_table = $db->query_first("SELECT award_cat_id FROM ".TABLE_PREFIX."award_cat");
if (($award_table['award_id']) AND ($award_cat_table['award_cat_id'])){
$installed_version = "1.0.0";
}
// UPGRADE FROM 1.0.0 CODE
if ($installed_version == "1.0.0") {
$db->query_write("DELETE FROM ".TABLE_PREFIX."settinggroup WHERE grouptitle LIKE 'awards'");
$db->query_write("DELETE FROM ".TABLE_PREFIX."setting WHERE grouptitle LIKE 'awards'");
$db->query_write("DELETE FROM ".TABLE_PREFIX."phrase WHERE (varname LIKE '%award%' OR varname LIKE 'setting_aw%') AND languageid = 0");
}
// NEW INSTALL CODE
if ($installed_version == null) {
echo "Adding Awards Tables<br /><br />";
$db->query_write("CREATE TABLE " . TABLE_PREFIX . "award (
award_id smallint(5) unsigned NOT NULL auto_increment,
award_cat_id smallint(5) NOT NULL default '1',
award_name varchar(50) NOT NULL default '',
award_desc varchar(250) NOT NULL default '',
award_icon_url varchar(250) NOT NULL default '',
award_img_url varchar(225) NOT NULL default '',
award_displayorder smallint(5) NOT NULL default '0',
PRIMARY KEY (award_id)
) TYPE=MyISAM
");
echo "<font size=\"1\">Added Table - award</font><br />";
$db->query_write("CREATE TABLE " . TABLE_PREFIX . "award_user (
issue_id smallint(5) NOT NULL auto_increment,
award_id smallint(5) NOT NULL default '0',
userid int(10) NOT NULL default '0',
issue_reason varchar(255) NOT NULL default '',
issue_time int(10) NOT NULL default '0',
PRIMARY KEY (issue_id)
) TYPE=MyISAM
");
echo "<font size=\"1\">Added Table - award_user</font><br />";
$db->query_write("CREATE TABLE " . TABLE_PREFIX . "award_cat (
award_cat_id mediumint(8) unsigned NOT NULL auto_increment,
award_cat_title varchar(100) NOT NULL default '',
award_cat_desc varchar(250) NOT NULL default '',
award_cat_displayorder mediumint(8) unsigned NOT NULL default '0',
award_cat_parentid mediumint(8) NOT NULL default '-1',
PRIMARY KEY (award_cat_id),
KEY award_cat_order (award_cat_displayorder)
) TYPE=MyISAM
");
echo "<font size=\"1\">Added Table - award_cat</font><br />";
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "award_cat
(award_cat_id, award_cat_title, award_cat_desc, award_cat_displayorder, award_cat_parentid)
VALUES (1, 'Default', 'Default category', 1, -1)
");
echo "<font size=\"1\">Inserted Default Catergory to table - award_cat</font><br />";
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "award
(award_id, award_cat_id, award_name, award_desc, award_icon_url, award_img_url, award_displayorder)
VALUES (1, 1, 'Default Blue', 'This is a default medal', '". $vbulletin->options['bburl'] ."/images/medals/medal-blue.gif','". $vbulletin->options['bburl'] ."/images/medals/medal-blue-gold.gif', 1)
");
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "award
(award_id, award_cat_id, award_name, award_desc, award_icon_url, award_img_url, award_displayorder)
VALUES (2, 1, 'Default Red', 'This is a default medal', '". $vbulletin->options['bburl'] ."/images/medals/medal-red.gif','". $vbulletin->options['bburl'] ."/images/medals/medal-red-gold.gif', 1)
");
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "award
(award_id, award_cat_id, award_name, award_desc, award_icon_url, award_img_url, award_displayorder)
VALUES (3, 1, 'Default Green', 'This is a default medal', '". $vbulletin->options['bburl'] ."/images/medals/medal-green.gif','". $vbulletin->options['bburl'] ."/images/medals/medal-star2.gif', 1)
");
echo "<font size=\"1\">Inserted Default Awards to table - award</font><br />";
}
$db->reporterror = 1;
]]></installcode>