This function seems to be able to allow one to retrieve just about any photo from the site. Anyone care to walk through the function its use?
function BxPhotosSearch ($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '')
{
parent::BxTemplSearchResultSharedMedia('BxPhotosModule');
$this->aConstants['linksTempl'] = array(
'home' => 'home',
'file' => 'view/{uri}',
'category' => 'browse/category/{uri}',
'browseAll' => 'browse/',
'browseUserAll' => 'albums/browse/owner/{uri}',
'browseAllTop' => 'browse/top',
'tag' => 'browse/tag/{uri}',
'album' => 'browse/album/{uri}',
'add' => 'browse/my/add'
);
$aMain = array(
'name' => 'bx_photos',
'title' => '_bx_photos',
'table' => 'bx_photos_main'
);
$this->aCurrent = array_merge($aMain, $this->aCurrent);
$this->aCurrent['ownFields'] = array('ID', 'Title', 'Uri', 'Date', 'Size', 'Views', 'Rate', 'RateCount', 'Hash');
$this->aCurrent['searchFields'] = array('Title', 'Tags', 'Desc', 'Categories');
$this->aCurrent['rss']['title'] = _t('_bx_photos');
// redeclaration some unique fav fields
$this->aAddPartsConfig['favorite']['table'] = 'bx_photos_favorites';
$this->aAddPartsConfig['favorite']['mainField'] = 'ID';
$this->oTemplate = &$this->oModule->_oTemplate;
$this->aConstants['filesUrl'] = $this->oModule->_oConfig->getFilesUrl();
$this->aConstants['filesDir'] = $this->oModule->_oConfig->getFilesPath();
$this->aConstants['filesInAlbumCover'] = 17;
$this->aConstants['picPostfix'] = $this->oModule->_oConfig->aFilePostfix;
$this->aCurrent['restriction']['albumType']['value'] = $this->aCurrent['name'];
switch ($sParamName) {
case 'calendar':
$this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00')", 'field' => 'Date', 'operator' => '>=', 'no_quote_value' => true);
$this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59')", 'field' => 'Date', 'operator' => '<=', 'no_quote_value' => true);
$this->aCurrent['title'] = _t('_bx_photos_caption_browse_by_day') . sprintf("%04u-%02u-%02u", $sParamValue, $sParamValue1, $sParamValue2);
break;
case 'top':
$this->aCurrent['sorting'] = 'top';
break;
case 'popular':
$this->aCurrent['sorting'] = 'popular';
break;
case 'featured':
$this->aCurrent['restriction']['featured'] = array(
'value'=>'1', 'field'=>'Featured', 'operator'=>'=', 'paramName'=>'bx_photos_mode'
);
break;
case 'favorited':
if (isset($this->aAddPartsConfig['favorite']) && !empty($this->aAddPartsConfig['favorite']) && getLoggedId() != 0) {
$this->aCurrent['join']['favorite'] = $this->aAddPartsConfig['favorite'];
$this->aCurrent['restriction']['fav'] = array(
'value' => getLoggedId(),
'field' => $this->aAddPartsConfig['favorite']['userField'],
'operator' => '=',
'table' => $this->aAddPartsConfig['favorite']['table']
);
}
break;
case 'album':
$this->aCurrent['sorting'] = 'album_order';
$this->aCurrent['restriction']['album'] = array(
'value'=>'', 'field'=>'Uri', 'operator'=>'=', 'paramName'=>'albumUri', 'table'=>'sys_albums'
);
$this->aCurrent['restriction']['albumType'] = array(
'value'=>$this->aCurrent['name'], 'field'=>'Type', 'operator'=>'=', 'paramName'=>'albumType', 'table'=>'sys_albums'
);
if ($sParamValue1 == 'owner' && strlen($sParamValue2) > 0) {
$this->aCurrent['restriction']['owner'] = array(
'value'=>$sParamValue2, 'field'=>'NickName', 'operator'=>'=', 'paramName'=>'ownerName', 'table' => 'Profiles'
);
}
break;
}
}