Changeset 1107


Ignore:
Timestamp:
Mar 28, 2006, 3:26:37 AM (18 years ago)
Author:
rvelices
Message:

fix: php 5 errors and warnings

improve: put back update remote site from local listing.xml functionality
(allow_url_fopen is false on several ISPs)

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_manager.php

    • Property svn:keywords set to Author Date Id Revision
    r1080 r1107  
    77// | branch        : BSF (Best So Far)
    88// | file          : $RCSfile$
    9 // | last update   : $Date: 2006-01-31 21:46:26 -0500 (Tue, 31 Jan 2006) $
    10 // | last modifier : $Author: rvelices $
    11 // | revision      : $Revision: 1020 $
     9// | last update   : $Date$
     10// | last modifier : $Author$
     11// | revision      : $Revision$
    1212// +-----------------------------------------------------------------------+
    1313// | This program is free software; you can redistribute it and/or modify  |
     
    112112    if ($is_remote)
    113113    {
    114       $clf_url = $url.'create_listing_file.php';
    115       $clf_url.= '?action=test';
    116       $clf_url.= '&version='.PHPWG_VERSION;
    117       if ($lines = @file($clf_url))
     114      if ( ! isset($_POST['no_check']) )
    118115      {
    119         $first_line = strip_tags($lines[0]);
    120         if (!preg_match('/^PWG-INFO-2:/', $first_line))
     116        $clf_url = $url.'create_listing_file.php';
     117        $clf_url.= '?action=test';
     118        $clf_url.= '&version='.PHPWG_VERSION;
     119        if ($lines = @file($clf_url))
    121120        {
    122           array_push($page['errors'],
    123                      l10n('site_err').' : '.$first_line);
     121          $first_line = strip_tags($lines[0]);
     122          if (!preg_match('/^PWG-INFO-2:/', $first_line))
     123          {
     124            array_push($page['errors'],
     125                       l10n('site_err').' : '.$first_line);
     126          }
    124127        }
    125       }
    126       else
    127       {
    128         array_push($page['errors'], l10n('site_err_remote_file_not_found') );
     128        else
     129        {
     130          array_push($page['errors'], l10n('site_err_remote_file_not_found') );
     131        }
    129132      }
    130133    }
     
    211214// +-----------------------------------------------------------------------+
    212215
     216if ( is_file(PHPWG_ROOT_PATH.'listing.xml') )
     217{
     218  $xml_content = getXmlCode(PHPWG_ROOT_PATH.'listing.xml');
     219  $local_listing_site_url = getAttribute(
     220          getChild($xml_content, 'informations'),
     221          'url'
     222        );
     223  if ( !url_is_remote($local_listing_site_url) )
     224  {
     225    $local_listing_site_url = null;
     226  }
     227}
     228
    213229$query = '
    214230SELECT s.*, COUNT(c.id) AS nb_categories, SUM(c.nb_images) AS nb_images
    215 FROM '.SITES_TABLE.' AS s LEFT JOIN '.CATEGORIES_TABLE.' AS c
    216 ON s.id=c.site_id
    217 GROUP BY s.id'.
     231  FROM '.SITES_TABLE.' AS s LEFT JOIN '.CATEGORIES_TABLE.' AS c
     232  ON s.id=c.site_id
     233  GROUP BY s.id'.
    218234';';
    219235$result = pwg_query($query);
     
    255271   }
    256272
    257    if ($row['id'] != 1)
    258    {
    259      $template->assign_block_vars( 'sites.site.delete',
    260        array('U_DELETE' => $base_url.'delete') );
    261    }
    262 }
     273  if ($row['id'] != 1)
     274  {
     275    $template->assign_block_vars( 'sites.site.delete',
     276      array('U_DELETE' => $base_url.'delete') );
     277  }
     278
     279  if ( isset($local_listing_site_url) and
     280       $row['galleries_url']==$local_listing_site_url )
     281  {
     282    $local_listing_site_id = $row['id'];
     283    $template->assign_block_vars( 'local_listing',
     284        array(
     285          'URL' =>  $local_listing_site_url,
     286        )
     287      );
     288
     289    $template->assign_block_vars( 'local_listing.update',
     290          array(
     291            'U_SYNCHRONIZE' => $update_url.'&local_listing=1'
     292            )
     293        );
     294  }
     295}
     296
     297if ( isset($local_listing_site_url) and !isset($local_listing_site_id) )
     298{
     299  $template->assign_block_vars( 'local_listing',
     300      array(
     301        'URL' =>  $local_listing_site_url,
     302      )
     303    );
     304
     305  $template->assign_block_vars( 'local_listing.create',
     306        array('NAME' => $local_listing_site_url)
     307      );
     308}
     309
    263310
    264311$template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager');
  • trunk/admin/site_reader_remote.php

    • Property svn:keywords set to Author Date Id Revision
    r1064 r1107  
    77// | branch        : BSF (Best So Far)
    88// | file          : $RCSfile$
    9 // | last update   : $Date: 2005-12-03 17:03:58 -0500 (Sat, 03 Dec 2005) $
    10 // | last modifier : $Author: plg $
    11 // | revision      : $Revision: 967 $
     9// | last update   : $Date$
     10// | last modifier : $Author$
     11// | revision      : $Revision$
    1212// +-----------------------------------------------------------------------+
    1313// | This program is free software; you can redistribute it and/or modify  |
     
    3232
    3333var $site_url;
     34var $listing_url;
    3435var $site_dirs;
    3536var $site_files;
     
    3738var $update_attributes;
    3839
    39 function RemoteSiteReader($url)
     40function RemoteSiteReader($url, $listing_url)
    4041{
    4142  $this->site_url = $url;
     
    4647    'representative_ext', 'has_high', 'filesize', 'width', 'height'
    4748    );
     49
     50  if (!isset($listing_url))
     51  {
     52    $this->listing_url = $this->site_url.'/listing.xml';
     53  }
     54  else
     55  {
     56    $this->listing_url = $listing_url;
     57  }
    4858}
    4959
     
    5666{
    5767  global $errors;
    58  
    59   $listing_file = $this->site_url.'/listing.xml';
    60   if (@fopen($listing_file, 'r'))
     68
     69  if (@fopen($this->listing_url, 'r'))
    6170  {
    6271    $this->site_dirs = array();
    6372    $this->site_files = array();
    64     $xml_content = getXmlCode($listing_file);
     73    $xml_content = getXmlCode($this->listing_url);
    6574    $info_xml_element = getChild($xml_content, 'informations');
    6675    if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION)
     
    6978        $errors,
    7079        array(
    71           'path' => $listing_file,
     80          'path' => $this->listing_url,
    7281          'type' => 'PWG-ERROR-VERSION'
    7382          )
    7483        );
    75      
     84
    7685      return false;
    7786    }
     
    8190      explode(',', getAttribute($info_xml_element, 'metadata'))
    8291      );
    83    
     92
    8493    $this->build_structure($xml_content, '', 0);
    85    
     94
    8695    return true;
    8796  }
     
    91100      $errors,
    92101      array(
    93         'path' => $listing_file,
     102        'path' => $this->listing_url,
    94103        'type' => 'PWG-ERROR-NOLISTING'
    95104        )
  • trunk/admin/site_update.php

    • Property svn:keywords set to Author Date Id Revision
    r1072 r1107  
    77// | branch        : BSF (Best So Far)
    88// | file          : $RCSfile$
    9 // | last update   : $Date: 2005-12-03 17:03:58 -0500 (Sat, 03 Dec 2005) $
    10 // | last modifier : $Author: plg $
    11 // | revision      : $Revision: 967 $
     9// | last update   : $Date$
     10// | last modifier : $Author$
     11// | revision      : $Revision$
    1212// +-----------------------------------------------------------------------+
    1313// | This program is free software; you can redistribute it and/or modify  |
     
    8787{
    8888  include_once(PHPWG_ROOT_PATH.'admin/site_reader_remote.php');
    89   $site_reader = new RemoteSiteReader($site_url);
     89  $local_listing = null;
     90  if ( isset($_GET['local_listing'])
     91      and $_GET['local_listing'] )
     92  {
     93    $local_listing = PHPWG_ROOT_PATH.'listing.xml';
     94  }
     95  $site_reader = new RemoteSiteReader($site_url, $local_listing);
    9096}
    9197else
     
    432438          )
    433439        );
    434      
     440
    435441      continue;
    436442    }
     
    454460          'path'           => $path,
    455461          );
    456        
     462
    457463        array_push(
    458464          $inserts,
    459465          $insert
    460466          );
    461        
     467
    462468        array_push(
    463469          $insert_links,
     
    725731  }
    726732  $update_fields = $site_reader->get_update_attributes();
    727   $update_fields = array_merge($update_fields, 'date_metadata_update');
     733  $update_fields = array_merge($update_fields, array('date_metadata_update'));
    728734  $fields =
    729735      array(
  • trunk/include/calendar_base.class.php

    • Property svn:keywords set to Author Date Id Revision
    r1092 r1107  
    66// | branch        : BSF (Best So Far)
    77// | file          : $RCSfile$
    8 // | last update   : $Date: 2006-01-27 02:11:43 +0100 (ven, 27 jan 2006) $
    9 // | last modifier : $Author: rvelices $
    10 // | revision      : $Revision: 1014 $
     8// | last update   : $Date$
     9// | last modifier : $Author$
     10// | revision      : $Revision$
    1111// +-----------------------------------------------------------------------+
    1212// | This program is free software; you can redistribute it and/or modify  |
     
    182182        $nav_bar .= '<span class="'.$class_prefix.'">';
    183183        $url = duplicate_index_url(
    184           array('chronology_date'=>array_merge($date_components,$item)),
     184          array('chronology_date'=>array_merge($date_components,array($item))),
    185185          array( 'start' )
    186186            );
     
    208208        $nav_bar .= '<span class="'.$class_prefix.'">';
    209209        $url = duplicate_index_url(
    210           array('chronology_date'=>array_merge($date_components,'any')),
     210          array('chronology_date'=>array_merge($date_components,array('any'))),
    211211          array( 'start' )
    212212            );
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r1105 r1107  
    302302$lang['remote_site_generate'] = 'generate listing';
    303303$lang['remote_site_generate_hint'] = 'generate file listing.xml on remote site';
     304$lang['remote_site_local_create'] = 'Create this site';
    304305$lang['remote_site_local_found'] = 'A local listing.xml file has been found for ';
    305306$lang['remote_site_local_update'] = 'read local listing.xml and update';
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r1105 r1107  
    302302$lang['remote_site_generate'] = 'générer le listing';
    303303$lang['remote_site_generate_hint'] = 'générer le fichier listing.xml sur le site distant';
     304$lang['remote_site_local_create'] = 'Créer ce site';
    304305$lang['remote_site_local_found'] = 'Un fichier listing.xml local a été trouvé pour ';
    305306$lang['remote_site_local_update'] = 'lire le listing.xml local et mettre à jour';
  • trunk/picture.php

    r1106 r1107  
    2828define('PHPWG_ROOT_PATH','./');
    2929include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
    30 include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
    3130include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
    3231
     
    166165    case 'rate' :
    167166    {
     167      include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
    168168      rate_picture($page['image_id'], $_GET['rate']);
    169169      redirect($url_self);
     
    757757include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
    758758include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
    759 include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
    760 
     759if ($metadata_showable and isset($_GET['metadata']))
     760{
     761  include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
     762}
    761763//------------------------------------------------------------ log informations
    762764pwg_log( 'picture', $title_img, $picture['current']['file'] );
  • trunk/template/yoga/admin/site_manager.tpl

    • Property svn:keywords set to Author Date Id Revision
    r1085 r1107  
    1 <!-- $Id: remote_site.tpl 980 2005-12-10 15:24:53Z chrisaga $ -->
     1<!-- $Id$ -->
    22<div class="titrePage">
    33  <ul class="categoryActions">
     
    1616</div>
    1717<!-- END remote_output -->
     18
     19<!-- BEGIN local_listing -->
     20{lang:remote_site_local_found} {local_listing.URL}
     21<!-- BEGIN create -->
     22<form action="" method="post">
     23  <p>
     24    {lang:remote_site_local_create}:
     25    <input type="hidden" name="no_check" value="1"/>
     26    <input type="hidden" name="galleries_url" value="{local_listing.URL}" />
     27    <input type="submit" name="submit" value="{lang:submit}"/>
     28  </p>
     29</form>
     30<!-- END create -->
     31<!-- BEGIN update -->
     32<a href="{local_listing.update.U_SYNCHRONIZE}" title="{lang:remote_site_local_update}">{lang:site_synchronize}</a>
     33<!-- END update -->
     34<!-- END local_listing -->
    1835
    1936<!-- BEGIN sites -->
Note: See TracChangeset for help on using the changeset viewer.