diff --git a/lib/init.php b/lib/init.php index 98c9fdf4..d33f0530 100644 --- a/lib/init.php +++ b/lib/init.php @@ -408,6 +408,8 @@ if(AREA == 'admin' || AREA == 'customer') } eval("\$header = \"" . getTemplate('header', '1') . "\";"); + +$current_year = date('Y', time()); eval("\$footer = \"" . getTemplate('footer', '1') . "\";"); if(isset($_POST['action'])) diff --git a/scripts/jobs/cron_usage.inc.diskspace.php b/scripts/jobs/cron_usage.inc.diskspace.php index 5b1d38a4..c52279f3 100644 --- a/scripts/jobs/cron_usage.inc.diskspace.php +++ b/scripts/jobs/cron_usage.inc.diskspace.php @@ -21,7 +21,7 @@ $result = $db->query("SELECT `c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`firstname`, `c`.`diskspace`, `c`.`diskspace_used`, `c`.`email`, `c`.`def_language`, - `a`.`name` AS `adminname`, `a`.`email` AS `adminmail`, + `a`.`name` AS `adminname`, `a`.`email` AS `adminmail` FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` LEFT JOIN `" . TABLE_PANEL_ADMINS . "` AS `a` ON `a`.`adminid` = `c`.`adminid` @@ -38,74 +38,73 @@ while($row = $db->fetch_array($result)) $replace_arr = array( 'NAME' => $row['name'], 'DISKAVAILABLE' => ($row['diskspace'] / 1024), /* traffic is stored in KB, template uses MB */ - 'DISKUSED' => ($row['diskspace_used'] / 1024), /* traffic is stored in KB, template uses MB */ + 'DISKUSED' => round($row['diskspace_used'] / 1024, 2), /* traffic is stored in KB, template uses MB */ 'USAGE_PERCENT' => ($row['diskspace_used'] * 100) / $row['diskspace'], 'MAX_PERCENT' => $settings['system']['report_webmax'] ); - } - $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $row['def_language'] . "'"); - - if($lngfile !== NULL) - { - $langfile = $lngfile['file']; - } - else - { $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); - $langfile = $lngfile['file']; + WHERE `language` ='" . $row['def_language'] . "'"); + + if($lngfile !== NULL) + { + $langfile = $lngfile['file']; + } + else + { + $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` + WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); + $langfile = $lngfile['file']; + } + + include_once makeCorrectFile($pathtophpfiles . '/' . $langfile); + + // Get mail templates from database; the ones from 'admin' are fetched for fallback + $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` + WHERE `adminid`='" . (int)$row['adminid'] . "' + AND `language`='" . $db->escape($row['def_language']) . "' + AND `templategroup`='mails' + AND `varname`='webmaxpercent_subject'"); + $mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr)); + + $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` + WHERE `adminid`='" . (int)$row['adminid'] . "' + AND `language`='" . $db->escape($row['def_language']) . "' + AND `templategroup`='mails' + AND `varname`='webmaxpercent_mailbody'"); + $mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr)); + + $_mailerror = false; + try { + $mail->SetFrom($row['email'], $row['firstname'] . " " . $row['name']); + $mail->Subject = $mail_subject; + $mail->AltBody = $mail_body; + $mail->MsgHTML(nl2br($mail_body)); + $mail->AddAddress($row['email'], $row['name']); + $mail->Send(); + } catch(phpmailerException $e) { + $mailerr_msg = $e->errorMessage(); + $_mailerror = true; + } catch (Exception $e) { + $mailerr_msg = $e->getMessage(); + $_mailerror = true; + } + + if ($_mailerror) { + $cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); + standard_error('errorsendingmail', $row["email"]); + } + + $mail->ClearAddresses(); + $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `reportsent`='2' + WHERE `customerid`='" . (int)$row['customerid'] . "'"); } - - include_once makeCorrectFile($pathtophpfiles . '/' . $langfile); - - // Get mail templates from database; the ones from 'admin' are fetched for fallback - $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` - WHERE `adminid`='" . (int)$row['adminid'] . "' - AND `language`='" . $db->escape($row['def_language']) . "' - AND `templategroup`='mails' - AND `varname`='webmaxpercent_subject'"); - $mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr)); - - $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` - WHERE `adminid`='" . (int)$row['adminid'] . "' - AND `language`='" . $db->escape($row['def_language']) . "' - AND `templategroup`='mails' - AND `varname`='webmaxpercent_mailbody'"); - $mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr)); - - $_mailerror = false; - try { - $mail->SetFrom($row['email'], $row['firstname'] . " " . $row['name']); - $mail->Subject = $mail_subject; - $mail->AltBody = $mail_body; - $mail->MsgHTML($mail_body); - $mail->AddAddress($row['email'], $row['name']); - $mail->Send(); - } catch(phpmailerException $e) { - $mailerr_msg = $e->errorMessage(); - $_mailerror = true; - } catch (Exception $e) { - $mailerr_msg = $e->getMessage(); - $_mailerror = true; - } - - if ($_mailerror) { - $cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); - standard_error('errorsendingmail', $row["email"]); - } - - $mail->ClearAddresses(); - $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `reportsent`='2' - WHERE `customerid`='" . (int)$row['customerid'] . "'"); } /** * report about diskusage for admins/reseller */ -$result = $db->query("SELECT `a`.* FROM `" . TABLE_PANEL_ADMINS . "` `a` - WHERE `a`.`reportsent` <> '2'"); +$result = $db->query("SELECT `a`.* FROM `" . TABLE_PANEL_ADMINS . "` `a` WHERE `a`.`reportsent` <> '2'"); while($row = $db->fetch_array($result)) { @@ -118,65 +117,65 @@ while($row = $db->fetch_array($result)) $replace_arr = array( 'NAME' => $row['name'], 'DISKAVAILABLE' => ($row['diskspace'] / 1024), /* traffic is stored in KB, template uses MB */ - 'DISKUSED' => ($row['diskspace_used'] / 1024), /* traffic is stored in KB, template uses MB */ + 'DISKUSED' => round($row['diskspace_used'] / 1024, 2), /* traffic is stored in KB, template uses MB */ 'USAGE_PERCENT' => ($row['diskspace_used'] * 100) / $row['diskspace'], 'MAX_PERCENT' => $settings['system']['report_webmax'] ); - } - $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $row['def_language'] . "'"); - - if($lngfile !== NULL) - { - $langfile = $lngfile['file']; - } - else - { $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); - $langfile = $lngfile['file']; + WHERE `language` ='" . $row['def_language'] . "'"); + + if($lngfile !== NULL) + { + $langfile = $lngfile['file']; + } + else + { + $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` + WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); + $langfile = $lngfile['file']; + } + + include_once makeCorrectFile($pathtophpfiles . '/' . $langfile); + + // Get mail templates from database; the ones from 'admin' are fetched for fallback + $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` + WHERE `adminid`='" . (int)$row['adminid'] . "' + AND `language`='" . $db->escape($row['def_language']) . "' + AND `templategroup`='mails' + AND `varname`='webmaxpercent_subject'"); + $mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr)); + + $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` + WHERE `adminid`='" . (int)$row['adminid'] . "' + AND `language`='" . $db->escape($row['def_language']) . "' + AND `templategroup`='mails' + AND `varname`='webmaxpercent_mailbody'"); + $mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr)); + + $_mailerror = false; + try { + $mail->SetFrom($row['email'], $row['name']); + $mail->Subject = $mail_subject; + $mail->AltBody = $mail_body; + $mail->MsgHTML(nl2br($mail_body)); + $mail->AddAddress($row['email'], $row['name']); + $mail->Send(); + } catch(phpmailerException $e) { + $mailerr_msg = $e->errorMessage(); + $_mailerror = true; + } catch (Exception $e) { + $mailerr_msg = $e->getMessage(); + $_mailerror = true; + } + + if ($_mailerror) { + $cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); + standard_error('errorsendingmail', $row["email"]); + } + + $mail->ClearAddresses(); + $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `reportsent`='2' + WHERE `adminid`='" . (int)$row['adminid'] . "'"); } - - include_once makeCorrectFile($pathtophpfiles . '/' . $langfile); - - // Get mail templates from database; the ones from 'admin' are fetched for fallback - $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` - WHERE `adminid`='" . (int)$row['adminid'] . "' - AND `language`='" . $db->escape($row['def_language']) . "' - AND `templategroup`='mails' - AND `varname`='webmaxpercent_subject'"); - $mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr)); - - $result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` - WHERE `adminid`='" . (int)$row['adminid'] . "' - AND `language`='" . $db->escape($row['def_language']) . "' - AND `templategroup`='mails' - AND `varname`='webmaxpercent_mailbody'"); - $mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr)); - - $_mailerror = false; - try { - $mail->SetFrom($row['email'], $row['name']); - $mail->Subject = $mail_subject; - $mail->AltBody = $mail_body; - $mail->MsgHTML($mail_body); - $mail->AddAddress($row['email'], $row['name']); - $mail->Send(); - } catch(phpmailerException $e) { - $mailerr_msg = $e->errorMessage(); - $_mailerror = true; - } catch (Exception $e) { - $mailerr_msg = $e->getMessage(); - $_mailerror = true; - } - - if ($_mailerror) { - $cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); - standard_error('errorsendingmail', $row["email"]); - } - - $mail->ClearAddresses(); - $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `reportsent`='2' - WHERE `adminid`='" . (int)$row['adminid'] . "'"); } diff --git a/scripts/jobs/cron_usage_report.php b/scripts/jobs/cron_usage_report.php index 5d5ee277..4bd3b901 100644 --- a/scripts/jobs/cron_usage_report.php +++ b/scripts/jobs/cron_usage_report.php @@ -88,7 +88,7 @@ while($row = $db->fetch_array($result)) $mail->SetFrom($row['adminmail'], $row['adminname']); $mail->Subject = $mail_subject; $mail->AltBody = $mail_body; - $mail->MsgHTML($mail_body); + $mail->MsgHTML(nl2br($mail_body)); $mail->AddAddress($row['email'], $row['firstname'] . ' ' . $row['name']); $mail->Send(); } catch(phpmailerException $e) { @@ -169,7 +169,7 @@ while($row = $db->fetch_array($result)) $mail->SetFrom($row['email'], $row['name']); $mail->Subject = $mail_subject; $mail->AltBody = $mail_body; - $mail->MsgHTML($mail_body); + $mail->MsgHTML(nl2br($mail_body)); $mail->AddAddress($row['email'], $row['name']); $mail->Send(); } catch(phpmailerException $e) { diff --git a/templates/footer.tpl b/templates/footer.tpl index d98325a4..c5a9491c 100644 --- a/templates/footer.tpl +++ b/templates/footer.tpl @@ -8,7 +8,7 @@ {$version}{$branding} - © 2009-2010 by the Froxlor Team + © 2009-{$current_year} by the Froxlor Team
Theme based on work by: Luca Piona and Luca Longinotti
{$lng['panel']['translator']}: {$lng['translator']}