</tr> <tr> <th><span>Grand Total</span></th> <td><span><?php echo $row->total; ?> <?php echo $row->currency; ?> </span></td> </tr> <tr> <th>Status</th> <td class="green">Paid</td> </tr> </table> <div id="footer"> <h1><span>Additional Notes</span></h1> <div> <p><small class="extra"><?php echo cleanOut(Registry::get("Core")->inv_note); ?> </small></p> </div> </div> </body> </html> <?php } else { die('<h1 style="text-align:center">You have selected invalid invoice</h1>'); }
static function d($debug, $cond = 1, $dies = 0, $file = 0) { #returns single instance from static context to be used as an object : Debug::d($debug); if (!$cond) { return; } #@ob_start();\Doctrine\Common\Util\Debug::dump($debug,4);$$debug=ob_get_clean();return pr1($debug);#doctrine way $obj = self::i(); init(); $bt = debug_backtrace(); if (count($bt) > 2) { array_shift($bt); } $call = array_shift($bt); $call = $call['file'] . ':' . $call['line']; #$tmp=explode('/',$call['file']);if(count($tmp)<2)$tmp=explode('\\',$call['file']);#nunows $debug = cleanRecursion($debug); cleanNullOrMaxDepthArrays($debug); if ($file) { file_put_contents($file, serialize(compact('call', 'debug'))); } #Keep a Memo if (0) { #*** $xt = (array) end($debug); $y = []; $y = array_keys($xt); $split = str_split($y[1]); foreach ($split as &$v) { $v .= '§' . ord($v); } unset($v); pr1(['line' => __LINE__, 'aborted', $split, isset($xt[PRIV . 'factetape'])] + $y, 1); #enfants,statut,data,*factetape ( public from proposition ); } #isSerializable, now ! #$debug=var_debug($debug); if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { #AJAX if ($dies) { $debug = JSON_encode(compact('call', 'debug')); cleanOut($debug, 1); die($debug); } #return new JSON_response return compact('call', 'debug'); #return new JSON_response #return json_encode($debug); } if (!isset($_SERVER['HTTP_HOST'])) { $debug = print_r(compact('call', 'debug'), 1); die(CleanOut($debug)); } #Failsafe for first debug ( recursivity issues ) toggles advanced display -> is now flattened $debug = var_debug($debug); $debug = print_r(compact('call', 'debug'), 1); CleanOut($debug); /* know that #client referers to first client level $x = preg_replace("~\n[ ]+(bool|int)\(([a-z]*[0-9]*)\)~", "\\2", $x); $x = preg_replace("~\n[ ]+string\([0-9]+\)~", "", $x); #$x=preg_replace("~\n bool(false)~","0",$x); $x = preg_replace("~\n[ ]+([^\n]+\n[ ]+null|\[[^\n]+\] => null)~i", "", $x); $x = preg_replace("~\(([0-9]+)\) {\n[ ]+\.\.\.\n[ ]+}~", "(\\1)...", $x); */ if ($dies < 0) { file_put_contents(ini_get('error_log'), print_r($debug, 1)); return; } header('Content-Type: text/html; charset=utf-8', 1); echo "<link rel=stylesheet href='//ben/codes/debug.css'><script src='//ben/codes/debug.js' type='text/javascript'></script>"; # if ($dies) { die(pr1($debug)); } return pr1($debug); }
if (!$user->logged_in) { ?> <a href="register.php"><?php echo Core::$word->UA_REGISTER; ?> </a> <?php } ?> </nav> </div> </div> </header> <?php if ($news and !$user->logged_in) { ?> <div class="columns"> <div class="screen-60 tablet-90 phone-100 push-center"> <div id="news"><?php echo Filter::dodate("short_date", $news->created) . ' <strong>' . $news->title . '</strong>'; ?> <?php echo cleanOut($news->body); ?> </div> </div> </div> <?php } ?> </div>
/** * Membership::membershipCron() * * @param mixed $days * @return */ function membershipCron($days) { global $db, $core; $sql = "SELECT u.id, CONCAT(u.fname,' ',u.lname) as name, u.email, u.membership_id, u.trial_used, m.title, m.days," . "\n DATE_FORMAT(u.mem_expire, '%d %b %Y') as edate" . "\n FROM users as u" . "\n LEFT JOIN " . $this->mTable . " AS m ON m.id = u.membership_id" . "\n WHERE u.active = 'y' AND u.membership_id !=0" . "\n AND TO_DAYS(NOW()) - TO_DAYS(u.mem_expire) = '" . (int) $days . "'"; $listrow = $db->fetch_all($sql); require_once BASEPATH . "lib/class_mailer.php"; if ($listrow) { switch ($days) { case 7: $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $trow = $core->getRowById("email_templates", 8); $body = cleanOut($trow['body']); $replacements = array(); foreach ($listrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $core->site_name, '[URL]' => $core->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($trow['subject'])->setFrom(array($core->site_email => $core->site_name))->setBody($body, 'text/html'); foreach ($listrow as $row) { $message->addTo($row['email'], $row['name']); } unset($row); $numSent = $mailer->batchSend($message); break; case 0: $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $trow = $core->getRowById("email_templates", 9); $body = cleanOut($trow['body']); $replacements = array(); foreach ($listrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $core->site_name, '[URL]' => $core->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($trow['subject'])->setFrom(array($core->site_email => $core->site_name))->setBody($body, 'text/html'); foreach ($listrow as $row) { $message->addTo($row['email'], $row['name']); $data = array('membership_id' => 0, 'mem_expire' => "0000-00-00 00:00:00"); $db->update("users", $data, "id = '" . (int) $row['id'] . "'"); } unset($row); $numSent = $mailer->batchSend($message); break; } } }
</div> <div class="wojo footer"> <button type="button" name="dosubmit" class="wojo button"><?php echo Core::$word->GW_UPDATE; ?> </button> <input name="processGateway" type="hidden" value="1"> <input name="id" type="hidden" value="<?php echo Filter::$id; ?> "> </div> </form> </div> <div id="showhelp" style="display:none"><?php echo cleanOut($row->info); ?> </div> <script type="text/javascript"> // <![CDATA[ $(document).ready(function () { $('a.viewtip').on('click', function () { var text = $("#showhelp").html(); new Messi(text, { title: "<?php echo $row->displayname; ?> ", modal: true, }); });
$html .= '</div>'; $html .= '<div class="extra text">'; $html .= '<p><a href="index.php?do=newsletter&emailid=' . urlencode($row->email) . '">' . $row->email . '</a></p>'; $html .= '<p>' . Core::$word->MEMBERSHIP . ': ' . $membership . '</p>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; } $html .= '</div>'; print $html; } } } /* == Quick Edit== */ if (isset($_POST['quickedit'])) { $title = cleanOut($_POST['title']); $title = strip_tags($title); switch ($_POST['type']) { /* == Update Language Phrase== */ case "phrase": if (file_exists(BASEPATH . Core::langdir . "/lang.xml")) { $xmlel = simplexml_load_file(BASEPATH . Core::langdir . "/lang.xml"); $node = $xmlel->xpath("/language/phrase[@data = '" . $_POST['key'] . "']"); $node[0][0] = $title; $xmlel->asXML(BASEPATH . Core::langdir . "/lang.xml"); } break; /* == Update Country Vat == */ /* == Update Country Vat == */ case "cntvat": if (empty($_POST['title'])) {
"><?php echo $core->formatMoney($prow->price); ?> <span><?php echo $prow->days . ' ' . $member->getPeriod($prow->period); ?> </span></p> <p class="recurring"><?php echo Core::$word->RECURRING; ?> <b><?php echo $prow->recurring ? Core::$word->YES : Core::$word->NO; ?> </b></p> <p class="desc"><?php echo cleanOut($prow->description); ?> </p> </li> <?php } ?> </ul> </div> <?php } ?> </div> </div> </div> <script type="text/javascript">
/** * User::activateAccount() * * @return */ public function activateAccount() { $data['active'] = "y"; self::$db->update(self::uTable, $data, "id = " . Filter::$id); require_once BASEPATH . "lib/class_mailer.php"; $row = Registry::get("Core")->getRowById(Content::eTable, 16); $usr = Registry::get("Core")->getRowById(self::uTable, Filter::$id); $body = str_replace(array('[NAME]', '[URL]', '[SITE_NAME]'), array($usr->fname . ' ' . $usr->lname, SITEURL, Registry::get("Core")->site_name), $row->body); $newbody = cleanOut($body); $mailer = Mailer::sendMail(); $message = Swift_Message::newInstance()->setSubject($row->subject)->setTo(array($usr->email => $usr->username))->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($newbody, 'text/html'); if ($data['active'] == "y") { $json['type'] = 'success'; $json['title'] = Core::$word->SUCCESS; $json['message'] = Core::$word->UR_ACCOK; print json_encode($json); } else { $json['type'] = 'error'; $json['title'] = Core::$word->ERROR; $json['message'] = Core::$word->UR_ACCERR; print json_encode($json); } }
/** * cleanSanitize() * * @param mixed $string * @param bool $trim * @return */ function cleanSanitize($string, $trim = false, $end_char = '…') { $string = cleanOut($string); $string = filter_var($string, FILTER_SANITIZE_STRING); $string = trim($string); $string = stripslashes($string); $string = strip_tags($string); $string = str_replace(array('‘', '’', '“', '”'), array("'", "'", '"', '"'), $string); if ($trim) { if (strlen($string) < $trim) { return $string; } $string = preg_replace("/\\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $string)); if (strlen($string) <= $trim) { return $string; } $out = ""; foreach (explode(' ', trim($string)) as $val) { $out .= $val . ' '; if (strlen($out) >= $trim) { $out = trim($out); return strlen($out) == strlen($string) ? $out : $out . $end_char; } } } return $string; }
exit; } } /* Proccess User */ if (isset($_POST['processUser'])) { if (intval($_POST['processUser']) == 0 || empty($_POST['processUser'])) { exit; } $user->updateProfile(); } /* Get Invoice */ if (isset($_GET['doInvoice'])) { $row = $member->getUserInvoice(Filter::$id); if ($row) { $usr = Registry::get("Core")->getRowById(Users::uTable, Registry::get("Users")->uid); $title = cleanOut(preg_replace("/[^a-zA-Z0-9\\s]/", "", $row->title)); ob_start(); require_once BASEPATH . 'assets/print_pdf.tpl.php'; $pdf_html = ob_get_contents(); ob_end_clean(); require_once BASEPATH . 'lib/mPdf/mpdf.php'; $mpdf = new mPDF('utf-8', "A4"); $mpdf->SetTitle($title); $mpdf->SetAutoFont(); $mpdf->WriteHTML($pdf_html); $mpdf->Output($title . ".pdf", "D"); exit; } else { exit; } }
/** * Core::processNewsletter() * * @return */ public function processNewsletter() { global $db; if (empty($_POST['subject'])) { $this->msgs['subject'] = "Please Enter Newsletter Subject"; } if (empty($_POST['body'])) { $this->msgs['body'] = "Please Enter Email Message!"; } if (empty($this->msgs)) { $to = sanitize($_POST['recipient']); $subject = sanitize($_POST['subject']); $body = cleanOut($_POST['body']); $numSent = false; switch ($to) { case "all": require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM users WHERE id != 1"; $userrow = $db->fetch_all($sql); $replacements = array(); if ($userrow) { foreach ($userrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $this->site_name, '[URL]' => $this->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array($this->site_email => $this->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->addTo($row['email'], $row['name']); } unset($row); $numSent = $mailer->batchSend($message); } break; case "newsletter": require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM users WHERE newsletter = '1' AND id != 1"; $userrow = $db->fetch_all($sql); $replacements = array(); if ($userrow) { foreach ($userrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $this->site_name, '[URL]' => $this->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array($this->site_email => $this->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->addTo($row['email'], $row['name']); } unset($row); $numSent = $mailer->batchSend($message); } break; case "free": require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email,CONCAT(fname,' ',lname) as name FROM users WHERE membership_id = 0 AND id != 1"; $userrow = $db->fetch_all($sql); $replacements = array(); if ($userrow) { foreach ($userrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $this->site_name, '[URL]' => $this->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array($this->site_email => $this->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->addTo($row['email'], $row['name']); } unset($row); $numSent = $mailer->batchSend($message); } break; case "paid": require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM users WHERE membership_id <> 0 AND id != 1"; $userrow = $db->fetch_all($sql); $replacements = array(); if ($userrow) { foreach ($userrow as $cols) { $replacements[$cols['email']] = array('[NAME]' => $cols['name'], '[SITE_NAME]' => $this->site_name, '[URL]' => $this->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array($this->site_email => $this->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->addTo($row['email'], $row['name']); } unset($row); $numSent = $mailer->batchSend($message); } break; default: require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $row = $db->first("SELECT email, CONCAT(fname,' ',lname) as name FROM users WHERE email LIKE '%" . sanitize($to) . "%'"); if ($row) { $newbody = str_replace(array('[NAME]', '[SITE_NAME]', '[URL]'), array($row['name'], $this->site_name, $this->site_url), $body); $message = Swift_Message::newInstance()->setSubject($subject)->setTo(array($to => $row['name']))->setFrom(array($this->site_email => $this->site_name))->setBody($newbody, 'text/html'); $numSent = $mailer->send($message); } break; } $numSent ? $this->msgOk("<span>Success!</span>All Email(s) have been sent successfully!") : $this->msgAlert("<span>Error!</span>Some of the emails could not be sent!"); } else { print $this->msgStatus(); } }
/** * User::passReset() * * @return */ public function passReset() { global $db, $core; if (empty($_POST['uname'])) { $core->msgs['uname'] = 'Please Enter Valid Username'; } $uname = $this->usernameExists($_POST['uname']); if (strlen($_POST['uname']) < 4 || strlen($_POST['uname']) > 30 || !preg_match("/^([0-9a-z])+\$/i", $_POST['uname']) || $uname != 3) { $core->msgs['uname'] = 'We are sorry, selected username does not exist in our database'; } if (empty($_POST['email'])) { $core->msgs['email'] = 'Please Enter Valid Email Address'; } if (!$this->emailExists($_POST['email'])) { $core->msgs['uname'] = 'Entered Email Address Does Not Exists.'; } if (empty($_POST['captcha'])) { $core->msgs['captcha'] = 'Please enter the total amount'; } if ($_POST['captcha'] != "10") { $core->msgs['captcha'] = 'Entered total amount is incorrect'; } if (empty($core->msgs)) { $user = $this->getUserInfo($_POST['uname']); $randpass = $this->getUniqueCode(12); $newpass = sha1($randpass); $data['password'] = $newpass; $db->update($this->uTable, $data, "username = '******'username'] . "'"); require_once BASEPATH . "lib/class_mailer.php"; $row = $core->getRowById("email_templates", 2); $body = str_replace(array('[USERNAME]', '[PASSWORD]', '[URL]', '[LINK]', '[IP]', '[SITE_NAME]'), array($user['username'], $randpass, $core->site_url, $core->site_url, $_SERVER['REMOTE_ADDR'], $core->site_name), $row['body']); $newbody = cleanOut($body); $mailer = $mail->sendMail(); $message = Swift_Message::newInstance()->setSubject($row['subject'])->setTo(array($user['email'] => $user['username']))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody, 'text/html'); $db->affected() && $mailer->send($message) ? $core->msgOk('<span>Success!</span>You have successfully changed your password. Please check your email for further info!', false) : $core->msgError('<span>Error!</span>There was an error during the process. Please contact the administrator.', false); } else { print $core->msgStatus(); } }
} if ($_POST['code'] != "8") { $core->msgs['code'] = 'Entered total amount is incorrect'; } if ($_POST['email'] == "") { $core->msgs['email'] = 'Please enter your email address'; } if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$/", $_POST['email'])) { $core->msgs['email'] = 'Entered email address is invalid!'; } if ($_POST['message'] == "") { $core->msgs['message'] = 'Please enter your message'; } if (empty($core->msgs)) { $sender_email = sanitize($_POST['email']); $name = sanitize($_POST['name']); $message = strip_tags($_POST['message']); $mailsubject = sanitize($_POST['subject']); $ip = sanitize($_SERVER['REMOTE_ADDR']); require_once BASEPATH . "lib/class_mailer.php"; $mailer = $mail->sendMail(); $row = $core->getRowById("email_templates", 10); $body = str_replace(array('[MESSAGE]', '[SENDER]', '[NAME]', '[MAILSUBJECT]', '[IP]', '[SITE_NAME]', '[URL]'), array($message, $sender_email, $name, $mailsubject, $ip, $core->site_name, $core->site_url), $row['body']); $message = Swift_Message::newInstance()->setSubject($row['subject'])->setTo(array($core->site_email => $core->site_name))->setFrom(array($sender_email => $name))->setBody(cleanOut($body), 'text/html'); if ($mailer->send($message)) { print 1; } } else { print $core->msgStatus(); } }
/** * Content::processNewsletter() * * @return */ public function processNewsletter() { Filter::checkPost('subject', Core::$word->NL_SUBJECT); Filter::checkPost('body', Core::$word->NL_BODY); Filter::checkPost('recipient', Core::$word->NL_RCPT); if (empty(Filter::$msgs)) { $to = sanitize($_POST['recipient']); $subject = sanitize($_POST['subject']); $body = cleanOut($_POST['body']); $numSent = 0; $failedRecipients = array(); switch ($to) { case "all": require_once BASEPATH . "lib/class_mailer.php"; $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE id != 1"; $userrow = Registry::get("Database")->fetch_all($sql); $replacements = array(); if ($userrow) { if (empty($_FILES['attachment']['name'])) { $attachement = ''; } else { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>'; } foreach ($userrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->setTo(array($row->email => $row->name)); $numSent++; $mailer->send($message, $failedRecipients); } unset($row); } break; case "newsletter": require_once BASEPATH . "lib/class_mailer.php"; $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE newsletter = '1' AND id != 1"; $userrow = Registry::get("Database")->fetch_all($sql); $replacements = array(); if ($userrow) { if (empty($_FILES['attachment']['name'])) { $attachement = ''; } else { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>'; } foreach ($userrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html'); if (!empty($_FILES['attachment']['name'])) { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = $_FILES['attachment']['name']; } foreach ($userrow as $row) { $message->setTo(array($row->email => $row->name)); $numSent++; $mailer->send($message, $failedRecipients); } unset($row); } break; case "free": require_once BASEPATH . "lib/class_mailer.php"; $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email,CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE membership_id = 0 AND id != 1"; $userrow = Registry::get("Database")->fetch_all($sql); $replacements = array(); if ($userrow) { if (empty($_FILES['attachment']['name'])) { $attachement = ''; } else { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>'; } foreach ($userrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->setTo(array($row->email => $row->name)); $numSent++; $mailer->send($message, $failedRecipients); } unset($row); } break; case "paid": require_once BASEPATH . "lib/class_mailer.php"; $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100)); $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE membership_id <> 0 AND id != 1"; $userrow = Registry::get("Database")->fetch_all($sql); $replacements = array(); if ($userrow) { if (empty($_FILES['attachment']['name'])) { $attachement = ''; } else { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>'; } foreach ($userrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html'); foreach ($userrow as $row) { $message->setTo(array($row->email => $row->name)); $numSent++; $mailer->send($message, $failedRecipients); } } break; default: require_once BASEPATH . "lib/class_mailer.php"; $mailer = Mailer::sendMail(); $row = Registry::get("Database")->first("SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE email LIKE '%" . sanitize($to) . "%'"); if ($row) { if (empty($_FILES['attachment']['name'])) { $attachement = ''; } else { move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']); $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>'; } $newbody = str_replace(array('[NAME]', '[ATTACHMENT]', '[SITE_NAME]', '[URL]'), array($row->name, $attachement, Registry::get("Core")->site_name, Registry::get("Core")->site_url), $body); $message = Swift_Message::newInstance()->setSubject($subject)->setTo(array($to => $row->name))->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($newbody, 'text/html'); $numSent++; $mailer->send($message, $failedRecipients); } break; } if ($numSent) { $json['type'] = 'success'; $json['title'] = Core::$word->SUCCESS; $json['message'] = Core::$word->NL_SENT; } else { $json['type'] = 'error'; $json['title'] = Core::$word->ERROR; $res = ''; $res .= '<ul>'; foreach ($failedRecipients as $failed) { $res .= '<li>' . $failed . '</li>'; } $res .= '</ul>'; $json['message'] = Core::$word->NL_ALERT . $res; unset($failed); } print json_encode($json); } else { $json['type'] = 'error'; $json['title'] = Core::$word->SYSTEM_ERR; $json['message'] = Filter::msgSingleStatus(); print json_encode($json); } }
$error = true; return false; } pflog('ITN OK'); pflog("ITN verified for {$itnVerifyRequest}\n"); if ($error == false and $_POST['payment_status'] == "COMPLETE") { $user_id = intval($_POST['custom_int1']); $mc_gross = $_POST['amount_gross']; $membership_id = $_POST['m_payment_id']; $txn_id = $_POST['pf_payment_id']; $total = Core::getCart($user_id); $v1 = compareFloatNumbers($mc_gross, $total->totalprice, "="); if ($v1 == true) { $row = $db->first("SELECT * FROM " . Membership::mTable . " WHERE id=" . (int) $membership_id); $username = getValueById("username", Users::uTable, (int) $user_id); $data = array('txn_id' => $txn_id, 'membership_id' => $row->id, 'user_id' => (int) $user_id, 'rate_amount' => $total->originalprice, 'tax' => $total->totaltax, 'coupon' => $total->coupon, 'total' => $total->totalprice, 'ip' => $_SERVER['REMOTE_ADDR'], 'created' => "NOW()", 'pp' => "PayFast", 'currency' => "ZAR", 'status' => 1); $db->insert(Membership::pTable, $data); $udata = array('membership_id' => $row->id, 'mem_expire' => $user->calculateDays($row->id), 'trial_used' => $row->trial == 1 ? 1 : 0, 'memused' => 1); $db->update(Users::uTable, $udata, "id=" . (int) $user_id); /* == Notify Administrator == */ require_once BASEPATH . "lib/class_mailer.php"; $row2 = Core::getRowById(Content::eTable, 5); $body = str_replace(array('[USERNAME]', '[ITEMNAME]', '[PRICE]', '[STATUS]', '[PP]', '[IP]'), array($username, $row->title, $core->formatMoney($mc_gross), "Completed", "PayPal", $_SERVER['REMOTE_ADDR']), $row2->body); $newbody = cleanOut($body); $mailer = Mailer::sendMail(); $message = Swift_Message::newInstance()->setSubject($row2->subject)->setTo(array($core->site_email => $core->site_name))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody, 'text/html'); $mailer->send($message); pflog("Email Notification sent successfuly"); } } }
<a href="contact.php"><img src="images/mailsend.png" alt="" class="tooltip" title="Contact Us" /></a> <a href="hub.php"><img src="images/www.gif" alt="" class="tooltip" title="The Hub" /></a> <a href="down.php"><img src="images/down.png" alt="" class="tooltip" title="Down or Not" /></a> <a href="logout.php"><img src="images/log-off.png" alt="" class="tooltip" title="Log Off" /></a> <?php } else { ?> <a href="plans.php"><img src="images/memberships.png" alt="" class="tooltip" title="Membersips" /></a> <?php } ?> </div> <?php if ($news) { ?> <div id="news-slide"><img src="images/latest-news.png" alt="" id="shownews"/> <div id="news"> <?php echo $news['cdate'] . ' <strong>' . $news['title'] . '</strong>'; ?> <?php echo cleanOut($news['body']); ?> </div> </div> <?php } ?> <div class="wrap"> <div id="msgholder"></div> <div id="content"> <span id="loader" style="display:none"></span>
$db->update(Users::uTable, $udata, "id=" . $user->uid); $jn['type'] = 'success'; $jn['message'] = 'Thank you payment completed'; print json_encode($jn); /* == Notify Administrator == */ require_once BASEPATH . "lib/class_mailer.php"; $row2 = Core::getRowById(Content::eTable, 5); $body = str_replace(array('[USERNAME]', '[ITEMNAME]', '[PRICE]', '[STATUS]', '[PP]', '[IP]'), array($user->username, $row->title, $core->formatMoney($amount_charged), "Completed", "Stripe", $_SERVER['REMOTE_ADDR']), $row2->body); $newbody = cleanOut($body); $mailer = Mailer::sendMail(); $message = Swift_Message::newInstance()->setSubject($row2->subject)->setTo(array($core->site_email => $core->site_name))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody, 'text/html'); $mailer->send($message); /* == Notify User == */ $row3 = Core::getRowById(Content::eTable, 15); $body2 = str_replace(array('[USERNAME]', '[MNAME]', '[VALID]'), array($user->username, $row->title, $udata['mem_expire']), $row3->body); $newbody2 = cleanOut($body2); $mailer2 = Mailer::sendMail(); $message2 = Swift_Message::newInstance()->setSubject($row3->subject)->setTo(array($user->email => $user->username))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody2, 'text/html'); $mailer2->send($message2); $db->delete(Content::crTable, "uid = " . $user->uid); } else { $json['type'] = 'error'; $json['message'] = "Invalid Transaction detected"; print json_encode($json); } } catch (Stripe_CardError $e) { //$json = json_decode($e); $body = $e->getJsonBody(); $err = $body['error']; $json['type'] = 'error'; Filter::$msgs['status'] = 'Status is: ' . $e->getHttpStatus() . "\n";
/** * Membership::membershipCron() * * @param mixed $days * @return */ function membershipCron($days) { $sql = "SELECT u.id, CONCAT(u.fname,' ',u.lname) as name, u.email, u.membership_id, u.trial_used, m.title, m.days," . "\n DATE_FORMAT(u.mem_expire, '%d %b %Y') as edate" . "\n FROM " . Users::uTable . " as u" . "\n LEFT JOIN " . self::mTable . " AS m ON m.id = u.membership_id" . "\n WHERE u.active = 'y' AND u.membership_id !=0" . "\n AND TO_DAYS(u.mem_expire) - TO_DAYS(NOW()) = '" . (int) $days . "'"; $listrow = $db->fetch_all($sql); require_once BASEPATH . "lib/class_mailer.php"; if ($listrow) { switch ($days) { case 7: $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30)); $trow = Registry::get("Core")->getRowById(Content::eTable, 8); $body = cleanOut($trow->body); $replacements = array(); foreach ($listrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html'); foreach ($listrow as $row) { $message->setTo(array($row->email => $row->name)); $mailer->send($message); } unset($row); break; case 0: $mailer = Mailer::sendMail(); $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30)); $trow = Registry::get("Core")->getRowById(Content::eTable, 9); $body = cleanOut($trow->body); $replacements = array(); foreach ($listrow as $cols) { $replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url); } $decorator = new Swift_Plugins_DecoratorPlugin($replacements); $mailer->registerPlugin($decorator); $message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array($core->site_email => $core->site_name))->setBody($body, 'text/html'); foreach ($listrow as $row) { $message->setTo(array($row->email => $row->name)); $data = array('membership_id' => 0, 'mem_expire' => "0000-00-00 00:00:00"); self::$db->update(Users::uTable, $data, "id = " . $row->id); $mailer->send($message); } unset($row); break; } } }