42 $this -> sCurrentPage =
'viewFriends.php';
45 $this -> iMemberOnlineTime = (int)
getParam(
'member_online_time');
61 $aUsedTemplates = array (
62 'browse_searched_block.html'
66 $sPhotoCaption =
_t(
'_With photos only' );
67 $sOnlineCaption =
_t(
'_online only' );
71 $aWhereParam = array();
72 if ( $this -> aDisplayParameters[
'photos'] )
73 $aWhereParam[] =
'p.`Avatar` <> 0';
75 if ( $this -> aDisplayParameters[
'online'] )
76 $aWhereParam[] =
"(p.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $this -> iMemberOnlineTime .
" MINUTE)) ";
79 foreach( $aWhereParam AS $sValue )
81 $sWhereParam .=
' AND ' . $sValue;
89 $iPerPage = $this -> aDisplayParameters[
'per_page'];
90 $iCurPage = $this -> aDisplayParameters[
'page'];
93 $sqlLimit =
"LIMIT {$sLimitFrom}, {$iPerPage}";
96 $sTemplateName = ($this->aDisplayParameters[
'mode'] ==
'extended') ?
'search_profiles_ext.html' :
'search_profiles_sim.html';
99 $sSortParam =
'activity_desc';
100 if ( isset($this -> aDisplayParameters[
'sort']) ) {
101 switch($this -> aDisplayParameters[
'sort']) {
103 $sSortParam =
'activity_desc';
106 $sSortParam =
'date_reg_desc';
109 $sSortParam =
'rate';
112 $this -> aDisplayParameters[
'sort'] =
'activity';
116 $this -> aDisplayParameters[
'sort'] =
'activity';
118 $aAllFriends =
getMyFriendsEx($this->iProfileID, $sWhereParam, $sSortParam, $sqlLimit);
120 $aExtendedCss = array(
121 'ext_css_class' => $this->aDisplayParameters[
'mode'] ==
'extended' ?
'search_filled_block' :
''
123 foreach ($aAllFriends
as $iFriendID => $aFriendsPrm) {
136 $aGetParams = array(
'mode',
'iUser',
'photos_only',
'online_only');
137 $sRequest = CH_WSB_URL_ROOT .
'viewFriends.php?';
143 'page_url' => $sRequest,
147 'sorting' => $this -> aDisplayParameters[
'sort'],
151 $sPagination = $oPaginate -> getPaginate();
157 $sPerPageBlock = $oPaginate -> getPages(
$iPerPage );
160 $aSortingParam = array(
161 'activity' =>
_t(
'_Latest activity'),
162 'date_reg' =>
_t(
'_FieldCaption_DateReg_View'),
164 if (
getParam(
'votes')) $aSortingParam[
'rate'] =
_t(
'_Rate');
168 $sSortBlock = $oPaginate -> getSorting( $aSortingParam );
170 $sRequest = str_replace(
'{page}',
'1', $sRequest);
171 $sRequest = str_replace(
'{per_page}',
$iPerPage, $sRequest);
172 $sRequest = str_replace(
'{sorting}', $this -> aDisplayParameters[
'sort'], $sRequest);
176 $sPhotosChecked = ($this -> aDisplayParameters[
'photos'])
177 ?
'checked="checked"'
180 $sOnlineChecked = ($this -> aDisplayParameters[
'online'])
181 ?
'checked="checked"'
186 $sPhotoLocation = $this ->
getCutParam(
'photos_only', $sRequest);
190 $sOnlineLocation = $this ->
getCutParam(
'online_only', $sRequest);
194 $sModeLocation = $this ->
getCutParam(
'mode', $sRequest);
195 $sModeLocation = $this ->
getCutParam(
'per_page', $sModeLocation);
200 $sTopControls =
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'browse_sb_top_controls.html', array(
201 'sort_block' => $sSortBlock,
202 'ch_if:show_with_photos' => array(
203 'condition' => $oMemberInfo->isAvatarSearchAllowed(),
205 'photo_checked' => $sPhotosChecked,
206 'photo_location' => $sPhotoLocation,
207 'photo_caption' => $sPhotoCaption,
210 'online_checked' => $sOnlineChecked,
211 'online_location' => $sOnlineLocation,
212 'online_caption' => $sOnlineCaption,
213 'per_page_block' => $sPerPageBlock
218 'top_controls' => $sTopControls,
219 'ch_if:show_sim_css' => array (
220 'condition' => $this->aDisplayParameters[
'mode'] !=
'extended',
223 'ch_if:show_ext_css' => array (
224 'condition' => $this->aDisplayParameters[
'mode'] ==
'extended',
228 'pagination' => $sPagination,
232 $aToggleItems = array
234 '' =>
_t(
'_Simple' ),
235 'extended' =>
_t(
'_Extended' ),
238 foreach( $aToggleItems AS $sKey => $sValue ) {
239 $aToggleEllements[$sValue] = array (
240 'href' => $sModeLocation .
'&mode=' . $sKey,
242 'active' => ($this -> aDisplayParameters[
'mode'] == $sKey ),
246 return array(
$sOutputHtml . $sEmpty, $aToggleEllements, array(),
true);
269 return $this->oProfile->showBlockMutualFriends(
'',
true);
279 return preg_replace(
"/(&|&){$sExceptParam}=([a-z0-9\_\-]{1,})/i",
'', $sString);
296 $iOldCount = (int) $iOldCount;
297 $iOnlineTime = (int)
getParam(
"member_online_time" );
300 $aNotifyMessages = array();
304 $sWhereCondition =
" AND (p.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $iOnlineTime .
" MINUTE))";
306 foreach($aFoundFriends
as $iFriendId =>
$aInfo) {
307 $aFriends[] = array($iFriendId);
311 $iOnlineFriends = count($aFriends);
315 if ( $iOnlineFriends > $iOldCount) {
317 for( $i = $iOldCount; $i < $iOnlineFriends; $i++) {
322 'sender_thumb' =>
$oFunctions -> getMemberIcon($aFriends[$i][0],
'left'),
323 'profile_link' => $sProfileLink,
324 'friend_nickname' => $sFriendNickName,
325 'key_on_line' =>
_t(
'_Now online' ),
329 $aNotifyMessages[] = array(
330 'message' =>
$oSysTemplate -> parseHtmlByName(
'member_menu_notify_window.html', array(
'message' =>
$sMessage))
337 'count' => $iOnlineFriends,
338 'messages' => $aNotifyMessages,
358 $iOldCount = (int) $iOldCount;
359 $iOnlineTime = (int)
getParam(
"member_online_time" );
362 $aNotifyMessages = array();
366 $sSql =
"SELECT `tp`.`ID` FROM `sys_friend_list` AS `tf` LEFT JOIN `Profiles` AS `tp` ON `tf`.`ID`=`tp`.`ID` WHERE `tf`.`Profile`={$iMemberId} AND `tf`.`Check`='0' AND `tp`.`Status`='Active' ORDER BY `tf`.`When`";
367 $aFriends =
$GLOBALS[
'MySQL']->getColumn($sSql);
369 $iOnlineFriends = count($aFriends);
370 if($iOnlineFriends > $iOldCount)
371 for($i = $iOldCount; $i < $iOnlineFriends; $i++) {
373 'sender_thumb' =>
$oFunctions -> getMemberIcon($aFriends[$i],
'left'),
376 'key_on_line' =>
_t(
'_Now online' ),
380 $aNotifyMessages[] = array(
381 'message' =>
$oSysTemplate -> parseHtmlByName(
'member_menu_notify_window.html', array(
'message' =>
$sMessage))
387 'count' => $iOnlineFriends,
388 'messages' => $aNotifyMessages,
405 $iOnlineTime = (int)
getParam(
'member_online_time');
408 $sExtraMenuPosition = ( isset($_COOKIE[
'menu_position']) )
409 ? $_COOKIE[
'menu_position']
410 :
getParam(
'ext_nav_menu_top_position' );
412 $aLanguageKeys = array (
413 'requests' =>
_t(
'_Friend Requests' ),
414 'online' =>
_t(
'_Online Friends' ),
423 $sWhereParam =
"AND p.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $iOnlineTime .
" MINUTE)";
427 $sVideoMessengerImgPath =
$GLOBALS[
'oSysTemplate'] -> getIconUrl(
'video.png');
428 $sMessengerTitle =
_t(
'_Chat');
430 foreach ($aAllFriends
as $iFriendID => $aFriendsPrm) {
434 $sHeadline = ( mb_strlen(
$aMemberInfo[
'UserStatusMessage']) > 40 )
435 ? mb_substr(
$aMemberInfo[
'UserStatusMessage'], 0, 40) .
'...'
441 'profile_id' => $iFriendID,
442 'thumbnail' => $sThumb,
443 'head_line' => $sHeadline,
445 'ch_if:video_messenger' => array (
446 'condition' => (
$oModuleDb -> isModule(
'messenger') ),
450 'recipient_id' => $iFriendID,
451 'video_img_src' => $sVideoMessengerImgPath,
452 'messenger_title' => $sMessengerTitle,
458 $aExtraSection = array(
459 'friends_request' => $aLanguageKeys[
'requests'],
460 'request_count' => $iFriendsRequests,
463 'online_friends' => $aLanguageKeys[
'online'],
464 'online_count' => $iOnlineFriends,
468 $aTemplateKeys = array (
469 'ch_if:menu_position_bottom' => array (
470 'condition' => ( $sExtraMenuPosition ==
'bottom' ),
471 'content' => $aExtraSection,
474 'ch_if:menu_position_top' => array (
475 'condition' => ( $sExtraMenuPosition ==
'top' || $sExtraMenuPosition ==
'static' ),
476 'content' => $aExtraSection,
479 'ch_repeat:friend_list' => $aFriends,
482 $sOutputCode =
$GLOBALS[
'oSysTemplate'] -> parseHtmlByName(
'view_friends_member_menu_friends_list.html', $aTemplateKeys );