source: extensions/File_Uploader/main.inc.php @ 20059

Last change on this file since 20059 was 19875, checked in by julien1311, 11 years ago

[file_uploader] lots of bug fixes

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