Exemplo n.º 1
0
 public function actionSend($name = null)
 {
     if (defined('DISABLE_MESSAGING') && DISABLE_MESSAGING) {
         throw new Lvc_Exception('Messaging disabled', 404);
     }
     $active_user = User::require_active_user();
     $this->setLayoutVar('active_user', $active_user);
     if (is_null($name)) {
         throw new Lvc_Exception('Null username on send action');
     }
     if ($user = User::find(array('name' => $name))) {
         if (!empty($this->post['submit'])) {
             $subject = $this->post['subject'];
             $body = $this->post['body'];
             $result = Message::send($user, $subject, $body, $active_user);
             if ($result['status']) {
                 Flash::set('success', $result['message']);
                 $this->redirect('/message/inbox');
                 die;
             } else {
                 Flash::set('failure', $result['message']);
             }
             $this->setVar('subject', $subject);
             $this->setVar('body', $body);
         }
         $this->setVar('to_user', $user);
     } else {
         throw new Lvc_Exception('User Not Found: ' . $name);
     }
 }
Exemplo n.º 2
0
function main()
{
    $controller = new Controller();
    $response = null;
    switch ($_POST["cmd"]) {
        case "RPC":
            $username = $_POST["user"];
            if ($username == null) {
                $username = $_SESSION['user'];
            }
            $pw = $_POST["pw"];
            $plantname = $_POST["plant"];
            $code = $_POST["code"];
            $plantid = $_POST["id"];
            $response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code, $plantid);
            break;
        case "ContentRequest":
            if ($controller->IsLoggedIn() != "false") {
                $response = new ContentMessage($_POST["content"], $_POST["plantid"]);
            } else {
                $func = "function() { this.showLoginDialog(); this.showMessage('Sie sind nicht eingeloggt bitte einloggen', 'error'); }";
                $response = new RemoteProcedureCall($func);
            }
            break;
        default:
            $response = new Message('error', 'unknown Command');
            break;
    }
    if ($response != null) {
        $response->send();
    } else {
        echo "Error! no response was generated";
    }
}
Exemplo n.º 3
0
 public function run()
 {
     Bundle::start('messages');
     $twoweeks = date('Y-m-d', strtotime('+2 weeks'));
     $week = date('Y-m-d', strtotime('+1 weeks'));
     $tomorrow = date('Y-m-d', strtotime('+1 day'));
     $rooms = Room::where_del_date($tomorrow)->or_where('del_date', '=', $week)->or_where('del_date', '=', $twoweeks)->get();
     foreach ($rooms as $room) {
         switch ($room->del_date) {
             case $twoweeks:
                 $expire_date = "over twee weken";
                 break;
             case $week:
                 $expire_date = "over een week";
                 break;
             case $tomorrow:
                 $expire_date = "morgen";
                 break;
         }
         Message::send(function ($message) use($room, $expire_date) {
             $message->to($room->email);
             $message->from('*****@*****.**', 'Kamergenood');
             $message->subject('Verleng de kameradvertentie: "' . $room->title . '"');
             $message->body('view: emails.extend');
             $message->body->id = $room->id;
             $message->body->title = $room->title;
             $message->body->url = $room->url;
             $message->body->delkey = $room->delkey;
             $message->body->expire_date = $expire_date;
             $message->html(true);
         });
     }
 }
Exemplo n.º 4
0
 function action_write()
 {
     if (isset($_POST['from'])) {
         $to = $_POST['to'];
         $from = $_POST['from'];
         $text = $_POST['text'];
         $author = $_POST['author'];
         $msg = new Message($text, $author, $to, $from);
         $msg->send();
     }
 }
Exemplo n.º 5
0
 public function index()
 {
     if (isset($this->registry->params['user_id']) && isset($this->registry->params['user_activation_verification_code'])) {
         // új regisztráció ellenőrzése
         $result = $this->regisztracio_model->verifyNewUser($this->registry->params['user_id'], $this->registry->params['user_activation_verification_code']);
         if ($result) {
             $this->view->message = Message::send('account_activation_successful');
         } else {
             $this->view->message = Message::send('account_activation_failed');
         }
         $this->view->settings = $this->regisztracio_model->get_settings();
         $this->view->render('regisztracio/tpl_regisztracio', true);
     } else {
         Util::redirect('error');
     }
 }
Exemplo n.º 6
0
 public function sendPM($hash)
 {
     if (Request::isMethod('GET')) {
         $user = User::where('public_hash', '=', $hash)->firstOrFail();
         return View::make('user.anonpm', ['user' => $user]);
     } else {
         if (!Input::get('captcha') || !$this->checkCaptcha()) {
             return View::make('verif.pm_verif');
         }
         $input = Input::only('message');
         Message::validate($input);
         $user = User::where('public_hash', '=', $hash)->firstOrFail();
         Message::send($user->user_fp, $input);
         return Redirect::to('u/' . $hash);
     }
 }
Exemplo n.º 7
0
 public function run()
 {
     Bundle::start('messages');
     $today = date('Y-m-d');
     $rooms = Room::where_del_date($today)->get();
     foreach ($rooms as $room) {
         Message::send(function ($message) use($room) {
             $message->to($room->email);
             $message->from('*****@*****.**', 'Kamergenood');
             $message->subject('Kamer verlopen en verwijderd: "' . $room->title . '"');
             $message->body('view: emails.deleted');
             $message->body->title = $room->title;
             $message->html(true);
         });
         $path_room_folder = getcwd() . '/public_html/img/room/' . $room->id;
         File::rmdir($path_room_folder);
         $room->delete();
     }
 }
Exemplo n.º 8
0
 public function get_approve($id)
 {
     $room = Room::find($id);
     $room->status = 'publish';
     $room->save();
     Message::send(function ($message) use($room) {
         $message->to($room->email);
         $message->from('*****@*****.**', 'Kamergenood');
         $message->subject('Kamer geplaatst: "' . $room->title . '"');
         $message->body('view: emails.accept');
         $message->body->id = $room->id;
         $message->body->title = $room->title;
         $message->body->url = $room->url;
         $message->body->delkey = $room->delkey;
         $message->html(true);
     });
     if (Message::was_sent()) {
         return Redirect::to('admin')->with('msg', '<div class="alert alert-success"><strong>Kamer gepubliseerd</strong></div>');
     }
 }
Exemplo n.º 9
0
 /**
  *	Rekord törlése a site_users táblából
  */
 public function ajax_delete_items()
 {
     if (Util::is_ajax()) {
         if (isset($_POST['delete_id'])) {
             // ez a metódus true-val tér vissza (false esetén kivételt dob!)
             $result = $this->register_subscribe_model->delete(array($_POST['delete_id']));
             // visszatérés üzenetekkel
             if ($result['success'] == 1) {
                 $message = Message::send('A felhasználó törlése sikerült.');
                 echo json_encode(array("status" => 'success', "message" => $message));
             } else {
                 $message = Message::send('A felhasználó törlése nem sikerült!');
                 echo json_encode(array("status" => 'error', "message" => $message));
             }
         } else {
             throw new Exception('HIBA az ajax_delete_item metódusban: Nem létezik $_POST["delete_id"]');
         }
     } else {
         Util::redirect('error');
     }
 }
Exemplo n.º 10
0
 public function post_contact()
 {
     $rules = array('name' => 'required|min:3', 'email' => 'required|email', 'subject' => 'required|min:5', 'message' => 'required|min:30', 'captchatest' => 'laracaptcha|required');
     $messages = array('name_required' => 'Vul a.u.b je naam in', 'name_min' => 'Dat is wel een erg korte naam', 'email_required' => 'Vul a.u.b je emailadres in', 'email_email' => 'Dit is geen geldig emailadres', 'subject_required' => 'Geef a.u.b aan waar je bericht over gaat', 'subject_min' => 'Geef a.u.b iets uitgebreider waar je bericht over gaat', 'message_required' => 'Geen bericht geschreven', 'message_min' => 'Beschrijf je vraag of opmerking a.u.b iets uitgebreider', 'captchatest_laracaptcha' => 'De tekens komen niet overeen', 'captchatest_required' => 'De spamcheck is verplicht');
     $v = Validator::make(Input::all(), $rules, $messages);
     if ($v->fails()) {
         return Redirect::to('contact')->with_errors($v)->with_input();
     } else {
         $inputs = Input::all();
         Message::send(function ($message) use($inputs) {
             $message->to('*****@*****.**');
             $message->from($inputs['email'], $inputs['name']);
             $message->subject('Contact formulier: "' . $inputs['subject'] . '"');
             $message->body('<p>Bericht via het contactformulier verstuurd:</p><p>' . nl2br($inputs['message']) . '</p>');
             $message->html(true);
         });
         if (Message::was_sent()) {
             return Redirect::to('contact')->with('msg', '<div class="alert alert-success"><strong>Bericht verzonden!</strong> Indien nodig zal er zo snel mogelijk contact met je opgenomen worden.</div>');
         }
     }
 }
Exemplo n.º 11
0
    public function ajax_get_jobs($request_data)
    {
        // ebbe a tömbbe kerülnek a csoportos műveletek üzenetei
        $messages = array();
        $user_role = Session::get('user_role_id');
        if (isset($request_data['customActionType']) && isset($request_data['customActionName'])) {
            switch ($request_data['customActionName']) {
                case 'group_delete':
                    // az id-ket tartalmazó tömböt kapja paraméterként
                    $result = $this->delete_job($request_data['id']);
                    if ($result['success'] > 0) {
                        $messages['success'] = $result['success'] . ' ' . Message::send('munka sikeresen törölve.');
                    }
                    if ($result['error'] > 0) {
                        $messages['error'] = $result['error'] . ' ' . Message::send('munka törlése nem sikerült!');
                    }
                    break;
                case 'group_make_active':
                    $result = $this->change_status_query($request_data['id'], 1);
                    if ($result['success'] > 0) {
                        $messages['success'] = $result['success'] . Message::send(' munka státusza aktívra változott.');
                    }
                    if ($result['error'] > 0) {
                        $messages['error'] = $result['error'] . Message::send(' munka státusza nem változott meg!');
                    }
                    break;
                case 'group_make_inactive':
                    $result = $this->change_status_query($request_data['id'], 0);
                    if ($result['success'] > 0) {
                        $messages['success'] = $result['success'] . Message::send(' munka státusza inaktívra változott.');
                    }
                    if ($result['error'] > 0) {
                        $messages['error'] = $result['error'] . Message::send(' munka státusza nem változott meg!');
                    }
                    break;
            }
        }
        //összes sor számának lekérdezése
        $total_records = $this->query->count('jobs');
        $display_length = intval($request_data['length']);
        $display_length = $display_length < 0 ? $total_records : $display_length;
        $display_start = intval($request_data['start']);
        $display_draw = intval($request_data['draw']);
        $this->query->reset();
        $this->query->set_table(array('jobs'));
        $this->query->set_columns('SQL_CALC_FOUND_ROWS 
			`jobs`.`job_id`,
			`jobs`.`job_title`,
			`jobs`.`job_status`,
			`jobs`.`job_create_timestamp`,
			`jobs`.`job_update_timestamp`,
                        `jobs`.`job_expiry_timestamp`,
			`employer`.`employer_name`,
			`jobs_list`.`job_list_name`,
            `users`.`user_id`,
            `users`.`user_first_name`,
            `users`.`user_last_name`');
        $this->query->set_join('left', 'employer', 'jobs.job_employer_id', '=', 'employer.employer_id');
        $this->query->set_join('left', 'jobs_list', 'jobs.job_category_id', '=', 'jobs_list.job_list_id');
        $this->query->set_join('left', 'users', 'jobs.job_ref_id', '=', 'users.user_id');
        $this->query->set_offset($display_start);
        $this->query->set_limit($display_length);
        //szűrés beállítások
        if (isset($request_data['action']) && $request_data['action'] == 'filter') {
            if (!empty($request_data['search_employer'])) {
                $this->query->set_where('job_employer_id', 'LIKE', '%' . $request_data['search_employer'] . '%');
            }
            if (!empty($request_data['search_job_category'])) {
                $this->query->set_where('job_category_id', 'LIKE', '%' . $request_data['search_job_category'] . '%');
            }
            if (!empty($request_data['search_job_id'])) {
                $this->query->set_where('job_id', '=', (int) $request_data['search_job_id']);
            }
            if (!empty($request_data['search_referens'])) {
                $this->query->set_where('job_ref_id', '=', (int) $request_data['search_referens']);
            }
            if (!empty($request_data['search_job_title'])) {
                $this->query->set_where('job_title', 'LIKE', '%' . $request_data['search_job_title'] . '%');
            }
            if ($request_data['search_status'] !== '') {
                $this->query->set_where('job_status', '=', (int) $request_data['search_status']);
            }
        }
        //rendezés
        if (isset($request_data['order'][0]['column']) && isset($request_data['order'][0]['dir'])) {
            $num = $request_data['order'][0]['column'];
            //ez az oszlop száma
            $dir = $request_data['order'][0]['dir'];
            // asc vagy desc
            $order = $request_data['columns'][$num]['name'];
            // az oszlopokat az adatbázis mezői szerint kell elnevezni (a javascript datattables columnDefs beállításában)
            $this->query->set_orderby(array($order), $dir);
        }
        // lekérdezés
        $result = $this->query->select();
        // szűrés utáni visszaadott eredmények száma
        $filtered_records = $this->query->found_rows();
        // ebbe a tömbbe kerülnek az elküldendő adatok
        $data = array();
        foreach ($result as $value) {
            // id attribútum hozzáadása egy sorhoz
            //$temp['DT_RowId'] = 'ez_az_id_' . $value['job_id'];
            // class attribútum hozzáadása egy sorhoz
            //$temp['DT_RowClass'] = 'proba_osztaly';
            // csak a datatables 1.10.5 verzió felett
            //$temp['DT_RowAttr'] = array('data-proba' => 'ertek_proba');
            $temp['checkbox'] = $user_role < 3 ? '<input type="checkbox" class="checkboxes" name="job_id_' . $value['job_id'] . '" value="' . $value['job_id'] . '"/>' : '';
            $temp['id'] = '#' . $value['job_id'];
            $temp['megnevezes'] = $value['job_title'];
            $temp['kategoria'] = $value['job_list_name'];
            $temp['ceg_neve'] = $value['employer_name'];
            $temp['letrehozva'] = date('Y-m-d', $value['job_create_timestamp']) . ' / ' . date('Y-m-d', $value['job_expiry_timestamp']);
            $temp['modositva'] = empty($value['job_update_timestamp']) ? '' : date('Y-m-d H:i', $value['job_update_timestamp']);
            $temp['referens'] = $value['user_first_name'] . ' ' . $value['user_last_name'];
            $temp['status'] = $value['job_status'] == 1 ? '<span class="label label-sm label-success">Aktív</span>' : '<span class="label label-sm label-danger">Inaktív</span>';
            if ($value['job_expiry_timestamp'] < time()) {
                $temp['status'] .= '<span class="label label-sm label-warning">Lejárt</span>';
            }
            $temp['menu'] = '						
			<div class="actions">
				<div class="btn-group">';
            $temp['menu'] .= '<a class="btn btn-sm grey-steel" title="Műveletek" href="#" data-toggle="dropdown">
						<i class="fa fa-cogs"></i>
					</a>					
					<ul class="dropdown-menu pull-right">
						<li><a data-toggle="modal" data-target="#ajax_modal" href="' . $this->registry->site_url . 'jobs/view_job_ajax/' . $value['job_id'] . '"><i class="fa fa-eye"></i> Részletek</a></li>';
            // update
            $temp['menu'] .= $user_role < 3 ? '<li><a href="' . $this->registry->site_url . 'jobs/update_job/' . $value['job_id'] . '"><i class="fa fa-pencil"></i> Szerkeszt</a></li>' : '';
            // törlés
            if ($user_role == 1) {
                $temp['menu'] .= '<li><a href="javascript:;" class="delete_job_class" data-id="' . $value['job_id'] . '"> <i class="fa fa-trash"></i> Töröl</a></li>';
            } else {
                $temp['menu'] .= '<li class="disabled-link"><a href="javascript:;" title="Nincs jogosultsága törölni" class="disable-target"><i class="fa fa-trash"></i> Töröl</a></li>';
            }
            // status
            if ($value['job_status'] == 0) {
                $temp['menu'] .= '<li><a data-id="' . $value['job_id'] . '" href="javascript:;" class="change_status" data-action="make_active"><i class="fa fa-check"></i> Aktivál</a></li>';
            } else {
                $temp['menu'] .= '<li><a data-id="' . $value['job_id'] . '" href="javascript:;" class="change_status" data-action="make_inactive"><i class="fa fa-ban"></i> Blokkol</a></li>';
            }
            $temp['menu'] .= '</ul></div></div>';
            // adatok berakása a data tömbbe
            $data[] = $temp;
        }
        $json_data = array("draw" => $display_draw, "recordsTotal" => $total_records, "recordsFiltered" => $filtered_records, "data" => $data, "customActionStatus" => 'OK', "customActionMessage" => $messages);
        return $json_data;
    }
Exemplo n.º 12
0
 function fbHandle($p)
 {
     $msg_id = Message::send($p['to'], $p['msg']);
     Feedback::markHandled($p['owner'], $msg_id);
     js_redirect('a/feedback/default');
 }
Exemplo n.º 13
0
         // To a thread
         $threadDetails = $DB->sql_hash("SELECT f.id, f.latestReplySent, \r\n\t\t\t\t\t\tf.silenceID,\r\n\t\t\t\t\t\tsilence.userID as silenceUserID,\r\n\t\t\t\t\t\tsilence.postID as silencePostID,\r\n\t\t\t\t\t\tsilence.moderatorUserID as silenceModeratorUserID,\r\n\t\t\t\t\t\tsilence.enabled as silenceEnabled,\r\n\t\t\t\t\t\tsilence.startTime as silenceStartTime,\r\n\t\t\t\t\t\tsilence.length as silenceLength,\r\n\t\t\t\t\t\tsilence.reason as silenceReason\r\n\t\t\t\t\tFROM wD_ForumMessages f \r\n\t\t\t\t\tLEFT JOIN wD_Silences silence ON ( f.silenceID = silence.id )\r\n\t\t\t\t\tWHERE f.id=" . $new['sendtothread'] . "\r\n\t\t\t\t\t\tAND f.type='ThreadStart'");
         unset($messageproblem);
         if ($threadDetails['latestReplySent'] < $Misc->ThreadAliveThreshold) {
             $messageproblem = l_t("The thread you are attempting to reply to is too old, and has expired.");
         } elseif (Silence::isSilenced($threadDetails)) {
             $silence = new Silence($threadDetails);
             if ($silence->isEnabled()) {
                 $messageproblem = l_t("The thread you are attempting to reply to has been silenced; ") . $silence->reason;
             }
             unset($silence);
         }
         if (isset($threadDetails['id']) && !isset($messageproblem)) {
             // It's being sent to an existing, non-silenced / dated thread.
             try {
                 $new['id'] = Message::send($new['sendtothread'], $User->id, $new['message'], '', 'ThreadReply');
                 $_SESSION['lastPostText'] = $new['message'];
                 $_SESSION['lastPostTime'] = time();
                 $_SESSION['lastPostType'] = 'ThreadReply';
                 header("Location: " . $_SERVER['REQUEST_URI'] . '&reply=success');
             } catch (Exception $e) {
                 $messageproblem = $e->getMessage();
             }
         } else {
             $messageproblem = l_t("The thread you attempted to reply to doesn't exist.");
         }
         unset($threadDetails);
     }
 }
 if (isset($messageproblem) and $new['id'] != -1) {
     $_REQUEST['newmessage'] = '';
Exemplo n.º 14
0
 public function sendMessage($to, $txt)
 {
     $message = new Message($this->user, $this->token);
     $deliveryToken = $message->send($to, $txt);
     return $deliveryToken;
 }
Exemplo n.º 15
0
 /**
  * Send the HTTP request away.
  * 
  * @param $callback Callable
  */
 public function end($callback)
 {
     $message = new Message($this->url(), $this->method, $this->headers, $this->data);
     list($error, $response) = $message->send($this->expectedStatus);
     $callback($error, $response);
 }
Exemplo n.º 16
0
 /**
  *	Iroda törlése
  */
 public function ajax_delete_office()
 {
     if (isset($_POST['delete_id'])) {
         $id = (int) $_POST['delete_id'];
         // ez a metódus true-val tér vissza (false esetén kivételt dob!)
         $result = $this->offices_model->delete_office($id);
         // visszatérés üzenetekkel
         if ($result['success'] == 1) {
             $message = Message::send('Az iroda törlése sikerült.');
             echo json_encode(array("status" => 'success', "message" => $message));
         } else {
             $message = Message::send('Az iroda törlése nem sikerült!');
             echo json_encode(array("status" => 'error', "message" => $message));
         }
     } else {
         throw new Exception('HIBA az ajax_delete_office metódusban: Nem létezik $_POST["delete_id"]');
     }
 }
Exemplo n.º 17
0
 public function notify($title)
 {
     global $redcap_version;
     $dark = "#800000";
     //#1a74ba  1a74ba
     $light = "#FFE1E1";
     //#ebf6f3
     $border = "#800000";
     //FF0000";	//#a6d1ed	#3182b9
     // Run notification
     $url = APP_PATH_WEBROOT_FULL . "redcap_v{$redcap_version}/" . "DataEntry/index.php?pid={$this->project_id}&page={$this->instrument}&id={$this->record}&event_id={$this->event_id}";
     // Message (email html painfully copied from box.net notification email)
     $msg = RCView::table(array('cellpadding' => '0', 'cellspacing' => '0', 'border' => '0', 'style' => 'border:1px solid #bbb; font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'padding:13px'), RCView::table(array('style' => 'font:normal 15px Arial'), RCView::tr(array(), RCView::td(array('style' => 'font-size:18px;color:#000;border-bottom:1px solid #bbb'), RCView::span(array('style' => 'color:black'), RCVieW::a(array('style' => 'color:black'), 'REDCap AutoNotification Alert')) . RCView::br())) . RCView::tr(array(), RCView::td(array('style' => 'padding:10px 0'), RCView::table(array('style' => 'font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Title") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "<b>{$title}</b>")))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Project") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), REDCap::getProjectTitle())))) . ($this->redcap_event_name ? RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Event") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "{$this->redcap_event_name}")))) : '') . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Instrument") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->instrument)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Record") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->record)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Date/Time") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), date('Y-m-d H:i:s'))))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Message") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->config['message']))))))) . RCView::tr(array(), RCView::td(array('style' => "border:1px solid {$border};background-color:{$light};padding:20px"), RCView::table(array('style' => 'font:normal 12px Arial', 'cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array('style' => 'vertical-align:middle'), RCView::td(array(), RCView::table(array('cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array(), RCView::td(array('style' => "border:1px solid #600000;background-color:{$dark};padding:8px;font:bold 12px Arial"), RCView::a(array('class' => 'hide', 'style' => 'color:#fff;white-space:nowrap;text-decoration:none', 'href' => $url), "View Record"))))) . RCView::td(array('style' => 'padding-left:15px'), "To view this record, visit this link:" . RCView::br() . RCView::a(array('style' => "color:{$dark}", 'href' => $url), $url))))))))));
     $msg = "<HTML><head></head><body>" . $msg . "</body></html>";
     // Determine number of emails to send
     // Prepare message
     $email = new Message();
     $email->setTo($this->config['to']);
     $email->setFrom($this->config['from']);
     $email->setSubject($this->config['subject']);
     $email->setBody($msg);
     // Send Email
     if (!$email->send()) {
         error_log('Error sending mail: ' . $email->getSendError() . ' with ' . json_encode($email));
         exit;
     }
     //		error_log ('Email sent');
     // Add Log Entry
     $data_values = "title,{$title}\nrecord,{$this->record}\nevent,{$this->redcap_event_name}";
     REDCap::logEvent('AutoNotify Alert', $data_values);
 }
                    $intro_email_body.=$intro_body_msg[$i].'<br><br>';
                }
                $replace= array("[DATE]", "[employee name]","[emailid]","[designation]");
                $str_replaced  = array(date("d-m-Y"),'<b>'.$URSRC_firstname.'</b>', $loginid,'<b>'.$URSRC_designation.'</b>');
                $intro_message = str_replace($replace, $str_replaced, $intro_email_body);
                $cc_array=get_active_login_id();

                $intro_mail_options = [
                    "sender" =>$admin,
                    "to" => $cc_array,
                    "subject" => $intro_mail_subject,
                    "htmlBody" => $intro_message
                ];
                try {
                    $message1 = new Message($intro_mail_options);
                    $message1->send();
                } catch (\InvalidArgumentException $e) {
                    echo $e;
                }

            }
            $flag_array=[$flag];
            $con->commit();
            echo json_encode($flag_array);
        }
    }
    //ROLE CREATION ENTRY
    if($_REQUEST['option']=="URSRC_check_role_id"){
        $URSRC_roleid=$_GET['URSRC_roleidval'];
        $sql="SELECT * FROM ROLE_CREATION where RC_NAME='$URSRC_roleid'";
        $sql_result= mysqli_query($con,$sql);
Exemplo n.º 19
0
 public function sendMessage($hash)
 {
     $input = Input::only('message');
     Message::validate($input);
     $user = User::where('public_hash', '=', $hash)->firstOrFail();
     Message::send($user->user_fp, $input);
     return Response::jsonOk();
 }
Exemplo n.º 20
0
 /**
  * (AJAX) A jobs táblában módosítja az job_status mező értékét
  * 1 munka státuszát módosítja
  *
  * @return void
  */
 public function ajax_change_status()
 {
     if (Util::is_ajax()) {
         if (isset($_POST['action']) && isset($_POST['id'])) {
             $id = (int) $_POST['id'];
             $action = $_POST['action'];
             if ($action == 'make_active') {
                 $result = $this->jobs_model->change_status_query(array($id), 1);
                 if ($result['success'] == 1) {
                     $message = Message::send('A munka aktív státuszba került!');
                     echo json_encode(array("status" => 'success', "message" => $message));
                 } else {
                     $message = Message::send();
                     echo json_encode(array("status" => 'error', "message" => $message));
                 }
             }
             if ($action == 'make_inactive') {
                 $result = $this->jobs_model->change_status_query(array($id), 0);
                 if ($result['success'] == 1) {
                     $message = Message::send('A munka inaktív státuszba került!');
                     echo json_encode(array("status" => 'success', "message" => $message));
                 } else {
                     $message = Message::send('A munka státusza nem változott meg!');
                     echo json_encode(array("status" => 'error', "message" => $message));
                 }
             }
         } else {
             throw new Exception('Nincs $_POST["action"] es $_POST["id"]!!!');
         }
     } else {
         Util::redirect('error');
     }
 }
Exemplo n.º 21
0
                $Statement->execute(array($thumbnailUrl, $user["id"]));
                header("Location: " . $_SERVER["REQUEST_URI"]);
            } catch (Exception $e) {
                echo $e->getMessage();
            }
        }
    }
}
//Process the message reply form
if (isset($_POST["send_reply" . $messageCount])) {
    $Message = new Message($user["id"], $Database);
    //Instantiate the message class
    try {
        $Message->setReciever($_POST["sid" . $messageCount]);
        $Message->setText($_POST["message_text" . $messageCount]);
        $Message->send();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
    header("Location: " . $_SERVER["REQUEST_URI"]);
}
#####################################################
/**
 * Displays the html of the page based on the page settings
 */
if (!empty($user)) {
    //If the user is logged in
    require $baseDir . 'includes/templates/page_header.php';
} else {
    //If the user isn't logged in
    require $baseDir . 'includes/templates/public_page_header.php';
Exemplo n.º 22
0
    if (!$message->isNameValid()) {
        throw new Exception('Name field is too short.');
    }
    if (!$message->isEmailValid()) {
        throw new Exception('Email is not valid.');
    }
    if (!$message->isSubjectValid()) {
        throw new Exception('Subject field is too short.');
    }
    if (!$message->isMessageValid()) {
        throw new Exception('Message field is too short.');
    }
    if ((int) $_POST['captcha'] != $_SESSION['expected']) {
        throw new Exception('Captcha field is not valid.');
    }
    $message->send($emailAddresses);
    echo json_encode(array('status' => 'ok', 'log' => 'Mail sent.'));
} catch (Exception $ex) {
    $error = $ex->getMessage();
    echo json_encode(array('status' => 'fail', 'log' => $error));
}
/**
 * Class Message
 */
class Message
{
    var $name;
    var $email;
    var $subject;
    var $message;
    public function __construct($name, $email, $subject, $message)
Exemplo n.º 23
0
function sendActivation($mail, $name, $link, $html = true)
{
    Message::send(function ($message) use($mail, $name, $link, $html) {
        $message->to($mail);
        $message->from('*****@*****.**', 'KarelGroup DTM');
        $message->subject('KarelGroup DTM Üyelik Aktivasyonu');
        $message->body('view: email.activation');
        $message->body->name = $name;
        $message->body->link = $link;
        $message->body->sentdate = date("m/d/Y");
        $message->html($html);
    });
}
Exemplo n.º 24
0
 function msgSubmit($p)
 {
     Message::send($p['to'], $p['msg']);
     js_redirect('u/messages/inbox');
 }
Exemplo n.º 25
0
	/**
	 * @param $userid
	 * @param $headers
	 * @param $table_csv
	 * @param array $fields
	 * @param $parent_chkd_flds
	 * @param $export_file_name
	 * @param $debug
	 * @param null $comment
	 * @param array $to
	 */
	public static function do_sendit($userid, $headers, $table_csv, $fields = array(), $parent_chkd_flds, $export_file_name, $comment = null, $to = array(), $debug)
	{
		global $project_id, $user_rights, $app_title, $lang, $redcap_version; // we could use the global $userid, but we need control of it for setting the user as [CRON], so this is passed in args.
		$return_val = false;
		$export_type = 0; // this puts all files generated here in the Data Export category in the File Repository
		$today = date("Y-m-d_Hi"); //get today for filename
		$projTitleShort = substr(str_replace(" ", "", ucwords(preg_replace("/[^a-zA-Z0-9 ]/", "", html_entity_decode($app_title, ENT_QUOTES)))), 0, 20); // shortened project title for filename
		$originalFilename = $projTitleShort . "_" . $export_file_name . "_DATA_" . $today . ".csv"; // name the file for storage
		$today = date("Y-m-d-H-i-s"); // get today for comment, subsequent processing as needed
		$docs_comment_WH = $export_type ? "Data export file created by $userid on $today" : fix_case($export_file_name) . " file created by $userid on $today. $comment"; // unused, but I keep it around just in case
		/**
		 * setup vars for value export logging
		 */
		$chkd_fields = implode(',', $fields);
		/**
		 * turn on/off exporting per user rights
		 */
		if (($user_rights['data_export_tool'] || $userid == '[CRON]') && !$debug) {
			$table_csv = addBOMtoUTF8($headers . $table_csv);
			/**
			 * Store the file in the file system and log the activity, handle if error
			 */
			if (!DataExport::storeExportFile($originalFilename, $table_csv, true)) {
				log_event("", "redcap_data", "data_export", "", str_replace("'", "", $chkd_fields) . (($parent_chkd_flds == "") ? "" : ", " . str_replace("'", "", $parent_chkd_flds)), "Data Export Failed");
			} else {
				log_event("", "redcap_data", "data_export", "", str_replace("'", "", $chkd_fields) . (($parent_chkd_flds == "") ? "" : ", " . str_replace("'", "", $parent_chkd_flds)), "Export data for SendIt");
				/**
				 * email file link and download password in two separate emails via REDCap SendIt
				 */
				$file_info_sql = db_query("SELECT docs_id, docs_size, docs_type FROM redcap_docs WHERE project_id = $project_id ORDER BY docs_id DESC LIMIT 1"); // get required info about the file we just created
				if ($file_info_sql) {
					$docs_id = db_result($file_info_sql, 0, 'docs_id');
					$docs_size = db_result($file_info_sql, 0, 'docs_size');
					$docs_type = db_result($file_info_sql, 0, 'docs_type');
				}
				$yourName = 'PRIORITIZE REDCap';
				$expireDays = 3; // set the SendIt to expire in this many days
				/**
				 * $file_location:
				 * 1 = ephemeral, will be deleted on $expireDate
				 * 2 = export file, visible only to rights in file repository
				 */
				$file_location = 2;
				$send = 1; // always send download confirmation
				$expireDate = date('Y-m-d H:i:s', strtotime("+$expireDays days"));
				$expireYear = substr($expireDate, 0, 4);
				$expireMonth = substr($expireDate, 5, 2);
				$expireDay = substr($expireDate, 8, 2);
				$expireHour = substr($expireDate, 11, 2);
				$expireMin = substr($expireDate, 14, 2);

				// Add entry to sendit_docs table
				$query = "INSERT INTO redcap_sendit_docs (doc_name, doc_orig_name, doc_type, doc_size, send_confirmation, expire_date, username,
					location, docs_id, date_added)
				  VALUES ('$originalFilename', '" . prep($originalFilename) . "', '$docs_type', '$docs_size', $send, '$expireDate', '" . prep($userid) . "',
					$file_location, $docs_id, '" . NOW . "')";
				db_query($query);
				$newId = db_insert_id();

				$logDescrip = "Send file from file repository (Send-It)";
				log_event($query, "redcap_sendit_docs", "MANAGE", $newId, "document_id = $newId", $logDescrip);

				// Set email subject
				$subject = "[PRIORITIZE] " . $comment;
				$subject = html_entity_decode($subject, ENT_QUOTES);

				// Set email From address
				$from = array('Ken Bergquist' => '*****@*****.**');

				// Begin set up of email to send to recipients
				$email = new Message();
				foreach ($from as $name => $address) {
					$email->setFrom($address);
					$email->setFromName($name);
				}
				$email->setSubject($subject);

				// Loop through each recipient and send email
				foreach ($to as $name => $address) {
					// If a non-blank email address
					if (trim($address) != '') {
						// create key for unique url
						$key = strtoupper(substr(uniqid(md5(mt_rand())), 0, 25));

						// create password
						$pwd = generateRandomHash(8, false, true);

						$query = "INSERT INTO redcap_sendit_recipients (email_address, sent_confirmation, download_date, download_count, document_id, guid, pwd)
						  VALUES ('$address', 0, NULL, 0, $newId, '$key', '" . md5($pwd) . "')";
						$q = db_query($query);

						// Download URL
						$url = APP_PATH_WEBROOT_FULL . 'redcap_v' . $redcap_version . '/SendIt/download.php?' . $key;

						// Message from sender
						$note = "$comment for $today";
						// Get YMD timestamp of the file's expiration time
						$expireTimestamp = date('Y-m-d H:i:s', mktime($expireHour, $expireMin, 0, $expireMonth, $expireDay, $expireYear));

						// Email body
						$body = "<html><body style=\"font-family:Arial;font-size:10pt;\">
							$yourName {$lang['sendit_51']} \"$originalFilename\" {$lang['sendit_52']} " .
							date('l', mktime($expireHour, $expireMin, 0, $expireMonth, $expireDay, $expireYear)) . ",
							" . DateTimeRC::format_ts_from_ymd($expireTimestamp) . "{$lang['period']}
							{$lang['sendit_53']}<br><br>
							{$lang['sendit_54']}<br>
							<a href=\"$url\">$url</a><br><br>
							$note
							<br>-----------------------------------------------<br>
							{$lang['sendit_55']} " . CONSORTIUM_WEBSITE_DOMAIN . ".
							</body></html>";

						// Construct email and send
						$email->setTo($address);
						$email->setToName($name);
						$email->setBody($body);
						if ($email->send()) {
							// Now send follow-up email containing password
							$bodypass = "******"font-family:Arial;font-size:10pt;\">
								{$lang['sendit_50']}<br><br>
								$pwd<br><br>
								</body></html>";
							$email->setSubject("Re: $subject");
							$email->setBody($bodypass);
							sleep(2); // Hold for a second so that second email somehow doesn't reach the user first
							$email->send();
						} else {
							error_log("ERROR: pid=$project_id: Email to $name <$address> NOT SENT");
						}

					}
				}
			}
			unset($table_csv);
		}
	}
Exemplo n.º 26
0
	$conversationID = $_POST['conversation'];
	$body = $_POST['body'];

	if(!isset($body))
	{
		$response['data']['reason'] = "No body.";
		sendResponse(400, json_encode($response)); return false;
	}
	
	//Check body
	$body = strip_tags($body);
	
	//OK
	require_once('/var/www/html/api/conversation/obj/Conversation.php');
	$Conversation = new Conversation($conversationID, $PDOconn);
	if(!$Conversation->exists)
	{
		$response['data']['reason'] = "The conversation doesn't exist.";
		sendResponse(400, json_encode($response)); return false;
	}

	$Message = new Message(NULL, $PDOconn);
	$Message->send($User->ID, $Conversation->ID, $body);

	//Set the status to 1 (success)
	$response['meta']['status'] = 1;

	//Send the response
	sendResponse(200, json_encode($response));
	return true;
?>
		$to = array(
			'Ken Bergquist' => '*****@*****.**',
			'Lasheaka McClellan' => '*****@*****.**',
			'Tyre Johnson' => '*****@*****.**',
			'Dona-Marie Mintz' => '*****@*****.**',
			'Nicholas Slater' => '*****@*****.**'
		);
		//$to = array('Ken Bergquist' => '*****@*****.**');
		$from = array('Ken Bergquist' => '*****@*****.**');
		$subject = "HCV-TARGET 2 Site Source Upload Notification";
		$email = new Message ();
		foreach ($from as $name => $address) {
			$email->setFrom($address);
			$email->setFromName($name);
		}
		$email->setSubject($subject);
		$email->setBody($html);
		foreach ($to as $name => $address) {
			$email->setTo($address);
			$email->setToName($name);
			if (!$debug) {
				if (!$email->send()) {
					error_log("ERROR: Failed to send Site Source Upload digest");
				}
			}
		}
		d($email);
	} else {
		error_log("NOTICE: No site source uploads were available to be digested");
	}
}
Exemplo n.º 28
0
$sess->CheckValidFBSession();
if (!$sess->CheckValidSession()) {
    // Validates Session
    $sess->Login();
}
$log = new log($_SERVER["PHP_SELF"]);
$db = new Database();
// Creates database object
if (!$db->connect()) {
    echo "<p>Error connecting to the database</p>";
}
$message = new Message();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    extract($_POST);
    if ($send == "Send") {
        $message->send($uid, $subject, $text);
        FBData::updatecount($uid);
    }
    header("Location: viewmessages.php?id=" . $uid);
}
$id = $sess->Retrieve('id');
$profile = new Profile($id);
?>
<title>TheFacebook |  View Messages</title> 
<link rel="stylesheet" href="style.css"> 
<link rel="shortcut icon" href="favicon.ico"> 


<center>

<table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700>
Exemplo n.º 29
0
 public function send($to, $message)
 {
     if (!$this->username) {
         return array('r' => 'error', 'e' => 'no session found');
     }
     $message = $this->_sanitize($message);
     $to = User::find($to);
     if (!$to) {
         return array('r' => 'error', 'e' => 'no_recipient');
     }
     if (Message::send($this->user_id, $to->user_id, $message)) {
         return array('r' => 'sent');
     } else {
         return array('r' => 'error', 'e' => 'send error');
     }
 }
Exemplo n.º 30
0
 public function post_message($city, $id)
 {
     $rules = array('name' => 'required|min:3', 'fmail' => 'required|email', 'message' => 'required|min:30', 'captchatest' => 'laracaptcha|required');
     $messages = array('name_required' => 'Vul je naam in', 'name_min' => 'Dat is wel een erg korte naam', 'fmail_required' => 'Vul je emailadres in', 'fmail_email' => 'Dit is geen geldig emailadres', 'message_required' => 'Je bent vergeten de reactie te schrijven', 'message_min' => 'Dat is wel een erg korte reactie', 'captchatest_laracaptcha' => 'De tekens komen niet overeen', 'captchatest_required' => 'Typ de tekens over');
     $v = Validator::make(Input::all(), $rules, $messages);
     if ($v->fails()) {
         return Redirect::to('kamer-huren/' . $city . '/' . $id)->with_errors($v)->with_input();
     } else {
         $room = Room::where_id($id)->first();
         $name = ucwords(Input::get('name'));
         $femail = Input::get('fmail');
         $fmessage = Input::get('message');
         Message::send(function ($message) use($room, $name, $femail, $fmessage) {
             $message->to($room->email);
             $message->from($femail, $name);
             $message->subject('Kamergenood: Iemand heeft op de kamer gereageerd');
             $message->body('view: emails.message');
             $message->body->name = $name;
             $message->body->id = $room->id;
             $message->body->title = $room->title;
             $message->body->message = $fmessage;
             $message->body->url = $room->url;
             $message->html(true);
         });
         if (Input::get('copy') == 1) {
             Message::send(function ($message) use($room, $name, $femail, $fmessage) {
                 $message->to($femail);
                 $message->from('*****@*****.**', 'Kamergenood');
                 $message->subject('Kamergenood: Kopie van jou reactie');
                 $message->body('view: emails.message_copy');
                 $message->body->name = $name;
                 $message->body->title = $room->title;
                 $message->body->message = $fmessage;
                 $message->html(true);
             });
         }
         if (Message::was_sent()) {
             return Redirect::to('kamer-huren/' . $city . '/' . $id)->with('msg', '<div id="successModal" class="modal hide" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3 id="myModalLabel">Je reactie is succesvol verstuurd!</h3></div><div class="modal-body"><p><strong>De reactie is succesvol verstuurd.</strong></p><p>De verhuurder krijgt de reactie in een mailtje met jouw e-mailadres als afzender. Vanaf nu staan jullie direct met elkaar in contact.</p></div><div class="modal-footer"><button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Ok, sluit venster</button></div></div>');
         }
     }
 }