active= new Image();
active.src="' . $site['url'] . 'templates/base/images/media_tab_active.png;";
passive= new Image();
passive.src="' . $site['url'] . 'templates/base/images/media_tab_passive.png;";
hover= new Image();
hover.src="' . $site['url'] . 'templates/base/images/media_tab_hover.png;";
';
$logged['member'] = member_auth( 0 );
$_page['header'] = _t( "_Profile Photos" );
//$_page['header_text'] = _t( "_UPLOAD_MEDIA", $site['title'] );
$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompMainCode();
PageCode();
function PageCompMainCode()
{
global $tmpl, $_page, $oTemplConfig;
$iProfileID = (int)$_COOKIE['memberID'];
$show = $_REQUEST['show'];
switch( $show )
{
case 'photo':
default:
require_once( BX_DIRECTORY_PATH_ROOT . 'uploadPhoto.php' );
$oMedia = new UploadPhoto( $iProfileID );
$oMedia -> getMediaArray();
$_page['header_text'] = _t( "_My Photos" );
break;
}
$ret = '';
$ret .= '
';
if( $oTemplConfig -> customize['upload_media']['showMediaTabs'] )
{
$ret .= '
';
$ret .= getMediaTabs( $oMedia -> sMediaType, $oMedia -> aMediaConfig['enable'] );
$ret .= '
' . "\n";
$ret .= '';
}
if( $oTemplConfig -> customize['upload_media']['showAddButton'] )
{
$ret .= '' . "\n";
}
$ret .= '';
if( $oMedia -> iMediaCount >= $oMedia -> aMediaConfig['max'][$oMedia -> sMediaType] )
{
$ret .= _t_action('_too_many_files');
}
else
{
$ret .= '
';
}
$ret .= '
' . "\n";
$action = $_REQUEST['action'];
if( $_POST['makePrim'] || isset($_POST['makePrim_x'] ) )
{
$action = 'makePrim';
}
elseif( $_POST['makePrimCouple'] || isset($_POST['makePrimCouple_x'] ) )
{
$action = 'makePrimCouple';
}
elseif( $_POST['makeRable'] )
{
$action = 'makeRable';
}
elseif( $_POST['deletePhoto'] || isset($_POST['deletePhoto_x']) )
{
$action = 'deletePhoto';
}
$iPhotoID = (int)$_REQUEST['photoID'];
$iMediaID = (int)$_REQUEST['mediaID'];
switch($action)
{
case 'upload':
$ret .= $oMedia -> uploadMedia();
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType );
break;
case 'makePrim':
$ret .= $oMedia -> makePrimPhoto( $iPhotoID );
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType);
break;
case 'makeRable':
$ret .= $oMedia -> makeRablePhoto( $iPhotoID );
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType);
break;
case 'makePrimCouple':
$ret .= $oMedia -> makePrimPhoto( $iPhotoID, true );
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType);
break;
case 'deletePhoto':
$ret .= $oMedia -> deleteMedia( $iPhotoID );
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType);
break;
case 'delete':
$ret .= $oMedia -> deleteMedia( $iMediaID );
header('Location:' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType);
break;
}
switch( $show )
{
case 'photo':
default:
if( $_REQUEST['photoID'] )
{
$iPhotoId = (int)$_REQUEST['photoID'];
$ret .= $oMedia -> getMediaPage($iPhotoId);
}
else
{
$ret .= $oMedia -> getMediaPage();
}
break;
}
return $ret;
}
function getMediaTabs( $show = 'photo', $aMediaConf ) {
$aItems = array( 'photo' );
foreach( $aItems as $sItem )
{
if( $aMediaConf[$sItem] )
{
if( $sItem == $show )
{
$ret .= '';
$ret .= '
';
$ret .= _t('_' . $sItem . '');
$ret .= '
';
$ret .= '
';
}
else
{
$ret .= '';
}
}
else
{
$ret .= '';
}
}
return $ret;
}
?>