mirror of https://github.com/BOINC/boinc.git
- Translation awareness (From ORE)
svn path=/trunk/boinc/; revision=16685
This commit is contained in:
parent
9481b392a4
commit
519760d784
|
@ -28,16 +28,15 @@ function check_pending($user, $destuser) {
|
||||||
$friend = BoincFriend::lookup($user->id, $destuser->id);
|
$friend = BoincFriend::lookup($user->id, $destuser->id);
|
||||||
if ($friend) {
|
if ($friend) {
|
||||||
if ($friend->reciprocated) {
|
if ($friend->reciprocated) {
|
||||||
error_page("Already friends");
|
error_page(tra("Already friends"));
|
||||||
}
|
}
|
||||||
$notify = BoincNotify::lookup($destuser->id, NOTIFY_FRIEND_REQ, $user->id);
|
$notify = BoincNotify::lookup($destuser->id, NOTIFY_FRIEND_REQ, $user->id);
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
page_head("Request pending");
|
page_head(tra("Request pending"));
|
||||||
$t = date_str($friend->create_time);
|
$t = date_str($friend->create_time);
|
||||||
echo "You requested friendship with $destuser->name on $t.
|
echo tra("You requested friendship with %1 on %2.", $destuser->name,$t) . "
|
||||||
<p>
|
<p>" .
|
||||||
This request is still pending confirmation.
|
tra("This request is still pending confirmation.");
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +47,7 @@ function check_pending($user, $destuser) {
|
||||||
function check_ignoring($srcuser, $destuser) {
|
function check_ignoring($srcuser, $destuser) {
|
||||||
BoincForumPrefs::lookup($destuser);
|
BoincForumPrefs::lookup($destuser);
|
||||||
if (is_ignoring($destuser, $srcuser)) {
|
if (is_ignoring($destuser, $srcuser)) {
|
||||||
error_page("$destuser->name is not accepting friendship requests from you");
|
error_page(tra("%1 is not accepting friendship requests from you",$destuser->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,24 +56,23 @@ function check_ignoring($srcuser, $destuser) {
|
||||||
function handle_add($user) {
|
function handle_add($user) {
|
||||||
$destid = get_int('userid');
|
$destid = get_int('userid');
|
||||||
if ($destid == $user->id) {
|
if ($destid == $user->id) {
|
||||||
error_page("You can't be friends with yourself");
|
error_page(tra("You can't be friends with yourself"));
|
||||||
}
|
}
|
||||||
$destuser = BoincUser::lookup_id($destid);
|
$destuser = BoincUser::lookup_id($destid);
|
||||||
if (!$destuser) error_page("No such user");
|
if (!$destuser) error_page(tra("No such user"));
|
||||||
|
|
||||||
check_pending($user, $destuser);
|
check_pending($user, $destuser);
|
||||||
check_ignoring($user, $destuser);
|
check_ignoring($user, $destuser);
|
||||||
|
|
||||||
page_head("Add friend");
|
page_head(tra("Add friend"));
|
||||||
echo "
|
echo "
|
||||||
<form method=post action=friend.php>
|
<form method=post action=friend.php>
|
||||||
<input type=hidden name=userid value=$destid>
|
<input type=hidden name=userid value=$destid>
|
||||||
<input type=hidden name=action value=add_confirm>
|
<input type=hidden name=action value=add_confirm>" .
|
||||||
You have asked to add <b>$destuser->name</b> as a friend.
|
tra("You have asked to add %1 as a friend. We will notify %2 and will ask him/her to confirm that you are friends.",
|
||||||
We will notify <b>$destuser->name</b> and will ask him/her to
|
"<b>".$destuser->name."</b>","<b>".$destuser->name."</b>") ."
|
||||||
confirm that you are friends.
|
<p>" .
|
||||||
<p>
|
tra("Add an optional message here:") ."
|
||||||
Add an optional message here:
|
|
||||||
<br>
|
<br>
|
||||||
<textarea name=message cols=64 rows=4></textarea>
|
<textarea name=message cols=64 rows=4></textarea>
|
||||||
<p>
|
<p>
|
||||||
|
@ -89,7 +87,7 @@ function handle_add($user) {
|
||||||
function handle_add_confirm($user) {
|
function handle_add_confirm($user) {
|
||||||
$destid = post_int('userid');
|
$destid = post_int('userid');
|
||||||
$destuser = BoincUser::lookup_id($destid);
|
$destuser = BoincUser::lookup_id($destid);
|
||||||
if (!$destuser) error_page("No such user");
|
if (!$destuser) error_page(tra("No such user"));
|
||||||
|
|
||||||
check_pending($user, $destuser);
|
check_pending($user, $destuser);
|
||||||
check_ignoring($user, $destuser);
|
check_ignoring($user, $destuser);
|
||||||
|
@ -102,7 +100,7 @@ function handle_add_confirm($user) {
|
||||||
"user_src=$user->id, user_dest=$destid, message='$msg', create_time=$now, reciprocated=0"
|
"user_src=$user->id, user_dest=$destid, message='$msg', create_time=$now, reciprocated=0"
|
||||||
);
|
);
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
error_page("database error");
|
error_page(tra("Database error"));
|
||||||
}
|
}
|
||||||
$now = time();
|
$now = time();
|
||||||
$type = NOTIFY_FRIEND_REQ;
|
$type = NOTIFY_FRIEND_REQ;
|
||||||
|
@ -112,10 +110,8 @@ function handle_add_confirm($user) {
|
||||||
if ($destuser->prefs->pm_notification == 1) {
|
if ($destuser->prefs->pm_notification == 1) {
|
||||||
send_friend_request_email($user, $destuser, $msg);
|
send_friend_request_email($user, $destuser, $msg);
|
||||||
}
|
}
|
||||||
page_head("Friend request sent");
|
page_head(tra("Friend request sent"));
|
||||||
echo "
|
echo tra("We have notified %1 of your request.","<b>".$destuser->name."</b>");
|
||||||
We have notified <b>$destuser->name</b> of your request.
|
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,16 +120,14 @@ function handle_add_confirm($user) {
|
||||||
function handle_query($user) {
|
function handle_query($user) {
|
||||||
$srcid = get_int('userid');
|
$srcid = get_int('userid');
|
||||||
$srcuser = BoincUser::lookup_id($srcid);
|
$srcuser = BoincUser::lookup_id($srcid);
|
||||||
if (!$srcuser) error_page("No such user");
|
if (!$srcuser) error_page(tra("No such user"));
|
||||||
$friend = BoincFriend::lookup($srcid, $user->id);
|
$friend = BoincFriend::lookup($srcid, $user->id);
|
||||||
if (!$friend) error_page("Request not found");
|
if (!$friend) error_page(tra("Request not found"));
|
||||||
page_head("Friend request");
|
page_head(tra("Friend request"));
|
||||||
$x = user_links($srcuser, true);
|
$x = user_links($srcuser, true);
|
||||||
echo "
|
echo tra("%1 has added you as a friend.", $x);
|
||||||
$x has added you as a friend.
|
|
||||||
";
|
|
||||||
if (strlen($friend->message)) {
|
if (strlen($friend->message)) {
|
||||||
echo "<p>$srcuser->name says: $friend->message<p>";
|
echo "<p>".tra("%1 says: %2", $srcuser->name, $friend->message)."</p>";
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
<p><ul class=\"actionlist\">";
|
<p><ul class=\"actionlist\">";
|
||||||
|
@ -149,11 +143,11 @@ function handle_query($user) {
|
||||||
function handle_accept($user) {
|
function handle_accept($user) {
|
||||||
$srcid = get_int('userid');
|
$srcid = get_int('userid');
|
||||||
$srcuser = BoincUser::lookup_id($srcid);
|
$srcuser = BoincUser::lookup_id($srcid);
|
||||||
if (!$srcuser) error_page("No such user");
|
if (!$srcuser) error_page(tra("No such user"));
|
||||||
|
|
||||||
$friend = BoincFriend::lookup($srcid, $user->id);
|
$friend = BoincFriend::lookup($srcid, $user->id);
|
||||||
if (!$friend) {
|
if (!$friend) {
|
||||||
error_page("No request");
|
error_page(tra("No request"));
|
||||||
}
|
}
|
||||||
$friend->update("reciprocated=1");
|
$friend->update("reciprocated=1");
|
||||||
|
|
||||||
|
@ -163,7 +157,7 @@ function handle_accept($user) {
|
||||||
$now = time();
|
$now = time();
|
||||||
$ret = BoincFriend::replace("user_src=$user->id, user_dest=$srcid, message='$msg', create_time=$now, reciprocated=1");
|
$ret = BoincFriend::replace("user_src=$user->id, user_dest=$srcid, message='$msg', create_time=$now, reciprocated=1");
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
error_page("database error");
|
error_page(tra("Database error"));
|
||||||
}
|
}
|
||||||
$type = NOTIFY_FRIEND_ACCEPT;
|
$type = NOTIFY_FRIEND_ACCEPT;
|
||||||
BoincNotify::replace("userid=$srcid, create_time=$now, type=$type, opaque=$user->id");
|
BoincNotify::replace("userid=$srcid, create_time=$now, type=$type, opaque=$user->id");
|
||||||
|
@ -177,10 +171,8 @@ function handle_accept($user) {
|
||||||
$notify->delete();
|
$notify->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
page_head("Friendship confirmed");
|
page_head(tra("Friendship confirmed"));
|
||||||
echo "
|
echo tra("Your friendship with %1 has been confirmed.","<b>" . $srcuser->name ."</b>");
|
||||||
Your friendship with <b>$srcuser->name</b> has been confirmed.
|
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,10 +190,8 @@ function handle_ignore($user) {
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$notify->delete();
|
$notify->delete();
|
||||||
}
|
}
|
||||||
page_head("Friendship declined");
|
page_head(tra("Friendship declined"));
|
||||||
echo "
|
echo tra("You have declined friendship with %1","<b>".$srcuser->name."</b>");
|
||||||
You have declined friendship with <b>$srcuser->name</b>
|
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,31 +201,28 @@ function handle_ignore($user) {
|
||||||
function handle_accepted($user) {
|
function handle_accepted($user) {
|
||||||
$destid = get_int('userid');
|
$destid = get_int('userid');
|
||||||
$destuser = BoincUser::lookup_id($destid);
|
$destuser = BoincUser::lookup_id($destid);
|
||||||
if (!$destuser) error_page("No such user");
|
if (!$destuser) error_page(tra("No such user"));
|
||||||
$notify = BoincNotify::lookup($user->id, NOTIFY_FRIEND_ACCEPT, $destid);
|
$notify = BoincNotify::lookup($user->id, NOTIFY_FRIEND_ACCEPT, $destid);
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$notify->delete();
|
$notify->delete();
|
||||||
} else {
|
} else {
|
||||||
echo "?? notification not found";
|
echo tra("Notification not found");
|
||||||
}
|
}
|
||||||
page_head("Friend confirmed");
|
page_head(tra("Friend confirmed"));
|
||||||
echo "
|
echo tra("You are now friends with %1.",$destuser->name);
|
||||||
You are now friends with $destuser->name.
|
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_cancel_confirm($user) {
|
function handle_cancel_confirm($user) {
|
||||||
$destid = get_int('userid');
|
$destid = get_int('userid');
|
||||||
$destuser = BoincUser::lookup_id($destid);
|
$destuser = BoincUser::lookup_id($destid);
|
||||||
if (!$destuser) error_page("No such user");
|
if (!$destuser) error_page(tra("No such user"));
|
||||||
page_head("Cancel friendship?");
|
page_head(tra("Cancel friendship?"));
|
||||||
echo "
|
echo tra("Are you sure you want to cancel your friendship with %1?",$destuser->name) ."
|
||||||
Are you sure you want to cancel your friendship with $destuser->name?
|
|
||||||
<p>
|
<p>
|
||||||
<ul class=\"actionlist\">";
|
<ul class=\"actionlist\">";
|
||||||
show_actionlist_button("friend.php?action=cancel&userid=$destid", tra("Yes"), "Cancel friendship");
|
show_actionlist_button("friend.php?action=cancel&userid=$destid", tra("Yes"), tra("Cancel friendship"));
|
||||||
show_actionlist_button("home.php", tra("No"), "Stay friends");
|
show_actionlist_button("home.php", tra("No"), tra("Stay friends"));
|
||||||
echo "</ul>";
|
echo "</ul>";
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
@ -243,12 +230,10 @@ function handle_cancel_confirm($user) {
|
||||||
function handle_cancel($user) {
|
function handle_cancel($user) {
|
||||||
$destid = get_int('userid');
|
$destid = get_int('userid');
|
||||||
$destuser = BoincUser::lookup_id($destid);
|
$destuser = BoincUser::lookup_id($destid);
|
||||||
if (!$destuser) error_page("No such user");
|
if (!$destuser) error_page(tra("No such user"));
|
||||||
BoincFriend::delete($user->id, $destid);
|
BoincFriend::delete($user->id, $destid);
|
||||||
page_head("Friendship cancelled");
|
page_head(tra("Friendship cancelled"));
|
||||||
echo "
|
echo tra("Your friendship with %1 has been cancelled.",$destuser->name);
|
||||||
Your friendship with $destuser->name has been cancelled.
|
|
||||||
";
|
|
||||||
page_tail();
|
page_tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +271,7 @@ case 'cancel':
|
||||||
handle_cancel($user);
|
handle_cancel($user);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error_page("unknown action");
|
error_page(tra("Unknown action"));
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue