Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033 require_once "./include/inc.header.php";
00034 require_once "./include/inc.mail.php";
00035 require_once "classes/class.ilFormatMail.php";
00036 require_once "classes/class.ilFileDataMail.php";
00037 $lng->loadLanguageModule("mail");
00038 $lng->loadLanguageModule("forum");
00039
00040 $mfile = new ilFileDataMail($_SESSION["AccountId"]);
00041
00042
00043 $umail = new ilFormatMail($_SESSION["AccountId"]);
00044 $mail_data = $umail->getSavedData();
00045
00046 $_POST["filename"] = $_POST["filename"] ? $_POST["filename"] : array();
00047
00048 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00049 $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_attachment.html");
00050 $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00051 $tpl->setCurrentBlock("header_image");
00052 $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mail_b.gif"));
00053 $tpl->parseCurrentBlock();
00054 $tpl->setVariable("HEADER",$lng->txt("mail"));
00055 $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachment"));
00056 infoPanel();
00057
00058
00059 setLocator($_GET["mobj_id"],"mail_attachment.php", $_SESSION["AccountId"],"");
00060
00061 if(isset($_POST["attachment"]["adopt"]))
00062 {
00063 $umail->saveAttachments($_POST["filename"]);
00064 header("location:mail_new.php?mobj_id=$_GET[mobj_id]&type=attach");
00065 exit();
00066
00067 }
00068 if(isset($_POST["attachment"]["cancel"]))
00069 {
00070 header("location:mail_new.php?mobj_id=$_GET[mobj_id]&type=attach");
00071 exit;
00072
00073 }
00074 if(isset($_POST["attachment"]["delete"]))
00075 {
00076 if(!$_POST["filename"])
00077 {
00078 sendInfo($lng->txt("mail_select_one_file"));
00079 $error_delete = true;
00080 }
00081 else
00082 {
00083 sendInfo($lng->txt("mail_sure_delete_file"));
00084 }
00085 }
00086
00087 if(isset($_POST["cmd"]["upload"]))
00088 {
00089 if($mfile->storeUploadedFile($_FILES['userfile']) == 1)
00090 {
00091 sendInfo($lng->txt("mail_maxsize_attachment_error")." ".$mfile->getUploadLimit()." K".$lng->txt("mail_byte"));
00092 }
00093 }
00094
00095 if(isset($_POST["cmd"]["cancel"]))
00096 {
00097 header("location:mail_attachment.php?mobj_id=$_GET[mobj_id]");
00098 exit;
00099 }
00100
00101 if(isset($_POST["cmd"]["confirm"]))
00102 {
00103 if(!$_POST["filename"])
00104 {
00105 sendInfo($lng->txt("mail_select_one_mail"));
00106 }
00107 else if($error = $mfile->unlinkFiles($_POST["filename"]))
00108 {
00109 sendInfo($lng->txt("mail_error_delete_file")." ".$error);
00110 }
00111 else
00112 {
00113 sendInfo($lng->txt("mail_files_deleted"));
00114 }
00115 }
00116
00117
00118 include "./include/inc.mail_buttons.php";
00119
00120 $tpl->setVariable("ACTION","mail_attachment.php?mobj_id=$_GET[mobj_id]");
00121 $tpl->setVariable("UPLOAD","mail_attachment.php?mobj_id=$_GET[mobj_id]");
00122
00123
00124 if(isset($_POST["attachment"]["delete"]) and !$error_delete and !isset($_POST["cmd"]["confirm"]))
00125 {
00126 $tpl->setCurrentBlock("confirm_delete");
00127 $tpl->setVariable("BUTTON_CONFIRM",$lng->txt("confirm"));
00128 $tpl->setVariable("BUTTON_CANCEL",$lng->txt("cancel"));
00129 $tpl->parseCurrentBlock();
00130 }
00131
00132
00133 $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachment"));
00134 $tpl->setVariable("TXT_FILENAME",$lng->txt("mail_file_name"));
00135 $tpl->setVariable("TXT_FILESIZE",$lng->txt("mail_file_size"));
00136 $tpl->setVariable("TXT_CREATE_TIME",$lng->txt("forums_thread_create_date"));
00137 $tpl->setVariable("TXT_NEW_FILE",$lng->txt("mail_new_file"));
00138
00139
00140 $tpl->setVariable("BUTTON_ATTACHMENT_ADOPT",$lng->txt("adopt"));
00141 $tpl->setVariable("BUTTON_ATTACHMENT_CANCEL",$lng->txt("cancel"));
00142 $tpl->setVariable("BUTTON_ATTACHMENT_DELETE",$lng->txt("delete"));
00143
00144
00145 $tpl->setVariable("BUTTON_SUBMIT",$lng->txt("submit"));
00146 $tpl->setVariable("BUTTON_UPLOAD",$lng->txt("upload"));
00147
00148
00149 if($files = $mfile->getUserFilesData())
00150 {
00151 $counter = 0;
00152 foreach($files as $file)
00153 {
00154 $tpl->setCurrentBlock('files');
00155 if(in_array($file["name"],$mail_data["attachments"]) ||
00156 in_array($file["name"],$_POST["filename"]))
00157 {
00158 $tpl->setVariable("CHECKED",'checked');
00159 }
00160 $tpl->setVariable('CSSROW',++$counter%2 ? 'tblrow1' : 'tblrow2');
00161 $tpl->setVariable('FILE_NAME',$file["name"]);
00162 $tpl->setVariable("NAME",$file["name"]);
00163 $tpl->setVariable("SIZE",$file["size"]);
00164 $tpl->setVariable("CTIME",$file["ctime"]);
00165 $tpl->parseCurrentBlock();
00166 }
00167 }
00168 else
00169 {
00170 $tpl->setCurrentBlock("no_content");
00171 $tpl->setVariable("TXT_ATTACHMENT_NO",$lng->txt("mail_no_attachments_found"));
00172 $tpl->parseCurrentBlock();
00173 }
00174 $tpl->show();
00175 ?>