Ejemplo n.º 1
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.º 2
0
 $invoice['show_tax'] = $invoice['calc_tax'] > 0 ? true : false;
 $invoice['show_tax2'] = $invoice['calc_tax2'] > 0 ? true : false;
 $invoice['show_shipping'] = $invoice['shipping'] > 0 ? true : false;
 $invoice['terms'] = $invoice['terms'] ? $invoice['terms'] : ($client['def_terms'] ? $client['def_terms'] : ($admin['def_terms'] ? $admin['def_terms'] : $lang['terms']));
 $invoice['comments'] = $invoice['comments'] ? $invoice['comments'] : ($client['def_comments'] ? $client['def_comments'] : ($admin['def_comments'] ? $admin['def_comments'] : ''));
 $invoice['due_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['due_date']);
 $invoice['issue_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['issue_date']);
 $invoice['calc_tax'] = currency_format($invoice['calc_tax']);
 $invoice['calc_tax2'] = currency_format($invoice['calc_tax2']);
 $invoice['shipping'] = currency_format($invoice['shipping']);
 $invoice['cost'] = currency_format($invoice['cost']);
 $invoice['total'] = currency_format($invoice['total']);
 $emailSendID = $ISL->addEmailSend($invoice['clientid'], $invoiceID, $client['email'], 1);
 $e = new Emailer();
 $e->setMainFile('forms/email_invoice.tpl');
 $e->setFrom($SYSTEM['email']['from']);
 $e->setFromName($SYSTEM['email']['fromName']);
 $e->setSubject($lang['eml_subj_invoice']);
 $e->set('SYSTEM', $SYSTEM);
 $e->set('invoice', $invoice);
 $e->set('client', $client);
 $e->set('admin', $admin);
 $ispayed = strtolower($invoice['curr_status']) == 'fully paid' ? true : false;
 $e->set('ispayed', $ispayed);
 $e->fetchMessage();
 $e->appendMessage('<img src="' . HTTP_ROOT . 'isop.php?sid=' . $emailSendID . '" width="1" height="1">');
 $e->setRecipient($client['email']);
 $e->setPriority('High');
 $result = $e->send();
 unset($e);
 $result = $result ? 'Successful' : 'Failed';
Ejemplo n.º 3
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.º 4
0
            $mail->bodyAdd("");
            $mail->bodyAdd("Thank you for registering with Fast Food Jobs but as we take your privacy seriously, we just wanted to check you did register with our site.");
            $mail->bodyAdd("In order to gain access to all of the web site functionality please click on here: {$url}");
            $mail->bodyAdd("");
            $mail->bodyAdd("If you should not have received this e-mail, please click on the e-mail link below and just put \"remove\" in the heading and we will remove your details from our system.");
            $mail->bodyAdd("");
            $mail->bodyAdd("Regards");
            $mail->bodyAdd("");
            $mail->bodyAdd("The Fast Food Jobs Team");
            $mail->bodyAdd("");
            $mail->bodyAdd("Tel: 0845 644 8252");
            $mail->bodyAdd("*****@*****.**");
            $mail->send();
            $adminMail = new Emailer();
            $adminMail->setTo($configuration["adminEmail"]);
            $adminMail->setFrom($configuration["fromEmail"]);
            $adminMail->setSubject("New Sign up");
            $adminMail->bodyAdd("Dear admin,");
            $adminMail->bodyAdd("Just to let you know that new member");
            $adminMail->bodyAdd("Name: " . $first_name . " " . $last_name);
            $adminMail->bodyAdd("Emai: {$email}");
            $adminMail->bodyAdd("Role: {$role}");
            $adminMail->bodyAdd("has just joined Fast Foods.");
            $adminMail->send();
            header("Location: register_thankyou.php");
            exit;
        }
    }
    $errorText = "<ul>" . $errorText . "</ul>";
}
require "top.php";
Ejemplo n.º 5
0
    $heading = $_POST["heading"];
    $text = $_POST["text"];
    $link = $_POST["link"];
    if (($result = validate($heading, "", 20)) !== true) {
        $errorText .= "<li>The heading is {$result}";
    }
    if (($result = validate($text, "", 50)) !== true) {
        $errorText .= "<li>The main text is {$result}";
    }
    if (($result = validate($link, "", 255)) !== true) {
        $errorText .= "<li>The URL link is {$result}";
    }
    if ($errorText == "") {
        $mail = new Emailer();
        $mail->setTo($configuration["adminEmail"]);
        $mail->setFrom("*****@*****.**");
        $mail->setSubject("Classified Advert");
        $mail->bodyAdd("NEW CLASSIFIED ADVERT");
        $mail->bodyAdd("");
        $mail->bodyAdd("User: "******"Heading: {$heading}");
        $mail->bodyAdd("Text: {$text}");
        $mail->bodyAdd("URL: {$link}");
        $mail->bodyAdd("");
        $mail->bodyAdd("END");
        $mail->send();
        header("Location: classified_success.php");
    } else {
        $errorText = "<ul>" . $errorText . "</ul>";
    }
}
Ejemplo n.º 6
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.º 7
0
 public function send()
 {
     if (!$this->accessAdminPage(0)) {
         return new ActionResult($this, '/admin/email', 0, 'You are not allowed to send emails!', B_T_FAIL);
     }
     $check = $this->checknames();
     if ($check->status == 0) {
         return $check;
     } else {
         Session::del('status_msg', $check->id);
     }
     $to = WebApp::post('to');
     $subject = WebApp::post('subject');
     $message = WebApp::post('message');
     $mail = new Emailer();
     $mail->setFrom($this->parent->parent->user->getUsername() . '@biggleswadesc.org', $this->parent->parent->user->getFullName());
     $mail->Subject = $subject;
     $mail->msgHTML($message);
     $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
     $to = strgetcsv(WebApp::post('to'));
     // Fetches emails from usernames
     $user_query = $this->mySQL_r->prepare("SELECT CONCAT(`f_name`, ' ', `s_name`), `email` FROM `core_users` WHERE `username`=?");
     // Fetches names and emails from p_group names
     $p_group_query = $this->mySQL_r->prepare("SELECT CONCAT(`f_name`, ' ', `s_name`),`email` FROM `core_users`\nINNER JOIN `core_groups` ON `p_group`=`GID` AND `core_groups`.`name`=? AND `type`='p'");
     // Fetches names and emails from s_group names through link table (core_sgroup)
     $s_group_query = $this->mySQL_r->prepare("SELECT CONCAT(`f_name`, ' ', `s_name`),`email` FROM `core_users`\nINNER JOIN `core_groups` ON `core_groups`.`name`=? AND `type`='s'\nINNER JOIN `core_sgroup` ON `core_sgroup`.`user`=`core_users`.`id` AND `core_groups`.`GID`=`core_sgroup`.`group`");
     $email_addresses = array();
     foreach ($to as $name) {
         $name = trim($name);
         if (filter_var($name, FILTER_VALIDATE_EMAIL)) {
             $email_addresses[$name] = $name;
         } else {
             // Check if name is user
             $user_query->bind_param('s', $name);
             $user_query->bind_result($fullName, $email);
             $user_query->execute();
             $user_query->store_result();
             if ($user_query->num_rows == 1) {
                 $this->parent->parent->debug($this::name_space . ': Address is for user');
                 // deal with user
                 $user_query->fetch();
                 $email_addresses[$email] = $fullName;
                 $user_query->free_result();
                 $user_query->reset();
             } else {
                 // Check if name is pgroup
                 $user_query->free_result();
                 $p_group_query->bind_param('s', $name);
                 $p_group_query->bind_result($fullName, $email);
                 $p_group_query->execute();
                 $p_group_query->store_result();
                 if ($p_group_query->num_rows != 0) {
                     while ($p_group_query->fetch()) {
                         $email_addresses[$email] = $fullName;
                     }
                     $p_group_query->free_result();
                     $p_group_query->reset();
                 } else {
                     $p_group_query->free_result();
                     $p_group_query->reset();
                     // Check sgroup
                     $s_group_query->bind_param('s', $name);
                     $s_group_query->bind_result($fullName, $email);
                     $s_group_query->execute();
                     $s_group_query->store_result();
                     if ($s_group_query->num_rows != 0) {
                         // Deal with sgroup
                         while ($s_group_query->fetch()) {
                             $email_addresses[$email] = $fullName;
                         }
                     }
                     $s_group_query->free_result();
                     $s_group_query->reset();
                 }
             }
         }
     }
     $failed = array();
     foreach ($email_addresses as $email => $name) {
         $mail->addAddress($email, $name);
         if (!$mail->send()) {
             $failed[] = $email;
             $this->parent->parent->debug($this::name_space . ': Did not send mail to ' . $email);
             $this->parent->parent->debug('Reason: ' . $mail->ErrorInfo);
         } else {
             $this->parent->parent->debug($this::name_space . ': Sent mail to ' . $email);
         }
         $mail->clearAddresses();
     }
     if (count($failed) == 0) {
         return new ActionResult($this, '/admin/email', 1, 'Email was successfully sent!', B_T_SUCCESS);
     } else {
         return new ActionResult($this, '/admin/email', 0, 'Email was sent to except:<code>' . implode(', ', $failed) . '</code>', B_T_WARNING);
     }
 }