@@ -886,42 +886,41 @@ function send_notification_email($template, $placeholders, $recipients) {
886886 }
887887 send_notification_email ('web_quota_ok_notification ' , $ placeholders , $ recipients );
888888 }
889+ } else {
889890
890- continue ;
891- }
892-
893- // could a notification be sent?
894- $ send_notification = false ;
895- if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
896- elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
891+ // could a notification be sent?
892+ $ send_notification = false ;
893+ if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
894+ elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
897895
898- //* Send quota notifications
899- if (($ web_config ['overquota_notify_admin ' ] == 'y ' || $ web_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
900- $ app ->dbmaster ->datalogUpdate ('web_domain ' , "last_quota_notification = CURDATE() " , 'domain_id ' , $ rec ['domain_id ' ]);
896+ //* Send quota notifications
897+ if (($ web_config ['overquota_notify_admin ' ] == 'y ' || $ web_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
898+ $ app ->dbmaster ->datalogUpdate ('web_domain ' , "last_quota_notification = CURDATE() " , 'domain_id ' , $ rec ['domain_id ' ]);
901899
902- $ placeholders = array ('{domain} ' => $ rec ['domain ' ],
903- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
904- '{used} ' => $ rec ['used ' ],
905- '{soft} ' => $ rec ['soft ' ],
906- '{hard} ' => $ rec ['hard ' ],
907- '{ratio} ' => $ rec ['ratio ' ]);
900+ $ placeholders = array ('{domain} ' => $ rec ['domain ' ],
901+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
902+ '{used} ' => $ rec ['used ' ],
903+ '{soft} ' => $ rec ['soft ' ],
904+ '{hard} ' => $ rec ['hard ' ],
905+ '{ratio} ' => $ rec ['ratio ' ]);
908906
909- $ recipients = array ();
907+ $ recipients = array ();
910908
911- //* send email to admin
912- if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_notify_admin ' ] == 'y ' ) {
913- $ recipients [] = $ global_config ['admin_mail ' ];
914- }
909+ //* send email to admin
910+ if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_notify_admin ' ] == 'y ' ) {
911+ $ recipients [] = $ global_config ['admin_mail ' ];
912+ }
915913
916- //* Send email to client
917- if ($ web_config ['overquota_notify_client ' ] == 'y ' ) {
918- $ client_group_id = $ rec ["sys_groupid " ];
919- $ 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 " );
920- if ($ client ['email ' ] != '' ) {
921- $ recipients [] = $ client ['email ' ];
914+ //* Send email to client
915+ if ($ web_config ['overquota_notify_client ' ] == 'y ' ) {
916+ $ client_group_id = $ rec ["sys_groupid " ];
917+ $ 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 " );
918+ if ($ client ['email ' ] != '' ) {
919+ $ recipients [] = $ client ['email ' ];
920+ }
922921 }
922+ send_notification_email ('web_quota_notification ' , $ placeholders , $ recipients );
923923 }
924- send_notification_email ('web_quota_notification ' , $ placeholders , $ recipients );
925924 }
926925 }
927926 }
@@ -1016,42 +1015,41 @@ function send_notification_email($template, $placeholders, $recipients) {
10161015
10171016 send_notification_email ('mail_quota_ok_notification ' , $ placeholders , $ recipients );
10181017 }
1018+ } else {
10191019
1020- continue ;
1021- }
1020+ //* Send quota notifications
1021+ // could a notification be sent?
1022+ $ send_notification = false ;
1023+ if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
1024+ elseif ($ mail_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ mail_config ['overquota_notify_freq ' ]) $ send_notification = true ;
10221025
1023- //* Send quota notifications
1024- // could a notification be sent?
1025- $ send_notification = false ;
1026- if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; // not yet notified
1027- elseif ($ mail_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ mail_config ['overquota_notify_freq ' ]) $ send_notification = true ;
1028-
1029- if (($ mail_config ['overquota_notify_admin ' ] == 'y ' || $ mail_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
1030- $ app ->dbmaster ->datalogUpdate ('mail_user ' , "last_quota_notification = CURDATE() " , 'mailuser_id ' , $ rec ['mailuser_id ' ]);
1031-
1032- $ placeholders = array ('{email} ' => $ rec ['email ' ],
1033- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
1034- '{used} ' => $ rec ['used ' ],
1035- '{name} ' => $ rec ['name ' ],
1036- '{quota} ' => $ rec ['quota ' ],
1037- '{ratio} ' => $ rec ['ratio ' ]);
1038-
1039- $ recipients = array ();
1040- //* send email to admin
1041- if ($ global_config ['admin_mail ' ] != '' && $ mail_config ['overquota_notify_admin ' ] == 'y ' ) {
1042- $ recipients [] = $ global_config ['admin_mail ' ];
1043- }
1026+ if (($ mail_config ['overquota_notify_admin ' ] == 'y ' || $ mail_config ['overquota_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
1027+ $ app ->dbmaster ->datalogUpdate ('mail_user ' , "last_quota_notification = CURDATE() " , 'mailuser_id ' , $ rec ['mailuser_id ' ]);
1028+
1029+ $ placeholders = array ('{email} ' => $ rec ['email ' ],
1030+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
1031+ '{used} ' => $ rec ['used ' ],
1032+ '{name} ' => $ rec ['name ' ],
1033+ '{quota} ' => $ rec ['quota ' ],
1034+ '{ratio} ' => $ rec ['ratio ' ]);
10441035
1045- //* Send email to client
1046- if ($ mail_config ['overquota_notify_client ' ] == 'y ' ) {
1047- $ client_group_id = $ rec ["sys_groupid " ];
1048- $ 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 " );
1049- if ($ client ['email ' ] != '' ) {
1050- $ recipients [] = $ client ['email ' ];
1036+ $ recipients = array ();
1037+ //* send email to admin
1038+ if ($ global_config ['admin_mail ' ] != '' && $ mail_config ['overquota_notify_admin ' ] == 'y ' ) {
1039+ $ recipients [] = $ global_config ['admin_mail ' ];
10511040 }
1052- }
10531041
1054- send_notification_email ('mail_quota_notification ' , $ placeholders , $ recipients );
1042+ //* Send email to client
1043+ if ($ mail_config ['overquota_notify_client ' ] == 'y ' ) {
1044+ $ client_group_id = $ rec ["sys_groupid " ];
1045+ $ 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 " );
1046+ if ($ client ['email ' ] != '' ) {
1047+ $ recipients [] = $ client ['email ' ];
1048+ }
1049+ }
1050+
1051+ send_notification_email ('mail_quota_notification ' , $ placeholders , $ recipients );
1052+ }
10551053 }
10561054 }
10571055 }
0 commit comments