本文整理汇总了PHP中phorum_api_user_get函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_api_user_get函数的具体用法?PHP phorum_api_user_get怎么用?PHP phorum_api_user_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phorum_api_user_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phorum_moderator_data_get
function phorum_moderator_data_get($key = null)
{
$PHORUM = $GLOBALS['PHORUM'];
$user_data = phorum_api_user_get($PHORUM['DATA']['USER']['user_id']);
if ($user_data['moderator_data']) {
$moderator_data = unserialize($user_data['moderator_data']);
} else {
$moderator_data = array();
}
if (is_null($key)) {
return $moderator_data;
} else {
return isset($moderator_data[$key]) ? $moderator_data[$key] : NULL;
}
}
示例2: phorum_api_mail_message_moderate
/**
* Send a new forum message for moderation to the moderator(s).
*
* @param array $message
* An array containing the data for a forum message.
*/
function phorum_api_mail_message_moderate($message)
{
// Not "global $PHORUM", because we do not want the loading of language
// files to override our already loaded language file.
$PHORUM = $GLOBALS['PHORUM'];
// Retrieve the list of moderators for the current forum.
$moderators = phorum_api_user_list_moderators($PHORUM['forum_id'], $PHORUM['email_ignore_admin'], TRUE);
// The list moderators function returns user_id => mail address.
// We want the full user info, so we can lookup the preferred
// language for the moderators.
$moderators = phorum_api_user_get(array_keys($moderators));
// Sort all moderators by their preferred language.
$recipients = array();
foreach ($moderators as $moderator) {
if (!isset($recipients[$moderator['user_language']])) {
$recipients[$moderator['user_language']] = array($moderator['email']);
} else {
$recipients[$moderator['user_language']][] = $moderator['email'];
}
}
// No moderators (oomph)? Then we are done.
if (empty($recipients)) {
return;
}
if ($message['status'] > 0) {
$mailsubjecttpl = 'NewUnModeratedSubject';
$mailmessagetpl = 'NewUnModeratedMessage';
} else {
$mailsubjecttpl = 'NewModeratedSubject';
$mailmessagetpl = 'NewModeratedMessage';
}
$mail_data = array('forumname' => strip_tags($PHORUM['DATA']['NAME']), 'forum_id' => $message['forum_id'], 'message_id' => $message['message_id'], 'author' => phorum_api_user_get_display_name($message['user_id'], $message['author'], PHORUM_FLAG_PLAINTEXT), 'subject' => $message['subject'], 'fully_body' => $message['body'], 'plain_body' => wordwrap(phorum_api_format_strip($message['body']), 72), 'approve_url' => phorum_api_url_no_uri_auth(PHORUM_CONTROLCENTER_URL, 'panel=messages'), 'read_url' => phorum_api_url_no_uri_auth(PHORUM_READ_URL, $message['thread'], $message['message_id']), 'mailmessagetpl' => $mailmessagetpl, 'mailsubjecttpl' => $mailsubjecttpl);
foreach ($recipients as $language => $addresses) {
$language = basename($language);
if (file_exists(PHORUM_PATH . "/include/lang/{$language}.php")) {
$mail_data['language'] = $language;
include PHORUM_PATH . "/include/lang/{$language}.php";
} else {
$mail_data['language'] = $PHORUM['language'];
include PHORUM_PATH . "/include/lang/{$PHORUM['language']}.php";
}
$mail_data['mailmessage'] = $PHORUM['DATA']['LANG'][$mailmessagetpl];
$mail_data['mailsubject'] = $PHORUM['DATA']['LANG'][$mailsubjecttpl];
phorum_api_mail($addresses, $mail_data);
}
}
示例3: foreach
foreach ($message["recipients"] as $rcpt) {
if ($user_id == $rcpt["user_id"]) {
continue;
}
$msg["recipients"][$rcpt["user_id"]] = array("display_name" => $rcpt["display_name"], "user_id" => $rcpt["user_id"]);
}
}
$hide_userselect = 1;
// Setup data for replying privately to a forum post.
} elseif (isset($PHORUM["args"]["message_id"])) {
$message = $PHORUM['DB']->get_message($PHORUM["args"]["message_id"], "message_id", true);
if (phorum_api_user_check_access(PHORUM_USER_ALLOW_READ) && ($PHORUM["forum_id"] == $message["forum_id"] || $message["forum_id"] == 0)) {
// get url to the message board thread
$origurl = phorum_api_url(PHORUM_READ_URL, $message["thread"], $message["message_id"]);
// Get the data for the user that we reply to.
$user = phorum_api_user_get($message["user_id"]);
$msg["subject"] = $message["subject"];
$msg["message"] = $message["body"];
$msg["recipients"][$message["user_id"]] = array('display_name' => $user["display_name"], 'user_id' => $user["user_id"]);
$msg = phorum_pm_quoteformat($user["display_name"], $user["user_id"], $msg, $origurl);
}
$hide_userselect = 1;
}
}
/**
* [hook]
* pm_send_init
*
* [availability]
* Phorum 5 >= 5.2.15
*
示例4: phorum_api_user_check_group_access
/**
* @param integer $permission
* The permission level to check for. The function will check if the
* user has equal or higher permissions for the group(s). The available
* permission levels in low-to-high level order are:
* - {@link PHORUM_USER_GROUP_SUSPENDED}
* - {@link PHORUM_USER_GROUP_UNAPPROVED}
* - {@link PHORUM_USER_GROUP_APPROVED}
* - {@link PHORUM_USER_GROUP_MODERATOR}
*
* @param mixed $group_id
* Specifies the group(s) to look at. Available options are:
* - The id of the group for which to check the access.
* - An array of group_ids to check.
* - {@link PHORUM_ACCESS_ANY} to check if the user has access rights
* for any of the available groups.
* - {@link PHORUM_ACCESS_LIST} to return a list of group_ids for which the
* user has access rights.
*
* @param mixed $user
* Specifies the user to look at. Available options are:
* - 0 (zero, the default) to look at the active Phorum user.
* - A full user data array.
* - A single user_id.
*
* @return mixed
* The return value depends on the $group_id argument that was used:
*
* - Single group_id or {@link PHORUM_ACCESS_ANY}:
* return either TRUE (access granted) or FALSE (access denied).
*
* - An array of group_ids or {@link PHORUM_ACCESS_LIST}:
* return an array, containing all groups for which permission was
* granted. The keys in this array are group_ids and the values are
* group info arrays. These arrays contain the fields "group_id",
* "name", "open", "permissions" (which contains an array of
* forum permissions, indexed by forum_id), "user_status" (which contains
* the group status for the user, i.e. one of the PHORUM_USER_GROUP_*
* constants).
*/
function phorum_api_user_check_group_access($permission, $group_id, $user = 0)
{
$PHORUM = $GLOBALS['PHORUM'];
// Prepare the user to check the access for.
if (empty($user)) {
$user = $PHORUM['user'];
} elseif (!is_array($user)) {
$user = phorum_api_user_get($user);
}
// Retrieve all the groups for the current user. Admins get all groups.
if (!empty($user['user_id']) && !empty($user['admin'])) {
$groups = phorum_db_get_groups(0, TRUE);
} else {
$usergroups = phorum_db_user_get_groups($user['user_id']);
$groups = empty($usergroups) ? array() : phorum_db_get_groups(array_keys($usergroups), TRUE);
}
// Prepare the array of group_ids to check.
$group_access = array();
$single_group_id = NULL;
// An array of group ids.
if (is_array($group_id)) {
foreach ($group_id as $id) {
$group_access[$id] = FALSE;
}
// Retrieve a group access list or access-rights-in-any-group.
} elseif ($group_id == PHORUM_ACCESS_LIST || $group_id == PHORUM_ACCESS_ANY) {
foreach ($groups as $id => $data) {
$group_access[$id] = FALSE;
}
// A single group id.
} else {
$single_group_id = $group_id;
$group_access[$group_id] = FALSE;
}
// Inactive users have no group permissions at all.
if (!empty($user['user_id']) && empty($user['active'])) {
if ($group_id == PHORUM_ACCESS_ANY) {
return FALSE;
}
// No further code required. We'll just keep all group
// permissions set to FALSE here.
} elseif (!empty($user['user_id']) && !empty($user['admin'])) {
if ($group_id == PHORUM_ACCESS_ANY) {
return TRUE;
}
foreach ($group_access as $id => $data) {
$group_access[$id] = $groups[$id];
$group_access[$id]['user_status'] = PHORUM_USER_GROUP_MODERATOR;
}
} else {
foreach ($group_access as $id => $data) {
if (!isset($groups[$id])) {
continue;
}
if ($usergroups[$id] >= $permission) {
if ($group_id == PHORUM_ACCESS_ANY) {
return TRUE;
}
$group_access[$id] = $groups[$id];
$group_access[$id]['user_status'] = $usergroups[$id];
//.........这里部分代码省略.........
示例5: array
$PHORUM["DATA"]["USERS"] = array();
$PHORUM["DATA"]["GROUP"]["URL"]["VIEW"] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id);
$PHORUM["DATA"]["FILTER"] = array();
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["ShowAll"], "enable" => $filter == "all", "url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id), "id" => "all");
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["ShowApproved"], "enable" => $filter == PHORUM_USER_GROUP_APPROVED, "url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id, "filter=" . PHORUM_USER_GROUP_APPROVED), "id" => PHORUM_USER_GROUP_APPROVED);
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["ShowGroupModerator"], "enable" => $filter == PHORUM_USER_GROUP_MODERATOR, "url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id, "filter=" . PHORUM_USER_GROUP_MODERATOR), "id" => PHORUM_USER_GROUP_MODERATOR);
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["ShowSuspended"], "enable" => $filter == PHORUM_USER_GROUP_SUSPENDED, "url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id, "filter=" . PHORUM_USER_GROUP_SUSPENDED), "id" => PHORUM_USER_GROUP_SUSPENDED);
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["ShowUnapproved"], "enable" => $filter != "all" && $filter == PHORUM_USER_GROUP_UNAPPROVED, "url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $group_id, "filter=" . PHORUM_USER_GROUP_UNAPPROVED), "id" => PHORUM_USER_GROUP_UNAPPROVED);
$PHORUM["DATA"]["STATUS_OPTIONS"] = array();
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => "remove", "name" => "< " . $PHORUM["DATA"]["LANG"]["RemoveFromGroup"] . " >");
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_APPROVED, "name" => $PHORUM["DATA"]["LANG"]["Approved"]);
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_UNAPPROVED, "name" => $PHORUM["DATA"]["LANG"]["Unapproved"]);
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_SUSPENDED, "name" => $PHORUM["DATA"]["LANG"]["Suspended"]);
$groupmembers = phorum_db_get_group_members($group_id);
$usersingroup = array_keys($groupmembers);
$users = phorum_api_user_get($usersingroup);
$memberlist = array();
foreach ($groupmembers as $userid => $status) {
// if we have a filter, check that the user is in it
if ($filter != "all") {
if ($filter != $status) {
continue;
}
}
$disabled = false;
$statustext = "";
// moderators can't edit other moderators
if ($status == PHORUM_USER_GROUP_MODERATOR) {
$disabled = true;
$statustext = $PHORUM["DATA"]["LANG"]["PermGroupModerator"];
}
示例6: dirname
require_once dirname(__FILE__) . '/../include/api.php';
// Make sure that the output is not buffered.
phorum_api_buffer_clear();
if (!ini_get('safe_mode')) {
set_time_limit(0);
ini_set("memory_limit", "64M");
}
$count_total = $PHORUM['DB']->user_count();
$res = $PHORUM['DB']->user_get_all();
print "\nRebuilding display name information ...\n";
$size = strlen($count_total);
$count = 0;
while ($user = $PHORUM['DB']->fetch_row($res, DB_RETURN_ASSOC)) {
// We save an empty user, to make sure that the display name in the
// database is up-to-date. This will already run needed updates in
// case the display name changed ...
phorum_api_user_save(array("user_id" => $user["user_id"]));
// ... but still we run the name updates here, so inconsistencies
// are flattened out.
$user = phorum_api_user_get($user["user_id"]);
$PHORUM['DB']->user_display_name_updates(array("user_id" => $user["user_id"], "display_name" => $user["display_name"]));
$count++;
$perc = floor($count / $count_total * 100);
$barlen = floor(20 * ($perc / 100));
$bar = "[";
$bar .= str_repeat("=", $barlen);
$bar .= str_repeat(" ", 20 - $barlen);
$bar .= "]";
printf("updating %{$size}d / %{$size}d %s (%d%%)\r", $count, $count_total, $bar, $perc);
}
print "\n\n";
示例7: phorum_build_forum_list
$PHORUM["DATA"]["SEARCH"]["match_threads"] = (int) $PHORUM["args"]["match_threads"];
$PHORUM["DATA"]["SEARCH"]["forum_list"] = phorum_build_forum_list();
if (isset($PHORUM["args"]["match_forum"])) {
$match_forum = explode(",", $PHORUM["args"]["match_forum"]);
foreach ($PHORUM["DATA"]["SEARCH"]["forum_list"] as $key => $list_item) {
if (in_array($list_item["forum_id"], $match_forum)) {
$PHORUM["DATA"]["SEARCH"]["forum_list"][$key]["selected"] = true;
}
}
}
foreach ($PHORUM["DATA"]["SEARCH"]["forum_list"] as $key => $list_item) {
$PHORUM["DATA"]["SEARCH"]["forum_list"][$key]['indent_spaces'] = str_repeat(" ", $list_item['indent']);
}
$PHORUM["DATA"]["SEARCH"]["forum_list_length"] = min(10, count($PHORUM["DATA"]["SEARCH"]["forum_list"]) + 1);
if ($PHORUM["args"]["match_type"] == "USER_ID") {
$search_user = phorum_api_user_get((int) $phorum_author);
if (!$search_user) {
$search_name = $PHORUM["DATA"]["LANG"]["AnonymousUser"];
} else {
$search_name = $search_user["display_name"];
if (empty($PHORUM['custom_display_name'])) {
$search_name = htmlspecialchars($search_name, ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
}
$PHORUM["DATA"]["HEADING"] = $PHORUM["DATA"]["LANG"]["SearchAllPosts"];
$PHORUM["DATA"]["HTML_TITLE"] = $PHORUM["DATA"]["LANG"]["SearchAllPosts"];
} else {
$PHORUM["DATA"]["HEADING"] = $PHORUM["DATA"]["LANG"]["Search"];
$PHORUM["DATA"]["HTML_TITLE"] .= PHORUM_SEPARATOR . $PHORUM["DATA"]["LANG"]["Search"];
if (!empty($phorum_search)) {
$PHORUM["DATA"]["HTML_TITLE"] .= " - " . htmlspecialchars($phorum_search);
示例8: phorum_mod_event_logging_user_delete
function phorum_mod_event_logging_user_delete($userid)
{
if (!$GLOBALS["PHORUM"]["mod_event_logging"]["do_log_user_delete"]) {
return $userid;
}
list($source, $from_module) = event_logging_find_source(1);
$user = phorum_api_user_get($userid);
event_logging_writelog(array("message" => "User deleted: {$user['username']} <{$user['email']}> ID: {$userid} .", "loglevel" => EVENTLOG_LVL_INFO, "source" => $source, "category" => EVENTLOG_CAT_SECURITY));
return $userid;
}
示例9: phorum_api_redirect
if (count($edit_tracks) == 0 || $PHORUM["track_edits"] == PHORUM_EDIT_TRACK_OFF || $PHORUM["track_edits"] == PHORUM_EDIT_TRACK_MODERATOR && !$PHORUM["DATA"]["MODERATOR"]) {
phorum_api_redirect(PHORUM_READ_URL, $message['thread'], $message_id);
}
$diffs = array_reverse($edit_tracks);
// push an empty diff for the current status
array_push($diffs, array());
$prev_body = -1;
$prev_subject = -1;
foreach ($diffs as $diff_info) {
if (!isset($diff_info["user_id"])) {
$this_version["username"] = empty($PHORUM['custom_display_name']) ? htmlspecialchars($message["author"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]) : $message["author"];
$this_version["user_id"] = $message["user_id"];
$this_version["date"] = phorum_api_format_date($PHORUM["long_date_time"], $message["datestamp"]);
$this_version["original"] = true;
} else {
$edit_user = phorum_api_user_get($diff_info['user_id']);
$this_version["username"] = empty($PHORUM['custom_display_name']) ? htmlspecialchars($edit_user["display_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]) : $edit_user["display_name"];
$this_version["user_id"] = $diff_info["user_id"];
$this_version["date"] = phorum_api_format_date($PHORUM["long_date_time"], $diff_info["time"]);
$this_version["original"] = false;
}
// only happens in first loop
if ($prev_body == -1) {
$prev_body = $message["body"];
}
// body diffs
if (isset($diff_info['diff_body']) && !empty($diff_info['diff_body'])) {
$colored_body = phorum_api_diff_unpatch_color($prev_body, $diff_info['diff_body']);
$prev_body = phorum_api_diff_unpatch($prev_body, $diff_info['diff_body']);
$colored_body = htmlspecialchars($colored_body, ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
$colored_body = str_replace(array("[phorum addition]", "[phorum removal]", "[/phorum addition]", "[/phorum removal]"), array("<span class=\"addition\">", "<span class=\"removal\">", "</span>", "</span>"), $colored_body);
示例10: phorum_posting_merge_db2form
function phorum_posting_merge_db2form($form, $db, $apply_readonly = false)
{
global $PHORUM;
// If we have a user linked to the current message, then get the
// user data from the database, if it has to be applied as
// read-only data. We fetch the data here, so later on we
// can apply it to the message.
if (($PHORUM["post_fields"]["email"][pf_READONLY] || $PHORUM["post_fields"]["author"][pf_READONLY]) && !empty($db["user_id"])) {
$user_info = phorum_api_user_get($db["user_id"]);
$user_info["author"] = $user_info["display_name"];
}
foreach ($PHORUM["post_fields"] as $key => $info) {
// Skip writeable fields if we only have to apply read-only ones.
if ($apply_readonly && !$info[pf_READONLY]) {
continue;
}
switch ($key) {
case "show_signature":
$form[$key] = !empty($db["meta"]["show_signature"]);
break;
case "allow_reply":
$form[$key] = !$db["closed"];
break;
case "subscription":
$type = phorum_api_user_get_subscription($db["user_id"], $db["forum_id"], $db["thread"]);
switch ($type) {
case NULL:
$form[$key] = "";
break;
case PHORUM_SUBSCRIPTION_BOOKMARK:
$form[$key] = "bookmark";
break;
case PHORUM_SUBSCRIPTION_MESSAGE:
$form[$key] = "message";
break;
default:
$form[$key] = "";
break;
}
break;
case "forum_id":
$form["forum_id"] = $db["forum_id"] ? $db["forum_id"] : $PHORUM["forum_id"];
break;
case "attachments":
$form[$key] = array();
if (isset($db["meta"]["attachments"])) {
foreach ($db["meta"]["attachments"] as $data) {
$data["keep"] = true;
$data["linked"] = true;
$form["attachments"][] = $data;
}
}
break;
case "author":
case "email":
if ($db["user_id"] && $PHORUM["post_fields"][$key][pf_READONLY]) {
$form[$key] = $user_info[$key];
} else {
$form[$key] = $db[$key];
}
break;
case "special":
if ($db["sort"] == PHORUM_SORT_STICKY) {
$form["special"] = "sticky";
} else {
$form["special"] = "";
}
break;
case "mode":
// NOOP
break;
default:
$form[$key] = $db[$key];
}
}
return $form;
}
示例11: testUserApiDelete
function testUserApiDelete()
{
$user_id = phorum_api_user_search('username', 'testuser' . $this->sharedFixture, '=');
$ret = phorum_api_user_delete($this->user_id_used);
$this->assertTrue($ret, 'User delete.');
$ret = phorum_api_user_get($this->user_id_used);
$this->assertNull($ret, 'Checking for deleted user.');
}
示例12: phorum_build_common_urls
include_once "./common.php";
include_once "./include/email_functions.php";
include_once "./include/format_functions.php";
// set all our URL's
phorum_build_common_urls();
$template = "profile";
$error = "";
// redirect if no profile id passed
if (!empty($PHORUM["args"][1])) {
$profile_id = (int) $PHORUM["args"][1];
}
if (empty($PHORUM["args"][1]) || empty($profile_id)) {
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
exit;
}
$user = phorum_api_user_get($profile_id, TRUE);
if (!is_array($user) || $user["active"] == 0) {
$PHORUM["DATA"]["ERROR"] = $PHORUM["DATA"]["LANG"]["UnknownUser"];
$PHORUM['DATA']["URL"]["REDIRECT"] = phorum_get_url(PHORUM_LIST_URL);
$PHORUM['DATA']["BACKMSG"] = $PHORUM["DATA"]["LANG"]["BackToList"];
// have to include the header here for the Redirect
phorum_output("message");
return;
}
// security messures
unset($user["password"]);
unset($user["permissions"]);
// set any custom profile fields that are not present.
if (!empty($PHORUM["PROFILE_FIELDS"])) {
foreach ($PHORUM["PROFILE_FIELDS"] as $id => $field) {
if ($id === 'num_fields' || !empty($field['deleted'])) {
示例13: confirm
onClick="CheckboxControl(this.form, false);">
<input type="submit" name="delete" value="Delete Selected Users"
onClick="return confirm('Really delete the selected user(s)?')">
</td>
</tr>
</table>
</form>
EOT;
} else {
echo "No Users Found.";
}
}
// display edit form
if (isset($_REQUEST["user_id"])) {
print "<a href=\"" . htmlspecialchars($referrer) . "\">Back to the user overview</a> | <a href=\"#forums\">Edit Forum Permissions</a> | <a href=\"#groups\">Edit Groups</a><br />";
$user = empty($user_data) ? phorum_api_user_get($_REQUEST["user_id"], TRUE) : $user_data;
if (count($user)) {
$frm = new PhorumInputForm("", "post", "Update");
$frm->hidden("module", "users");
$frm->hidden("section", "main");
$frm->hidden("referrer", $referrer);
$frm->hidden("user_id", $_REQUEST["user_id"]);
$frm->addbreak("Edit User");
$frm->addrow("User Name", $frm->text_box("username", $user["username"], 50));
$frm->addrow("Real Name", $frm->text_box("real_name", $user["real_name"], 50));
$frm->addrow("Email", $frm->text_box("email", $user["email"], 50));
$frm->addrow("Password (Enter to change)", $frm->text_box("password1", ""));
$frm->addrow("Password (Confirmation)", $frm->text_box("password2", ""));
$frm->addrow("Signature", $frm->textarea("signature", $user["signature"]));
$frm->addrow("Active", $frm->select_tag("active", array("No", "Yes"), $user["active"]));
$frm->addrow("Forum posts", $user["posts"]);
示例14: foreach
return;
}
$real_name_field = NULL;
foreach ($PHORUM['PROFILE_FIELDS'] as $id => $field) {
if ($id === 'num_fields') {
continue;
}
if ($field['name'] == 'real_name') {
$field['id'] = $id;
$real_name_field = $field;
break;
}
}
if (empty($real_name_field) || !empty($real_name_field['deleted'])) {
return;
}
// If we do, then copy all available real_names to the new real_name
// field in the user table.
$sth = $PHORUM['DB']->interact(DB_RETURN_RES, "SELECT * FROM {$PHORUM['DB']->prefix}_user_custom_fields\n WHERE type = {$real_name_field['id']}");
while ($row = $PHORUM['DB']->fetch_row($sth, DB_RETURN_ASSOC)) {
$user = phorum_api_user_get($row['user_id']);
if ($user) {
phorum_api_user_save_raw(array('user_id' => $row['user_id'], 'real_name' => $row['data']));
}
}
// Now we delete the existing real_name custom field.
// We only mark it as deleted. We keep the original data around for
// reference (just in case this upgrade failed in a terrible way)
$field =& $PHORUM['PROFILE_FIELDS'][$real_name_field['id']];
$field['deleted'] = 1;
$PHORUM['DB']->update_settings(array('PROFILE_FIELDS' => $PHORUM['PROFILE_FIELDS']));
示例15: phorum_admin_error
break;
case "create_tables":
$step = "create_admin_user";
break;
case "create_admin_user":
if (!empty($_POST["admin_user"]) && !empty($_POST["admin_pass"]) && !empty($_POST["admin_pass2"]) && !empty($_POST["admin_email"])) {
// Check if the two entered passwords are equal.
if ($_POST["admin_pass"] != $_POST["admin_pass2"]) {
phorum_admin_error("The password fields do not match");
break;
}
// Check if the user already exists as an admin user.
// If yes, then we can use that existing user.
$user_id = phorum_api_user_authenticate(PHORUM_ADMIN_SESSION, $_POST["admin_user"], $_POST["admin_pass"]);
if ($user_id) {
$user = phorum_api_user_get($user_id);
if (empty($user["admin"])) {
phorum_admin_error("That user already exists but without admin " . "permissions. Please create a different user.");
break;
}
}
// Authenticating the user failed? Let's check if the user
// already exists at all.
if (!$user_id) {
$user = phorum_api_user_search('username', $_POST['admin_user']);
if ($user) {
phorum_admin_error("That user already exists in the database.");
break;
}
}
// The user does not yet exist. Create it now.