当前位置: 首页>>代码示例>>PHP>>正文


PHP get_forum函数代码示例

本文整理汇总了PHP中get_forum函数的典型用法代码示例。如果您正苦于以下问题:PHP get_forum函数的具体用法?PHP get_forum怎么用?PHP get_forum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_forum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload_attach_func

function upload_attach_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("member");
    $parser = new postParser();
    $input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT, 'group_id' => Tapatalk_Input::STRING, 'content' => Tapatalk_Input::STRING), $xmlrpc_params);
    $fid = $input['forum_id'];
    //return xmlrespfalse(print_r($_FILES, true));
    // Fetch forum information.
    $forum = get_forum($fid);
    if (!$forum) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    $forumpermissions = forum_permissions($fid);
    if ($forum['open'] == 0 || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    // Check if this forum is password protected and we have a valid password
    tt_check_forum_password($forum['fid']);
    $posthash = $input['group_id'];
    if (empty($posthash)) {
        $posthash = md5($mybb->user['uid'] . random_str());
    }
    $mybb->input['posthash'] = $posthash;
    if (!empty($mybb->input['pid'])) {
        $attachwhere = "pid='{$mybb->input['pid']}'";
    } else {
        $attachwhere = "posthash='{$posthash}'";
    }
    $query = $db->simple_select("attachments", "COUNT(aid) as numattachs", $attachwhere);
    $attachcount = $db->fetch_field($query, "numattachs");
    //if(is_array($_FILES['attachment']['name'])){
    foreach ($_FILES['attachment'] as $k => $v) {
        if (is_array($_FILES['attachment'][$k])) {
            $_FILES['attachment'][$k] = $_FILES['attachment'][$k][0];
        }
    }
    //}
    if ($_FILES['attachment']['type'] == 'image/jpg') {
        $_FILES['attachment']['type'] = 'image/jpeg';
    }
    // If there's an attachment, check it and upload it
    if ($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments'])) {
        require_once MYBB_ROOT . "inc/functions_upload.php";
        $attachedfile = upload_attachment($_FILES['attachment'], false);
    }
    if (empty($attachedfile)) {
        return xmlrespfalse("No file uploaded");
    }
    //return xmlrespfalse(print_r($attachedfile, true));
    if ($attachedfile['error']) {
        return xmlrespfalse(implode(" :: ", $attachedfile['error']));
    }
    $result = new xmlrpcval(array('attachment_id' => new xmlrpcval($attachedfile['aid'], 'string'), 'group_id' => new xmlrpcval($posthash, 'string'), 'result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'file_size' => new xmlrpcval($attachedfile['filesize'], 'int')), 'struct');
    return new xmlrpcresp($result);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:59,代码来源:upload_attach.php

示例2: remove_attachment_func

function remove_attachment_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    chdir("../");
    $lang->load("member");
    $parser = new postParser();
    $input = Tapatalk_Input::filterXmlInput(array('attachment_id' => Tapatalk_Input::INT, 'forum_id' => Tapatalk_Input::INT, 'group_id' => Tapatalk_Input::STRING, 'post_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $fid = $input['forum_id'];
    $forum = get_forum($fid);
    if (!$forum) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    $forumpermissions = forum_permissions($fid);
    if ($forum['open'] == 0 || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    tt_check_forum_password($forum['fid']);
    $posthash = $input['group_id'];
    $mybb->input['posthash'] = $posthash;
    // If we're removing an attachment that belongs to an existing post, some security checks...
    $query = $db->simple_select("attachments", "pid", "aid='{$input['attachment_id']}'");
    $attachment = $db->fetch_array($query);
    $pid = $attachment['pid'];
    if ($pid > 0) {
        if ($pid != $input['post_id']) {
            return xmlrespfalse("The attachment you are trying to remove does not belong to this post");
        }
        $query = $db->simple_select("posts", "*", "pid='{$pid}'");
        $post = $db->fetch_array($query);
        if (!$post['pid']) {
            return xmlrespfalse($lang->error_invalidpost);
        }
        // Get thread info
        $tid = $post['tid'];
        $thread = get_thread($tid);
        if (!$thread['tid']) {
            return xmlrespfalse($lang->error_invalidthread);
        }
        if (!is_moderator($fid, "caneditposts")) {
            if ($thread['closed'] == 1) {
                return xmlrespfalse($lang->redirect_threadclosed);
            }
            if ($forumpermissions['caneditposts'] == 0) {
                return tt_no_permission();
            }
            if ($mybb->user['uid'] != $post['uid']) {
                return tt_no_permission();
            }
        }
    } else {
        $pid = 0;
    }
    require_once MYBB_ROOT . "inc/functions_upload.php";
    remove_attachment($pid, $mybb->input['posthash'], $input['attachment_id']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:59,代码来源:remove_attachment.php

示例3: unsubscribe_forum_func

function unsubscribe_forum_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("usercp");
    $input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $forum = get_forum($input['forum_id']);
    if (!$forum['fid']) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    remove_subscribed_forum($forum['fid']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:12,代码来源:unsubscribe_forum.php

示例4: subscribe_forum_func

function subscribe_forum_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("usercp");
    $input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $forum = get_forum($input['forum_id']);
    if (!$forum['fid']) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    $forumpermissions = forum_permissions($forum['fid']);
    if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
        return tt_no_permission();
    }
    add_subscribed_forum($forum['fid']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:16,代码来源:subscribe_forum.php

示例5: mark_all_as_read_func

function mark_all_as_read_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $forum_cache;
    $input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT), $xmlrpc_params);
    if (!empty($input['forum_id'])) {
        $validforum = get_forum($input['forum_id']);
        if (!$validforum) {
            return xmlrespfalse('Invalid forum');
        }
        require_once MYBB_ROOT . "/inc/functions_indicators.php";
        mark_forum_read($input['forum_id']);
    } else {
        require_once MYBB_ROOT . "/inc/functions_indicators.php";
        mark_all_forums_read();
    }
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:17,代码来源:mark_all_as_read.php

示例6: reportthread_dopost

function reportthread_dopost()
{
    require_once MYBB_ROOT . "inc/datahandlers/post.php";
    global $db, $mybb;
    if (intval($mybb->settings['rtt_enabled']) == 1 || preg_replace("/[^a-z]/i", "", $mybb->settings['rtt_enabled']) == "yes") {
        if ($mybb->input['type'] == 'post') {
            $title = "Reported Post By ";
            $post = get_post($mybb->input['pid']);
            $thread = get_thread($post['tid']);
            $forum = get_forum($thread['fid']);
            $tlink = get_thread_link($thread['tid']);
            $flink = get_forum_link($thread['fid']);
            $reason = $mybb->input['reason'];
            if ($reason === 'other') {
                $reason = $mybb->input['comment'];
            }
            $post_data = $mybb->user['username'] . " has reported a post.\r\n\r\nOriginal Thread: [url=" . $mybb->settings['bburl'] . "/{$tlink}]" . $thread['subject'] . "[/url]\r\nForum: [url=" . $mybb->settings['bburl'] . "/{$flink}]" . $forum['name'] . "[/url]\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nPost Content:\r\n[quote=\"" . $post['username'] . "\" pid=\"" . $post['pid'] . "\" dateline=\"" . $post['dateline'] . "\"]" . $post['message'] . "[/quote]";
        } else {
            if ($mybb->input['type'] == 'reputation') {
                $title = "Reported Reputation By ";
                $rep = get_reputation_point($mybb->input['pid']);
                $giver = get_user($rep['adduid']);
                $reason = $mybb->input['reason'];
                if ($reason === 'other') {
                    $reason = $mybb->input['comment'];
                }
                $post_data = $mybb->user['username'] . " has reported a reputation point.\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nReputation comment:\r\n[quote=\"" . $giver['username'] . "\" dateline=\"" . $rep['dateline'] . "\"]" . $rep['comments'] . "[/quote]";
            }
        }
        $new_thread = array("fid" => $mybb->settings['rtt_fid'], "prefix" => 0, "subject" => $title . $mybb->user['username'], "icon" => 0, "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "message" => $post_data, "ipaddress" => get_ip(), "posthash" => md5($mybb->user['uid'] . random_str()));
        $posthandler = new PostDataHandler("insert");
        $posthandler->action = "thread";
        $posthandler->set_data($new_thread);
        if ($posthandler->validate_thread()) {
            $thread_info = $posthandler->insert_thread();
        }
    }
}
开发者ID:ateista-pl,项目名称:forum,代码行数:38,代码来源:reportthread.php

示例7: breadcrumb

function breadcrumb($db, $id, $get_from = 'F')
{
    $separator = ' &middot; ';
    if ($get_from == 'P') {
        $sql = 'SELECT forum_id, subject FROM frm_posts WHERE id = ' . $id;
        $result = mysql_query($sql, $db) or die(mysql_error($db));
        $row = mysql_fetch_array($result);
        $id = $row['forum_id'];
        $topic = $row['subject'];
        mysql_free_result($result);
    }
    $row = get_forum($db, $id);
    $bcrumb = '<a href="frm_index.php">Home</a>' . $separator;
    switch ($get_from) {
        case 'P':
            $bcrumb .= '<a href="frm_view_forum.php?f=' . $id . '">' . $row['name'] . '</a>' . $separator . $topic;
            break;
        case 'F':
            $bcrumb .= $row['name'];
            break;
    }
    return '<h2>' . $bcrumb . '</h2>';
}
开发者ID:noikiy,项目名称:web,代码行数:23,代码来源:frm_output_functions.inc.php

示例8: error

}
// Make sure we are looking at a real thread here.
if (!$thread || $thread['visible'] != 1 && $ismod == false || $thread['visible'] > 1 && $ismod == true) {
    error($lang->error_invalidthread);
}
$forumpermissions = forum_permissions($thread['fid']);
// Does the user have permission to view this thread?
if ($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1) {
    error_no_permission();
}
if (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
    error_no_permission();
}
$archive_url = build_archive_link("thread", $tid);
// Does the thread belong to a valid forum?
$forum = get_forum($fid);
if (!$forum || $forum['type'] != "f") {
    error($lang->error_invalidforum);
}
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);
// If there is no specific action, we must be looking at the thread.
if (empty($mybb->input['action'])) {
    $mybb->input['action'] = "thread";
}
// Jump to the unread posts.
if ($mybb->input['action'] == "newpost") {
    // First, figure out what time the thread or forum were last read
    $query = $db->simple_select("threadsread", "dateline", "uid='{$mybb->user['uid']}' AND tid='{$thread['tid']}'");
    $thread_read = $db->fetch_field($query, "dateline");
    if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:showthread.php

示例9: if

	$msg->printErrors('FORUM_DENIED');
	require(AT_INCLUDE_PATH.'footer.inc.php');
	exit;
}

// set default thread display order to ascending
if (!isset($_SESSION['thread_order']))
{
	$_SESSION['thread_order'] = 'a';
}
else if (isset($_GET['order']))
{
	$_SESSION['thread_order'] = $_GET['order'];
}

$forum_info = get_forum($fid);

$_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['title']    = get_forum_name($fid);
$_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['parent']   = 'mods/_standard/forums/forum/list.php';
$_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['children'] = array(url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid), 'search.php?search_within[]=forums');

$_pages[url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid)]['title_var'] = 'new_thread';
$_pages[url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid)]['parent']    = url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid);

$_pages['mods/_standard/forums/forum/view.php']['parent'] = url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid);
$_pages['search.php?search_within[]=forums']['title_var'] = 'search';
$_pages['search.php?search_within[]=forums']['parent']    = url_rewrite('mods/_standard/forums/forum/index.php');

if ($_REQUEST['reply']) {
	$onload = 'document.form.subject.focus();';
}
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:31,代码来源:view.php

示例10: array

     $pcheck2 = array();
     while ($tcheck = $db->fetch_array($query)) {
         if ($tcheck['count'] > 0) {
             $pcheck2[] = $tcheck['tid'];
         }
     }
     if (count($pcheck2) != count($pcheck)) {
         // One or more threads do not have posts after splitting
         error($lang->error_cantsplitall);
     }
     if ($mybb->input['moveto']) {
         $moveto = intval($mybb->input['moveto']);
     } else {
         $moveto = $fid;
     }
     $newforum = get_forum($moveto);
     if (!$newforum || $newforum['type'] != "f" || $newforum['type'] == "f" && $newforum['linkto'] != '') {
         error($lang->error_invalidforum);
     }
     $newsubject = $mybb->input['newsubject'];
     $newtid = $moderation->split_posts($posts, $tid, $moveto, $newsubject);
     $pid_list = implode(', ', $posts);
     $lang->split_selective_posts = $lang->sprintf($lang->split_selective_posts, $pid_list, $newtid);
     log_moderator_action($modlogdata, $lang->split_selective_posts);
     moderation_redirect(get_thread_link($newtid), $lang->redirect_threadsplit);
     break;
     // Approve posts - Inline moderation
 // Approve posts - Inline moderation
 case "multiapproveposts":
     // Verify incoming POST request
     verify_post_check($mybb->input['my_post_key']);
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:moderation.php

示例11: mysql_query

	$result = mysql_query($sql, $db);
	write_to_log(AT_ADMIN_LOG_DELETE, 'forums', mysql_affected_rows($db), $sql);
	
	$sql = "OPTIMIZE TABLE ".TABLE_PREFIX."forums_threads";
	$result = mysql_query($sql, $db);

	$msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
	header('Location: forums.php');
	exit;
}

require(AT_INCLUDE_PATH.'header.inc.php'); 

	$_GET['forum'] = intval($_GET['forum']); 

	$row = get_forum($_GET['forum']);

	if (!is_array($row)) {
		$msg->addError('FORUM_NOT_FOUND');
		$msg->printErrors();
	} else {

		$hidden_vars['delete_forum'] = TRUE;
		$hidden_vars['forum'] = $_GET['forum'];
		$msg->addConfirm(array('DELETE_FORUM', AT_print($row['title'], 'forums.title')), $hidden_vars);
		$msg->printConfirm();
	}

require(AT_INCLUDE_PATH.'footer.inc.php'); 

?>
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:31,代码来源:forum_delete.php

示例12: save_raw_post_func

function save_raw_post_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("editpost");
    $input = Tapatalk_Input::filterXmlInput(array('post_id' => Tapatalk_Input::INT, 'post_title' => Tapatalk_Input::STRING, 'post_content' => Tapatalk_Input::STRING, 'return_html' => Tapatalk_Input::INT, 'attachment_id_array' => Tapatalk_Input::RAW, 'group_id' => Tapatalk_Input::STRING, 'editreason' => Tapatalk_Input::STRING), $xmlrpc_params);
    $parser = new postParser();
    // No permission for guests
    if (!$mybb->user['uid']) {
        return tt_no_permission();
    }
    // Get post info
    $pid = $input['post_id'];
    $query = $db->simple_select("posts", "*", "pid='{$pid}'");
    $post = $db->fetch_array($query);
    if (empty($input['post_title'])) {
        $input['post_title'] = $post['subject'];
    }
    if (!$post['pid']) {
        return xmlrespfalse($lang->error_invalidpost);
    }
    // Get thread info
    $tid = $post['tid'];
    $thread = get_thread($tid);
    if (!$thread['tid']) {
        return xmlrespfalse($lang->error_invalidthread);
    }
    $thread['subject'] = htmlspecialchars_uni($thread['subject']);
    // Get forum info
    $fid = $post['fid'];
    $forum = get_forum($fid);
    if (!$forum || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($forum['open'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    $forumpermissions = forum_permissions($fid);
    if (!is_moderator($fid, "caneditposts")) {
        if ($thread['closed'] == 1) {
            return xmlrespfalse($lang->redirect_threadclosed);
        }
        if ($forumpermissions['caneditposts'] == 0) {
            return tt_no_permission();
        }
        if ($mybb->user['uid'] != $post['uid']) {
            return tt_no_permission();
        }
        // Edit time limit
        $time = TIME_NOW;
        if ($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < $time - $mybb->settings['edittimelimit'] * 60) {
            $lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
            return xmlrespfalse($lang->edit_time_limit);
        }
    }
    // Check if this forum is password protected and we have a valid password
    tt_check_forum_password($forum['fid']);
    // Set up posthandler.
    require_once MYBB_ROOT . "inc/datahandlers/post.php";
    $posthandler = new PostDataHandler("update");
    $posthandler->action = "post";
    // Set the post data that came from the input to the $post array.
    $post = array("pid" => $pid, "subject" => $input['post_title'], "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "edit_uid" => $mybb->user['uid'], "message" => $input['post_content']);
    if (version_compare($mybb->version, '1.8.0', '>=') && !empty($input['editreason'])) {
        $post["editreason"] = $input['editreason'];
    }
    // get subscription status
    $query = $db->simple_select("threadsubscriptions", 'notification', "uid='" . intval($mybb->user['uid']) . "' AND tid='" . intval($tid) . "'");
    $substatus = $db->fetch_array($query);
    // Set up the post options from the input.
    $post['options'] = array("signature" => 1, "subscriptionmethod" => isset($substatus['notification']) ? $substatus['notification'] == 1 ? 'instant' : 'none' : '', "disablesmilies" => 0);
    $posthandler->set_data($post);
    // Now let the post handler do all the hard work.
    if (!$posthandler->validate_post()) {
        $post_errors = $posthandler->get_friendly_errors();
        return xmlrespfalse(implode(" :: ", $post_errors));
    } else {
        $postinfo = $posthandler->update_post();
        $visible = $postinfo['visible'];
        $first_post = $postinfo['first_post'];
        // Help keep our attachments table clean.
        $db->delete_query("attachments", "filename='' OR filesize<1");
        if ($visible == 0 && $first_post && !is_moderator($fid, "", $mybb->user['uid'])) {
            $state = 1;
        } else {
            if ($visible == 0 && !is_moderator($fid, "", $mybb->user['uid'])) {
                $state = 1;
            } else {
                $state = 0;
            }
        }
    }
    $pid = intval($pid);
    if (!empty($input['group_id_esc'])) {
        $db->update_query("attachments", array("pid" => $pid), "posthash='{$input['group_id_esc']}'");
    }
    // update thread attachment account
    if (count($input['attachment_id_array']) > 0) {
        update_thread_counters($tid, array("attachmentcount" => "+" . count($input['attachment_id_array'])));
    }
    $post = get_post($pid);
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:save_raw_post.php

示例13: header

            $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        } else {
            $msg->addError('FORUM_NO_DEL_SHARE');
        }
        header('Location: ' . AT_BASE_HREF . 'mods/_standard/forums/index.php');
        exit;
    }
}
$_section[0][0] = _AT('discussions');
$_section[0][1] = 'discussions/';
$_section[1][0] = _AT('forums');
$_section[1][1] = 'forum/list.php';
$_section[2][0] = _AT('delete_forum');
require AT_INCLUDE_PATH . 'header.inc.php';
$_GET['fid'] = intval($_GET['fid']);
$row = get_forum($_GET['fid'], $_SESSION['course_id']);
if (!is_array($row)) {
    $msg->addError('FORUM_NOT_ADDED');
} else {
    ?>
	<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
	<input type="hidden" name="delete_forum" value="true">
	<input type="hidden" name="fid" value="<?php 
    echo $_GET['fid'];
    ?>
">
		
	<?php 
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:delete_forum.php

示例14: soft_delete_threads

 /**
  * Soft delete one or more threads
  *
  * @param array|int Thread ID(s)
  * @return boolean
  */
 function soft_delete_threads($tids)
 {
     global $db, $cache, $plugins;
     if (!is_array($tids)) {
         $tids = array($tids);
     }
     if (empty($tids)) {
         return false;
     }
     // Make sure we only have valid values
     $tids = array_map('intval', $tids);
     $tid_list = implode(',', $tids);
     $tid_moved_list = "";
     $comma = "";
     foreach ($tids as $tid) {
         $tid_moved_list .= "{$comma}'moved|{$tid}'";
         $comma = ",";
     }
     $forum_counters = $user_counters = $posts_to_delete = array();
     foreach ($tids as $tid) {
         $thread = get_thread($tid);
         $forum = get_forum($thread['fid']);
         if ($thread['visible'] == 1 || $thread['visible'] == 0) {
             if (!isset($forum_counters[$forum['fid']])) {
                 $forum_counters[$forum['fid']] = array('num_posts' => 0, 'num_threads' => 0, 'num_deleted_threads' => 0, 'num_deleted_posts' => 0, 'unapproved_threads' => 0, 'unapproved_posts' => 0);
             }
             if (!isset($user_counters[$thread['uid']])) {
                 $user_counters[$thread['uid']] = array('num_posts' => 0, 'num_threads' => 0);
             }
             ++$forum_counters[$forum['fid']]['num_deleted_threads'];
             $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['replies'] + $thread['unapprovedposts'] + 1;
             if ($thread['visible'] == 1) {
                 ++$forum_counters[$forum['fid']]['num_threads'];
                 $forum_counters[$forum['fid']]['num_posts'] += $thread['replies'] + 1;
                 // Add implied invisible to count
                 $forum_counters[$forum['fid']]['unapproved_posts'] += $thread['unapprovedposts'];
             } else {
                 ++$forum_counters[$forum['fid']]['unapproved_threads'];
                 $forum_counters[$forum['fid']]['unapproved_posts'] += $thread['replies'] + $thread['deletedposts'] + $thread['unapprovedposts'] + 1;
                 // Add implied invisible to count
                 $forum_counters[$forum['fid']]['num_deleted_posts'] += $thread['deletedposts'];
             }
             // On unapproving thread update user post counts
             if ($thread['visible'] == 1 && $forum['usepostcounts'] != 0) {
                 $query = $db->simple_select("posts", "COUNT(pid) AS posts, uid", "tid='{$tid}' AND (visible='1' OR pid='{$thread['firstpost']}') AND uid > 0 GROUP BY uid");
                 while ($counter = $db->fetch_array($query)) {
                     if (!isset($user_counters[$counter['uid']]['num_posts'])) {
                         $user_counters[$counter['uid']]['num_posts'] = 0;
                     }
                     $user_counters[$counter['uid']]['num_posts'] += $counter['posts'];
                 }
             }
             if ($thread['visible'] == 1 && $forum['usethreadcounts'] != 0 && substr($thread['closed'], 0, 6) != 'moved|') {
                 ++$user_counters[$thread['uid']]['num_threads'];
             }
         }
         $posts_to_delete[] = $thread['firstpost'];
     }
     $update = array("visible" => -1);
     $db->update_query("threads", $update, "tid IN ({$tid_list})");
     // Soft delete redirects, too
     $redirect_tids = array();
     $query = $db->simple_select('threads', 'tid', "closed IN ({$tid_moved_list})");
     mark_reports($tids, "threads");
     while ($redirect_tid = $db->fetch_field($query, 'tid')) {
         $redirect_tids[] = $redirect_tid;
     }
     if (!empty($redirect_tids)) {
         $this->soft_delete_threads($redirect_tids);
     }
     if (!empty($posts_to_delete)) {
         $db->update_query("posts", $update, "pid IN (" . implode(',', $posts_to_delete) . ")");
     }
     $plugins->run_hooks("class_moderation_soft_delete_threads", $tids);
     if (is_array($forum_counters)) {
         foreach ($forum_counters as $fid => $counters) {
             // Update stats
             $update_array = array("threads" => "-{$counters['num_threads']}", "unapprovedthreads" => "-{$counters['unapproved_threads']}", "posts" => "-{$counters['num_posts']}", "unapprovedposts" => "-{$counters['unapproved_posts']}", "deletedposts" => "+{$counters['num_deleted_posts']}", "deletedthreads" => "+{$counters['num_deleted_threads']}");
             update_forum_counters($fid, $update_array);
             update_forum_lastpost($fid);
         }
     }
     if (!empty($user_counters)) {
         foreach ($user_counters as $uid => $counters) {
             $update_array = array("postnum" => "-{$counters['num_posts']}", "threadnum" => "-{$counters['num_threads']}");
             update_user_counters($uid, $update_array);
         }
     }
     return true;
 }
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:96,代码来源:class_moderation.php

示例15: move_threads

 /**
  * Move multiple threads to new forum
  *
  * @param array Thread IDs
  * @param int Destination forum
  * @return boolean true
  */
 function move_threads($tids, $moveto)
 {
     global $db, $plugins;
     // Make sure we only have valid values
     $tids = array_map('intval', $tids);
     $tid_list = implode(',', $tids);
     $moveto = intval($moveto);
     $newforum = get_forum($moveto);
     $total_posts = $total_unapproved_posts = $total_threads = $total_unapproved_threads = 0;
     $query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, tid", "tid IN ({$tid_list}) AND closed NOT LIKE 'moved|%'");
     while ($thread = $db->fetch_array($query)) {
         $forum = get_forum($thread['fid']);
         $total_posts += $thread['replies'] + 1;
         $total_unapproved_posts += $thread['unapprovedposts'];
         $forum_counters[$thread['fid']]['posts'] += $thread['replies'] + 1;
         $forum_counters[$thread['fid']]['unapprovedposts'] += $thread['unapprovedposts'];
         if ($thread['visible'] == 1) {
             $forum_counters[$thread['fid']]['threads']++;
             ++$total_threads;
         } else {
             $forum_counters[$thread['fid']]['unapprovedthreads']++;
             $forum_counters[$thread['fid']]['unapprovedposts'] += $thread['replies'];
             // Implied unapproved posts counter for unapproved threads
             ++$total_unapproved_threads;
         }
         $query1 = $db->query("\n\t\t\t\tSELECT COUNT(p.pid) AS posts, p.visible, u.uid\n\t\t\t\tFROM " . TABLE_PREFIX . "posts p\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n\t\t\t\tWHERE p.tid = '{$thread['tid']}'\n\t\t\t\tGROUP BY p.visible, u.uid\n\t\t\t\tORDER BY posts DESC\n\t\t\t");
         while ($posters = $db->fetch_array($query1)) {
             $pcount = "";
             if ($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0 && $posters['visible'] != 0) {
                 $pcount = "+{$posters['posts']}";
             } else {
                 if ($newforum['usepostcounts'] == 0 && $forum['usepostcounts'] != 0 && $posters['visible'] != 0) {
                     $pcount = "-{$posters['posts']}";
                 }
             }
             if (!empty($pcount)) {
                 $db->update_query("users", array("postnum" => "postnum{$pcount}"), "uid='{$posters['uid']}'", 1, true);
             }
         }
     }
     $sqlarray = array("fid" => $moveto);
     $db->update_query("threads", $sqlarray, "tid IN ({$tid_list})");
     $db->update_query("posts", $sqlarray, "tid IN ({$tid_list})");
     // If any of the thread has a prefix and the destination forum doesn't accept that prefix, remove the prefix
     $query = $db->simple_select("threads", "tid, prefix", "tid IN ({$tid_list}) AND prefix != 0");
     while ($thread = $db->fetch_array($query)) {
         $query = $db->simple_select("threadprefixes", "COUNT(*) as num_prefixes", "(CONCAT(',',forums,',') LIKE '%,{$moveto},%' OR forums='-1') AND pid='" . $thread['prefix'] . "'");
         if ($db->fetch_field($query, "num_prefixes") == 0) {
             $sqlarray = array("prefix" => 0);
             $db->update_query("threads", $sqlarray, "tid = '{$thread['tid']}'");
         }
     }
     $arguments = array("tids" => $tids, "moveto" => $moveto);
     $plugins->run_hooks("class_moderation_move_threads", $arguments);
     if (is_array($forum_counters)) {
         foreach ($forum_counters as $fid => $counter) {
             $updated_count = array("posts" => "-{$counter['posts']}", "unapprovedposts" => "-{$counter['unapprovedposts']}");
             if ($counter['threads']) {
                 $updated_count['threads'] = "-{$counter['threads']}";
             }
             if ($counter['unapprovedthreads']) {
                 $updated_count['unapprovedthreads'] = "-{$counter['unapprovedthreads']}";
             }
             update_forum_counters($fid, $updated_count);
         }
     }
     $updated_count = array("threads" => "+{$total_threads}", "unapprovedthreads" => "+{$total_unapproved_threads}", "posts" => "+{$total_posts}", "unapprovedposts" => "+{$total_unapproved_posts}");
     update_forum_counters($moveto, $updated_count);
     // Remove thread subscriptions for the users who no longer have permission to view the thread
     $this->remove_thread_subscriptions($tid_list, false, $moveto);
     return true;
 }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:79,代码来源:class_moderation.php


注:本文中的get_forum函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。