Changeset 2902 for trunk/admin/include


Ignore:
Timestamp:
Nov 23, 2008, 6:23:57 PM (16 years ago)
Author:
patdenice
Message:
  • Add home and identification buttons after installation.
  • Use fetchRemote function for remote site actions.
  • Corrections in fetchRemote fnction.
  • Move PLUGIN_PICTURE_BEFORE in picture.tpl.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r2900 r2902  
    19491949function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0)
    19501950{
     1951  // Try to retrieve data from local file?
     1952  if (!url_is_remote($src))
     1953  {
     1954    $content = @file_get_contents($src);
     1955    if ($content !== false)
     1956    {
     1957      is_resource($dest) ? @fwrite($dest, $content) : $dest = $content;
     1958      return true;
     1959    }
     1960    else
     1961    {
     1962      return false;
     1963    }
     1964  }
     1965
    19511966  // After 3 redirections, return false
    19521967  if ($step > 3) return false;
     
    19651980    $content = @curl_exec($ch);
    19661981    $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE);
     1982    $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
    19671983    @curl_close($ch);
    1968     if ($content !== false)
     1984    if ($content !== false and $status >= 200 and $status < 400)
    19691985    {
    19701986      if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m))
Note: See TracChangeset for help on using the changeset viewer.