Ignore:
Timestamp:
Mar 28, 2006, 4:16:34 AM (18 years ago)
Author:
rvelices
Message:

moved category.php to index.php

split url functions from functions.inc.php to functions_url.inc.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/section_init.inc.php

    r1094 r1109  
    8585$next_token = 0;
    8686if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php')
    87 { // the last token must be the identifier for the picture
    88   $token = array_pop($tokens);
     87{ // the first token must be the identifier for the picture
     88  if ( isset($_GET['image_id'])
     89       and isset($_GET['cat']) and is_numeric($_GET['cat']) )
     90  {// url compatibility with versions below 1.6
     91    $url = make_picture_url( array(
     92        'section' => 'categories',
     93        'category' => $_GET['cat'],
     94        'image_id' => $_GET['image_id']
     95      ) );
     96    redirect($url);
     97  }
     98  $token = $tokens[$next_token];
     99  $next_token++;
    89100  if ( is_numeric($token) )
    90101  {
     
    93104  else
    94105  {
    95     preg_match('/^(\d+-)?((.*)[_\.]html?)?$/', $token, $matches);
     106    preg_match('/^(\d+-)?(.*)?$/', $token, $matches);
    96107    if (isset($matches[1]) and is_numeric($matches[1]=rtrim($matches[1],'-')) )
    97108    {
    98109      $page['image_id'] = $matches[1];
    99       if ( !empty($matches[3]) )
     110      if ( !empty($matches[2]) )
    100111      {
    101         $page['image_file'] = $matches[3];
     112        $page['image_file'] = $matches[2];
    102113      }
    103114
     
    105116    else
    106117    {
    107       if ( !empty($matches[3]) )
     118      if ( !empty($matches[2]) )
    108119      {
    109         $page['image_file'] = $matches[3];
     120        $page['image_file'] = $matches[2];
    110121      }
    111122      else
     
    117128}
    118129
    119 if (0 === strpos($tokens[$next_token], 'cat'))
     130if (0 === strpos($tokens[$next_token], 'categor'))
    120131{
    121132  $page['section'] = 'categories';
     
    214225  $next_token++;
    215226}
    216 else
    217 {
    218   $page['section'] = 'categories';
    219   $next_token++;
    220 }
    221227
    222228for ($i = $next_token; ; $i++)
Note: See TracChangeset for help on using the changeset viewer.