From fb8241039b37e0318cbaf40831c28baa7b49d828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Tue, 10 Sep 2013 14:45:41 +0200 Subject: [PATCH] #119 added links to json export --- db/install.sql | 4 ++-- includes/model/User_model.php | 2 +- includes/pages/user_myshifts.php | 2 +- includes/pages/user_shifts.php | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db/install.sql b/db/install.sql index a294e79b..235e6224 100644 --- a/db/install.sql +++ b/db/install.sql @@ -1161,8 +1161,8 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES ('to_filter', 'EN', 'filter'), ('pub_schichtplan_tasks_notice', 'DE', 'Die hier angezeigten Aufgaben werden durch die Präferenzen in deinen Einstellungen beeinflusst! Beschreibung der einzelnen Aufgaben.'), ('pub_schichtplan_tasks_notice', 'EN', 'The tasks shown here are influenced by the preferences you defined in your settings! Description of the jobs.'), -('inc_schicht_ical_text', 'DE', 'Zum Abonnieren der angezeigten Schichten in deiner Kalender-Software benutze diesen Link (bitte geheimhalten, im Notfall Deinen API-Key zurücksetzen).'), -('inc_schicht_ical_text', 'EN', 'To subscribe the shifts shown in your calendar software, use this link (please keep secret, otherwise reset the ical key).'), +('inc_schicht_ical_text', 'DE', 'Export der angezeigten Schichten. Im iCal Format oder im JSON Format (bitte geheimhalten, im Notfall Deinen API-Key zurücksetzen).'), +('inc_schicht_ical_text', 'EN', 'Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key).'), ('helpers', 'DE', 'Helfer'), ('helpers', 'EN', 'helpers'), ('helper', 'DE', 'Helfer'), diff --git a/includes/model/User_model.php b/includes/model/User_model.php index d79ede17..4e833aef 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -29,7 +29,7 @@ function User_by_api_key($api_key) { * Generates a new api key for given user. * @param User $user */ -function User_reset_api_key($user) { +function User_reset_api_key(&$user) { $user['api_key'] = md5($user['Nick'] . time() . rand()); sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1"); engelsystem_log("API key resetted."); diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index a19ee34e..3d3a92ba 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -118,7 +118,7 @@ function user_myshifts() { 'actions' => "Aktion" ), $myshifts_table), $id == $user['UID'] && count($shifts) == 0 ? error(sprintf(Get_Text('pub_myshifts_goto_shifts'), page_link_to('user_shifts')), true) : '', - "

iCal Export

" . sprintf(Get_Text('inc_schicht_ical_text'), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset') + "

Exports

" . sprintf(Get_Text('inc_schicht_ical_text'), page_link_to_absolute('ical') . '&key=' . $shifts_user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $shifts_user['api_key'], page_link_to('user_myshifts') . '&reset') )); } ?> diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 6a7d6ed5..daf0fe60 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -704,12 +704,12 @@ return msg() . template_render('../templates/user_shifts.html', array ( 'task_notice' => '1' . Get_Text("pub_schichtplan_tasks_notice"), 'new_style_checkbox' => '', 'shifts_table' => $shifts_table, - 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_ical_link($user['api_key'])), page_link_to('user_myshifts') . '&reset'), + 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), htmlspecialchars(make_user_shifts_export_link('ical', $user['api_key'])), htmlspecialchars(make_user_shifts_export_link('shifts_json_export', $user['api_key'])), page_link_to('user_myshifts') . '&reset'), 'filter' => ucfirst(Get_Text("to_filter")), )); } -function make_user_shifts_ical_link($key) { +function make_user_shifts_export_link($page, $key) { $link = "&start_day=" . $_SESSION['user_shifts']['start_day']; $link = "&start_time=" . $_SESSION['user_shifts']['start_time']; $link = "&end_day=" . $_SESSION['user_shifts']['end_day']; @@ -720,7 +720,7 @@ function make_user_shifts_ical_link($key) { $link .= '&types[]=' . $type; foreach ($_SESSION['user_shifts']['filled'] as $filled) $link .= '&filled[]=' . $filled; - return page_link_to_absolute('ical') . $link . '&export=user_shifts&key=' . $key; + return page_link_to_absolute($page) . $link . '&export=user_shifts&key=' . $key; } function get_ids_from_array($array) {