Ignore:
Timestamp:
Mar 5, 2006, 12:31:46 AM (19 years ago)
Author:
plg
Message:

new feature: source/destination links between categories. Will we keep this
feature? Code is complicated and very few people will understand how it
works...

modification: #images.storage_category_id replaced by
#image_category.is_storage

improvement: many code refactoring to improve readibility

improvement: virtual category creation code was moved to a dedicated
function in order to be called from admin/cat_list.php and
admin/cat_modify.php (create a new destination category)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_reader_remote.php

    r1058 r1064  
    4040{
    4141  $this->site_url = $url;
    42   $this->insert_attributes = array('tn_ext', 'representative_ext', 'has_high');
    43   $this->update_attributes = array( 'representative_ext', 'has_high', 'filesize', 'width', 'height' );
     42  $this->insert_attributes = array(
     43    'tn_ext', 'representative_ext', 'has_high'
     44    );
     45  $this->update_attributes = array(
     46    'representative_ext', 'has_high', 'filesize', 'width', 'height'
     47    );
    4448}
    4549
     
    5256{
    5357  global $errors;
     58 
    5459  $listing_file = $this->site_url.'/listing.xml';
    5560  if (@fopen($listing_file, 'r'))
     
    5964    $xml_content = getXmlCode($listing_file);
    6065    $info_xml_element = getChild($xml_content, 'informations');
    61     if ( getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION )
    62     {
    63       array_push($errors, array('path' => $listing_file, 'type' => 'PWG-ERROR-VERSION'));
     66    if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION)
     67    {
     68      array_push(
     69        $errors,
     70        array(
     71          'path' => $listing_file,
     72          'type' => 'PWG-ERROR-VERSION'
     73          )
     74        );
     75     
    6476      return false;
    6577    }
    66     $meta_attributes = explode ( ',',
    67         getAttribute($info_xml_element , 'metadata') );
    68     $this->update_attributes = array_merge( $this->update_attributes, $meta_attributes );
     78
     79    $this->update_attributes = array_merge(
     80      $this->update_attributes,
     81      explode(',', getAttribute($info_xml_element, 'metadata'))
     82      );
     83   
    6984    $this->build_structure($xml_content, '', 0);
     85   
    7086    return true;
    7187  }
    7288  else
    7389  {
    74     array_push($errors, array('path' => $listing_file, 'type' => 'PWG-ERROR-NOLISTING'));
     90    array_push(
     91      $errors,
     92      array(
     93        'path' => $listing_file,
     94        'type' => 'PWG-ERROR-NOLISTING'
     95        )
     96      );
     97
    7598    return false;
    7699  }
     
    84107  {
    85108    $full_dir = $this->site_url . $dir;
    86     if ( $full_dir!=$basedir
    87       and strpos($full_dir, $basedir)===0
     109    if ($full_dir != $basedir
     110        and strpos($full_dir, $basedir) === 0
    88111      )
    89112    {
     
    106129  {
    107130    $full_dir = $this->site_url . $dir;
    108     if ( strpos($full_dir, $path)===0 )
    109     {
    110       foreach ( $files as $file)
     131    if (strpos($full_dir, $path) === 0)
     132    {
     133      foreach ($files as $file)
    111134      {
    112         $data = $this->get_element_attributes($file,
    113                                               $this->insert_attributes);
     135        $data = $this->get_element_attributes(
     136          $file,
     137          $this->insert_attributes
     138          );
    114139        $elements[$file] = $data;
    115140      }
     
    130155function get_element_update_attributes($file)
    131156{
    132     return $this->get_element_attributes($file,
    133                                          $this->update_attributes);
     157  return $this->get_element_attributes(
     158    $file,
     159    $this->update_attributes
     160    );
    134161}
    135162
     
    144171{
    145172  $xml_element = $this->site_files[$file];
    146   if ( ! isset($xml_element) )
     173  if (!isset($xml_element))
    147174  {
    148175    return null;
     
    178205  if ($basedir != '')
    179206  {
    180     $xml_elements = getChildren( getChild($xml_content, 'root'), 'element' );
     207    $xml_elements = getChildren(
     208      getChild($xml_content, 'root'),
     209      'element'
     210      );
    181211    foreach ($xml_elements as $xml_element)
    182212    {
    183213      $path = getAttribute($xml_element, 'path');
    184214      $this->site_files[$path] = $xml_element;
    185       array_push( $this->site_dirs[$basedir], $path);
     215      array_push($this->site_dirs[$basedir], $path);
    186216    }
    187217  }
Note: See TracChangeset for help on using the changeset viewer.