From 0158fa142c80d928a0f118929bd17c7c7fe717fe Mon Sep 17 00:00:00 2001 From: quix0r Date: Thu, 30 Jun 2011 04:23:47 +0000 Subject: [PATCH] Table user_book renamed to user_booking, isExtensionOlder() should not be used, instead use isExtensionInstalledAndOlder() --- inc/extensions/ext-booking.php | 6 +++--- inc/libs/booking_functions.php | 11 ++++++++--- inc/libs/user_functions.php | 4 ++-- inc/modules/member/what-points.php | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 5ec0c9e5c1..20c60dd08f 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -56,8 +56,8 @@ switch (getExtensionMode()) { addConfigAddSql('booking_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 3)); // Drop/create table for user bookings - addDropTableSql('user_book'); - addCreateTableSql('user_book', "( + addDropTableSql('user_booking'); + addCreateTableSql('user_booking', "( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `subject` VARCHAR(255) NOT NULL DEFAULT 'missing', @@ -82,7 +82,7 @@ PRIMARY KEY (`id`) break; case 'remove': // Do stuff when removing extension - addDropTableSql('user_book'); + addDropTableSql('user_booking'); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_booking','list_booking')"); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='booking'"); diff --git a/inc/libs/booking_functions.php b/inc/libs/booking_functions.php index ad4601c0e4..02ac68ede6 100644 --- a/inc/libs/booking_functions.php +++ b/inc/libs/booking_functions.php @@ -43,14 +43,19 @@ if (!defined('__SECURITY')) { // Add a record entry ("mode" can be add/sub!) function addBookingRecord ($subject, $userid, $points, $mode) { // Is the sql_patches updated? - if (isExtensionOlder('sql_patches', '0.5.7')) { + if (isExtensionInstalledAndOlder('sql_patches', '0.5.7')) { // Abort here return; } // END - if // Add record entry here - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_book` (`userid`,`subject`,`mode`,`points`) VALUES(%s,'%s','%s',%s)", - array($userid, $subject, $mode, $points), __FUNCTION__, __LINE__); + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_booking` (`userid`,`subject`,`mode`,`points`) VALUES(%s,'%s','%s',%s)", + array( + bigintval($userid), + $subject, + $mode, + $points + ), __FUNCTION__, __LINE__); } // [EOF] diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index bcbff3049a..2fcebafc1d 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -485,7 +485,7 @@ function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') { } // END - if // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) { // Return zero here return $data['inserted']; } // END - if @@ -522,7 +522,7 @@ LIMIT 1", // Inserts user stats function insertUserStatsRecord ($userid, $statsType, $statsData) { // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) { // Return zero here return false; } // END - if diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index 08e9b396cc..87f69f4207 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -150,7 +150,7 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu } elseif ((isExtensionActive('bonus')) && (!isBonusRallyeActive())) { // Bonus active rallye deactivated $content['special_rows'] = loadTemplate('member_points_bonus_disabled', true); -} elseif ((isAdmin()) && (isExtensionOlder('bonus', '0.2.2')) && (isExtensionActive('bonus'))) { +} elseif ((isAdmin()) && (isExtensionInstalledAndOlder('bonus', '0.2.2')) && (isExtensionActive('bonus'))) { // Please upgrade your bonus extension to v0.2.2 or newer! $content['special_rows'] = loadTemplate('member_points_upgrade'); } -- 2.39.5