Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmail/user/mailview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: mailview.php 7828 2001-10-14 16:20:00Z fh $
5 //
6 // Created on: <23-Oct-2000 17:53:46 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/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/ezhttptool.php" );
31 // include_once( "ezmail/classes/ezmail.php" );
32 // include_once( "ezmail/classes/ezmailfolder.php" );
33 // include_once( "ezuser/classes/ezuser.php" );
34 // include_once( "ezsession/classes/ezpreferences.php" );
35
36 // Check if this really is your mail we are talking about here..
37 if ( !eZMail::isOwner( eZUser::currentUser(), $MailID ) )
38 {
39 eZHTTPTool::header( "Location: /error/403/" );
40 exit();
41 }
42
43 if ( isset( $Cancel ) )
44 {
45 $mail = new eZMail( $MailID );
46 $folderID = $mail->folder( false );
47 eZHTTPTool::header( "Location: /mail/folder/$folderID" );
48 exit();
49 }
50
51 if ( isset( $Reply ) )
52 {
53 $mail = new eZMail( $MailID );
54 $mail->setStatus( REPLIED, true );
55 $reply = $mail->copyMail( "reply" );
56 $replyid = $reply->id();
57 $reply->setStatus( READ, true );
58
59 $drafts = eZMailFolder::getSpecialFolder( DRAFTS );
60 $drafts->addMail( $reply );
61
62 eZHTTPTool::header( "Location: /mail/mailedit/$replyid" );
63 exit();
64 }
65
66 if ( isset( $ReplyAll ) )
67 {
68 $mail = new eZMail( $MailID );
69 $mail->setStatus( REPLIED, true );
70 $reply = $mail->copyMail( "replyall" );
71 $replyid = $reply->id();
72 $reply->setStatus( READ, true );
73
74 $drafts = eZMailFolder::getSpecialFolder( DRAFTS );
75 $drafts->addMail( $reply );
76
77 eZHTTPTool::header( "Location: /mail/mailedit/$replyid" );
78 exit();
79 }
80
81 if ( isset( $Forward ) )
82 {
83 $mail = new eZMail( $MailID );
84 $mail->setStatus( FORWARDED, true );
85 $reply = $mail->copyMail( "forward" );
86 $replyid = $reply->id();
87 $reply->setStatus( READ, true );
88
89 $drafts = eZMailFolder::getSpecialFolder( DRAFTS );
90 $drafts->addMail( $reply );
91
92 eZHTTPTool::header( "Location: /mail/mailedit/$replyid" );
93 exit();
94 }
95
96 if ( isset( $Delete ) )
97 {
98 $mail = new eZMail( $MailID );
99 $folderID = $mail->folder( false );
100
101 $del_var =& eZPreferences::variable( "eZMail_OnDel" );
102 if( $del_var == "del" )
103 {
104 eZMail::delete( $MailID );
105 }
106 else // move to trash
107 {
108 $trash = eZMailFolder::getSpecialFolder( TRASH );
109 $trash->addMail( $MailID );
110 }
111 eZHTTPTool::header( "Location: /mail/folder/$folderID" );
112 exit();
113 }
114
115 if ( isset( $Link ) )
116 {
117 eZHTTPTool::header( "Location: /mail/link/$MailID" );
118 exit();
119 }
120
121 $ini =& eZINI::instance( 'site.ini' );
122 $Language = $ini->variable( "eZMailMain", "Language" );
123
124 $t = new eZTemplate( "kernel/ezmail/user/" . $ini->variable( "eZMailMain", "TemplateDir" ),
125 "kernel/ezmail/user/intl/", $Language, "mailview.php" );
126 $t->setAllStrings();
127
128 $t->set_file( "mail_view_page_tpl", "mailview.tpl" );
129
130 $t->set_block( "mail_view_page_tpl", "cc_value_tpl", "cc_value" );
131 $t->set_block( "mail_view_page_tpl", "bcc_value_tpl", "bcc_value" );
132 $t->set_block( "mail_view_page_tpl", "inserted_attachments_tpl", "inserted_attachments" );
133 $t->set_block( "inserted_attachments_tpl", "attachment_tpl", "attachment" );
134 $t->set_var( "inserted_attachments", "" );
135 $t->set_var( "cc_value", "" );
136 $t->set_var( "bcc_value", "" );
137
138 $mail = new eZMail( $MailID );
139 if ( $mail->status() == UNREAD )
140 $mail->setStatus( READ, true );
141 $t->set_var( "current_mail_id", $MailID );
142
143 $t->set_var( "to", htmlspecialchars( $mail->to() ) );
144 $t->set_var( "from", htmlspecialchars( $mail->from() ) );
145 $t->set_var( "subject", htmlspecialchars( $mail->subject() ) );
146
147 if ( $ini->variable( "eZMailMain", "HTMLMail" ) == "enabled" )
148 $t->set_var( "mail_body", nl2br( ( $mail->body() ) ) );
149 else
150 $t->set_var( "mail_body", nl2br( htmlspecialchars( $mail->body() ) ) );
151
152 $t->set_var( "date", date("D M d H:i Y ", $mail->uDate() ) );
153
154 if ( $mail->cc() != "" )
155 {
156 $t->set_var( "cc", htmlspecialchars( $mail->cc() ) );
157 $t->parse( "cc_value", "cc_value_tpl", false );
158 }
159
160 if ( $mail->bcc() != "" )
161 {
162 $t->set_var( "bcc", htmlspecialchars( $mail->bcc() ) );
163 $t->parse( "bcc_value", "bcc_value_tpl", false );
164 }
165
166 $files = $mail->files();
167 $i = 0;
168 foreach ( $files as $file )
169 {
170 $t->set_var( "file_name", "<a href=\"$GlobalSiteIni->WWWDir$GlobalSiteIni->Index/filemanager/download/" . $file->id() . "/" . $file->originalFileName() . "/ \">" . htmlspecialchars( $file->originalFileName() ) . "</a>" );
171 $t->set_var( "file_id", $file->id() );
172
173 $size = $file->siFileSize();
174 $t->set_var( "file_size", $size["size-string"] . $size["unit"] );
175
176 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
177
178 $t->parse( "attachment", "attachment_tpl", true );
179 $i++;
180 }
181
182 if ( $i > 0 )
183 $t->parse( "inserted_attachments", "inserted_attachments_tpl", false );
184
185 $t->pparse( "output", "mail_view_page_tpl" );
186
187 ?>
$Link
$Link
Definition: articlelistrss.php:37
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZMailFolder\getSpecialFolder
static getSpecialFolder( $specialType, $user=false)
Definition: ezmailfolder.php:477
eZMail
Definition: ezmail.php:57
eZMail\isOwner
static isOwner( $user, $mailID)
Definition: ezmail.php:867
eZMail\delete
delete( $id=-1)
Definition: ezmail.php:87
eZPreferences\variable
static variable( $name, $group=false)
Definition: ezpreferences.php:95
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$size
if($file_debug) $size
Definition: ezfilemanager/user/filedownload.php:165
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$files
if( $mail->cc() !="") if( $mail->bcc() !="") $files
Definition: ezmail/user/mailview.php:166
$t
$t
Definition: ezmail/user/mailview.php:124
$i
$i
Definition: ezmail/user/mailview.php:167
$Language
$Language
Definition: ezmail/user/mailview.php:122
$ini
if(!eZMail::isOwner(eZUser::currentUser(), $MailID)) if(isset( $Cancel)) if(isset( $Reply)) if(isset( $ReplyAll)) if(isset( $Forward)) if(isset( $Delete)) if(isset( $Link)) $ini
Definition: ezmail/user/mailview.php:121
$mail
$mail
Definition: ezmail/user/mailview.php:138
REPLIED
const REPLIED
Definition: ezmail.php:52
FORWARDED
const FORWARDED
Definition: ezmail.php:53
READ
const READ
Definition: ezmail.php:51
UNREAD
const UNREAD
Definition: ezmail.php:50
DRAFTS
const DRAFTS
Definition: ezmailfolder.php:44
TRASH
const TRASH
Definition: ezmailfolder.php:46
$Reply
$Reply
Definition: ezmessage/user/messageedit.php:119
exit
exit
Definition: folder.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.