error() public static method

logs error message
public static error ( string $message, string $logGroup = null )
$message string
$logGroup string
Ejemplo n.º 1
0
 function LogRequest($log){
   if($this->logLevel & self::L_RQST){
     Gpf_Log::error(sprintf("\n%s:- %s\n",date("D M j G:i:s T Y"),$log)); 
      return true;
   }
   return false;
 }
Ejemplo n.º 2
0
 	public function addCommission(Pap_Contexts_Signup $signupContext) {
 	    if (($user = $signupContext->getUserObject()) == null) {
 	        return;
 	    } 
 	    
 	    $campaignId = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CAMPAIGNID);
 	    $actionCode = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CODE);
 	    
 	    if ($actionCode == '') {
 	        Gpf_Log::error('SignupActionCommissions plugin: No Action code set');
 	        return;
 	    }
        
 	    $saleTracker = new Pap_Tracking_ActionTracker();
 	    
        $action = $saleTracker->createAction($actionCode);
        $action->setAffiliateID($user->getId());    
        $action->setStatus($user->getStatus());
        $action->setOrderId(SignupActionCommissions_Config::DEFAULT_ORDER_ID);
        if ($campaignId != '') {
          $action->setCampaignID($campaignId);
        }
        try {
            $saleTracker->register();
        } catch (Gpf_Exception $e) {
            Gpf_Log::error('SignupActionCommissions plugin: '.$e->getMessage());
        }
        
 	}
Ejemplo n.º 3
0
 protected function log($time, $message, $logLevel, $logGroup, $ip, $file, $line, $type = null)
 {
     if ($message == "") {
         return;
     }
     $timeString = strftime("Y-m-d H:i:s", $time);
     $userId = null;
     try {
         $userId = Gpf_Session::getAuthUser()->getUserId();
     } catch (Gpf_Exception $e) {
     }
     try {
         $dbLog = new Gpf_Db_Log();
         $dbLog->set('groupid', $logGroup);
         $dbLog->set('level', $logLevel);
         $dbLog->set('created', $timeString);
         $dbLog->set('filename', $file);
         $dbLog->set('message', $message);
         $dbLog->set('line', $line);
         $dbLog->set('ip', $ip);
         $dbLog->set('accountuserid', $userId);
         $dbLog->set(Gpf_Db_Table_Logs::TYPE, $type);
         $dbLog->save();
     } catch (Exception $e) {
         Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE);
         Gpf_Log::error($this->_sys("Database Logger Error. Logging on display: %s", $message));
         Gpf_Log::enableAllTypes();
     }
 }
Ejemplo n.º 4
0
 protected function logException()
 {
     if ($this->isLoggerException) {
         parent::logException();
         return;
     }
     Gpf_Log::error($this->getMessage());
 }
 private function sendNotificationToMerchant(Pap_Db_DirectLinkUrl $directLink) {
     $mail = new Pap_Mail_MerchantNewDirectLinkNotification($directLink);
     $mail->loadUser(Gpf_Session::getAuthUser()->getPapUserId());
     $mail->addRecipient(Pap_Common_User::getMerchantEmail());
     try {
         $mail->send();
     } catch (Exception $e) {
     	Gpf_Log::error($this->_('Error sending new direct link notification email to merchant: %s', $e->getMessage()));
     }
 }
 private function updatePlannedTaskParams() {
     $plannedTask = new Gpf_Db_PlannedTask();
     $plannedTask->setClassName(Pap_Merchants_Config_EmailNotificationsFormBase::REPORTS_SEND_CLASS);
     $plannedTask->setAccountId($this->task->getAccountId());
     try {
         $plannedTask->loadFromData(array(Gpf_Db_Table_PlannedTasks::CLASSNAME, Gpf_Db_Table_PlannedTasks::ACCOUNTID));
         $plannedTask->setParams($this->getSerializedDateParams(Gpf_Common_DateUtils::getDate($this->time)));
         $plannedTask->setLastPlanDate(Gpf_Common_DateUtils::addDateUnit(Gpf_Common_DateUtils::getDate($this->time), 1, Gpf_Common_DateUtils::DAY));
         $plannedTask->save();
     } catch (Gpf_Exception $e) {
         Gpf_Log::error('Error during updating planned ReportsSendTask: ' . $e->getMessage());
     }
 }
Ejemplo n.º 7
0
 public function checkRules(Pap_Common_Transaction $transaction) {
     Gpf_Log::debug('Performance reward started');
     foreach($this->getRules($transaction->getCampaignId()) as $ruleRecord) {
         $rule = new Pap_Features_PerformanceRewards_Rule_Transaction($transaction);
         $rule->fillFromRecord($ruleRecord);
         try {
             Gpf_Log::debug('Processing rule ' . $rule->getId() . ': ' . $rule->getAction());
             $rule->executeAction();
             Gpf_Log::debug('Rule completed');
         } catch (Exception $e) {
             Gpf_Log::error(sprintf('Rule %s failed. Reason: %s', $rule->getId(), $e->getMessage()));
         }
     }
     Gpf_Log::debug('Performance reward ended');
 }
Ejemplo n.º 8
0
 /**
  *
  * @return Pap_Db_UserInCommissionGroup
  */
 protected function getUserCommissionGroup() {
     if($this->userInGroup !== null) {
         return $this->userInGroup;
     }
     try {
         $userInGroup = Pap_Db_Table_UserInCommissionGroup::getInstance()->getUserCommissionGroup(
             $this->getCurrentUserId(), $this->transaction->getCampaignId());
     } catch (Gpf_DbEngine_TooManyRowsException $e) {
         Gpf_Log::error(sprintf('Database not in consistent state. User %s has many commission groups', $userId));
         Pap_Db_Table_UserInCommissionGroup::removeUserFromCampaignGroups($userId, $campaignId);
         $userInGroup = new Pap_Db_UserInCommissionGroup();
         $userInGroup->setStatus(Pap_Features_PerformanceRewards_Condition::STATUS_APPROVED);
         $userInGroup->setUserId($userId);
     }
     return $this->userInGroup = $userInGroup;
 }
Ejemplo n.º 9
0
 protected function getTransactionsListForPeriod($time) {
     $ch = curl_init();
     $request = $this->buildURLrequest($time);
     curl_setopt($ch, CURLOPT_URL, $request);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $answer = curl_exec($ch);
     $curlErr = curl_error($ch);
     if (strlen($curlErr)) {
         Gpf_Log::error('Error during recieving transaction list from ccBill, request: ' . $request);
     }
     if (strpos($answer, 'Authentication failed')) {
         $message = 'Authentification failed, request: ' . $request;
         Gpf_Log::error($message);
         throw new Gpf_Exception($message);
     }
     return $answer;
 }
Ejemplo n.º 10
0
 public static function create(Gpf_Application $application)
 {
     setlocale(LC_ALL, 'en.UTF-8');
     self::$instance = $application;
     self::$instance->registerRolePrivileges();
     self::$instance->initLogger();
     self::$instance->addSmartyPluginsDir();
     $timezone = Gpf_Settings_Gpf::DEFAULT_TIMEZONE;
     try {
         $timezone = Gpf_Settings::get(Gpf_Settings_Gpf::TIMEZONE_NAME);
     } catch (Gpf_Exception $e) {
         Gpf_Log::error('Unable to load timezone: %s - using default one.', $e->getMessage());
     }
     if (false === @date_default_timezone_set($timezone)) {
         Gpf_Log::error('Unable to set timezone %s:', $timezone);
     }
 }
Ejemplo n.º 11
0
 private function generateDefaultValue($userId) {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add('MAX(CAST(SUBSTR('.Pap_Db_Table_Channels::VALUE.', 5) AS UNSIGNED))', 'max');
     $select->from->add(Pap_Db_Table_Channels::getName());
     $select->where->add(Pap_Db_Table_Channels::VALUE, 'like', 'code%');
     $select->where->add(Pap_Db_Table_Channels::USER_ID, '=', $userId);
     try {
         $result = $select->getOneRow();
         $max = $result->get('max')+1;
     } catch (Gpf_DbEngine_NoRowException $e) {
         $max = 1;
     } catch (Gpf_DbEngine_TooManyRowsException $e) {
         Gpf_Log::error('Database not in consistent state. Error in qu_pap_channels.');
     }
     if (isset($max)) {
         return 'code'.$max;
     }
     return 'code';
 }
 protected function copy(Gpf_Io_File $source, Gpf_Io_File $target)
 {
     $this->resourceOverwritten = false;
     if ($target->isExists() && $this->isFileChanged($source, $target)) {
         try {
             Gpf_Io_File::copy($target, new Gpf_Io_File($target->getFileName() . '.v' . str_replace('.', '_', Gpf_Application::getInstance()->getVersion())), $this->mode);
             $this->resourceOverwritten = true;
         } catch (Gpf_Exception $e) {
             $message = $this->_('Could not backup changed theme resource file %s (%s)', $target->getFileName(), $e->getMessage());
             Gpf_Log::error($message);
             throw new Gpf_Exception($message);
         }
     }
     try {
         Gpf_Io_File::copy($source, $target, $this->mode);
     } catch (Gpf_Exception $e) {
         $message = $this->_('Could not install new theme resource (%s) file.  Make sure that file is writable by webserver.', $target->getFileName());
         Gpf_Log::error($message);
         throw new Gpf_Exception($message);
     }
 }
Ejemplo n.º 13
0
 /**
  * @param $licenseCode
  * @param $installUrl
  * @return Gpf_Install_LicenseInfo
  */
 private function getLicenseInfo($licenseCode, $installUrl = '', $hostedAccountId = null)
 {
     if (strlen($licenseCode) > self::MIN_LICENSE_LENGTH) {
         $licenseInfo = new Gpf_Install_LicenseInfo();
         $licenseInfo->setLicense($licenseCode);
         return $licenseInfo;
     }
     $response = $this->sendRequestAndGetResponse($this->createValidateLicenseDatarequest($licenseCode, $installUrl, $hostedAccountId));
     $license = $response->getValue(self::LICENSE_MEMBERS_NAME);
     if ($license == '') {
         Gpf_Log::error(sprintf('Response from members recieved, but contains system error: %s', $response->getValue('message')));
         throw new Gpf_Exception("Invalid license");
     }
     $licenseInfo = new Gpf_Install_LicenseInfo();
     $licenseInfo->setLicense($license);
     $variationName = $response->getValue('variation_name');
     if (null !== $variationName) {
         $licenseInfo->setProductVariationName($variationName);
     }
     $licenseInfo->setApplicationCode($response->getValue('app_code'));
     return $licenseInfo;
 }
Ejemplo n.º 14
0
 /**
  * @param Gpf_Net_Http_Request $request
  * @return Gpf_Net_Http_Response
  */
 private function executeWithSocketOpen(Gpf_Net_Http_Request $request)
 {
     $scheme = $request->getScheme() == 'ssl' || $request->getScheme() == 'https' ? 'ssl://' : '';
     $proxySocket = @fsockopen($scheme . $request->getHost(), $request->getPort(), $errorNr, $errorMessage, self::CONNECTION_TIMEOUT);
     if ($proxySocket === false) {
         $gpfErrorMessage = $this->_sys('Could not connect to server: %s:%s, Failed with error: %s', $request->getHost(), $request->getPort(), $errorMessage);
         Gpf_Log::error($gpfErrorMessage);
         throw new Gpf_Exception($gpfErrorMessage);
     }
     $requestText = $request->toString();
     $result = @fwrite($proxySocket, $requestText);
     if ($result === false || $result != strlen($requestText)) {
         @fclose($proxySocket);
         $gpfErrorMessage = $this->_sys('Could not send request to server %s:%s', $request->getHost(), $request->getPort());
         Gpf_Log::error($gpfErrorMessage);
         throw new Gpf_Exception($gpfErrorMessage);
     }
     $result = '';
     while (false === @feof($proxySocket)) {
         try {
             if (false === ($data = @fread($proxySocket, 8192))) {
                 Gpf_Log::error($this->_sys('Could not read from proxy socket'));
                 throw new Gpf_Exception("could not read from proxy socket");
             }
             $result .= $data;
         } catch (Exception $e) {
             Gpf_Log::error($this->_sys('Proxy failed: %s', $e->getMessage()));
             @fclose($proxySocket);
             throw new Gpf_Exception($this->_('Proxy failed: %s', $e->getMessage()));
         }
     }
     @fclose($proxySocket);
     $response = new Gpf_Net_Http_Response();
     $response->setResponseText($result);
     return $response;
 }
Ejemplo n.º 15
0
 private function addPluginsFromPath($pluginDirectoriesPaths)
 {
     foreach ($pluginDirectoriesPaths as $pluginDirectoryPath) {
         $iterator = new Gpf_Io_DirectoryIterator($pluginDirectoryPath, '', false, true);
         foreach ($iterator as $fullPath => $pluginName) {
             if (defined('ENABLE_ENGINECONFIG_LOG')) {
                 Gpf_Log::info('addPluginsFromPath - path:' . $pluginDirectoriesPaths . ', fullpath: ' . $fullPath . ', pluginName: ' . $pluginName);
             }
             try {
                 $this->availablePlugins[] = $this->createPlugin($fullPath);
             } catch (Gpf_Exception $e) {
                 if (defined('ENABLE_ENGINECONFIG_LOG')) {
                     Gpf_Log::error('error during loading plkugin from directory: ' . $e->getMessage());
                 }
             }
         }
     }
 }
Ejemplo n.º 16
0
 public function createFile($filename, $content)
 {
     Gpf_Log::debug('Writing content to tmp file');
     $tempFile = tmpfile();
     if ($tempFile === false) {
         Gpf_Log::error('Unable to create TMP file!');
     }
     fwrite($tempFile, $content);
     fseek($tempFile, 0);
     $result = ftp_fput($this->ftpStream, $filename, $tempFile, FTP_BINARY);
     if ($result === false) {
         Gpf_Log::error('Unable to uplaod file to ftp');
     }
     fclose($tempFile);
 }
Ejemplo n.º 17
0
	private function _send() {
		$this->_reset_response();
		
		$ch = curl_init();
		
		// set the url, number of POST vars, POST data
		curl_setopt($ch,CURLOPT_URL, URL);//constant("Relbit_API::URL"));
		curl_setopt($ch,CURLOPT_POST, 1);
		//temporary fix to empty responses from relbit
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch,CURLOPT_POSTFIELDS, "request=" . urlencode(json_encode($this->request)));
		// TODO: weird CURL SSL handling
		
		// execute post
		$res = curl_exec($ch);
		if ($res === false) {
		    Gpf_Log::error('Curl error: ' . curl_error($ch));
		}
		
		if ($this->debug) {
			Gpf_Log::debug('RELBIT REQUEST: ' . print_r($this->request, true) . "\nRELBIT RESPONSE: " . print_r($res. true));
		}
		
		$this->response = json_decode($res, true);
		// close connection
		curl_close($ch);
		$this->_reset_request();
	}
Ejemplo n.º 18
0
 protected function logError($err) {
     Gpf_Log::error($err);
 }
Ejemplo n.º 19
0
 protected function processAndUpdateVisit(Pap_Db_Visit $visit) {
     try {
         $this->processVisit($visit);
     } catch (Exception $e) {
         Gpf_Log::error("Visit processing failed ($e)");
     }
     $visit->delete();
 }
Ejemplo n.º 20
0
	private function initializeApplication(){
		setlocale(LC_ALL, 'en.UTF-8');
		$timezone = Gpf_Settings_Gpf::DEFAULT_TIMEZONE;
		try {
			$timezone = Gpf_Settings::get(Gpf_Settings_Gpf::TIMEZONE_NAME);
		} catch (Gpf_Exception $e) {
			Gpf_Log::error('Unable to load timezone: %s - using default one.', $e->getMessage());
		}
		if(false === @date_default_timezone_set($timezone)) {
			Gpf_Log::error('Unable to set timezone %s:', $timezone);
		}
		$papAlertData = new Pap_Alert_Data();
		$papAlertData->computeTimeOffset();
	}
Ejemplo n.º 21
0
 private function canDisableTheme($panelName)
 {
     $iterator = new Gpf_Io_DirectoryIterator(Gpf_Paths::getInstance()->getTopTemplatePath() . $panelName, '', false, true);
     $enabledCount = 0;
     foreach ($iterator as $fullName => $themeId) {
         if ($themeId == rtrim(Gpf_Paths::DEFAULT_THEME, '/')) {
             continue;
         }
         try {
             $theme = new Gpf_Desktop_Theme($themeId, $panelName);
             if ($theme->isEnabled()) {
                 $enabledCount++;
                 if ($enabledCount == 2) {
                     return true;
                 }
             }
         } catch (Gpf_Exception $e) {
             Gpf_Log::error($e->getMessage());
         }
     }
     return false;
 }
    public function sendOnChangeStatusNotification() {
        try {
            $user = $this->getUser($this->transaction);
        } catch (Gpf_DbEngine_NoRowException $e) {
            Gpf_Log::error('User with userid=' . $this->transaction->getUserId() . 'can not be loaded and mail can not be send.');
            Gpf_Log::debug('Sending notification to affiliate ended');
            return;
        }
        $isNotify = $this->isNotify($user,
        Pap_Settings::AFF_NOTIFICATION_ON_CHANGE_COMMISSION_STATUS_DEFAULT_SETTING_NAME,
        Pap_Settings::AFF_NOTIFICATION_ON_CHANGE_COMMISSION_STATUS_ENABLED_SETTING_NAME,
            'aff_notification_on_change_comm_status',
        $this->transaction->getStatus(),
        Pap_Settings::AFF_NOTIFICATION_ON_CHANGE_COMMISSION_STATUS_OPTION_STATUS);

        if ($isNotify <> Gpf::YES) {
            Gpf_Log::debug('Sending change status notification to affiliate ended. Affiliate '.$user->getId().': '.$user->getName().' does not have change status notification turned on');
            return;
        }

        if(Gpf_Settings::get(Pap_Settings::NOTIFICATION_ON_COMMISSION_APPROVED) == Gpf::YES && $this->transaction->getStatus() == Pap_Common_Constants::STATUS_APPROVED){
            $this->sendEmail(new Pap_Mail_MerchantOnCommissionApproved(), $user, $this->transaction, $this->getMerchantEmail());
        }

        $disableChangeStatusNotificationEmail = new Gpf_Plugins_ValueContext(false);
        $disableChangeStatusNotificationEmail->setArray(array($user));

        Gpf_Plugins_Engine::extensionPoint('Pap_Tracking_Action_SendTransactionNotificationEmails.sendOnChangeStatusNotificationToAffiliate', $disableChangeStatusNotificationEmail);

        if($disableChangeStatusNotificationEmail->get()) {
            Gpf_Log::debug('Sending change status notification to affiliate ended by any feature or plugin. Affiliate '.$user->getId().': '.$user->getName().'.');
            return;
        }
        $this->sendEmail(new Pap_Mail_AffiliateChangeCommissionStatus(), $user, $this->transaction, $user->getEmail());
        
        Gpf_Log::debug('Sending notification to affiliate ended');
    }
Ejemplo n.º 23
0
 public final function run($maxRunTime = 24, Gpf_Tasks_Task $task = null)
 {
     $this->maxRunTime = $maxRunTime;
     $this->setTask($task);
     $this->initSettings();
     if ($this->maxRunTime < 0) {
         $this->runWithoutInterrupt();
         return;
     }
     $this->startTime = time();
     $this->resumed = true;
     if (!$this->resume()) {
         $this->resumed = false;
         $this->init();
         $this->insertTask();
     }
     if (strlen($this->task->getProgress()) == 0) {
         $this->resumed = false;
     }
     try {
         $this->lock();
         $this->doBeforeExecute();
         $this->execute();
         $this->doAfterExecute();
         $this->unlock();
     } catch (Gpf_Tasks_LongTaskInterrupt $e) {
         $this->doAfterLongTaskInterrupt();
         $this->unlock();
         throw $e;
     } catch (Exception $e) {
         //in case of error, don't execute task next 30 seconds again
         Gpf_Log::error(sprintf('Task %s threw exception %s', get_class($this), $e));
         $this->updateTask(30);
         $this->unlock();
         throw $e;
     }
     $this->task->finishTask();
 }
Ejemplo n.º 24
0
 protected function error($message)
 {
     Gpf_Log::error($message, 'HTTP');
 }
Ejemplo n.º 25
0
 protected function logException()
 {
     Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE);
     Gpf_Log::error($this->getMessage());
     Gpf_Log::enableAllTypes();
 }
Ejemplo n.º 26
0
 protected function createBannerPreview(Gpf_Data_Record $record) {
     try {
         $bannerObj = $this->loadBannerObject($record);
     } catch (Pap_Common_Banner_NotFound $e) {
         return $this->_('Unknown banner type');
     }
     try {
         return $bannerObj->getPreview($this->user);
     } catch (Exception $e) {
         Gpf_Log::error('Unable to generate preview for banner: ' . $bannerObj->getName());
         return '';
     }
 }
    private function setTransactionStatus(Pap_Common_Transaction $transaction, $transactionHeader, $transactionData) {
        if($this->form->getFieldValue(self::TRANSACTION_STATUS) != 'F') {
            Gpf_Log::info('Setting status form file to: ' . $this->form->getFieldValue(self::TRANSACTION_STATUS));
            $transaction->setStatus($this->form->getFieldValue(self::TRANSACTION_STATUS));
            return $transaction;
        }

        $data = array_flip($transactionHeader);
        $stat = $transactionData[$data[Pap_Db_Table_Transactions::R_STATUS]];
        if($stat == Pap_Common_Constants::STATUS_PENDING || $stat == Pap_Common_Constants::STATUS_APPROVED || $stat == Pap_Common_Constants::STATUS_DECLINED){
            Gpf_Log::info('Setting status form preset to: ' . $stat);
            $transaction->set(Pap_Db_Table_Transactions::R_STATUS, $stat);
            return $transaction;
        }
        Gpf_Log::error('Invalid transaction status in import data');
        throw new Gpf_Exception('Invalid transaction status in import data');
    }
Ejemplo n.º 28
0
 protected function runExistingTasks($timeFrame, $inclusion_type, $inclusion_tasks)
 {
     $startTime = time();
     $lastRunTaskId = null;
     try {
         while ($timeFrame > time() - $startTime && ($task = $this->getPendingTask($lastRunTaskId, $inclusion_type, $inclusion_tasks))) {
             if ($inclusion_type == self::INCLUDE_TASKS && !in_array($task->getClassName(), $inclusion_tasks) || $inclusion_type == self::EXCLUDE_TASKS && in_array($task->getClassName(), $inclusion_tasks)) {
                 Gpf_Log::debug('Skipping task ' . $task->getClassName() . ', inclusion settings: ' . $inclusion_type . ', ' . print_r($inclusion_tasks, true));
                 $lastRunTaskId = $task->get(Gpf_Db_Table_Tasks::ID);
                 continue;
             }
             //Init long task
             try {
                 $longTask = $this->createLongTaskObject($task->getClassName());
             } catch (Exception $e) {
                 Gpf_Log::error($this->_("Can not instantiate tasks %s with error %s", $task->getClassName(), $e->getMessage()));
                 $lastRunTaskId = $task->get(Gpf_Db_Table_Tasks::ID);
                 continue;
             }
             //Run long task
             try {
                 Gpf_Log::debug($this->_("Running task %s", $task->getClassName()));
                 $longTask->run($timeFrame - (time() - $startTime), $task);
             } catch (Gpf_Tasks_LongTaskInterrupt $e) {
             } catch (Exception $e) {
                 Gpf_Log::error($this->_("Error while running task %s. Message: %s. Trace: %s.", $task->getClassName(), $e->getMessage(), $e->getTraceAsString()));
             }
             $lastRunTaskId = $task->get(Gpf_Db_Table_Tasks::ID);
         }
     } catch (Gpf_DbEngine_NoRowException $e) {
         Gpf_Log::debug('No task pending');
     }
 }
Ejemplo n.º 29
0
 /**
  * Send mail (schedule to outbox)
  * @throws Gpf_Exception
  * @param $now boolean if true, mail is sent immediately
  */
 public function send($now = false, $delayMinutes = 0)
 {
     if (count($this->recipients) == 0) {
         throw new Gpf_Exception('Failed to send mail, recipients empty.');
     }
     $recipients = $this->getRecipients();
     if (count($recipients) == 0) {
         Gpf_Log::error('Email will not be sent, recipients empty.');
         return;
     }
     $this->loadTemplate();
     foreach ($recipients as $language => $timeOffsets) {
         foreach ($timeOffsets as $timeOffset => $emails) {
             $this->subjectTemplate = new Gpf_Templates_Template(Gpf_Lang::_localizeRuntime($this->getSubject(), $language), '', Gpf_Templates_Template::FETCH_TEXT);
             $this->bodyHtmlTemplate = new Gpf_Templates_Template(Gpf_Lang::_localizeRuntime($this->getBodyHtml(), $language), '', Gpf_Templates_Template::FETCH_TEXT);
             $this->bodyTextTemplate = new Gpf_Templates_Template(Gpf_Lang::_localizeRuntime($this->getBodyText(), $language), '', Gpf_Templates_Template::FETCH_TEXT);
             $this->setRecipientLanguage($language);
             $this->loadVariableValues($timeOffset);
             $mail = $this->createMail(implode(',', $emails), $this->getBccRecipients($this->bccRecipient));
             $mail->scheduleNow($now, $delayMinutes);
         }
     }
 }
Ejemplo n.º 30
0
 protected function logException()
 {
     Gpf_Log::error($this->getMessage());
 }