[opw-web] Pass unencoded username to ->profile; use full name in link
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [opw-web] Pass unencoded username to ->profile; use full name in link
- Date: Mon, 10 Mar 2014 04:32:23 +0000 (UTC)
commit e3f793da89a8e3a6b71aa34d38682b557bdb22c3
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Sun Mar 9 12:47:14 2014 -0400
Pass unencoded username to ->profile; use full name in link
classes/class_user.php | 26 +++++++++++++-------------
modules/mod_approve_mentors.php | 2 +-
modules/mod_user_ban.php | 2 +-
modules/mod_view_participants.php | 2 +-
modules/mod_view_projects.php | 4 ++--
5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/classes/class_user.php b/classes/class_user.php
index 108efd5..a39b318 100644
--- a/classes/class_user.php
+++ b/classes/class_user.php
@@ -417,23 +417,23 @@ class user
{
global $core;
- if ($username != '-')
- {
- $username_url = urlencode($username);
- $profile_url = "?q=user_profile&u={$username_url}";
+ if ($username == '-')
+ return $username;
- if ($return)
- {
- $redir_url = urlencode($core->request_uri());
- $profile_url .= '&r=' . urlencode($redir_url);
- }
+ $info = $this->lookup_user($username);
+ if ($info === null)
+ return htmlspecialchars($username);
- return '<a href="' . $profile_url . '">' . $username . '</a>';
- }
- else
+ $username_url = urlencode($username);
+ $profile_url = "?q=user_profile&u={$username_url}";
+
+ if ($return)
{
- return $username;
+ $redir_url = urlencode($core->request_uri());
+ $profile_url .= '&r=' . urlencode($redir_url);
}
+
+ return '<a href="' . htmlspecialchars($profile_url) . '">' . htmlspecialchars($info['fullname']) .
'</a>';
}
// Get the role and organization of the current user
diff --git a/modules/mod_approve_mentors.php b/modules/mod_approve_mentors.php
index 8769634..2c12557 100644
--- a/modules/mod_approve_mentors.php
+++ b/modules/mod_approve_mentors.php
@@ -59,7 +59,7 @@ foreach ($list_data as $row)
// Assign data for each mentor
$skin->assign(array(
- 'mentor_name' => $user->profile(htmlspecialchars($row['username']), true),
+ 'mentor_name' => $user->profile($row['username'], true),
'organization' => htmlspecialchars($row['organization_title']),
'approve_url' => "?q=approve_mentors&a=approve&u={$mentor_url}",
'reject_url' => "?q=approve_mentors&a=reject&u={$mentor_url}",
diff --git a/modules/mod_user_ban.php b/modules/mod_user_ban.php
index 77907de..fd7bed4 100644
--- a/modules/mod_user_ban.php
+++ b/modules/mod_user_ban.php
@@ -72,7 +72,7 @@ foreach ($result as $row)
// Assign data for each row
$skin->assign(array(
- 'ban_username' => $user->profile(htmlspecialchars($row['username']), true),
+ 'ban_username' => $user->profile($row['username'], true),
'unban_url' => "?q=user_ban&u={$username_url}",
));
diff --git a/modules/mod_view_participants.php b/modules/mod_view_participants.php
index b1c4c22..7352db5 100644
--- a/modules/mod_view_participants.php
+++ b/modules/mod_view_participants.php
@@ -57,7 +57,7 @@ foreach ($list_data as $row)
$list[] = array(
'username' => $row['username'],
- 'profile' => $user->profile(htmlspecialchars($row['username']), true),
+ 'profile' => $user->profile($row['username'], true),
'role' => $lang->get('role_' . $row['role']),
'projects' => $project,
);
diff --git a/modules/mod_view_projects.php b/modules/mod_view_projects.php
index f9cd22f..be85c64 100644
--- a/modules/mod_view_projects.php
+++ b/modules/mod_view_projects.php
@@ -570,8 +570,8 @@ else if ($action == 'view')
'project_title' => htmlspecialchars($project_data['title']),
'project_organization' => htmlspecialchars($organization_data ? $organization_data['title'] :
''),
'project_description' => nl2br(htmlspecialchars($project_data['description'])),
- 'project_student' => $user->profile(htmlspecialchars($student), true),
- 'project_mentor' => $user->profile(htmlspecialchars($mentor), true),
+ 'project_student' => $user->profile($student, true),
+ 'project_mentor' => $user->profile($mentor, true),
'project_accepted' => $accepted,
'project_complete' => $complete,
'project_result' => $result,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]