/** * Generate a Block of searching result by Tag (GET is tagKey) * * @return HTML presentation of data */ function GenSearchResult() { global $site; $iCheckedMemberID = $this->aBlogConf['visitorID']; $sRestrictRes = $this->CheckRestrictionToView($iCheckedMemberID); if ($sRestrictRes != '') { return $sRestrictRes; } $bNoProfileMode = isset($_REQUEST['ownerID']) || isset($_REQUEST['ownerName']) ? false : true; $sRetHtml = ''; $sSearchedTag = process_db_input($_REQUEST['tagKey']); $iMemberID = $this->defineUserId(); $sDateFormatPhp = getParam('php_date_format'); $sTagsC = _t('_Tags'); $sNoBlogC = _t('_No blogs available'); $sBlogPosts = ''; $sWhereAddon = $iMemberID > 0 ? "AND `BlogCategories`.`OwnerID` = {$iMemberID}" : ''; $sOwnerAddAp = $iMemberID == $this->aBlogConf['visitorID'] ? '' : "AND `PostStatus`='approval'"; $sBlogPostsSQL = "\n\t\t\tSELECT `BlogPosts`. * , `BlogCategories`.`CategoryName`, `BlogCategories`.`CategoryUri`, `BlogCategories`.`CategoryID`, `BlogCategories`.`OwnerID` AS 'OwnID'\n\t\t\tFROM `BlogPosts` \n\t\t\tINNER JOIN `BlogCategories` ON `BlogCategories`.`CategoryID` = `BlogPosts`.`CategoryID` \n\t\t\tWHERE 1 \n\t\t\t{$sWhereAddon}\n\t\t\t{$sOwnerAddAp}\n\t\t"; $vBlogPosts = db_res($sBlogPostsSQL); while ($aResSQL = mysql_fetch_assoc($vBlogPosts)) { $sDateTime = date($sDateFormatPhp, strtotime($aResSQL['BlogDate'])); $oCmts = new BxDolCmts('blogposts', $aResSQL['PostID']); $iCountBlogComments = $oCmts->getObjectCommentsCount(); $sTagsCommas = $aResSQL['Tags']; $aTags = split(',', $sTagsCommas); if (in_array($sSearchedTag, $aTags)) { $sProfNickName = getNickName($aResSQL['OwnID']); if ($iMemberID > 0) { $aUser = array('Permalink' => $sProfNickName, 'Link' => $aResSQL['OwnID']); } else { $aUser = ''; } foreach ($aTags as $sTagKey) { $sTagLink = $this->genBlogLink('search_by_tag', $aUser, '', '', $sTagKey); $sTagsHrefs .= <<<EOF <a href="{$sTagLink}" >{$sTagKey}</a> EOF; } $sActions = ''; if (($this->aBlogConf['visitorID'] == $aBlogsRes['OwnerID'] || $this->bAdminMode == TRUE) && $iMemberID > 0) { $sLink = $this->genBlogFormUrl(); $sActions = <<<EOF <div class="fr"> \t\t<a href="{$sLink}" onclick="javascript: UpdateField('EditPostID','{$aResSQL['PostID']}');document.forms.command_edit_post.submit();return false;" style="text-transform:none;">{$sEditC}</a> \t\t<a href="{$sLink}" onclick="javascript: if (confirm('{$sSureC}')) {UpdateField('DeletePostID','{$aResSQL['PostID']}');UpdateField('DOwnerID','{$aBlogsRes['OwnerID']}');document.forms.command_delete_post.submit(); } return false;" style="text-transform:none;">{$sDeleteC}</a> </div> EOF; } $sProfileLink = $iMemberID > 0 ? '' : "<a href=" . getProfileLink($aResSQL['OwnID']) . ">" . $sProfNickName . "</a>"; $bFriend = is_friends($this->aBlogConf['visitorID'], $aResSQL['OwnID']); $bOwner = $this->aBlogConf['visitorID'] == $aResSQL['OwnID'] ? true : false; if ('friends' == $aResSQL['PostReadPermission'] && !$bFriend && !$bOwner && !$this->bAdminMode) { $sMsgBox = MsgBox(_t('_this_blog_only_for_friends')); $sBlogPosts .= <<<EOF <div class="clear_both"></div> \t<img src="{$site['icons']}lock.gif" alt="" class="marg_icon" style="float:right;position:relative;" /> \t{$sMsgBox} <div class="clear_both"></div> EOF; } else { $aUser = array('Permalink' => $sProfNickName, 'Link' => $aResSQL['OwnID']); $aPost = array('Permalink' => $aResSQL['PostUri'], 'Link' => $aResSQL['PostID']); $aCat = array('Permalink' => $aResSQL['CategoryUri'], 'Link' => $aResSQL['CategoryID']); $sPostLink = $this->genBlogLink('show_member_post', $aUser, '', $aPost); $sCatLink = $this->genBlogLink('show_member_blog', $aUser, $aCat, $aPost); $sBlogPosts .= <<<EOF <div class="cls_res_info_p1"> \t<div class="cls_res_thumb"> \t\t<a class="actions" href="{$sPostLink}"> \t\t\t{$aResSQL['PostCaption']} \t\t</a> \t</div> \t{$sActions} \t<div class="clear_both"></div> </div> <div class="fr_small_gray_centered"> \t{$sProfileLink} \t<span style="vertical-align:middle;"><img src="{$site['icons']}clock.gif" style="position:static;margin-right:7px;" alt="{$sDateTime}" /></span>{$sDateTime} \t<span style="vertical-align:middle;"><img src="{$site['icons']}add_comment.gif" alt="{$sAddCommentC}" title="{$sAddCommentC}" style="position:static;margin-right:7px;" /></span>{$iCountBlogComments} comments \t<span style="vertical-align:middle;"><img src="{$site['icons']}folder_small.png" style="position:static;margin-right:7px;" /></span> \t<a href="{$sCatLink}"> \t\t{$aResSQL['CategoryName']} \t</a> </div> <div class="cls_res_info_p1"> \t{$aResSQL['PostText']} </div> <div class="cls_res_info_p1"> \t<span style="vertical-align:middle;"><img src="{$site['icons']}tag_small.png" style="position:static;margin-right:7px;" alt="" /></span>{$sTagsC}: {$sTagsHrefs} </div> <br /> EOF; } } else { //return MsgBox(_t('_Sorry, nothing found')); } } if ($sBlogPosts == '') { $sBlogPosts = MsgBox(_t('_Sorry, nothing found')); } $sContentSect = DesignBoxContent($sTagsC . ' - ' . $sSearchedTag, $sBlogPosts, 1); if ($bNoProfileMode == false) { $sRightSect = ''; if ($iMemberID > 0 && ($a = $this->GetProfileData($iMemberID))) { $sBlogsSQL = "\n\t\t\t\t\tSELECT `Blogs`. * , `Profiles`.`Nickname` \n\t\t\t\t\tFROM `Blogs` \n\t\t\t\t\tINNER JOIN `Profiles` ON `Blogs`.`OwnerID` = `Profiles`.`ID`\n\t\t\t\t\tWHERE `Blogs`.`OwnerID` = {$iMemberID}\n\t\t\t\t\tLIMIT 1\n\t\t\t\t"; $aBlogsRes = db_arr($sBlogsSQL); if (mysql_affected_rows() == 0) { $sNoBlogC = MsgBox($sNoBlogC); $sRetHtml = <<<EOF <div> \t<div class="clear_both"></div> \t<div class="{$sWidthClass}"> \t\t{$sNoBlogC} \t</div> \t<div class="clear_both"></div> </div> <div class="clear_both"></div> EOF; } else { $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes); $sWidthClass = $iMemberID > 0 ? 'cls_info_left' : 'cls_res_thumb'; $sRetHtml = $this->Templater($sContentSect, $sRightSect, $sWidthClass); } } else { $sRetHtml = MsgBox(_t('_Profile Not found Ex')); } } else { $sRetHtml = <<<EOF <div> \t<div class="clear_both"></div> \t<div class="{$sWidthClass}"> \t\t{$sContentSect} \t</div> \t<div class="clear_both"></div> </div> <div class="clear_both"></div> EOF; } return $sRetHtml; }