Ejemplo n.º 1
0
 public function forgetPassword($controller, $model, $module = "default")
 {
     $view = new Zend_View();
     $items = $model->getItemsByCriteria(array("email=?" => $model->email));
     //print_r($exhibitors);exit;
     if (count($items["rows"]) > 0) {
         list($item) = $items["rows"];
     }
     if (isset($item)) {
         //$mail_model=Default_Model_Mail();
         $timestamp = time();
         $security_code = md5($item->id . $timestamp . $item->created);
         $retrieve_pw_uri = $view->serverUrl() . $view->url(array("module" => $module, "controller" => $controller, "action" => "resetpw", "id" => $item->id, "t" => $timestamp, "c" => $security_code), null, true);
         return $retrieve_pw_uri;
     } else {
         return null;
     }
 }
Ejemplo n.º 2
0
 /**
  * Get config
  *
  * @throws Zend_Controller_Action_Exception
  * @return array
  */
 public function getConfig()
 {
     if (!Zend_Registry::isRegistered('googleConfig')) {
         throw new Zend_Controller_Action_Exception('Google oAuth: config not found');
     }
     $config = Zend_Registry::get('googleConfig');
     if (empty($config['consumerKey'])) {
         throw new Zend_Controller_Action_Exception('Google oAuth: consumer key is missed');
     }
     if (empty($config['consumerSecret'])) {
         throw new Zend_Controller_Action_Exception('Google oAuth: consumer secret is missed');
     }
     if (strpos($config['callbackUrl'], 'http') !== 0) {
         $view = new Zend_View();
         $config['callbackUrl'] = $view->serverUrl($config['callbackUrl']);
     }
     return $config;
 }
Ejemplo n.º 3
0
 /**
  * Get twitter client
  *
  * @throws Zend_Controller_Action_Exception
  * @return Zend_Oauth_Consumer
  */
 public function getClient()
 {
     if (!$this->_client) {
         if (!Zend_Registry::isRegistered('twitterConfig')) {
             throw new Zend_Controller_Action_Exception('Twitter oAuth: config not found');
         }
         $config = Zend_Registry::get('twitterConfig');
         if (empty($config['consumerKey'])) {
             throw new Zend_Controller_Action_Exception('Twitter oAuth: consumer key is missed');
         }
         if (empty($config['consumerSecret'])) {
             throw new Zend_Controller_Action_Exception('Twitter oAuth: consumer secret is missed');
         }
         if (strpos($config['callbackUrl'], 'http') !== 0) {
             $view = new Zend_View();
             $config['callbackUrl'] = $view->serverUrl($config['callbackUrl']);
         }
         $this->setClient(new Zend_Oauth_Consumer($config));
     }
     return $this->_client;
 }
Ejemplo n.º 4
0
 function afterSave()
 {
     $session = SessionWrapper::getInstance();
     # add log to audit trail
     $view = new Zend_View();
     $url = $view->serverUrl($view->baseUrl('role/view/id/' . encode($this->getID())));
     $usecase = '0.4';
     $module = '0';
     $type = SYSTEM_CREATEROLE;
     $details = "Role <a href='" . $url . "' class='blockanchor'>" . $this->getName() . "</a> created";
     $browser = new Browser();
     $audit_values = $session->getVar('browseraudit');
     $audit_values['module'] = $module;
     $audit_values['usecase'] = $usecase;
     $audit_values['transactiontype'] = $type;
     $audit_values['status'] = "Y";
     $audit_values['userid'] = $session->getVar('userid');
     $audit_values['transactiondetails'] = $details;
     $audit_values['url'] = $url;
     // debugMessage($audit_values);
     $this->notify(new sfEvent($this, $type, $audit_values));
 }
Ejemplo n.º 5
0
 function getProfilePath()
 {
     $path = "";
     $view = new Zend_View();
     // $path = '<a href="'.$view->serverUrl($view->baseUrl('user/'.strtolower($this->getUserName()))).'">'.$view->serverUrl($view->baseUrl('user/'.strtolower($this->getUserName()))).'</a>';
     $path = '<a href="javascript: void(0)">' . $view->serverUrl($view->baseUrl('user/' . strtolower($this->getUserName()))) . '</a>';
     return $path;
 }
Ejemplo n.º 6
0
 /**
  * Compile a less file
  *
  * @param \Zend_View $view
  * @param string $href The less file
  * @param boolean $always Always compile
  * @return boolean True when changed
  */
 public function compile(\Zend_View $view, $href, $always = false)
 {
     if (\MUtil_String::startsWith($href, 'http', true)) {
         // When a local url, strip the serverUrl and basepath
         $base = $view->serverUrl() . $view->baseUrl();
         if (\MUtil_String::startsWith($href, $base, true)) {
             // Only strip when urls match
             $href = substr($href, strlen($base));
         }
     }
     // Add full path to the webdir
     $inFile = $this->_webroot . '/' . $href;
     $outFile = substr($inFile, 0, -strlen(pathinfo($inFile, PATHINFO_EXTENSION))) . 'css';
     // Try compiling
     try {
         // \MUtil_Echo::track($inFile, $outFile);
         $lessc = new lessc();
         $lessc->registerFunction('base64encode', array($this, 'base64encode'));
         if ($always || array_key_exists('compilecss', \Zend_Controller_Front::getInstance()->getRequest()->getParams())) {
             $result = (bool) $lessc->compileFile($inFile, $outFile);
         } else {
             $result = $lessc->checkedCompile($inFile, $outFile);
         }
     } catch (\Exception $exc) {
         // If we have an error, present it if not in production
         if (APPLICATION_ENV !== 'production' || APPLICATION_ENV !== 'acceptance') {
             \MUtil_Echo::pre($exc->getMessage());
         }
         $result = null;
     }
     return $result;
 }
 /**
  * Envia um email com os dados para Recuperacao/alteração da senha do usuário
  * @param Administrativo_Model_Usuario $oUsuario instancia do usuario
  */
 public static function enviarEmailSenha(Administrativo_Model_Usuario $oUsuario)
 {
     $sHash = $oUsuario->criarHash();
     $oView = new Zend_View();
     $oView->setScriptPath(APPLICATION_PATH . '/modules/auth/views/scripts/login/');
     $oView->sUrlRecuperarSenha = $oView->serverUrl("/auth/login/recuperar-senha/hash/{$sHash}");
     $oView->nome = $oUsuario->getEntity()->getNome();
     $sTextoEmail = $oView->render('email-recuperacao-senha.phtml');
     $oTranslate = Zend_Registry::get('Zend_Translate');
     DBSeller_Helper_Mail_Mail::send($oUsuario->getEmail(), $oTranslate->_('ECidadeOnline2 - Recuperação de Senha'), $sTextoEmail);
 }