Commit:    6877baa6e81ec5c3509eb5b0443cc9be7c2d1c70
Author:    Peter Cowburn <[email protected]>         Thu, 15 Nov 2012 
20:08:58 +0000
Parents:   62425947de74cc2275518e82a3ec13df78d774f8
Branches:  master

Link:       
http://git.php.net/?p=web/people.git;a=commitdiff;h=6877baa6e81ec5c3509eb5b0443cc9be7c2d1c70

Log:
add user profile text

Changed paths:
  M  include/misc.php
  M  styles.css
  M  user.php


Diff:
diff --git a/include/misc.php b/include/misc.php
index d2edb59..3297718 100644
--- a/include/misc.php
+++ b/include/misc.php
@@ -84,6 +84,37 @@ function findPEARUser($username)
     );
 }
 
+function findPHPUserProfile($username)
+{
+    $opts = array("ignore_errors" => true);
+    $ctx = stream_context_create(array("http" => $opts));
+    $token = getenv("TOKEN");
+    if (!$token) {
+        $token = trim(file_get_contents("token"));
+    }
+    $retval = 
@file_get_contents("http://master.php.local/fetch/user-profile.php?username="; . 
$username . "&token=" . rawurlencode($token), false, $ctx);
+    if (!$retval) {
+        if (isset($http_response_header) && $http_response_header) {
+            list($protocol, $errcode, $errmsg) = explode(" ", 
$http_response_header[0], 3);
+        } else {
+            $error   = error_get_last();
+            // Remove the function name, arguments and all that stuff... we
+            // really only care about whatever comes after the last colon
+            $message = explode(":", $error["message"]);
+            $errmsg  = array_pop($message);
+        }
+        error($errmsg);
+    }
+    $json = json_decode($retval, true);
+    if (!is_array($json)) {
+        error("Something happend to master");
+    }
+    if (isset($json["error"])) {
+        error($json["error"]);
+    }
+    return $json["html"];
+}
+
 function error($errormsg)
 {
     echo '<p class="warning error">', $errormsg, "</p>";
diff --git a/styles.css b/styles.css
index c2028f6..2f93193 100644
--- a/styles.css
+++ b/styles.css
@@ -79,11 +79,16 @@ h2 {
        line-height: 20px;
        color: #5A5993;
 }
+#blurb,
 #karma,
 #notes {
        color: #5A5993;
 }
 
+.blurb {
+  margin: 0 0 0 2em;
+  width: 600px;
+}
 
 .warning {
   padding: 1em;
diff --git a/user.php b/user.php
index 1ee0834..eec6b7a 100644
--- a/user.php
+++ b/user.php
@@ -12,6 +12,7 @@ $NFO      = findPHPUser($USERNAME);
 $PEAR     = findPEARUser($USERNAME);
 $GITHUB   = findGitHubUser($NFO["name"]);
 $KARMA    = findKarma($USERNAME);
+$PROFILE  = findPHPUserProfile($USERNAME);
 $email    = $NFO["enable"] ? $NFO["username"].'@php.net' : "";
 $location = isset($PEAR["long"], $PEAR["lat"]) ? $PEAR["lat"] . ", " . 
$PEAR["long"] : null;
 ?>
@@ -76,6 +77,13 @@ if (isset($GITHUB["location"])) {
 
 </dl>
 
+<?php if ($PROFILE) { ?>
+    <h2 id="blurb">About:</h2>
+    <div class="blurb">
+        <?php echo $PROFILE; ?>
+    </div>
+<?php } ?>
+
 <?php if ($KARMA) { ?>
     <?php $KARMA = formatKarma($KARMA); ?>
     <h2 id="karma">Karma:</h2>


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to