1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Piwigo AutoUpgrade |
---|
4 | Version: auto |
---|
5 | Description: Upgrade your gallery automatically. |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=302 |
---|
7 | Author: P@t |
---|
8 | Author URI: http://www.gauchon.com |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | |
---|
13 | define('AUTOUPDATE_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
14 | |
---|
15 | if (script_basename() == 'admin') |
---|
16 | add_event_handler('get_admin_plugin_menu_links', 'check_for_auto_upgrade'); |
---|
17 | |
---|
18 | function check_for_auto_upgrade($plugin_menu_links) |
---|
19 | { |
---|
20 | global $template, $page, $conf, $header_notes, $prefixeTable; |
---|
21 | |
---|
22 | load_language('plugin.lang', dirname(__FILE__).'/'); |
---|
23 | |
---|
24 | if ($page['page'] == 'intro') |
---|
25 | { |
---|
26 | if (isset($_GET['action']) and |
---|
27 | ($_GET['action'] == 'check_autoupdate' or $_GET['action'] == 'check_upgrade' )) |
---|
28 | { |
---|
29 | unset($_SESSION['need_update']); |
---|
30 | unset($_SESSION['plugins_need_update']); |
---|
31 | } |
---|
32 | |
---|
33 | if (!isset($_SESSION['need_update']) or !isset($_SESSION['plugins_need_update']) |
---|
34 | or $_SESSION['need_update'] !== false or $_SESSION['plugins_need_update'] !== array()) |
---|
35 | { |
---|
36 | $template->set_filename('autoupdate_head', realpath(AUTOUPDATE_PATH.'template/head.tpl')); |
---|
37 | array_push($header_notes, $template->parse('autoupdate_head', true)); |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | if ($page['page'] == 'plugins_update' and method_exists('template', 'set_prefilter')) |
---|
42 | { |
---|
43 | include(dirname(__FILE__).'/plugins_update.php'); |
---|
44 | } |
---|
45 | |
---|
46 | array_push($plugin_menu_links, array( |
---|
47 | 'NAME' => 'Piwigo AutoUpgrade', |
---|
48 | 'URL' => get_admin_plugin_menu_link(AUTOUPDATE_PATH . '/autoupdate.php'))); |
---|
49 | |
---|
50 | return $plugin_menu_links; |
---|
51 | } |
---|
52 | ?> |
---|