/**
  * Function will return member's status icon ;
  *
  * @param  : $iMemberId (integer) - logged member's Id ;
  * @return : (string) - icon's name;
  */
 function getStatus($iMemberId)
 {
     // default value;
     $sMemberStatus = $this->aStatuses['offline']['title'];
     if (get_user_online_status($iMemberId)) {
         // get profile status;
         $sMemberStatus = $GLOBALS['MySQL']->fromMemory("user_status.{$iMemberId}", 'getOne', "SELECT `UserStatus` FROM `Profiles` WHERE `ID` = {$iMemberId}");
     }
     return $sMemberStatus;
 }
function get_member_thumbnail($ID, $float, $bDrawMargin = FALSE)
{
    global $site;
    require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php';
    $user_is_online = get_user_online_status($ID);
    //$sSexSql = "SELECT `Sex` FROM `Profiles` WHERE `ID` = '{$ID}'";
    $aSexSql = getProfileInfo($ID);
    //db_arr( $sSexSql );
    $oPhoto = new ProfilePhotos($ID);
    $oPhoto->getActiveMediaArray();
    $aFile = $oPhoto->getPrimaryPhotoArray();
    if (extFileExists($oPhoto->sMediaDir . 'thumb_' . $aFile['med_file'])) {
        $sFileName = $oPhoto->sMediaUrl . 'thumb_' . $aFile['med_file'];
    } else {
        if ($aSexSql['Sex'] == 'female' or $aSexSql['Sex'] == 'Female') {
            $sSexPic = 'woman_medium.gif';
        } elseif ($aSexSql['Sex'] == 'male' or $aSexSql['Sex'] == 'Male') {
            $sSexPic = 'man_medium.gif';
        } else {
            $sSexPic = 'visitor_medium.gif';
        }
        $sFileName = getTemplateIcon($sSexPic);
    }
    $sMarginsAddon = $bDrawMargin ? " margin-right:10px;margin-bottom:10px; " : '';
    $style = 'width:' . $oPhoto->aMediaConfig['size']['thumbWidth'] . 'px;' . 'height:' . $oPhoto->aMediaConfig['size']['thumbHeight'] . 'px;' . 'background-image:url(' . $sFileName . ');';
    $ret = '';
    $ret .= '<div class="thumbnail_block" style="float:' . $float . '; ">';
    $ret .= getProfileOnlineStatus($user_is_online, $bDrawMargin);
    $ret .= "<a href=\"" . getProfileLink($ID) . "\">";
    $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $sMarginsAddon . $style . '" alt="' . process_line_output($aFileName['med_title']) . '" />';
    $ret .= '</a>';
    $ret .= '</div>';
    return $ret;
}
 /**
  * Function will generate messenger's input field ;
  * Will generate messenger's part that allow logged member to send message ;
  *
  * @param  : $iViewedMemberId (integer) - Viewed member's Id ;
  * @return : (text) - Html presentation data ;
  */
 function serviceGetMessengerField($iViewedMemberId)
 {
     if (!$this->iLoggedMemberId || !get_user_online_status($iViewedMemberId) || $this->iLoggedMemberId == $iViewedMemberId || isBlocked($iViewedMemberId, $this->iLoggedMemberId)) {
         return '';
     }
     $sOutputCode = '';
     if ($this->isMessengerAlowed($iViewedMemberId) && $this->isMessengerAlowed($this->iLoggedMemberId)) {
         $aTemplateKeys = array('message' => _t('_simple_messenger_chat_now') . '...', 'res_id' => $iViewedMemberId);
         $sOutputCode = $this->_oTemplate->parseHtmlByName('send_message_field.html', $aTemplateKeys);
     }
     return $sOutputCode;
 }
Exemple #4
0
 function serviceGetActionLink($iMemberId, $iProfileId)
 {
     $aResult = checkAction($iMemberId, ACTION_ID_USE_MESSENGER);
     if ($iMemberId > 0 && get_user_online_status($iProfileId) && $aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iMemberId != $iProfileId && !isBlocked($iProfileId, $iMemberId)) {
         $sResult = _t('_messenger_actions_item');
     } else {
         $sResult = '';
     }
     return $sResult;
 }
 function showBlockActionsMenu($sCaption, $bNoDB = false)
 {
     global $logged;
     global $p_arr;
     $oTemplMenu = new BxTemplMenu($this->oTemplConfig);
     if (!$logged['member'] or !$p_arr) {
         return '';
     }
     $memberID = (int) $_COOKIE['memberID'];
     $profileID = (int) $p_arr['ID'];
     if ($memberID == $profileID) {
         return '';
     }
     /* * * * Ray IM Integration * * * */
     $check_res_im = checkAction($memberID, ACTION_ID_USE_RAY_IM);
     if (getParam('enable_ray') == 'on' and get_user_online_status($profileID) and $check_res_im[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) {
         $sSndPassword = getPassword($memberID);
         $IMNow = $oTemplMenu->getActionsMenuItem('action_im.gif', _t('_ChatNow', $p_arr['NickName']), "javascript:void(0);", '', '', "openRayWidget( 'im', 'user', '{$memberID}', '{$sSndPassword}', '{$profileID}' );");
     } else {
         $IMNow = '';
     }
     /* * * * Ray IM Integration [END]* * * */
     $ret = '<div class="menuBlock">';
     $ret .= '<div class="menu_item_block">';
     $ret .= '<div class="menu_item_block_left">';
     $ret .= $oTemplMenu->getActionsMenuItem('action_send.gif', _t('_SendLetter'), "compose.php?ID={$profileID}");
     $ret .= $oTemplMenu->getActionsMenuItem('action_fave.gif', _t('_Fave'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=hot&amp;ID={$profileID}',    '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_friends.gif', _t('_Befriend'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=friend&amp;ID={$profileID}', '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_greet.gif', _t('_Greet'), "javascript:void(0);", '', '', "window.open( 'greet.php?sendto={$profileID}',                  '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $IMNow;
     if (!$this->oTemplConfig->bAnonymousMode) {
         $ret .= $oTemplMenu->getActionsMenuItem('action_email.gif', _t('_Get E-mail'), "javascript:void(0);", '', '', "window.open( 'freemail.php?ID={$profileID}', '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     }
     $ret .= '</div>';
     $ret .= '<div class="menu_item_block_right">';
     $ret .= $oTemplMenu->getActionsMenuItem('action_photos.gif', $this->getLinkStat('prPhoto', _t('_ProfilePhotos'), $profileID), "photos_gallery.php?ID={$profileID}");
     $ret .= $oTemplMenu->getActionsMenuItem('action_videos.gif', $this->getLinkStat('prVideo', _t('_ProfileVideos'), $profileID), "javascript:void(0);", '', '', "openRayWidget( 'video', 'player', '{$profileID}' );");
     //				$ret .= $oTemplMenu -> getActionsMenuItem( 'action_videos.gif', _t('_ProfileVideos'),   "javascript:void(0);", '', '', "openRayWidget( 'video', 'player', '$profileID' );" );
     $ret .= $oTemplMenu->getActionsMenuItem('action_music.gif', $this->getLinkStat('prMusic', _t('_ProfileMusic'), $profileID), "javascript:void(0);", '', '', "openRayWidget( 'mp3', 'player', '{$profileID}', '" . getPassword($memberID) . "', '{$memberID}');");
     $ret .= $oTemplMenu->getActionsMenuItem('action_share.gif', _t('_Share'), "javascript:void(0);", '', '', "return launchTellFriendProfile({$profileID});");
     $ret .= $oTemplMenu->getActionsMenuItem('action_report.gif', _t('_Report'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=spam&amp;ID={$profileID}',   '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= $oTemplMenu->getActionsMenuItem('action_block.gif', _t('_Block'), "javascript:void(0);", '', '', "window.open( 'list_pop.php?action=block&amp;ID={$profileID}',  '', 'width={$this->oTemplConfig->popUpWindowWidth},height={$this->oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );");
     $ret .= '</div>';
     $ret .= '<div class="clear_both"></div>';
     $ret .= '</div>';
     $ret .= '</div>';
     if ($bNoDB) {
         return $ret;
     } else {
         echo DesignBoxContent(_t($sCaption), $ret, 1);
     }
 }
    /**
     * page show participants function
     * @return HTML presentation of data
     */
    function PageSDatingShowParticipants()
    {
        global $site;
        global $oTemplConfig;
        $sYOC = _t('_y/o');
        $sRetHtml = '';
        $sEventParticipantsC = _t('_Event participants');
        $sListOfParticipantsC = _t('_List') . ' ' . _t('_of') . ' ' . _t('_Participants');
        // collect information about current member
        if ($logged['member']) {
            $aMember['ID'] = (int) $_COOKIE['memberID'];
            $aMemberData = getProfileInfo($aMember['ID']);
        } else {
            $aMember['ID'] = 0;
        }
        $aMembership = getMemberMembershipInfo($aMember['ID']);
        /*$iEventID = (int)$_REQUEST['event_id'];*/
        $iEventID = $this->bUseFriendlyLinks ? (int) db_value("SELECT `ID` FROM `SDatingEvents` WHERE `EntryUri`='" . $this->process_html_db_input($_REQUEST['eventUri']) . "' LIMIT 1") : (int) $_REQUEST['event_id'];
        $sQuery = "\r\n\t\t\tSELECT `ID`, `Title`,\r\n\t\t\t\t(NOW() > `EventEnd` AND NOW() < DATE_ADD(`EventEnd`, INTERVAL `ChoosePeriod` DAY)) AS `ChooseActive`\r\n\t\t\tFROM `SDatingEvents`\r\n\t\t\tWHERE\r\n\t\t\t\t`ID` = {$iEventID} AND `Status` = 'Active' AND `AllowViewParticipants` = 1";
        $aEventData = db_arr($sQuery);
        if (!$aEventData['ID']) {
            return DesignBoxContent('', '<center>' . _t('_Event is unavailable') . '</center>', $oTemplConfig->PageSDatingShowParticipants_db_num);
        }
        $sRetHtml .= '<div class="text">' . process_line_output($aEventData['Title']) . '</div>';
        // list of participants
        $aSelfPart = db_arr("SELECT `ID` FROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\tWHERE `IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\tAND `IDMember` = {$aMember['ID']}");
        $iPartPage = isset($_REQUEST['part_page']) ? (int) $_REQUEST['part_page'] : 1;
        $iPartPPerPage = isset($_REQUEST['part_p_per_page']) ? (int) $_REQUEST['part_p_per_page'] : 30;
        $iLimitFirst = (int) ($iPartPage - 1) * $iPartPPerPage;
        $vPartProfilesRes = db_res("SELECT `Profiles`.*, `SDatingParticipants`.`ParticipantUID` AS `UID`\r\n\t\t\t\t\t\t\t\t\t\tFROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\t\tINNER JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID`\r\n\t\t\t\t\t\t\t\t\t\tWHERE `SDatingParticipants`.`IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\t\tORDER BY `Profiles`.`NickName`\r\n\t\t\t\t\t\t\t\t\t\tLIMIT {$iLimitFirst}, {$iPartPPerPage}");
        $aTotal = db_arr("SELECT COUNT(*) FROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\tWHERE `SDatingParticipants`.`IDEvent` = {$iEventID}");
        $iPartProfilesTotal = (int) $aTotal[0];
        $iPagesNum = ceil($iPartProfilesTotal / $iPartPPerPage);
        $sGenUrlP = $this->genUrl($iEventID, '', 'part', true);
        $sPartGetUrl = $sGenUrlP . (isset($_REQUEST['part_p_per_page']) ? '&amp;part_p_per_page=' . (int) $_REQUEST['part_p_per_page'] : '');
        if ($iPartProfilesTotal == 0) {
            $sRetHtml .= _t('_There are no participants for this event');
        } else {
            if ($iPagesNum > 1) {
                $sRetHtml .= '<div class="text">' . _t('_Pages') . ':&nbsp;';
                for ($i = 1; $i <= $iPagesNum; $i++) {
                    if ($i == $iPartPage) {
                        $sRetHtml .= "[{$i}]&nbsp;";
                    } else {
                        $sRetHtml .= "<a href=\"{$sPartGetUrl}&amp;part_page={$i}\">{$i}</a>&nbsp;";
                    }
                }
                $sRetHtml .= '</div><br />';
            }
            $sProfilesTrs = '';
            while ($part_profiles_arr = mysql_fetch_assoc($vPartProfilesRes)) {
                $iUserIsOnline = get_user_online_status($part_profiles_arr[ID]);
                $sCont = get_member_thumbnail($part_profiles_arr['ID'], 'none') . '<br /><center>' . getProfileOnlineStatus($iUserIsOnline) . '</center>';
                //$sProfilesTrs .= DesignBoxContentBorder( process_line_output( strmaxtextlen( $part_profiles_arr['NickName'], 11 ) ) . ': ' . age( $part_profiles_arr['DateOfBirth'] ) . ' ' . _t('_y/o'), $sCont );
                $sThumb = get_member_thumbnail($part_profiles_arr['ID'], 'none');
                $sProfLink = getProfileLink($part_profiles_arr['ID']);
                $sAge = age($part_profiles_arr['DateOfBirth']) . $sYOC;
                $sProfilesTrs .= <<<EOF
<div style="float:left;text-align:center;margin-right:10px;position:relative;">
\t{$sThumb}
\t<div class="browse_nick" style="width:{$this->iThumbSize}px;">
\t\t<a href="{$sProfLink}">{$part_profiles_arr['NickName']}</a>: {$sAge}
\t</div>
</div>
EOF;
            }
            $sNicknameC = _t('_Nickname');
            $sDateOfBirthC = _t('_DateOfBirth');
            $sSexC = _t('_Sex');
            $sEventUIDC = _t('_Event UID');
            $sChooseParts = '';
            // show 'choose participants' link only during choose period and if member is participant of this event
            // if ( $this->bAdminMode==FALSE || ($aEventData['ChooseActive'] && $aSelfPart['ID'] )) {
            // $sChooseParts = '<div class="text" align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=select_match&amp;event_id='.$iEventID.'">'._t('_Choose participants you liked').'</a></div><br />';
            // }
            $sPagesHref = '';
            if ($iPagesNum > 1) {
                $sPagesHref .= '<div class="text">' . _t('_Pages') . ':&nbsp;';
                for ($i = 1; $i <= $iPagesNum; $i++) {
                    if ($i == $iPartPage) {
                        $sPagesHref .= "[{$i}]&nbsp;";
                    } else {
                        $sPagesHref .= "<a href=\"{$sPartGetUrl}&amp;part_page={$i}\">{$i}</a>&nbsp;";
                    }
                }
                $sPagesHref .= '</div><br />';
            }
            $sRetHtml .= $sProfilesTrs . $sPagesHref;
        }
        $sRetHtml .= '<div class="clear_both"></div>';
        return DesignBoxContent($sListOfParticipantsC, $sRetHtml, $oTemplConfig->PageSDatingShowParticipants_db_num);
    }
function PageCompPageMainCode()
{
    global $sex_sel;
    global $country_sel;
    global $age_start_sel;
    global $age_end_sel;
    global $onl_only;
    global $pic_only;
    global $site;
    global $p_num;
    global $page;
    global $pages_num;
    global $p_per_page;
    global $page_first_p;
    global $pages_num;
    global $search_start_age;
    global $search_end_age;
    global $max_thumb_width;
    global $max_thumb_height;
    $query = "SELECT * FROM ProfilesDesc WHERE `name` IN ( 'Sex', 'Country')";
    $res = db_res($query);
    while ($arr = mysql_fetch_array($res)) {
        switch ($arr['name']) {
            case 'Sex':
                $sex_sel = $sex_sel ? $sex_sel : 'male,female';
                $sex_options = makeCheckbox('sex', $arr['extra'], $sex_sel);
                break;
            case 'Country':
                $country_sel = $country_sel ? $country_sel : 'all';
                //getParam('default_country');
                $country_options = makeList('country', '', $arr['extra'], $country_sel, 'onchange="javascript: flagImage = document.getElementById(\'flagImageId\'); if (this.value == \'all\') {flagImage.src = \'' . $site['images'] . 'spacer.gif\';} else {flagImage.src = \'' . $site['flags'] . '\' + this.value.toLowerCase() + \'.gif\';}"');
                break;
            default:
                break;
        }
    }
    $age_start_sel = $age_start_sel ? $age_start_sel : $search_start_age;
    $age_end_sel = $age_end_sel ? $age_end_sel : $search_end_age;
    $age_option_start = makeList('age_start', "{$search_start_age}-{$search_end_age}", '', $age_start_sel);
    $age_option_end = makeList('age_end', "{$search_start_age}-{$search_end_age}", '', $age_end_sel);
    $photo_only_check = '<input type="checkbox" name="photo_only" id="photo_only_id" ' . ($pic_only ? 'checked="checked"' : '') . ' /><label for="photo_only_id"><b>' . _t('_With photos only') . '</b></label>';
    $online_only_check = '<input type="checkbox" name="online_only" id="online_only_id" ' . ($onl_only ? 'checked="checked"' : '') . ' /><label for="online_only_id"><b>' . _t('_online only') . '</b></label>';
    $country_def_flag = $country_sel == 'all' ? $site['images'] . 'spacer.gif' : $site['flags'] . strtolower($country_sel) . '.gif';
    $ret = '
	    <form id="browse_form" action="' . $_SERVER['PHP_SELF'] . '" method="get">
			<div class="browse_form_wrapper">
			
				<div class="browse_form_row">
					<div class="clear_both"></div>
						<div class="label">' . _t('_Sex') . ':</div>
						<div class="value">' . $sex_options . '</div>
					<div class="clear_both"></div>
				</div>
				
				<div class="browse_form_row">
					<div class="clear_both"></div>
						<div class="label">' . _t('_DateOfBirth') . ':</div>
						<div class="value">' . _t("from") . '&nbsp;' . $age_option_start . '&nbsp;' . _t("to") . '&nbsp;' . $age_option_end . '</div>
					<div class="clear_both"></div>
				</div>

				<div class="browse_form_row">
					<div class="clear_both"></div>
		    			<div class="label">' . _t('_Country') . ':</div>' . '<div class="value">' . $country_options . '&nbsp;<img id="flagImageId" src="' . $country_def_flag . '" alt="flag" />
						</div>
					<div class="clear_both"></div>
				</div>

				<div class="only">
				    ' . $photo_only_check . '
				    ' . $online_only_check . '
				</div>

				<div class="submit">
		    		<input id="search" name="search" type="submit" value="' . _t('_Show') . '" />
				</div>

			</div>
		</form>
	    ';
    //====================================================================================================
    //----------------------- search results -------------------------------------------------
    //====================================================================================================
    $page = (int) $_GET[page];
    $p_per_page = (int) $_GET[p_per_page];
    $aVar = array(30, 60, 90);
    if (!$page) {
        $page = 1;
    }
    if (!$p_per_page) {
        $p_per_page = 30;
    }
    $real_first_p = (int) ($page - 1) * $p_per_page;
    $page_first_p = $real_first_p + 1;
    $temp_arr = explode(',', $sex_sel);
    foreach ($temp_arr as $value) {
        if ($value) {
            $sex_add .= " `Sex` = '{$value}' OR ";
        }
    }
    if ($country_sel && 'all' != $country_sel) {
        $country_add = " `Country` = '{$country_sel}' AND ";
    }
    if ($age_start_sel) {
        $age_add .= " ( (YEAR(NOW()) - {$age_start_sel}) >= YEAR(`DateofBirth`) ) AND ";
    }
    if ($age_end_sel) {
        $age_add .= " ( (YEAR(NOW()) - {$age_end_sel}) <= YEAR(`DateofBirth`) ) AND ";
    }
    if ($pic_only) {
        $pic_add = " AND `Picture` = '1' ";
    }
    if ($onl_only) {
        $onl_add = " AND (LastNavTime > SUBDATE(NOW(), INTERVAL " . getParam("member_online_time") . " MINUTE)) ";
    }
    $sex_add = $sex_add ? '(' . $sex_add . ' 1=0 ) AND ' : '';
    $age_add = $age_add ? '(' . $age_add . ' 1=1 )' : '';
    $sql_add = $sex_add . $country_add . $age_add . $pic_add . $onl_add;
    $p_num = db_arr("SELECT COUNT(*) FROM Profiles WHERE {$sql_add} AND `Status` = 'Active'");
    $p_num = $p_num[0];
    $pages_num = ceil($p_num / $p_per_page);
    $profiles_list_query = "SELECT `ID`, `NickName`, `Sex`, `DateOfBirth` FROM Profiles WHERE {$sql_add} AND `status`='Active' ORDER BY `Picture` DESC LIMIT {$real_first_p}, {$p_per_page};";
    $function = '
		    $ret = \'?\';
		    foreach ( $_GET as $key => $value )
			if ( $value )
			    $ret .= $key . \'=\' . $value . \'&amp;\';

		    return $ret;
		';
    $ret .= '<div id="container_result" style="border: 0px solid #000000">';
    $ret .= '<div style="margin-bottom:10px;"><center>' . ResNavigationRet('ProfilesUpper', 0, $function, $aVar) . '</center></div>';
    if ($p_num > 0) {
        $res = db_res($profiles_list_query);
        $iI = 1;
        while ($arr = mysql_fetch_array($res)) {
            $user_is_online = get_user_online_status($arr['ID']);
            if ($iI == 6) {
                $cont = '<div class="browse_thumb_thin">';
            } else {
                $cont = '<div class="browse_thumb">';
            }
            $cont .= getProfileOnlineStatus($user_is_online) . get_member_thumbnail($arr['ID'], 'none') . '<div class="browse_nick"><a href="' . getProfileLink($arr['ID']) . '">' . $arr['NickName'] . '</a></div></div>';
            $ret .= $cont;
            $iI++;
            if ($iI > 6) {
                $iI = 1;
            }
        }
    } else {
        $ret .= '<div class="no_result">';
        $ret .= '<div>' . _t('_No results found') . '</div>';
        $ret .= '</div>';
    }
    $ret .= '<div style="clear:both;margin-top:10px;"><center>' . ResNavigationRet('ProfilesLower', 0, $function, $aVar) . '</center></div>';
    $ret .= '</div>';
    return $ret;
}
    function showBlockProfileDetails($sCaption)
    {
        global $prof;
        global $enable_zodiac;
        global $p_arr;
        global $site;
        $aFields = $this->collectProfileFieldsByCateg(0);
        $sDetails = $this->showProfileFields($aFields);
        $sTagsAddon = "";
        $sTagsQuery = "SELECT `Tag` FROM `Tags` WHERE `ID`='{$p_arr['ID']}' AND `Type` = 'profile'";
        $rTags = db_res($sTagsQuery);
        while ($aTags = mysql_fetch_assoc($rTags)) {
            $sTagsAddon .= "<a href='" . $site['url'] . "search_result.php?tag=" . $aTags['Tag'] . "'>" . $aTags['Tag'] . "</a>, ";
        }
        $sTagsAddon = rtrim($sTagsAddon, ", ");
        $bOnlineStatus = get_user_online_status($p_arr['ID']);
        $sOnlineStatus = $bOnlineStatus == true ? _t('Online') : _t('Offline');
        ob_start();
        ?>
			<div id="profile_details_wrapper">
				<table>
					<?php 
        echo $sDetails;
        ?>
					<tr>
						<td class="profile_td_1">Tags:</td>
						<td class="profile_td_2"><?php 
        echo $sTagsAddon;
        ?>
</td>
					</tr>
					<tr>
						<td class="profile_td_1">Status:</td>
						<td class="profile_td_2"><div class="member_status"><?php 
        echo $sOnlineStatus;
        ?>
</div></td>
					</tr>
				</table>
			</div>
		<?php 
        $ret = ob_get_clean();
        echo DesignBoxContent(_t($sCaption, $p_arr['NickName']), $ret, 1);
    }
/**
 * returns HTML code for one search row
 */
function PrintSearhResult($p_arr, $templ_search, $iNumber = 1, $bCouple = false, $aCoupleInfo = '')
{
    global $site;
    global $pa_icon_preload;
    global $aPreValues;
    global $logged;
    global $tmpl;
    global $dir;
    global $max_thumb_width;
    global $max_thumb_height;
    global $anon_mode;
    global $enable_zodiac;
    global $enable_friendlist;
    global $pic_num;
    global $oTemplConfig;
    global $NickName;
    $member['ID'] = (int) $_COOKIE['memberID'];
    $free_mode = getParam("free_mode") == "on" ? 1 : 0;
    $bEnableRay = getParam('enable_ray') == 'on';
    $gl_thumb_width = $max_thumb_width;
    $gl_thumb_height = $max_thumb_height;
    // get user online status
    $user_is_online = get_user_online_status($p_arr[ID]);
    $templ = $templ_search;
    // ------------ template variables --------------
    $thumbnail = get_member_thumbnail($p_arr['ID'], 'none', true);
    // online/offline status
    $launch_ray_im = "";
    //--- Ray IM integration ---//
    if ($user_is_online) {
        $check_res = checkAction($member['ID'], ACTION_ID_USE_RAY_IM);
        if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $member['ID'] != $p_arr['ID'] && !empty($member['ID'])) {
            $iSndId = (int) $member['ID'];
            $sSndPassword = getPassword($member['ID']);
            $iRspId = (int) $p_arr['ID'];
            $launch_ray_im = "<a href=\"javascript:void(0);\" onClick=\"javascript: openRayWidget( 'im', 'user', '" . $iSndId . "', '" . $sSndPassword . "', '" . $iRspId . "' ); return false;\">" . _t("_IM now", $p_arr['NickName']) . "</a>";
        }
    }
    //--- Ray IM integration ---//
    // Template customizations
    // profile Nick/Age/Sex etc.
    $nick = '<a href="' . getProfileLink($p_arr['ID']) . '">' . $p_arr['NickName'] . '</a>';
    $age_str = $p_arr['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($p_arr['DateOfBirth'])) . ' ' : "";
    $age_only = $p_arr['DateOfBirth'] != "0000-00-00" ? age($p_arr['DateOfBirth']) : "";
    $y_o_sex = $age_str . _t("_" . $p_arr['Sex']);
    $city = _t("_City") . ": " . process_line_output($p_arr['City']);
    $country = _t("_Country") . ": " . _t($aPreValues['Country'][$p_arr['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($p_arr['Country'])) . '.gif" alt="flag" />';
    $sFlag = $p_arr['Country'] != '' ? '&nbsp;<img src="' . ($site['flags'] . strtolower($p_arr['Country'])) . '.gif" alt="flag" />' : '';
    $city_con = process_line_output($p_arr['City']) . ", " . _t($aPreValues['Country'][$p_arr['Country']]['LKey']) . $sFlag;
    $occupation = process_line_output($p_arr['Occupation']);
    $children = $p_arr['Children'] ? $p_arr['Children'] . " " . _t("_children") : "";
    $id = _t("_ID") . ": " . $p_arr['ID'];
    // description
    $i_am = _t("_I am");
    $i_am_desc = process_smiles(strip_tags(process_text_output($p_arr['DescriptionMe']), '<img>')) . "...";
    $you_are = _t("_You are");
    $you_are_desc = process_smiles(process_text_output($p_arr['DescriptionYou'])) . "... <a href=\"" . getProfileLink($p_arr['ID']) . "\">" . _t("_more") . "</a>";
    /*
    echo '<hr>';
    print_r( $p_arr );
    echo '<hr>';
    */
    $sCity = $p_arr['City'];
    //echo $sCity . '<hr>';
    //--- Ray IM integration start ---//
    $ai_im = '';
    $al_im = '';
    $chechActionRes = checkAction($member['ID'], ACTION_ID_USE_RAY_IM);
    if ($bEnableRay && $chechActionRes[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $member['ID'] != $p_arr['ID'] && !empty($member['ID'])) {
        $iSndId = (int) $member['ID'];
        $sSndPassword = getPassword($member['ID']);
        $iRspId = (int) $p_arr['ID'];
        if ($user_is_online) {
            $file_icon = $dir['root'] . "templates/tmpl_" . $tmpl . "/images/icons/action_im_small.gif";
            if (file_exists($file_icon)) {
                $ai_im .= "<img alt=\"" . _t("_IM now") . "\" class=\"links_image\" name=i06{$p_arr['ID']} src=\"{$site['url']}templates/tmpl_{$tmpl}/images/icons/action_im_small.gif\" />";
            }
            $al_im .= '<a href="javascript:void(0);" onClick="javascript: openRayWidget( \'im\', \'user\', \'' . $iSndId . '\', \'' . $sSndPassword . '\', \'' . $iRspId . '\' ); return false;">';
            $al_im = '<span class="links_span">' . $ai_im . $al_im . ucwords(_t("_IM now", $p_arr['NickName'])) . '</a></span>';
        }
    }
    //--- Ray IM integration end ---//
    /* Standard IM commented out
    	else if ( $enable_im )
    	{
    		if ( $user_is_online )
    		{
    			$al_im = "<a href=\"javascript:void(0);\" OnClick=\"javascript: launchAddToIM({$p_arr['ID']}); return false;\"";
    		}
    		else
    		{
    			$al_im = "<a href='javascript: void(0);' OnClick=\"javascript: alert('". _t("_Sorry, user is OFFLINE") ."'); return false;\"";
    		}
    
    		if ( $pa_icon_preload )
    			$al_im .= "onMouseOut =\"javascript: i06$p_arr[ID].src='$site[images]pa_im.gif';\"";
    
    		$al_im .= ">";
    
    		$file_icon = $dir['root'] ."templates/tmpl_".$tmpl."/images/pa_im.gif";
    		if ( file_exists( $file_icon ) )
    			$ai_im .= $al_im ."<img name=i06$p_arr[ID] src=\"". $site['images']. "pa_im.gif\" border=0></a>";
    		$al_im .= _t("_chat now") ."</a>";
    	}
     Standard IM commented out */
    /* View Profile commented out
    	    $ai_viewprof = "<img alt=\""._t("_View Profile")."\" name=i00$p_arr[ID] src=\"$site[images]pa_profile.gif\" border=0>";
    	    $al_viewprof = "<a href=\"$p_arr[NickName]\"";
    
            if ( $pa_icon_preload )
            {
             $al_viewprof.="onMouseOver=\"javascript:i00$p_arr[ID].src='$site[images]pa_profile2.gif';\"";
             $al_viewprof.="onMouseOut =\"javascript:i00$p_arr[ID].src='$site[images]pa_profile.gif';\"";
            }
    		$al_viewprof .= ">";
    		$ai_viewprof = $al_viewprof.$ai_viewprof."</a>";
            $al_viewprof .= _t("_View Profile")."</a>";
     View Profile commented out */
    //--- Greeting start ---//
    $chechActionRes = checkAction($member['ID'], ACTION_ID_SEND_VKISS);
    if ($chechActionRes[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $member['ID'] != $p_arr['ID']) {
        $ai_kiss = "<img alt=\"" . _t("_Greet") . "\" class=\"links_image\" name=i01{$p_arr['ID']} src=\"" . $site['url'] . "templates/tmpl_" . $tmpl . "/images/icons/action_greet_small.gif\" />";
        $al_kiss = '<a target=_blank href="greet.php?sendto=' . $p_arr[ID] . '"';
        if ($pa_icon_preload) {
            $al_kiss .= "onMouseOver=\"javascript: i01{$p_arr['ID']}.src='{$site['images']}pa_kiss2.gif';\"";
            $al_kiss .= "onMouseOut =\"javascript: i01{$p_arr['ID']}.src='{$site['images']}pa_kiss.gif';\"";
        }
        $al_kiss .= ">";
        $al_kiss = "<span class=\"links_span\">" . $ai_kiss . $al_kiss . _t("_Greet") . "</a></span>";
    } else {
        $al_kiss = '';
    }
    //--- Greeting end ---//
    //--- Contact start ---//
    $chechActionRes = checkAction($member['ID'], ACTION_ID_SEND_MESSAGE);
    if ($chechActionRes[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $member['ID'] != $p_arr['ID']) {
        $ai_sendmsg = "<img alt=\"" . _t("_SEND_MESSAGE") . "\" name=i02{$p_arr['ID']} src=\"{$site['url']}templates/tmpl_{$tmpl}/images/icons/action_send_small.gif\" class=\"links_image\" />";
        $al_sendmsg = "<a href=\"compose.php?ID={$p_arr['ID']}\"";
        if ($pa_icon_preload) {
            $al_sendmsg .= "onMouseOver=\"javascript: i02{$p_arr['ID']}.src='{$site['images']}pa_send2.gif';\"";
            $al_sendmsg .= "onMouseOut =\"javascript: i02{$p_arr['ID']}.src='{$site['images']}pa_send.gif';\"";
        }
        $al_sendmsg .= ">";
        $al_sendmsg = "<span class=\"links_span\">" . $ai_sendmsg . $al_sendmsg . _t("_Contact") . "</a></span>";
    } else {
        $al_sendmsg = '';
    }
    //--- Contact end ---//
    if ($logged['member']) {
        $ai_hot = "<img alt=\"" . _t("_hot member") . "\" name=i03{$p_arr['ID']} src=\"{$site['images']}pa_hot.gif\" border=0>";
        $al_hot = "<a href=\"javascript:void(0);\" onClick=\"javascript:window.open( 'list_pop.php?action=hot&ID=" . $p_arr['ID'] . "', '', 'width=280,height=200,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no, location=no' );\"";
        if ($pa_icon_preload) {
            $al_hot .= "onMouseOver=\"javascript: i03{$p_arr['ID']}.src='{$site['images']}pa_hot2.gif';\"";
            $al_hot .= "onMouseOut =\"javascript: i03{$p_arr['ID']}.src='{$site['images']}pa_hot.gif';\"";
        }
        $al_hot .= ">";
        $ai_hot = $al_hot . $ai_hot . "</a>";
        $al_hot .= _t("_hot member") . "</a>";
        $ai_friend = "<img alt=\"" . _t("_friend member") . "\" name=i03{$p_arr['ID']} src=\"{$site['images']}pa_friend.gif\" border=0>";
        $al_friend = "<a href=\"javascript:void(0);\" onClick=\"javascript:window.open( 'list_pop.php?action=friend&ID=" . $p_arr['ID'] . "', '', 'width=280,height=200,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no, location=no' );\"";
        if ($pa_icon_preload) {
            $al_friend .= "onMouseOver=\"javascript: i03{$p_arr['ID']}.src='{$site['images']}pa_friend2.gif';\"";
            $al_friend .= "onMouseOut =\"javascript: i03{$p_arr['ID']}.src='{$site['images']}pa_friend.gif';\"";
        }
        $al_friend .= ">";
        $ai_friend = $al_friend . $ai_friend . "</a>";
        $al_friend .= _t("_friend member") . "</a>";
        $ai_block = "<img alt=\"" . _t("_block member") . "\" name=i04{$p_arr['ID']} src=\"{$site['images']}pa_block.gif\" border=0>";
        $al_block = "<a href=\"javascript:void(0);\" onClick=\"javascript:window.open( 'list_pop.php?action=block&ID=" . $p_arr['ID'] . "', '', 'width=280,height=200,menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no, location=no' );\"";
        if ($pa_icon_preload) {
            $al_block .= "onMouseOver=\"javascript: i04{$p_arr['ID']}.src='{$site['images']}pa_block2.gif';\"";
            $al_block .= "onMouseOut =\"javascript: i04{$p_arr['ID']}.src='{$site['images']}pa_block.gif';\"";
        }
        $al_block .= ">";
        $ai_block = $al_block . $ai_block . "</a>";
        $al_block .= _t("_block member") . "</a>";
    }
    //--- Fave Start ---//
    if ($logged['member'] && $member['ID'] != $p_arr['ID']) {
        $ai_fave = "<img alt=\"" . _t("_Fave") . "\" class=\"links_image\" name=i03{$p_arr['ID']} src=\"{$site['url']}templates/tmpl_{$tmpl}/images/icons/action_fave_small.gif\" />";
        $al_fave = "<a href=\"javascript:void(0);\" onclick=\"window.open( 'list_pop.php?action=hot&amp;ID={$profileID}',    '', 'width={$oTemplConfig->popUpWindowWidth},height={$oTemplConfig->popUpWindowHeight},menubar=no,status=no,resizable=no,scrollbars=yes,toolbar=no,location=no' );\">";
        $al_fave = '<span class="links_span">' . $ai_fave . $al_fave . _t("_Fave") . "</a></span>";
    } else {
        $al_fave = '';
    }
    //--- Fave End ---//
    $more = '<a href="' . getProfileLink($p_arr['ID']) . '" target="_blank">';
    $more .= '<img src="' . $site['icons'] . 'desc_more.gif" alt="' . _t('_more') . '" />';
    $more .= '</a>';
    $enable_more_photos = 'on' == getParam("more_photos_on_searchrow") ? 1 : 0;
    if ($enable_more_photos) {
        $more_photos = '';
        for ($i = 1; $i <= $pic_num; ++$i) {
            if ($p_arr['Pic_' . $i . '_addon'] > 0) {
                $photo_counter++;
            }
        }
        if (0 < $photo_counter && ($logged['admin'] || $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED)) {
            $more_photos = '<a href="javascript:void(0);" onClick="javascript: get_gallery(' . $p_arr['ID'] . ');" class="search_more_photo">';
            $more_photos .= $photo_counter . '&nbsp;' . _t("_More Photos");
            $more_photos .= '</a>';
        } else {
            $more_photos = '';
        }
    }
    // ------------ [end] template variables --------------
    if ($aCoupleInfo) {
        // profile Nick/Age/Sex etc.
        $nick2 = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . $aCoupleInfo['NickName'] . '</a>';
        $age_str2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aCoupleInfo['DateOfBirth'])) . ' ' : "";
        $age_only2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? age($aCoupleInfo['DateOfBirth']) : "";
        $y_o_sex2 = $age_str2 . _t("_" . $aCoupleInfo['Sex']);
        $city2 = _t("_City") . ": " . process_line_output($aCoupleInfo['City']);
        $country2 = _t("_Country") . ": " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aCoupleInfo['Country'])) . '.gif" alt="flag" />';
        $city_con2 = process_line_output($aCoupleInfo['City']) . ", " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aCoupleInfo['Country'])) . '.gif" alt="flag" />';
        $occupation2 = process_line_output($aCoupleInfo['Occupation']);
        $children2 = $aCoupleInfo['Children'] ? $aCoupleInfo['Children'] . " " . _t("_children") : "";
        $id2 = _t("_ID") . ": " . $aCoupleInfo['ID'];
        // description
        $i_am2 = _t("_I am");
        $i_am_desc2 = process_smiles(strip_tags(process_text_output($aCoupleInfo['DescriptionMe']), '<img>')) . "...";
        $you_are2 = _t("_You are");
        $you_are_desc2 = process_smiles(process_text_output($aCoupleInfo['DescriptionYou'])) . "... <a href=\"" . getProfileLink($aCoupleInfo['ID']) . "\">" . _t("_more") . "</a>";
        $sCity2 = $aCoupleInfo['City'];
        $templ = str_replace("__add_style_c1__", 'float:left;width:31%;margin-right:10px;', $templ);
        $templ = str_replace("__add_style_c2__", 'float:left;width:31%;display:block;', $templ);
        $templ = str_replace("__nick2__", $nick2, $templ);
        $templ = str_replace("__age_sex2__", $y_o_sex2, $templ);
        $templ = str_replace("__city_con2__", $city_con2, $templ);
        $templ = str_replace("__i_am_desc2__", $i_am_desc2, $templ);
        if ($logged['member'] && $member['ID'] != $aCoupleInfo['ID'] && getParam('enable_match')) {
            $templ = str_replace("__match2__", getProfileMatch($member['ID'], $aCoupleInfo['ID']), $templ);
        } else {
            $templ = str_replace("__match2__", '', $templ);
        }
    } else {
        $templ = str_replace("__add_style_c1__", '', $templ);
        $templ = str_replace("__add_style_c2__", 'display:none;', $templ);
        $templ = str_replace("__match2__", '', $templ);
    }
    // replace template variables
    $templ = str_replace("__row_title__", process_line_output($p_arr[Headline]), $templ);
    $templ = str_replace("__n__", $iNumber, $templ);
    if (isset($p_arr['Couple']) && $p_arr['Couple'] > 0) {
        $iMaxThumbWidth = getParam('max_thumb_width');
        $iNewWidth = 2 * ($iMaxThumbWidth + 10 + 2);
        $templ = str_replace("__ext_st__", 'style="width:' . $iNewWidth . 'px;"', $templ);
    } else {
        $iMaxThumbWidth = getParam('max_thumb_width');
        $iNewWidth = 1 * ($iMaxThumbWidth + 12);
        $templ = str_replace("__ext_st__", 'style="width:' . $iNewWidth . 'px;"', $templ);
    }
    //$templ = str_replace ( "__ext_st__", '', $templ );
    $templ = str_replace("__thumbnail__", $thumbnail, $templ);
    $templ = str_replace("__launch_ray_im__", $launch_ray_im, $templ);
    // match progress bar
    if ($logged['member'] && $member['ID'] != $p_arr['ID'] && getParam('enable_match')) {
        $templ = str_replace("__match__", getProfileMatch($member['ID'], $p_arr['ID']), $templ);
    } else {
        $templ = str_replace("__match__", '', $templ);
    }
    $templ = str_replace("__nick__", $nick, $templ);
    $templ = str_replace("__age_sex__", $y_o_sex, $templ);
    $templ = str_replace("__city__", $city, $templ);
    $templ = str_replace("__just_city__", $sCity, $templ);
    $templ = str_replace("__just_age__", $age_only, $templ);
    $templ = str_replace("__city_con__", $city_con, $templ);
    $templ = str_replace("__country__", $country, $templ);
    $templ = str_replace("__occupation__", $occupation, $templ);
    $templ = str_replace("__children__", $children, $templ);
    $templ = str_replace("__id__", $id, $templ);
    if ($enable_zodiac) {
        $templ = str_replace("__zodiac_sign__", getProfileZodiac($p_arr['DateOfBirth']), $templ);
    } else {
        $templ = str_replace("__zodiac_sign__", "", $templ);
    }
    $templ = str_replace("__i_am__", $i_am, $templ);
    $templ = str_replace("__i_am_desc__", $i_am_desc, $templ);
    $templ = str_replace("__you_are__", $you_are, $templ);
    $templ = str_replace("__you_are_desc__", $you_are_desc, $templ);
    $templ = str_replace("__ai_im__", $ai_im, $templ);
    $templ = str_replace("__al_im__", $al_im, $templ);
    $templ = str_replace("__ai_viewprof__", $ai_viewprof, $templ);
    $templ = str_replace("__al_viewprof__", $al_viewprof, $templ);
    $templ = str_replace("__ai_kiss__", $ai_kiss, $templ);
    $templ = str_replace("__al_kiss__", $al_kiss, $templ);
    $templ = str_replace("__ai_sendmsg__", $ai_sendmsg, $templ);
    $templ = str_replace("__al_sendmsg__", $al_sendmsg, $templ);
    $templ = str_replace("__ai_fave__", $ai_fave, $templ);
    $templ = str_replace("__al_fave__", $al_fave, $templ);
    $templ = str_replace("__ai_hot__", $ai_hot, $templ);
    $templ = str_replace("__al_hot__", $al_hot, $templ);
    $templ = str_replace("__ai_block__", $ai_block, $templ);
    $templ = str_replace("__al_block__", $al_block, $templ);
    $templ = str_replace("__from__", _t("_from"), $templ);
    $templ = str_replace("__more__", $more, $templ);
    $templ = str_replace("__more_photos__", $more_photos, $templ);
    $templ = str_replace("__images__", $site['images'], $templ);
    if (function_exists('colors_select')) {
        $templ = str_replace("__designBoxColor__", colors_select(), $templ);
    }
    return $templ;
}