cvs: pearweb /include pear-format-html.php /public_html credits.php
| From: | Martin Jansen | Date: | Fri, 10 May 2002 17:03:55 +0000 |
| Subject: | cvs: pearweb /include pear-format-html.php /public_html credits.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3750@lists.php.net to get a copy of this message | ||
mj Fri May 10 13:03:55 2002 EDT
Modified files:
/pearweb/include pear-format-html.php
/pearweb/public_html credits.php
Log:
* Function for displaying links to users.
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.36 pearweb/include/pear-format-html.php:1.37
--- pearweb/include/pear-format-html.php:1.36 Mon Apr 29 10:55:25 2002
+++ pearweb/include/pear-format-html.php Fri May 10 13:03:53 2002
@@ -356,4 +356,31 @@
return sizeof($notes);
}
+// {{{ user_link()
+
+/**
+ * Create link to the account information page and to the user's wishlist
+ *
+ * @param string User's handle
+ * @return mixed False on error, otherwise string
+ */
+function user_link($handle)
+{
+ global $dbh;
+
+ $query = "SELECT name, wishlist FROM users WHERE handle = '" . $handle .
"'";
+ $row = $dbh->getRow($query, DB_FETCHMODE_ASSOC);
+
+ if (!is_array($row)) {
+ return false;
+ }
+
+ return sprintf("<a
href=\"account-info.php?handle=%s\">%s</a>%s\n",
+ $handle,
+ $row['name'],
+ ($row['wishlist'] != "" ? " [<a href=\"" .
$row['wishlist'] . "\">Wishlist</a>]" : "")
+ );
+}
+
+// }}}
?>
Index: pearweb/public_html/credits.php
diff -u pearweb/public_html/credits.php:1.8 pearweb/public_html/credits.php:1.9
--- pearweb/public_html/credits.php:1.8 Fri May 10 02:09:21 2002
+++ pearweb/public_html/credits.php Fri May 10 13:03:55 2002
@@ -7,18 +7,18 @@
<h3>PEAR website team</h3>
<ul>
- <li><a href="/account-info.php?handle=ssb">Stig Sæther
Bakken</a></li>
- <li><a href="/account-info.php?handle=cox">Tomas V.V.
Cox</a></li>
- <li><a href="/account-info.php?handle=mj">Martin
Jansen</a></li>
- <li><a href="/account-info.php?handle=cmv">Colin
Viebrock</a></li>
+ <li><?php echo user_link("ssb"); ?></li>
+ <li><?php echo user_link("cox"); ?></li>
+ <li><?php echo user_link("mj"); ?></li>
+ <li><?php echo user_link("cmv"); ?></li>
</ul>
<h3>PEAR documentation team</h3>
<ul>
- <li><a href="/account-info.php?handle=cox">Tomas V.V.
Cox</a></li>
- <li><a href="/account-info.php?handle=mj">Martin
Jansen</a></li>
- <li><a href="/account-info.php?handle=alexmerz">Alexander
Merz</a></li>
+ <li><?php echo user_link("cox"); ?></li>
+ <li><?php echo user_link("mj"); ?></li>
+ <li><?php echo user_link("alexmerz"); ?></li>
</ul>
<small>(All in alphabetic order)</small>