public function PostIsSpam() { global $db; if ($this->mCanReport) { $sql = 'INSERT INTO ' . DB_PREFIX . 'spam_reports (the_time, ip, job_id) VALUES (NOW(), "' . $this->mIp . '", ' . $this->mJobId . ')'; if ($db->query($sql)) { if ($this->GetTotalVotesPerPost() > REPORT_POST_NOTIFY_ON) { $job = new Job($this->mJobId); $mihai = new Postman(); $mihai->MailReportSpam($job->GetInfo()); } return true; } else { return false; } } else { return false; } }
// 04/08/2015 : Adding Try Catch statement to prevent a fatal exception when acessing // October backend update settings. What happens in there is a race // condition when visiting October backend update page. Plugings don't follow their normal flow it looks like // the boot function is not called, so facades are not created therfore FriendsAPI doesn't exists. try { DMA\Friends\Facades\FriendsAPI::getRoutes(); } catch (\ReflectionException $e) { // FriendsAPI facade doesn't exist yet // Do nothing, just live long and prosper } }); }); Route::get('logout', function () { Auth::logout(); return Redirect::to('/'); }); Route::get('location/barcode-login', function () { return DMA\Friends\Controllers\Locations::barcodeLogin(); }); Route::group(['prefix' => 'webhooks'], function () { // Implement here each individual webhook Route::post('twilio/sms', function () { $request = Input::all(); $ch = Postman::getChannelInstance('sms'); return $ch->webhook($request); }); }); // TODO: add ajax route Route::get('friends/reports/ajax/{class}', function ($class) { return \DMA\Friends\Controllers\Ajax::report($class); });
<?php $email = $auth = null; if (!empty($_POST) && isset($_POST['email']) && isset($_POST['auth'])) { $email = $db->real_escape_string($_POST['email']); $auth = $db->real_escape_string($_POST['auth']); } elseif (!empty($id) && !empty($extra)) { $email = $id; $auth = $extra; } if (!empty($email) && !empty($auth) && Subscriber::isValid($email, $auth)) { $subscriber = new Subscriber($email); $postman = new Postman(); if (isset($_POST['delete_subscriber'])) { if ($subscriber->delete()) { $postman->MailSubscriptionRemoved($email); $template = 'subscriptions-removed.tpl'; } } else { if ($settings['subscribe_page_content'] != '') { $sql = ' SELECT * FROM ' . DB_PREFIX . 'pages WHERE url = "' . $db->real_escape_string($settings['subscribe_page_content']) . '"'; $result = $db->query($sql); $pageData = $result->fetch_assoc(); if (is_array($pageData)) { $html_title = $pageData['page_title'] . ' - ' . SITE_NAME; $meta_keywords = $pageData['keywords']; $meta_description = $pageData['description']; $smarty->assign('page', $pageData);
$attachment = $filename; } else { $attachment = ''; } $data = array('apply_email' => $apply_email, 'apply_name' => $apply_name, 'apply_msg' => strip_tags($apply_msg), 'company_email' => $j->mPosterEmail, 'company_name' => $j->mCompany, 'job_title' => $j->mTitle, 'attachment_path' => APP_PATH . FILE_UPLOAD_DIR . $attachment, 'attachment_filename' => $attachment, 'job_id' => $job_id); $app = new JobApplication($job_id, $data); $applicationTimeoutDisabled = MINUTES_BETWEEN_APPLY_TO_JOBS_FROM_SAME_IP <= 0; $applicationTimeoutPassed = false; $applicantIP = $_SERVER['REMOTE_ADDR']; if (!$applicationTimeoutDisabled) { $applicationTimeoutPassed = $app->HasApplyTimeoutPassed($applicantIP); } $applicationAllowed = $applicationTimeoutDisabled || $applicationTimeoutPassed; if ($applicationAllowed) { $app->Apply($applicantIP); $mailSender = new Postman(); $applyMailSent = $mailSender->MailApplyOnline($data); if ($applyMailSent) { $_SESSION['apply_mail_sent'] = 1; $_SESSION['apply_successful'] = 1; } else { $_SESSION['apply_mail_sent'] = -1; $_SESSION['apply_successful'] = -1; $_SESSION['apply_fields'] = $_POST; } } else { $_SESSION['apply_allowed'] = -1; $_SESSION['apply_successful'] = -1; $_SESSION['apply_fields'] = $_POST; } // delete uploaded file (cleanup)
/** * * @param RainLab\User\Models\User $user $user * @param string $notificationName * @param array $channel * @return boolean|Ambigous <boolean, void> */ public function sendNotification(&$user, $notificationName, array $channel = null) { // Check if the user is part of the group or the owner. if (!$this->inGroup($user)) { if ($this->owner->getKey() != $user->getKey()) { return false; } } $group = $this; $fromUser = $this->owner; \Postman::send($notificationName, function ($notification) use($user, $fromUser, $group) { $notification->to($user, $user->name); $notification->from($fromUser); $notification->subject('Groups'); $notification->attachObject($group); }, $channel); return false; }
<?php $job = new Job($id); $isNewPost = $job->mIsTemp; $postRequiresModeration = !$job->IsApprovedPosterEmail() && ENABLE_NEW_POST_MODERATION; if ($isNewPost) { $job->Publish(); } $postMan = new Postman(); $jobInfo = $job->GetInfo(); $jobInfo['isNewPost'] = $isNewPost; $jobInfo['postRequiresModeration'] = $postRequiresModeration; $postMan->MailPublishToAdmin($jobInfo); if ($postRequiresModeration) { if ($isNewPost) { $postMan->MailPublishPendingToUser($job->mPosterEmail); } $html_title = $translations['jobs']['add_success'] . ' / ' . SITE_NAME; } else { if (!$job->mIsActive) { $job->Activate(); } if ($isNewPost) { $postMan->MailPublishToUser($jobInfo); } $html_title = $translations['jobs']['publish_success'] . ' / ' . SITE_NAME; } $smarty->assign('postRequiresModeration', $postRequiresModeration); redirect_to(BASE_URL . 'confirm/' . $job->mId . '/' . ($postRequiresModeration ? 1 : 0) . '/'); exit;
$errors['contact_msg'] = $translations['contact']['msg_error']; } $attachment_path = $attachment_filename = ''; if ($pageData['accepts_files'] == '1' && array_key_exists('contact_attach', $_FILES)) { if ($_FILES['contact_attach']['size'] >= MAX_CV_SIZE) { $errors['contact_attach'] = $translations['contact']['attach_error']; } else { $attachment_path = $_FILES['contact_attach']['tmp_name']; $attachment_filename = $_FILES['contact_attach']['name']; } } if (count($errors) > 0) { $errors['contact_error'] = $translations['contact']['send_error']; $smarty->assign('errors', $errors); } else { $data = array('name' => $contact_name, 'email' => $contact_email, 'message' => $contact_msg, 'attachment_path' => $attachment_path, 'attachment_filename' => $attachment_filename); $mailer = new Postman(); if ($mailer->MailContact($data)) { $_SESSION['contact_msg_sent'] = 1; } if (!empty($attachment_path)) { @unlink($attachment_path); } } } else { $smarty->assign('ENABLE_RECAPTCHA', $captcha_enabled); if ($captcha_enabled) { $smarty->assign('the_captcha', recaptcha_get_html(CAPTCHA_PUBLIC_KEY)); } } }
public static function sendJob($jobId) { global $db; $job = new Job($jobId); $subscribers = self::getCategorySubscribers($job->mCategoryId); $postman = new Postman(); foreach ($subscribers as $subscriber) { if (!empty($subscriber['keywords'])) { $keywords = '/\\b(' . str_replace(',', '|', preg_quote($subscriber['keywords'])) . ')\\b/i'; if (!(preg_match($keywords, $job->mTitle) || preg_match($keywords, $job->mSummary) || preg_match($keywords, strip_tags($job->mDescription)))) { continue; } } $postman->MailSubscriptionJobPosted($subscriber['email'], $subscriber['auth'], $job); $sql = 'INSERT INTO ' . DB_PREFIX . 'subscriber_mail_log (email, job_id, job_title, job_summary, date) VALUES ("' . $subscriber['email'] . '", ' . $jobId . ', "' . $job->mTitle . '", "' . $job->mSummary . '", NOW())'; $db->Execute($sql); } }
/** * Add settings fields of all available channels. * @param mixed $form */ private function extendedSettingFields($form) { if (!$form->model instanceof \DMA\Friends\Models\Settings) { return; } if ($form->getContext() != 'update') { return; } $form->addFields(\Postman::getChannelSettingFields(), 'primary'); }
/** * Triggered upon instantiation. * * @return void * @access public */ public function __construct() { parent::_initialize(); }
/** * Triggered before the controller's `beforeFilter` method but after the * models have been constructed. * * @param Controller $controller * @param array $settings * @return null * @access public * @see http://book.cakephp.org/view/1617/Component-callbacks */ public function initialize(Controller $controller, $settings = array()) { parent::_initialize($settings); }
/** * Diese Methode erstellt einen neuen Newsletter in der Datenbank. * @return int den Primaerschluessel (die ID) des neuen Newsletters in der * Datenbank */ public static function create() { // existierende Templates holen $tpls = NewsletterTemplate::read_existing_templates(); // Wahl des Users auslesen $postman = new Postman(); $candidate = $postman->get_plaintext("template"); if (!is_null($candidate) && in_array($candidate, $tpls)) { $value = $candidate; } else { $value = $tpls[0][0]; } $db = new DbPdo(); $db->prepare_and_execute("INSERT INTO " . PREFIX . "newsletterCont SET date=:date, templatefile=:templatefile;", array("date" => time(), "templatefile" => $value)); $rueckgabe = $db->get_last_insert_id(); return $rueckgabe; }
$resp = recaptcha_check_answer(CAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $errors['captcha'] = $translations['captcha']['captcha_error']; } } if ($contact_name == '') { $errors['contact_name'] = $translations['contact']['name_error']; } if ($contact_email == '' || !validate_email($contact_email)) { $errors['contact_email'] = $translations['contact']['email_error']; } if ($contact_msg == '') { $errors['contact_msg'] = $translations['contact']['msg_error']; } if (count($errors) > 0) { $errors['contact_error'] = $translations['contact']['send_error']; $smarty->assign('errors', $errors); } else { $mailer = new Postman(); if ($mailer->MailContact($contact_name, $contact_email, $contact_msg)) { $_SESSION['contact_msg_sent'] = 1; } } } $smarty->assign('page', $pageData); if ($pageData['has_form'] == '1') { $smarty->assign('ENABLE_RECAPTCHA', $captcha_enabled); if ($captcha_enabled) { $smarty->assign('the_captcha', recaptcha_get_html(CAPTCHA_PUBLIC_KEY)); } }
<?php $j = new Job($id); // if auth code used, check it and allow activating if (isset($_SESSION['later_edit']) && $_SESSION['later_edit'] == $j->GetAuth() || $extra != '' && $extra == $j->GetAuth()) { $activator = $j->Activate(); $vali = new Postman(); $vali->MailPostActivatedToUser($j->GetInfo()); $_SESSION['status'] = $translations['jobs']['activated_success']; redirect_to(BASE_URL . URL_JOB . '/' . $id . '/'); exit; } else { redirect_to(BASE_URL); exit; }
/** * Инициализация объекта рассылки почтовых сообщений. * * @return Postman */ protected function get_postman() { $config = $this->_config['postman']; $postman = Postman::create($config); return $postman; }
<?php if (!empty($_POST) && isset($_POST['email']) && isset($_POST['category'])) { if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $email = $db->real_escape_string($_POST['email']); $category = $db->real_escape_string($_POST['category']); if ($category != '0') { $categoryData = get_category_by_id($category); if (is_null($categoryData)) { echo '0'; exit; } } $subscriber = new Subscriber($email); $postman = new Postman(); if ($subscriber->addSubscription($category)) { if ($postman->MailSubscriptionPleaseConfirm($email, $subscriber->getAuthCode())) { echo '1'; exit; } } } echo '0'; exit; } else { if ($settings['subscribe_page_content'] != '') { $sql = ' SELECT * FROM ' . DB_PREFIX . 'pages WHERE url = "' . $db->real_escape_string($settings['subscribe_page_content']) . '"'; $result = $db->query($sql);
<?php $j = new Job($_POST['job_id']); $activator = $j->Activate(); $vali = new Postman(); $vali->MailPostActivatedToUser($j->GetInfo(), BASE_URL_ORIG); echo 1; exit;
<?php escape($_POST); $costel = new Postman(); if ($costel->MailSendToFriend($friend_email, $my_email)) { echo '1'; } else { echo '0'; } exit;
/** * Test for the `setTransport` method. * * @return void * @access public */ public function testSetTransport() { $this->assertFalse($this->_object->setTransport(false)); $this->expectException(); $this->_object->setTransport(new stdClass()); }