Changeset 1090 for trunk/picture.php


Ignore:
Timestamp:
Mar 21, 2006, 2:27:21 AM (18 years ago)
Author:
rvelices
Message:

URL rewriting: fix some old links, calendar simplification and prepare code
for urls without ? (added functions get_root_url and add_url_param)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r1086 r1090  
    277277  $file_wo_ext = get_filename_wo_extension($row['file']);
    278278
    279   $icon = get_themeconf('mime_icon_dir');
    280   $icon.= strtolower(get_extension($row['file'])).'.png';
    281 
    282279  if (isset($row['representative_ext']) and $row['representative_ext'] != '')
    283280  {
     
    288285  else
    289286  {
     287    $icon = get_themeconf('mime_icon_dir');
     288    $icon.= strtolower(get_extension($row['file'])).'.png';
    290289    $picture[$i]['src'] = $icon;
    291290  }
     
    301300      {
    302301        $url_high=$cat_directory.'/pwg_high/'.$row['file'];
    303         $picture[$i]['high'] = $url_high;
     302        $picture[$i]['high_file_system'] = $picture[$i]['high'] = $url_high;
     303        if ( ! url_is_remote($picture[$i]['high']) )
     304        {
     305          $picture[$i]['high'] = get_root_url().$picture[$i]['high'];
     306        }
    304307      }
    305308    }
     309  }
     310  $picture[$i]['src_file_system'] = $picture[$i]['src'];
     311  if ( ! url_is_remote($picture[$i]['src']) )
     312  {
     313    $picture[$i]['src'] = get_root_url(). $picture[$i]['src'];
    306314  }
    307315
     
    309317  if (!$picture[$i]['is_picture'])
    310318  {
    311     $picture[$i]['download'] = $row['path'];
     319    $picture[$i]['download'] = url_is_remote($row['path']) ? '' : get_root_url();
     320    $picture[$i]['download'].= $row['path'];
    312321  }
    313322
     
    326335    array(
    327336      'image_id' => $row['id'],
     337      'image_file' => $row['file'],
    328338      ),
    329339    array(
     
    343353
    344354$url_admin =
    345   PHPWG_ROOT_PATH.'admin.php?page=picture_modify'
     355  get_root_url().'admin.php?page=picture_modify'
    346356  .'&cat_id='.(isset($page['category']) ? $page['category'] : '')
    347357  .'&image_id='.$page['image_id']
    348358;
    349359
    350 $url_slide =
    351   $picture['current']['url']
    352   .'&slideshow='.$conf['slideshow_period']
    353 ;
     360$url_slide = add_url_param(
     361  $picture['current']['url'],
     362  'slideshow='.$conf['slideshow_period'] );
    354363
    355364$title =  $picture['current']['name'];
     
    358367{
    359368  $refresh= $_GET['slideshow'];
    360   $url_link = $picture['next']['url'].'&slideshow='.$refresh;
     369  $url_link = add_url_param($picture['next']['url'], 'slideshow='.$refresh);
    361370}
    362371
     
    378387if (empty($picture['current']['width']))
    379388{
    380   $taille_image = @getimagesize($picture['current']['src']);
     389  $taille_image = @getimagesize($picture['current']['src_file_system']);
    381390  $original_width = $taille_image[0];
    382391  $original_height = $taille_image[1];
     
    511520    'download',
    512521    array(
    513       'U_DOWNLOAD' => PHPWG_ROOT_PATH.'action.php?dwn='
    514       .$picture['current']['high']
     522      'U_DOWNLOAD' => get_root_url().'action.php?dwn='
     523      .$picture['current']['high_file_system']
    515524      )
    516525    );
     
    523532    'representative',
    524533    array(
    525       'URL' => $url_self.'&action=set_as_representative'
     534      'URL' => add_url_param($url_self, 'action=set_as_representative')
    526535      )
    527536    );
     
    534543    'caddie',
    535544    array(
    536       'URL' => $url_self.'&action=add_to_caddie'
     545      'URL' => add_url_param($url_self, 'action=add_to_caddie')
    537546      )
    538547    );
     
    554563  if ($row['nb_fav'] == 0)
    555564  {
    556     $url = $url_self.'&action=add_to_favorites';
    557 
    558565    $template->assign_block_vars(
    559566      'favorite',
    560567      array(
    561         'FAVORITE_IMG'  => get_themeconf('icon_dir').'/favorite.png',
     568        'FAVORITE_IMG'  => get_root_url().get_themeconf('icon_dir').'/favorite.png',
    562569        'FAVORITE_HINT' => $lang['add_favorites_hint'],
    563570        'FAVORITE_ALT'  => $lang['add_favorites_alt'],
    564         'U_FAVORITE'    => $url_self.'&action=add_to_favorites',
     571        'U_FAVORITE'    => add_url_param($url_self, 'action=add_to_favorites'),
    565572        )
    566573      );
     
    571578      'favorite',
    572579      array(
    573         'FAVORITE_IMG'  => get_themeconf('icon_dir').'/del_favorite.png',
     580        'FAVORITE_IMG'  => get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
    574581        'FAVORITE_HINT' => $lang['del_favorites_hint'],
    575582        'FAVORITE_ALT'  => $lang['del_favorites_alt'],
    576         'U_FAVORITE'    => $url_self.'&action=remove_from_favorites',
     583        'U_FAVORITE'    => add_url_param($url_self, 'action=remove_from_favorites'),
    577584        )
    578585      );
     
    622629  $val = format_date($picture['current']['date_creation']);
    623630  $url = make_index_URL(
    624           array(
    625             'chronology' =>
    626               array(
    627                 'field'=>'created',
    628                 'style'=>'monthly',
    629                 'view'=>'list',
    630               ),
    631              'chronology_date' => explode('-', $picture['current']['date_creation'])
    632            )
    633          );
     631        array(
     632          'chronology_field'=>'created',
     633          'chronology_style'=>'monthly',
     634          'chronology_view'=>'list',
     635          'chronology_date' => explode('-', $picture['current']['date_creation'])
     636        )
     637      );
    634638  $infos['INFO_CREATION_DATE'] = '<a href="'.$url.'">'.$val.'</a>';
    635639}
     
    642646$val = format_date($picture['current']['date_available'], 'mysql_datetime');
    643647$url = make_index_URL(
    644         array(
    645           'chronology' =>
    646             array(
    647               'field'=>'posted',
    648               'style'=>'monthly',
    649               'view'=>'list',
    650             ),
    651            'chronology_date' => explode('-', substr($picture['current']['date_available'],0,10))
    652          )
    653        );
     648      array(
     649        'chronology_field'=>'posted',
     650        'chronology_style'=>'monthly',
     651        'chronology_view'=>'list',
     652        'chronology_date'=>explode('-', substr($picture['current']['date_available'],0,10))
     653      )
     654    );
    654655$infos['INFO_POSTED_DATE'] = '<a href="'.$url.'">'.$val.'</a>';
    655656
Note: See TracChangeset for help on using the changeset viewer.