-
Notifications
You must be signed in to change notification settings - Fork 10
/
message_manager.php
65 lines (50 loc) · 1.29 KB
/
message_manager.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
<?php
require './includes/bootstrap.php';
$template->title = 'Message manager';
if( ! $perm->get('manage_messages')) {
error::fatal(m('Error: Access denied'));
}
$messages = $lang->get_default_messages();
?>
<p>From this page, you can edit the text of MiniBBS's interface.</p>
<?php
/* Print custom messages */
$columns = array
(
'Key',
'Message'
);
$table = new Table($columns, 1);
$table->add_td_class(0, 'topic_headline');
$res = $db->q('SELECT `key`, `message` AS text FROM messages');
while($message = $res->fetchObject()) {
/* Unset default message */
unset($messages[$message->key]);
$values = array
(
'<a href="'.DIR.'edit_message/'.urlencode($message->key).'">'.htmlspecialchars($message->key).'</a>',
htmlspecialchars($message->text)
);
$table->row($values);
}
if($table->row_count) {
echo '<h4 class="section">Custom messages</h4>';
$table->output();
}
/* Print default messages */
$table = new Table($columns, 1);
$table->add_td_class(0, 'topic_headline');
foreach($messages as $key => $text) {
$values = array
(
'<a href="'.DIR.'edit_message/'.urlencode($key).'">'.htmlspecialchars($key).'</a>',
htmlspecialchars($text)
);
$table->row($values);
}
if($table->row_count) {
echo '<h4 class="section">Default messages</h4>';
$table->output();
}
$template->render();
?>