@@ -292,42 +292,41 @@ function send_notification_email($template, $placeholders, $recipients) {
292292 }
293293 send_notification_email ('web_quota_ok_notification ' , $ placeholders , $ recipients );
294294 }
295+ } else {
295296
296- continue ;
297- }
298-
299- // could a notification be sent?
300- $ send_notification = false ;
301- if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
302- elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
297+ // could a notification be sent?
298+ $ send_notification = false ;
299+ if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
300+ elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
303301
304- //* Send quota notifications
305- if (($ web_config ['overquota_notify_admin ' ] == 'y ' || $ web_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
306- $ app ->dbmaster ->datalogUpdate ('web_domain ' , "last_quota_notification = CURDATE() " , 'domain_id ' , $ rec ['domain_id ' ]);
302+ //* Send quota notifications
303+ if (($ web_config ['overquota_notify_admin ' ] == 'y ' || $ web_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
304+ $ app ->dbmaster ->datalogUpdate ('web_domain ' , "last_quota_notification = CURDATE() " , 'domain_id ' , $ rec ['domain_id ' ]);
307305
308- $ placeholders = array ('{domain} ' => $ rec ['domain ' ],
309- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
310- '{used} ' => $ rec ['used ' ],
311- '{soft} ' => $ rec ['soft ' ],
312- '{hard} ' => $ rec ['hard ' ],
313- '{ratio} ' => $ rec ['ratio ' ]);
306+ $ placeholders = array ('{domain} ' => $ rec ['domain ' ],
307+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
308+ '{used} ' => $ rec ['used ' ],
309+ '{soft} ' => $ rec ['soft ' ],
310+ '{hard} ' => $ rec ['hard ' ],
311+ '{ratio} ' => $ rec ['ratio ' ]);
314312
315- $ recipients = array ();
313+ $ recipients = array ();
316314
317- //* send email to admin
318- if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_notify_admin ' ] == 'y ' ) {
319- $ recipients [] = $ global_config ['admin_mail ' ];
320- }
315+ //* send email to admin
316+ if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_notify_admin ' ] == 'y ' ) {
317+ $ recipients [] = $ global_config ['admin_mail ' ];
318+ }
321319
322- //* Send email to client
323- if ($ web_config ['overquota_notify_client ' ] == 'y ' ) {
324- $ client_group_id = $ rec ["sys_groupid " ];
325- $ client = $ app ->db ->queryOneRecord ("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
326- if ($ client ['email ' ] != '' ) {
327- $ recipients [] = $ client ['email ' ];
320+ //* Send email to client
321+ if ($ web_config ['overquota_notify_client ' ] == 'y ' ) {
322+ $ client_group_id = $ rec ["sys_groupid " ];
323+ $ client = $ app ->db ->queryOneRecord ("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
324+ if ($ client ['email ' ] != '' ) {
325+ $ recipients [] = $ client ['email ' ];
326+ }
328327 }
328+ send_notification_email ('web_quota_notification ' , $ placeholders , $ recipients );
329329 }
330- send_notification_email ('web_quota_notification ' , $ placeholders , $ recipients );
331330 }
332331 }
333332 }
@@ -422,42 +421,41 @@ function send_notification_email($template, $placeholders, $recipients) {
422421
423422 send_notification_email ('mail_quota_ok_notification ' , $ placeholders , $ recipients );
424423 }
424+ } else {
425425
426- continue ;
427- }
426+ //* Send quota notifications
427+ // could a notification be sent?
428+ $ send_notification = false ;
429+ if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
430+ elseif ($ mail_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ mail_config ['overquota_notify_freq ' ]) $ send_notification = true ;
428431
429- //* Send quota notifications
430- // could a notification be sent?
431- $ send_notification = false ;
432- if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
433- elseif ($ mail_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ mail_config ['overquota_notify_freq ' ]) $ send_notification = true ;
434-
435- if (($ mail_config ['overquota_notify_admin ' ] == 'y ' || $ mail_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
436- $ app ->dbmaster ->datalogUpdate ('mail_user ' , "last_quota_notification = CURDATE() " , 'mailuser_id ' , $ rec ['mailuser_id ' ]);
437-
438- $ placeholders = array ('{email} ' => $ rec ['email ' ],
439- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
440- '{used} ' => $ rec ['used ' ],
441- '{name} ' => $ rec ['name ' ],
442- '{quota} ' => $ rec ['quota ' ],
443- '{ratio} ' => $ rec ['ratio ' ]);
444-
445- $ recipients = array ();
446- //* send email to admin
447- if ($ global_config ['admin_mail ' ] != '' && $ mail_config ['overquota_notify_admin ' ] == 'y ' ) {
448- $ recipients [] = $ global_config ['admin_mail ' ];
449- }
432+ if (($ mail_config ['overquota_notify_admin ' ] == 'y ' || $ mail_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
433+ $ app ->dbmaster ->datalogUpdate ('mail_user ' , "last_quota_notification = CURDATE() " , 'mailuser_id ' , $ rec ['mailuser_id ' ]);
434+
435+ $ placeholders = array ('{email} ' => $ rec ['email ' ],
436+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
437+ '{used} ' => $ rec ['used ' ],
438+ '{name} ' => $ rec ['name ' ],
439+ '{quota} ' => $ rec ['quota ' ],
440+ '{ratio} ' => $ rec ['ratio ' ]);
450441
451- //* Send email to client
452- if ($ mail_config ['overquota_notify_client ' ] == 'y ' ) {
453- $ client_group_id = $ rec ["sys_groupid " ];
454- $ client = $ app ->db ->queryOneRecord ("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
455- if ($ client ['email ' ] != '' ) {
456- $ recipients [] = $ client ['email ' ];
442+ $ recipients = array ();
443+ //* send email to admin
444+ if ($ global_config ['admin_mail ' ] != '' && $ mail_config ['overquota_notify_admin ' ] == 'y ' ) {
445+ $ recipients [] = $ global_config ['admin_mail ' ];
457446 }
458- }
459447
460- send_notification_email ('mail_quota_notification ' , $ placeholders , $ recipients );
448+ //* Send email to client
449+ if ($ mail_config ['overquota_notify_client ' ] == 'y ' ) {
450+ $ client_group_id = $ rec ["sys_groupid " ];
451+ $ client = $ app ->db ->queryOneRecord ("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
452+ if ($ client ['email ' ] != '' ) {
453+ $ recipients [] = $ client ['email ' ];
454+ }
455+ }
456+
457+ send_notification_email ('mail_quota_notification ' , $ placeholders , $ recipients );
458+ }
461459 }
462460 }
463461 }
0 commit comments