Ignore:
Timestamp:
Jun 28, 2007, 4:16:03 AM (17 years ago)
Author:
rvelices
Message:

feature 713: allow permalinks to contain the slash ("/") character

File:
1 edited

Legend:

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

    r2026 r2047  
    458458      }
    459459      else
    460       {
    461         if ( strpos($tokens[$next_token], 'created-')!==0
    462             and strpos($tokens[$next_token], 'posted-')!==0
     460      {// try a permalink
     461        $maybe_permalinks = array();
     462        $current_token = $next_token;
     463        while ( isset($tokens[$current_token])
     464            and strpos($tokens[$current_token], 'created-')!==0
     465            and strpos($tokens[$current_token], 'posted-')!==0
    463466            and strpos($tokens[$next_token], 'start-')!==0
    464             and $tokens[$next_token] != 'flat')
    465         {// try a permalink
    466           $cat_id = get_cat_id_from_permalink($tokens[$next_token]);
    467           if ( !isset($cat_id) )
    468           {//try old permalink
    469             $cat_id = get_cat_id_from_old_permalink($tokens[$next_token], true);
     467            and $tokens[$current_token] != 'flat')
     468        {
     469          if (empty($maybe_permalinks))
     470          {
     471            array_push($maybe_permalinks, $tokens[$current_token]);
    470472          }
     473          else
     474          {
     475            array_push($maybe_permalinks,
     476                $maybe_permalinks[count($maybe_permalinks)-1]
     477                . '/' . $tokens[$current_token]
     478              );
     479          }
     480          $current_token++;
     481        }
     482
     483        if ( count($maybe_permalinks) )
     484        {
     485          $cat_id = get_cat_id_from_permalinks($maybe_permalinks, $perma_index);
    471486          if ( isset($cat_id) )
    472487          {
     488            $next_token += $perma_index+1;
    473489            $page['category'] = $cat_id;
    474             $page['hit_by']['cat_permalink'] = $tokens[$next_token];
     490            $page['hit_by']['cat_permalink'] = $maybe_permalinks[$perma_index];
    475491          }
    476492          else
     
    478494            page_not_found('Permalink for album not found');
    479495          }
    480           $next_token++;
    481496        }
    482        }
     497      }
    483498    }
    484499
Note: See TracChangeset for help on using the changeset viewer.