summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/helper/email_helper.php3
-rw-r--r--includes/helper/graph_helper.php6
-rw-r--r--includes/helper/internationalization_helper.php11
-rw-r--r--includes/helper/message_helper.php40
-rw-r--r--includes/pages/guest_login.php2
5 files changed, 31 insertions, 31 deletions
diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php
index 5c7c64a8..24c32be8 100644
--- a/includes/helper/email_helper.php
+++ b/includes/helper/email_helper.php
@@ -3,8 +3,9 @@
function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false) {
global $user;
- if ($not_if_its_me && $user['UID'] == $recipient_user['UID'])
+ if ($not_if_its_me && $user['UID'] == $recipient_user['UID']) {
return true;
+ }
gettext_locale($recipient_user['Sprache']);
diff --git a/includes/helper/graph_helper.php b/includes/helper/graph_helper.php
index 17473634..180d1ef9 100644
--- a/includes/helper/graph_helper.php
+++ b/includes/helper/graph_helper.php
@@ -9,14 +9,16 @@
*/
function bargraph($id, $key, $row_names, $colors, $data) {
$labels = [];
- foreach ($data as $dataset)
+ foreach ($data as $dataset) {
$labels[] = $dataset[$key];
+ }
$datasets = [];
foreach ($row_names as $row_key => $name) {
$values = [];
- foreach ($data as $dataset)
+ foreach ($data as $dataset) {
$values[] = $dataset[$row_key];
+ }
$datasets[] = [
'label' => $name,
'fillColor' => $colors[$row_key],
diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php
index a8fdd0f0..1f4f3558 100644
--- a/includes/helper/internationalization_helper.php
+++ b/includes/helper/internationalization_helper.php
@@ -26,10 +26,11 @@ function locale_short() {
function gettext_init() {
global $locales, $default_locale;
- if (isset($_REQUEST['set_locale']) && in_array($_REQUEST['set_locale'], array_keys($locales)))
+ if (isset($_REQUEST['set_locale']) && in_array($_REQUEST['set_locale'], array_keys($locales))) {
$_SESSION['locale'] = $_REQUEST['set_locale'];
- elseif (! isset($_SESSION['locale']))
+ } elseif (! isset($_SESSION['locale'])) {
$_SESSION['locale'] = $default_locale;
+ }
gettext_locale();
bindtextdomain('default', '../locale');
@@ -43,8 +44,9 @@ function gettext_init() {
* @param string $locale
*/
function gettext_locale($locale = null) {
- if ($locale == null)
+ if ($locale == null) {
$locale = $_SESSION['locale'];
+ }
putenv('LC_ALL=' . $locale);
setlocale(LC_ALL, $locale);
@@ -60,8 +62,9 @@ function make_langselect() {
$URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale=";
$items = array();
- foreach ($locales as $locale => $name)
+ foreach ($locales as $locale => $name) {
$items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name);
+ }
return $items;
}
diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php
index 26bad871..a0cc6eb7 100644
--- a/includes/helper/message_helper.php
+++ b/includes/helper/message_helper.php
@@ -4,8 +4,9 @@
* Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher
*/
function msg() {
- if (! isset($_SESSION['msg']))
+ if (! isset($_SESSION['msg'])) {
return "";
+ }
$msg = $_SESSION['msg'];
$_SESSION['msg'] = "";
return $msg;
@@ -15,44 +16,37 @@ function msg() {
* Rendert eine Information
*/
function info($msg, $immediatly = false) {
- if ($immediatly) {
- if ($msg == "")
- return "";
- return '<div class="alert alert-info">' . $msg . '</div>';
- } else {
- if (! isset($_SESSION['msg']))
- $_SESSION['msg'] = "";
- $_SESSION['msg'] .= info($msg, true);
- }
+ return alert('info', $msg, $immediatly);
}
/**
* Rendert eine Fehlermeldung
*/
function error($msg, $immediatly = false) {
- if ($immediatly) {
- if ($msg == "")
- return "";
- return '<div class="alert alert-danger">' . $msg . '</div>';
- } else {
- if (! isset($_SESSION['msg']))
- $_SESSION['msg'] = "";
- $_SESSION['msg'] .= error($msg, true);
- }
+ return alert('danger', $msg, $immediatly);
}
/**
* Rendert eine Erfolgsmeldung
*/
function success($msg, $immediatly = false) {
+ return alert('success', $msg, $immediatly);
+}
+
+/**
+ * Renders an alert with given alert-* class.
+ */
+function alert($class, $msg, $immediatly = false) {
if ($immediatly) {
- if ($msg == "")
+ if ($msg == "") {
return "";
- return '<div class="alert alert-success">' . $msg . '</div>';
+ }
+ return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
} else {
- if (! isset($_SESSION['msg']))
+ if (! isset($_SESSION['msg'])) {
$_SESSION['msg'] = "";
- $_SESSION['msg'] .= success($msg, true);
+ }
+ $_SESSION['msg'] .= alert($class, $msg, true);
}
}
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index dfda3306..2700fd5b 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -313,13 +313,13 @@ function guest_login() {
return page([
div('col-md-12', [
- msg(),
div('row', [
div('col-md-4', [
EventConfig_countdown_page($event_config)
]),
div('col-md-4', [
heading(login_title(), 2),
+ msg(),
form([
form_text('nick', _("Nick"), $nick),
form_password('password', _("Password")),