From 2d55583e262436e3c7baee24fcbe5c224a748770 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 5 Nov 2009 16:08:01 +0000 Subject: [PATCH] Some code moved --- inc/libs/rallye_functions.php | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 331687eb51..22ddd6cb3d 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -321,6 +321,7 @@ LIMIT 1", __FUNCTION__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Init variables $min_users = '0'; $min_prices = '0'; + // Load data if (getExtensionVersion('rallye') >= '0.2.0') { list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result); @@ -331,21 +332,6 @@ LIMIT 1", __FUNCTION__, __LINE__); // Free result SQL_FREERESULT($result); - // Check if line is already included... - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1", - array(bigintval($id), bigintval($userid)), __FUNCTION__, __LINE__); - - // Is this user added? - if (SQL_NUMROWS($result) == '0') { - // Add userid and his ref count to table - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` (`rallye_id`, `userid`, `refs`) -VALUES ('%s','%s',0)", - array(bigintval($id), bigintval($userid)), __FUNCTION__, __LINE__); - } // END - if - - // Free memory - SQL_FREERESULT($result); - if ($notify == 'Y') { // Transfer all neccessary data to the global $content array $content['start'] = generateDateTime($start, 2); @@ -367,6 +353,27 @@ VALUES ('%s','%s',0)", $message = loadEmailTemplate('member_rallye_notify', $content, $userid); sendEmail($userid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message); } // END - if + + // Check if line is already included... + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1", + array( + bigintval($id), + bigintval($userid) + ), __FUNCTION__, __LINE__); + + // Is this user added? + if (SQL_NUMROWS($result) < 1) { + // Add userid and his ref count to table + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` (`rallye_id`, `userid`, `refs`) +VALUES ('%s','%s',0)", + array( + bigintval($id), + bigintval($userid) + ), __FUNCTION__, __LINE__); + } // END - if + + // Free memory + SQL_FREERESULT($result); } // END - if } -- 2.30.2