From 1b5260522e3234c122613189bf14deab445ed4c9 Mon Sep 17 00:00:00 2001 From: patdenice Date: Sat, 11 Dec 2010 21:20:12 +0000 Subject: feature 2048: send technical details only to get_version_list.php of PEM API. git-svn-id: http://piwigo.org/svn/trunk@8084 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 38 ++++++++++++++++++++------------------ admin/include/languages.class.php | 2 +- admin/include/plugins.class.php | 2 +- admin/include/themes.class.php | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/admin/include/functions.php b/admin/include/functions.php index 463cfeb0f..6f2ce02e2 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1704,8 +1704,6 @@ function cat_admin_access($category_id) */ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_agent='Piwigo', $step=0) { - global $conf; - // Try to retrieve data from local file? if (!url_is_remote($src)) { @@ -1724,22 +1722,6 @@ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_ // After 3 redirections, return false if ($step > 3) return false; - // Send anonymous data to piwigo server - if ($conf['send_hosting_technical_details'] - and $_SERVER['HTTP_HOST'] != 'localhost' and $step==0 - and preg_match('#^http://(?:[a-z]+\.)?piwigo\.org#', $src)) - { - $post_data = array_merge($post_data, array( - 'uuid' => hash_hmac('md5', get_absolute_root_url(), $conf['secret_key']), - 'os' => urlencode(PHP_OS), - 'pwgversion' => urlencode(PHPWG_VERSION), - 'phpversion' => urlencode(phpversion()), - 'dbengine' => urlencode(DB_ENGINE), - 'dbversion' => urlencode(pwg_get_db_version()), - ) - ); - } - // Initialization $method = empty($post_data) ? 'GET' : 'POST'; $request = empty($post_data) ? '' : http_build_query($post_data, '', '&'); @@ -2062,4 +2044,24 @@ function get_fckb_tag_ids($raw_tags) return $tag_ids; } + +function get_hosting_technical_details() +{ + global $conf; + + $details = array(); + if ($conf['send_hosting_technical_details'] and $_SERVER['HTTP_HOST'] != 'localhost') + { + $details = array( + 'uuid' => hash_hmac('md5', get_absolute_root_url(), $conf['secret_key']), + 'os' => urlencode(PHP_OS), + 'pwgversion' => urlencode(PHPWG_VERSION), + 'phpversion' => urlencode(phpversion()), + 'dbengine' => urlencode(DB_ENGINE), + 'dbversion' => urlencode(pwg_get_db_version()), + ); + } + + return $details; +} ?> diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php index d9537bbdd..4fd73d4af 100644 --- a/admin/include/languages.class.php +++ b/admin/include/languages.class.php @@ -205,7 +205,7 @@ UPDATE '.USER_INFOS_TABLE.' $version = PHPWG_VERSION; $versions_to_check = array(); $url = PEM_URL . '/api/get_version_list.php'; - if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result)) + if (fetchRemote($url, $result, $get_data, get_hosting_technical_details()) and $pem_versions = @unserialize($result)) { if (!preg_match('/^\d+\.\d+\.\d+/', $version)) { diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index 5b620da62..169a50b76 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -299,7 +299,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\''; $version = PHPWG_VERSION; $versions_to_check = array(); $url = PEM_URL . '/api/get_version_list.php'; - if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result)) + if (fetchRemote($url, $result, $get_data, get_hosting_technical_details()) and $pem_versions = @unserialize($result)) { if (!preg_match('/^\d+\.\d+\.\d+/', $version)) { diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index f372ef5de..b00172d31 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -456,7 +456,7 @@ SELECT $version = PHPWG_VERSION; $versions_to_check = array(); $url = PEM_URL . '/api/get_version_list.php'; - if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result)) + if (fetchRemote($url, $result, $get_data, get_hosting_technical_details()) and $pem_versions = @unserialize($result)) { if (!preg_match('/^\d+\.\d+\.\d+/', $version)) { -- cgit v1.2.3