X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Freset%2Freset_holiday.php;h=e678d588086df6a3359c6d8149943f939309d256;hb=f94266632bde6b5eda847aa62ef9c43c61afa60f;hp=b08a8deb34f52a883168b37025ab157351d1f777;hpb=595f8c580b79c347fad020d82dff9c2dd44334bd;p=mailer.git diff --git a/inc/reset/reset_holiday.php b/inc/reset/reset_holiday.php index b08a8deb34..e678d58808 100644 --- a/inc/reset/reset_holiday.php +++ b/inc/reset/reset_holiday.php @@ -18,6 +18,7 @@ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -48,10 +49,16 @@ if ((getOutputMode() != 0) || ((!isResetModeEnabled()) && (getConfig('holiday_mo //* DEBUG: */ outputHtml(basename(__FILE__)."
"); // Check for holidays we need to enable and send email to user -$result_main = SQL_QUERY("SELECT userid, holiday_activated -FROM `{?_MYSQL_PREFIX?}_user_data` -WHERE holiday_activated > 0 AND holiday_activated < UNIX_TIMESTAMP() AND `holiday_active`='N' -ORDER BY holiday_activated", +$result_main = SQL_QUERY("SELECT + `userid`, `holiday_activated` +FROM + `{?_MYSQL_PREFIX?}_user_data` +WHERE + `holiday_activated` > 0 AND + `holiday_activated` < UNIX_TIMESTAMP() AND + `holiday_active`='N' +ORDER BY + `holiday_activated` ASC", __FILE__, __LINE__); // Entries found? @@ -62,11 +69,18 @@ if (SQL_NUMROWS($result_main) > 0) { // We have found at least one useraccount so let's check it... while ($content = SQL_FETCHARRAY($result_main)) { // Check if his holiday can be activated - $result_holiday = SQL_QUERY_ESC("SELECT holiday_start, holiday_end -FROM `{?_MYSQL_PREFIX?}_user_holidays` -WHERE `userid`=%s AND holiday_start <= UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() + $result_holiday = SQL_QUERY_ESC("SELECT + `holiday_start`, `holiday_end` +FROM + `{?_MYSQL_PREFIX?}_user_holidays` +WHERE + `userid`=%s AND + `holiday_start` <= UNIX_TIMESTAMP() AND + `holiday_end` > UNIX_TIMESTAMP() LIMIT 1", - array(bigintval($content['userid'])), __FILE__, __LINE__); + array(bigintval($content['userid'])), __FILE__, __LINE__); + + // Do we have an entry? if (SQL_NUMROWS($result_holiday) == 1) { // Okay, this user can be send away to holiday... $content = merge_array($content, SQL_FETCHARRAY($result_holiday)); @@ -83,9 +97,12 @@ LIMIT 1", sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $message); // Update account - addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` -SET `holiday_active`='Y' -WHERE `userid`=%s + addSql(SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_user_data` +SET + `holiday_active`='Y' +WHERE + `userid`=%s LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__, false)); } // END - if @@ -96,7 +113,7 @@ LIMIT 1", // Run all SQLs runFilterChain('run_sqls'); -} +} // END - if // Free memory SQL_FREERESULT($result_main);