Changeset 8083 for trunk/admin


Ignore:
Timestamp:
Dec 11, 2010, 10:08:43 PM (13 years ago)
Author:
patdenice
Message:

feature 2057: use $get_data parameter to send GET data.

Location:
trunk/admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/languages.class.php

    r6550 r8083  
    197197    global $user;
    198198
    199     $pem_category_id = 8;
     199    $get_data = array(
     200      'category_id' => 8,
     201      'format' => 'php',
     202    );
    200203
    201204    // Retrieve PEM versions
    202205    $version = PHPWG_VERSION;
    203206    $versions_to_check = array();
    204     $url = PEM_URL . '/api/get_version_list.php?category_id='.$pem_category_id.'&format=php';
    205     if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
     207    $url = PEM_URL . '/api/get_version_list.php';
     208    if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
    206209    {
    207210      if (!preg_match('/^\d+\.\d+\.\d+/', $version))
     
    224227
    225228    // Retrieve PEM languages infos
    226     $url = PEM_URL . '/api/get_revision_list.php?category_id='.$pem_category_id.'&format=php&last_revision_only=true';
    227     $url .= '&version=' . implode(',', $versions_to_check);
    228     $url .= '&lang='.$user['language'];
    229 
    230     if (fetchRemote($url, $result))
     229    $url = PEM_URL . '/api/get_revision_list.php';
     230    $get_data = array_merge($get_data, array(
     231      'last_revision_only' => 'true',
     232      'version' => implode(',', $versions_to_check),
     233      'lang' => $user['language'],
     234      )
     235    );
     236
     237    if (fetchRemote($url, $result, $get_data))
    231238    {
    232239      $pem_languages = @unserialize($result);
     
    259266    if ($archive = tempnam( PHPWG_ROOT_PATH.'language', 'zip'))
    260267    {
    261       $url = PEM_URL . '/download.php?rid=' . $revision;
    262       $url .= '&origin=piwigo_' . $action;
    263 
    264       if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
     268      $url = PEM_URL . '/download.php';
     269      $get_data = array(
     270        'rid' => $revision,
     271        'origin' => 'piwigo_'.$action,
     272      );
     273
     274      if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
    265275      {
    266276        fclose($handle);
  • trunk/admin/include/plugins.class.php

    r6725 r8083  
    291291    global $user;
    292292
     293    $get_data = array(
     294      'category_id' => 12,
     295      'format' => 'php',
     296    );
     297
    293298    // Retrieve PEM versions
    294299    $version = PHPWG_VERSION;
    295300    $versions_to_check = array();
    296     $url = PEM_URL . '/api/get_version_list.php?category_id=12&format=php';
    297     if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
     301    $url = PEM_URL . '/api/get_version_list.php';
     302    if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
    298303    {
    299304      if (!preg_match('/^\d+\.\d+\.\d+/', $version))
     
    326331
    327332    // Retrieve PEM plugins infos
    328     $url = PEM_URL . '/api/get_revision_list.php?category_id=12&format=php&last_revision_only=true';
    329     $url .= '&version=' . implode(',', $versions_to_check);
    330     $url .= '&lang=' . substr($user['language'], 0, 2);
    331     $url .= '&get_nb_downloads=true';
     333    $url = PEM_URL . '/api/get_revision_list.php';
     334    $get_data = array_merge($get_data, array(
     335      'last_revision_only' => 'true',
     336      'version' => implode(',', $versions_to_check),
     337      'lang' => substr($user['language'], 0, 2),
     338      'get_nb_downloads' => 'true',
     339      )
     340    );
    332341
    333342    if (!empty($plugins_to_check))
    334343    {
    335       $url .= $new ? '&extension_exclude=' : '&extension_include=';
    336       $url .= implode(',', $plugins_to_check);
    337     }
    338     if (fetchRemote($url, $result))
     344      if ($new)
     345      {
     346        $get_data['extension_exclude'] = implode(',', $plugins_to_check);
     347      }
     348      else
     349      {
     350        $get_data['extension_include'] = implode(',', $plugins_to_check);
     351      }
     352    }
     353    if (fetchRemote($url, $result, $get_data))
    339354    {
    340355      $pem_plugins = @unserialize($result);
     
    387402    if ($archive = tempnam( PHPWG_PLUGINS_PATH, 'zip'))
    388403    {
    389       $url = PEM_URL . '/download.php?rid=' . $revision;
    390       $url .= '&origin=piwigo_' . $action;
    391 
    392       if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
     404      $url = PEM_URL . '/download.php';
     405      $get_data = array(
     406        'rid' => $revision,
     407        'origin' => 'piwigo_'.$action,
     408      );
     409
     410      if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
    393411      {
    394412        fclose($handle);
  • trunk/admin/include/themes.class.php

    r6550 r8083  
    448448    global $user;
    449449
    450     $pem_category_id = 10;
     450    $get_data = array(
     451      'category_id' => 10,
     452      'format' => 'php',
     453    );
    451454
    452455    // Retrieve PEM versions
    453456    $version = PHPWG_VERSION;
    454457    $versions_to_check = array();
    455     $url = PEM_URL . '/api/get_version_list.php?category_id='.$pem_category_id.'&format=php';
    456     if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
     458    $url = PEM_URL . '/api/get_version_list.php';
     459    if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
    457460    {
    458461      if (!preg_match('/^\d+\.\d+\.\d+/', $version))
     
    485488
    486489    // Retrieve PEM themes infos
    487     $url = PEM_URL . '/api/get_revision_list.php?category_id='.$pem_category_id.'&format=php&last_revision_only=true';
    488     $url .= '&version=' . implode(',', $versions_to_check);
    489     $url .= '&lang=' . substr($user['language'], 0, 2);
    490     $url .= '&get_nb_downloads=true';
     490    $url = PEM_URL . '/api/get_revision_list.php';
     491    $get_data = array_merge($get_data, array(
     492      'last_revision_only' => 'true',
     493      'version' => implode(',', $versions_to_check),
     494      'lang' => substr($user['language'], 0, 2),
     495      'get_nb_downloads' => 'true',
     496      )
     497    );
    491498
    492499    if (!empty($themes_to_check))
    493500    {
    494       $url .= $new ? '&extension_exclude=' : '&extension_include=';
    495       $url .= implode(',', $themes_to_check);
    496     }
    497     if (fetchRemote($url, $result))
     501      if ($new)
     502      {
     503        $get_data['extension_exclude'] = implode(',', $themes_to_check);
     504      }
     505      else
     506      {
     507        $get_data['extension_include'] = implode(',', $themes_to_check);
     508      }
     509    }
     510    if (fetchRemote($url, $result, $get_data))
    498511    {
    499512      $pem_themes = @unserialize($result);
     
    547560    if ($archive = tempnam( PHPWG_THEMES_PATH, 'zip'))
    548561    {
    549       $url = PEM_URL . '/download.php?rid=' . $revision;
    550       $url .= '&origin=piwigo_' . $action;
    551 
    552       if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle))
     562      $url = PEM_URL . '/download.php';
     563      $get_data = array(
     564        'rid' => $revision,
     565        'origin' => 'piwigo_'.$action,
     566      );
     567
     568      if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle, $get_data))
    553569      {
    554570        fclose($handle);
  • trunk/admin/site_manager.php

    r6363 r8083  
    117117      {
    118118        $clf_url = $url.'create_listing_file.php';
    119         $clf_url.= '?action=test';
    120         $clf_url.= '&version='.PHPWG_VERSION;
    121         if (fetchRemote($clf_url, $result))
     119        $get_data = array(
     120          'action' => 'test',
     121          'version' => PHPWG_VERSION,
     122        );
     123        if (fetchRemote($clf_url, $result, $get_data))
    122124        {
    123125          $lines = explode("\r\n", $result);
Note: See TracChangeset for help on using the changeset viewer.