Beispiel #1
0
	function delete()
	{
		if ($blogtextid = $this->existing['blogtextid'])
		{
			$db =& $this->registry->db;
			require_once(DIR . '/includes/blog_functions_log_error.php');

			if ($this->info['hard_delete'])
			{

				require_once(DIR . '/vb/search/indexcontroller/queue.php');
				vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogComment', 'delete', $blogtextid);

				$db->query_write("
					DELETE " . TABLE_PREFIX . "blog_text, " . TABLE_PREFIX . "blog_textparsed
					FROM " . TABLE_PREFIX . "blog_text
					LEFT JOIN " . TABLE_PREFIX . "blog_textparsed ON (" . TABLE_PREFIX . "blog_textparsed.blogtextid = " . TABLE_PREFIX . "blog_text.blogtextid)
					WHERE " . TABLE_PREFIX . "blog_text.blogtextid = $blogtextid
				");

				$db->query_write("
					DELETE FROM " . TABLE_PREFIX . "blog_deletionlog
					WHERE primaryid = $blogtextid AND type = 'blogtextid'
				");

				$db->query_write("
					DELETE FROM " . TABLE_PREFIX . "blog_moderation
					WHERE primaryid = $blogtextid AND type = 'blogtextid'
				");

				$db->query_write("
					DELETE FROM " . TABLE_PREFIX . "blog_hash
					WHERE blogtextid = " . intval($blogtextid) . " AND
						dateline > " . (TIMENOW - 300)
				);

				if (!$this->info['skip_moderator_log'])
				{
					blog_moderator_action($this->existing, 'comment_x_by_y_removed', array($this->existing['title'], $this->existing['username']));
				}
			}
			else
			{
				$this->set('state', 'deleted');
				$this->save();

				if (!$this->info['skip_moderator_log'])
				{
					blog_moderator_action($this->existing, 'comment_x_by_y_softdeleted', array($this->existing['title'], $this->existing['username']));
				}

				// soft delete
				// We have a DM for this
				$db->query_write("
					REPLACE INTO " . TABLE_PREFIX . "blog_deletionlog
						(primaryid, type, userid, username, reason, dateline)
					VALUES
						($blogtextid,
						'blogtextid',
						" . $this->registry->userinfo['userid'] . ",
						'" . $db->escape_string($this->registry->userinfo['username']) . "',
						'" . $db->escape_string($this->info['reason']) . "',
						" . TIMENOW . ")
				");

				$db->query_write("
					DELETE FROM " . TABLE_PREFIX . "blog_moderation
					WHERE primaryid = $blogtextid AND type = 'blogtextid'
				");
			}

			if (!$this->info['skip_build_blog_counters'])
			{
				build_blog_entry_counters($this->existing['blogid']);
				if (empty($this->info['blog']['userid']))
				{
					$bloginfo = fetch_bloginfo($this->existing['blogid']);
					build_blog_user_counters($bloginfo['userid']);
				}
				else
				{
					build_blog_user_counters($this->info['blog']['userid']);
				}
			}

			($hook = vBulletinHook::fetch_hook('blog_textdata_delete')) ? eval($hook) : false;
			return true;
		}

		return false;
	}
	/**
	*
	* @param	boolean	Do the query?
	*/
	function post_save_once($doquery = true)
	{
		require_once(DIR . '/includes/blog_functions_category.php');
		build_category_genealogy($this->fetch_field('userid'));
		build_blog_user_counters($this->fetch_field('userid'));

		if (!$this->fetch_field('userid'))
		{	// Admin Defined Category
			$this->registry->db->query_write("
				DELETE FROM " . TABLE_PREFIX . "phrase
				WHERE
					product = 'vbblog'
						AND
					varname IN ('category" . $this->fetch_field('blogcategoryid') . "_title', 'category" . $this->fetch_field('blogcategoryid') . "_desc')
						AND
					fieldname = 'vbblogcat'
						AND
					languageid IN (0,-1)
			");
			$this->registry->db->query_write("
				INSERT INTO " . TABLE_PREFIX . "phrase
					(languageid, fieldname, varname, text, product, username, dateline, version)
				VALUES
					(0,
					'vbblogcat',
					'category" . $this->fetch_field('blogcategoryid') . "_title',
					'" . $this->registry->db->escape_string($this->fetch_field('title')) . "',
					'vbblog',
					'" . $this->registry->db->escape_string($this->registry->userinfo['username']) . "',
					" . TIMENOW . ",
					'" . $this->registry->db->escape_string($this->registry->options['templateversion']) . "'
					),
					(0,
					'vbblogcat',
					'category" . $this->fetch_field('blogcategoryid') . "_desc',
					'" . $this->registry->db->escape_string($this->fetch_field('description')) . "',
					'vbblog',
					'" . $this->registry->db->escape_string($this->registry->userinfo['username']) . "',
					" . TIMENOW . ",
					'" . $this->registry->db->escape_string($this->registry->options['templateversion']) . "'
					)
			");

			require_once(DIR . '/includes/adminfunctions_language.php');
			build_language();
		}

		($hook = vBulletinHook::fetch_hook('blog_categorydata_postsave')) ? eval($hook) : false;
	}
Beispiel #3
0
        print_table_header(construct_phrase($vbphrase['confirm_deletion_x'], $bloginfo['title']));
        print_description_row($vbphrase['are_you_sure_that_you_want_to_delete_this_blog_entry']);
        print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
    } else {
        print_stop_message('no_matches_found');
    }
}
if ($_POST['do'] == 'killentry') {
    $vbulletin->input->clean_array_gpc('p', array('blogid' => TYPE_UINT, 'userid' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'perpage' => TYPE_UINT, 'orderby' => TYPE_NOHTML, 'startstamp' => TYPE_UINT, 'endstamp' => TYPE_UINT, 'status' => TYPE_NOHTML));
    if ($bloginfo = fetch_bloginfo($vbulletin->GPC['blogid'])) {
        $blogman =& datamanager_init('Blog', $vbulletin, ERRTYPE_CP, 'blog');
        $blogman->set_existing($bloginfo);
        $blogman->set_info('hard_delete', true);
        $blogman->delete();
        unset($blogman);
        build_blog_user_counters($bloginfo['userid']);
        $args = '&status=' . $vbulletin->GPC['status'] . '&u=' . $vbulletin->GPC['userid'] . '&startstamp=' . $vbulletin->GPC['startstamp'] . '&endstamp=' . $vbulletin->GPC['endstamp'] . '&pp=' . $vbulletin->GPC['perpage'] . '&page=' . $vbulletin->GPC['pagenumber'] . '&orderby=' . $vbulletin->GPC['orderby'];
        define('CP_REDIRECT', 'blog_admin.php?do=dolist' . $args);
        print_stop_message('deleted_entry_successfully');
    } else {
        print_stop_message('no_matches_found');
    }
}
if ($_REQUEST['do'] == 'rebuildprofilepic') {
    $vbulletin->input->clean_array_gpc('r', array('perpage' => TYPE_UINT, 'startat' => TYPE_UINT));
    @ini_set('memory_limit', -1);
    if ($vbulletin->options['imagetype'] != 'Magick' and !function_exists('imagetypes')) {
        print_stop_message('your_version_no_image_support');
    }
    if (empty($vbulletin->GPC['perpage'])) {
        $vbulletin->GPC['perpage'] = 20;
		unset($userdm);
	}
	else
	{
		$db->query_write("
			UPDATE " . TABLE_PREFIX . "blog_user
			SET bloguserid = $destinfo[userid]
			WHERE bloguserid = $sourceinfo[userid]
		");
	}

	// Update required blog entries
	foreach (array_keys($blogs) AS $blogid)
	{
		build_blog_entry_counters($blogid);
	}

	// Update counters for destination user
	build_blog_user_counters($destinfo['userid']);
	build_blog_memberblogids($destinfo['userid']);
	build_blog_memberids($destinfo['userid']);
}

/*======================================================================*\
|| ####################################################################
|| # 
|| # SVN: $Revision: 17991 $
|| ####################################################################
\*======================================================================*/
?>
Beispiel #5
0
	foreach(array_keys($blogarray) AS $blogid)
	{
		build_blog_entry_counters($blogid);
		$modlog[] = array(
			'userid' =>& $vbulletin->userinfo['userid'],
			'id1'    =>& $blogarray["$blogid"]['userid'],
			'id2'    =>  $blogid,
		);
	}

	require_once(DIR . '/includes/blog_functions_log_error.php');
	blog_moderator_action($modlog, 'blogentry_undeleted');

	foreach (array_keys($userlist) AS $userid)
	{
		build_blog_user_counters($userid);
	}
	build_blog_stats();

	// empty cookie
	setcookie('vbulletin_inlineblog', '', TIMENOW - 3600, '/');

	($hook = vBulletinHook::fetch_hook('blog_inlinemod_undeleteentries')) ? eval($hook) : false;

	eval(print_standard_redirect('redirect_inline_undeletedentries', true, $forceredirect));
}

if ($userinfo)
{
	$sidebar =& build_user_sidebar($userinfo);
}
Beispiel #6
0
	/**
	* Updating the votecount for that thread
	*
	* @param	boolean	Do the query?
	*/
	function post_save_each($doquery = true)
	{
		// Are we handleing a multi DM
		if (!$this->condition OR $this->existing['vote'] != $this->fetch_field('vote'))
		{
			if ($this->info['blog'])
			{
				$bloginfo =& $this->info['blog'];
			}
			else
			{ 
				$bloginfo = fetch_bloginfo($this->fetch_field('blogid'));
			}

			if (!$this->condition)
			{
				// Increment the vote count for the thread that has just been voted on
				$blogman =& datamanager_init('Blog', $this->registry, ERRTYPE_SILENT, 'blog');
				$blogman->set_existing($bloginfo);
				$blogman->set('ratingtotal', "ratingtotal + " . intval($this->fetch_field('vote')), false);
				$blogman->set('ratingnum', 'ratingnum + 1', false);
				$blogman->set('rating', 'ratingtotal / ratingnum', false);
				$blogman->save();
			}
			else
			{
				// this is an update
				$votediff = $this->fetch_field('vote') - $this->existing['vote'];

				$blogman =& datamanager_init('Blog', $this->registry, ERRTYPE_SILENT, 'blog');
				$blogman->set_existing($bloginfo);
				$blogman->set('ratingtotal', "ratingtotal + $votediff", false);
				$blogman->set('rating', "ratingtotal / ratingnum", false);
				$blogman->save();
			}

			build_blog_user_counters($bloginfo['userid']);

			if ($this->fetch_field('userid') == $this->registry->userinfo['userid'])
			{
				set_bbarray_cookie('blog_rate', $this->fetch_field('blogid'), $this->fetch_field('vote'), 1);
			}
		}

		($hook = vBulletinHook::fetch_hook('blog_ratedata_postsave')) ? eval($hook) : false;
	}