From 724e89ebab68c0febce5ee24b6296fffc4be221e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 23 Dec 2007 23:09:10 +0000 Subject: [PATCH] - web: if user has profile photo, use it instead of head_20. svn path=/trunk/boinc/; revision=14438 --- checkin_notes | 12 ++++++++++++ doc/dg.php | 2 +- html/inc/boinc_db.inc | 4 ++++ html/inc/db_conn.inc | 11 +++++++++++ html/inc/user.inc | 4 ++-- html/inc/util.inc | 9 ++++++++- html/user/forum_moderate_thread.php | 2 +- 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index c54c32f74e..371a33c7d9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12467,3 +12467,15 @@ David 21 Dec 2007 setup_project.py tools/ make_project + +David 23 Dec 2007 + - web: if user has profile photo, use it instead of head_20. + + html/ + inc/ + boinc_db.inc + db_conn.inc + user.inc + util.inc + user/ + forum_moderate_thread.php diff --git a/doc/dg.php b/doc/dg.php index 58ec815e1c..c1d7426a8b 100644 --- a/doc/dg.php +++ b/doc/dg.php @@ -3,6 +3,6 @@ require_once("../html/inc/page_translate.inc"); find_translation("dg.html"); -Header("Location: http://boinc.berkeley.edu/trac/wiki/VirtualCampusSupercomputerCenter"); +Header("Location: http://boinc.berkeley.edu/trac/wiki/DesktopGrid"); ?> diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index c3793a7e05..6a74a54ace 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -205,6 +205,10 @@ class BoincAppVersion { } class BoincProfile { + static function lookup_fields($fields, $clause) { + $db = BoincDb::get(); + return $db->lookup_fields('profile', 'BoincProfile', $fields, $clause); + } static function lookup($clause) { $db = BoincDb::get(); return $db->lookup('profile', 'BoincProfile', $clause); diff --git a/html/inc/db_conn.inc b/html/inc/db_conn.inc index 1f824e7b88..c7db457bba 100644 --- a/html/inc/db_conn.inc +++ b/html/inc/db_conn.inc @@ -34,6 +34,17 @@ class DbConn { return $ret; } + function lookup_fields($table, $classname, $fields, $clause) { + $query = "select $fields from DBNAME.$table where $clause"; + $result = $this->do_query($query); + if (!$result) { + return null; + } + $obj = mysql_fetch_object($result, $classname); + mysql_free_result($result); + return $obj; + } + function lookup($table, $classname, $clause) { $query = "select * from DBNAME.$table where $clause"; $result = $this->do_query($query); diff --git a/html/inc/user.inc b/html/inc/user.inc index c2b72377ae..4dfbdb85e7 100644 --- a/html/inc/user.inc +++ b/html/inc/user.inc @@ -232,7 +232,7 @@ function show_user_info_private($user) { $x = ""; foreach($friends as $friend) { $fuser = BoincUser::lookup_id($friend->user_dest); - $x .= user_links($fuser); + $x .= " ". user_links($fuser); } row2("Friends", $x); } @@ -308,7 +308,7 @@ function show_user_summary_public($user) { $x = ""; foreach($friends as $friend) { $fuser = BoincUser::lookup_id($friend->user_dest); - $x .= user_links($fuser); + $x .= " ".user_links($fuser); } row2("Friends", $x); } diff --git a/html/inc/util.inc b/html/inc/util.inc index 0e0f22262c..5b7b7dd344 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -6,6 +6,7 @@ require_once("../inc/db.inc"); require_once("../inc/boinc_db.inc"); require_once("../inc/translation.inc"); require_once("../inc/forum.inc"); +require_once("../inc/profile.inc"); ini_set("memory_limit", "64M"); @@ -549,7 +550,13 @@ function user_links($user) { } $x = "id."\">".$user->name.""; if ($user->has_profile) { - $x .= ' Profile'; + $profile = BoincProfile::lookup_fields("has_picture", "userid=$user->id"); + if ($profile && $profile->has_picture) { + $img_url = profile_thumb_url($user->id); + } else { + $img_url = URL_BASE."img/head_20.png"; + } + $x .= ' Profile'; } if ($user->donated == 1) { require_once("../project/donations.inc"); diff --git a/html/user/forum_moderate_thread.php b/html/user/forum_moderate_thread.php index 8fe743aae0..41d21bdc95 100644 --- a/html/user/forum_moderate_thread.php +++ b/html/user/forum_moderate_thread.php @@ -61,7 +61,7 @@ if (get_str('action')=="hide") { } row2("Reason
Mailed if nonempty", - ""); + ""); row2( "",