<?php 

if($_G['pa_count'] < 1) {

    odz_error('parameters_error', -112);

}



if($_GET['editmode'] == 'yes' && !$_G['uid']) {

    odz_error('not_loggedin', ODZ_ERR_LOGIN);

}



$_GET['uid'] = (int)$_GET['uid'];

if(!$_GET['uid']) {

    odz_error('parameters_error', -113);

}



$space = getuserbyuid($_GET['uid'], 1);

if(!$space) {

    odz_error('member_nonexistence');

}



require_once libfile('function/spacecp');



space_merge($space, 'count');

space_merge($space, 'field_home');

space_merge($space, 'field_forum');

space_merge($space, 'profile');

space_merge($space, 'status');

getonlinemember(array($space['uid']));



require_once libfile('function/misc');



$profile = array(

    'uid' => $space['uid'],

    'email' => $space['email'],

    'username' => $space['username'],

    'grouptitle' => strip_tags($_G['cache']['usergroups'][$space['groupid']]['grouptitle']),

    'avatar' => avatar($space['uid'], 'middle', true),

    'friends' => $space['friends'],

    'posts' => (string)$space['posts'],

    'threads' => (string)$space['threads'],

    'credits' => (string)$space['credits'],

    'extcredits1' => $space['extcredits1'],

    'extcredits2' => $space['extcredits2'],

    'extcredits3' => $space['extcredits3'],

    'extcredits4' => $space['extcredits4'],

    'extcredits5' => $space['extcredits5'],

    'extcredits6' => $space['extcredits6'],

    'extcredits7' => $space['extcredits7'],

    'extcredits8' => $space['extcredits8'],

    'oltime' => $space['oltime'],

    'follower' => $space['follower'],

    'following' => $space['following'],

    'sharings' => $space['sharings'],

    'regdate' => dgmdate($space['regdate']),

    'regip' => $space['regip'],

    'regip_loc' => convertip($space['regip']),

    'lastip' => $space['lastip'],

    'lastip_loc' => convertip($space['lastip']),

    'lastvisit' => dgmdate($space['lastvisit']),

    'gender' => $space['gender'],

    'emailstatus' => $space['emailstatus']

);

unset($space);



$onlinedata = C::app()->session->fetch_by_uid($param['uid']);

if($onlinedata) {

    $profile['onlinestatus'] = $onlinedata['lastactivity']; 

} else {

    $profile['onlinestatus'] = 0;

}



$mobilestatus = 0;

if($_G['uid']) {

    $bind_mobile = DB::fetch_first('SELECT mobile, dateline FROM '.DB::table('mocuz_mobile')." WHERE uid = '$_G[uid]'");

    if ($bind_mobile) {

        $mobilestatus = 1;

        $profile['bind_mobile'] = $bind_mobile;

    } else {

        $profile['bind_mobile'] = '';

    }

}

$profile['mobilestatus'] = $mobilestatus;



odz_result(array('profile'=>$profile));

?>