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


PHP eZMail::validate方法代码示例

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


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

示例1: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $parameters = array();
     $parameters['host'] = $ini->variable('MailSettings', 'TransportServer');
     $parameters['helo'] = $ini->variable('MailSettings', 'SenderHost');
     $parameters['port'] = $ini->variable('MailSettings', 'TransportPort');
     $parameters['connectionType'] = $ini->variable('MailSettings', 'TransportConnectionType');
     $user = $ini->variable('MailSettings', 'TransportUser');
     $password = $ini->variable('MailSettings', 'TransportPassword');
     if ($user and $password) {
         $parameters['auth'] = true;
         $parameters['user'] = $user;
         $parameters['pass'] = $password;
     }
     /* If email sender hasn't been specified or is empty
      * we substitute it with either MailSettings.EmailSender or AdminEmail.
      */
     if (!$mail->senderText()) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         eZMail::extractEmail($emailSender, $emailSenderAddress, $emailSenderName);
         if (!eZMail::validate($emailSenderAddress)) {
             $emailSender = false;
         }
         if ($emailSender) {
             $mail->setSenderText($emailSender);
         }
     }
     $excludeHeaders = $ini->variable('MailSettings', 'ExcludeHeaders');
     if (count($excludeHeaders) > 0) {
         $mail->Mail->appendExcludeHeaders($excludeHeaders);
     }
     $options = new ezcMailSmtpTransportOptions();
     if ($parameters['connectionType']) {
         $options->connectionType = $parameters['connectionType'];
     }
     $smtp = new ezcMailSmtpTransport($parameters['host'], $user, $password, $parameters['port'], $options);
     // If in debug mode, send to debug email address and nothing else
     if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
         $mail->Mail->to = array(new ezcMailAddress($ini->variable('MailSettings', 'DebugReceiverEmail')));
         $mail->Mail->cc = array();
         $mail->Mail->bcc = array();
     }
     // send() from ezcMailSmtpTransport doesn't return anything (it uses exceptions in case
     // something goes bad)
     try {
         eZPerfLogger::accumulatorStart('mail_sent');
         $smtp->send($mail->Mail);
         eZPerfLogger::accumulatorStop('mail_sent');
     } catch (ezcMailException $e) {
         eZPerfLogger::accumulatorStop('mail_send');
         eZDebug::writeError($e->getMessage(), __METHOD__);
         return false;
     }
     // return true in case of no exceptions
     return true;
 }
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:60,代码来源:ezsmtptracingtransport.php

示例2: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = $emailFrom['email'];
     if (!$emailSender || count($emailSender) <= 0) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     if (!eZMail::validate($emailSender)) {
         $emailSender = false;
     }
     $isSafeMode = ini_get('safe_mode');
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     $filename = time() . '-' . mt_rand() . '.mail';
     $data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
     $returnedValue = eZFile::create($filename, 'var/log/mail', $data);
     if ($returnedValue === false) {
         eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
     }
     return $returnedValue;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:27,代码来源:ezfiletransport.php

示例3: sendMail

    /**
     * 
     * @param $mail
     * @return unknown_type
     */
    function sendMail( eZMail $mail )
    {
        $ini = eZINI::instance();
        $sendmailOptions = '';
        $emailFrom = $mail->sender();
        $emailSender = $emailFrom['email'];
        if ( !$emailSender || count( $emailSender) <= 0 )
            $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
        if ( !$emailSender )
            $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );
        if ( !eZMail::validate( $emailSender ) )
            $emailSender = false;

        $isSafeMode = ini_get( 'safe_mode' );
        if ( $isSafeMode and
             $emailSender and
             $mail->sender() == false )
        {
            $mail->setSenderText( $emailSender );
        }
           
        $this->doFakeRecepient($mail);

        return $this->realTransport->sendMail($mail);
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:ezkalioptransport.php

示例4: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = isset($emailFrom['email']) ? $emailFrom['email'] : false;
     if (!$emailSender || count($emailSender) <= 0) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     if (!eZMail::validate($emailSender)) {
         $emailSender = false;
     }
     $isSafeMode = ini_get('safe_mode') != 0;
     $sendmailOptionsArray = $ini->variable('MailSettings', 'SendmailOptions');
     if (is_array($sendmailOptionsArray)) {
         $sendmailOptions = implode(' ', $sendmailOptionsArray);
     } elseif (!is_string($sendmailOptionsArray)) {
         $sendmailOptions = $sendmailOptionsArray;
     }
     if (!$isSafeMode and $emailSender) {
         $sendmailOptions .= ' -f' . $emailSender;
     }
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     if (function_exists('mail')) {
         $message = $mail->body();
         $sys = eZSys::instance();
         $excludeHeaders = array('Subject');
         // If not Windows PHP mail() implementation, we can not specify a To: header in the $additional_headers parameter,
         // because then there will be 2 To: headers in the resulting e-mail.
         // However, we can use "undisclosed-recipients:;" in $to.
         if ($sys->osType() != 'win32') {
             $excludeHeaders[] = 'To';
             $receiverEmailText = count($mail->ReceiverElements) > 0 ? $mail->receiverEmailText() : 'undisclosed-recipients:;';
         } else {
             $receiverEmailText = $mail->receiverEmailText();
         }
         // If in debug mode, send to debug email address and nothing else
         if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
             $receiverEmailText = $ini->variable('MailSettings', 'DebugReceiverEmail');
             $excludeHeaders[] = 'To';
             $excludeHeaders[] = 'Cc';
             $excludeHeaders[] = 'Bcc';
         }
         $extraHeaders = $mail->headerText(array('exclude-headers' => $excludeHeaders));
         $returnedValue = mail($receiverEmailText, $mail->subject(), $message, $extraHeaders, $sendmailOptions);
         if ($returnedValue === false) {
             eZDebug::writeError('An error occurred while sending e-mail. Check the Sendmail error message for further information (usually in /var/log/messages)', __METHOD__);
         }
         return $returnedValue;
     } else {
         eZDebug::writeWarning("Unable to send mail: 'mail' function is not compiled into PHP.", __METHOD__);
     }
     return false;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:59,代码来源:ezsendmailtransport.php

示例5: validateEMailHTTPInput

 function validateEMailHTTPInput($email, $contentObjectAttribute)
 {
     if (!eZMail::validate($email)) {
         $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The email address is not valid.'));
         return eZInputValidator::STATE_INVALID;
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:8,代码来源:ezemailtype.php

示例6: validateObjectAttributeHTTPInput

 function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
 {
     $actionRemoveSelected = false;
     if ($http->hasPostVariable('CustomActionButton')) {
         $customActionArray = $http->postVariable('CustomActionButton');
         if (isset($customActionArray[$contentObjectAttribute->attribute("id") . '_remove_selected'])) {
             if ($customActionArray[$contentObjectAttribute->attribute("id") . '_remove_selected'] == 'Remove selected') {
                 $actionRemoveSelected = true;
             }
         }
     }
     if ($http->hasPostVariable($base . "_data_author_id_" . $contentObjectAttribute->attribute("id"))) {
         $classAttribute = $contentObjectAttribute->contentClassAttribute();
         $idList = $http->postVariable($base . "_data_author_id_" . $contentObjectAttribute->attribute("id"));
         $nameList = $http->postVariable($base . "_data_author_name_" . $contentObjectAttribute->attribute("id"));
         $emailList = $http->postVariable($base . "_data_author_email_" . $contentObjectAttribute->attribute("id"));
         if ($http->hasPostVariable($base . "_data_author_remove_" . $contentObjectAttribute->attribute("id"))) {
             $removeList = $http->postVariable($base . "_data_author_remove_" . $contentObjectAttribute->attribute("id"));
         } else {
             $removeList = array();
         }
         if ($contentObjectAttribute->validateIsRequired()) {
             if (trim($nameList[0]) == "") {
                 $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'At least one author is required.'));
                 return eZInputValidator::STATE_INVALID;
             }
         }
         if (trim($nameList[0]) != "") {
             for ($i = 0; $i < count($idList); $i++) {
                 if ($actionRemoveSelected) {
                     if (in_array($idList[$i], $removeList)) {
                         continue;
                     }
                 }
                 $name = $nameList[$i];
                 $email = $emailList[$i];
                 if (trim($name) == "") {
                     $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The author name must be provided.'));
                     return eZInputValidator::STATE_INVALID;
                 }
                 $isValidate = eZMail::validate($email);
                 if (!$isValidate) {
                     $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The email address is not valid.'));
                     return eZInputValidator::STATE_INVALID;
                 }
             }
         }
     } else {
         if ($contentObjectAttribute->validateIsRequired()) {
             $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'At least one author is required.'));
             return eZInputValidator::STATE_INVALID;
         }
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:55,代码来源:ezauthortype.php

示例7: validateObjectAttributeHTTPInput

 function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
 {
     //$classAttribute = $contentObjectAttribute->contentClassAttribute();
     if ($http->hasPostVariable($base . '_data_text_' . $contentObjectAttribute->attribute('id'))) {
         $email = $http->postVariable($base . '_data_text_' . $contentObjectAttribute->attribute('id'));
         $trimmedEmail = trim($email);
         if ($trimmedEmail == "") {
             return eZInputValidator::STATE_ACCEPTED;
         }
         if (!eZMail::validate($trimmedEmail)) {
             $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'The email address is not valid.'));
             return eZInputValidator::STATE_INVALID;
         }
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
开发者ID:jjohnsen,项目名称:jajnewsletter,代码行数:16,代码来源:jajpreviewnewslettertype.php

示例8: processPostData

    function processPostData()
    {
        $user = array();

        $user['first_name'] = $this->Http->postVariable( 'eZSetup_site_templates_first_name' );
        $user['last_name'] = $this->Http->postVariable( 'eZSetup_site_templates_last_name' );
        $user['email'] = $this->Http->postVariable( 'eZSetup_site_templates_email' );
        if ( strlen( trim( $user['first_name'] ) ) == 0 )
        {
            $this->Error[] = self::FIRST_NAME_MISSING;
        }
        if ( strlen( trim( $user['last_name'] ) ) == 0 )
        {
            $this->Error[] = self::LAST_NAME_MISSING;
        }
        if ( strlen( trim( $user['email'] ) ) == 0 )
        {
            $this->Error[] = self::EMAIL_MISSING;
        }
        else if ( !eZMail::validate( trim( $user['email'] ) ) )
        {
            $this->Error[] = self::EMAIL_INVALID;
        }
        if ( strlen( trim( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) ) ) == 0 )
        {
            $this->Error[] = self::PASSWORD_MISSING;
        }
        else if ( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) != $this->Http->postVariable( 'eZSetup_site_templates_password2' ) )
        {
            $this->Error[] = self::PASSWORD_MISSMATCH;
        }
        else if ( !eZUser::validatePassword( trim( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) ) ) )
        {
            $this->Error[] = self::PASSWORD_TOO_SHORT;
        }
        else
        {
            $user['password'] = $this->Http->postVariable( 'eZSetup_site_templates_password1' );
        }
        if ( !isset( $user['password'] ) )
            $user['password'] = '';
        $this->PersistenceList['admin'] = $user;

        return ( count( $this->Error ) == 0 );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:45,代码来源:ezstep_site_admin.php

示例9: processViewActions

 function processViewActions(&$validation, $params)
 {
     $http = eZHTTPTool::instance();
     $prefix = eZSurveyType::PREFIX_ATTRIBUTE;
     $attributeID = $params['contentobjectattribute_id'];
     $postAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $attributeID;
     $answer = trim($http->postVariable($postAnswer));
     if ($this->attribute('mandatory') == 1 and strlen($answer) == 0) {
         $validation['error'] = true;
         $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Please answer the question %number as well!', null, array('%number' => $this->questionNumber())), 'question_number' => $this->questionNumber(), 'code' => 'email_answer_question', 'question' => $this);
     } else {
         if (strlen($answer) != 0 && !eZMail::validate($answer)) {
             $validation['error'] = true;
             $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question %number is not a valid email address!', null, array('%number' => $this->questionNumber())), 'question_number' => $this->questionNumber(), 'code' => 'email_email_not_valid', 'question' => $this);
         }
     }
     $this->setAnswer($answer);
 }
开发者ID:netbliss,项目名称:ezsurvey,代码行数:18,代码来源:ezsurveyemailentry.php

示例10: validateField

 /**
  * Implement the validatation in adding comment
  * @see extension/ezcomments/classes/ezcomFormTool#validateField($field)
  */
 protected function validateField($field, $value)
 {
     switch ($field) {
         case 'website':
             return ezcomUtility::validateURLString($value);
         case 'email':
             // just validate anonymous's input email
             $user = eZUser::currentUser();
             if ($user->isAnonymous()) {
                 $result = eZMail::validate($value);
                 if (!$result) {
                     return ezpI18n::tr('ezcomments/comment/add', 'Not a valid email address.');
                 }
             }
             return true;
         case 'recaptcha':
             require_once 'recaptchalib.php';
             $ini = eZINI::instance('ezcomments.ini');
             $privateKey = $ini->variable('RecaptchaSetting', 'PrivateKey');
             $http = eZHTTPTool::instance();
             if ($http->hasPostVariable('recaptcha_challenge_field') && $http->hasPostVariable('recaptcha_response_field')) {
                 $ip = $_SERVER["REMOTE_ADDR"];
                 $challengeField = $http->postVariable('recaptcha_challenge_field');
                 $responseField = $http->postVariable('recaptcha_response_field');
                 $capchaResponse = recaptcha_check_answer($privateKey, $ip, $challengeField, $responseField);
                 if (!$capchaResponse->is_valid) {
                     return ezpI18n::tr('ezcomments/comment/add', 'The words you input are incorrect.');
                 }
             } else {
                 return ezpI18n::tr('ezcomments/comment/add', 'Captcha parameter error.');
             }
             return true;
         default:
             return true;
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:40,代码来源:ezcomaddcommenttool.php

示例11: processViewActions

 function processViewActions($objectAttribute, &$survey, &$validation)
 {
     $http = eZHTTPTool::instance();
     $actionContinue = false;
     $postNodeID = self::PREFIX_ATTRIBUTE . '_ezsurvey_node_id_' . $objectAttribute->attribute('id');
     $postContentObjectAttributeID = self::PREFIX_ATTRIBUTE . '_ezsurvey_contentobjectattribute_id_' . $objectAttribute->attribute('id');
     $postSurveyID = self::PREFIX_ATTRIBUTE . '_ezsurvey_id_' . $objectAttribute->attribute('id');
     $continueViewActions = true;
     if ($survey->attribute('one_answer') == 1) {
         $user = eZUser::currentUser();
         if ($user->isLoggedIn() === true) {
             $contentObjectID = $objectAttribute->attribute('contentobject_id');
             $contentClassAttributeID = $objectAttribute->attribute('contentclassattribute_id');
             $languageCode = $objectAttribute->attribute('language_code');
             $surveyID = $survey->attribute('id');
             $exist = eZSurveyResult::exist($surveyID, $user->attribute('contentobject_id'), $contentObjectID, $contentClassAttributeID, $languageCode);
             if ($exist === true) {
                 $continueViewActions = false;
             }
         } else {
             $continueViewActions = false;
         }
     }
     if ($continueViewActions === true) {
         if ($http->hasPostVariable($postNodeID) and $http->hasPostVariable($postContentObjectAttributeID) and $http->hasPostVariable($postSurveyID)) {
             $surveyID = $http->postVariable($postSurveyID);
             $contentObjectAttributeID = $http->postVariable($postContentObjectAttributeID);
             $nodeID = $http->postVariable($postNodeID);
             $node = eZContentObjectTreeNode::fetch($nodeID);
             if (get_class($node) == 'eZContentObjectTreeNode' and $node->canRead() === true) {
                 // verify that our attribute is included in this node.
                 $dataMap = $node->dataMap();
                 foreach ($dataMap as $attribute) {
                     $attributeObjectID = $attribute->attribute('id');
                     if ($attributeObjectID == $contentObjectAttributeID) {
                         $actionContinue = true;
                         break;
                     }
                 }
             } else {
                 if (get_class($node) == 'eZContentObjectTreeNode') {
                     eZDebug::writeWarning("Not enough permissions to read node with ID: " . $nodeID . ".", 'eZSurveyType::processViewActions');
                 } else {
                     eZDebug::writeWarning("node with ID: " . $nodeID . " does not exist.", 'eZSurveyType::processViewActions');
                     return false;
                 }
             }
         } else {
             eZDebug::writeWarning("All the postvariables {$postNodeID}, {$postContentObjectAttributeID} and {$postSurveyID} need to be supplied.", 'eZSurveyType::processViewActions');
             return false;
         }
         $nodeID = $http->postVariable($postNodeID);
         $node = eZContentObjectTreeNode::fetch($nodeID);
         if ($actionContinue === true) {
             $survey = eZSurvey::fetch($surveyID);
             $status = $survey->validateContentObjectAttributeID($contentObjectAttributeID);
             if (!$survey or !$survey->published() or !$survey->enabled() or !$survey->valid()) {
                 eZDebug::writeWarning('Survey is not valid', 'eZSurveyType::processViewActions');
                 return;
             }
             $params = array('prefix_attribute' => self::PREFIX_ATTRIBUTE, 'contentobjectattribute_id' => $contentObjectAttributeID);
             $variableArray = $survey->processViewActions($validation, $params);
             $postSurveyStoreButton = self::PREFIX_ATTRIBUTE . '_ezsurvey_store_button_' . $contentObjectAttributeID;
             $user = eZUser::currentUser();
             if ($survey->attribute('persistent')) {
                 $result = eZSurveyResult::instance($surveyID, $user->id());
             } else {
                 $result = eZSurveyResult::instance($surveyID);
             }
             $result->setAttribute('user_id', $user->id());
             $http = eZHTTPTool::instance();
             $sessionID = $http->sessionID();
             $result->setAttribute('user_session_id', $sessionID);
             if ($http->hasPostVariable($postSurveyStoreButton) && $validation['error'] == false) {
                 $result->storeResult($params);
                 $postReceiverID = self::PREFIX_ATTRIBUTE . '_ezsurvey_receiver_id_' . $contentObjectAttributeID;
                 if ($http->hasPostVariable($postReceiverID) and $questionList = $survey->fetchQuestionList() and $postReceiverQuestionID = $http->postVariable($postReceiverID) and isset($questionList[$postReceiverQuestionID])) {
                     $mailTo = $questionList[$postReceiverQuestionID]->answer();
                     $emailSenderList = explode('_', $questionList[$postReceiverQuestionID]->attribute('text3'));
                     if (isset($emailSenderList[1]) and $emailSenderID = $emailSenderList[1] and is_numeric($emailSenderID) and $emailSenderID > 0 and isset($questionList[$emailSenderID]) and $senderQuestion = $questionList[$emailSenderID] and $senderQuestion->attribute('type') == 'EmailEntry' and eZMail::validate($senderQuestion->attribute('answer'))) {
                         $emailSender = $senderQuestion->attribute('answer');
                     } else {
                         $ini = eZINI::instance();
                         $emailSender = $ini->variable('MailSettings', 'EmailSender');
                         if (!$emailSender) {
                             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
                         }
                     }
                     require_once 'kernel/common/template.php';
                     $tpl_email = templateInit();
                     $tpl_email->setVariable('survey', $survey);
                     $tpl_email->setVariable('survey_questions', $questionList);
                     $tpl_email->setVariable('survey_node', $node);
                     $templateResult = $tpl_email->fetch('design:survey/mail.tpl');
                     $subject = $tpl_email->variable('subject');
                     $mail = new eZMail();
                     $mail->setSenderText($emailSender);
                     $mail->setReceiver($mailTo);
                     $mail->setSubject($subject);
                     $mail->setBody($templateResult);
//.........这里部分代码省略.........
开发者ID:netbliss,项目名称:ezsurvey,代码行数:101,代码来源:ezsurveytype.php

示例12: DOMDocument

    $module->redirectTo('/shop/basket/');
    return;
}
$tpl->setVariable("input_error", false);
if ($module->isCurrentAction('Store')) {
    $inputIsValid = true;
    $firstName = $http->postVariable("FirstName");
    if (trim($firstName) == "") {
        $inputIsValid = false;
    }
    $lastName = $http->postVariable("LastName");
    if (trim($lastName) == "") {
        $inputIsValid = false;
    }
    $email = $http->postVariable("EMail");
    if (!eZMail::validate($email)) {
        $inputIsValid = false;
    }
    $address = $http->postVariable("Address");
    if (trim($address) == "") {
        $inputIsValid = false;
    }
    $tpl->setVariable("first_name", $firstName);
    $tpl->setVariable("last_name", $lastName);
    $tpl->setVariable("email", $email);
    $tpl->setVariable("address", $address);
    if ($inputIsValid == true) {
        // Check for validation
        $basket = eZBasket::currentBasket();
        $order = $basket->createOrder();
        $doc = new DOMDocument('1.0', 'utf-8');
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:31,代码来源:register.php

示例13: microtime_float2

                if ($try == $maxRetry) {
                    eZFile::rename($mailFiles[$i - 1], $mailFiles[$i] . ".notsend");
                }
            } else {
                eZFile::rename($mailFiles[$i - 1], $mailFiles[$i] . ".notsend");
            }
        }
    }
    if ($robinCounter >= $packageSize && count($serverlist) != 1) {
        $time_end = microtime_float2();
        $time = $time_end - $time_start;
        $cli->output("Sent " . $robinCounter . " emails in " . number_format($time, 3) . " seconds with " . $serverlist[$active_server]['host']);
        $cli->output("Average speed: " . number_format((double) 60.0 * (double) $robinCounter / (double) $time, 3) . " emails/minute");
        $robinCounter = 0;
        $active_server = nextConnection($active_server, $serverlist, $i + 1);
        $time_start = microtime_float2();
    }
    if (eZMail::validate($from) && eZMail::validate($to)) {
        $robinCounter++;
    }
}
if (count($serverlist) == 1) {
    $time_end = microtime_float2();
    $time = $time_end - $time_start;
    $cli->output("Sent " . $robinCounter . " emails in " . number_format($time, 3) . " seconds with " . $serverlist[$active_server]['host']);
    $cli->output("Average speed: " . number_format((double) 60.0 * (double) $robinCounter / (double) $time, 3) . " emails/minute");
}
// remove pid file to unlock cronjob
if (file_exists($pidfilename)) {
    unlink($pidfilename);
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:cluster_send.php

示例14: processPostData

    /**
     * @return bool
     */
    function processPostData()
    {
        if ( !$this->Http->hasPostVariable( 'eZSetupSendRegistration' ) )// skip site registration
        {
            return true;
        }

        if ( !$this->Http->hasPostVariable( 'eZSetupRegistrationData' ) )
        {
          return false;
        }

        // Get post variables and make sure they keep same order independent of checkboxes
        $rawUserData = $this->Http->postVariable( 'eZSetupRegistrationData' );
        $userData['first_time_user'] = isset( $rawUserData['first_time_user'] ) ? true : false;
        $userData['include_tech_stats'] = isset( $rawUserData['include_tech_stats'] ) ? true : false;
        unset( $rawUserData['first_time_user'], $rawUserData['include_tech_stats'] );
        $userData = $rawUserData + $userData + $this->defaultUserData;

        // Store on persistence list so data doesn't need to be entered several times
        $this->PersistenceList['email_info']['user_data'] = $userData;

        // Make sure requried data is present
        $validationMessages = array();
        if ( !$userData['first_name'] )
        {
            $validationMessages[] = ezpI18n::tr(
                'design/standard/setup/init',
                'Registration field "%fieldName" is empty',
                false,
                array( '%fieldName' => ezpI18n::tr( 'design/standard/setup/init', 'First name' ) )
            );
        }

        if ( !$userData['last_name'] )
        {
            $validationMessages[] = ezpI18n::tr(
                'design/standard/setup/init',
                'Registration field "%fieldName" is empty',
                false,
                array( '%fieldName' => ezpI18n::tr( 'design/standard/setup/init', 'Last name' ) )
            );
        }

        if ( !$userData['email'] )
        {
            $validationMessages[] = ezpI18n::tr(
                'design/standard/setup/init',
                'Registration field "%fieldName" is empty',
                false,
                array( '%fieldName' => ezpI18n::tr( 'design/standard/setup/init', 'Your email' ) )
            );
        }
        else if ( !eZMail::validate( $userData['email'] ) )
        {
            $validationMessages[] = ezpI18n::tr(
                'design/standard/setup/init',
                'Registration field "%fieldName" has wrong format',
                false,
                array( '%fieldName' => ezpI18n::tr( 'design/standard/setup/init', 'Your email' ) )
            );
        }

        if ( !$userData['country'] )
        {
            $validationMessages[] = ezpI18n::tr(
                'design/standard/setup/init',
                'Registration field "%fieldName" is empty',
                false,
                array( '%fieldName' => ezpI18n::tr( 'design/standard/setup/init', 'Country' ) )
            );
        }

        if ( !empty( $validationMessages ) )
        {
            $this->Tpl->setVariable( 'validation_messages', $validationMessages );
            return false;
        }

        $mailTpl = eZTemplate::factory();
        $bodyText = $this->generateRegistration( $mailTpl, $userData );
        $subject = $mailTpl->variable( 'subject' );

        // Fill in E-Mail data and send it
        $mail = new eZMail();
        $mail->setReceiver( 'registerezsite@ez.no', 'eZ Site Registration' );
        $mail->setSender( 'registerezsite@ez.no' );
        $mail->setSubject( $subject );
        $mail->setBody( $bodyText );
        $mailResult = eZMailTransport::send( $mail );

        $this->PersistenceList['email_info']['send'] = true;
        $this->PersistenceList['email_info']['result'] = $mailResult;

        return true; // Always continue
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:99,代码来源:ezstep_registration.php

示例15: executeBeforeLastRedirect

 public function executeBeforeLastRedirect($node)
 {
     $survey = $this->fetchFeedbackSurvey();
     $surveyQuestions = $this->feedbackQuestionList();
     $mailTo = $this->fetchMailTo($surveyQuestions);
     if ($survey = $this->fetchFeedbackSurvey() and $survey instanceof eZSurvey and $surveyQuestions = $this->feedbackQuestionList() and $mailTo = $this->fetchMailTo($surveyQuestions) and eZMail::validate($mailTo)) {
         $tpl_email = eZTemplate::factory();
         $tpl_email->setVariable('intro', $this->Text2);
         $tpl_email->setVariable('survey', $survey);
         $tpl_email->setVariable('survey_questions', $surveyQuestions);
         $tpl_email->setVariable('survey_node', $node);
         $templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl');
         if (trim($this->Text3) != '') {
             $subject = $this->Text3;
         } else {
             $subject = $tpl_email->variable('subject');
         }
         $mail = new eZMail();
         $ini = eZINI::instance();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         $mail->setSenderText($emailSender);
         $mail->setReceiver($mailTo);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         if ($this->Num == 1) {
             $adminReceiver = $ini->variable('MailSettings', 'AdminEmail');
             $mail->addBcc($adminReceiver);
         }
         $mailResult = eZMailTransport::send($mail);
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:34,代码来源:ezsurveyfeedbackfield.php


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