[3604] | 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 | |
---|
[6167] | 13 | define('AUTOUPDATE_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
[3604] | 14 | |
---|
[9707] | 15 | global $conf; |
---|
| 16 | $conf['AU_ignore'] = unserialize($conf['autoupdate_ignore_list']); |
---|
| 17 | |
---|
| 18 | // Upgrade? |
---|
[9710] | 19 | if (!isset($conf['AU_ignore']['plugins'])) |
---|
[9707] | 20 | { |
---|
| 21 | $conf['AU_ignore'] = array('plugins'=>array(),'themes'=>array(),'languages'=>array()); |
---|
| 22 | conf_update_param('autoupdate_ignore_list', pwg_db_real_escape_string(serialize($conf['AU_ignore']))); |
---|
| 23 | } |
---|
| 24 | |
---|
[6167] | 25 | if (script_basename() == 'admin') |
---|
| 26 | add_event_handler('get_admin_plugin_menu_links', 'check_for_auto_upgrade'); |
---|
| 27 | |
---|
[3604] | 28 | function check_for_auto_upgrade($plugin_menu_links) |
---|
| 29 | { |
---|
[6167] | 30 | global $template, $page, $conf, $header_notes, $prefixeTable; |
---|
[4699] | 31 | |
---|
[6181] | 32 | load_language('plugin.lang', dirname(__FILE__).'/'); |
---|
| 33 | |
---|
[4699] | 34 | if ($page['page'] == 'intro') |
---|
| 35 | { |
---|
[6167] | 36 | if (isset($_GET['action']) and |
---|
| 37 | ($_GET['action'] == 'check_autoupdate' or $_GET['action'] == 'check_upgrade' )) |
---|
| 38 | { |
---|
| 39 | unset($_SESSION['need_update']); |
---|
[9710] | 40 | unset($_SESSION['extensions_need_update']); |
---|
[6167] | 41 | } |
---|
| 42 | |
---|
[9710] | 43 | if (!isset($_SESSION['need_update']) or !isset($_SESSION['extensions_need_update']) |
---|
| 44 | or $_SESSION['need_update'] !== false or $_SESSION['extensions_need_update'] !== array()) |
---|
[6167] | 45 | { |
---|
| 46 | $template->set_filename('autoupdate_head', realpath(AUTOUPDATE_PATH.'template/head.tpl')); |
---|
| 47 | array_push($header_notes, $template->parse('autoupdate_head', true)); |
---|
| 48 | } |
---|
[4699] | 49 | } |
---|
| 50 | |
---|
[6167] | 51 | array_push($plugin_menu_links, array( |
---|
[9707] | 52 | 'NAME' => 'Piwigo AutoUpgrade', |
---|
| 53 | 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) |
---|
| 54 | ) |
---|
| 55 | ); |
---|
[6167] | 56 | |
---|
[3604] | 57 | return $plugin_menu_links; |
---|
| 58 | } |
---|
[3575] | 59 | ?> |
---|