• 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-2005 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.adm_content.html");
00055 $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_read.html");
00056 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00057 $tpl->setCurrentBlock("header_image");
00058 $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mail_b.gif"));
00059 $tpl->parseCurrentBlock();
00060 $tpl->setVariable("HEADER",$lng->txt("mail_mails_of"));
00061 setLocator($_GET["mobj_id"],'mail.php',$_SESSION["AccountId"],"");
00062 
00063 // DOWNLOAD FILE
00064 if($_POST["cmd"])
00065 {
00066         if($_POST["filename"])
00067         {
00068                 if(isset($_POST["cmd"]["download"]))
00069                 {
00070                         require_once "classes/class.ilFileDataMail.php";
00071                         
00072                         $mfile = new ilFileDataMail($_SESSION["AccountId"]);
00073                         if(!$path = $mfile->getAttachmentPath($_POST["filename"],$_GET["mail_id"]))
00074                         {
00075                                 sendInfo("Error reading file!");
00076                         }
00077                         else
00078                         {
00079                                 ilUtil::deliverFile($path,$_POST["filename"]);
00080                         }
00081                 }
00082         }
00083 }
00084                                         
00085 include "./include/inc.mail_buttons.php";
00086 
00087 //buttons
00088 $tplbtn = new ilTemplate("tpl.buttons.html", true, true);
00089 if($mail_data["sender_id"])
00090 {
00091         $tplbtn->setCurrentBlock("btn_cell");
00092         $tplbtn->setVariable("BTN_LINK","./mail_new.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=reply");
00093         $tplbtn->setVariable("BTN_TXT", $lng->txt("reply"));
00094         $tplbtn->parseCurrentBlock();
00095 }
00096 $tplbtn->setCurrentBlock("btn_cell");
00097 $tplbtn->setVariable("BTN_LINK", "mail_new.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=forward");
00098 $tplbtn->setVariable("BTN_TXT", $lng->txt("forward"));
00099 $tplbtn->parseCurrentBlock();
00100 $tplbtn->setCurrentBlock("btn_cell");
00101 $tplbtn->setVariable("BTN_LINK", "mail_print.php?mail_id=".$_GET["mail_id"]);
00102 $tplbtn->setVariable("BTN_TXT", $lng->txt("print"));
00103 $tplbtn->setVariable("BTN_TARGET","target=\"_blank\"");
00104 $tplbtn->parseCurrentBlock();
00105 if($mail_data["sender_id"])
00106 {
00107         $tplbtn->setCurrentBlock("btn_cell");
00108         $tplbtn->setVariable("BTN_LINK", "mail_addressbook.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]&type=add");
00109         $tplbtn->setVariable("BTN_TXT", $lng->txt("mail_add_to_addressbook"));
00110         $tplbtn->parseCurrentBlock();
00111 }
00112 $tplbtn->setCurrentBlock("btn_cell");
00113 $tplbtn->setVariable("BTN_LINK", "mail.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]");
00114 $tplbtn->setVariable("BTN_TXT", $lng->txt("delete"));
00115 $tplbtn->parseCurrentBlock();
00116 
00117 $tplbtn->setCurrentBlock("btn_row");
00118 $tplbtn->parseCurrentBlock();
00119 
00120 $tpl->setVariable("BUTTONS2",$tplbtn->get());
00121 $tpl->setVariable("ACTION","mail_read.php?mobj_id=$_GET[mobj_id]&mail_id=$_GET[mail_id]");
00122 
00123 // SET MAIL DATA
00124 $counter = 1;
00125 // FROM
00126 $tpl->setVariable("TXT_FROM", $lng->txt("from"));
00127 
00128 $tmp_user = new ilObjUser($mail_data["sender_id"]);
00129 #$tmp_user =& ilObjectFactory::getInstanceByObjId($mail_data["sender_id"],false);
00130 
00131 $tpl->setVariable("FROM", $tmp_user->getFullname());
00132 $tpl->setCurrentBlock("pers_image");
00133 $tpl->setVariable("IMG_SENDER", $tmp_user->getPersonalPicturePath("xsmall"));
00134 $tpl->setVariable("ALT_SENDER", $tmp_user->getFullname());
00135 $tpl->parseCurrentBlock();
00136 $tpl->setCurrentBlock("adm_content");
00137 
00138 if(!($login = $tmp_user->getLogin()))
00139 {
00140         $login = $mail_data["import_name"]." (".$lng->txt("imported").")";
00141 }
00142 $tpl->setVariable("MAIL_LOGIN",$login);
00143 $tpl->setVariable("CSSROW_FROM",++$counter%2 ? 'tblrow1' : 'tblrow2');
00144 // TO
00145 $tpl->setVariable("TXT_TO", $lng->txt("mail_to"));
00146 $tpl->setVariable("TO", $mail_data["rcp_to"]);
00147 $tpl->setVariable("CSSROW_TO",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00148 
00149 // CC
00150 if($mail_data["rcp_cc"])
00151 {
00152         $tpl->setCurrentBlock("cc");
00153         $tpl->setVariable("TXT_CC",$lng->txt("cc"));
00154         $tpl->setVariable("CC",$mail_data["rcp_cc"]);
00155         $tpl->setVariable("CSSROW_CC",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00156         $tpl->parseCurrentBlock();
00157 }
00158 // SUBJECT
00159 $tpl->setVariable("TXT_SUBJECT",$lng->txt("subject"));
00160 $tpl->setVariable("SUBJECT",htmlspecialchars($mail_data["m_subject"]));
00161 $tpl->setVariable("CSSROW_SUBJ",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00162 
00163 // DATE
00164 $tpl->setVariable("TXT_DATE", $lng->txt("date"));
00165 $tpl->setVariable("DATE", ilFormat::formatDate($mail_data["send_time"]));
00166 $tpl->setVariable("CSSROW_DATE",(++$counter)%2 ? 'tblrow1' : 'tblrow2');
00167 
00168 // ATTACHMENTS
00169 if($mail_data["attachments"])
00170 {
00171         $tpl->setCurrentBlock("attachment");
00172         $tpl->setCurrentBlock("a_row");
00173         $counter = 1;
00174         foreach($mail_data["attachments"] as $file)
00175         {
00176                 $tpl->setVariable("A_CSSROW",++$counter%2 ? 'tblrow1' : 'tblrow2');
00177                 $tpl->setVariable("FILE",$file);
00178                 $tpl->setVariable("FILE_NAME",$file);
00179                 $tpl->parseCurrentBlock();
00180         }
00181         $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachments"));
00182         $tpl->setVariable("TXT_DOWNLOAD",$lng->txt("download"));
00183         $tpl->parseCurrentBlock();
00184 }
00185 
00186 // MESSAGE
00187 $tpl->setVariable("TXT_MESSAGE", $lng->txt("message"));
00188 $tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable($mail_data["m_message"])));
00189 //$tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable(htmlspecialchars($mail_data["m_message"]))));
00190 
00191 $tpl->show();
00192 ?>

Generated on Fri Dec 13 2013 11:57:58 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1