Merge branch 'master' of github.com:engelsystem/engelsystem

This commit is contained in:
Felix Favre 2014-12-07 21:06:39 +01:00
commit 0cd8dd40a5
3 changed files with 13 additions and 14 deletions

View File

@ -11,12 +11,6 @@ SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
--
-- Datenbank: `engelsystem`
--
CREATE DATABASE IF NOT EXISTS `engelsystem` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `engelsystem`;
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --

View File

@ -1,12 +1,17 @@
<?php <?php
function engelsystem_email_to_user($user, $title, $message) { function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_its_me = false) {
gettext_locale($user['Sprache']); global $user;
$message = sprintf(_("Hi %s,"), $user['Nick']) . "\n\n" . _("here is a message for you from the engelsystem:") . "\n\n" . $message . "\n\n" . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem."); if ($not_if_its_me && $user['UID'] == $recipient_user['UID'])
return true;
gettext_locale($recipient_user['Sprache']);
$message = sprintf(_("Hi %s,"), $recipient_user['Nick']) . "\n\n" . _("here is a message for you from the engelsystem:") . "\n\n" . $message . "\n\n" . _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.");
gettext_locale(); gettext_locale();
return engelsystem_email($user['email'], $title, $message); return engelsystem_email($recipient_user['email'], $title, $message);
} }
function engelsystem_email($address, $title, $message) { function engelsystem_email($address, $title, $message) {

View File

@ -44,7 +44,7 @@ function mail_shift_change($old_shift, $new_shift) {
foreach ($users as $user) foreach ($users as $user)
if ($user["email_shiftinfo"]) if ($user["email_shiftinfo"])
engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift has changed"), $message); engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift has changed"), $message, true);
} }
function mail_shift_delete($shift) { function mail_shift_delete($shift) {
@ -59,7 +59,7 @@ function mail_shift_delete($shift) {
foreach ($users as $user) foreach ($users as $user)
if ($user["email_shiftinfo"]) if ($user["email_shiftinfo"])
engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift was deleted"), $message); engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift was deleted"), $message, true);
} }
function mail_shift_assign($user, $shift) { function mail_shift_assign($user, $shift) {
@ -71,7 +71,7 @@ function mail_shift_assign($user, $shift) {
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n"; $message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n"; $message .= $room["Name"] . "\n";
engelsystem_email_to_user($user, '[engelsystem] ' . _("Assigned to Shift"), $message); engelsystem_email_to_user($user, '[engelsystem] ' . _("Assigned to Shift"), $message, true);
} }
} }
@ -84,7 +84,7 @@ function mail_shift_removed($user, $shift) {
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n"; $message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n"; $message .= $room["Name"] . "\n";
engelsystem_email_to_user($user, '[engelsystem] ' . _("Removed from Shift"), $message); engelsystem_email_to_user($user, '[engelsystem] ' . _("Removed from Shift"), $message, true);
} }
} }