protected function renderMenu()
 {
     $container = new Zend_Navigation(VAR_menu);
     $this->view->assign('menu', $container);
     $this->view->assign('module', $this->_getParam('module'));
     Zend_Layout::getMvcInstance()->assign('navbar', $this->view->render('navbar.phtml'));
 }
示例#2
0
 protected function _initView()
 {
     // Start initail view
     $this->bootstrap('layout');
     $config = $this->getOption('views');
     $resources = $this->getOption('resources');
     $view = new Zend_View();
     if (isset($resources['layout']['layoutPath'])) {
         $view->assign('layoutRootPath', $resources['layout']['layoutPath']);
     }
     $this->bootstrap('db');
     Zend_Loader::loadClass('Ht_Utils_SystemSetting');
     $sysSetting = Ht_Utils_SystemSetting::getSettings();
     $view->assign('sysSetting', $sysSetting);
     $view->assign('profile', Zend_Auth::getInstance()->getIdentity());
     Zend_Loader::loadClass("Ht_Model_SystemSetting");
     $this->setSystemLogConfiguration($sysSetting);
     // use the viewrenderer to keep the code DRY
     // instantiate and add the helper in one go
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     $viewRenderer->setViewSuffix('phtml');
     // add it to the action helper broker
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     /**
      * Set inflector for Zend_Layout
      */
     $inflector = new Zend_Filter_Inflector(':script.:suffix');
     $inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml'));
     // Initialise Zend_Layout's MVC helpers
     $this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector);
     return $this->getResource('layout')->getView();
 }
示例#3
0
文件: Mailer.php 项目: omusico/logica
 /**
  * Send an email
  * @param String $emailTo
  * @param String $emailFrom
  * @param String $emailSubject
  * @param String $emailData
  * @param String $tpl
  * @return Zend_Session_Namespace
  * @author Reda Menhouch, reda@fornetmaroc.com
  */
 public function sendMail($toMail, $toName, $mailSubject, $emailData, $tpl, $fromMail = false, $fromName = false, $sujetMail = "", $h1Mail = "")
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
     $mailConfig = array('auth' => $config->mail->transport->auth, 'username' => $config->mail->transport->username, 'password' => $config->mail->transport->password, 'ssl' => $config->mail->transport->ssl, 'port' => $config->mail->transport->port);
     //var_dump($mailConfig); die;
     $transport = new Zend_Mail_Transport_Smtp($config->mail->transport->host, $mailConfig);
     $html = new Zend_View();
     $html->setScriptPath(APPLICATION_PATH . '/modules/frontend/views/emails/');
     foreach ($emailData as $key => $value) {
         $html->assign($key, $value);
     }
     $html->assign('sujetMail', $sujetMail);
     $html->assign('h1Mail', $h1Mail);
     $mailSubjectTail = "";
     //$mailSubjectTail=" - [" . $toMail . "]";
     $html->assign('site', $config->site->url);
     $bodyText = $html->render($tpl . '.phtml');
     $fromMail = $fromMail === false ? $config->mail->defaultFrom->email : $fromMail;
     $fromName = $fromName === false ? $config->mail->defaultFrom->name : $fromName;
     $mail = new Zend_Mail('utf-8');
     $mail->setBodyHtml($bodyText, 'utf-8');
     $mail->setFrom($fromMail, $fromName);
     $mail->addTo($toMail, $toName);
     $mail->setSubject($config->mail->defaultSubject->prefix . $mailSubject . $mailSubjectTail);
     $mail->send($transport);
 }
示例#4
0
 public function contatoAction()
 {
     if ($this->_request->isPost()) {
         $html = new Zend_View();
         $html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
         $title = 'Contato | Instag';
         $to = '*****@*****.**';
         $cc = '*****@*****.**';
         $html->assign('title', $title);
         $html->assign('nome', $this->_request->getPost('nome'));
         $html->assign('email', $this->_request->getPost('email'));
         $html->assign('assunto', $this->_request->getPost('assunto'));
         $html->assign('mensagem', $this->_request->getPost('mensagem'));
         $mail = new Zend_Mail('utf-8');
         $bodyText = $html->render('contato.phtml');
         $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => '*****@*****.**', 'password' => 'Inndeia123');
         $transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
         $mail->addTo($to);
         $mail->addCc($cc);
         $mail->setSubject($title);
         $mail->setFrom($this->_request->getPost('email'), $this->_request->getPost('name'));
         $mail->setBodyHtml($bodyText);
         $send = $mail->send($transport);
         if ($send) {
             $this->_helper->flashMessenger->addMessage('Sua mensagem foi enviada com sucesso, em breve entraremos em contato.');
         } else {
             $this->_helper->flashMessenger->addMessage('Falha no envio, tente novamente!');
         }
         $this->_redirect('/index');
     }
 }
示例#5
0
 public function recoveryPasswordCliente($email)
 {
     try {
         if ($this->_modelCliente->verificarEmail($email) == true) {
             try {
                 $where = $this->_modelCliente->getAdapter()->quoteInto('email = ?', $email);
                 $user = $this->_modelCliente->fetchAll($where);
                 $html = new Zend_View();
                 $html->setScriptPath(APPLICATION_PATH . '/assets/templates/');
                 // enviando variaveis para a view
                 $html->assign('nome', $user[0]['nome']);
                 $html->assign('email', $user[0]['email']);
                 $html->assign('senha', $user[0]['pass']);
                 // criando objeto email
                 $mail = new Zend_Mail('utf-8');
                 // render view
                 $bodyText = $html->render('esqueciasenha.phtml');
                 // configurar envio
                 $mail->addTo($user[0]['email']);
                 $mail->setSubject('Esqueci a senha ');
                 $mail->setFrom('*****@*****.**', 'Instag');
                 $mail->setBodyHtml($bodyText);
                 $mail->send();
                 return true;
             } catch (Exception $e) {
                 throw $e;
             }
         } else {
             return false;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
示例#6
0
 public function send()
 {
     $config = Zend_Registry::get('config');
     $mail = new Zend_Mail('utf-8');
     $mail->setSubject('Bericht via de website van ' . $config->company->name)->setFrom($this->getEmail(), $this->getName() . ' ' . $this->getFirstName());
     $view = new Zend_View();
     $view->assign('contact', $this);
     $view->assign('config', $config);
     $view->addScriptPath(APPLICATION_PATH . '/modules/default/views/scripts');
     $body = $view->render('/contact/_mailMessage.phtml');
     $mail->setBodyHtml($body);
     $mail->addTo($config->contact->to);
     return $mail->send();
 }
 public function postAction()
 {
     $email = $this->_request->getParam('email');
     $response = $this->_helper->response();
     if (Kebab_Validation_Email::isValid($email)) {
         // Create user object
         $user = Doctrine_Core::getTable('Model_Entity_User')->findOneBy('email', $email);
         $password = Kebab_Security::createPassword();
         if ($user !== false) {
             $user->password = md5($password);
             $user->save();
             $configParam = Zend_Registry::get('config')->kebab->mail;
             $smtpServer = $configParam->smtpServer;
             $config = $configParam->config->toArray();
             // Mail phtml
             $view = new Zend_View();
             $view->setScriptPath(APPLICATION_PATH . '/views/mails/');
             $view->assign('password', $password);
             $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
             $mail = new Zend_Mail('UTF-8');
             $mail->setFrom($configParam->from, 'Kebab Project');
             $mail->addTo($user->email, $user->fullName);
             $mail->setSubject('Reset Password');
             $mail->setBodyHtml($view->render('forgot-password.phtml'));
             $mail->send($transport);
             $response->setSuccess(true)->getResponse();
         } else {
             $response->addNotification(Kebab_Notification::ERR, 'There isn\'t user with this email')->getResponse();
         }
     } else {
         $response->addError('email', 'Invalid email format')->getResponse();
     }
 }
示例#8
0
 public function render($datas)
 {
     $this->_scriptName = $datas->scriptName;
     # html mail
     // needed: email, passwd, scriptname
     $file = APPLICATION_PATH . '/configs/langs/' . $datas->lang . '/emails.ini';
     $texts = new Zend_Config_Ini($file, $this->_scriptName);
     $view = new Zend_View();
     $view->setScriptPath($this->_config->mail->scriptsPath);
     $view->setHelperPath($this->_config->mail->helpersPath);
     //    switch sur la lang pour header
     switch ($datas->lang) {
         case 'befl':
         case 'befr':
         case 'nl':
             $view->top = 'top_challenge.jpg';
             break;
         default:
             $view->top = 'top.jpg';
             break;
     }
     $view->texts = $texts;
     $view->assign((array) $datas->view);
     $view->webhost = $this->_config->site->webhost;
     $view->tplname = $this->_scriptName;
     //    on gere le setFrom ici car localisé
     $this->setFrom($this->_config->mail->addressFrom, $texts->labelFrom);
     $this->_document = $view->render($this->_scriptName . '.phtml');
     $this->setSubject(utf8_decode($texts->subject));
     $this->setBodyHtml($this->_document, 'utf-8');
     $this->addTo($datas->view->email);
     $this->send();
 }
示例#9
0
 public function newUserCeated($data)
 {
     $config = array('auth' => 'login', 'username' => 'USERNAME', 'password' => 'SENHAGMAIL', 'ssl' => 'ssl', 'port' => 465);
     // Optional port number supplied
     $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
     $html = new Zend_View();
     $html->setScriptPath(APPLICATION_PATH . '/modules/home/views/helpers/emails');
     $html->assign('name', $data['name']);
     $html->assign('login', $data['login']);
     $html->assign('date', date('d/m/Y H:i:s', $data['timestamp']));
     $mail = new Zend_Mail("UTF-8");
     $bodyText = $html->render('newUser.phtml');
     $mail->setFrom(self::$fromEmail, self::$fromName);
     $mail->addTo('*****@*****.**');
     $mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
     $mail->setSubject('Novo usuário cadastrado!');
     $mail->setBodyHtml($bodyText);
     $mail->send($transport);
 }
 protected function render($mailName)
 {
     $view = new Zend_View();
     if (!$this->scriptPath) {
         $this->scriptPath = ROOT_PATH . "/templates/mail";
     }
     $view->setBasePath($this->scriptPath);
     $view->assign($this->assigns);
     return $view->render($mailName . ".phtml");
 }
示例#11
0
 public static function getTemplate($name, $vars = array())
 {
     $html = new Zend_View();
     $html->setScriptPath(APPLICATION_PATH . '/views/emaillayouts/');
     if (!empty($vars)) {
         foreach ($vars as $key => $value) {
             $html->assign($key, $value);
         }
     }
     return $html->render($name);
 }
 private function sendSignUpMail($user)
 {
     $configParam = Zend_Registry::get('config')->kebab->mail;
     $smtpServer = $configParam->smtpServer;
     $config = $configParam->config->toArray();
     // Mail phtml
     $view = new Zend_View();
     $view->setScriptPath(APPLICATION_PATH . '/views/mails/');
     //KBBTODO use language file
     $view->assign('id', $user->id);
     $view->assign('fullName', $user->fullName);
     $view->assign('activationKey', $user->activationKey);
     $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
     Zend_Mail::setDefaultTransport($transport);
     $mail = new Zend_Mail('UTF-8');
     $mail->setFrom($configParam->from, 'Kebab Project');
     $mail->addTo($user->email, $user->fullName);
     $mail->setSubject('Welcome to Kebab Project');
     $mail->setBodyHtml($view->render('sign-up.phtml'));
     $mail->send($transport);
 }
 /**
  * 
  */
 public function Topbox($bezeichner)
 {
     $_Model = new Application_Model_Empfehlungen();
     $box = $_Model->getByBezeichner($bezeichner);
     if ($box) {
         $view = new Zend_View();
         $view->setBasePath(APPLICATION_PATH . '/views/');
         $view->assign('box', $box);
         $output = $view->render('_partials/topbox.phtml');
         return $output;
     } else {
         return '';
     }
 }
示例#14
0
文件: Model.php 项目: hYOUstone/tsg
 public function setViewBody($script, $params = array())
 {
     $layout = new Zend_Layout(array('layoutPath' => $this->_getLayoutPath()));
     $layout->setLayout('email');
     $view = new Zend_View();
     $view->setScriptPath($this->_getViewPath() . '/email');
     foreach ($params as $k => $param) {
         $view->assign($k, $param);
     }
     $layout->content = $view->render($script . '.phtml');
     //$layout->content = $msg;
     $html = $layout->render();
     $this->setBodyHtml($html);
 }
示例#15
0
文件: Mail.php 项目: Remchi/ZF-Quani
 public function setBodyView($script, $params = array())
 {
     $layout = new Zend_Layout(array('layoutPath' => APPLICATION_PATH . '/views/layouts'));
     $layout->setLayout('email');
     $view = new Zend_View();
     $view->setScriptPath(APPLICATION_PATH . '/views/email');
     foreach ($params as $key => $value) {
         $view->assign($key, $value);
     }
     $layout->content = $view->render($script . '.phtml');
     $html = $layout->render();
     $this->setBodyHtml($html);
     return $this;
 }
示例#16
0
文件: Mail.php 项目: besters/My-Base
 /**
  * Generuje uvitaci email
  *
  * @return Model_Mail
  *
  * @todo neni kompletni
  */
 private function _invite()
 {
     $salt = 'ofsdmší&;516#@ešěýp-§)údjs861fds';
     $session = new Zend_Session_Namespace('Zend_Auth');
     $this->_view->assign('company', '***COMPANY***');
     $this->_view->assign('name', $this->_data['name']);
     $this->_view->assign('sender', $session->storage->name . ' ' . $session->storage->surname);
     $this->_view->assign('hash', md5($this->_data['idcompany'] . $this->_data['name'] . $this->_data['surname'] . $this->_data['email'] . $salt));
     $this->_view->assign('note', nl2br($this->_data['note']), true);
     $this->_view->assign('mail', $session->storage->email);
     $this->_mail->setSubject('[MyBase.cz] Your account has been created **ALPHA**');
     $this->from('*****@*****.**');
     $this->_bodyText = $this->_view->render('invite.phtml');
     return $this;
 }
示例#17
0
文件: Mail.php 项目: shevron/stoa
 /**
  * Set the e-mail's body from a template
  * 
  * @param  string $tempalte
  * @param  array  $params
  * @return Geves_Mail
  */
 public function fromTemplate($template, array $params)
 {
     $view = new Zend_View();
     $view->setScriptPath($this->_templateDir);
     $view->assign($params);
     if ($this->_layout) {
         $this->_layout->content = $view->render($template . '.phtml');
         $html = $this->_layout->render();
     } else {
         $html = $view->render($template . '.phtml');
     }
     $this->setBodyHtml($html);
     $this->setBodyText(strip_tags($html));
     return $this;
 }
示例#18
0
 public function getFormAction()
 {
     $elementClass = $this->_getParam('classname');
     $refItem = $this->_getParam('refele');
     $elementName = "Iati_Aidstream_Element_" . $elementClass;
     $element = new $elementName();
     preg_match("/{$element->getClassName()}-\\d+/", $refItem, $matches);
     $ele = $matches[0];
     $count = substr($ele, -1);
     $element->setCount($count);
     $form = $element->getForm(true);
     /**
      * If the element is a child form, we have to add the parent's name and
      * count to the form elements.
      * @todo refractor the baseElement's code so that we dont need to do this here.
      */
     $parents = preg_replace("/(-)?{$ele}.*\$/", '', $refItem);
     if ($parents) {
         $belongsTo = "";
         if (preg_match("/^\\w+-\\d+/", $parents, $matches)) {
             $parentCount = explode('-', $matches[0]);
             $belongsTo = $belongsTo . "{$parentCount[0]}[{$parentCount[1]}]";
             $parents = preg_replace("/^\\w+-\\d+/", '', $parents);
         } else {
             if (preg_match("/^\\w+/", $parents, $matches)) {
                 $belongsTo = $belongsTo . $matches[0];
                 $parents = preg_replace("/^\\w+/", '', $parents);
             }
         }
         if (preg_match_all("/\\w+-\\d+/", $parents, $matches)) {
             foreach ($matches[0] as $parent) {
                 $parentCount = explode('-', $parent);
                 $belongsTo = $belongsTo . "[{$parentCount[0]}][{$parentCount[1]}]";
             }
         }
         $formBelongsTo = $form->getElementsBelongTo();
         $formBelongsTo = preg_replace('/(^\\w+)/', '[$1]', $formBelongsTo);
         $belongsTo = $belongsTo . $formBelongsTo;
         $form->setElementsBelongTo($belongsTo);
     }
     $partialPath = Zend_Registry::get('config')->resources->layout->layoutpath;
     $myView = new Zend_View();
     $myView->setScriptPath($partialPath . '/partial');
     $myView->assign('form', $form);
     $form = $myView->render('form.phtml');
     print $form;
     exit;
 }
示例#19
0
 /**
  *
  * @param int|array $id
  * @param string $type
  * @return array Rendered content items
  */
 function getRenderedContent($ids, $type = 'List')
 {
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     foreach ($ids as $id) {
         if (!is_object($id)) {
             $item = $this->load($id, $type);
         } else {
             $item = $id;
         }
         $can_edit = Zoo::getService('acl')->checkItemAccess($item, 'edit');
         $cacheid = "Content_node" . $type . "_" . $item->id . ($can_edit ? "_edit" : "");
         try {
             $cached = Zoo::getService("cache")->load($cacheid);
             if ($cached) {
                 $content[] = $cached;
             }
         } catch (Zoo_Exception_Service $e) {
             // Cache service unavailable, set content to empty string
             $cached = false;
         }
         if (!$cached) {
             // Render content item
             if (!$this->view) {
                 $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
                 /* @var $view Zend_View_Abstract */
                 // Don't clone the view until it is needed
                 $this->view = clone $view;
                 $this->view->clearVars();
             }
             list($module, $nodetype) = explode('_', $item->type);
             $this->resetView($module, $nodetype);
             $this->addLanguage($module);
             $this->view->assign('item', $item);
             $this->view->assign('can_edit', $can_edit);
             $rendered = $this->view->render($type == "Display" ? "index" : $type);
             $content[] = $rendered;
             try {
                 Zoo::getService('cache')->save($rendered, $cacheid, array('node' . $type, 'node_' . $item->id), null);
             } catch (Zoo_Exception_Service $e) {
                 // Cache service not available, do nothing
             }
         }
     }
     return $content;
 }
示例#20
0
 public function setBodyView($script, $params = array())
 {
     $layout = new Zend_Layout(array('layoutPath' => APPLICATION_PATH . '/layouts'));
     //вибрати шаблон email.phtml
     $layout->setLayout('email');
     $view = new Zend_View();
     $view->setScriptPath(APPLICATION_PATH . '/views/email');
     foreach ($params as $key => $value) {
         //Метод assign() дает возможность устанавливать значения
         //из массива или объекта "партиями".
         $view->assign($key, $value);
     }
     $layout->content = $view->render($script . '.phtml');
     $html = $layout->render();
     $this->setBodyHtml($html);
     return $this;
 }
示例#21
0
文件: Imple.php 项目: rocknoon/TCVM
 public function email($orderId)
 {
     $orderInfo = TCVM_Order_Factory::Factory()->getOrder($orderId);
     $zendView = new Zend_View();
     $zendView->assign("orderInfo", $orderInfo);
     $zendView->setEncoding('UTF-8');
     $path = realpath(dirname(__FILE__));
     $zendView->setScriptPath($path);
     $html = $zendView->render("success.phtml");
     $headers = "MIME-Version: 1.0" . "\r\n";
     $headers .= "Content-type:text/html;charset=utf-8" . "\r\n";
     $headers .= 'From: admin@tcvm.com.au' . "\r\n" . 'Reply-To: admin@tcvm.com.au' . "\r\n";
     $to = array($orderInfo["email"], "*****@*****.**", "*****@*****.**", "*****@*****.**");
     foreach ($to as $emailA) {
         @mail($emailA, "TCVM Course Booking", $html, $headers);
     }
 }
示例#22
0
文件: Mail.php 项目: josmel/adminwap
 public function __call($name, $arguments)
 {
     $this->_mail = new Zend_Mail('utf-8');
     $options = $arguments[0];
     $f = new Zend_Filter_Word_CamelCaseToDash();
     $tplDir = APPLICATION_PATH . '/../emailing/';
     $mailView = new Zend_View();
     $layoutView = new Zend_View();
     $mailView->setScriptPath($tplDir);
     $layoutView->setScriptPath($tplDir);
     $template = strtolower($f->filter($name)) . '.phtml';
     $subjects = new Zend_Config_Ini(APPLICATION_PATH . '/configs/mailing.ini', 'subjects');
     $subjects = $subjects->toArray();
     if (!is_readable(realpath($tplDir . $template))) {
         throw new Zend_Mail_Exception('No existe template para este email');
     }
     if (!array_key_exists($name, $subjects) || trim($subjects[$name]) == "") {
         throw new Zend_Mail_Exception('Subject no puede ser vacío, verificar mailing.ini');
     } else {
         $options['subject'] = $subjects[$name];
     }
     if (!array_key_exists('to', $options)) {
         throw new Zend_Mail_Exception('Falta indicar destinatario en $options["to"]');
     } else {
         $v = new Zend_Validate_EmailAddress();
         if (!$v->isValid($options['to'])) {
             //throw new Zend_Mail_Exception('Email inválido');
             // En lugar de lanzar un error, mejor lo logeo.
             $log = Zend_Registry::get('log');
             $log->warn('Email inválido: ' . $options['to']);
         }
     }
     foreach ($options as $key => $value) {
         $mailView->assign($key, $value);
         $options['subject'] = str_replace('{%' . $key . '%}', $value, $options['subject']);
     }
     $mailView->addHelperPath('Core/View/Helper', 'Core_View_Helper');
     $layoutView->addHelperPath('Core/View/Helper', 'Core_View_Helper');
     $mailViewHtml = $mailView->render($template);
     $layoutView->assign('emailTemplate', $mailViewHtml);
     $mailHtml = $layoutView->render('_layout.phtml');
     $this->_mail->setBodyHtml($mailHtml);
     $this->_mail->addTo($options['to']);
     $this->_mail->setSubject($options['subject']);
     $this->_mail->send();
 }
示例#23
0
 public function resetPassword(Admin_Model_User $user)
 {
     $login = Zend_Json::decode($this->getApiHelper()->direct(array('app' => $this->getApiHelper()->name('login'), 'key' => $this->getApiHelper()->key('login'), 'user_id' => $user->getId(), 'admin_id' => $this->getSession()->userid, 'token' => uniqid()), $this->getApiHelper()->endpoint('login') . 'adminresettoken'));
     if ($login['error'] == 0) {
         // get email templates
         $vars = array('url' => 'https://' . $_SERVER['HTTP_HOST'] . '/love/resetpass.php?un=' . base64_encode($login['username']) . '&token=' . $login['confirm_string']);
         $view = new Zend_View();
         $view->setScriptPath(APPLICATION_PATH . '/views/scripts/emails');
         $view->assign($vars);
         // send email
         $mail = new Sendlove_Mail();
         $mail->setBodyHtml($view->render('html_recovery.phtml'));
         $mail->setBodyText($view->render('text_recovery.phtml'));
         $mail->setFrom('*****@*****.**', 'SendLove');
         $mail->addTo($login['username']);
         $mail->setSubject('SendLove Password Recovery');
         $mail->send();
         return true;
     }
     return false;
 }
示例#24
0
/**
 *
 * Load & submit invitation form
 *
*/
function getBetterInvitaionForm()
{
    require_once 'InviteForm.php';
    $form = new Addon_Form_BetterInvite();
    $translator = Zend_Registry::get('Zend_Translate');
    // form is submitted and valid?
    if (isset($_POST['identifier']) && $_POST['identifier'] == 'Invite') {
        if ($form->isValid($_POST)) {
            $to = $form->getValue('email');
            $subject = $translator->translate('Invitation');
            $base_url = Application_Plugin_Common::getFullBaseUrl();
            $user_id = Zend_Auth::getInstance()->getIdentity()->id;
            $user_name = Zend_Auth::getInstance()->getIdentity()->name;
            $user_screenname = Zend_Auth::getInstance()->getIdentity()->screen_name;
            $invitation_link = $base_url . '/?ref=' . $user_id;
            $profile_link = $base_url . '/' . $user_name . '/?ref=' . $user_id;
            // prepare phtml email template
            $view = new Zend_View();
            $view->setScriptPath(realpath(dirname(__FILE__)));
            $view->assign('invitation_link', $invitation_link);
            $body = $view->render('email.phtml');
            $body = str_replace("NETWORK_NAME", Zend_Registry::get('config')->get('network_name'), $body);
            $body = str_replace("INVITATION_LINK", $invitation_link, $body);
            $body = str_replace("INVITED_BY_SCREENNAME", $user_screenname, $body);
            $body = str_replace("INVITED_BY_PROFILE_LINK", $profile_link, $body);
            // send email
            $ret = Application_Plugin_Common::sendEmail($to, $subject, $body, true);
            // show info message
            if ($ret) {
                Application_Plugin_Alerts::success(Zend_Registry::get('Zend_Translate')->translate('Invitation has been sent'), 'on');
            }
        }
        // flush field
        $form->getElement('email')->setValue('');
    }
    return $form;
}
示例#25
0
 public function retornoPagamentoAction()
 {
     if (isset($_POST['notificationType']) && $_POST['notificationType'] == 'transaction') {
         //Todo resto do código iremos inserir aqui.
         $email = '*****@*****.**';
         //$token = '256E9F0B507E4F328AF0BDD12883B054';
         $token = '3118ED043B2C40C584F52B2733CBBCB3';
         //$url = 'https://ws.pagseguro.uol.com.br/v2/transactions/notifications/' . $_POST['notificationCode'] . '?email=' . $email . '&token=' . $token;
         $url = 'https://ws.sandbox.pagseguro.uol.com.br/v2/transactions/notifications/' . $_POST['notificationCode'] . '?email=' . $email . '&token=' . $token;
         $curl = curl_init($url);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         $transaction = curl_exec($curl);
         curl_close($curl);
         if ($transaction == 'Unauthorized') {
             $html = new Zend_View();
             $html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
             $title = 'erro | Instag';
             $to = '*****@*****.**';
             //$cc = '*****@*****.**';
             $html->assign('title', $title);
             $html->assign('nome', 'erro transacao');
             $html->assign('assunto', $_POST['notificationCode']);
             $mail = new Zend_Mail('utf-8');
             $bodyText = $html->render('contato.phtml');
             $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => '*****@*****.**', 'password' => 'Inndeia123');
             $transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
             $mail->addTo($to);
             //$mail->addCc($cc);
             $mail->setSubject($title);
             $mail->setFrom($to, 'Paulo');
             $mail->setBodyHtml($bodyText);
             $send = $mail->send($transport);
             exit;
             //Mantenha essa linha
         }
         $transaction = simplexml_load_string($transaction);
         $dados = array();
         $dados['status'] = $transaction->status;
         if ($dados['status'] == 3) {
             $dados['data_validade'] = date('Y-m-d', strtotime("+30 days", strtotime(date('Y-m-d'))));
         }
         $modelItenracao = new InteracaoModel();
         $where = $modelItenracao->getAdapter()->quoteInto('referencia_pagamento = ?', $transaction->reference);
         $return = $modelItenracao->update($dados, $where);
     }
 }
示例#26
0
 protected function sendNotificationEmail($message, $emailParams, $language, $template = 'notification.phtml')
 {
     $emailParams = array_merge($this->_application->get_email_settings(), $emailParams);
     //print_r($emailParams); die();
     $transport = HCMS_Email_TransportFactory::createFactory($emailParams);
     //init view
     $emailView = new Zend_View();
     $emailView->setScriptPath($this->getFrontController()->getModuleDirectory('admin') . '/views/scripts/email_templates/');
     $mvcView = clone Zend_Layout::getMvcInstance()->getView();
     if (isset($mvcView->theme)) {
         $emailView->addScriptPath(APPLICATION_PATH . '/../themes/' . $mvcView->theme . '/views/admin/email_templates/');
     }
     $emailView->assign(array('application' => $this->_application, 'message' => $message, 'lang' => $language, 'serverUrl' => $this->view->serverUrl(), 'imagesUrl' => isset($mvcView->theme) ? $this->view->serverUrl() . '/themes/' . $mvcView->theme . '/images/email/' : $this->view->serverUrl() . '/images/email/'));
     $body = $this->getEmailBody($emailView, $emailParams, $template, $language);
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyHtml($body);
     $mail->setFrom($emailParams['from_email'], $emailParams['from_name']);
     foreach ($emailParams['to_emails'] as $toEmail) {
         if (is_array($toEmail)) {
             $mail->addTo($toEmail['email'], $toEmail['name']);
         } else {
             $mail->addTo($toEmail);
         }
     }
     $mail->setSubject($this->translate($emailParams['subject']));
     $mail->send($transport);
 }
示例#27
0
 /**
  * @return string
  */
 public function prepareBodyHtml($template, $arguments)
 {
     $config = $this->getConfig();
     $view = new \Zend_View();
     $view->addScriptPath($config['layoutPath']);
     foreach ($arguments as $alias => $argument) {
         $view->assign($alias, $argument);
     }
     $this->setBodyHtml(utf8_decode($view->render($template)))->_buildHtml();
     return $this;
 }
 public function applyAction()
 {
     if (null == ($id = $this->_request->getParam('id', null))) {
         $this->_helper->flashMessenger->addMessage('%%ERROR_URL%%');
         $this->_helper->redirector('show-classes');
     }
     $form = new Application_Form_Classes();
     $this->view->form = $form;
     /* Proccess data post*/
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $tutorModel = new Application_Model_Tutors();
             $data = $_POST;
             /* check tutor is exist */
             if ($tutorModel->checkTutorIsExist($data['TutorId'])) {
                 $tutors = $this->_model->getTutorsOfClass($data['ClassId']);
                 /* check tutor id exist in class */
                 if (!in_array($data['TutorId'], explode(',', $tutors['ClassTutors']))) {
                     if (!empty($tutors['ClassTutors'])) {
                         $data['ClassTutors'] = $tutors['ClassTutors'] . ',' . $data['TutorId'];
                     } else {
                         $data['ClassTutors'] = $data['TutorId'];
                     }
                     if ($this->_model->edit($data)) {
                         $tutor = $tutorModel->getTutorInfo($data['TutorId']);
                         $email = $tutor["Email"];
                         $mailUserName = null;
                         $mailFrom = null;
                         $configMails = null;
                         try {
                             $modelConfig = new Application_Model_Configs();
                             $configMails = $modelConfig->getConfigValueByCategoryCode("GROUP_CONFIG_MAIL");
                             foreach ($configMails as $key => $configMail) {
                                 switch ($configMail["ConfigCode"]) {
                                     case "mail-user-name":
                                         $mailUserName = $configMail["ConfigValue"];
                                         break;
                                     case "mail-user-name-from":
                                         $mailFrom = $configMail["ConfigValue"];
                                         break;
                                 }
                             }
                             $tutorConfig = $modelConfig->getConfigDetail("ung-tuyen-gia-su");
                         } catch (Zend_Exception $e) {
                         }
                         $rsInitMail = $this->_initMail($configMails);
                         if ($rsInitMail[0]) {
                             $subject = $tutorConfig['ConfigName'];
                             // initialize template
                             $html = new Zend_View();
                             $html->setScriptPath(APPLICATION_PATH . '/views/scripts/email_templates/');
                             $html->assign('name', $tutor["UserName"]);
                             $html->assign('tutorId', $data['TutorId']);
                             $html->assign('classId', $data['ClassId']);
                             $message = $html->render('apply-class.phtml');
                             $sendResult = $this->sendMail($email, $subject, $message, $mailUserName, $mailFrom);
                             if ($sendResult[0]) {
                                 $this->_redirect('/news/detail/id/' . $tutorConfig['ConfigValue']);
                             } else {
                                 $this->view->messageStatus = 'danger/Bạn đã ứng tuyển nhưng gửi email cho bạn thất bại.';
                             }
                         } else {
                             $this->view->messageStatus = 'danger/Hiện tại hệ thống không đáp ứng kịp.';
                         }
                     } else {
                         $messageStatus = 'danger/Hiện tại hệ thống không đáp ứng chức năng này. Mong bạn thông cảm và thử lại.';
                         $this->view->messageStatus = $messageStatus;
                     }
                 } else {
                     $messageStatus = 'danger/Mã số của bạn đã được úng tuyển lớp học này';
                     $this->view->messageStatus = $messageStatus;
                 }
             } else {
                 $messageStatus = 'danger/Mã số của bạn không tồn tại';
                 $this->view->messageStatus = $messageStatus;
             }
         } else {
             $msgVN = array("is required and can't be empty" => 'Không được để trống', "does not appear to be an integer" => 'Phải là chữ số');
             $messageStatus = 'danger/Có lỗi xảy ra. Chú ý thông tin những ô sau đây:';
             $messages = array();
             foreach ($form->getMessages() as $fieldName => $message) {
                 $message = end($message);
                 $key = substr(strstr($message, " "), 1);
                 if (in_array($key, array_keys($msgVN))) {
                     $message = $msgVN[$key];
                 }
                 $messages[$fieldName] = $message;
             }
             $this->view->messages = $messages;
             $this->view->messageStatus = $messageStatus;
         }
     }
     $class = $this->_model->getClassDetail($id);
     $form->populate($class->toArray());
     $this->view->class = $class;
     $this->view->id = $id;
 }
示例#29
0
 public function testAssignThrowsExceptionsOnBadValues()
 {
     $view = new Zend_View();
     try {
         $view->assign('_path', dirname(__FILE__) . '/View/_stubs/HelperDir2/');
         $this->fail('Protected/private properties cannot be assigned');
     } catch (Exception $e) {
         // success
         // @todo  assert something?
     }
     try {
         $view->assign(array('_path' => dirname(__FILE__) . '/View/_stubs/HelperDir2/'));
         $this->fail('Protected/private properties cannot be assigned');
     } catch (Exception $e) {
         // success
         // @todo  assert something?
     }
     try {
         $view->assign($this);
         $this->fail('Assign spec requires string or array');
     } catch (Exception $e) {
         // success
         // @todo  assert something?
     }
 }
示例#30
0
if (!isset($_REQUEST['name']) || is_array($_REQUEST['name'])) {
    $name = '';
} else {
    $name = $_REQUEST['name'];
}
if (!isset($_REQUEST['key']) || is_array($_REQUEST['key'])) {
    $key = 'nokey';
    // will never match since hash values are either NULL or 32 characters
} else {
    $key = $_REQUEST['key'];
}
require 'includes/basics.php';
$view = new Zend_View();
$view->setBasePath(WEBROOT . '/templates');
$authPlugin = Kimai_Registry::getAuthenticator();
$view->assign('kga', $kga);
// current database setup correct?
checkDBversion(".");
// processing login and displaying either login screen or errors
$name = htmlspecialchars(trim($name));
$is_customer = $database->is_customer_name($name);
if ($is_customer) {
    $id = $database->customer_nameToID($name);
    $customer = $database->customer_get_data($id);
    $keyCorrect = $key === $customer['passwordResetHash'];
} else {
    $id = $database->user_name2id($name);
    $user = $database->user_get_data($id);
    $keyCorrect = $key === $user['passwordResetHash'];
}
switch ($_REQUEST['a']) {