本文整理汇总了PHP中BoincUser::lookup_name方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser::lookup_name方法的具体用法?PHP BoincUser::lookup_name怎么用?PHP BoincUser::lookup_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoincUser
的用法示例。
在下文中一共展示了BoincUser::lookup_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_send
function do_send($logged_in_user)
{
global $replyto, $userid;
check_banished($logged_in_user);
check_tokens($logged_in_user->authenticator);
$to = sanitize_tags(post_str("to", true));
$subject = post_str("subject", true);
$content = post_str("content", true);
if (post_str("preview", true) == tra("Preview")) {
pm_form($replyto, $userid);
}
if ($to == null || $subject == null || $content == null) {
pm_form($replyto, $userid, tra("You need to fill all fields to send a private message"));
} else {
if (!akismet_check($logged_in_user, $content)) {
pm_form($replyto, $userid, tra("Your message was flagged as spam\n by the Akismet anti-spam system.\n Please modify your text and try again."));
}
$to = str_replace(", ", ",", $to);
// Filter out spaces after separator
$users = explode(",", $to);
$userlist = array();
$userids = array();
// To prevent from spamming a single user by adding it multiple times
foreach ($users as $username) {
$user = explode(" ", $username);
if (is_numeric($user[0])) {
// user ID is gived
$userid = $user[0];
$user = BoincUser::lookup_id($userid);
if ($user == null) {
pm_form($replyto, $userid, tra("Could not find user with id %1", $userid));
}
} else {
$user = BoincUser::lookup_name($username);
if ($user == null) {
pm_form($replyto, $userid, tra("Could not find user with username %1", $username));
} elseif ($user == -1) {
// Non-unique username
pm_form($replyto, $userid, tra("%1 is not a unique username; you will have to use user ID", $username));
}
}
BoincForumPrefs::lookup($user);
if (is_ignoring($user, $logged_in_user)) {
pm_form($replyto, $userid, tra("User %1 (ID: %2) is not accepting private messages from you.", $user->name, $user->id));
}
if (!isset($userids[$user->id])) {
$userlist[] = $user;
$userids[$user->id] = true;
}
}
foreach ($userlist as $user) {
if (!is_moderator($logged_in_user, null)) {
check_pm_count($logged_in_user->id);
}
pm_send_msg($logged_in_user, $user, $subject, $content, true);
}
Header("Location: pm.php?action=inbox&sent=1");
}
}