コード例 #1
0
 public function send($transports = array())
 {
     $output = false;
     $queuedMessageInfo = $this->getData();
     try {
         $options = array('intro' => Util::lavnn('intro', $queuedMessageInfo, ''), 'manual' => Util::lavnn('manual', $queuedMessageInfo, 0), 'signature' => Util::lavnn('signature', $queuedMessageInfo, 'team'), 'language' => Util::lavnn('language', $queuedMessageInfo, 'en'), 'sender' => Util::lavnn('sender', $queuedMessageInfo, 0));
         if (count($transports) > 0) {
             $options['transport'] = $transports[0];
         }
         if (count($transports) > 1) {
             $options['alternativeTransport'] = $transports[1];
         }
         $output = MailUtil::mail($queuedMessageInfo['email'], $queuedMessageInfo['subject'], $queuedMessageInfo['message'], $options);
     } catch (\Exception $ex) {
         $env = Runtime::getInstance()->config['ENV'];
         $adminAlert = new AdminAlert();
         $adminAlert->insert(array('title' => '[' . $env . '] Failed email sending attempt to address "' . $queuedMessageInfo['email'], 'description' => print_r($queuedMessageInfo, 1), 'context' => print_r($ex->getTrace(), 1)));
     }
     return $output;
 }
コード例 #2
0
ファイル: Runtime.php プロジェクト: barcodex/kasha
 protected function routePageAction($p, $fileName)
 {
     $this->addProfilerMessage("Started to include action {$p}");
     parent::routePageAction($p, $fileName);
     $this->addProfilerMessage("Finished to include action {$p}");
 }
コード例 #3
0
ファイル: Runtime.php プロジェクト: barcodex/kasha-core
 /**
  * Forces inclusion of another action without rerouting/redirecting (should preserve the original url)
  *
  * @param $actionPath
  * @param $params // added to $_REQUEST, overwriting the keys
  */
 public function includeAction($actionPath, $params = array())
 {
     // include action if it exists
     if ($actionPath != '' && ($fileName = $this->checkAction($actionPath))) {
         // save the original request and current action
         $currentModule = $this->moduleName;
         $currentAction = $this->actionName;
         $originalRequest = $_REQUEST;
         // alter the request
         foreach ($params as $key => $value) {
             $_REQUEST[$key] = $value;
         }
         $r = Runtime::getInstance();
         if ($r->hasContextItem('page')) {
             $page = $r->getContextItem('page');
         }
         require $fileName;
         // restore original request and action
         $_REQUEST = $originalRequest;
         $this->moduleName = $currentModule;
         $this->actionName = $currentAction;
     } else {
         // @TODO send an error to admin that action is missing
         die($actionPath . ' not found');
     }
 }
コード例 #4
0
ファイル: form.php プロジェクト: barcodex/kashevar
<?php

use Kasha\Core\Runtime;
use Kasha\Core\Validator;
use Kasha\Temple\Util;
use Kasha\Templar\TextProcessor;
$url = Util::lavnn('_nextUrl', $_REQUEST, '');
$validator = new Validator($_REQUEST);
$validator->removeFields(['f', 'PHPSESSID', 'SQLiteManager_currentLangue', '_nextUrl']);
//$validator->checkMetadata($model->getMetadata(), ['id']);
$request = $validator->getFields();
$errors = $validator->getErrors();
if (count($errors) > 0) {
    $_SESSION['form']['data'] = $request;
    $_SESSION['form']['errors'] = $errors;
} else {
    //	$updateId = $model->load($id)->update($request);
    if ($updateId == $id) {
        $_SESSION['flash'] = TextProcessor::doTemplate('%MODULE%', 'flash.%NAME%.success');
    } else {
        $_SESSION['error'] = TextProcessor::doTemplate('%MODULE%', 'error.%NAME%.failure');
    }
}
Runtime::redirect($url);
コード例 #5
0
ファイル: MailUtil.php プロジェクト: barcodex/kasha-mail
 /**
  * Prepares mail message in the text format
  *
  * @param $subj
  * @param $body
  * @param $hash
  * @param string $intro
  * @param string $signature
  * @param string $language
  * @param int $sender
  *
  * @return string
  */
 public static function prepareTextMail($subj, $body, $hash, $intro = '', $signature = 'team', $language = 'en', $sender = 0)
 {
     $url = Runtime::getBaseUrl() . '/' . Runtime::getUrlLanguagePrefix() . 'webmail/' . $hash;
     $params = array('subj' => $subj, 'body' => strip_tags($body), 'intro' => $intro, 'hash' => $hash, 'weblink' => $url, 'signature' => self::prepareMailSignature($signature, false, $language, $sender));
     return TextProcessor::doTemplate('cron', 'mail.text', $params);
 }