Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editmail.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Edition to send mail
9  *
10  * @author Anakeen 2000
11  * @version $Id: editmail.php,v 1.21 2008/10/16 13:57:35 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 include_once ("FDL/Class.Doc.php");
20 /**
21  * Edition to send mail
22  * @param Action &$action current action
23  * @global mid Http var : document id to send
24  * @global mzone Http var : view zone to use to send mail
25  * @global ulink Http var : with hyperlink (to use in internal) [Y|N]
26  * @global dochead Http var : with header (icon/title) or not [Y|N]
27  * @global viewdoc Http var : with preview of sended mail [Y|N]
28  * @global mail_to Http var : recipient mail
29  * @global mail_cc Http var : recipient copy
30  * @global mail_subject Http var : subject
31  */
32 function editmail(&$action)
33 {
34  $docid = GetHttpVars("mid");
35  $zone = GetHttpVars("mzone");
36  $ulink = GetHttpVars("ulink");
37  $dochead = GetHttpVars("dochead");
38  $viewdoc = (GetHttpVars("viewdoc", "Y") == "Y");
39 
40  $from = GetHttpVars("_mail_from", "");
41  $to = GetHttpVars("mail_to");
42  $cc = GetHttpVars("mail_cc");
43  // for compliance with old notation
44  $ts = array();
45  $tt = array();
46  if ($to != "") {
47  $to = str_replace("\n", ",", $to);
48  $to = str_replace('\n', ",", $to);
49  $ts = explode(",", $to);
50  $tt = array_fill(0, count($ts) , "to");
51  }
52  if ($cc != "") {
53  $ts = array_merge($ts, explode(",", $cc));
54  $tt = array_merge($tt, array_fill(0, count(explode(",", $cc)) , "cc"));
55  }
56  setHttpVar("mail_recip", $ts);
57  setHttpVar("mail_copymode", $tt);
58 
59  if ($from == "") {
60  $from = getMailAddr($action->user->id, false);
61  }
62 
63  $dbaccess = $action->GetParam("FREEDOM_DB");
65  // control sending
66  $err = $doc->control('send');
67  if ($err != "") $action->exitError($err);
68 
69  if ($zone == "") $zone = $doc->defaultmview;
70  $zo = $doc->getZoneOption("$zone");
71 
72  $action->lay->Set("binarymode", ($zo == "B"));
73  if ($zo == "B") {
74  $engine = $doc->getZoneTransform($zone);
75  if ($engine == "pdf") $action->lay->Set("iconmime", $action->getImageUrl("mime-pdf.png"));
76  else $action->lay->Set("iconmime", $action->getImageUrl("mime-document2.png"));
77  }
78 
79  $action->lay->Set("from", $from);
80  $action->lay->Set("mid", $docid);
81  $action->lay->Set("ulink", $ulink);
82  $action->lay->Set("mzone", $zone);
83  $action->lay->Set("dochead", $dochead);
84  $action->lay->Set("title", $doc->title);
85  $action->lay->set("VIEWDOC", $viewdoc);
86 }
87 ?>
← centre documentaire © anakeen - published under CC License - Dynacase