Changeset 18973 for extensions/BatchDownloader/main.inc.php
- Timestamp:
- Nov 7, 2012, 10:05:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/main.inc.php
r18291 r18973 13 13 global $conf, $prefixeTable; 14 14 15 define('BATCH_DOWNLOAD_PATH', PHPWG_PLUGINS_PATH . 'BatchDownloader/'); 15 defined('BATCH_DOWNLOAD_ID') or define('BATCH_DOWNLOAD_ID', basename(dirname(__FILE__))); 16 define('BATCH_DOWNLOAD_PATH', PHPWG_PLUGINS_PATH . BATCH_DOWNLOAD_ID . '/'); 16 17 define('BATCH_DOWNLOAD_TSETS', $prefixeTable . 'download_sets'); 17 18 define('BATCH_DOWNLOAD_TIMAGES', $prefixeTable . 'download_sets_images'); 18 19 define('BATCH_DOWNLOAD_LOCAL', PHPWG_ROOT_PATH . $conf['data_location'] . 'download_archives/'); 19 define('BATCH_DOWNLOAD_ADMIN', get_root_url() . 'admin.php?page=plugin- BatchDownloader');20 define('BATCH_DOWNLOAD_ADMIN', get_root_url() . 'admin.php?page=plugin-' . BATCH_DOWNLOAD_ID); 20 21 define('BATCH_DOWNLOAD_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'download')) . '/'); 21 22 define('BATCH_DOWNLOAD_VERSION', 'auto'); … … 24 25 add_event_handler('init', 'batch_download_init'); 25 26 26 add_event_handler('loc_end_section_init', 'batch_download_section_init'); 27 add_event_handler('loc_end_index', 'batch_download_page'); 27 if (defined('IN_ADMIN')) 28 { 29 add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu'); 30 } 31 else 32 { 33 add_event_handler('loc_end_section_init', 'batch_download_section_init'); 34 add_event_handler('loc_end_index', 'batch_download_page'); 28 35 29 add_event_handler('loc_end_index', 'batch_download_clean');36 add_event_handler('loc_end_index', 'batch_download_clean'); 30 37 31 add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10);38 add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 32 39 33 add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock'); 34 add_event_handler('blockmanager_apply', 'batch_download_applymenu'); 40 add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock'); 41 add_event_handler('blockmanager_apply', 'batch_download_applymenu'); 42 } 43 35 44 36 45 include_once(BATCH_DOWNLOAD_PATH . 'include/BatchDownloader.class.php'); 37 46 include_once(BATCH_DOWNLOAD_PATH . 'include/functions.inc.php'); 38 47 include_once(BATCH_DOWNLOAD_PATH . 'include/events.inc.php'); 39 40 if (defined('IN_ADMIN'))41 {42 add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu');43 }44 48 45 49 … … 53 57 54 58 if ( 55 $pwg_loaded_plugins['BatchDownloader']['version'] == 'auto' or 56 version_compare($pwg_loaded_plugins['BatchDownloader']['version'], BATCH_DOWNLOAD_VERSION, '<') 59 BATCH_DOWNLOAD_VERSION == 'auto' or 60 $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] == 'auto' or 61 version_compare($pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'], BATCH_DOWNLOAD_VERSION, '<') 57 62 ) 58 63 { … … 60 65 batch_download_install(); 61 66 62 if ( $pwg_loaded_plugins['BatchDownloader']['version'] != 'auto')67 if ( $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] != 'auto' and BATCH_DOWNLOAD_VERSION != 'auto' ) 63 68 { 64 69 $query = ' 65 70 UPDATE '. PLUGINS_TABLE .' 66 71 SET version = "'. BATCH_DOWNLOAD_VERSION .'" 67 WHERE id = " BatchDownloader"';72 WHERE id = "'. BATCH_DOWNLOAD_ID .'"'; 68 73 pwg_query($query); 69 74 70 $pwg_loaded_plugins[ 'BatchDownloader']['version'] = BATCH_DOWNLOAD_VERSION;75 $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] = BATCH_DOWNLOAD_VERSION; 71 76 72 77 if (defined('IN_ADMIN'))
Note: See TracChangeset
for help on using the changeset viewer.