Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmessage/admin/messageedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messageedit.php 6484 2001-08-17 13:36:01Z jhe $
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
37 $usersValid = true;
38 $MessageSent = false;
39
40 if ( isset( $SendMessage ) )
41 {
42 $users = explode( ",", $Receiver );
43
44 // check for valid users:
45 foreach ( $users as $user )
46 {
47 $user = trim( $user );
48 $exists = eZUser::exists( $user );
49 if ( !is_a( $exists, "eZUser" ) )
50 $usersValid = false;
51 }
52
53 if ( $usersValid == true )
54 {
55 foreach ( $users as $user )
56 {
57 $user = trim( $user );
58
59 $message = new eZMessage( );
60 if ( trim ( $Subject ) == "" )
61 $Subject = "None Subject";
62 $message->setSubject( $Subject );
63 if ( trim ( $Description ) == "" )
64 $Description = "None Description";
65 $message->setDescription( $Description );
66 $toUser = eZUser::getUser( $user );
67 $message->setToUser( $toUser );
68
69 $fromUser =& eZUser::currentUser();
70 $message->setFromUser( $fromUser );
71
72 $message->store();
73 $MessageID = $message->id();
74
75 $messageDefinition = new eZMessageDefinition();
76 $messageDefinition->setMessageID( $MessageID );
77 $messageDefinition->setToUserID( $toUser );
78 $messageDefinition->setFromUserID( $fromUser );
79 $messageDefinition->store();
80
81 $messageDefinition = new eZMessageDefinition();
82 $messageDefinition->setMessageID( $MessageID );
83 $messageDefinition->setToUserID( $fromUser );
84 $messageDefinition->setFromUserID( $toUser );
85 $messageDefinition->store();
86 $MessageSent = true;
87
88 }
89 }
90 }
91
92 $t = new eZTemplate( "kernel/ezmessage/admin/" . $ini->variable( "eZMessageMain", "AdminTemplateDir" ),
93 "kernel/ezmessage/admin/intl", $Language, "messageedit.php" );
94
95 $locale = new eZLocale( $Language );
96
97 $t->set_file( "message_page_tpl", "messageedit.tpl" );
98
99 $t->set_block( "message_page_tpl", "error_tpl", "error" );
100 $t->set_block( "message_page_tpl", "message_sent_tpl", "message_sent" );
101 $t->set_block( "message_page_tpl", "message_verify_tpl", "message_verify" );
102 $t->set_block( "message_verify_tpl", "message_receiver_tpl", "message_receiver" );
103 $t->set_block( "message_page_tpl", "message_edit_tpl", "message_edit" );
104
105 $t->setAllStrings();
106
107 $t->set_var( "receiver", isset( $Receiver ) ? $Receiver : false );
108 $t->set_var( "subject", isset( $Subject ) ? $Subject : false );
109 $t->set_var( "description", isset( $Description ) ? $Description : false );
110
111 $t->set_var( "error", "" );
112
113 if ( isset ( $Reply ) )
114 {
115 $fromUser = new eZUser ( $FromUserID );
116 $t->set_var( "description", eZTextTool::addPre( $Message ), ">" );
117 $t->set_var( "receiver", $fromUser->login() );
118 }
119
120 if ( isset( $MessageSent ) && $MessageSent == true )
121 {
122 $t->parse( "message_sent", "message_sent_tpl" );
123 $t->set_var( "message_verify", "" );
124 $t->set_var( "message_edit", "" );
125 }
126 else if ( !isset( $Preview ) || isset( $Edit ) )
127 {
128 $t->parse( "message_edit", "message_edit_tpl" );
129 $t->set_var( "message_verify", "" );
130 $t->set_var( "message_sent", "" );
131
132 }
133 else
134 {
135 if ( substr( trim( $Receiver ) ,strlen( trim( $Receiver ) ) -1 ) == "," )
136 $Receiver = substr( trim( $Receiver ) , 0, strlen( trim( $Receiver ) ) -1 );
137
138 $users = explode( ",", $Receiver );
139
140 // check for valid users:
141 $usersValid = true;
142 foreach ( $users as $user )
143 {
144 $user = trim( $user );
145
146 if ( !eZUser::exists( $user ) )
147 $usersValid = false;
148 }
149
150 if ( $usersValid == true )
151 {
152 foreach ( $users as $user )
153 {
154 $user = trim( $user );
155
156 $toUser = eZUser::getUser( $user );
157
158 $t->set_var( "login", $user );
159 $t->set_var( "first_name", $toUser->firstName() );
160 $t->set_var( "last_name", $toUser->lastName() );
161 $t->parse( "message_receiver", "message_receiver_tpl", true );
162 }
163
164 $t->parse( "message_verify", "message_verify_tpl" );
165 $t->set_var( "message_edit", "" );
166 $t->set_var( "message_sent", "" );
167 }
168 else
169 {
170 // show error
171 $t->parse( "error", "error_tpl" );
172 $t->parse( "message_edit", "message_edit_tpl" );
173 $t->set_var( "message_verify", "" );
174 $t->set_var( "message_sent", "" );
175
176 }
177 }
178
179 $t->pparse( "output", "message_page_tpl" );
180
181 ?>
$message
$message
Definition: admin/message.php:51
$Description
$Description
Definition: articlelistrss.php:38
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
$Language
$Language
Definition: classes/admin/linklist.php:65
$ini
$ini
Definition: classes/admin/linklist.php:64
$t
if(isset( $SendMessage)) $t
Definition: ezmessage/admin/messageedit.php:92
$users
$users
Definition: ezmessage/admin/messageedit.php:138
$locale
$locale
Definition: ezmessage/admin/messageedit.php:95
$usersValid
$usersValid
Definition: ezmessage/admin/messageedit.php:37
$MessageSent
$MessageSent
Definition: ezmessage/admin/messageedit.php:38
$Edit
$Edit
Definition: ezmessage/user/messageedit.php:120
$Subject
$Subject
Definition: ezmessage/user/messageedit.php:117
$Reply
$Reply
Definition: ezmessage/user/messageedit.php:119
$Preview
$Preview
Definition: ezmessage/user/messageedit.php:121
$Receiver
$Receiver
Definition: ezmessage/user/messageedit.php:116
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.