本文整理汇总了PHP中getBasicMemberData函数的典型用法代码示例。如果您正苦于以下问题:PHP getBasicMemberData函数的具体用法?PHP getBasicMemberData怎么用?PHP getBasicMemberData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getBasicMemberData函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: action_modifyuser
/**
* Edit or add a user subscription.
*
* - Accessed from ?action=admin;area=paidsubscribe;sa=modifyuser
*/
public function action_modifyuser()
{
global $context, $txt, $modSettings;
require_once SUBSDIR . '/PaidSubscriptions.subs.php';
loadSubscriptions();
$context['log_id'] = isset($_REQUEST['lid']) ? (int) $_REQUEST['lid'] : 0;
$context['sub_id'] = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : 0;
$context['action_type'] = $context['log_id'] ? 'edit' : 'add';
// Setup the template.
$context['sub_template'] = 'modify_user_subscription';
$context['page_title'] = $txt[$context['action_type'] . '_subscriber'];
loadJavascriptFile('suggest.js', array('defer' => true));
// If we haven't been passed the subscription ID get it.
if ($context['log_id'] && !$context['sub_id']) {
$context['sub_id'] = validateSubscriptionID($context['log_id']);
}
if (!isset($context['subscriptions'][$context['sub_id']])) {
fatal_lang_error('no_access', false);
}
$context['current_subscription'] = $context['subscriptions'][$context['sub_id']];
// Searching?
if (isset($_POST['ssearch'])) {
return $this->action_viewsub();
} elseif (isset($_REQUEST['save_sub'])) {
checkSession();
// Work out the dates...
$starttime = mktime($_POST['hour'], $_POST['minute'], 0, $_POST['month'], $_POST['day'], $_POST['year']);
$endtime = mktime($_POST['hourend'], $_POST['minuteend'], 0, $_POST['monthend'], $_POST['dayend'], $_POST['yearend']);
// Status.
$status = $_POST['status'];
// New one?
if (empty($context['log_id'])) {
// Find the user...
require_once SUBSDIR . '/Members.subs.php';
$member = getMemberByName($_POST['name']);
if (empty($member)) {
fatal_lang_error('error_member_not_found');
}
if (alreadySubscribed($context['sub_id'], $member['id_member'])) {
fatal_lang_error('member_already_subscribed');
}
// Actually put the subscription in place.
if ($status == 1) {
addSubscription($context['sub_id'], $member['id_member'], 0, $starttime, $endtime);
} else {
$details = array('id_subscribe' => $context['sub_id'], 'id_member' => $member['id_member'], 'id_group' => $member['id_group'], 'start_time' => $starttime, 'end_time' => $endtime, 'status' => $status);
logSubscription($details);
}
} else {
$subscription_status = getSubscriptionStatus($context['log_id']);
// Pick the right permission stuff depending on what the status is changing from/to.
if ($subscription_status['old_status'] == 1 && $status != 1) {
removeSubscription($context['sub_id'], $subscription_status['id_member']);
} elseif ($status == 1 && $subscription_status['old_status'] != 1) {
addSubscription($context['sub_id'], $subscription_status['id_member'], 0, $starttime, $endtime);
} else {
$item = array('start_time' => $starttime, 'end_time' => $endtime, 'status' => $status, 'current_log_item' => $context['log_id']);
updateSubscriptionItem($item);
}
}
// Done - redirect...
redirectexit('action=admin;area=paidsubscribe;sa=viewsub;sid=' . $context['sub_id']);
} elseif (isset($_REQUEST['delete']) || isset($_REQUEST['finished'])) {
checkSession();
// Do the actual deletes!
if (!empty($_REQUEST['delsub'])) {
$toDelete = array();
foreach ($_REQUEST['delsub'] as $id => $dummy) {
$toDelete[] = (int) $id;
}
$deletes = prepareDeleteSubscriptions($toDelete);
foreach ($deletes as $id_subscribe => $id_member) {
removeSubscription($id_subscribe, $id_member, isset($_REQUEST['delete']));
}
}
redirectexit('action=admin;area=paidsubscribe;sa=viewsub;sid=' . $context['sub_id']);
}
// Default attributes.
if ($context['action_type'] == 'add') {
$context['sub'] = array('id' => 0, 'start' => array('year' => (int) strftime('%Y', time()), 'month' => (int) strftime('%m', time()), 'day' => (int) strftime('%d', time()), 'hour' => (int) strftime('%H', time()), 'min' => (int) strftime('%M', time()) < 10 ? '0' . (int) strftime('%M', time()) : (int) strftime('%M', time()), 'last_day' => 0), 'end' => array('year' => (int) strftime('%Y', time()), 'month' => (int) strftime('%m', time()), 'day' => (int) strftime('%d', time()), 'hour' => (int) strftime('%H', time()), 'min' => (int) strftime('%M', time()) < 10 ? '0' . (int) strftime('%M', time()) : (int) strftime('%M', time()), 'last_day' => 0), 'status' => 1);
$context['sub']['start']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['sub']['start']['month'] == 12 ? 1 : $context['sub']['start']['month'] + 1, 0, $context['sub']['start']['month'] == 12 ? $context['sub']['start']['year'] + 1 : $context['sub']['start']['year']));
$context['sub']['end']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['sub']['end']['month'] == 12 ? 1 : $context['sub']['end']['month'] + 1, 0, $context['sub']['end']['month'] == 12 ? $context['sub']['end']['year'] + 1 : $context['sub']['end']['year']));
if (isset($_GET['uid'])) {
require_once SUBSDIR . '/Members.subs.php';
// Get the latest activated member's display name.
$result = getBasicMemberData((int) $_GET['uid']);
$context['sub']['username'] = $result['real_name'];
} else {
$context['sub']['username'] = '';
}
} else {
$row = getPendingSubscriptions($context['log_id']);
if (empty($row)) {
fatal_lang_error('no_access', false);
}
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:ManagePaid.controller.php
示例2: removeSubscription
/**
* Removes a subscription from a user, as in removes the groups.
*
* @param int $id_subscribe
* @param int $id_member
* @param boolean $delete
*/
function removeSubscription($id_subscribe, $id_member, $delete = false)
{
global $context;
$db = database();
loadSubscriptions();
// Load the user core bits.
require_once SUBSDIR . '/Members.subs.php';
$member_info = getBasicMemberData($id_member, array('moderation' => true));
// Just in case of errors.
if (empty($member_info)) {
$db->query('', '
DELETE FROM {db_prefix}log_subscribed
WHERE id_member = {int:current_member}', array('current_member' => $id_member));
return;
}
// Get all of the subscriptions for this user that are active - it will be necessary!
$request = $db->query('', '
SELECT
id_subscribe, old_id_group
FROM {db_prefix}log_subscribed
WHERE id_member = {int:current_member}
AND status = {int:is_active}', array('current_member' => $id_member, 'is_active' => 1));
// These variables will be handy, honest ;)
$removals = array();
$allowed = array();
$member = array();
$member['id_group'] = 0;
$new_id_group = -1;
while ($row = $db->fetch_assoc($request)) {
if (!isset($context['subscriptions'][$row['id_subscribe']])) {
continue;
}
// The one we're removing?
if ($row['id_subscribe'] == $id_subscribe) {
$removals = explode(',', $context['subscriptions'][$row['id_subscribe']]['add_groups']);
if ($context['subscriptions'][$row['id_subscribe']]['prim_group'] != 0) {
$removals[] = $context['subscriptions'][$row['id_subscribe']]['prim_group'];
}
$member['id_group'] = $row['old_id_group'];
} else {
$allowed = array_merge($allowed, explode(',', $context['subscriptions'][$row['id_subscribe']]['add_groups']));
if ($context['subscriptions'][$row['id_subscribe']]['prim_group'] != 0) {
$allowed[] = $context['subscriptions'][$row['id_subscribe']]['prim_group'];
$new_id_group = $context['subscriptions'][$row['id_subscribe']]['prim_group'];
}
}
}
$db->free_result($request);
// Now, for everything we are removing check they defintely are not allowed it.
$existingGroups = explode(',', $member_info['additional_groups']);
foreach ($existingGroups as $key => $group) {
if (empty($group) || in_array($group, $removals) && !in_array($group, $allowed)) {
unset($existingGroups[$key]);
}
}
// Finally, do something with the current primary group.
if (in_array($member_info['id_group'], $removals)) {
// If this primary group is actually allowed keep it.
if (in_array($member_info['id_group'], $allowed)) {
$existingGroups[] = $member_info['id_group'];
}
// Either way, change the id_group back.
if ($new_id_group < 1) {
// If we revert to the old id-group we need to ensure it wasn't from a subscription.
foreach ($context['subscriptions'] as $id => $group) {
// It was? Make them a regular member then!
if ($group['prim_group'] == $member['id_group']) {
$member['id_group'] = 0;
}
}
$member_info['id_group'] = $member['id_group'];
} else {
$member_info['id_group'] = $new_id_group;
}
}
// Crazy stuff, we seem to have our groups fixed, just make them unique
$existingGroups = array_unique($existingGroups);
// Update the member
assignGroupsToMember($id_member, $member_info['id_group'], $existingGroups);
// Disable the subscription.
if (!$delete) {
$db->query('', '
UPDATE {db_prefix}log_subscribed
SET status = {int:not_active}
WHERE id_member = {int:current_member}
AND id_subscribe = {int:current_subscription}', array('not_active' => 0, 'current_member' => $id_member, 'current_subscription' => $id_subscribe));
} else {
$db->query('', '
DELETE FROM {db_prefix}log_subscribed
WHERE id_member = {int:current_member}
AND id_subscribe = {int:current_subscription}', array('current_member' => $id_member, 'current_subscription' => $id_subscribe));
}
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:100,代码来源:PaidSubscriptions.subs.php
示例3: getMembersInRange
/**
* Return the details of the members using a certain range of IPs
* except the current one
*
* @param string[] $ips a list of IP addresses
* @param int $memID the id of the "current" member (maybe it could be retrieved with currentMemberID)
*/
function getMembersInRange($ips, $memID)
{
$db = database();
$message_members = array();
$members_in_range = array();
// Get member ID's which are in messages...
$request = $db->query('', '
SELECT mem.id_member
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.poster_ip IN ({array_string:ip_list})
GROUP BY mem.id_member
HAVING mem.id_member != {int:current_member}', array('current_member' => $memID, 'ip_list' => $ips));
while ($row = $db->fetch_assoc($request)) {
$message_members[] = $row['id_member'];
}
$db->free_result($request);
// And then get the member ID's belong to other users
$request = $db->query('', '
SELECT id_member
FROM {db_prefix}members
WHERE id_member != {int:current_member}
AND member_ip IN ({array_string:ip_list})', array('current_member' => $memID, 'ip_list' => $ips));
while ($row = $db->fetch_assoc($request)) {
$message_members[] = $row['id_member'];
}
$db->free_result($request);
// Once the IDs are all combined, let's clean them up
$message_members = array_unique($message_members);
// And finally, fetch their names, cause of the GROUP BY doesn't like giving us that normally.
if (!empty($message_members)) {
require_once SUBSDIR . '/Members.subs.php';
// Get the latest activated member's display name.
$members_in_range = getBasicMemberData($message_members);
}
return $members_in_range;
}
开发者ID:scripple,项目名称:Elkarte,代码行数:44,代码来源:Profile.subs.php
示例4: createPost
/**
* Create a post, either as new topic (id_topic = 0) or in an existing one.
*
* The input parameters of this function assume:
* - Strings have been escaped.
* - Integers have been cast to integer.
* - Mandatory parameters are set.
*
* @package Posts
* @param mixed[] $msgOptions
* @param mixed[] $topicOptions
* @param mixed[] $posterOptions
*/
function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
{
global $user_info, $txt, $modSettings;
$db = database();
// Set optional parameters to the default value.
$msgOptions['icon'] = empty($msgOptions['icon']) ? 'xx' : $msgOptions['icon'];
$msgOptions['smileys_enabled'] = !empty($msgOptions['smileys_enabled']);
$msgOptions['attachments'] = empty($msgOptions['attachments']) ? array() : $msgOptions['attachments'];
$msgOptions['approved'] = isset($msgOptions['approved']) ? (int) $msgOptions['approved'] : 1;
$topicOptions['id'] = empty($topicOptions['id']) ? 0 : (int) $topicOptions['id'];
$topicOptions['poll'] = isset($topicOptions['poll']) ? (int) $topicOptions['poll'] : null;
$topicOptions['lock_mode'] = isset($topicOptions['lock_mode']) ? $topicOptions['lock_mode'] : null;
$topicOptions['sticky_mode'] = isset($topicOptions['sticky_mode']) ? $topicOptions['sticky_mode'] : null;
$topicOptions['redirect_expires'] = isset($topicOptions['redirect_expires']) ? $topicOptions['redirect_expires'] : null;
$topicOptions['redirect_topic'] = isset($topicOptions['redirect_topic']) ? $topicOptions['redirect_topic'] : null;
$posterOptions['id'] = empty($posterOptions['id']) ? 0 : (int) $posterOptions['id'];
$posterOptions['ip'] = empty($posterOptions['ip']) ? $user_info['ip'] : $posterOptions['ip'];
// We need to know if the topic is approved. If we're told that's great - if not find out.
if (!$modSettings['postmod_active']) {
$topicOptions['is_approved'] = true;
} elseif (!empty($topicOptions['id']) && !isset($topicOptions['is_approved'])) {
$request = $db->query('', '
SELECT approved
FROM {db_prefix}topics
WHERE id_topic = {int:id_topic}
LIMIT 1', array('id_topic' => $topicOptions['id']));
list($topicOptions['is_approved']) = $db->fetch_row($request);
$db->free_result($request);
}
// If nothing was filled in as name/email address, try the member table.
if (!isset($posterOptions['name']) || $posterOptions['name'] == '' || empty($posterOptions['email']) && !empty($posterOptions['id'])) {
if (empty($posterOptions['id'])) {
$posterOptions['id'] = 0;
$posterOptions['name'] = $txt['guest_title'];
$posterOptions['email'] = '';
} elseif ($posterOptions['id'] != $user_info['id']) {
require_once SUBSDIR . '/Members.subs.php';
$result = getBasicMemberData($posterOptions['id']);
// Couldn't find the current poster?
if (empty($result)) {
trigger_error('createPost(): Invalid member id ' . $posterOptions['id'], E_USER_NOTICE);
$posterOptions['id'] = 0;
$posterOptions['name'] = $txt['guest_title'];
$posterOptions['email'] = '';
} else {
$posterOptions['name'] = $result['member_name'];
$posterOptions['email'] = $result['email_address'];
}
} else {
$posterOptions['name'] = $user_info['name'];
$posterOptions['email'] = $user_info['email'];
}
}
// It's do or die time: forget any user aborts!
$previous_ignore_user_abort = ignore_user_abort(true);
$new_topic = empty($topicOptions['id']);
$message_columns = array('id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => 'string-255', 'body' => !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] > 65534 ? 'string-' . $modSettings['max_messageLength'] : (empty($modSettings['max_messageLength']) ? 'string' : 'string-65534'), 'poster_name' => 'string-255', 'poster_email' => 'string-255', 'poster_time' => 'int', 'poster_ip' => 'string-255', 'smileys_enabled' => 'int', 'modified_name' => 'string', 'icon' => 'string-16', 'approved' => 'int');
$message_parameters = array('id_board' => $topicOptions['board'], 'id_topic' => $topicOptions['id'], 'id_member' => $posterOptions['id'], 'subject' => $msgOptions['subject'], 'body' => $msgOptions['body'], 'poster_name' => $posterOptions['name'], 'poster_email' => $posterOptions['email'], 'poster_time' => empty($posterOptions['time']) ? time() : $posterOptions['time'], 'poster_ip' => $posterOptions['ip'], 'smileys_enabled' => $msgOptions['smileys_enabled'] ? 1 : 0, 'modified_name' => '', 'icon' => $msgOptions['icon'], 'approved' => $msgOptions['approved']);
// What if we want to do anything with posts?
call_integration_hook('integrate_before_create_post', array(&$msgOptions, &$topicOptions, &$posterOptions, &$message_columns, &$message_parameters));
// Insert the post.
$db->insert('', '{db_prefix}messages', $message_columns, $message_parameters, array('id_msg'));
$msgOptions['id'] = $db->insert_id('{db_prefix}messages', 'id_msg');
// Something went wrong creating the message...
if (empty($msgOptions['id'])) {
return false;
}
// Fix the attachments.
if (!empty($msgOptions['attachments'])) {
$db->query('', '
UPDATE {db_prefix}attachments
SET id_msg = {int:id_msg}
WHERE id_attach IN ({array_int:attachment_list})', array('attachment_list' => $msgOptions['attachments'], 'id_msg' => $msgOptions['id']));
}
// What if we want to export new posts out to a CMS?
call_integration_hook('integrate_create_post', array($msgOptions, $topicOptions, $posterOptions, $message_columns, $message_parameters));
// Insert a new topic (if the topicID was left empty.)
if ($new_topic) {
$topic_columns = array('id_board' => 'int', 'id_member_started' => 'int', 'id_member_updated' => 'int', 'id_first_msg' => 'int', 'id_last_msg' => 'int', 'locked' => 'int', 'is_sticky' => 'int', 'num_views' => 'int', 'id_poll' => 'int', 'unapproved_posts' => 'int', 'approved' => 'int', 'redirect_expires' => 'int', 'id_redirect_topic' => 'int');
$topic_parameters = array('id_board' => $topicOptions['board'], 'id_member_started' => $posterOptions['id'], 'id_member_updated' => $posterOptions['id'], 'id_first_msg' => $msgOptions['id'], 'id_last_msg' => $msgOptions['id'], 'locked' => $topicOptions['lock_mode'] === null ? 0 : $topicOptions['lock_mode'], 'is_sticky' => $topicOptions['sticky_mode'] === null ? 0 : $topicOptions['sticky_mode'], 'num_views' => 0, 'id_poll' => $topicOptions['poll'] === null ? 0 : $topicOptions['poll'], 'unapproved_posts' => $msgOptions['approved'] ? 0 : 1, 'approved' => $msgOptions['approved'], 'redirect_expires' => $topicOptions['redirect_expires'] === null ? 0 : $topicOptions['redirect_expires'], 'id_redirect_topic' => $topicOptions['redirect_topic'] === null ? 0 : $topicOptions['redirect_topic']);
call_integration_hook('integrate_before_create_topic', array(&$msgOptions, &$topicOptions, &$posterOptions, &$topic_columns, &$topic_parameters));
$db->insert('', '{db_prefix}topics', $topic_columns, $topic_parameters, array('id_topic'));
$topicOptions['id'] = $db->insert_id('{db_prefix}topics', 'id_topic');
// The topic couldn't be created for some reason.
if (empty($topicOptions['id'])) {
// We should delete the post that did work, though...
$db->query('', '
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:Post.subs.php
示例5: action_groupMembership2
//.........这里部分代码省略.........
list($disallow) = $db->fetch_row($request);
$db->free_result($request);
if ($disallow) {
isAllowedTo('admin_forum');
}
}
// If we're requesting, add the note then return.
if ($changeType == 'request') {
$request = $db->query('', '
SELECT id_member
FROM {db_prefix}log_group_requests
WHERE id_member = {int:selected_member}
AND id_group = {int:selected_group}', array('selected_member' => $memID, 'selected_group' => $group_id));
if ($db->num_rows($request) != 0) {
fatal_lang_error('profile_error_already_requested_group');
}
$db->free_result($request);
// Log the request.
$db->insert('', '{db_prefix}log_group_requests', array('id_member' => 'int', 'id_group' => 'int', 'time_applied' => 'int', 'reason' => 'string-65534'), array($memID, $group_id, time(), $_POST['reason']), array('id_request'));
// Send an email to all group moderators etc.
require_once SUBSDIR . '/Mail.subs.php';
// Do we have any group moderators?
$request = $db->query('', '
SELECT id_member
FROM {db_prefix}group_moderators
WHERE id_group = {int:selected_group}', array('selected_group' => $group_id));
$moderators = array();
while ($row = $db->fetch_assoc($request)) {
$moderators[] = $row['id_member'];
}
$db->free_result($request);
// Otherwise this is the backup!
if (empty($moderators)) {
require_once SUBSDIR . '/Members.subs.php';
$moderators = membersAllowedTo('manage_membergroups');
}
if (!empty($moderators)) {
require_once SUBSDIR . '/Members.subs.php';
$members = getBasicMemberData($moderators, array('preferences' => true, 'sort' => 'lngfile'));
foreach ($members as $member) {
if ($member['notify_types'] != 4) {
continue;
}
// Check whether they are interested.
if (!empty($member['mod_prefs'])) {
list(, , $pref_binary) = explode('|', $member['mod_prefs']);
if (!($pref_binary & 4)) {
continue;
}
}
$replacements = array('RECPNAME' => $member['member_name'], 'APPYNAME' => $old_profile['member_name'], 'GROUPNAME' => $group_name, 'REASON' => $_POST['reason'], 'MODLINK' => $scripturl . '?action=moderate;area=groups;sa=requests');
$emaildata = loadEmailTemplate('request_membership', $replacements, empty($member['lngfile']) || empty($modSettings['userLanguage']) ? $language : $member['lngfile']);
sendmail($member['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
}
}
return $changeType;
} elseif ($changeType == 'free') {
// Are we leaving?
if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id])) {
if ($old_profile['id_group'] == $group_id) {
$newPrimary = 0;
} else {
unset($addGroups[$group_id]);
}
} else {
// Can we change the primary, and do we want to?
if ($canChangePrimary) {
if ($old_profile['id_group'] != 0) {
$addGroups[$old_profile['id_group']] = -1;
}
$newPrimary = $group_id;
} else {
$addGroups[$group_id] = -1;
}
}
} elseif ($canChangePrimary) {
if ($old_profile['id_group'] != 0) {
$addGroups[$old_profile['id_group']] = -1;
}
if (isset($addGroups[$group_id])) {
unset($addGroups[$group_id]);
}
$newPrimary = $group_id;
}
// Finally, we can make the changes!
foreach ($addGroups as $id => $dummy) {
if (empty($id)) {
unset($addGroups[$id]);
}
}
$addGroups = implode(',', array_flip($addGroups));
// Ensure that we don't cache permissions if the group is changing.
if ($context['user']['is_owner']) {
$_SESSION['mc']['time'] = 0;
} else {
updateSettings(array('settings_updated' => time()));
}
updateMemberData($memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups));
return $changeType;
}
开发者ID:scripple,项目名称:Elkarte,代码行数:101,代码来源:ProfileOptions.controller.php
示例6: generateSubscriptionError
}
}
if (empty($txnType)) {
generateSubscriptionError($txt['paid_unknown_transaction_type']);
}
// Get the subscription and member ID amoungst others...
@(list($subscription_id, $member_id) = $gatewayClass->precheck());
// Integer these just in case.
$subscription_id = (int) $subscription_id;
$member_id = (int) $member_id;
// This would be bad...
if (empty($member_id)) {
generateSubscriptionError($txt['paid_empty_member']);
}
// Verify the member.
$member_info = getBasicMemberData($member_id);
// Didn't find them?
if (empty($member_info)) {
generateSubscriptionError(sprintf($txt['paid_could_not_find_member'], $member_id));
}
// Get the subscription details.
$request = $db->query('', '
SELECT cost, length, name
FROM {db_prefix}subscriptions
WHERE id_subscribe = {int:current_subscription}', array('current_subscription' => $subscription_id));
// Didn't find it?
if ($db->num_rows($request) === 0) {
generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription'], $member_id, $subscription_id));
}
$subscription_info = $db->fetch_assoc($request);
$db->free_result($request);
开发者ID:KeiroD,项目名称:Elkarte,代码行数:31,代码来源:subscriptions.php
示例7: action_coppa
/**
* This function will display the contact information for the forum, as well a form to fill in.
* Accessed by action=coppa
*/
public function action_coppa()
{
global $context, $modSettings, $txt;
loadLanguage('Login');
loadTemplate('Register');
// No User ID??
if (!isset($_GET['member'])) {
fatal_lang_error('no_access', false);
}
// Get the user details...
require_once SUBSDIR . '/Members.subs.php';
$member = getBasicMemberData((int) $_GET['member'], array('authentication' => true));
// If doesn't exist or not pending coppa
if (empty($member) || $member['is_activated'] != 5) {
fatal_lang_error('no_access', false);
}
if (isset($_GET['form'])) {
// Some simple contact stuff for the forum.
$context['forum_contacts'] = (!empty($modSettings['coppaPost']) ? $modSettings['coppaPost'] . '<br /><br />' : '') . (!empty($modSettings['coppaFax']) ? $modSettings['coppaFax'] . '<br />' : '');
$context['forum_contacts'] = !empty($context['forum_contacts']) ? $context['forum_name_html_safe'] . '<br />' . $context['forum_contacts'] : '';
// Showing template?
if (!isset($_GET['dl'])) {
// Shortcut for producing underlines.
$context['ul'] = '<u> </u>';
Template_Layers::getInstance()->removeAll();
$context['sub_template'] = 'coppa_form';
$context['page_title'] = replaceBasicActionUrl($txt['coppa_form_title']);
$context['coppa_body'] = str_replace(array('{PARENT_NAME}', '{CHILD_NAME}', '{USER_NAME}'), array($context['ul'], $context['ul'], $member['member_name']), replaceBasicActionUrl($txt['coppa_form_body']));
} else {
// The data.
$ul = ' ';
$crlf = "\r\n";
$data = $context['forum_contacts'] . $crlf . $txt['coppa_form_address'] . ':' . $crlf . $txt['coppa_form_date'] . ':' . $crlf . $crlf . $crlf . replaceBasicActionUrl($txt['coppa_form_body']);
$data = str_replace(array('{PARENT_NAME}', '{CHILD_NAME}', '{USER_NAME}', '<br>', '<br />'), array($ul, $ul, $member['member_name'], $crlf, $crlf), $data);
// Send the headers.
header('Connection: close');
header('Content-Disposition: attachment; filename="approval.txt"');
header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream'));
header('Content-Length: ' . count($data));
echo $data;
obExit(false);
}
} else {
$context += array('page_title' => $txt['coppa_title'], 'sub_template' => 'coppa');
$context['coppa'] = array('body' => str_replace('{MINIMUM_AGE}', $modSettings['coppaAge'], replaceBasicActionUrl($txt['coppa_after_registration'])), 'many_options' => !empty($modSettings['coppaPost']) && !empty($modSettings['coppaFax']), 'post' => empty($modSettings['coppaPost']) ? '' : $modSettings['coppaPost'], 'fax' => empty($modSettings['coppaFax']) ? '' : $modSettings['coppaFax'], 'phone' => empty($modSettings['coppaPhone']) ? '' : str_replace('{PHONE_NUMBER}', $modSettings['coppaPhone'], $txt['coppa_send_by_phone']), 'id' => $_GET['member']);
}
}
开发者ID:Ralkage,项目名称:Elkarte,代码行数:51,代码来源:Register.controller.php
示例8: action_log
/**
* View the forum's error log.
*
* What it does:
* - This method sets all the context up to show the error log for maintenance.
* - It requires the admin_forum permission.
* - It is accessed from ?action=admin;area=logs;sa=errorlog.
*
* @uses the Errors template and error_log sub template.
*/
protected function action_log()
{
global $scripturl, $txt, $context, $modSettings, $user_profile, $filter;
// We'll escape some strings...
$db = database();
require_once SUBSDIR . '/Error.subs.php';
// Templates, etc...
loadLanguage('Maintenance');
loadTemplate('Errors');
// You can filter by any of the following columns:
$filters = array('id_member' => $txt['username'], 'ip' => $txt['ip_address'], 'session' => $txt['session'], 'url' => $txt['error_url'], 'message' => $txt['error_message'], 'error_type' => $txt['error_type'], 'file' => $txt['file'], 'line' => $txt['line']);
// Set up the filtering...
if (isset($_GET['value'], $_GET['filter']) && isset($filters[$_GET['filter']])) {
$filter = array('variable' => $_GET['filter'], 'value' => array('sql' => in_array($_GET['filter'], array('message', 'url', 'file')) ? base64_decode(strtr($_GET['value'], array(' ' => '+'))) : $db->escape_wildcard_string($_GET['value'])), 'href' => ';filter=' . $_GET['filter'] . ';value=' . $_GET['value'], 'entity' => $filters[$_GET['filter']]);
} elseif (isset($_GET['filter']) || isset($_GET['value'])) {
unset($_GET['filter'], $_GET['value']);
}
// Deleting, are we?
$type = isset($_POST['delall']) ? 'delall' : (isset($_POST['delete']) ? 'delete' : false);
$error_list = isset($_POST['delete']) ? $_POST['delete'] : null;
if ($type != false) {
// Make sure the session exists and is correct; otherwise, might be a hacker.
checkSession();
validateToken('admin-el');
deleteErrors($type, $filter, $error_list);
// Go back to where we were.
if ($type == 'delete') {
redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : '') . ';start=' . $_GET['start'] . (isset($filter) ? ';filter=' . $_GET['filter'] . ';value=' . $_GET['value'] : ''));
}
// Go back to where we were.
redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : ''));
}
$num_errors = numErrors($filter);
// If this filter is empty...
if ($num_errors == 0 && isset($filter)) {
redirectexit('action=admin;area=logs;sa=errorlog' . (isset($_REQUEST['desc']) ? ';desc' : ''));
}
// Clean up start.
if (!isset($_GET['start']) || $_GET['start'] < 0) {
$_GET['start'] = 0;
}
// Do we want to reverse error listing?
$context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up';
// Set the page listing up.
$context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=logs;sa=errorlog' . ($context['sort_direction'] == 'down' ? ';desc' : '') . (isset($filter) ? $filter['href'] : ''), $_GET['start'], $num_errors, $modSettings['defaultMaxMessages']);
$context['start'] = $_GET['start'];
$context['errors'] = array();
$logdata = getErrorLogData($_GET['start'], $context['sort_direction'], $filter);
if (!empty($logdata)) {
$context['errors'] = $logdata['errors'];
$members = $logdata['members'];
}
// Load the member data.
if (!empty($members)) {
require_once SUBSDIR . '/Members.subs.php';
$members = getBasicMemberData($members, array('add_guest' => true));
// Go through each error and tack the data on.
foreach ($context['errors'] as $id => $dummy) {
$memID = $context['errors'][$id]['member']['id'];
$context['errors'][$id]['member']['username'] = $members[$memID]['member_name'];
$context['errors'][$id]['member']['name'] = $members[$memID]['real_name'];
$context['errors'][$id]['member']['href'] = empty($memID) ? '' : $scripturl . '?action=profile;u=' . $memID;
$context['errors'][$id]['member']['link'] = empty($memID) ? $txt['guest_title'] : '<a href="' . $scripturl . '?action=profile;u=' . $memID . '">' . $context['errors'][$id]['member']['name'] . '</a>';
}
}
// Filtering anything?
if (isset($filter)) {
$context['filter'] =& $filter;
// Set the filtering context.
if ($filter['variable'] == 'id_member') {
$id = $filter['value']['sql'];
loadMemberData($id, false, 'minimal');
$context['filter']['value']['html'] = '<a href="' . $scripturl . '?action=profile;u=' . $id . '">' . $user_profile[$id]['real_name'] . '</a>';
} elseif ($filter['variable'] == 'url') {
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars((substr($filter['value']['sql'], 0, 1) == '?' ? $scripturl : '') . $filter['value']['sql'], ENT_COMPAT, 'UTF-8'), array('\\_' => '_')) . '\'';
} elseif ($filter['variable'] == 'message') {
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars($filter['value']['sql'], ENT_COMPAT, 'UTF-8'), array("\n" => '<br />', '<br />' => '<br />', "\t" => ' ', '\\_' => '_', '\\%' => '%', '\\\\' => '\\')) . '\'';
$context['filter']['value']['html'] = preg_replace('~&lt;span class=&quot;remove&quot;&gt;(.+?)&lt;/span&gt;~', '$1', $context['filter']['value']['html']);
} elseif ($filter['variable'] == 'error_type') {
$context['filter']['value']['html'] = '\'' . strtr(htmlspecialchars($filter['value']['sql'], ENT_COMPAT, 'UTF-8'), array("\n" => '<br />', '<br />' => '<br />', "\t" => ' ', '\\_' => '_', '\\%' => '%', '\\\\' => '\\')) . '\'';
} else {
$context['filter']['value']['html'] =& $filter['value']['sql'];
}
}
$sort = $context['sort_direction'] == 'down' ? ';desc' : '';
// What type of errors do we have and how many do we have?
$context['error_types'] = array();
$context['error_types'] = fetchErrorsByType($filter, $sort);
$tmp = array_keys($context['error_types']);
$sum = (int) end($tmp);
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:ManageErrors.controller.php
示例9: isFirstLogin
/**
* This functions determines whether this is the first login of the given user.
*
* @package Authorization
* @param int $id_member the id of the member to check for
*/
function isFirstLogin($id_member)
{
// First login?
require_once SUBSDIR . '/Members.subs.php';
$member = getBasicMemberData($id_member, array('moderation' => true));
return !empty($member) && $member['last_login'] == 0;
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:13,代码来源:Auth.subs.php
示例10: action_staff
/**
* Report for showing all the forum staff members - quite a feat!
* functions ending with "Report" are responsible for generating data
* for reporting.
* they are all called from action_index.
* never access the context directly, but use the data handling
* functions to do so.
*/
public function action_staff()
{
global $txt;
require_once SUBSDIR . '/Members.subs.php';
require_once SUBSDIR . '/Boards.subs.php';
require_once SUBSDIR . '/Membergroups.subs.php';
// Fetch all the board names.
$boards = fetchBoardsInfo('all');
$moderators = allBoardModerators(true);
$boards_moderated = array();
foreach ($moderators as $id_member => $rows) {
foreach ($rows as $row) {
$boards_moderated[$id_member][] = $row['id_board'];
}
}
// Get a list of global moderators (i.e. members with moderation powers).
$global_mods = array_intersect(membersAllowedTo('moderate_board', 0), membersAllowedTo('approve_posts', 0), membersAllowedTo('remove_any', 0), membersAllowedTo('modify_any', 0));
// How about anyone else who is special?
$allStaff = array_merge(membersAllowedTo('admin_forum'), membersAllowedTo('manage_membergroups'), membersAllowedTo('manage_permissions'), array_keys($moderators), $global_mods);
// Make sure everyone is there once - no admin less important than any other!
$allStaff = array_unique($allStaff);
// This is a bit of a cop out - but we're protecting their forum, really!
if (count($allStaff) > 300) {
fatal_lang_error('report_error_too_many_staff');
}
// Get all the possible membergroups!
$all_groups = getBasicMembergroupData(array('all'), array(), null, false);
$groups = array(0 => $txt['full_member']);
foreach ($all_groups as $row) {
$groups[$row['id']] = empty($row['online_color']) ? $row['name'] : '<span style="color: ' . $row['online_color'] . '">' . $row['name'] . '</span>';
}
// All the fields we'll show.
$staffSettings = array('position' => $txt['report_staff_position'], 'moderates' => $txt['report_staff_moderates'], 'posts' => $txt['report_staff_posts'], 'last_login' => $txt['report_staff_last_login']);
// Do it in columns, it's just easier.
setKeys('cols');
// Get the latest activated member's display name.
$result = getBasicMemberData($allStaff, array('moderation' => true, 'sort' => 'real_name'));
foreach ($result as $row) {
// Each member gets their own table!.
newTable($row['real_name'], '', 'left', 'auto', 'left', 200, 'center');
// First off, add in the side key.
addData($staffSettings);
// Create the main data array.
$staffData = array('position' => isset($groups[$row['id_group']]) ? $groups[$row['id_group']] : $groups[0], 'posts' => $row['posts'], 'last_login' => standardTime($row['last_login']), 'moderates' => array());
// What do they moderate?
if (in_array($row['id_member'], $global_mods)) {
$staffData['moderates'] = '<em>' . $txt['report_staff_all_boards'] . '</em>';
} elseif (isset($boards_moderated[$row['id_member']])) {
// Get the names
foreach ($boards_moderated[$row['id_member']] as $board) {
if (isset($boards[$board])) {
$staffData['moderates'][] = $boards[$board]['name'];
}
}
$staffData['moderates'] = implode(', ', $staffData['moderates']);
} else {
$staffData['moderates'] = '<em>' . $txt['report_staff_no_boards'] . '</em>';
}
// Next add the main data.
addData($staffData);
}
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:70,代码来源:Reports.controller.php
示例11: memberQuerySeeBoard
/**
* Builds the 'query_see_board' element for a certain member
*
* @package Members
* @param integer $id_member a valid member id
*/
function memberQuerySeeBoard($id_member)
{
global $modSettings;
$member = getBasicMemberData($id_member, array('moderation' => true));
if (empty($member['additional_groups'])) {
$groups = array($member['id_group'], $member['id_post_group']);
} else {
$groups = array_merge(array($member['id_group'], $member['id_post_group']), explode(',', $member['additional_groups']));
}
foreach ($groups as $k => $v) {
$groups[$k] = (int) $v;
}
$groups = array_unique($groups);
if (in_array(1, $groups)) {
return '1=1';
} else {
require_once SUBSDIR . '/Boards.subs.php';
$boards_mod = boardsModerated($id_member);
$mod_query = empty($boards_mod) ? '' : ' OR b.id_board IN (' . implode(',', $boards_mod) . ')';
return '((FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $groups) . ', b.member_groups) != 0)' . (!empty($modSettings['deny_boards_access']) ? ' AND (FIND_IN_SET(' . implode(', b.deny_member_groups) = 0 AND FIND_IN_SET(', $groups) . ', b.deny_member_groups) = 0)' : '') . $mod_query . ')';
}
}
开发者ID:Ralkage,项目名称:Elkarte,代码行数:28,代码来源:Members.subs.php
示例12: action_manrules
/**
* List and allow adding/entering all man rules, such as
*
* What it does:
* - If it itches, it will be scratched.
* - Yes or No are perfectly acceptable answers to almost every question.
* - Men see in only 16 colors, Peach, for example, is a fruit, not a color.
*
* @uses sub template rules
*/
public function action_manrules()
{
global $txt, $context, $user_info, $scripturl;
require_once SUBSDIR . '/PersonalMessage.subs.php';
// The link tree - gotta have this :o
$context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=manrules', 'name' => $txt['pm_manage_rules']);
$context['page_title'] = $txt['pm_manage_rules'];
$context['sub_template'] = 'rules';
// Load them... load them!!
loadRules();
// Likely to need all the groups!
require_once SUBSDIR . '/Membergroups.subs.php';
$context['groups'] = accessibleGroups();
// Applying all rules?
if (isset($_GET['apply'])) {
checkSession('get');
applyRules(true);
redirectexit('action=pm;sa=manrules');
}
// Editing a specific rule?
if (isset($_GET['add'])) {
$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']]) ? (int) $_GET['rid'] : 0;
$context['sub_template'] = 'add_rule';
// Any known rule
$js_rules = '';
foreach ($context['known_rules'] as $rule) {
$js_rules .= JavaScriptEscape($rule) . ': ' . JavaScriptEscape($txt['pm_rule_' . $rule]) . ',';
}
$js_rules = '{' . substr($js_rules, 0, -1) . '}';
// Any known label
$js_labels = '';
foreach ($context['labels'] as $label) {
if ($label['id'] != -1) {
$js_labels .= JavaScriptEscape($label['id'] + 1) . ': ' . JavaScriptEscape($label['name']) . ',';
}
}
$js_labels = '{' . substr($js_labels, 0, -1) . '}';
// And all of the groups as well
$js_groups = '';
foreach ($context['groups'] as $id => $title) {
$js_groups .= JavaScriptEscape($id) . ': ' . JavaScriptEscape($title) . ',';
}
$js_groups = '{' . substr($js_groups, 0, -1) . '}';
// Oh my, we have a lot of text strings for this
addJavascriptVar(array('criteriaNum' => 0, 'actionNum' => 0, 'groups' => $js_groups, 'labels' => $js_labels, 'rules' => $js_rules, 'txt_pm_readable_and' => $txt['pm_readable_and'], 'txt_pm_readable_or' => $txt['pm_readable_or'], 'txt_pm_readable_member' => $txt['pm_readable_member'], 'txt_pm_readable_group' => $txt['pm_readable_group'], 'txt_pm_readable_subject ' => $txt['pm_readable_subject'], 'txt_pm_readable_body' => $txt['pm_readable_body'], 'txt_pm_readable_buddy' => $txt['pm_readable_buddy'], 'txt_pm_readable_label' => $txt['pm_readable_label'], 'txt_pm_readable_delete' => $txt['pm_readable_delete'], 'txt_pm_readable_start' => $txt['pm_readable_start'], 'txt_pm_readable_end' => $txt['pm_readable_end'], 'txt_pm_readable_then' => $txt['pm_readable_then'], 'txt_pm_rule_not_defined' => $txt['pm_rule_not_defined'], 'txt_pm_rule_criteria_pick' => $txt['pm_rule_criteria_pick'], 'txt_pm_rule_sel_group' => $txt['pm_rule_sel_group'], 'txt_pm_rule_sel_action' => $txt['pm_rule_sel_action'], 'txt_pm_rule_label' => $txt['pm_rule_label'], 'txt_pm_rule_delete' => $txt['pm_rule_delete'], 'txt_pm_rule_sel_label' => $txt['pm_rule_sel_label']), true);
// Current rule information...
if ($context['rid']) {
$context['rule'] = $context['rules'][$context['rid']];
$members = array();
// Need to get member names!
foreach ($context['rule']['criteria'] as $k => $criteria) {
if ($criteria['t'] == 'mid' && !empty($criteria['v'])) {
$members[(int) $criteria['v']] = $k;
}
}
if (!empty($members)) {
require_once SUBSDIR . '/Members.subs.php';
$result = getBasicMemberData(array_keys($members));
foreach ($result as $row) {
$context['rule']['criteria'][$members[$row['id_member']]]['v'] = $row['member_name'];
}
}
} else {
$context['rule'] = array('id' => '', 'name' => '', 'criteria' => array(), 'actions' => array(), 'logic' => 'and');
}
// Add a dummy criteria to allow expansion for none js users.
$context['rule']['criteria'][] = array('t' => '', 'v' => '');
} elseif (isset($_GET['save'])) {
checkSession('post');
$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']]) ? (int) $_GET['rid'] : 0;
// Name is easy!
$ruleName = Util::htmlspecialchars(trim($_POST['rule_name']));
if (empty($ruleName)) {
|
请发表评论