当前位置: 首页>>代码示例>>PHP>>正文


PHP FormMail::add_attached_files方法代码示例

本文整理汇总了PHP中FormMail::add_attached_files方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMail::add_attached_files方法的具体用法?PHP FormMail::add_attached_files怎么用?PHP FormMail::add_attached_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormMail的用法示例。


在下文中一共展示了FormMail::add_attached_files方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

            $formmail->withtopic = $langs->trans('SendShippingRef', '__SHIPPINGREF__');
            $formmail->withfile = 2;
            $formmail->withbody = 1;
            $formmail->withdeliveryreceipt = 1;
            $formmail->withcancel = 1;
            // Tableau des substitutions
            $formmail->substit['__SHIPPINGREF__'] = $object->ref;
            // Tableau des parametres complementaires
            $formmail->param['action'] = 'send';
            $formmail->param['models'] = 'shipping_send';
            $formmail->param['shippingid'] = $object->id;
            $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
            // Init list of files
            if (!empty($_REQUEST["mode"]) && $_REQUEST["mode"] == 'init') {
                $formmail->clear_attached_files();
                $formmail->add_attached_files($file, dol_sanitizeFilename($ref . '.pdf'), 'application/pdf');
            }
            // Show form
            $formmail->show_form();
            print '<br>';
        }
        if ($action != 'presend' && !empty($origin) && $object->{$origin}->id) {
            print '<br>';
            //show_list_sending_receive($object->origin,$object->origin_id," AND e.rowid <> ".$object->id);
            show_list_sending_receive($object->origin, $object->origin_id);
        }
    } else {
        print "Expedition inexistante ou acces refuse";
    }
}
$db->close();
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例2: foreach

                foreach ($contactarr as $contact) {
                    if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) {
                        // TODO Use code and not label
                        require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
                        $contactstatic = new Contact($db);
                        $contactstatic->fetch($contact['id']);
                        $custcontact = $contactstatic->getFullName($langs, 1);
                    }
                }
                if (!empty($custcontact)) {
                    $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
                }
            }
            // Tableau des parametres complementaires du post
            $formmail->param['action'] = $action;
            $formmail->param['models'] = $modelmail;
            $formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
            $formmail->param['facid'] = $object->id;
            $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
            // Init list of files
            if (GETPOST("mode") == 'init') {
                $formmail->clear_attached_files();
                $formmail->add_attached_files($file, basename($file), dol_mimetype($file));
            }
            print $formmail->get_form();
            dol_fiche_end();
        }
    }
}
llxFooter();
$db->close();
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:facture.php

示例3:

        $formmail->withfile=2;
        $formmail->withbody=1;
        $formmail->withdeliveryreceipt=1;
        $formmail->withcancel=1;

        // Tableau des substitutions
        $formmail->substit['__FICHINTERREF__']=$object->ref;
        // Tableau des parametres complementaires
        $formmail->param['action']='send';
        $formmail->param['models']='fichinter_send';
        $formmail->param['fichinter_id']=$object->id;
        $formmail->param['returnurl']=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$object->id;

        // Init list of files
        if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
        {
            $formmail->clear_attached_files();
            $formmail->add_attached_files($file,$object->ref.'.pdf','application/pdf');
        }

        $formmail->show_form();

        print '<br>';
    }
}

$db->close();

llxFooter('$Date: 2011/07/31 23:50:53 $ - $Revision: 1.173 $');
?>
开发者ID:remyyounes,项目名称:dolibarr,代码行数:30,代码来源:fiche.php

示例4: FormMail

}
$upload_dir = $conf->admin->dir_temp;
/*
 * Actions
 */
if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
    $result = dol_mkdir($upload_dir);
    // Create dir if not exists
    if ($result >= 0) {
        $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 1, 0, $_FILES['userfile']['error']);
        if (is_numeric($resupload) && $resupload > 0) {
            $mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
            include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
            $formmail = new FormMail($db);
            $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'], $_FILES['addedfile']['name'], $_FILES['addedfile']['type']);
        } else {
            $langs->load("errors");
            if ($resupload < 0) {
                $mesg = '<div class="error">' . $langs->trans("ErrorFileNotUploaded") . '</div>';
            } else {
                if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/', $resupload, $reg)) {
                    $mesg = '<div class="error">' . $langs->trans("ErrorFileIsInfectedWithAVirus");
                    $mesg .= '<br>' . $langs->trans("Information") . ': ' . $langs->trans($reg[1]);
                    $mesg .= '</div>';
                } else {
                    $mesg = '<div class="error">' . $langs->trans($resupload) . '</div>';
                }
            }
        }
    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:security_other.php

示例5: dol_add_file_process

/**
 * Get and save an upload file (for example after submitting a new file a mail form).
 * All information used are in db, conf, langs, user and _FILES.
 * Note: This function can be used only into a HTML page context.
 *
 * @param	string	$upload_dir				Directory where to store uploaded file (note: also find in first part of dest_file)
 * @param	int		$allowoverwrite			1=Allow overwrite existing file
 * @param	int		$donotupdatesession		1=Do no edit _SESSION variable
 * @param	string	$varfiles				_FILES var name
 * @param	string	$savingdocmask			Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
 * @param	string	$link					Link to add
 * @return	void
 */
function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null)
{
    global $db, $user, $conf, $langs;
    if (!empty($_FILES[$varfiles])) {
        dol_syslog('dol_add_file_process upload_dir=' . $upload_dir . ' allowoverwrite=' . $allowoverwrite . ' donotupdatesession=' . $donotupdatesession . ' savingdocmask=' . $savingdocmask, LOG_DEBUG);
        if (dol_mkdir($upload_dir) >= 0) {
            $TFile = $_FILES[$varfiles];
            if (!is_array($TFile['name'])) {
                foreach ($TFile as $key => &$val) {
                    $val = array($val);
                }
            }
            $nbfile = count($TFile['name']);
            for ($i = 0; $i < $nbfile; $i++) {
                // Define $destpath (path to file including filename) and $destfile (only filename)
                $destpath = $upload_dir . "/" . $TFile['name'][$i];
                $destfile = $TFile['name'][$i];
                $savingdocmask = dol_sanitizeFileName($savingdocmask);
                if ($savingdocmask) {
                    $destpath = $upload_dir . "/" . preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
                    $destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
                }
                $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
                if (is_numeric($resupload) && $resupload > 0) {
                    global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
                    include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
                    if (empty($donotupdatesession)) {
                        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
                        $formmail = new FormMail($db);
                        $formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]);
                    }
                    if (image_format_supported($destpath) == 1) {
                        // Create small thumbs for image (Ratio is near 16/9)
                        // Used on logon for example
                        $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
                        // Create mini thumbs for image (Ratio is near 16/9)
                        // Used on menu or for setup page for example
                        $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
                    }
                    setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
                } else {
                    $langs->load("errors");
                    if ($resupload < 0) {
                        setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
                    } else {
                        if (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
                            setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
                        } else {
                            setEventMessages($langs->trans($resupload), null, 'errors');
                        }
                    }
                }
            }
        }
    } elseif ($link) {
        if (dol_mkdir($upload_dir) >= 0) {
            require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
            $linkObject = new Link($db);
            $linkObject->entity = $conf->entity;
            $linkObject->url = $link;
            $linkObject->objecttype = GETPOST('objecttype', 'alpha');
            $linkObject->objectid = GETPOST('objectid', 'int');
            $linkObject->label = GETPOST('label', 'alpha');
            $res = $linkObject->create($user);
            $langs->load('link');
            if ($res > 0) {
                setEventMessages($langs->trans("LinkComplete"), null, 'mesgs');
            } else {
                setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors');
            }
        }
    } else {
        $langs->load("errors");
        setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
    }
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:89,代码来源:files.lib.php

示例6: dol_add_file_process

/**
 * Get and save an upload file (for example after submitting a new file a mail form).
 * All information used are in db, conf, langs, user and _FILES.
 * @param	upload_dir				Directory to store upload files
 * @param	allowoverwrite			1=Allow overwrite existing file
 * @param	donotupdatesession		1=Do no edit _SESSION variable
 * @return	string					Message with result of upload and store.
 */
function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0)
{
	global $db,$user,$conf,$langs,$_FILES;

	$mesg='';

	if (! empty($_FILES['addedfile']['tmp_name']))
	{
		if (dol_mkdir($upload_dir) >= 0)
		{
			$resupload = dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],$allowoverwrite,0, $_FILES['addedfile']['error']);
			if (is_numeric($resupload) && $resupload > 0)
			{
				$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';

				if (empty($donotupdatesession))
				{
					include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
					$formmail = new FormMail($db);
					$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
				}
			}
			else
			{
				$langs->load("errors");
				if ($resupload < 0)	// Unknown error
				{
					$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
				}
				else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload))	// Files infected by a virus
				{
					$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
				}
				else	// Known error
				{
					$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
				}
			}
		}
	}
	else
	{
		$langs->load("errors");
		$mesg = '<div class="warning">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("File")).'</div>';
	}

	return $mesg;
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:56,代码来源:files.lib.php

示例7:

		$formmail->withdeliveryreceipt=1;
		$formmail->withcancel=1;

		// Tableau des substitutions
		$formmail->substit['__PROPREF__']=$object->ref;
		// Tableau des parametres complementaires
		$formmail->param['action']='send';
		$formmail->param['models']='propal_send';
		$formmail->param['id']=$object->id;
		$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;

		// Init list of files
		if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
		{
			$formmail->clear_attached_files();
			$formmail->add_attached_files($file,dol_sanitizeFilename($object->ref).'.pdf','application/pdf');
		}

		$formmail->show_form();

		print '<br>';
	}

}
else
{
	/****************************************************************************
	 *                                                                          *
	 *                         Mode Liste des propales                          *
	 *                                                                          *
	 ****************************************************************************/
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:propal.php


注:本文中的FormMail::add_attached_files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。