- web: if user has profile photo, use it instead of head_20.

svn path=/trunk/boinc/; revision=14438
This commit is contained in:
David Anderson 2007-12-23 23:09:10 +00:00
parent 11dac5e80c
commit 724e89ebab
7 changed files with 39 additions and 5 deletions

View File

@ -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

View File

@ -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");
?>

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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 = "<a href=\"".URL_BASE."show_user.php?userid=".$user->id."\">".$user->name."</a>";
if ($user->has_profile) {
$x .= ' <a href="'.URL_BASE.'view_profile.php?userid='.$user->id.'"><img title="View the profile of '.$user->name.'" border="0" src="'.URL_BASE.'img/head_20.png" alt="Profile"></a>';
$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 .= ' <a href="'.URL_BASE.'view_profile.php?userid='.$user->id.'"><img title="View the profile of '.$user->name.'" border="0" align=top src="'.$img_url.'" alt="Profile"></a>';
}
if ($user->donated == 1) {
require_once("../project/donations.inc");

View File

@ -61,7 +61,7 @@ if (get_str('action')=="hide") {
}
row2("Reason<br>Mailed if nonempty",
"<textarea name=\"reason\"></textarea>");
"<textarea rows=10 cols=80 name=\"reason\"></textarea>");
row2(
"",