Exemplo n.º 1
0
	function post_save_each($doquery = true)
	{
		$blogid = intval($this->fetch_field('blogid'));
		$userid = intval($this->fetch_field('userid'));
		$blogtextid = $this->fetch_field('blogtextid');
		$postedby_userid = intval($this->fetch_field('postedby_userid'));

		require_once(DIR . '/vb/search/indexcontroller/queue.php');
		vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogEntry', 'index', $blogid);
		vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogComment', 'group_data_change', $blogid);

		if (!$condition AND $this->info['addtags'])
		{
			// invalidate users tag cloud
			$dataman =& datamanager_init('Blog_User', $this->registry, ERRTYPE_SILENT);
			$info = array('bloguserid' => $userid);
			$dataman->set_existing($info);
			$dataman->set('tagcloud', '');
			$dataman->save();
		}

		$this->build_category_counters();
		build_blog_stats();

		// Insert entry for moderation
		if ($this->fetch_field('state') == 'moderation')
		{
			/*insert query*/
			$this->dbobject->query_write("
				INSERT IGNORE INTO " . TABLE_PREFIX . "blog_moderation
					(primaryid, type, dateline)
				VALUES
					($blogid, 'blogid', " . TIMENOW . ")
			");
		}

		// Insert entry for moderation
		if (!$this->condition AND ($this->fetch_field('state') == 'moderation' OR $this->fetch_field('state') == 'draft') OR $this->fetch_field('pending'))
		{
			$userinfo = array('bloguserid' => $userid);
			$userdata =& datamanager_init('Blog_user', $this->registry, ERRTYPE_SILENT);
			$userdata->set_existing($userinfo);
			if ($this->fetch_field('state') == 'moderation' OR $this->fetch_field('state') == 'draft')
			{
				$userdata->set($this->fetch_field('state'), $this->fetch_field('state') . ' + 1', false);
			}
			if ($this->fetch_field('pending'))
			{
				$userdata->set('pending', 'pending + 1', false);
			}
			$userdata->save();
		}

		// Send Email Notification
		if (((!$this->condition AND !$this->fetch_field('pending')) OR $this->info['send_notification']) AND ($this->fetch_field('state') == 'visible' OR $this->fetch_field('state') == 'moderation') AND $this->registry->options['enableemail'])
		{
			$lastposttime = $this->dbobject->query_first("
				SELECT MAX(dateline) AS dateline
				FROM " . TABLE_PREFIX . "blog AS blog
				WHERE blogid = $blogid
					AND dateline < " . $this->fetch_field('dateline') . "
					AND state = 'visible'
			");

			$entrytitle = unhtmlspecialchars($this->fetch_field('title'));
			if (defined('VBBLOG_PERMS') AND $this->registry->userinfo['userid'] == $this->fetch_field('userid'))
			{
				$blogtitle = unhtmlspecialchars($this->registry->userinfo['blog_title']);
				$username = unhtmlspecialchars($this->registry->userinfo['username']);
				$userinfo =& $this->registry->userinfo;
			}
			else
			{
				if (!defined('VBBLOG_PERMS'))
				{	// Tell the fetch_userinfo plugin that we need the blog fields in case this class is being called by a non blog script
					define('VBBLOG_PERMS', true);
				}
				$userinfo = fetch_userinfo($this->fetch_field('userid'), 1);
				cache_permissions($userinfo, false);
				$blogtitle = unhtmlspecialchars($userinfo['blog_title']);
				if ($userinfo['userid'] != $this->fetch_field('userid'))
				{
					$userinfo2 = fetch_userinfo($this->fetch_field('userid'), 1);
					$username = unhtmlspecialchars($userinfo2['username']);
				}
				else
				{
					$username = unhtmlspecialchars($userinfo['username']);
				}
			}

			require_once(DIR . '/includes/class_bbcode_alt.php');
			$plaintext_parser = new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list());
			$pagetext_cache = array(); // used to cache the results per languageid for speed

			$pagetext_orig =& $this->fetch_field('pagetext', 'blog_text');

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

			$useremails = $this->dbobject->query_read_slave("
				SELECT
					user.*,
					blog_subscribeuser.blogsubscribeuserid,
					bm.blogmoderatorid,
					ignored.relationid AS ignoreid, buddy.relationid AS buddyid,
					bu.isblogmoderator, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
				FROM " . TABLE_PREFIX . "blog_subscribeuser AS blog_subscribeuser
				INNER JOIN " . TABLE_PREFIX . "user AS user ON (blog_subscribeuser.userid = user.userid)
				LEFT JOIN " . TABLE_PREFIX . "blog_moderator AS bm ON (bm.userid = user.userid)
				LEFT JOIN " . TABLE_PREFIX . "userlist AS buddy ON (buddy.userid = $userid AND buddy.relationid = user.userid AND buddy.type = 'buddy')
				LEFT JOIN " . TABLE_PREFIX . "userlist AS ignored ON (ignored.userid = $userid AND ignored.relationid = user.userid AND ignored.type = 'ignore')
				LEFT JOIN " . TABLE_PREFIX . "blog_user AS bu ON (bu.bloguserid = user.userid)
				WHERE
					blog_subscribeuser.bloguserid = $userid
						AND
					" . ($userid == $postedby_userid ? "blog_subscribeuser.userid <> $userid AND" : "") . "
					blog_subscribeuser.type = 'email'
						AND
					user.usergroupid <> 3
						AND
					user.lastactivity >= " . intval($lastposttime['dateline']) . "
			");

			vbmail_start();

			$setoptions = $this->fetch_field('options');

			$evalemail = array();
			while ($touser = $this->dbobject->fetch_array($useremails))
			{
				cache_permissions($touser, false);
				// only send private entries to contacts and moderators
				if ($setoptions["{$this->bitfields['options']['private']}"] AND !$touser['buddyid'] AND !$touser['blogmoderatorid'] AND !is_member_of_blog($touser, $userinfo))
				{
					continue;
				}

				if (!($this->registry->usergroupcache["$touser[usergroupid]"]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']))
				{
					continue;
				}

				if ($this->fetch_field('state') == 'moderation')
				{
					if ($touser['userid'] != $userid AND !can_moderate_blog('canmoderateentries', $touser))
					{
						continue;
					}
				}

				if (!empty($this->info['categories']))
				{
					prepare_blog_category_permissions($touser);
					if (array_intersect($touser['blogcategorypermissions']['cantview'], $this->info['categories']) AND $userinfo['userid'] != $touser['userid'])
					{
						continue;
					}
				}

				if (!($touser['permissions']['vbblog_general_permissions'] & $this->registry->bf_ugp_vbblog_general_permissions['blog_canviewothers']))
				{
					continue;
				}
				else if (
					!$touser['blogmoderatorid']
						AND
					!($touser['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel'])
						AND
					!($touser['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['ismoderator'])
						AND
					(!$userinfo['ignore_canviewmyblog'] OR !$touser['ignoreid'])
						AND
					(!$userinfo['buddy_canviewmyblog'] OR !$touser['buddyid'])
						AND
					(!$userinfo['member_canviewmyblog'] OR (!$userinfo['buddy_canviewmyblog'] AND $touser['budyid']) OR (!$userinfo['ignore_canviewmyblog'] AND $touser['ignoreid']))
						AND
					!is_member_of_blog($touser, $userinfo)
				)
				{
					continue;
				}

				$touser['username'] = unhtmlspecialchars($touser['username']);
				$touser['languageid'] = iif($touser['languageid'] == 0, $this->registry->options['languageid'], $touser['languageid']);
				$touser['auth'] = md5($touser['userid'] . $touser['blogsubscribeuserid'] . $touser['salt'] . COOKIE_SALT);

				if (empty($evalemail))
				{
					$email_texts = $this->dbobject->query_read_slave("
						SELECT text, languageid, fieldname
						FROM " . TABLE_PREFIX . "phrase
						WHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'blog_user_notify'
					");

					while ($email_text = $this->dbobject->fetch_array($email_texts))
					{
						$emails["$email_text[languageid]"]["$email_text[fieldname]"] = $email_text['text'];
					}

					require_once(DIR . '/includes/functions_misc.php');

					foreach ($emails AS $languageid => $email_text)
					{
						// lets cycle through our array of notify phrases
						$text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody'])));
						$text_message = replace_template_variables($text_message);
						$text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject'])));
						$text_subject = replace_template_variables($text_subject);

						$evalemail["$languageid"] = '
							$message = "' . $text_message . '";
							$subject = "' . $text_subject . '";
						';
					}
				}

				// parse the page text into plain text, taking selected language into account
				if (!isset($pagetext_cache["$touser[languageid]"]))
				{
					$plaintext_parser->set_parsing_language($touser['languageid']);
					$pagetext_cache["$touser[languageid]"] = $plaintext_parser->parse($pagetext_orig);
				}
				$pagetext = $pagetext_cache["$touser[languageid]"];

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

				eval(iif(empty($evalemail["$touser[languageid]"]), $evalemail["-1"], $evalemail["$touser[languageid]"]));

				vbmail($touser['email'], $subject, $message);
			}
			unset($plaintext_parser, $pagetext_cache);

			vbmail_end();
		}

		$this->post_save_each_blogtext($doquery);

		if ($this->fetch_field('dateline') <= TIMENOW)
		{
			$this->insert_dupehash($this->fetch_field('blogid'));
		}

		if ($this->condition AND $this->info['emailupdate'] == 'none' AND ($userid != $this->registry->userinfo['userid'] OR ($userid == $this->registry->userinfo['userid'] AND $this->existing['entrysubscribed'])))
		{
			$this->dbobject->query_write("
				DELETE FROM " . TABLE_PREFIX . "blog_subscribeentry
				WHERE blogid = $blogid AND userid = $userid
			");
		}
		else if ($this->info['emailupdate'] == 'email' OR $this->info['emailupdate'] == 'usercp')
		{
			$this->dbobject->query_write("
				REPLACE INTO " . TABLE_PREFIX . "blog_subscribeentry
				(blogid, dateline, type, userid)
				VALUES
				($blogid, " . TIMENOW . ", '" . $this->info['emailupdate'] . "', $userid)
			");
		}

		($hook = vBulletinHook::fetch_hook('blog_fpdata_postsave')) ? eval($hook) : false;
	}
Exemplo n.º 2
0
	/**
	* Deletes a forum and its associated data from the database
	*/
	function delete()
	{
		// fetch list of forums to delete
		$forumlist = '';

		// Search index maintenance - Forum delete (calls delete index on threads -> posts)
		require_once DIR . '/vb/search/indexcontroller/queue.php' ;

		$forums = $this->dbobject->query_read_slave("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE " . $this->condition);
		while($thisforum = $this->dbobject->fetch_array($forums))
		{
			$forumlist .= ',' . $thisforum['forumid'];
			vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'Forum', 'delete', $thisforum['forumid']);
		}
		$this->dbobject->free_result($forums);

		$forumlist = substr($forumlist, 1);

		if ($forumlist == '')
		{
			// nothing to do
			$this->error('invalid_forum_specified');
		}
		else
		{
			$condition = "forumid IN ($forumlist)";

			// delete from extra data tables
			$this->db_delete(TABLE_PREFIX, 'forumpermission', $condition);
			$this->db_delete(TABLE_PREFIX, 'access',          $condition);
			$this->db_delete(TABLE_PREFIX, 'moderator',       $condition);
			$this->db_delete(TABLE_PREFIX, 'announcement',    $condition);
			$this->db_delete(TABLE_PREFIX, 'subscribeforum',  $condition);
			$this->db_delete(TABLE_PREFIX, 'tachyforumpost',  $condition);
			$this->db_delete(TABLE_PREFIX, 'podcast',         $condition);
			$this->db_delete(TABLE_PREFIX, 'forumprefixset',  $condition);

			require_once(DIR . '/includes/functions_databuild.php');

			// delete threads in specified forums
			$threads = $this->dbobject->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "thread WHERE $condition");
			while ($thread = $this->dbobject->fetch_array($threads))
			{
				$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
				$threadman->set_existing($thread);
				$threadman->set_info('skip_moderator_log', true);
				$threadman->delete($this->registry->forumcache["$thread[forumid]"]['options'] & $this->registry->bf_misc_forumoptions['countposts']);
				unset($threadman);
			}
			$this->dbobject->free_result($threads);

			$this->db_delete(TABLE_PREFIX, 'forum', $condition);

			build_forum_permissions();

			($hook = vBulletinHook::fetch_hook('forumdata_delete')) ? eval($hook) : false;
		}
	}
Exemplo n.º 3
0
 /**
  * Deletes a thread with the first post
  *
  * @param	boolean	Whether to consider updating post counts, regardless of forum's settings
  * @param	boolean	Whether to physically remove the thread from the database
  * @param	array	Array of information for a soft delete
  * @param	boolean	Whether to add an entry to the moderator log
  *
  * @return	mixed	The number of affected rows
  */
 function delete($countposts = true, $physicaldel = true, $delinfo = NULL, $dolog = true)
 {
     require_once DIR . '/vb/search/core.php';
     // TODO: follow up on and check $this->existing['threadid']
     if ($threadid = $this->existing['threadid']) {
         // Search index maintenance
         if ($physicaldel) {
             require_once DIR . '/vb/search/indexcontroller/queue.php';
             vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'Post', 'delete', $threadid);
             require_once DIR . '/includes/class_taggablecontent.php';
             $content = vB_Taggable_Content_Item::create($this->registry, "vBForum_Thread", $threadid);
             $content->delete_tag_attachments();
         }
     }
     ($hook = vBulletinHook::fetch_hook('threadfpdata_delete')) ? eval($hook) : false;
     return parent::delete($countposts, $physicaldel, $delinfo, $this->info['skip_moderator_log'] !== null ? !$this->info['skip_moderator_log'] : $dolog);
 }
Exemplo n.º 4
0
 /**
  * Deleted a SG Message
  * 
  * @param 	bool, added for PHP 5.4 Strict Standards compliance
  * @return	boolean	Was this message deleted successfully?
  */
 function delete($doquery = true)
 {
     if ($gmid = $this->existing['gmid']) {
         $db =& $this->registry->db;
         // Search index maintenance - Remove for a hard delete.
         require_once DIR . '/vb/search/core.php';
         if ($this->info['hard_delete']) {
             $db->query_write("DELETE FROM " . TABLE_PREFIX . "deletionlog WHERE primaryid = {$gmid} AND type = 'groupmessage'");
             $db->query_write("DELETE FROM " . TABLE_PREFIX . "groupmessage WHERE gmid = {$gmid}");
             $db->query_write("DELETE FROM " . TABLE_PREFIX . "moderation WHERE primaryid = {$gmid} AND type = 'groupmessage'");
             vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'SocialGroupMessage', 'delete', $gmid);
             $activity = new vB_ActivityStream_Manage('socialgroup', 'groupmessage');
             $activity->set('contentid', $gmid);
             $activity->delete();
             // Logging?
         } else {
             $this->set('state', 'deleted');
             $this->save();
             vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'SocialGroupMessage', 'index', $gmid);
             $deletionman =& datamanager_init('Deletionlog_GroupMessage', $this->registry, ERRTYPE_SILENT, 'deletionlog');
             $deletionman->set('primaryid', $gmid);
             $deletionman->set('type', 'groupmessage');
             $deletionman->set('userid', $this->registry->userinfo['userid']);
             $deletionman->set('username', $this->registry->userinfo['username']);
             $deletionman->set('reason', $this->info['reason']);
             $deletionman->save();
             unset($deletionman);
         }
         $db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation WHERE primaryid = {$gmid} AND type = 'groupmessage'\n\t\t\t");
         if (!$this->info['skip_build_counters']) {
             require_once DIR . '/includes/functions_socialgroup.php';
             build_discussion_counters($this->existing['discussionid']);
             build_group_counters($this->info['group']['groupid']);
         }
         $this->post_delete();
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 /**
  * Any code to run after deleting
  *
  * @param	Boolean Do the query?
  */
 function post_delete($doquery = true)
 {
     if (!defined('MYSQL_VERSION')) {
         $mysqlversion = $this->registry->db->query_first("SELECT version() AS version");
         define('MYSQL_VERSION', $mysqlversion['version']);
     }
     $enginetype = version_compare(MYSQL_VERSION, '4.0.18', '<') ? 'TYPE' : 'ENGINE';
     $tabletype = version_compare(MYSQL_VERSION, '4.1', '<') ? 'HEAP' : 'MEMORY';
     $aggtable = 'aaggregate_temp_' . $this->registry->userinfo['userid'] . '_' . $this->fetch_field('groupid') . '_' . TIMENOW;
     $this->registry->db->query_write("\n\t\t\tCREATE TABLE IF NOT EXISTS " . TABLE_PREFIX . "{$aggtable} (\n\t\t\t\tuserid INT UNSIGNED NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY (userid)\n\t\t\t) {$enginetype} = {$tabletype}\n\t\t");
     if ($this->registry->options['usemailqueue'] == 2) {
         $this->registry->db->lock_tables(array($aggtable => 'WRITE', 'socialgroupmember' => 'WRITE'));
     }
     $this->registry->db->query_write("\n\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "{$aggtable}\n\t\t\tSELECT userid\n\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember\n\t\t\tWHERE groupid = " . $this->fetch_field('groupid') . "\n\t\t\t\tAND type = 'invited'\n\t\t");
     // A user's 'type' doesn't seem to change when a group's type is changed. Why is this?
     // e.g. a 'moderated' user doesn't become a member if a moderated group is made public
     $result = array();
     if ($this->fetch_field('creatoruserid')) {
         $result = $this->registry->db->query_first("\n\t\t\t\tSELECT COUNT(*) AS count\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember\n\t\t\t\tWHERE groupid = " . $this->fetch_field('groupid') . "\n\t\t\t\t\tAND type = 'moderated'\n\t\t\t");
     }
     if ($this->registry->options['usemailqueue'] == 2) {
         $this->registry->db->unlock_tables();
     }
     $this->registry->db->query_write("DELETE FROM " . TABLE_PREFIX . "socialgroupmember WHERE groupid = " . $this->fetch_field('groupid'));
     $this->registry->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "user AS user," . TABLE_PREFIX . "{$aggtable} AS aggregate\n\t\t\tSET socgroupinvitecount = IF(socgroupinvitecount > 0, socgroupinvitecount - 1, 0)\n\t\t\tWHERE user.userid = aggregate.userid\n\t\t");
     if ($result['count']) {
         $this->registry->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\tSET socgroupreqcount = IF(socgroupreqcount >= {$result['count']}, socgroupreqcount - {$result['count']}, 0)\n\t\t\t\tWHERE userid = " . $this->fetch_field('creatoruserid') . "\n\t\t\t");
     }
     $this->registry->db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . $aggtable);
     // delete picture references
     $contenttypeid = vB_Types::instance()->getContentTypeID('vBForum_SocialGroup');
     $attachids = array();
     $ids = $this->registry->db->query_read("\n\t\t\tSELECT attachmentid\n\t\t\tFROM " . TABLE_PREFIX . "attachment\n\t\t\tWHERE contentid = " . intval($this->fetch_field('groupid')) . " AND\n\t\t\t\tcontenttypeid = {$contenttypeid}\t\n\t\t");
     while ($id = $this->registry->db->fetch_array($ids)) {
         $attachids[] = $id['attachmentid'];
     }
     if ($attachids) {
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "attachment\n\t\t\t\tWHERE attachmentid IN (" . implode(",", $attachids) . ")\n\t\t\t");
         $activity = new vB_ActivityStream_Manage('socialgroup', 'photo');
         $activity->set('contentid', $attachids);
         $activity->delete();
     }
     vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'SocialGroup', 'delete', $this->fetch_field('groupid'));
     $gms_to_delete = array();
     $gmids = $this->registry->db->query_read("SELECT gmid FROM " . TABLE_PREFIX . "discussion AS discussion\n\t\t\t INNER JOIN " . TABLE_PREFIX . "groupmessage AS gm\n\t\t\t  ON (gm.discussionid = discussion.discussionid)\n\t\t\t WHERE discussion.groupid = " . intval($this->fetch_field('groupid')));
     while ($gmid = $this->registry->db->fetch_array($gmids)) {
         $gms_to_delete[] = $gmid['gmid'];
         vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'SocialGroupMessage', 'delete', $gmid['gmid']);
     }
     $this->registry->db->free_result($gmids);
     if (!empty($gms_to_delete)) {
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation\n\t\t\t\tWHERE type = 'groupmessage'\n\t\t\t\t\tAND primaryid IN (" . implode(', ', $gms_to_delete) . ")\n\t\t\t");
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "deletionlog\n\t\t\t\tWHERE type = 'groupmessage'\n\t\t\t\t\tAND primaryid IN (" . implode(', ', $gms_to_delete) . ")\n\t\t\t");
         $this->registry->db->query_write("\n\t\t\t\tDELETE " . TABLE_PREFIX . "groupmessage\n\t\t\t\tFROM " . TABLE_PREFIX . "groupmessage\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "discussion ON (" . TABLE_PREFIX . "discussion.discussionid = " . TABLE_PREFIX . "groupmessage.discussionid)\n\t\t\t\tWHERE " . TABLE_PREFIX . "discussion.groupid = " . $this->fetch_field('groupid'));
         $activity = new vB_ActivityStream_Manage('socialgroup', 'groupmessage');
         $activity->set('contentid', $gms_to_delete);
         $activity->delete();
     }
     // delete subscribed discussions
     $this->registry->db->query_write("\n\t\t\tDELETE " . TABLE_PREFIX . "subscribediscussion\n\t\t\tFROM " . TABLE_PREFIX . "subscribediscussion\n\t\t\tINNER JOIN " . TABLE_PREFIX . "discussion ON (" . TABLE_PREFIX . "discussion.discussionid = " . TABLE_PREFIX . "subscribediscussion.discussionid)\n\t\t\t AND " . TABLE_PREFIX . "discussion.groupid = " . intval($this->fetch_field('groupid')) . "\n\t\t");
     // delete discussion readmarking
     $this->registry->db->query_write("\n\t\t\tDELETE " . TABLE_PREFIX . "discussionread\n\t\t\tFROM " . TABLE_PREFIX . "discussionread\n\t\t\tINNER JOIN " . TABLE_PREFIX . "discussion\n\t\t\t ON (" . TABLE_PREFIX . "discussion.discussionid = " . TABLE_PREFIX . "discussionread.discussionid)\n\t\t\t AND " . TABLE_PREFIX . "discussion.groupid = " . intval($this->fetch_field('groupid')) . "\n\t\t");
     $idlist = array();
     $ids = $this->registry->db->query_read("\n\t\t\tSELECT discussionid\n\t\t\tFROM " . TABLE_PREFIX . "discussion\n\t\t\tWHERE groupid = " . intval($this->fetch_field('groupid')));
     while ($id = $this->registry->db->fetch_array($ids)) {
         $idlist[] = $id['discussionid'];
     }
     if ($idlist) {
         $activity = new vB_ActivityStream_Manage('socialgroup', 'discussion');
         $activity->set('contentid', $idlist);
         $activity->delete();
     }
     // delete discussions
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "discussion\n\t\t\tWHERE groupid = " . intval($this->fetch_field('groupid')));
     // delete group subscriptions
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "subscribegroup\n\t\t\tWHERE " . TABLE_PREFIX . "subscribegroup.groupid = " . intval($this->fetch_field('groupid')) . "\n\t\t");
     // delete readmarking
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "groupread\n\t\t\tWHERE " . TABLE_PREFIX . "groupread.groupid = " . intval($this->fetch_field('groupid')) . "\n\t\t");
     // delete group icon
     $groupicon =& datamanager_init('SocialGroupIcon', $this->registry, ERRTYPE_STANDARD);
     $groupicon->condition = "groupid = " . intval($this->fetch_field('groupid'));
     $groupicon->delete();
     unset($groupicon);
     // update moderation count for owner
     update_owner_pending_gm_count($this->fetch_field('creatoruserid'));
     // update category cloud
     fetch_socialgroup_category_cloud(true);
     // update newest groups
     fetch_socialgroup_newest_groups(true, false, !$this->registry->options['sg_enablesocialgroupicons']);
     $activity = new vB_ActivityStream_Manage('socialgroup', 'group');
     $activity->set('contentid', $this->fetch_field('groupid'));
     $activity->delete();
     ($hook = vBulletinHook::fetch_hook('socgroupdata_delete')) ? eval($hook) : false;
 }
Exemplo n.º 6
0
		$attachdata =& datamanager_init('Attachment', $vbulletin, ERRTYPE_ARRAY, 'attachment');
		$attachdata->set('userid', $attachment['userid']);
		$attachdata->set('dateline', $attachment['dateline']);
		$attachdata->set('contentid', $postassoc["$attachment[contentid]"]);
		$attachdata->set('state', $attachment['state']);
		$attachdata->set('contenttypeid', $contenttypeid);
		$attachdata->set('filedataid', $attachment['filedataid']);
		$attachdata->set('filename', $attachment['filename']);
		$attachdata->set('displayorder', $attachment['displayorder']);
		$attachdata->save();
		unset($attachdata);
	}

	foreach($dupeposts AS $oldid => $newid)
	{
		vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'Post', 'index', $newid);
	}

	// Insert Moderated Posts
	if (!empty($hiddeninfo))
	{
		/*insert query*/
		$db->query_write("
			INSERT INTO " . TABLE_PREFIX . "moderation
			(primaryid, type, dateline)
			VALUES
			" . implode(', ', $hiddeninfo) . "
		");
	}

	// Insert Deleted Posts