Changeset 2902 for trunk/admin


Ignore:
Timestamp:
Nov 23, 2008, 6:23:57 PM (15 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.
Location:
trunk/admin
Files:
4 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))
  • trunk/admin/site_manager.php

    r2530 r2902  
    4545  global $template, $page;
    4646
    47   if($lines = @file($url))
    48   {
     47  if (fetchRemote($url, $result))
     48  {
     49    $lines = explode("\r\n", $result);
    4950    // cleaning lines from HTML tags
    5051    foreach ($lines as $line)
     
    113114        $clf_url.= '?action=test';
    114115        $clf_url.= '&version='.PHPWG_VERSION;
    115         if ( ($lines = @file($clf_url)) !== false)
     116        if (fetchRemote($clf_url, $result))
    116117        {
     118          $lines = explode("\r\n", $result);
    117119          $first_line = strip_tags($lines[0]);
    118120          if (!preg_match('/^PWG-INFO-2:/', $first_line))
  • trunk/admin/site_reader_remote.php

    r2299 r2902  
    4949  if (!isset($listing_url))
    5050  {
    51     $this->listing_url = $this->site_url.'/listing.xml';
     51    $this->listing_url = $this->site_url.'listing.xml';
    5252  }
    5353  else
     
    6666  global $errors;
    6767
    68   if (@fopen($this->listing_url, 'r'))
     68  if ($xml_content = getXmlCode($this->listing_url))
    6969  {
    7070    $this->site_dirs = array();
    7171    $this->site_files = array();
    72     $xml_content = getXmlCode($this->listing_url);
    7372    $info_xml_element = getChild($xml_content, 'informations');
    7473    if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION)
  • trunk/admin/template/goto/install.tpl

    r2819 r2902  
    146146  </table>
    147147</form>
     148{else}
     149<p>
     150  <br />
     151  <input type="button" name="index" value="{'home'|@translate}" onClick="document.location = 'index.php';"/>
     152  <input type="button" name="identification" value="{'Identification'|@translate}" onClick="document.location = 'identification.php';"/>
     153</p>
    148154{/if}
    149155</div> {* content *}
Note: See TracChangeset for help on using the changeset viewer.