function parsePusher($to, $insertedid, $message, $isChatroom = '0')
{
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
    global $userid;
    if ($isChatroom === '0') {
        $rawMessage = array("name" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => $message, "sent" => $insertedid);
        if (strlen($insertedid) < 13) {
            $rawMessage['id'] = $insertedid;
        }
        $channel = $_SERVER['HTTP_HOST'] . "USER_" . $to;
    } else {
        $parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $_SESSION['cometchat']['chatroom']['n'] . ": " . $message;
        if (strpos($message, "has shared a file") !== false) {
            $parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $_SESSION['cometchat']['chatroom']['n'] . ": " . "has shared a file";
        }
        $rawMessage = array("id" => $insertedid, "from" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => sanitize($parse_message), "sent" => $insertedid, "cid" => $to);
        $channel = $_SERVER['HTTP_HOST'] . "CHATROOM_" . $to;
    }
    $parse = new Parse();
    $parse->sendNotification($channel, $rawMessage, $isChatroom);
}
Ejemplo n.º 2
0
function parsePusher($to, $insertedid, $message, $isChatroom = '0')
{
    $emojiUTF8 = (include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "emoji_notification.php");
    if (strpos($message, 'cometchat_smiley') !== false) {
        preg_match_all('/<img[^>]+\\>/i', $message, $matches);
        for ($i = 0; $i < sizeof($matches[0]); $i++) {
            $msgpart = explode('/images/smileys/', $matches[0][$i]);
            $imagenamearr = explode('"', $msgpart[1]);
            $imagename = $imagenamearr[0];
            $smileynamearr = explode('.', $imagename);
            $smileyname = $smileynamearr[0];
            if (!empty($imagename) && !empty($emojiUTF8[$imagename])) {
                $message = str_replace($matches[0][$i], $emojiUTF8[$imagename], $message);
            } else {
                $message = str_replace($matches[0][$i], ':' . $smileyname . ':', $message);
            }
        }
    }
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
    global $userid;
    global $channelprefix;
    if ($isChatroom === '0') {
        $rawMessage = array("name" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => $message, "sent" => $insertedid);
        if (strlen($insertedid) < 13) {
            $rawMessage['id'] = $insertedid;
        }
        $channel = md5($channelprefix . "USER_" . $to . BASE_URL);
    } else {
        $chatroom_name = base64_decode($_SESSION['cometchat']['chatroom']['n']);
        $parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $chatroom_name . ": " . $message;
        if (strpos($message, "has shared a file") !== false) {
            $parse_message = $_SESSION['cometchat']['user']['n'] . "@" . $chatroom_name . ": " . "has shared a file";
        }
        $rawMessage = array("id" => $insertedid, "from" => $_SESSION['cometchat']['user']['n'], "fid" => $userid, "m" => sanitize($parse_message), "sent" => $insertedid, "cid" => $to);
        $channel = md5($channelprefix . "CHATROOM_" . $to . BASE_URL);
    }
    $parse = new Parse();
    $parse->sendNotification($channel, $rawMessage, $isChatroom);
}
Ejemplo n.º 3
0
function parsePusherAnn($zero, $sent, $message, $isAnnouncement = '0', $insertedid)
{
    global $userid;
    if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php")) {
        include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "mobileapp" . DIRECTORY_SEPARATOR . "parse_push.php";
        $announcementpushchannel = '';
        if (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php")) {
            include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php";
        }
        if (!empty($isAnnouncement)) {
            $rawMessage = array("m" => $message, "sent" => $sent, "id" => $insertedid);
        }
        $parse = new Parse();
        $parse->sendNotification($announcementpushchannel, $rawMessage, 0, 1);
    }
}