* @category Community Framework
*/
class IPB3xExporter extends AbstractExporter {
- protected static $knownProfileFields = array('website', 'icq', 'gender', 'location', 'interests', 'skype');
+ protected static $knownProfileFields = ['website', 'icq', 'gender', 'location', 'interests', 'skype'];
/**
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.follower' => 'Followers',
'com.woltlab.wbb.poll' => 'Polls',
'com.woltlab.wbb.poll.option.vote' => 'PollOptionVotes',
'com.woltlab.wbb.like' => 'Likes'
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment'
- )
- );
+ ]
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = $knownProfileFields = array();
+ $profileFields = $knownProfileFields = [];
$sql = "SELECT *
FROM ".$this->databasePrefix."pfields_data";
$statement = $this->database->prepareStatement($sql);
WHERE members.member_id BETWEEN ? AND ?
ORDER BY members.member_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['name'],
'password' => '',
'email' => $row['email'],
'profileHits' => $row['members_profile_views'],
'userTitle' => ($row['title'] ?: ''),
'lastActivityTime' => $row['last_activity']
- );
+ ];
// get group ids
$groupIDs = preg_split('/,/', $row['mgroup_others'], -1, PREG_SPLIT_NO_EMPTY);
$groupIDs[] = $row['member_group_id'];
// get user options
- $options = array(
+ $options = [
//'timezone' => $row['time_offset'],
'homepage' => (isset($knownProfileFields['website']) && !empty($row['field_'.$knownProfileFields['website']['pf_id']])) ? $row['field_'.$knownProfileFields['website']['pf_id']] : '',
'icq' => (isset($knownProfileFields['icq']) && !empty($row['field_'.$knownProfileFields['icq']['pf_id']])) ? $row['field_'.$knownProfileFields['icq']['pf_id']] : '',
'hobbies' => (isset($knownProfileFields['interests']) && !empty($row['field_'.$knownProfileFields['interests']['pf_id']])) ? $row['field_'.$knownProfileFields['interests']['pf_id']] : '',
'skype' => (isset($knownProfileFields['skype']) && !empty($row['field_'.$knownProfileFields['skype']['pf_id']])) ? $row['field_'.$knownProfileFields['skype']['pf_id']] : '',
'location' => (isset($knownProfileFields['location']) && !empty($row['field_'.$knownProfileFields['location']['pf_id']])) ? $row['field_'.$knownProfileFields['location']['pf_id']] : ''
- );
+ ];
// get birthday
if ($row['bday_day'] && $row['bday_month'] && $row['bday_year']) {
if ($gender == 'f') $options['gender'] = UserProfile::GENDER_FEMALE;
}
- $additionalData = array(
+ $additionalData = [
'groupIDs' => $groupIDs,
'options' => $options
- );
+ ];
// handle user options
foreach ($profileFields as $profileField) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('ipb3:'.$row['members_pass_hash'].':'.$row['members_pass_salt'], $newUserID));
+ $passwordUpdateStatement->execute(['ipb3:'.$row['members_pass_hash'].':'.$row['members_pass_salt'], $newUserID]);
}
}
}
*/
public function countUserOptions() {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('pf_key NOT IN (?)', array(self::$knownProfileFields));
+ $conditionBuilder->add('pf_key NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."pfields_data
*/
public function exportUserOptions($offset, $limit) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('pf_key NOT IN (?)', array(self::$knownProfileFields));
+ $conditionBuilder->add('pf_key NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT *
FROM ".$this->databasePrefix."pfields_data
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['pf_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['pf_id'], [
'categoryName' => 'profile.personal',
'optionType' => 'textarea',
'askDuringRegistration' => $row['pf_show_on_reg'],
- ), array('name' => $row['pf_title']));
+ ], ['name' => $row['pf_title']]);
}
}
WHERE g_id BETWEEN ? AND ?
ORDER BY g_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$groupType = UserGroup::OTHER;
switch ($row['g_id']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['g_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['g_id'], [
'groupName' => $row['g_title'],
'groupType' => $groupType,
'userOnlineMarking' => (!empty($row['prefix']) ? ($row['prefix'].'%s'.$row['suffix']) : '%s')
- ));
+ ]);
}
}
OR pp_main_photo <> '')
ORDER BY pp_member_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
if ($row['pp_main_photo']) {
$avatarName = basename($row['pp_main_photo']);
}
$avatarExtension = pathinfo($avatarName, PATHINFO_EXTENSION);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['pp_member_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['pp_member_id'], [
'avatarName' => $avatarName,
'avatarExtension' => $avatarExtension,
'userID' => $row['pp_member_id']
- ), array('fileLocation' => $source));
+ ], ['fileLocation' => $source]);
}
}
WHERE status_updates.status_id BETWEEN ? AND ?
ORDER BY status_updates.status_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['status_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['status_id'], [
'objectID' => $row['status_member_id'],
'userID' => $row['status_author_id'],
'username' => ($row['name'] ?: ''),
'message' => self::fixStatusUpdate($row['status_content']),
'time' => $row['status_date']
- ));
+ ]);
}
}
WHERE member_status_replies.reply_id BETWEEN ? AND ?
ORDER BY member_status_replies.reply_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['reply_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['reply_id'], [
'commentID' => $row['reply_status_id'],
'time' => $row['reply_date'],
'userID' => $row['reply_member_id'],
'username' => ($row['name'] ?: ''),
'message' => self::fixStatusUpdate($row['reply_content']),
- ));
+ ]);
}
}
WHERE friends_id BETWEEN ? AND ?
ORDER BY friends_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['friends_member_id'],
'followUserID' => $row['friends_friend_id'],
'time' => $row['friends_added']
- ));
+ ]);
}
}
WHERE message_topics.mt_id BETWEEN ? AND ?
ORDER BY message_topics.mt_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['mt_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['mt_id'], [
'subject' => self::fixSubject($row['mt_title']),
'time' => $row['mt_date'],
'userID' => ($row['mt_starter_id'] ?: null),
'username' => ($row['mt_is_system'] ? 'System' : ($row['name'] ?: '')),
'isDraft' => $row['mt_is_draft']
- ));
+ ]);
}
}
WHERE message_posts.msg_id BETWEEN ? AND ?
ORDER BY message_posts.msg_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], [
'conversationID' => $row['msg_topic_id'],
'userID' => ($row['msg_author_id'] ?: null),
'username' => ($row['name'] ?: ''),
'message' => self::fixMessage($row['msg_post']),
'time' => $row['msg_date']
- ));
+ ]);
}
}
WHERE message_topic_user_map.map_id BETWEEN ? AND ?
ORDER BY message_topic_user_map.map_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['map_topic_id'],
'participantID' => $row['map_user_id'],
'username' => ($row['name'] ?: ''),
'hideConversation' => ($row['map_left_time'] ? 1 : 0),
'isInvisible' => 0,
'lastVisitTime' => $row['map_read_time']
- ));
+ ]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], [
'parentID' => ($board['parent_id'] != -1 ? $board['parent_id'] : null),
'position' => $board['position'],
'boardType' => ($board['redirect_on'] ? Board::TYPE_LINK : ($board['sub_can_post'] ? Board::TYPE_BOARD : Board::TYPE_CATEGORY)),
'clicks' => $board['redirect_hits'],
'posts' => $board['posts'],
'threads' => $board['topics']
- ));
+ ]);
$this->exportBoardsRecursively($board['id']);
}
*/
public function exportThreads($offset, $limit) {
// get thread ids
- $threadIDs = array();
+ $threadIDs = [];
$sql = "SELECT tid
FROM ".$this->databasePrefix."topics
WHERE tid BETWEEN ? AND ?
ORDER BY tid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$threadIDs[] = $row['tid'];
}
// get threads
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('topics.tid IN (?)', array($threadIDs));
+ $conditionBuilder->add('topics.tid IN (?)', [$threadIDs]);
$sql = "SELECT topics.*
FROM ".$this->databasePrefix."topics topics
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['forum_id'],
'topic' => self::fixSubject($row['title']),
'time' => $row['start_date'],
'movedTime' => $row['moved_on'],
'deleteTime' => $row['tdelete_time'],
'lastPostTime' => $row['last_post']
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if (isset($tags[$row['tid']])) $additionalData['tags'] = $tags[$row['tid']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['tid'], $data, $additionalData);
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], [
'threadID' => $row['topic_id'],
'userID' => $row['author_id'],
'username' => ($row['author_name'] ?: ''),
'editReason' => $row['post_edit_reason'],
'ipAddress' => UserUtil::convertIPv4To6($row['ip_address']),
'deleteTime' => $row['pdelete_time']
- ));
+ ]);
}
}
WHERE like_app = ?
AND like_area = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('forums', 'topics'));
+ $statement->execute(['forums', 'topics']);
$row = $statement->fetchArray();
return $row['count'];
}
AND like_area = ?
ORDER BY like_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('forums', 'topics'));
+ $statement->execute(['forums', 'topics']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['like_rel_id'],
'userID' => $row['like_member_id']
- ));
+ ]);
}
}
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$data = @unserialize($row['choices']);
if (!$data) $data = @unserialize(str_replace('\"', '"', $row['choices'])); // pre ipb3.4 fallback
if (!$data || !isset($data[1])) continue;
// import poll
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], [
'objectID' => $row['topic_firstpost'],
'question' => self::fixSubject($data[1]['question']),
'time' => $row['start_date'],
'isPublic' => $row['poll_view_voters'],
'maxVotes' => (!empty($data[1]['multi']) ? count($data[1]['choice']) : 1),
'votes' => $row['votes']
- ));
+ ]);
// import poll options
foreach ($data[1]['choice'] as $key => $choice) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$key, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$key, [
'pollID' => $row['pid'],
'optionValue' => $choice,
'showOrder' => $key,
'votes' => $data[1]['votes'][$key]
- ));
+ ]);
}
}
}
WHERE voters.vid BETWEEN ? AND ?
ORDER BY voters.vid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$data = @unserialize($row['member_choices']);
if (!$data) $data = @unserialize(str_replace('\"', '"', $row['member_choices'])); // pre ipb3.4 fallback
if (!$data || !isset($data[1])) continue;
foreach ($data[1] as $pollOptionKey) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pid'],
'optionID' => $row['pid'].'-'.$pollOptionKey,
'userID' => $row['member_id']
- ));
+ ]);
}
}
}
AND like_area = ?
AND like_visible = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('forums', 'topics', 1));
+ $statement->execute(['forums', 'topics', 1]);
$row = $statement->fetchArray();
return $row['count'];
}
AND core_like.like_visible = ?
ORDER BY core_like.like_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('forums', 'topics', 1));
+ $statement->execute(['forums', 'topics', 1]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $row['topic_firstpost'],
'objectUserID' => ($row['starter_id'] ?: null),
'userID' => $row['like_member_id'],
'likeValue' => Like::LIKE,
'time' => $row['like_added']
- ));
+ ]);
}
}
WHERE attach_rel_module = ?
AND attach_rel_id > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($type, 0));
+ $statement->execute([$type, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND attach_rel_id > ?
ORDER BY attach_id DESC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($type, 0));
+ $statement->execute([$type, 0]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'uploads/'.$row['attach_location'];
- ImportHandler::getInstance()->getImporter($objectType)->import($row['attach_id'], array(
+ ImportHandler::getInstance()->getImporter($objectType)->import($row['attach_id'], [
'objectID' => $row['attach_rel_id'],
'userID' => ($row['attach_member_id'] ?: null),
'filename' => $row['attach_file'],
'isImage' => $row['attach_is_image'],
'downloads' => $row['attach_hits'],
'uploadTime' => $row['attach_date'],
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
private function getTags($app, $area, array $objectIDs) {
- $tags = array();
+ $tags = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('tag_meta_app = ?', array($app));
- $conditionBuilder->add('tag_meta_area = ?', array($area));
- $conditionBuilder->add('tag_meta_id IN (?)', array($objectIDs));
+ $conditionBuilder->add('tag_meta_app = ?', [$app]);
+ $conditionBuilder->add('tag_meta_area = ?', [$area]);
+ $conditionBuilder->add('tag_meta_id IN (?)', [$objectIDs]);
// get taggable id
$sql = "SELECT tag_meta_id, tag_text
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($tags[$row['tag_meta_id']])) $tags[$row['tag_meta_id']] = array();
+ if (!isset($tags[$row['tag_meta_id']])) $tags[$row['tag_meta_id']] = [];
$tags[$row['tag_meta_id']][] = $row['tag_text'];
}
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.follower' => 'Followers',
'com.woltlab.wbb.poll' => 'Polls',
'com.woltlab.wbb.poll.option.vote' => 'PollOptionVotes',
'com.woltlab.wbb.like' => 'Likes'
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment'
- )
- );
+ ]
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = array();
+ $profileFields = [];
$sql = "SELECT *
FROM ".$this->databasePrefix."core_pfields_data";
$statement = $this->database->prepareStatement($sql);
WHERE members.member_id BETWEEN ? AND ?
ORDER BY members.member_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['name'],
'password' => '',
'email' => $row['email'],
'profileHits' => $row['members_profile_views'],
'userTitle' => ($row['member_title'] ?: ''),
'lastActivityTime' => $row['last_activity']
- );
+ ];
// get group ids
$groupIDs = preg_split('/,/', $row['mgroup_others'], -1, PREG_SPLIT_NO_EMPTY);
$groupIDs[] = $row['member_group_id'];
// get user options
- $options = array();
+ $options = [];
// get birthday
if ($row['bday_day'] && $row['bday_month'] && $row['bday_year']) {
$options['birthday'] = $row['bday_year'].'-'.($row['bday_month'] < 10 ? '0' : '').$row['bday_month'].'-'.($row['bday_day'] < 10 ? '0' : '').$row['bday_day'];
}
- $additionalData = array(
+ $additionalData = [
'groupIDs' => $groupIDs,
'options' => $options
- );
+ ];
// handle user options
foreach ($profileFields as $profileField) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('cryptMD5:'.$row['members_pass_hash'].':'.$row['members_pass_salt'], $newUserID));
+ $passwordUpdateStatement->execute(['cryptMD5:'.$row['members_pass_hash'].':'.$row['members_pass_salt'], $newUserID]);
}
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['pf_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['pf_id'], [
'categoryName' => 'profile.personal',
'optionType' => 'textarea',
'askDuringRegistration' => $row['pf_show_on_reg'],
- ), array('name' => $this->getLanguageVar('core_pfield', $row['pf_id'])));
+ ], ['name' => $this->getLanguageVar('core_pfield', $row['pf_id'])]);
}
}
WHERE g_id BETWEEN ? AND ?
ORDER BY g_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$groupType = UserGroup::OTHER;
switch ($row['g_id']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['g_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['g_id'], [
'groupName' => $this->getLanguageVar('core_group', $row['g_id']),
'groupType' => $groupType,
'userOnlineMarking' => (!empty($row['prefix']) ? ($row['prefix'].'%s'.$row['suffix']) : '%s')
- ));
+ ]);
}
}
AND pp_main_photo <> ''
ORDER BY member_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$avatarName = basename($row['pp_main_photo']);
$source = $this->fileSystemPath.'uploads/'.$row['pp_main_photo'];
$avatarExtension = pathinfo($avatarName, PATHINFO_EXTENSION);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['member_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['member_id'], [
'avatarName' => $avatarName,
'avatarExtension' => $avatarExtension,
'userID' => $row['member_id']
- ), array('fileLocation' => $source));
+ ], ['fileLocation' => $source]);
}
}
WHERE status_updates.status_id BETWEEN ? AND ?
ORDER BY status_updates.status_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['status_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['status_id'], [
'objectID' => $row['status_member_id'],
'userID' => $row['status_author_id'],
'username' => ($row['name'] ?: ''),
'message' => self::fixMessage($row['status_content']),
'time' => $row['status_date']
- ));
+ ]);
}
}
WHERE member_status_replies.reply_id BETWEEN ? AND ?
ORDER BY member_status_replies.reply_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['reply_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['reply_id'], [
'commentID' => $row['reply_status_id'],
'time' => $row['reply_date'],
'userID' => $row['reply_member_id'],
'username' => ($row['name'] ?: ''),
'message' => self::fixMessage($row['reply_content']),
- ));
+ ]);
}
}
WHERE follow_app = ?
AND follow_area = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('core', 'member'));
+ $statement->execute(['core', 'member']);
$row = $statement->fetchArray();
return $row['count'];
}
AND follow_area = ?
ORDER BY follow_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('core', 'member'));
+ $statement->execute(['core', 'member']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['follow_member_id'],
'followUserID' => $row['follow_rel_id'],
'time' => $row['follow_added']
- ));
+ ]);
}
}
WHERE message_topics.mt_id BETWEEN ? AND ?
ORDER BY message_topics.mt_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['mt_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['mt_id'], [
'subject' => $row['mt_title'],
'time' => $row['mt_date'],
'userID' => ($row['mt_starter_id'] ?: null),
'username' => ($row['mt_is_system'] ? 'System' : ($row['name'] ?: '')),
'isDraft' => $row['mt_is_draft']
- ));
+ ]);
}
}
WHERE message_posts.msg_id BETWEEN ? AND ?
ORDER BY message_posts.msg_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], [
'conversationID' => $row['msg_topic_id'],
'userID' => ($row['msg_author_id'] ?: null),
'username' => ($row['name'] ?: ''),
'message' => self::fixMessage($row['msg_post']),
'time' => $row['msg_date']
- ));
+ ]);
}
}
WHERE message_topic_user_map.map_id BETWEEN ? AND ?
ORDER BY message_topic_user_map.map_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['map_topic_id'],
'participantID' => $row['map_user_id'],
'username' => ($row['name'] ?: ''),
'hideConversation' => ($row['map_left_time'] ? 1 : 0),
'isInvisible' => 0,
'lastVisitTime' => $row['map_read_time']
- ));
+ ]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], [
'parentID' => ($board['parent_id'] != -1 ? $board['parent_id'] : null),
'position' => $board['position'],
'boardType' => ($board['redirect_on'] ? Board::TYPE_LINK : ($board['sub_can_post'] ? Board::TYPE_BOARD : Board::TYPE_CATEGORY)),
'clicks' => $board['redirect_hits'],
'posts' => $board['posts'],
'threads' => $board['topics']
- ));
+ ]);
$this->exportBoardsRecursively($board['id']);
}
*/
public function exportThreads($offset, $limit) {
// get thread ids
- $threadIDs = array();
+ $threadIDs = [];
$sql = "SELECT tid
FROM ".$this->databasePrefix."forums_topics
WHERE tid BETWEEN ? AND ?
ORDER BY tid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$threadIDs[] = $row['tid'];
}
// get threads
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('topics.tid IN (?)', array($threadIDs));
+ $conditionBuilder->add('topics.tid IN (?)', [$threadIDs]);
$sql = "SELECT topics.*
FROM ".$this->databasePrefix."forums_topics topics
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['forum_id'],
'topic' => $row['title'],
'time' => $row['start_date'],
'movedThreadID' => ($row['moved_to'] ? intval($row['moved_to']) : null),
'movedTime' => $row['moved_on'],
'lastPostTime' => $row['last_post']
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if (isset($tags[$row['tid']])) $additionalData['tags'] = $tags[$row['tid']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['tid'], $data, $additionalData);
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], [
'threadID' => $row['topic_id'],
'userID' => $row['author_id'],
'username' => $row['author_name'],
'editReason' => $row['post_edit_reason'],
'ipAddress' => UserUtil::convertIPv4To6($row['ip_address']),
'deleteTime' => $row['pdelete_time']
- ));
+ ]);
}
}
WHERE follow_app = ?
AND follow_area = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('forums', 'topic'));
+ $statement->execute(['forums', 'topic']);
$row = $statement->fetchArray();
return $row['count'];
}
AND follow_area = ?
ORDER BY follow_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('forums', 'topic'));
+ $statement->execute(['forums', 'topic']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['follow_rel_id'],
'userID' => $row['follow_member_id']
- ));
+ ]);
}
}
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
if (!$row['topic_firstpost']) continue;
}
// import poll
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], [
'objectID' => $row['topic_firstpost'],
'question' => $data[1]['question'],
'time' => $row['start_date'],
'isPublic' => $row['poll_view_voters'],
'maxVotes' => (!empty($data[1]['multi']) ? count($data[1]['choice']) : 1),
'votes' => $row['votes']
- ));
+ ]);
// import poll options
foreach ($data[1]['choice'] as $key => $choice) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$key, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$key, [
'pollID' => $row['pid'],
'optionValue' => $choice,
'showOrder' => $key,
'votes' => $data[1]['votes'][$key]
- ));
+ ]);
}
}
}
WHERE voters.vid BETWEEN ? AND ?
ORDER BY voters.vid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
try {
$data = JSON::decode($row['member_choices']);
}
if (!$data || !isset($data[1])) continue;
- if (!is_array($data[1])) $data[1] = array($data[1]);
+ if (!is_array($data[1])) $data[1] = [$data[1]];
foreach ($data[1] as $pollOptionKey) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pid'],
'optionID' => $row['pid'].'-'.$pollOptionKey,
'userID' => $row['member_id']
- ));
+ ]);
}
}
}
WHERE app = ?
AND type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('forums', 'pid'));
+ $statement->execute(['forums', 'pid']);
$row = $statement->fetchArray();
return $row['count'];
}
AND core_reputation_index.type = ?
ORDER BY core_reputation_index.id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('forums', 'pid'));
+ $statement->execute(['forums', 'pid']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $row['type_id'],
'objectUserID' => ($row['author_id'] ?: null),
'userID' => $row['member_id'],
'likeValue' => Like::LIKE,
'time' => $row['rep_date']
- ));
+ ]);
}
}
WHERE location_key = ?
AND id2 IS NOT NULL";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($type));
+ $statement->execute([$type]);
$row = $statement->fetchArray();
return $row['count'];
}
AND core_attachments_map.id2 IS NOT NULL
ORDER BY core_attachments_map.attachment_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($type));
+ $statement->execute([$type]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'uploads/'.$row['attach_location'];
- ImportHandler::getInstance()->getImporter($objectType)->import($row['attach_id'], array(
+ ImportHandler::getInstance()->getImporter($objectType)->import($row['attach_id'], [
'objectID' => $row['id2'],
'userID' => ($row['attach_member_id'] ?: null),
'filename' => $row['attach_file'],
'isImage' => $row['attach_is_image'],
'downloads' => $row['attach_hits'],
'uploadTime' => $row['attach_date'],
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
private function getTags($app, $area, array $objectIDs) {
- $tags = array();
+ $tags = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('tag_meta_app = ?', array($app));
- $conditionBuilder->add('tag_meta_area = ?', array($area));
- $conditionBuilder->add('tag_meta_id IN (?)', array($objectIDs));
+ $conditionBuilder->add('tag_meta_app = ?', [$app]);
+ $conditionBuilder->add('tag_meta_area = ?', [$area]);
+ $conditionBuilder->add('tag_meta_id IN (?)', [$objectIDs]);
// get taggable id
$sql = "SELECT tag_meta_id, tag_text
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($tags[$row['tag_meta_id']])) $tags[$row['tag_meta_id']] = array();
+ if (!isset($tags[$row['tag_meta_id']])) $tags[$row['tag_meta_id']] = [];
$tags[$row['tag_meta_id']][] = $row['tag_text'];
}
FROM ".$this->databasePrefix."core_sys_lang
WHERE lang_default = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1));
+ $statement->execute([1]);
$row = $statement->fetchArray();
if ($row !== false) {
$this->defaultLanguageID = $row['lang_id'];
AND word_key = ?";
$this->languageStatement = $this->database->prepareStatement($sql, 1);
}
- $this->languageStatement->execute(array($this->getDefaultLanguageID(), $prefix . '_' . $id . ($suffix ? ('_' . $suffix) : '')));
+ $this->languageStatement->execute([$this->getDefaultLanguageID(), $prefix . '_' . $id . ($suffix ? ('_' . $suffix) : '')]);
$row = $this->languageStatement->fetchArray();
if ($row !== false) {
return $row['word_custom'];
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wbb.thread' => 'Threads',
'com.woltlab.wbb.post' => 'Posts',
'com.woltlab.wbb.attachment' => 'Attachments'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.attachment'
- )
- );
+ ]
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE id BETWEEN ? AND ?
ORDER BY id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
switch ($row['id']) {
case 1:
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['id'], [
'groupName' => $row['title'],
'groupType' => $groupType
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => StringUtil::getRandomID(),
'email' => $row['email'],
'registrationDate' => @strtotime($row['registerDate']),
'lastActivityTime' => @strtotime($row['lastvisitDate']),
'signature' => self::fixBBCodes($row['signature'])
- );
+ ];
// get user options
- $options = array(
+ $options = [
'location' => $row['location'],
'birthday' => $row['birthdate'],
'icq' => $row['icq'],
'skype' => $row['skype'],
'homepage' => $row['websiteurl'],
'gender' => $row['gender']
- );
+ ];
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
'options' => $options
- );
+ ];
// import user
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['userid'], $data, $additionalData);
$password = 'phpass:'.$row['password'];
}
- $passwordUpdateStatement->execute(array($password, $newUserID));
+ $passwordUpdateStatement->execute([$password, $newUserID]);
}
}
}
FROM ".$this->databasePrefix."kunena_ranks
WHERE rank_special = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE rank_special = ?
ORDER BY rank_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], [
'groupID' => 2, // 2 = registered users
'requiredPoints' => $row['rank_min'] * 5,
'rankTitle' => $row['rank_title'],
'rankImage' => $row['rank_image'],
'repeatImage' => 0,
'requiredGender' => 0 // neutral
- ));
+ ]);
}
}
while ($row = $statement->fetchArray()) {
$filepath = $this->fileSystemPath . 'media/kunena/avatars/' . $row['avatar'];
if (file_exists($filepath)) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, [
'avatarName' => basename($filepath),
'avatarExtension' => pathinfo($filepath, PATHINFO_EXTENSION),
'userID' => $row['userid']
- ), array('fileLocation' => $filepath));
+ ], ['fileLocation' => $filepath]);
}
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id'], [
'parentID' => ($board['parent_id'] ?: null),
'position' => $board['ordering'],
'boardType' => ($board['parent_id'] ? 0 : 1),
'title' => $board['name'],
'description' => $board['description'],
'isClosed' => $board['locked'] ? 1 : 0
- ));
+ ]);
$this->exportBoardsRecursively($board['id']);
}
WHERE id BETWEEN ? AND ?
ORDER BY id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['category_id'],
'topic' => $row['subject'],
'time' => $row['first_post_time'],
'isSticky' => $row['ordering'] == 1 ? 1 : 0,
'isClosed' => $row['locked'] == 1 ? 1 : 0,
'movedThreadID' => ($row['moved_id'] ? $row['moved_id'] : null)
- );
+ ];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['id'], $data);
}
WHERE id BETWEEN ? AND ?
ORDER BY id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id'], [
'threadID' => $row['thread'],
'userID' => $row['userid'],
'username' => $row['name'],
'ipAddress' => UserUtil::convertIPv4To6($row['ip']),
'isClosed' => ($row['locked'] ? 1 : 0),
'editorID' => null
- ));
+ ]);
}
}
WHERE id BETWEEN ? AND ?
ORDER BY id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$fileLocation = FileUtil::addTrailingSlash($this->fileSystemPath . $row['folder']) . $row['filename'];
$isImage = 0;
if ($row['filetype'] == 'image/jpeg' || $row['filetype'] == 'image/png' || $row['filetype'] == 'image/gif') $isImage = 1;
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['id'], [
'objectID' => $row['mesid'],
'userID' => ($row['userid'] ?: null),
'filename' => $row['filename'],
'filesize' => $row['size'],
'fileType' => $row['filetype'],
'isImage' => $isImage
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote="(.*?)" post=(\d+)\]', Regex::CASE_INSENSITIVE);
$quoteCallback = new Callback(function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $postID,
'forceFrontend' => true
- )).'#post'.$postID;
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$postID;
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
});
}
// use proper WCF 2 bbcode
- $replacements = array(
+ $replacements = [
'[left]' => '[align=left]',
'[/left]' => '[/align]',
'[right]' => '[align=right]',
'[/video]' => '[/media]',
'[attachment' => '[attach',
'[/attachment]' => '[/attach]'
- );
+ ];
$message = str_ireplace(array_keys($replacements), array_values($replacements), $message);
// fix size bbcodes
* @category Community Framework
*/
class MyBB16xExporter extends AbstractExporter {
- protected static $knownProfileFields = array('Bio', 'Sex', 'Location');
+ protected static $knownProfileFields = ['Bio', 'Sex', 'Location'];
/**
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wcf.label' => 'Labels',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley' => 'Smilies'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.user.follower' => 100
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
FROM ".$this->databasePrefix."datacache
WHERE title = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('version'));
+ $statement->execute(['version']);
$row = $statement->fetchArray();
$data = unserialize($row['cache']);
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE gid BETWEEN ? AND ?
ORDER BY gid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
switch ($row['gid']) {
case 1:
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['gid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['gid'], [
'groupName' => $row['title'],
'groupType' => $groupType,
'userOnlineMarking' => str_replace('{username}', '%s', $row['namestyle']),
'showOnTeamPage' => $row['showforumteam'],
'priority' => $row['disporder'] ? pow(2, 10 - $row['disporder']) : 0
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = $knownProfileFields = array();
+ $profileFields = $knownProfileFields = [];
$sql = "SELECT *
FROM ".$this->databasePrefix."profilefields";
$statement = $this->database->prepareStatement($sql);
WHERE user_table.uid BETWEEN ? AND ?
ORDER BY user_table.uid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, $offset + 1, $offset + $limit));
+ $statement->execute([0, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'disableSignatureReason' => '',
'userTitle' => $row['usertitle'],
'lastActivityTime' => $row['lastactive']
- );
+ ];
$birthday = \DateTime::createFromFormat('j-n-Y', $row['birthday']);
// get user options
- $options = array(
+ $options = [
'location' => (isset($knownProfileFields['Location']) && !empty($row['fid'.$knownProfileFields['Location']['fid']])) ? $row['fid'.$knownProfileFields['Location']['fid']] : '',
'birthday' => $birthday ? $birthday->format('Y-m-d') : '',
'icq' => $row['icq'],
'homepage' => $row['website']
- );
+ ];
// get gender
if (isset($knownProfileFields['Sex']) && !empty($row['fid'.$knownProfileFields['Sex']['fid']])) {
}
}
- $additionalData = array(
+ $additionalData = [
'groupIDs' => array_unique(ArrayUtil::toIntegerArray(explode(',', $row['additionalgroups'].','.$row['usergroup']))),
'options' => $options
- );
+ ];
// handle user options
foreach ($profileFields as $profileField) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('mybb1:'.$row['password'].':'.$row['salt'], $newUserID));
+ $passwordUpdateStatement->execute(['mybb1:'.$row['password'].':'.$row['salt'], $newUserID]);
}
}
}
*/
public function countUserOptions() {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('name NOT IN (?)', array(self::$knownProfileFields));
+ $conditionBuilder->add('name NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."profilefields
*/
public function exportUserOptions($offset, $limit) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('name NOT IN (?)', array(self::$knownProfileFields));
+ $conditionBuilder->add('name NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT *
FROM ".$this->databasePrefix."profilefields
$selectOptions = $type[1];
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['fid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['fid'], [
'categoryName' => 'profile.personal',
'optionType' => $row['type'],
'editable' => ((isset($row['editable']) && $row['editable']) || (isset($row['editableby']) && $row['editableby'] == -1)) ? UserOption::EDITABILITY_ALL : UserOption::EDITABILITY_ADMINISTRATOR,
'selectOptions' => $selectOptions,
'visible' => ((isset($row['hidden']) && $row['hidden']) || (isset($row['profile']) && !$row['profile']) || (isset($row['viewableby']) && $row['viewableby'] != -1)) ? UserOption::VISIBILITY_ADMINISTRATOR | UserOption::VISIBILITY_OWNER : UserOption::VISIBILITY_ALL,
'showOrder' => $row['disporder']
- ), array('name' => $row['name']));
+ ], ['name' => $row['name']]);
}
}
$sql = "SELECT (SELECT COUNT(*) FROM ".$this->databasePrefix."usertitles)
+ (SELECT COUNT(*) FROM ".$this->databasePrefix."usergroups WHERE usertitle <> ? AND gid <> ?) AS count";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('', 1));
+ $statement->execute(['', 1]);
$row = $statement->fetchArray();
return $row['count'];
)
ORDER BY utid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('', 1));
+ $statement->execute(['', 1]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['utid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['utid'], [
'groupID' => $row['gid'],
'requiredPoints' => $row['posts'] * 5,
'rankTitle' => $row['title'],
'rankImage' => $row['starimage'],
'repeatImage' => $row['stars'],
'requiredGender' => 0 // neutral
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."users
WHERE buddylist <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE buddylist <> ?
ORDER BY uid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
$buddylist = array_unique(ArrayUtil::toIntegerArray(explode(',', $row['buddylist'])));
foreach ($buddylist as $buddy) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['uid'],
'followUserID' => $buddy
- ));
+ ]);
}
}
}
WHERE avatar <> ?
AND avatartype IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('', 'upload', 'gallery'));
+ $statement->execute(['', 'upload', 'gallery']);
$row = $statement->fetchArray();
return $row['count'];
}
AND avatartype IN (?, ?)
ORDER BY uid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('', 'upload', 'gallery'));
+ $statement->execute(['', 'upload', 'gallery']);
while ($row = $statement->fetchArray()) {
$path = parse_url($row['avatar']);
list($width, $height) = explode('|', $row['avatardimensions']);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, [
'avatarName' => basename($path['path']),
'avatarExtension' => pathinfo($path['path'], PATHINFO_EXTENSION),
'width' => $width,
'height' => $height,
'userID' => $row['uid']
- ), array('fileLocation' => $this->fileSystemPath . $path['path']));
+ ], ['fileLocation' => $this->fileSystemPath . $path['path']]);
}
}
list($folderID, $folderName) = explode('**', $folder);
if ($folderID <= 4) continue; // the first 4 folders are the default folders
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['uid'].'-'.$folderID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['uid'].'-'.$folderID, [
'userID' => $row['uid'],
'label' => $folderName
- ));
+ ]);
}
}
}
while ($row = $statement->fetchArray()) {
$row['isDraft'] = $row['folder'] == 3 ? 1 : 0;
- $conversationID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['fromid'].'-'.$row['dateline'], array(
+ $conversationID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['fromid'].'-'.$row['dateline'], [
'subject' => $row['subject'],
'time' => $row['dateline'],
'userID' => $row['fromid'],
'username' => $row['username'] ?: '',
'isDraft' => $row['isDraft']
- ));
+ ]);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmid'], [
'conversationID' => $row['fromid'].'-'.$row['dateline'],
'userID' => $row['fromid'],
'username' => $row['username'] ?: '',
'time' => $row['dateline'],
'enableSmilies' => $row['smilieoff'] ? 0 : 1,
'showSignature' => $row['includesig'] ? 1 : 0
- ));
+ ]);
}
}
WHERE pmid BETWEEN ? AND ?
ORDER BY pmid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$recipients = unserialize($row['recipients']);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['fromid'].'-'.$row['dateline'],
'participantID' => $row['uid'],
'username' => $row['username'] ?: '',
'hideConversation' => $row['deletetime'] ? 1 : 0,
'isInvisible' => (isset($recipients['bcc']) && in_array($row['uid'], $recipients['bcc'])) ? 1 : 0,
'lastVisitTime' => $row['readtime']
- ), array('labelIDs' => ($row['folder'] > 4 ? array($row['folder']) : array())));
+ ], ['labelIDs' => ($row['folder'] > 4 ? [$row['folder']] : [])]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['fid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['fid'], [
'parentID' => ($board['pid'] ?: null),
'position' => $board['disporder'],
'boardType' => ($board['linkto'] ? Board::TYPE_LINK : ($board['type'] == 'c' ? Board::TYPE_CATEGORY : Board::TYPE_BOARD)),
'isInvisible' => $board['active'] ? 0 : 1,
'posts' => $board['posts'],
'threads' => $board['threads']
- ));
+ ]);
$this->exportBoardsRecursively($board['fid']);
}
WHERE tid BETWEEN ? AND ?
ORDER BY tid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['fid'],
'topic' => $row['subject'],
'time' => $row['dateline'],
'isClosed' => $row['closed'] ? 1 : 0,
'isDeleted' => $row['deletetime'] ? 1 : 0,
'deleteTime' => $row['deletetime']
- );
+ ];
- $additionalData = array();
- if ($row['prefix']) $additionalData['labels'] = array(ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['fid']).'-'.$row['prefix']);
+ $additionalData = [];
+ if ($row['prefix']) $additionalData['labels'] = [ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['fid']).'-'.$row['prefix']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['tid'], $data, $additionalData);
}
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], [
'threadID' => $row['tid'],
'userID' => $row['uid'],
'username' => $row['username'],
'enableSmilies' => $row['smilieoff'] ? 0 : 1,
'showSignature' => $row['includesig'],
'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress'])
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."settings
WHERE name = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('uploadspath'));
+ $statement->execute(['uploadspath']);
$row = $statement->fetchArray();
$uploadsPath = $row['value'];
if (!StringUtil::startsWith($uploadsPath, '/')) $uploadsPath = realpath($this->fileSystemPath.$uploadsPath);
WHERE aid BETWEEN ? AND ?
ORDER BY aid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$fileLocation = FileUtil::addTrailingSlash($uploadsPath).$row['attachname'];
if (!file_exists($fileLocation)) continue;
$row['isImage'] = $row['width'] = $row['height'] = 0;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['aid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['aid'], [
'objectID' => $row['pid'],
'userID' => ($row['uid'] ?: null),
'filename' => $row['filename'],
'height' => $row['height'],
'downloads' => $row['downloads'],
'uploadTime' => $row['dateuploaded']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
WHERE sid BETWEEN ? AND ?
ORDER BY sid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import($row['sid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import($row['sid'], [
'objectID' => $row['tid'],
'userID' => $row['uid'],
'notification' => $row['notification']
- ));
+ ]);
}
}
WHERE pid BETWEEN ? AND ?
ORDER BY pid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pid'], [
'objectID' => $row['firstpost'],
'question' => $row['question'],
'time' => $row['dateline'],
'isPublic' => $row['public'],
'maxVotes' => $row['multiple'] ? $row['numoptions'] : 1,
'votes' => $row['numvotes']
- ));
+ ]);
}
}
$votes = explode('||~|~||', $row['votes']);
$i = 1;
foreach ($options as $key => $option) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$i, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pid'].'-'.$i, [
'pollID' => $row['pid'],
'optionValue' => $option,
'showOrder' => $i,
'votes' => $votes[$key]
- ));
+ ]);
$i++;
}
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import($row['vid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import($row['vid'], [
'pollID' => $row['pid'],
'optionID' => $row['pid'].'-'.$row['voteoption'],
'userID' => $row['uid']
- ));
+ ]);
}
}
AND adduid <> ?
AND reputation <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0, 0));
+ $statement->execute([0, 0, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND reputation <> ?
ORDER BY rid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0, 0, 0));
+ $statement->execute([0, 0, 0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import($row['rid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import($row['rid'], [
'objectID' => $row['pid'],
'objectUserID' => ($row['uid'] ?: null),
'userID' => $row['adduid'],
'likeValue' => ($row['reputation'] > 0 ? Like::LIKE : Like::DISLIKE),
'time' => $row['dateline']
- ));
+ ]);
}
}
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."threadprefixes";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
* Exports labels.
*/
public function exportLabels($offset, $limit) {
- $prefixMap = array();
+ $prefixMap = [];
$boardIDs = array_keys(BoardCache::getInstance()->getBoards());
$sql = "SELECT *
FROM ".$this->databasePrefix."threadprefixes";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
$forums = array_unique(ArrayUtil::toIntegerArray(explode(',', $row['forums'])));
foreach ($forums as $key => $forum) {
if (in_array('-1', $forums)) $forums = $boardIDs;
foreach ($forums as $forum) {
- if (!isset($prefixMap[$forum])) $prefixMap[$forum] = array();
+ if (!isset($prefixMap[$forum])) $prefixMap[$forum] = [];
$prefixMap[$forum][$row['pid']] = $row['prefix'];
}
}
foreach ($prefixMap as $forumID => $data) {
// import label group
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($forumID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($forumID, [
'groupName' => 'labelgroup'.$forumID
- ), array('objects' => array($objectType->objectTypeID => array($forumID))));
+ ], ['objects' => [$objectType->objectTypeID => [$forumID]]]);
// import labels
foreach ($data as $prefixID => $prefix) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($forumID.'-'.$prefixID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($forumID.'-'.$prefixID, [
'groupID' => $forumID,
'label' => $prefix
- ));
+ ]);
}
}
}
*/
public function exportACLs($offset, $limit) {
// get ids
- $mod = $user = $group = array();
+ $mod = $user = $group = [];
$sql = "(
SELECT mid AS id, 'mod' AS type
FROM ".$this->databasePrefix."moderators
// mods
if (!empty($mod)) {
- $modPermissionMap = array(
- 'caneditposts' => array('canEditPost'),
- 'candeleteposts' => array(
+ $modPermissionMap = [
+ 'caneditposts' => ['canEditPost'],
+ 'candeleteposts' => [
'canDeleteThread',
'canReadDeletedThread',
'canRestoreThread',
'canReadDeletedPost',
'canRestorePost',
'canDeletePostCompletely'
- ),
- 'canviewips' => array(),
- 'canopenclosethreads' => array(
+ ],
+ 'canviewips' => [],
+ 'canopenclosethreads' => [
'canCloseThread',
'canReplyClosedThread',
'canPinThread',
'canClosePost'
- ),
- 'canmanagethreads' => array(
+ ],
+ 'canmanagethreads' => [
'canEnableThread',
'canMoveThread',
'canMergeThread',
'canEnablePost',
'canMovePost',
'canMergePost'
- )
- );
+ ]
+ ];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('mid IN (?)', array($mod));
+ $conditionBuilder->add('mid IN (?)', [$mod]);
$sql = "SELECT *
FROM ".$this->databasePrefix."moderators
while ($row = $statement->fetchArray()) {
foreach ($modPermissionMap as $mybbPermission => $permissions) {
foreach ($permissions as $permission) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $row['fid'],
($row['isgroup'] ? 'groupID' : 'userID') => $row['id'],
'optionValue' => $row[$mybbPermission]
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
// groups
if (!empty($group)) {
- $groupPermissionMap = array(
- 'canview' => array(
+ $groupPermissionMap = [
+ 'canview' => [
'canViewBoard',
'canEnterBoard'
- ),
- 'canviewthreads' => array('canReadThread'),
- 'canonlyviewownthreads' => array(),
- 'candlattachments' => array(
+ ],
+ 'canviewthreads' => ['canReadThread'],
+ 'canonlyviewownthreads' => [],
+ 'candlattachments' => [
'canDownloadAttachment',
'canViewAttachmentPreview'
- ),
- 'canpostthreads' => array('canStartThread'),
- 'canpostreplys' => array('canReplyThread'),
- 'canpostattachments' => array('canUploadAttachment'),
- 'canratethreads' => array(),
- 'caneditposts' => array('canEditOwnPost'),
- 'candeleteposts' => array('canDeleteOwnPost'),
- 'candeletethreads' => array(),
- 'caneditattachments' => array(),
- 'canpostpolls' => array('canStartPoll'),
- 'canvotepolls' => array('canVotePoll'),
- 'cansearch' => array()
- );
+ ],
+ 'canpostthreads' => ['canStartThread'],
+ 'canpostreplys' => ['canReplyThread'],
+ 'canpostattachments' => ['canUploadAttachment'],
+ 'canratethreads' => [],
+ 'caneditposts' => ['canEditOwnPost'],
+ 'candeleteposts' => ['canDeleteOwnPost'],
+ 'candeletethreads' => [],
+ 'caneditattachments' => [],
+ 'canpostpolls' => ['canStartPoll'],
+ 'canvotepolls' => ['canVotePoll'],
+ 'cansearch' => []
+ ];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('pid IN (?)', array($group));
+ $conditionBuilder->add('pid IN (?)', [$group]);
$sql = "SELECT *
FROM ".$this->databasePrefix."forumpermissions
while ($row = $statement->fetchArray()) {
foreach ($groupPermissionMap as $mybbPermission => $permissions) {
foreach ($permissions as $permission) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $row['fid'],
'groupID' => $row['gid'],
'optionValue' => $row[$mybbPermission]
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
FROM ".$this->databasePrefix."smilies
ORDER BY sid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath . $row['image'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['sid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['sid'], [
'smileyTitle' => $row['name'],
'smileyCode' => $row['find'],
'showOrder' => $row['disporder']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
$videoRegex = new Regex('\[video=[a-z]+\]');
$quoteRegex = new Regex('\[quote=\'(.*?)\' pid=\'(\d+)\' dateline=\'\d+\'\]');
$quoteCallback = new Callback(function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $postID,
'forceFrontend' => true
- )).'#post'.$postID;
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$postID;
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
});
$imgRegex = new Regex('\[img(?:=(\d)x\d)?(?: align=(left|right))?\](?:\r\n?|\n?)(https?://(?:[^<>"\']+?))\[/img\]');
$imgCallback = new Callback(function ($matches) {
- $escapedLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[3]);
+ $escapedLink = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[3]);
if ($matches[1] && $matches[2]) {
return "[img='".$escapedLink."',".$matches[2].",".$matches[1]."][/img]";
}
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.follower' => 'Followers',
'com.woltlab.wcf.conversation' => 'Conversations',
'com.woltlab.wbb.thread' => 'Threads',
'com.woltlab.wbb.post' => 'Posts',
'com.woltlab.wbb.like' => 'Likes',
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 100
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::init()
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- $supportedData = array(
- 'com.woltlab.wcf.user' => array(
+ $supportedData = [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.follower',
- ),
- 'com.woltlab.wcf.conversation' => array(
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.like',
- ),
- );
+ ],
+ ];
return $supportedData;
}
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
$row = $this->database->hgetall('user:'.$userID);
if (!$row) throw new SystemException('Invalid user');
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'banReason' => '',
'lastActivityTime' => intval($row['lastonline'] / 1000),
'signature' => self::convertMarkdown($row['signature']),
- );
+ ];
static $gravatarRegex = null;
if ($gravatarRegex === null) {
$birthday = \DateTime::createFromFormat('m/d/Y', StringUtil::decodeHTML($row['birthday']));
// get user options
- $options = array(
+ $options = [
'birthday' => $birthday ? $birthday->format('Y-m-d') : '',
'homepage' => StringUtil::decodeHTML($row['website']),
'location' => StringUtil::decodeHTML($row['location']),
- );
+ ];
- $additionalData = array(
+ $additionalData = [
'options' => $options
- );
+ ];
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['uid'], $data, $additionalData);
// update password hash
if ($newUserID) {
$password = PasswordUtil::getSaltedHash($row['password'], $row['password']);
- $passwordUpdateStatement->execute(array($password, $newUserID));
+ $passwordUpdateStatement->execute([$password, $newUserID]);
}
}
}
$boardIDs = $this->database->zrange('categories:cid', 0, -1);
if (!$boardIDs) throw new SystemException('Could not fetch boardIDs');
- $imported = array();
+ $imported = [];
foreach ($boardIDs as $boardID) {
$row = $this->database->hgetall('category:'.$boardID);
if (!$row) throw new SystemException('Invalid board');
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['cid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['cid'], [
'parentID' => ($board['parentCid'] ?: null),
'position' => $board['order'] ?: 0,
'boardType' => $board['link'] ? Board::TYPE_LINK : Board::TYPE_BOARD,
'title' => $board['name'],
'description' => $board['description'],
'externalURL' => $board['link']
- ));
+ ]);
$this->exportBoardsRecursively($board['cid']);
}
$row = $this->database->hgetall('topic:'.$threadID);
if (!$row) throw new SystemException('Invalid thread');
- $data = array(
+ $data = [
'boardID' => $row['cid'],
'topic' => $row['title'],
'time' => intval($row['timestamp'] / 1000),
'isClosed' => $row['locked'],
'isDeleted' => $row['deleted'],
'deleteTime' => TIME_NOW,
- );
+ ];
- $additionalData = array(
- 'tags' => $this->database->smembers('topic:'.$threadID.':tags') ?: array()
- );
+ $additionalData = [
+ 'tags' => $this->database->smembers('topic:'.$threadID.':tags') ?: []
+ ];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['tid'], $data, $additionalData);
}
if (!$row) throw new SystemException('Invalid post');
// TODO: ip address
- $data = array(
+ $data = [
'threadID' => $row['tid'],
'userID' => $row['uid'],
'username' => $this->database->hget('user:'.$row['uid'], 'username'),
'editor' => $this->database->hget('user:'.$row['editor'], 'username'),
'lastEditTime' => intval($row['edited'] / 1000),
'editCount' => $row['edited'] ? 1 : 0
- );
+ ];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], $data);
}
if ($likes) {
foreach ($likes as $postID) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $postID,
'objectUserID' => $this->database->hget('post:'.$postID, 'uid') ?: null,
'userID' => $userID,
'likeValue' => Like::LIKE,
'time' => intval($this->database->zscore('uid:'.$userID.':upvote', $postID) / 1000)
- ));
+ ]);
}
}
if ($dislikes) {
foreach ($dislikes as $postID) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $postID,
'objectUserID' => $this->database->hget('post:'.$postID, 'uid') ?: null,
'userID' => $userID,
'likeValue' => Like::DISLIKE,
'time' => intval($this->database->zscore('uid:'.$userID.':downvote', $postID) / 1000)
- ));
+ ]);
}
}
}
if ($followed) {
foreach ($followed as $followUserID) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $userID,
'followUserID' => $followUserID,
'time' => intval($this->database->zscore('following:'.$userID, $followUserID) / 1000)
- ));
+ ]);
}
}
}
if (!$firstMessageID) throw new SystemException('Could not find first message of conversation');
$firstMessage = $this->database->hgetall('message:'.$firstMessageID[0]);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, [
'subject' => $this->database->hget('user:'.$userID, 'username').' - '.$this->database->hget('user:'.$chat, 'username'),
'time' => intval($firstMessage['timestamp'] / 1000),
'userID' => $userID,
'username' => $this->database->hget('user:'.$firstMessage['fromuid'], 'username'),
'isDraft' => 0
- ));
+ ]);
// participant a
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $userID,
'username' => $this->database->hget('user:'.$userID, 'username'),
'hideConversation' => 0,
'isInvisible' => 0,
'lastVisitTime' => 0
- ));
+ ]);
// participant b
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $chat,
'username' => $this->database->hget('user:'.$chat, 'username'),
'hideConversation' => 0,
'isInvisible' => 0,
'lastVisitTime' => 0
- ));
+ ]);
}
}
}
if (!$message) continue;
$conversationID = min($message['fromuid'], $message['touid']).':to:'.max($message['fromuid'], $message['touid']);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($offset + $i, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($offset + $i, [
'conversationID' => $conversationID,
'userID' => $message['fromuid'],
'username' => $this->database->hget('user:'.$message['fromuid'], 'username'),
'enableHtml' => 0,
'enableBBCodes' => 0,
'showSignature' => 0
- ));
+ ]);
}
}
$out = $parsedown->text($message);
$out = $codeRegex->replace($out, '[code=\1]');
- $out = strtr($out, array(
+ $out = strtr($out, [
'<p>' => '',
'</p>' => '',
'<br />' => '',
'</blockquote>' => '[/quote]',
'</a>' => '[/url]'
- ));
+ ]);
$out = $imgRegex->replace($out, '[img]\1[/img]');
$out = $urlRegex->replace($out, '[url=\1]');
* @category Community Framework
*/
class PhpBB31xExporter extends AbstractExporter {
- protected static $knownProfileFields = array(
+ protected static $knownProfileFields = [
'phpbb_location', 'phpbb_website', 'phpbb_interests', 'phpbb_occupation',
'phpbb_icq', 'phpbb_facebook', 'phpbb_twitter', 'phpbb_googleplus', 'phpbb_skype'
- );
+ ];
const TOPIC_TYPE_GLOBAL = 3;
const TOPIC_TYPE_ANNOUCEMENT = 2;
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wcf.label' => 'Labels',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley' => 'Smilies'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 1
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE group_id BETWEEN ? AND ?
ORDER BY group_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
switch ($row['group_id']) {
case 1:
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['group_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['group_id'], [
'groupName' => $row['group_name'],
'groupType' => $groupType,
'userOnlineMarking' => ($row['group_colour'] ? '<span style="color: #'.$row['group_colour'].'">%s</span>' : '%s'),
'showOnTeamPage' => $row['group_legend']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."users
WHERE user_type <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(self::USER_TYPE_USER_IGNORE));
+ $statement->execute([self::USER_TYPE_USER_IGNORE]);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = array();
+ $profileFields = [];
$sql = "SELECT *
FROM ".$this->databasePrefix."profile_fields";
$statement = $this->database->prepareStatement($sql);
AND user_table.user_id BETWEEN ? AND ?
ORDER BY user_table.user_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, self::USER_TYPE_USER_IGNORE, $offset + 1, $offset + $limit));
+ $statement->execute([0, self::USER_TYPE_USER_IGNORE, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => StringUtil::decodeHTML($row['username']),
'password' => '',
'email' => $row['user_email'],
'signatureEnableHtml' => 0,
'signatureEnableSmilies' => preg_match('/<!-- s.*? -->/', $row['user_sig']),
'lastActivityTime' => $row['user_lastvisit']
- );
+ ];
$birthday = \DateTime::createFromFormat('j-n-Y', str_replace(' ', '', $row['user_birthday']));
// get user options
- $options = array(
+ $options = [
'birthday' => $birthday ? $birthday->format('Y-m-d') : ''
- );
+ ];
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
- 'languages' => array($row['user_lang']),
+ 'languages' => [$row['user_lang']],
'options' => $options
- );
+ ];
// handle user options
foreach ($profileFields as $profileField) {
$password = 'phpbb3:'.$row['user_password'].':';
}
- $passwordUpdateStatement->execute(array($password, $newUserID));
+ $passwordUpdateStatement->execute([$password, $newUserID]);
}
}
}
*/
public function exportUserOptions($offset, $limit) {
$condition = new PreparedStatementConditionBuilder();
- $condition->add('field_name NOT IN (?)', array(self::$knownProfileFields));
+ $condition->add('field_name NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT fields.*,
(
".$condition."
ORDER BY fields.field_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array_merge(array('profilefields.type.dropdown'), $condition->getParameters()));
+ $statement->execute(array_merge(['profilefields.type.dropdown'], $condition->getParameters()));
while ($row = $statement->fetchArray()) {
$selectOptions = '';
switch ($row['field_type']) {
$outputClass = '';
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['field_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['field_id'], [
'categoryName' => 'profile.personal',
'optionType' => $type,
'editable' => $row['field_show_profile'] ? UserOption::EDITABILITY_ALL : UserOption::EDITABILITY_ADMINISTRATOR,
'showOrder' => $row['field_order'],
'outputClass' => $outputClass,
'isDisabled' => $row['field_active'] ? 0 : 1
- ), array('name' => $row['field_name']));
+ ], ['name' => $row['field_name']]);
}
}
FROM ".$this->databasePrefix."ranks
WHERE rank_special = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE rank_special = ?
ORDER BY rank_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], [
'groupID' => 2, // 2 = registered users
'requiredPoints' => $row['rank_min'] * 5,
'rankTitle' => $row['rank_title'],
'rankImage' => $row['rank_image'],
'repeatImage' => 0,
'requiredGender' => 0 // neutral
- ));
+ ]);
}
}
WHERE friend = ?
AND foe = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND foe = ?
ORDER BY user_id, zebra_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['user_id'],
'followUserID' => $row['zebra_id']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."users
WHERE user_avatar_type IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED));
+ $statement->execute([self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED]);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."config
WHERE config_name IN (?, ?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('avatar_path', 'avatar_salt', 'avatar_gallery_path'));
+ $statement->execute(['avatar_path', 'avatar_salt', 'avatar_gallery_path']);
while ($row = $statement->fetchArray()) {
$config_name = $row['config_name'];
$$config_name = $row['config_value'];
WHERE user_avatar_type IN (?, ?)
ORDER BY user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED));
+ $statement->execute([self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED]);
while ($row = $statement->fetchArray()) {
$extension = pathinfo($row['user_avatar'], PATHINFO_EXTENSION);
switch ($row['user_avatar_type']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, [
'avatarName' => basename($row['user_avatar']),
'avatarExtension' => $extension,
'userID' => $row['user_id']
- ), array('fileLocation' => $location));
+ ], ['fileLocation' => $location]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folder_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folder_id'], [
'userID' => $row['user_id'],
'label' => mb_substr($row['folder_name'], 0, 80)
- ));
+ ]);
}
}
)
ORDER BY isDraft, msg_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
if (!$row['isDraft']) {
$participants = explode(',', $row['participants']);
if (ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $conversationID) !== null) continue;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import(($row['isDraft'] ? 'draft-'.$row['msg_id'] : $conversationID), array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import(($row['isDraft'] ? 'draft-'.$row['msg_id'] : $conversationID), [
'subject' => StringUtil::decodeHTML($row['message_subject']),
'time' => $row['message_time'],
'userID' => $row['author_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'isDraft' => $row['isDraft']
- ));
+ ]);
}
}
)
ORDER BY msg_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['author_id'];
$conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], [
'conversationID' => $conversationID,
'userID' => $row['author_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'enableHtml' => 0,
'enableBBCodes' => $row['enable_bbcode'],
'showSignature' => $row['enable_sig']
- ));
+ ]);
}
}
$conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
$bcc = explode(':', $row['bcc_address']);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $row['user_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'hideConversation' => $row['pm_deleted'],
'isInvisible' => in_array('u_'.$row['user_id'], $bcc) ? 1 : 0,
'lastVisitTime' => $row['pm_new'] ? 0 : $row['message_time']
- ), array('labelIDs' => ($row['folder_id'] > 0 ? array($row['folder_id']) : array())));
+ ], ['labelIDs' => ($row['folder_id'] > 0 ? [$row['folder_id']] : [])]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forum_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forum_id'], [
'parentID' => ($board['parent_id'] ?: null),
'position' => $board['left_id'],
'boardType' => ($board['forum_type'] == self::BOARD_TYPE_LINK ? Board::TYPE_LINK : ($board['forum_type'] == self::BOARD_TYPE_CATEGORY ? Board::TYPE_CATEGORY : Board::TYPE_BOARD)),
'clicks' => $board['forum_posts_approved'],
'posts' => $board['forum_posts_approved'],
'threads' => $board['forum_topics_approved']
- ));
+ ]);
$this->exportBoardsRecursively($board['forum_id']);
}
WHERE topic_id BETWEEN ? AND ?
ORDER BY topic_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['forum_id'] ?: $boardIDs[0], // map global annoucements to a random board
'topic' => StringUtil::decodeHTML($row['topic_title']),
'time' => $row['topic_time'],
'isClosed' => $row['topic_status'] == self::TOPIC_STATUS_CLOSED ? 1 : 0,
'movedThreadID' => ($row['topic_status'] == self::TOPIC_STATUS_LINK && $row['topic_moved_id']) ? $row['topic_moved_id'] : null,
'movedTime' => 0,
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if ($row['topic_type'] == self::TOPIC_TYPE_GLOBAL) $additionalData['assignedBoards'] = $boardIDs;
- if ($row['topic_type'] == self::TOPIC_TYPE_ANNOUCEMENT) $additionalData['assignedBoards'] = array($row['forum_id']);
+ if ($row['topic_type'] == self::TOPIC_TYPE_ANNOUCEMENT) $additionalData['assignedBoards'] = [$row['forum_id']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['topic_id'], $data, $additionalData);
}
WHERE post_id BETWEEN ? AND ?
ORDER BY post_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, $offset + 1, $offset + $limit));
+ $statement->execute([0, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], [
'threadID' => $row['topic_id'],
'userID' => $row['poster_id'],
'username' => ($row['post_username'] ?: (StringUtil::decodeHTML($row['username']) ?: '')),
'enableBBCodes' => $row['enable_bbcode'],
'showSignature' => $row['enable_sig'],
'ipAddress' => UserUtil::convertIPv4To6($row['poster_ip'])
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['topic_id'],
'userID' => $row['user_id'],
'notification' => $row['notify_status']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."topics
WHERE poll_start <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE poll_start <> ?
ORDER BY topic_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['topic_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['topic_id'], [
'objectID' => $row['topic_first_post_id'],
'question' => $row['poll_title'],
'time' => $row['poll_start'],
'isPublic' => 0,
'maxVotes' => $row['poll_max_options'],
'votes' => $row['poll_votes']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['topic_id'].'-'.$row['poll_option_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['topic_id'].'-'.$row['poll_option_id'], [
'pollID' => $row['topic_id'],
'optionValue' => $row['poll_option_text'],
'showOrder' => $row['poll_option_id'],
'votes' => $row['poll_option_total']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."poll_votes
WHERE vote_user_id <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE vote_user_id <> ?
ORDER BY poll_option_id, vote_user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['topic_id'],
'optionID' => $row['topic_id'].'-'.$row['poll_option_id'],
'userID' => $row['vote_user_id']
- ));
+ ]);
}
}
$sql = "SELECT (SELECT COUNT(*) FROM ".$this->databasePrefix."acl_users WHERE forum_id <> ?)
+ (SELECT COUNT(*) FROM ".$this->databasePrefix."acl_groups WHERE forum_id <> ?) AS count";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
$row = $statement->fetchArray();
return $row['count'] ? 2 : 0;
}
FROM ".$this->databasePrefix."acl_options
WHERE is_local = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1));
- $options = array();
+ $statement->execute([1]);
+ $options = [];
while ($row = $statement->fetchArray()) {
$options[$row['auth_option_id']] = $row;
}
$condition = new PreparedStatementConditionBuilder();
- $condition->add('auth_option_id IN (?)', array(array_keys($options)));
+ $condition->add('auth_option_id IN (?)', [array_keys($options)]);
$sql = "SELECT *
FROM ".$this->databasePrefix."acl_roles_data
".$condition;
$statement = $this->database->prepareStatement($sql);
$statement->execute($condition->getParameters());
- $roles = array();
+ $roles = [];
while ($row = $statement->fetchArray()) {
$roles[$row['role_id']][$row['auth_option_id']] = $row['auth_setting'];
}
- $data = array();
+ $data = [];
if ($offset == 0) {
// groups
$sql = "SELECT *
WHERE forum_id <> ?
ORDER BY auth_role_id DESC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$key = 'group';
}
else if ($offset == 1) {
WHERE forum_id <> ?
ORDER BY auth_role_id DESC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$key = 'user';
}
}
}
- static $optionMapping = array(
- 'f_announce' => array('canStartAnnouncement'),
- 'f_attach' => array('canUploadAttachment'),
- 'f_bbcode' => array(),
- 'f_bump' => array(),
- 'f_delete' => array('canDeleteOwnPost'),
- 'f_download' => array('canDownloadAttachment', 'canViewAttachmentPreview'),
- 'f_edit' => array('canEditOwnPost'),
- 'f_email' => array(),
- 'f_flash' => array(),
- 'f_icons' => array(),
- 'f_ignoreflood' => array(),
- 'f_img' => array(),
- 'f_list' => array('canViewBoard'),
- 'f_noapprove' => array('canStartThreadWithoutModeration', 'canReplyThreadWithoutModeration'),
- 'f_poll' => array('canStartPoll'),
- 'f_post' => array('canStartThread'),
- 'f_postcount' => array(),
- 'f_print' => array(),
- 'f_read' => array('canEnterBoard'),
- 'f_reply' => array('canReplyThread'),
- 'f_report' => array(),
- 'f_search' => array(),
- 'f_sigs' => array(),
- 'f_smilies' => array(),
- 'f_sticky' => array('canPinThread'),
- 'f_subscribe' => array(),
- 'f_user_lock' => array(),
- 'f_vote' => array('canVotePoll'),
- 'f_votechg' => array(),
- 'm_approve' => array('canEnableThread'),
- 'm_chgposter' => array(),
- 'm_delete' => array(
+ static $optionMapping = [
+ 'f_announce' => ['canStartAnnouncement'],
+ 'f_attach' => ['canUploadAttachment'],
+ 'f_bbcode' => [],
+ 'f_bump' => [],
+ 'f_delete' => ['canDeleteOwnPost'],
+ 'f_download' => ['canDownloadAttachment', 'canViewAttachmentPreview'],
+ 'f_edit' => ['canEditOwnPost'],
+ 'f_email' => [],
+ 'f_flash' => [],
+ 'f_icons' => [],
+ 'f_ignoreflood' => [],
+ 'f_img' => [],
+ 'f_list' => ['canViewBoard'],
+ 'f_noapprove' => ['canStartThreadWithoutModeration', 'canReplyThreadWithoutModeration'],
+ 'f_poll' => ['canStartPoll'],
+ 'f_post' => ['canStartThread'],
+ 'f_postcount' => [],
+ 'f_print' => [],
+ 'f_read' => ['canEnterBoard'],
+ 'f_reply' => ['canReplyThread'],
+ 'f_report' => [],
+ 'f_search' => [],
+ 'f_sigs' => [],
+ 'f_smilies' => [],
+ 'f_sticky' => ['canPinThread'],
+ 'f_subscribe' => [],
+ 'f_user_lock' => [],
+ 'f_vote' => ['canVotePoll'],
+ 'f_votechg' => [],
+ 'm_approve' => ['canEnableThread'],
+ 'm_chgposter' => [],
+ 'm_delete' => [
'canDeleteThread', 'canReadDeletedThread', 'canRestoreThread', 'canDeleteThreadCompletely',
'canDeletePost', 'canReadDeletedPost', 'canRestorePost', 'canDeletePostCompletely'
- ),
- 'm_edit' => array('canEditPost'),
- 'm_info' => array(),
- 'm_lock' => array('canCloseThread', 'canReplyClosedThread'),
- 'm_merge' => array('canMergeThread', 'canMergePost'),
- 'm_move' => array('canMoveThread', 'canMovePost'),
- 'm_report' => array(),
- 'm_split' => array()
- );
+ ],
+ 'm_edit' => ['canEditPost'],
+ 'm_info' => [],
+ 'm_lock' => ['canCloseThread', 'canReplyClosedThread'],
+ 'm_merge' => ['canMergeThread', 'canMergePost'],
+ 'm_move' => ['canMoveThread', 'canMovePost'],
+ 'm_report' => [],
+ 'm_split' => []
+ ];
foreach ($data as $id => $forumData) {
foreach ($forumData as $forumID => $settingData) {
foreach ($settingData as $optionID => $value) {
if (!isset($optionMapping[$options[$optionID]['auth_option']])) continue;
foreach ($optionMapping[$options[$optionID]['auth_option']] as $optionName) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $forumID,
$key.'ID' => $id,
'optionValue' => $value
- ), array(
+ ], [
'optionName' => $optionName
- ));
+ ]);
}
}
}
GROUP BY smiley_url
ORDER BY smiley_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'images/smilies/'.$row['smiley_url'];
$code = array_shift($aliases);
$emotion = mb_substr($row['emotion'], 0, mb_strpos($row['emotion'], "\n") ?: mb_strlen($row['emotion'])); // we had to GROUP_CONCAT it because of SQL strict mode
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smiley_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smiley_id'], [
'smileyTitle' => $emotion,
'smileyCode' => $code,
'showOrder' => $row['smiley_order'],
'aliases' => implode("\n", $aliases)
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
FROM ".$this->databasePrefix."attachments
WHERE in_message = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($conversation ? 1 : 0));
+ $statement->execute([$conversation ? 1 : 0]);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."config
WHERE config_name IN (?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('upload_path'));
+ $statement->execute(['upload_path']);
while ($row = $statement->fetchArray()) {
$$row['config_name'] = $row['config_value'];
}
WHERE in_message = ?
ORDER BY attach_id DESC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($conversation ? 1 : 0));
+ $statement->execute([$conversation ? 1 : 0]);
while ($row = $statement->fetchArray()) {
$fileLocation = FileUtil::addTrailingSlash($this->fileSystemPath.$upload_path).$row['physical_filename'];
$isImage = 0;
if ($row['mimetype'] == 'image/jpeg' || $row['mimetype'] == 'image/png' || $row['mimetype'] == 'image/gif') $isImage = 1;
- ImportHandler::getInstance()->getImporter('com.woltlab.'.($conversation ? 'wcf.conversation' : 'wbb').'.attachment')->import(0, array( // TODO: support inline attachments
+ ImportHandler::getInstance()->getImporter('com.woltlab.'.($conversation ? 'wcf.conversation' : 'wbb').'.attachment')->import(0, [ // TODO: support inline attachments
'objectID' => $row['post_msg_id'],
'userID' => ($row['poster_id'] ?: null),
'filename' => $row['real_filename'],
'isImage' => $isImage,
'downloads' => $row['download_count'],
'uploadTime' => $row['filetime']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
// fix code php bbcode...
$text = preg_replace_callback('#\[code(=php)?\](.*)\[/code\]#s', function ($matches) {
$content = $matches[2];
- $content = str_replace(array(
+ $content = str_replace([
'<br />',
' '
- ), array(
+ ], [
"\n",
"\t"
- ), $content);
+ ], $content);
$content = preg_replace('#(?:<span class="syntax[^"]*">|</span>)#', '', $content);
return '[code'.$matches[1].']'.$content.'[/code]';
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wcf.label' => 'Labels',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley' => 'Smilies'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 1
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE group_id BETWEEN ? AND ?
ORDER BY group_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
switch ($row['group_id']) {
case 1:
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['group_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['group_id'], [
'groupName' => $row['group_name'],
'groupType' => $groupType,
'userOnlineMarking' => ($row['group_colour'] ? '<span style="color: #'.$row['group_colour'].'">%s</span>' : '%s'),
'showOnTeamPage' => $row['group_legend']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."users
WHERE user_type <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(self::USER_TYPE_USER_IGNORE));
+ $statement->execute([self::USER_TYPE_USER_IGNORE]);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = array();
+ $profileFields = [];
$sql = "SELECT *
FROM ".$this->databasePrefix."profile_fields";
$statement = $this->database->prepareStatement($sql);
AND user_table.user_id BETWEEN ? AND ?
ORDER BY user_table.user_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, self::USER_TYPE_USER_IGNORE, $offset + 1, $offset + $limit));
+ $statement->execute([0, self::USER_TYPE_USER_IGNORE, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => StringUtil::decodeHTML($row['username']),
'password' => '',
'email' => $row['user_email'],
'signatureEnableHtml' => 0,
'signatureEnableSmilies' => preg_match('/<!-- s.*? -->/', $row['user_sig']),
'lastActivityTime' => $row['user_lastvisit']
- );
+ ];
$birthday = \DateTime::createFromFormat('j-n-Y', str_replace(' ', '', $row['user_birthday']));
// get user options
- $options = array(
+ $options = [
'location' => $row['user_from'],
'birthday' => $birthday ? $birthday->format('Y-m-d') : '',
'icq' => $row['user_icq'],
'homepage' => $row['user_website'],
'hobbies' => $row['user_interests']
- );
+ ];
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
- 'languages' => array($row['user_lang']),
+ 'languages' => [$row['user_lang']],
'options' => $options
- );
+ ];
// handle user options
foreach ($profileFields as $profileField) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('phpbb3:'.$row['user_password'].':', $newUserID));
+ $passwordUpdateStatement->execute(['phpbb3:'.$row['user_password'].':', $newUserID]);
}
}
}
FROM ".$this->databasePrefix."profile_fields fields
ORDER BY fields.field_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(5));
+ $statement->execute([5]);
while ($row = $statement->fetchArray()) {
$selectOptions = '';
switch ($row['field_type']) {
continue 2;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['field_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['field_id'], [
'categoryName' => 'profile.personal',
'optionType' => $type,
'editable' => $row['field_show_profile'] ? UserOption::EDITABILITY_ALL : UserOption::EDITABILITY_ADMINISTRATOR,
'visible' => $row['field_no_view'] ? UserOption::VISIBILITY_ADMINISTRATOR | UserOption::VISIBILITY_OWNER : UserOption::VISIBILITY_ALL,
'showOrder' => $row['field_order'],
'outputClass' => $type == 'select' ? 'wcf\system\option\user\SelectOptionsUserOptionOutput' : ''
- ), array('name' => $row['field_name']));
+ ], ['name' => $row['field_name']]);
}
}
FROM ".$this->databasePrefix."ranks
WHERE rank_special = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE rank_special = ?
ORDER BY rank_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rank_id'], [
'groupID' => 2, // 2 = registered users
'requiredPoints' => $row['rank_min'] * 5,
'rankTitle' => $row['rank_title'],
'rankImage' => $row['rank_image'],
'repeatImage' => 0,
'requiredGender' => 0 // neutral
- ));
+ ]);
}
}
WHERE friend = ?
AND foe = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND foe = ?
ORDER BY user_id, zebra_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['user_id'],
'followUserID' => $row['zebra_id']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."users
WHERE user_avatar_type IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED));
+ $statement->execute([self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED]);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."config
WHERE config_name IN (?, ?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('avatar_path', 'avatar_salt', 'avatar_gallery_path'));
+ $statement->execute(['avatar_path', 'avatar_salt', 'avatar_gallery_path']);
while ($row = $statement->fetchArray()) {
$config_name = $row['config_name'];
$$config_name = $row['config_value'];
WHERE user_avatar_type IN (?, ?)
ORDER BY user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED));
+ $statement->execute([self::AVATAR_TYPE_GALLERY, self::AVATAR_TYPE_UPLOADED]);
while ($row = $statement->fetchArray()) {
$extension = pathinfo($row['user_avatar'], PATHINFO_EXTENSION);
switch ($row['user_avatar_type']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, [
'avatarName' => basename($row['user_avatar']),
'avatarExtension' => $extension,
'userID' => $row['user_id']
- ), array('fileLocation' => $location));
+ ], ['fileLocation' => $location]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folder_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folder_id'], [
'userID' => $row['user_id'],
'label' => mb_substr($row['folder_name'], 0, 80)
- ));
+ ]);
}
}
)
ORDER BY isDraft, msg_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
if (!$row['isDraft']) {
$participants = explode(',', $row['participants']);
if (ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $conversationID) !== null) continue;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import(($row['isDraft'] ? 'draft-'.$row['msg_id'] : $conversationID), array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import(($row['isDraft'] ? 'draft-'.$row['msg_id'] : $conversationID), [
'subject' => StringUtil::decodeHTML($row['message_subject']),
'time' => $row['message_time'],
'userID' => $row['author_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'isDraft' => $row['isDraft']
- ));
+ ]);
}
}
)
ORDER BY msg_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1, 0));
+ $statement->execute([1, 0]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['author_id'];
$conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['msg_id'], [
'conversationID' => $conversationID,
'userID' => $row['author_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'enableHtml' => 0,
'enableBBCodes' => $row['enable_bbcode'],
'showSignature' => $row['enable_sig']
- ));
+ ]);
}
}
$conversationID = $this->getConversationID($row['root_level'] ?: $row['msg_id'], $participants);
$bcc = explode(':', $row['bcc_address']);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $row['user_id'],
'username' => StringUtil::decodeHTML($row['username']) ?: '',
'hideConversation' => $row['pm_deleted'],
'isInvisible' => in_array('u_'.$row['user_id'], $bcc) ? 1 : 0,
'lastVisitTime' => $row['pm_new'] ? 0 : $row['message_time']
- ), array('labelIDs' => ($row['folder_id'] > 0 ? array($row['folder_id']) : array())));
+ ], ['labelIDs' => ($row['folder_id'] > 0 ? [$row['folder_id']] : [])]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forum_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forum_id'], [
'parentID' => ($board['parent_id'] ?: null),
'position' => $board['left_id'],
'boardType' => ($board['forum_type'] == self::BOARD_TYPE_LINK ? Board::TYPE_LINK : ($board['forum_type'] == self::BOARD_TYPE_CATEGORY ? Board::TYPE_CATEGORY : Board::TYPE_BOARD)),
'clicks' => $board['forum_posts'],
'posts' => $board['forum_posts'],
'threads' => $board['forum_topics']
- ));
+ ]);
$this->exportBoardsRecursively($board['forum_id']);
}
WHERE topic_id BETWEEN ? AND ?
ORDER BY topic_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['forum_id'] ?: $boardIDs[0], // map global annoucements to a random board
'topic' => StringUtil::decodeHTML($row['topic_title']),
'time' => $row['topic_time'],
'isClosed' => $row['topic_status'] == self::TOPIC_STATUS_CLOSED ? 1 : 0,
'movedThreadID' => ($row['topic_status'] == self::TOPIC_STATUS_LINK && $row['topic_moved_id']) ? $row['topic_moved_id'] : null,
'movedTime' => 0,
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if ($row['topic_type'] == self::TOPIC_TYPE_GLOBAL) $additionalData['assignedBoards'] = $boardIDs;
- if ($row['topic_type'] == self::TOPIC_TYPE_ANNOUCEMENT) $additionalData['assignedBoards'] = array($row['forum_id']);
+ if ($row['topic_type'] == self::TOPIC_TYPE_ANNOUCEMENT) $additionalData['assignedBoards'] = [$row['forum_id']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['topic_id'], $data, $additionalData);
}
WHERE post_id BETWEEN ? AND ?
ORDER BY post_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, $offset + 1, $offset + $limit));
+ $statement->execute([0, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], [
'threadID' => $row['topic_id'],
'userID' => $row['poster_id'],
'username' => ($row['post_username'] ?: (StringUtil::decodeHTML($row['username']) ?: '')),
'enableBBCodes' => $row['enable_bbcode'],
'showSignature' => $row['enable_sig'],
'ipAddress' => UserUtil::convertIPv4To6($row['poster_ip'])
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['topic_id'],
'userID' => $row['user_id'],
'notification' => $row['notify_status']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."topics
WHERE poll_start <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE poll_start <> ?
ORDER BY topic_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['topic_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['topic_id'], [
'objectID' => $row['topic_first_post_id'],
'question' => $row['poll_title'],
'time' => $row['poll_start'],
'isPublic' => 0,
'maxVotes' => $row['poll_max_options'],
'votes' => $row['poll_votes']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['topic_id'].'-'.$row['poll_option_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['topic_id'].'-'.$row['poll_option_id'], [
'pollID' => $row['topic_id'],
'optionValue' => $row['poll_option_text'],
'showOrder' => $row['poll_option_id'],
'votes' => $row['poll_option_total']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."poll_votes
WHERE vote_user_id <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE vote_user_id <> ?
ORDER BY poll_option_id, vote_user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['topic_id'],
'optionID' => $row['topic_id'].'-'.$row['poll_option_id'],
'userID' => $row['vote_user_id']
- ));
+ ]);
}
}
$sql = "SELECT (SELECT COUNT(*) FROM ".$this->databasePrefix."acl_users WHERE forum_id <> ?)
+ (SELECT COUNT(*) FROM ".$this->databasePrefix."acl_groups WHERE forum_id <> ?) AS count";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
$row = $statement->fetchArray();
return $row['count'] ? 2 : 0;
}
FROM ".$this->databasePrefix."acl_options
WHERE is_local = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1));
- $options = array();
+ $statement->execute([1]);
+ $options = [];
while ($row = $statement->fetchArray()) {
$options[$row['auth_option_id']] = $row;
}
$condition = new PreparedStatementConditionBuilder();
- $condition->add('auth_option_id IN (?)', array(array_keys($options)));
+ $condition->add('auth_option_id IN (?)', [array_keys($options)]);
$sql = "SELECT *
FROM ".$this->databasePrefix."acl_roles_data
".$condition;
$statement = $this->database->prepareStatement($sql);
$statement->execute($condition->getParameters());
- $roles = array();
+ $roles = [];
while ($row = $statement->fetchArray()) {
$roles[$row['role_id']][$row['auth_option_id']] = $row['auth_setting'];
}
- $data = array();
+ $data = [];
if ($offset == 0) {
// groups
$sql = "SELECT *
WHERE forum_id <> ?
ORDER BY auth_role_id DESC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$key = 'group';
}
else if ($offset == 1) {
WHERE forum_id <> ?
ORDER BY auth_role_id DESC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$key = 'user';
}
}
}
- static $optionMapping = array(
- 'f_announce' => array('canStartAnnouncement'),
- 'f_attach' => array('canUploadAttachment'),
- 'f_bbcode' => array(),
- 'f_bump' => array(),
- 'f_delete' => array('canDeleteOwnPost'),
- 'f_download' => array('canDownloadAttachment', 'canViewAttachmentPreview'),
- 'f_edit' => array('canEditOwnPost'),
- 'f_email' => array(),
- 'f_flash' => array(),
- 'f_icons' => array(),
- 'f_ignoreflood' => array(),
- 'f_img' => array(),
- 'f_list' => array('canViewBoard'),
- 'f_noapprove' => array('canStartThreadWithoutModeration', 'canReplyThreadWithoutModeration'),
- 'f_poll' => array('canStartPoll'),
- 'f_post' => array('canStartThread'),
- 'f_postcount' => array(),
- 'f_print' => array(),
- 'f_read' => array('canEnterBoard'),
- 'f_reply' => array('canReplyThread'),
- 'f_report' => array(),
- 'f_search' => array(),
- 'f_sigs' => array(),
- 'f_smilies' => array(),
- 'f_sticky' => array('canPinThread'),
- 'f_subscribe' => array(),
- 'f_user_lock' => array(),
- 'f_vote' => array('canVotePoll'),
- 'f_votechg' => array(),
- 'm_approve' => array('canEnableThread'),
- 'm_chgposter' => array(),
- 'm_delete' => array(
+ static $optionMapping = [
+ 'f_announce' => ['canStartAnnouncement'],
+ 'f_attach' => ['canUploadAttachment'],
+ 'f_bbcode' => [],
+ 'f_bump' => [],
+ 'f_delete' => ['canDeleteOwnPost'],
+ 'f_download' => ['canDownloadAttachment', 'canViewAttachmentPreview'],
+ 'f_edit' => ['canEditOwnPost'],
+ 'f_email' => [],
+ 'f_flash' => [],
+ 'f_icons' => [],
+ 'f_ignoreflood' => [],
+ 'f_img' => [],
+ 'f_list' => ['canViewBoard'],
+ 'f_noapprove' => ['canStartThreadWithoutModeration', 'canReplyThreadWithoutModeration'],
+ 'f_poll' => ['canStartPoll'],
+ 'f_post' => ['canStartThread'],
+ 'f_postcount' => [],
+ 'f_print' => [],
+ 'f_read' => ['canEnterBoard'],
+ 'f_reply' => ['canReplyThread'],
+ 'f_report' => [],
+ 'f_search' => [],
+ 'f_sigs' => [],
+ 'f_smilies' => [],
+ 'f_sticky' => ['canPinThread'],
+ 'f_subscribe' => [],
+ 'f_user_lock' => [],
+ 'f_vote' => ['canVotePoll'],
+ 'f_votechg' => [],
+ 'm_approve' => ['canEnableThread'],
+ 'm_chgposter' => [],
+ 'm_delete' => [
'canDeleteThread', 'canReadDeletedThread', 'canRestoreThread', 'canDeleteThreadCompletely',
'canDeletePost', 'canReadDeletedPost', 'canRestorePost', 'canDeletePostCompletely'
- ),
- 'm_edit' => array('canEditPost'),
- 'm_info' => array(),
- 'm_lock' => array('canCloseThread', 'canReplyClosedThread'),
- 'm_merge' => array('canMergeThread', 'canMergePost'),
- 'm_move' => array('canMoveThread', 'canMovePost'),
- 'm_report' => array(),
- 'm_split' => array()
- );
+ ],
+ 'm_edit' => ['canEditPost'],
+ 'm_info' => [],
+ 'm_lock' => ['canCloseThread', 'canReplyClosedThread'],
+ 'm_merge' => ['canMergeThread', 'canMergePost'],
+ 'm_move' => ['canMoveThread', 'canMovePost'],
+ 'm_report' => [],
+ 'm_split' => []
+ ];
foreach ($data as $id => $forumData) {
foreach ($forumData as $forumID => $settingData) {
foreach ($settingData as $optionID => $value) {
if (!isset($optionMapping[$options[$optionID]['auth_option']])) continue;
foreach ($optionMapping[$options[$optionID]['auth_option']] as $optionName) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $forumID,
$key.'ID' => $id,
'optionValue' => $value
- ), array(
+ ], [
'optionName' => $optionName
- ));
+ ]);
}
}
}
GROUP BY smiley_url
ORDER BY smiley_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'images/smilies/'.$row['smiley_url'];
$code = array_shift($aliases);
$emotion = mb_substr($row['emotion'], 0, mb_strpos($row['emotion'], "\n") ?: mb_strlen($row['emotion'])); // we had to GROUP_CONCAT it because of SQL strict mode
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smiley_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smiley_id'], [
'smileyTitle' => $emotion,
'smileyCode' => $code,
'showOrder' => $row['smiley_order'],
'aliases' => implode("\n", $aliases)
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
FROM ".$this->databasePrefix."attachments
WHERE in_message = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($conversation ? 1 : 0));
+ $statement->execute([$conversation ? 1 : 0]);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."config
WHERE config_name IN (?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('upload_path'));
+ $statement->execute(['upload_path']);
while ($row = $statement->fetchArray()) {
$$row['config_name'] = $row['config_value'];
}
WHERE in_message = ?
ORDER BY attach_id DESC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($conversation ? 1 : 0));
+ $statement->execute([$conversation ? 1 : 0]);
while ($row = $statement->fetchArray()) {
$fileLocation = FileUtil::addTrailingSlash($this->fileSystemPath.$upload_path).$row['physical_filename'];
$isImage = 0;
if ($row['mimetype'] == 'image/jpeg' || $row['mimetype'] == 'image/png' || $row['mimetype'] == 'image/gif') $isImage = 1;
- ImportHandler::getInstance()->getImporter('com.woltlab.'.($conversation ? 'wcf.conversation' : 'wbb').'.attachment')->import(0, array( // TODO: support inline attachments
+ ImportHandler::getInstance()->getImporter('com.woltlab.'.($conversation ? 'wcf.conversation' : 'wbb').'.attachment')->import(0, [ // TODO: support inline attachments
'objectID' => $row['post_msg_id'],
'userID' => ($row['poster_id'] ?: null),
'filename' => $row['real_filename'],
'isImage' => $isImage,
'downloads' => $row['download_count'],
'uploadTime' => $row['filetime']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
// fix code php bbcode...
$text = preg_replace_callback('#\[code(=php)?\](.*)\[/code\]#s', function ($matches) {
$content = $matches[2];
- $content = str_replace(array(
+ $content = str_replace([
'<br />',
' '
- ), array(
+ ], [
"\n",
"\t"
- ), $content);
+ ], $content);
$content = preg_replace('#(?:<span class="syntax[^"]*">|</span>)#', '', $content);
return '[code'.$matches[1].']'.$content.'[/code]';
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wcf.label' => 'Labels',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley' => 'Smilies'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.user.follower' => 100
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
*/
public function exportUserGroups($offset, $limit) {
// import everyone, guests and users pseudogroups
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_EVERYONE, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_EVERYONE, [
'groupName' => 'Everyone',
'groupType' => UserGroup::EVERYONE
- ));
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_GUEST, array(
+ ]);
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_GUEST, [
'groupName' => 'Guests',
'groupType' => UserGroup::GUESTS
- ));
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_USER_FAKE, array(
+ ]);
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import(self::GROUP_USER_FAKE, [
'groupName' => 'Users',
'groupType' => UserGroup::USERS
- ));
+ ]);
$sql = "SELECT *
FROM ".$this->databasePrefix."membergroups
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['id_group'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['id_group'], [
'groupName' => $row['group_name'],
'groupType' => UserGroup::OTHER,
'userOnlineMarking' => '<span style="color: '.$row['online_color'].';">%s</span>',
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = array();
+ $profileFields = [];
$sql = "SELECT col_name, id_field
FROM ".$this->databasePrefix."custom_fields";
$statement = $this->database->prepareStatement($sql);
$passwordUpdateStatement = WCF::getDB()->prepareStatement($sql);
// get userIDs
- $userIDs = array();
+ $userIDs = [];
$sql = "SELECT id_member
FROM ".$this->databasePrefix."members
WHERE id_member BETWEEN ? AND ?
ORDER BY id_member";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$userIDs[] = $row['id_member'];
}
if (empty($userIDs)) return;
// get profile field values
- $profileFieldValues = array();
+ $profileFieldValues = [];
if (!empty($profileFields)) {
$condition = new PreparedStatementConditionBuilder();
- $condition->add('id_member IN(?)', array($userIDs));
- $condition->add('variable IN(?)', array(array_keys($profileFields)));
+ $condition->add('id_member IN(?)', [$userIDs]);
+ $condition->add('variable IN(?)', [array_keys($profileFields)]);
$sql = "SELECT *
FROM ".$this->databasePrefix."themes
".$condition;
$statement = $this->database->prepareStatement($sql);
$statement->execute($condition->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($profileFieldValues[$row['id_member']])) $profileFieldValues[$row['id_member']] = array();
+ if (!isset($profileFieldValues[$row['id_member']])) $profileFieldValues[$row['id_member']] = [];
$profileFieldValues[$row['id_member']][$profileFields[$row['variable']]['id_field']] = $row['value'];
}
}
// get users
$condition = new PreparedStatementConditionBuilder();
- $condition->add('member.id_member IN(?)', array($userIDs));
+ $condition->add('member.id_member IN(?)', [$userIDs]);
$sql = "SELECT member.*, ban_group.ban_time, ban_group.expire_time AS banExpire, ban_group.reason AS banReason,
(SELECT COUNT(*) FROM ".$this->databasePrefix."moderators moderator WHERE member.id_member = moderator.id_member) AS isMod
FROM ".$this->databasePrefix."members member
$statement = $this->database->prepareStatement($sql);
$statement->execute($condition->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['member_name'],
'password' => '',
'email' => $row['email_address'],
'signatureEnableSmilies' => 1,
'userTitle' => StringUtil::decodeHTML($row['usertitle']),
'lastActivityTime' => $row['last_login']
- );
+ ];
// get user options
- $options = array(
+ $options = [
'location' => $row['location'],
'birthday' => $row['birthdate'],
'icq' => $row['icq'],
'homepage' => $row['website_url'],
'aboutMe' => $row['personal_text']
- );
+ ];
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['additional_groups'].','.$row['id_group']),
'options' => $options
- );
+ ];
if ($row['isMod']) {
$additionalData['groupIDs'][] = self::GROUP_MODERATORS;
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('smf2:'.$row['passwd'].':'.$row['password_salt'], $newUserID));
+ $passwordUpdateStatement->execute(['smf2:'.$row['passwd'].':'.$row['password_salt'], $newUserID]);
}
}
}
$editable = UserOption::EDITABILITY_ADMINISTRATOR;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['id_field'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['id_field'], [
'categoryName' => 'profile.personal',
'optionType' => $row['field_type'],
'editable' => $editable,
'searchable' => $row['can_search'] ? 1 : 0,
'outputClass' => $row['field_type'] == 'select' ? 'wcf\system\option\user\SelectOptionsUserOptionOutput' : '',
'defaultValue' => $row['default_value']
- ), array('name' => $row['field_name']));
+ ], ['name' => $row['field_name']]);
}
}
FROM ".$this->databasePrefix."membergroups
WHERE min_posts <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(-1));
+ $statement->execute([-1]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE min_posts <> ?
ORDER BY id_group";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(-1));
+ $statement->execute([-1]);
while ($row = $statement->fetchArray()) {
list($repeatImage, $rankImage) = explode('#', $row['stars'], 2);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['id_group'] == self::GROUP_USER ? self::GROUP_USER_FAKE : $row['id_group'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['id_group'] == self::GROUP_USER ? self::GROUP_USER_FAKE : $row['id_group'], [
'groupID' => $row['id_group'] == self::GROUP_USER ? self::GROUP_USER_FAKE : $row['id_group'],
'requiredPoints' => $row['min_posts'] * 5,
'rankTitle' => $row['group_name'],
'rankImage' => $rankImage,
'repeatImage' => $repeatImage
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."members
WHERE buddy_list <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE buddy_list <> ?
ORDER BY id_member";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
$buddylist = array_unique(ArrayUtil::toIntegerArray(explode(',', $row['buddy_list'])));
foreach ($buddylist as $buddy) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['id_member'],
'followUserID' => $buddy
- ));
+ ]);
}
}
}
$sql = "SELECT (SELECT COUNT(*) AS count FROM ".$this->databasePrefix."attachments WHERE id_member <> ?)
+ (SELECT COUNT(*) AS count FROM ".$this->databasePrefix."members WHERE avatar <> ?) AS count";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('', 0));
+ $statement->execute(['', 0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE avatar <> ?
)";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('', 0));
+ $statement->execute(['', 0]);
while ($row = $statement->fetchArray()) {
switch ($row['type']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import(0, [
'avatarName' => basename($row['avatarName']),
'avatarExtension' => pathinfo($row['avatarName'], PATHINFO_EXTENSION),
'userID' => $row['id_member']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
FROM ".$this->databasePrefix."members
WHERE message_labels <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE message_labels <> ?
ORDER BY id_member";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
$labels = ArrayUtil::trim(explode(',', $row['message_labels']), false);
$i = 0;
foreach ($labels as $label) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['id_member'].'-'.($i++), array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['id_member'].'-'.($i++), [
'userID' => $row['id_member'],
'label' => mb_substr($label, 0, 80)
- ));
+ ]);
}
}
}
WHERE pm.id_pm BETWEEN ? AND ?
ORDER BY pm.id_pm";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['id_member_from'];
if (ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $conversationID) !== null) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, [
'subject' => $row['subject'],
'time' => $row['msgtime'],
'userID' => $row['id_member_from'],
'username' => $row['from_name'],
'isDraft' => 0
- ));
+ ]);
}
}
WHERE pm.id_pm BETWEEN ? AND ?
ORDER BY pm.id_pm";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['id_member_from'];
$conversationID = $this->getConversationID($row['id_pm_head'], $participants);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['id_pm'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['id_pm'], [
'conversationID' => $conversationID,
'userID' => $row['id_member_from'],
'username' => $row['from_name'],
'enableHtml' => 0,
'enableBBCodes' => 1,
'showSignature' => 1
- ));
+ ]);
}
}
return $item != '-1';
});
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $row['id_member'],
'username' => $row['member_name'],
'hideConversation' => $row['deleted'] ? 1 : 0,
'isInvisible' => $row['bcc'] ? 1 : 0,
'lastVisitTime' => $row['is_new'] ? 0 : $row['msgtime']
- ), array('labelIDs' => $labels));
+ ], ['labelIDs' => $labels]);
}
}
$statement = $this->database->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import('cat-'.$row['id_cat'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import('cat-'.$row['id_cat'], [
'parentID' => null,
'position' => $row['cat_order'],
'boardType' => Board::TYPE_CATEGORY,
'title' => $row['name']
- ));
+ ]);
}
$sql = "SELECT *
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id_board'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['id_board'], [
'parentID' => ($board['id_parent'] ?: 'cat-'.$board['id_cat']),
'position' => $board['board_order'],
'boardType' => $board['redirect'] ? Board::TYPE_LINK : Board::TYPE_BOARD,
'clicks' => $board['num_posts'],
'posts' => $board['num_posts'],
'threads' => $board['num_topics']
- ));
+ ]);
$this->exportBoardsRecursively($board['id_board']);
}
WHERE topic.id_topic BETWEEN ? AND ?
ORDER BY topic.id_topic";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['id_topic'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['id_topic'], [
'boardID' => $row['id_board'],
'topic' => StringUtil::decodeHTML($row['subject']),
'time' => $row['time'],
'isClosed' => $row['locked'] ? 1 : 0,
'movedThreadID' => null,
'movedTime' => 0
- ));
+ ]);
}
}
WHERE message.id_msg BETWEEN ? AND ?
ORDER BY message.id_msg";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id_msg'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id_msg'], [
'threadID' => $row['id_topic'],
'userID' => $row['id_member'],
'username' => $row['poster_name'],
'enableBBCodes' => 1,
'showSignature' => 1,
'ipAddress' => UserUtil::convertIPv4To6($row['poster_ip'])
- ));
+ ]);
}
}
WHERE id_member = ?
AND id_msg <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND attachment.id_msg <> ?
ORDER BY attachment.id_attach";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->readOption('attachmentUploadDir').'/'.$row['id_attach'].'_'.$row['file_hash'];
$row['isImage'] = $row['width'] = $row['height'] = 0;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['id_attach'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['id_attach'], [
'objectID' => $row['id_msg'],
'userID' => ($row['id_member'] ?: null),
'filename' => $row['filename'],
'height' => $row['height'],
'downloads' => $row['downloads'],
'uploadTime' => $row['poster_time']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
WHERE id_topic <> ?
AND id_board = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND id_board = ?
ORDER BY id_member, id_topic";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0, 0));
+ $statement->execute([0, 0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['id_topic'],
'userID' => $row['id_member']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['id_poll'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['id_poll'], [
'objectID' => $row['id_first_msg'],
'question' => $row['question'],
'endTime' => $row['expire_time'],
'isPublic' => $row['hide_results'] ? 0 : 1,
'maxVotes' => $row['max_votes'],
'votes' => $row['votes']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['id_poll'].'-'.$row['id_choice'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['id_poll'].'-'.$row['id_choice'], [
'pollID' => $row['id_poll'],
'optionValue' => $row['label'],
'showOrder' => $row['id_choice'],
'votes' => $row['votes']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."log_polls
WHERE id_member <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE id_member <> ?
ORDER BY id_poll, id_member, id_choice";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['id_poll'],
'optionID' => $row['id_poll'].'-'.$row['id_choice'],
'userID' => $row['id_member']
- ));
+ ]);
}
}
*/
public function exportACLs($offset, $limit) {
// TODO: try to split this into several requests
- $profileToBoard = array();
- $boardToGroup = array();
- $boardToMod = array();
+ $profileToBoard = [];
+ $boardToGroup = [];
+ $boardToMod = [];
$sql = "SELECT id_board, id_profile, member_groups,
(SELECT GROUP_CONCAT(id_member) FROM ".$this->databasePrefix."moderators moderator WHERE moderator.id_board = board.id_board) AS moderators
$statement = $this->database->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
- if (!isset($profileToBoard[$row['id_profile']])) $profileToBoard[$row['id_profile']] = array();
+ if (!isset($profileToBoard[$row['id_profile']])) $profileToBoard[$row['id_profile']] = [];
$profileToBoard[$row['id_profile']][] = $row['id_board'];
$boardToGroup[$row['id_board']] = array_unique(ArrayUtil::toIntegerArray(explode(',', $row['member_groups'])));
foreach ($boardToGroup as $boardID => $groups) {
// deny for everyone first
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => self::GROUP_EVERYONE,
'optionValue' => 0
- ), array(
+ ], [
'optionName' => 'canViewBoard'
- ));
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ]);
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => self::GROUP_EVERYONE,
'optionValue' => 0
- ), array(
+ ], [
'optionName' => 'canEnterBoard'
- ));
+ ]);
if (!in_array(self::GROUP_ADMIN, $groups)) {
// admins may do everything
$groupID = $groupID == self::GROUP_USER ? self::GROUP_USER_FAKE : $groupID;
// allow specified groups
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => $groupID,
'optionValue' => 1
- ), array(
+ ], [
'optionName' => 'canViewBoard'
- ));
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ]);
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => $groupID,
'optionValue' => 1
- ), array(
+ ], [
'optionName' => 'canEnterBoard'
- ));
+ ]);
}
}
- static $permissionMap = array(
- 'approve_posts' => array(
+ static $permissionMap = [
+ 'approve_posts' => [
'canEnableThread',
'canEnablePost'
- ),
- 'delete_any' => array(
+ ],
+ 'delete_any' => [
'canDeletePost',
'canReadDeletedPost',
'canRestorePost',
'canDeletePostCompletely'
- ),
- 'delete_own' => array('canDeleteOwnPost'),
- 'lock_any' => array('canCloseThread', 'canClosePost'),
- 'lock_own' => array(),
- 'make_sticky' => array('canPinThread'),
- 'mark_any_modify' => array(),
- 'mark_modify' => array(),
- 'merge_any' => array('canMergeThread'),
- 'moderate_board' => array('canReplyClosedThread'),
- 'modify_any' => array('canEditPost'),
- 'modify_own' => array('canEditOwnPost'),
- 'poll_add_any' => array(),
- 'poll_add_own' => array(),
- 'poll_edit_any' => array(),
- 'poll_edit_own' => array(),
- 'poll_lock_any' => array(),
- 'poll_lock_own' => array(),
- 'poll_post' => array('canStartPoll'),
- 'poll_remove_any' => array(),
- 'poll_view' => array(),
- 'poll_vote' => array('canVotePoll'),
- 'post_attachment' => array('canUploadAttachment'),
- 'post_reply_any' => array('canReplyThread'),
- 'post_reply_own' => array('canReplyOwnThread'),
- 'post_unapproved_replies_any' => array('canReplyThreadWithoutModeration'),
- 'post_unapproved_replies_own' => array(),
- 'post_unapproved_topics' => array('canStartThreadWithoutModeration'),
- 'remove_any' => array(
+ ],
+ 'delete_own' => ['canDeleteOwnPost'],
+ 'lock_any' => ['canCloseThread', 'canClosePost'],
+ 'lock_own' => [],
+ 'make_sticky' => ['canPinThread'],
+ 'mark_any_modify' => [],
+ 'mark_modify' => [],
+ 'merge_any' => ['canMergeThread'],
+ 'moderate_board' => ['canReplyClosedThread'],
+ 'modify_any' => ['canEditPost'],
+ 'modify_own' => ['canEditOwnPost'],
+ 'poll_add_any' => [],
+ 'poll_add_own' => [],
+ 'poll_edit_any' => [],
+ 'poll_edit_own' => [],
+ 'poll_lock_any' => [],
+ 'poll_lock_own' => [],
+ 'poll_post' => ['canStartPoll'],
+ 'poll_remove_any' => [],
+ 'poll_view' => [],
+ 'poll_vote' => ['canVotePoll'],
+ 'post_attachment' => ['canUploadAttachment'],
+ 'post_reply_any' => ['canReplyThread'],
+ 'post_reply_own' => ['canReplyOwnThread'],
+ 'post_unapproved_replies_any' => ['canReplyThreadWithoutModeration'],
+ 'post_unapproved_replies_own' => [],
+ 'post_unapproved_topics' => ['canStartThreadWithoutModeration'],
+ 'remove_any' => [
'canDeleteThread',
'canReadDeletedThread',
'canRestoreThread',
'canDeleteThreadCompletely'
- ),
- 'remove_own' => array(),
- 'report_any' => array(),
- 'send_topic' => array(),
- 'split_any' => array(),
- 'view_attachments' => array('canDownloadAttachment', 'canViewAttachmentPreview')
- );
+ ],
+ 'remove_own' => [],
+ 'report_any' => [],
+ 'send_topic' => [],
+ 'split_any' => [],
+ 'view_attachments' => ['canDownloadAttachment', 'canViewAttachmentPreview']
+ ];
$sql = "SELECT *
FROM ".$this->databasePrefix."board_permissions
if (!isset($boardToMod[$boardID])) continue;
foreach ($boardToMod[$boardID] as $moderator) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'userID' => $moderator,
'optionValue' => $row['add_deny']
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
else {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => $row['id_group'] == self::GROUP_USER ? self::GROUP_USER_FAKE : $row['id_group'],
'optionValue' => $row['add_deny']
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
foreach ($boardIDs as $boardID) {
foreach ($permissionMap as $permissions) {
foreach ($permissions as $permission) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $boardID,
'groupID' => self::GROUP_ADMIN,
'optionValue' => 1
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
GROUP BY filename
ORDER BY id_smiley";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->readOption('smiley_dir').'/'.$this->readOption('smiley_sets_default').'/'.$row['filename'];
$code = array_shift($aliases);
$description = mb_substr($row['description'], 0, mb_strpos($row['description'], "\n") ?: mb_strlen($row['description'])); // we had to GROUP_CONCAT it because of SQL strict mode
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['id_smiley'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['id_smiley'], [
'smileyTitle' => $description,
'smileyCode' => $code,
'showOrder' => $row['smiley_order'],
'aliases' => implode("\n", $aliases)
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
private function readOption($optionName) {
- static $optionCache = array();
+ static $optionCache = [];
if (!isset($optionCache[$optionName])) {
$sql = "SELECT value
FROM ".$this->databasePrefix."settings
WHERE variable = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($optionName));
+ $statement->execute([$optionName]);
$row = $statement->fetchArray();
$optionCache[$optionName] = $row['value'];
if ($sizeRegex === null) {
$quoteRegex = new Regex('\[quote author=(.*?) link=topic=\d+\.msg(\d+)#msg\\2 date=\d+\]');
$quoteCallback = new Callback(function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $postID,
'forceFrontend' => true
- )).'#post'.$postID;
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$postID;
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
});
}
// use proper WCF 2 bbcode
- $message = strtr($message, array(
+ $message = strtr($message, [
'<br />' => "\n",
'[iurl]' => '[url]',
'[/iurl]' => '[/url]',
'[/ftp]' => '[/url]',
'[php]' => '[code=php]',
'[/php]' => '[/code]'
- ));
+ ]);
// fix size bbcode
$message = $sizeRegex->replace($message, '[size=\\1]');
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.calendar.category' => 'CalendarCategories',
'com.woltlab.calendar.event' => 'CalendarEvents',
'com.woltlab.calendar.event.date' => 'CalendarEventDates'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 100,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 50
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.gallery.image' => array(
+ ],
+ 'com.woltlab.gallery.image' => [
'com.woltlab.gallery.album',
'com.woltlab.gallery.image.comment'
- ),
- 'com.woltlab.calendar.event' => array(
+ ],
+ 'com.woltlab.calendar.event' => [
'com.woltlab.calendar.category'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['usergroupid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['usergroupid'], [
'groupName' => $row['title'],
'groupDescription' => $row['description'],
'groupType' => $groupType,
'userOnlineMarking' => $row['opentag'].'%s'.$row['closetag']
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache user options
- $userOptions = array();
+ $userOptions = [];
$sql = "SELECT profilefieldid
FROM ".$this->databasePrefix."profilefield";
$statement = $this->database->prepareStatement($sql);
WHERE user_table.userid BETWEEN ? AND ?
ORDER BY user_table.userid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => StringUtil::decodeHTML($row['username']),
'password' => '',
'email' => StringUtil::decodeHTML($row['email']),
'signature' => $row['signature'],
'userTitle' => ($row['customtitle'] != 0) ? StringUtil::decodeHTML($row['usertitle']) : '',
'lastActivityTime' => $row['lastactivity']
- );
- $additionalData = array(
+ ];
+ $additionalData = [
'groupIDs' => explode(',', $row['membergroupids'].','.$row['usergroupid']),
- 'options' => array()
- );
+ 'options' => []
+ ];
// handle user options
foreach ($userOptions as $optionID) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('vb3:'.$row['password'].':'.$row['salt'], $newUserID));
+ $passwordUpdateStatement->execute(['vb3:'.$row['password'].':'.$row['salt'], $newUserID]);
}
}
}
AND usertitle <> ?
) AS count";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1, 2, ''));
+ $statement->execute([1, 2, '']);
$row = $statement->fetchArray();
return $row['count'];
}
)
ORDER BY usertitleid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1, 2, ''));
+ $statement->execute([1, 2, '']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['usertitleid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['usertitleid'], [
'groupID' => $row['groupID'],
'requiredPoints' => $row['minposts'] * 5,
'rankTitle' => StringUtil::decodeHTML($row['title'])
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."usertextfield
WHERE buddylist <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE buddylist <> ?
ORDER BY userid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
$buddies = array_unique(ArrayUtil::toIntegerArray(explode(' ', $row['buddylist'])));
foreach ($buddies as $buddy) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['userid'],
'followUserID' => $buddy
- ));
+ ]);
}
}
}
WHERE vmid BETWEEN ? AND ?
ORDER BY vmid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['vmid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['vmid'], [
'objectID' => $row['userid'],
'userID' => $row['postuserid'],
'username' => StringUtil::decodeHTML($row['postusername']),
'message' => StringUtil::decodeHTML($row['pagetext']),
'time' => $row['dateline']
- ));
+ ]);
}
}
file_put_contents($file, $row['filedata']);
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['userid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['userid'], [
'avatarName' => StringUtil::decodeHTML($row['filename']),
'avatarExtension' => pathinfo($row['filename'], PATHINFO_EXTENSION),
'width' => $row['width'],
'height' => $row['height'],
'userID' => $row['userid']
- ), array('fileLocation' => $file));
+ ], ['fileLocation' => $file]);
if (!$this->readOption('usefileavatar')) unlink($file);
}
}
// get select options
- $selectOptions = array();
+ $selectOptions = [];
if ($row['type'] == 'radio' || $row['type'] == 'select' || $row['type'] == 'select_multiple' || $row['type'] == 'checkbox') {
$selectOptions = @unserialize($row['data']);
WHERE languageid = ?
AND varname = ?";
$statement2 = $this->database->prepareStatement($sql);
- $statement2->execute(array(0, 'field'.$row['profilefieldid'].'_title'));
+ $statement2->execute([0, 'field'.$row['profilefieldid'].'_title']);
$row2 = $statement2->fetchArray();
if ($row2 !== false) {
$fieldName = $row2['text'];
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['profilefieldid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['profilefieldid'], [
'categoryName' => 'profile.personal',
'optionType' => $optionType,
'defaultValue' => $defaultValue,
'editable' => $editable,
'visible' => $visible,
'showOrder' => $row['displayorder']
- ), array('name' => $fieldName));
+ ], ['name' => $fieldName]);
}
}
WHERE pmfolders IS NOT NULL
AND pmfolders <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
$row = $statement->fetchArray();
return $row['count'];
}
AND pmfolders <> ?
ORDER BY userid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
$convert = false;
// vBulletin relies on undefined behaviour by default, we cannot know in which
// convert back to utf-8
if ($convert) $val = mb_convert_encoding($val, 'UTF-8', 'ISO-8859-1');
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['userid'].'-'.$key, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['userid'].'-'.$key, [
'userID' => $row['userid'],
'label' => mb_substr($val, 0, 80)
- ));
+ ]);
}
}
}
WHERE pm.pmid BETWEEN ? AND ?
ORDER BY pm.pmid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['fromuserid'];
if (ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $conversationID) !== null) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, [
'subject' => StringUtil::decodeHTML($row['title']),
'time' => $row['dateline'],
'userID' => $row['fromuserid'],
'username' => StringUtil::decodeHTML($row['fromusername']),
'isDraft' => 0
- ));
+ ]);
}
}
WHERE pmtext.pmtextid BETWEEN ? AND ?
ORDER BY pmtext.pmtextid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['fromuserid'];
$conversationID = $this->getConversationID($row['conversationID'], $participants);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmtextid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmtextid'], [
'conversationID' => $conversationID,
'userID' => $row['fromuserid'],
'username' => StringUtil::decodeHTML($row['fromusername']),
'enableHtml' => 0,
'enableBBCodes' => 1,
'showSignature' => $row['showsignature']
- ));
+ ]);
}
}
// encoding the data was saved
// this may cause some hidden participants to become visible
$recipients = @unserialize($row['touserarray']);
- if (!is_array($recipients)) $recipients = array();
+ if (!is_array($recipients)) $recipients = [];
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $row['userid'],
'username' => StringUtil::decodeHTML($row['username'] ?: ''),
'hideConversation' => 0, // there is no trash
'isInvisible' => (isset($recipients['bcc']) && isset($recipients['bcc'][$row['userid']])) ? 1 : 0,
'lastVisitTime' => $row['messageread'] ? $row['dateline'] : 0
- ), array('labelIDs' => ($row['folderid'] > 0 ? array($row['userid'].'-'.$row['folderid']) : array())));
+ ], ['labelIDs' => ($row['folderid'] > 0 ? [$row['userid'].'-'.$row['folderid']] : [])]);
}
}
$getDaysPrune = function ($value) {
if ($value == -1) return 1000;
- $availableDaysPrune = array(1, 3, 7, 14, 30, 60, 100, 365);
+ $availableDaysPrune = [1, 3, 7, 14, 30, 60, 100, 365];
foreach ($availableDaysPrune as $daysPrune) {
if ($value <= $daysPrune) return $daysPrune;
return 1000;
};
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forumid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['forumid'], [
'parentID' => ($board['parentid'] != -1 ? $board['parentid'] : null),
'position' => $board['displayorder'],
'boardType' => ($board['link'] ? Board::TYPE_LINK : ($board['options'] & self::FORUMOPTIONS_CANCONTAINTHREADS ? Board::TYPE_BOARD : Board::TYPE_CATEGORY)),
'clicks' => 0,
'posts' => $board['replycount'],
'threads' => $board['threadcount']
- ));
+ ]);
$this->exportBoardsRecursively($board['forumid']);
}
WHERE thread.threadid BETWEEN ? AND ?
ORDER BY thread.threadid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(14, $offset + 1, $offset + $limit)); // 14 = soft delete
+ $statement->execute([14, $offset + 1, $offset + $limit]); // 14 = soft delete
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['forumid'],
'topic' => StringUtil::decodeHTML($row['title']),
'time' => $row['dateline'],
'isDone' => 0,
'deleteTime' => $row['deleteTime'] ?: 0,
'lastPostTime' => $row['lastpost']
- );
- $additionalData = array();
- if ($row['prefixid']) $additionalData['labels'] = array($row['prefixid']);
+ ];
+ $additionalData = [];
+ if ($row['prefixid']) $additionalData['labels'] = [$row['prefixid']];
if ($row['taglist'] !== null) {
$tags = ArrayUtil::trim(explode(',', $row['taglist']));
$additionalData['tags'] = $tags;
WHERE post.postid BETWEEN ? AND ?
ORDER BY post.postid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
if (isset($row['htmlState']) && $row['htmlState'] == 'on_nl2br') {
$row['pagetext'] = str_replace("\n", '<br />', StringUtil::unifyNewlines($row['pagetext']));
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postid'], [
'threadID' => $row['threadid'],
'userID' => $row['userid'],
'username' => StringUtil::decodeHTML($row['username']),
'enableBBCodes' => 1,
'showSignature' => $row['showsignature'],
'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress'])
- ));
+ ]);
}
}
$row['isImage'] = $row['width'] = $row['height'] = 0;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['attachmentid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['attachmentid'], [
'objectID' => $row['postid'],
'userID' => ($row['userid'] ?: null),
'filename' => $row['filename'],
'downloads' => $row['counter'],
'uploadTime' => $row['dateline'],
'showOrder' => (isset($row['displayOrder']) ? $row['displayOrder'] : 0)
- ), array('fileLocation' => $file));
+ ], ['fileLocation' => $file]);
if ($this->readOption('attachfile') == self::ATTACHFILE_DATABASE) unlink($file);
}
WHERE subscribethreadid BETWEEN ? AND ?
ORDER BY subscribethreadid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import($row['subscribethreadid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import($row['subscribethreadid'], [
'objectID' => $row['threadid'],
'userID' => $row['userid']
- ));
+ ]);
}
}
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."poll";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array());
+ $statement->execute([]);
$row = $statement->fetchArray();
return $row['count'];
}
AND thread.open <> ?
ORDER BY poll.pollid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(10));
+ $statement->execute([10]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], [
'objectID' => $row['firstpostid'],
'question' => StringUtil::encodeHTML($row['question']),
'time' => $row['dateline'],
'sortByVotes' => 0,
'maxVotes' => $row['multiple'] ? $row['numberoptions'] : 1,
'votes' => $row['voters']
- ));
+ ]);
}
}
$i = 1;
foreach ($options as $key => $option) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pollid'].'-'.$i, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pollid'].'-'.$i, [
'pollID' => $row['pollid'],
'optionValue' => $option,
'showOrder' => $i,
'votes' => $votes[$key]
- ));
+ ]);
$i++;
}
WHERE pollvoteid BETWEEN ? AND ?
ORDER BY pollvoteid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pollid'],
'optionID' => $row['pollid'].'-'.$row['voteoption'],
'userID' => $row['userid']
- ));
+ ]);
}
}
WHERE reputationid BETWEEN ? AND ?
ORDER BY reputationid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $row['postid'],
'objectUserID' => ($row['userid'] ?: null),
'userID' => $row['whoadded'],
'likeValue' => ($row['reputation'] > 0 ? Like::LIKE : Like::DISLIKE),
'time' => $row['dateline']
- ));
+ ]);
}
}
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($row['prefixsetid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($row['prefixsetid'], [
'groupName' => $row['prefixsetid']
- ), array('objects' => array($objectType->objectTypeID => $boardIDs)));
+ ], ['objects' => [$objectType->objectTypeID => $boardIDs]]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($row['prefixid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($row['prefixid'], [
'groupID' => $row['prefixsetid'],
'label' => mb_substr($row['prefixid'], 0, 80)
- ));
+ ]);
}
}
* Exports ACLs.
*/
public function exportACLs($offset, $limit) {
- $mapping = array(
+ $mapping = [
'canViewBoard' => self::FORUMPERMISSIONS_CANVIEW,
'canEnter' => self::FORUMPERMISSIONS_CANVIEWTHREADS,
'canReadThread' => self::FORUMPERMISSIONS_CANVIEWOTHERS,
'canUploadAttachment' => self::FORUMPERMISSIONS_CANPOSTATTACHMENT,
'canStartPoll' => self::FORUMPERMISSIONS_CANPOSTPOLL,
'canVotePoll' => self::FORUMPERMISSIONS_CANVOTE
- );
+ ];
$sql = "SELECT *
FROM ".$this->databasePrefix."forumpermission
while ($row = $statement->fetchArray()) {
foreach ($mapping as $permission => $bits) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $row['forumid'],
'groupID' => $row['usergroupid'],
'optionValue' => ($row['forumpermissions'] & $bits) ? 1 : 0
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
FROM ".$this->databasePrefix."smilie
ORDER BY smilieid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath . $row['smiliepath'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smilieid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smilieid'], [
'smileyTitle' => StringUtil::decodeHTML($row['title']),
'smileyCode' => $row['smilietext'],
'showOrder' => $row['displayorder'],
'categoryID' => $row['imagecategoryid']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
FROM ".$this->databasePrefix."imagecategory
WHERE imagetype = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(3));
+ $statement->execute([3]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE imagetype = ?
ORDER BY imagecategoryid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(3));
+ $statement->execute([3]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['imagecategoryid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['imagecategoryid'], [
'title' => StringUtil::decodeHTML($row['title']),
'parentCategoryID' => 0,
'showOrder' => $row['displayorder']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.album')->import($row['albumid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.album')->import($row['albumid'], [
'userID' => $row['userid'],
'username' => StringUtil::decodeHTML($row['username'] ?: ''),
'title' => StringUtil::decodeHTML($row['title']),
'description' => StringUtil::decodeHTML($row['description']),
'lastUpdateTime' => $row['lastpicturedate']
- ));
+ ]);
}
}
}
}
- $additionalData = array(
+ $additionalData = [
'fileLocation' => $file
- );
+ ];
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image')->import((isset($row['pictureid']) ? $row['pictureid'] : $row['filedataid']), array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image')->import((isset($row['pictureid']) ? $row['pictureid'] : $row['filedataid']), [
'userID' => ($row['userid'] ?: null),
'username' => StringUtil::decodeHTML($row['username'] ?: ''),
'albumID' => ($row['albumid'] ?: null),
'creationTime' => $row['dateline'],
'width' => $row['width'],
'height' => $row['height']
- ), $additionalData);
+ ], $additionalData);
}
catch (\Exception $e) {
if ($vB === 3 && $this->readOption('album_dataloc') == self::GALLERY_DATABASE && $file) @unlink($file);
WHERE comment.commentid BETWEEN ? AND ?
ORDER BY comment.commentid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.comment')->import($row['commentid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.comment')->import($row['commentid'], [
'objectID' => (isset($row['pictureid']) ? $row['pictureid'] : $row['filedataid']),
'userID' => ($row['postuserid'] ?: null),
'username' => StringUtil::decodeHTML($row['username'] ?: ''),
'message' => $row['pagetext'],
'time' => $row['dateline']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.category')->import($row['calendarid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.category')->import($row['calendarid'], [
'title' => StringUtil::decodeHTML($row['title']),
'description' => StringUtil::decodeHTML($row['description']),
'parentCategoryID' => 0,
'showOrder' => $row['displayorder']
- ));
+ ]);
}
}
WHERE eventid BETWEEN ? AND ?
ORDER BY eventid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
- $timezones = array();
+ $timezones = [];
foreach (DateUtil::getAvailableTimezones() as $timezone) {
$dateTimeZone = new \DateTimeZone($timezone);
$offset = $dateTimeZone->getOffset(new \DateTime("now", $dateTimeZone));
while ($row = $statement->fetchArray()) {
- $eventDateData = array(
+ $eventDateData = [
'startTime' => $row['dateline_from'],
'endTime' => ($row['recurring'] != 0) ? $row['dateline_from'] + 1 : $row['dateline_to'], // vBulletin does not properly support endTime for recurring events
'isFullDay' => $row['dateline_to'] ? 0 : 1,
'firstDayOfWeek' => 1,
'repeatType' => '',
'repeatInterval' => 1,
- 'repeatWeeklyByDay' => array(),
+ 'repeatWeeklyByDay' => [],
'repeatMonthlyByMonthDay' => 1,
'repeatMonthlyDayOffset' => 1,
'repeatMonthlyByWeekDay' => 0,
'repeatYearlyByMonth' => 1,
'repeatYearlyDayOffset' => 1,
'repeatYearlyByWeekDay' => 1
- );
+ ];
switch ($row['recurring']) {
case 0:
break;
}
- $data = array(
+ $data = [
'userID' => ($row['userid'] ?: null),
'username' => $row['username'],
'subject' => $row['title'],
'time' => $row['dateline'],
'enableSmilies' => $row['allowsmilies'],
'eventDate' => serialize($eventDateData)
- );
+ ];
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event')->import($row['eventid'], $data, array(
- 'categories' => array($row['calendarid']),
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event')->import($row['eventid'], $data, [
+ 'categories' => [$row['calendarid']],
'createEventDates' => true
- ));
+ ]);
}
}
private function readOption($optionName) {
- static $optionCache = array();
+ static $optionCache = [];
if (!isset($optionCache[$optionName])) {
$sql = "SELECT value
FROM ".$this->databasePrefix."setting
WHERE varname = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($optionName));
+ $statement->execute([$optionName]);
$row = $statement->fetchArray();
$optionCache[$optionName] = $row['value'];
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote=(.*?);(\d+)\]', Regex::CASE_INSENSITIVE);
$quoteCallback = new Callback(function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $postID,
'forceFrontend' => true
- )).'#post'.$postID;
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$postID;
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
});
}
// use proper WCF 2 bbcode
- $replacements = array(
+ $replacements = [
'[left]' => '[align=left]',
'[/left]' => '[/align]',
'[right]' => '[align=right]',
'[/html]' => '[/code]',
'[/video]' => '[/media]',
'[attach=config]' => '[attach]'
- );
+ ];
$message = str_ireplace(array_keys($replacements), array_values($replacements), $message);
// remove double quotes
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley.category' => 'SmileyCategories',
'com.woltlab.wcf.smiley' => 'Smilies',
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 100,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 50
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
/* 'com.woltlab.wcf.user.option',*/
/* 'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'*/
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
/*'com.woltlab.wbb.acl',*/
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
/* 'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like',
'com.woltlab.wcf.label'*/
- ),
+ ],
/* 'com.woltlab.wcf.conversation' => array(
'com.woltlab.wcf.conversation.label'
),
'com.woltlab.wcf.smiley' => array()*/
- );
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE usergroupid BETWEEN ? AND ?
ORDER BY usergroupid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
switch ($row['systemgroupid']) {
case 1:
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['usergroupid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['usergroupid'], [
'groupName' => $row['title'],
'groupDescription' => $row['description'],
'groupType' => $groupType,
'userOnlineMarking' => $row['opentag'].'%s'.$row['closetag']
- ));
+ ]);
}
}
WHERE user_table.userid BETWEEN ? AND ?
ORDER BY user_table.userid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'signature' => $row['signature'],
'userTitle' => ($row['customtitle'] != 0) ? $row['usertitle'] : '',
'lastActivityTime' => $row['lastactivity']
- );
- $additionalData = array(
+ ];
+ $additionalData = [
'groupIDs' => explode(',', $row['membergroupids'].','.$row['usergroupid']),
- 'options' => array()
- );
+ 'options' => []
+ ];
// import user
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['userid'], $data, $additionalData);
$password = 'vb5:'.implode(':', explode(' ', $row['token'], 2));
}
- $passwordUpdateStatement->execute(array($password, $newUserID));
+ $passwordUpdateStatement->execute([$password, $newUserID]);
}
}
}
WHERE customavatar.userid BETWEEN ? AND ?
ORDER BY customavatar.userid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$file = null;
file_put_contents($file, $row['filedata']);
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['userid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['userid'], [
'avatarName' => $row['filename'],
'avatarExtension' => pathinfo($row['filename'], PATHINFO_EXTENSION),
'width' => $row['width'],
'height' => $row['height'],
'userID' => $row['userid']
- ), array('fileLocation' => $file));
+ ], ['fileLocation' => $file]);
if (!$this->readOption('usefileavatar')) unlink($file);
}
INNER JOIN (SELECT contenttypeid FROM ".$this->databasePrefix."contenttype WHERE class = ?) x
ON x.contenttypeid = node.contenttypeid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Channel'));
+ $statement->execute(['Channel']);
$row = $statement->fetchArray();
return ($row['count'] ? 1 : 0);
}
ORDER BY nodeid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Channel'));
+ $statement->execute(['Channel']);
while ($row = $statement->fetchArray()) {
$this->boardCache[$row['parentid']][] = $row;
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['nodeid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['nodeid'], [
'parentID' => ($board['parentid'] ?: null),
'position' => $board['displayorder'] ?: 0,
'boardType' => Board::TYPE_BOARD,
'descriptionUseHtml' => 0,
'enableMarkingAsDone' => 0,
'ignorable' => 1
- ));
+ ]);
$this->exportBoardsRecursively($board['nodeid']);
}
WHERE child.nodeid BETWEEN ? AND ?
ORDER BY child.nodeid ASC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Channel', 'Text', 'Poll', $offset + 1, $offset + $limit));
+ $statement->execute(['Channel', 'Text', 'Poll', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['parentid'],
'topic' => StringUtil::decodeHTML($row['title']),
'time' => $row['created'],
'isClosed' => $row['open'] ? 0 : 1,
'isDeleted' => $row['deleteuserid'] !== null ? 1 : 0,
'deleteTime' => $row['deleteuserid'] !== null ? TIME_NOW : 0
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['nodeid'], $data, $additionalData);
}
WHERE child.nodeid BETWEEN ? AND ?
ORDER BY child.nodeid ASC";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Text', 'Poll', $offset + 1, $offset + $limit));
+ $statement->execute(['Text', 'Poll', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['nodeid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['nodeid'], [
'threadID' => $row['isFirstPost'] ? $row['nodeid'] : $row['parentid'],
'userID' => $row['userid'],
'username' => $row['authorname'],
'enableBBCodes' => 1,
'showSignature' => $row['showsignature'],
'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress'])
- ));
+ ]);
}
}
// Text in a Text or Poll should be a post
// Text in a Channel should be a thread
- $statement->execute(array('Text', 'Poll', 'Channel', 'Text', 'Attach', $offset + 1, $offset + $limit));
+ $statement->execute(['Text', 'Poll', 'Channel', 'Text', 'Attach', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$file = null;
$row['isImage'] = $row['width'] = $row['height'] = 0;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['nodeid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.attachment')->import($row['nodeid'], [
'objectID' => $row['parentid'],
'userID' => ($row['userid'] ?: null),
'filename' => $row['filename'],
'downloads' => $row['counter'],
'uploadTime' => $row['dateline'],
'showOrder' => (isset($row['displayOrder']) ? $row['displayOrder'] : 0)
- ), array('fileLocation' => $file));
+ ], ['fileLocation' => $file]);
if ($this->readOption('attachfile') == self::ATTACHFILE_DATABASE) unlink($file);
}
WHERE pollid BETWEEN ? AND ?
ORDER BY pollid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], [
'objectID' => $row['nodeid'],
'question' => $row['question'],
'time' => $row['dateline'],
'sortByVotes' => 0,
'maxVotes' => $row['multiple'] ? $row['numberoptions'] : 1,
'votes' => $row['votes']
- ));
+ ]);
}
}
WHERE polloption.polloptionid BETWEEN ? AND ?
ORDER BY polloption.polloptionid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['polloptionid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['polloptionid'], [
'pollID' => $row['pollid'],
'optionValue' => $row['title'],
'votes' => $row['votes']
- ));
+ ]);
}
}
WHERE pollvoteid BETWEEN ? AND ?
ORDER BY pollvoteid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pollid'],
'optionID' => $row['polloptionid'],
'userID' => $row['userid']
- ));
+ ]);
}
}
private function readOption($optionName) {
- static $optionCache = array();
+ static $optionCache = [];
if (!isset($optionCache[$optionName])) {
$sql = "SELECT value
FROM ".$this->databasePrefix."setting
WHERE varname = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($optionName));
+ $statement->execute([$optionName]);
$row = $statement->fetchArray();
$optionCache[$optionName] = $row['value'];
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote=(.*?);n(\d+)\]', Regex::CASE_INSENSITIVE);
$quoteCallback = new Callback(function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $postID,
'forceFrontend' => true
- )).'#post'.$postID;
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$postID;
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
});
}
// use proper WCF 2 bbcode
- $replacements = array(
+ $replacements = [
'[left]' => '[align=left]',
'[/left]' => '[/align]',
'[right]' => '[align=right]',
'[html]' => '[code=html]',
'[/html]' => '[/code]',
'[/video]' => '[/media]'
- );
+ ];
$message = str_ireplace(array_keys($replacements), array_values($replacements), $message);
// quotes
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.wcf.label' => 'Labels',
'com.woltlab.wbb.acl' => 'ACLs',
'com.woltlab.wcf.smiley' => 'Smilies'
- );
+ ];
- protected $permissionMap = array(
+ protected $permissionMap = [
'can_view_board' => 'canViewBoard',
'can_enter_board' => 'canEnterBoard',
'can_read_thread' => 'canReadThread',
//'can_use_post_icons' => '',
//'can_use_post_images' => '',
//'can_use_prefix' => ''
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::validateDatabaseAccess()
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupid'], [
'groupName' => $row['title'],
'groupType' => $groupType,
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache profile fields
- $profileFields = array();
+ $profileFields = [];
$sql = "SELECT profilefieldid
FROM ".$this->databasePrefix."profilefields
WHERE profilefieldid > 3";
WHERE user.userid BETWEEN ? AND ?
ORDER BY user.userid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'signatureEnableHtml' => $row['allowsightml'],
'signatureEnableBBCodes' => $row['allowsigbbcode'],
'registrationIpAddress' => (!empty($row['reg_ipaddress']) ? $row['reg_ipaddress'] : '')
- );
+ ];
- $options = array(
+ $options = [
'birthday' => $row['birthday'],
'gender' => $row['gender'],
'homepage' => $row['homepage'],
'location' => (!empty($row['field1']) ? $row['field1'] : ''),
'hobbies' => (!empty($row['field2']) ? $row['field2'] : ''),
'occupation' => (!empty($row['field3']) ? $row['field3'] : ''),
- );
+ ];
foreach ($profileFields as $profileFieldID) {
if (!empty($row['field'.$profileFieldID])) {
}
}
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
'options' => $options
- );
+ ];
// import user
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['userid'], $data, $additionalData);
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('wbb2:'.(!empty($row['sha1_password']) ? $row['sha1_password'] : $row['password']), $newUserID));
+ $passwordUpdateStatement->execute(['wbb2:'.(!empty($row['sha1_password']) ? $row['sha1_password'] : $row['password']), $newUserID]);
}
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankid'], [
'groupID' => $row['groupid'],
'requiredPoints' => $row['needposts'] * 5,
'rankTitle' => $row['ranktitle'],
'requiredGender' => $row['gender']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."avatars
WHERE userid <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE userid <> ?
ORDER BY avatarid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarid'], [
'avatarName' => $row['avatarname'],
'avatarExtension' => $row['avatarextension'],
'width' => $row['width'],
'height' => $row['height'],
'userID' => $row['userid']
- ), array('fileLocation' => $this->fileSystemPath . 'images/avatars/avatar-' . $row['avatarid'] . '.' . $row['avatarextension']));
+ ], ['fileLocation' => $this->fileSystemPath . 'images/avatars/avatar-' . $row['avatarid'] . '.' . $row['avatarextension']]);
}
}
FROM ".$this->databasePrefix."profilefields
WHERE profilefieldid > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(3));
+ $statement->execute([3]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE profilefieldid > ?
ORDER BY profilefieldid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(3));
+ $statement->execute([3]);
while ($row = $statement->fetchArray()) {
$optionType = 'text';
switch ($row['fieldtype']) {
break;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['profilefieldid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['profilefieldid'], [
'categoryName' => 'profile.personal',
'optionType' => $optionType,
'required' => $row['required'],
'showOrder' => $row['fieldorder'],
'selectOptions' => $row['fieldoptions'],
'editable' => UserOption::EDITABILITY_ALL
- ), array('name' => $row['title']));
+ ], ['name' => $row['title']]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folderid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folderid'], [
'userID' => $row['userid'],
'label' => mb_substr($row['title'], 0, 80)
- ));
+ ]);
}
}
WHERE pm.privatemessageid BETWEEN ? AND ?
ORDER BY pm.privatemessageid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $conversationID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['privatemessageid'], array(
+ $conversationID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['privatemessageid'], [
'subject' => $row['subject'],
'time' => $row['sendtime'],
'userID' => $row['senderid'],
'username' => ($row['username'] ?: '')
- ));
+ ]);
// import message
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['privatemessageid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['privatemessageid'], [
'conversationID' => $row['privatemessageid'],
'userID' => $row['senderid'],
'username' => ($row['username'] ?: ''),
'enableHtml' => $row['allowhtml'],
'enableBBCodes' => $row['allowbbcode'],
'showSignature' => $row['showsignature']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['privatemessageid'],
'participantID' => $row['recipientid'],
'username' => $row['recipient'],
'hideConversation' => $row['deletepm'],
'isInvisible' => $row['blindcopy'],
'lastVisitTime' => $row['view']
- ), array('labelIDs' => ($row['folderid'] ? array($row['folderid']) : array())));
+ ], ['labelIDs' => ($row['folderid'] ? [$row['folderid']] : [])]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardid'], [
'parentID' => ($board['parentid'] ?: null),
'position' => $board['boardorder'],
'boardType' => (!$board['isboard'] ? 1 : (!empty($board['externalurl']) ? 2 : 0)),
'countUserPosts' => $board['countuserposts'],
'isClosed' => $board['closed'],
'isInvisible' => intval($board['invisible'] == 2)
- ));
+ ]);
$this->exportBoardsRecursively($board['boardid']);
}
FROM ".$this->databasePrefix."options
WHERE varname = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('default_prefix'));
+ $statement->execute(['default_prefix']);
$row = $statement->fetchArray();
if ($row !== false) $globalPrefixes = $row['value'];
// get boards
- $boardPrefixes = array();
+ $boardPrefixes = [];
$sql = "SELECT boardid, prefix, prefixuse
FROM ".$this->databasePrefix."boards
WHERE prefixuse > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
$prefixes = '';
}
// get thread ids
- $threadIDs = $announcementIDs = array();
+ $threadIDs = $announcementIDs = [];
$sql = "SELECT threadid, important
FROM ".$this->databasePrefix."threads
WHERE threadid BETWEEN ? AND ?
ORDER BY threadid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$threadIDs[] = $row['threadid'];
if ($row['important'] == 2) $announcementIDs[] = $row['threadid'];
}
// get assigned boards (for announcements)
- $assignedBoards = array();
+ $assignedBoards = [];
if (!empty($announcementIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadid IN (?)', array($announcementIDs));
+ $conditionBuilder->add('threadid IN (?)', [$announcementIDs]);
$sql = "SELECT boardid, threadid
FROM ".$this->databasePrefix."announcements
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($assignedBoards[$row['threadid']])) $assignedBoards[$row['threadid']] = array();
+ if (!isset($assignedBoards[$row['threadid']])) $assignedBoards[$row['threadid']] = [];
$assignedBoards[$row['threadid']][] = $row['boardid'];
}
}
// get threads
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadid IN (?)', array($threadIDs));
+ $conditionBuilder->add('threadid IN (?)', [$threadIDs]);
$sql = "SELECT *
FROM ".$this->databasePrefix."threads
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['boardid'],
'topic' => $row['topic'],
'time' => $row['starttime'],
'isClosed' => intval($row['closed'] == 1),
'movedThreadID' => ($row['closed'] == 3 ? $row['pollid'] : null),
'lastPostTime' => $row['lastposttime']
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if (!empty($assignedBoards[$row['threadid']])) $additionalData['assignedBoards'] = $assignedBoards[$row['threadid']];
- if ($row['prefix'] && isset($boardPrefixes[$row['boardid']])) $additionalData['labels'] = array($boardPrefixes[$row['boardid']].'-'.$row['prefix']);
+ if ($row['prefix'] && isset($boardPrefixes[$row['boardid']])) $additionalData['labels'] = [$boardPrefixes[$row['boardid']].'-'.$row['prefix']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['threadid'], $data, $additionalData);
}
WHERE postid BETWEEN ? AND ?
ORDER BY postid";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postid'], [
'threadID' => $row['threadid'],
'userID' => $row['userid'],
'username' => $row['username'],
'enableHtml' => $row['allowhtml'],
'enableBBCodes' => $row['allowbbcode'],
'showSignature' => $row['showsignature'],
- 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress'])
- ));
+ 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress'])
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['threadid'],
'userID' => $row['userid']
- ));
+ ]);
}
}
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."polls";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post'));
+ $statement->execute(['post']);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."polls poll
ORDER BY pollid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('post'));
+ $statement->execute(['post']);
while ($row = $statement->fetchArray()) {
$postID = null;
$votes = 0;
// get first post id
- $firstPostStatement->execute(array($row['threadid']));
+ $firstPostStatement->execute([$row['threadid']]);
$row2 = $firstPostStatement->fetchArray();
if (empty($row2['postid'])) continue;
$postID = $row2['postid'];
// get votes
- $votesStatement->execute(array($row['pollid']));
+ $votesStatement->execute([$row['pollid']]);
$row2 = $votesStatement->fetchArray();
if (!empty($row2['votes'])) $votes = $row2['votes'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollid'], [
'objectID' => $postID,
'question' => $row['question'],
'time' => $row['starttime'],
'endTime' => ($row['timeout'] ? $row['starttime'] + $row['timeout'] * 86400 : 0),
'maxVotes' => $row['choicecount'],
'votes' => $votes
- ));
+ ]);
}
}
$sql = "SELECT COUNT(*) AS count
FROM ".$this->databasePrefix."polloptions";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array());
+ $statement->execute([]);
$row = $statement->fetchArray();
return $row['count'];
}
FROM ".$this->databasePrefix."polloptions
ORDER BY polloptionid";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array());
+ $statement->execute([]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['polloptionid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['polloptionid'], [
'pollID' => $row['pollid'],
'optionValue' => $row['polloption'],
'votes' => $row['votes']
- ));
+ ]);
}
}
FROM ".$this->databasePrefix."boards
WHERE prefixuse > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return ($row['count'] ? 1 : 0);
}
* Exports labels.
*/
public function exportLabels($offset, $limit) {
- $prefixMap = array();
+ $prefixMap = [];
// get global prefixes
$globalPrefixes = '';
FROM ".$this->databasePrefix."options
WHERE varname = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('default_prefix'));
+ $statement->execute(['default_prefix']);
$row = $statement->fetchArray();
if ($row !== false) $globalPrefixes = $row['value'];
FROM ".$this->databasePrefix."boards
WHERE prefixuse > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
$prefixes = '';
if ($prefixes) {
$key = StringUtil::getHash($prefixes);
if (!isset($prefixMap[$key])) {
- $prefixMap[$key] = array(
+ $prefixMap[$key] = [
'prefixes' => $prefixes,
- 'boardIDs' => array()
- );
+ 'boardIDs' => []
+ ];
}
$boardID = ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['boardid']);
foreach ($prefixMap as $key => $data) {
// import label group
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($key, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($key, [
'groupName' => 'labelgroup'.$i
- ), array('objects' => array($objectType->objectTypeID => $data['boardIDs'])));
+ ], ['objects' => [$objectType->objectTypeID => $data['boardIDs']]]);
// import labels
$labels = explode("\n", $data['prefixes']);
foreach ($labels as $label) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($key.'-'.$label, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($key.'-'.$label, [
'groupID' => $key,
'label' => mb_substr($label, 0, 80)
- ));
+ ]);
}
$i++;
$statement = $this->database->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'objectID' => $row['boardid'],
'groupID' => $row['groupid']
- );
+ ];
unset($row['boardid'], $row['groupid']);
foreach ($row as $permission => $value) {
if ($value == -1) continue;
if (!isset($this->permissionMap[$permission])) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, array('optionValue' => $value)), array('optionName' => $this->permissionMap[$permission]));
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, ['optionValue' => $value]), ['optionName' => $this->permissionMap[$permission]]);
}
}
}
$row['smiliepath'] = $this->fileSystemPath.$row['smiliepath'];
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smilieid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smilieid'], [
'smileyTitle' => $row['smilietitle'],
'smileyCode' => $row['smiliecode'],
'showOrder' => $row['smilieorder']
- ), array('fileLocation' => $row['smiliepath']));
+ ], ['fileLocation' => $row['smiliepath']]);
}
}
FROM ".$this->databasePrefix."attachments
WHERE ".$indexName." > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE ".$indexName." > ?
ORDER BY attachmentid DESC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'attachments/attachment-'.$row['attachmentid'].'.'.$row['attachmentextension'];
if (!@file_exists($fileLocation)) continue;
$isImage = 0;
if ($fileType == 'image/jpeg' || $fileType == 'image/png' || $fileType == 'image/gif') $isImage = 1;
- ImportHandler::getInstance()->getImporter($objectType)->import($row['attachmentid'], array(
+ ImportHandler::getInstance()->getImporter($objectType)->import($row['attachmentid'], [
'objectID' => $row[$indexName],
'userID' => ($row['userid'] ?: null),
'filename' => $row['attachmentname'].'.'.$row['attachmentextension'],
'downloads' => $row['counter'],
'uploadTime' => $row['uploadtime'],
'showOrder' => 0
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.calendar.event.date' => 'CalendarEventDates',
'com.woltlab.calendar.event.date.comment' => 'CalendarEventDateComments',
'com.woltlab.calendar.event.date.participation' => 'CalendarEventDateParticipation'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 50,
'com.woltlab.gallery.image' => 100
- );
+ ];
/**
* valid thread sort fields
* @var array<string>
*/
- protected static $availableThreadSortFields = array('topic', 'username', 'time', 'views', 'replies', 'lastPostTime', 'cumulativeLikes');
+ protected static $availableThreadSortFields = ['topic', 'username', 'time', 'views', 'replies', 'lastPostTime', 'cumulativeLikes'];
/**
* @see \wcf\system\exporter\IExporter::init()
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.blog.entry' => array(
+ ],
+ 'com.woltlab.blog.entry' => [
'com.woltlab.blog.category',
'com.woltlab.blog.entry.attachment',
'com.woltlab.blog.entry.comment',
'com.woltlab.blog.entry.like'
- ),
- 'com.woltlab.gallery.image' => array(
+ ],
+ 'com.woltlab.gallery.image' => [
'com.woltlab.gallery.category',
'com.woltlab.gallery.album',
'com.woltlab.gallery.image.comment',
'com.woltlab.gallery.image.like'
- ),
- 'com.woltlab.calendar.event' => array(
+ ],
+ 'com.woltlab.calendar.event' => [
'com.woltlab.calendar.category',
'com.woltlab.calendar.event.attachment',
'com.woltlab.calendar.event.date.participation'
- ),
- 'com.woltlab.wcf.smiley' => array()
- );
+ ],
+ 'com.woltlab.wcf.smiley' => []
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE groupID BETWEEN ? AND ?
ORDER BY groupID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupID'], [
'groupName' => $row['groupName'],
'groupType' => $row['groupType'],
'userOnlineMarking' => (!empty($row['userOnlineMarking']) ? $row['userOnlineMarking'] : ''),
'showOnTeamPage' => (!empty($row['showOnTeamPage']) ? $row['showOnTeamPage'] : 0)
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache existing user options
- $existingUserOptions = array();
+ $existingUserOptions = [];
$sql = "SELECT optionName, optionID
FROM wcf".WCF_N."_user_option
WHERE optionName NOT LIKE 'option%'";
}
// cache user options
- $userOptions = array();
+ $userOptions = [];
$sql = "SELECT optionName, optionID
FROM wcf".$this->dbNo."_user_option";
$statement = $this->database->prepareStatement($sql);
WHERE optionName IN ('encryption_enable_salting', 'encryption_encrypt_before_salting', 'encryption_method', 'encryption_salt_position')";
$statement = $this->database->prepareStatement($sql);
$statement->execute();
- $encryptionData = array();
+ $encryptionData = [];
while ($row = $statement->fetchArray()) {
$encryptionData[$row['optionName']] = $row['optionValue'];
}
- if (isset($encryptionData['encryption_method']) && in_array($encryptionData['encryption_method'], array('crc32', 'md5', 'sha1'))) {
+ if (isset($encryptionData['encryption_method']) && in_array($encryptionData['encryption_method'], ['crc32', 'md5', 'sha1'])) {
if ($encryptionData['encryption_enable_salting'] && $encryptionData['encryption_encrypt_before_salting'] && $encryptionData['encryption_method'] == 'sha1' && $encryptionData['encryption_salt_position'] == 'before') {
$encryption = 'wcf1';
}
WHERE user_table.userID BETWEEN ? AND ?
ORDER BY user_table.userID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'profileHits' => $row['profileHits'],
'userTitle' => $row['userTitle'],
'lastActivityTime' => $row['lastActivityTime']
- );
- $additionalData = array(
+ ];
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
'languages' => explode(',', $row['languageCodes']),
- 'options' => array()
- );
+ 'options' => []
+ ];
// handle user options
foreach ($userOptions as $optionID => $optionName) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array($encryption.':'.$row['password'].':'.$row['salt'], $newUserID));
+ $passwordUpdateStatement->execute([$encryption.':'.$row['password'].':'.$row['salt'], $newUserID]);
}
}
}
WHERE rankID BETWEEN ? AND ?
ORDER BY rankID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankID'], [
'groupID' => $row['groupID'],
'requiredPoints' => $row['neededPoints'],
'rankTitle' => $row['rankTitle'],
'rankImage' => $row['rankImage'],
'repeatImage' => $row['repeatImage'],
'requiredGender' => $row['gender']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['userID'],
'followUserID' => $row['whiteUserID'],
'time' => (!empty($row['time']) ? $row['time'] : 0)
- ));
+ ]);
}
}
WHERE entryID BETWEEN ? AND ?
ORDER BY entryID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['entryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['entryID'], [
'objectID' => $row['ownerID'],
'userID' => $row['userID'],
'username' => $row['username'],
'message' => $row['message'],
'time' => $row['time']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_user_guestbook
WHERE commentTime > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
AND user_guestbook.entryID BETWEEN ? AND ?
ORDER BY user_guestbook.entryID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, $offset + 1, $offset + $limit));
+ $statement->execute([0, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['entryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['entryID'], [
'commentID' => $row['entryID'],
'time' => $row['commentTime'],
'userID' => $row['ownerID'],
'username' => $row['ownerName'],
'message' => $row['comment'],
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_avatar
WHERE userID <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
AND avatarID BETWEEN ? AND ?
ORDER BY avatarID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, $offset + 1, $offset + $limit));
+ $statement->execute([0, $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarID'], [
'avatarName' => $row['avatarName'],
'avatarExtension' => $row['avatarExtension'],
'width' => $row['width'],
'height' => $row['height'],
'userID' => $row['userID']
- ), array('fileLocation' => $this->fileSystemPath . 'images/avatars/avatar-' . $row['avatarID'] . '.' . $row['avatarExtension']));
+ ], ['fileLocation' => $this->fileSystemPath . 'images/avatars/avatar-' . $row['avatarID'] . '.' . $row['avatarExtension']]);
}
}
$optionsNames = $this->getExistingUserOptions();
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', array('profile'));
- if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', array($optionsNames));
+ $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', ['profile']);
+ if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', [$optionsNames]);
$sql = "SELECT COUNT(*) AS count
FROM wcf".$this->dbNo."_user_option
$optionsNames = $this->getExistingUserOptions();
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', array('profile'));
- if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', array($optionsNames));
+ $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', ['profile']);
+ if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', [$optionsNames]);
$sql = "SELECT user_option.*, (
SELECT languageItemValue
$row['optionType'] = 'textarea';
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['optionID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['optionID'], [
'categoryName' => $row['categoryName'],
'optionType' => $row['optionType'],
'defaultValue' => $row['defaultValue'],
'editable' => $editable,
'visible' => $visible,
'showOrder' => $row['showOrder']
- ), array('name' => ($row['name'] ?: $row['optionName'])));
+ ], ['name' => ($row['name'] ?: $row['optionName'])]);
}
}
WHERE folderID BETWEEN ? AND ?
ORDER BY folderID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$cssClassName = '';
if (!empty($row['color'])) {
}
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folderID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['folderID'], [
'userID' => $row['userID'],
'label' => mb_substr($row['folderName'], 0, 80),
'cssClassName' => $cssClassName
- ));
+ ]);
}
}
WHERE pm.pmID BETWEEN ? AND ?
ORDER BY pm.pmID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['userID'];
if (ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $conversationID) !== null) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($conversationID, [
'subject' => $row['subject'],
'time' => $row['time'],
'userID' => $row['userID'],
'username' => $row['username'],
'isDraft' => $row['isDraft']
- ));
+ ]);
}
}
WHERE pm.pmID BETWEEN ? AND ?
ORDER BY pm.pmID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$participants = explode(',', $row['participants']);
$participants[] = $row['userID'];
$conversationID = $this->getConversationID($row['parentPmID'] ?: $row['pmID'], $participants);
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['pmID'], [
'conversationID' => $conversationID,
'userID' => $row['userID'],
'username' => $row['username'],
'enableHtml' => $row['enableHtml'],
'enableBBCodes' => $row['enableBBCodes'],
'showSignature' => $row['showSignature']
- ));
+ ]);
}
}
if ($row['isDraft']) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $conversationID,
'participantID' => $row['recipientID'],
'username' => $row['recipient'],
'hideConversation' => $row['isDeleted'],
'isInvisible' => $row['isBlindCopy'],
'lastVisitTime' => $row['isViewed']
- ), array('labelIDs' => ($row['folderID'] ? array($row['folderID']) : array())));
+ ], ['labelIDs' => ($row['folderID'] ? [$row['folderID']] : [])]);
}
}
foreach ($this->boardCache[$parentID] as $board) {
if (!in_array($board['sortField'], self::$availableThreadSortFields)) $board['sortField'] = 'lastPostTime';
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardID'], [
'parentID' => ($board['parentID'] ?: null),
'position' => ($board['position'] ?: 0),
'boardType' => $board['boardType'],
'clicks' => $board['clicks'],
'posts' => $board['posts'],
'threads' => $board['threads']
- ));
+ ]);
$this->exportBoardsRecursively($board['boardID']);
}
FROM wcf".$this->dbNo."_option
WHERE optionName = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('thread_default_prefixes'));
+ $statement->execute(['thread_default_prefixes']);
$row = $statement->fetchArray();
if ($row !== false) $globalPrefixes = $row['optionValue'];
// get boards
- $boardPrefixes = array();
+ $boardPrefixes = [];
if (substr($this->getPackageVersion('com.woltlab.wcf'), 0, 3) == '1.1') {
$sql = "SELECT boardID, prefixes, prefixMode
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixMode > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
}
else {
$sql = "SELECT boardID, prefixes, 2 AS prefixMode
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixes <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
}
while ($row = $statement->fetchArray()) {
}
// get thread ids
- $threadIDs = $announcementIDs = array();
+ $threadIDs = $announcementIDs = [];
$sql = "SELECT threadID, isAnnouncement
FROM wbb".$this->dbNo."_".$this->instanceNo."_thread
WHERE threadID BETWEEN ? AND ?
ORDER BY threadID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$threadIDs[] = $row['threadID'];
if ($row['isAnnouncement']) $announcementIDs[] = $row['threadID'];
if (empty($threadIDs)) return;
// get assigned boards (for announcements)
- $assignedBoards = array();
+ $assignedBoards = [];
if (!empty($announcementIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadID IN (?)', array($announcementIDs));
+ $conditionBuilder->add('threadID IN (?)', [$announcementIDs]);
$sql = "SELECT boardID, threadID
FROM wbb".$this->dbNo."_".$this->instanceNo."_thread_announcement
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($assignedBoards[$row['threadID']])) $assignedBoards[$row['threadID']] = array();
+ if (!isset($assignedBoards[$row['threadID']])) $assignedBoards[$row['threadID']] = [];
$assignedBoards[$row['threadID']][] = $row['boardID'];
}
}
// get threads
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadID IN (?)', array($threadIDs));
+ $conditionBuilder->add('threadID IN (?)', [$threadIDs]);
$sql = "SELECT thread.*, language.languageCode
FROM wbb".$this->dbNo."_".$this->instanceNo."_thread thread
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['boardID'],
'topic' => $row['topic'],
'time' => $row['time'],
'isDone' => (!empty($row['isDone']) ? $row['isDone'] : 0),
'deleteTime' => $row['deleteTime'],
'lastPostTime' => $row['lastPostTime']
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
if (!empty($assignedBoards[$row['threadID']])) $additionalData['assignedBoards'] = $assignedBoards[$row['threadID']];
- if ($row['prefix'] && isset($boardPrefixes[$row['boardID']])) $additionalData['labels'] = array($boardPrefixes[$row['boardID']].'-'.$row['prefix']);
+ if ($row['prefix'] && isset($boardPrefixes[$row['boardID']])) $additionalData['labels'] = [$boardPrefixes[$row['boardID']].'-'.$row['prefix']];
if (isset($tags[$row['threadID']])) $additionalData['tags'] = $tags[$row['threadID']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['threadID'], $data, $additionalData);
WHERE postID BETWEEN ? AND ?
ORDER BY postID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postID'], [
'threadID' => $row['threadID'],
'userID' => $row['userID'],
'username' => $row['username'],
'showSignature' => $row['showSignature'],
'ipAddress' => UserUtil::convertIPv4To6($row['ipAddress']),
'deleteTime' => $row['deleteTime']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['threadID'],
'userID' => $row['userID'],
'notification' => $row['enableNotification']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_poll
WHERE messageType = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post'));
+ $statement->execute(['post']);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
AND pollID BETWEEN ? AND ?
ORDER BY pollID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post', $offset + 1, $offset + $limit));
+ $statement->execute(['post', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollID'], [
'objectID' => $row['messageID'],
'question' => $row['question'],
'time' => $row['time'],
'sortByVotes' => $row['sortByResult'],
'maxVotes' => $row['choiceCount'],
'votes' => $row['votes']
- ));
+ ]);
}
}
WHERE messageType = ?
)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post'));
+ $statement->execute(['post']);
$row = $statement->fetchArray();
if ($row !== false) return $row['maxID'];
return 0;
AND pollOptionID BETWEEN ? AND ?
ORDER BY pollOptionID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post', $offset + 1, $offset + $limit));
+ $statement->execute(['post', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pollOptionID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['pollOptionID'], [
'pollID' => $row['pollID'],
'optionValue' => $row['pollOption'],
'showOrder' => $row['showOrder'],
'votes' => $row['votes']
- ));
+ ]);
}
}
)
AND userID <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post', 0));
+ $statement->execute(['post', 0]);
$row = $statement->fetchArray();
return $row['count'];
}
AND userID <> ?
ORDER BY pollOptionID, userID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('post', 0));
+ $statement->execute(['post', 0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pollID'],
'optionID' => $row['pollOptionID'],
'userID' => $row['userID']
- ));
+ ]);
}
}
WHERE userID <> ?
AND rating NOT IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0, 0, 3));
+ $statement->execute([0, 0, 3]);
$row = $statement->fetchArray();
return $row['count'];
}
AND thread_rating.rating NOT IN (?, ?)
ORDER BY thread_rating.threadID, thread_rating.userID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0, 0, 3));
+ $statement->execute([0, 0, 3]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.like')->import(0, [
'objectID' => $row['firstPostID'],
'objectUserID' => ($row['objectUserID'] ?: null),
'userID' => $row['userID'],
'likeValue' => ($row['rating'] > 3 ? Like::LIKE : Like::DISLIKE),
'time' => $row['time']
- ));
+ ]);
}
}
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixMode > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
}
else {
$sql = "SELECT COUNT(*) AS count
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixes <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
}
$row = $statement->fetchArray();
* Exports labels.
*/
public function exportLabels($offset, $limit) {
- $prefixMap = array();
+ $prefixMap = [];
// get global prefixes
$globalPrefixes = '';
FROM wcf".$this->dbNo."_option
WHERE optionName = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('thread_default_prefixes'));
+ $statement->execute(['thread_default_prefixes']);
$row = $statement->fetchArray();
if ($row !== false) $globalPrefixes = $row['optionValue'];
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixMode > ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
}
else {
$sql = "SELECT boardID, prefixes, 2 AS prefixMode
FROM wbb".$this->dbNo."_".$this->instanceNo."_board
WHERE prefixes <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(''));
+ $statement->execute(['']);
}
while ($row = $statement->fetchArray()) {
if ($prefixes) {
$key = StringUtil::getHash($prefixes);
if (!isset($prefixMap[$key])) {
- $prefixMap[$key] = array(
+ $prefixMap[$key] = [
'prefixes' => $prefixes,
- 'boardIDs' => array()
- );
+ 'boardIDs' => []
+ ];
}
$boardID = ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['boardID']);
foreach ($prefixMap as $key => $data) {
// import label group
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($key, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($key, [
'groupName' => 'labelgroup'.$i
- ), array('objects' => array($objectType->objectTypeID => $data['boardIDs'])));
+ ], ['objects' => [$objectType->objectTypeID => $data['boardIDs']]]);
// import labels
$labels = explode("\n", $data['prefixes']);
foreach ($labels as $label) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($key.'-'.$label, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($key.'-'.$label, [
'groupID' => $key,
'label' => mb_substr($label, 0, 80)
- ));
+ ]);
}
$i++;
*/
public function exportACLs($offset, $limit) {
// get ids
- $mod = $user = $group = array();
+ $mod = $user = $group = [];
$sql = "(
SELECT boardID, userID, groupID, 'mod' AS type
FROM wbb".$this->dbNo."_".$this->instanceNo."_board_moderator
if (!empty($mod)) {
$conditionBuilder = new PreparedStatementConditionBuilder(true, 'OR');
foreach ($mod as $row) {
- $conditionBuilder->add('(boardID = ? AND userID = ? AND groupID = ?)', array($row['boardID'], $row['userID'], $row['groupID']));
+ $conditionBuilder->add('(boardID = ? AND userID = ? AND groupID = ?)', [$row['boardID'], $row['userID'], $row['groupID']]);
}
$sql = "SELECT *
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'objectID' => $row['boardID']
- );
+ ];
if ($row['userID']) $data['userID'] = $row['userID'];
else if ($row['groupID']) $data['groupID'] = $row['groupID'];
foreach ($row as $permission => $value) {
if ($value == -1) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, array('optionValue' => $value)), array('optionName' => $permission));
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, ['optionValue' => $value]), ['optionName' => $permission]);
}
}
}
if (!empty($group)) {
$conditionBuilder = new PreparedStatementConditionBuilder(true, 'OR');
foreach ($group as $row) {
- $conditionBuilder->add('(boardID = ? AND groupID = ?)', array($row['boardID'], $row['groupID']));
+ $conditionBuilder->add('(boardID = ? AND groupID = ?)', [$row['boardID'], $row['groupID']]);
}
$sql = "SELECT *
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'objectID' => $row['boardID']
- );
+ ];
$data['groupID'] = $row['groupID'];
unset($row['boardID'], $row['groupID']);
foreach ($row as $permission => $value) {
if ($value == -1) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, array('optionValue' => $value)), array('optionName' => $permission));
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, ['optionValue' => $value]), ['optionName' => $permission]);
}
}
}
if (!empty($user)) {
$conditionBuilder = new PreparedStatementConditionBuilder(true, 'OR');
foreach ($user as $row) {
- $conditionBuilder->add('(boardID = ? AND userID = ?)', array($row['boardID'], $row['userID']));
+ $conditionBuilder->add('(boardID = ? AND userID = ?)', [$row['boardID'], $row['userID']]);
}
$sql = "SELECT *
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'objectID' => $row['boardID']
- );
+ ];
$data['userID'] = $row['userID'];
unset($row['boardID'], $row['userID']);
foreach ($row as $permission => $value) {
if ($value == -1) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, array('optionValue' => $value)), array('optionName' => $permission));
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array_merge($data, ['optionValue' => $value]), ['optionName' => $permission]);
}
}
}
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath . $row['smileyPath'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smileyID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smileyID'], [
'smileyTitle' => $row['smileyTitle'],
'smileyCode' => $row['smileyCode'],
'showOrder' => $row['showOrder'],
'categoryID' => (!empty($row['smileyCategoryID']) ? $row['smileyCategoryID'] : null)
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['smileyCategoryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['smileyCategoryID'], [
'title' => $row['title'],
'parentCategoryID' => 0,
'showOrder' => $row['showOrder']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_user_blog_category
WHERE userID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE userID = ?
ORDER BY categoryID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($row['categoryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($row['categoryID'], [
'title' => $row['title'],
'parentCategoryID' => 0,
'showOrder' => 0
- ));
+ ]);
}
}
*/
public function exportBlogEntries($offset, $limit) {
// get entry ids
- $entryIDs = array();
+ $entryIDs = [];
$sql = "SELECT entryID
FROM wcf".$this->dbNo."_user_blog
WHERE entryID BETWEEN ? AND ?
ORDER BY entryID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$entryIDs[] = $row['entryID'];
}
$tags = $this->getTags('com.woltlab.wcf.user.blog.entry', $entryIDs);
// get categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('entry_to_category.entryID IN (?)', array($entryIDs));
- $conditionBuilder->add('category.userID = ?', array(0));
+ $conditionBuilder->add('entry_to_category.entryID IN (?)', [$entryIDs]);
+ $conditionBuilder->add('category.userID = ?', [0]);
$sql = "SELECT entry_to_category.*
FROM wcf".$this->dbNo."_user_blog_entry_to_category entry_to_category
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($categories[$row['entryID']])) $categories[$row['entryID']] = array();
+ if (!isset($categories[$row['entryID']])) $categories[$row['entryID']] = [];
$categories[$row['entryID']][] = $row['categoryID'];
}
// get entries
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('user_blog.entryID IN (?)', array($entryIDs));
+ $conditionBuilder->add('user_blog.entryID IN (?)', [$entryIDs]);
$sql = "SELECT user_blog.*, language.languageCode
FROM wcf".$this->dbNo."_user_blog user_blog
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
if (isset($tags[$row['entryID']])) $additionalData['tags'] = $tags[$row['entryID']];
if (isset($categories[$row['entryID']])) $additionalData['categories'] = $categories[$row['entryID']];
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['entryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['entryID'], [
'userID' => ($row['userID'] ?: null),
'username' => $row['username'],
'subject' => $row['subject'],
'views' => $row['views'],
'isPublished' => $row['isPublished'],
'publicationDate' => $row['publishingDate']
- ), $additionalData);
+ ], $additionalData);
}
}
WHERE commentID BETWEEN ? AND ?
ORDER BY commentID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['commentID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['commentID'], [
'objectID' => $row['entryID'],
'userID' => $row['userID'],
'username' => $row['username'],
'message' => $row['comment'],
'time' => $row['time']
- ));
+ ]);
}
}
AND userID <> ?
AND rating NOT IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('com.woltlab.wcf.user.blog.entry', 0, 0, 3));
+ $statement->execute(['com.woltlab.wcf.user.blog.entry', 0, 0, 3]);
$row = $statement->fetchArray();
return $row['count'];
}
AND rating.rating NOT IN (?, ?)
ORDER BY rating.objectID, rating.userID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('com.woltlab.wcf.user.blog.entry', 0, 0, 3));
+ $statement->execute(['com.woltlab.wcf.user.blog.entry', 0, 0, 3]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.like')->import(0, [
'objectID' => $row['objectID'],
'objectUserID' => ($row['objectUserID'] ?: null),
'userID' => $row['userID'],
'likeValue' => ($row['rating'] > 3 ? Like::LIKE : Like::DISLIKE)
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.category')->import($row['categoryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.category')->import($row['categoryID'], [
'title' => $row['title'],
'parentCategoryID' => 0,
'showOrder' => 0
- ));
+ ]);
}
}
WHERE gallery_album.albumID BETWEEN ? AND ?
ORDER BY albumID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'userID' => $row['ownerID'],
'username' => ($row['username'] ?: ''),
'title' => $row['title'],
'description' => $row['description'],
'lastUpdateTime' => $row['lastUpdateTime']
- );
+ ];
if ($destVersion21 && $row['isPrivate']) {
$data['accessLevel'] = 2;
}
*/
public function exportGalleryImages($offset, $limit) {
// get ids
- $imageIDs = array();
+ $imageIDs = [];
$sql = "SELECT photoID
FROM wcf".$this->dbNo."_user_gallery
WHERE photoID BETWEEN ? AND ?
ORDER BY photoID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$imageIDs[] = $row['photoID'];
}
$tags = $this->getTags('com.woltlab.wcf.user.gallery.photo', $imageIDs);
// get categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('photo_to_category.objectType = ?', array('photo'));
- $conditionBuilder->add('photo_to_category.objectID IN (?)', array($imageIDs));
+ $conditionBuilder->add('photo_to_category.objectType = ?', ['photo']);
+ $conditionBuilder->add('photo_to_category.objectID IN (?)', [$imageIDs]);
$sql = "SELECT photo_to_category.*
FROM wcf".$this->dbNo."_user_gallery_category_to_object photo_to_category
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($categories[$row['objectID']])) $categories[$row['objectID']] = array();
+ if (!isset($categories[$row['objectID']])) $categories[$row['objectID']] = [];
$categories[$row['objectID']][] = $row['categoryID'];
}
// get images
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('user_gallery.photoID IN (?)', array($imageIDs));
+ $conditionBuilder->add('user_gallery.photoID IN (?)', [$imageIDs]);
$sql = "SELECT user_gallery.*
FROM wcf".$this->dbNo."_user_gallery user_gallery
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $additionalData = array(
- 'fileLocation' => $this->fileSystemPath . 'images/photos/photo-' . $row['photoID'] . ($row['photoHash'] ? ('-' . $row['photoHash']) : '') . '.' . $row['fileExtension']
- );
+ $additionalData = [
+ 'fileLocation' => $this->fileSystemPath . 'images/photos/photo-' . $row['photoID'] . ($row['photoHash'] ? ('-' . $row['photoHash']) : '') . '.' . $row['fileExtension']
+ ];
if (isset($tags[$row['photoID']])) $additionalData['tags'] = $tags[$row['photoID']];
if (isset($categories[$row['photoID']])) $additionalData['categories'] = array_unique($categories[$row['photoID']]);
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image')->import($row['photoID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image')->import($row['photoID'], [
'userID' => ($row['ownerID'] ?: null),
'username' => $row['username'],
'albumID' => ($row['albumID'] ?: null),
'latitude' => $row['latitude'],
'longitude' => $row['longitude'],
'ipAddress' => UserUtil::convertIPv4To6($row['ipAddress'])
- ), $additionalData);
+ ], $additionalData);
}
}
WHERE commentID BETWEEN ? AND ?
ORDER BY commentID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.comment')->import($row['commentID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.comment')->import($row['commentID'], [
'objectID' => $row['photoID'],
'userID' => ($row['userID'] ?: null),
'username' => $row['username'],
'message' => $row['comment'],
'time' => $row['time']
- ));
+ ]);
}
}
AND userID <> ?
AND rating NOT IN (?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('com.woltlab.wcf.user.gallery.photo', 0, 0, 3));
+ $statement->execute(['com.woltlab.wcf.user.gallery.photo', 0, 0, 3]);
$row = $statement->fetchArray();
return $row['count'];
}
AND rating.rating NOT IN (?, ?)
ORDER BY rating.objectID, rating.userID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('com.woltlab.wcf.user.gallery.photo', 0, 0, 3));
+ $statement->execute(['com.woltlab.wcf.user.gallery.photo', 0, 0, 3]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.like')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.like')->import(0, [
'objectID' => $row['objectID'],
'objectUserID' => ($row['objectUserID'] ?: null),
'userID' => $row['userID'],
'likeValue' => ($row['rating'] > 3 ? Like::LIKE : Like::DISLIKE)
- ));
+ ]);
}
}
WHERE calendarID IN (SELECT calendarID FROM wcf".$this->dbNo."_calendar_to_group)
AND className <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('BirthdayEvent'));
+ $statement->execute(['BirthdayEvent']);
$row = $statement->fetchArray();
return $row['count'];
}
AND className <> ?
ORDER BY calendarID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('BirthdayEvent'));
+ $statement->execute(['BirthdayEvent']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.category')->import($row['calendarID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.category')->import($row['calendarID'], [
'title' => $row['title'],
'parentCategoryID' => 0,
'showOrder' => 0
- ));
+ ]);
}
}
WHERE calendar_event.eventID BETWEEN ? AND ?
ORDER BY calendar_event.eventID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$oldEventDateData = @unserialize($row['eventDate']);
$repeatType = '';
$repeatMonthlyByMonthDay = $repeatMonthlyByWeekDay = $repeatMonthlyDayOffset = 1;
$repeatYearlyByMonthDay = $repeatYearlyByWeekDay = $repeatYearlyDayOffset = $repeatYearlyByMonth = 1;
- $repeatWeeklyByDay = array();
+ $repeatWeeklyByDay = [];
$dateTime = DateUtil::getDateTimeByTimestamp($oldEventDateData['startTime']);
if ($oldEventDateData['repeatType'] != 'no') {
$repeatType = $oldEventDateData['repeatType'];
$repeatWeeklyByDay = $oldEventDateData['repeatByDay'];
}
else {
- $repeatWeeklyByDay = array($dateTime->format('w'));
+ $repeatWeeklyByDay = [$dateTime->format('w')];
}
}
if (isset($oldEventDateData['repeatEndCount']) && $oldEventDateData['repeatEndCount'] < $repeatEndCount) $repeatEndCount = $oldEventDateData['repeatEndCount'];
$repeatEndDate = 1395415497;
if (isset($oldEventDateData['repeatEndTime']) && $oldEventDateData['repeatEndTime'] < $repeatEndDate) $repeatEndDate = $oldEventDateData['repeatEndTime'];
- $eventDateData = array(
+ $eventDateData = [
'startTime' => $oldEventDateData['startTime'],
'endTime' => $oldEventDateData['endTime'],
'isFullDay' => $oldEventDateData['isFullDay'],
'repeatEndType' => $repeatEndType,
'repeatEndCount' => $repeatEndCount,
'repeatEndDate' => $repeatEndDate
- );
+ ];
- $data = array(
+ $data = [
'userID' => ($row['userID'] ?: null),
'username' => $row['username'],
'location' => $row['location'],
'enableBBCodes' => $row['enableBBCodes'],
'showSignature' => $row['showSignature'],
'eventDate' => serialize($eventDateData)
- );
+ ];
if ($row['participationID']) {
$data['enableParticipation'] = 1;
$data['participationEndTime'] = $row['endTime'];
$data['participationIsPublic'] = $row['isPublic'];
}
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event')->import($row['eventID'], $data, array('categories' => array($row['calendarID'])));
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event')->import($row['eventID'], $data, ['categories' => [$row['calendarID']]]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date')->import($row['eventID'] . '-' . $row['startTime'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date')->import($row['eventID'] . '-' . $row['startTime'], [
'eventID' => $row['eventID'],
'startTime' => $row['startTime'],
'endTime' => $row['endTime'],
'isFullDay' => $row['isFullDay']
- ));
+ ]);
}
}
$statement->execute();
while ($row = $statement->fetchArray()) {
// get first event date
- $firstEventDateStatement->execute(array($row['eventID']));
+ $firstEventDateStatement->execute([$row['eventID']]);
$startTime = $firstEventDateStatement->fetchColumn();
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.comment')->import($row['messageID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.comment')->import($row['messageID'], [
'objectID' => $row['eventID'] . '-' . $startTime,
'userID' => $row['userID'],
'username' => $row['username'],
'message' => $row['message'],
'time' => $row['time']
- ));
+ ]);
}
}
$statement->execute();
while ($row = $statement->fetchArray()) {
// get first event date
- $firstEventDateStatement->execute(array($row['eventID']));
+ $firstEventDateStatement->execute([$row['eventID']]);
$startTime = $firstEventDateStatement->fetchColumn();
if (!$startTime) continue;
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.participation')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.participation')->import(0, [
'eventDateID' => $row['eventID'] . '-' . $startTime,
'userID' => $row['userID'],
'username' => $row['username'],
'decision' => $row['decision'],
'decisionTime' => $row['decisionTime']
- ));
+ ]);
}
}
AND messageID > ?";
}
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($type, 0));
+ $statement->execute([$type, 0]);
$row = $statement->fetchArray();
return $row['count'];
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($type, 0));
+ $statement->execute([$type, 0]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'attachments/attachment-'.$row['attachmentID'];
- ImportHandler::getInstance()->getImporter($objectType)->import($row['attachmentID'], array(
+ ImportHandler::getInstance()->getImporter($objectType)->import($row['attachmentID'], [
'objectID' => (!empty($row['containerID']) ? $row['containerID'] : $row['messageID']),
'userID' => ($row['userID'] ?: null),
'filename' => $row['attachmentName'],
'lastDownloadTime' => $row['lastDownloadTime'],
'uploadTime' => $row['uploadTime'],
'showOrder' => (!empty($row['showOrder']) ? $row['showOrder'] : 0)
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
* @return array
*/
private function getExistingUserOptions() {
- $optionsNames = array();
+ $optionsNames = [];
$sql = "SELECT optionName
FROM wcf".WCF_N."_user_option
WHERE optionName NOT LIKE ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array('option%'));
+ $statement->execute(['option%']);
while ($row = $statement->fetchArray()) {
$optionsNames[] = $row['optionName'];
}
FROM wcf".$this->dbNo."_package
WHERE package = ?";
$statement = $this->database->prepareStatement($sql, 1);
- $statement->execute(array($name));
+ $statement->execute([$name]);
$row = $statement->fetchArray();
if ($row !== false) return $row['packageVersion'];
}
private function getTags($name, array $objectIDs) {
- $tags = array();
+ $tags = [];
if (substr($this->getPackageVersion('com.woltlab.wcf'), 0, 3) == '1.1' && $this->getPackageVersion('com.woltlab.wcf.tagging')) {
// get taggable id
$sql = "SELECT taggableID
WHERE name = ?
ORDER BY packageID";
$statement = $this->database->prepareStatement($sql, 1);
- $statement->execute(array($name));
+ $statement->execute([$name]);
$taggableID = $statement->fetchColumn();
if ($taggableID) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('tag_to_object.taggableID = ?', array($taggableID));
- $conditionBuilder->add('tag_to_object.objectID IN (?)', array($objectIDs));
+ $conditionBuilder->add('tag_to_object.taggableID = ?', [$taggableID]);
+ $conditionBuilder->add('tag_to_object.objectID IN (?)', [$objectIDs]);
$sql = "SELECT tag.name, tag_to_object.objectID
FROM wcf".$this->dbNo."_tag_to_object tag_to_object
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($tags[$row['objectID']])) $tags[$row['objectID']] = array();
+ if (!isset($tags[$row['objectID']])) $tags[$row['objectID']] = [];
$tags[$row['objectID']][] = $row['name'];
}
}
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.calendar.event.date.comment.response' => 'CalendarEventDateCommentResponses',
'com.woltlab.calendar.event.date.participation' => 'CalendarEventDateParticipation',
'com.woltlab.calendar.event.like' => 'CalendarEventLikes'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 100,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.conversation.attachment' => 100,
'com.woltlab.wbb.thread' => 200,
'com.woltlab.wbb.attachment' => 100,
'com.woltlab.wbb.acl' => 50
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::init()
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- $supportedData = array(
- 'com.woltlab.wcf.user' => array(
+ $supportedData = [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wbb.like',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.attachment',
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.blog.entry' => array(
+ ],
+ 'com.woltlab.blog.entry' => [
'com.woltlab.blog.category',
'com.woltlab.blog.entry.attachment',
'com.woltlab.blog.entry.comment',
'com.woltlab.blog.entry.like'
- ),
- 'com.woltlab.calendar.event' => array(
+ ],
+ 'com.woltlab.calendar.event' => [
'com.woltlab.calendar.category',
'com.woltlab.calendar.event.attachment',
'com.woltlab.calendar.event.date.comment',
'com.woltlab.calendar.event.date.participation',
'com.woltlab.calendar.event.like'
- ),
- 'com.woltlab.wcf.smiley' => array(),
- );
+ ],
+ 'com.woltlab.wcf.smiley' => [],
+ ];
$gallery = PackageCache::getInstance()->getPackageByIdentifier('com.woltlab.gallery');
if ($gallery && Package::compareVersion('2.1.0 Alpha 1', $gallery->packageVersion) != 1) {
- $supportedData['com.woltlab.gallery.image'] = array(
+ $supportedData['com.woltlab.gallery.image'] = [
'com.woltlab.gallery.category',
'com.woltlab.gallery.album',
'com.woltlab.gallery.image.comment',
'com.woltlab.gallery.image.like',
'com.woltlab.gallery.image.marker'
- );
+ ];
}
return $supportedData;
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['groupID'], [
'groupName' => $row['groupName'],
'groupDescription' => $row['groupDescription'],
'groupType' => $row['groupType'],
'priority' => $row['priority'],
'userOnlineMarking' => (!empty($row['userOnlineMarking']) ? $row['userOnlineMarking'] : ''),
'showOnTeamPage' => (!empty($row['showOnTeamPage']) ? $row['showOnTeamPage'] : 0)
- ));
+ ]);
}
}
*/
public function exportUsers($offset, $limit) {
// cache existing user options
- $existingUserOptions = array();
+ $existingUserOptions = [];
$sql = "SELECT optionName, optionID
FROM wcf".WCF_N."_user_option
WHERE optionName NOT LIKE 'option%'";
}
// cache user options
- $userOptions = array();
+ $userOptions = [];
$sql = "SELECT optionName, optionID
FROM wcf".$this->dbNo."_user_option";
$statement = $this->database->prepareStatement($sql);
WHERE user_table.userID BETWEEN ? AND ?
ORDER BY user_table.userID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'profileHits' => $row['profileHits'],
'userTitle' => $row['userTitle'],
'lastActivityTime' => $row['lastActivityTime']
- );
- $additionalData = array(
+ ];
+ $additionalData = [
'groupIDs' => explode(',', $row['groupIDs']),
'languages' => explode(',', $row['languageCodes']),
- 'options' => array()
- );
+ 'options' => []
+ ];
// handle user options
foreach ($userOptions as $optionID => $optionName) {
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array($row['password'], $newUserID));
+ $passwordUpdateStatement->execute([$row['password'], $newUserID]);
}
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['rankID'], [
'groupID' => $row['groupID'],
'requiredPoints' => $row['requiredPoints'],
'rankTitle' => $row['rankTitle'],
'rankImage' => $row['rankImage'],
'repeatImage' => $row['repeatImage'],
'requiredGender' => $row['requiredGender']
- ));
+ ]);
}
}
WHERE followID BETWEEN ? AND ?
ORDER BY followID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['userID'],
'followUserID' => $row['followUserID'],
'time' => $row['time']
- ));
+ ]);
}
}
WHERE avatarID BETWEEN ? AND ?
ORDER BY avatarID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['avatarID'], [
'avatarName' => $row['avatarName'],
'avatarExtension' => $row['avatarExtension'],
'width' => $row['width'],
'fileHash' => $row['fileHash'],
'cropX' => $row['cropX'],
'cropY' => $row['cropY']
- ), array('fileLocation' => $this->fileSystemPath . 'images/avatars/' . substr($row['fileHash'], 0, 2) . '/' . $row['avatarID'] . '-' . $row['fileHash'] . '.' . $row['avatarExtension']));
+ ], ['fileLocation' => $this->fileSystemPath . 'images/avatars/' . substr($row['fileHash'], 0, 2) . '/' . $row['avatarID'] . '-' . $row['fileHash'] . '.' . $row['avatarExtension']]);
}
}
$optionsNames = $this->getExistingUserOptions();
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', array('profile'));
- if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', array($optionsNames));
+ $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', ['profile']);
+ if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', [$optionsNames]);
$sql = "SELECT COUNT(*) AS count
FROM wcf".$this->dbNo."_user_option
$optionsNames = $this->getExistingUserOptions();
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', array('profile'));
- if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', array($optionsNames));
+ $conditionBuilder->add('categoryName IN (SELECT categoryName FROM wcf'.$this->dbNo.'_user_option_category WHERE parentCategoryName = ?)', ['profile']);
+ if (!empty($optionsNames)) $conditionBuilder->add('optionName NOT IN (?)', [$optionsNames]);
$sql = "SELECT user_option.*, (
SELECT languageItemValue
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['optionID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['optionID'], [
'categoryName' => $row['categoryName'],
'optionType' => $row['optionType'],
'defaultValue' => $row['defaultValue'],
'editable' => $row['editable'],
'visible' => $row['visible'],
'showOrder' => $row['showOrder']
- ), array('name' => ($row['name'] ?: $row['optionName'])));
+ ], ['name' => ($row['name'] ?: $row['optionName'])]);
}
}
WHERE labelID BETWEEN ? AND ?
ORDER BY labelID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['labelID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['labelID'], [
'userID' => $row['userID'],
'label' => $row['label'],
'cssClassName' => $row['cssClassName']
- ));
+ ]);
}
}
WHERE conversationID BETWEEN ? AND ?
ORDER BY conversationID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['conversationID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['conversationID'], [
'subject' => $row['subject'],
'time' => $row['time'],
'userID' => $row['userID'],
'isClosed' => $row['isClosed'],
'isDraft' => $row['isDraft'],
'draftData' => $row['draftData']
- ));
+ ]);
}
}
WHERE messageID BETWEEN ? AND ?
ORDER BY messageID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['messageID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['messageID'], [
'conversationID' => $row['conversationID'],
'userID' => $row['userID'],
'username' => $row['username'],
'enableBBCodes' => $row['enableBBCodes'],
'showSignature' => $row['showSignature'],
'ipAddress' => $row['ipAddress']
- ));
+ ]);
}
}
* Exports conversation recipients.
*/
public function exportConversationUsers($offset, $limit) {
- $conversationIDs = $userID = $rows = array();
+ $conversationIDs = $userID = $rows = [];
$sql = "SELECT *
FROM wcf".$this->dbNo."_conversation_to_user
ORDER BY conversationID, participantID";
}
// get labels
- $labels = array();
+ $labels = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('label.labelID = label_to_object.labelID');
- $conditionBuilder->add('label_to_object.conversationID IN (?)', array($conversationIDs));
- $conditionBuilder->add('label.userID IN (?)', array($userIDs));
+ $conditionBuilder->add('label_to_object.conversationID IN (?)', [$conversationIDs]);
+ $conditionBuilder->add('label.userID IN (?)', [$userIDs]);
$sql = "SELECT label_to_object.conversationID, label.userID, label.labelID
FROM wcf".$this->dbNo."_conversation_label_to_object label_to_object,
}
foreach ($rows as $row) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['conversationID'],
'participantID' => $row['participantID'],
'username' => $row['username'],
'hideConversation' => $row['hideConversation'],
'isInvisible' => $row['isInvisible'],
'lastVisitTime' => $row['lastVisitTime']
- ), array('labelIDs' => (isset($labels[$row['conversationID']][$row['participantID']]) ? $labels[$row['conversationID']][$row['participantID']] : array())));
+ ], ['labelIDs' => (isset($labels[$row['conversationID']][$row['participantID']]) ? $labels[$row['conversationID']][$row['participantID']] : [])]);
}
}
if (!isset($this->boardCache[$parentID])) return;
foreach ($this->boardCache[$parentID] as $board) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($board['boardID'], [
'parentID' => $board['parentID'],
'position' => $board['position'],
'boardType' => $board['boardType'],
'clicks' => $board['clicks'],
'posts' => $board['posts'],
'threads' => $board['threads']
- ));
+ ]);
$this->exportBoardsRecursively($board['boardID']);
}
*/
public function exportThreads($offset, $limit) {
// get thread ids
- $threadIDs = $announcementIDs = array();
+ $threadIDs = $announcementIDs = [];
$sql = "SELECT threadID, isAnnouncement
FROM wbb".$this->dbNo."_thread
WHERE threadID BETWEEN ? AND ?
ORDER BY threadID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$threadIDs[] = $row['threadID'];
if ($row['isAnnouncement']) $announcementIDs[] = $row['threadID'];
if (empty($threadIDs)) return;
// get assigned boards (for announcements)
- $assignedBoards = array();
+ $assignedBoards = [];
if (!empty($announcementIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadID IN (?)', array($announcementIDs));
+ $conditionBuilder->add('threadID IN (?)', [$announcementIDs]);
$sql = "SELECT boardID, threadID
FROM wbb".$this->dbNo."_thread_announcement
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($assignedBoards[$row['threadID']])) $assignedBoards[$row['threadID']] = array();
+ if (!isset($assignedBoards[$row['threadID']])) $assignedBoards[$row['threadID']] = [];
$assignedBoards[$row['threadID']][] = $row['boardID'];
}
}
// get threads
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('threadID IN (?)', array($threadIDs));
+ $conditionBuilder->add('threadID IN (?)', [$threadIDs]);
$sql = "SELECT thread.*, language.languageCode
FROM wbb".$this->dbNo."_thread thread
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['boardID'],
'topic' => $row['topic'],
'time' => $row['time'],
'deleteTime' => $row['deleteTime'],
'lastPostTime' => $row['lastPostTime'],
'hasLabels' => $row['hasLabels']
- );
- $additionalData = array();
+ ];
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
if (!empty($assignedBoards[$row['threadID']])) $additionalData['assignedBoards'] = $assignedBoards[$row['threadID']];
if (isset($labels[$row['threadID']])) $additionalData['labels'] = $labels[$row['threadID']];
WHERE postID BETWEEN ? AND ?
ORDER BY postID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postID'], [
'threadID' => $row['threadID'],
'userID' => $row['userID'],
'username' => $row['username'],
'showSignature' => $row['showSignature'],
'ipAddress' => $row['ipAddress'],
'deleteTime' => $row['deleteTime']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_user_object_watch
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread')]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE objectTypeID = ?
ORDER BY watchID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread')]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['objectID'],
'userID' => $row['userID'],
'notification' => $row['notification']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_poll
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE objectTypeID = ?
ORDER BY pollID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['pollID'], [
'objectID' => $row['objectID'],
'question' => $row['question'],
'time' => $row['time'],
'resultsRequireVote' => $row['resultsRequireVote'],
'maxVotes' => $row['maxVotes'],
'votes' => $row['votes']
- ));
+ ]);
}
}
WHERE objectTypeID = ?
)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
$row = $statement->fetchArray();
return $row['count'];
}
)
ORDER BY optionID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['optionID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['optionID'], [
'pollID' => $row['pollID'],
'optionValue' => $row['optionValue'],
'showOrder' => $row['showOrder'],
'votes' => $row['votes']
- ));
+ ]);
}
}
WHERE objectTypeID = ?
)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
$row = $statement->fetchArray();
return $row['count'];
}
)
ORDER BY optionID, userID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.poll', 'com.woltlab.wbb.post')]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['pollID'],
'optionID' => $row['optionID'],
'userID' => $row['userID']
- ));
+ ]);
}
}
*/
public function exportLabels($offset, $limit) {
// get labels array($this->getObjectTypeID('com.woltlab.wcf.label.object', 'com.woltlab.wbb.thread'))
- $labels = array();
+ $labels = [];
$sql = "SELECT *
FROM wcf".$this->dbNo."_label";
$statement = $this->database->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
- if (!isset($labels[$row['groupID']])) $labels[$row['groupID']] = array();
+ if (!isset($labels[$row['groupID']])) $labels[$row['groupID']] = [];
$labels[$row['groupID']][] = $row;
}
// get label groups
- $labelGroups = array();
+ $labelGroups = [];
$sql = "SELECT *
FROM wcf".$this->dbNo."_label_group";
$statement = $this->database->prepareStatement($sql);
}
// get board ids
- $boardIDs = array();
+ $boardIDs = [];
$sql = "SELECT *
FROM wcf".$this->dbNo."_label_group_to_object
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.label.objectType', 'com.woltlab.wbb.board')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.label.objectType', 'com.woltlab.wbb.board')]);
while ($row = $statement->fetchArray()) {
- if (!isset($boardIDs[$row['groupID']])) $boardIDs[$row['groupID']] = array();
+ if (!isset($boardIDs[$row['groupID']])) $boardIDs[$row['groupID']] = [];
$boardIDs[$row['groupID']][] = $row['objectID'];
}
foreach ($labelGroups as $labelGroup) {
// import label group
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($labelGroup['groupID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($labelGroup['groupID'], [
'groupName' => $labelGroup['groupName']
- ), array('objects' => array($objectType->objectTypeID => (!empty($boardIDs[$labelGroup['groupID']]) ? $boardIDs[$labelGroup['groupID']] : array()))));
+ ], ['objects' => [$objectType->objectTypeID => (!empty($boardIDs[$labelGroup['groupID']]) ? $boardIDs[$labelGroup['groupID']] : [])]]);
// import labels
if (!empty($labels[$labelGroup['groupID']])) {
foreach ($labels[$labelGroup['groupID']] as $label) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($label['labelID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($label['labelID'], [
'groupID' => $labelGroup['groupID'],
'label' => $label['label'],
'cssClassName' => $label['cssClassName']
- ));
+ ]);
}
}
}
)
ORDER BY optionID, objectID, userID, groupID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($objectTypeID, $objectTypeID));
+ $statement->execute([$objectTypeID, $objectTypeID]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'objectID' => $row['objectID'],
'optionValue' => $row['optionValue']
- );
+ ];
if ($row['userID']) $data['userID'] = $row['userID'];
if ($row['groupID']) $data['groupID'] = $row['groupID'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, $data, array('optionName' => $row['optionName']));
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, $data, ['optionName' => $row['optionName']]);
}
}
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath . $row['smileyPath'];
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smileyID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley')->import($row['smileyID'], [
'categoryID' => $row['categoryID'],
'smileyTitle' => $row['smileyTitle'],
'smileyCode' => $row['smileyCode'],
'aliases' => $row['aliases'],
'showOrder' => $row['showOrder']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
FROM wcf".$this->dbNo."_category
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley')]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE objectTypeID = ?
ORDER BY categoryID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley')));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley')]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['categoryID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.smiley.category')->import($row['categoryID'], [
'title' => $row['title'],
'description' => $row['description'],
'parentCategoryID' => 0,
'showOrder' => $row['showOrder'],
'time' => $row['time'],
'isDisabled' => $row['isDisabled']
- ));
+ ]);
}
}
WHERE blogID BETWEEN ? AND ?
ORDER BY blogID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.blog')->import($row['blogID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.blog')->import($row['blogID'], [
'userID' => $row['userID'],
'username' => $row['username'],
'title' => $row['title'],
'description' => $row['description'],
'accessLevel' => $row['accessLevel'],
'isFeatured' => $row['isFeatured']
- ), $additionalData);
+ ], $additionalData);
}
}
$destVersion21 = version_compare(BLOGCore::getInstance()->getPackage()->packageVersion, '2.1.0 Alpha 1', '>=');
// get entry ids
- $entryIDs = array();
+ $entryIDs = [];
$sql = "SELECT entryID
FROM blog".$this->dbNo."_entry
WHERE entryID BETWEEN ? AND ?
ORDER BY entryID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$entryIDs[] = $row['entryID'];
}
$tags = $this->getTags('com.woltlab.blog.entry', $entryIDs);
// get categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('entryID IN (?)', array($entryIDs));
+ $conditionBuilder->add('entryID IN (?)', [$entryIDs]);
$sql = "SELECT *
FROM blog".$this->dbNo."_entry_to_category
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($categories[$row['entryID']])) $categories[$row['entryID']] = array();
+ if (!isset($categories[$row['entryID']])) $categories[$row['entryID']] = [];
$categories[$row['entryID']][] = $row['categoryID'];
}
// get entries
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('entry.entryID IN (?)', array($entryIDs));
+ $conditionBuilder->add('entry.entryID IN (?)', [$entryIDs]);
$sql = "SELECT entry.*, language.languageCode
FROM blog".$this->dbNo."_entry entry
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
if (isset($tags[$row['entryID']])) $additionalData['tags'] = $tags[$row['entryID']];
if (isset($categories[$row['entryID']])) $additionalData['categories'] = $categories[$row['entryID']];
- $data = array(
+ $data = [
'userID' => $row['userID'],
'username' => $row['username'],
'subject' => $row['subject'],
'publicationDate' => $row['publicationDate'],
'ipAddress' => $row['ipAddress'],
'deleteTime' => $row['deleteTime']
- );
+ ];
if ($sourceVersion21 && $destVersion21) {
$data['blogID'] = $row['blogID'];
WHERE albumID BETWEEN ? AND ?
ORDER BY albumID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'userID' => $row['userID'],
'username' => ($row['username'] ?: ''),
'title' => $row['title'],
'description' => $row['description'],
'lastUpdateTime' => $row['lastUpdateTime']
- );
+ ];
if ($sourceVersion21 && $destVersion21) {
$data['accessLevel'] = $row['accessLevel'];
FROM wcf".$this->dbNo."_package
WHERE package = ?";
$statement = $this->database->prepareStatement($sql, 1);
- $statement->execute(array('com.woltlab.gallery'));
+ $statement->execute(['com.woltlab.gallery']);
$packageDir = $statement->fetchColumn();
$imageFilePath = FileUtil::getRealPath($this->fileSystemPath.'/'.$packageDir);
WHERE imageID BETWEEN ? AND ?
ORDER BY imageID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
- $imageIDs = $images = array();
+ $imageIDs = $images = [];
while ($row = $statement->fetchArray()) {
$imageIDs[] = $row['imageID'];
- $images[$row['imageID']] = array(
+ $images[$row['imageID']] = [
'tmpHash' => $row['tmpHash'],
'userID' => $row['userID'],
'username' => $row['username'],
'isDeleted' => $row['isDeleted'],
'deleteTime' => $row['deleteTime'],
'exifData' => $row['exifData'],
- );
+ ];
if ($sourceVersion21 && $destVersion21) {
- $images[$row['imageID']] = array_merge($images[$row['imageID']], array(
+ $images[$row['imageID']] = array_merge($images[$row['imageID']], [
'enableSmilies' => $row['enableSmilies'],
'enableHtml' => $row['enableHtml'],
'enableBBCodes' => $row['enableBBCodes'],
'hasMarkers' => $row['hasMarkers'],
'showOrder' => $row['showOrder'],
'hasOriginalWatermark' => $row['hasOriginalWatermark']
- ));
+ ]);
}
}
$tags = $this->getTags('com.woltlab.gallery.image', $imageIDs);
// fetch categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('imageID IN (?)', array($imageIDs));
+ $conditionBuilder->add('imageID IN (?)', [$imageIDs]);
$sql = "SELECT *
FROM gallery".$this->dbNo."_image_to_category
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($categories[$row['imageID']])) {
- $categories[$row['imageID']] = array();
+ $categories[$row['imageID']] = [];
}
$categories[$row['imageID']][] = $row['categoryID'];
}
foreach ($images as $imageID => $imageData) {
- $additionalData = array(
+ $additionalData = [
'fileLocation' => $imageFilePath .'/userImages/' . substr($imageData['fileHash'], 0, 2) . '/' . ($imageID) . '-' . $imageData['fileHash'] . '.' . $imageData['fileExtension']
- );
+ ];
if (isset($categories[$imageID])) {
$additionalData['categories'] = $categories[$imageID];
WHERE markerID BETWEEN ? AND ?
ORDER BY markerID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.marker')->import($row['markerID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.gallery.image.marker')->import($row['markerID'], [
'imageID' => $row['imageID'],
'positionX' => $row['positionX'],
'positionY' => $row['positionY'],
'userID' => $row['userID'],
'description' => $row['description']
- ));
+ ]);
}
}
*/
public function exportCalendarEvents($offset, $limit) {
// get event ids
- $eventIDs = array();
+ $eventIDs = [];
$sql = "SELECT eventID
FROM calendar".$this->dbNo."_event
WHERE eventID BETWEEN ? AND ?
ORDER BY eventID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
$eventIDs[] = $row['eventID'];
}
$tags = $this->getTags('com.woltlab.calendar.event', $eventIDs);
// get categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('eventID IN (?)', array($eventIDs));
+ $conditionBuilder->add('eventID IN (?)', [$eventIDs]);
$sql = "SELECT *
FROM calendar".$this->dbNo."_event_to_category
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($categories[$row['eventID']])) $categories[$row['eventID']] = array();
+ if (!isset($categories[$row['eventID']])) $categories[$row['eventID']] = [];
$categories[$row['eventID']][] = $row['categoryID'];
}
// get event
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('event.eventID IN (?)', array($eventIDs));
+ $conditionBuilder->add('event.eventID IN (?)', [$eventIDs]);
$sql = "SELECT event.*, language.languageCode
FROM calendar".$this->dbNo."_event event
LEFT JOIN wcf".$this->dbNo."_language language
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if ($row['languageCode']) $additionalData['languageCode'] = $row['languageCode'];
if (isset($tags[$row['eventID']])) $additionalData['tags'] = $tags[$row['eventID']];
if (isset($categories[$row['eventID']])) $additionalData['categories'] = $categories[$row['eventID']];
- $data = array(
+ $data = [
'userID' => $row['userID'],
'username' => $row['username'],
'subject' => $row['subject'],
'maxCompanions' => $row['maxCompanions'],
'participationIsChangeable' => $row['participationIsChangeable'],
'participationIsPublic' => $row['participationIsPublic']
- );
+ ];
ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event')->import($row['eventID'], $data, $additionalData);
}
WHERE eventDateID BETWEEN ? AND ?
ORDER BY eventDateID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date')->import($row['eventDateID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date')->import($row['eventDateID'], [
'eventID' => $row['eventID'],
'startTime' => $row['startTime'],
'endTime' => $row['endTime'],
'isFullDay' => $row['isFullDay'],
'participants' => $row['participants']
- ));
+ ]);
}
}
WHERE participationID BETWEEN ? AND ?
ORDER BY participationID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.participation')->import($row['participationID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.calendar.event.date.participation')->import($row['participationID'], [
'eventDateID' => $row['eventDateID'],
'userID' => $row['userID'],
'username' => $row['username'],
'decisionTime' => $row['decisionTime'],
'participants' => $row['participants'],
'message' => $row['message']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_comment
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE objectTypeID = ?
ORDER BY commentID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter($importer)->import($row['commentID'], array(
+ ImportHandler::getInstance()->getImporter($importer)->import($row['commentID'], [
'objectID' => $row['objectID'],
'userID' => $row['userID'],
'username' => $row['username'],
'message' => $row['message'],
'time' => $row['time']
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_comment_response
WHERE commentID IN (SELECT commentID FROM wcf".$this->dbNo."_comment WHERE objectTypeID = ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE commentID IN (SELECT commentID FROM wcf".$this->dbNo."_comment WHERE objectTypeID = ?)
ORDER BY responseID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.comment.commentableContent', $objectType)]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter($importer)->import($row['responseID'], array(
+ ImportHandler::getInstance()->getImporter($importer)->import($row['responseID'], [
'commentID' => $row['commentID'],
'time' => $row['time'],
'userID' => $row['userID'],
'username' => $row['username'],
'message' => $row['message'],
- ));
+ ]);
}
}
FROM wcf".$this->dbNo."_like
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.like.likeableObject', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.like.likeableObject', $objectType)]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE objectTypeID = ?
ORDER BY likeID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.like.likeableObject', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.like.likeableObject', $objectType)]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter($importer)->import(0, array(
+ ImportHandler::getInstance()->getImporter($importer)->import(0, [
'objectID' => $row['objectID'],
'objectUserID' => $row['objectUserID'],
'userID' => $row['userID'],
'likeValue' => $row['likeValue'],
'time' => $row['time']
- ));
+ ]);
}
}
WHERE objectTypeID = ?
AND objectID IS NOT NULL";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.attachment.objectType', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.attachment.objectType', $objectType)]);
$row = $statement->fetchArray();
return $row['count'];
}
AND objectID IS NOT NULL
ORDER BY attachmentID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.attachment.objectType', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.attachment.objectType', $objectType)]);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath . 'attachments/' . substr($row['fileHash'], 0, 2) . '/' . $row['attachmentID'] . '-' . $row['fileHash'];
- ImportHandler::getInstance()->getImporter($importer)->import($row['attachmentID'], array(
+ ImportHandler::getInstance()->getImporter($importer)->import($row['attachmentID'], [
'objectID' => $row['objectID'],
'userID' => ($row['userID'] ?: null),
'filename' => $row['filename'],
'lastDownloadTime' => $row['lastDownloadTime'],
'uploadTime' => $row['uploadTime'],
'showOrder' => $row['showOrder']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
* @return array
*/
private function getExistingUserOptions() {
- $optionsNames = array();
+ $optionsNames = [];
$sql = "SELECT optionName
FROM wcf".WCF_N."_user_option
WHERE optionName NOT LIKE ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array('option%'));
+ $statement->execute(['option%']);
while ($row = $statement->fetchArray()) {
$optionsNames[] = $row['optionName'];
}
FROM wcf".$this->dbNo."_package
WHERE package = ?";
$statement = $this->database->prepareStatement($sql, 1);
- $statement->execute(array($name));
+ $statement->execute([$name]);
$row = $statement->fetchArray();
if ($row !== false) return $row['packageVersion'];
}
private function getTags($objectType, array $objectIDs) {
- $tags = array();
+ $tags = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('tag_to_object.objectTypeID = ?', array($this->getObjectTypeID('com.woltlab.wcf.tagging.taggableObject', $objectType)));
- $conditionBuilder->add('tag_to_object.objectID IN (?)', array($objectIDs));
+ $conditionBuilder->add('tag_to_object.objectTypeID = ?', [$this->getObjectTypeID('com.woltlab.wcf.tagging.taggableObject', $objectType)]);
+ $conditionBuilder->add('tag_to_object.objectID IN (?)', [$objectIDs]);
$sql = "SELECT tag.name, tag_to_object.objectID
FROM wcf".$this->dbNo."_tag_to_object tag_to_object
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($tags[$row['objectID']])) $tags[$row['objectID']] = array();
+ if (!isset($tags[$row['objectID']])) $tags[$row['objectID']] = [];
$tags[$row['objectID']][] = $row['name'];
}
}
private function getLabels($objectType, array $objectIDs) {
- $labels = array();
+ $labels = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('objectTypeID = ?', array($this->getObjectTypeID('com.woltlab.wcf.label.object', $objectType)));
- $conditionBuilder->add('objectID IN (?)', array($objectIDs));
+ $conditionBuilder->add('objectTypeID = ?', [$this->getObjectTypeID('com.woltlab.wcf.label.object', $objectType)]);
+ $conditionBuilder->add('objectID IN (?)', [$objectIDs]);
$sql = "SELECT labelID, objectID
FROM wcf".$this->dbNo."_label_object
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($labels[$row['objectID']])) $labels[$row['objectID']] = array();
+ if (!isset($labels[$row['objectID']])) $labels[$row['objectID']] = [];
$labels[$row['objectID']][] = $row['labelID'];
}
SELECT definitionID FROM wcf".$this->dbNo."_object_type_definition WHERE definitionName = ?
)";
$statement = $this->database->prepareStatement($sql, 1);
- $statement->execute(array($objectTypeName, $definitionName));
+ $statement->execute([$objectTypeName, $definitionName]);
$row = $statement->fetchArray();
if ($row !== false) return $row['objectTypeID'];
FROM wcf".$this->dbNo."_category
WHERE objectTypeID = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.category', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.category', $objectType)]);
return $statement->fetchColumn();
}
WHERE objectTypeID = ?
ORDER BY parentCategoryID, categoryID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($this->getObjectTypeID('com.woltlab.wcf.category', $objectType)));
+ $statement->execute([$this->getObjectTypeID('com.woltlab.wcf.category', $objectType)]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter($importer)->import($row['categoryID'], array(
+ ImportHandler::getInstance()->getImporter($importer)->import($row['categoryID'], [
'title' => $row['title'],
'description' => $row['description'],
'parentCategoryID' => $row['parentCategoryID'],
'showOrder' => $row['showOrder'],
'time' => $row['time'],
'isDisabled' => $row['isDisabled']
- ));
+ ]);
}
}
}
* category cache
* @var array
*/
- protected $categoryCache = array();
+ protected $categoryCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.blog.category' => 'BlogCategories',
'com.woltlab.blog.entry' => 'BlogEntries',
'com.woltlab.blog.entry.comment' => 'BlogComments',
'com.woltlab.blog.entry.attachment' => 'BlogAttachments'
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
- ),
- 'com.woltlab.blog.entry' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
+ ],
+ 'com.woltlab.blog.entry' => [
'com.woltlab.blog.category',
'com.woltlab.blog.entry.comment',
'com.woltlab.blog.entry.attachment'
- )
- );
+ ]
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
WHERE ID BETWEEN ? AND ?
ORDER BY ID";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['user_login'],
'password' => '',
'email' => $row['user_email'],
'registrationDate' => @strtotime($row['user_registered'])
- );
+ ];
// import user
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['ID'], $data);
// update password hash
if ($newUserID) {
- $passwordUpdateStatement->execute(array('phpass:'.$row['user_pass'].':', $newUserID));
+ $passwordUpdateStatement->execute(['phpass:'.$row['user_pass'].':', $newUserID]);
}
}
}
FROM ".$this->databasePrefix."term_taxonomy
WHERE taxonomy = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('category'));
+ $statement->execute(['category']);
$row = $statement->fetchArray();
return ($row['count'] ? 1 : 0);
}
WHERE term_taxonomy.taxonomy = ?
ORDER BY term_taxonomy.parent, term_taxonomy.term_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('category'));
+ $statement->execute(['category']);
while ($row = $statement->fetchArray()) {
$this->categoryCache[$row['parent']][] = $row;
}
if (!isset($this->categoryCache[$parentID])) return;
foreach ($this->categoryCache[$parentID] as $category) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($category['term_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($category['term_id'], [
'title' => StringUtil::decodeHTML($category['name']),
'parentCategoryID' => $category['parent'],
'showOrder' => 0
- ));
+ ]);
$this->exportBlogCategoriesRecursively($category['term_id']);
}
FROM ".$this->databasePrefix."posts
WHERE post_type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('post'));
+ $statement->execute(['post']);
$row = $statement->fetchArray();
return $row['count'];
}
*/
public function exportBlogEntries($offset, $limit) {
// get entry ids
- $entryIDs = array();
+ $entryIDs = [];
$sql = "SELECT ID
FROM ".$this->databasePrefix."posts
WHERE post_type = ?
AND post_status IN (?, ?, ?, ?, ?, ?)
ORDER BY ID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('post', 'publish', 'pending', 'draft', 'future', 'private', 'trash'));
+ $statement->execute(['post', 'publish', 'pending', 'draft', 'future', 'private', 'trash']);
while ($row = $statement->fetchArray()) {
$entryIDs[] = $row['ID'];
}
// get tags
- $tags = array();
+ $tags = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('term_taxonomy.term_taxonomy_id = term_relationships.term_taxonomy_id');
- $conditionBuilder->add('term_relationships.object_id IN (?)', array($entryIDs));
- $conditionBuilder->add('term_taxonomy.taxonomy = ?', array('post_tag'));
+ $conditionBuilder->add('term_relationships.object_id IN (?)', [$entryIDs]);
+ $conditionBuilder->add('term_taxonomy.taxonomy = ?', ['post_tag']);
$conditionBuilder->add('term.term_id IS NOT NULL');
$sql = "SELECT term.name, term_relationships.object_id
FROM ".$this->databasePrefix."term_relationships term_relationships,
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($tags[$row['object_id']])) $tags[$row['object_id']] = array();
+ if (!isset($tags[$row['object_id']])) $tags[$row['object_id']] = [];
$tags[$row['object_id']][] = $row['name'];
}
// get categories
- $categories = array();
+ $categories = [];
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('term_taxonomy.term_taxonomy_id = term_relationships.term_taxonomy_id');
- $conditionBuilder->add('term_relationships.object_id IN (?)', array($entryIDs));
- $conditionBuilder->add('term_taxonomy.taxonomy = ?', array('category'));
+ $conditionBuilder->add('term_relationships.object_id IN (?)', [$entryIDs]);
+ $conditionBuilder->add('term_taxonomy.taxonomy = ?', ['category']);
$sql = "SELECT term_taxonomy.term_id, term_relationships.object_id
FROM ".$this->databasePrefix."term_relationships term_relationships,
".$this->databasePrefix."term_taxonomy term_taxonomy
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- if (!isset($categories[$row['object_id']])) $categories[$row['object_id']] = array();
+ if (!isset($categories[$row['object_id']])) $categories[$row['object_id']] = [];
$categories[$row['object_id']][] = $row['term_id'];
}
// get entries
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('post.ID IN (?)', array($entryIDs));
+ $conditionBuilder->add('post.ID IN (?)', [$entryIDs]);
$sql = "SELECT post.*, user.user_login
FROM ".$this->databasePrefix."posts post
$statement = $this->database->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if (isset($tags[$row['ID']])) $additionalData['tags'] = $tags[$row['ID']];
if (isset($categories[$row['ID']])) $additionalData['categories'] = $categories[$row['ID']];
$time = @strtotime($row['post_date_gmt']);
if (!$time) $time = @strtotime($row['post_date']);
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['ID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['ID'], [
'userID' => ($row['post_author'] ?: null),
'username' => ($row['user_login'] ?: ''),
'subject' => $row['post_title'],
'enableBBCodes' => 0,
'isPublished' => ($row['post_status'] == 'publish' ? 1 : 0),
'isDeleted' => ($row['post_status'] == 'trash' ? 1 : 0)
- ), $additionalData);
+ ], $additionalData);
}
}
FROM ".$this->databasePrefix."comments
WHERE comment_approved = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(1));
+ $statement->execute([1]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE comment_approved = ?
ORDER BY comment_parent, comment_ID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(1));
+ $statement->execute([1]);
while ($row = $statement->fetchArray()) {
if (!$row['comment_parent']) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['comment_ID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['comment_ID'], [
'objectID' => $row['comment_post_ID'],
'userID' => ($row['user_id'] ?: null),
'username' => $row['comment_author'],
'message' => StringUtil::decodeHTML($row['comment_content']),
'time' => @strtotime($row['comment_date_gmt'])
- ));
+ ]);
}
else {
$parentID = $row['comment_parent'];
do {
- $parentCommentStatement->execute(array($parentID));
+ $parentCommentStatement->execute([$parentID]);
$row2 = $parentCommentStatement->fetchArray();
if (!$row2['comment_parent']) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment.response')->import($row['comment_ID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment.response')->import($row['comment_ID'], [
'commentID' => $row2['comment_ID'],
'userID' => ($row['user_id'] ?: null),
'username' => $row['comment_author'],
'message' => StringUtil::decodeHTML($row['comment_content']),
'time' => @strtotime($row['comment_date_gmt'])
- ));
+ ]);
break;
}
$parentID = $row2['comment_parent'];
AND post_status IN (?, ?, ?, ?, ?, ?)
)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('attachment', 'post', 'publish', 'pending', 'draft', 'future', 'private', 'trash'));
+ $statement->execute(['attachment', 'post', 'publish', 'pending', 'draft', 'future', 'private', 'trash']);
$row = $statement->fetchArray();
return $row['count'];
}
)
ORDER BY ID";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('_wp_attached_file', 'attachment', 'post', 'publish', 'pending', 'draft', 'future', 'private', 'trash'));
+ $statement->execute(['_wp_attached_file', 'attachment', 'post', 'publish', 'pending', 'draft', 'future', 'private', 'trash']);
while ($row = $statement->fetchArray()) {
$fileLocation = $this->fileSystemPath.'wp-content/uploads/'.$row['meta_value'];
$time = @strtotime($row['post_date_gmt']);
if (!$time) $time = @strtotime($row['post_date']);
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.attachment')->import($row['meta_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.attachment')->import($row['meta_id'], [
'objectID' => $row['post_parent'],
'userID' => ($row['post_author'] ?: null),
'filename' => basename($fileLocation),
'lastDownloadTime' => 0,
'uploadTime' => $time,
'showOrder' => 0
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
* @category Community Framework
*/
class XF12xExporter extends AbstractExporter {
- protected static $knownProfileFields = array('facebook', 'icq', 'twitter', 'skype');
+ protected static $knownProfileFields = ['facebook', 'icq', 'twitter', 'skype'];
/**
* board cache
* @var array
*/
- protected $boardCache = array();
+ protected $boardCache = [];
/**
* @see \wcf\system\exporter\AbstractExporter::$methods
*/
- protected $methods = array(
+ protected $methods = [
'com.woltlab.wcf.user' => 'Users',
'com.woltlab.wcf.user.group' => 'UserGroups',
'com.woltlab.wcf.user.rank' => 'UserRanks',
'com.woltlab.blog.entry.attachment' => 'BlogAttachments',
'com.woltlab.blog.entry.comment' => 'BlogComments',
'com.woltlab.blog.entry.like' => 'BlogEntryLikes'
- );
+ ];
/**
* @see \wcf\system\exporter\AbstractExporter::$limits
*/
- protected $limits = array(
+ protected $limits = [
'com.woltlab.wcf.user' => 200,
'com.woltlab.wcf.user.avatar' => 100,
'com.woltlab.wcf.user.follower' => 100
- );
+ ];
/**
* @see \wcf\system\exporter\IExporter::getSupportedData()
*/
public function getSupportedData() {
- return array(
- 'com.woltlab.wcf.user' => array(
+ return [
+ 'com.woltlab.wcf.user' => [
'com.woltlab.wcf.user.group',
'com.woltlab.wcf.user.avatar',
'com.woltlab.wcf.user.option',
'com.woltlab.wcf.user.comment',
'com.woltlab.wcf.user.follower',
'com.woltlab.wcf.user.rank'
- ),
- 'com.woltlab.wbb.board' => array(
+ ],
+ 'com.woltlab.wbb.board' => [
'com.woltlab.wbb.acl',
'com.woltlab.wbb.attachment',
'com.woltlab.wbb.poll',
'com.woltlab.wbb.watchedThread',
'com.woltlab.wcf.label'
- ),
- 'com.woltlab.wcf.conversation' => array(
+ ],
+ 'com.woltlab.wcf.conversation' => [
'com.woltlab.wcf.conversation.label'
- ),
- 'com.woltlab.blog.entry' => array(
+ ],
+ 'com.woltlab.blog.entry' => [
'com.woltlab.blog.category',
'com.woltlab.blog.entry.attachment',
'com.woltlab.blog.entry.comment',
'com.woltlab.blog.entry.like'
- )
- );
+ ]
+ ];
}
/**
* @see \wcf\system\exporter\IExporter::getQueue()
*/
public function getQueue() {
- $queue = array();
+ $queue = [];
// user
if (in_array('com.woltlab.wcf.user', $this->selectedData)) {
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['user_group_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.group')->import($row['user_group_id'], [
'groupName' => $row['title'],
'groupType' => UserGroup::OTHER,
- 'userOnlineMarking' => ($row['username_css'] ? '<span style="'.str_replace(array("\n", "\r"), '', $row['username_css']).'">%s</span>' : '%s'),
+ 'userOnlineMarking' => ($row['username_css'] ? '<span style="'.str_replace(["\n", "\r"], '', $row['username_css']).'">%s</span>' : '%s'),
'priority' => $row['display_style_priority']
- ));
+ ]);
}
}
WHERE user_table.user_id BETWEEN ? AND ?
ORDER BY user_table.user_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('user', 'register', $offset + 1, $offset + $limit));
+ $statement->execute(['user', 'register', $offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'username' => $row['username'],
'password' => '',
'email' => $row['email'],
'signatureEnableHtml' => 0,
'signatureEnableSmilies' => 1,
'lastActivityTime' => $row['last_activity']
- );
- $options = array(
+ ];
+ $options = [
'location' => $row['location'],
'occupation' => $row['occupation'],
'homepage' => $row['homepage'],
'aboutMe' => self::fixBBCodes($row['about']),
'birthday' => $row['dob_year'].'-'.$row['dob_month'].'-'.$row['dob_day']
- );
+ ];
$customFields = unserialize($row['custom_fields']);
$countryCode = '';
if ($row['language_code']) list($languageCode, $countryCode) = explode('-', $row['language_code'], 2);
- $additionalData = array(
+ $additionalData = [
'groupIDs' => explode(',', $row['secondary_group_ids'].','.$row['user_group_id']),
- 'languages' => array($languageCode),
+ 'languages' => [$languageCode],
'options' => $options
- );
+ ];
// import user
$newUserID = ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user')->import($row['user_id'], $data, $additionalData);
$password = 'invalid:-:-';
break;
}
- $passwordUpdateStatement->execute(array($password, $newUserID));
+ $passwordUpdateStatement->execute([$password, $newUserID]);
}
}
}
*/
public function countUserOptions() {
$condition = new PreparedStatementConditionBuilder();
- $condition->add('field_id NOT IN (?)', array(self::$knownProfileFields));
+ $condition->add('field_id NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT COUNT(*) AS count
FROM xf_user_field
*/
public function exportUserOptions($offset, $limit) {
$condition = new PreparedStatementConditionBuilder();
- $condition->add('field_id NOT IN (?)', array(self::$knownProfileFields));
+ $condition->add('field_id NOT IN (?)', [self::$knownProfileFields]);
$sql = "SELECT *
FROM xf_user_field
continue;
}
- $selectOptions = array();
+ $selectOptions = [];
if ($row['field_choices']) {
$field_choices = @unserialize($row['field_choices']);
if (!$field_choices) continue;
}
// the ID is transformed into an integer, because the importer cannot handle strings as IDs
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import(hexdec(substr(sha1($row['field_id']), 0, 7)), array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import(hexdec(substr(sha1($row['field_id']), 0, 7)), [
'categoryName' => 'profile.personal',
'optionType' => $row['field_type'],
'editable' => $row['user_editable'] == 'yes' ? UserOption::EDITABILITY_ALL : UserOption::EDITABILITY_ADMINISTRATOR,
'selectOptions' => implode("\n", $selectOptions),
'visible' => UserOption::VISIBILITY_ALL,
'outputClass' => $row['field_type'] == 'select' ? 'wcf\system\option\user\SelectOptionsUserOptionOutput' : '',
- ), array('name' => $row['field_id']));
+ ], ['name' => $row['field_id']]);
}
}
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['minimum_level'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.rank')->import($row['minimum_level'], [
'groupID' => 2, // 2 = registered users
'requiredPoints' => $row['minimum_level'],
'rankTitle' => $row['title'],
'rankImage' => '',
'repeatImage' => 0,
'requiredGender' => 0 // neutral
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.follower')->import(0, [
'userID' => $row['user_id'],
'followUserID' => $row['follow_user_id'],
'time' => $row['follow_date']
- ));
+ ]);
}
}
WHERE profile_post_id BETWEEN ? AND ?
ORDER BY profile_post_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['profile_post_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment')->import($row['profile_post_id'], [
'objectID' => $row['profile_user_id'],
'userID' => $row['user_id'],
'username' => $row['username'],
'message' => self::fixComment($row['message']),
'time' => $row['post_date']
- ));
+ ]);
}
}
WHERE profile_post_comment_id BETWEEN ? AND ?
ORDER BY profile_post_comment_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['profile_post_comment_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.comment.response')->import($row['profile_post_comment_id'], [
'commentID' => $row['profile_post_id'],
'time' => $row['comment_date'],
'userID' => $row['user_id'],
'username' => $row['username'],
'message' => self::fixComment($row['message']),
- ));
+ ]);
}
}
FROM xf_user
WHERE avatar_date <> ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE avatar_date <> ?
ORDER BY user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
$config = $this->getConfig();
$location = $this->fileSystemPath.$config['externalDataPath'].'/avatars/l/'.floor($row['user_id'] / 1000).'/'.$row['user_id'].'.jpg';
$extension = 'gif';
}
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['user_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.avatar')->import($row['user_id'], [
'avatarName' => '',
'avatarExtension' => $extension,
'userID' => $row['user_id']
- ), array('fileLocation' => $location));
+ ], ['fileLocation' => $location]);
}
}
FROM xf_user
ORDER BY user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(''));
+ $statement->execute(['']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['userid'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.label')->import($row['userid'], [
'userID' => $row['user_id'],
'label' => 'Star'
- ));
+ ]);
}
}
WHERE conversation_id BETWEEN ? AND ?
ORDER BY conversation_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['conversation_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation')->import($row['conversation_id'], [
'subject' => $row['title'],
'time' => $row['start_date'],
'userID' => $row['user_id'],
'isDraft' => 0,
'isClosed' => $row['conversation_open'] ? 0 : 1,
'participantCanInvite' => $row['open_invite'] ? 1 : 0
- ));
+ ]);
}
}
WHERE message_table.message_id BETWEEN ? AND ?
ORDER BY message_table.message_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['message_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.message')->import($row['message_id'], [
'conversationID' => $row['conversation_id'],
'userID' => $row['user_id'],
'username' => $row['username'],
'message' => self::fixBBCodes($row['message']),
'time' => $row['message_date'],
'ipAddress' => $row['ip'] ? UserUtil::convertIPv4To6($row['ip']) : ''
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $row['conversation_id'],
'participantID' => $row['user_id'],
'username' => $row['username'] ?: '',
'hideConversation' => ($row['recipient_state'] == 'deleted_ignored' ? Conversation::STATE_LEFT : ($row['recipient_state'] == 'deleted' ? Conversation::STATE_HIDDEN : Conversation::STATE_DEFAULT)),
'isInvisible' => 0,
'lastVisitTime' => $row['last_read_date']
- ), array('labelIDs' => ($row['is_starred'] ? array($row['user_id']) : array())));
+ ], ['labelIDs' => ($row['is_starred'] ? [$row['user_id']] : [])]);
}
}
FROM xf_node
WHERE node_type_id IN (?, ?, ?)";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Forum', 'Category', 'LinkForum'));
+ $statement->execute(['Forum', 'Category', 'LinkForum']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE node_type_id IN (?, ?, ?)
ORDER BY node.lft";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('Forum', 'Category', 'LinkForum'));
+ $statement->execute(['Forum', 'Category', 'LinkForum']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($row['nodeID'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.board')->import($row['nodeID'], [
'parentID' => ($row['parent_node_id'] ?: null),
'position' => $row['lft'],
'boardType' => ($row['node_type_id'] == 'Category' ? Board::TYPE_CATEGORY : ($row['node_type_id'] == 'Forum' ? Board::TYPE_BOARD : Board::TYPE_LINK)),
'clicks' => $row['redirect_count'] ?: 0,
'posts' => $row['message_count'] ?: 0,
'threads' => $row['discussion_count'] ?: 0
- ));
+ ]);
}
}
WHERE thread_id BETWEEN ? AND ?
ORDER BY thread_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- $data = array(
+ $data = [
'boardID' => $row['node_id'],
'topic' => $row['title'],
'time' => $row['post_date'],
'isClosed' => $row['discussion_open'] ? 0 : 1,
'isDeleted' => $row['discussion_state'] == 'deleted' ? 1 : 0,
'deleteTime' => $row['discussion_state'] == 'deleted' ? TIME_NOW : 0
- );
+ ];
- $additionalData = array();
- if ($row['prefix_id']) $additionalData['labels'] = array($row['node_id'].'-'.$row['prefix_id']);
+ $additionalData = [];
+ if ($row['prefix_id']) $additionalData['labels'] = [$row['node_id'].'-'.$row['prefix_id']];
ImportHandler::getInstance()->getImporter('com.woltlab.wbb.thread')->import($row['thread_id'], $data, $additionalData);
}
WHERE post_id BETWEEN ? AND ?
ORDER BY post_id";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($offset + 1, $offset + $limit));
+ $statement->execute([$offset + 1, $offset + $limit]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], [
'threadID' => $row['thread_id'],
'userID' => $row['user_id'],
'username' => $row['username'],
'enableSmilies' => 1,
'showSignature' => 1,
'ipAddress' => $row['ip'] ? UserUtil::convertIPv4To6($row['ip']) : ''
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.watchedThread')->import(0, [
'objectID' => $row['thread_id'],
'userID' => $row['user_id']
- ));
+ ]);
}
}
FROM xf_poll
WHERE content_type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('thread'));
+ $statement->execute(['thread']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE content_type = ?
ORDER BY poll.poll_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('thread'));
+ $statement->execute(['thread']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['poll_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll')->import($row['poll_id'], [
'objectID' => $row['first_post_id'],
'question' => $row['question'],
'endTime' => $row['close_date'],
'isPublic' => $row['public_votes'] ? 1 : 0,
'maxVotes' => isset($row['max_votes']) ? $row['max_votes'] : ($row['multiple'] ? $row['responses'] : 1),
'votes' => $row['voter_count']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['poll_response_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option')->import($row['poll_response_id'], [
'pollID' => $row['poll_id'],
'optionValue' => $row['response'],
'showOrder' => $row['poll_response_id'],
'votes' => $row['response_vote_count']
- ));
+ ]);
}
}
FROM xf_poll_vote
ORDER BY poll_response_id, user_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.poll.option.vote')->import(0, [
'pollID' => $row['poll_id'],
'optionID' => $row['poll_response_id'],
'userID' => $row['user_id']
- ));
+ ]);
}
}
while ($row = $statement->fetchArray()) {
// import label group
if (!ImportHandler::getInstance()->getNewID('com.woltlab.wcf.label.group', $row['node_id'])) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($row['node_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label.group')->import($row['node_id'], [
'groupName' => 'labelgroup'.$row['node_id']
- ), array('objects' => array($objectType->objectTypeID => array(ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['node_id'])))));
+ ], ['objects' => [$objectType->objectTypeID => [ImportHandler::getInstance()->getNewID('com.woltlab.wbb.board', $row['node_id'])]]]);
}
if (!ImportHandler::getInstance()->getNewID('com.woltlab.wcf.label', $row['node_id'].'-'.$row['prefix_id'])) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($row['node_id'].'-'.$row['prefix_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.label')->import($row['node_id'].'-'.$row['prefix_id'], [
'groupID' => $row['node_id'],
'label' => $row['phrase_text']
- ));
+ ]);
}
}
}
AND permission_value <> ?
AND content_type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('forum', 'use_int', 'node'));
+ $statement->execute(['forum', 'use_int', 'node']);
$row = $statement->fetchArray();
return $row['count'];
}
* Exports ACLs.
*/
public function exportACLs($offset, $limit) {
- static $mapping = array(
- 'approveUnapprove' => array('canEnableThread', 'canEnablePost'),
- 'deleteAnyPost' => array('canDeletePost'),
- 'deleteAnyThread' => array('canDeleteThread'),
- 'deleteOwnPost' => array('canDeleteOwnPost'),
- 'editAnyPost' => array('canEditPost'),
- 'editOwnPost' => array('canEditOwnPost'),
- 'hardDeleteAnyPost' => array('canDeletePostCompletely'),
- 'hardDeleteAnyThread' => array('canDeleteThreadCompletely'),
- 'lockUnlockThread' => array('canCloseThread'),
- 'manageAnyThread' => array('canMoveThread', 'canMergeThread'),
- 'postReply' => array('canReplyThread'),
- 'postThread' => array('canStartThread'),
- 'stickUnstickThread' => array('canPinThread'),
- 'undelete' => array('canRestorePost', 'canRestoreThread'),
- 'uploadAttachments' => array('canUploadAttachment'),
- 'viewAttachment' => array('canDownloadAttachment'),
- 'viewContent' => array('canReadThread'),
- 'viewDeleted' => array('canReadDeletedPost', 'canReadDeletedThread'),
- 'votePoll' => array('canVotePoll')
- );
+ static $mapping = [
+ 'approveUnapprove' => ['canEnableThread', 'canEnablePost'],
+ 'deleteAnyPost' => ['canDeletePost'],
+ 'deleteAnyThread' => ['canDeleteThread'],
+ 'deleteOwnPost' => ['canDeleteOwnPost'],
+ 'editAnyPost' => ['canEditPost'],
+ 'editOwnPost' => ['canEditOwnPost'],
+ 'hardDeleteAnyPost' => ['canDeletePostCompletely'],
+ 'hardDeleteAnyThread' => ['canDeleteThreadCompletely'],
+ 'lockUnlockThread' => ['canCloseThread'],
+ 'manageAnyThread' => ['canMoveThread', 'canMergeThread'],
+ 'postReply' => ['canReplyThread'],
+ 'postThread' => ['canStartThread'],
+ 'stickUnstickThread' => ['canPinThread'],
+ 'undelete' => ['canRestorePost', 'canRestoreThread'],
+ 'uploadAttachments' => ['canUploadAttachment'],
+ 'viewAttachment' => ['canDownloadAttachment'],
+ 'viewContent' => ['canReadThread'],
+ 'viewDeleted' => ['canReadDeletedPost', 'canReadDeletedThread'],
+ 'votePoll' => ['canVotePoll']
+ ];
$sql = "SELECT *
FROM xf_permission_entry_content
AND content_type = ?
ORDER BY permission_entry_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('forum', 'use_int', 'node'));
+ $statement->execute(['forum', 'use_int', 'node']);
while ($row = $statement->fetchArray()) {
if (!isset($mapping[$row['permission_id']])) continue;
foreach ($mapping[$row['permission_id']] as $permission) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wbb.acl')->import(0, [
'objectID' => $row['content_id'],
($row['user_id'] ? 'userID' : 'groupID') => $row['user_id'] ?: $row['user_group_id'],
'optionValue' => $row['permission_value'] == 'content_allow' ? 1 : 0
- ), array(
+ ], [
'optionName' => $permission
- ));
+ ]);
}
}
}
FROM xfa_blog_category
WHERE user_id = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array(0));
+ $statement->execute([0]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE user_id = ?
ORDER BY category_id ASC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array(0));
+ $statement->execute([0]);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($row['category_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.category')->import($row['category_id'], [
'title' => $row['category_name'],
'parentCategoryID' => 0, // by intent as Community Blog does not support arbitrary nested categories
'showOrder' => $row['display_order']
- ));
+ ]);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- $additionalData = array();
+ $additionalData = [];
if ($row['isPublished']) {
$additionalData['categories'] = explode(',', $row['categories']);
}
if ($categories) $additionalData['categories'] = $categories;
}
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['entry_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry')->import($row['entry_id'], [
'userID' => $row['user_id'] ?: null,
'username' => $row['username'] ?: '',
'subject' => $row['title'],
'views' => $row['view_count'],
'isPublished' => $row['isPublished'],
'publicationDate' => $row['post_date']
- ), $additionalData);
+ ], $additionalData);
}
}
$statement = $this->database->prepareStatement($sql, $limit, $offset);
$statement->execute();
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['comment_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.comment')->import($row['comment_id'], [
'objectID' => $row['entry_id'],
'userID' => $row['user_id'] ?: null,
'username' => $row['username'] ?: '',
'message' => self::fixComment($row['message']),
'time' => $row['post_date']
- ));
+ ]);
}
}
FROM xf_liked_content
WHERE content_type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array('xfa_blog_entry'));
+ $statement->execute(['xfa_blog_entry']);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE content_type = ?
ORDER BY like_id ASC";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array('xfa_blog_entry'));
+ $statement->execute(['xfa_blog_entry']);
while ($row = $statement->fetchArray()) {
- ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.like')->import($row['like_id'], array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.blog.entry.like')->import($row['like_id'], [
'objectID' => $row['content_id'],
'objectUserID' => $row['content_user_id'] ?: null,
'userID' => $row['like_user_id'],
'likeValue' => Like::LIKE,
'time' => $row['like_date']
- ));
+ ]);
}
}
FROM xf_attachment
WHERE content_type = ?";
$statement = $this->database->prepareStatement($sql);
- $statement->execute(array($type));
+ $statement->execute([$type]);
$row = $statement->fetchArray();
return $row['count'];
}
WHERE attachment.content_type = ?
ORDER BY attachment.attachment_id";
$statement = $this->database->prepareStatement($sql, $limit, $offset);
- $statement->execute(array($type));
+ $statement->execute([$type]);
while ($row = $statement->fetchArray()) {
$config = self::getConfig();
$fileLocation = $this->fileSystemPath.$config['internalDataPath'].'/attachments/'.floor($row['data_id'] / 1000).'/'.$row['data_id'].'-'.$row['file_hash'].'.data';
$row['isImage'] = $row['width'] = $row['height'] = 0;
}
- ImportHandler::getInstance()->getImporter($objectType)->import($row['attachment_id'], array(
+ ImportHandler::getInstance()->getImporter($objectType)->import($row['attachment_id'], [
'objectID' => $row['content_id'],
'userID' => ($row['user_id'] ?: null),
'filename' => $row['filename'],
'height' => $row['height'],
'downloads' => $row['view_count'],
'uploadTime' => $row['upload_date']
- ), array('fileLocation' => $fileLocation));
+ ], ['fileLocation' => $fileLocation]);
}
}
public function getConfig() {
- $config = array(
- 'db' => array(
+ $config = [
+ 'db' => [
'adapter' => 'mysqli',
'host' => 'localhost',
'port' => '3306',
'password' => '',
'dbname' => '',
'adapterNamespace' => 'Zend_Db_Adapter'
- ),
- 'cache' => array(
+ ],
+ 'cache' => [
'enabled' => false,
'cacheSessions' => false,
'frontend' => 'core',
- 'frontendOptions' => array(
+ 'frontendOptions' => [
'caching' => true,
'cache_id_prefix' => 'xf_'
- ),
+ ],
'backend' => 'file',
- 'backendOptions' => array(
+ 'backendOptions' => [
'file_name_prefix' => 'xf_'
- )
- ),
+ ]
+ ],
'debug' => false,
'enableListeners' => true,
- 'development' => array(
+ 'development' => [
'directory' => '',
'default_addon' => ''
- ),
+ ],
'superAdmins' => '1',
'globalSalt' => '1717c7e013ff20562bcc1483c1e0c8a8',
'jsVersion' => '',
- 'cookie' => array(
+ 'cookie' => [
'prefix' => 'xf_',
'path' => '/',
'domain' => ''
- ),
+ ],
'enableMail' => true,
'enableMailQueue' => true,
'internalDataPath' => 'internal_data',
'enableTemplateModificationCallbacks' => true,
'enableClickjackingProtection' => true,
'maxImageResizePixelCount' => 20000000
- );
+ ];
require($this->fileSystemPath.'library/config.php');
return $config;
$userRegex = new Regex('\[user=(\d+)\](.*?)\[/user\]', Regex::CASE_INSENSITIVE);
$userCallback = new Callback(function ($matches) {
- $userLink = LinkHandler::getInstance()->getLink('User', array(
+ $userLink = LinkHandler::getInstance()->getLink('User', [
'userID' => $matches[1],
'forceFrontend' => true
- ));
+ ]);
- $userLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $userLink);
+ $userLink = str_replace(["\\", "'"], ["\\\\", "\'"], $userLink);
return "[url='".$userLink."']".$matches[2]."[/url]";
});
$quoteRegex = new Regex('\[quote=("?)(?P<username>[^,\]\n]*)(?:, post: (?P<postID>\d+)(?:, member: \d+)?)?\1\]', Regex::CASE_INSENSITIVE);
$quoteCallback = new Callback(function ($matches) {
if (isset($matches['username']) && $matches['username']) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches['username']);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches['username']);
if (isset($matches['postID']) && $matches['postID']) {
- $postLink = LinkHandler::getInstance()->getLink('Thread', array(
+ $postLink = LinkHandler::getInstance()->getLink('Thread', [
'application' => 'wbb',
'postID' => $matches['postID'],
'forceFrontend' => true
- )).'#post'.$matches['postID'];
- $postLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $postLink);
+ ]).'#post'.$matches['postID'];
+ $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
}
return '[size='.$size.']';
}, $message);
- static $map = array(
+ static $map = [
'[php]' => '[code=php]',
'[/php]' => '[/code]',
'[html]' => '[code=html]',
'[right]' => '[align=right]',
'[/right]' => '[/align]',
'[attach=full]' => '[attach]'
- );
+ ];
// use proper WCF 2 bbcode
$message = str_ireplace(array_keys($map), array_values($map), $message);