Exemplo n.º 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;
 }
Exemplo n.º 2
0
 protected function routePageAction($p, $fileName)
 {
     $this->addProfilerMessage("Started to include action {$p}");
     parent::routePageAction($p, $fileName);
     $this->addProfilerMessage("Finished to include action {$p}");
 }
Exemplo n.º 3
0
 /**
  * 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');
     }
 }
Exemplo n.º 4
0
<?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);
Exemplo n.º 5
0
 /**
  * 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);
 }