| 208 | | $result = $this->getDB()->sendQuery("SELECT * FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads WHERE file_id = '".$row['file_id']."' ORDER BY upload_id ASC LIMIT 1,1"); |
| 209 | | while ($row2 = $this->getDB()->fetchArray($result)) { |
| 210 | | if(file_exists($this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'])) { |
| 211 | | $this->getImporter()->importThumbnail("t".$row2['upload_id'],"i".$row2['file_id'],$this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'],"",$row['userid']); |
| 212 | | } |
| 213 | | } |
| 214 | | } |
| 215 | | } |
| 216 | | |
| 217 | | /** |
| 218 | | * @see AbstractDatabaseExporter::exportScreenshots(); |
| 219 | | */ |
| 220 | | public function exportScreenshots($offset,$limit) { |
| 221 | | //look for the Screenshots |
| 222 | | $sql = "SELECT f.*, u.file_id, u.userid FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads AS `f` LEFT JOIN ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `u` ON (u.file_id = f.file_id) WHERE f.upmode = 'screen' LIMIT 2"; |
| 223 | | //$result = $this->getDB()->sendQuery($sql,$limit,$offset); |
| 224 | | |
| 225 | | // file_id = itemID |
| 226 | | // upload_id = Bild_ID / Datei-ID |
| | 208 | $row2 = $this->getDB()->getFirstRow("SELECT * FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads WHERE file_id = '".$row['file_id']."' AND upmode='screen' ORDER BY upload_id ASC"); |
| | 209 | if(file_exists($this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'])) { |
| | 210 | $this->getImporter()->importThumbnail("t".$row2['upload_id'],"i".$row2['file_id'],$this->settings['sourcePath']."files/".$row2['upload_id']."_screen_".$row2['encode'].".".$row2['ext'],"",$row['userid']); |
| | 211 | } |
| | 212 | } |
| 255 | | //nothing |
| | 241 | |
| | 242 | require_once(WCF_DIR.'lib/data/message/attachment/AttachmentsEditor.class.php'); |
| | 243 | |
| | 244 | $result = $this->getDB()->sendQuery("SELECT f.*, u.file_id, u.userid FROM ".$this->dbPrefix."fp".$this->settings['dbNumber']."_fileuploads AS `f` LEFT JOIN ".$this->dbPrefix."fp".$this->settings['dbNumber']."_files AS `u` ON (u.file_id = f.file_id) WHERE f.upmode = 'screen'",$limit,$offset); |
| | 245 | while($row = $this->getDB()->fetchArray($result)) { |
| | 246 | |
| | 247 | $source = $this->settings['sourcePath']."files/".$row['upload_id']."_screen_".$row['encode'].".".$row['ext']; |
| | 248 | |
| | 249 | if(file_exists($source)) { |
| | 250 | |
| | 251 | $attachmentName = $row['name'].".".$row['ext']; |
| | 252 | |
| | 253 | $item = $this->getImporter()->getImportKey("i".$row['file_id']); |
| | 254 | |
| | 255 | $attachment = array( |
| | 256 | "attachmentSize" => filesize($source), |
| | 257 | "sha1Hash" => sha1_file($source), |
| | 258 | "fileType" => $row['mime'], |
| | 259 | "isBinary" => 1, |
| | 260 | "isImage" => 1, |
| | 261 | "messageID" => $item['value'], |
| | 262 | "messageType" => "database", |
| | 263 | "packageID" => PACKAGE_ID, |
| | 264 | "idHash" => StringUtil::getRandomID(), |
| | 265 | "userID" => $row['userid'], |
| | 266 | "uploadTime" => $row['upload_time'] |
| | 267 | ); |
| | 268 | |
| | 269 | $attachment['attachmentID'] = AttachmentsEditor::insert($attachmentName, $attachment); |
| | 270 | $attachment['attachmentName'] = $attachmentName; |
| | 271 | $attachment['attachment'] = WCF_DIR.'attachments/attachment-'.$attachment['attachmentID']; |
| | 272 | $attachment['attachmentExtension'] = $row['ext']; |
| | 273 | |
| | 274 | @copy($source,$attachment['attachment']); |
| | 275 | |
| | 276 | AttachmentsEditor::saveThumbnail($attachment); |
| | 277 | } |
| | 278 | |
| | 279 | } |