/[pkg-tikiwiki]/trunk/tiki-admin_chat.php
ViewVC logotype

Contents of /trunk/tiki-admin_chat.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Tue Jul 11 06:27:24 2006 UTC (6 years, 10 months ago) by marcusb-guest
File size: 2897 byte(s)
Imported into trunk (integration branch).
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-admin_chat.php,v 1.9.2.3 2005/01/05 19:45:08 jburleyebuilt Exp $
4
5 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
6 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
7 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
8
9 // Initialization
10 require_once ('tiki-setup.php');
11
12 include_once ('lib/chat/chatlib.php');
13
14 if ($tiki_p_admin_chat != 'y') {
15 $smarty->assign('msg', tra("You do not have permission to use this feature"));
16
17 $smarty->display("error.tpl");
18 die;
19 }
20
21 if (!isset($_REQUEST["channelId"])) {
22 $_REQUEST["channelId"] = 0;
23 }
24
25 $smarty->assign('channelId', $_REQUEST["channelId"]);
26
27 if ($_REQUEST["channelId"]) {
28 $info = $chatlib->get_channel($_REQUEST["channelId"]);
29 } else {
30 $info = array();
31
32 $info["name"] = '';
33 $info["description"] = '';
34 $info["active"] = 'y';
35 $info["refresh"] = 3000;
36 }
37
38 $smarty->assign('name', $info["name"]);
39 $smarty->assign('description', $info["description"]);
40 $smarty->assign('active', $info["active"]);
41 $smarty->assign('refresh', $info["refresh"]);
42
43 if (isset($_REQUEST["remove"])) {
44 $area = "delchatchannel";
45 if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
46 key_check($area);
47 $chatlib->remove_channel($_REQUEST["remove"]);
48 } else {
49 key_get($area);
50 }
51 }
52
53 if (isset($_REQUEST["save"])) {
54 check_ticket('admin-chat');
55 if (isset($_REQUEST["active"]) && $_REQUEST["active"] == 'on') {
56 $active = 'y';
57 } else {
58 $active = 'n';
59 }
60
61 $chatlib->replace_channel($_REQUEST["channelId"], $_REQUEST["name"], $_REQUEST["description"], 0,
62 'n', $active, $_REQUEST["refresh"]);
63 }
64
65 if (!isset($_REQUEST["sort_mode"])) {
66 $sort_mode = 'name_desc';
67 } else {
68 $sort_mode = $_REQUEST["sort_mode"];
69 }
70
71 if (!isset($_REQUEST["offset"])) {
72 $offset = 0;
73 } else {
74 $offset = $_REQUEST["offset"];
75 }
76
77 $smarty->assign_by_ref('offset', $offset);
78
79 if (isset($_REQUEST["find"])) {
80 $find = $_REQUEST["find"];
81 } else {
82 $find = '';
83 }
84
85 $smarty->assign('find', $find);
86
87 $smarty->assign_by_ref('sort_mode', $sort_mode);
88
89 $channels = $chatlib->list_channels($offset, $maxRecords, $sort_mode, $find);
90
91 $cant_pages = ceil($channels["cant"] / $maxRecords);
92 $smarty->assign_by_ref('cant_pages', $cant_pages);
93 $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
94
95 if ($channels["cant"] > ($offset + $maxRecords)) {
96 $smarty->assign('next_offset', $offset + $maxRecords);
97 } else {
98 $smarty->assign('next_offset', -1);
99 }
100
101 // If offset is > 0 then prev_offset
102 if ($offset > 0) {
103 $smarty->assign('prev_offset', $offset - $maxRecords);
104 } else {
105 $smarty->assign('prev_offset', -1);
106 }
107
108 $smarty->assign_by_ref('channels', $channels["data"]);
109
110 ask_ticket('admin-chat');
111
112 // Display the template
113 $smarty->assign('mid', 'tiki-admin_chat.tpl');
114 $smarty->display("tiki.tpl");
115
116 ?>

  ViewVC Help
Powered by ViewVC 1.1.5