Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmessage/user/messageedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messageedit.php,v 1.5 2001/08/17 13:36:00 jhe Exp $
5 //
6 // Created on: <05-Jun-2001 17:19:01 bf>
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/ezhttptool.php" );
29 // include_once( "classes/eztemplate.php" );
30 // include_once( "classes/INIFile.php" );
31 // include_once( "classes/eztexttool.php" );
32
33 // include_once( "ezuser/classes/ezuser.php" );
34
35 // include_once( "ezmessage/classes/ezmessage.php" );
36 // include_once( "ezmessage/classes/ezmessagemessagedefinition.php" );
37
38 $MessageSent = false;
39 if ( isset( $SendMessage ) )
40 {
41 if ( substr( trim( $Receiver ) ,strlen( trim( $Receiver ) ) -1 ) == "," )
42 $Receiver = substr( trim( $Receiver ) , 0, strlen( trim( $Receiver ) ) -1 );
43
44 $users = explode( ",", $Receiver );
45
46 // check for valid users:
47 $usersValid = true;
48 foreach ( $users as $user )
49 {
50 $user = trim( $user );
51
52 if ( !eZUser::exists( $user ) )
53 $usersValid = false;
54 }
55
56 if ( $usersValid == true )
57 {
58 foreach ( $users as $user )
59 {
60 $user = trim( $user );
61
62 $message = new eZMessage( );
63 if ( trim ( $Subject ) == "" )
64 $Subject = "None Subject";
65 $message->setSubject( $Subject );
66 if ( trim ( $Description ) == "" )
67 $Description = "None Description";
68 $message->setDescription( $Description );
69 $toUser = eZUser::getUser( $user );
70 $message->setToUser( $toUser );
71
72 $fromUser =& eZUser::currentUser();
73
74 $message->setFromUser( $fromUser );
75
76 $message->store();
77 $MessageID = $message->id();
78
79 $messageDefinition = new eZMessageDefinition();
80 $messageDefinition->setMessageID( $MessageID );
81 $messageDefinition->setToUserID( $toUser );
82 $messageDefinition->setFromUserID( $fromUser );
83 $messageDefinition->store();
84
85 $messageDefinition = new eZMessageDefinition();
86 $messageDefinition->setMessageID( $MessageID );
87 $messageDefinition->setToUserID( $fromUser );
88 $messageDefinition->setFromUserID( $toUser );
89 $messageDefinition->store();
90 $MessageSent = true;
91
92 }
93 }
94 }
95
96 $ini =& eZINI::instance( 'site.ini' );
97 $Language = $ini->variable( "eZMessageMain", "Language" );
98 $t = new eZTemplate( "kernel/ezmessage/user/" . $ini->variable( "eZMessageMain", "TemplateDir" ),
99 "kernel/ezmessage/user/intl", $Language, "messageedit.php" );
100
101 $locale = new eZLocale( $Language );
102
103
104
105 $t->set_file( "message_page_tpl", "messageedit.tpl" );
106
107 $t->set_block( "message_page_tpl", "error_tpl", "error" );
108 $t->set_block( "message_page_tpl", "message_sent_tpl", "message_sent" );
109 $t->set_block( "message_page_tpl", "message_verify_tpl", "message_verify" );
110 $t->set_block( "message_verify_tpl", "message_receiver_tpl", "message_receiver" );
111 $t->set_block( "message_page_tpl", "message_edit_tpl", "message_edit" );
112
113
114 $t->setAllStrings();
115
116 $Receiver = eZHTTPTool::getVar( "Receiver");
117 $Subject = eZHTTPTool::getVar( "Subject" );
118 $Description = eZHTTPTool::getVar( "Description" );
119 $Reply = eZHTTPTool::getVar( "Reply" );
120 $Edit = eZHTTPTool::getVar( "Edit" );
121 $Preview = eZHTTPTool::getVar( "Preview" );
122
123 $t->set_var( "receiver", $Receiver );
124 $t->set_var( "subject", $Subject );
125 $t->set_var( "description", $Description );
126
127 $mes = new eZMessage( );
128 $t->set_var( "show_description", $mes->render( $Description ) );
129 $t->set_var( "error", "" );
130
131 if ( isSet ( $Reply ) )
132 {
133 $fromUser = new eZUser ( $FromUserID );
134 $t->set_var( "full_name", $fromUser->firstName() );
135 if ( $Message != "" )
136 {
137 $t->set_var( "description", eZTextTool::addPre( $Message ), ">" );
138 }
139 else
140 {
141 $t->set_var( "description", "" );
142 }
143 $t->set_var( "receiver", $fromUser->login() );
144 }
145
146 if ( $MessageSent == true )
147 {
148 $t->parse( "message_sent", "message_sent_tpl" );
149 $t->set_var( "message_verify", "" );
150 $t->set_var( "message_edit", "" );
151 }
152 else if ( !isset( $Preview ) || isset( $Edit ) )
153 {
154 $t->parse( "message_edit", "message_edit_tpl" );
155
156 if ($Receiver != "")
157 {
158 $UserName = eZUser::getUser( $Receiver );
159 $t->set_var( "full_name", $UserName->firstName()." ".$UserName->lastName() );
160 }
161 $t->set_var( "message_verify", "" );
162 $t->set_var( "message_sent", "" );
163
164 }
165 else
166 {
167
168 if ( substr( trim( $Receiver ) ,strlen( trim( $Receiver ) ) -1 ) == "," )
169 $Receiver = substr( trim( $Receiver ) , 0, strlen( trim( $Receiver ) ) -1 );
170 $users = explode( ",", $Receiver );
171
172 // check for valid users:
173 $usersValid = true;
174 foreach ( $users as $user )
175 {
176 $user = trim( $user );
177
178 if ( !eZUser::exists( $user ) )
179 $usersValid = false;
180 }
181
182 if ( $usersValid == true )
183 {
184 //$fromUser =& eZUser::currentUser();
185 //print_r($fromUser);
186 foreach ( $users as $user )
187 {
188 $user = trim( $user );
189
190 $toUser = eZUser::getUser( $user );
191
192 $t->set_var( "login", $user );
193 $t->set_var( "first_name", $toUser->firstName() );
194 $t->set_var( "last_name", $toUser->lastName() );
195 $t->parse( "message_receiver", "message_receiver_tpl", true );
196 }
197
198 $t->parse( "message_verify", "message_verify_tpl" );
199 $t->set_var( "message_edit", "" );
200 $t->set_var( "message_sent", "" );
201 }
202 else
203 {
204 // show error
205 $t->parse( "error", "error_tpl" );
206 $t->parse( "message_edit", "message_edit_tpl" );
207 $t->set_var( "message_verify", "" );
208 $t->set_var( "message_sent", "" );
209
210 }
211 }
212
213 $t->pparse( "output", "message_page_tpl" );
214
215 if ( $MessageSent == true )
216 {
217 include( "kernel/ezmessage/user/messagelist.php" );
218 }
219
220 ?>
221
$message
$message
Definition: admin/message.php:51
$UserName
$UserName
Definition: admin/seti.php:20
eZHTTPTool\getVar
static getVar( $name, $onlyCheckPost=false)
Definition: ezhttptool.php:55
eZLocale
Definition: ezlocale.php:119
eZMessageDefinition
Definition: ezmessagemessagedefinition.php:8
eZMessage
Definition: ezmessage.php:39
eZTemplate
Definition: eztemplate.php:107
eZTextTool\addPre
static addPre( $string, $char=">")
Definition: eztexttool.php:83
eZUser
Definition: ezuser.php:76
eZUser\getUser
static getUser( $login)
Definition: ezuser.php:420
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZUser\exists
static exists( $login)
Definition: ezuser.php:556
$Edit
$Edit
Definition: ezmessage/user/messageedit.php:120
$users
$users
Definition: ezmessage/user/messageedit.php:170
$Subject
$Subject
Definition: ezmessage/user/messageedit.php:117
$Description
$Description
Definition: ezmessage/user/messageedit.php:118
$locale
$locale
Definition: ezmessage/user/messageedit.php:101
$t
$t
Definition: ezmessage/user/messageedit.php:98
$mes
$mes
Definition: ezmessage/user/messageedit.php:127
$usersValid
$usersValid
Definition: ezmessage/user/messageedit.php:173
$Language
$Language
Definition: ezmessage/user/messageedit.php:97
$Reply
$Reply
Definition: ezmessage/user/messageedit.php:119
$Preview
$Preview
Definition: ezmessage/user/messageedit.php:121
$Receiver
$Receiver
Definition: ezmessage/user/messageedit.php:116
$ini
if(isset( $SendMessage)) $ini
Definition: ezmessage/user/messageedit.php:96
$MessageSent
$MessageSent
Definition: ezmessage/user/messageedit.php:38
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.