source: extensions/Admin_Messages/admin/list.php @ 27476

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

Reorganize language files

File size: 1.8 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// +-----------------------------------------------------------------------+
5//        Supression d'un message
6// +-----------------------------------------------------------------------+
7if (isset($_GET['delete_message'])) {
8  pwg_query("DELETE FROM ". AM_TABLE ." WHERE id = ". $_GET['delete_message'] .";");
9  if (isset($_GET['redirect']) AND $_GET['redirect'] = 'home')
10    redirect(get_root_url() . 'admin.php#messages');
11  else
12    array_push($page['infos'], l10n('Message deleted'));
13}
14
15if (isset($_GET['msg']) and $_GET['msg'] == 'added')
16{
17  array_push($page['infos'], l10n('Message added'));
18}
19
20
21// +-----------------------------------------------------------------------+
22//        Affichage des messages
23// +-----------------------------------------------------------------------+
24$messages = pwg_query("SELECT * FROM `". AM_TABLE ."`
25  ORDER BY add_date DESC;");
26 
27if (pwg_db_num_rows($messages)) {
28  while ($message = pwg_db_fetch_assoc($messages)) {
29    $item = array(
30      'DATE' => format_date($message['add_date'], true),
31      'AUTHOR' => $message['author'],
32      'CONTENT' => $message['content'],
33    );
34    if (is_admin() OR $message['author'] = $user['username']) {
35      $item['U_DELETE'] = AM_ADMIN . '&amp;delete_message=' . $message['id'];
36      $item['U_EDIT'] = AM_ADMIN . '&amp;tab=edit&amp;message_id=' . $message['id'];
37    } 
38   
39    $template->append('messages', $item);
40  }
41 
42}
43
44
45// +-----------------------------------------------------------------------+
46//        Template
47// +-----------------------------------------------------------------------+
48$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/list.tpl'));
49$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
50 
51?>
Note: See TracBrowser for help on using the repository browser.