diff --git a/common.php b/common.php index 6454d09b..6bd587e7 100644 --- a/common.php +++ b/common.php @@ -27,7 +27,7 @@ session_start(); define('MYAAC', true); define('MYAAC_VERSION', '0.7.10-dev'); -define('DATABASE_VERSION', 21); +define('DATABASE_VERSION', 22); define('TABLE_PREFIX', 'myaac_'); define('START_TIME', microtime(true)); define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX')); diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php index 5d34f5a2..6cc1d987 100644 --- a/install/steps/7-finish.php +++ b/install/steps/7-finish.php @@ -178,14 +178,17 @@ else { } // update config.highscores_ids_hidden - require_once(SYSTEM . 'migrations/20.php'); $database_migration_20 = true; + require_once(SYSTEM . 'migrations/20.php'); $content = ''; if(!databaseMigration20($content)) { $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.local.php', $locale['step_database_error_file']); warning($locale['step_database_error_file'] . '
'); } + + // add z_polls tables + require_once(SYSTEM . 'migrations/22.php'); $locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']); $locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']); diff --git a/system/migrations/22.php b/system/migrations/22.php new file mode 100644 index 00000000..fd166402 --- /dev/null +++ b/system/migrations/22.php @@ -0,0 +1,26 @@ +query(' +CREATE TABLE `z_polls` ( + `id` int(11) NOT NULL auto_increment, + `question` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + `end` int(11) NOT NULL DEFAULT 0, + `start` int(11) NOT NULL DEFAULT 0, + `answers` int(11) NOT NULL DEFAULT 0, + `votes_all` int(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;'); + +if(!tableExist('z_polls_answers')) +$db->query(' + CREATE TABLE `z_polls_answers` ( + `poll_id` int(11) NOT NULL, + `answer_id` int(11) NOT NULL, + `answer` varchar(255) NOT NULL, + `votes` int(11) NOT NULL DEFAULT 0 +) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); + +if(!fieldExist('vote', 'accounts')) + $db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;'); \ No newline at end of file diff --git a/system/pages/polls.php b/system/pages/polls.php index b97919fb..cf1843fe 100644 --- a/system/pages/polls.php +++ b/system/pages/polls.php @@ -13,31 +13,6 @@ $title = 'Polls'; /* Polls System By Averatec from pervera.pl & otland.net */ -if(!tableExist('z_polls')) - $db->query(' -CREATE TABLE `z_polls` ( - `id` int(11) NOT NULL auto_increment, - `question` varchar(255) NOT NULL, - `description` varchar(255) NOT NULL, - `end` int(11) NOT NULL DEFAULT 0, - `start` int(11) NOT NULL DEFAULT 0, - `answers` int(11) NOT NULL DEFAULT 0, - `votes_all` int(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;'); - -if(!tableExist('z_polls_answers')) -$db->query(' - CREATE TABLE `z_polls_answers` ( - `poll_id` int(11) NOT NULL, - `answer_id` int(11) NOT NULL, - `answer` varchar(255) NOT NULL, - `votes` int(11) NOT NULL DEFAULT 0 -) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); - -if(!fieldExist('vote', 'accounts')) - $db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;'); - function getColorByPercent($percent) { if($percent < 15)