本文整理汇总了PHP中BoincForumPrefs类的典型用法代码示例。如果您正苦于以下问题:PHP BoincForumPrefs类的具体用法?PHP BoincForumPrefs怎么用?PHP BoincForumPrefs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BoincForumPrefs类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update_user_posts
function update_user_posts()
{
$users = BoincUser::enum();
foreach ($users as $user) {
BoincForumPrefs::lookup($user);
$num = BoincPost::count("user={$user->id}");
if ($num != $user->prefs->posts) {
echo "user {$user->id}: {$user->posts} {$num}\n";
$user->prefs->update("posts={$num}");
}
}
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:12,代码来源:forum_repair.php
示例2: get_logged_in_user
break;
case CREATE_TIME_OLD:
$query .= ' ORDER by post.timestamp asc';
break;
case POST_SCORE:
$query .= ' ORDER by post.score desc';
break;
default:
$query .= ' ORDER BY post.timestamp DESC';
break;
}
$query .= " limit {$limit}";
return BoincPost::enum_general($query);
}
$logged_in_user = get_logged_in_user(false);
BoincForumPrefs::lookup($logged_in_user);
if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
$show_hidden_posts = true;
} else {
$show_hidden_posts = false;
}
page_head(tra("Forum search results"));
$search_keywords = post_str("search_keywords", true);
$search_author = post_int("search_author", true);
$search_max_time = post_int("search_max_time");
$search_forum = post_int("search_forum");
$search_sort = post_int("search_sort");
$search_list = explode(" ", $search_keywords);
if ($search_max_time) {
$min_timestamp = time() - $search_max_time * 3600 * 24;
} else {
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:forum_search_action.php
示例3: get_cached_data
// need to do this in any case,
// since show_user_summary_public() etc. accesses DB
// The page may be presented in many different languages,
// so here we cache the data instead
//
$cache_args = "userid=" . $id;
$cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
if ($cached_data) {
// We found some old but non-stale data, let's use it
$data = unserialize($cached_data);
$user = $data->user;
$community_links = $data->clo;
} else {
// No data was found, generate new data for the cache and store it
$user = lookup_user_id($id);
BoincForumPrefs::lookup($user);
$user = @get_other_projects($user);
$community_links = get_community_links_object($user);
$data->user = $user;
$data->clo = $community_links;
set_cached_data(USER_PAGE_TTL, serialize($data), $cache_args);
}
if (!$user->id) {
error_page("No such user");
}
$logged_in_user = get_logged_in_user(false);
page_head($user->name);
start_table();
echo "<tr><td valign=top>";
start_table();
show_user_summary_public($user);
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:show_user.php
示例4: error_page
if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) {
$auth = true;
} else {
if ($user->prefs->privilege(S_ADMIN)) {
$auth = true;
}
}
if (!$auth) {
error_page(tra("Not authorized to banish users"));
}
$userid = post_int('userid');
$bad_user = BoincUser::lookup_id($userid);
if (!$bad_user) {
error_page("user ID not found");
}
BoincForumPrefs::lookup($bad_user);
$duration = post_int('duration');
if ($duration == -1) {
$t = 2147483647;
// Maximum integer value
} else {
$t = time() + $duration;
}
$reason = post_str("reason", true);
$result = $bad_user->prefs->update("banished_until={$t}");
page_head(tra("Banishment"));
if ($result) {
echo tra("User %1 has been banished.", $bad_user->name);
send_banish_email($forum, $bad_user, $t, $reason);
} else {
error_page(tra("Action failed: possible database problem"));
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:forum_moderate_post_action.php
示例5: 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");
}
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:59,代码来源:pm.php
示例6: tra
echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.") . "\n <p>\n <form action=edit_forum_preferences_action.php method=post>\n <input type=hidden name=action value=reset>\n <input class=\"btn btn-warning\" type=submit value=\"" . tra("Reset preferences") . "\">\n </form>\n ";
page_tail();
exit;
}
// If the user has requested a reset of preferences;
// preserve a few fields.
//
if (post_str("action", true) == "reset") {
$posts = $user->prefs->posts;
$last_post = $user->prefs->last_post;
$rated_posts = $user->prefs->rated_posts;
$banished_until = $user->prefs->banished_until;
$special_user = $user->prefs->special_user;
$user->prefs->delete();
unset($user->prefs);
BoincForumPrefs::lookup($user, true);
$user->prefs->update("posts={$posts}, last_post={$last_post}, rated_posts='{$rated_posts}', banished_until={$banished_until}, special_user='{$special_user}'");
Header("Location: edit_forum_preferences_form.php");
exit;
}
$pmn = post_int("pm_notification");
if ($pmn != $user->prefs->pm_notification) {
$user->prefs->update("pm_notification={$pmn}");
}
if (!DISABLE_FORUMS) {
$avatar_type = post_int("avatar_select");
$newfile = IMAGE_PATH . $user->id . "_avatar.jpg";
// Update the user avatar
if ($avatar_type < 0 or $avatar_type > 3) {
$avatar_type = 0;
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:edit_forum_preferences_action.php
示例7: handle_accept
function handle_accept($user)
{
$srcid = get_int('userid');
$srcuser = BoincUser::lookup_id($srcid);
if (!$srcuser) {
error_page("No such user");
}
$friend = BoincFriend::lookup($srcid, $user->id);
if (!$friend) {
error_page("No request");
}
$friend->update("reciprocated=1");
// "accept message" not implemented in interface yet
$msg = post_str('message', true);
if ($msg) {
$msg = sanitize_tags(BoincDb::escape_string($msg));
}
$now = time();
$ret = BoincFriend::replace("user_src={$user->id}, user_dest={$srcid}, message='{$msg}', create_time={$now}, reciprocated=1");
if (!$ret) {
error_page(tra("Database error"));
}
$type = NOTIFY_FRIEND_ACCEPT;
BoincNotify::replace("userid={$srcid}, create_time={$now}, type={$type}, opaque={$user->id}");
BoincForumPrefs::lookup($srcuser);
if ($srcuser->prefs->pm_notification == 1) {
send_friend_accept_email($user, $srcuser, $msg);
}
$notify = BoincNotify::lookup($user->id, NOTIFY_FRIEND_REQ, $srcid);
if ($notify) {
$notify->delete();
}
page_head(tra("Friendship confirmed"));
echo tra("Your friendship with %1 has been confirmed.", "<b>" . $srcuser->name . "</b>");
page_tail();
}
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:36,代码来源:friend.php
示例8: delete_banished
function delete_banished()
{
global $days;
$fps = BoincForumPrefs::enum("banished_until>0");
foreach ($fps as $fp) {
$user = BoincUser::lookup_id($fp->userid);
if (!$user) {
continue;
}
if ($user->create_time < time() - $days * 86400) {
continue;
}
do_delete_user($user);
}
}
开发者ID:privat1,项目名称:boinc,代码行数:15,代码来源:delete_spammers.php
注:本文中的BoincForumPrefs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论