Ejemplo n.º 1
0
 * License: http://www.bluethrust.com/license.php
 *
 */
include_once "../../classes/chatroom.php";
if (!isset($member) || !isset($eventObj) || substr($_SERVER['PHP_SELF'], -strlen("manage.php")) != "manage.php") {
    exit;
} else {
    // This is a little repeatative, but for security.
    $memberInfo = $member->get_info();
    $consoleObj->select($cID);
    if (!$member->hasAccess($consoleObj) || !$eventObj->select($eID)) {
        exit;
    }
    $eventInfo = $eventObj->get_info_filtered();
}
if ($eventInfo['member_id'] != $memberInfo['member_id'] && !in_array($memberInfo['member_id'], $eventObj->getInvitedMembers(true))) {
    echo "\n\t\t<script type='text/javascript'>\n\t\t\twindow.location = '" . $MAIN_ROOT . "members';\n\t\t</script>\n\t";
    exit;
}
$eventChatObj = new ChatRoom($mysqli);
$eventChatID = $eventObj->chatRoomStarted();
if ($eventChatID === false && $memberInfo['member_id'] != $eventInfo['member_id']) {
    echo "\n\t\t<div style='display: none' id='successBox'>\n\t\t\t<p align='center'>\n\t\t\t\tAn event chat room has not been created.  The event creator must start one!\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\tpopupDialog('Event Chatroom', '" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&select=" . $eventInfo['event_id'] . "', 'successBox');\n\t\t</script>\n\t";
    exit;
} elseif ($eventChatID === false && $memberInfo['member_id'] == $eventInfo['member_id']) {
    $eventChatObj->addNew(array("event_id", "datestarted"), array($eventInfo['event_id'], time()));
    $eventObj->notifyEventInvites("A chatroom has been started for the event, <a href='" . $MAIN_ROOT . "members/events/manage.php?eID=" . $eventInfo['event_id'] . "&pID=Chat'>" . $eventInfo['title'] . "</a>!");
} elseif ($eventChatObj->select($eventChatID)) {
    $eventChatInfo = $eventChatObj->get_info_filtered();
}
echo "\n\n<script type='text/javascript'>\n\$(document).ready(function() {\n\$('#breadCrumbTitle').html(\"Chat\");\n\$('#breadCrumb').html(\"<a href='" . $MAIN_ROOT . "'>Home</a> > <a href='" . $MAIN_ROOT . "members'>My Account</a> > <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&select=" . $eventInfo['event_id'] . "'>" . $consoleTitle . "</a> > <b>" . $eventInfo['title'] . ":</b> Chat\");\n});\n</script>\n\n\n\n<div class='eventChatContainer'>\n\n\t\n\t<div style='position: relative; margin-left: 5px; margin-bottom: 5px'>\n\t\t<div class='main' style='display: table-cell; vertical-align: middle'>Auto-scroll:</div>\n\t\t<div style='display: table-cell; vertical-align: middle'><input type='checkbox'></div>\n\t</div>\n\t\n\t<div style='clear: both'></div>\n\t<div class='eventChatRoom'></div>\n\t\n\t<div class='eventChatList'></div>\n\t<div style='clear: both'></div>\n\t<div class='chatTextBoxContainer'>\n\t\t<div style='float: left; width: 85%'><textarea class='textBox'></textarea></div><div style='float: right; width: 10%'><input type='button' class='submitButton' value='Chat'></div>\n\t\n\t</div>\n\t\n</div>\n\n\n\n<div id='jsDump' style='display: none'></div>\n\n<script type='text/javascript'>\n\n\tfunction updateChat() {\n\t\n\t\t\$(document).ready(function() {\n\t\t\n\t\t\t\$.post('" . $MAIN_ROOT . "members/events/include/updatechat.php', { ecID: '" . $eventChatInfo['eventchat_id'] . "' }, function(data) {\n\t\t\t\n\t\t\t\t\$('#jsDump').html(data);\n\t\t\t\n\t\t\t});\n\t\t\n\t\t});\n\t\n\t}\n\n</script>\n";