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


PHP delete_thread函数代码示例

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


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

示例1: delete_thread_uri

function delete_thread_uri($itemuri, $uid)
{
    $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid));
    if (count($messages)) {
        foreach ($messages as $message) {
            delete_thread($message["id"]);
        }
    }
}
开发者ID:jzacman,项目名称:friendica,代码行数:9,代码来源:threads.php

示例2: delete

 /**
  * Deletes a thread
  *
  * @param	boolean	Whether to consider updating post counts, regardless of forum's settings
  * @param	boolean	Whether to physically remove the thread from the database
  * @param	array	Array of information for a soft delete
  * @param	boolean	Whether to add an entry to the moderator log
  *
  * @return	mixed	The number of affected rows
  */
 function delete($countposts = true, $physicaldel = true, $delinfo = NULL, $dolog = true)
 {
     if ($threadid = $this->existing['threadid']) {
         require_once DIR . '/includes/functions_databuild.php';
         ($hook = vBulletinHook::fetch_hook('threaddata_delete')) ? eval($hook) : false;
         // note: the skip_moderator_log is the inverse of the $dolog argument
         return delete_thread($threadid, $countposts, $physicaldel, $delinfo, $this->info['skip_moderator_log'] !== null ? !$this->info['skip_moderator_log'] : $dolog, $this->existing);
     }
     return false;
 }
开发者ID:benyamin20,项目名称:vbregistration,代码行数:20,代码来源:class_dm_threadpost.php

示例3: diaspora_signed_retraction

function diaspora_signed_retraction($importer, $xml, $msg)
{
    $guid = notags(unxmlify($xml->target_guid));
    $diaspora_handle = notags(unxmlify($xml->sender_handle));
    $type = notags(unxmlify($xml->target_type));
    $sig = notags(unxmlify($xml->target_author_signature));
    $parent_author_signature = $xml->parent_author_signature ? notags(unxmlify($xml->parent_author_signature)) : '';
    $contact = diaspora_get_contact_by_handle($importer['uid'], $diaspora_handle);
    if (!$contact) {
        logger('diaspora_signed_retraction: no contact ' . $diaspora_handle . ' for ' . $importer['uid']);
        return;
    }
    $signed_data = $guid . ';' . $type;
    $key = $msg['key'];
    /* How Diaspora performs relayable_retraction signature checking:
    
    	   - If an item has been sent by the item author to the top-level post owner to relay on
    	     to the rest of the contacts on the top-level post, the top-level post owner checks
    	     the author_signature, then creates a parent_author_signature before relaying the item on
    	   - If an item has been relayed on by the top-level post owner, the contacts who receive it
    	     check only the parent_author_signature. Basically, they trust that the top-level post
    	     owner has already verified the authenticity of anything he/she sends out
    	   - In either case, the signature that get checked is the signature created by the person
    	     who sent the salmon
    	*/
    if ($parent_author_signature) {
        $parent_author_signature = base64_decode($parent_author_signature);
        if (!rsa_verify($signed_data, $parent_author_signature, $key, 'sha256')) {
            logger('diaspora_signed_retraction: top-level post owner verification failed');
            return;
        }
    } else {
        $sig_decode = base64_decode($sig);
        if (!rsa_verify($signed_data, $sig_decode, $key, 'sha256')) {
            logger('diaspora_signed_retraction: retraction owner verification failed.' . print_r($msg, true));
            return;
        }
    }
    if ($type === 'StatusMessage' || $type === 'Comment' || $type === 'Like') {
        $r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1", dbesc($guid), intval($importer['uid']));
        if (count($r)) {
            if (link_compare($r[0]['author-link'], $contact['url'])) {
                q("update item set `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' where `id` = %d", dbesc(datetime_convert()), dbesc(datetime_convert()), intval($r[0]['id']));
                delete_thread($r[0]['id'], $r[0]['parent-uri']);
                // Now check if the retraction needs to be relayed by us
                //
                // The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
                // return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
                // The only item with `parent` and `id` as the parent id is the parent item.
                $p = q("select origin from item where parent = %d and id = %d limit 1", $r[0]['parent'], $r[0]['parent']);
                if (count($p)) {
                    if ($p[0]['origin'] && !$parent_author_signature) {
                        q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", $r[0]['id'], dbesc($signed_data), dbesc($sig), dbesc($diaspora_handle));
                        // the existence of parent_author_signature would have meant the parent_author or owner
                        // is already relaying.
                        logger('diaspora_signed_retraction: relaying relayable_retraction');
                        proc_run('php', 'include/notifier.php', 'drop', $r[0]['id']);
                    }
                }
            }
        }
    } else {
        logger('diaspora_signed_retraction: unknown type: ' . $type);
    }
    return 202;
    // NOTREACHED
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:67,代码来源:diaspora.php

示例4: drop_item

function drop_item($id, $interactive = true)
{
    $a = get_app();
    // locate item to be deleted
    $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", intval($id));
    if (!count($r)) {
        if (!$interactive) {
            return 0;
        }
        notice(t('Item not found.') . EOL);
        goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
    }
    $item = $r[0];
    $owner = $item['uid'];
    $cid = 0;
    // check if logged in user is either the author or owner of this item
    if (is_array($_SESSION['remote'])) {
        foreach ($_SESSION['remote'] as $visitor) {
            if ($visitor['uid'] == $item['uid'] && $visitor['cid'] == $item['contact-id']) {
                $cid = $visitor['cid'];
                break;
            }
        }
    }
    if (local_user() == $item['uid'] || $cid || !$interactive) {
        // Check if we should do HTML-based delete confirmation
        if ($_REQUEST['confirm']) {
            // <form> can't take arguments in its "action" parameter
            // so add any arguments as hidden inputs
            $query = explode_querystring($a->query_string);
            $inputs = array();
            foreach ($query['args'] as $arg) {
                if (strpos($arg, 'confirm=') === false) {
                    $arg_parts = explode('=', $arg);
                    $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
                }
            }
            return replace_macros(get_markup_template('confirm.tpl'), array('$method' => 'get', '$message' => t('Do you really want to delete this item?'), '$extra_inputs' => $inputs, '$confirm' => t('Yes'), '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel')));
        }
        // Now check how the user responded to the confirmation query
        if ($_REQUEST['canceled']) {
            goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
        }
        logger('delete item: ' . $item['id'], LOGGER_DEBUG);
        // delete the item
        $r = q("UPDATE `item` SET `deleted` = 1, `title` = '', `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d", dbesc(datetime_convert()), dbesc(datetime_convert()), intval($item['id']));
        create_tags_from_item($item['id']);
        create_files_from_item($item['id']);
        delete_thread($item['id'], $item['parent-uri']);
        // clean up categories and tags so they don't end up as orphans
        $matches = false;
        $cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
        if ($cnt) {
            foreach ($matches as $mtch) {
                file_tag_unsave_file($item['uid'], $item['id'], $mtch[1], true);
            }
        }
        $matches = false;
        $cnt = preg_match_all('/\\[(.*?)\\]/', $item['file'], $matches, PREG_SET_ORDER);
        if ($cnt) {
            foreach ($matches as $mtch) {
                file_tag_unsave_file($item['uid'], $item['id'], $mtch[1], false);
            }
        }
        // If item is a link to a photo resource, nuke all the associated photos
        // (visitors will not have photo resources)
        // This only applies to photos uploaded from the photos page. Photos inserted into a post do not
        // generate a resource-id and therefore aren't intimately linked to the item.
        if (strlen($item['resource-id'])) {
            q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", dbesc($item['resource-id']), intval($item['uid']));
            // ignore the result
        }
        // If item is a link to an event, nuke the event record.
        if (intval($item['event-id'])) {
            q("DELETE FROM `event` WHERE `id` = %d AND `uid` = %d", intval($item['event-id']), intval($item['uid']));
            // ignore the result
        }
        // If item has attachments, drop them
        foreach (explode(",", $item['attach']) as $attach) {
            preg_match("|attach/(\\d+)|", $attach, $matches);
            q("DELETE FROM `attach` WHERE `id` = %d AND `uid` = %d", intval($matches[1]), local_user());
            // ignore the result
        }
        // clean up item_id and sign meta-data tables
        /*
        // Old code - caused very long queries and warning entries in the mysql logfiles:
        
        $r = q("DELETE FROM item_id where iid in (select id from item where parent = %d and uid = %d)",
        	intval($item['id']),
        	intval($item['uid'])
        );
        
        $r = q("DELETE FROM sign where iid in (select id from item where parent = %d and uid = %d)",
        	intval($item['id']),
        	intval($item['uid'])
        );
        */
        // The new code splits the queries since the mysql optimizer really has bad problems with subqueries
        // Creating list of parents
        $r = q("select id from item where parent = %d and uid = %d", intval($item['id']), intval($item['uid']));
//.........这里部分代码省略.........
开发者ID:EmilienB,项目名称:friendica,代码行数:101,代码来源:items.php

示例5: redirect

        redirect('viewforum.php?id=' . $cur_comment['fid']);
    } else {
        // Reset just this one comment
        $db->query('UPDATE ' . $db->prefix . 'comments SET soft = 0 WHERE id=' . $id) or error('Unable to soft delete comment', __FILE__, __LINE__, $db->error());
        update_forum($cur_comment['fid']);
        // Redirect towards the comment
        redirect('thread.php?pid=' . $id . '#p' . $id);
    }
}
if (isset($_POST['delete'])) {
    // Make sure they got here from the site
    confirm_referrer('delete.php');
    require LUNA_ROOT . 'include/search_idx.php';
    if ($is_thread_comment) {
        // Delete the thread and all of its comments
        delete_thread($cur_comment['tid'], "hard");
        update_forum($cur_comment['fid']);
        redirect('viewforum.php?id=' . $cur_comment['fid']);
    } else {
        // Delete just this one comment
        delete_comment($id, $cur_comment['tid'], $cur_comment['commenter_id']);
        update_forum($cur_comment['fid']);
        // Redirect towards the previous comment
        $result = $db->query('SELECT id FROM ' . $db->prefix . 'comments WHERE thread_id=' . $cur_comment['tid'] . ' AND id < ' . $id . ' ORDER BY id DESC LIMIT 1') or error('Unable to fetch comment info', __FILE__, __LINE__, $db->error());
        $comment_id = $db->result($result);
        redirect('thread.php?pid=' . $comment_id . '#p' . $comment_id);
    }
}
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Delete comment', 'luna'));
define('LUNA_ACTIVE_PAGE', 'delete');
require LUNA_ROOT . 'include/parser.php';
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:delete.php

示例6: ostatus_completion


//.........这里部分代码省略.........
        $parent_uri = $parent["uri"];
        // "context" only seems to exist on older servers
        if (isset($single_conv->context->inReplyTo->id)) {
            $parent_exists = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s','%s') LIMIT 1", intval($uid), dbesc($single_conv->context->inReplyTo->id), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DFRN));
            if ($parent_exists) {
                $parent_uri = $single_conv->context->inReplyTo->id;
            }
        }
        // This is the current way
        if (isset($single_conv->object->inReplyTo->id)) {
            $parent_exists = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s','%s') LIMIT 1", intval($uid), dbesc($single_conv->object->inReplyTo->id), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DFRN));
            if ($parent_exists) {
                $parent_uri = $single_conv->object->inReplyTo->id;
            }
        }
        $message_exists = q("SELECT `id`, `parent`, `uri` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s','%s') LIMIT 1", intval($uid), dbesc($single_conv->id), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DFRN));
        if ($message_exists) {
            logger("Message " . $single_conv->id . " already existed on the system", LOGGER_DEBUG);
            if ($parent["id"] != 0) {
                $existing_message = $message_exists[0];
                // We improved the way we fetch OStatus messages, this shouldn't happen very often now
                // To-Do: we have to change the shadow copies as well. This way here is really ugly.
                if ($existing_message["parent"] != $parent["id"]) {
                    logger('updating id ' . $existing_message["id"] . ' with parent ' . $existing_message["parent"] . ' to parent ' . $parent["id"] . ' uri ' . $parent["uri"] . ' thread ' . $parent_uri, LOGGER_DEBUG);
                    // Update the parent id of the selected item
                    $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s' WHERE `id` = %d", intval($parent["id"]), dbesc($parent["uri"]), intval($existing_message["id"]));
                    // Update the parent uri in the thread - but only if it points to itself
                    $r = q("UPDATE `item` SET `thr-parent` = '%s' WHERE `id` = %d AND `uri` = `thr-parent`", dbesc($parent_uri), intval($existing_message["id"]));
                    // try to change all items of the same parent
                    $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s' WHERE `parent` = %d", intval($parent["id"]), dbesc($parent["uri"]), intval($existing_message["parent"]));
                    // Update the parent uri in the thread - but only if it points to itself
                    $r = q("UPDATE `item` SET `thr-parent` = '%s' WHERE (`parent` = %d) AND (`uri` = `thr-parent`)", dbesc($parent["uri"]), intval($existing_message["parent"]));
                    // Now delete the thread
                    delete_thread($existing_message["parent"]);
                }
            }
            // The item we are having on the system is the one that we wanted to store via the item array
            if (isset($item["uri"]) and $item["uri"] == $existing_message["uri"]) {
                $item = array();
                $item_stored = 0;
            }
            continue;
        }
        if (is_array($single_conv->to)) {
            foreach ($single_conv->to as $to) {
                if ($importer["nurl"] == normalise_link($to->id)) {
                    $mention = true;
                }
            }
        }
        $actor = $single_conv->actor->id;
        if (isset($single_conv->actor->url)) {
            $actor = $single_conv->actor->url;
        }
        $contact = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` != '%s'", $uid, normalise_link($actor), NETWORK_STATUSNET);
        if (count($contact)) {
            logger("Found contact for url " . $actor, LOGGER_DEBUG);
            $contact_id = $contact[0]["id"];
        } else {
            logger("No contact found for url " . $actor, LOGGER_DEBUG);
            // Adding a global contact
            // To-Do: Use this data for the post
            $global_contact_id = get_contact($actor, 0);
            logger("Global contact " . $global_contact_id . " found for url " . $actor, LOGGER_DEBUG);
            $contact_id = $parent["contact-id"];
        }
开发者ID:rahmiyildiz,项目名称:friendica,代码行数:67,代码来源:ostatus.php

示例7: m_delete_post_func

function m_delete_post_func($xmlrpc_params)
{
    global $input, $post, $thread, $forum, $pid, $tid, $fid, $modlogdata, $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $moderation, $parser;
    $input = Tapatalk_Input::filterXmlInput(array('post_id' => Tapatalk_Input::INT, 'mode' => Tapatalk_Input::INT, 'reason_text' => Tapatalk_Input::STRING), $xmlrpc_params);
    // Load global language phrases
    $lang->load("editpost");
    $plugins->run_hooks("editpost_start");
    // No permission for guests
    if (!$mybb->user['uid']) {
        error_no_permission();
    }
    // Get post info
    $pid = intval($input['post_id']);
    $query = $db->simple_select("posts", "*", "pid='{$pid}'");
    $post = $db->fetch_array($query);
    if (!$post['pid']) {
        error($lang->error_invalidpost);
    }
    // Get thread info
    $tid = $post['tid'];
    $thread = get_thread($tid);
    if (!$thread['tid']) {
        error($lang->error_invalidthread);
    }
    // Get forum info
    $fid = $post['fid'];
    $forum = get_forum($fid);
    if (!$forum || $forum['type'] != "f") {
        error($lang->error_closedinvalidforum);
    }
    if ($forum['open'] == 0 || $mybb->user['suspendposting'] == 1) {
        error_no_permission();
    }
    $forumpermissions = forum_permissions($fid);
    if (!is_moderator($fid, "candeleteposts")) {
        if ($thread['closed'] == 1) {
            error($lang->redirect_threadclosed);
        }
        if ($forumpermissions['candeleteposts'] == 0) {
            error_no_permission();
        }
        if ($mybb->user['uid'] != $post['uid']) {
            error_no_permission();
        }
    }
    // Check if this forum is password protected and we have a valid password
    check_forum_password($forum['fid']);
    $plugins->run_hooks("editpost_deletepost");
    $modlogdata['fid'] = $fid;
    $modlogdata['tid'] = $tid;
    $query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
    $firstcheck = $db->fetch_array($query);
    if ($firstcheck['pid'] == $pid) {
        if ($forumpermissions['candeletethreads'] == 1 || is_moderator($fid, "candeletethreads")) {
            delete_thread($tid);
            mark_reports($tid, "thread");
            log_moderator_action($modlogdata, $lang->thread_deleted);
        } else {
            error_no_permission();
        }
    } else {
        if ($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts")) {
            // Select the first post before this
            delete_post($pid, $tid);
            mark_reports($pid, "post");
            log_moderator_action($modlogdata, $lang->post_deleted);
        } else {
            error_no_permission();
        }
    }
    $response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'is_login_mod' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval("", 'base64')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:73,代码来源:moderation.php

示例8: removeThread

 /**
  * Delete a user in the database
  *
  * @param integer $thread Thread ID
  * @return boolean
  */
 function removeThread($thread)
 {
     $tid = intval($thread);
     $this->lang->load('editpost');
     $deleted = delete_thread($tid);
     mark_reports($tid, "thread");
     $modlogdata['tid'] = $tid;
     $this->logModeratorAction($modlogdata, $this->lang->thread_deleted);
     return $deleted;
 }
开发者ID:NoiSek,项目名称:ArFlux,代码行数:16,代码来源:class.MyBBIntegrator.php

示例9: error_page

        if ($forum->parent_type != 0) {
            error_page("No");
        }
        $fid = post_int('forumid');
        $new_forum = BoincForum::lookup_id($fid);
        $result = move_thread($thread, $forum, $new_forum);
        $action_name = "moved from {$forum->title} to {$new_forum->title}";
        break;
    case "title":
        $new_title = post_str('newtitle');
        $title = BoincDb::escape_string($new_title);
        $result = $thread->update("title='{$title}'");
        $action_name = "renamed from '{$thread->title}' to '{$new_title}'";
        break;
    case "delete":
        delete_thread($thread, $forum);
        page_head("Thread deleted");
        echo "Thread successfully deleted.\n        <p>\n        <a href=forum_forum.php?id={$forum->id}>Return to forum</a>\n    ";
        page_tail();
        exit;
    default:
        error_page("Unknown action");
}
if (!$result) {
    error_page("Moderation failed");
}
$reason = post_str('reason', true);
if (!$reason) {
    $reason = "None given";
}
send_thread_moderation_email($forum, $thread, $reason, $action_name, $explanation);
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:forum_moderate_thread_action.php

示例10: delete

 /**
  * Deletes a thread
  *
  * @param	boolean	Whether to consider updating post counts, regardless of forum's settings
  * @param	boolean	Whether to physically remove the thread from the database
  * @param	array	Array of information for a soft delete
  * @param	boolean	Whether to add an entry to the moderator log
  *
  * @return	mixed	The number of affected rows
  */
 function delete($countposts = true, $physicaldel = true, $delinfo = NULL, $dolog = true)
 {
     if ($threadid = $this->existing['threadid']) {
         require_once DIR . '/includes/functions_databuild.php';
         require_once DIR . "/vb/search/core.php";
         ($hook = vBulletinHook::fetch_hook('threaddata_delete')) ? eval($hook) : false;
         // Search index maintenance
         if ($physicaldel) {
             require_once DIR . '/includes/class_taggablecontent.php';
             $content = vB_Taggable_Content_Item::create($this->registry, "vBForum_Thread", $threadid);
             $content->delete_tag_attachments();
             //don't queue this, it needs to run before the thread records are deleted.
             $indexcontroller = vB_Search_Core::get_instance()->get_index_controller('vBForum', 'Post');
             $indexcontroller->delete_thread($threadid);
         }
         // note: the skip_moderator_log is the inverse of the $dolog argument
         return delete_thread($threadid, $countposts, $physicaldel, $delinfo, $this->info['skip_moderator_log'] !== null ? !$this->info['skip_moderator_log'] : $dolog, $this->existing);
     }
     return false;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:30,代码来源:class_dm_threadpost.php

示例11: remove_forums

 /**
 Remove the group's forums from the game
 */
 public function remove_forums()
 {
     if ($this->info['fid']) {
         $forumquery = $this->db->simple_select('forums', '*', 'fid = ' . $this->info['fid']);
         while ($forum = $this->db->fetch_array($forumquery)) {
             //Move prefix to parent board
             $prefixquery = $this->db->simple_select('threadprefixes', '*', 'CONCAT(\',\',forums,\',\') LIKE \'%,' . $this->info['fid'] . ',%\'');
             while ($prefix = $this->db->fetch_array($prefixquery)) {
                 $forums = explode(',', $prefix['forums']);
                 foreach ($forums as $f) {
                     $forumstring .= $f !== $this->info['fid'] ? $f . ',' : $forum['pid'] . ',';
                 }
                 $this->db->update_query('threadprefixes', array('forums' => trim($forumstring, ',')), 'pid = ' . $prefix['pid']);
             }
             //Move threads to parent board
             $threadquery = $this->db->simple_select('threads', '*', 'fid = ' . $this->info['fid']);
             while ($thread = $this->db->fetch_array($threadquery)) {
                 $threadstring .= $thread['tid'];
             }
             if (!empty($threadstring)) {
                 $this->db->update_query('threads', array('fid' => $forum['pid']), 'tid IN (' . $threadstring . ')');
                 $this->db->update_query('posts', array('fid' => $forum['pid']), 'tid IN (' . $threadstring . ')');
                 update_forum_lastpost($forum['pid']);
             }
         }
         //Delete MO forum
         $this->db->query('DELETE FROM ' . TABLE_PREFIX . 'forums WHERE fid = ' . $this->info['mo_fid']);
         $threadquery = $this->db->simple_select('threads', '*', 'fid = ' . $this->info['mo_fid']);
         while ($thread = $this->db->fetch_array($threadquery)) {
             delete_thread($thread['tid']);
         }
         //Delete all permissions
         $this->db->query('DELETE FROM ' . TABLE_PREFIX . 'forumpermissions WHERE fid = ' . $this->info['mo_fid']);
         $this->db->query('DELETE FROM ' . TABLE_PREFIX . 'moderators WHERE fid = ' . $this->info['mo_fid']);
         $this->db->query('DELETE FROM ' . TABLE_PREFIX . 'moderators WHERE fid = ' . $this->info['fid']);
         //Delete forum
         $this->db->query('DELETE FROM ' . TABLE_PREFIX . 'forums WHERE fid = ' . $this->info['fid']);
     }
     $this->cache->update_forums();
     $this->cache->update_moderators();
     $this->cache->update_forumpermissions();
     $this->cache->update_threadprefixes();
 }
开发者ID:amwelles,项目名称:RPGSuite,代码行数:46,代码来源:class_UserGroup.php

示例12: verify_post_check

 // Verify incoming POST request
 verify_post_check($mybb->input['my_post_key']);
 $plugins->run_hooks("editpost_deletepost");
 if ($mybb->input['delete'] == 1) {
     $query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
     $firstcheck = $db->fetch_array($query);
     if ($firstcheck['pid'] == $pid) {
         $firstpost = 1;
     } else {
         $firstpost = 0;
     }
     $modlogdata['fid'] = $fid;
     $modlogdata['tid'] = $tid;
     if ($firstpost) {
         if ($forumpermissions['candeletethreads'] == 1 || is_moderator($fid, "candeletethreads")) {
             delete_thread($tid);
             mark_reports($tid, "thread");
             log_moderator_action($modlogdata, $lang->thread_deleted);
             redirect(get_forum_link($fid), $lang->redirect_threaddeleted);
         } else {
             error_no_permission();
         }
     } else {
         if ($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts")) {
             // Select the first post before this
             delete_post($pid, $tid);
             mark_reports($pid, "post");
             log_moderator_action($modlogdata, $lang->post_deleted);
             $query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline <= '{$post['dateline']}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "desc"));
             $next_post = $db->fetch_array($query);
             if ($next_post['pid']) {
开发者ID:slothly,项目名称:mybb,代码行数:31,代码来源:editpost.php

示例13: error

 $db->query('DELETE FROM ' . $db->prefix . 'thread_subscriptions WHERE user_id=' . $id) or error('Unable to delete thread subscriptions', __FILE__, __LINE__, $db->error());
 $db->query('DELETE FROM ' . $db->prefix . 'forum_subscriptions WHERE user_id=' . $id) or error('Unable to delete forum subscriptions', __FILE__, __LINE__, $db->error());
 // Remove him/her from the online list (if they happen to be logged in)
 $db->query('DELETE FROM ' . $db->prefix . 'online WHERE user_id=' . $id) or error('Unable to remove user from online list', __FILE__, __LINE__, $db->error());
 // Should we delete all comments made by this user?
 if (isset($_POST['delete_comments'])) {
     require LUNA_ROOT . 'include/search_idx.php';
     @set_time_limit(0);
     // Find all comments made by this user
     $result = $db->query('SELECT p.id, p.thread_id, t.forum_id FROM ' . $db->prefix . 'comments AS p INNER JOIN ' . $db->prefix . 'threads AS t ON t.id=p.thread_id INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id WHERE p.commenter_id=' . $id) or error('Unable to fetch comments', __FILE__, __LINE__, $db->error());
     if ($db->num_rows($result)) {
         while ($cur_comment = $db->fetch_assoc($result)) {
             // Determine whether this comment is the "thread comment" or not
             $result2 = $db->query('SELECT id FROM ' . $db->prefix . 'comments WHERE thread_id=' . $cur_comment['thread_id'] . ' ORDER BY commented LIMIT 1') or error('Unable to fetch comment info', __FILE__, __LINE__, $db->error());
             if ($db->result($result2) == $cur_comment['id']) {
                 delete_thread($cur_comment['thread_id']);
             } else {
                 delete_comment($cur_comment['id'], $cur_comment['thread_id'], $id);
             }
             update_forum($cur_comment['forum_id']);
         }
     }
 } else {
     // Set all his/her comments to guest
     $db->query('UPDATE ' . $db->prefix . 'comments SET commenter_id=1 WHERE commenter_id=' . $id) or error('Unable to update comments', __FILE__, __LINE__, $db->error());
 }
 // Delete the user
 $db->query('DELETE FROM ' . $db->prefix . 'users WHERE id=' . $id) or error('Unable to delete user', __FILE__, __LINE__, $db->error());
 // Delete user avatar
 delete_avatar($id);
 // Regenerate the users info cache
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:settings.php

示例14: get_input_vars

    $tr = $db->get_thread($vars['thread_id']);
    $db->delete_thread($vars['thread_id']);
    $t->assign('msg', "Thread deleted");
    $t->assign('link', 'newsletter_threads.php');
    $t->display("admin/newsletter_thread_saved.html");
}
//////////////////// main ////////////////////////////////////////
$vars = get_input_vars();
if ($vars['thread_id']) {
    $t->assign('thread_id', $vars['thread_id']);
}
switch ($vars['action']) {
    case 'new':
        display_form();
        break;
    case 'create':
        create_thread($vars);
        break;
    case 'edit':
        display_edit_form();
        break;
    case 'update':
        update_thread($vars);
        break;
    case 'delete':
        delete_thread();
        break;
    default:
        display_threads_list();
        break;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:31,代码来源:newsletter_threads.php


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