[19472] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: File Uploader |
---|
[19474] | 4 | Version: auto |
---|
[19472] | 5 | Description: Upload files to the galleries folder and synchronise them with database |
---|
[19478] | 6 | Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=661 |
---|
[19472] | 7 | Author: Julien1311 |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | //Check whether we are indeed included by Piwigo. |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
[20299] | 13 | if (mobile_theme()) |
---|
| 14 | return; |
---|
| 15 | |
---|
[19472] | 16 | global $conf; |
---|
| 17 | |
---|
| 18 | define('FILE_UPLOADER_DIR' , basename(dirname(__FILE__))); |
---|
| 19 | define('FILE_UPLOADER_PATH' , PHPWG_PLUGINS_PATH.FILE_UPLOADER_DIR.'/'); |
---|
[19652] | 20 | define('FILE_UPLOADER_ADMIN', get_root_url() . 'admin.php?page=plugin-'.FILE_UPLOADER_DIR); |
---|
[19875] | 21 | define('FILE_UPLOADER_PDF2TAB_PATH' , FILE_UPLOADER_PATH.'/plugin_pdf2tab/'); |
---|
[19675] | 22 | define('FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH' , dirname(__FILE__).'/plugin_pdf2tab/'); |
---|
[19472] | 23 | |
---|
| 24 | /* +-----------------------------------------------------------------------+ |
---|
| 25 | * | Plugin admin | |
---|
| 26 | * +-----------------------------------------------------------------------+ */ |
---|
| 27 | |
---|
| 28 | // Add an entry to the plugins menu |
---|
| 29 | add_event_handler('get_admin_plugin_menu_links', 'file_uploader_admin_menu'); |
---|
| 30 | |
---|
| 31 | function file_uploader_admin_menu($menu) { |
---|
| 32 | array_push( |
---|
| 33 | $menu, array( |
---|
| 34 | 'NAME' => 'File Uploader', |
---|
| 35 | 'URL' => FILE_UPLOADER_ADMIN, |
---|
| 36 | ) |
---|
| 37 | ); |
---|
| 38 | return $menu; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | /* +-----------------------------------------------------------------------+ |
---|
| 42 | * | Plugin code | |
---|
| 43 | * +-----------------------------------------------------------------------+ */ |
---|
| 44 | $conf_file_uploader = unserialize($conf['file_uploader']); |
---|
[19875] | 45 | if (isset($conf_file_uploader['new_tab']) && $conf_file_uploader['new_tab'] == 1) { |
---|
[19472] | 46 | load_language('plugin.lang', FILE_UPLOADER_PATH); |
---|
[19666] | 47 | include_once(FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'include/thumbnails.inc.php'); |
---|
| 48 | include_once(FILE_UPLOADER_PDF2TAB_ABSOLUTE_PATH.'include/picture.inc.php'); |
---|
[19472] | 49 | } |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | /* +-----------------------------------------------------------------------+ |
---|
| 53 | * | CSS Style | |
---|
| 54 | * +-----------------------------------------------------------------------+ */ |
---|
| 55 | |
---|
| 56 | add_event_handler('loc_end_page_header', 'file_uploader_css'); |
---|
| 57 | |
---|
| 58 | function file_uploader_css() { |
---|
| 59 | global $template; |
---|
| 60 | |
---|
[19875] | 61 | if (defined('IN_ADMIN') and IN_ADMIN) { |
---|
| 62 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PATH.'admin/admin.css">'); |
---|
| 63 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.FILE_UPLOADER_PDF2TAB_PATH.'css/admin.css">'); |
---|
| 64 | } |
---|
[19472] | 65 | } |
---|
| 66 | ?> |
---|