source: extensions/Admin_Messages/admin_messages.php @ 16341

Last change on this file since 16341 was 12356, checked in by mistic100, 13 years ago

Reorganize language files

File size: 1.5 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// Langue et configuration
5load_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 
16if (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 . '&amp;delete_message=' . $message['id'] . '&amp;redirect=home';
25      $item['U_EDIT'] = AM_ADMIN . '-edit&amp;message_id=' . $message['id'] . '&amp;redirect=home';
26    } 
27   
28    $template->append('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?>
Note: See TracBrowser for help on using the repository browser.