source: extensions/autoupdate/trunk/main.inc.php @ 9710

Last change on this file since 9710 was 9710, checked in by patdenice, 13 years ago

New languages keys.

File size: 1.8 KB
Line 
1<?php
2/*
3Plugin Name: Piwigo AutoUpgrade
4Version: auto
5Description: Upgrade your gallery automatically.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=302
7Author: P@t
8Author URI: http://www.gauchon.com
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('AUTOUPDATE_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
14
15global $conf;
16$conf['AU_ignore'] = unserialize($conf['autoupdate_ignore_list']);
17
18// Upgrade?
19if (!isset($conf['AU_ignore']['plugins']))
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
25if (script_basename() == 'admin')
26 add_event_handler('get_admin_plugin_menu_links', 'check_for_auto_upgrade');
27
28function check_for_auto_upgrade($plugin_menu_links)
29{
30  global $template, $page, $conf, $header_notes, $prefixeTable;
31
32  load_language('plugin.lang', dirname(__FILE__).'/');
33
34  if ($page['page'] == 'intro')
35  {
36    if (isset($_GET['action']) and 
37      ($_GET['action'] == 'check_autoupdate' or $_GET['action'] == 'check_upgrade' ))
38    {
39      unset($_SESSION['need_update']);
40      unset($_SESSION['extensions_need_update']);
41    }
42
43    if (!isset($_SESSION['need_update']) or !isset($_SESSION['extensions_need_update'])
44      or $_SESSION['need_update'] !== false or $_SESSION['extensions_need_update'] !== array())
45    {
46      $template->set_filename('autoupdate_head', realpath(AUTOUPDATE_PATH.'template/head.tpl'));
47      array_push($header_notes, $template->parse('autoupdate_head', true));
48    }
49  }
50
51  array_push($plugin_menu_links, array(
52    'NAME' => 'Piwigo AutoUpgrade',
53    'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
54    )
55  );
56
57  return $plugin_menu_links;
58}
59?>
Note: See TracBrowser for help on using the repository browser.