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

mail_attachment.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 
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 // GET SAVED DATA
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 // LOCATOR
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 // UPLOAD FILE
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 // CONFIRM CANCELED
00095 if(isset($_POST["cmd"]["cancel"]))
00096 {
00097         header("location:mail_attachment.php?mobj_id=$_GET[mobj_id]");
00098         exit;
00099 }
00100 // DELETE CONFIRMED
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 // BUTTONS
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 // BEGIN CONFIRM_DELETE
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 // SET STATIC VARIABLES ;-)
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 // ACTIONS
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 // BUTTONS
00145 $tpl->setVariable("BUTTON_SUBMIT",$lng->txt("submit"));
00146 $tpl->setVariable("BUTTON_UPLOAD",$lng->txt("upload"));
00147 
00148 // BEGIN FILES
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 ?>

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