Changeset 16592
- Timestamp:
- Jul 10, 2012, 3:39:01 PM (12 years ago)
- Location:
- extensions/BatchDownloader
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/include/BatchDownloader.class.php
r16400 r16592 39 39 $query = ' 40 40 SELECT 41 user_id, 41 42 date_creation, 42 43 type, … … 58 59 $this->data['set_id'] = $set_id; 59 60 list( 61 $this->data['user_id'], 60 62 $this->data['date_creation'], 61 63 $this->data['type'], … … 68 70 ) = pwg_db_fetch_row($result); 69 71 70 // make sur all pictures of the set exist s72 // make sur all pictures of the set exist 71 73 $query = ' 72 74 DELETE FROM '.BATCH_DOWNLOAD_TIMAGES.' … … 606 608 } 607 609 608 // selection 609 // case 'selection': 610 // { 611 // $set['NAME'] = ''; 612 // $set['COMMENT'] = ''; 613 // break; 614 // } 610 // collection 611 case 'collection': 612 { 613 try 614 { 615 $UserCollection = new UserCollection($this->data['type_id']); 616 $set['NAME'] = l10n('Collection').': <a href="'.USER_COLLEC_PUBLIC.'view/'.$UserCollection->getParam('col_id').'">'.$UserCollection->getParam('name').'</a>'; 617 } 618 catch (Exception $e) 619 { 620 $set['NAME'] = l10n('Collection').': #'.$this->data['type_id'].' (deleted)'; 621 } 622 break; 623 } 615 624 } 616 625 -
extensions/BatchDownloader/include/download.inc.php
r16400 r16592 63 63 /* edition page */ 64 64 case 'view': 65 { 65 66 $self_url = BATCH_DOWNLOAD_PUBLIC . 'view&set_id='.$_GET['set_id']; 66 67 … … 106 107 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); 107 108 108 break; 109 break; 110 } 109 111 } 110 112 … … 116 118 $search = '<span class="thumbName">'; 117 119 118 $add = '<a href="{$U_VIEW}&remove={$thumbnail.id}" >120 $add = '<a href="{$U_VIEW}&remove={$thumbnail.id}" rel="nofollow"> 119 121 <img src="{$BATCH_DOWNLOAD_PATH}template/image_delete.png" title="{\'Remove from download set\'|@translate}"> 120 122 </a> '; -
extensions/BatchDownloader/include/events.inc.php
r16400 r16592 96 96 } 97 97 98 if ($page['section'] == 'collections') 99 { 100 $url = $_SERVER['REQUEST_URI']; 101 } 102 else 103 { 104 $url = duplicate_index_url(array(), array('action')); 105 } 106 98 107 // toolbar button 99 $button = '<li><a href="'. duplicate_index_url(array(), array('action')).'&action=advdown_set" title="'.l10n('Download all pictures of this selection').'" class="pwg-state-default pwg-button" rel="nofollow">108 $button = '<li><a href="'. $url .'&action=advdown_set" title="'.l10n('Download all pictures of this selection').'" class="pwg-state-default pwg-button" rel="nofollow"> 100 109 <span class="pwg-icon" style="background:url(\'' . BATCH_DOWNLOAD_PATH . 'template/zip.png\') center center no-repeat;"> </span><span class="pwg-button-text">'.l10n('Advanced Downloader').'</span> 101 110 </a></li>'; 102 111 $template->concat('PLUGIN_INDEX_ACTIONS', $button); 112 $template->concat('COLLECTION_ACTIONS', $button); 103 113 } 104 114 … … 178 188 conf_update_param('batch_download', serialize($conf['batch_download'])); 179 189 180 // set old sets as done 190 // set old sets as done and clean images table 181 191 $query = ' 182 SELECT id 183 FROM '.BATCH_DOWNLOAD_TSETS.' 192 DELETE i 193 FROM '.BATCH_DOWNLOAD_TIMAGES.' AS i 194 INNER JOIN '.BATCH_DOWNLOAD_TSETS.' AS s 195 ON i.set_id = s.id 196 WHERE 197 status != "done" AND 198 date_creation < DATE_SUB(NOW(), INTERVAL '.$conf['batch_download']['archive_timeout'].' HOUR) 199 ;'; 200 pwg_query($query); 201 202 $query = ' 203 UPDATE '.BATCH_DOWNLOAD_TSETS.' 204 SET status = "done" 184 205 WHERE 206 status != "done" AND 185 207 date_creation < DATE_SUB(NOW(), INTERVAL '.$conf['batch_download']['archive_timeout'].' HOUR) 186 AND status != "done" 187 ;'; 188 $sets = array_from_query($query, 'id'); 189 190 foreach ($sets as $set_id) 191 { 192 $BatchDownloader = new BatchDownloader($set_id); 193 $BatchDownloader->deleteLastArchive(); 194 $BatchDownloader->clearImages(); 195 $BatchDownloader->updateParam('status', 'done'); 196 } 208 ;'; 209 pwg_query($query); 197 210 198 211 // remove old archives -
extensions/BatchDownloader/include/functions.inc.php
r16400 r16592 44 44 $batch_type = 'search'; 45 45 $batch_id = $page['search']; 46 break; 47 case 'collections': 48 if (in_array(@$page['sub_section'], array('view','edit'))) 49 { 50 $batch_type = 'collection'; 51 $batch_id = $page['col_id']; 52 } 46 53 break; 47 54 case 'favorites': -
extensions/BatchDownloader/main.inc.php
r16379 r16592 20 20 define('BATCH_DOWNLOAD_PUBLIC', make_index_url(array('section' => 'download')) . '/'); 21 21 22 22 23 if (class_exists('ZipArchive')) 23 24 { … … 29 30 add_event_handler('loc_end_index', 'batch_download_clean'); 30 31 31 add_event_handler('loc_ begin_index', 'batch_download_index_button');32 add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 32 33 33 34 add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock'); … … 38 39 require(BATCH_DOWNLOAD_PATH . 'include/events.inc.php'); 39 40 } 41 40 42 41 43 add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu');
Note: See TracChangeset
for help on using the changeset viewer.