本文整理汇总了PHP中build_forum_counters函数的典型用法代码示例。如果您正苦于以下问题:PHP build_forum_counters函数的具体用法?PHP build_forum_counters怎么用?PHP build_forum_counters使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_forum_counters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_internal
/**
* Process the actual deletes
*
* @param boolean $is_hard_delete
* @param vB_Legacy_User $user
* @param string $reason
* @param boolean $keepattachments
*/
protected function delete_internal($is_hard_delete, $user, $reason, $keepattachments)
{
global $vbulletin;
$thread = $this->get_field('thread');
$forum = $thread->get_field('forum');
$postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$postman->set_existing($this->record);
$postman->delete($forum->get_countposts(), $thread->get_field('threadid'), $is_hard_delete, array('userid' => $user->get_field('userid'), 'username' => $user->get_field('username'), 'reason' => $reason, 'keepattachments' => $keepattachments));
unset($postman);
build_thread_counters($threadinfo['threadid']);
if ($forum->get_field('lastthreadid') != $thread->get_field('threadid')) {
$forum->decrement_replycount();
} else {
// this thread is the one being displayed as the thread with the last post...
// need to get the lastpost datestamp and lastposter name from the thread.
build_forum_counters($thread->get_field('forumid'));
}
}
示例2: array
}
if (!empty($rsslog_insert_sql)) {
// insert logs
$vbulletin->db->query_replace(TABLE_PREFIX . 'rsslog', '(rssfeedid, itemid, itemtype, uniquehash, contenthash, dateline, threadactiontime)', $rsslog_insert_sql);
$rsslog_insert_sql = array();
$rss_logs_inserted = true;
}
}
if (defined('IN_CONTROL_PANEL')) {
echo "</ol>";
}
if ($rss_logs_inserted) {
// rebuild forum counters
require_once DIR . '/includes/functions_databuild.php';
foreach (array_keys($update_forumids) as $forumid) {
build_forum_counters($forumid);
}
// build cron log
$log_items = '<ul class="smallfont">';
foreach ($cronlog_items as $rssfeedid => $items) {
$log_items .= "<li><strong>{$feeds[$rssfeedid][title]}</strong><ul class=\"smallfont\">\r\n";
foreach ($items as $item) {
$log_items .= $item;
}
$log_items .= "</ul></li>\r\n";
}
$log_items .= '</ul>';
}
if (!empty($feeds)) {
// update lastrun time for feeds
$vbulletin->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "rssfeed\n\t\t\t\tSET lastrun = " . TIMENOW . "\n\t\t\t\tWHERE rssfeedid IN(" . implode(', ', array_keys($feeds)) . ")\n\t\t\t");
示例3:
echo '<p>' . $vbphrase['updating_forums'] . '</p>';
$forums = $db->query_read("
SELECT forumid
FROM " . TABLE_PREFIX . "forum
WHERE forumid >= " . $vbulletin->GPC['startat'] . "
ORDER BY forumid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while($forum = $db->fetch_array($forums))
{
build_forum_counters($forum['forumid'], true);
echo construct_phrase($vbphrase['processing_x'], $forum['forumid']) . "<br />\n";
vbflush();
$finishat = ($forum['forumid'] > $finishat ? $forum['forumid'] : $finishat);
}
$finishat++;
if ($checkmore = $db->query_first("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE forumid >= $finishat LIMIT 1"))
{
print_cp_redirect("misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateforum&startat=$finishat&pp=" . $vbulletin->GPC['perpage']);
echo "<p><a href=\"misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateforum&startat=$finishat&pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
}
else
{
示例4: vbflush
echo ". \n";
vbflush();
}
echo $vbphrase['done'] . '</p>';
define('CP_REDIRECT', 'index.php?do=home');
print_stop_message('pruned_threads_successfully_modcp');
} else {
if ($vbulletin->GPC['type'] == 'move') {
$threadslist = '0';
foreach ($vbulletin->GPC['thread'] as $threadid => $confirm) {
$threadslist .= ',' . intval($threadid);
}
$db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\t\t\tforumid = " . $vbulletin->GPC['destforumid'] . "\n\t\t\t\tWHERE threadid IN ({$threadslist})\n\t\t\t\t\tAND forumid IN (" . implode(',', $forumids) . ")\n\t\t\t");
$vbulletin->db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed");
require_once DIR . '/includes/functions_prefix.php';
remove_invalid_prefixes($threadslist, $vbulletin->GPC['destforumid']);
require_once DIR . '/includes/functions_databuild.php';
build_forum_counters($vbulletin->GPC['destforumid']);
define('CP_REDIRECT', 'index.php?do=home');
print_stop_message('moved_threads_successfully_modcp');
}
}
}
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 09:39, Wed Nov 5th 2008
|| # CVS: $RCSfile$ - $Revision: 25059 $
|| ####################################################################
\*======================================================================*/
示例5: post_delete
/**
* Additional data to update after a delete call (such as denormalized values in other tables).
*
* @param boolean Do the query?
*/
function post_delete($doquery = true)
{
$db =& $this->registry->db;
// need to rebuild last post info in forums that use this prefix
require_once(DIR . '/includes/functions_databuild.php');
$forums = $db->query_read("
SELECT forumid
FROM " . TABLE_PREFIX . "forumprefixset
WHERE prefixsetid = '" . $db->escape_string($this->fetch_field('prefixsetid')) . "'
");
while ($forum = $db->fetch_array($forums))
{
build_forum_counters($forum['forumid']);
}
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "forumprefixset
WHERE prefixsetid = '" . $db->escape_string($this->fetch_field('prefixsetid')) . "'
");
// delete this set's phrases
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "phrase
WHERE varname = '" . $db->escape_string('prefixset_' . $this->fetch_field('prefixsetid') . '_title') . "'
AND fieldname = 'prefix'
");
// now find all the phrases for child prefixes to remove
$prefix_phrases = array();
$prefixids = array();
$prefix_sql = $db->query_read("
SELECT prefixid
FROM " . TABLE_PREFIX . "prefix
WHERE prefixsetid = '" . $db->escape_string($this->fetch_field('prefixsetid')) . "'
");
while ($prefix = $db->fetch_array($prefix_sql))
{
$prefix_phrases[] = "'" . $db->escape_string("prefix_$prefix[prefixid]_title_plain") . "'";
$prefix_phrases[] = "'" . $db->escape_string("prefix_$prefix[prefixid]_title_rich") . "'";
$prefixids[] = "'" . $db->escape_string($prefix['prefixid']) . "'";
}
if ($prefix_phrases)
{
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "phrase
WHERE varname IN (" . implode(',', $prefix_phrases) . ")
AND fieldname = 'global'
");
$db->query_write("
UPDATE " . TABLE_PREFIX . "thread SET
prefixid = ''
WHERE prefixid IN (" . implode(',', $prefixids) . ")
");
}
// now delete the child prefixes themselves
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "prefix
WHERE prefixsetid = '" . $db->escape_string($this->fetch_field('prefixsetid')) . "'
");
require_once(DIR . '/includes/adminfunctions_language.php');
build_language();
require_once(DIR . '/includes/adminfunctions_prefix.php');
build_prefix_datastore();
($hook = vBulletinHook::fetch_hook('prefixsetdata_delete')) ? eval($hook) : false;
return true;
}
示例6: remove_prefixes_forum
/**
* Removes prefixes from threads in certain forums. Useful when a prefix or prefix set
* is no longer available in a forum.
*
* @param array|string Array of prefixes (or single one)
* @param array|integer Array of forumids (or a single one)
*/
function remove_prefixes_forum($prefixes, $forumids)
{
global $vbulletin;
if (!is_array($prefixes)) {
$prefixes = array($prefixes);
}
$prefixes = array_map(array(&$vbulletin->db, 'escape_string'), $prefixes);
if (!is_array($forumids)) {
$forumids = array($forumids);
}
$forumids = array_map('intval', $forumids);
if (empty($prefixes) or empty($forumids)) {
return;
}
$vbulletin->db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\tprefixid = ''\n\t\tWHERE prefixid IN ('" . implode("', '", $prefixes) . "')\n\t\t\tAND forumid IN (" . implode(',', $forumids) . ")\n\t");
// rebuild last post info in these forums
require_once DIR . '/includes/functions_databuild.php';
foreach ($forumids as $forumid) {
build_forum_counters($forumid);
}
}
示例7: undelete_post
function undelete_post($postid, $countposts, $postinfo = NULL, $threadinfo = NULL, $counterupdate = true)
{
global $vbulletin, $vbphrase;
// Valid postinfo array will contain: postid, threadid, visible, userid, username, title
// Invalid post or post is not deleted
if (!$postinfo AND !$postinfo = fetch_postinfo($postid))
{
return;
}
// Valid threadinfo array will contain: threadid, forumid, visible, firstpostid
if (!$threadinfo AND !$threadinfo = fetch_threadinfo($postinfo['threadid']))
{
return;
}
if ($threadinfo['firstpostid'] == $postid)
{
// undelete thread
undelete_thread($threadinfo['threadid'], $countposts, $threadinfo);
return;
}
// Post is not deleted
if ($postinfo['visible'] != 2)
{
return;
}
// Only increment post for a visible thread in a counting forum
if ($countposts AND $postinfo['userid'] AND $threadinfo['visible'] == 1)
{
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdata->set_existing($postinfo);
$userdata->set('posts', 'posts + 1', false);
$userdata->set_ladder_usertitle_relative(1);
$userdata->save();
unset($userdata);
}
$deletiondata =& datamanager_init('Deletionlog_ThreadPost', $vbulletin, ERRTYPE_SILENT, 'deletionlog');
$deletioninfo = array('type' => 'post', 'primaryid' => $postid);
$deletiondata->set_existing($deletioninfo);
$deletiondata->delete();
unset($deletiondata, $deletioninfo);
$postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$postman->set_existing($postinfo);
$postman->set('visible', 1);
$postman->save();
if ($counterupdate)
{
build_thread_counters($postinfo['threadid']);
build_forum_counters($threadinfo['forumid']);
}
fetch_phrase_group('threadmanage');
$postinfo['forumid'] = $threadinfo['forumid'];
require_once(DIR . '/includes/functions_log_error.php');
log_moderator_action($postinfo, 'post_y_by_x_undeleted', array($postinfo['title'], $postinfo['username']));
}
示例8: PostNewThread
function PostNewThread($who, $forumid, $title, $pagetext)
{
global $db, $vbulletin, $server, $structtypes, $lastpostarray;
$result = RegisterService($who);
if ($result['Code'] != 0) {
$retval['Result'] = $result;
return $retval;
}
$insertid = 0;
$foruminfo = fetch_foruminfo($forumid, false);
if ($foruminfo['forumid'] > 0) {
$userid = 0;
// such is the case for network posts
$postuserid = 0;
// same as above
$forumid = $foruminfo['forumid'];
$pagetext = fetch_censored_text($pagetext);
//$title = $title;
$allowsmilie = '1';
$visible = '1';
$dateline = TIMENOW;
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);
// there is no (easy) way to parse out an excessive amount of smilies when dong the image check
// so we check for [IMG] tags only and then disable the check for smilies
#$threaddm->set_info('skip_maximagescheck', true);
$threaddm->do_set('userid', $vbulletin->userinfo['userid']);
$threaddm->do_set('username', $vbulletin->userinfo['username']);
$threaddm->do_set('postuserid', $postuserid);
$threaddm->do_set('forumid', $forumid);
$threaddm->do_set('pagetext', $pagetext);
$threaddm->do_set('title', $title);
$threaddm->do_set('allowsmilie', $allowsmilie);
$threaddm->do_set('visible', $visible);
$threaddm->do_set('dateline', $dateline);
$threaddm->pre_save();
if (count($threaddm->errors) > 0) {
return ErrorResult('pre_save_failed_new_thread');
} else {
// save the thread
$insertid = $threaddm->save();
require_once './includes/functions_databuild.php';
build_forum_counters($forumid);
}
}
if ($insertid > 0) {
$retval['PostID'] = $insertid;
$retval['RemoteUser'] = ConsumeArray($vbulletin->userinfo, $structtypes['RemoteUser']);
$result['Code'] = 1;
$retval['Result'] = $result;
} else {
return ErrorResult('save_failed_thread_reply');
}
return $retval;
}
示例9: array
$insert_subscriptions = array();
foreach ($unique_thread_user as $threadid => $users) {
foreach ($users as $userid => $subscriptioninfo) {
if ($subscriptioninfo['issubscribed'] and $subscriptioninfo['autosubscribe'] != -1) {
$insert_subscriptions[] = "({$userid}, {$destthreadinfo['threadid']}, {$subscriptioninfo['autosubscribe']}, 0, 1)";
}
}
}
if ($insert_subscriptions) {
$db->query_write("\n\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "subscribethread\n\t\t\t\t\t(userid, threadid, emailupdate, folderid, canview)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(', ', $insert_subscriptions));
}
// need to check permissions on these threads
update_subscriptions(array('threadids' => array($destthreadinfo['threadid'])));
}
build_thread_counters($destthreadinfo['threadid']);
build_forum_counters($destforuminfo['forumid']);
log_moderator_action($destthreadinfo, 'posts_copied_to_x', $destthreadinfo['threadid']);
// empty cookie
setcookie('vbulletin_inlinepost', '', TIMENOW - 3600, '/');
($hook = vBulletinHook::fetch_hook('inlinemod_docopyposts')) ? eval($hook) : false;
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$destthreadinfo['threadid']}";
eval(print_standard_redirect('redirect_inline_copiedposts', true, $forceredirect));
}
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
($hook = vBulletinHook::fetch_hook('inlinemod_complete')) ? eval($hook) : false;
$url =& $vbulletin->url;
// spit out the final HTML if we have got this far
eval('$HTML = "' . fetch_template($template) . '";');
eval('print_output("' . fetch_template('THREADADMIN') . '");');
/*======================================================================*\
示例10: postDelete
/**
* Additional tasks to perform after a delete.
*
* Return false to indicate that the entire delete process was not a success.
*
* @param mixed - The result of execDelete()
*/
protected function postDelete($result)
{
$this->treeUpdated();
$this->assertItem();
vB::$db->query_write("
DELETE FROM " . TABLE_PREFIX . "cms_nodeconfig
WHERE nodeid = " . intval($this->item->getNodeId())
);
vB::$db->query_write("
DELETE FROM " . TABLE_PREFIX . "cms_nodeinfo
WHERE nodeid = " . intval($this->item->getNodeId())
);
vB::$db->query_write("
DELETE FROM " . TABLE_PREFIX . "cms_navigation
WHERE nodeid = " . intval($this->item->getNodeId())
);
// Delete associated thread
if ($threadid = $this->item->getAssociatedThreadId())
{
if ($threadinfo = verify_id('thread', $threadid, false, true))
{
$threadman =& datamanager_init('Thread', vB::$vbulletin, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->delete(true, true, NULL, false);
unset($threadman);
build_forum_counters($threadinfo['forumid']);
}
}
vB_Cache::instance()->event(vBCms_NavBar::getCacheEventId(vBCms_NavBar::GLOBAL_CACHE_EVENT));
return parent::postDelete($result);
}
示例11: delete_internal
/**
* Enter description here...
*
* @param boolean $is_hard_delete
* @param vB_Legacy_User $user
* @param String $reason
* @param boolean $keepattachments
*/
protected function delete_internal($is_hard_delete, $user, $reason, $keepattachments)
{
global $vbulletin;
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($this->record);
$forum = $this->get_forum();
$threadman->delete($forum->get_field['replycount'], $is_hard_delete, array('userid' => $user->get_field('userid'), 'username' => $user->get_field('username'), 'reason' => $reason, 'keepattachments' => $keepattachments));
unset($threadman);
if ($forum->get_field('lastthreadid') != $this->get_field('threadid')) {
$forum->decrement_threadcount();
} else {
// this thread is the one being displayed as the thread with the last post...
// so get a new thread to display.
build_forum_counters($this->get_field('forumid'));
}
}
示例12: VARCHAR
$db->errno = 0;
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD lastpostid INT UNSIGNED NOT NULL DEFAULT '0'");
$db->errno = 0;
$db->query_first("SELECT forumid FROM " . TABLE_PREFIX . "podcast LIMIT 1");
if ($db->errno()) {
$db->query_write("CREATE TABLE " . TABLE_PREFIX . "podcast (\n\t\t\tforumid INT UNSIGNED NOT NULL DEFAULT '0',\n\t\t\tauthor VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\tcategory VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\timage VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\texplicit SMALLINT NOT NULL DEFAULT '0',\n\t\t\tenabled SMALLINT NOT NULL DEFAULT '1',\n\t\t\tkeywords VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\towneremail VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\townername VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\tsubtitle VARCHAR(255) NOT NULL DEFAULT '',\n\t\t\tsummary MEDIUMTEXT,\n\t\t\tcategoryid SMALLINT NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (forumid)\n\t\t)");
}
$db->show_errors();
$db->query_write("UPDATE forum SET lastpost=0, lastposter=''");
$forums = $db->query_read("SELECT forumid, title FROM forum ORDER BY forumid DESC");
echo "<ul>\n";
while ($forum = $db->fetch_array($forums)) {
// update forum counters
echo_flush("<li>" . sprintf($upgrade_phrases['upgrade_300b3.php']['updating_counters_for_x'], $forum['title']) . "</li>\n");
require_once DIR . '/includes/functions_databuild.php';
build_forum_counters($forum['forumid']);
$thread = $db->query_first("\n\t\t\tSELECT * FROM thread\n\t\t\tWHERE forumid = {$forum['forumid']}\n\t\t\tORDER BY lastpost DESC\n\t\t\tLIMIT 1\n\t\t");
$query[] = "\n\t\t\tUPDATE forum SET\n\t\t\t\tlastpost = " . intval($thread['lastpost']) . ",\n\t\t\t\tlastposter = '" . $db->escape_string($thread['lastposter']) . "',\n\t\t\t\tlastthread = '" . $db->escape_string($thread['title']) . "',\n\t\t\t\tlastthreadid = " . intval($thread['threadid']) . ",\n\t\t\t\tlasticonid = " . intval($thread['iconid']) . "\n\t\t\tWHERE forumid = " . intval($thread['forumid']) . "\n\t\t";
$explain[] = sprintf($upgrade_phrases['upgrade_300b3.php']['updating_lastpost_info_for_x'], $forum['title']);
}
echo "</ul>\n";
exec_queries();
}
// #############################################################################
// Convert Private Messages
if ($vbulletin->GPC['step'] == 6) {
$vbulletin->GPC['perpage'] = 1000;
$count = $db->query_first("SELECT COUNT(*) AS total FROM privatemessage");
echo_flush("<p>" . sprintf($upgrade_phrases['upgrade_300b3.php']['converting_priv_msg_x'], construct_upgrade_page_hint($count['total'], $vbulletin->GPC['startat'], $vbulletin->GPC['perpage'])) . "</p>\n");
// query a batch of private messages
$getpms = $db->query_read("\n\t\tSELECT\n\t\t\tprivatemessage.*,\n\t\t\tIF(ISNULL(touser.username), '[{$upgrade_phrases['upgrade_300b3.php']['deleted_user']}]', touser.username) AS tousername,\n\t\t\tIF(ISNULL(fromuser.username), '[{$upgrade_phrases['upgrade_300b3.php']['deleted_user']}]', fromuser.username) AS fromusername\n\t\tFROM privatemessage\n\t\tLEFT JOIN user AS touser ON(touser.userid = privatemessage.touserid)\n\t\tLEFT JOIN user AS fromuser ON(fromuser.userid = privatemessage.fromuserid)\n\t\tLIMIT {$vbulletin->GPC['startat']}, {$vbulletin->GPC['perpage']}\n\t");
示例13: do_moderation
//.........这里部分代码省略.........
if (!can_moderate($threadinfo['forumid'], 'candeleteposts') and !can_moderate($threadinfo['forumid'], 'canremoveposts')) {
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['candeletepost']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['candeletethread'])) {
json_error(ERR_NO_PERMISSION);
} else {
if ($threadinfo['dateline'] < TIMENOW - $vbulletin->options['edittimelimit'] * 60 and $vbulletin->options['edittimelimit'] != 0) {
json_error(ERR_NO_PERMISSION);
} else {
if (!$threadinfo['open']) {
json_error(ERR_NO_PERMISSION);
}
if (!is_first_poster($threadinfo['threadid'])) {
json_error(ERR_NO_PERMISSION);
}
}
}
} else {
if (!can_moderate($threadinfo['forumid'], 'canremoveposts')) {
$physicaldel = false;
} else {
if (!can_moderate($threadinfo['forumid'], 'candeleteposts')) {
$physicaldel = true;
} else {
$physicaldel = iif($vbulletin->GPC['deletetype'] == 1, false, true);
}
}
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
$delinfo = array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'reason' => $vbulletin->GPC['deletereason'], 'keepattachments' => $vbulletin->GPC['keepattachments']);
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->delete($foruminfo['countposts'], $physicaldel, $delinfo);
unset($threadman);
build_forum_counters($threadinfo['forumid']);
}
// Delete Posts
if ($_POST['do'] == 'dodeleteposts') {
$vbulletin->input->clean_array_gpc('p', array('postids' => TYPE_STR));
$postids = explode(',', $vbulletin->GPC['postids']);
foreach ($postids as $index => $postid) {
if (intval($postid) == 0) {
unset($postids["{$index}"]);
} else {
$postids["{$index}"] = intval($postid);
}
}
if (empty($postids)) {
standard_error(fetch_error('no_applicable_posts_selected'));
}
if (count($postids) > 400) {
standard_error(fetch_error('you_are_limited_to_working_with_x_posts', $postlimit));
}
$vbulletin->input->clean_array_gpc('p', array('deletetype' => TYPE_UINT, 'keepattachments' => TYPE_BOOL, 'deletereason' => TYPE_STR));
$vbulletin->GPC['deletereason'] = prepare_remote_utf8_string($vbulletin->GPC['deletereason']);
$physicaldel = iif($vbulletin->GPC['deletetype'] == 1, false, true);
// Validate posts
$posts = $db->query_read_slave("\n\t\tSELECT post.postid, post.threadid, post.parentid, post.visible, post.title, post.userid AS posteruserid,\n\t\t\tthread.forumid, thread.title AS thread_title, thread.postuserid, thread.firstpostid, thread.visible AS thread_visible\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\tWHERE postid IN (" . implode(',', $postids) . ")\n\t\tORDER BY postid\n\t");
$deletethreads = array();
$firstpost = array();
while ($post = $db->fetch_array($posts)) {
$forumperms = fetch_permissions($post['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and $post['postuserid'] != $vbulletin->userinfo['userid']) {
json_error(ERR_NO_PERMISSION);
}
if ((!$post['visible'] or !$post['thread_visible']) and !can_moderate($post['forumid'], 'canmoderateposts')) {
standard_error(fetch_error('you_do_not_have_permission_to_manage_moderated_threads_and_posts'));
示例14:
if ($threaddata->save())
{
// Reindex first post to set up title properly.
require_once(DIR . '/includes/functions_databuild.php');
delete_post_index($getfirstpost['postid'], $getfirstpost['title'], $getfirstpost['pagetext']);
$getfirstpost['threadtitle'] = $threaddata->fetch_field('title');
$getfirstpost['title'] =& $getfirstpost['threadtitle'];
build_post_index($getfirstpost['postid'] , $foruminfo, 1, $getfirstpost);
cache_ordered_forums(1);
if ($vbulletin->forumcache["$threadinfo[forumid]"]['lastthreadid'] == $threadinfo['threadid'])
{
require_once(DIR . '/includes/functions_databuild.php');
build_forum_counters($threadinfo['forumid']);
}
// we do not appear to log thread title updates
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('foo');
$xml->add_tag('linkhtml', $threaddata->thread['title']);
$threadinfo['title'] = $threaddata->fetch_field('title');
$xml->add_tag('linkhref', fetch_seo_url('thread', $threadinfo));
$xml->close_group('foo');
$xml->print_xml();
exit;
}
}
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
示例15: post_delete
/**
* Additional data to update after a delete call (such as denormalized values in other tables).
*
* @param boolean Do the query?
*/
function post_delete($doquery = true)
{
$db =& $this->registry->db;
$db->query_write("
UPDATE " . TABLE_PREFIX . "thread SET
prefixid = ''
WHERE prefixid = '" . $db->escape_string($this->fetch_field('prefixid')) . "'
");
// need to rebuild last post info in forums that use this prefix
require_once(DIR . '/includes/functions_databuild.php');
$forums = $db->query_read("
SELECT forumid
FROM " . TABLE_PREFIX . "forumprefixset
WHERE prefixsetid = '" . $db->escape_string($this->fetch_field('prefixsetid')) . "'
");
while ($forum = $db->fetch_array($forums))
{
build_forum_counters($forum['forumid']);
}
$db->query_write("
DELETE FROM " . TABLE_PREFIX . "phrase
WHERE varname IN (
'" . $db->escape_string('prefix_' . $this->fetch_field('prefixid') . '_title_plain') . "',
'" . $db->escape_string('prefix_' . $this->fetch_field('prefixid') . '_title_rich') . "'
)
AND fieldname = 'global'
");
require_once(DIR . '/includes/adminfunctions_language.php');
build_language();
require_once(DIR . '/includes/adminfunctions_prefix.php');
build_prefix_datastore();
($hook = vBulletinHook::fetch_hook('prefixdata_delete')) ? eval($hook) : false;
return true;
}