[9421] | 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 | // +-----------------------------------------------------------------------+ |
---|
[12356] | 10 | // Affichage des messages |
---|
[9421] | 11 | // +-----------------------------------------------------------------------+ |
---|
| 12 | $messages = pwg_query("SELECT * FROM `". AM_TABLE ."` |
---|
[12356] | 13 | ORDER BY add_date DESC |
---|
| 14 | LIMIT 0, ". $conf['admin_messages']['nb_messages'] .";"); |
---|
| 15 | |
---|
[9421] | 16 | if (pwg_db_num_rows($messages)) { |
---|
[12356] | 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('messages', $item); |
---|
| 29 | } |
---|
| 30 | |
---|
[9421] | 31 | } |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | // +-----------------------------------------------------------------------+ |
---|
[12356] | 35 | // Template |
---|
[9421] | 36 | // +-----------------------------------------------------------------------+ |
---|
| 37 | $template->assign(array( |
---|
[12356] | 38 | 'AM_ADMIN' => AM_ADMIN, |
---|
| 39 | 'USERNAME' => $user['username'], |
---|
| 40 | 'AM_PATH' => AM_PATH |
---|
[9421] | 41 | )); |
---|
| 42 | |
---|
| 43 | $template->set_filenames(array('admin_messages' => dirname(__FILE__) .'/template/admin_messages.tpl')); |
---|
| 44 | $template->pparse('admin_messages'); |
---|
[12356] | 45 | |
---|
[9421] | 46 | ?> |
---|