X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fdaily%2Fdaily_birthday.php;h=2b6bcc195215858acb3717086b5d9cacd50dbe58;hp=97f8b3775b4826f21860e0ec6ede3ca1ebf0dfa3;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=cd7d344ea7007cfa20413acd3e03e50f0ab86d86 diff --git a/inc/daily/daily_birthday.php b/inc/daily/daily_birthday.php index 97f8b3775b..2b6bcc1952 100644 --- a/inc/daily/daily_birthday.php +++ b/inc/daily/daily_birthday.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Versendet Geburtstagsmails beim Reset * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -60,19 +55,13 @@ $lastOnline = ''; $excludeSql = ''; // Shall I include only active members? +// @TODO Move this out to an extension if ((getConfig('birthday_active') == 'Y') && (isExtensionActive('autopurge')) && ((getApInactiveSince() > 0))) { $excludeSql = ' AND (UNIX_TIMESTAMP() - `d`.`last_online`) < {?ap_inactive_since?}'; } // END - if -// Is ext-holiday installed? -// @TODO Rewrite these if() blocks to a filter -if (isExtensionActive('holiday')) { - // Exclude those as well - $excludeSql .= " AND `d`.`holiday_active`='N'"; -} // END - if - // Only confirmed members shall receive birthday mails... -$result_birthday = SQL_QUERY_ESC("SELECT +$result_birthday = sqlQueryEscaped("SELECT `d`.`userid`, `d`.`email`, `d`.`birth_year` @@ -80,7 +69,7 @@ FROM `{?_MYSQL_PREFIX?}_user_data` AS `d` WHERE `d`.`status`='CONFIRMED' - " . runFilterChain('user_exclusion_sql', $excludeSql) . " AND + " . runFilterChain('user_exclusion_sql', ' ' . $excludeSql) . " AND `d`.`birth_day`=%s AND `d`.`birth_month`=%s AND `d`.`birthday_sent` < (UNIX_TIMESTAMP() - ({?ONE_DAY?} * 364)) @@ -89,9 +78,9 @@ ORDER BY `d`.`userid` ASC", array($day, $month), __FILE__, __LINE__); -if (!SQL_HASZERONUMS($result_birthday)) { +if (!ifSqlHasZeroNumRows($result_birthday)) { // Start sending out birthday mails - while ($content = SQL_FETCHARRAY($result_birthday)) { + while ($content = sqlFetchArray($result_birthday)) { // Calculate own timestamp for birthday and today $bd = $content['birth_year'] + 12 * $month + 365 * $day; $now = $year + 12 * $month + 365 * $day; @@ -110,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' )", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_birthday` (`userid`, `points`, `chk_value`) VALUES (%s,{?birthday_points?},'%s' )", array( bigintval($content['userid']), $content['check'] @@ -127,12 +116,12 @@ if (!SQL_HASZERONUMS($result_birthday)) { 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", + sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1", array(bigintval($content['userid'])), __FILE__, __LINE__); } // END - while // Free memory - SQL_FREERESULT($result_birthday); + sqlFreeResult($result_birthday); } // END - if // Debug line