/**
  * @see	\wcf\system\worker\IWorker::getProgress()
  */
 public function getProgress()
 {
     $progress = parent::getProgress();
     if ($progress == 100) {
         // unmark users
         ClipboardHandler::getInstance()->unmark($this->parameters['userIDs'], ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user'));
     }
     return $progress;
 }
Example #2
0
 /**
  * @see	wcf\system\worker\IWorker::getProgress()
  */
 public function getProgress()
 {
     $progress = parent::getProgress();
     if ($progress == 100) {
         // clear markings
         $typeID = ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user');
         ClipboardHandler::getInstance()->removeItems($typeID);
         // clear session
         $userMailData = WCF::getSession()->getVar('userMailData');
         unset($userMailData[$this->parameters['mailID']]);
         WCF::getSession()->register('userMailData', $userMailData);
     }
     return $progress;
 }
 /**
  * @see	\wcf\action\ClipboardAction::getEditorItems()
  */
 protected function getEditorItems()
 {
     $returnValues = parent::getEditorItems();
     $returnValues['markedItems'] = array();
     // break if no items are available (status was cached by browser)
     if (empty($returnValues['items'])) {
         return $returnValues;
     }
     // load marked items from runtime cache
     $data = ClipboardHandler::getInstance()->getMarkedItems();
     // insert object ids for each type of marked items
     $returnValues['markedItems'] = array();
     foreach ($data as $typeName => $itemData) {
         $returnValues['markedItems'][$typeName] = array_keys($itemData);
     }
     return $returnValues;
 }
Example #4
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     foreach ($this->userIDs as $userID) {
         if ($userID != $this->destinationUserID) {
             $this->mergedUserIDs[] = $userID;
         }
     }
     parent::save();
     // poll_option_vote
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_poll_option_vote\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // comment
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_comment\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // comment_response
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_comment_response\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // profile comments
     $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.user.profileComment');
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectTypeID = ?", array($objectType->objectTypeID));
     $conditions->add("objectID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_comment\n\t\t\tSET\tobjectID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // like (userID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_like\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // like (objectUserID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_like\n\t\t\tSET\tobjectUserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // like_object
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_like_object\n\t\t\tSET\tobjectUserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_follow (userID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $conditions->add("followUserID <> ?", array($this->destinationUserID));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_follow\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_follow (followUserID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("followUserID IN (?)", array($this->mergedUserIDs));
     $conditions->add("userID <> ?", array($this->destinationUserID));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_follow\n\t\t\tSET\t\tfollowUserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_ignore (userID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $conditions->add("ignoreUserID <> ?", array($this->destinationUserID));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_ignore\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_ignore (ignoreUserID)
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("ignoreUserID IN (?)", array($this->mergedUserIDs));
     $conditions->add("userID <> ?", array($this->destinationUserID));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_ignore\n\t\t\tSET\t\tignoreUserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_object_watch
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE IGNORE\twcf" . WCF_N . "_user_object_watch\n\t\t\tSET\t\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // user_activity_event
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_user_activity_event\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // attachments
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_attachment\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // modification_log
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->mergedUserIDs));
     $sql = "UPDATE\twcf" . WCF_N . "_modification_log\n\t\t\tSET\tuserID = ?\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters()));
     // delete merged users
     $action = new UserAction($this->mergedUserIDs, 'delete');
     $action->executeAction();
     // reset clipboard
     ClipboardHandler::getInstance()->removeItems($this->objectTypeID);
     SessionHandler::resetSessions($this->userIDs);
     $this->saved();
     // show success message
     WCF::getTPL()->assign('message', 'wcf.global.success');
     WCF::getTPL()->display('success');
     exit;
 }
Example #5
0
 /**
  * @see	\wcf\data\IClipboardAction::unmarkAll()
  */
 public function unmarkAll()
 {
     ClipboardHandler::getInstance()->removeItems(ClipboardHandler::getInstance()->getObjectTypeID('de.codequake.cms.page'));
 }
Example #6
0
 /**
  * @see wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('users' => $this->users, 'searchID' => $this->searchID, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user')), 'url' => $this->url, 'columnHeads' => $this->columnHeads, 'columnValues' => $this->columnValues));
 }
 /**
  * Returns the number of marked items.
  * 
  * @return    integer
  */
 public function getMarkedItems()
 {
     return ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.incendium.filebase.file'));
 }
Example #8
0
 /**
  * Validates parameters.
  */
 protected function validate()
 {
     if (empty($this->objectIDs)) {
         throw new AJAXException("Invalid object ids given.");
     }
     if (empty($this->pageClassName)) {
         throw new AJAXException("page not given");
     }
     if ($this->action != 'mark' && $this->action != 'unmark') {
         throw new AJAXException("Clipboard action '" . $this->action . "' is invalid.");
     }
     $this->objectTypeID = !empty($this->type) ? ClipboardHandler::getInstance()->getObjectTypeID($this->type) : null;
     if ($this->objectTypeID === null) {
         throw new AJAXException("object type '" . $this->type . "' is invalid.");
     }
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     EditHistoryManager::getInstance()->bulkRevert($this->userIDs, $this->timeframe * 86400);
     // reset clipboard
     ClipboardHandler::getInstance()->removeItems($this->objectTypeID);
     $this->saved();
     // show success message
     WCF::getTPL()->assign('message', 'wcf.global.success');
     WCF::getTPL()->display('success');
     exit;
 }
 /**
  * Returns the number of marked items.
  * 
  * @return    integer
  */
 public function getMarkedItems()
 {
     return ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.incendium.linklist.entry'));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('category' => $this->category, 'categoryID' => $this->categoryID, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.incendium.filebase.entry')), 'user' => $this->user, 'userID' => $this->userID, 'controller' => 'EntryList', 'defaultSortField' => $this->defaultSortField, 'defaultSortOrder' => $this->defaultSortOrder, 'allowSpidersToIndexThisPage' => true, 'categoryList' => $this->categoryList));
 }
 /**
  * @see wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->userIDs));
     $sql = "SELECT\tuserID, groupID\n\t\t\tFROM\twcf" . WCF_N . "_user_to_group\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $groups = array();
     while ($row = $statement->fetchArray()) {
         $groups[$row['userID']][] = $row['groupID'];
     }
     foreach ($this->users as $user) {
         if (!UserGroup::isAccessibleGroup($groups[$user->userID])) {
             throw new PermissionDeniedException();
         }
         $groupsIDs = array_merge($groups[$user->userID], $this->groupIDs);
         $groupsIDs = array_unique($groupsIDs);
         $userEditor = new UserEditor($user);
         $userEditor->addToGroups($groupsIDs, true, false);
     }
     ClipboardHandler::getInstance()->removeItems($this->typeID);
     SessionHandler::resetSessions($this->userIDs);
     $this->saved();
     WCF::getTPL()->assign('message', 'wcf.acp.user.assignToGroup.success');
     WCF::getTPL()->display('success');
     exit;
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // configuration for dashboard boxes
     DashboardHandler::getInstance()->loadBoxes('de.incendium.cms.NewsOverviewPage', $this);
     WCF::getTPL()->assign(array('letters' => str_split(self::$availableLetters), 'letter' => $this->letter, 'controller' => 'NewsOverview', 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.incendium.cms.news.entry')), 'stats' => $this->stats, 'categoryID' => $this->categoryID, 'category' => $this->category, 'categoryList' => $this->categoryList, 'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'de.incendium.cms.NewsOverviewPage'), 'sidebarName' => 'de.incendium.cms.NewsOverviewPage', 'usersOnlineList' => $this->usersOnlineList, 'statistics' => $this->statistics, 'user' => $this->user, 'userID' => $this->userID, 'sortOrder' => $this->sortOrder, 'allowSpidersToIndexThisPage' => true));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.codequake.cms.stylesheet'))));
 }
 /**
  * Assigns labels to a conversation.
  * 
  * @return	array
  */
 public function assignLabel()
 {
     // remove previous labels (if any)
     $labelIDs = array();
     foreach ($this->labelList as $label) {
         $labelIDs[] = $label->labelID;
     }
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("conversationID IN (?)", array($this->parameters['conversationIDs']));
     $conditions->add("labelID IN (?)", array($labelIDs));
     $sql = "DELETE FROM\twcf" . WCF_N . "_conversation_label_to_object\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     // assign label ids
     if (!empty($this->parameters['labelIDs'])) {
         $sql = "INSERT INTO\twcf" . WCF_N . "_conversation_label_to_object\n\t\t\t\t\t\t(labelID, conversationID)\n\t\t\t\tVALUES\t\t(?, ?)";
         $statement = WCF::getDB()->prepareStatement($sql);
         WCF::getDB()->beginTransaction();
         foreach ($this->parameters['labelIDs'] as $labelID) {
             foreach ($this->parameters['conversationIDs'] as $conversationID) {
                 $statement->execute(array($labelID, $conversationID));
             }
         }
         WCF::getDB()->commitTransaction();
         if (!empty($this->parameters['conversationIDs'])) {
             ClipboardHandler::getInstance()->unmark($this->parameters['conversationIDs'], ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.conversation.conversation'));
         }
     }
     return array('actionName' => 'assignLabel', 'labelIDs' => $this->parameters['labelIDs']);
 }
Example #16
0
 /**
  * @see	\wcf\data\IEditableObject::deleteAll()
  */
 public static function deleteAll(array $objectIDs = array())
 {
     // unmark users
     ClipboardHandler::getInstance()->unmark($objectIDs, ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user'));
     return parent::deleteAll($objectIDs);
 }
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('allowSpidersToIndexThisPage' => true, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.codequake.cms.news'))));
 }
Example #18
0
	/**
	 * Validates parameters.
	 */
	protected function validate() {
		if (empty($this->objectIDs)) {
			throw new UserInputException('objectIDs');
		}
		
		if (empty($this->pageClassName)) {
			throw new UserInputException('pageClassName');
		}
		
		if ($this->action != 'mark' && $this->action != 'unmark') {
			throw new UserInputException('action');
		}
		
		$this->objectTypeID = (!empty($this->type)) ? ClipboardHandler::getInstance()->getObjectTypeID($this->type) : null;
		if ($this->objectTypeID === null) {
			throw new UserInputException('type');
		}
	}
 /**
  * Unmarks entries.
  * 
  * @param    array<integer>        $entryIDs
  */
 protected function unmarkItems(array $entryIDs = array())
 {
     if (empty($entryIDs)) {
         foreach ($this->objects as $entry) {
             $entryIDs[] = $entry->entryID;
         }
     }
     if (!empty($entryIDs)) {
         ClipboardHandler::getInstance()->unmark($entryIDs, ClipboardHandler::getInstance()->getObjectTypeID('de.incendium.filebase.entry'));
     }
 }
Example #20
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('categoryID' => $this->categoryID, 'category' => $this->category, 'categoryList' => $this->categoryList, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.codequake.cms.file'))));
 }
 /**
  * @see wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // send content type
     header('Content-Type: text/' . $this->fileType . '; charset=UTF-8');
     header('Content-Disposition: attachment; filename="export.' . $this->fileType . '"');
     if ($this->fileType == 'xml') {
         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<addresses>\n";
     }
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("userID IN (?)", array($this->userIDs));
     // count users
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $count = $statement->fetchArray();
     // get users
     $sql = "SELECT\t\temail\n\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\temail";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $i = 0;
     while ($row = $statement->fetchArray()) {
         if ($this->fileType == 'xml') {
             echo "<address><![CDATA[" . StringUtil::escapeCDATA($row['email']) . "]]></address>\n";
         } else {
             echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $count['count'] ? $this->separator : '');
         }
         $i++;
     }
     if ($this->fileType == 'xml') {
         echo "</addresses>";
     }
     $this->saved();
     // remove items
     ClipboardHandler::getInstance()->removeItems($this->typeID);
     exit;
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('filter' => $this->filter, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.conversation.conversation')), 'labelID' => $this->labelID, 'labelList' => $this->labelList, 'conversationCount' => $this->conversationCount, 'draftCount' => $this->draftCount, 'hiddenCount' => $this->hiddenCount, 'outboxCount' => $this->outboxCount));
 }
Example #23
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.codequake.cms.page')), 'objectTypeList' => $this->objectTypeList, 'pageList' => $this->pageList));
 }
Example #24
0
 /**
  * delete conversation
  *
  * @param  Object  $oMbqEtPc
  * @param  Integer  $mode
  */
 public function deleteConversation($oMbqEtPc = null, $mode = null)
 {
     $oConversation = $oMbqEtPc->mbqBind['oViewableConversation']->getDecoratedObject();
     $conversationEditor = new ConversationEditor($oConversation);
     if ($mode == 1) {
         $hideConversation = Conversation::STATE_HIDDEN;
     } elseif ($mode == 2) {
         $hideConversation = Conversation::STATE_LEFT;
     } else {
         MbqError::alert('', 'Need valid mode.', '', MBQ_ERR_APP);
     }
     $objectIDs = array($oMbqEtPc->convId->oriValue);
     //ref wcf\data\conversation\ConversationAction::hideConversation()
     $sql = "UPDATE\twcf" . WCF_N . "_conversation_to_user\r\n\t\t\tSET\thideConversation = ?\r\n\t\t\tWHERE\tconversationID = ?\r\n\t\t\t\tAND participantID = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     WCF::getDB()->beginTransaction();
     foreach ($objectIDs as $conversationID) {
         $statement->execute(array($hideConversation, $conversationID, WCF::getUser()->userID));
     }
     WCF::getDB()->commitTransaction();
     // reset user's conversation counters if user leaves conversation
     // permanently
     if ($hideConversation == Conversation::STATE_LEFT) {
         UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'conversationCount');
         UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'unreadConversationCount');
     }
     // add modification log entry
     if ($hideConversation == Conversation::STATE_LEFT) {
         ConversationModificationLogHandler::getInstance()->leave($conversationEditor->getDecoratedObject());
     }
     // unmark items
     ClipboardHandler::getInstance()->unmark($objectIDs, ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.conversation.conversation'));
     if ($hideConversation == Conversation::STATE_LEFT) {
         // update participant summary
         ConversationEditor::updateParticipantSummaries($objectIDs);
         // delete conversation if all users have left it
         $conditionBuilder = new PreparedStatementConditionBuilder();
         $conditionBuilder->add('conversation.conversationID IN (?)', array($objectIDs));
         $conditionBuilder->add('conversation_to_user.conversationID IS NULL');
         $conversationIDs = array();
         $sql = "SELECT\t\tDISTINCT conversation.conversationID\r\n\t\t\t\tFROM\t\twcf" . WCF_N . "_conversation conversation\r\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_conversation_to_user conversation_to_user\r\n\t\t\t\tON\t\t(conversation_to_user.conversationID = conversation.conversationID AND conversation_to_user.hideConversation <> " . Conversation::STATE_LEFT . ")\r\n\t\t\t\t" . $conditionBuilder;
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute($conditionBuilder->getParameters());
         while ($row = $statement->fetchArray()) {
             $conversationIDs[] = $row['conversationID'];
         }
         if (!empty($conversationIDs)) {
             $action = new ConversationAction($conversationIDs, 'delete');
             $action->executeAction();
         }
     }
 }
 /**
  * Unmarks conversations.
  * 
  * @param	array<integer>		$conversationIDs
  */
 protected function unmarkItems(array $conversationIDs = array())
 {
     if (empty($conversationIDs)) {
         $conversationIDs = $this->objectIDs;
     }
     ClipboardHandler::getInstance()->unmark($conversationIDs, ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.conversation.conversation'));
 }
 /**
  * Loads object ids from clipboard.
  * 
  * @return	array<integer>
  */
 protected function getObjectIDs()
 {
     $typeID = ClipboardHandler::getInstance()->getObjectTypeID($this->typeName);
     if ($typeID === null) {
         throw new AJAXException("clipboard item type '" . $this->typeName . "' is unknown");
     }
     $objects = ClipboardHandler::getInstance()->getMarkedItems($typeID);
     if (!count($objects) || !isset($objects[$this->typeName]) || !count($objects[$this->typeName])) {
         return null;
     }
     return array_keys($objects[$this->typeName]);
 }
Example #27
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function readData()
 {
     parent::readData();
     if (empty($_POST)) {
         // get marked user ids
         if (empty($this->action)) {
             // get type id
             $objectTypeID = ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user');
             if ($objectTypeID === null) {
                 throw new SystemException("Unknown clipboard item type 'com.woltlab.wcf.user'");
             }
             // get user ids
             $users = ClipboardHandler::getInstance()->getMarkedItems($objectTypeID);
             if (empty($users)) {
                 throw new IllegalLinkException();
             }
             // load users
             $this->userIDs = array_keys($users);
         }
         if (MAIL_USE_FORMATTED_ADDRESS) {
             $this->from = MAIL_FROM_NAME . ' <' . MAIL_FROM_ADDRESS . '>';
         } else {
             $this->from = MAIL_FROM_ADDRESS;
         }
     }
     if (!empty($this->userIDs)) {
         $this->userList = new UserList();
         $this->userList->getConditionBuilder()->add("user_table.userID IN (?)", array($this->userIDs));
         $this->userList->sqlOrderBy = "user_table.username ASC";
         $this->userList->readObjects();
     }
     $this->groups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE));
 }
Example #28
0
	/**
	 * @see	wcf\data\IClipboardAction::unmarkAll()
	 */
	public function unmarkAll() {
		ClipboardHandler::getInstance()->removeItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user'));
	}
Example #29
0
 /**
  * Unmarks users.
  * 
  * @param	array<integer>		$userIDs
  */
 protected function unmarkItems(array $userIDs = array())
 {
     if (empty($userIDs)) {
         $userIDs = $this->objectIDs;
     }
     if (!empty($userIDs)) {
         ClipboardHandler::getInstance()->unmark($userIDs, ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user'));
     }
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('entry' => $this->entry, 'entryID' => $this->entryID, 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('de.incenduium.filebase.file')), 'userProfile' => $this->userProfile, 'commentCanAdd' => WCF::getUser()->userID && WCF::getSession()->getPermission('user.filebase.canAddComment'), 'commentList' => $this->commentList, 'commentObjectTypeID' => $this->commentObjectTypeID, 'fileList' => $this->fileList, 'lastCommentTime' => $this->commentList ? $this->commentList->getMinCommentTime() : 0, 'likeData' => MODULE_LIKE && $this->commentList ? $this->commentList->getLikeData() : array(), 'userEntryList' => $this->userEntryList, 'tags' => $this->tags, 'entryLikeData' => $this->entryLikeData, 'attachmentList' => $this->entry->getAttachments(), 'allowSpidersToIndexThisPage' => true));
 }