/***************************************************************************
* Dolphin Smart Community Builder
* -----------------
* begin : Mon Mar 23 2006
* copyright : (C) 2006 BoonEx Group
* website : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details.
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolMediaQuery.php' );
// --------------- page variables and login
$_page['name_index'] = 26;
$_page['css_name'] = 'upload_media.css';
$_ni = $_page['name_index'];
check_logged();
$max_thumb_width = (int)getParam( 'max_thumb_width' );
$max_thumb_height = (int)getParam( 'max_thumb_height' );
$_page['header'] = _t( "_HOTORNOT_H" );
$_page['header_text'] = _t( "_HOTORNOT_H1" );
// --------------- GET/POST actions
$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
PageCode();
function PageCompPageMainCode() {
global $site;
global $oTemplConfig;
$aPhoto = getVotingItem();
$check_res = checkAction( $_COOKIE['memberID'], ACTION_ID_RATE_PHOTOS );
if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED )
{
$ret = '
' . $check_res[CHECK_ACTION_MESSAGE] . ' |
';
return $ret;
}
$ret = '';
if ($_GET['prev_id'])
$ret .= showPreviousRated((int)$_GET['prev_id']);
if( $oTemplConfig -> customize['rate']['showSexSelector'] )
{
$ret .= '';
$ret .= '';
$ret .= '
';
}
if( empty( $aPhoto ) )
{
$ret .= _t_action('_there_is_no_photo_that_you_can_rate');
}
else
{
if( $oTemplConfig -> customize['rate']['showProfileInfo'] )
{
$ret .= '';
$ret .= ProfileDetails( $aPhoto['med_prof_id'] );
$ret .= '';
}
$ret .= getRatingPhoto( $aPhoto );
$oVotingView = new BxTemplVotingView ('media', (int)$aPhoto['med_id']);
if( $oVotingView->isEnabled())
{
$sUrlAdd = '';
if ($_REQUEST['showme'])
$sUrlAdd .= 'showme='.$_REQUEST['showme'].'&';
$ret .= "
";
$ret .= '' . $oVotingView->getBigVoting () . '
';
}
}
return $ret;
}
function getVotingItem() {
if ( strlen($_REQUEST['showme']) && $_REQUEST['showme'] != 'all' ) {
$sSexOnly = process_db_input($_REQUEST['showme']);
}
$sVoted = getVotedItems();
$oMediaQuery = new BxDolMediaQuery();
$oDolVoting = new BxDolVoting ('media', 0, 0);
return $oMediaQuery -> selectVotingItem( $oDolVoting, $sVoted, $sSexOnly );
}
function VotingTrack( $iMediaID )
{
$oMediaQuery = new BxDolMediaQuery();
$iMediaID = (int)$iMediaID;
$ip = getVisitorIP();
$oMediaQuery -> insertVotingTrack( $iMediaID, $ip );
}
function getVotedItems()
{
$ip = getVisitorIP();
$oDolVoting = new BxDolVoting ('media', 0, 0);
$_aVotedItems = $oDolVoting -> getVotedItems ($ip);
$aVotedItems = reviewArray( $_aVotedItems );
return $aVotedItems;
}
function reviewArray( $arrays )
{
$line = '';
foreach($arrays as $array)
{
$line .= '\'' . $array['med_id'] . '\',';
}
$line .= '\'\'';
return $line;
}
function getRatingPhoto( $aPhoto )
{
global $max_photo_width, $max_photo_height, $dir, $site;
$sFileSrc = $dir['profileImage'] . $aPhoto['med_prof_id'] . '/photo_' . $aPhoto['med_file'];
if( extFileExists($sFileSrc) )
{
$sPhotoUrl = $site['profileImage'] . $aPhoto['med_prof_id'] . '/photo_' . $aPhoto['med_file'];
}
else
{
header('Location:' . $_SERVER['PHP_SELF']);
}
$ret = '';
$ret .= '';
$ret .= process_line_output( $aPhoto['med_title'] );
$ret .= '
';
$ret .= '';
$ret .= '
';
$ret .= '
';
return $ret;
}
function showPreviousRated( $iPhotoID )
{
global $site;
global $oTemplConfig;
global $max_thumb_width;
global $max_thumb_height;
$iBarWidth = $oTemplConfig -> iRateSmallRatingBar;
$iBarNum = $oTemplConfig -> iRateSmallRatingBarNum;
$query = "
SELECT
`media`.`med_id`,
`med_prof_id`,
`med_file`,
`med_title`,
`med_rating_count`,
`med_rating_sum`,
`Profiles`.`NickName`
FROM `media`
LEFT JOIN `media_rating` USING (`med_id`)
LEFT JOIN `Profiles` ON
(`Profiles`.`ID`=`media`.`med_prof_id`)
WHERE
`med_status` = 'active'
AND `media`.`med_id` = $iPhotoID
";
$ph_arr = db_arr( $query );
if( !$ph_arr )
return '';
$urlImg = "{$site['profileImage']}{$ph_arr['med_prof_id']}/thumb_{$ph_arr['med_file']}";
$urlSpacer = getTemplateIcon( 'spacer.gif' );
$sProfLink = getProfileLink($ph_arr['med_prof_id']);
$sRatingBar = '';
$oVotingView = new BxTemplVotingView ('media', (int)$iPhotoID);
if( $oVotingView->isEnabled())
$sRatingBar = $oVotingView->getSmallVoting (false);
$ret .= <<
EOJ;
return DesignBoxContent( _t('_Previous rated'), $ret, 1 );
}
?>