summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2011-10-11 22:24:33 +0200
committerPhilip Häusler <msquare@notrademark.de>2011-10-11 22:24:33 +0200
commita06ffd2e49320c9602993394e5ff2ab5be2a68d6 (patch)
tree544da466127214682ffbfdbd8a27a7f0bdec0438 /includes
parentf8ec85e4c642802d5698054a22afdd67f6ae6d67 (diff)
#27 ical export, key reset
Diffstat (limited to 'includes')
-rw-r--r--includes/pages/user_myshifts.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 78fdf8a1..5a667974 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -7,7 +7,14 @@ function user_myshifts() {
global $user, $privileges;
$msg = "";
- if (isset ($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) {
+ if (isset ($_REQUEST['reset'])) {
+ if ($_REQUEST['reset'] == "ack") {
+ user_reset_ical_key();
+ return success("Key geändert.");
+ }
+ return template_render('../templates/user_myshifts_reset.html', array ());
+ }
+ elseif (isset ($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) {
$id = $_REQUEST['edit'];
$shift = sql_select("SELECT `ShiftEntry`.`Comment`, `Shifts`.*, `Room`.`Name`, `AngelTypes`.`Name` as `angel_type` FROM `ShiftEntry` JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`TID`) JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) WHERE `id`=" . sql_escape($id) . " AND `UID`=" . sql_escape($user['UID']) . " LIMIT 1");
if (count($shift) > 0) {
@@ -66,10 +73,8 @@ function user_myshifts() {
if ($html == "")
$html = '<tr><td>Keine...</td><td></td><td></td><td></td><td></td><td>Gehe zum <a href="' . page_link_to('user_shifts') . '">Schichtplan</a> um Dich für Schichten einzutragen.</td></tr>';
- if ($user['ical_key'] == "") {
- $user['ical_key'] = md5($user['Nick'] . time() . rand());
- sql_query("UPDATE `User` SET `ical_key`='" . sql_escape($user['ical_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
- }
+ if ($user['ical_key'] == "")
+ user_reset_ical_key();
return template_render('../templates/user_myshifts.html', array (
'h' => $LETZTES_AUSTRAGEN,
@@ -79,4 +84,10 @@ function user_myshifts() {
'reset_link' => page_link_to('user_myshifts') . '&reset'
));
}
+
+function user_reset_ical_key() {
+ global $user;
+ $user['ical_key'] = md5($user['Nick'] . time() . rand());
+ sql_query("UPDATE `User` SET `ical_key`='" . sql_escape($user['ical_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
+}
?> \ No newline at end of file