예제 #1
0
파일: content.php 프로젝트: hungnv0789/vhtm
	/**
	 * Removes content from the indes.
	 */
	protected function deleteSearchContent()
	{
		if (!$type_info = vB_Search_Core::get_instance()->get_indexed_types($this->item->getContentTypeId()))
		{
			//$this->item->getId() (returns the contentid) reflects the value prior to saving anything.
			//this means that on first save it will be 0 because the content record hasn't been set yet.
			vB_Search_Indexcontroller_Queue::indexQueue($this->item->getPackage(), $this->item->getClass(), 'delete', $this->getField('contentid'));
		}
	}
예제 #2
0
         }
         $message['group_name'] = $group['name'];
         $message['discussion_name'] = $discussion['title'];
         $messagearray["{$message['gmid']}"] = $message;
         $discussionlist["{$discussion['discussionid']}"] = true;
         $grouplist["{$group['groupid']}"] = true;
     }
 }
 if (empty($messagearray)) {
     standard_error(fetch_error('you_did_not_select_any_valid_messages'));
 }
 require_once DIR . '/vb/search/indexcontroller/queue.php';
 $db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "deletionlog\n\t\tWHERE type = 'groupmessage' AND\n\t\t\tprimaryid IN(" . implode(',', array_keys($messagearray)) . ")\n\t");
 $db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "groupmessage\n\t\tSET state = 'visible'\n\t\tWHERE gmid IN(" . implode(',', array_keys($messagearray)) . ")\n\t");
 foreach (array_keys($messagearray) as $gmid) {
     vB_Search_Indexcontroller_Queue::indexQueue('vBForum', 'SocialGroupMessage', 'index', $gmid, null, null);
 }
 foreach (array_keys($discussionlist) as $discussionid) {
     build_discussion_counters($discussionid);
 }
 foreach (array_keys($grouplist) as $groupid) {
     build_group_counters($groupid);
 }
 foreach ($messagearray as $message) {
     if (!$message['is_group_owner']) {
         if ($message['firstpost']) {
             log_moderator_action($message, 'discussion_by_x_for_y_undeleted', array($message['postusername'], $message['group_name']));
         } else {
             log_moderator_action($message, 'gm_by_x_in_y_for_z_undeleted', array($message['postusername'], $message['discussion_name'], $message['group_name']));
         }
     }
예제 #3
0
 /**
  * Code to run after Saving a Visitor Message
  *
  * @param	boolean	Do the query?
  */
 function post_save_once($doquery = true)
 {
     $vmid = intval($this->fetch_field('vmid'));
     vB_Search_Indexcontroller_Queue::indexQueue('vBForum', 'VisitorMessage', 'index', $vmid);
     if (!$this->condition) {
         if ($this->fetch_field('userid')) {
             $this->insert_dupehash($this->fetch_field('userid'));
         }
         $activity = new vB_ActivityStream_Manage('forum', 'visitormessage');
         $activity->set('contentid', $this->fetch_field('vmid'));
         $activity->set('userid', $this->fetch_field('postuserid'));
         $activity->set('dateline', $this->fetch_field('dateline'));
         $activity->set('action', 'create');
         $activity->save();
     }
     if (!$this->info['profileuser']) {
         $this->info['profileuser'] = fetch_userinfo($this->fetch_field('userid'));
     }
     if ($this->info['profileuser'] and !in_coventry($this->fetch_field('postuserid'), true)) {
         $userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
         $userdata->set_existing($this->info['profileuser']);
         if ($this->fetch_field('state') == 'visible') {
             if (!$this->condition and !$this->fetch_field('messageread')) {
                 // new vm, not been read, visible -> increase unread count
                 $userdata->set('vmunreadcount', 'vmunreadcount + 1', false);
             } else {
                 if ($this->condition and $this->fetch_field('messageread') and isset($this->existing['messageread']) and !$this->existing['messageread']) {
                     // existing vm going from unread to read -> decrease unread count
                     // isset() check ensures that messageread info was explicitly passed in
                     $userdata->set('vmunreadcount', 'vmunreadcount - 1', false);
                 }
             }
         }
         if ($this->fetch_field('state') == 'visible' and $this->existing['state'] == 'moderation') {
             // moderated message made visible -> decrease moderated count
             $userdata->set('vmmoderatedcount', 'vmmoderatedcount - 1', false);
         } else {
             if ($this->fetch_field('state') == 'moderation' and $this->fetch_field('state') != $this->existing['state']) {
                 // message is moderated and wasn't moderated before -> increase moderated count
                 $userdata->set('vmmoderatedcount', 'vmmoderatedcount + 1', false);
             }
         }
         $userdata->save();
     }
     if ($this->fetch_field('state') == 'moderation') {
         /*insert query*/
         $this->dbobject->query_write("\n\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "moderation\n\t\t\t\t\t(primaryid, type, dateline)\n\t\t\t\tVALUES\n\t\t\t\t\t({$vmid}, 'visitormessage', " . TIMENOW . ")\n\t\t\t");
     } else {
         if ($this->fetch_field('state') == 'visible' and $this->existing['state'] == 'moderation') {
             // message was made visible, remove the moderation record
             $this->dbobject->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation\n\t\t\t\tWHERE primaryid = {$vmid} AND type = 'visitormessage'\n\t\t\t");
         }
     }
     ($hook = vBulletinHook::fetch_hook('visitormessagedata_postsave')) ? eval($hook) : false;
 }
예제 #4
0
파일: content.php 프로젝트: hungnv0789/vhtm
	/**
	 * Main entry point for the controller.
	 *
	 * @return string							- The final page output
	 */
	public function actionPublishNode()
	{
		// Create AJAX view for html replacement
		$view = new vB_View_AJAXHTML('cms_publish_view');
		$view->title = new vB_Phrase('vbcms', 'publishing_page');

		vB::$vbulletin->input->clean_array_gpc('r', array(
			'do' => vB_Input::TYPE_STR,
			'publishdate' => vB_Input::TYPE_UNIXTIME
		));

		if ((vB::$vbulletin->GPC['do'] == 'save') AND $this->verifyPostId())
		{
			$publishdate = vB::$vbulletin->GPC['publishdate'];

			$nodedm = new vBCms_DM_Node();
			$nodedm->setExisting($this->node);
			$nodedm->set('publishdate', vB::$vbulletin->GPC['publishdate']);

			if (!$nodedm->save())
			{
				$view->addErrors($nodedm->getErrors());
				return $this->saveError($view, 'Node DM save failed');
			}

			//We need to see if we have a content node to index.
			$contenttypeid = $this->node->getContenttypeId();
			$index_controller = vB_Search_Core::get_instance()->get_index_controller_by_id($contenttypeid);

			if (!($index_controller instanceof vb_Search_Indexcontroller_Null))
			{
				$classinfo = vB_Types::instance()->getContentClassFromId($contenttypeid);
				vB_Search_Indexcontroller_Queue::indexQueue($classinfo['package'], $classinfo['class'], 'index', $this->node->getId());
			}

			$published = ($publishdate AND ($publishdate <= TIMENOW));

			if ($published != $this->node->isPublished())
			{
				$finishurl = vBCms_Route_Content::getURL(array('node' => $this->node->getNodeId(), 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')));
				$view->setUrl(vB_View_AJAXHTML::URL_FINISHED, $finishurl);
			}

			$status_phrase = new vB_Phrase('vbcms', $published ? 'page_published' : 'page_unpublished');
			$view->setStatus(vB_View_AJAXHTML::STATUS_FINISHED, $status_phrase);
		}
		else
		{
			// get the delete view
			$publishview = new vB_View('vbcms_publish_form');

			// add datepicker for date
			$publishview->datepicker = new vB_View_DatePicker();
			$publishview->datepicker->setDate($this->node->getPublishDate());
			$publishview->datepicker->setLabel(new vB_Phrase('vbcms', 'publish_date'));
			$publishview->datepicker->setDateVar('publishdate');

			// item id to ensure form is submitted to us
			$this->addPostId($publishview);

			// add form to the html replacement output
			$view->setContent($publishview);

			// send the view
			// TODO: update overlay handler to accept an empty status
			$view->setStatus(vB_View_AJAXHTML::STATUS_VIEW, '&nbsp;');
		}

		return $view->render(true);
	}