diff options
Diffstat (limited to 'includes/helper')
-rw-r--r-- | includes/helper/email_helper.php | 25 | ||||
-rw-r--r-- | includes/helper/graph_helper.php | 10 | ||||
-rw-r--r-- | includes/helper/internationalization_helper.php | 6 | ||||
-rw-r--r-- | includes/helper/message_helper.php | 37 |
4 files changed, 63 insertions, 15 deletions
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php index 35bdbc9a..18203ecb 100644 --- a/includes/helper/email_helper.php +++ b/includes/helper/email_helper.php @@ -1,5 +1,12 @@ <?php +/** + * @param array $recipient_user + * @param string $title + * @param string $message + * @param bool $not_if_its_me + * @return bool + */ function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false) { global $user; @@ -16,14 +23,28 @@ function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_it . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem."); gettext_locale(); + return engelsystem_email($recipient_user['email'], $title, $message); } +/** + * @param string $address + * @param string $title + * @param string $message + * @return bool + */ function engelsystem_email($address, $title, $message) { - $result = mail($address, $title, $message, - "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>"); + $result = mail( + $address, + $title, + $message, + "Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <noreply@engelsystem.de>" + ); + if ($result === false) { engelsystem_error('Unable to send email.'); } + + return true; } diff --git a/includes/helper/graph_helper.php b/includes/helper/graph_helper.php index d844213c..12c7df6c 100644 --- a/includes/helper/graph_helper.php +++ b/includes/helper/graph_helper.php @@ -3,10 +3,12 @@ /** * Renders a bargraph * - * @param string $key keyname of the x-axis - * @param array $row_names keynames for the data rows - * @param unknown $colors colors for the data rows - * @param unknown $data the data + * @param string $dom_id + * @param string $key key name of the x-axis + * @param array $row_names key names for the data rows + * @param array $colors colors for the data rows + * @param array $data the data + * @return string */ function bargraph($dom_id, $key, $row_names, $colors, $data) { diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php index d4df1cb7..ee9339e2 100644 --- a/includes/helper/internationalization_helper.php +++ b/includes/helper/internationalization_helper.php @@ -8,6 +8,8 @@ $default_locale = 'en_US.UTF-8'; /** * Return currently active locale + * + * @return string */ function locale() { @@ -16,6 +18,8 @@ function locale() /** * Returns two letter language code from currently active locale + * + * @return string */ function locale_short() { @@ -59,7 +63,7 @@ function gettext_locale($locale = null) /** * Renders language selection. * - * @return string + * @return array */ function make_langselect() { diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php index a085aa0e..613ac32e 100644 --- a/includes/helper/message_helper.php +++ b/includes/helper/message_helper.php @@ -2,6 +2,8 @@ /** * Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher + * + * @return string */ function msg() { @@ -15,34 +17,51 @@ function msg() /** * Rendert eine Information + * + * @param string $msg + * @param bool $immediately + * @return string */ -function info($msg, $immediatly = false) +function info($msg, $immediately = false) { - return alert('info', $msg, $immediatly); + return alert('info', $msg, $immediately); } /** * Rendert eine Fehlermeldung + * + * @param string $msg + * @param bool $immediately + * @return string */ -function error($msg, $immediatly = false) +function error($msg, $immediately = false) { - return alert('danger', $msg, $immediatly); + return alert('danger', $msg, $immediately); } /** * Rendert eine Erfolgsmeldung + * + * @param string $msg + * @param bool $immediately + * @return string */ -function success($msg, $immediatly = false) +function success($msg, $immediately = false) { - return alert('success', $msg, $immediatly); + return alert('success', $msg, $immediately); } /** * Renders an alert with given alert-* class. + * + * @param string $class + * @param string $msg + * @param bool $immediately + * @return string|null */ -function alert($class, $msg, $immediatly = false) +function alert($class, $msg, $immediately = false) { - if ($immediatly) { + if ($immediately) { if ($msg == "") { return ""; } @@ -53,4 +72,6 @@ function alert($class, $msg, $immediatly = false) $_SESSION['msg'] = ""; } $_SESSION['msg'] .= alert($class, $msg, true); + + return null; } |