Changeset 1086


Ignore:
Timestamp:
Mar 17, 2006, 5:13:19 AM (18 years ago)
Author:
rvelices
Message:

URL rewrite for chronology: uses $pagechronology and
$pagechronology_date. $pagechronology is an array with 'field',
'style' and 'view' keys. This is step 1.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/category.php

    r1084 r1086  
    132132$icon_recent = get_icon(date('Y-m-d'));
    133133
    134 $calendar_view_link = duplicate_index_URL(
    135   array(),                            // nothing to redefine
    136   array('chronology_type', 'start')   // what to remove ?
    137   );
    138 
    139 if (!isset($page['chronology_type']))
    140 {
    141   $calendar_view_link.= '/calendar-';
    142 
     134if (!isset($page['chronology']))
     135{
     136  $chronology =
     137    array(
     138      'chronology' =>
     139        array(
     140          'field' => 'created',
     141          'style' => 'monthly',
     142          'view' => 'list',
     143        )
     144    );
    143145  $template->assign_block_vars(
    144146    'mode_created',
    145147    array(
    146       'URL' => $calendar_view_link.'created'
    147       )
    148     );
    149 
     148      'URL' => duplicate_index_URL( $chronology, array('start') )
     149      )
     150    );
     151
     152  $chronology['chronology']['field'] = 'posted';
    150153  $template->assign_block_vars(
    151154    'mode_posted',
    152155    array(
    153       'URL' => $calendar_view_link.'posted'
     156      'URL' => duplicate_index_URL( $chronology, array('start') )
    154157      )
    155158    );
     
    160163    'mode_normal',
    161164    array(
    162       'URL' => $calendar_view_link
    163       )
    164     );
    165 
    166   $calendar_view_link .= '/calendar-';
    167   if ($page['chronology_type'] == 'created')
    168   {
    169     $template->assign_block_vars(
    170       'mode_posted',
    171       array(
    172         'URL' => $calendar_view_link.'posted'
    173         )
    174       );
     165      'URL' => duplicate_index_URL( array(), array('chronology','start') )
     166      )
     167    );
     168
     169  $chronology = $page['chronology'];
     170  if ($chronology['field'] == 'created')
     171  {
     172    $chronology['field'] = 'posted';
    175173  }
    176174  else
    177175  {
    178     $template->assign_block_vars(
    179       'mode_created',
    180       array(
    181         'URL' => $calendar_view_link.'created'
    182         )
    183       );
    184   }
     176    $chronology['field'] = 'created';
     177  }
     178  $url = duplicate_index_URL(
     179            array(
     180              'chronology'=>$chronology
     181            ),
     182            array('chronology_date', 'start')
     183          );
     184  $template->assign_block_vars(
     185    'mode_'.$chronology['field'],
     186    array('URL' => $url )
     187    );
    185188}
    186189
     
    294297  array(
    295298    'URL' =>
    296       make_index_URL()
    297       .'/calendar-'
    298       .($conf['calendar_datefield'] == 'date_available' ? 'posted' : 'created')
    299       .'-monthly-c',
     299      make_index_URL(
     300        array(
     301          'chronology'=>
     302            array(
     303              'field' => ($conf['calendar_datefield']=='date_available' ? 'posted' : 'created'),
     304              'style' => 'monthly',
     305              'view' => 'calendar'
     306            )
     307        )
     308      ),
    300309    'TITLE' => $lang['calendar_hint'],
    301310    'NAME' => $lang['calendar']
  • trunk/include/calendar_base.class.php

    r1069 r1086  
    3434  // used for queries (INNER JOIN or normal)
    3535  var $inner_sql;
    36   // base url used when generating html links
    37   var $url_base;
    38   // array of date components e.g. (2005,10,12) ...
    39   var $date_components;
    4036  //
    4137  var $calendar_levels;
     
    4541  /**
    4642   * Initialize the calendar
    47    * @param string date_field db column on which this calendar works
    4843   * @param string inner_sql used for queries (INNER JOIN or normal)
    49    * @param array date_components
    50    */
    51   function initialize($date_field, $inner_sql, $date_components)
    52   {
    53     $this->date_field = $date_field;
     44   */
     45  function initialize($inner_sql)
     46  {
     47    global $page;
     48    if ($page['chronology']['field']=='posted')
     49    {
     50      $this->date_field = 'date_available';
     51    }
     52    else
     53    {
     54      $this->date_field = 'date_creation';
     55    }
    5456    $this->inner_sql = $inner_sql;
    55     $this->date_components = $date_components;
    5657    $this->has_nav_bar = false;
    5758  }
     
    5960  function get_display_name()
    6061  {
    61     global $conf;
     62    global $conf, $page;
    6263    $res = '';
    63     $url = $this->url_base;
    64 
    65     for ($i=0; $i<count($this->date_components); $i++)
     64
     65    for ($i=0; $i<count($page['chronology_date']); $i++)
    6666    {
    6767      $res .= $conf['level_separator'];
    68       if ($i>0)
    69       {
    70         $url .= '-';
    71       }
    72       $url .= $this->date_components[$i];
    73       if ( isset($this->date_components[$i+1]) )
    74       {
     68      if ( isset($page['chronology_date'][$i+1]) )
     69      {
     70        $chronology_date = array_slice($page['chronology_date'],0, $i+1);
     71        $url = duplicate_index_url(
     72            array( 'chronology_date'=>$chronology_date ),
     73            array( 'start' )
     74            );
    7575        $res .=
    7676          '<a href="'.$url.'">'
    77           .$this->get_date_component_label($i, $this->date_components[$i])
     77          .$this->get_date_component_label($i, $page['chronology_date'][$i])
    7878          .'</a>';
    7979      }
     
    8282        $res .=
    8383          '<span class="calInHere">'
    84           .$this->get_date_component_label($i, $this->date_components[$i])
     84          .$this->get_date_component_label($i, $page['chronology_date'][$i])
    8585          .'</span>';
    8686      }
     
    132132   * Creates a calendar navigation bar.
    133133   *
    134    * @param string url_base - links start with this root
     134   * @param array date_components
    135135   * @param array items - hash of items to put in the bar (e.g. 2005,2006)
    136136   * @param array selected_item - item currently selected (e.g. 2005)
     
    141141   * @return string the navigation bar
    142142   */
    143   function get_nav_bar_from_items($url_base, $items, $selected_item,
     143  function get_nav_bar_from_items($date_components, $items, $selected_item,
    144144                                  $class_prefix, $show_any,
    145145                                  $show_empty=false, $labels=null)
    146146  {
    147     global $conf;
     147    global $conf, $page;
    148148
    149149    $nav_bar = '';
     
    181181      {
    182182        $nav_bar .= '<span class="'.$class_prefix.'">';
    183         $url = $url_base . $item;
     183        $url = duplicate_index_url(
     184          array('chronology_date'=>array_merge($date_components,$item)),
     185          array( 'start' )
     186            );
    184187        $nav_bar .= '<a href="'.$url.'">';
    185188        $nav_bar .= $label;
     
    204207      {
    205208        $nav_bar .= '<span class="'.$class_prefix.'">';
    206         $url = $url_base . 'any';
     209        $url = duplicate_index_url(
     210          array('chronology_date'=>array_merge($date_components,'any')),
     211          array( 'start' )
     212            );
    207213        $nav_bar .= '<a href="'.$url.'">';
    208214        $nav_bar .= $label;
     
    222228  function build_nav_bar($level, $labels=null)
    223229  {
    224     global $template, $conf;
     230    global $template, $conf, $page;
    225231
    226232    $query = '
     
    241247
    242248    if ( count($level_items)==1 and
    243          count($this->date_components)<count($this->calendar_levels)-1)
    244     {
    245       if ( ! isset($this->date_components[$level]) )
     249         count($page['chronology_date'])<count($this->calendar_levels)-1)
     250    {
     251      if ( ! isset($page['chronology_date'][$level]) )
    246252      {
    247253        list($key) = array_keys($level_items);
    248         $this->date_components[$level] = (int)$key;
    249 
    250         if ( $level<count($this->date_components) and
     254        $page['chronology_date'][$level] = (int)$key;
     255
     256        if ( $level<count($page['chronology_date']) and
    251257             $level!=count($this->calendar_levels)-1 )
    252258        {
     
    256262    }
    257263
    258     $url_base = $this->url_base;
    259     for ($i=0; $i<$level; $i++)
    260     {
    261       if (isset($this->date_components[$i]))
    262       {
    263         $url_base .= $this->date_components[$i].'-';
    264       }
    265     }
    266264    $nav_bar = $this->get_nav_bar_from_items(
    267       $url_base,
     265      $page['chronology_date'],
    268266      $level_items,
    269267      null,
     
    289287  function build_next_prev()
    290288  {
    291     global $template;
     289    global $template, $page;
    292290    $prev = $next =null;
    293     if ( empty($this->date_components) )
     291    if ( empty($page['chronology_date']) )
    294292      return;
    295293    $query = 'SELECT CONCAT_WS("-"';
    296     for ($i=0; $i<count($this->date_components); $i++)
    297     {
    298       if ( 'any' === $this->date_components[$i] )
     294    for ($i=0; $i<count($page['chronology_date']); $i++)
     295    {
     296      if ( 'any' === $page['chronology_date'] )
    299297      {
    300298        $query .= ','.'"any"';
     
    305303      }
    306304    }
    307     $current = implode('-', $this->date_components );
     305    $current = implode('-', $page['chronology_date'] );
    308306
    309307    $query.=') as period' . $this->inner_sql .'
     
    328326      $template->assign_block_vars( 'calendar.navbar', array() );
    329327    }
     328
    330329    if ( $current_rank>0 )
    331330    { // has previous
    332331      $prev = $upper_items[$current_rank-1];
     332      $chronology_date = explode('-', $prev);
    333333      $template->assign_block_vars(
    334334        'calendar.navbar.prev',
    335335        array(
    336336          'LABEL' => $this->get_date_nice_name($prev),
    337           'URL' => $this->url_base . $prev,
     337          'URL' => duplicate_index_url(
     338                array('chronology_date'=>$chronology_date), array('start')
     339                )
    338340          )
    339341        );
    340342    }
    341343    if ( $current_rank < count($upper_items)-1 )
    342     {
    343       // has next
     344    { // has next
    344345      $next = $upper_items[$current_rank+1];
     346      $chronology_date = explode('-', $next);
    345347      $template->assign_block_vars(
    346348        'calendar.navbar.next',
    347349        array(
    348350          'LABEL' => $this->get_date_nice_name($next),
    349           'URL' => $this->url_base . $next,
     351          'URL' => duplicate_index_url(
     352                array('chronology_date'=>$chronology_date), array('start')
     353                )
    350354          )
    351355        );
  • trunk/include/calendar_monthly.class.php

    r1069 r1086  
    1 <?php
     1  <?php
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
     
    3939  /**
    4040   * Initialize the calendar
    41    * @param string date_field db column on which this calendar works
    4241   * @param string inner_sql used for queries (INNER JOIN or normal)
    43    * @param array date_components
    4442   */
    45   function initialize($date_field, $inner_sql, $date_components)
    46   {
    47     parent::initialize($date_field, $inner_sql, $date_components);
     43  function initialize($inner_sql)
     44  {
     45    parent::initialize($inner_sql);
    4846    global $lang;
    4947    $this->calendar_levels = array(
     
    6866 * where not included here, true otherwise
    6967 */
    70 function generate_category_content($url_base, $view_type)
    71 {
    72   global $conf;
    73 
    74   $this->url_base = $url_base;
    75 
     68function generate_category_content()
     69{
     70  global $conf, $page;
     71
     72  $view_type = $page['chronology']['view'];
    7673  if ($view_type==CAL_VIEW_CALENDAR)
    7774  {
    78     if ( count($this->date_components)==0 )
     75    if ( count($page['chronology_date'])==0 )
    7976    {//case A: no year given - display all years+months
    8077      if ($this->build_global_calendar())
     
    8279    }
    8380
    84     if ( count($this->date_components)==1 )
     81    if ( count($page['chronology_date'])==1 )
    8582    {//case B: year given - display all days in given year
    8683      if ($this->build_year_calendar())
     
    9188    }
    9289
    93     if ( count($this->date_components)==2 )
     90    if ( count($page['chronology_date'])==2 )
    9491    {//case C: year+month given - display a nice month calendar
    9592      $this->build_month_calendar();
     
    10198  }
    10299
    103   if ($view_type==CAL_VIEW_LIST or count($this->date_components)==3)
     100  if ($view_type==CAL_VIEW_LIST or count($page['chronology_date'])==3)
    104101  {
    105102    $has_nav_bar = false;
    106     if ( count($this->date_components)==0 )
     103    if ( count($page['chronology_date'])==0 )
    107104    {
    108105      $this->build_nav_bar(CYEAR); // years
    109106    }
    110     if ( count($this->date_components)==1)
     107    if ( count($page['chronology_date'])==1)
    111108    {
    112109      $this->build_nav_bar(CMONTH); // month
    113110    }
    114     if ( count($this->date_components)==2 )
     111    if ( count($page['chronology_date'])==2 )
    115112    {
    116113      $day_labels = range( 1, $this->get_all_days_in_month(
    117               $this->date_components[CYEAR] ,$this->date_components[CMONTH] ) );
     114              $page['chronology_date'][CYEAR] ,$page['chronology_date'][CMONTH] ) );
    118115      array_unshift($day_labels, 0);
    119116      unset( $day_labels[0] );
     
    134131function get_date_where($max_levels=3)
    135132{
    136   $date = $this->date_components;
     133  global $page;
     134  $date = $page['chronology_date'];
    137135  while (count($date)>$max_levels)
    138136  {
     
    219217function build_global_calendar()
    220218{
    221   assert( count($this->date_components) == 0 );
     219  global $page;
     220  assert( count($page['chronology_date']) == 0 );
    222221  $query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%Y%m")) as period,
    223222            COUNT( DISTINCT(id) ) as count';
     
    245244  {// only one year exists so bail out to year view
    246245    list($y) = array_keys($items);
    247     $this->date_components[CYEAR] = $y;
     246    $page['chronology_date'][CYEAR] = $y;
    248247    return false;
    249248  }
     
    252251  foreach ( $items as $year=>$year_data)
    253252  {
    254     $url_base = $this->url_base.$year;
    255 
    256     $nav_bar = '<span class="calCalHead"><a href="'.$url_base.'">'.$year.'</a>';
     253    $chronology_date = array( $year );
     254    $url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
     255
     256    $nav_bar = '<span class="calCalHead"><a href="'.$url.'">'.$year.'</a>';
    257257    $nav_bar .= ' ('.$year_data['nb_images'].')';
    258258    $nav_bar .= '</span><br>';
    259259
    260     $url_base .= '-';
    261     $nav_bar .= $this->get_nav_bar_from_items( $url_base,
     260    $nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
    262261            $year_data['children'], null, 'calCal', false, false, $lang['month'] );
    263262
     
    271270function build_year_calendar()
    272271{
    273   assert( count($this->date_components) == 1 );
     272  global $page;
     273  assert( count($page['chronology_date']) == 1 );
    274274  $query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%m%d")) as period,
    275275            COUNT( DISTINCT(id) ) as count';
     
    295295  { // only one month exists so bail out to month view
    296296    list($m) = array_keys($items);
    297     $this->date_components[CMONTH] = $m;
     297    $page['chronology_date'][CMONTH] = $m;
    298298    return false;
    299299  }
     
    301301  foreach ( $items as $month=>$month_data)
    302302  {
    303     $url_base = $this->url_base.$this->date_components[CYEAR].'-'.$month;
    304 
    305     $nav_bar = '<span class="calCalHead"><a href="'.$url_base.'">';
     303    $chronology_date = array( $page['chronology_date'][CYEAR], $month );
     304    $url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
     305
     306    $nav_bar = '<span class="calCalHead"><a href="'.$url.'">';
    306307    $nav_bar .= $lang['month'][$month].'</a>';
    307308    $nav_bar .= ' ('.$month_data['nb_images'].')';
    308309    $nav_bar .= '</span><br>';
    309310
    310     $url_base .= '-';
    311     $nav_bar .= $this->get_nav_bar_from_items( $url_base,
     311    $nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
    312312                     $month_data['children'], null, 'calCal', false );
    313313
     
    322322function build_month_calendar()
    323323{
     324  global $page;
    324325  $query='SELECT DISTINCT(DAYOFMONTH('.$this->date_field.')) as period,
    325326            COUNT( DISTINCT(id) ) as count';
    326327  $query.= $this->inner_sql;
    327   $query.= $this->get_date_where($this->date_components);
     328  $query.= $this->get_date_where();
    328329  $query.= '
    329330  GROUP BY period';
     
    338339  foreach ( $items as $day=>$data)
    339340  {
    340     $this->date_components[CDAY]=$day;
     341    $page['chronology_date'][CDAY]=$day;
    341342    $query = '
    342343SELECT file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 as dow';
     
    346347  ORDER BY RAND()
    347348  LIMIT 0,1';
    348     unset ( $this->date_components[CDAY] );
     349    unset ( $page['chronology_date'][CDAY] );
    349350
    350351    $row = mysql_fetch_array(pwg_query($query));
     
    417418      $template->assign_block_vars('calendar.thumbnails.row.col.blank', array());
    418419    }
    419     for ($day=1; $day<=$this->get_all_days_in_month(
    420               $this->date_components[CYEAR] ,$this->date_components[CMONTH]); $day++)
     420    for ( $day = 1;
     421          $day <= $this->get_all_days_in_month(
     422            $page['chronology_date'][CYEAR], $page['chronology_date'][CMONTH]
     423              );
     424          $day++)
    421425    {
    422426      $dow = ($first_day_dow + $day-1)%7;
     
    487491          $css_style.='top:'.round(-$pos_top).'px;';
    488492        }
    489         $url = $this->url_base.
    490               $this->date_components[CYEAR].'-'.
    491               $this->date_components[CMONTH].'-'.$day;
     493        $url = duplicate_index_url(
     494            array(
     495              'chronology_date' =>
     496                array(
     497                  $page['chronology_date'][CYEAR],
     498                  $page['chronology_date'][CMONTH],
     499                  $day
     500                )
     501            )
     502          );
    492503        $alt = $wday_labels[$dow] . ' ' . $day.
    493504               ' ('.$items[$day]['nb_images'].')';
     
    520531    foreach ( $items as $day=>$data)
    521532    {
    522       $url = $this->url_base.
    523             $this->date_components[CYEAR].'-'.
    524             $this->date_components[CMONTH].'-'.$day;
     533      $url = duplicate_index_url(
     534          array(
     535            'chronology_date' =>
     536              array(
     537                $page['chronology_date'][CYEAR],
     538                $page['chronology_date'][CMONTH],
     539                $day
     540              )
     541          )
     542        );
    525543
    526544      $thumbnail_title = $lang['day'][$data['dow']] . ' ' . $day;
  • trunk/include/calendar_weekly.class.php

    r1069 r1086  
    3939  /**
    4040   * Initialize the calendar
    41    * @param string date_field db column on which this calendar works
    4241   * @param string inner_sql used for queries (INNER JOIN or normal)
    43    * @param array date_components
    4442   */
    45   function initialize($date_field, $inner_sql, $date_components)
     43  function initialize($inner_sql)
    4644  {
    47     parent::initialize($date_field, $inner_sql, $date_components);
     45    parent::initialize($inner_sql);
    4846    global $lang;
    4947    $week_no_labels=array();
     
    8078 * @return boolean false to indicate that thumbnails where not included here
    8179 */
    82 function generate_category_content($url_base, $view_type)
     80function generate_category_content()
    8381{
    84   global $conf;
     82  global $conf, $page;
    8583
    86   $this->url_base = $url_base;
    87 
    88   assert($view_type==CAL_VIEW_LIST);
    89 
    90   if ( count($this->date_components)==0 )
     84  if ( count($page['chronology_date'])==0 )
    9185  {
    9286    $this->build_nav_bar(CYEAR); // years
    9387  }
    94   if ( count($this->date_components)==1 )
     88  if ( count($page['chronology_date'])==1 )
    9589  {
    9690    $this->build_nav_bar(CWEEK, array()); // week nav bar 1-53
    9791  }
    98   if ( count($this->date_components)==2 )
     92  if ( count($page['chronology_date'])==2 )
    9993  {
    10094    $this->build_nav_bar(CDAY); // days nav bar Mon-Sun
     
    113107function get_date_where($max_levels=3)
    114108{
    115   $date = $this->date_components;
     109  global $page;
     110  $date = $page['chronology_date'];
    116111  while (count($date)>$max_levels)
    117112  {
  • trunk/include/functions.inc.php

    r1084 r1086  
    224224  $height = $original_height;
    225225  $is_original_size = true;
    226                
     226
    227227  if ( $max_width != "" )
    228228  {
     
    250250    {
    251251      if ( $ratioWidth < $ratioHeight )
    252       { 
     252      {
    253253        $width = floor( $original_width / $ratioHeight );
    254254        $height = $max_height;
    255255      }
    256256      else
    257       { 
    258         $width = $max_width; 
     257      {
     258        $width = $max_width;
    259259        $height = floor( $original_height / $ratioWidth );
    260260      }
     
    331331                             $remaining );
    332332  $return_string.= $treatment;
    333                
     333
    334334  return $return_string;
    335335}
     
    341341  // FIXME : with new advanced search, this function needs a rewrite
    342342  return $string;
    343  
     343
    344344  $words = explode( ',', $search );
    345345  $style = 'background-color:white;color:red;';
     
    360360    $login = ($user['id'] == $conf['guest_id'])
    361361      ? 'guest' : addslashes($user['username']);
    362    
     362
    363363    $query = '
    364364INSERT INTO '.HISTORY_TABLE.'
     
    388388
    389389  list($year,$month,$day,$hour,$minute,$second) = array(0,0,0,0,0,0);
    390  
     390
    391391  switch ( $type )
    392392  {
     
    433433{
    434434  global $conf,$page,$debug,$t2;
    435  
     435
    436436  $start = get_moment();
    437437  $result = mysql_query($query) or my_error($query."\n");
    438  
     438
    439439  $time = get_moment() - $start;
    440440
     
    444444    $page['queries_time'] = 0;
    445445  }
    446  
     446
    447447  $page['count_queries']++;
    448448  $page['queries_time']+= $time;
    449  
     449
    450450  if ($conf['show_queries'])
    451451  {
     
    460460    $output.= number_format( ($time+$start-$t2), 3, '.', ' ').' s)';
    461461    $output.= "</pre>\n";
    462    
     462
    463463    $debug .= $output;
    464464  }
    465  
     465
    466466  return $result;
    467467}
     
    501501
    502502  include( PHPWG_ROOT_PATH.'include/page_header.php' );
    503  
     503
    504504  $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
    505505  $template->parse('redirect');
    506  
     506
    507507  include( PHPWG_ROOT_PATH.'include/page_tail.php' );
    508508
     
    519519{
    520520  $query_string = '';
    521  
     521
    522522  $str = $_SERVER['QUERY_STRING'];
    523523  parse_str($str, $vars);
    524  
     524
    525525  $is_first = true;
    526526  foreach ($vars as $key => $value)
     
    554554
    555555  $template_dir = PHPWG_ROOT_PATH.'template';
    556  
     556
    557557  foreach (get_dirs($template_dir) as $template)
    558558  {
     
    596596    $src.= strtolower(get_extension($path)).'.png';
    597597  }
    598  
     598
    599599  return $src;
    600600}
     
    623623{
    624624  $array = array();
    625  
     625
    626626  $result = pwg_query($query);
    627627  while ($row = mysql_fetch_array($result))
     
    642642{
    643643  global $template;
    644  
     644
    645645  $template->assign_block_vars(
    646646    $blockname, array('SELECTED' => '', 'VALUE' => 0, 'OPTION' => '--'));
    647  
     647
    648648  for ($i = 1; $i <= 31; $i++)
    649649  {
     
    669669{
    670670  global $template, $lang;
    671  
     671
    672672  $template->assign_block_vars(
    673673    $blockname, array('SELECTED' => '',
     
    698698{
    699699  global $user;
    700  
     700
    701701  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    702  
     702
    703703  $query = '
    704704SELECT element_id
     
    750750    echo '[l10n] language key "'.$key.'" is not defined<br />';
    751751  }
    752  
     752
    753753  return isset($lang[$key]) ? $lang[$key] : $key;
    754754}
     
    798798    die('Search id must be an integer');
    799799  }
    800  
     800
    801801  $query = '
    802802SELECT rules
     
    805805;';
    806806  list($serialized_rules) = mysql_fetch_row(pwg_query($query));
    807  
     807
    808808  return unserialize($serialized_rules);
    809809}
     
    821821{
    822822  $search = get_search_array($search_id);
    823  
     823
    824824  // SQL where clauses are stored in $clauses array during query
    825825  // construction
    826826  $clauses = array();
    827  
     827
    828828  foreach (array('file','name','comment','keywords','author') as $textfield)
    829829  {
     
    848848    }
    849849  }
    850  
     850
    851851  if (isset($search['fields']['allwords']))
    852852  {
     
    876876        );
    877877    }
    878    
     878
    879879    array_walk(
    880880      $word_clauses,
    881881      create_function('&$s','$s="(".$s.")";')
    882882      );
    883    
     883
    884884    array_push(
    885885      $clauses,
     
    893893      );
    894894  }
    895  
     895
    896896  foreach (array('date_available', 'date_creation') as $datefield)
    897897  {
     
    903903        );
    904904    }
    905    
     905
    906906    foreach (array('after','before') as $suffix)
    907907    {
    908908      $key = $datefield.'-'.$suffix;
    909      
     909
    910910      if (isset($search['fields'][$key]))
    911911      {
    912912        array_push(
    913913          $clauses,
    914          
     914
    915915          $datefield.
    916916          ($suffix == 'after'             ? ' >' : ' <').
    917917          ($search['fields'][$key]['inc'] ? '='  : '').
    918918          " '".$search['fields'][$key]['date']."'"
    919          
     919
    920920          );
    921921      }
    922922    }
    923923  }
    924  
     924
    925925  if (isset($search['fields']['cat']))
    926926  {
     
    934934      $cat_ids = $search['fields']['cat']['words'];
    935935    }
    936    
     936
    937937    $local_clause = 'category_id IN ('.implode(',', $cat_ids).')';
    938938    array_push($clauses, $local_clause);
    939939  }
    940  
     940
    941941  // adds brackets around where clauses
    942942  $clauses = prepend_append_array_items($clauses, '(', ')');
    943  
     943
    944944  $where_separator =
    945945    implode(
     
    947947      $clauses
    948948      );
    949  
     949
    950950  $search_clause = $where_separator;
    951  
     951
    952952  if (isset($forbidden))
    953953  {
     
    987987
    988988  $available_upgrade_ids = array();
    989  
     989
    990990  if ($contents = opendir($upgrades_path))
    991991  {
     
    10161016    .'/'.make_section_in_URL($params)
    10171017    ;
    1018  
    1019   if (isset($params['start']) and $params['start'] > 0)
    1020   {
    1021     $url.= '/start-'.$params['start'];
    1022   }
     1018
     1019  $url = add_well_known_params_in_url($url, $params);
    10231020
    10241021  return $url;
     
    11071104    die('make_picture_URL: image_id is a required parameter');
    11081105  }
    1109  
     1106
    11101107  $url =
    11111108    PHPWG_ROOT_PATH.'picture.php?'
     
    11141111    ;
    11151112
    1116   // first comment to start on
     1113  $url = add_well_known_params_in_url($url, $params);
     1114  return $url;
     1115}
     1116
     1117/**
     1118 *adds to the url the chronology and start parameters
     1119*/
     1120function add_well_known_params_in_url($url, $params)
     1121{
     1122  if ( isset($params['chronology']) )
     1123  {
     1124    $url .= '/'. $params['chronology']['field'];
     1125    $url .= '-'. $params['chronology']['style'];
     1126    if ( isset($params['chronology']['view']) )
     1127    {
     1128      $url .= '-'. $params['chronology']['view'];
     1129    }
     1130    if ( isset($params['chronology_date']) )
     1131    {
     1132      $url .= '-'. implode('-', $params['chronology_date'] );
     1133    }
     1134  }
     1135
    11171136  if (isset($params['start']) and $params['start'] > 0)
    11181137  {
    11191138    $url.= '/start-'.$params['start'];
    11201139  }
    1121 
    11221140  return $url;
    11231141}
     
    11351153{
    11361154  $section_string = '';
    1137  
     1155
    11381156  if (!isset($params['section']))
    11391157  {
     
    11601178    $params['section'] = 'categories';
    11611179  }
    1162  
     1180
    11631181  switch($params['section'])
    11641182  {
     
    11731191        $section_string.= 'category/'.$params['category'];
    11741192      }
    1175      
     1193
    11761194      break;
    11771195    }
     
    11891207        $section_string.= '/'.$tag;
    11901208      }
    1191      
     1209
    11921210      break;
    11931211    }
     
    11981216        die('make_section_in_URL: require a search identifier');
    11991217      }
    1200      
     1218
    12011219      $section_string.= 'search/'.$params['search'];
    12021220
     
    12111229
    12121230      $section_string.= 'list/'.implode(',', $params['list']);
    1213      
     1231
    12141232      break;
    12151233    }
  • trunk/include/functions_calendar.inc.php

    r1062 r1086  
    2525// +-----------------------------------------------------------------------+
    2626
    27 define('CAL_VIEW_LIST',     'l');
    28 define('CAL_VIEW_CALENDAR', 'c');
    29 
    30 function get_calendar_parameter($options, &$parameters )
    31 {
    32   if ( count($parameters) and isset($options[$parameters[0]]) )
    33   {
    34     return array_shift($parameters);
    35   }
    36   else
    37   {
    38     foreach ($options as $option => $data)
    39     {
    40        if ( empty( $data['default_link'] ) )
    41        {
    42          break;
    43        }
    44     }
    45     return $option;
    46   }
    47 }
     27define('CAL_VIEW_LIST',     'list');
     28define('CAL_VIEW_CALENDAR', 'calendar');
    4829
    4930function initialize_calendar()
     
    5435  $inner_sql = ' FROM ' . IMAGES_TABLE;
    5536
    56   if (!isset($page['cat']) or is_numeric($page['cat']))
     37  if (!isset($page['category']) or is_numeric($page['category']))
    5738  { // we will regenerate the items by including subcats elements
    5839    $page['cat_nb_images'] = 0;
     
    6142INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
    6243
    63     if (isset($page['cat']) and is_numeric($page['cat']))
     44    if (isset($page['category']) and is_numeric($page['category']))
    6445    {
    6546      $sub_ids = array_diff(
    66         get_subcat_ids(array($page['cat'])),
     47        get_subcat_ids(array($page['category'])),
    6748        explode(',', $user['forbidden_categories'])
    6849        );
     
    9374//-------------------------------------- initialize the calendar parameters ---
    9475  pwg_debug('start initialize_calendar');
    95   // the parameters look like (FIELD)?(STYLE)?(VIEW)?(DATE COMPONENTS)?
    96   // FIELD = (created-|posted-)
    97   // STYLE = (m-|w-)
    98   // VIEW  = (l-|c-)
    99   // DATE COMPONENTS= YEAR(-MONTH/WEEK)?(-DAY)?
    10076
    10177  $fields = array(
    10278    // Created
    10379    'created' => array(
    104       'default_link'   => 'created-',
    10580      'label'          => l10n('Creation date'),
    106       'db_field'       => 'date_creation',
    10781      ),
    10882    // Posted
    10983    'posted' => array(
    110       'default_link'   => 'posted-',
    11184      'label'          => l10n('Post date'),
    112       'db_field'       => 'date_available',
    11385      ),
    11486    );
     
    11789    // Monthly style
    11890    'monthly' => array(
    119       'default_link'   => '',
    12091      'include'        => 'calendar_monthly.class.php',
    12192      'view_calendar'  => true,
     
    12394    // Weekly style
    12495    'weekly' => array(
    125       'default_link'   => 'weekly-',
    12696      'include'        => 'calendar_weekly.class.php',
    12797      'view_calendar'  => false,
     
    12999    );
    130100
    131   $views = array(
    132     // list view
    133     CAL_VIEW_LIST => array(
    134       'default_link'   => '',
    135       ),
    136     // calendar view
    137     CAL_VIEW_CALENDAR => array(
    138       'default_link'   => CAL_VIEW_CALENDAR.'-',
    139       ),
    140     );
    141 
    142   $requested = explode('-', $_GET['calendar']);
     101  $views = array(CAL_VIEW_LIST,CAL_VIEW_CALENDAR);
    143102
    144103  // Retrieve calendar field
    145   $cal_field = get_calendar_parameter($fields, $requested);
     104  if ( !isset( $fields[ $page['chronology']['field'] ] ) )
     105  {
     106    die('bad field');
     107  }
    146108
    147109  // Retrieve style
    148   $cal_style = get_calendar_parameter($styles, $requested);
     110  if ( !isset( $styles[ $page['chronology']['style'] ] ) )
     111  {
     112    $page['chronology']['style'] = 'monthly';
     113  }
     114  $cal_style = $page['chronology']['style'];
    149115  include(PHPWG_ROOT_PATH.'include/'. $styles[$cal_style]['include']);
    150116  $calendar = new Calendar();
    151117
    152118  // Retrieve view
    153   $cal_view = get_calendar_parameter($views, $requested);
    154   if ( CAL_VIEW_CALENDAR==$cal_view and !$styles[$cal_style]['view_calendar'] )
    155   {
    156     $cal_view=CAL_VIEW_LIST;
    157   }
     119
     120  if ( !isset($page['chronology']['view']) or
     121       !in_array( $page['chronology']['view'], $views ) )
     122  {
     123    $page['chronology']['view'] = CAL_VIEW_LIST;
     124  }
     125
     126  if ( CAL_VIEW_CALENDAR==$page['chronology']['view'] and
     127        !$styles[$cal_style]['view_calendar'] )
     128  {
     129
     130    $page['chronology']['view'] = CAL_VIEW_LIST;
     131  }
     132  $cal_view = $page['chronology']['view'];
    158133
    159134  // perform a sanity check on $requested
    160   while (count($requested) > 3)
    161   {
    162     array_pop($requested);
     135  if (!isset($page['chronology_date']))
     136  {
     137    $page['chronology_date'] = array();
     138  }
     139  while ( count($page['chronology_date']) > 3)
     140  {
     141    array_pop($page['chronology_date']);
    163142  }
    164143
    165144  $any_count = 0;
    166   for ($i = 0; $i < count($requested); $i++)
    167   {
    168     if ($requested[$i] == 'any')
     145  for ($i = 0; $i < count($page['chronology_date']); $i++)
     146  {
     147    if ($page['chronology_date'][$i] == 'any')
    169148    {
    170149      if ($cal_view == CAL_VIEW_CALENDAR)
    171150      {// we dont allow any in calendar view
    172         while ($i < count($requested))
     151        while ($i < count($page['chronology_date']))
    173152        {
    174           array_pop($requested);
     153          array_pop($page['chronology_date']);
    175154        }
    176155        break;
     
    178157      $any_count++;
    179158    }
    180     elseif ($requested[$i] == '')
    181     {
    182       while ($i < count($requested))
     159    elseif ($page['chronology_date'][$i] == '')
     160    {
     161      while ($i < count($page['chronology_date']))
    183162      {
    184         array_pop($requested);
     163        array_pop($page['chronology_date']);
    185164      }
    186165    }
    187166    else
    188167    {
    189       $requested[$i] = (int)$requested[$i];
     168      $page['chronology_date'][$i] = (int)$page['chronology_date'][$i];
    190169    }
    191170  }
    192171  if ($any_count == 3)
    193172  {
    194     array_pop($requested);
    195   }
    196 
    197   $calendar->initialize($fields[$cal_field]['db_field'], $inner_sql, $requested);
     173    array_pop($page['chronology_date']);
     174  }
     175
     176  $calendar->initialize($inner_sql);
    198177
    199178  //echo ('<pre>'. var_export($calendar, true) . '</pre>');
    200179
    201   $url_base = get_query_string_diff(array('start', 'calendar'));
     180/*  $url_base = get_query_string_diff(array('start', 'calendar'));
    202181  $url_base =
    203182    PHPWG_ROOT_PATH.'category.php'
     
    205184    .(empty($url_base) ? '?' : '&')
    206185    .'calendar='.$cal_field.'-'
    207     ;
     186    ;*/
    208187  $must_show_list = true; // true until calendar generates its own display
    209188  if (basename($_SERVER["PHP_SELF"]) == 'category.php')
     
    211190    $template->assign_block_vars('calendar', array());
    212191
    213     if ($calendar->generate_category_content(
    214           $url_base.$cal_style.'-'.$cal_view.'-',
    215           $cal_view
    216           )
    217        )
     192    if ($calendar->generate_category_content())
    218193    {
    219194      unset(
     
    229204    foreach ($styles as $style => $style_data)
    230205    {
    231       foreach ($views as $view => $view_data)
     206      foreach ($views as $view)
    232207      {
    233208        if ( $style_data['view_calendar'] or $view != CAL_VIEW_CALENDAR)
    234209        {
    235210          $selected = '';
    236           $url = $url_base.$style.'-'.$view;
    237           if ($style==$cal_style)
     211          $chronology = $page['chronology'];
     212          $chronology['style'] = $style;
     213          $chronology['view'] = $view;
     214
     215          if ($style!=$cal_style)
    238216          {
    239             $url .= '-'.implode('-', $calendar->date_components);
    240             if ( $view==$cal_view )
     217            $chronology_date = array();
     218            if ( isset($page['chronology_date'][0]) )
    241219            {
    242               $selected = 'SELECTED';
     220              array_push($chronology_date, $page['chronology_date'][0]);
    243221            }
    244222          }
    245223          else
    246224          {
    247             if (isset($calendar->date_components[0]))
    248             {
    249               $url .= '-' . $calendar->date_components[0];
    250             }
     225            $chronology_date = $page['chronology_date'];
    251226          }
     227          $url = duplicate_index_url(
     228              array(
     229                'chronology' => $chronology,
     230                'chronology_date' => $chronology_date,
     231                )
     232             );
     233
     234          if ($style==$cal_style and $view==$cal_view )
     235          {
     236            $selected = 'SELECTED';
     237          }
     238
    252239          $template->assign_block_vars(
    253240            'calendar.views.view',
     
    261248      }
    262249    }
    263     $calendar_title =
    264         '<a href="'.$url_base.$cal_style.'-'.$cal_view.'">'
    265         .$fields[$cal_field]['label'].'</a>';
     250    $url = duplicate_index_url(
     251              array('chronology_date'=>array()), array('start')
     252            );
     253    $calendar_title = '<a href="'.$url.'">'
     254        .$fields[$chronology['field']]['label'].'</a>';
    266255    $calendar_title.= $calendar->get_display_name();
    267256    //this should be an assign_block_vars, but I need to assign 'calendar'
  • trunk/include/section_init.inc.php

    r1082 r1086  
    7979      }
    8080      $page['image_id'] = $matches[1];
    81      
    82       $next_token++;
    83     }
    84    
     81
     82      $next_token++;
     83    }
     84
    8585    if (0 === strpos($tokens[$next_token], 'cat'))
    8686    {
    8787      $page['section'] = 'categories';
    8888      $next_token++;
    89      
     89
    9090      if (isset($tokens[$next_token])
    91           and preg_match('/(\d+)/', $tokens[$next_token], $matches))
     91          and preg_match('/^(\d+)/', $tokens[$next_token], $matches))
    9292      {
    9393        $page['category'] = $matches[1];
     
    9999      $page['section'] = 'tags';
    100100      $page['tags'] = array();
    101      
    102       $next_token++;
    103      
     101
     102      $next_token++;
     103
    104104      for ($i = $next_token; ; $i++)
    105105      {
     
    108108          break;
    109109        }
    110        
     110
    111111        preg_match('/^(\d+)/', $tokens[$i], $matches);
    112112        if (!isset($matches[1]))
     
    123123        array_push($page['tags'], $matches[1]);
    124124      }
    125      
     125
    126126      $next_token = $i;
    127127    }
     
    155155      $page['section'] = 'search';
    156156      $next_token++;
    157      
     157
    158158      preg_match('/(\d+)/', $tokens[$next_token], $matches);
    159159      if (!isset($matches[1]))
     
    185185      $next_token++;
    186186    }
    187    
     187
    188188    for ($i = $next_token; ; $i++)
    189189    {
     
    192192        break;
    193193      }
    194      
     194
    195195      if (preg_match('/^start-(\d+)/', $tokens[$i], $matches))
    196196      {
     
    198198      }
    199199
    200       if (preg_match('/^calendar-(.+)$/', $tokens[$i], $matches))
    201       {
    202         // TODO: decide with rvelices how we name calendar/chronology is the
    203         // URL
    204         $_GET['calendar'] = $matches[1];
     200      if (preg_match('/^posted|created/', $tokens[$i] ))
     201      {
     202        $chronology_tokens = explode('-', $tokens[$i] );
     203        $page['chronology']['field'] = $chronology_tokens[0];
     204        array_shift($chronology_tokens);
     205        $page['chronology']['style'] = $chronology_tokens[0];
     206        array_shift($chronology_tokens);
     207        if ( count($chronology_tokens)>0 )
     208        {
     209          if ('list'==$chronology_tokens[0] or
     210              'calendar'==$chronology_tokens[0])
     211          {
     212            $page['chronology']['view'] = $chronology_tokens[0];
     213            array_shift($chronology_tokens);
     214          }
     215          $page['chronology_date'] = $chronology_tokens;
     216        }
    205217      }
    206218    }
     
    220232  $conf['order_by'] = str_replace(
    221233    'ORDER BY ',
    222     'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',', 
     234    'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',',
    223235    $conf['order_by']
    224236    );
     
    234246  {
    235247    $result = get_cat_info($page['category']);
    236    
     248
    237249    $page = array_merge(
    238250      $page,
     
    247259        'cat_id_uppercat'  => $result['id_uppercat'],
    248260        'uppercats'        => $result['uppercats'],
    249        
     261
    250262        'title' => get_cat_display_name($result['name'], '', false),
    251263        )
    252264      );
    253    
     265
    254266    if (!isset($_GET['calendar']))
    255267    {
     
    262274;';
    263275      $page['items'] = array_from_query($query, 'image_id');
    264      
     276
    265277      $page['thumbnails_include'] =
    266278        $result['nb_images'] > 0
     
    388400  LIMIT 0, '.$conf['top_number'].'
    389401;';
    390    
     402
    391403    $page = array_merge(
    392404      $page,
     
    405417    $page['super_order_by'] = true;
    406418    $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC';
    407    
     419
    408420    $query ='
    409421SELECT DISTINCT(id)
     
    437449  '.$conf['order_by'].'
    438450;';
    439      
     451
    440452    $page = array_merge(
    441453      $page,
     
    447459      );
    448460  }
    449  
     461
    450462  if (!isset($page['cat_nb_images']))
    451463  {
     
    458470// +-----------------------------------------------------------------------+
    459471
    460 if (isset($_GET['calendar']))
     472if (isset($page['chronology']))
    461473{
    462474  include_once( PHPWG_ROOT_PATH.'include/functions_calendar.inc.php' );
  • trunk/picture.php

    r1085 r1086  
    6464if ($page['current_rank'] != $page['first_rank'])
    6565{
    66   // "go to first picture of this section" link is displayed only if the
    67   // displayed item is not the first.
    68   $template->assign_block_vars(
    69     'first',
    70     array(
    71       'U_IMG' => duplicate_picture_URL(
    72         // redefinitions
    73         array(
    74           'image_id' => $page['items'][ $page['first_rank'] ],
    75           ),
    76         // removes
    77         array()
    78         )
    79       )
    80     );
    81 
    82   // caching previous item : readability purpose
     66  // caching first & previous item : readability purpose
    8367  $page['previous_item'] = $page['items'][ $page['current_rank'] - 1 ];
     68  $page['first_item'] = $page['items'][ $page['first_rank'] ];
    8469}
    8570
    8671if ($page['current_rank'] != $page['last_rank'])
    8772{
    88   // "go to last picture of this section" link is displayed only if the
    89   // displayed item is not the last.
    90   $template->assign_block_vars(
    91     'last',
    92     array(
    93       'U_IMG' => duplicate_picture_URL(
    94         // redefinitions
    95         array(
    96           'image_id' => $page['items'][ $page['last_rank'] ],
    97           ),
    98         // removes
    99         array()
    100         )
    101       )
    102     );
    103 
    104   // caching next item : readability purpose
     73  // caching next & last item : readability purpose
    10574  $page['next_item'] = $page['items'][ $page['current_rank'] + 1 ];
     75  $page['last_item'] = $page['items'][ $page['last_rank'] ];
    10676}
    10777
     
    145115
    146116      redirect($url_self);
    147      
     117
    148118      break;
    149119    }
     
    165135        redirect($url_self);
    166136      }
    167      
     137
    168138      break;
    169139    }
     
    179149        pwg_query($query);
    180150      }
    181      
     151
    182152      redirect($url_self);
    183  
     153
    184154      break;
    185155    }
     
    244214}
    245215usort($related_categories, 'global_rank_compare');
    246 //------------------------------------- prev, current & next picture management
     216//-------------------------first, prev, current, next & last picture management
    247217$picture = array();
    248218
     
    251221{
    252222  array_push($ids, $page['previous_item']);
     223  array_push($ids, $page['first_item']);
    253224}
    254225if (isset($page['next_item']))
    255226{
    256227  array_push($ids, $page['next_item']);
     228  array_push($ids, $page['last_item']);
    257229}
    258230
     
    269241  if (isset($page['previous_item']) and $row['id'] == $page['previous_item'])
    270242  {
    271     $i = 'prev';
     243    $i = 'previous';
    272244  }
    273245  else if (isset($page['next_item']) and $row['id'] == $page['next_item'])
    274246  {
    275247    $i = 'next';
     248  }
     249  else if (isset($page['first_item']) and $row['id'] == $page['first_item'])
     250  {
     251    $i = 'first';
     252  }
     253  else if (isset($page['last_item']) and $row['id'] == $page['last_item'])
     254  {
     255    $i = 'last';
    276256  }
    277257  else
     
    351331      )
    352332    );
     333
     334  if ('previous'==$i and $page['previous_item']==$page['first_item'])
     335  {
     336    $picture['first'] = $picture[$i];
     337  }
     338  if ('next'==$i and $page['next_item']==$page['last_item'])
     339  {
     340    $picture['last'] = $picture[$i];
     341  }
    353342}
    354343
     
    428417$page['body_id'] = 'thePicturePage';
    429418//------------------------------------------------------- navigation management
    430 if (isset($page['previous_item']))
    431 {
    432   $template->assign_block_vars(
    433     'previous',
    434     array(
    435       'TITLE_IMG' => $picture['prev']['name'],
    436       'IMG' => $picture['prev']['thumbnail'],
    437       'U_IMG' => $picture['prev']['url'],
    438       'U_IMG_SRC' => $picture['prev']['src']
    439       )
    440     );
    441 }
    442 
    443 if (isset($page['next_item']))
    444 {
    445   $template->assign_block_vars(
    446     'next',
    447     array(
    448       'TITLE_IMG' => $picture['next']['name'],
    449       'IMG' => $picture['next']['thumbnail'],
    450       'U_IMG' => $picture['next']['url'],
    451       'U_IMG_SRC' => $picture['next']['src'] // allow navigator to preload
    452       )
    453     );
     419foreach ( array('first','previous','next','last') as $which_image )
     420{
     421  if (isset($picture[$which_image]))
     422  {
     423    $template->assign_block_vars(
     424      $which_image,
     425      array(
     426        'TITLE_IMG' => $picture[$which_image]['name'],
     427        'IMG' => $picture[$which_image]['thumbnail'],
     428        'U_IMG' => $picture[$which_image]['url'],
     429        'U_IMG_SRC' => $picture[$which_image]['src']
     430        )
     431      );
     432  }
    454433}
    455434
     
    520499{
    521500  $uuid = uniqid(rand());
    522  
     501
    523502  $template->assign_block_vars(
    524503    'high',
     
    528507      )
    529508    );
    530  
     509
    531510  $template->assign_block_vars(
    532511    'download',
     
    572551  $result = pwg_query($query);
    573552  $row = mysql_fetch_array($result);
    574  
     553
    575554  if ($row['nb_fav'] == 0)
    576555  {
     
    642621{
    643622  $val = format_date($picture['current']['date_creation']);
    644   $infos['INFO_CREATION_DATE'] = '<a href="'.
    645        PHPWG_ROOT_PATH.'category.php?calendar=created-c-'.
    646        $picture['current']['date_creation'].'">'.$val.'</a>';
     623  $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         );
     634  $infos['INFO_CREATION_DATE'] = '<a href="'.$url.'">'.$val.'</a>';
    647635}
    648636else
     
    653641// date of availability
    654642$val = format_date($picture['current']['date_available'], 'mysql_datetime');
    655 $infos['INFO_POSTED_DATE'] = '<a href="'.
    656    PHPWG_ROOT_PATH.'category.php?calendar=posted-c-'.
    657    substr($picture['current']['date_available'],0,10).'">'.$val.'</a>';
     643$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       );
     654$infos['INFO_POSTED_DATE'] = '<a href="'.$url.'">'.$val.'</a>';
    658655
    659656// size in pixels
Note: See TracChangeset for help on using the changeset viewer.