public function updateConversationList($userID, $buddyID) { global $db; //Getting Conversation List $convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array(); //Getting the users that sent new messages not in the conversation list $newMessages = BuckysPrivateMessenger::getMessages($userID, $buddyID, 'new'); foreach ($newMessages as $row) { if (!in_array($row['userID'], $convList)) { $convList[] = $row['userID']; } } $_SESSION['converation_list'] = $convList; }
/** * Load Private Messenger * */ function loadMessenger() { global $db, $userID; //Getting Friends from the Buddy List $messengerSettings = BuckysUser::getUserBasicInfo($userID); $uIDs = array(); //Return HTML ob_start(); ?> <div id="private_messenger_main_wrap"> <div class="box_nav_row"> <a href="#" class="close_box_link"> </a> <!-- <a href="#" class="minimize_box_link"> </a>--> </div> <h2>Private Messenger</h2> <div class="chat_user_list" id="private_messenger_buddies_list"> <?php echo BuckysPrivateMessenger::getUserListHTML($userID, $uIDs); ?> </div> <div class="below_chat_user_list <?php if ($messengerSettings['messenger_privacy'] == 'all') { ?> add-user-to-buddylist-hidden<?php } ?> " id="add-user-to-buddylist"> <form name="adduserform" id="adduserform"> <h2>Add Friends</h2> <span id="add-user-to-buddylist-inputholder"> <input type="text" class="input below_chat_user_list_input" id="add-user-to-buddylist-input" /> <input type="submit" value="Add" class="redButton" /> </span> <!-- <div id="selected-users-list"></div>--> <div class="clear"></div> <?php echo render_loading_wrapper(); ?> </form> </div> <div class="below_chat_user_list" id="messenger_btn_box"> <span><input type="button" id="settings_messenger_btn" class="redButton" value="Settings"></span> </div> </div> <?php BuckysPrivateMessenger::updateConversationList($userID, $uIDs); $convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array(); ?> <div id="private_messenger_conversation_wrap" <?php if (!buckys_not_null($convList)) { ?> style="display: none;"<?php } ?> > <div class="box_nav_row"> <a href="#" class="close_box_link"> </a> <a href="#" class="minimize_box_link"> </a> <div href="#" class="options_link" id="private-messenger-options-link"> Options <ul> <li><a href="#" id="pm-box-clear-history-link">Clear history</a></li> <li><a href="#" id="pm-box-block-user-link">Block User</a></li> </ul> </div> </div> <div id="private_messenger_conversation_lft"> <div id="private_messenger_opened_chats"> <?php foreach ($convList as $i => $uID) { $tUInfo = BuckysUser::getUserBasicInfo($uID); ?> <a href="#" data-id="<?php echo $uID; ?> " <?php if ($i == 0) { ?> class="actived"<?php } ?> data-encrypted="<?php echo buckys_encrypt_id($uID); ?> "><?php echo $tUInfo['firstName'] . " " . $tUInfo['lastName']; ?> <span title="close" class="close-conversation">X</span></a><?php } ?> </div> </div> <div id="private_messenger_conversation_rgt"> <?php foreach ($convList as $i => $uID) { $tUInfo = BuckysUser::getUserBasicInfo($uID); ?> <div class="private_messenger_conversation_contr" <?php if ($i > 0) { ?> style="display: none;"<?php } ?> id="private_messenger_conversation_contr<?php echo $uID; ?> "> <?php echo BuckysPrivateMessenger::getMessagesHTML($userID, $uID, 'all'); ?> </div> <?php } ?> <div id="private_messenger_send_message_contr"> <form name="newmessageform" id="newmessageform" action="" method="post"> <input class="under_private_message_conversation_area_input" id="new_private_message" class="input" type="text" /> </form> </div> </div> <div class="clear"></div> </div> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
<label for="messenger_privacy_all"><input type="radio" name="messenger_privacy" id="messenger_privacy_all" <?php if ($userBasicInfo['messenger_privacy'] == 'all') { ?> checked="checked"<?php } ?> value="all"/> Everyone except the people on my blocklist</label> <div id="block-lists"> <label>Block List:</label> <span class="btn-row" id="blocked-users"><input type="text" id="block-username" class="input"/><input type="submit" value="Add" class="redButton"/></span> <?php $blockList = BuckysPrivateMessenger::getBlockLists($userID); ?> <ul id="block_list"> <?php foreach ($blockList as $row) { ?> <li data-id="<?php echo $row['userID']; ?> "> <img src="<?php echo BuckysUser::getProfileIcon($row); ?> "/> <?php echo $row['name']; ?>