Ejemplo n.º 1
0
 /**
  * Generate a password reset token and email a link to the user.
  *
  * @return string Standard JSON envelope
  */
 public function passwordRequest()
 {
     if (!isset($_POST['email'])) {
         return $this->error('No email address provided.', false);
     }
     $email = $_POST['email'];
     if ($email == $this->config->user->email) {
         $token = md5(rand(10000, 100000));
         $tokenUrl = sprintf('%s://%s/manage/password/reset/%s', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], $token);
         $this->user->setAttribute('passwordToken', $token);
         $templateObj = getTemplate();
         $template = sprintf('%s/email/password-reset.php', $this->config->paths->templates);
         $body = $this->template->get($template, array('tokenUrl' => $tokenUrl));
         $emailer = new Emailer();
         $emailer->setRecipients(array($this->config->user->email));
         $emailer->setSubject('Trovebox password reset request');
         $emailer->setBody($body);
         $result = $emailer->send();
         if ($result > 0) {
             return $this->success('An email was sent to reset the password.', true);
         } else {
             $this->logger->info('Unable to send email. Confirm that your email settings are correct and the email addresses are valid.');
             return $this->error('We were unable to send a password reset email.', false);
         }
     }
     return $this->error('The email address provided does not match the registered email for this site.', false);
 }
Ejemplo n.º 2
0
$objUrls->parseRequest($params['_urlrequest']);
if (!empty($objUrls->requestParams)) {
    $params = array_merge($params, $objUrls->requestParams);
}
// start up
try {
    $objSettings->loadSettings();
    $objDispatcher->setDirectory('frontend');
    $objDispatcher->setController($objUrls->requestController);
    $objDispatcher->setAction($objUrls->requestAction);
    $objDispatcher->setParams($params);
    $objDispatcher->dispatch();
} catch (Exception $e) {
    $objEmail = new Emailer();
    $objEmail->addTO(ERROR_EMAIL);
    $objEmail->setFrom(ERROR_EMAIL);
    $objEmail->setSubject('FATAL ERROR | Exception thrown on ' . URL);
    $objEmail->setBody('Fatal Exception! ' . $e->getMessage() . print_r($params, true));
    //$objEmail->sendMail();
    die('Error<br/>' . $e->getMessage() . '<br/><a href="http://' . URL . '">' . PRODUCT_NAME . '</a>');
}
// time to clean up
$dbQueries = $objDatabase->getNumbQueries();
$objDatabase->disconnect();
//end timer
$endTime = microtime(true);
// calc render details
$totalSeconds = number_format($endTime - $startTime, 3);
$totalMemory = number_format(memory_get_peak_usage() / 1024, 2);
// speed / queries / memory report
//echo "\r\n".'<!--'."\r\n".'Took '.$totalSeconds.' seconds, '.$dbQueries.' database queries, and '.$totalMemory.'KB of memory'."\r\n".'-->';
Ejemplo n.º 3
0
 public function uploadNotify($token)
 {
     $shareTokenObj = new ShareToken();
     $tokenArr = $shareTokenObj->get($token);
     if (empty($tokenArr) || $tokenArr['type'] != 'upload') {
         return $this->forbidden('No permissions with the passed in token', false);
     }
     $albumId = $tokenArr['data'];
     $albumResp = $this->api->invoke(sprintf('/album/%s/view.json', $albumId), EpiRoute::httpGet, array('_GET' => array('token' => $token)));
     if ($albumResp['code'] !== 200) {
         return $this->error('Could not get album details', false);
     }
     $uploader = $count = null;
     if (isset($_POST['uploader'])) {
         $uploader = $_POST['uploader'];
     }
     if (isset($_POST['count'])) {
         $count = $_POST['count'];
     }
     $utilityObj = new Utility();
     $albumName = $albumResp['result']['name'];
     $albumUrl = sprintf('%s://%s/photos/album-%s/token-%s/list??sortBy=dateUploaded,desc', $utilityObj->getProtocol(false), $utilityObj->getHost(false), $albumId, $token);
     $tokenOwner = $tokenArr['actor'];
     $emailer = new Emailer();
     $emailer->setRecipients(array($tokenOwner));
     if (!empty($albumName)) {
         $emailer->setSubject(sprintf('Photos uploaded to %s', $albumName));
     } else {
         $emailer->setSubject('New photos were uploaded for you');
     }
     $markup = $this->theme->get('partials/upload-notify.php', array('albumId' => $albumId, 'albumName' => $albumName, 'albumUrl' => $albumUrl, 'uploader' => $uploader, 'count' => $count));
     $emailer->setBody($markup);
     $res = $emailer->send($markup);
     return $this->success('Email probably sent', true);
 }
Ejemplo n.º 4
0
 function actionLogin($params = '')
 {
     if (!empty($params['email']) && !empty($params['password'])) {
         if ($this->objAuthentication->login($params['email'], $params['password'])) {
             //no errors, continue to home
             /*$objDispatcher = new Dispatcher;
             		$objDispatcher->setController('Forum');
             		$objDispatcher->setAction('Index');
             		$objDispatcher->setParams($params);
             		$objDispatcher->dispatch();*/
             $this->actionIndex($params);
         } else {
             $this->view->assign('errorMsg', 'Unable to login, try again.');
             $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl'));
             $this->finish();
         }
     } else {
         if (!empty($params['createAccount']) && $params['createAccount'] == 1) {
             $errorMessages = array();
             $objValidator = new Validator();
             $objValidator->reset();
             $objValidator->validateEmail($params['create_email']);
             $objValidator->validatePassword($params['create_password']);
             $objValidator->passwordsMatch($params['create_password'], $params['create_password2']);
             $objValidator->validateName($params['create_displayName']);
             if ($objValidator->hasError || empty($params['create_terms'])) {
                 $error = $objValidator->getError();
                 if (empty($params['create_terms'])) {
                     $error[] = 'You must agree to the Terms of Use to make an account';
                 }
                 $this->view->assign('errorMessages', $error);
                 $this->view->assign('created', false);
             } else {
                 $userData = array();
                 $userData['email'] = $params['create_email'];
                 $userData['password'] = $params['create_password'];
                 $userData['displayName'] = $params['create_displayName'];
                 $userModel = new UserModel();
                 $created = $userModel->createUser($userData);
                 if (!empty($created)) {
                     $this->view->assign('created', true);
                     $objEmail = new Emailer();
                     $objEmail->setFrom(CONTACT_EMAIL);
                     $objEmail->setSubject('Retail Roar Community account created');
                     $objEmail->addTO($userData['email']);
                     $objEmail->setBody($this->view->fetch('emails/communitysignup.tpl'), true);
                     $sent = $objEmail->sendMail();
                 } else {
                     $this->view->assign('created', false);
                     $this->view->assign('errorMessages', $userModel->errorMsg);
                 }
                 $this->view->assign('submitted', true);
             }
             $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl'));
             $this->finish();
         } else {
             if ($this->objAuthentication->loggedIn()) {
                 $this->view->assign('content', 'Already logged in.');
                 $this->finish();
             } else {
                 $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl'));
                 $this->finish();
             }
         }
     }
 }
Ejemplo n.º 5
0
 function sendWebcastRegistrationAdmin($orderInfo)
 {
     $objEmailer = new Emailer();
     $objLayout = new LayoutModel();
     $objTemplate = new TemplatesModel();
     $objSettings = Settings::getInstance();
     $adminEmail = $objSettings->getEntry('admin', 'admin-email');
     $layoutInfo = $objLayout->loadLayout(28);
     $template = $objTemplate->loadTemplateFromKeyname('email-webcastregistration-admin');
     $this->view->assign('orderInfo', $orderInfo);
     $objEmailer->setFrom('*****@*****.**');
     $objEmailer->addTo($adminEmail);
     $objEmailer->setSubject('WEBCAST PURCHASE');
     // render template
     $this->view->assign('content', $this->view->fetch('fromstring:' . $template['content']));
     $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $template['left_sidebar']));
     $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $template['right_sidebar']));
     $objEmailer->setBody($this->view->fetch('fromstring:' . $layoutInfo['code']), true);
     $objEmailer->sendMail();
     return true;
 }
Ejemplo n.º 6
0
    $controller = 'Error';
    $action = 'Permission';
}
// start up
try {
    $objSettings->loadSettings();
    $objDispatcher->setDirectory('backend');
    $objDispatcher->setController($controller);
    $objDispatcher->setAction($action);
    $objDispatcher->setParams($params);
    $objDispatcher->dispatch();
} catch (Exception $e) {
    $objEmail = new Emailer();
    $objEmail->addTO(ERROR_EMAIL);
    $objEmail->setFrom(ERROR_EMAIL);
    $objEmail->setSubject('FATAL ERROR | Exception thrown on ' . URL);
    $objEmail->setBody('Fatal Exception! ' . $e->getMessage());
    $objEmail->sendMail();
    die('Error<br/>' . $e->getMessage() . '<br/><a href="http://' . URL . '">' . PRODUCT_NAME . '</a>');
}
// time to clean up
$dbQueries = $objDatabase->getNumbQueries();
$objDatabase->disconnect();
//end timer
$endTime = microtime(true);
// calc render details
$totalSeconds = number_format($endTime - $startTime, 3);
$totalMemory = number_format(memory_get_peak_usage() / 1024, 2);
// speed / queries / memory report
// if you uncomment this ajax requests / rss / xml responses will be corrupt
//echo "\r\n".'<!--'."\r\n".'Took '.$totalSeconds.' seconds, '.$dbQueries.' database queries, and '.$totalMemory.'KB of memory'."\r\n".'-->';