本文整理汇总了PHP中removeMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP removeMessage函数的具体用法?PHP removeMessage怎么用?PHP removeMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeMessages
/**
* Remove a batch of messages (or topics)
*
* @param int[] $messages
* @param mixed[] $messageDetails
* @param string $type = replies
*/
function removeMessages($messages, $messageDetails, $type = 'replies')
{
global $modSettings;
// @todo something's not right, removeMessage() does check permissions,
// removeTopics() doesn't
if ($type == 'topics') {
removeTopics($messages);
// and tell the world about it
foreach ($messages as $topic) {
// Note, only log topic ID in native form if it's not gone forever.
logAction('remove', array(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$topic]['board'] ? 'topic' : 'old_topic_id' => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board']));
}
} else {
require_once SUBSDIR . '/Messages.subs.php';
foreach ($messages as $post) {
removeMessage($post);
logAction('delete', array(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$post]['board'] ? 'topic' : 'old_topic_id' => $messageDetails[$post]['topic'], 'subject' => $messageDetails[$post]['subject'], 'member' => $messageDetails[$post]['member'], 'board' => $messageDetails[$post]['board']));
}
}
}
示例2: deleteAccount2
function deleteAccount2($profile_vars, $post_errors, $memID)
{
global $user_info, $sourcedir, $context, $cur_profile, $modSettings, $smcFunc;
// Try get more time...
@set_time_limit(600);
// !!! Add a way to delete pms as well?
if (!$context['user']['is_owner']) {
isAllowedTo('profile_remove_any');
} elseif (!allowedTo('profile_remove_any')) {
isAllowedTo('profile_remove_own');
}
checkSession();
$old_profile =& $cur_profile;
// Too often, people remove/delete their own only account.
if (in_array(1, explode(',', $old_profile['additional_groups'])) || $old_profile['id_group'] == 1) {
// Are you allowed to administrate the forum, as they are?
isAllowedTo('admin_forum');
$request = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE (id_group = {int:admin_group} OR FIND_IN_SET({int:admin_group}, additional_groups) != 0)
AND id_member != {int:selected_member}
LIMIT 1', array('admin_group' => 1, 'selected_member' => $memID));
list($another) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if (empty($another)) {
fatal_lang_error('at_least_one_admin', 'critical');
}
}
// This file is needed for the deleteMembers function.
require_once $sourcedir . '/Subs-Members.php';
// Do you have permission to delete others profiles, or is that your profile you wanna delete?
if ($memID != $user_info['id']) {
isAllowedTo('profile_remove_any');
// Now, have you been naughty and need your posts deleting?
// !!! Should this check board permissions?
if ($_POST['remove_type'] != 'none' && allowedTo('moderate_forum')) {
// Include RemoveTopics - essential for this type of work!
require_once $sourcedir . '/RemoveTopic.php';
// First off we delete any topics the member has started - if they wanted topics being done.
if ($_POST['remove_type'] == 'topics') {
// Fetch all topics started by this user within the time period.
$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics AS t
WHERE t.id_member_started = {int:selected_member}', array('selected_member' => $memID));
$topicIDs = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$topicIDs[] = $row['id_topic'];
}
$smcFunc['db_free_result']($request);
// Actually remove the topics.
// !!! This needs to check permissions, but we'll let it slide for now because of moderate_forum already being had.
removeTopics($topicIDs);
}
// Now delete the remaining messages.
$request = $smcFunc['db_query']('', '
SELECT m.id_msg
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic
AND t.id_first_msg != m.id_msg)
WHERE m.id_member = {int:selected_member}', array('selected_member' => $memID));
// This could take a while... but ya know it's gonna be worth it in the end.
while ($row = $smcFunc['db_fetch_assoc']($request)) {
if (function_exists('apache_reset_timeout')) {
@apache_reset_timeout();
}
removeMessage($row['id_msg']);
}
$smcFunc['db_free_result']($request);
}
// Only delete this poor members account if they are actually being booted out of camp.
if (isset($_POST['deleteAccount'])) {
deleteMembers($memID);
}
} elseif (empty($post_errors) && !empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) {
// Setup their account for deletion ;)
updateMemberData($memID, array('is_activated' => 4));
// Another account needs approval...
updateSettings(array('unapprovedMembers' => true), true);
} elseif (empty($post_errors)) {
deleteMembers($memID);
require_once $sourcedir . '/LogInOut.php';
LogOut(true);
redirectExit();
}
}
示例3: deleteAccount2
function deleteAccount2($profile_vars, $post_errors, $memID)
{
global $ID_MEMBER, $user_info, $sourcedir, $context, $db_prefix, $user_profile, $modSettings;
// !!! Add a way to delete pms as well?
if (!$context['user']['is_owner']) {
isAllowedTo('profile_remove_any');
} elseif (!allowedTo('profile_remove_any')) {
isAllowedTo('profile_remove_own');
}
checkSession();
$old_profile =& $user_profile[$memID];
// Too often, people remove/delete their own only account.
if (in_array(1, explode(',', $old_profile['additionalGroups'])) || $old_profile['ID_GROUP'] == 1) {
// Are you allowed to administrate the forum, as they are?
isAllowedTo('admin_forum');
$request = db_query("\n\t\t\tSELECT ID_MEMBER\n\t\t\tFROM {$db_prefix}members\n\t\t\tWHERE (ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups))\n\t\t\t\tAND ID_MEMBER != {$memID}\n\t\t\tLIMIT 1", __FILE__, __LINE__);
list($another) = mysql_fetch_row($request);
mysql_free_result($request);
if (empty($another)) {
fatal_lang_error('at_least_one_admin');
}
}
// This file is needed for the deleteMembers function.
require_once $sourcedir . '/Subs-Members.php';
// Do you have permission to delete others profiles, or is that your profile you wanna delete?
if ($memID != $ID_MEMBER) {
isAllowedTo('profile_remove_any');
// Now, have you been naughty and need your posts deleting?
// !!! Should this check board permissions?
if ($_POST['remove_type'] != 'none' && allowedTo('moderate_forum')) {
// Include RemoveTopics - essential for this type of work!
require_once $sourcedir . '/RemoveTopic.php';
// First off we delete any topics the member has started - if they wanted topics being done.
if ($_POST['remove_type'] == 'topics') {
// Fetch all topics started by this user within the time period.
$request = db_query("\n\t\t\t\t\tSELECT t.ID_TOPIC\n\t\t\t\t\tFROM {$db_prefix}topics AS t\n\t\t\t\t\tWHERE t.ID_MEMBER_STARTED = {$memID}", __FILE__, __LINE__);
$topicIDs = array();
while ($row = mysql_fetch_assoc($request)) {
$topicIDs[] = $row['ID_TOPIC'];
}
mysql_free_result($request);
// Actually remove the topics.
// !!! This needs to check permissions, but we'll let it slide for now because of moderate_forum already being had.
removeTopics($topicIDs);
}
// Now delete the remaining messages.
$request = db_query("\n\t\t\t\tSELECT m.ID_MSG\n\t\t\t\tFROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t)\n\t\t\t\tWHERE m.ID_MEMBER = {$memID}\n\t\t\t\t\tAND m.ID_TOPIC = t.ID_TOPIC\n\t\t\t\t\tAND t.ID_FIRST_MSG != m.ID_MSG", __FILE__, __LINE__);
// This could take a while... but ya know it's gonna be worth it in the end.
while ($row = mysql_fetch_assoc($request)) {
removeMessage($row['ID_MSG']);
}
mysql_free_result($request);
}
// Only delete this poor members account if they are actually being booted out of camp.
if (isset($_POST['deleteAccount'])) {
deleteMembers($memID);
}
} elseif (empty($post_errors) && !empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) {
// Setup their account for deletion ;)
updateMemberData($memID, array('is_activated' => 4));
// Another account needs approval...
updateSettings(array('unapprovedMembers' => true), true);
} elseif (empty($post_errors)) {
deleteMembers($memID);
}
}
示例4: mob_m_ban_user
function mob_m_ban_user($rpcmsg)
{
global $mobdb, $context, $func, $user_info, $modSettings, $user_info, $sourcedir;
checkSession('session');
// Cannot ban an user?
if (!allowedTo('manage_bans')) {
mob_error('cannot ban users');
}
$reason = strtr($func['htmlspecialchars']($rpcmsg->getParam(2) ? $rpcmsg->getScalarValParam(2) : ''), array("\r" => '', "\n" => '', "\t" => ''));
$username = $rpcmsg->getScalarValParam(0);
require_once $sourcedir . '/Subs-Auth.php';
// If we have an user ID, use it otherwise search for the user
if (!is_null($id_user)) {
$request = $mobdb->query('
SELECT ID_MEMBER
FROM {db_prefix}members
WHERE ID_MEMBER = {int:member}', array('member' => $id_user));
if ($mobdb->num_rows($request) == 0) {
$id_user = null;
} else {
list($id_user) = $mobdb->fetch_row($request);
}
$mobdb->free_result($request);
}
// Otherwise search from the DB,
if (is_null($id_user)) {
$username = utf8ToAscii($username);
$members = findMembers($username);
if (empty($members)) {
mob_error('user not found');
}
$member_ids = array_keys($members);
$id_user = $members[$member_ids[0]]['id'];
}
$member = $id_user;
// Create the ban
$mobdb->query('
INSERT INTO {db_prefix}ban_groups
(name, ban_time, cannot_access, expire_time, reason)
VALUES
({string:name}, {int:time}, 1, NULL, {string:reason})', array('time' => time(), 'name' => 'Tapatalk ban (' . $username . ')', 'reason' => $reason));
$id_ban_group = $mobdb->insert_id();
// Insert the user into the ban
$mobdb->query('
INSERT INTO {db_prefix}ban_items
(ID_BAN_GROUP, ID_MEMBER)
VALUES
({int:group}, {int:member})', array('group' => $id_ban_group, 'member' => $member));
// Do we have to delete every post made by this user?
// !!! Optimize this
if ($rpcmsg->getScalarValParam(1) == 2) {
require_once $sourcedir . '/RemoveTopic.php';
@ignore_user_abort();
@set_time_limit(0);
$request = $mobdb->query('
SELECT m.ID_MSG AS id_msg
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}topics AS t ON (t.ID_TOPIC = m.ID_TOPIC)
WHERE m.ID_MEMBER = {int:member}
AND (t.ID_FIRST_MSG != m.ID_MSG OR t.numReplies = 0)', array('member' => $member));
while ($row = $mobdb->fetch_assoc($request)) {
removeMessage($row['id_msg']);
}
$mobdb->free_result($request);
}
// Return a true response
return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean')), 'struct'));
}
示例5: ViewWatchedUsers
function ViewWatchedUsers()
{
global $smcFunc, $modSettings, $context, $txt, $scripturl, $user_info, $sourcedir;
// Some important context!
$context['page_title'] = $txt['mc_watched_users_title'];
$context['view_posts'] = isset($_GET['sa']) && $_GET['sa'] == 'post';
$context['start'] = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
loadTemplate('ModerationCenter');
// Get some key settings!
$modSettings['warning_watch'] = empty($modSettings['warning_watch']) ? 1 : $modSettings['warning_watch'];
// Put some pretty tabs on cause we're gonna be doing hot stuff here...
$context[$context['moderation_menu_name']]['tab_data'] = array('title' => $txt['mc_watched_users_title'], 'help' => '', 'description' => $txt['mc_watched_users_desc']);
// First off - are we deleting?
if (!empty($_REQUEST['delete'])) {
checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post');
$toDelete = array();
if (!is_array($_REQUEST['delete'])) {
$toDelete[] = (int) $_REQUEST['delete'];
} else {
foreach ($_REQUEST['delete'] as $did) {
$toDelete[] = (int) $did;
}
}
if (!empty($toDelete)) {
require_once $sourcedir . '/RemoveTopic.php';
// If they don't have permission we'll let it error - either way no chance of a security slip here!
foreach ($toDelete as $did) {
removeMessage($did);
}
}
}
// Start preparing the list by grabbing relevant permissions.
if (!$context['view_posts']) {
$approve_query = '';
$delete_boards = array();
} else {
// Still obey permissions!
$approve_boards = boardsAllowedTo('approve_posts');
$delete_boards = boardsAllowedTo('delete_any');
if ($approve_boards == array(0)) {
$approve_query = '';
} elseif (!empty($approve_boards)) {
$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
} else {
$approve_query = ' AND 0';
}
}
require_once $sourcedir . '/Subs-List.php';
// This is all the information required for a watched user listing.
$listOptions = array('id' => 'watch_user_list', 'title' => $txt['mc_watched_users_title'] . ' - ' . ($context['view_posts'] ? $txt['mc_watched_users_post'] : $txt['mc_watched_users_member']), 'width' => '100%', 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $context['view_posts'] ? $txt['mc_watched_users_no_posts'] : $txt['mc_watched_users_none'], 'base_href' => $scripturl . '?action=moderate;area=userwatch;sa=' . ($context['view_posts'] ? 'post' : 'member'), 'default_sort_col' => $context['view_posts'] ? '' : 'member', 'get_items' => array('function' => $context['view_posts'] ? 'list_getWatchedUserPosts' : 'list_getWatchedUsers', 'params' => array($approve_query, $delete_boards)), 'get_count' => array('function' => $context['view_posts'] ? 'list_getWatchedUserPostsCount' : 'list_getWatchedUserCount', 'params' => array($approve_query)), 'columns' => array('member' => array('header' => array('value' => $txt['mc_watched_users_member']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=profile;u=%1$d">%2$s</a>', 'params' => array('id' => false, 'name' => false))), 'sort' => array('default' => 'real_name', 'reverse' => 'real_name DESC')), 'warning' => array('header' => array('value' => $txt['mc_watched_users_warning']), 'data' => array('function' => create_function('$member', '
global $scripturl;
return allowedTo(\'issue_warning\') ? \'<a href="\' . $scripturl . \'?action=profile;area=issuewarning;u=\' . $member[\'id\'] . \'">\' . $member[\'warning\'] . \'%</a>\' : $member[\'warning\'] . \'%\';
')), 'sort' => array('default' => 'warning', 'reverse' => 'warning DESC')), 'posts' => array('header' => array('value' => $txt['posts']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=profile;u=%1$d;area=showposts;sa=messages">%2$s</a>', 'params' => array('id' => false, 'posts' => false))), 'sort' => array('default' => 'posts', 'reverse' => 'posts DESC')), 'last_login' => array('header' => array('value' => $txt['mc_watched_users_last_login']), 'data' => array('db' => 'last_login'), 'sort' => array('default' => 'last_login', 'reverse' => 'last_login DESC')), 'last_post' => array('header' => array('value' => $txt['mc_watched_users_last_post']), 'data' => array('function' => create_function('$member', '
global $scripturl;
if ($member[\'last_post_id\'])
return \'<a href="\' . $scripturl . \'?msg=\' . $member[\'last_post_id\'] . \'">\' . $member[\'last_post\'] . \'</a>\';
else
return $member[\'last_post\'];
')))), 'form' => array('href' => $scripturl . '?action=moderate;area=userwatch;sa=post', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array($context['view_posts'] ? array('position' => 'bottom_of_list', 'value' => '
<input type="submit" name="delete_selected" value="' . $txt['quickmod_delete_selected'] . '" class="button_submit" />', 'align' => 'right') : array()));
// If this is being viewed by posts we actually change the columns to call a template each time.
if ($context['view_posts']) {
$listOptions['columns'] = array('posts' => array('data' => array('function' => create_function('$post', '
return template_user_watch_post_callback($post);
'))));
}
// Create the watched user list.
createList($listOptions);
$context['sub_template'] = 'show_list';
$context['default_list'] = 'watch_user_list';
}
示例6: showPosts
function showPosts($memID)
{
global $txt, $user_info, $scripturl, $modSettings;
global $context, $user_profile, $sourcedir, $board, $memberContext, $options;
EoS_Smarty::loadTemplate('profile/profile_base');
$context['need_synhlt'] = true;
// Some initial context.
$context['start'] = (int) $_REQUEST['start'];
$context['current_member'] = $memID;
// Create the tabs for the template.
$context[$context['profile_menu_name']]['tab_data'] = array('title' => $txt['showPosts'], 'description' => $txt['showPosts_help'], 'tabs' => array('messages' => array(), 'topics' => array(), 'attach' => array()));
// Set the page title
$context['page_title'] = $txt['showPosts'] . ' - ' . $user_profile[$memID]['real_name'];
$context['pageindex_multiplier'] = commonAPI::getMessagesPerPage();
$context['can_approve_posts'] = false;
// Is the load average too high to allow searching just now?
if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts']) {
fatal_lang_error('loadavg_show_posts_disabled', false);
}
if (isset($_GET['sa']) && !empty($modSettings['karmaMode']) && ($_GET['sa'] == 'likes' || $_GET['sa'] == 'likesout')) {
require_once $sourcedir . '/Ratings.php';
return LikesByUser($memID);
}
EoS_Smarty::getConfigInstance()->registerHookTemplate('profile_content_area', 'profile/show_content');
$boards_hidden_1 = boardsAllowedTo('see_hidden1');
$boards_hidden_2 = boardsAllowedTo('see_hidden2');
$boards_hidden_3 = boardsAllowedTo('see_hidden3');
// If we're specifically dealing with attachments use that function!
if (isset($_GET['sa']) && $_GET['sa'] == 'attach') {
return showAttachments($memID);
}
// Are we just viewing topics?
$context['is_topics'] = isset($_GET['sa']) && $_GET['sa'] == 'topics' ? true : false;
// If just deleting a message, do it and then redirect back.
if (isset($_GET['delete']) && !$context['is_topics']) {
checkSession('get');
// We need msg info for logging.
$request = smf_db_query('
SELECT subject, id_member, id_topic, id_board
FROM {db_prefix}messages
WHERE id_msg = {int:id_msg}', array('id_msg' => (int) $_GET['delete']));
$info = mysql_fetch_row($request);
mysql_free_result($request);
// Trying to remove a message that doesn't exist.
if (empty($info)) {
redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
}
// We can be lazy, since removeMessage() will check the permissions for us.
require_once $sourcedir . '/RemoveTopic.php';
removeMessage((int) $_GET['delete']);
// Add it to the mod log.
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3]));
}
// Back to... where we are now ;).
redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
}
// Default to 10.
if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) {
$_REQUEST['viewscount'] = '10';
}
if ($context['is_topics']) {
$request = smf_db_query('
SELECT COUNT(*)
FROM {db_prefix}topics AS t' . ($user_info['query_see_board'] == '1=1' ? '' : '
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board AND {query_see_board})') . '
WHERE t.id_member_started = {int:current_member}' . (!empty($board) ? '
AND t.id_board = {int:board}' : '') . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
AND t.approved = {int:is_approved}'), array('current_member' => $memID, 'is_approved' => 1, 'board' => $board));
} else {
$request = smf_db_query('
SELECT COUNT(*)
FROM {db_prefix}messages AS m' . ($user_info['query_see_board'] == '1=1' ? '' : '
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})') . '
WHERE m.id_member = {int:current_member}' . (!empty($board) ? '
AND m.id_board = {int:board}' : '') . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
AND m.approved = {int:is_approved}'), array('current_member' => $memID, 'is_approved' => 1, 'board' => $board));
}
list($msgCount) = mysql_fetch_row($request);
mysql_free_result($request);
$request = smf_db_query('
SELECT MIN(id_msg), MAX(id_msg)
FROM {db_prefix}messages AS m
WHERE m.id_member = {int:current_member}' . (!empty($board) ? '
AND m.id_board = {int:board}' : '') . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
AND m.approved = {int:is_approved}'), array('current_member' => $memID, 'is_approved' => 1, 'board' => $board));
list($min_msg_member, $max_msg_member) = mysql_fetch_row($request);
mysql_free_result($request);
$reverse = false;
$range_limit = '';
$maxIndex = (int) $modSettings['defaultMaxMessages'];
// Make sure the starting place makes sense and construct our friend the page index.
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $memID . ';area=showposts' . ($context['is_topics'] ? ';sa=topics' : '') . (!empty($board) ? ';board=' . $board : ''), $context['start'], $msgCount, $maxIndex);
$context['current_page'] = $context['start'] / $maxIndex;
// Reverse the query if we're past 50% of the pages for better performance.
$start = $context['start'];
$reverse = $_REQUEST['start'] > $msgCount / 2;
if ($reverse && !$context['is_topics']) {
$maxIndex = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 && $msgCount > $context['start'] ? $msgCount - $context['start'] : (int) $modSettings['defaultMaxMessages'];
$start = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 || $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] ? 0 : $msgCount - $context['start'] - $modSettings['defaultMaxMessages'];
//.........这里部分代码省略.........
示例7: removeMessages
function removeMessages($messages, $messageDetails, $current_view = 'replies')
{
global $sourcedir, $modSettings;
require_once $sourcedir . '/RemoveTopic.php';
if ($current_view == 'topics') {
removeTopics($messages);
// and tell the world about it
foreach ($messages as $topic) {
// Note, only log topic ID in native form if it's not gone forever.
logAction('remove', array(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$topic]['board'] ? 'topic' : 'old_topic_id' => $topic, 'subject' => $messageDetails[$topic]['subject'], 'member' => $messageDetails[$topic]['member'], 'board' => $messageDetails[$topic]['board']));
}
} else {
foreach ($messages as $post) {
removeMessage($post);
logAction('delete', array(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $messageDetails[$post]['board'] ? 'topic' : 'old_topic_id' => $messageDetails[$post]['topic'], 'subject' => $messageDetails[$post]['subject'], 'member' => $messageDetails[$post]['member'], 'board' => $messageDetails[$post]['board']));
}
}
}
示例8: action_quickmod2
/**
* In-topic quick moderation.
* Accessed by ?action=quickmod2
*/
public function action_quickmod2()
{
global $topic, $board, $user_info, $context;
// Check the session = get or post.
checkSession('request');
require_once SUBSDIR . '/Messages.subs.php';
if (empty($_REQUEST['msgs'])) {
redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
$messages = array();
foreach ($_REQUEST['msgs'] as $dummy) {
$messages[] = (int) $dummy;
}
// We are restoring messages. We handle this in another place.
if (isset($_REQUEST['restore_selected'])) {
redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
}
if (isset($_REQUEST['split_selection'])) {
$mgsOptions = basicMessageInfo(min($messages), true);
$_SESSION['split_selection'][$topic] = $messages;
redirectexit('action=splittopics;sa=selectTopics;topic=' . $topic . '.0;subname_enc=' . urlencode($mgsOptions['subject']) . ';' . $context['session_var'] . '=' . $context['session_id']);
}
require_once SUBSDIR . '/Topic.subs.php';
$topic_info = getTopicInfo($topic);
// Allowed to delete any message?
if (allowedTo('delete_any')) {
$allowed_all = true;
} elseif (allowedTo('delete_replies')) {
$allowed_all = $topic_info['id_member_started'] == $user_info['id'];
} else {
$allowed_all = false;
}
// Make sure they're allowed to delete their own messages, if not any.
if (!$allowed_all) {
isAllowedTo('delete_own');
}
// Allowed to remove which messages?
$messages = determineRemovableMessages($topic, $messages, $allowed_all);
// Get the first message in the topic - because you can't delete that!
$first_message = $topic_info['id_first_msg'];
$last_message = $topic_info['id_last_msg'];
// Delete all the messages we know they can delete. ($messages)
foreach ($messages as $message => $info) {
// Just skip the first message - if it's not the last.
if ($message == $first_message && $message != $last_message) {
continue;
} elseif ($message == $first_message) {
$topicGone = true;
}
removeMessage($message);
// Log this moderation action ;).
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board));
}
}
redirectexit(!empty($topicGone) ? 'board=' . $board : 'topic=' . $topic . '.' . $_REQUEST['start']);
}
示例9: DeleteMessage
function DeleteMessage()
{
global $ID_MEMBER, $db_prefix, $topic, $board, $modSettings;
checkSession('get');
$_REQUEST['msg'] = (int) $_REQUEST['msg'];
// Is $topic set?
if (empty($topic) && isset($_REQUEST['topic'])) {
$topic = (int) $_REQUEST['topic'];
}
$request = db_query("\n\t\tSELECT t.ID_MEMBER_STARTED, m.ID_MEMBER, m.subject, m.posterTime\n\t\tFROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)\n\t\tWHERE t.ID_TOPIC = {$topic}\n\t\t\tAND m.ID_TOPIC = {$topic}\n\t\t\tAND m.ID_MSG = {$_REQUEST['msg']}\n\t\tLIMIT 1", __FILE__, __LINE__);
list($starter, $poster, $subject, $post_time) = mysql_fetch_row($request);
mysql_free_result($request);
if ($poster == $ID_MEMBER) {
if (!allowedTo('delete_own')) {
if ($starter == $ID_MEMBER && !allowedTo('delete_any')) {
isAllowedTo('delete_replies');
} elseif (!allowedTo('delete_any')) {
isAllowedTo('delete_own');
}
} elseif (!allowedTo('delete_any') && ($starter != $ID_MEMBER || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $post_time + $modSettings['edit_disable_time'] * 60 < time()) {
fatal_lang_error('modify_post_time_passed', false);
}
} elseif ($starter == $ID_MEMBER && !allowedTo('delete_any')) {
isAllowedTo('delete_replies');
} else {
isAllowedTo('delete_any');
}
// If the full topic was removed go back to the board.
$full_topic = removeMessage($_REQUEST['msg']);
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $poster != $ID_MEMBER)) {
logAction('delete', array('topic' => $topic, 'subject' => $subject, 'member' => $starter));
}
// We want to redirect back to recent action.
if (isset($_REQUEST['recent'])) {
redirectexit('action=recent');
} elseif ($full_topic) {
redirectexit('board=' . $board . '.0');
} else {
redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
}
示例10: removeNonTopicMessages
/**
* This function removes all the messages of a certain user that are *not*
* first messages of a topic
*
* @param int $memID The member id
*/
function removeNonTopicMessages($memID)
{
$db = database();
$request = $db->query('', '
SELECT m.id_msg
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic
AND t.id_first_msg != m.id_msg)
WHERE m.id_member = {int:selected_member}', array('selected_member' => $memID));
// This could take a while... but ya know it's gonna be worth it in the end.
while ($row = $db->fetch_assoc($request)) {
if (function_exists('apache_reset_timeout')) {
@apache_reset_timeout();
}
removeMessage($row['id_msg']);
}
$db->free_result($request);
}
示例11: QuickModeration2
function QuickModeration2()
{
global $sourcedir, $db_prefix, $topic, $board, $ID_MEMBER, $modSettings;
// Check the session = get or post.
checkSession('request');
require_once $sourcedir . '/RemoveTopic.php';
if (empty($_REQUEST['msgs'])) {
redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
$messages = array();
foreach ($_REQUEST['msgs'] as $dummy) {
$messages[] = (int) $dummy;
}
// Allowed to delete any message?
if (allowedTo('delete_any')) {
$allowed_all = true;
} elseif (allowedTo('delete_replies')) {
$request = db_query("\n\t\t\tSELECT ID_MEMBER_STARTED\n\t\t\tFROM {$db_prefix}topics\n\t\t\tWHERE ID_TOPIC = {$topic}\n\t\t\tLIMIT 1", __FILE__, __LINE__);
list($starter) = mysql_fetch_row($request);
mysql_free_result($request);
$allowed_all = $starter == $ID_MEMBER;
} else {
$allowed_all = false;
}
// Make sure they're allowed to delete their own messages, if not any.
if (!$allowed_all) {
isAllowedTo('delete_own');
}
// Allowed to remove which messages?
$request = db_query("\n\t\tSELECT ID_MSG, subject, ID_MEMBER, posterTime\n\t\tFROM {$db_prefix}messages\n\t\tWHERE ID_MSG IN (" . implode(', ', $messages) . ")\n\t\t\tAND ID_TOPIC = {$topic}" . (!$allowed_all ? "\n\t\t\tAND ID_MEMBER = {$ID_MEMBER}" : '') . "\n\t\tLIMIT " . count($messages), __FILE__, __LINE__);
$messages = array();
while ($row = mysql_fetch_assoc($request)) {
if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['posterTime'] + $modSettings['edit_disable_time'] * 60 < time()) {
continue;
}
$messages[$row['ID_MSG']] = array($row['subject'], $row['ID_MEMBER']);
}
mysql_free_result($request);
// Get the first message in the topic - because you can't delete that!
$request = db_query("\n\t\tSELECT ID_FIRST_MSG, ID_LAST_MSG\n\t\tFROM {$db_prefix}topics\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tLIMIT 1", __FILE__, __LINE__);
list($first_message, $last_message) = mysql_fetch_row($request);
mysql_free_result($request);
// Delete all the messages we know they can delete. ($messages)
foreach ($messages as $message => $info) {
// Just skip the first message.
if ($message == $first_message && $message != $last_message) {
continue;
}
removeMessage($message);
// Log this moderation action ;).
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $ID_MEMBER)) {
logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1]));
}
}
redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
示例12: getCategories
}
function getCategories($Database)
{
$result = $Database->query('SELECT DISTINCT action FROM message');
if (!$result) {
echo 'Could not get categories: ';
print_r($Database->errorInfo());
die;
}
return $result;
}
//And now ladies and gentlemen, procedural hell...
//open the database
$db = openDatabase($databaseFilename);
//delete a message if one has been toggled for removal
removeMessage($db, $remove);
//this array is filled with the id's of every message display in this instance of this page.
//at the end, the showCount columns for these messages are updated to reflect they have been shown.
//(this is handy for marking new items are being viewed, and for seeing which messages are looked
// at the most, "favourites" if you will.)
$shownIds = array();
//display the filter option column titles
echo '<form action="monkeyview.php" method="get">';
echo $filterTableHeader;
//"added" filter box
echo '<tr>';
echo '<td><select name="added">';
foreach ($addedOptions as $option) {
$selected = $option == $added ? ' selected' : '';
echo '<option' . $selected . '>' . $option . '</option>';
}
示例13: action_showPosts
/**
* Show all posts by the current user.
*
* @todo This function needs to be split up properly.
*/
public function action_showPosts()
{
global $txt, $user_info, $scripturl, $modSettings, $context, $user_profile, $board;
$memID = currentMemberID();
// Some initial context.
$context['start'] = (int) $_REQUEST['start'];
$context['current_member'] = $memID;
loadTemplate('ProfileInfo');
// Create the tabs for the template.
$context[$context['profile_menu_name']]['tab_data'] = array('title' => $txt['showPosts'], 'description' => $txt['showPosts_help'], 'class' => 'profile', 'tabs' => array('messages' => array(), 'topics' => array(), 'unwatchedtopics' => array(), 'attach' => array()));
// Set the page title
$context['page_title'] = $txt['showPosts'] . ' - ' . $user_profile[$memID]['real_name'];
// Is the load average too high to allow searching just now?
if (!empty($modSettings['loadavg_show_posts']) && $modSettings['current_load'] >= $modSettings['loadavg_show_posts']) {
fatal_lang_error('loadavg_show_posts_disabled', false);
}
// If we're specifically dealing with attachments use that function!
if (isset($_GET['sa']) && $_GET['sa'] == 'attach') {
return $this->action_showAttachments();
} elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics' && $modSettings['enable_unwatch']) {
return $this->action_showUnwatched();
}
// Are we just viewing topics?
$context['is_topics'] = isset($_GET['sa']) && $_GET['sa'] == 'topics' ? true : false;
// If just deleting a message, do it and then redirect back.
if (isset($_GET['delete']) && !$context['is_topics']) {
checkSession('get');
// We need msg info for logging.
require_once SUBSDIR . '/Messages.subs.php';
$info = basicMessageInfo((int) $_GET['delete'], true);
// Trying to remove a message that doesn't exist.
if (empty($info)) {
redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
}
// We can be lazy, since removeMessage() will check the permissions for us.
removeMessage((int) $_GET['delete']);
// Add it to the mod log.
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info['id_member'] != $user_info['id'])) {
logAction('delete', array('topic' => $info['id_topic'], 'subject' => $info['subject'], 'member' => $info['id_member'], 'board' => $info['id_board']));
}
// Back to... where we are now ;).
redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
}
// Default to 10.
if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) {
$_REQUEST['viewscount'] = '10';
}
if ($context['is_topics']) {
$msgCount = count_user_topics($memID, $board);
} else {
$msgCount = count_user_posts($memID, $board);
}
list($min_msg_member, $max_msg_member) = findMinMaxUserMessage($memID, $board);
$range_limit = '';
$maxIndex = (int) $modSettings['defaultMaxMessages'];
// Make sure the starting place makes sense and construct our friend the page index.
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $memID . ';area=showposts' . ($context['is_topics'] ? ';sa=topics' : ';sa=messages') . (!empty($board) ? ';board=' . $board : ''), $context['start'], $msgCount, $maxIndex);
$context['current_page'] = $context['start'] / $maxIndex;
// Reverse the query if we're past 50% of the pages for better performance.
$start = $context['start'];
$reverse = $_REQUEST['start'] > $msgCount / 2;
if ($reverse) {
$maxIndex = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 && $msgCount > $context['start'] ? $msgCount - $context['start'] : (int) $modSettings['defaultMaxMessages'];
$start = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 || $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] ? 0 : $msgCount - $context['start'] - $modSettings['defaultMaxMessages'];
}
// Guess the range of messages to be shown to help minimize what the query needs to do
if ($msgCount > 1000) {
$margin = floor(($max_msg_member - $min_msg_member) * (($start + $modSettings['defaultMaxMessages']) / $msgCount) + 0.1 * ($max_msg_member - $min_msg_member));
// Make a bigger margin for topics only.
if ($context['is_topics']) {
$margin *= 5;
$range_limit = $reverse ? 't.id_first_msg < ' . ($min_msg_member + $margin) : 't.id_first_msg > ' . ($max_msg_member - $margin);
} else {
$range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin);
}
}
// Find this user's posts or topics started
if ($context['is_topics']) {
$rows = load_user_topics($memID, $start, $maxIndex, $range_limit, $reverse, $board);
} else {
$rows = load_user_posts($memID, $start, $maxIndex, $range_limit, $reverse, $board);
}
// Start counting at the number of the first message displayed.
$counter = $reverse ? $context['start'] + $maxIndex + 1 : $context['start'];
$context['posts'] = array();
$board_ids = array('own' => array(), 'any' => array());
foreach ($rows as $row) {
// Censor....
censorText($row['body']);
censorText($row['subject']);
// Do the code.
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
// And the array...
$context['posts'][$counter += $reverse ? -1 : 1] = array('body' => $row['body'], 'counter' => $counter, 'alternate' => $counter % 2, 'category' => array('name' => $row['cname'], 'id' => $row['id_cat']), 'board' => array('name' => $row['bname'], 'id' => $row['id_board'], 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'), 'topic' => array('id' => $row['id_topic'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'), 'subject' => $row['subject'], 'start' => 'msg' . $row['id_msg'], 'time' => standardTime($row['poster_time']), 'html_time' => htmlTime($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'id' => $row['id_msg'], 'tests' => array('can_reply' => false, 'can_mark_notify' => false, 'can_delete' => false), 'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()), 'approved' => $row['approved'], 'buttons' => array('remove' => array('href' => $scripturl . '?action=deletemsg;msg=' . $row['id_msg'] . ';topic=' . $row['id_topic'] . ';profile;u=' . $context['member']['id'] . ';start=' . $context['start'], 'text' => $txt['remove'], 'test' => 'can_delete', 'custom' => 'onclick="return confirm(' . JavaScriptEscape($txt['remove_message'] . '?') . ');"'), 'notify' => array('href' => $scripturl . '?action=notify;topic=' . $row['id_topic'] . '.msg' . $row['id_msg'], 'text' => $txt['notify'], 'test' => 'can_mark_notify'), 'reply' => array('href' => $scripturl . '?action=post;topic=' . $row['id_topic'] . '.msg' . $row['id_msg'], 'text' => $txt['reply'], 'test' => 'can_reply'), 'quote' => array('href' => $scripturl . '?action=post;topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';quote=' . $row['id_msg'], 'text' => $txt['quote'], 'test' => 'can_quote')));
if ($user_info['id'] == $row['id_member_started']) {
//.........这里部分代码省略.........
示例14: DeleteMessage
/**
* Remove just a single post.
* On completion redirect to the topic or to the board.
*/
function DeleteMessage()
{
global $user_info, $topic, $board, $modSettings, $smcFunc;
checkSession('get');
$_REQUEST['msg'] = (int) $_REQUEST['msg'];
// Is $topic set?
if (empty($topic) && isset($_REQUEST['topic'])) {
$topic = (int) $_REQUEST['topic'];
}
removeDeleteConcurrence();
$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, m.id_member, m.subject, m.poster_time, m.approved
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = {int:id_msg} AND m.id_topic = {int:current_topic})
WHERE t.id_topic = {int:current_topic}
LIMIT 1', array('current_topic' => $topic, 'id_msg' => $_REQUEST['msg']));
list($starter, $poster, $subject, $post_time, $approved) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Verify they can see this!
if ($modSettings['postmod_active'] && !$approved && !empty($poster) && $poster != $user_info['id']) {
isAllowedTo('approve_posts');
}
if ($poster == $user_info['id']) {
if (!allowedTo('delete_own')) {
if ($starter == $user_info['id'] && !allowedTo('delete_any')) {
isAllowedTo('delete_replies');
} elseif (!allowedTo('delete_any')) {
isAllowedTo('delete_own');
}
} elseif (!allowedTo('delete_any') && ($starter != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $post_time + $modSettings['edit_disable_time'] * 60 < time()) {
fatal_lang_error('modify_post_time_passed', false);
}
} elseif ($starter == $user_info['id'] && !allowedTo('delete_any')) {
isAllowedTo('delete_replies');
} else {
isAllowedTo('delete_any');
}
// If the full topic was removed go back to the board.
$full_topic = removeMessage($_REQUEST['msg']);
if (allowedTo('delete_any') && (!allowedTo('delete_own') || $poster != $user_info['id'])) {
logAction('delete', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board));
}
// We want to redirect back to recent action.
if (isset($_REQUEST['recent'])) {
redirectexit('action=recent');
} elseif (isset($_REQUEST['profile'], $_REQUEST['start'], $_REQUEST['u'])) {
redirectexit('action=profile;u=' . $_REQUEST['u'] . ';area=showposts;start=' . $_REQUEST['start']);
} elseif ($full_topic) {
redirectexit('board=' . $board . '.0');
} else {
redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
}
示例15: session_start
<?php
session_start();
header("Content-Type:text/plain;charset=utf-8");
include_once 'fun.inc.php';
linkDB();
$uid = $_SESSION["uid"];
$data = returnMessage($uid);
removeMessage($uid);
echo json_encode($data, JSON_UNESCAPED_UNICODE);