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


PHP bb_delete_topic函数代码示例

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


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

示例1: bb_ksd_new_post

function bb_ksd_new_post($post_id)
{
    global $bb_ksd_pre_post_status;
    if ('2' != $bb_ksd_pre_post_status) {
        return;
    }
    $bb_post = bb_get_post($post_id);
    $topic = get_topic($bb_post->topic_id);
    if (0 == $topic->topic_posts) {
        bb_delete_topic($topic->topic_id, 2);
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:12,代码来源:akismet.php

示例2: bp_forums_delete_topic

/**
 * Delete a topic.
 *
 * @param array $args {
 *     @type int $topic_id ID of the topic being deleted.
 * }
 * @return bool True on success, false on failure.
 */
function bp_forums_delete_topic($args = '')
{
    /** This action is documented in bp-forums/bp-forums-screens */
    do_action('bbpress_init');
    $r = wp_parse_args($args, array('topic_id' => false));
    extract($r, EXTR_SKIP);
    return bb_delete_topic($topic_id, 1);
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:16,代码来源:bp-forums-functions.php

示例3: bb_deleteTopic

 /**
  * Deletes a topic
  *
  * @since 1.0
  * @return integer|object 0 if already changed, 1 when successfully changed or an IXR_Error object on failure
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The username for authentication
  * @param string $args[1] The password for authentication
  * @param integer|string $args[2] The unique id of the topic to be deleted
  * @param integer $args[3] 1 deletes the topic, 0 undeletes the topic
  *
  * XML-RPC request to delete a topic with id of 34
  * <methodCall>
  *     <methodName>bb.deleteTopic</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><integer>34</integer></value></param>
  *     </params>
  * </methodCall>
  */
 function bb_deleteTopic($args)
 {
     do_action('bb_xmlrpc_call', 'bb.deleteTopic');
     // Escape args
     $this->escape($args);
     // Get the login credentials
     $username = $args[0];
     $password = (string) $args[1];
     // Check the user is valid
     $user = $this->authenticate($username, $password, 'delete_topics', __('You do not have permission to delete topics.'));
     do_action('bb_xmlrpc_call_authenticated', 'bb.deleteTopic');
     // If an error was raised by authentication or by an action then return it
     if ($this->error) {
         return $this->error;
     }
     // Can be numeric id or slug
     $topic_id = isset($args[2]) ? $args[2] : false;
     // Check for bad data
     if (!$topic_id || !is_string($topic_id) && !is_integer($topic_id)) {
         $this->error = new IXR_Error(400, __('The topic id is invalid.'));
         return $this->error;
     }
     // Check the requested topic exists
     if (!($topic = get_topic($topic_id))) {
         $this->error = new IXR_Error(400, __('No topic found.'));
         return $this->error;
     }
     // The topic id may have been a slug, so make sure it's an integer here
     $topic_id = (int) $topic->topic_id;
     $delete = isset($args[3]) ? (int) $args[3] : 1;
     // Don't do anything if already set that way
     if ($delete === (int) $topic->topic_status) {
         return 0;
     }
     // Make sure they are allowed to delete this topic
     if (!bb_current_user_can('delete_topic', $topic_id)) {
         $this->error = new IXR_Error(403, __('You do not have permission to delete this topic.'));
         return $this->error;
     }
     // Delete the topic
     if (!bb_delete_topic($topic_id, $delete)) {
         $this->error = new IXR_Error(500, __('The topic could not be deleted.'));
         return $this->error;
     }
     $result = 1;
     do_action('bb_xmlrpc_call_return', 'bb.deleteTopic');
     return $result;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:69,代码来源:xmlrpc.php

示例4: bp_forums_delete_topic

function bp_forums_delete_topic($args = '')
{
    global $bp;
    do_action('bbpress_init');
    $defaults = array('topic_id' => false);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    return bb_delete_topic($topic_id, 1);
}
开发者ID:hscale,项目名称:webento,代码行数:9,代码来源:bp-forums-functions.php

示例5: bb_bozo_new_post

function bb_bozo_new_post($post_id)
{
    $bb_post = bb_get_post($post_id);
    if (1 < $bb_post->post_status) {
        bb_bozon($bb_post->poster_id, $bb_post->topic_id);
    }
    $topic = get_topic($bb_post->topic_id, false);
    if (0 == $topic->topic_posts) {
        bb_delete_topic($topic->topic_id, 2);
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:11,代码来源:bozo.php

示例6: wp_redirect

<?php

require 'admin-action.php';
$topic_id = (int) $_GET['id'];
if (!bb_current_user_can('delete_topic', $topic_id)) {
    wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('delete-topic_' . $topic_id);
$topic = get_topic($topic_id);
$old_status = (int) $topic->topic_status;
if (!$topic) {
    bb_die(__('There is a problem with that topic, pardner.'));
}
$status = $topic->topic_status ? 0 : 1;
bb_delete_topic($topic->topic_id, $status);
$message = '';
switch ($old_status) {
    case 0:
        switch ($status) {
            case 0:
                break;
            case 1:
                $message = 'deleted';
                break;
        }
        break;
    case 1:
        switch ($status) {
            case 0:
                $message = 'undeleted';
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:delete-topic.php

示例7: blocklist_check

function blocklist_check($post_id = 0, $wall = false)
{
    if (bb_current_user_can('moderate') || bb_current_user_can('throttle')) {
        return;
    }
    if ($wall) {
        $bb_post = user_wall_get_post($post_id);
    } else {
        $bb_post = bb_get_post($post_id);
    }
    if (empty($post_id) || empty($bb_post) || !empty($bb_post->post_status)) {
        return;
    }
    global $blocklist, $bbdb;
    blocklist_initialize();
    if (empty($blocklist['data'])) {
        return;
    }
    (array) ($data = explode("\r\n", $blocklist['data']));
    $user = bb_get_user($bb_post->poster_id);
    foreach ($data as $item) {
        if (empty($item) || strlen($item) < 4 || ord($item) == 35) {
            continue;
        }
        if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $item)) {
            // is IP
            if (strpos($bb_post->poster_ip, $item) === 0) {
                $found = "IP address";
                $bad = $item;
                break;
            }
        } else {
            // is word
            $qitem = preg_quote($item);
            if (preg_match('/\\b' . $qitem . '/simU', $user->user_email)) {
                $found = "email";
                $bad = $item;
                break;
            }
            if (preg_match('/\\b' . $qitem . '/simU', $user->user_login)) {
                $found = "username";
                $bad = $item;
                break;
            }
            if (preg_match('/\\b' . $qitem . '/simU', $bb_post->post_text)) {
                $found = "post text";
                $bad = $item;
                break;
            } elseif (!$wall && $bb_post->post_position == 1) {
                if (empty($topic)) {
                    $topic = get_topic($bb_post->topic_id);
                }
                if (!empty($topic->topic_title) && preg_match('/\\b' . $qitem . '/simU', $topic->topic_title)) {
                    $found = "topic title";
                    $bad = $item;
                    break;
                }
            }
        }
        if (!empty($bad)) {
            break;
        }
    }
    if (!empty($bad)) {
        if ($wall) {
            user_wall_delete_post($post_id, 2);
            $uri = bb_get_option('uri') . "bb-admin/admin-base.php?post_status=2&plugin=user_wall_admin&user-wall-recent=1";
        } else {
            bb_delete_post($post_id, 2);
            if (empty($topic)) {
                $topic = get_topic($bb_post->topic_id);
            }
            if (empty($topic->topic_posts)) {
                bb_delete_topic($topic->topic_id, 2);
            }
            // if no posts in topic, also set topic to spam
            $uri = bb_get_option('uri') . 'bb-admin/' . (defined('BACKPRESS_PATH') ? '' : 'content-') . 'posts.php?post_status=2';
        }
        if (empty($blocklist['email'])) {
            return;
        }
        (array) ($email = explode("\r\n", $blocklist['email']));
        $message = "The blocklist has been triggered... \r\n\r\n";
        $message .= "Matching entry " . '"' . $bad . '"' . " found in {$found}.\r\n";
        $message .= "{$uri}\r\n\r\n";
        $message .= sprintf(__('Username: %s'), stripslashes($user->user_login)) . "\r\n";
        $message .= sprintf(__('Profile: %s'), get_user_profile_link($user->ID)) . "\r\n";
        $message .= sprintf(__('Email: %s'), stripslashes($user->user_email)) . "\r\n";
        $message .= sprintf(__('IP address: %s'), $_SERVER['REMOTE_ADDR']) . "\r\n";
        $message .= sprintf(__('Agent: %s'), substr(stripslashes($_SERVER["HTTP_USER_AGENT"]), 0, 255)) . "\r\n\r\n";
        foreach ($email as $to) {
            if (empty($to) || strlen($to) < 8) {
                continue;
            }
            @bb_mail($to, "[" . bb_get_option('name') . "] blocklist triggered", $message);
        }
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:98,代码来源:blocklist.php

示例8: bb_delete_post

function bb_delete_post($post_id, $new_status = 0)
{
    global $bbdb, $topic, $bb_post;
    $post_id = (int) $post_id;
    $bb_post = bb_get_post($post_id);
    $new_status = (int) $new_status;
    $old_status = (int) $bb_post->post_status;
    add_filter('get_topic_where', 'bb_no_where');
    $topic = get_topic($bb_post->topic_id);
    $topic_id = (int) $topic->topic_id;
    if ($bb_post) {
        $uid = (int) $bb_post->poster_id;
        if ($new_status == $old_status) {
            return;
        }
        _bb_delete_post($post_id, $new_status);
        if (0 == $old_status) {
            bb_update_topicmeta($topic_id, 'deleted_posts', $topic->deleted_posts + 1);
            $bbdb->query($bbdb->prepare("UPDATE {$bbdb->forums} SET posts = posts - 1 WHERE forum_id = %d", $topic->forum_id));
        } else {
            if (0 == $new_status) {
                bb_update_topicmeta($topic_id, 'deleted_posts', $topic->deleted_posts - 1);
                $bbdb->query($bbdb->prepare("UPDATE {$bbdb->forums} SET posts = posts + 1 WHERE forum_id = %d", $topic->forum_id));
            }
        }
        $posts = (int) $bbdb->get_var($bbdb->prepare("SELECT COUNT(*) FROM {$bbdb->posts} WHERE topic_id = %d AND post_status = 0", $topic_id));
        $bbdb->update($bbdb->topics, array('topic_posts' => $posts), compact('topic_id'));
        if (0 == $posts) {
            if (0 == $topic->topic_status || 1 == $new_status) {
                bb_delete_topic($topic_id, $new_status);
            }
        } else {
            if (0 != $topic->topic_status) {
                $bbdb->update($bbdb->topics, array('topic_status' => 0), compact('topic_id'));
                $bbdb->query($bbdb->prepare("UPDATE {$bbdb->forums} SET topics = topics + 1 WHERE forum_id = %d", $topic->forum_id));
            }
            bb_topic_set_last_post($topic_id);
            bb_update_post_positions($topic_id);
            bb_update_topic_voices($topic_id);
        }
        $user = bb_get_user($uid);
        $user_posts = new BB_Query('post', array('post_author_id' => $user->ID, 'topic_id' => $topic_id));
        if ($new_status && !$user_posts->results) {
            $topics_replied_key = $bbdb->prefix . 'topics_replied';
            bb_update_usermeta($user->ID, $topics_replied_key, $user->{$topics_replied_key} - 1);
        }
        nxt_cache_delete($topic_id, 'bb_topic');
        nxt_cache_delete($topic_id, 'bb_thread');
        nxt_cache_flush('bb_forums');
        nxt_cache_flush('bb_query');
        nxt_cache_flush('bb_cache_posts_post_ids');
        do_action('bb_delete_post', $post_id, $new_status, $old_status);
        return $post_id;
    } else {
        return false;
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:57,代码来源:functions.bb-posts.php

示例9: bp_forums_delete_topic

function bp_forums_delete_topic($args = '')
{
    do_action('bbpress_init');
    $r = wp_parse_args($args, array('topic_id' => false));
    extract($r, EXTR_SKIP);
    return bb_delete_topic($topic_id, 1);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:7,代码来源:bp-forums-functions.php

示例10: foreach

            break;
        case 'open':
            foreach ($topic_ids as $topic_id) {
                $affected += bb_open_topic($topic_id);
            }
            $query_vars = array('message' => 'opened', 'count' => $affected);
            break;
        case 'delete':
            foreach ($topic_ids as $topic_id) {
                $affected += (int) (bool) bb_delete_topic($topic_id, 1);
            }
            $query_vars = array('message' => 'deleted', 'count' => $affected);
            break;
        case 'undelete':
            foreach ($topic_ids as $topic_id) {
                $affected += (int) (bool) bb_delete_topic($topic_id, 0);
            }
            $query_vars = array('message' => 'undeleted', 'count' => $affected);
            break;
        default:
            if ($action) {
                $query_vars = apply_filters("bulk_topic__{$action}", array(), $topic_ids);
            }
            break;
    }
    bb_safe_redirect(add_query_arg($query_vars));
    exit;
}
if (!empty($_GET['message'])) {
    $message_count = isset($_GET['count']) ? (int) $_GET['count'] : 1;
    switch ((string) $_GET['message']) {
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:topics.php


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