From 3b0caa8de442a1028a78d2cf48aff4d3997729b3 Mon Sep 17 00:00:00 2001 From: patdenice Date: Sat, 15 Nov 2008 21:11:58 +0000 Subject: merge -c2880 from trunk to branch 2.0 - Add fetchRemote function which allow to retrieve datas over HTTP protocol using cURL method, file_get_contents function or fsockopen method. This allow to retrieve datas or files even if allow_url_fopen is deactivated. - Use fetchRemote function in plugins manager and in latest version checking. - Add german translations for upgrade.lang.php. - Remove empty line at the end of pclzip.lib.php. - Change display of deactivated plugins after upgrade. git-svn-id: http://piwigo.org/svn/branches/2.0@2881 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/plugins.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'admin/include/plugins.class.php') diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index ff478be83..13c2940a4 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -268,8 +268,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; $version = PHPWG_VERSION; $versions_to_check = array(); $url = PEM_URL . '/api/get_version_list.php?category_id=12&format=php'; - if ($source = @file_get_contents($url) - and $pem_versions = @unserialize($source)) + if (fetchRemote($url, $result) and $pem_versions = @unserialize($result)) { if (!preg_match('/^\d+\.\d+\.\d+/', $version)) { @@ -308,9 +307,9 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; $url .= $new ? '&extension_exclude=' : '&extension_include='; $url .= implode(',', $plugins_to_check); } - if ($source = @file_get_contents($url)) + if (fetchRemote($url, $result)) { - $pem_plugins = @unserialize($source); + $pem_plugins = @unserialize($result); if (!is_array($pem_plugins)) { return false; @@ -321,6 +320,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; } return true; } + return false; } /** @@ -357,8 +357,10 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; { $url = PEM_URL . '/download.php?rid=' . $revision; $url .= '&origin=piwigo_' . $action; - if (@copy($url, $archive)) + + if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle)) { + fclose($handle); include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php'); $zip = new PclZip($archive); if ($list = $zip->listContent()) -- cgit v1.2.3