/** * @see wcf\system\option\IOptionType::getData() */ public function getData(Option $option, $newValue) { if (!empty($newValue)) { $ips = explode("\n", $newValue); foreach ($ips as &$ip) { $ip = trim($ip); $ip = UserUtil::convertIPv4To6($ip); } unset($ip); $newValue = implode("\n", $ips); } return $newValue; }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tpost_table.*, user_table.username AS editor\n\t\t\tFROM\t\t" . $this->databasePrefix . "posts post_table\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "users user_table\n\t\t\tON\t\tuser_table.uid = post_table.edituid\n\t\t\tWHERE\t\tpid BETWEEN ? AND ?\n\t\t\tORDER BY\tpid"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], array('threadID' => $row['tid'], 'userID' => $row['uid'], 'username' => $row['username'], 'subject' => $row['subject'], 'message' => self::fixBBCodes($row['message']), 'time' => $row['dateline'], 'isDisabled' => $row['visible'] ? 0 : 1, 'editorID' => $row['edituid'] ?: null, 'editor' => $row['editor'] ?: '', 'lastEditTime' => $row['edittime'], 'editCount' => $row['editor'] ? 1 : 0, 'enableSmilies' => $row['smilieoff'] ? 0 : 1, 'showSignature' => $row['includesig'], 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress']))); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\t*\n\t\t\tFROM\t\t" . $this->databasePrefix . "posts\n\t\t\tWHERE\t\tpid BETWEEN ? AND ?\n\t\t\tORDER BY\tpid"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['pid'], array('threadID' => $row['topic_id'], 'userID' => $row['author_id'], 'username' => $row['author_name'] ?: '', 'message' => self::fixMessage($row['post']), 'time' => $row['post_date'], 'isDeleted' => $row['queued'] == 3 ? 1 : 0, 'isDisabled' => $row['queued'] == 2 ? 1 : 0, 'lastEditTime' => $row['edit_time'] ?: 0, 'editorID' => null, 'editReason' => $row['post_edit_reason'], 'ipAddress' => UserUtil::convertIPv4To6($row['ip_address']), 'deleteTime' => $row['pdelete_time'])); } }
/** * Exports gallery images. */ public function exportGalleryImages($offset, $limit) { // get ids $imageIDs = array(); $sql = "SELECT\t\tphotoID\n\t\t\tFROM\t\twcf" . $this->dbNo . "_user_gallery\n\t\t\tWHERE\t\tphotoID BETWEEN ? AND ?\n\t\t\tORDER BY\tphotoID"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { $imageIDs[] = $row['photoID']; } if (empty($imageIDs)) { return; } // get tags $tags = $this->getTags('com.woltlab.wcf.user.gallery.photo', $imageIDs); // get categories $categories = array(); $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('photo_to_category.objectType = ?', array('photo')); $conditionBuilder->add('photo_to_category.objectID IN (?)', array($imageIDs)); $sql = "SELECT\t\tphoto_to_category.*\n\t\t\tFROM\t\twcf" . $this->dbNo . "_user_gallery_category_to_object photo_to_category\n\t\t\tLEFT JOIN\twcf" . $this->dbNo . "_user_gallery_category category\n\t\t\tON\t\t(category.categoryID = photo_to_category.categoryID)\n\t\t\t" . $conditionBuilder; $statement = $this->database->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); while ($row = $statement->fetchArray()) { if (!isset($categories[$row['objectID']])) { $categories[$row['objectID']] = array(); } $categories[$row['objectID']][] = $row['categoryID']; } // get images $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('user_gallery.photoID IN (?)', array($imageIDs)); $sql = "SELECT\t\tuser_gallery.*\n\t\t\tFROM\t\twcf" . $this->dbNo . "_user_gallery user_gallery\n\t\t\t" . $conditionBuilder; $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']); 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('userID' => $row['ownerID'] ?: null, 'username' => $row['username'], 'albumID' => $row['albumID'] ?: null, 'title' => $row['title'], 'description' => $row['description'], 'filename' => $row['filename'], 'fileExtension' => $row['fileExtension'], 'filesize' => $row['filesize'], 'comments' => $row['comments'], 'views' => $row['views'], 'uploadTime' => $row['uploadTime'], 'creationTime' => $row['creationTime'], 'width' => $row['width'], 'height' => $row['height'], 'camera' => $row['camera'], 'latitude' => $row['latitude'], 'longitude' => $row['longitude'], 'ipAddress' => UserUtil::convertIPv4To6($row['ipAddress'])), $additionalData); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tpost.*, user.username AS editor, INET_NTOA(ip.ip) AS ip, thread.title\n\t\t\tFROM\t\txf_post post\n\t\t\tLEFT JOIN\txf_user user\n\t\t\tON\t\tpost.last_edit_user_id = user.user_id\n\t\t\tLEFT JOIN\txf_ip ip\n\t\t\tON\t\tpost.ip_id = ip.ip_id\n\t\t\tLEFT JOIN\txf_thread thread\n\t\t\tON\t\tthread.first_post_id = post.post_id\n\t\t\tWHERE\t\tpost_id BETWEEN ? AND ?\n\t\t\tORDER BY\tpost_id"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], array('threadID' => $row['thread_id'], 'userID' => $row['user_id'], 'username' => $row['username'], 'subject' => $row['title'] ?: '', 'message' => self::fixBBCodes($row['message']), 'time' => $row['post_date'], 'isDisabled' => $row['message_state'] == 'moderated' ? 1 : 0, 'editorID' => $row['last_edit_user_id'] ?: null, 'editor' => $row['editor'] ?: '', 'lastEditTime' => $row['last_edit_date'], 'editCount' => $row['editor'] ? $row['edit_count'] : 0, 'enableSmilies' => 1, 'showSignature' => 1, 'ipAddress' => $row['ip'] ? UserUtil::convertIPv4To6($row['ip']) : '')); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tpost_table.*, user_table.username, editor.username AS editorName,\n\t\t\t\t\t(SELECT COUNT(*) FROM " . $this->databasePrefix . "attachments attachment_table WHERE attachment_table.post_msg_id = post_table.post_id AND in_message = ?) AS attachments\n\t\t\tFROM\t\t" . $this->databasePrefix . "posts post_table\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "users user_table\n\t\t\tON\t\tpost_table.poster_id = user_table.user_id\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "users editor\n\t\t\tON\t\tpost_table.post_edit_user = editor.user_id\n\t\t\tWHERE\t\tpost_id BETWEEN ? AND ?\n\t\t\tORDER BY\tpost_id"; $statement = $this->database->prepareStatement($sql); $statement->execute(array(0, $offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['post_id'], array('threadID' => $row['topic_id'], 'userID' => $row['poster_id'], 'username' => $row['post_username'] ?: (StringUtil::decodeHTML($row['username']) ?: ''), 'subject' => StringUtil::decodeHTML($row['post_subject']), 'message' => self::fixBBCodes(StringUtil::decodeHTML($row['post_text']), $row['bbcode_uid']), 'time' => $row['post_time'], 'isDisabled' => $row['post_approved'] ? 0 : 1, 'isClosed' => $row['post_edit_locked'] ? 1 : 0, 'editorID' => $row['post_edit_user'] ?: null, 'editor' => $row['editorName'] ?: '', 'lastEditTime' => $row['post_edit_time'], 'editCount' => $row['post_edit_count'], 'editReason' => !empty($row['post_edit_reason']) ? $row['post_edit_reason'] : '', 'attachments' => $row['attachments'], 'enableSmilies' => $row['enable_smilies'], 'enableHtml' => 0, 'enableBBCodes' => $row['enable_bbcode'], 'showSignature' => $row['enable_sig'], 'ipAddress' => UserUtil::convertIPv4To6($row['poster_ip']))); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\t*\n\t\t\tFROM\t\t" . $this->databasePrefix . "kunena_messages kunena_messages\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "kunena_messages_text kunena_messages_text\n\t\t\tON\t\t(kunena_messages_text.mesid = kunena_messages.id)\n\t\t\tWHERE\t\tid BETWEEN ? AND ?\n\t\t\tORDER BY\tid"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id'], array('threadID' => $row['thread'], 'userID' => $row['userid'], 'username' => $row['name'], 'subject' => $row['subject'], 'message' => self::fixBBCodes($row['message']), 'time' => $row['time'], 'ipAddress' => UserUtil::convertIPv4To6($row['ip']), 'isClosed' => $row['locked'] ? 1 : 0, 'editorID' => null)); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tchild.*, IF(parent.contenttypeid = child.contenttypeid, 0, 1) AS isFirstPost, text.*\n\t\t\tFROM\t\t" . $this->databasePrefix . "node child\n\t\t\tINNER JOIN\t" . $this->databasePrefix . "text text\n\t\t\tON\t\tchild.nodeid = text.nodeid\n\t\t\tINNER JOIN\t" . $this->databasePrefix . "node parent\n\t\t\tON\t\tchild.parentid = parent.nodeid\n\t\t\t\n\t\t\tINNER JOIN\t(SELECT contenttypeid FROM " . $this->databasePrefix . "contenttype WHERE class IN(?, ?)) x\n\t\t\tON\t\tx.contenttypeid = child.contenttypeid\n\t\t\t\n\t\t\tWHERE\t\tchild.nodeid BETWEEN ? AND ?\n\t\t\tORDER BY\tchild.nodeid ASC"; $statement = $this->database->prepareStatement($sql); $statement->execute(array('Text', 'Poll', $offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['nodeid'], array('threadID' => $row['isFirstPost'] ? $row['nodeid'] : $row['parentid'], 'userID' => $row['userid'], 'username' => $row['authorname'], 'subject' => StringUtil::decodeHTML($row['title']), 'message' => self::fixBBCodes($row['rawtext']), 'time' => $row['created'], 'isDeleted' => $row['deleteuserid'] !== null ? 1 : 0, 'deleteTime' => $row['deleteuserid'] !== null ? TIME_NOW : 0, 'isDisabled' => $row['approved'] ? 0 : 1, 'isClosed' => 0, 'editorID' => null, 'editor' => '', 'lastEditTime' => 0, 'editCount' => 0, 'editReason' => '', 'enableSmilies' => $row['allowsmilie'], 'enableHtml' => isset($row['htmlState']) && $row['htmlState'] != 'off' ? 1 : 0, 'enableBBCodes' => 1, 'showSignature' => $row['showsignature'], 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress']))); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tpost.*,\n\t\t\t\t\tpostedithistory.dateline AS lastEditTime, postedithistory.username AS editor, postedithistory.userid AS editorID,\n\t\t\t\t\tpostedithistory.reason AS editReason,\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT\tCOUNT(*) - 1\n\t\t\t\t\t\tFROM\t" . $this->databasePrefix . "postedithistory postedithistory3\n\t\t\t\t\t\tWHERE\tpostedithistory3.postid = post.postid\n\t\t\t\t\t) AS editCount\n\t\t\tFROM\t\t" . $this->databasePrefix . "post post\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "postedithistory postedithistory\n\t\t\tON\t\tpostedithistory.postedithistoryid = (\n\t\t\t\t\t\tSELECT\tMAX(postedithistoryid)\n\t\t\t\t\t\tFROM\t" . $this->databasePrefix . "postedithistory postedithistory2\n\t\t\t\t\t\tWHERE\tpostedithistory2.postid = post.postid\n\t\t\t\t\t)\n\t\t\tWHERE\t\tpost.postid BETWEEN ? AND ?\n\t\t\tORDER BY\tpost.postid"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($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('threadID' => $row['threadid'], 'userID' => $row['userid'], 'username' => $row['username'], 'subject' => $row['title'], 'message' => self::fixBBCodes($row['pagetext']), 'time' => $row['dateline'], 'isDeleted' => $row['visible'] == 2 ? 1 : 0, 'isDisabled' => $row['visible'] == 0 ? 1 : 0, 'isClosed' => 0, 'editorID' => $row['editorID'] ?: null, 'editor' => $row['editor'] ?: '', 'lastEditTime' => $row['lastEditTime'] ?: 0, 'editCount' => $row['editCount'] && $row['editCount'] > 0 ? $row['editCount'] : 0, 'editReason' => $row['editReason'] ?: '', 'attachments' => $row['attach'], 'enableSmilies' => $row['allowsmilie'], 'enableHtml' => isset($row['htmlState']) && $row['htmlState'] != 'off' ? 1 : 0, 'enableBBCodes' => 1, 'showSignature' => $row['showsignature'], 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress']))); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\t*\n\t\t\tFROM\t\t" . $this->databasePrefix . "posts\n\t\t\tWHERE\t\tpostid BETWEEN ? AND ?\n\t\t\tORDER BY\tpostid"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['postid'], array('threadID' => $row['threadid'], 'userID' => $row['userid'], 'username' => $row['username'], 'subject' => $row['posttopic'], 'message' => self::fixBBCodes($row['message']), 'time' => $row['posttime'], 'isDisabled' => intval(!$row['visible']), 'editorID' => $row['editorid'] ?: null, 'editor' => $row['editor'], 'lastEditTime' => $row['edittime'], 'editCount' => $row['editcount'], 'attachments' => $row['attachments'], 'enableSmilies' => $row['allowsmilies'], 'enableHtml' => $row['allowhtml'], 'enableBBCodes' => $row['allowbbcode'], 'showSignature' => $row['showsignature'], 'ipAddress' => UserUtil::convertIPv4To6($row['ipaddress']))); } }
/** * Exports posts. */ public function exportPosts($offset, $limit) { $sql = "SELECT\t\tmessage.*, member.id_member AS editorID\n\t\t\tFROM\t\t" . $this->databasePrefix . "messages message\n\t\t\tLEFT JOIN\t" . $this->databasePrefix . "members member\n\t\t\tON\t\t(message.modified_name = member.real_name)\n\t\t\tWHERE\t\tmessage.id_msg BETWEEN ? AND ?\n\t\t\tORDER BY\tmessage.id_msg"; $statement = $this->database->prepareStatement($sql); $statement->execute(array($offset + 1, $offset + $limit)); while ($row = $statement->fetchArray()) { ImportHandler::getInstance()->getImporter('com.woltlab.wbb.post')->import($row['id_msg'], array('threadID' => $row['id_topic'], 'userID' => $row['id_member'], 'username' => $row['poster_name'], 'subject' => StringUtil::decodeHTML($row['subject']), 'message' => self::fixBBCodes($row['body']), 'time' => $row['poster_time'], 'isDisabled' => $row['approved'] ? 0 : 1, 'editorID' => $row['editorID'] ?: null, 'editor' => $row['modified_name'], 'lastEditTime' => $row['modified_time'], 'editCount' => $row['modified_time'] ? 1 : 0, 'editReason' => !empty($row['editReason']) ? $row['editReason'] : '', 'enableSmilies' => $row['smileys_enabled'], 'enableHtml' => 0, 'enableBBCodes' => 1, 'showSignature' => 1, 'ipAddress' => UserUtil::convertIPv4To6($row['poster_ip']))); } }