From 0df155ce92219d7722a81dc7c8808660655d83bf Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 1 Aug 2016 11:46:29 +0200 Subject: Several fixes --- install/index.php | 2 +- install/upgrade.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'install') diff --git a/install/index.php b/install/index.php index d331f91..6844241 100644 --- a/install/index.php +++ b/install/index.php @@ -160,7 +160,7 @@ if (isset($_GET['create_folders'])) { if (isset($_GET['create_user'])) { $username = 'admin'; try { - $password = user::generateRandomPassword(); + $password = User::generateRandomPassword(); $user = User::create($_pdo, [$username, $password]); if ($user !== false) { echo "Created user '$username' ({$user->id}) with password '$password'."; diff --git a/install/upgrade.php b/install/upgrade.php index 7caf46e..0ebff57 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -91,16 +91,17 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.4.2')) { try { $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."payment` ( - `id` smallint(5) unsigned NOT NULL, + `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `offerId` smallint(5) unsigned NOT NULL, - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"); $offers = $_pdo->query("SELECT `id`,`payment_received` FROM `".Constants::db_prefix."offer` WHERE `payment_received` IS NOT NULL"); $offers = $offers->fetchAll(PDO::FETCH_ASSOC); foreach ($offers as $offer) { $stmt = $_pdo->prepare("INSERT IGNORE INTO `".Constants::db_prefix."payment` (`offerId`,`date`) VALUES (?,?)"); - $stmt->execute($offer['id'], $offer['payment_received']); + $stmt->execute([$offer['id'], $offer['payment_received']]); } $_pdo->query("ALTER TABLE `".Constants::db_prefix."offer` DROP `payment_received`;"); -- cgit v1.2.3