From ba7d92fad7b3ac0cfe4a6733339aa474991315a2 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 22 Oct 2009 22:56:21 -0700 Subject: [PATCH] NEW FEATURE: use gravatars as icons for players use icons at the table and on the user page (for last players logged in). --- css/{standard021.css => standard022.css} | 14 ++++++++++---- include/db.php | 11 +++++++++++ include/functions.php | 10 +++++++--- include/output.php | 2 +- include/preferences.php | 1 + include/user.php | 9 +++++++-- 6 files changed, 37 insertions(+), 10 deletions(-) rename css/{standard021.css => standard022.css} (98%) diff --git a/css/standard021.css b/css/standard022.css similarity index 98% rename from css/standard021.css rename to css/standard022.css index 6957924..79dfeea 100644 --- a/css/standard021.css +++ b/css/standard022.css @@ -165,7 +165,7 @@ body { background-color: #ddd; } div.table { position:absolute; width:100%; - height:35em; + height:37em; margin:0; left:0; padding:0; @@ -202,7 +202,7 @@ div.table div.table0 { right:62.5%; } div.table div.table1 { - top:7.5%; + top:0%; left:43.75%; } div.table div.table2 { @@ -210,7 +210,7 @@ div.table div.table2 { left:62.5%; } div.table div.table3 { - bottom:5%; + bottom:0%; left: 43.75%; } @@ -413,7 +413,7 @@ ul.tricks li div div span.comment span{ .mycards { margin:0; - margin-top:34.5em; + margin-top:38.5em; padding:0; border-top: 2px solid gray; /* border-bottom: 2px solid green;*/ @@ -643,4 +643,10 @@ table.openid td, table.openid th{ .vacation { color: #666; background-color: #fc3; +} + +div.table div img.gravatar, img.gravatar { + width: 4em; + height: 4em; + border: 3px solid #aaa; } \ No newline at end of file diff --git a/include/db.php b/include/db.php index cc40f67..882a1ad 100644 --- a/include/db.php +++ b/include/db.php @@ -470,6 +470,17 @@ function DB_get_names_of_last_logins($N) return $names; } +function DB_get_emails_of_last_logins($N) +{ + $emails = array(); + + $result = DB_query("SELECT email FROM User ORDER BY last_login DESC LIMIT $N"); + while($r = DB_fetch_array($result)) + $emails[] = $r[0]; + + return $emails; +} + function DB_get_names_of_new_logins($N) { $names = array(); diff --git a/include/functions.php b/include/functions.php index 43fbb24..63216eb 100644 --- a/include/functions.php +++ b/include/functions.php @@ -803,7 +803,8 @@ function display_table () " Hand.point_call, ". " User.last_login, ". " Hand.hash, ". - " User.timezone ". + " User.timezone, ". + " User.email ". "FROM Hand ". "LEFT JOIN User ON User.id=Hand.user_id ". "WHERE Hand.game_id='".$gameid."' ". @@ -821,11 +822,14 @@ function display_table () $call = $r[5]; $hash = $r[7]; $timezone = $r[8]; + $email = $r[9]; $wins = DB_get_number_of_tricks($gameid,$pos); date_default_timezone_set($defaulttimezone); $lastlogin = strtotime($r[6]); date_default_timezone_set($timezone); $timenow = strtotime(date("Y-m-d H:i:s")); + $gravatar = "$name
"; + echo "
\n"; @@ -838,10 +842,10 @@ function display_table () $comment = $vacation[2]; $title = "begin: $start end: $stop $comment"; - echo " $name (on vacation until $stop) \n"; + echo " $gravatar (on vacation until $stop) \n"; } else - echo " $name \n"; + echo " $gravatar \n"; if($debug) echo"\n"; diff --git a/include/output.php b/include/output.php index 33f7b19..9e87de3 100644 --- a/include/output.php +++ b/include/output.php @@ -301,7 +301,7 @@ function output_header() e-Doko - + diff --git a/include/preferences.php b/include/preferences.php index 2e3eef2..70ecabb 100644 --- a/include/preferences.php +++ b/include/preferences.php @@ -496,6 +496,7 @@ if($changed_openid) echo " \n"; echo "
Submit
\n"; echo " \n"; +echo "

E-DoKo uses gravatars as icons. I

"; echo "
\n"; return; diff --git a/include/user.php b/include/user.php index bac4398..a027f40 100644 --- a/include/user.php +++ b/include/user.php @@ -206,9 +206,14 @@ else echo "

\n"; /* display last 5 users that logged on */ - $names = DB_get_names_of_last_logins(5); echo "

Players last logged in:

\n

\n"; - echo implode(", ",$names).",...\n"; + + $names = DB_get_names_of_last_logins(7); + $emails = DB_get_emails_of_last_logins(7); + for($i=0;$i<7;$i++) + { + echo "\n"; + } echo "

\n"; echo "\n"; -- 2.34.1