heres what fixed mine
file in location:
components/com_comprofiler/plugin/user/plug_g2bridge/g2bridge.php
[code:1]
<?php
class getg2bridgeTab extends cbTabHandler {
/**
* Constructor
*/
function getg2bridgeTab() {
$this->cbTabHandler();
}
/**
* Generates the HTML to display the user profile tab
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function getDisplayTab($tab,$user,$ui) {
global $database, $my;
$return="";
if(!file_exists('components/com_gallery2/init.inc')){
return _G2BRIDGE_GALLERYNOTINSTALLED;
}
/* setup base */
require_once('components/com_gallery2/init.inc');
core::initiatedG2();
core::classRequireOnce('utility');
core::classRequireOnce('user');
global $gallery, $g2Cache;
$g2ProfileId = utility::getG2Id($user->id);
$g2ViewerId = utility::getG2Id($my->id);
$params=$this->params;
$imgTextIfNoImg = $params->get('imgTextnoImg', _G2BRIDGE_NOIMAGES);
$imgSortByAllowed = $params->get('imgSortByAllowed', 0);
$imgNumberPerPage = $params->get('imgNumberPerPage', '10');
$pagingParams = $this->_getPaging(array(),array("img_"«»));
$offset = $pagingParams["img_limitstart"] ? $pagingParams["img_limitstart"] : 0;
if(empty($imgSortByAllowed)){
$imageList = $params->get('imgSortBy', 'date');
} else {
$imageList = $pagingParams;
}
$data = getList($imageList, $g2ViewerId, $g2ProfileId, $offset, $imgNumberPerPage);
if($data<1) {
if ($imgTextIfNoImg) {
if ($tab->description != null) $return .= "\t\t<div class=\"tab_Description\">".unHtmlspecialchars(getLangDefinition($tab->description))."</div>\n";
$return .= $imgTextIfNoImg;
}
return $return;
}
if ($tab->description != null) $return .= "\t\t<div class=\"tab_Description\">".unHtmlspecialchars(getLangDefinition($tab->description))."</div>\n";
if(!empty($imgSortByAllowed)){
$return.= "<div style=\"margin-bottom:10px;\">".sprintf(_UE_CLICKTOSORTBY, ":"«»);
$return .= "<span style=\"margin:12px;\">".$this->_writeSortByLink($pagingParams,"img_","date",_G2BRIDGE_SORTLAST,true)."</span>";
$return .= "<span style=\"margin:12px;\">".$this->_writeSortByLink($pagingParams,"img_","hits",_G2BRIDGE_SORTVIEWS)."</span>";
$return .= "<span style=\"margin:12px;\">".$this->_writeSortByLink($pagingParams,"img_","album",_G2BRIDGE_SORTALBUM)."</span>";
$return.= "</div>";
}
foreach ($data as $photo) {
$photo = $photo;
$return.= "<div class=\"containerBox\">";
$return.= "<a href=\"".$photo."\"><b>".$photo."</b></a><br />";
$return.= "<a href=\"".$photo."\">"
."<img src=\"".$photo."\" border=\"0\" alt=\"\" title=\"".$photo."\" />"
."</a>\n";
$return.= "</div>";
}
$return .= "<div style=\"clear:both;\"> </div>";
if ($imgNumberPerPage < $data) {
$return .= "<div style='width:95%;text-align:center;'>"
.$this->_writePaging($pagingParams, "img_", $imgNumberPerPage, $data)
."</div>";
}
return $return;
}
}
function getList($imageList, $g2ViewerId, $ownerId, $offset, $count){
global $gallery;
$urlGenerator = $gallery->getUrlGenerator();
switch ($imageList) {
case "album":
$aclIds = core::getAclIds(array('core.view'), $g2ViewerId);
$orderBy = '[GalleryItem::originationTimestamp] DESC';
$albumCheck = 1;
break;
case "hits":
$aclIds = core::getAclIds(array('core.view'), $g2ViewerId);
$orderBy = '[GalleryItemAttributesMap::viewCount] DESC';
$albumCheck = 0;
break;
case "date":
default:
$aclIds = core::getAclIds(array('core.view'), $g2ViewerId);
$orderBy = '[GalleryItem::originationTimestamp] DESC';
$albumCheck = 0;
break;
}
if (empty($aclIds)) {
return array('start' => 0, 'end' => '0', 'count' => 0, 'results' => array());
}
$aclMarkers = GalleryUtilities::makeMarkers(count($aclIds));
$countQuery = sprintf('
SELECT
COUNT([GalleryItem::id])
FROM
[GalleryItem], [GalleryAccessSubscriberMap], [GalleryItemAttributesMap]
WHERE
[GalleryAccessSubscriberMap::itemId] = [GalleryItem::id]
AND
[GalleryItemAttributesMap::itemId] = [GalleryItem::id]
AND
[GalleryItem::canContainChildren] = ?
AND
[GalleryItem::ownerId] = ?
AND
[GalleryAccessSubscriberMap::accessListId] IN (%s)
ORDER BY
%s
', $aclMarkers, $orderBy);
$query = sprintf('
SELECT
[GalleryItem::id]
FROM
[GalleryItem], [GalleryAccessSubscriberMap], [GalleryItemAttributesMap]
WHERE
[GalleryAccessSubscriberMap::itemId] = [GalleryItem::id]
AND
[GalleryItemAttributesMap::itemId] = [GalleryItem::id]
AND
[GalleryItem::canContainChildren] = ?
AND
[GalleryItem::ownerId] = ?
AND
[GalleryAccessSubscriberMap::accessListId] IN (%s)
ORDER BY
%s
', $aclMarkers, $orderBy);
$data = array();
$data[] = $albumCheck;
$data[] = $ownerId;
$data = array_merge($data, $aclIds);
/* count total */
list ($ret, $results) = $gallery->search($countQuery, $data);
/* if ($ret->isError()) { */
/* error reporting, use cb style but have to read it first */
/* return false; */
/* } */
/* $result = $results->nextResult(); */
$numRows = (int)$result[0];
/* fetch the images */
list ($ret, $results) = $gallery->search(
$query, $data, array('limit' => array('offset' => $offset, 'count' => $count)));
/* if ($ret->isError()) { */
/* error reporting, use cb style but have to read it first */
/* return false; */
/* } */
$searchResults = array();
while ($result = $results->nextResult()) {
$itemId = (int)$result[0];
list($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
$fields = array();
$title = $item->getTitle() ? $item->getTitle() : $item->getPathComponent();
$fields = preg_replace('/\r\n/', ' ', $title);
list (, $fields) = GalleryCoreApi::fetchItemViewCount($itemId);
list(,$thumbs) = GalleryCoreApi::fetchThumbnailsByItemIds(array($itemId));
$fields = @$urlGenerator->generateUrl(array('view' => 'core.ShowItem', 'itemId' => $thumbs[$itemId]->getderivativeSourceId()));
$fields = @$urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $thumbs[$itemId]->getId()));
$searchResults[] = array('itemId' => $itemId,
'fields' => $fields);
}
$data = array('start' => $numRows == 0 ? 0 : $offset+1,
'end' => $numRows == 0 ? 0 : $offset + sizeof($searchResults),
'count' => $numRows,
'results' => $searchResults);
return $data;
}
?>[/code:1]
Post edited by: sastian, at: 2006/09/25 11:50