####################################################
#                                                                                                    #
#                 .          #
#             FILE TO UTF-8                                                                #
#             : ˸                                                        #
#             AUTHOR:     Anvar (Anv@r.all)                                       #
#              : http://apwa.ru (   =)) #
####################################################


//      album.php
//
//      
//--------------------------------------------------------------------------------------------------------

$page_title = $lang['Album'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'album_personal_body.tpl')
);

//----------------------------------------------------------------------------------------------------------

//        
//----------------------------------------------------------------------------------------------------------

if ( $user_id == $userdata['user_id'] )
{
	$template->assign_block_vars('avatarremote', array());
}
if ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['submitavatar']) )
{	
	$user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['avatarremoteurl'])) : '';
	
	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);

	if ( $user_id != $userdata['user_id'] )
	{
		message_die(GENERAL_ERROR, $lang['Wrong_Profile']);
	}

        if ( $user_avatar_remoteurl != '')
	{
	       if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
	       {
		        user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);	

			$sql = "UPDATE " . USERS_TABLE . "
				SET user_avatar = '" . $user_avatar_remoteurl . "', user_avatar_type = '2'
				WHERE user_id = " . $userdata['user_id'];
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			}

			$message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

			$template->assign_vars(array(
				"META" => '<meta http-equiv="refresh" content="0;url=' . append_sid("index.$phpEx") . '">')
			);               
		        message_die(GENERAL_MESSAGE, $message);
		}        
	}
	else
	{
	        message_die(GENERAL_MESSAGE, $lang['Only_one_avatar']);
	}
}

//----------------------------------------------------------------------------------------------------------------
//        
//-----------------------------------------------------------------------------------------------------------------

'DESC' => $picrow[$j]['pic_desc'],

//-----------------------------------------------------------------------------------------------------------------
//       
//-----------------------------------------------------------------------------------------------------------------

'INPUT_VALUE' => ( $user_id == $userdata['user_id'] ) ? '<input type="radio" name="avatarremoteurl" value="album.' . $phpEx . '?action=thumbnail&pic_id=' . $picrow[$j]['pic_id'] . '"/>' : '',				

//-----------------------------------------------------------------------------------------------------------------
//         
//-----------------------------------------------------------------------------------------------------------------

if ($album_user_access['view'] == 0)
{
	die($lang['Not_Authorised']);
}

//-------------------------------------------------------------------------------------------------------------------
//        album_personal_body.tpl
//-----------------------------------------------------------------------------
//       
//-----------------------------------------------------------------------------

<!-- BEGIN picrow -->

//         

<!-- BEGIN avatarremote -->
<form action="{U_PERSONAL_GALLERY}" method="post">
<!-- END avatarremote -->

//         

<br/>{picrow.piccol.APPROVAL}

//          

{picrow.piccol.INPUT_VALUE}

//        

<!-- END picrow -->

//         

<!-- BEGIN avatarremote -->
<input type="submit" name="submitavatar" value=" "/>
</form>
<!-- END avatarremote -->

//   =)) P.S.    =)) P.P.S.      =))	