| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/baberankings.com.bak/community/plugins/autoupdate/include/ |
Upload File : |
<?php
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
function autoupdate_check_version($version=PHPWG_VERSION)
{
global $conf;
if (!isset($_SESSION['need_update']))
{
$_SESSION['need_update'] = null;
if (preg_match('/(\d+\.\d+)\.(\d+)/', $version, $matches)
and @fetchRemote(PHPWG_URL.'/download/all_versions.php', $result))
{
$all_versions = @explode("\n", $result);
$new_version = trim($all_versions[0]);
$_SESSION['need_update'] = version_compare($version, $new_version, '<');
}
}
if ($_SESSION['need_update'])
{
return l10n('A new version of Piwigo is available.').'<br>'
. '<a href="admin.php?page=plugin&section=autoupdate%2Fautoupdate.php">'.l10n('Click here to upgrade automatically').'</a>';
}
else
{
// Gallery is up to date
// Check plugins upgrade
include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
$plugins = new plugins();
$ignore_list = unserialize($conf['autoupdate_ignore_list']);
if (!isset($_SESSION['plugins_need_update']))
{
$_SESSION['plugins_need_update'] = null;
autoupdate_check_plugins_upgrade($plugins, $ignore_list);
}
elseif (!empty($_SESSION['plugins_need_update']))
{
// Check if plugins have been upgraded since last check
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
if (isset($_SESSION['plugins_need_update'][$plugin_id])
and $plugins->plugin_version_compare($fs_plugin['version'], $_SESSION['plugins_need_update'][$plugin_id]))
{
// Plugin have been updated
autoupdate_check_plugins_upgrade($plugins, $ignore_list);
}
}
}
if (!empty($_SESSION['plugins_need_update']))
{
return l10n('Some upgrades are available for you plugins').'<br>'
. '<a href="admin.php?page=plugins_update">'.l10n('Click here see upgrade plugins page').'</a>';
}
}
if ($_SESSION['need_update'] === false and $_SESSION['plugins_need_update'] === array())
{
return l10n('Gallery and plugins are up to date');
}
else
{
return l10n('Unable to check upgrades...')
. '<br><a href="admin.php?action=check_autoupdate">'
. l10n('Click here to check upgrades now') . '</a>';
}
}
function autoupdate_check_plugins_upgrade($plugins, $ignore_list)
{
if ($plugins->get_server_plugins())
{
$new_ignore_list = array();
$_SESSION['plugins_need_update'] = array();
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
if (isset($fs_plugin['extension']) and isset($plugins->server_plugins[$fs_plugin['extension']]))
{
$plugin_info = $plugins->server_plugins[$fs_plugin['extension']];
if (!$plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name']))
{
if (in_array($fs_plugin['name'], $ignore_list))
{
array_push($new_ignore_list, $fs_plugin['name']);
}
else
{
$_SESSION['plugins_need_update'][$plugin_id] = $plugin_info['revision_name'];
}
}
}
}
// Update ignore list in database
$query = '
UPDATE '.CONFIG_TABLE.'
SET value = "'.addslashes(serialize($new_ignore_list)).'"
WHERE param = "autoupdate_ignore_list"
;';
pwg_query($query);
}
}
?>