• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

mail_read.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00034 require_once "./include/inc.header.php";
00035 require_once "./include/inc.mail.php";
00036 require_once "classes/class.ilObjUser.php";
00037 require_once "classes/class.ilMail.php";
00038 
00039 $lng->loadLanguageModule("mail");
00040 
00041 //get the mail from user
00042 $umail = new ilMail($_SESSION["AccountId"]);
00043 
00044 // catch hack attempts
00045 if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00046 {
00047         $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
00048 }
00049 
00050 $umail->markRead(array($_GET["mail_id"]));
00051 
00052 $mail_data = $umail->getMail($_GET["mail_id"]);
00053 
00054 $tpl->addBlockFile("CONTENT", "content", "tpl.mail_read.html");
00055 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00056 $tpl->setVariable("TXT_MAILS_OF",$lng->txt("mail_mails_of"));
00057 setLocator($_GET["mobj_id"],$_SESSION["AccountId"],"");
00058 
00059 // DOWNLOAD FILE
00060 if($_POST["cmd"])
00061 {
00062         if($_POST["filename"])
00063         {
00064                 if(isset($_POST["cmd"]["download"]))
00065                 {
00066                         require_once "classes/class.ilFileDataMail.php";
00067                         
00068                         $mfile = new ilFileDataMail($_SESSION["AccountId"]);
00069                         if(!$path = $mfile->getAttachmentPath($_POST["filename"],$_GET["mail_id"]))
00070                         {
00071                                 sendInfo("Error reading file!");
00072                         }
00073                         else
00074                         {
00075                                 ilUtil::deliverFile($path,$_POST["filename"]);
00076                         }
00077                 }
00078         }
00079 }
00080                                         
00081 include "./include/inc.mail_buttons.php";
00082 
00083 //buttons
00084 $tplbtn = new ilTemplate("tpl.buttons.html", true, true);
00085 if($mail_data["sender_id"])
00086 {
00087         $tplbtn->setCurrentBlock("btn_cell");
00088         $tplbtn->setVariable("BTN_LINK","./mail_new.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=reply");
00089         $tplbtn->setVariable("BTN_TXT", $lng->txt("reply"));
00090         $tplbtn->parseCurrentBlock();
00091 }
00092 $tplbtn->setCurrentBlock("btn_cell");
00093 $tplbtn->setVariable("BTN_LINK", "mail_new.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=forward");
00094 $tplbtn->setVariable("BTN_TXT", $lng->txt("forward"));
00095 $tplbtn->parseCurrentBlock();
00096 $tplbtn->setCurrentBlock("btn_cell");
00097 $tplbtn->setVariable("BTN_LINK", "mail_print.php?mail_id=".$_GET["mail_id"]);
00098 $tplbtn->setVariable("BTN_TXT", $lng->txt("print"));
00099 $tplbtn->setVariable("BTN_TARGET","target=\"_blank\"");
00100 $tplbtn->parseCurrentBlock();
00101 if($mail_data["sender_id"])
00102 {
00103         $tplbtn->setCurrentBlock("btn_cell");
00104         $tplbtn->setVariable("BTN_LINK", "mail_addressbook.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=add");
00105         $tplbtn->setVariable("BTN_TXT", $lng->txt("mail_add_to_addressbook"));
00106         $tplbtn->parseCurrentBlock();
00107 }
00108 $tplbtn->setCurrentBlock("btn_cell");
00109 $tplbtn->setVariable("BTN_LINK", "mail.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]");
00110 $tplbtn->setVariable("BTN_TXT", $lng->txt("delete"));
00111 $tplbtn->parseCurrentBlock();
00112 
00113 $tplbtn->setCurrentBlock("btn_row");
00114 $tplbtn->parseCurrentBlock();
00115 
00116 $tpl->setVariable("BUTTONS2",$tplbtn->get());
00117 $tpl->setVariable("ACTION","mail_read.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]");
00118 
00119 // SET MAIL DATA
00120 $counter = 1;
00121 // FROM
00122 $tpl->setVariable("TXT_FROM", $lng->txt("from"));
00123 
00124 $tmp_user = new ilObjUser($mail_data["sender_id"]);
00125 #$tmp_user =& ilObjectFactory::getInstanceByObjId($mail_data["sender_id"],false);
00126 
00127 $tpl->setVariable("FROM", $tmp_user->getFullname());
00128 
00129 if(!($login = $tmp_user->getLogin()))
00130 {
00131         $login = $mail_data["import_name"]." (".$lng->txt("imported").")";
00132 }
00133 $tpl->setVariable("MAIL_LOGIN",$login);
00134 $tpl->setVariable("CSSROW_FROM",++$counter%2 ? 'tblrow1' : 'tblrow2');
00135 // TO
00136 $tpl->setVariable("TXT_TO", $lng->txt("to"));
00137 $tpl->setVariable("TO", $mail_data["rcp_to"]);
00138 $tpl->setVariable("CSSROW_TO",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00139 
00140 // CC
00141 if($mail_data["rcp_cc"])
00142 {
00143         $tpl->setCurrentBlock("cc");
00144         $tpl->setVariable("TXT_CC",$lng->txt("cc"));
00145         $tpl->setVariable("CC",$mail_data["rcp_cc"]);
00146         $tpl->setVariable("CSSROW_CC",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00147         $tpl->parseCurrentBlock();
00148 }
00149 // SUBJECT
00150 $tpl->setVariable("TXT_SUBJECT",$lng->txt("subject"));
00151 $tpl->setVariable("SUBJECT",htmlspecialchars($mail_data["m_subject"]));
00152 $tpl->setVariable("CSSROW_SUBJ",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00153 
00154 // DATE
00155 $tpl->setVariable("TXT_DATE", $lng->txt("date"));
00156 $tpl->setVariable("DATE", ilFormat::formatDate($mail_data["send_time"]));
00157 $tpl->setVariable("CSSROW_DATE",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00158 
00159 // ATTACHMENTS
00160 if($mail_data["attachments"])
00161 {
00162         $tpl->setCurrentBlock("attachment");
00163         $tpl->setCurrentBlock("a_row");
00164         $counter = 1;
00165         foreach($mail_data["attachments"] as $file)
00166         {
00167                 $tpl->setVariable("A_CSSROW",++$counter%2 ? 'tblrow1' : 'tblrow2');
00168                 $tpl->setVariable("FILE",$file);
00169                 $tpl->setVariable("FILE_NAME",$file);
00170                 $tpl->parseCurrentBlock();
00171         }
00172         $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachments"));
00173         $tpl->setVariable("TXT_DOWNLOAD",$lng->txt("download"));
00174         $tpl->parseCurrentBlock();
00175 }
00176 
00177 // MESSAGE
00178 $tpl->setVariable("TXT_MESSAGE", $lng->txt("message"));
00179 $tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable($mail_data["m_message"])));
00180 //$tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable(htmlspecialchars($mail_data["m_message"]))));
00181 
00182 $tpl->show();
00183 ?>

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1