Skip to content
Browse files

profile linking

  • Loading branch information...
1 parent dfb73e9 commit 7342f491cf026c50a668ab2570083f1463fff9a3 @simison simison committed Mar 31, 2011
View
4 ajax/country.php
@@ -99,7 +99,7 @@
<?php if(!empty($country["capital"])): ?>
<tr>
<td><b><?php echo _("Capital"); ?></b></td>
- <td><a href="#" id="search_for_this"><?php echo $country["capital"]; ?></a></td>
+ <td><a href="./?q=<?php echo urlencode($country["capital"].", ".$country["name"]); ?>" id="search_for_this"><?php echo $country["capital"]; ?></a></td>
</tr>
<script type="text/javascript">
$("a#search_for_this").click(function(e){
@@ -207,7 +207,7 @@
<?php pt_list($country["iso"]); ?>
-<h3 class="icon world">In other services</h3>
+<h3 class="icon world"><?php printf("%s in other services", $country["name"]); ?></h3>
<a target="_blank" href="http://hitchwiki.org/en/index.php?title=Special%3ASearch&search=<?php echo urlencode($country["name"]); ?>&go=Go">Hitchwiki</a>,
<a target="_blank" href="http://en.wikipedia.org/wiki/Special:Search?search=<?php echo urlencode($country["name"]); ?>">Wikipedia</a>,
View
24 ajax/hitchability_log.php
@@ -64,6 +64,7 @@
$ratings[] = array(
"datetime" => $datetime,
"rating" => hitchability2textual($r["rating"]),
+ "rating_num" => $r["rating"],
"username" => username($r["fk_user"]),
"user_id" => $r["fk_user"],
"id" => $r["id"]
@@ -105,13 +106,30 @@
echo '<tr id="rating-'.$rating["id"].'">';
+ // Date
if(!empty($rating["datetime"])) echo '<td title="'.date(DATE_RFC822, $rating["datetime"]).'">'.date("n/Y", $rating["datetime"]).'</td>';
else echo '<td> </td>';
- echo '<td>'.$rating["rating"].'</td>';
+ // Rating
+ echo '<td title="'.$rating["rating_num"].'/5">'.$rating["rating"].'</td>';
+
+ // Username
+ echo '<td>';
+ if(!empty($user["id"]) && $user["id"] == $rating["user_id"]) echo '<strong>';
+
+ if(!empty($rating["user_id"])) {
+ echo '<a href="./?page=profile&amp;user_id='.$rating["user_id"].'" onclick="open_page(\'profile\', \'user_id='.$rating["user_id"].'\'); return false;" title="';
+
+ if(!empty($user["id"]) && $user["id"] == $rating["user_id"]) echo _("That's you!");
+ else echo _("Profile");
+
+ echo '">'.$rating["username"];
+
+ } else echo $rating["username"];
+
+ if(!empty($user["id"]) && $user["id"] == $rating["user_id"]) echo '<strong>';
+ echo '</td>';
- if(!empty($user["id"]) && $user["id"] == $rating["user_id"]) echo '<td><a href="./?page=profile" onclick="open_page(\'profile\'); return false;">'.$rating["username"].'</a></td>';
- else echo '<td>'.$rating["username"].'</td>';
// Print extra cell if in this list there are some of this users waitingtimes.
// Print delete-icon into users own rows
View
2 ajax/map_statistics.php
@@ -257,7 +257,7 @@ function drawMap() {
</script>
<?php endif; ?>
- <meta name="description" content="<?php printf(_("This is just a preview map. Go to %s for the actual service."), $settings["base_url"]."/"); ?>" />
+ <meta name="description" content="<?php printf(_("This is just a preview map. Go to %s for the actual service."), $settings["base_url"]); ?>" />
</head>
<body><div id="map_canvas"></div></body>
</html>
View
4 ajax/place.php
@@ -647,7 +647,7 @@
echo '<div class="meta"><strong>';
if(isset($comment["user"]["nick"])) echo htmlspecialchars($comment["user"]["nick"]);
- elseif(isset($comment["user"]["name"])) echo htmlspecialchars($comment["user"]["name"]);
+ elseif(isset($comment["user"]["name"])) echo '<a href="./?page=profile&amp;user_id='.$comment["user"]["id"].'" onclick="open_page(\'profile\', \'user_id='.$comment["user"]["id"].'\'); return false;" title="'._("Profile").'">'.htmlspecialchars($comment["user"]["name"]).'</a>';
else echo '<i>'._("Anonymous").'</i>';
echo '</strong> &mdash; <span title="'.date(DATE_RFC822,strtotime($comment["datetime"])).'">'.date("j.n.Y",strtotime($comment["datetime"])).'</span>';
@@ -897,7 +897,7 @@ function(data) {
// When marker was added and who added it
// Name
if(isset($place["user"]["name"])) {
- echo "&bull; "._("Added by").' <strong>'.htmlspecialchars($place["user"]["name"]).'</strong>';
+ echo "&bull; "._("Added by").' <strong><a href="./?page=profile&amp;user_id='.$place["user"]["id"].'" onclick="open_page(\'profile\', \'user_id='.$place["user"]["id"].'\'); return false;" title="'._("Profile").'">'.htmlspecialchars($place["user"]["name"]).'</a></strong>';
if(!empty($place["datetime"])) echo ' &mdash;';
}
View
22 ajax/waitingtimes_log.php
@@ -96,11 +96,29 @@
foreach($waitingtimes as $waitingtime) {
echo '<tr id="timing-'.$waitingtime["id"].'">';
+
+ // Datetime
echo '<td title="'.date(DATE_RFC822, $waitingtime["datetime"]).'">'.date("n/Y", $waitingtime["datetime"]).'</td>';
+
+ // Waitingtime
echo '<td>'.$waitingtime["waitingtime"].'</td>';
- if(!empty($user["id"]) && $user["id"] == $waitingtime["user_id"]) echo '<td><a href="./?page=profile" onclick="open_page(\'profile\'); return false;">'.$waitingtime["username"].'</a></td>';
- else echo '<td>'.$waitingtime["username"].'</td>';
+ // Username
+ echo '<td>';
+ if(!empty($user["id"]) && $user["id"] == $waitingtime["user_id"]) echo '<strong>';
+
+ if(!empty($waitingtime["user_id"])) {
+ echo '<a href="./?page=profile&amp;user_id='.$waitingtime["user_id"].'" onclick="open_page(\'profile\', \'user_id='.$waitingtime["user_id"].'\'); return false;" title="';
+
+ if(!empty($user["id"]) && $user["id"] == $waitingtime["user_id"]) echo _("That's you!");
+ else echo _("Profile");
+
+ echo '">'.$waitingtime["username"];
+
+ } else echo $waitingtime["username"];
+
+ if(!empty($user["id"]) && $user["id"] == $waitingtime["user_id"]) echo '<strong>';
+ echo '</td>';
// Print extra cell if in this list there are some of this users waitingtimes.
// Print delete-icon into users own rows
View
174 lib/functions.php
@@ -247,8 +247,110 @@ function gather_log($id=false,$type="place") {
$log = array();
+ // Get a log for a user
+ if($id!==false && $type == "user") {
+
+ $query = "
+ SELECT * FROM
+ (
+ SELECT `id`,`ip`,`datetime`,`fk_user`,
+ `description` AS `log_entry`,
+ `language` AS `log_meta`,
+ 'description' AS `log_type`
+ FROM `t_points_descriptions`
+ WHERE `fk_user` = ".mysql_real_escape_string($id)."
+
+
+ UNION ALL
+
+ SELECT `id`,`ip`,`datetime`,`fk_user`,
+ `rating` AS `log_entry`,
+ '' AS `log_meta`,
+ 'rating' AS `log_type`
+ FROM `t_ratings`
+ WHERE `fk_user` = ".mysql_real_escape_string($id)."
+ AND `datetime` IS NOT NULL
+
+
+ UNION ALL
+
+ SELECT `id`,`ip`,`datetime`,`fk_user`,
+ `waitingtime` AS `log_entry`,
+ '' AS `log_meta`,
+ 'waitingtime' AS `log_type`
+ FROM `t_waitingtimes`
+ WHERE `fk_user` = ".mysql_real_escape_string($id)."
+ AND `datetime` IS NOT NULL
+
+
+ UNION ALL
+
+ SELECT `id`,`ip`,`datetime`,`fk_user`,
+ `comment` AS `log_entry`,
+ '' AS `log_meta`,
+ 'comment' AS `log_type`
+ FROM `t_comments`
+ WHERE `fk_user` = ".mysql_real_escape_string($id)." AND `hidden` IS NULL
+ AND `datetime` IS NOT NULL
+
+
+ UNION ALL
+
+ SELECT
+ `id` AS `id`,
+ '' AS `ip`,
+ `datetime`,
+ `user` AS `fk_user`,
+ `locality` AS `log_entry`,
+ '' AS `log_meta`,
+ 'place' AS `log_type`
+ FROM `t_points`
+ WHERE `user` = ".mysql_real_escape_string($id)."
+
+ )
+ AS `log`
+ ORDER BY `datetime` DESC";
+
+/*
+ UNION ALL
+
+
+ SELECT
+ `id`,
+ '' AS `ip`,
+ `datetime`,
+ `user_id` AS `fk_user`,
+ '' AS `fk_point`,
+ `country` AS `log_entry`,
+ '' AS `log_meta`,
+ 'public_transport' AS `log_type`
+ FROM `t_ptransport`
+ WHERE `user_id` = ".mysql_real_escape_string($id)."
+ AND `datetime` IS NOT NULL
+
+
+ UNION ALL
+
+
+ SELECT
+ `id`,
+ '' AS `ip`,
+ `registered` AS `datetime`,
+ `id` AS `fk_user`,
+ '' AS `fk_point`,
+ `country` AS `log_entry`,
+ '' AS `log_meta`,
+ 'user' AS `log_type`
+ FROM `t_users`
+ WHERE `id` = ".mysql_real_escape_string($id)."
+ AND `registered` IS NOT NULL
+
+*/
+
+
+ }
// Get a log for a place
- if($id!==false) {
+ elseif($id!==false && $type == "place") {
$query = "
SELECT * FROM
@@ -420,6 +522,9 @@ function gather_log($id=false,$type="place") {
start_sql();
$res = mysql_query($query);
+
+ if(!$res) return false;
+
#if(mysql_num_rows($res) > 0) {
while($line = mysql_fetch_array($res, MYSQL_ASSOC)) {
$log[] = $line;
@@ -690,14 +795,14 @@ function list_countries($type="array", $order="name", $limit=false, $count=true,
// print a list item
elseif($type=="li") {
- echo '<li><img class="flag" alt="'.strtolower($country["iso"]).'" src="static/gfx/flags/'.strtolower($country["iso"]).'.png" /> <a href="#" id="search_for_this">'.$country["name"]."</a>";
+ echo '<li><img class="flag" alt="'.strtolower($country["iso"]).'" src="static/gfx/flags/'.strtolower($country["iso"]).'.png" /> <a href="./?q='.urlencode($country["name"]).'" id="search_for_this">'.$country["name"]."</a>";
if($count==true) echo ' <small class="grey">('.$country["places"].')</small>';
echo '</li>';
}
// print a table row
elseif($type=="tr") {
- echo '<tr><td><img class="flag" alt="'.strtolower($country["iso"]).'" src="static/gfx/flags/'.strtolower($country["iso"]).'.png" /> <a href="#" id="search_for_this">'.$country["name"].'</a></td>';
+ echo '<tr><td><img class="flag" alt="'.strtolower($country["iso"]).'" src="static/gfx/flags/'.strtolower($country["iso"]).'.png" /> <a href="./?q='.urlencode($country["name"]).'" id="search_for_this">'.$country["name"].'</a></td>';
if($count==true) echo '<td>'.$country["places"].'</td>';
echo '</tr>';
}
@@ -787,17 +892,17 @@ function list_cities($type="array", $order="markers", $limit=false, $count=true,
}
elseif($type=="li") {
- if($country == false) echo '<li><img class="flag" alt="'.strtolower($r['country']).'" src="static/gfx/flags/'.strtolower($r['country']).'.png" /> <a href="#" id="search_for_this">'.$r['locality'].', '.$countryname.'</a>';
- else echo '<li><a href="#" id="search_for_this">'.$r['locality'].'</a>';
+ if($country == false) echo '<li><img class="flag" alt="'.strtolower($r['country']).'" src="static/gfx/flags/'.strtolower($r['country']).'.png" /> <a href="./?q='.urlencode($r['locality'].', '.$countryname).'" id="search_for_this">'.$r['locality'].', '.$countryname.'</a>';
+ else echo '<li><a href="./?q='.urlencode($r['locality']).'" id="search_for_this">'.$r['locality'].'</a>';
if($count==true) echo ' <small class="grey">('.$r['cnt'].')</small>';
echo '</li>';
}
elseif($type=="tr") {
- echo '<tr><td><a href="#" id="search_for_this">'.$r['locality'].'</a></td>';
+ echo '<tr><td><a href="./?q='.urlencode($r['locality']).'" id="search_for_this">'.$r['locality'].'</a></td>';
- if($country == false) echo '<td><img class="flag" alt="'.strtolower($r['country']).'" src="static/gfx/flags/'.strtolower($r['country']).'.png" /> <a href="#" id="search_for_this">'.$countryname.'</a></td>';
+ if($country == false) echo '<td><img class="flag" alt="'.strtolower($r['country']).'" src="static/gfx/flags/'.strtolower($r['country']).'.png" /> <a href="./?q='.urlencode($countryname).'" id="search_for_this">'.$countryname.'</a></td>';
if($count == true) echo '<td>'.$r['cnt'].'</td>';
@@ -1315,7 +1420,7 @@ function image_map($lat, $lon, $zoom=15, $format='png', $width=150, $height=150)
/*
* Return a user name by ID
*/
-function username($id) {
+function username($id, $link=false) {
if(!empty($id) && is_numeric($id)) {
start_sql();
@@ -1327,7 +1432,9 @@ function username($id) {
// If we have a result, go and get the name
if(mysql_num_rows($res) > 0) {
while($r = mysql_fetch_array($res, MYSQL_ASSOC)) {
- return htmlspecialchars($r["name"]);
+
+ if($link===true) return '<a href="./?page=profile&amp;user_id='.$id.'" onclick="open_page(\'profile\', \'user_id='.$id.'\'); return false;" title="'._("Profile").'">'.htmlspecialchars($r["name"]).'</a>';
+ else return htmlspecialchars($r["name"]);
}
}
else return _("Anonymous");
@@ -1570,6 +1677,51 @@ function current_user($get_password=false) {
/*
+ * Get user's infoarray by ID
+ */
+function user_info($user_id) {
+ global $settings;
+
+ start_sql();
+
+ $res = mysql_query("SELECT * FROM `t_users` WHERE `id` = '".mysql_real_escape_string($user_id)."' LIMIT 1");
+
+ if(!$res) return false;
+
+ // If we have a result, continue gathering user array
+ if(mysql_num_rows($res) > 0) {
+ while($r = mysql_fetch_array($res, MYSQL_ASSOC)) {
+
+ $user["logged_in"] = true;
+ $user["id"] = $r["id"];
+ $user["name"] = $r["name"];
+ $user["location"] = $r["location"];
+ $user["country"] = $r["country"];
+ $user["language"] = $r["language"];
+ $user["registered"] = $r["registered"];
+ $user["last_seen"] = $r["last_seen"];
+ $user["private_location"] = $r["private_location"];
+ $user["google_latitude"] = $r["google_latitude"];
+ $user["centered_glatitude"] = $r["centered_glatitude"];
+ $user["allow_gravatar"] = $r["allow_gravatar"];
+ $user["map_google"] = $r["map_google"];
+ $user["map_yahoo"] = $r["map_yahoo"];
+ $user["map_vearth"] = $r["map_vearth"];
+ $user["map_default_layer"] = $r["map_default_layer"];
+
+ // Admin?
+ if($r["admin"]=="1" && $settings["allow_admins"] === true) $user["admin"] = true;
+ else $user["admin"] = false;
+
+ return $user;
+ }
+ } else return false;
+
+}
+
+
+
+/*
* Check if user is in database
* email = t_user.email
* password = md5(t_user.password)
@@ -1586,7 +1738,7 @@ function get_user($session=false) {
if(mysql_num_rows($res) > 0) {
$last_seen = mysql_query("UPDATE `t_users` SET `last_seen` = NOW() WHERE `id` = ".mysql_real_escape_string($session["wsUserID"])." LIMIT 1");
-
+
while($r = mysql_fetch_array($res, MYSQL_ASSOC)) {
$user["logged_in"] = true;
@@ -1606,7 +1758,7 @@ function get_user($session=false) {
$user["map_vearth"] = $r["map_vearth"];
$user["map_default_layer"] = $r["map_default_layer"];
- // Admin? 1:false
+ // Admin?
if($r["admin"]=="1" && $settings["allow_admins"] === true) $user["admin"] = true;
else $user["admin"] = false;
View
BIN locale/de_DE/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/de_DE/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:01+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:02+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/es_ES/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/es_ES/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:05+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:07+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/fi_FI/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/fi_FI/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:02+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:04+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/fr_FR/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/fr_FR/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:05+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:07+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/it_IT/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/it_IT/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:05+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:06+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/lt_LT/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/lt_LT/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:04+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:05+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/nl_NL/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/nl_NL/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:04+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:05+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/pl_PL/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/pl_PL/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:05+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:06+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/pt_PT/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/pt_PT/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:03+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:04+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/ro_RO/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/ro_RO/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:02+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:03+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/ru_RU/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/ru_RU/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:02+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:03+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
BIN locale/zh_CN/LC_MESSAGES/maps.mo
Binary file not shown.
View
2 locale/zh_CN/LC_MESSAGES/maps.po
@@ -2,7 +2,7 @@
# This file is distributed under the same license as the Maps package.
msgid ""
msgstr ""
-"PO-Revision-Date: 2011-03-25 15:30:04+0000\n"
+"PO-Revision-Date: 2011-03-30 23:00:05+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
View
2 views/pages/log_all.php
@@ -36,7 +36,7 @@
echo '<li id="log-'.$line["log_type"].'-'.$line["id"].'" class="log_'.$line["id"].' icon '.$icon.'">';
// Who
- if(!empty($line["fk_user"])) $who = '<b>'.username($line["fk_user"]).'</b>';
+ if(!empty($line["fk_user"])) $who = '<strong>'.username($line["fk_user"], true).'</strong>';
else $who = _("Anonymous");
// What
View
2 views/pages/log_place.php
@@ -46,7 +46,7 @@
echo '<li id="log-'.$line["log_type"].'-'.$line["id"].'" class="log_'.$line["id"].' icon '.$icon.'">';
// Who
- if(!empty($line["fk_user"])) $who = '<b>'.username($line["fk_user"]).'</b>';
+ if(!empty($line["fk_user"])) $who = '<strong>'.username($line["fk_user"], true).'</strong>';
else $who = _("Anonymous");
// What
View
30 views/pages/log_user.php
@@ -2,16 +2,24 @@
echo info_sign("This feature is under development and visible only for admins.",false);
// Show only when logged in
-#if($user["logged_in"]===true):
+if($user["logged_in"]===true):
+if(isset($_GET["user_id"]) && !empty($_GET["user_id"])) $profile = user_info($_GET["user_id"]);
+else $profile = $user;
-?><h2><?php printf(_("%s's activity log"), "Username"); ?></h2>
+if($user["id"] == $profile["id"]): ?>
+ <h2><?php printf(_("Hey %s, welcome to your stuff!"), '<a href="./?page=profile" onclick="open_page(\'profile\'); return false;" title="'._("Profile").'">'.$profile["name"].'</a>'); ?></h2>
+<?php else: ?>
+ <h2><?php printf(_("%s's activity log"), '<a href="./?page=profile&amp;user_id='.$profile["id"].'" onclick="open_page(\'profile\', \'user_id='.$profile["id"].'\'); return false;" title="'._("Profile").'">'.$profile["name"].'</a>'); ?></h2>
+<?php endif; ?>
<div style="width: 650px;">
<ul class="history">
<?php
+ $lines = gather_log($profile["id"], "user");
+
if(is_array($lines) && !empty($lines)) {
foreach($lines as $line) {
@@ -25,13 +33,15 @@
elseif($line["log_type"] == "waitingtime") $icon = 'time';
elseif($line["log_type"] == "rating") $icon = 'chart_bar2';
elseif($line["log_type"] == "description") $icon = 'pencil';
+ elseif($line["log_type"] == "public_transport") $icon = 'underground';
+ elseif($line["log_type"] == "user") $icon = 'user';
else $icon = 'tag';
// START
echo '<li id="log-'.$line["log_type"].'-'.$line["id"].'" class="log_'.$line["id"].' icon '.$icon.'">';
// Who
- if(!empty($line["fk_user"])) $who = '<b>'.username($line["fk_user"]).'</b>';
+ if(!empty($line["fk_user"])) $who = '<strong>'.username($line["fk_user"], true).'</strong>';
else $who = _("Anonymous");
// What
@@ -54,6 +64,12 @@
if(!empty($line["log_meta"])) echo '<br /><small title="'._("Language").'">'._("Language").': '._($settings["languages_in_english"][$line["log_meta"]]).'</small>';
echo '<br /><small><em class="bubble">'.Markdown(utf8_decode($line["log_entry"])).'</em></small>';
}
+ elseif($line["log_type"] == "public_transport") {
+ echo sprintf(_('%1$s added a link to the public transportation catalog for %2$s'), $who, '<b>'.ISO_to_country($line["log_entry"]).'</b>');
+ }
+ elseif($line["log_type"] == "user") {
+ echo sprintf(_("%s started using Maps"), $who);
+ }
// Start meta
@@ -81,3 +97,11 @@
</ul>
</div>
+
+<?php
+// Not logged in?
+else:
+ error_sign(_("You must be logged in."), false);
+endif;
+
+?>
View
33 views/pages/profile.php
@@ -4,12 +4,18 @@
*/
-$profile = $user;
+if(isset($_GET["user_id"]) && !empty($_GET["user_id"])) $profile = user_info($_GET["user_id"]);
+else $profile = $user;
+
if(!empty($profile)): ?>
-<?php if($user["id"] == $profile["id"]): ?><small class="tip white"><em><?php echo _("This is your profile as others see it."); ?> &mdash; <a href="#" onclick="open_page('settings'); return false;"><?php echo _("Edit your profile"); ?></a></em></small><?php endif; ?>
-<h2 title="<?php echo $profile["id"]; ?>"><?php echo $profile["name"]; ?></h2>
+<?php if($user["id"] == $profile["id"]): ?>
+ <small class="tip white"><em><?php echo _("This is your profile as others see it."); ?> &mdash; <a href="#" onclick="open_page('settings'); return false;"><?php echo _("Edit your profile"); ?></a></em></small>
+ <h2><?php printf("Welcome home, %s", $profile["name"]); ?></h2>
+<?php else: ?>
+ <h2><?php echo $profile["name"]; ?></h2>
+<?php endif; ?>
<table class="infotable profile_card" cellspacing="0" cellpadding="0">
<tbody>
@@ -32,15 +38,16 @@
<?php if(!empty($profile["location"])): ?>
<tr>
<td><b><?php echo _("Location"); ?></b></td>
- <td><a href="#" id="search_for_this"><?php echo $profile["location"]; ?></a></td>
+ <td><a href="./?q=<?php echo urlencode($profile["location"]); ?>" id="search_for_this"><?php echo $profile["location"]; ?></a></td>
</tr>
<?php endif; ?>
<?php if(!empty($profile["country"])): ?>
<tr>
<td><b><?php echo _("Country"); ?></b></td>
- <td><a href="#" id="search_for_this"><?php echo ISO_to_country($profile["country"]); ?></a> <img class="flag" alt="" src="static/gfx/flags/<?php echo strtolower($profile["country"]); ?>.png" /></td>
+ <?php $countryname = ISO_to_country($profile["country"]); ?>
+ <td><a href="./?q=<?php echo urlencode($countryname); ?>" id="search_for_this"><?php echo $countryname; ?></a> <img class="flag" alt="" src="static/gfx/flags/<?php echo strtolower($profile["country"]); ?>.png" /></td>
</tr>
<?php endif; ?>
@@ -60,14 +67,26 @@
</tr>
<?php endif; ?>
-
- <?php if($profile["admin"]===true): ?>
+ <?php
+ // Show if profile is of an admin
+ if($profile["admin"]===true): ?>
<tr>
<td colspan="2"><span class="icon tux"><?php echo _("Administrator"); ?></span></td>
</tr>
<?php endif; ?>
<?php
+ // Show this only for admins
+ if($user["admin"]===true): ?>
+ <tr>
+ <td colspan="2"><span class="icon page_white_text"><a href="#" onclick="open_page('log_user', 'user_id=<?php echo $profile["id"]; ?>'); return false;"><?php printf(_("%s's activity log"), $profile["name"]); ?></a></span></td>
+ </tr>
+ <tr>
+ <td colspan="2"><span class="icon key"><?php echo $profile["id"]; ?></span></td>
+ </tr>
+ <?php endif; ?>
+
+ <?php
/*
* Gravatar
* http://en.gravatar.com/site/implement/
View
17 views/pages/statistics.php
@@ -79,7 +79,7 @@
<!-- highest places -->
<h3><?php echo _("Highest hitchhiking places"); ?></h3>
- <table class="infotable" cellspacing="0" cellpadding="0">
+ <table class="infotable" cellspacing="0" cellpadding="0" id="highest_places">
<thead>
<tr>
<th><?php echo _("Country"); ?></th>
@@ -109,8 +109,9 @@
$i=1;
while ($row = mysql_fetch_array($result)) {
+ $countryname = ISO_to_country($row["country"]);
echo '<tr>';
- echo '<td><img class="flag" alt="'.strtolower($row["country"]).'" src="static/gfx/flags/'.strtolower($row["country"]).'.png" /> <a href="#" id="search_for_this">'.ISO_to_country($row["country"]).'</a></td>';
+ echo '<td><img class="flag" alt="'.$countryname.'" src="static/gfx/flags/'.strtolower($row["country"]).'.png" /> <a href="./?q='.urlencode($countryname).'" id="search_for_this">'.$countryname.'</a></td>';
echo '<td>'.$row["max"].' '._("m").'</td>';
echo '<td>'.round($row["avg"]).' '._("m").'</td>';
echo '<td>'.$row["min"].' '._("m").'</td>';
@@ -123,6 +124,18 @@
?>
</tbody>
</table>
+
+ <script type="text/javascript">
+ $(function() {
+
+ $("#highest_places .search_for_this").click(function(e){
+ e.preventDefault();
+ close_page();
+ search($(this).text());
+ });
+
+ });
+ </script>
<!-- /highest places -->
</div>
View
15 views/pages/users.php
@@ -43,8 +43,14 @@
echo '<tr valign="top">';
// Name
- if($row["id"] == $user["id"]) echo '<td><b><a href="./?page=profile" onclick="open_page(\'profile\'); return false;">'.htmlspecialchars($row["name"]).'</a></b> <small>&mdash; '._("That's you!").'</small></td>';
- else echo '<td>'.htmlspecialchars($row["name"]).'</td>';
+ echo '<td>';
+ if($row["id"] == $user["id"]) echo '<b>';
+
+ echo '<a href="./?page=profile&amp;user_id='.$row["id"].'" onclick="open_page(\'profile\', \'user_id='.$row["id"].'\'); return false;" title="'._("Profile").'">'.htmlspecialchars($row["name"]).'</a>';
+
+ if($row["id"] == $user["id"]) echo '</b> <small>&mdash; '._("That's you!").'</small>';
+ echo '</td>';
+
// Registered
echo '<td style="text-align: right;">'.date("j.n.Y", strtotime($row["registered"])).'</td>';
@@ -55,14 +61,15 @@
// Location
if(!empty($row["location"])) {
- echo '<td><a href="#" class="search_this">'.htmlspecialchars($row["location"]).'</td>';
+ echo '<td><a href="./?q='.urlencode($row["location"]).'" class="search_this">'.htmlspecialchars($row["location"]).'</td>';
}
else echo '<td> </td>';
// Country
if(!empty($row["country"])) {
- echo '<td><a href="#" class="search_this">'.ISO_to_country($row["country"]).'</a> <img class="flag" alt="" src="static/gfx/flags/'.strtolower($row["country"]).'.png" /></td>';
+ $countryname = ISO_to_country($row["country"]);
+ echo '<td><a href="./?q='.urlencode($countryname).'" class="search_this">'.$countryname.'</a> <img class="flag" alt="'.$countryname.'" src="static/gfx/flags/'.strtolower($row["country"]).'.png" /></td>';
}
else echo '<td> </td>';

0 comments on commit 7342f49

Please sign in to comment.
Something went wrong with that request. Please try again.