Ejemplo n.º 1
0
			$peer_inf = $profiles[$row['peer']];
			$online = $peer_inf[2] > $online_time ? '<div class="online"></div>' : '';
			$output .= '<div class="chat_block" onCLick="im.open('.$row['peer'].')" id="im_'.$row['peer'].'">
				<img src="/img/camera_50.gif" class="fl_l">
				<div class="cont">
					<div class="name">'.$peer_inf[0].' '.$peer_inf[1].'</div>
					<div class="msg">'.$row['text'].'</div>
					<div class="new_cnt" id="msg_new'.$row['peer'].'">'.$row['new'].'</div>
					<div class="typing" id="typing_'.$row['peer'].'"><img src="/img/typing.gif"/></div>
				</div>'.$online.'
				<div class="clear"></div>
			</div>';
		}
	}else $output = '<div class="info_center">У вас нет ни одного диалога</div>';

	tpl_load('im/head');
	tpl_set(array(
		'{dialogs}' => $output
	));
	tpl_make('cont');

	$initJS = "$(document).ready(function(){
$('#contacts, #messages_nano').nanoScroller();

$(window).resize(function(){
	var wh = Math.max(window.innerHeight-45, 300);
	if(wh > 600) wh -= 30;
	$('.im_chats, .im_cont').css('height', wh+'px');
	$('#contacts, #contacts_res').css('height', (wh-54)+'px');

	var hcont = wh-(parseInt($('.im_send_form').get(0).scrollHeight)+44), mh = $('#message_all_cont').get(0).scrollHeight, margin = hcont > mh ? hcont-mh : 0;
Ejemplo n.º 2
0
			$sql_ = mysql_query("SELECT uid, name, lname, last_update FROM `users` WHERE uid IN ({$ids})", 1);
			$ids = false;

			foreach($sql_ as $row){
				tpl_set(array(
					'{name}' => $row['name'].' '.$row['lname'],
					'{online}' => $row['last_update'] > $online_time ? 'online' : '',
					'{id}' => $row['uid']
				));
				tpl_make('res');
			}
		}else $tpl_res['res'] = '<div class="info_center" style="padding: 100px 0;">У вас нет друзей</div>';

		tpl_load('friends/head');
		tpl_set(array(
			'{res}' => $tpl_res['res'],
			'{cnt}' => $cnt > 0 ? gram($cnt, 'друг', 'друга', 'друзей') : 'нет друзей',
			'{load_but}' => $cnt > 15 ? '' : ' no_display',
			'{req_cnt}' => $uinfo['friends_request'] > 0 ? '+'.$uinfo['friends_request'] : ''
		));
		tpl_make('cont');

		$initJS = 'friends.uid = '.$get_id.';
friends.tpl = \''.$friends_tpl.'\';
friends.loadFriends();
friends.req_tpl = \'<div class="one_request" id="req{id}"><img src="/img/camera_100.gif" class="fl_l"><div class="cont fl_l"><div class="name"><a href="/">{name}</a></div><div class="online">{online}</div><div class="buttons"><button class="button fl_l" onClick="friends.accept({id});">Принять</button><button class="button inline fl_l" onClick="friends.reject({id});">Откланить</button><div class="clear"></div></div></div><div class="clear"></div></div>\'';
	}
}else{
	tpl_load('nolog_err');
	tpl_make('cont');
}
Ejemplo n.º 3
0
					<div class="actions fl_r">
						<li onClick="im.open('.$row['uid'].');">Отправить сообщение</li>
						'.$req_btn.'
					</div>
					<div class="clear"></div>
				</div>';
			}
		}else{
			if($page == 0) $res = '<div class="info_center">По запросу <b>'.$q.'</b> ничего не найдено</div>';
		}

		if($doload){
			echo $res;
			exit;
		}

		tpl_load('people/head');
		tpl_set(array(
			'{res}' => $res,
			'{load}' => count($sql_) == $limit ? '' : 'no_display'
		));
		tpl_make('cont');

		echo json_encode(array(
			'cont' => $tpl_res['cont'],
			'id' => 'box_people'
		));

	break;
}
exit;
Ejemplo n.º 4
0
*/

if(!$uid) die('no_log');

$queue = new Memcache;
$queue->connect('127.0.0.1', QUE_PORT);

$ip = ip2long($_SERVER['HTTP_X_REAL_IP']);
$queue->get("upd_secret{$uid}");

$data = $queue->get("timestamp_key{$uid},{$ip},25(notify{$uid})");
$data = json_decode($data, true);

if(isset($_POST['data_only'])){
	echo json_encode(array(
		'key' => $data['key'],
		'ts' => $data['ts'],
		'id' => $uid
	));
	exit;
}

tpl_load('q_frame');
tpl_set(array(
	'{ts}' => $data['ts'],
	'{key}' => $data['key'],
	'{uid}' => $uid
));
tpl_make('cont');
echo $tpl_res['cont'];
exit;
Ejemplo n.º 5
0
	default:

	if($logged) include 'app/modules/im.php';
	else{
		tpl_load('main_page');
	 	tpl_make('cont');
	}
}

if(isset($_POST['nav'])){
	$res = array('cont' => $tpl_res['cont'], 'st_files' => $st_files ? $st_files : 0, 'init_js' => $initJS);
	echo json_encode($res);
	exit;
}

tpl_load('head');

if($logged){
	tpl_set(array(
		'{my_id}' => $uid,
		'{name}' => $uinfo['name'].' '.$uinfo['lname'],
		'{head_req}' => $uinfo['friends_request'] > 0 ? '+'.$uinfo['friends_request'] : ''
	));
}

if($st_files){
	$st_res = '';
	foreach($st_files as $file){
		if(strpos($file, '.js') !== false) $st_res .= '<script type="text/javascript" src="/js/'.$file.'"></script>';
		else $st_res .= '<link rel="stylesheet" type="text/css" href="/css/'.$file.'"/>';
	}
Ejemplo n.º 6
0
if($id == $uid) $row = $uinfo;
else{
	$row = $pmc->get('uinfo'.$id);
	if(!$row['uid']){
		$row = mysql_query("SELECT uid, email, name, lname, photo FROM `users` WHERE uid = '{$id}'");
		if($row['uid']) $pmc->set('uinfo'.$id, $row, 3600*24);
	}
}

if(!$row['uid']){
	tpl_load('profile/not_found');
}else{

	if($row['photo']){
		$photo = new Memcache; 
		$photo->connect('127.0.0.1', 11233);

		//$photos = $photo->get("photo{$id},{$row['photo']}(id,locationps)");

		//print_r($photos);
		//exit;
	}else $ava = '/img/camera_400.gif';

	tpl_load('profile/main');
	tpl_set(array(
		'{id}' => $id,
		'{name}' => $row['name'],
		'{lname}' => $row['lname']
	));
}
tpl_make('cont');