Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

messageform.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messageform.php 9553 2002-05-22 11:24:54Z jhe $
5 //
6 // Created on: <21-Feb-2001 18:00:00 pkej>
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/ezlocale.php" );
28 // include_once( "classes/eztexttool.php" );
29
30 $ini = eZINI::instance( 'site.ini' );
31 $AllowHTML = $ini->variable( "eZForumMain", "AllowHTML" );
32 $language = $ini->variable( "eZForumMain", "Language" );
33 $AllowedTags = $ini->variable( "eZForumMain", "AllowedTags" );
34
35 $author = eZUser::currentUser();
36
37 $locale = new eZLocale( $language );
38
39 if ( isset( $ShowMessageForm ) && $ShowMessageForm )
40 {
41 if ( isset( $ShowVisibleMessageForm ) && $ShowVisibleMessageForm )
42 {
43 $t->set_file( "form", "messageform.tpl" );
44 $t->set_block( "form", "author_field_tpl", "author_field" );
45 $t->set_block( "author_field_tpl", "author_logged_in_tpl", "author_logged_in" );
46 $t->set_block( "author_field_tpl", "author_not_logged_in_tpl", "author_not_logged_in" );
47
48 $t->set_block( "form", "message_body_info_tpl", "message_body_info_item" );
49 $t->set_block( "form", "message_reply_info_tpl", "message_reply_info_item" );
50 $t->set_block( "form", "message_notice_checkbox_tpl", "message_notice_checkbox" );
51 $t->set_var( "message_body_info_item", "" );
52 $t->set_var( "message_reply_info_item", "" );
53 $t->set_var( "message_notice_checkbox", "" );
54 $t->set_var( "allowed_tags", htmlspecialchars( $AllowedTags ) );
55 $t->set_var( "headline", $t->Ini->variable( "strings", $Action . "_headline" ) );
56 }
57
58 if ( isset( $ShowHiddenMessageForm ) && $ShowHiddenMessageForm )
59 {
60 $t->set_file( "hidden_form", "messagehiddenform.tpl" );
61 }
62
63 if (( $ShowBodyInfo ) && ( $AllowHTML ))
64 $t->parse( "message_body_info", "message_body_info_tpl" );
65
66 if ( isset( $BodyInfo ) && $BodyInfo )
67 {
68 $t->parse( "message_body_info_item", "message_body_info_tpl" );
69 }
70
71 if ( isset( $ShowVisibleMessageForm ) && $ShowVisibleMessageForm && is_a( eZUser::currentUser(), "eZUser" ) )
72 {
73 $t->parse( "message_notice_checkbox", "message_notice_checkbox_tpl" );
74 }
75
76 if ( isset( $ReplyInfo ) && $ReplyInfo )
77 {
78 $t->parse( "message_reply_info_item", "message_reply_info_tpl" );
79 }
80
81 if ( isset( $Error ) && $Error )
82 {
83 $MessageTopic = $NewMessageTopic;
84 $MessageBody = $NewMessageBody;
85
86 $t->set_block( "errors_tpl", "error_missing_body_item_tpl", "error_missing_body_item" );
87 $t->set_block( "errors_tpl", "error_missing_topic_item_tpl", "error_missing_topic_item" );
88
89 if ( empty( $NewMessageTopic ) )
90 {
91 $t->parse( "error_missing_topic_item", "error_missing_topic_item_tpl" );
92 }
93 else
94 {
95 $t->set_var( "error_missing_topic_item", "" );
96 }
97
98 if ( empty( $NewMessageBody ) )
99 {
100 $t->parse( "error_missing_body_item", "error_missing_body_item_tpl" );
101 }
102 else
103 {
104 $t->set_var( "error_missing_body_item", "" );
105 }
106
107 $t->parse( "errors_item", "errors_tpl" );
108 }
109
110 if ( isset( $ShowEmptyMessageForm ) && $ShowEmptyMessageForm === true )
111 {
112 if ( !is_object( $msg ) )
113 {
114 $msg = new eZForumMessage( $MessageID );
115 $msg->setIsTemporary( true );
116 }
117
118 if ( isset( $NewMessageTopic ) )
119 {
120 $MessageTopic = $NewMessageTopic;
121 }
122 else
123 {
124 $MessageTopic = $msg->topic();
125 }
126
127 if ( isset( $NewMessageBody ) )
128 {
129 $MessageBody = $NewMessageBody;
130 }
131 else
132 {
133 $MessageBody = $msg->body();
134 }
135
136 $MessageNotice = $msg->emailNotice();
137 $ForumID = $msg->forumId();
138
139 if ( !$msg->isTemporary() && $Action != "reply" )
140 {
141 $MessagePostedAt = $Locale->format( $msg->postingTime() );
142 }
143 else
144 {
145 $MessagePostedAt = $NewMessagePostedAt;
146 }
147
148 if ( isset( $NewMessageNotice ) )
149 {
150 $MessageNotice = $NewMessageNotice;
151 }
152 }
153 else
154 {
155 if ( isset( $NewMessageAuthor ) )
156 {
157 $MessageAuthor = $NewMessageAuthor;
158 }
159 else
160 {
161 if ( $msg->userName() != "" && $Action != "reply" )
162 {
163 $MessageAuthor = $msg->userName();
164 }
165 else if ( !is_object( $author ) )
166 {
167 $author = eZUser::currentUser();
168 }
169 }
170 if ( $msg->isTemporary() )
171 {
172 $MessagePostedAt = $NewMessagePostedAt;
173 }
174 else
175 {
176 $MessagePostedAt = $locale->format( $msg->postingTime() );
177 }
178 }
179
180 if ( is_object( $author ) && $author->id() > 0 )
181 {
182 $MessageAuthor = $author->firstName() . " " . $author->lastName();
183 }
184 else if ( $msg->userName() != "" && $Action != "reply" )
185 {
186 $MessageAuthor = $msg->userName();
187 }
188 else
189 {
190 $MessageAuthor = $ini->variable( "eZForumMain", "AnonymousPoster" );
191 }
192
193 switch ( $MessageNotice )
194 {
195 case "on":
196 case "y":
197 case "checked":
198 case 1:
199 case true:
200 {
201 $MessageNoticeText = $t->Ini->variable( "strings", "notice_yes" );
202 $MessageNotice = "checked";
203 $NewMessageNotice = "checked";
204 }
205 break;
206
207 case "off":
208 case "n":
209 case "unchecked":
210 case 0:
211 case false:
212 {
213 $MessageNoticeText = $t->Ini->variable( "strings", "notice_no" );
214 $MessageNotice = "";
215 $NewMessageNotice = "";
216 }
217 break;
218 }
219
220 $quote = "/". chr( 34 ) . "/";
221
222 if( !is_null( $MessageTopic ) )
223 $MessageTopic = preg_replace( $quote, "&#034;", $MessageTopic );
224
225 if( !is_null( $MessageBody ) )
226 $MessageBody = preg_replace( $quote, "&#034;", $MessageBody );
227
228 // include_once( "classes/eztexttool.php" );
229
230 $t->set_var( "message_topic", isset( $MessageTopic ) ? $MessageTopic : false );
231 $t->set_var( "new_message_topic", isset( $NewMessageTopic ) ? $NewMessageTopic : false );
232 $t->set_var( "message_body", isset( $MessageBody ) ? $MessageBody : false );
233 $t->set_var( "new_message_body", isset( $NewMessageBody ) ? $NewMessageBody : false );
234 $t->set_var( "message_posted_at", isset( $MessagePostedAt ) ? $MessagePostedAt : false );
235 $t->set_var( "message_author", isset( $MessageAuthor ) ? $MessageAuthor : false );
236 $t->set_var( "message_id", isset( $MessageID ) ? $MessageID : false );
237 $t->set_var( "message_notice_text", isset( $MessageNoticeText ) ? $MessageNoticeText : false );
238 $t->set_var( "message_notice", isset( $MessageNotice ) ? $MessageNotice : false );
239 $t->set_var( "new_message_notice", isset( $NewMessageNotice ) ? $NewMessageNotice : false );
240
241 $t->set_var( "reply_to_id", isset( $ReplyToID ) ? $ReplyToID : false );
242 $t->set_var( "preview_id", isset( $PreviewID ) ? $PreviewID : false );
243 $t->set_var( "original_id", isset( $OriginalID ) ? $OriginalID : false );
244
245 $t->set_var( "forum_id", isset( $ForumID ) ? $ForumID : false );
246
247 $t->set_var( "redirect_url", eZTextTool::htmlspecialchars( isset( $RedirectURL ) ? $RedirectURL : false ) );
248 $t->set_var( "end_action", isset( $EndAction ) ? $EndAction : false );
249 $t->set_var( "start_action", isset( $StartAction ) ? $StartAction : false );
250 $t->set_var( "action_value", isset( $ActionValue ) ? $ActionValue : false );
251
252
253 $AllowedTags = $ini->variable( "eZForumMain", "AllowedTags" );
254 $t->set_var( "allowed_tags", htmlspecialchars( $AllowedTags ) );
255
256 if ( $ShowVisibleMessageForm )
257 {
258 if ( is_object( $author ) && $author->id() > 0 )
259 {
260 $t->parse( "author_field", "author_logged_in_tpl" );
261 }
262 else
263 {
264 $t->parse( "author_field", "author_not_logged_in_tpl" );
265 }
266 }
267
268 if ( $ShowHiddenMessageForm )
269 {
270 if ( isset( $doPrint ) )
271 {
272 $t->pparse( "message_hidden_form_file", "hidden_form" );
273 }
274 else
275 {
276 $t->parse( "message_hidden_form_file", "hidden_form" );
277 }
278 }
279
280 if ( $ShowVisibleMessageForm )
281 {
282 if ( isset( $doPrint ) )
283 {
284 $t->parse( "message_form_file", "form" );
285 }
286 else
287 {
288 $t->parse( "message_form_file", "form" );
289 }
290 }
291 }
292 else
293 {
294 $t->parse( "message_form_file", "" );
295 $t->parse( "message_hidden_form_file", "" );
296 }
297
298 ?>
$Locale
$Locale
Definition: admin/articleedit.php:526
eZForumMessage
Definition: ezforummessage.php:42
eZLocale
Definition: ezlocale.php:119
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$Action
$Action
Definition: companysearch.php:80
$msg
$msg
Definition: editmessage.php:47
$ActionValue
$ActionValue
Definition: ezarticle/admin/attributeedit.php:79
$Error
if(isset( $EditButton)) if(!empty( $CancelButton)) if(!empty( $PreviewButton)) if( $Action=="preview") switch( $Action) $Error
Definition: ezforum/user/messageedit.php:134
$RedirectURL
$RedirectURL
Definition: ezforum/user/userlogin.php:91
$AllowHTML
$AllowHTML
Definition: messageform.php:31
$AllowedTags
$AllowedTags
Definition: messageform.php:33
$locale
$locale
Definition: messageform.php:37
$language
$language
Definition: messageform.php:32
$ini
$ini
Definition: messageform.php:30
$author
$author
Definition: messageform.php:35
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.