function exception_handler($e) { //echo $e; if (defined('DEBUG_MAIL') && DEBUG_MAIL or defined('DEBUG_IM') && DEBUG_IM && !DEBUG && !(!get_class($e) == "GruppException" && !get_class($e) == "MedlemException" && !get_class($e) == "SecurityException")) { $smarty = new MMSmarty(); $smarty->assign('error', $e); $mess_err = $smarty->fetch('errormsg.tpl'); // echo $mess_err; $host = $_SERVER['HTTP_HOST']; $browserPlain = Medlem::getCurrentBrowserVersion(); $ipNr = Medlem::getCurrentIpNr(); $mess = $host . " \n Browser used: " . $browserPlain; if (isset($USER)) { $mess .= "\n id: " . $USER->getId(); $mess .= "\n Username: "******"\n Email: " . $USER->getEpost(); } $mess .= "\n Referal page: " . $_SERVER['HTTP_REFERER']; $mess .= "\n Error page: " . $_SERVER['REQUEST_URI']; $mess .= "\n Get Aguments: " . print_r($_GET, true); $mess .= "\n Post Arguments: " . print_r($_POST, true); $mess .= "\n DateTime: " . date('Y-m-d H-i-s'); $mess .= " \n Ip: " . $ipNr . " \n\n " . $mess_err; unset($smarty); } if (defined('DEBUG_IM') && DEBUG_IM && !DEBUG && !(!get_class($e) == "GruppException" && !get_class($e) == "MedlemException" && !get_class($e) == "SecurityException")) { global $IM, $SETTINGS; $IM->login(DEBUG_IM_MAIL, DEBUG_IM_PASS); foreach ($SETTINGS['im_recip'] as $mail) { $IM->createSession($mail); $IM->sendMessage($mess); } } if (defined('DEBUG_MAIL') && DEBUG_MAIL && !DEBUG && !(!get_class($e) == "GruppException" && !get_class($e) == "MedlemException" && !get_class($e) == "SecurityException")) { foreach ($SETTINGS["debug_mail"] as $mail) { @Misc::sendEmail($mail, $SETTINGS["email"], "Debug meddelande från motiomera", $mess); } } if (get_class($e) == "UserException") { return false; } $smarty = new MMSmarty(); if (DEBUG) { $smarty->assign("error", $e); } $smarty->display('error.tpl'); exit; }
// print_r($medlemmar); foreach ($medlemmar as $medlem) { if (!empty($medlem)) { $id = $medlem->getId(); $s = $stegindex[$id] / Foretag::TAVLINGSPERIOD_DAGAR; $tm[] = array("stegindex" => $s, "namn" => $medlem->getANamn(), "id" => $id); } } if (count($tm) != 0) { array_multisort($tm, SORT_DESC); } $smarty->assign("topplista_foretag", $tf); $smarty->assign("topplista_lag", $tl); $smarty->assign("topplista_medlem", $tm); unset($tf); unset($tl); unset($tm); if (isset($USER)) { if ($TEAM) { $smarty->assign("TEAM", $TEAM); } if ($COMPANY) { $smarty->assign("COMPANY", $COMPANY); } } $smarty->assign("toplist_count", 101); $smarty->assign("hof", true); $output = $smarty->fetch('widget_deltagartoppen.tpl'); $output .= $smarty->fetch('widget_lagtoppen.tpl'); $output .= $smarty->fetch('widget_foretagstoppen.tpl'); echo $output;
public function sendActivationEmail() { global $SETTINGS; $email = new MMSmarty(); $email->assign("fnamn", $this->getFNamn()); $email->assign("enamn", $this->getENamn()); $email->assign("to", $this->getEpost()); $key = urlencode(base64_encode(trim($this->getId() . "|" . $this->getEpost()))); $email->assign("url", $SETTINGS["url"] . "actions/activate.php?q=" . $key); $email->assign("key", $key); if ($this->getEpostBekraftad() == 0) { // Ny användare $body = $email->fetch('activationemail.tpl'); } else { // TODO: ny template för gammal användare $body = $email->fetch('activationemail.tpl'); } $subject = "Välkommen till Motiomera.se"; Misc::sendEmail($this->getEpost(), $SETTINGS["email"], $subject, $body); }
/** * Sends the email receipt, depending on order type different mails are sent * Changed by krillo 090819 */ public function sendEmailReciept() { $email = new MMSmarty(); $email->assign("order", $this); $email->assign("medlem", Medlem::loadById($this->getMedlemId())); $subject = "Kvitto"; switch ($this->getTyp()) { case "medlem_extend": case "medlem": $body = $email->fetch('epostkvitto.tpl'); $epost = $this->getMedlem()->getEpost(); Misc::sendEmail($epost, null, $subject, $body); break; default: Misc::logEmailSend(false, $subject, 'Felaktigt ordertyp inget epostkvitto skickat: ' . $epost); throw new OrderException("Felaktigt ordertyp inget epostkvitto skickat: " . $order, -9); break; } }
/** * Sends the email receipt, depending on order type different mails are sent * Splitted and moved here by krillo 100119 */ public function sendEmailReciept($orderTyp, $refId) { $email = new MMSmarty(); $orderItemList = array(); $orderItemList = Order::listOrderDataByRefId($refId); //can be more than one order row $orderList = array(); $orderList["foretagLosen"] = $this->getTempLosenord(); $orderList["companyName"] = $this->getNamn(); $orderList["foretagANamn"] = $this->getANamn(); $orderList["startDatum"] = $this->getStartdatum(); $orderList["pro_order"] = false; $orderList["payerCompanyName"] = $this->getPayerCompanyName(); $orderList["payerName"] = $this->getPayerName(); $orderList["payerAddress"] = $this->getPayerAddress(); $orderList["payerCo"] = $this->getPayerCo(); $orderList["payerZipCode"] = $this->getPayerZipCode(); $orderList["payerCity"] = $this->getPayerCity(); $orderList["payerEmail"] = $this->getPayerEmail(); $orderList["payerPhone"] = $this->getPayerPhone(); $orderList["payerMobile"] = $this->getPayerMobile(); $orderList["payerCountry"] = $this->getPayerCountry(); $orderList["reciveCompanyName"] = $this->getReciverCompanyName(); $orderList["reciverName"] = $this->getReciverName(); $orderList["reciverAddress"] = $this->getReciverAddress(); $orderList["reciverCo"] = $this->getReciverCo(); $orderList["reciverZipCode"] = $this->getReciverZipCode(); $orderList["reciverCity"] = $this->getReciverCity(); $orderList["reciverEmail"] = $this->getReciverEmail(); $orderList["reciverPhone"] = $this->getReciverPhone(); $orderList["reciverMobile"] = $this->getReciverMobile(); $orderList["reciverCountry"] = $this->getReciverCountry(); $order = Order::loadByForetagId($this->getId()); //get the first order line $orderList["refId"] = $order->getRefId(); $orderList["items"] = $order->getItems(); $orderList["orderId"] = $order->getOrderId(); $orderList["date"] = $order->getDate(); $orderList["price"] = $order->getPrice(); $orderList["quantity"] = $order->getAntal(); $orderList["item"] = $order->getItem(); $orderList["magazineId"] = $order->getMagazineId(); $orderList["payment"] = $order->getPayment(); $orderList["sum"] = $order->getSum(); $orderList["sumMoms"] = $order->getSumMoms(); $orderList["typ"] = $order->getTyp(); $orderList["id"] = $order->getId(); $email->assign("orderList", $orderList); $email->assign("orderItemList", $orderItemList); switch ($orderTyp) { case "foretag": $subject = "Kvitto - företag"; $body = $email->fetch('epostkvittoforetag.tpl'); break; case "foretag_tillagg": $subject = "Kvitto - tilläggsbeställning"; $body = $email->fetch('epostkvittoforetag_tillagg.tpl'); break; case "foretag_again": $subject = "Kvitto - fortsatt tävling"; $body = $email->fetch('epostkvittoforetag_again.tpl'); break; default: Order::logEmailSend(false, $subject, 'Felaktigt ordertyp inget epostkvitto skickat: | ' . $orderList["reciveCompanyName"] . ' | ' . $orderList["reciverEmail"]); throw new OrderException("Felaktigt ordertyp inget epostkvitto skickat: " . $order, -9); break; } Misc::sendEmail($orderList["reciverEmail"], null, $subject, $body); }
} } break; case "allasteg": //** Send mail for verification global $USER; if (isset($USER)) { $medlem = $USER; } if (!empty($medlem)) { $code = Security::getMedlemEncryptedString($medlem); $subject = "Nollställning av steg och rutt på Motiomera.se"; $email = new MMSmarty(); $link = 'http:/' . $_SERVER['SERVER_NAME'] . '/actions/delete.php?table=verifieraallasteg&verification=' . $code; $email->assign("link", $link); $body = $email->fetch('removeallstegemail.tpl'); Misc::sendEmail($USER->getEpost(), $SETTINGS["email"], $subject, $body); throw new UserException("E-post skickat för nollställning", "Ett e-post meddelande har skickats till din registerade e-post för att du ska kunna nollställa steg och rutt."); } break; case "verifieraallasteg": //** Attempt to verify to remove sträcka/steg global $USER; //$argCode = $_GET['verification']; if (!empty($USER)) { //if ($argCode == Security::getMedlemEncryptedString($USER)) { $USER->removeAllStrackor(); $USER->removeAllSteg(); $USER->setUserOnStaticRoute('false'); $USER->commit(); throw new UserException('Stegen nollställda', 'Vi har nu nollställt dina steg och du kan börja om från början. Vill du starta i någon annan kommun än din hemkommun kan du välja att göra detta innan du startar din nya rutt.');