Beispiel #1
0
$objUrls = new FriendlyurlModel();
$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
Beispiel #2
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();
             }
         }
     }
 }