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

PHP update_search_index函数代码示例

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

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



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

示例1: get_query_str

 public function get_query_str()
 {
     global $lang_admin_maintenance;
     $query_str = '';
     $per_page = $this->request->get('i_per_page') ? intval($this->request->get('i_per_page')) : 0;
     $start_at = $this->request->get('i_start_at') ? intval($this->request->get('i_start_at')) : 0;
     require FEATHER_ROOT . 'include/search_idx.php';
     // Fetch posts to process this cycle
     $select_get_query_str = array('p.id', 'p.message', 't.subject', 't.first_post_id');
     $result = DB::for_table('posts')->table_alias('p')->select_many($select_get_query_str)->inner_join('topics', array('t.id', '=', 'p.topic_id'), 't')->where_gte('p.id', $start_at)->order_by_asc('p.id')->limit($per_page)->find_many();
     $end_at = 0;
     foreach ($result as $cur_item) {
         echo '<p><span>' . sprintf($lang_admin_maintenance['Processing post'], $cur_item['id']) . '</span></p>' . "\n";
         if ($cur_item['id'] == $cur_item['first_post_id']) {
             update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
         } else {
             update_search_index('post', $cur_item['id'], $cur_item['message']);
         }
         $end_at = $cur_item['id'];
     }
     // Check if there is more work to do
     if ($end_at > 0) {
         $id = DB::for_table('posts')->where_gt('id', $end_at)->order_by_asc('id')->find_one_col('id');
         if ($id) {
             $query_str = '?action=rebuild&i_per_page=' . $per_page . '&i_start_at=' . intval($id);
         }
     }
     $pdo = DB::get_db();
     $pdo = null;
     return $query_str;
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:31,代码来源:maintenance.php


示例2: add_post

function add_post($post_info, &$new_pid)
{
    global $forum_db, $db_type, $forum_config, $lang_common;
    $return = ($hook = get_hook('fn_add_post_start')) ? eval($hook) : null;
    if ($return != null) {
        return;
    }
    // Add the post
    $query = array('INSERT' => 'poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id', 'INTO' => 'posts', 'VALUES' => '\'' . $forum_db->escape($post_info['poster']) . '\', ' . $post_info['poster_id'] . ', \'' . $forum_db->escape(get_remote_address()) . '\', \'' . $forum_db->escape($post_info['message']) . '\', ' . $post_info['hide_smilies'] . ', ' . $post_info['posted'] . ', ' . $post_info['topic_id']);
    // If it's a guest post, there might be an e-mail address we need to include
    if ($post_info['is_guest'] && $post_info['poster_email'] != null) {
        $query['INSERT'] .= ', poster_email';
        $query['VALUES'] .= ', \'' . $forum_db->escape($post_info['poster_email']) . '\'';
    }
    ($hook = get_hook('fn_add_post_qr_add_post')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $new_pid = $forum_db->insert_id();
    if (!$post_info['is_guest']) {
        // Subscribe or unsubscribe?
        if ($post_info['subscr_action'] == 1) {
            $query = array('INSERT' => 'user_id, topic_id', 'INTO' => 'subscriptions', 'VALUES' => $post_info['poster_id'] . ' ,' . $post_info['topic_id']);
            ($hook = get_hook('fn_add_post_qr_add_subscription')) ? eval($hook) : null;
            $forum_db->query_build($query) or error(__FILE__, __LINE__);
        } else {
            if ($post_info['subscr_action'] == 2) {
                $query = array('DELETE' => 'subscriptions', 'WHERE' => 'topic_id=' . $post_info['topic_id'] . ' AND user_id=' . $post_info['poster_id']);
                ($hook = get_hook('fn_add_post_qr_delete_subscription')) ? eval($hook) : null;
                $forum_db->query_build($query) or error(__FILE__, __LINE__);
            }
        }
    }
    // Count number of replies in the topic
    $query = array('SELECT' => 'COUNT(p.id)', 'FROM' => 'posts AS p', 'WHERE' => 'p.topic_id=' . $post_info['topic_id']);
    ($hook = get_hook('fn_add_post_qr_get_topic_reply_count')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $num_replies = $forum_db->result($result, 0) - 1;
    // Update topic
    $query = array('UPDATE' => 'topics', 'SET' => 'num_replies=' . $num_replies . ', last_post=' . $post_info['posted'] . ', last_post_id=' . $new_pid . ', last_poster=\'' . $forum_db->escape($post_info['poster']) . '\'', 'WHERE' => 'id=' . $post_info['topic_id']);
    ($hook = get_hook('fn_add_post_qr_update_topic')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    sync_forum($post_info['forum_id']);
    if (!defined('FORUM_SEARCH_IDX_FUNCTIONS_LOADED')) {
        require FORUM_ROOT . 'include/search_idx.php';
    }
    update_search_index('post', $new_pid, $post_info['message']);
    send_subscriptions($post_info, $new_pid);
    // Increment user's post count & last post time
    if (isset($post_info['update_user'])) {
        if ($post_info['is_guest']) {
            $query = array('UPDATE' => 'online', 'SET' => 'last_post=' . $post_info['posted'], 'WHERE' => 'ident=\'' . $forum_db->escape(get_remote_address()) . '\'');
        } else {
            $query = array('UPDATE' => 'users', 'SET' => 'num_posts=num_posts+1, last_post=' . $post_info['posted'], 'WHERE' => 'id=' . $post_info['poster_id']);
        }
        ($hook = get_hook('fn_add_post_qr_update_last_post')) ? eval($hook) : null;
        $forum_db->query_build($query) or error(__FILE__, __LINE__);
    }
    // If the posting user is logged in update his/her unread indicator
    if (!$post_info['is_guest'] && isset($post_info['update_unread']) && $post_info['update_unread']) {
        $tracked_topics = get_tracked_topics();
        $tracked_topics['topics'][$post_info['topic_id']] = time();
        set_tracked_topics($tracked_topics);
    }
    ($hook = get_hook('fn_add_post_end')) ? eval($hook) : null;
}
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:64,代码来源:functions.php


示例3: VALUES

 if (!$luna_user['is_guest']) {
     // To subscribe or not to subscribe, that ...
     if ($luna_config['o_thread_subscriptions'] == '1' && $subscribe) {
         $db->query('INSERT INTO ' . $db->prefix . 'thread_subscriptions (user_id, thread_id) VALUES(' . $luna_user['id'] . ' ,' . $new_tid . ')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
     }
     // Create the comment ("thread comment")
     $db->query('INSERT INTO ' . $db->prefix . 'comments (commenter, commenter_id, commenter_ip, message, hide_smilies, commented, thread_id) VALUES(\'' . $db->escape($username) . '\', ' . $luna_user['id'] . ', \'' . $db->escape(get_remote_address()) . '\', \'' . $db->escape($message) . '\', ' . $hide_smilies . ', ' . $now . ', ' . $new_tid . ')') or error('Unable to create comment', __FILE__, __LINE__, $db->error());
 } else {
     // Create the comment ("thread comment")
     $email_sql = $luna_config['p_force_guest_email'] == '1' || $email != '' ? '\'' . $db->escape($email) . '\'' : 'NULL';
     $db->query('INSERT INTO ' . $db->prefix . 'comments (commenter, commenter_ip, commenter_email, message, hide_smilies, commented, thread_id) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape(get_remote_address()) . '\', ' . $email_sql . ', \'' . $db->escape($message) . '\', ' . $hide_smilies . ', ' . $now . ', ' . $new_tid . ')') or error('Unable to create comment', __FILE__, __LINE__, $db->error());
 }
 $new_pid = $db->insert_id();
 // Update the thread with last_comment_id
 $db->query('UPDATE ' . $db->prefix . 'threads SET last_comment_id=' . $new_pid . ', first_comment_id=' . $new_pid . ' WHERE id=' . $new_tid) or error('Unable to update thread', __FILE__, __LINE__, $db->error());
 update_search_index('comment', $new_pid, $message, $subject);
 update_forum($fid);
 // Should we send out notifications?
 if ($luna_config['o_forum_subscriptions'] == '1') {
     // Get any subscribed users that should be notified (banned users are excluded)
     $result = $db->query('SELECT u.id, u.email, u.notify_with_comment, u.language FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'forum_subscriptions AS s ON u.id=s.user_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=' . $cur_commenting['fid'] . ' AND fp.group_id=u.group_id) LEFT JOIN ' . $db->prefix . 'bans AS b ON u.username=b.username WHERE b.username IS NULL AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.forum_id=' . $cur_commenting['fid'] . ' AND u.id!=' . $luna_user['id']) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
     if ($db->num_rows($result)) {
         require_once LUNA_ROOT . 'include/email.php';
         $notification_emails = array();
         if ($luna_config['o_censoring'] == '1') {
             $cleaned_message = bbcode2email($censored_message, -1);
         } else {
             $cleaned_message = bbcode2email($message, -1);
         }
         // Loop through subscribed users and send emails
         while ($cur_subscriber = $db->fetch_assoc($result)) {
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:comment.php


示例4: setval

                 break;
             case 'pgsql':
                 $db->query('SELECT setval(\'' . $db->prefix . 'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error());
                 break;
         }
     }
     require LUNA_ROOT . 'include/search_idx.php';
     // Fetch comments to process this cycle
     $result = $db->query('SELECT p.id, p.message, t.subject, t.first_comment_id FROM ' . $db->prefix . 'comments AS p INNER JOIN ' . $db->prefix . 'threads AS t ON t.id=p.thread_id WHERE p.id > ' . $start_at . ' ORDER BY p.id ASC LIMIT ' . PER_PAGE) or error('Unable to fetch comments', __FILE__, __LINE__, $db->error());
     $end_at = 0;
     while ($cur_item = $db->fetch_assoc($result)) {
         echo sprintf(__('Rebuilding index for %1$s %2$s', 'luna'), __('comment', 'luna'), $cur_item['id']) . '<br />' . "\n";
         if ($cur_item['id'] == $cur_item['first_comment_id']) {
             update_search_index('comment', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
         } else {
             update_search_index('comment', $cur_item['id'], $cur_item['message']);
         }
         $end_at = $cur_item['id'];
     }
     // Check if there is more work to do
     if ($end_at > 0) {
         $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'comments WHERE id > ' . $end_at . ' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
         if ($db->num_rows($result) > 0) {
             $query_str = '?stage=rebuild_idx&start_at=' . $end_at;
         }
     }
     break;
     // Show results page
 // Show results page
 case 'finish':
     // Give a "Success" notifcation
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:db_update.php


示例5: intval

                        if ($db->num_rows($tagged_res)) {
                            $tagged_id = $db->fetch_assoc($tagged_res);
                            if ($tagged_id['block_notif'] == 0) {
                                $db->query('INSERT INTO `#^notifications` (type, user, send_time, contents, arguments)
							VALUES (\'notification\', ' . intval($tagged_id['id']) . ', ' . time() . ', ' . $pid . ', \'' . $futurebb_user['username'] . ',' . $db->escape($cur_topic['subject']) . '\')');
                            }
                        }
                    }
                }
            }
            // Continue posting
            $db->query('UPDATE `#^topics` SET last_post=' . time() . ',last_post_id=' . $pid . ',num_replies=num_replies+1 WHERE id=' . $tid) or error('Failed to update topic info', __FILE__, __LINE__, $db->error());
            $db->query('UPDATE `#^forums` SET last_post=' . time() . ',last_post_id=' . $pid . ($cur_topic['deleted'] ? '' : ',num_posts=num_posts+1') . ' WHERE id=' . $cur_topic['f_id']) or error('Failed to forum last post', __FILE__, __LINE__, $db->error());
            $db->query('DELETE FROM `#^read_tracker` WHERE (forum_id=' . $cur_topic['f_id'] . ' OR topic_id=' . $tid . ') AND user_id<>' . $futurebb_user['id']) or error('Failed to update read tracker', __FILE__, __LINE__, $db->error());
            $db->query('UPDATE `#^users` SET num_posts=num_posts+1 WHERE id=' . $futurebb_user['id']) or error('Failed to update number of posts', __FILE__, __LINE__, $db->error());
            update_search_index($pid, $_POST['message']);
            ExtensionConfig::run_hooks('new_post', array('id' => $pid, 'topic' => $cur_topic['subject'], 'topic_url' => $cur_topic['url'], 'poster' => $futurebb_user['username'], 'message' => $_POST['message'], 'forum_url' => $cur_topic['forum_url'], 'forum' => $cur_topic['forum_name']));
            redirect($base_config['baseurl'] . '/posts/' . $pid);
            return;
        } else {
            if (isset($_POST['preview']) && empty($errors)) {
                echo '<div class="quotebox preview">' . BBCodeController::parse_msg($_POST['message'], !isset($_POST['hidesmilies']), true, $futurebb_config['enable_bbcode']) . '</div>';
            }
        }
    }
}
if (isset($errors) && !empty($errors)) {
    echo '<p>' . translate('errordesc') . '<ul>';
    foreach ($errors as $val) {
        echo '<li>' . $val . '</li>';
    }
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:post.php


示例6: setval

                 break;
             case 'pgsql':
                 $db->query('SELECT setval(\'' . $db->prefix . 'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error());
                 break;
         }
     }
     require PUN_ROOT . 'include/search_idx.php';
     // Fetch posts to process this cycle
     $result = $db->query('SELECT p.id, p.message, t.subject, t.first_post_id FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id WHERE p.id > ' . $start_at . ' ORDER BY p.id ASC LIMIT ' . PER_PAGE) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
     $end_at = 0;
     while ($cur_item = $db->fetch_assoc($result)) {
         echo sprintf($lang_update['Rebuilding index item'], $lang_update['post'], $cur_item['id']) . '<br />' . "\n";
         if ($cur_item['id'] == $cur_item['first_post_id']) {
             update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
         } else {
             update_search_index('post', $cur_item['id'], $cur_item['message']);
         }
         $end_at = $cur_item['id'];
     }
     // Check if there is more work to do
     if ($end_at > 0) {
         $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'posts WHERE id > ' . $end_at . ' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
         if ($db->num_rows($result) > 0) {
             $query_str = '?stage=rebuild_idx&start_at=' . $end_at;
         }
     }
     break;
     // Show results page
 // Show results page
 case 'finish':
     // We update the version number
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:31,代码来源:db_update.php


示例7: error

    // Fetch posts to process
    $result = $db->query('SELECT DISTINCT t.id, p.id, p.message FROM ' . $db->prefix . 'topics AS t INNER JOIN ' . $db->prefix . 'posts AS p ON t.id=p.topic_id WHERE t.id>=' . $start_at . ' AND t.id<' . $end_at . ' ORDER BY t.id') or error('Unable to fetch topic/post info', __FILE__, __LINE__, $db->error());
    $cur_topic = 0;
    while ($cur_post = $db->fetch_row($result)) {
        if ($cur_post[0] != $cur_topic) {
            // Fetch subject and ID of first post in topic
            $result2 = $db->query('SELECT p.id, t.subject, MIN(p.posted) AS first FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id WHERE t.id=' . $cur_post[0] . ' GROUP BY p.id, t.subject ORDER BY first LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
            list($first_post, $subject) = $db->fetch_row($result2);
            $cur_topic = $cur_post[0];
        }
        echo 'Processing post <strong>' . $cur_post[1] . '</strong> in topic <strong>' . $cur_post[0] . '</strong><br />' . "\n";
        if ($cur_post[1] == $first_post) {
            // This is the "topic post" so we have to index the subject as well
            update_search_index('post', $cur_post[1], $cur_post[2], $subject);
        } else {
            update_search_index('post', $cur_post[1], $cur_post[2]);
        }
    }
    // Check if there is more work to do
    $result = $db->query('SELECT id FROM ' . $db->prefix . 'topics WHERE id>' . $end_at) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    $query_str = $db->num_rows($result) ? '?i_per_page=' . $per_page . '&i_start_at=' . $end_at : '';
    $db->end_transaction();
    $db->close();
    exit('<script type="text/javascript">window.location="admin_maintenance.php' . $query_str . '"</script><br />JavaScript redirect unsuccessful. Click <a href="admin_maintenance.php' . $query_str . '">here</a> to continue.');
}
// Get the first post ID from the db
$result = $db->query('SELECT id FROM ' . $db->prefix . 'topics ORDER BY id LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) {
    $first_id = $db->result($result);
}
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / Admin / Maintenance';
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:31,代码来源:admin_maintenance.php


示例8: message

                message($lang_admin_deleted['topic has been deleted']);
            }
            $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';
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:deleted.php


示例9: array

 // Insert some other default data
 $query = array('INSERT' => 'cat_name, disp_position', 'INTO' => 'categories', 'VALUES' => '\'' . $lang_install['Default category name'] . '\', 1');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $query = array('INSERT' => 'forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id', 'INTO' => 'forums', 'VALUES' => '\'' . $lang_install['Default forum name'] . '\', \'' . $lang_install['Default forum descrip'] . '\', 1, 1, ' . $now . ', 1, \'' . $forum_db->escape($username) . '\', 1, ' . $forum_db->insert_id() . '');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $query = array('INSERT' => 'poster, subject, posted, first_post_id, last_post, last_post_id, last_poster, forum_id', 'INTO' => 'topics', 'VALUES' => '\'' . $forum_db->escape($username) . '\', \'' . $lang_install['Default topic subject'] . '\', ' . $now . ', 1, ' . $now . ', 1, \'' . $forum_db->escape($username) . '\', ' . $forum_db->insert_id() . '');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $query = array('INSERT' => 'poster, poster_id, poster_ip, message, posted, topic_id', 'INTO' => 'posts', 'VALUES' => '\'' . $forum_db->escape($username) . '\', ' . $new_uid . ', \'127.0.0.1\', \'' . $lang_install['Default post contents'] . '\', ' . $now . ', ' . $forum_db->insert_id() . '');
 if ($db_type != 'pgsql') {
     $query['INSERT'] .= ', id';
     $query['VALUES'] .= ', 1';
 }
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 // Add new post to search table
 require FORUM_ROOT . 'include/search_idx.php';
 update_search_index('post', $forum_db->insert_id(), $lang_install['Default post contents'], $lang_install['Default topic subject']);
 // Insert the default ranks
 $query = array('INSERT' => 'rank, min_posts', 'INTO' => 'ranks', 'VALUES' => '\'' . $lang_install['Default rank 1'] . '\', 0');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $query = array('INSERT' => 'rank, min_posts', 'INTO' => 'ranks', 'VALUES' => '\'' . $lang_install['Default rank 2'] . '\', 10');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $forum_db->end_transaction();
 $alerts = array();
 // Check if the cache directory is writable and clear cache dir
 if (is_writable(FORUM_ROOT . 'cache/')) {
     $cache_dir = dir(FORUM_ROOT . 'cache/');
     if ($cache_dir) {
         while (($entry = $cache_dir->read()) !== false) {
             if (substr($entry, strlen($entry) - 4) == '.php') {
                 @unlink(FORUM_ROOT . 'cache/' . $entry);
             }
开发者ID:heiswayi,项目名称:ishare-plus,代码行数:31,代码来源:install.php


示例10: message

        message('No Forums Selected');
    }
    $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


示例11: edit_post

 public function edit_post($id, $can_edit_subject, $post, $cur_post, $is_admmod)
 {
     require FEATHER_ROOT . 'include/search_idx.php';
     if ($can_edit_subject) {
         // Update the topic and any redirect topics
         $where_topic = array(array('id' => $cur_post['tid']), array('moved_to' => $cur_post['tid']));
         $update_topic = array('subject' => $post['subject'], 'sticky' => $post['stick_topic']);
         DB::for_table('topics')->where_any_is($where_topic)->find_one()->set($update_topic)->save();
         // We changed the subject, so we need to take that into account when we update the search words
         update_search_index('edit', $id, $post['message'], $post['subject']);
     } else {
         update_search_index('edit', $id, $post['message']);
     }
     // Update the post
     $update_post = array('message' => $post['message'], 'hide_smilies' => $post['hide_smilies']);
     if (!$this->request->post('silent') || !$is_admmod) {
         $update_post['edited'] = time();
         $update_post['edited_by'] = $this->user->username;
     }
     DB::for_table('posts')->where('id', $id)->find_one()->set($update_post)->save();
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:21,代码来源:edit.php


示例12: array

 $folders = array($lang_install['New'], $lang_install['Inbox'], $lang_install['Archived']);
 foreach ($folders as $folder) {
     $insert = array('name' => $folder, 'user_id' => 1);
     $db->insert('folders', $insert);
 }
 $insert = array('cat_name' => $lang_install['Test category'], 'disp_position' => 1);
 $db->insert('categories', $insert);
 $insert = array('forum_name' => $lang_install['Test forum'], 'forum_desc' => $lang_install['This is just a test forum'], 'num_topics' => 1, 'num_posts' => 1, 'last_post' => $now, 'last_post_id' => 1, 'last_topic' => sprintf($lang_install['Test post'], FORUM_VERSION), 'last_topic_id' => 1, 'last_poster' => $username, 'disp_position' => 1, 'cat_id' => 1, 'quickjump' => 1);
 $db->insert('forums', $insert);
 $insert = array('poster' => $username, 'subject' => sprintf($lang_install['Test post'], FORUM_VERSION), 'posted' => $now, 'first_post_id' => 1, 'last_post' => $now, 'last_post_id' => 1, 'last_poster' => $username, 'forum_id' => 1);
 $db->insert('topics', $insert);
 $insert = array('poster' => $username, 'poster_id' => 2, 'poster_ip' => get_remote_address(), 'message' => $lang_install['Message'], 'posted' => $now, 'topic_id' => 1);
 $db->insert('posts', $insert);
 // Index the test post so searching for it works
 require PANTHER_ROOT . 'include/search_idx.php';
 update_search_index('post', 1, $lang_install['Message'], $lang_install['Test post']);
 $db->end_transaction();
 // Check if we disabled uploading avatars because file_uploads was disabled
 if ($avatars == '0') {
     $alerts[] = $lang_install['Alert upload'];
 }
 // Generate the config.php file data
 $file = generate_config_file($config);
 // Attempt to write config.php and serve it up for download if writing fails
 $written = false;
 if (forum_is_writable(PANTHER_ROOT . 'include')) {
     $fh = @fopen(PANTHER_ROOT . 'include/config.php', 'wb');
     if ($fh) {
         fwrite($fh, $file);
         fclose($fh);
         $written = true;
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:install.php


示例13: strip_search_index

         strip_search_index($second_post_id);
         update_search_index('movepost', $second_post_id, $second_message, $subject);
     }
 } elseif (isset($post_ids) && $new_subject) {
     require_once PUN_ROOT . 'include/search_idx.php';
     update_search_index('movepost', $post_id, $message, $new_subject);
     // update message and subject
 }
 if ($is_reception_post_new) {
     require_once PUN_ROOT . 'include/search_idx.php';
     // update the post which was first one on the reception topic (and second now)
     strip_search_index($reception_topic_first_post_id);
     update_search_index('movepost', $reception_topic_first_post_id, $reception_first_message);
     // update the post which is now the first one on the reception topic
     strip_search_index($post_id);
     update_search_index('movepost', $post_id, $message, $reception_subject);
 }
 //Update topics and forum if required
 update_topic($new_topic_id);
 if ($is_topic_post || $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
     }
 } else {
     update_topic($old_topic_id);
     update_forum($old_fid);
     // Update the forum FROM which the topic was moved
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:movepost.php


示例14: update_search_index

             $cur_topic = $cur_post[0];
         }
         echo 'Processing post <strong>' . $cur_post[1] . '</strong> in topic <strong>' . $cur_post[0] . '</strong><br />' . "\n";
         if ($cur_post[1] == $first_post) {
             update_search_index('post', $cur_post[1], $cur_post[2], $subject);
         } else {
             update_search_index('post', $cur_post[1], $cur_post[2]);
         }
     }
 } else {
     $result = $db->query('SELECT DISTINCT t.id, t.subject FROM ' . $db->prefix . 'topics AS t WHERE t.id>=' . $start_at . ' AND t.id<' . $end_at . ' ORDER BY t.id') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
     while ($cur_topic = $db->fetch_row($result)) {
         $result2 = $db->query('SELECT p.id, MIN(p.posted) AS first FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id WHERE t.id=' . $cur_topic[0] . ' GROUP BY p.id ORDER BY first LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
         $cur_post = $db->fetch_row($result2);
         echo 'Processing topic <strong>' . $cur_topic[0] . '</strong><br />' . "\n";
         update_search_index('post', $cur_post[0], "", $cur_topic[1]);
     }
 }
 // Check if there is more work to do
 $result = $db->query('SELECT id FROM ' . $db->prefix . 'topics WHERE id>' . $end_at) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
 if ($db->num_rows($result)) {
     $query_str = '?i_per_page=' . $per_page . '&i_start_at=' . $end_at;
     if ($subject_only) {
         $query_str .= '&i_subject_only=1';
     }
 } else {
     $query_str = '';
 }
 $db->end_transaction();
 $db->close();
 exit('<script type="text/javascript">window.location="admin_maintenance.php' . $query_str . '"</script><br />JavaScript redirect unsuccessful. Click <a href="admin_maintenance.php' . $query_str . '">here</a> to continue.');
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:admin_maintenance.php


示例15: array

         // Create the redirect topic
         $insert = array('poster' => $moved_to['poster'], 'subject' => $moderation['add_start'] . $moved_to['subject'] . $moderation['add_end'], 'posted' => $moved_to['posted'], 'last_post' => $moved_to['last_post'], 'moved_to' => $tid, 'forum_id' => $moved_to['forum_id']);
         $db->insert('topics', $insert);
     }
 }
 //We may (not) need some of this, but we might as well get it all in one query regardless
 $data = array(':id' => $tid);
 $ps = $db->run('SELECT t.subject, p.message, p.poster_email, p.poster_id, u.email, u.id AS uid, u.language FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.first_post_id=p.id LEFT JOIN ' . $db->prefix . 'users AS u ON p.poster_id=u.id WHERE t.id=:id', $data);
 $topic = $ps->fetch();
 $email = !is_null($topic['poster_email']) ? $topic['poster_email'] : $topic['email'];
 if ($moderation['add_start'] != '' || $moderation['add_end'] != '') {
     $update['subject'] = $moderation['add_start'] . $topic['subject'] . $moderation['add_end'];
     if (!defined('PANTHER_CJK_HANGUL_REGEX')) {
         require PANTHER_ROOT . 'include/search_idx.php';
     }
     update_search_index('edit', $tid, $topic['message'], $moderation['add_start'] . $topic['subject'] . $moderation['add_end']);
 }
 if (!empty($update)) {
     $data = array(':id' => $tid);
     $db->update('topics', $update, 'id=:id', $data);
 }
 $data = array(':id' => $tid);
 $ps = $db->select('posts', 'COUNT(id)', $data, 'topic_id=:id AND approved=1 AND deleted=0');
 $num_replies = $ps->fetchColumn() - 1;
 // Get last_post, last_post_id and last_poster
 $data = array(':id' => $tid);
 $ps = $db->select('posts', 'posted, id, poster, poster_id', $data, 'topic_id=:id AND approved=1 AND deleted=0', 'id DESC LIMIT 1');
 $last_topic = $ps->fetch();
 // Update topic
 $update = array('num_replies' => $num_replies, 'last_post' => $last_topic['posted'], 'last_post_id' => $last_topic['id'], 'last_poster' => $last_topic['poster']);
 $data = array(':id' => $tid);
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:moderate.php


示例16: header

        if (!$db->num_rows($result)) {
            header('Location: ' . $base_config['baseurl'] . '/admin/maintenance');
            return;
        }
        echo '<div class="forum_content">';
        $first = true;
        $outid = 0;
        while (list($id, $content) = $db->fetch_row($result)) {
            if ($first) {
                echo '<p style="border: 1px solid #000; margin-left:5%; margin-right:5%; padding:0px;">
						<span style="width:' . $id / $post_count * 100 . '%; background-color: #39F; display:block; padding-left: 1px; padding-top: 1px; padding-bottom: 1px; margin-left:0px">&nbsp;</span>
				</p>
				<h3>' . translate('rebuildingsearch') . '</h3>';
                $first = false;
            }
            update_search_index($id, $content);
            echo '<p>' . translate('procpost', $id) . '</p>';
            $outid = $id;
        }
        echo '<p>' . translate('redirmsg', '?start=' . ($_GET['start'] + $per_page)) . '</p>';
        echo '</div>';
        header('Refresh: 1; url=' . $base_config['baseurl'] . '/admin/maintenance/rebuildsearch?start=' . ($_GET['start'] + $per_page));
        return;
    case 'update_user_post_counts':
        $per_page = 300;
        if (!isset($_GET['start'])) {
            $_GET['start'] = 0;
            $db->query('UPDATE `#^users` SET num_posts=-1') or error('Failed to erase search index', __FILE__, __LINE__, $db->error());
        }
        $result = $db->query('SELECT MAX(id) FROM `#^users`') or error('Failed to find post count', __FILE__, __LINE__, $db->error());
        list($user_count) = $db->fetch_row($result);
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:maintenance.php


示例17: while

             $urllist[] = $url;
         }
         $ok = false;
         $add_num = 0;
         while (!$ok) {
             $ok = true;
             if (in_array($name, $urllist)) {
                 $add_num++;
                 $name = $base_name . '-' . $add_num;
                 $ok = false;
             }
         }
         $db->query('UPDATE `#^topics` SET subject=\'' . $db->escape($_POST['subject']) . '\',url=\'' . $db->escape($name) . '\' WHERE id=' . $cur_post['tid']) or error('Failed to update topic subject', __FILE__, __LINE__, $db->error());
         $db->query('INSERT INTO `#^topics`(url,redirect_id) VALUES(\'' . $db->escape($cur_post['turl']) . '\',' . $cur_post['tid'] . ')') or error('Failed to create redirect topic', __FILE__, __LINE__, $db->error());
     }
     update_search_index($pid, $_POST['content']);
     if (isset($_POST['silentedit']) && ($futurebb_user['g_mod_privs'] || $futurebb_user['g_admin_privs'])) {
         $last_edited_sql = '';
     } else {
         $last_edited_sql = 'last_edited=' . time() . ',last_edited_by=' . $futurebb_user['id'] . ',';
     }
     $db->query('UPDATE `#^posts` SET content=\'' . $db->escape($_POST['content']) . '\',parsed_content=\'' . $db->escape(BBCodeController::parse_msg($_POST['content'], !isset($_POST['hidesmilies']))) . '\',' . $last_edited_sql . 'disable_smilies=' . intval(isset($_POST['hidesmilies'])) . ' WHERE id=' . $pid) or error('Failed to update post', __FILE__, __LINE__, $db->error());
     redirect($base_config['baseurl'] . '/posts/' . $pid);
     return;
 } else {
     if (isset($_POST['preview']) && empty($errors)) {
         echo '<div class="quotebox preview">' . BBCodeController::parse_msg($_POST['content'], !isset($_POST['hidesmilies'])) . '</div>';
     } else {
         echo '<p>' . translate('errordesc') . '<ul>';
         foreach ($errors as $val) {
             echo '<li>' . $val . '</li>';
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:edit.php


示例18: isset

    }
    $hide_smilies = isset($_POST['hide_smilies']) ? intval($_POST['hide_smilies']) : 0;
    if ($hide_smilies != '1') {
        $hide_smilies = '0';
    }
    // Did everything go according to plan?
    if (empty($errors) && !isset($_POST['preview'])) {
        $edited_sql = !isset($_POST['silent']) || !$is_admmod ? $edited_sql = ', edited=' . time() . ', edited_by=\'' . $db->escape($pun_user['username']) . '\'' : '';
        require PUN_ROOT . 'include/search_idx.php';
        if ($can_edit_subject) {
            // Update the topic and any redirect topics
            $db->query('UPDATE ' . $db->prefix . 'topics SET subject=\'' . $db->escape($subject) . '\' WHERE id=' . $cur_post['tid'] . ' OR moved_to=' . $cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
            // We changed the subject, so we need to take that into account when we update the search words
            update_search_index('edit', $id, $message, $subject);
        } else {
            update_search_index('edit', $id, $message);
        }
        // Update the post
        $db->query('UPDATE ' . $db->prefix . 'posts SET message=\'' . $db->escape($message) . '\', hide_smilies=\'' . $hide_smilies . '\'' . $edited_sql . ' WHERE id=' . $id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
        redirect('viewtopic.php?pid=' . $id . '#p' . $id, $lang_post['Edit redirect']);
    }
}
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_post['Edit post'];
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_m 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP update_setting函数代码示例发布时间:2022-05-23
下一篇:
PHP update_rss_feed函数代码示例发布时间: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