Core  3.2
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  * @package FDL
5 */
6 /**
7  * Edition to send mail
8  *
9  * @author Anakeen
10  * @version $Id: editmail.php,v 1.21 2008/10/16 13:57:35 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 /**
19  * Edition to send mail
20  * @param Action &$action current action
21  * @global string $mid Http var : document id to send
22  * @global string $mzone Http var : view zone to use to send mail
23  * @global string $ulink Http var : with hyperlink (to use in internal) [Y|N]
24  * @global string $dochead Http var : with header (icon/title) or not [Y|N]
25  * @global string $viewdoc Http var : with preview of sended mail [Y|N]
26  * @global string $mail_to Http var : recipient mail
27  * @global string $mail_cc Http var : recipient copy
28  * @global string $mail_subject Http var : subject
29  */
30 function editmail(Action & $action)
31 {
32  include_once ("FDL/editutil.php");
33  editmode($action);
34 
35  $docid = GetHttpVars("mid");
36  $zone = GetHttpVars("mzone");
37  $ulink = GetHttpVars("ulink");
38  $dochead = GetHttpVars("dochead");
39  $viewdoc = (GetHttpVars("viewdoc", "Y") == "Y");
40 
41  $from = GetHttpVars("_mail_from", "");
42  $to = GetHttpVars("mail_to");
43  $cc = GetHttpVars("mail_cc");
44  // for compliance with old notation
45  $ts = array();
46  $tt = array();
47  if ($to != "") {
48  $to = str_replace("\n", ",", $to);
49  $to = str_replace('\n', ",", $to);
50  $ts = explode(",", $to);
51  $tt = array_fill(0, count($ts) , "to");
52  }
53  if ($cc != "") {
54  $ts = array_merge($ts, explode(",", $cc));
55  $tt = array_merge($tt, array_fill(0, count(explode(",", $cc)) , "cc"));
56  }
57  setHttpVar("mail_recip", $ts);
58  setHttpVar("mail_copymode", $tt);
59 
60  if ($from == "") {
61  $from = getMailAddr($action->user->id, true);
62  }
63 
64  $dbaccess = $action->dbaccess;
66  // control sending
67  $err = $doc->control('send');
68  if ($err != "") $action->exitError($err);
69 
70  $action->parent->setVolatileParam("overrideICreate", "true"); // used in editcard
71  if ($zone == "") $zone = $doc->defaultmview;
72  $zo = $doc->getZoneOption("$zone");
73 
74  $action->lay->Set("binarymode", ($zo == "B"));
75  if ($zo == "B") {
76  $engine = $doc->getZoneTransform($zone);
77  if ($engine == "pdf") $action->lay->Set("iconmime", $action->parent->getImageLink("mime-pdf.png"));
78  else $action->lay->Set("iconmime", $action->parent->getImageLink("mime-document2.png"));
79  }
80 
81  $action->lay->eSet("from", $from);
82  $action->lay->Set("mid", $doc->id);
83  $action->lay->eSet("ulink", ($ulink ? $ulink : "Y"));
84  $action->lay->eSet("mzone", $zone);
85  $action->lay->eSet("dochead", $dochead);
86  $action->lay->Set("title", $doc->getHTMLTitle());
87  $action->lay->set("VIEWDOC", $viewdoc);
88 }
editmail(Action &$action)
Definition: editmail.php:30
global $action
getMailAddr($userid, $full=false)
Definition: Lib.Common.php:133
$to
Set($name, &$parent)
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
$cc
$from
editmode(Action &$action)
Definition: editutil.php:41
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen