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/include/functions_html.inc.php

    r1084 r1090  
    4646    return $page['get_icon_cache'][$date];
    4747  }
    48  
     48
    4949  list($devnull, $year, $month, $day) = $matches;
    5050  $unixtime = mktime( 0, 0, 0, $month, $day, $year );
     
    5656    return $page['get_icon_cache'][$date];
    5757  }
    58  
     58
    5959  $diff = time() - $unixtime;
    6060  $day_in_seconds = 24*60*60;
     
    8484  $pages_around = $conf['paginate_pages_around'];
    8585  $start_str = $clean_url ? '/start-' : '&start=';
    86  
     86
    8787  $navbar = '';
    88  
     88
    8989  // current page detection
    9090  if (!isset($start)
     
    9494    $start = 0;
    9595  }
    96  
     96
    9797  // navigation bar useful only if more than one page to display !
    9898  if ($nb_element > $nb_element_page)
     
    119119    {
    120120      $previous = $start - $nb_element_page;
    121      
     121
    122122      $navbar.=
    123123        '<a href="'
     
    136136    {
    137137      $navbar.= '&nbsp;<a href="'.$url.'">1</a>';
    138      
     138
    139139      if ($cur_page > $pages_around + 2)
    140140      {
     
    142142      }
    143143    }
    144    
     144
    145145    // inspired from punbb source code
    146146    for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1;
     
    155155      {
    156156        $temp_start = ($i - 1) * $nb_element_page;
    157        
     157
    158158        $navbar.=
    159159          '&nbsp;'
     
    177177    {
    178178      $temp_start = ($maximum - 1) * $nb_element_page;
    179      
     179
    180180      if ($cur_page < ($maximum - $pages_around - 1))
    181181      {
    182182        $navbar.= ' ...';
    183183      }
    184      
     184
    185185      $navbar.= ' <a href="'.$url.$start_str.$temp_start.'">'.$maximum.'</a>';
    186186    }
    187    
     187
    188188    $navbar.= ' | ';
    189189    // link on next page ?
     
    192192    {
    193193      $next = $start + $nb_element_page;
    194      
     194
    195195      $navbar.=
    196196        '<a href="'.$url.$start_str.$next.'" rel="next">'
     
    202202      $navbar.= $lang['next_page'];
    203203    }
    204    
     204
    205205    $navbar.= ' | ';
    206206    // link to last page ?
     
    208208    {
    209209      $temp_start = ($maximum - 1) * $nb_element_page;
    210      
     210
    211211      $navbar.=
    212212        '<a href="'.$url.$start_str.$temp_start.'" rel="last">'
     
    258258{
    259259  global $conf;
    260  
     260
    261261  $output = '';
    262262  $is_first = true;
     
    324324    }
    325325  }
    326  
     326
    327327  $output = '';
    328328  $is_first = true;
     
    330330  {
    331331    $name = $cat_names[$category_id];
    332    
     332
    333333    if ($is_first)
    334334    {
     
    385385    $page_cat = $page['category'];
    386386  }
    387  
     387
    388388  foreach ($categories as $category)
    389389  {
     
    411411    }
    412412    $menu.= '>';
    413  
     413
    414414    $url = make_index_url(array('category' => $category['id']));
    415    
     415
    416416    $menu.= "\n".'<a href="'.$url.'"';
    417417    if ($page_cat != 0
     
    434434
    435435  $menu.= str_repeat("\n</li></ul>",($level));
    436  
     436
    437437  return $menu;
    438438}
     
    454454
    455455  $content = nl2br($content);
    456  
     456
    457457  // replace _word_ by an underlined word
    458458  $pattern = '/\b_(\S*)_\b/';
    459459  $replacement = '<span style="text-decoration:underline;">$1</span>';
    460460  $content = preg_replace($pattern, $replacement, $content);
    461  
     461
    462462  // replace *word* by a bolded word
    463463  $pattern = '/\b\*(\S*)\*\b/';
    464464  $replacement = '<span style="font-weight:bold;">$1</span>';
    465465  $content = preg_replace($pattern, $replacement, $content);
    466  
     466
    467467  // replace /word/ by an italic word
    468468  $pattern = "/\/(\S*)\/(\s)/";
Note: See TracChangeset for help on using the changeset viewer.