X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fdaily%2Fdaily_birthday.php;h=4ff04e06348dc564d53616bf0d392a60a37bcaa1;hb=0f40501c47057cd677ddfc5a4d49eb6cf3659306;hp=64e89cebd493c4f782e820c86f123d2e4c62b2f1;hpb=2e715eb7f3f8ca8d259aacb4cbbddde7d9d18e01;p=mailer.git diff --git a/inc/daily/daily_birthday.php b/inc/daily/daily_birthday.php index 64e89cebd4..4ff04e0634 100644 --- a/inc/daily/daily_birthday.php +++ b/inc/daily/daily_birthday.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -42,6 +42,7 @@ if (!defined('__SECURITY')) { // Do not execute when script is in CSS mode return; } elseif (!isExtensionActive('birthday')) { + // Extension not active/installed logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.'); return; } @@ -54,14 +55,17 @@ $day = getDay(); $month = getMonth(); $year = getYear(); +// Init variable +$lastOnline = ''; + // Shall I include only active members? -$add = '%s'; $value = ''; -if ((getConfig('birthday_active')) && (isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) { - $add = " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})"; +if ((getConfig('birthday_active') == 'Y') && (isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) { + $add = ' AND (UNIX_TIMESTAMP() - `last_online`) < {?ap_inactive_since?}'; } // END - if // Only confirmed members shall receive birthday mails... -$result_birthday = SQL_QUERY_ESC("SELECT `userid`, `email`, `birth_year` +$result_birthday = SQL_QUERY_ESC("SELECT + `userid`,`email`,`birth_year` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE @@ -69,10 +73,10 @@ WHERE `birth_day`=%s AND `birth_month`=%s AND `birthday_sent` < (UNIX_TIMESTAMP() - ({?ONE_DAY?} * 364)) - ".$add." + ".$lastOnline." ORDER BY `userid` ASC", - array($day, $month, $value), __FILE__, __LINE__); + array($day, $month), __FILE__, __LINE__); if (!SQL_HASZERONUMS($result_birthday)) { // Start sending out birthday mails @@ -95,7 +99,7 @@ if (!SQL_HASZERONUMS($result_birthday)) { } // END - for // Insert row into database - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_birthday` (`userid`, `points`, `chk_value`) VALUES (%s,{?birthday_points?},'%s' )", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_birthday` (`userid`,`points`,`chk_value`) VALUES (%s,{?birthday_points?},'%s' )", array( bigintval($content['userid']), $content['check'] @@ -109,7 +113,7 @@ if (!SQL_HASZERONUMS($result_birthday)) { } // Send email - sendEmail($content['email'], '{--MEMBER_HAPPY_BIRTHDAY_SUBJECT--}', $message); + sendEmail($content['userid'], '{--MEMBER_HAPPY_BIRTHDAY_SUBJECT--}', $message); // Remember him that he has received a birthday mail SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",