Beispiel #1
0
 function sendTestMessage($message, $mobilenumber)
 {
     $url = "http://www.smscountry.com/SMSCwebservice_Bulk.aspx";
     $user = SMS_USERNAME;
     $password = SMS_PASSWORD;
     $senderid = SENDER_ID;
     $messagetype = MESSAGE_TYPE;
     $DReports = DELIVERY_REPORT;
     $ch = curl_init();
     if (!$ch) {
         die("Couldn't initialize a cURL handle");
     }
     $ret = curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_POSTFIELDS, "User={$user}&passwd={$password}&mobilenumber={$mobilenumber}&message={$message}&sid={$senderid}&mtype={$messagetype}&DR={$DReports}");
     $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $curlresponse = curl_exec($ch);
     if (empty($ret)) {
         die(curl_error($ch));
         curl_close($ch);
     } else {
         $status = 'pending';
         if (strpos($curlresponse, 'OK') !== false) {
             $status = 'delivered';
         }
         $status = "http://www.smscountry.com/SMSCwebservice_Bulk.aspx?User={$user}&passwd={$password}&mobilenumber={$mobilenumber}&message={$message}&sid={$senderid}&mtype={$messagetype}&DR={$DReports}";
         saveMessage($message, $recipient_name, $mobilenumber, $type, $status);
         $info = curl_getinfo($ch);
         curl_close($ch);
     }
 }
 /**
  * Read new messages.
  *
  * @todo Get proper objects from TelegramClient.
  */
 function readNewMessages($limit = 0)
 {
     $list = $this->readMessages($limit);
     foreach ($list as $index => $message) {
         $message->type = 'incoming';
         $this - saveMessage($message);
     }
     return $list;
 }
Beispiel #3
0
$cid = mosGetParam($_REQUEST, 'cid', array(0));
if (!is_array($cid)) {
    $cid = array(0);
}
switch ($task) {
    case "view":
        viewMessage($cid[0], $option);
        break;
    case "new":
        newMessage($option, NULL, NULL);
        break;
    case "reply":
        newMessage($option, mosGetParam($_REQUEST, 'userid', 0), mosGetParam($_REQUEST, 'subject', ''));
        break;
    case "save":
        saveMessage($option);
        break;
    case "remove":
        removeMessage($cid, $option);
        break;
    case "config":
        editConfig($option);
        break;
    case "saveconfig":
        saveConfig($option);
        break;
    default:
        showMessages($option);
        break;
}
function editConfig($option)
Beispiel #4
0
<?php

/* For licensing terms, see /license.txt */
/**
 * Responses to AJAX calls
 */
$_dont_save_user_course_access = true;
require_once '../global.inc.php';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
if (api_is_anonymous()) {
    exit;
}
// Course Chat
if ($action == 'preview') {
    require_once api_get_path(SYS_CODE_PATH) . 'chat/chat_functions.lib.php';
    echo saveMessage($_REQUEST['message'], api_get_user_id(), api_get_course_info(), api_get_session_id(), api_get_group_id(), true);
}
if (api_get_setting('allow_global_chat') == 'false') {
    exit;
}
$to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
if (!isset($_SESSION['chatHistory'])) {
    $_SESSION['chatHistory'] = array();
}
if (!isset($_SESSION['openChatBoxes'])) {
    $_SESSION['openChatBoxes'] = array();
}
$chat = new Chat();
if (chat::disableChat()) {
    exit;
Beispiel #5
0
<?php

require_once 'connect.php';
//Dog
//get users phone
$phone = $_REQUEST['from'];
createUser($phone);
//get users message
$message = $_REQUEST['message'];
$result = checkForMessage($message, $phone);
saveMessage($message, $phone);
//check if the users message is dog
if (trim(strtolower($message)) == 'dog') {
    $reply = "A dog is a domestic animal";
} else {
    $reply = "We don't know what animal that is";
}
sendOutput($reply, $phone);
exit;
function createUser($phone)
{
    //check if the phone number exists
    $query = mysql_query("SELECT phone FROM users WHERE phone='{$phone}'");
    if (mysql_num_rows($query) > 0) {
        //do nothing
    } else {
        //create the user
        $query = mysql_query("INSERT INTO users (phone) VALUES ('{$phone}')");
    }
    return $query;
}
<?php
if(issetSessionVariable('user_level')){
	if(getSessionVariable('user_level') >= RES_USERLEVEL_ADMIN){
	
		
	
	}
	else{
		echo "Error: You don't have permissions to access this page!";
		die("");
		
	}
	
}
else{
	echo "Error: You don't have permissions to access this page!";
	die("");
}
if($pageid == "messages"){
	$messages = getAllMessages();
	
	$select = "<select name=\"messageid\">";
	
	while($row = mysql_fetch_assoc($messages)){
	
		$select = $select . "<option value=\"".$row['message_id']."\">".$row['start_date']." to ".$row['end_date']." - Priority ".$row['priority']."</option>";
	
	}
	
	$select = $select . "</select>";
// Mode open in a new window: close the window when there isn't an user login
if (empty($userId)) {
    echo '<script languaje="javascript" type="text/javascript"> close_chat_window(); </script>';
} else {
    api_protect_course_script();
}
if (empty($course) || empty($userId)) {
    exit;
}
/*	Constants and variables */
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sent = isset($_REQUEST['sent']) ? $_REQUEST['sent'] : null;
require 'header_frame.inc.php';
$chat_size = 0;
if ($sent) {
    saveMessage($_POST['message'], $userId, $_course, $session_id, $group_id, false);
}
?>
<form
    id="formMessage"
    name="formMessage"
    method="post"
    action="<?php 
echo api_get_self() . '?' . api_get_cidreq();
?>
" onsubmit="javascript: if(document.formMessage.message.value == '') { alert('<?php 
echo addslashes(api_htmlentities(get_lang('TypeMessage'), ENT_QUOTES));
?>
'); document.formMessage.message.focus(); return false; }"
    autocomplete="off"
>
Beispiel #8
0
function processMessage($message)
{
    // process incoming message
    $message_id = $message['message_id'];
    $chat_id = $message['chat']['id'];
    // Process only specified channel
    if ($chat_id !== CHAT_ID) {
        return false;
    }
    if (isset($message['text'])) {
        saveMessage($message);
        // Do not send responses
        return;
        // incoming text message
        $text = $message['text'];
        if (strpos($text, "/start") === 0) {
            apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Hello', 'reply_markup' => array('keyboard' => array(array('Hello', 'Hi')), 'one_time_keyboard' => true, 'resize_keyboard' => true)));
        } else {
            if ($text === "Hello" || $text === "Hi") {
                apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'Nice to meet you'));
            } else {
                if (strpos($text, "/stop") === 0) {
                    // stop now
                } else {
                    apiRequestWebhook("sendMessage", array('chat_id' => $chat_id, "reply_to_message_id" => $message_id, "text" => 'Cool'));
                }
            }
        }
    } else {
        apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'I understand only text messages'));
    }
}
Beispiel #9
0
<?php

session_start();
require "database/connect.php";
require "database/employees.php";
require "database/messages.php";
require "database/users.php";
require "includes/common.php";
if ($_POST["procedure"] == "Send") {
    if ($_POST["pm"] == "on") {
        saveMessage($_POST["userID"], $_POST["subject"], $_POST["message"], $_SESSION["id"], $_SESSION["username"], 0, 0);
    }
    if ($_POST["email"] == "on") {
        loadUser($_POST["userID"]);
        $subject = $_POST["subject"];
        $body = $_POST["message"];
        $from = $_SESSION["username"];
        if (mail($emp_email, $subject, $body, "From: " . $from . "\n")) {
            //echo("<p>Email successfully sent.</p>");
        } else {
            //echo("<p>Email delivery failed.</p>");
        }
    }
    header('Location: inbox.php');
}
$pageTitle = "Main";
$javascript = "message.js";
if ($_SESSION["type"] == "3") {
    require 'includes/adminHeader.php';
} else {
    require 'includes/userHeader.php';
Beispiel #10
0
}
switch ($action) {
    case 'signup':
        signup($pdo);
        break;
    case 'signin':
        signin($data, $pdo);
        break;
    case 'signout':
        signout();
        break;
    case 'getTargetData':
        getTargetData($pdo);
        break;
    case 'saveMessage':
        saveMessage($data, $pdo);
        break;
}
function signup($pdo)
{
    $targetDir = $_SERVER['DOCUMENT_ROOT'] . "/images/";
    $targetFile = $targetDir . basename($_FILES["image"]["name"]);
    $uploadOk = 1;
    $imageFileType = pathinfo($targetFile, PATHINFO_EXTENSION);
    // Check if image file is a actual image or fake image
    if (isset($_POST["submit"])) {
        $check = getimagesize($_FILES["image"]["tmp_name"]);
        if ($check !== false) {
            $uploadOk = 1;
        } else {
            $uploadOk = 0;
Beispiel #11
0
<?php

include_once "functions.php";
$nome = $_POST['nome'];
$email = $_POST['email'];
$tel = $_POST['tel'];
$assunto = $_POST['assunto'];
$mensagem = $_POST['mensagem'];
$obj = ["nome" => $nome, "email" => $email, "telefone" => $tel, "assunto" => $assunto, "mensagem" => $mensagem, "data" => date("d/m/Y - H:i")];
saveMessage($obj);
echo "<script>alert('Mensagem enviada com sucesso!');\n            window.open('contato.html', '_self');\n            </script>";
        } else {
            if ($pageid == "createmessage") {
                require 'adminfunctions.php';
                $startdate = $_POST['startdate'];
                $enddate = $_POST['enddate'];
                $priority = $_POST['priority'];
                $body = $_POST['body'];
                addMessage(getSessionVariable('user_id'), $startdate, $enddate, $priority, $body);
                echo "<center><h3>New Message Created!</h3></center>";
            } else {
                if ($pageid == "savemessage") {
                    require 'adminfunctions.php';
                    $messageid = $_POST['messageid'];
                    $startdate = $_POST['startdate'];
                    $enddate = $_POST['enddate'];
                    $priority = $_POST['priority'];
                    $body = $_POST['body'];
                    saveMessage($messageid, getSessionVariable('user_id'), $startdate, $enddate, $priority, $body);
                    echo "<center><h3>Message Saved!</h3></center>";
                } else {
                    if ($pageid == "deletemessage") {
                        require 'adminfunctions.php';
                        $messageid = $_POST['messageid'];
                        deleteMessage($messageid);
                        echo "<center><h3>Message Deleted</h3></center>";
                    }
                }
            }
        }
    }
}