- Timestamp:
- Jul 13, 2012, 12:12:21 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/include/BatchDownloader.class.php
r16626 r16689 20 20 21 21 $this->conf = $conf['batch_download']; 22 $this->conf['archive_acomment'] = $conf['batch_download_comment']; 22 23 $this->data = array( 23 ' set_id' => 0,24 'id' => 0, 24 25 'user_id' => $user['id'], 25 26 'date_creation' => '0000-00-00 00:00:00', … … 39 40 $query = ' 40 41 SELECT 42 id, 41 43 user_id, 42 44 date_creation, … … 57 59 if (pwg_db_num_rows($result)) 58 60 { 59 $this->data['set_id'] = $set_id; 60 list( 61 $this->data['user_id'], 62 $this->data['date_creation'], 63 $this->data['type'], 64 $this->data['type_id'], 65 $this->data['nb_zip'], 66 $this->data['last_zip'], 67 $this->data['nb_images'], 68 $this->data['total_size'], 69 $this->data['status'] 70 ) = pwg_db_fetch_row($result); 61 $this->data = array_merge( 62 $this->data, 63 pwg_db_fetch_assoc($result) 64 ); 71 65 72 66 // make sur all pictures of the set exist … … 84 78 zip 85 79 FROM '.BATCH_DOWNLOAD_TIMAGES.' 86 WHERE set_id = '.$this->data[' set_id'].'80 WHERE set_id = '.$this->data['id'].' 87 81 ;'; 88 82 $this->images = simple_hash_from_query($query, 'image_id', 'zip'); … … 129 123 ;'; 130 124 pwg_query($query); 131 $this->data[' set_id'] = pwg_db_insert_id();125 $this->data['id'] = pwg_db_insert_id(); 132 126 133 127 $date = pwg_query('SELECT FROM_UNIXTIME(NOW());'); … … 153 147 { 154 148 $this->data[$name] = $value; 155 pwg_query('UPDATE '.BATCH_DOWNLOAD_TSETS.' SET '.$name.' = "'.$value.'" WHERE id = '.$this->data[' set_id'].';');149 pwg_query('UPDATE '.BATCH_DOWNLOAD_TSETS.' SET '.$name.' = "'.$value.'" WHERE id = '.$this->data['id'].';'); 156 150 } 157 151 … … 201 195 DELETE FROM '.BATCH_DOWNLOAD_TIMAGES.' 202 196 WHERE 203 set_id = '.$this->data[' set_id'].'197 set_id = '.$this->data['id'].' 204 198 AND image_id IN('.implode(',', $image_ids).') 205 199 ;'; … … 225 219 226 220 $this->images[ $image_id ] = 0; 227 array_push($inserts, array('set_id'=>$this->data[' set_id'], 'image_id'=>$image_id, 'zip'=>0));221 array_push($inserts, array('set_id'=>$this->data['id'], 'image_id'=>$image_id, 'zip'=>0)); 228 222 } 229 223 … … 246 240 $query = ' 247 241 DELETE FROM '.BATCH_DOWNLOAD_TIMAGES.' 248 WHERE set_id = '.$this->data[' set_id'].'242 WHERE set_id = '.$this->data['id'].' 249 243 ;'; 250 244 pwg_query($query); … … 348 342 if (!empty($this->conf['archive_comment'])) 349 343 { 350 $comment.= "\n\n". $this->conf['archive_comment'];344 $comment.= "\n\n".wordwrap(remove_accents($this->conf['archive_comment']), 60); 351 345 } 352 346 $zip->setArchiveComment($comment); … … 359 353 SET zip = '.$this->data['last_zip'].' 360 354 WHERE 361 set_id = '.$this->data[' set_id'].'355 set_id = '.$this->data['id'].' 362 356 AND image_id IN('.implode(',', $images_added).') 363 357 ;'; … … 442 436 else if ($i == $this->data['last_zip']+1) 443 437 { 444 $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data[' set_id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"'438 $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"' 445 439 .($i!=1 ? 'onClick="return confirm(\'Starting download Archive #'.$i.' will destroy Archive #'.($i-1).', be sure you finish the download. Continue ?\');"' : null). 446 440 '><img src="'.BATCH_DOWNLOAD_PATH.'template/drive_go.png"> Archive #'.$i.' (ready)</a>'; … … 477 471 get_username($this->data['user_id']) .'_'. 478 472 $this->data['type'] .'-'. $this->data['type_id'] .'_'. 479 $this->data['user_id'] . $this->data[' set_id'] .473 $this->data['user_id'] . $this->data['id'] . 480 474 ($this->data['nb_zip']!=1 ? '_part'. $i : null). 481 475 '.zip';
Note: See TracChangeset
for help on using the changeset viewer.