/* == 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($total->totalprice), "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); /* == Notify User == */ $row3 = Core::getRowById(Content::eTable, 15); $uemail = getValueById("email", Users::uTable, intval($user_id)); $body2 = str_replace(array('[USERNAME]', '[MNAME]', '[VALID]'), array($username, $row->title, $udata['mem_expire']), $row3->body); $newbody2 = cleanOut($body2); $mailer2 = Mailer::sendMail(); $message2 = Swift_Message::newInstance()->setSubject($row3->subject)->setTo(array($uemail => $username))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody2, 'text/html'); $mailer2->send($message2); $db->delete(Content::crTable, "uid = " . intval($user_id)); } } else { /* == Failed Transaction= = */ require_once BASEPATH . "lib/class_mailer.php"; $row2 = Core::getRowById(Content::eTable, 6); $itemname = getValueById("title", Membership::mTable, intval($membership_id)); $body = str_replace(array('[USERNAME]', '[ITEMNAME]', '[PRICE]', '[STATUS]', '[PP]', '[IP]'), array($username, $itemname, $core->formatMoney($total->totalprice), "Failed", "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('ITN not OK'); $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"); } }
/** * Users::updateProfile() * * @return */ public function updateProfile() { Filter::checkPost('fname', Core::$word->UR_FNAME); Filter::checkPost('lname', Core::$word->UR_LNAME); Filter::checkPost('email', Core::$word->EMAIL); Filter::checkPost('address', Core::$word->UR_ADDRESS); Filter::checkPost('city', Core::$word->UR_CITY); Filter::checkPost('country', Core::$word->UR_COUNTRY); Filter::checkPost('state', Core::$word->UR_STATE); Filter::checkPost('zip', Core::$word->UR_ZIP); if (!$this->isValidEmail($_POST['email'])) { Filter::$msgs['email'] = Core::$word->UR_EMAIL_R2; } if (!empty($_FILES['avatar']['name'])) { if (!preg_match("/(\\.jpg|\\.png)\$/i", $_FILES['avatar']['name'])) { Filter::$msgs['avatar'] = Core::$word->CG_LOGO_R; } $file_info = getimagesize($_FILES['avatar']['tmp_name']); if (empty($file_info)) { Filter::$msgs['avatar'] = Core::$word->CG_LOGO_R; } } $this->verifyCustomFields("profile"); if (empty(Filter::$msgs)) { $data = array('email' => sanitize($_POST['email']), 'lname' => sanitize($_POST['lname']), 'fname' => sanitize($_POST['fname']), 'address' => sanitize($_POST['address']), 'city' => sanitize($_POST['city']), 'country' => sanitize($_POST['country']), 'state' => sanitize($_POST['state']), 'zip' => sanitize($_POST['zip']), 'newsletter' => intval($_POST['newsletter'])); // Procces Avatar if (!empty($_FILES['avatar']['name'])) { $thumbdir = UPLOADS; $tName = "AVT_" . randName(); $text = substr($_FILES['avatar']['name'], strrpos($_FILES['avatar']['name'], '.') + 1); $thumbName = $thumbdir . $tName . "." . strtolower($text); if (Filter::$id && ($thumb = getValueById("avatar", self::uTable, Filter::$id))) { @unlink($thumbdir . $thumb); } move_uploaded_file($_FILES['avatar']['tmp_name'], $thumbName); $data['avatar'] = $tName . "." . strtolower($text); } $userpass = getValueById("password", self::uTable, $this->uid); if ($_POST['password'] != "") { $data['password'] = sha1($_POST['password']); } else { $data['password'] = $userpass; } $fl_array = array_key_exists_wildcard($_POST, 'custom_*', 'key-value'); if (isset($fl_array)) { $fields = $fl_array; $total = count($fields); if (is_array($fields)) { $fielddata = ''; foreach ($fields as $fid) { $fielddata .= $fid . "::"; } } $data['custom_fields'] = $fielddata; } self::$db->update(self::uTable, $data, "id=" . $this->uid); if (self::$db->affected()) { $json['type'] = 'success'; $json['title'] = Core::$word->SUCCESS; $json['message'] = Core::$word->UA_UPDATEOK; print json_encode($json); } else { $json['type'] = 'warning'; $json['title'] = Core::$word->ALERT; $json['message'] = Core::$word->SYSTEM_PROCCESS; print json_encode($json); } } else { $json['type'] = 'error'; $json['title'] = Core::$word->SYSTEM_ERR; $json['message'] = Filter::msgSingleStatus(); print json_encode($json); } }