From 9f31f901461bf6a07bf269e01dc762ea1277d068 Mon Sep 17 00:00:00 2001 From: Tornadia <32970897+tornadia@users.noreply.github.com> Date: Fri, 19 Apr 2019 16:28:38 -0400 Subject: [PATCH] Fixing some errors at the install endscreen (#75) * Fixed some bugs at last install screen (unset country and HTTPS protocol definition) * Correction: allow_url_fopen is not to make any distinction between HTTP/HTTPS * Black skull bug when joining serverInfo * * latin is good but utf8 is better * also changed ENGINE to InnoDB * * use curl as alternative option for reporting install * * you forgot this * * fix typo * Revert "* fix typo" This reverts commit 6f24509dd659032c65c3ccbdf5b5bb3b25cffd72. * * fix typo * * this is the correct way to hide that notice --- install/includes/schema.sql | 44 ++++++++++++++++----------------- install/steps/7-finish.php | 13 +++++++++- install/tools/5-database.php | 4 +-- system/libs/pot/OTS_Account.php | 4 +-- system/pages/serverinfo.php | 6 ++--- 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/install/includes/schema.sql b/install/includes/schema.sql index b9938067..08339856 100644 --- a/install/includes/schema.sql +++ b/install/includes/schema.sql @@ -6,7 +6,7 @@ CREATE TABLE `myaac_account_actions` `date` INT(11) NOT NULL DEFAULT 0, `action` VARCHAR(255) NOT NULL DEFAULT '', KEY (`account_id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_admin_menu` ( @@ -17,7 +17,7 @@ CREATE TABLE `myaac_admin_menu` `flags` INT(11) NOT NULL DEFAULT 0, `enabled` INT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_bugtracker` ( @@ -32,7 +32,7 @@ CREATE TABLE `myaac_bugtracker` `uid` INT(11) NOT NULL AUTO_INCREMENT, `tag` INT(11) NOT NULL DEFAULT 0, PRIMARY KEY (`uid`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_changelog` ( @@ -44,7 +44,7 @@ CREATE TABLE `myaac_changelog` `player_id` INT(11) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; INSERT INTO `myaac_changelog` (`id`, `type`, `where`, `date`, `body`, `hidden`) VALUES (1, 3, 2, UNIX_TIMESTAMP(), 'MyAAC installed. (:', 0); @@ -57,7 +57,7 @@ CREATE TABLE `myaac_commands` `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE (`words`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_config` ( @@ -66,7 +66,7 @@ CREATE TABLE `myaac_config` `value` VARCHAR(1000) NOT NULL, PRIMARY KEY (`id`), UNIQUE (`name`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_faq` ( @@ -76,7 +76,7 @@ CREATE TABLE `myaac_faq` `ordering` INT(11) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_forum_boards` ( @@ -89,7 +89,7 @@ CREATE TABLE `myaac_forum_boards` `closed` TINYINT(1) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1); INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Trade', 'Trade offers.', 1); INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`) VALUES (NULL, 'Quests', 'Quest making.', 2); @@ -118,7 +118,7 @@ CREATE TABLE `myaac_forum` `closed` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `section` (`section`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_hooks` ( @@ -129,7 +129,7 @@ CREATE TABLE `myaac_hooks` `ordering` INT(11) NOT NULL DEFAULT 0, `enabled` INT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_items` ( @@ -139,7 +139,7 @@ CREATE TABLE `myaac_items` `plural` VARCHAR(50) NOT NULL DEFAULT '', `attributes` VARCHAR(500) NOT NULL DEFAULT '', PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_menu` ( @@ -153,7 +153,7 @@ CREATE TABLE `myaac_menu` `ordering` INT(11) NOT NULL DEFAULT 0, `enabled` INT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; /* MENU_CATEGORY_NEWS kathrine */ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('kathrine', 'Latest News', 'news', 1, 0); @@ -240,7 +240,7 @@ CREATE TABLE `myaac_monsters` ( `race` varchar(255) NOT NULL, `loot` varchar(500) NOT NULL, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_videos` ( @@ -251,7 +251,7 @@ CREATE TABLE `myaac_videos` `ordering` INT(11) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_news` ( @@ -269,7 +269,7 @@ CREATE TABLE `myaac_news` `article_image` VARCHAR(100) NOT NULL DEFAULT '', `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_news_categories` ( @@ -279,7 +279,7 @@ CREATE TABLE `myaac_news_categories` `icon_id` INT(2) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 0); INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 1); @@ -295,7 +295,7 @@ CREATE TABLE `myaac_notepad` `content` TEXT NOT NULL, /*`public` TINYINT(1) NOT NULL DEFAULT 0*/ PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_pages` ( @@ -309,7 +309,7 @@ CREATE TABLE `myaac_pages` `access` TINYINT(2) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_gallery` ( @@ -321,7 +321,7 @@ CREATE TABLE `myaac_gallery` `ordering` INT(11) NOT NULL DEFAULT 0, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; INSERT INTO `myaac_gallery` (`id`, `ordering`, `comment`, `image`, `thumb`, `author`) VALUES (NULL, 1, 'Demon', 'images/gallery/demon.jpg', 'images/gallery/demon_thumb.gif', 'MyAAC'); @@ -344,7 +344,7 @@ CREATE TABLE `myaac_spells` `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE (`name`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_visitors` ( @@ -352,7 +352,7 @@ CREATE TABLE `myaac_visitors` `lastvisit` INT(11) NOT NULL DEFAULT 0, `page` VARCHAR(100) NOT NULL, UNIQUE (`ip`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; CREATE TABLE `myaac_weapons` ( @@ -361,4 +361,4 @@ CREATE TABLE `myaac_weapons` `maglevel` INT(11) NOT NULL DEFAULT 0, `vocations` VARCHAR(100) NOT NULL DEFAULT '', PRIMARY KEY (`id`) -) ENGINE = MyISAM; +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php index 953d8556..e026ff68 100644 --- a/install/steps/7-finish.php +++ b/install/steps/7-finish.php @@ -121,7 +121,18 @@ else { )); if(!isset($_SESSION['installed'])) { - file_get_contents('http://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL)); + $report_url = 'http://my-aac.org/report_install.php?v=' . MYAAC_VERSION . '&b=' . urlencode(BASE_URL); + if (function_exists('curl_version')) + { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $report_url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_exec($curl); + curl_close($curl); + } + else if (ini_get('allow_url_fopen') ) { + file_get_contents($report_url); + } $_SESSION['installed'] = true; } diff --git a/install/tools/5-database.php b/install/tools/5-database.php index e61516bf..0ad19a12 100644 --- a/install/tools/5-database.php +++ b/install/tools/5-database.php @@ -153,8 +153,8 @@ if(!$db->hasColumn('accounts', 'premium_points')) { } if(!$db->hasColumn('guilds', 'motd')) { - if(query("ALTER TABLE `guilds` MODIFY `motd` VARCHAR(255) NOT NULL DEFAULT '';")) - success($locale['step_database_modifying_field'] . ' guilds.motd...'); + if(query("ALTER TABLE `guilds` ADD `motd` VARCHAR(255) NOT NULL DEFAULT '';")) + success($locale['step_database_adding_field'] . ' guilds.motd...'); } if(!$db->hasColumn('guilds', 'description')) { diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 1daa642b..d655a812 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -39,7 +39,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable * @var array * @version 0.1.5 */ - private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0); + private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0); public static $cache = array(); /** @@ -398,7 +398,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable return $this->data['created']; } - + /** * Name. * diff --git a/system/pages/serverinfo.php b/system/pages/serverinfo.php index b3b21f19..9835395c 100644 --- a/system/pages/serverinfo.php +++ b/system/pages/serverinfo.php @@ -97,9 +97,9 @@ $twig->display('serverinfo.html.twig', array( 'dailyFragsToRedSkull' => isset($config['lua']['dailyFragsToRedSkull']) ? $config['lua']['dailyFragsToRedSkull'] : $config['lua']['kills_per_day_red_skull'], 'weeklyFragsToRedSkull' => isset($config['lua']['weeklyFragsToRedSkull']) ? $config['lua']['weeklyFragsToRedSkull'] : $config['lua']['kills_per_week_red_skull'], 'monthlyFragsToRedSkull' => isset($config['lua']['monthlyFragsToRedSkull']) ? $config['lua']['monthlyFragsToRedSkull'] : $config['lua']['kills_per_month_red_skull'], - 'dailyFragsToBlackSkull' => isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : $config['lua']['kills_per_day_black_skull'], - 'weeklyFragsToBlackSkull' => isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : $config['lua']['kills_per_week_black_skull'], - 'monthlyFragsToBlackSkull' => isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : $config['lua']['kills_per_month_black_skull'], + 'dailyFragsToBlackSkull' => isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : isset($config['lua']['kills_per_day_black_skull']) ? $config['lua']['kills_per_day_black_skull'] : null, + 'weeklyFragsToBlackSkull' => isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : isset($config['lua']['kills_per_week_black_skull']) ? $config['lua']['kills_per_week_black_skull'] : null, + 'monthlyFragsToBlackSkull' => isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : isset($config['lua']['kills_per_month_black_skull']) ? $config['lua']['kills_per_month_black_skull'] : null, 'banishmentLength' => isset($config['lua']['banishment_length']) ? eval('return (' . $config['lua']['banishment_length'] . ') / (24 * 60 * 60);') : null, 'finalBanishmentLength' => isset($config['lua']['final_banishment_length']) ? eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);') : null, 'ipBanishmentLength' => isset($config['lua']['ip_banishment_length']) ? eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);') : null,