Automad
 All Classes Functions Variables Pages
status.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  * Return the current status of a config item.
43  */
44 
45 
46 $output = array();
47 
48 
49 if (isset($_POST['item'])) {
50 
51  $item = $_POST['item'];
52 
53  if ($item == 'cache') {
54 
55  if (AM_CACHE_ENABLED) {
56  $output['status'] = $this->tb['sys_cache'] . ' <span class="badge on"><span class="glyphicon glyphicon-ok"></span> ' . $this->tb['sys_status_enabled'] . '</span>';
57  } else {
58  $output['status'] = $this->tb['sys_cache'] . ' <span class="badge off"><span class="glyphicon glyphicon-ban-circle"></span> ' . $this->tb['sys_status_disabled'] . '</span>';
59  }
60 
61  }
62 
63  if ($item == 'debug') {
64 
65  if (AM_DEBUG_ENABLED) {
66  $output['status'] = $this->tb['sys_debug'] . ' <span class="badge on"><span class="glyphicon glyphicon-ok"></span> ' . $this->tb['sys_status_enabled'] . '</span>';
67  } else {
68  $output['status'] = $this->tb['sys_debug'] . ' <span class="badge off"><span class="glyphicon glyphicon-ban-circle"></span> ' . $this->tb['sys_status_disabled'] . '</span>';
69  }
70 
71  }
72 
73  if ($item == 'users') {
74 
75  $accounts = $this->accountsGetArray();
76  $output['status'] = $this->tb['sys_user_registered'] . ' <span class="badge on">' . count($accounts) . '</span>';
77 
78  }
79 
80 }
81 
82 
83 echo json_encode($output);
84 
85 
86 ?>