| Conditions | 2 |
| Paths | 2 |
| Total Lines | 28 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 3 | function sn_user_birthday_celebrate() { |
||
| 4 | sn_db_transaction_start(); |
||
| 5 | |||
| 6 | $query = DBStaticUser::db_user_list_to_celebrate(classSupernova::$config->user_birthday_range); |
||
| 7 | |||
| 8 | while ($row = db_fetch($query)) { |
||
| 9 | $row['username'] = db_escape($row['username']); |
||
| 10 | rpg_points_change( |
||
| 11 | $row['id'], |
||
| 12 | RPG_BIRTHDAY, |
||
| 13 | classSupernova::$config->user_birthday_gift, |
||
| 14 | "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}" |
||
| 15 | ); |
||
| 16 | DBStaticUser::db_user_set_by_id($row['id'], "`user_birthday_celebrated` = '{$row['current_birthday']}'"); |
||
| 17 | |||
| 18 | $message = sprintf( |
||
| 19 | classLocale::$lang['sys_birthday_message'], |
||
| 20 | $row['username'], |
||
| 21 | $row['current_birthday'], |
||
| 22 | classSupernova::$config->user_birthday_gift, |
||
| 23 | classLocale::$lang['sys_dark_matter_sh'] |
||
| 24 | ); |
||
| 25 | DBStaticMessages::msgSendFromAdmin($row['id'], classLocale::$lang['sys_birthday'], $message, true, true); |
||
| 26 | } |
||
| 27 | |||
| 28 | classSupernova::$config->db_saveItem('user_birthday_celebrate', SN_TIME_NOW); |
||
| 29 | sn_db_transaction_commit(); |
||
| 30 | } |
||
| 31 |