本文整理汇总了PHP中delete_topic函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_topic函数的具体用法?PHP delete_topic怎么用?PHP delete_topic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_topic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_deletion
public function handle_deletion($is_topic_post, $id, $tid, $fid)
{
global $lang_delete;
require FEATHER_ROOT . 'include/search_idx.php';
if ($is_topic_post) {
// Delete the topic and all of its posts
delete_topic($tid);
update_forum($fid);
redirect(get_link('forum/' . $fid . '/'), $lang_delete['Topic del redirect']);
} else {
// Delete just this one post
delete_post($id, $tid);
update_forum($fid);
// Redirect towards the previous post
$post = DB::for_table('posts')->select('id')->where('topic_id', $tid)->where_lt('id', $id)->order_by_desc('id')->find_one();
redirect(get_link('post/' . $post['id'] . '/#p' . $post['id']), $lang_delete['Post del redirect']);
}
}
示例2: while
$all_id = '';
while ($row = $db->fetch_row($result)) {
$all_id .= ($all_id != '' ? ',' : '') . $row[0];
}
}
}
//Move post in the new topic
if ($all_id) {
$db->query('UPDATE ' . $db->prefix . 'posts SET topic_id=' . $new_topic_id . ' WHERE id IN(' . $all_id . ')') or error('Unable to update user last visit data', __FILE__, __LINE__, $db->error());
} else {
$db->query('UPDATE ' . $db->prefix . 'posts SET topic_id=' . $new_topic_id . ' WHERE id=' . $post_id) or error('Unable to update user last visit data', __FILE__, __LINE__, $db->error());
}
//Update topics and forum if required
update_topic($new_topic_id);
if ($del_old_topic || $all_id) {
delete_topic($old_topic_id);
update_forum($old_fid);
// Update the forum FROM which the topic was moved
if ($new_forum) {
update_forum($new_fid);
}
// Update the forum FROM which the topic was moved
require PUN_ROOT . 'include/search_idx.php';
// Bit silly should be probably improved: in order to remove the subject from the old topic, we need:
// 1. remove all the words (message and subject) from the search tables
// 2. add the words from the message only in the search tables !!!
strip_search_index($post_id);
update_search_index('post', $post_id, $message);
} else {
update_topic($old_topic_id);
if ($new_forum) {
示例3: message
$topic_post_id = $db->result($result);
$is_topic_post = $id == $topic_post_id ? true : false;
// Do we have permission to edit this post?
if (($pun_user['g_delete_posts'] == '0' || $pun_user['g_delete_topics'] == '0' && $is_topic_post || $cur_post['poster_id'] != $pun_user['id'] || $cur_post['closed'] == '1') && !$is_admmod) {
message($lang_common['No permission']);
}
// Load the delete.php language file
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/delete.php';
if (isset($_POST['delete'])) {
if ($is_admmod) {
confirm_referrer('delete.php');
}
require PUN_ROOT . 'include/search_idx.php';
if ($is_topic_post) {
// Delete the topic and all of it's posts
delete_topic($cur_post['tid']);
update_forum($cur_post['fid']);
redirect('viewforum.php?id=' . $cur_post['fid'], $lang_delete['Topic del redirect']);
} else {
// Delete just this one post
delete_post($id, $cur_post['tid']);
update_forum($cur_post['fid']);
redirect('viewtopic.php?id=' . $cur_post['tid'], $lang_delete['Post del redirect']);
}
}
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_delete['Delete post'];
require PUN_ROOT . 'header.php';
require PUN_ROOT . 'include/parser.php';
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="linkst">
示例4: delete_user
function delete_user($user_id, $delete_posts = false)
{
global $forum_db, $db_type, $forum_config;
$return = ($hook = get_hook('fn_delete_user_start')) ? eval($hook) : null;
if ($return != null) {
return;
}
// First we need to get some data on the user
$query = array('SELECT' => 'u.username, u.group_id, g.g_moderator', 'FROM' => 'users AS u', 'JOINS' => array(array('INNER JOIN' => 'groups AS g', 'ON' => 'g.g_id=u.group_id')), 'WHERE' => 'u.id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_get_user_data')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$user = $forum_db->fetch_assoc($result);
// Delete any subscriptions
$query = array('DELETE' => 'subscriptions', 'WHERE' => 'user_id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_delete_subscriptions')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Delete any subscriptions forum
$query = array('DELETE' => 'forum_subscriptions', 'WHERE' => 'user_id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_delete_forum_subscriptions')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Remove him/her from the online list (if they happen to be logged in)
$query = array('DELETE' => 'online', 'WHERE' => 'user_id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_delete_online')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Should we delete all posts made by this user?
if ($delete_posts) {
@set_time_limit(0);
// Find all posts made by this user
$query = array('SELECT' => 'p.id, p.topic_id, t.forum_id, t.first_post_id', 'FROM' => 'posts AS p', 'JOINS' => array(array('INNER JOIN' => 'topics AS t', 'ON' => 't.id=p.topic_id')), 'WHERE' => 'p.poster_id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_get_user_posts')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
while ($cur_post = $forum_db->fetch_assoc($result)) {
if ($cur_post['first_post_id'] == $cur_post['id']) {
delete_topic($cur_post['topic_id'], $cur_post['forum_id']);
} else {
delete_post($cur_post['id'], $cur_post['topic_id'], $cur_post['forum_id']);
}
}
} else {
// Set all his/her posts to guest
$query = array('UPDATE' => 'posts', 'SET' => 'poster_id=1', 'WHERE' => 'poster_id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_reset_user_posts')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
// Delete the user
$query = array('DELETE' => 'users', 'WHERE' => 'id=' . $user_id);
($hook = get_hook('fn_delete_user_qr_delete_user')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
// Delete user avatar
delete_avatar($user_id);
// If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums
// and regenerate the bans cache (in case he/she created any bans)
if ($user['group_id'] == FORUM_ADMIN || $user['g_moderator'] == '1') {
clean_forum_moderators();
// Regenerate the bans cache
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FORUM_ROOT . 'include/cache.php';
}
generate_bans_cache();
}
($hook = get_hook('fn_delete_user_end')) ? eval($hook) : null;
}
示例5: abs
$n = '&page=' . abs($n);
}
$path = $config['url_path'] . '/read.php?id=' . $delete_data['reply'] . $n;
print_out(lang('success_deleted_post'), lang('redirecting'), $path);
}
}
}
}
} else {
if (isset($_GET['delete_topic'])) {
if (alpha($_GET['delete_topic'], 'numeric')) {
// Try getting that data!
$delete_data = topic($_GET['delete_topic']);
// Is it their topic?
if ($delete_data['starter_id'] == $user_data['id']) {
$result = delete_topic($_GET['delete_topic']);
if ($result === "ID_INVALID") {
print_out(lang_parse('error_invalid_given', array(lang('id'))), lang('redirecting'));
} else {
if ($result === "DELETING_POSTS") {
print_out(lang('error_deleting_posts'), lang('redirecting'));
} else {
if ($result === "DELETING_TOPIC") {
print_out(lang('error_deleting_topic'), lang('redirecting'));
}
}
}
if (!$error) {
print_out(lang('success_deleted_topic'), lang('redirecting'));
}
}
示例6: delete
protected function delete()
{
global $db;
$params = array();
if ($this->method == "POST") {
if (sizeof($this->args) == 2) {
$type = $this->args[0];
$main_arg = $this->args[1];
if (is_numeric($main_arg)) {
if ($type == "subject") {
$params["sid"] = $main_arg;
return delete_subject($db, $params);
} else {
if ($type == "topic") {
$params["tid"] = $main_arg;
return delete_topic($db, $params);
} else {
if ($type == "section") {
$params["section_id"] = $main_arg;
return delete_section($db, $params);
} else {
if ($type == "example") {
$params["eid"] = $main_arg;
return delete_example($db, $params);
} else {
return "No such object exists in the database!";
}
}
}
}
} else {
return "The associated id needs to be a numerical value!";
}
} else {
return "This requires two parameters: the object type and associated id!";
}
} else {
return "This only accepts POST requests!";
}
}
示例7: mysql_connect
$title = "FaqForge - $context";
$dbLink = mysql_connect ($dbServer, $dbUser, $dbPass);
mysql_select_db ($dbName);
switch ( $action )
{
case "deleteTopic":
{
$message = delete_topic_test ( $id, $dbLink );
break;
}
case "DELETEtopic": // FAULT_3 WDM
{
delete_topic ( $id, $dbLink );
break;
}
case "addNewTopic":
{
add_new_topic ( $newTitle, $newParent, $newContext, $newOrder, $dbLink );
break;
}
case "commit":
{
update_page ( stripslashes($faqText), $pageId, $id, $dbLink );
break;
}
case "Update Topic":
{
$topicPublish = ( $topicPublish == "on" ) ? "y" : "n";
示例8: op_topic_del
function op_topic_del($id, $change, $reason, $check = false)
{
$topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . $id);
if ($check) {
$result['status'] = 1;
return $result;
}
if (check_user_auth("topic", "del")) {
require_once APP_ROOT_PATH . 'system/model/topic.php';
$del_result = delete_topic($id);
$o_reason = $reason;
$reason .= "分享被删除";
if ($change == 1) {
modify_account(get_op_change("topic", "del"), $topic['user_id'], $reason);
$reason .= get_op_change_show("topic", "del");
}
if ($change == 1 || $o_reason != "") {
send_msg($topic['user_id'], $reason, "notify", 0);
}
$result['status'] = 1;
} else {
$result['status'] = 0;
$result['info'] = "没有权限";
}
return $result;
}
示例9: redirect
redirect('viewforum.php?id=' . $cur_post['fid']);
} else {
// Reset just this one post
$db->query('UPDATE ' . $db->prefix . 'posts SET soft = 0 WHERE id=' . $id) or error('Unable to soft delete post', __FILE__, __LINE__, $db->error());
update_forum($cur_post['fid']);
// Redirect towards the comment
redirect('viewtopic.php?pid=' . $id . '#p' . $id);
}
}
if (isset($_POST['delete'])) {
// Make sure they got here from the site
confirm_referrer('delete.php');
require FORUM_ROOT . 'include/search_idx.php';
if ($is_topic_post) {
// Delete the thread and all of its posts
delete_topic($cur_post['tid'], "hard");
update_forum($cur_post['fid']);
redirect('viewforum.php?id=' . $cur_post['fid']);
} else {
// Delete just this one post
delete_post($id, $cur_post['tid'], $cur_post['poster_id']);
update_forum($cur_post['fid']);
// Redirect towards the previous post
$result = $db->query('SELECT id FROM ' . $db->prefix . 'posts WHERE topic_id=' . $cur_post['tid'] . ' AND id < ' . $id . ' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$post_id = $db->result($result);
redirect('viewtopic.php?pid=' . $post_id . '#p' . $post_id);
}
}
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Delete comment', 'luna'));
define('FORUM_ACTIVE_PAGE', 'delete');
require FORUM_ROOT . 'include/parser.php';
示例10: patch_topic
patch_topic($id);
?>
</li>
</ul>
</div>
<br />
<div class="table_main">
<div id="container">
<?php
// blocco topic
if (@$_POST['block'] == 1) {
manage_block_topic($username, $id);
}
// cancello topic
if (@$_POST['delete_topic'] == 1) {
delete_topic($username, $id);
}
// aggiunta nuovo messaggio
if (@$_GET['send'] == 1) {
insert_topic(@$_POST['reply'], $id);
}
// sposto topic
if (@$_GET['move_topic'] == 1) {
move_topic(@$_POST['move_t_id'], @$_POST['to_forum']);
}
// setta topic
if (@$_GET['set_topic'] == 1) {
set_topic(@$_POST['set_topic'], $id);
}
$t_id = check_t_id($id);
$query = "SELECT id, f_id, t_id, author, title, data, replyof, last, ora, date \n\t\t FROM " . __PREFIX__ . "topic \n\t\t WHERE id = '" . $id . "' \n\t\t OR replyof = '" . $id . "' \n\t\t ORDER BY id, last DESC";
示例11: delete_users
public function delete_users()
{
global $lang_admin_users;
if ($this->request->post('users')) {
$user_ids = is_array($this->request->post('users')) ? array_keys($this->request->post('users')) : explode(',', $this->request->post('users'));
$user_ids = array_map('intval', $user_ids);
// Delete invalid IDs
$user_ids = array_diff($user_ids, array(0, 1));
} else {
$user_ids = array();
}
if (empty($user_ids)) {
message($lang_admin_users['No users selected']);
}
// Are we trying to delete any admins?
$is_admin = DB::for_table('users')->where_in('id', $user_ids)->where('group_id', FEATHER_ADMIN)->find_one();
if ($is_admin) {
message($lang_admin_users['No delete admins message']);
}
if ($this->request->post('delete_users_comply')) {
// Fetch user groups
$user_groups = array();
$select_fetch_user_groups = array('id', 'group_id');
$result = DB::for_table('users')->select_many($select_fetch_user_groups)->where_in('id', $user_ids)->find_many();
foreach ($result as $cur_user) {
if (!isset($user_groups[$cur_user['group_id']])) {
$user_groups[$cur_user['group_id']] = array();
}
$user_groups[$cur_user['group_id']][] = $cur_user['id'];
}
// Are any users moderators?
$group_ids = array_keys($user_groups);
$select_fetch_user_mods = array('g_id', 'g_moderator');
$result = DB::for_table('groups')->select_many($select_fetch_user_mods)->where_in('g_id', $group_ids)->find_many();
foreach ($result as $cur_group) {
if ($cur_group['g_moderator'] == '0') {
unset($user_groups[$cur_group['g_id']]);
}
}
// Fetch forum list and clean up their moderator list
$select_mods = array('id', 'moderators');
$result = DB::for_table('forums')->select_many($select_mods)->find_many();
foreach ($result as $cur_forum) {
$cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
foreach ($user_groups as $group_users) {
$cur_moderators = array_diff($cur_moderators, $group_users);
}
if (!empty($cur_moderators)) {
DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set('moderators', serialize($cur_moderators))->save();
} else {
DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set_expr('moderators', 'NULL')->save();
}
}
// Delete any subscriptions
DB::for_table('topic_subscriptions')->where_in('user_id', $user_ids)->delete_many();
DB::for_table('forum_subscriptions')->where_in('user_id', $user_ids)->delete_many();
// Remove them from the online list (if they happen to be logged in)
DB::for_table('online')->where_in('user_id', $user_ids)->delete_many();
// Should we delete all posts made by these users?
if ($this->request->post('delete_posts')) {
require FEATHER_ROOT . 'include/search_idx.php';
@set_time_limit(0);
// Find all posts made by this user
$select_user_posts = array('p.id', 'p.topic_id', 't.forum_id');
$result = DB::for_table('posts')->table_alias('p')->select_many($select_user_posts)->inner_join('topics', array('t.id', '=', 'p.topic_id'), 't')->inner_join('forums', array('f.id', '=', 't.forum_id'), 'f')->where('p.poster_id', $user_ids)->find_many();
if ($result) {
foreach ($result as $cur_post) {
// Determine whether this post is the "topic post" or not
$result2 = DB::for_table('posts')->where('topic_id', $cur_post['topic_id'])->order_by('posted')->find_one_col('id');
if ($this->db->result($result2) == $cur_post['id']) {
delete_topic($cur_post['topic_id']);
} else {
delete_post($cur_post['id'], $cur_post['topic_id']);
}
update_forum($cur_post['forum_id']);
}
}
} else {
// Set all their posts to guest
DB::for_table('posts')->where_in('poster_id', '1')->update_many('poster_id', $user_ids);
}
// Delete the users
DB::for_table('users')->where_in('id', $user_ids)->delete_many();
// Delete user avatars
foreach ($user_ids as $user_id) {
delete_avatar($user_id);
}
// Regenerate the users info cache
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FEATHER_ROOT . 'include/cache.php';
}
generate_users_info_cache();
redirect(get_link('admin/users/'), $lang_admin_users['Users delete redirect']);
}
return $user_ids;
}
示例12: catch
$form->assign('nextCommand', 'exEditTopic');
$form->assign('topicTitle', $topicSettingList['topic_title']);
$dialogBox->form($form->render());
} catch (Exception $ex) {
if (claro_debug_mode()) {
$dialogBox->error('<pre>' . $ex->__toString() . '</pre>');
} else {
$dialogBox->error($ex->getMessage());
}
}
} else {
$dialogBox->error(get_lang('Unknown topic'));
}
break;
case 'exDelTopic':
if (delete_topic($topicId)) {
$dialogBox->success(get_lang('This topic has been deleted'));
} else {
$dialogBox->error(get_lang('Error while deleting topic'));
}
break;
//TODO : lock and notification commands should be handled by ajax calls
//TODO : lock and notification commands should be handled by ajax calls
case 'exLock':
if (set_topic_lock_status($topicId, true)) {
$dialogBox->success(get_lang('This topic is now locked'));
} else {
$dialogBox->error(get_lang('Error while updating topic lock status'));
}
break;
case 'exUnlock':
示例13: do_del_topic
public function do_del_topic()
{
global_run();
if (intval($GLOBALS['user_info']['id']) == 0) {
$result['status'] = 0;
$result['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
} else {
$id = intval($_REQUEST['id']);
$topic = $GLOBALS['db']->getRow("select id,user_id from " . DB_PREFIX . "topic where id = " . $id);
if (!$topic) {
$result['status'] = 0;
$result['info'] = $GLOBALS['lang']['TOPIC_NOT_EXIST'];
} else {
$count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where (fav_id = " . $id . " or (origin_id = " . $id . " and fav_id <> 0)) and user_id = " . intval($GLOBALS['user_info']['id']));
if ($count > 0) {
$result['status'] = 1;
require_once APP_ROOT_PATH . "system/model/topic.php";
$del_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "topic where (fav_id = " . $id . " or (origin_id = " . $id . " and fav_id <> 0)) and user_id = " . intval($GLOBALS['user_info']['id']));
$tid = delete_topic($del_id);
} else {
$result['status'] = 0;
$result['info'] = "你还没喜欢";
}
}
}
ajax_return($result);
}
示例14: update_forum
$db->update('users', $update, 'id=:id', $data);
}
}
update_forum($post['forum_id']);
redirect(panther_link($panther_url['admin_posts']), $lang_admin_posts['Post approved redirect']);
} else {
if (($panther_user['g_mod_sfs_report'] == '1' || $panther_user['is_admin']) && $action == '3' && $panther_config['o_sfs_api'] != '') {
//If the user wasn't a guest we need to get the email from the users table
$email = $post['poster_email'] == '' && $post['poster_id'] != 1 ? $post['email'] : $post['poster_email'];
//Reporting now made fun =)
if (!stopforumspam_report($panther_config['o_sfs_api'], $post['poster_ip'], $email, $post['poster'], $post['message'])) {
message($lang_common['Unable to add spam data']);
}
}
if ($is_topic_post) {
delete_topic($post['topic_id']);
update_forum($post['forum_id']);
} else {
delete_post($post_id, $post['topic_id']);
update_forum($post['forum_id']);
}
redirect(panther_link($panther_url['admin_posts']), $lang_admin_posts['Post deleted redirect']);
}
}
$data = array(':gid' => $panther_user['g_id']);
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Posts']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('posts');
$posts = array();
$ps = $db->run('SELECT t.id AS topic_id, t.forum_id, p.poster, p.poster_id, p.posted, p.message, p.id AS pid, p.hide_smilies, t.subject, f.forum_name, f.moderators FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON p.topic_id = t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON t.forum_id = f.id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=:gid) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.approved=0 AND p.deleted=0 ORDER BY p.posted DESC', $data);
示例15: create_topic
create_topic(Flight::request());
});
Flight::route('GET /topics', function () {
incl('get_topics');
get_topics(Flight::request());
});
Flight::route('/topics', function () {
method_not_allowed();
});
Flight::route('GET /topics/@topic_id', function ($topic_id) {
incl('get_topic');
get_topic($topic_id, Flight::request());
});
Flight::route('DELETE /topics/@topic_id', function ($topic_id) {
incl('delete_topic');
delete_topic($topic_id, Flight::request());
});
Flight::route('/topic/@topic_id', function ($topic_id) {
method_not_allowed();
});
Flight::route('POST /single_use/programming_language_test', function () {
incl('test_programming_language');
test_programming_language(Flight::request());
});
Flight::route('/single_use/programming_language_test', function () {
method_not_allowed();
});
Flight::route('POST /single_use/question_test', function () {
incl('test_question');
test_question(Flight::request());
});