Automad
 All Classes Functions Variables Pages
system_settings.php
1 <?php
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  * AUTOMAD
29  *
30  * Copyright (c) 2014 by Marc Anton Dahmen
31  * http://marcdahmen.de
32  *
33  * Licensed under the MIT license.
34  * http://automad.org/license
35  */
36 
37 
38 defined('AUTOMAD') or die('Direct access not permitted!');
39 
40 
41 /*
42  * The GUI Sytem Settings' Page. As part of the GUI, this file is only to be included via the GUI class.
43  */
44 
45 
46 $this->guiTitle = $this->guiTitle . ' / ' . $this->tb['sys_title'];
47 $this->element('header');
48 
49 
50 ?>
51 
52  <div class="column subnav">
53  <div class="scroll">
54  <div class="inner">
55  <ul class="nav nav-pills nav-stacked">
56  <li class="active">
57  <a href="#cache" data-toggle="tab">
58  <span class="glyphicon glyphicon-hdd"></span><span class="hidden-md"> <?php echo $this->tb['sys_cache']; ?></span>
59  </a>
60  </li>
61  <li>
62  <a href="#users" data-toggle="tab">
63  <span class="glyphicon glyphicon-user"></span><span class="hidden-md"> <?php echo $this->tb['sys_user']; ?></span>
64  </a>
65  </li>
66  <li>
67  <a href="#file_types" data-toggle="tab">
68  <span class="glyphicon glyphicon-picture"></span><span class="hidden-md"> <?php echo $this->tb['sys_file_types']; ?></span>
69  </a>
70  </li>
71  <li>
72  <a href="#debug" data-toggle="tab">
73  <span class="glyphicon glyphicon-info-sign"></span><span class="hidden-md"> <?php echo $this->tb['sys_debug']; ?></span>
74  </a>
75  </li>
76  </ul>
77  </div>
78  </div>
79  </div>
80 
81  <div class="column content">
82  <!-- Tab panes -->
83  <div class="inner tab-content">
84  <div id="cache" class="tab-pane fade in active">
85  <div class="alert alert-info">
86  <h3><?php echo $this->tb['sys_cache']; ?></h3>
87  <?php echo $this->tb['sys_cache_info']; ?>
88  </div>
89  <a href="#" class="automad-status btn btn-default" data-automad-status="cache" data-toggle="modal" data-target="#cache-settings-modal"></a>
90  <a href="#" class="btn btn-default" data-toggle="modal" data-target="#cache-clear-modal"><span class="glyphicon glyphicon-refresh"></span> <?php echo $this->tb['sys_cache_clear']; ?></a>
91  </div>
92  <div id="users" class="tab-pane fade">
93  <div class="alert alert-info">
94  <h3><?php echo $this->tb['sys_user']; ?></h3>
95  <?php echo $this->tb['sys_user_info']; ?>
96  </div>
97  <a href="#" class="btn btn-default" data-toggle="modal" data-target="#change-password-modal"><span class="glyphicon glyphicon-lock"></span> <?php echo $this->tb['sys_user_change_password']; ?></a>
98  <a href="#" class="btn btn-default" data-toggle="modal" data-target="#add-user-modal"><span class="glyphicon glyphicon-plus"></span> <?php echo $this->tb['sys_user_add']; ?></a>
99  <a href="#" class="automad-status btn btn-default" data-automad-status="users" data-toggle="modal" data-target="#users-modal"></a>
100  </div>
101  <div id="file_types" class="tab-pane fade">
102  <div class="alert alert-info">
103  <h3><?php echo $this->tb['sys_file_types']; ?></h3>
104  <?php echo $this->tb['sys_file_types_info']; ?>
105  </div>
106  <a href="#" class="btn btn-default" data-toggle="modal" data-target="#file-types-modal"><span class="glyphicon glyphicon-pencil"></span> <?php echo $this->tb['sys_file_types_edit']; ?></a>
107  </div>
108  <div id="debug" class="tab-pane fade">
109  <div class="alert alert-info">
110  <h3><?php echo $this->tb['sys_debug']; ?></h3>
111  <?php echo $this->tb['sys_debug_info']; ?>
112  </div>
113  <a href="#" class="automad-status btn btn-default" data-automad-status="debug" data-toggle="modal" data-target="#debug-modal"></a>
114  </div>
115  </div>
116  </div>
117 
118  <!-- Modals -->
119 
120  <!-- Cache Settings -->
121  <div class="modal fade automad-close-on-success" id="cache-settings-modal" tabindex="-1">
122  <div class="modal-dialog modal-sm">
123  <div class="modal-content">
124  <div class="modal-header">
125  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
126  <h3 class="modal-title"><?php echo $this->tb['sys_cache']; ?></h3>
127  </div>
128  <form class="automad-form" data-automad-handler="update_config">
129  <div class="modal-body">
130  <div class="btn-group btn-group-justified" data-toggle="buttons">
131  <label class="btn btn-default btn-lg<?php if (AM_CACHE_ENABLED) { echo ' active'; } ?>">
132  <input type="radio" name="cache[enabled]" value="on"<?php if (AM_CACHE_ENABLED) { echo ' checked'; } ?> />On
133  </label>
134  <label class="btn btn-default btn-lg<?php if (!AM_CACHE_ENABLED) { echo ' active'; } ?>">
135  <input type="radio" name="cache[enabled]" value="off"<?php if (!AM_CACHE_ENABLED) { echo ' checked'; } ?> />Off
136  </label>
137  </div>
138  <br />
139  <label><?php echo $this->tb['sys_cache_monitor']; ?></label>
140  <div class="btn-group btn-group-justified" data-toggle="buttons">
141  <?php
142 
143  $delays = array(60, 120, 300);
144 
145  // Set default delay, if the current setting is not in $delays, to prevent submitting an empty value for cache[monitor-delay].
146  if (in_array(AM_CACHE_MONITOR_DELAY, $delays)) {
147  $current = AM_CACHE_MONITOR_DELAY;
148  } else {
149  $current = end($delays);
150  }
151 
152  foreach ($delays as $seconds) {
153 
154  echo '<label class="btn btn-default btn-sm';
155 
156  if ($seconds == $current) {
157  echo ' active';
158  }
159 
160  echo '"><input type="radio" name="cache[monitor-delay]" value="' . $seconds . '"';
161 
162  if ($seconds == $current) {
163  echo ' checked';
164  }
165 
166  echo ' />' . intval($seconds / 60) . ' min</label>';
167 
168  }
169 
170  ?>
171  </div>
172  </div>
173  <div class="modal-footer">
174  <button type="submit" class="btn btn-primary" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-ok"></span> <?php echo $this->tb['btn_ok']; ?></button>
175  </div>
176  </form>
177  </div>
178  </div>
179  </div>
180 
181  <!-- Cache Clear -->
182  <div class="modal fade" id="cache-clear-modal" tabindex="-1">
183  <div class="modal-dialog modal-sm">
184  <div class="modal-content">
185  <form class="automad-form" data-automad-handler="clear_cache">
186  <div class="modal-body">
187  <button type="submit" class="btn btn-primary btn-block" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-repeat"></span> <?php echo $this->tb['sys_cache_clear']; ?></button>
188  </div>
189  </form>
190  <div class="modal-footer">
191  <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> <?php echo $this->tb['btn_close']; ?></button>
192  </div>
193  </div>
194  </div>
195  </div>
196 
197  <!-- File Types -->
198  <div class="modal fade automad-close-on-success" id="file-types-modal" tabindex="-1">
199  <div class="modal-dialog">
200  <div class="modal-content">
201  <div class="modal-header">
202  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
203  <h3 class="modal-title"><?php echo $this->tb['sys_file_types']; ?></h3>
204  </div>
205  <form class="automad-form" data-automad-handler="update_config">
206  <div class="modal-body">
207  <?php echo $this->tb['sys_file_types_help']; ?>
208  <input type="text" class="form-control" name="file-types" value="<?php echo AM_ALLOWED_FILE_TYPES; ?>" />
209  </div>
210  <div class="modal-footer">
211  <button type="submit" class="btn btn-primary" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-ok"></span> <?php echo $this->tb['btn_ok']; ?></button>
212  </div>
213  </form>
214 
215  </div>
216  </div>
217  </div>
218 
219  <!-- Debugging -->
220  <div class="modal fade automad-close-on-success" id="debug-modal" tabindex="-1">
221  <div class="modal-dialog modal-sm">
222  <div class="modal-content">
223  <div class="modal-header">
224  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
225  <h3 class="modal-title"><?php echo $this->tb['sys_debug']; ?></h3>
226  </div>
227  <form class="automad-form" data-automad-handler="update_config">
228  <div class="modal-body">
229  <div class="btn-group btn-group-justified" data-toggle="buttons">
230  <label class="btn btn-default btn-lg<?php if (AM_DEBUG_ENABLED) { echo ' active'; } ?>">
231  <input type="radio" name="debug" value="on"<?php if (AM_DEBUG_ENABLED) { echo ' checked'; } ?> />On
232  </label>
233  <label class="btn btn-default btn-lg<?php if (!AM_DEBUG_ENABLED) { echo ' active'; } ?>">
234  <input type="radio" name="debug" value="off"<?php if (!AM_DEBUG_ENABLED) { echo ' checked'; } ?> />Off
235  </label>
236  </div>
237  </div>
238  <div class="modal-footer">
239  <button type="submit" class="btn btn-primary" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-ok"></span> <?php echo $this->tb['btn_ok']; ?></button>
240  </div>
241  </form>
242  </div>
243  </div>
244  </div>
245 
246  <!-- Change Password -->
247  <div class="modal fade" id="change-password-modal" tabindex="-1">
248  <div class="modal-dialog">
249  <div class="modal-content">
250  <div class="modal-header">
251  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
252  <h3 class="modal-title"><?php echo $this->tb['sys_user_change_password']; ?></h3>
253  </div>
254  <form class="automad-form automad-reset" data-automad-handler="change_password">
255  <div class="modal-body">
256  <div class="form-group">
257  <label for="change-current-password"><?php echo $this->tb['sys_user_change_password_current']; ?></label>
258  <input id="change-current-password" class="form-control" type="password" name="current-password" required />
259  </div>
260  <div class="form-group">
261  <label for="change-new-password1"><?php echo $this->tb['sys_user_change_password_new']; ?></label>
262  <input id="change-new-password1" class="form-control" type="password" name="new-password1" required />
263  </div>
264  <div class="form-group">
265  <label for="change-new-password2"><?php echo $this->tb['sys_user_change_password_repeat']; ?></label>
266  <input id="change-new-password2" class="form-control" type="password" name="new-password2" required />
267  </div>
268  </div>
269  <div class="modal-footer">
270  <div class="btn-group btn-group-justified">
271  <div class="btn-group">
272  <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> <?php echo $this->tb['btn_close']; ?></button>
273  </div>
274  <div class="btn-group">
275  <button type="submit" class="btn btn-success" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-ok"></span> <?php echo $this->tb['btn_save']; ?></button>
276  </div>
277  </div>
278  </div>
279  </form>
280  </div>
281  </div>
282  </div>
283 
284  <!-- Add User -->
285  <div class="modal fade" id="add-user-modal" tabindex="-1">
286  <div class="modal-dialog">
287  <div class="modal-content">
288  <div class="modal-header">
289  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
290  <h3 class="modal-title"><?php echo $this->tb['sys_user_add']; ?></h3>
291  </div>
292  <form class="automad-form automad-reset" data-automad-handler="add_user">
293  <div class="modal-body">
294  <div class="form-group">
295  <label for="add-username"><?php echo $this->tb['sys_user_add_name']; ?></label>
296  <input id="add-username" class="form-control" type="text" name="username" required />
297  </div>
298  <div class="form-group">
299  <label for="add-password1"><?php echo $this->tb['sys_user_add_password']; ?></label>
300  <input id="add-password1" class="form-control" type="password" name="password1" required />
301  </div>
302  <div class="form-group">
303  <label for="add-password2"><?php echo $this->tb['sys_user_add_repeat']; ?></label>
304  <input id="add-password2" class="form-control" type="password" name="password2" required />
305  </div>
306  </div>
307  <div class="modal-footer">
308  <div class="btn-group btn-group-justified">
309  <div class="btn-group">
310  <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> <?php echo $this->tb['btn_close']; ?></button>
311  </div>
312  <div class="btn-group">
313  <button type="submit" class="btn btn-primary" data-loading-text="<?php echo $this->tb['btn_loading']; ?>"><span class="glyphicon glyphicon-plus"></span> <?php echo $this->tb['btn_add']; ?></button>
314  </div>
315  </div>
316  </div>
317  </form>
318  </div>
319  </div>
320  </div>
321 
322  <!-- Users -->
323  <div class="modal fade" id="users-modal" tabindex="-1">
324  <div class="modal-dialog">
325  <div class="modal-content">
326  <div class="modal-header">
327  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
328  <h3 class="modal-title"><?php echo $this->tb['sys_user_registered']; ?></h3>
329  </div>
330  <form id="users" class="automad-form automad-init" data-automad-handler="users"></form>
331  </div>
332  </div>
333  </div>
334 
335 <?php
336 
337 
338 $this->element('footer');
339 
340 
341 ?>