feature 2057: use $get_data parameter to send GET data.
git-svn-id: http://piwigo.org/svn/trunk@8083 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
4ae512231a
commit
ea64e421cb
4 changed files with 85 additions and 39 deletions
|
|
@ -196,13 +196,16 @@ UPDATE '.USER_INFOS_TABLE.'
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$pem_category_id = 8;
|
$get_data = array(
|
||||||
|
'category_id' => 8,
|
||||||
|
'format' => 'php',
|
||||||
|
);
|
||||||
|
|
||||||
// Retrieve PEM versions
|
// Retrieve PEM versions
|
||||||
$version = PHPWG_VERSION;
|
$version = PHPWG_VERSION;
|
||||||
$versions_to_check = array();
|
$versions_to_check = array();
|
||||||
$url = PEM_URL . '/api/get_version_list.php?category_id='.$pem_category_id.'&format=php';
|
$url = PEM_URL . '/api/get_version_list.php';
|
||||||
if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
|
if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
|
||||||
{
|
{
|
||||||
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
||||||
{
|
{
|
||||||
|
|
@ -223,11 +226,15 @@ UPDATE '.USER_INFOS_TABLE.'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve PEM languages infos
|
// Retrieve PEM languages infos
|
||||||
$url = PEM_URL . '/api/get_revision_list.php?category_id='.$pem_category_id.'&format=php&last_revision_only=true';
|
$url = PEM_URL . '/api/get_revision_list.php';
|
||||||
$url .= '&version=' . implode(',', $versions_to_check);
|
$get_data = array_merge($get_data, array(
|
||||||
$url .= '&lang='.$user['language'];
|
'last_revision_only' => 'true',
|
||||||
|
'version' => implode(',', $versions_to_check),
|
||||||
|
'lang' => $user['language'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (fetchRemote($url, $result))
|
if (fetchRemote($url, $result, $get_data))
|
||||||
{
|
{
|
||||||
$pem_languages = @unserialize($result);
|
$pem_languages = @unserialize($result);
|
||||||
if (!is_array($pem_languages))
|
if (!is_array($pem_languages))
|
||||||
|
|
@ -258,10 +265,13 @@ UPDATE '.USER_INFOS_TABLE.'
|
||||||
{
|
{
|
||||||
if ($archive = tempnam( PHPWG_ROOT_PATH.'language', 'zip'))
|
if ($archive = tempnam( PHPWG_ROOT_PATH.'language', 'zip'))
|
||||||
{
|
{
|
||||||
$url = PEM_URL . '/download.php?rid=' . $revision;
|
$url = PEM_URL . '/download.php';
|
||||||
$url .= '&origin=piwigo_' . $action;
|
$get_data = array(
|
||||||
|
'rid' => $revision,
|
||||||
|
'origin' => 'piwigo_'.$action,
|
||||||
|
);
|
||||||
|
|
||||||
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
|
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
|
||||||
{
|
{
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
||||||
|
|
|
||||||
|
|
@ -290,11 +290,16 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
$get_data = array(
|
||||||
|
'category_id' => 12,
|
||||||
|
'format' => 'php',
|
||||||
|
);
|
||||||
|
|
||||||
// Retrieve PEM versions
|
// Retrieve PEM versions
|
||||||
$version = PHPWG_VERSION;
|
$version = PHPWG_VERSION;
|
||||||
$versions_to_check = array();
|
$versions_to_check = array();
|
||||||
$url = PEM_URL . '/api/get_version_list.php?category_id=12&format=php';
|
$url = PEM_URL . '/api/get_version_list.php';
|
||||||
if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
|
if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
|
||||||
{
|
{
|
||||||
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
||||||
{
|
{
|
||||||
|
|
@ -325,17 +330,27 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve PEM plugins infos
|
// Retrieve PEM plugins infos
|
||||||
$url = PEM_URL . '/api/get_revision_list.php?category_id=12&format=php&last_revision_only=true';
|
$url = PEM_URL . '/api/get_revision_list.php';
|
||||||
$url .= '&version=' . implode(',', $versions_to_check);
|
$get_data = array_merge($get_data, array(
|
||||||
$url .= '&lang=' . substr($user['language'], 0, 2);
|
'last_revision_only' => 'true',
|
||||||
$url .= '&get_nb_downloads=true';
|
'version' => implode(',', $versions_to_check),
|
||||||
|
'lang' => substr($user['language'], 0, 2),
|
||||||
|
'get_nb_downloads' => 'true',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($plugins_to_check))
|
if (!empty($plugins_to_check))
|
||||||
{
|
{
|
||||||
$url .= $new ? '&extension_exclude=' : '&extension_include=';
|
if ($new)
|
||||||
$url .= implode(',', $plugins_to_check);
|
{
|
||||||
|
$get_data['extension_exclude'] = implode(',', $plugins_to_check);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$get_data['extension_include'] = implode(',', $plugins_to_check);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fetchRemote($url, $result))
|
if (fetchRemote($url, $result, $get_data))
|
||||||
{
|
{
|
||||||
$pem_plugins = @unserialize($result);
|
$pem_plugins = @unserialize($result);
|
||||||
if (!is_array($pem_plugins))
|
if (!is_array($pem_plugins))
|
||||||
|
|
@ -386,10 +401,13 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
|
||||||
{
|
{
|
||||||
if ($archive = tempnam( PHPWG_PLUGINS_PATH, 'zip'))
|
if ($archive = tempnam( PHPWG_PLUGINS_PATH, 'zip'))
|
||||||
{
|
{
|
||||||
$url = PEM_URL . '/download.php?rid=' . $revision;
|
$url = PEM_URL . '/download.php';
|
||||||
$url .= '&origin=piwigo_' . $action;
|
$get_data = array(
|
||||||
|
'rid' => $revision,
|
||||||
|
'origin' => 'piwigo_'.$action,
|
||||||
|
);
|
||||||
|
|
||||||
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
|
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
|
||||||
{
|
{
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
||||||
|
|
|
||||||
|
|
@ -447,13 +447,16 @@ SELECT
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$pem_category_id = 10;
|
$get_data = array(
|
||||||
|
'category_id' => 10,
|
||||||
|
'format' => 'php',
|
||||||
|
);
|
||||||
|
|
||||||
// Retrieve PEM versions
|
// Retrieve PEM versions
|
||||||
$version = PHPWG_VERSION;
|
$version = PHPWG_VERSION;
|
||||||
$versions_to_check = array();
|
$versions_to_check = array();
|
||||||
$url = PEM_URL . '/api/get_version_list.php?category_id='.$pem_category_id.'&format=php';
|
$url = PEM_URL . '/api/get_version_list.php';
|
||||||
if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
|
if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
|
||||||
{
|
{
|
||||||
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
|
||||||
{
|
{
|
||||||
|
|
@ -484,17 +487,27 @@ SELECT
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve PEM themes infos
|
// Retrieve PEM themes infos
|
||||||
$url = PEM_URL . '/api/get_revision_list.php?category_id='.$pem_category_id.'&format=php&last_revision_only=true';
|
$url = PEM_URL . '/api/get_revision_list.php';
|
||||||
$url .= '&version=' . implode(',', $versions_to_check);
|
$get_data = array_merge($get_data, array(
|
||||||
$url .= '&lang=' . substr($user['language'], 0, 2);
|
'last_revision_only' => 'true',
|
||||||
$url .= '&get_nb_downloads=true';
|
'version' => implode(',', $versions_to_check),
|
||||||
|
'lang' => substr($user['language'], 0, 2),
|
||||||
|
'get_nb_downloads' => 'true',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($themes_to_check))
|
if (!empty($themes_to_check))
|
||||||
{
|
{
|
||||||
$url .= $new ? '&extension_exclude=' : '&extension_include=';
|
if ($new)
|
||||||
$url .= implode(',', $themes_to_check);
|
{
|
||||||
|
$get_data['extension_exclude'] = implode(',', $themes_to_check);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$get_data['extension_include'] = implode(',', $themes_to_check);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fetchRemote($url, $result))
|
if (fetchRemote($url, $result, $get_data))
|
||||||
{
|
{
|
||||||
$pem_themes = @unserialize($result);
|
$pem_themes = @unserialize($result);
|
||||||
if (!is_array($pem_themes))
|
if (!is_array($pem_themes))
|
||||||
|
|
@ -546,10 +559,13 @@ SELECT
|
||||||
{
|
{
|
||||||
if ($archive = tempnam( PHPWG_THEMES_PATH, 'zip'))
|
if ($archive = tempnam( PHPWG_THEMES_PATH, 'zip'))
|
||||||
{
|
{
|
||||||
$url = PEM_URL . '/download.php?rid=' . $revision;
|
$url = PEM_URL . '/download.php';
|
||||||
$url .= '&origin=piwigo_' . $action;
|
$get_data = array(
|
||||||
|
'rid' => $revision,
|
||||||
|
'origin' => 'piwigo_'.$action,
|
||||||
|
);
|
||||||
|
|
||||||
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
|
if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
|
||||||
{
|
{
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,11 @@ SELECT COUNT(id) AS count
|
||||||
if ( ! isset($_POST['no_check']) )
|
if ( ! isset($_POST['no_check']) )
|
||||||
{
|
{
|
||||||
$clf_url = $url.'create_listing_file.php';
|
$clf_url = $url.'create_listing_file.php';
|
||||||
$clf_url.= '?action=test';
|
$get_data = array(
|
||||||
$clf_url.= '&version='.PHPWG_VERSION;
|
'action' => 'test',
|
||||||
if (fetchRemote($clf_url, $result))
|
'version' => PHPWG_VERSION,
|
||||||
|
);
|
||||||
|
if (fetchRemote($clf_url, $result, $get_data))
|
||||||
{
|
{
|
||||||
$lines = explode("\r\n", $result);
|
$lines = explode("\r\n", $result);
|
||||||
$first_line = strip_tags($lines[0]);
|
$first_line = strip_tags($lines[0]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue