username = $data['username']; } public function processRequest() { $viewer = $this->getRequest()->getUser(); $user = id(new PhabricatorUser())->loadOneWhere( 'userName = %s', $this->username); if (!$user) { return new Aphront404Response(); } $profile = id(new PhabricatorUserProfile())->loadOneWhere( 'userPHID = %s', $user->getPHID()); if (!$profile) { $profile = new PhabricatorUserProfile(); } $links = array(); if ($user->getPHID() == $viewer->getPHID()) { $links[] = phutil_render_tag( 'a', array( 'href' => '/profile/edit/', ), 'Edit Profile'); } $oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere( 'userID = %d', $user->getID()); $oauths = mpull($oauths, null, 'getOAuthProvider'); $providers = PhabricatorOAuthProvider::getAllProviders(); foreach ($providers as $provider) { if (!$provider->isProviderEnabled()) { continue; } $provider_key = $provider->getProviderKey(); if (!isset($oauths[$provider_key])) { continue; } $name = $provider->getProviderName().' Profile'; $href = $oauths[$provider_key]->getAccountURI(); if ($href) { $links[] = phutil_render_tag( 'a', array( 'href' => $href, ), phutil_escape_html($name)); } } foreach ($links as $k => $link) { $links[$k] = '
  • '.$link.'
  • '; } $links = ''; $title = nonempty($profile->getTitle(), 'Untitled Document'); $username_tag = '

    '. phutil_escape_html($user->getUserName()). '

    '; $realname_tag = '

    '. '('.phutil_escape_html($user->getRealName()).')'. '

    '; $title_tag = '

    '. phutil_escape_html($title). '

    '; $src_phid = $profile->getProfileImagePHID(); if (!$src_phid) { $src_phid = $user->getProfileImagePHID(); } $src = PhabricatorFileURI::getViewURIForPHID($src_phid); $picture = phutil_render_tag( 'img', array( 'class' => 'profile-image', 'src' => $src, )); require_celerity_resource('phabricator-profile-css'); $blurb = nonempty( $profile->getBlurb(), '//Nothing is known about this rare specimen.//'); $factory = new DifferentialMarkupEngineFactory(); $engine = $factory->newDifferentialCommentMarkupEngine(); $blurb = $engine->markupText($blurb); $content = '

    Basic Information

    PHID '.phutil_escape_html($user->getPHID()).'
    User Since '.phabricator_format_timestamp($user->getDateCreated()).'
    '; $content .= '

    Flavor Text

    Blurb '.$blurb.'
    '; $profile = '
    '. $username_tag. $realname_tag. $title_tag. '
    '. $picture. '
    '. $links. '
    '. '
    '. $content. '
    '; return $this->buildStandardPageResponse( $profile, array( 'title' => $user->getUsername(), )); } }