Example #1
0
    function getChat($uid, $user)
    {
        global $LNG, $CONF;
        $output = '<div class="message-container">
						<div class="message-content">
							<div class="message-form-header">
								<div class="message-form-user"><img src="' . $this->url . '/' . $CONF['theme_url'] . '/images/icons/chat.png"></div>
								<span class="chat-username">' . (empty($user['username']) ? $LNG['conversation'] : realName($user['username'], $user['first_name'], $user['last_name'])) . '</span><span class="blocked-button">' . $this->getBlocked($uid) . '</span>
								<div class="message-loader" style="display: none"><img src="' . $this->url . '/' . $CONF['theme_url'] . '/images/preloader.gif"></div>
							</div>
							<div class="chat-container">
								' . (empty($user['username']) ? $this->chatError($LNG['start_conversation']) : $this->getChatMessages($uid)) . '
							</div>
							<div class="message-divider"></div>

							<div class="chat-form-inner"><input id="chat" class="chat-user' . $uid . '" placeholder="' . $LNG['write_message'] . '" name="chat" /></div>
						</div>	
					</div>' . audioContainer('Chat', $this->sound_new_chat);
        return $output;
    }
Example #2
0
function menu($user)
{
    global $CONF, $settings, $LNG;
    if ($user !== false) {
        // If the result is not 0 (int) then show the menu
        return '
		<a href="' . $CONF['url'] . '/index.php?a=feed&logout=1"><div class="menu_btn tooltipz" data-title="' . $LNG['log_out'] . '"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/logout.png" /></div></a>
		<a onclick="showNotification(\'\', \'1\')"><div class="menu_btn tooltipz" id="notifications_btn" data-title="' . $LNG['title_notifications'] . '"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/notification.png" id="notifications_img" /></div></a>
		<a href="' . $CONF['url'] . '/index.php?a=messages" id="messages_url"><div class="menu_btn tooltipz" id="messages_btn" data-title="' . $LNG['title_messages'] . '"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/message.png" /></div></a>
		<a href="' . $CONF['url'] . '/index.php?a=timeline"><div class="menu_btn tooltipz" data-title="' . $LNG['title_timeline'] . '"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/timeline.png" /></div></a>
		<a href="' . $CONF['url'] . '/index.php?a=feed"><div class="menu_btn tooltipz" data-title="' . $LNG['title_feed'] . '"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/feed.png" /></div></a>
        <a href="' . $CONF['url'] . '/index.php?a=directory"><div class="menu_btn tooltipz" data-title="Directory"><img src="' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/dir.png" /></div></a>
		<a href="' . $CONF['url'] . '/index.php?a=profile&u=' . $user['username'] . '"><div class="menu"><div class="menu_img"><img src="' . $CONF['url'] . '/thumb.php?src=' . $user['image'] . '&t=a&w=50&h=50" /></div><div class="menu_name"><strong>' . realName($user['username'], $user['first_name'], $user['last_name']) . '</strong></div></div></a>
		<div class="notification-container">
			<div class="notification-content">
				<div class="notification-inner">
					<span id="global_page_url"><a href="' . $CONF['url'] . '/index.php?a=notifications"><strong>' . $LNG['view_all_notifications'] . '</strong></a></span>
					<span id="chat_page_url"><a href="' . $CONF['url'] . '/index.php?a=notifications&filter=chats"><strong>' . $LNG['view_chat_notifications'] . '</strong></a></span>
					<a onclick="showNotification(\'close\')" title="' . $LNG['close_notifications'] . '"><div class="delete_btn"></div></a>
				</div>
				<div id="notifications-content"></div>
				<div class="notification-row"><div class="notification-padding"><a href="' . $CONF['url'] . '/index.php?a=settings&b=notifications">' . $LNG['notifications_settings'] . '</a></div></div>
			</div>
		</div>
		<script type="text/javascript">
		function checkNewNotifications(x) {
			// Retrieve the current notification values
			xy = $("#notifications_btn .notifications-number").html();
			xz = $("#messages_btn .notifications-number").html();
			
			// If there are not current values, reset them to 0
			if(!xy) {
				xy = 0;
			}
			if(!xz) {
				xz = 0;
			}
			$.ajax({
				type: "POST",
				url: "' . $CONF['url'] . '/requests/check_notifications.php",
				data: "for=1",
				success: function(html) {
					// If the response does not include "No notifications" and is not empty show the notification
					if(html.indexOf("' . $LNG['no_notifications'] . '") == -1 && html !== "" && html !== "0") {
						result = jQuery.parseJSON(html);
						if(result.response.global > 0) {
							$("#notifications_btn").html(getNotificationImage()+"<span class=\\"notificatons-number-container\\"><span class=\\"notifications-number\\">"+result.response.global+"</span></span>");
						} else {
							$("#notifications_btn").html(getNotificationImage());
						}
						if(result.response.messages > 0) {
							$("#messages_btn").html(getMessagesImageUrl(1)+"<span class=\\"notificatons-number-container\\"><span class=\\"notifications-number\\">"+result.response.messages+"</span></span>");
							$("#messages_url").attr("onclick", "showNotification(\'\', \'2\')");
							$("#messages_url").removeAttr("href");
						} else {
							$("#messages_btn").html(getMessagesImageUrl(1));
							$("#messages_url").removeAttr("onclick");
							$("#messages_url").attr("href", getMessagesImageUrl());
						}
						
						// If the new value is higher than the current one, and the current one is not equal to 0

						if(result.response.global > xy && xy != 0 || result.response.global == 1 && xy == 0) {
							checkAlert();
						} else if(result.response.messages > xz && xz != 0 || result.response.messages == 1 && xz == 0) {
							checkAlert();
						}
					}
					stopNotifications = setTimeout(checkNewNotifications, ' . $settings['intervaln'] . ');
			   }
			});
		}
		checkNewNotifications();
		
		function checkAlert() {
			if(!document.hasFocus()) {						
				// If the current document title doesn\'t have an alert, add one
				if(document.title.indexOf("(!)") == -1) {
					document.title = "(!) " + document.title;
				}
				notificationTitle(2);
			}
		}
		function getNotificationImage() {
			return "<img src=\\"' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/notification.png\\" />";
		}
		function getMessagesImageUrl(x) {
			if(x) {
				return "<img src=\\"' . $CONF['url'] . '/' . $CONF['theme_url'] . '/images/message.png\\" />";
			} else {
				return "' . $CONF['url'] . '/index.php?a=messages";
			}
		}
		
		</script>' . audioContainer('Notification', $user['sound_new_notification']);
    } else {
        // Else show the LogIn Register button
        return '
		
		<a href="' . $CONF['url'] . '/index.php?a=verify"><div class="menu_visitor"><strong>Sign Up</strong></div></a>
		<a href="' . $CONF['url'] . '/index.php?a=directory"><div class="menu_visitor"><strong>Directory</strong></div></a>';
    }
}