• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update_forum函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了update_forum函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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']);
     }
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:18,代码来源:delete.php


示例2: intval

     $prune_from = $_POST['prune_from'];
     $prune_days = intval($_POST['prune_days']);
     $prune_date = $prune_days ? time() - $prune_days * 86400 : -1;
     @set_time_limit(0);
     if ($prune_from == 'all') {
         $result = $db->query('SELECT id FROM ' . $db->prefix . 'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
         $num_forums = $db->num_rows($result);
         for ($i = 0; $i < $num_forums; ++$i) {
             $fid = $db->result($result, $i);
             prune($fid, $_POST['prune_sticky'], $prune_date);
             update_forum($fid);
         }
     } else {
         $prune_from = intval($prune_from);
         prune($prune_from, $_POST['prune_sticky'], $prune_date);
         update_forum($prune_from);
     }
     // Locate any "orphaned redirect topics" and delete them
     $result = $db->query('SELECT t1.id FROM ' . $db->prefix . 'topics AS t1 LEFT JOIN ' . $db->prefix . 'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
     $num_orphans = $db->num_rows($result);
     if ($num_orphans) {
         for ($i = 0; $i < $num_orphans; ++$i) {
             $orphans[] = $db->result($result, $i);
         }
         $db->query('DELETE FROM ' . $db->prefix . 'topics WHERE id IN(' . implode(',', $orphans) . ')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
     }
     redirect('admin_prune.php', 'Posts pruned. Redirecting &hellip;');
 }
 $prune_days = $_POST['req_prune_days'];
 if (!@preg_match('#^\\d+$#', $prune_days)) {
     message('Days to prune must be a positive integer.');
开发者ID:patrickod,项目名称:City-Blogger,代码行数:31,代码来源:admin_prune.php


示例3: confirm_referrer

// 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">
	<div class="inbox">
		<ul><li><a href="index.php"><?php 
echo $lang_common['Index'];
?>
</a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php 
echo $cur_post['fid'];
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:31,代码来源:delete.php


示例4: VALUES

             // To subscribe or not to subscribe, that ...
             if ($pun_config['o_subscriptions'] == 1 && $_POST['subscribe'] == 1) {
                 $db->query('INSERT INTO ' . $db->prefix . 'subscriptions (user_id, topic_id) VALUES(' . $pun_user['id'] . ' ,' . $new_tid . ')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
             }
             // Create the post ("topic post")
             $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
         } else {
             // Create the post ("topic post")
             $email_sql = $pun_config['p_force_guest_email'] == 1 || $email ? '\'' . $db->escape($email) . '\'' : 'NULL';
             $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', \'' . get_remote_address() . '\', ' . $email_sql . ', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
         }
         $new_pid = $db->insert_id();
         // Update the topic with last_post_id
         $db->query('UPDATE ' . $db->prefix . 'topics SET last_post_id=' . $new_pid . ' WHERE id=' . $new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
         update_search_index('post', $new_pid, $message, $subject);
         update_forum($fid);
     }
 }
 generate_rss();
 $uploaded = 0;
 $upload_result = process_uploaded_files($fid ? $new_tid : $tid, $new_pid, $uploaded);
 // If the posting user is logged in, increment his/her post count
 // MERGE POSTS BEGIN
 if (!$pun_user['is_guest']) {
     if ($uploaded) {
         $add_files = 'num_files=num_files+' . $uploaded . ', ';
     } else {
         $add_files = '';
     }
     if ($merged) {
         $db->query('UPDATE ' . $db->prefix . 'users SET ' . $add_files . 'last_post=' . $_SERVER['REQUEST_TIME'] . ' WHERE id=' . $pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:31,代码来源:post.php


示例5: array

            }
            $update = array('deleted' => 0);
            $post_data = array(':id' => $post_id);
            $db->update('posts', $update, 'id=:id', $post_data);
            if (!defined('PANTHER_CJK_HANGUL_REGEX')) {
                require PANTHER_ROOT . 'include/search_idx.php';
            }
            update_search_index('post', $post_id, $post['message']);
            $ps = $db->select('posts', 'id, poster, posted', $topic_data, 'topic_id=:id AND approved=1 AND deleted=0', 'id DESC LIMIT 1');
            list($last_id, $poster, $posted) = $ps->fetch(PDO::FETCH_NUM);
            $ps = $db->select('topics', 'num_replies', $topic_data, 'id=:id');
            $num_replies = $ps->fetchColumn();
            $update = array('num_replies' => $num_replies + 1, 'last_post' => $posted, 'last_post_id' => $last_id, 'last_poster' => $poster);
            $db->update('topics', $update, 'id=:id', $topic_data);
            update_search_index('post', $post_id, $post['message']);
            update_forum($post['forum_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post approved redirect']);
        }
    } else {
        if ($is_topic_post) {
            permanently_delete_topic($post['topic_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Topic deleted redirect']);
        } else {
            permanently_delete_post($post_id);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post deleted redirect']);
        }
    }
}
$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 FROM ' . $db->prefix . 'posts AS p LEFT 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 WHERE p.deleted=1 OR t.deleted=1 ORDER BY p.posted DESC');
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Deleted']);
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:deleted.php


示例6: redirect

        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';
$cur_comment['message'] = parse_message($cur_comment['message']);
require load_page('header.php');
if ($action == "reset") {
    require load_page('reset.php');
}
if ($action == "soft") {
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:delete.php


示例7: delete_topics

 public function delete_topics($topics, $fid)
 {
     global $lang_misc, $lang_common;
     if (@preg_match('%[^0-9,]%', $topics)) {
         message($lang_common['Bad request'], '404');
     }
     require FEATHER_ROOT . 'include/search_idx.php';
     $topics_sql = explode(',', $topics);
     // Verify that the topic IDs are valid
     $result = DB::for_table('topics')->where_in('id', $topics_sql)->where('forum_id', $fid)->find_many();
     if (count($result) != substr_count($topics, ',') + 1) {
         message($lang_common['Bad request'], '404');
     }
     // Verify that the posts are not by admins
     if ($this->user->g_id != FEATHER_ADMIN) {
         $authorized = DB::for_table('posts')->where_in('topic_id', $topics_sql)->where('poster_id', get_admin_ids())->find_many();
         if ($authorized) {
             message($lang_common['No permission'], '403');
         }
     }
     // Delete the topics
     DB::for_table('topics')->where_in('id', $topics_sql)->delete_many();
     // Delete any redirect topics
     DB::for_table('topics')->where_in('moved_to', $topics_sql)->delete_many();
     // Delete any subscriptions
     DB::for_table('topic_subscriptions')->where_in('topic_id', $topics_sql)->delete_many();
     // Create a list of the post IDs in this topic and then strip the search index
     $find_ids = DB::for_table('posts')->select('id')->where_in('topic_id', $topics_sql)->find_many();
     foreach ($find_ids as $id) {
         $ids_post[] = $id['id'];
     }
     $post_ids = implode(', ', $ids_post);
     // We have to check that we actually have a list of post IDs since we could be deleting just a redirect topic
     if ($post_ids != '') {
         strip_search_index($post_ids);
     }
     // Delete posts
     DB::for_table('posts')->where_in('topic_id', $topics_sql)->delete_many();
     update_forum($fid);
     redirect(get_link('forum/' . $fid . '/'), $lang_misc['Delete topics redirect']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:41,代码来源:moderate.php


示例8: error

    $num_updated = 0;
    // Get name of new user
    $result = $db->query('SELECT username FROM ' . $db->prefix . 'users WHERE id=' . $new_user_id) or error('Unable to fetch username', __FILE__, __LINE__, $db->error());
    $new_username = $db->result($result);
    if ($new_username == '') {
        message('User id ' . $new_user_id . ' wasn\'t found.');
    }
    // Update all posts
    foreach ($posts as $cur_post_id) {
        $num_updated += update_post_author($cur_post_id, $new_user_id, $new_username);
    }
    // Get all forums
    $result = $db->query('SELECT id FROM ' . $db->prefix . 'forums') or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
    // Update all forums
    while ($cur_forum = $db->fetch_assoc($result)) {
        update_forum($cur_forum['id']);
    }
    redirect($_SERVER['REQUEST_URI'], 'Changed author to "' . pun_htmlspecialchars($new_username) . '" for ' . $num_updated . ' post(s).');
} else {
    if (isset($_POST['sync_post_counts'])) {
        // Synchronize user post counts
        $db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $db->prefix . 'post_counts SELECT poster_id, count(*) as new_num FROM ' . $db->prefix . 'posts GROUP BY poster_id') or error('Creating temporary table failed', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE ' . $db->prefix . 'users SET num_posts=0') or error('Could not reset post counts', __FILE__, __LINE__, $db->error());
        // Zero posts
        $db->query('UPDATE ' . $db->prefix . 'users, ' . $db->prefix . 'post_counts SET num_posts=new_num WHERE id=poster_id') or error('Could not update post counts', __FILE__, __LINE__, $db->error());
        redirect($_SERVER['REQUEST_URI'], 'Post counts synchronized');
    }
}
if (isset($_POST['menu'])) {
    $user_field = array('<td>', "\t\t\t\t\t\t\t\t\t" . '<select name="">');
    $result = $db->query('SELECT id, username FROM ' . $db->prefix . 'users WHERE id > 1 ORDER BY username ASC') or error('Unable to get user list', __FILE__, __LINE__, $db->error());
开发者ID:nikorwell,项目名称:plugins,代码行数:31,代码来源:AP_Author_Update.php


示例9: setMessage

 /**
  * setMessage
  *
  * @param array $args
  * @return array
  * @throws Exception
  */
 public function setMessage($args)
 {
     $message = $args['message'];
     $topicId = $args['topicId'];
     $hideSmiles = $args['hideSmiles'];
     $topicId = intval($topicId);
     if ($topicId <= 0) {
         throw new Exception($this->_lang['Bad request']);
     }
     if ($this->_pun_user['is_guest']) {
         throw new Exception($this->_lang['Bad request']);
     }
     if ($this->_pun_user['last_post'] && $_SERVER['REQUEST_TIME'] - $this->_pun_user['last_post'] < $this->_pun_user['g_post_flood']) {
         throw new Exception($this->_lang['Bad request']);
     }
     // Clean up message
     $message = pun_linebreaks(pun_trim($message));
     if (!$message) {
         throw new Exception($this->_lang['Bad request']);
     } else {
         if (mb_strlen($message) > 65535) {
             throw new Exception($this->_lang['Bad request']);
         } else {
             if (!$this->_pun_config['p_message_all_caps'] && mb_strtoupper($message) == $message && $this->_pun_user['g_id'] > PUN_MOD) {
                 $message = ucwords(mb_strtolower($message));
             }
         }
     }
     convert_forum_url($message);
     // Insert the new post
     $r = $this->_db->query('
         INSERT INTO ' . $this->_db->prefix . 'posts (
             poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id
         ) VALUES (
             \'' . $this->_db->escape($this->_pun_user['username']) . '\',
             ' . $this->_pun_user['id'] . ',
             \'' . get_remote_address() . '\',
             \'' . $this->_db->escape($message) . '\',
             \'' . intval($hideSmiles) . '\',
             ' . $_SERVER['REQUEST_TIME'] . ',
             ' . $topicId . '
         )
     ');
     if (!$r) {
         throw new Exception($this->_db->error());
     }
     if (!$this->_db->affected_rows()) {
         throw new Exception($this->_lang['Bad request']);
     }
     $id = $this->_db->insert_id();
     // Count number of replies in the topic
     $result = $this->_db->query('
         SELECT COUNT(1)
         FROM ' . $this->_db->prefix . 'posts
         WHERE topic_id=' . $topicId);
     $num_replies = $this->_db->result($result, 0) - 1;
     // Update topic
     $this->_db->query('
         UPDATE ' . $this->_db->prefix . 'topics
         SET num_replies=' . $num_replies . ',
         last_post=' . $_SERVER['REQUEST_TIME'] . ',
         last_post_id=' . $id . ',
         last_poster=\'' . $this->_db->escape($this->_pun_user['username']) . '\'
         WHERE id=' . $topicId);
     //update_search_index('post', $id, $message);
     $result = $this->_db->query('
         SELECT f.id
         FROM ' . $this->_db->prefix . 'topics AS t
         INNER JOIN ' . $this->_db->prefix . 'forums AS f ON f.id=t.forum_id
         LEFT JOIN ' . $this->_db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $this->_pun_user['g_id'] . ')
         WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=' . $topicId);
     $forumId = $this->_db->result($result, 0);
     update_forum($forumId);
     generate_rss();
     return array('message' => $this->_parseMessage($message, $hideSmiles), 'poster' => $this->_pun_user['username'], 'posted' => $_SERVER['REQUEST_TIME']);
 }
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:83,代码来源:Informer.inc.php


示例10: insert_topic

 public function insert_topic($post, $fid)
 {
     $new = array();
     // Create the topic
     $insert_topic = array('poster' => $post['username'], 'subject' => $post['subject'], 'posted' => $post['time'], 'last_post' => $post['time'], 'last_poster' => $post['username'], 'sticky' => $post['stick_topic'], 'forum_id' => $fid);
     DB::for_table('topics')->create()->set($insert_topic)->save();
     $new['tid'] = DB::get_db()->lastInsertId($this->feather->prefix . 'topics');
     if (!$this->user->is_guest) {
         // To subscribe or not to subscribe, that ...
         if ($this->config['o_topic_subscriptions'] == '1' && $post['subscribe']) {
             $insert_subscription = array('user_id' => $this->user->id, 'topic_id' => $new['tid']);
             DB::for_table('topic_subscriptions')->create()->set($insert_subscription)->save();
         }
         // Create the post ("topic post")
         $insert_post = array('poster' => $post['username'], 'poster_id' => $this->user->id, 'poster_ip' => get_remote_address(), 'message' => $post['message'], 'hide_smilies' => $post['hide_smilies'], 'posted' => $post['time'], 'topic_id' => $new['tid']);
         DB::for_table('posts')->create()->set($insert_post)->save();
     } else {
         // It's a guest
         // Create the post ("topic post")
         $insert_post = array('poster' => $post['username'], 'poster_ip' => get_remote_address(), 'message' => $post['message'], 'hide_smilies' => $post['hide_smilies'], 'posted' => $post['time'], 'topic_id' => $new['tid']);
         if ($this->config['p_force_guest_email'] == '1' || $post['email'] != '') {
             $insert_post['poster_email'] = $post['email'];
         }
         DB::for_table('posts')->create()->set($insert_post)->save();
     }
     $new['pid'] = DB::get_db()->lastInsertId($this->feather->prefix . 'topics');
     // Update the topic with last_post_id
     $update_topic = array('last_post_id' => $new['pid'], 'first_post_id' => $new['pid']);
     DB::for_table('topics')->where('id', $new['tid'])->find_one()->set($update_topic)->save();
     update_search_index('post', $new['pid'], $post['message'], $post['subject']);
     update_forum($fid);
     return $new;
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:33,代码来源:post.php


示例11: prune_comply

 public function prune_comply($prune_from, $prune_sticky)
 {
     global $lang_admin_maintenance;
     $prune_days = intval($this->request->post('prune_days'));
     $prune_date = $prune_days ? time() - $prune_days * 86400 : -1;
     @set_time_limit(0);
     if ($prune_from == 'all') {
         $result = DB::for_table('forums')->select('id')->find_array();
         if (!empty($result)) {
             foreach ($result as $row) {
                 $this->prune($row['id'], $prune_sticky, $prune_date);
                 update_forum($row['id']);
             }
         }
     } else {
         $prune_from = intval($prune_from);
         $this->prune($prune_from, $prune_sticky, $prune_date);
         update_forum($prune_from);
     }
     // Locate any "orphaned redirect topics" and delete them
     $result = DB::for_table('topics')->table_alias('t1')->select('t1.id')->left_outer_join('topics', array('t1.moved_to', '=', 't2.id'), 't2')->where_null('t2.id')->where_not_null('t1.moved_to')->find_array();
     $orphans = array();
     if (!empty($result)) {
         foreach ($result as $row) {
             $orphans[] = $row['id'];
         }
         DB::for_table('topics')->where_in('id', $orphans)->delete_many();
     }
     redirect(get_link('admin/maintenance/'), $lang_admin_maintenance['Posts pruned redirect']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:30,代码来源:maintenance.php


示例12: time

    }
    $now = time();
    $i = 0;
    $_POST['message'] = pun_linebreaks(pun_trim($_POST['message']));
    while ($i < count($_POST['forums'])) {
        $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, sticky, closed)
			VALUES(\'' . $db->escape($pun_user['username']) . '\', \'' . $db->escape($_POST['subject']) . '\', ' . $now . ', ' . $now . ',
			       \'' . $db->escape($pun_user['username']) . '\', ' . $_POST['forums'][$i] . ', ' . $_POST['sticky'] . ', ' . $_POST['close'] . ')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
        $new_tid = $db->insert_id();
        $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id)
			VALUES(\'' . $db->escape($pun_user['username']) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\',
			       \'' . $db->escape($_POST['message']) . '\', \'0\', ' . $now . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
        $new_pid = $db->insert_id();
        $db->query('UPDATE ' . $db->prefix . 'topics SET last_post_id=' . $new_pid . ' WHERE id=' . $new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
        update_search_index('post', $new_pid, $_POST['message'], $_POST['subject']);
        update_forum($_POST['forums'][$i]);
        $i++;
    }
    redirect('admin_loader.php?plugin=AMP_Global_topic.php', 'Topic(s) Added');
} elseif (isset($_POST['update'])) {
    if (empty($_POST['subject']) || empty($_POST['message'])) {
        message('Missing Fields');
    }
    $_POST['message'] = pun_linebreaks(pun_trim($_POST['message']));
    $db->query('UPDATE ' . $db->prefix . 'topics SET subject=\'' . $db->escape($_POST['subject']) . '\'
		WHERE subject=\'' . $db->escape($_POST['old_subject']) . '\' AND posted=' . $db->escape($_POST['old_posted'])) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
    $result = $db->query('SELECT p.id FROM ' . $db->prefix . 'posts as p LEFT JOIN ' . $db->prefix . 'topics as t ON t.id=p.topic_id
		WHERE t.subject=\'' . $db->escape($_POST['subject']) . '\' AND t.posted=' . $db->escape($_POST['old_posted'])) or error('Unable to get post ids', __FILE__, __LINE__, $db->error());
    while ($cur_post = $db->fetch_assoc($result)) {
        $db->query('UPDATE ' . $db->prefix . 'posts SET message=\'' . $db->escape($_POST['message']) . '\' WHERE id=' . $cur_post['id']) or error('Unable to update post', __FILE__, __LINE__, $db->error());
    }
开发者ID:nikorwell,项目名称:plugins,代码行数:31,代码来源:AMP_Global_topic.php


示例13: 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;
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:96,代码来源:users.php


示例14: error

        // And the search index revision number
        $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . UPDATE_TO_SI_REVISION . '\' WHERE conf_name = \'o_searchindex_revision\'') or error('Unable to update search index revision number', __FILE__, __LINE__, $db->error());
        // And the parser revision number
        $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . UPDATE_TO_PARSER_REVISION . '\' WHERE conf_name = \'o_parser_revision\'') or error('Unable to update parser revision number', __FILE__, __LINE__, $db->error());
        // Check the default language still exists!
        if (!file_exists(PUN_ROOT . 'lang/' . $pun_config['o_default_lang'] . '/common.php')) {
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'English\' WHERE conf_name = \'o_default_lang\'') or error('Unable to update default language', __FILE__, __LINE__, $db->error());
        }
        // Check the default style still exists!
        if (!file_exists(PUN_ROOT . 'style/' . $pun_config['o_default_style'] . '.css')) {
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'Air\' WHERE conf_name = \'o_default_style\'') or error('Unable to update default style', __FILE__, __LINE__, $db->error());
        }
        // This feels like a good time to synchronize the forums
        $result = $db->query('SELECT id FROM ' . $db->prefix . 'forums') or error('Unable to fetch forum IDs', __FILE__, __LINE__, $db->error());
        while ($row = $db->fetch_row($result)) {
            update_forum($row[0]);
        }
        // Empty the PHP cache
        forum_clear_cache();
        // Delete the update lock file
        @unlink(FORUM_CACHE_DIR . 'db_update.lock');
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        echo $lang_common['lang_identifier'];
        ?>
" lang="<?php 
        echo $lang_common['lang_identifier'];
        ?>
" dir="<?php 
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:31,代码来源:db_update.php


示例15: message

        message('The forum you specified to merge from does not exist.');
    }
    $result = $db->query("SELECT * FROM " . $db->prefix . "forums WHERE id=" . $forum2);
    if ($db->num_rows($result) == '0') {
        message('The forum you specified to merge to does not exist.');
    }
    //Make sure the forums being merged aren't the same
    if ($forum1 == $forum2) {
        message('The forums you specified are the same.');
    }
    //Run the update query.
    $db->query("UPDATE " . $db->prefix . "topics set forum_id=" . $forum2 . " where forum_id=" . $forum1);
    //Delete the old forum
    $db->query("DELETE FROM " . $db->prefix . "forums WHERE id = " . $forum1);
    //Update the forum last post, etc.
    update_forum($forum2);
    // Display the admin navigation menu
    generate_admin_menu($plugin);
    ?>
	<div class="block">
		<h2><span>Forum Merge Plugin</span></h2>
		<div class="box">
			<div class="inbox">
				<p>Forums Merged.</p>
			</div>
		</div>
	</div>
<?php 
} else {
    // Display the admin navigation menu
    generate_admin_menu($plugin);
开发者ID:nikorwell,项目名称:plugins,代码行数:31,代码来源:AP_Merge_Forums.php


示例16: update_forum

         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) {
             update_forum($old_fid);
             // Update the forum FROM which the topic was moved
             update_forum($new_fid);
             // Update the forum TO which the topic was moved
         }
     }
     redirect('viewtopic.php?pid=' . $post_id . '#p' . $post_id, $lang_movepost['Mark move redirect']);
 } else {
     //Count the topics to diplayed
     $result = $db->query('SELECT count(id) FROM ' . $db->prefix . 'topics WHERE forum_id =' . $fid . ' AND moved_to IS NULL') or error('Unable to count topics in forum', __FILE__, __LINE__, $db->error());
     $num_topics = $db->result($result);
     //Not add the original topic
     if ($fid == $old_fid) {
         $num_topics = $num_topics - 1;
     }
     //Sort query (based on $_GET['new_fid'], $_GET['sort'] and $_GET['desc'])
     $var_query_img = $var_query = '';
     if (isset($_GET['new_fid'])) {
开发者ID:neofutur,项目名称:MyBestBB,代码行数:31,代码来源:movepost.php


示例17: delete_user

 public function delete_user($id)
 {
     global $lang_profile;
     // Get the username and group of the user we are deleting
     $select_info_delete_user = array('group_id', 'username');
     $result = DB::for_table('users')->where('id', $id)->select_many($select_info_delete_user)->find_one();
     $group_id = $result['group_id'];
     $username = $result['username'];
     if ($group_id == FEATHER_ADMIN) {
         message($lang_profile['No delete admin message']);
     }
     if ($this->request->post('delete_user_comply')) {
         // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums as well
         $group_mod = DB::for_table('groups')->where('g_id', $group_id)->find_one_col('g_moderator');
         if ($group_id == FEATHER_ADMIN || $group_mod == '1') {
             $select_info_delete_moderators = array('id', 'moderators');
             $result = DB::for_table('forums')->select_many($select_info_delete_moderators)->find_many();
             foreach ($result as $cur_forum) {
                 $cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
                 if (in_array($id, $cur_moderators)) {
                     unset($cur_moderators[$username]);
                     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('user_id', $id)->delete_many();
         DB::for_table('forum_subscriptions')->where('user_id', $id)->delete_many();
         // Remove him/her from the online list (if they happen to be logged in)
         DB::for_table('online')->where('user_id', $id)->delete_many();
         // Should we delete all posts made by this user?
         if ($this->request->post('delete_posts')) {
             require FEATHER_ROOT . 'include/search_idx.php';
             // Hold on, this could take some time!
             @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', $id)->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 his/her posts to guest
             DB::for_table('posts')->where_in('poster_id', '1')->update_many('poster_id', $id);
         }
         // Delete the user
         DB::for_table('users')->where('id', $id)->delete_many();
         // Delete user avatar
         delete_avatar($id);
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
         if ($group_id == FEATHER_ADMIN) {
             generate_admins_cache();
         }
         redirect(get_base_url(), $lang_profile['User delete redirect']);
     }
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:73,代码来源:profile.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP update_forum_tracking_info函数代码示例发布时间:2022-05-23
下一篇:
PHP update_fix_compatibility函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap