WHERE banned = ?";
$statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
$statement->execute(array(1));
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
break;
case 'newest':
ORDER BY user_table.registrationDate DESC";
$statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
$statement->execute();
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
break;
case 'disabled':
ORDER BY user_table.registrationDate DESC";
$statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
$statement->execute(array(0));
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
break;
case 'disabledAvatars':
WHERE disableAvatar = ?";
$statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
$statement->execute(array(1));
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
break;
case 'disabledSignatures':
WHERE disableSignature = ?";
$statement = WCF::getDB()->prepareStatement($sql, $this->maxResults);
$statement->execute(array(1));
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
break;
}
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
- $this->pageIDs = [];
- while ($row = $statement->fetchArray()) {
- $this->pageIDs[] = $row['pageID'];
- }
+ $this->pageIDs = $statement->fetchColumns();
}
// validate images
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
- $this->pageIDs = [];
- while ($row = $statement->fetchArray()) {
- $this->pageIDs[] = $row['pageID'];
- }
+ $this->pageIDs = $statement->fetchColumns();
}
}
FROM wcf".WCF_N."_style_variable";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
- $variables = [];
- while ($row = $statement->fetchArray()) {
- $variables[] = $row['variableName'];
- }
+ $variables = $statement->fetchColumns();
$lines = explode("\n", StringUtil::unifyNewlines($this->variables['overrideScss']));
$regEx = new Regex('^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\.\(\)\%\#-]+);$');
*/
protected function readUsers() {
// get user ids
- $userIDs = [];
$sql = "SELECT user_table.userID
FROM wcf".WCF_N."_user user_table
".(isset($this->options[$this->sortField]) ? "LEFT JOIN wcf".WCF_N."_user_option_value user_option_value ON (user_option_value.userID = user_table.userID)" : '')."
ORDER BY ".(($this->sortField != 'email' && isset($this->options[$this->sortField])) ? 'user_option_value.userOption'.$this->options[$this->sortField]->optionID : $this->sortField)." ".$this->sortOrder;
$statement = WCF::getDB()->prepareStatement($sql, $this->itemsPerPage, ($this->pageNo - 1) * $this->itemsPerPage);
$statement->execute($this->conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
// get user data
if (!empty($userIDs)) {
".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
$statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
- while ($row = $statement->fetchArray()) {
- $this->objectIDs[] = $row['objectID'];
- }
+ $this->objectIDs = $statement->fetchColumns();
}
/**
$this->parameters['attachmentIDs'] = ArrayUtil::toIntegerArray($this->parameters['attachmentIDs']);
// check attachment ids
- $attachmentIDs = [];
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("attachmentID IN (?)", [$this->parameters['attachmentIDs']]);
$conditions->add("objectTypeID = ?", [$objectType->objectTypeID]);
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $attachmentIDs[] = $row['attachmentID'];
- }
+ $attachmentIDs = $statement->fetchColumns();
foreach ($this->parameters['attachmentIDs'] as $attachmentID) {
if (!in_array($attachmentID, $attachmentIDs)) {
WHERE optionType = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array('BBCodeSelect'));
-
- $optionIDs = array();
- while ($optionID = $statement->fetchColumn()) {
- $optionIDs[] = $optionID;
- }
+ $optionIDs = $statement->fetchColumns();
if (!empty($optionIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
*/
public function getPageIDs() {
if ($this->pageIDs === null) {
- $this->pageIDs = [];
$sql = "SELECT pageID
FROM wcf" . WCF_N . "_box_to_page
WHERE boxID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->boxID]);
- while ($pageID = $statement->fetchColumn()) {
- $this->pageIDs[] = $pageID;
- }
+
+ $this->pageIDs = $statement->fetchColumns();
}
return $this->pageIDs;
ORDER BY time ASC, responseID ASC";
$statement = WCF::getDB()->prepareStatement($sql, 5);
$statement->execute(array($this->commentID));
- $responseIDs = array();
- while ($row = $statement->fetchArray()) {
- $responseIDs[] = $row['responseID'];
- }
+ $responseIDs = $statement->fetchColumns();
$this->update(array(
'responseIDs' => serialize($responseIDs)
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $languageItemIDs = [];
- while ($row = $statement->fetchArray()) {
- $languageItemIDs[] = $row['languageItemID'];
- }
+ $languageItemIDs = $statement->fetchColumns();
$objectAction = new LanguageItemAction($languageItemIDs, 'delete');
$objectAction->executeAction();
ORDER BY moderation_queue.lastChangeTime DESC";
$statement = WCF::getDB()->prepareStatement($sql, 5);
$statement->execute($conditions->getParameters());
- $queueIDs = array();
- while ($row = $statement->fetchArray()) {
- $queueIDs[] = $row['queueID'];
- }
+ $queueIDs = $statement->fetchColumns();
$queues = array();
if (!empty($queueIDs)) {
*/
public function getBoxIDs() {
if ($this->boxIDs === null) {
- $this->boxIDs = [];
$sql = "SELECT boxID
FROM wcf" . WCF_N . "_box_to_page
WHERE pageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->pageID]);
- while ($row = $statement->fetchArray()) {
- $this->boxIDs[] = $row['boxID'];
- }
+ $this->boxIDs = $statement->fetchColumns();
}
return $this->boxIDs;
WHERE templateGroupID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$style->templateGroupID]);
- while ($row = $statement->fetchArray()) {
- $knownTemplates[] = $row['templateName'];
- }
+ $knownTemplates = $statement->fetchColumns();
}
// copy templates
ORDER BY user_group.priority DESC".(!empty($this->sqlOrderBy) ? ", ".$this->sqlOrderBy : '');
$statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute();
- while ($row = $statement->fetchArray()) {
- $this->objectIDs[] = $row['objectID'];
- }
+ $this->objectIDs = $statement->fetchColumns();
}
/**
// cache does not exist or is outdated
if ($data === null || $skipCache) {
- $this->groupIDs = [];
$sql = "SELECT groupID
FROM wcf".WCF_N."_user_to_group
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->userID]);
- while ($row = $statement->fetchArray()) {
- $this->groupIDs[] = $row['groupID'];
- }
+ $this->groupIDs = $statement->fetchColumns();
// update storage data
if (!$skipCache) {
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->userID]);
- while ($row = $statement->fetchArray()) {
- $this->languageIDs[] = $row['languageID'];
- }
+ $this->languageIDs = $statement->fetchColumns();
// update storage data
UserStorageHandler::getInstance()->update($this->userID, 'languageIDs', serialize($this->languageIDs));
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
-
- $groupIDs = [];
- while ($row = $statement->fetchArray()) {
- $groupIDs[] = $row['groupID'];
- }
+ $groupIDs = $statement->fetchColumns();
if (!UserGroup::isAccessibleGroup($groupIDs)) {
throw new PermissionDeniedException();
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->userID]);
- while ($row = $statement->fetchArray()) {
- $this->followingUserIDs[] = $row['followUserID'];
- }
+ $this->followingUserIDs = $statement->fetchColumns();
// update storage data
UserStorageHandler::getInstance()->update($this->userID, 'followingUserIDs', serialize($this->followingUserIDs));
WHERE followUserID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->userID]);
- while ($row = $statement->fetchArray()) {
- $this->followerUserIDs[] = $row['userID'];
- }
+ $this->followerUserIDs = $statement->fetchColumns();
// update storage data
UserStorageHandler::getInstance()->update($this->userID, 'followerUserIDs', serialize($this->followerUserIDs));
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->userID]);
- while ($row = $statement->fetchArray()) {
- $this->ignoredUserIDs[] = $row['ignoreUserID'];
- }
+ $this->ignoredUserIDs = $statement->fetchColumns();
// update storage data
UserStorageHandler::getInstance()->update($this->userID, 'ignoredUserIDs', serialize($this->ignoredUserIDs));
WHERE followUserID = ?";
$statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute(array($this->parameters['userID']));
- $userIDs = array();
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
// create group
$group = new GroupedUserList();
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute(array($this->parameters['userID']));
- $userIDs = array();
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['followUserID'];
- }
+ $userIDs = $statement->fetchColumns();
// create group
$group = new GroupedUserList();
ORDER BY time DESC";
$statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20);
$statement->execute(array($this->parameters['userID']));
- $userIDs = array();
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
// create group
$group = new GroupedUserList();
WHERE username ".($this->nameExactly ? "= ?" : "LIKE ?");
$statement = WCF::getDB()->prepareStatement($sql, 100);
$statement->execute(array($this->username.(!$this->nameExactly ? '%' : '')));
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
if (empty($userIDs)) {
$this->throwNoMatchesException();
// do search
$statement = WCF::getDB()->prepareStatement($sql.$this->conditions, $this->maxResults);
$statement->execute($this->conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $this->matches[] = $row['userID'];
- }
+ $this->matches = $statement->fetchColumns();
}
/**
parent::execute($cronjob);
// delete orphaned attachments
- $attachmentIDs = array();
$sql = "SELECT attachmentID
FROM wcf".WCF_N."_attachment
WHERE objectID = ?
0,
(TIME_NOW - 86400)
));
- while ($row = $statement->fetchArray()) {
- $attachmentIDs[] = $row['attachmentID'];
- }
+ $attachmentIDs = $statement->fetchColumns();
if (!empty($attachmentIDs)) {
AttachmentEditor::deleteAll($attachmentIDs);
parent::execute($cronjob);
// get user ids
- $userIDs = array();
$sql = "SELECT DISTINCT userID
FROM wcf".WCF_N."_user_notification
WHERE mailNotified = ?
TIME_NOW - 3600 * 23,
0
));
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
if (empty($userIDs)) return;
// get users
ModerationQueue::STATUS_DONE,
(TIME_NOW - (86400 * 30))
));
- $queueIDs = array();
- while ($row = $statement->fetchArray()) {
- $queueIDs[] = $row['queueID'];
- }
+ $queueIDs = $statement->fetchColumns();
if (!empty($queueIDs)) {
$conditions = new PreparedStatementConditionBuilder();
public function execute(Cronjob $cronjob) {
parent::execute($cronjob);
- $userIDs = array();
$sql = "SELECT userID
FROM wcf".WCF_N."_user
WHERE quitStarted > ?
0,
(TIME_NOW - 7 * 24 * 3600)
));
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
if (!empty($userIDs)) {
$action = new UserAction($userIDs, 'delete');
return $column;
}
+ /**
+ * Returns a specific column for all of the remaining rows.
+ *
+ * @param integer $columnNumber
+ * @return array
+ */
+ public function fetchColumns($columnNumber = 0) {
+ $columns = [];
+ while ($column = $this->fetchColumn($columnNumber)) {
+ $columns[] = $column;
+ }
+
+ return $columns;
+ }
+
/**
* Fetches the next row from a result set in a database object.
*
$userIDs
));
- $entryIDs = array();
- while ($entryID = $statement->fetchColumn()) {
- $entryIDs[] = $entryID;
- }
+ $entryIDs = $statement->fetchColumns();
if (empty($entryIDs)) return;
$list = new EditHistoryEntryList();
ORDER BY time ASC, responseID ASC";
$statement = WCF::getDB()->prepareStatement($sql, 5);
$statement->execute(array($response->commentID));
- $responseIDs = array();
- while ($responseID = $statement->fetchColumn()) $responseIDs[] = $responseID;
+ $responseIDs = $statement->fetchColumns();
// update parent comment
$sql = "UPDATE wcf".WCF_N."_comment
WHERE preset = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(1));
- while ($row = $statement->fetchArray()) {
- $this->eventIDs[] = $row['eventID'];
- }
+ $this->eventIDs = $statement->fetchColumns();
$userOptionList = new UserOptionList();
$userOptionList->readObjects();
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $queueIDs = array();
- while ($row = $statement->fetchArray()) {
- $queueIDs[] = $row['queueID'];
- }
+ $queueIDs = $statement->fetchColumns();
if (!empty($queueIDs)) {
$queueAction = new ModerationQueueAction($queueIDs, 'delete');
// get highest version of the required major release
if (preg_match('/(\d+\.\d+\.)/', $version, $match)) {
- $packageVersions = array();
$sql = "SELECT DISTINCT packageVersion
FROM wcf".WCF_N."_package_update_version
WHERE packageUpdateID IN (
$package->package,
$match[1].'%'
));
- while ($row = $statement->fetchArray()) {
- $packageVersions[] = $row['packageVersion'];
- }
+ $packageVersions = $statement->fetchColumns();
if (count($packageVersions) > 1) {
// sort by version number
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
- $pageIDs = [];
- while ($pageID = $statement->fetchColumn()) {
- $pageIDs[] = $pageID;
- }
+ $pageIDs = $statement->fetchColumns();
// save page ids
foreach ($pageIDs as $pageID) {
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
- $pageIDs = [];
- while ($row = $statement->fetchArray()) {
- $pageIDs[] = $row['pageID'];
- }
+ $pageIDs = $statement->fetchColumns();
// save page ids
foreach ($pageIDs as $pageID) {
// work-around for setup process (package wcf does not exist yet)
if (!PACKAGE_ID) {
- $groupIDs = array();
$sql = "SELECT groupID
FROM wcf".WCF_N."_user_to_group
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->user->userID));
- while ($row = $statement->fetchArray()) {
- $groupIDs[] = $row['groupID'];
- }
+ $groupIDs = $statement->fetchColumns();
}
else {
$groupIDs = $this->user->getGroupIDs();
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->user->userID));
- while ($row = $statement->fetchArray()) {
- $this->languageIDs[] = $row['languageID'];
- }
+ $this->languageIDs = $statement->fetchColumns();
}
else {
$this->languageIDs = $this->user->getLanguageIDs();
$objectTypeID,
WCF::getUser()->userID
));
- while ($row = $statement->fetchArray()) {
- $this->collapsedContent[$objectTypeID][] = $row['objectID'];
- }
+ $this->collapsedContent[$objectTypeID] = $statement->fetchColumns();
// update storage data
UserStorageHandler::getInstance()->update(WCF::getUser()->userID, 'collapsedContent-'.$objectTypeID, serialize($this->collapsedContent[$objectTypeID]));
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $notificationIDs = array();
- while ($row = $statement->fetchArray()) {
- $notificationIDs[] = $row['notificationID'];
- }
+ $notificationIDs = $statement->fetchColumns();
// filter array of existing notifications and remove values which
// do not have a notification from this author yet (inverse logic!)
$statement->execute(array(
$objectTypeObj->objectTypeID
));
-
- $eventIDs = array();
- while ($row = $statement->fetchArray()) {
- $eventIDs[] = $row['eventID'];
- }
+ $eventIDs = $statement->fetchColumns();
if (!empty($eventIDs)) {
$conditions = new PreparedStatementConditionBuilder();
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
-
- $userIDs = array();
- while ($userID = $statement->fetchColumn()) {
- $userIDs[] = $userID;
- }
+ $userIDs = $statement->fetchColumns();
// reset number of notifications
if (!empty($userIDs)) {
return [];
}
- $recipientIDs = [];
-
// 1. fetch assigned user
// 2. fetch users who commented on the moderation queue entry
// 3. fetch users who responded to a comment on the moderation queue entry
$comment->objectID,
$objectTypeID
]);
- while ($userID = $statement->fetchColumn()) {
- $recipientIDs[] = $userID;
- }
+ $recipientIDs = $statement->fetchColumns();
// make sure that all users can (still) access the moderation queue entry
if (!empty($recipientIDs)) {
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
-
- $recipientIDs = [];
- while ($userID = $statement->fetchColumn()) {
- $recipientIDs[] = $userID;
- }
+ $recipientIDs = $statement->fetchColumns();
// make sure that all users (still) have permission to access moderation
if (!$recipientIDs) {
$objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $objectType);
// get subscriber
- $userIDs = array();
$conditionsBuilder = new PreparedStatementConditionBuilder();
$conditionsBuilder->add('objectTypeID = ?', array($objectTypeObj->objectTypeID));
$conditionsBuilder->add('objectID IN (?)', array($objectIDs));
".$conditionsBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionsBuilder->getParameters());
- while ($row = $statement->fetchArray()) {
- $userIDs[] = $row['userID'];
- }
+ $userIDs = $statement->fetchColumns();
if (!empty($userIDs)) {
// reset user storage