<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.org/licence */ $user = $params['user']; if (OssnChat::getChatUserStatus($user->guid) == 'online') { $status = 'ossn-chat-icon-online'; } else { $status = 'ossn-chat-icon-offline'; } $messages = ossn_chat()->getNew($user->guid, ossn_loggedin_user()->guid); $total = ''; if ($messages) { $total = get_object_vars($messages); $total = count($total); } $tab_class = ''; $style = ''; if ($total > 0) { $tab_class = 'ossn-chat-tab-active'; $style = 'style="display:block;"'; } ?> <!-- Item -->
foreach ($messages as $message) { if (ossn_loggedin_user()->guid == $message->message_from) { $vars['message'] = $message->message; $vars['time'] = $message->time; $messageitem = ossn_view('components/OssnChat/views/OssnChat/message-item-send', $vars); } else { $vars['reciever'] = ossn_user_by_guid($message->message_from); $vars['message'] = $message->message; $vars['time'] = $message->time; $messageitem = ossn_view('components/OssnChat/views/OssnChat/message-item-received', $vars); } $total = get_object_vars($messages); $new_messages[] = array('fid' => $friend, 'message' => $messageitem, 'total' => count($total)); } } if (OssnChat::getChatUserStatus($friend, 10) == 'online') { $status = 'ossn-chat-icon-online'; } else { $status = 'ossn-chat-icon-offline'; } $construct_active[$friend] = array('status' => $status); } } $api = json_encode(array('active_friends' => $construct_active, 'allfriends' => $allfriends, 'friends' => array('online' => ossn_chat()->countOnlineFriends('', 10), 'data' => ossn_view('components/OssnChat/views/OssnChat/friendslist')), 'newmessages' => $new_messages, 'all_new' => $new_all)); echo 'var OssnChat = '; echo preg_replace('/[ ]{2,}/', ' ', $api); echo ';'; ?> /**