-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupdate.settings.php
123 lines (98 loc) · 5.25 KB
/
update.settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/*
This file is part of Church Rota.
Copyright (C) 2013 Benjamin Schmitt
Church Rota is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Church Rota is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Church Rota. If not, see <http://www.gnu.org/licenses/>.
*/
// Include files, including the database connection
include('includes/dbConfig.php');
include('includes/functions.php');
// Start the session. This checks whether someone is logged in and if not redirects them
session_start();
if (isset($_SESSION['is_logged_in']) || $_SESSION['db_is_logged_in'] == true) {
// Just continue the code
} else {
header('Location: login.php');
exit;
}
if (!isAdmin()) {
header('Location: error.php?no=100&page='.basename($_SERVER['SCRIPT_FILENAME']));
exit;
}
$action = $_GET['action'];
$eventID = $_GET['id'];
function detectBrowserLanguage() {
$langcode = explode(";", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
$langcode = explode(",", $langcode['0']);
return $langcode['0'];
}
$language = detectBrowserLanguage();
$sqlSettings = "select * from cr_settings";
$resultSettings = mysql_query($sqlSettings) or die(mysql_error());
$rowSettings = mysql_fetch_array($resultSettings, MYSQL_ASSOC);
if($action == "update") {
//if ($language='de-de')
if ($rowSettings['lang_locale']=="en_GB")
{
executeDbSql("update cr_settings set lang_locale = 'de_DE'"); // de_DE
executeDbSql("update cr_settings set time_format_long = '%A, %e. %B %Y, %R Uhr, KW%V'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V
executeDbSql("update cr_settings set time_format_normal = '%d.%m.%Y %H:%M '"); // de_DE: %d.%m.%Y %H:%M
executeDbSql("update cr_settings set time_format_short = '%a, <strong>%e. %b</strong>, %R'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V
executeDbSql("update cr_settings set time_zone = 'Europe/Berlin'"); //de_DE: Europe/Berlin
executeDbSql("update cr_settings set google_group_calendar = ''");
executeDbSql("update cr_settings set overviewemail = '{{Gottesdienst-Planung [MONTH] [YEAR]}}\r\nHallo zusammen,\r\n\r\nanbei die Gottesdienst-Planung fuer [MONTH] [YEAR]\r\n\r\n[OVERVIEW]\r\n\r\nBitte fruehzeitig Bescheid geben, wenn etwas NICHT passt, ansonsten gehe ich davon aus, dass ihr wie geplant koennt.\r\n\r\nAlles Gute und Gottes Segen für Euch und Euren Dienst.\r\nEuer Gottesdienst Orga-Team'");
}
//else
if ($rowSettings['lang_locale']=="de_DE")
{
executeDbSql("update cr_settings set lang_locale = 'en_GB'"); // de_DE
executeDbSql("update cr_settings set time_format_long = '%A, %B %e @ %I:%M %p'"); // de_DE: %A, %e. %B %Y, %R Uhr, KW%V
executeDbSql("update cr_settings set time_format_normal = '%m/%d/%y %I:%M %p'"); // de_DE: %d.%m.%Y %H:%M
executeDbSql("update cr_settings set time_format_short = '%a, <strong>%b %e</strong>, %I:%M %p'"); // de_DE: %a, <strong>%e. %b</strong>, KW%V
executeDbSql("update cr_settings set time_zone = 'Europe/London'"); //de_DE: Europe/Berlin
executeDbSql("update cr_settings set google_group_calendar = ''");
executeDbSql("update cr_settings set overviewemail = 'Hello,\r\n\r\nIn this email you find the Rota for [MONTH] [YEAR].\r\n\r\n[OVERVIEW]\r\n\r\nPlease inform us as soon as possible, if you are not able to serve as scheduled.\r\n\r\nBe blessed.\r\nChurch Support Stuff'");
}
//notifyInfo(__FILE__,"settings updated",$_SESSION['userid']);
$sqlSettings = "select * from cr_settings";
$resultSettings = mysql_query($sqlSettings) or die(mysql_error());
$rowSettings = mysql_fetch_array($resultSettings, MYSQL_ASSOC);
$updateNotification = "Settings updated successfully to: " . $rowSettings['lang_locale'] ." <br> <br>";
}
$formatting = "true";
include('includes/header.php');
?>
<div class="elementBackground">
<h2>Optional Database Updates</h2>
<hr>
This page has only beta status. <br>Please do only use it in testing environments!
<hr>
<?php echo "Your web browser identifies your language as: " . $language;?><br>
<?php echo "Church Rota is set to use: " . $rowSettings['lang_locale'];?><br> <br>
<?php
if ($updateNotification == "")
{
?>
Do you want to update your mail templates and date settings accordingly?
<a class="button" href='#' data-reveal-id='deleteModalUpdateSettings'>Update settings</a>
<div id="deleteModalUpdateSettings" class="reveal-modal">
<h1>Really update settings?</h1>
<p>Are you sure you really want to update settings?</p><p>There is no way of undoing this action.</p>
<p><a class="button" href="update.settings.php?action=update">Sure, update settings</a></p>
<a class="close-reveal-modal">×</a>
</div>
<?php
}else{
echo $updateNotification;
}?>
</div>
<?php include('includes/footer.php'); ?>