Пример #1
0
     $show['inlinemod'] = true;
 }
 // Add moderation options
 show_group_inlinemoderation(false, $show, $do_discussions);
 $show['unapprove'] = $show['approve'];
 // Remove approval if we are viewing deleted
 if ($type == 'deleted') {
     $show['approve'] = false;
 } else {
     if ($type != 'new') {
         $show['undelete'] = false;
         $show['unapprove'] = false;
     }
 }
 // Create bit factory
 $bitfactory = new vB_Group_Bit_Factory($vbulletin, $itemtype);
 // Build message bits for all items
 $messagebits = '';
 while ($item = $collection->fetch_item()) {
     if (!$do_discussions) {
         $discussion = fetch_socialdiscussioninfo($item['discussionid']);
         $group = fetch_socialgroupinfo($discussion['groupid']);
     } else {
         $group = fetch_socialgroupinfo($item['groupid']);
     }
     // add group name to message
     $group['name'] = fetch_word_wrapped_string(fetch_censored_text($group['name']));
     // force items to be visible
     if ('new' != $type) {
         $item['state'] = 'visible';
     }
Пример #2
0
    // Create message collection
    $collection_factory = new vB_Group_Collection_Factory($vbulletin);
    $collection = $collection_factory->create('discussion', false, $vbulletin->GPC['pagenumber'], false, false, true);
    $collection->set_ignore_marking(false);
    $collection->filter_show_unsubscribed(false);
    // Check if the user is subscribed to any discussions
    if ($collection->fetch_count()) {
        if (!$vbulletin->input->clean_gpc('r', 'viewalldiscussions', TYPE_BOOL)) {
            // only show unread
            $collection->filter_show_read(false);
        }
        $numdiscussions = $collection->fetch_count();
        // Show group name in messages
        $show['group'] = true;
        // Create bit factory
        $bit_factory = new vB_Group_Bit_Factory($vbulletin, $itemtype);
        // Build message bits for all items
        $messagebits = '';
        while ($item = $collection->fetch_item()) {
            $group = fetch_socialgroupinfo($item['groupid']);
            // add group name to message
            $group['name'] = fetch_word_wrapped_string(fetch_censored_text($group['name']));
            // add bit
            $bit =& $bit_factory->create($item, $group);
            $bit->show_moderation_tools(false);
            $messagebits .= $bit->construct();
        }
        $show['discussions'] = true;
        unset($bit, $bit_factory, $collection_factory, $collection);
    }
}
Пример #3
0
 /**
  * Enter description here...
  *
  * @return unknown
  */
 public function render($current_user, $criteria, $template_name = '')
 {
     require_once DIR . "/includes/functions_socialgroup.php";
     require_once DIR . "/includes/class_groupmessage.php";
     $user = vB_Legacy_User::createFromIdCached($this->discussion->getUserId());
     $item = $this->discussion->getInfo($current_user->get_field('userid'));
     $item = array_merge($item, $user->get_record());
     $item['issearch'] = true;
     $group = $this->discussion->getSocialGroup();
     if ($group->has_modperm('canviewdeleted', $current_user)) {
         $dellog = $this->discussion->getDeletionLogArray();
         $item['del_username'] = $dellog['username'];
         $item['del_userid'] = $dellog['userid'];
         $item['del_reason'] = $dellog['reason'];
     }
     //I'm not sure what these are for, but they exist in the template so we should
     //make sure they are set.  The main message display code does not appear to
     //set them.
     global $show;
     $show['group'] = false;
     global $vbulletin;
     $factory = new vB_Group_Bit_Factory($vbulletin);
     $bit = $factory->create($item, $this->discussion->getSocialGroup()->get_record());
     //unfortunately the bit render can set the $show['inlinemod'] variable which we are
     //currently using across all templates to handle the inline mod settings.  We should
     //probably rely on something a little less global but that's not in the cards right now.
     //make sure that we honor the starting value and restore it when we are done.
     $inlinemod = $show['inlinemod'];
     $bit->show_moderation_tools($inlinemod);
     $text = $bit->construct();
     $show['inlinemod'] = $inlinemod;
     //todo this is ugly and invalid html.  We need to get the message_list
     //id out of here and convert the css to use a class for that formatting
     //but lets wait until we figure out what the new look and feel is going
     //do to or for us.
     return $text;
 }
Пример #4
0
 require_once DIR . '/includes/class_xml.php';
 $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
 $xml->add_group('commentbits');
 require_once DIR . '/includes/class_groupmessage.php';
 // create message collection
 $collection_factory = new vB_Group_Collection_Factory($vbulletin, $group);
 $collection = $collection_factory->create($messageinfo['gmid'] ? 'message' : 'recentmessage', $discussion['discussionid'], false, false, false, true);
 if ($messageinfo['gmid']) {
     $collection->filter_id($messageinfo['gmid']);
 } else {
     $collection->set_dateline($vbulletin->GPC['lastcomment'], $gmid);
 }
 // add hook for manipulating query
 $collection->set_query_hook('group_message_post_ajax');
 // create bit factory for rendering messages
 $bitfactory = new vB_Group_Bit_Factory($vbulletin, 'message');
 // build response for each message
 while ($message = $collection->fetch_item()) {
     $bit = $bitfactory->create($message, $group);
     if ($vbulletin->GPC['hideinlinemod']) {
         $bit->show_moderation_tools(false);
     }
     $xml->add_tag('message', process_replacement_vars($bit->construct()), array('gmid' => $message['gmid'], 'visible' => $message['state'] == 'visible' ? 1 : 0, 'bgclass' => $bgclass, 'quickedit' => 1));
 }
 unset($bitfactory, $bit, $collection_factory, $collection);
 exec_sg_mark_as_read('discussion', $discussion['discussionid'], $vbulletin->userinfo['username']);
 // send notifications
 if (!$messageinfo and $discussion['subscribers'] and !fetch_group_auto_moderation($group)) {
     exec_send_sg_notification($discussion['discussionid'], $gmid, $postusername = false);
 }
 $xml->add_tag('time', TIMENOW);
Пример #5
0
	public function render($current_user, $criteria, $template_name = '')
	{
		require_once(DIR . "/includes/functions_socialgroup.php");
		require_once(DIR . "/includes/class_groupmessage.php");
		global $vbulletin;

		$user = vB_Legacy_User::createFromIdCached($this->message->getPostUserId(), FETCH_USERINFO_AVATAR);
		$item = $this->message->getInfo();
		if (strlen($template_name))
		{
			if ($record = vB::$vbulletin->db->query_first("SELECT gm.*, gr.groupid,
			disc.discussionid, starter.postuserid AS poststarterid, starter.postusername AS poststarter,
			disc.firstpostid, starter.title AS firsttitle, gr.groupid, gr.name AS groupname
			 FROM " . TABLE_PREFIX .
				"groupmessage AS gm\n INNER JOIN " . TABLE_PREFIX .
				"discussion AS disc ON disc.discussionid = gm.discussionid\n INNER JOIN " . TABLE_PREFIX .
				"socialgroup AS gr ON gr.groupid = disc.groupid\n INNER JOIN " . TABLE_PREFIX .
				"groupmessage AS starter ON starter.gmid = disc.firstpostid\n WHERE gm.gmid = " . $item['gmid'] ))
			{
				$item = array_merge($item, $record);
			}

			if (!$this->bbcode_parser)
			{
				$this->bbcode_parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list());
			}
			$item['previewtext'] = fetch_censored_text($this->bbcode_parser->get_preview($item['pagetext'], 200));
			$template = vB_Template::create($template_name);
			$template->register('item', $item);
			$template->register('dateformat', $vbulletin->options['dateformat']);
			$template->register('timeformat', $vbulletin->options['default_timeformat']);
			return $template->render();
		}

		$item = array_merge($item, $user->get_record());
		$item['hascustom'] = $item['hascustomavatar'];
		$item['issearch'] = true;

		$group = $this->message->getDiscussion()->getSocialGroup();
		if ($group->has_modperm('canviewdeleted', $current_user))
		{
			$dellog = $this->message->getDeletionLogArray();
			$item['del_username'] = $dellog['username'];
			$item['del_userid'] = $dellog['userid'];
			$item['del_reason'] = $dellog['reason'];
		}

		//I'm not sure what these are for, but they exist in the template so we should
		//make sure they are set.  The main message display code does not appear to
		//set them.
		global $show;
		$show['group'] = false;
		$show['discussion'] = false;

		//If we want to create our own template, then we need

		$factory = new vB_Group_Bit_Factory($vbulletin);
		//this gets lookup up by the bit anyway.  Not sure why we need to pass it.
		$group = array();
		$bit = $factory->create($item, $group);

		//unfortunately the bit render can set the $show['inlinemod'] variable which we are
		//currently using across all templates to handle the inline mod settings.  We should
		//probably rely on something a little less global but that's not in the cards right now.
		//make sure that we honor the starting value and restore it when we are done.
		$inlinemod =  $show['inlinemod'];
		$bit->show_moderation_tools($inlinemod);
		$text = $bit->construct();
		$show['inlinemod'] = $inlinemod;

		//todo this is ugly and invalid html.  We need to get the message_list
		//id out of here and convert the css to use a class for that formatting
		//but lets wait until we figure out what the new look and feel is going
		//do to or for us.
		return $text;
	}