1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // Langue et configuration |
---|
5 | load_language('plugin.lang', AM_PATH); |
---|
6 | $conf['admin_messages'] = unserialize($conf['admin_messages']); |
---|
7 | |
---|
8 | |
---|
9 | // +-----------------------------------------------------------------------+ |
---|
10 | // Affichage des messages |
---|
11 | // +-----------------------------------------------------------------------+ |
---|
12 | $messages = pwg_query("SELECT * FROM `". AM_TABLE ."` |
---|
13 | ORDER BY add_date DESC |
---|
14 | LIMIT 0, ". $conf['admin_messages']['nb_messages'] .";"); |
---|
15 | |
---|
16 | if (pwg_db_num_rows($messages)) { |
---|
17 | while ($message = pwg_db_fetch_assoc($messages)) { |
---|
18 | $item = array( |
---|
19 | 'DATE' => format_date($message['add_date'], true), |
---|
20 | 'AUTHOR' => $message['author'], |
---|
21 | 'CONTENT' => $message['content'], |
---|
22 | ); |
---|
23 | if (is_admin() OR $message['author'] = $user['username']) { |
---|
24 | $item['U_DELETE'] = AM_ADMIN . '&delete_message=' . $message['id'] . '&redirect=home'; |
---|
25 | $item['U_EDIT'] = AM_ADMIN . '-edit&message_id=' . $message['id'] . '&redirect=home'; |
---|
26 | } |
---|
27 | |
---|
28 | $template->append('am_messages', $item); |
---|
29 | } |
---|
30 | |
---|
31 | } |
---|
32 | |
---|
33 | |
---|
34 | // +-----------------------------------------------------------------------+ |
---|
35 | // Template |
---|
36 | // +-----------------------------------------------------------------------+ |
---|
37 | $template->assign(array( |
---|
38 | 'AM_ADMIN' => AM_ADMIN, |
---|
39 | 'USERNAME' => $user['username'], |
---|
40 | 'AM_PATH' => AM_PATH |
---|
41 | )); |
---|
42 | |
---|
43 | $template->set_filenames(array('admin_messages' => dirname(__FILE__) .'/template/admin_messages.tpl')); |
---|
44 | $template->pparse('admin_messages'); |
---|
45 | |
---|
46 | ?> |
---|