Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezforum/admin/messageedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messageedit.php 7788 2001-10-11 12:00:35Z jhe $
5 //
6 // Created on: Created on: <18-Jul-2000 08:56:19 lw>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/ezhttptool.php" );
29 $ini =& eZINI::instance( 'site.ini' );
30
31 $Language = $ini->variable( "eZForumMain", "Language" );
32 $error = new eZINI( "kernel/ezforum/admin/intl/" . $Language . "/messageedit.php.ini", false );
33
34 // include_once( "ezforum/classes/ezforummessage.php" );
35 // include_once( "ezforum/classes/ezforum.php" );
36 // include_once( "ezforum/classes/ezforumcategory.php" );
37 // include_once( "classes/eztemplate.php" );
38 // include_once( "classes/ezlocale.php" );
39
40 require( "kernel/ezuser/admin/admincheck.php" );
41
42
43 if ( isset( $DeleteMessages ) )
44 {
45 $Action = "DeleteMessages";
46 }
47
48 if ( $Action == "update" )
49 {
50 if ( eZPermission::checkPermission( $user, "eZForum", "MessageModify" ) )
51 {
52 if ( $Topic != "" &&
53 $Body != "" )
54 {
55 $msg = new eZForumMessage();
56 $msg->get( $MessageID );
57 $msg->setTopic( $Topic );
58 $msg->setBody( $Body );
59
60 if ( $notice )
61 $msg->enableEmailNotice();
62 else
63 $msg->disableEmailNotice();
64
65 $ForumID = $msg->forumID();
66
67 $forum = new eZForum( $ForumID );
68
69 $msg->store();
70
71 eZHTTPTool::header( "Location: /forum/messagelist/$ForumID/" );
72 exit();
73 }
74 else
75 {
76 $error_msg = $error->variable( "strings", "error_missingdata" );
77 }
78 }
79 else
80 {
81 eZHTTPTool::header( "Location: /forum/norights" );
82 }
83
84 }
85
86 if ( $Action == "delete" )
87 {
88 if ( eZPermission::checkPermission( $user, "eZForum", "MessageDelete" ) )
89 {
90 if ( $MessageID != "" )
91 {
92 $msg = new eZForumMessage();
93 $msg->get( $MessageID );
94 $msg->delete();
95
96 $ForumID = $msg->forumID();
97 $forum = new eZForum( $ForumID );
98
99 eZHTTPTool::header( "Location: /forum/messagelist/$ForumID" );
100 exit();
101 }
102 else
103 {
104 $error_msg = $error->variable( "strings", "error_missingdata" );
105 }
106 }
107 else
108 {
109 eZHTTPTool::header( "Location: /forum/norights" );
110 }
111 }
112
113 if ( $Action == "DeleteMessages" )
114 {
115 if ( count( $MessageArrayID ) != 0 )
116 {
117 foreach ( $MessageArrayID as $MessageID )
118 {
119 $message = new eZForumMessage( $MessageID );
120 $forumID = $message->forumID();
121 $message->delete();
122
123 }
124
125 if ( empty( $RefererURL ) )
126 {
127 eZHTTPTool::header( "Location: /forum/messagelist/$forumID" );
128 exit();
129 }
130 else
131 {
132 eZHTTPTool::header( "Location: /forum/search/$RefererURL" );
133 exit();
134 }
135 }
136 }
137
138 $t = new eZTemplate( "kernel/ezforum/admin/" . $ini->variable( "eZForumMain", "AdminTemplateDir" ),
139 "kernel/ezforum/admin/" . "/intl", $Language, "messageedit.php" );
140 $t->setAllStrings();
141
142 $t->set_file( Array( "message_page" => "messageedit.tpl" ) );
143
144 $languageIni = new eZINI( "kernel/ezforum/admin/" . "intl/" . $Language . "/messageedit.php.ini", false );
145 $headline = $languageIni->variable( "strings", "head_line_insert" );
146
147 $t->set_block( "message_page", "message_edit_tpl", "message_edit" );
148 $locale = new eZLocale( $Language );
149
150 $t->set_var( "message_topic", "" );
151 $t->set_var( "message_postingtime", "" );
152 $t->set_var( "message_body", "" );
153 $t->set_var( "message_user", "" );
154 $t->set_var( "message_id", $MessageID );
155 $action_value = "update";
156
157 if ( $Action == "new" )
158 {
159 if ( !eZPermission::checkPermission( $user, "eZForum", "MessageModifyAdd" ) )
160 {
161 eZHTTPTool::header( "Location: /forum/norights" );
162 }
163
164 $action_value = "insert";
165 }
166
167
168 if ( $Action == "edit" )
169 {
170 $languageIni = new eZINI( "kernel/ezforum/admin/" . "intl/" . $Language . "/messageedit.php.ini", false );
171 $headline = $languageIni->variable( "strings", "head_line_edit" );
172
173 if ( !eZPermission::checkPermission( $user, "eZForum", "MessageModify" ) )
174 {
175 eZHTTPTool::header( "Location: /forum/norights" );
176 }
177 else
178 {
179 $msg = new eZForumMessage();
180 $msg->get( $MessageID );
181 $t->set_var( "message_topic", $msg->topic() );
182 $t->set_var( "message_postingtime", $locale->format( $msg->postingTime() ) );
183 $t->set_var( "message_body", $msg->body() );
184 $author = $msg->user();
185
186 if ( $msg->userName() )
187 $anonymous = $msg->userName();
188 else
189 $anonymous = $ini->variable( "eZForumMain", "AnonymousPoster" );
190
191 if ( $author->id() == 0 )
192 {
193 $MessageAuthor = $anonymous;
194 }
195 else
196 {
197 $MessageAuthor = $author->firstName() . " " . $author->lastName();
198 }
199
200 $t->set_var( "message_user", $MessageAuthor );
201 $action_value = "update";
202 $t->set_var( "message_id", $MessageID );
203 $t->set_var( "forum_id", $msg->forumID() );
204 }
205 }
206
207 $t->set_var( "action_value", $action_value );
208 $t->set_var( "error_msg", $error_msg );
209 $t->set_var( "category_id", $CategoryID );
210 $t->set_var( "headline", $headline );
211 $t->pparse( "output", "message_page" );
212
213 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$author
$author
Definition: admin/articleedit.php:834
$forum
$forum
Definition: admin/forumlist.php:50
$message
$message
Definition: admin/message.php:51
$anonymous
else $anonymous
Definition: admin/message.php:73
eZForumMessage
Definition: ezforummessage.php:42
eZForum
Definition: ezforum.php:44
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZLocale
Definition: ezlocale.php:119
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$msg
$msg
Definition: editmessage.php:47
$languageIni
$languageIni
Definition: ezforum/admin/messageedit.php:144
$locale
$locale
Definition: ezforum/admin/messageedit.php:148
$t
if(isset( $DeleteMessages)) if( $Action=="update") if( $Action=="delete") if( $Action=="DeleteMessages") $t
Definition: ezforum/admin/messageedit.php:138
$headline
$headline
Definition: ezforum/admin/messageedit.php:145
$Language
$Language
Definition: ezforum/admin/messageedit.php:31
$ini
$ini
Definition: ezforum/admin/messageedit.php:29
$action_value
$action_value
Definition: ezforum/admin/messageedit.php:155
$error
$error
Definition: ezforum/admin/messageedit.php:32
$error_msg
$error_msg
Definition: ezlink/admin/categoryedit.php:33
exit
exit
Definition: folder.php:81
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.