Luxbum.net - Script de galerie photo

Changeset 250

Show
Ignore:
Timestamp:
02/07/08 19:01:33 (10 months ago)
Author:
nicolas
Message:

meilleure gestion des vues

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/api/ui/public/Index.php

    r209 r250  
    1414    * @param Pluf_HTTP_Request $request 
    1515    * @param array $match 
     16    * @return Pluf_Template_Context 
    1617    */ 
    1718   public function index($request, $match) { 
    18  
    19       if (count($match) == 1) { 
    20          $dir = ''; 
    21          $index = true; 
    22       } 
    23       else if (count($match) == 2) { 
    24          $dir = files::removeTailSlash($match[1]); 
    25          $index = false; 
    26       } 
    27       else { 
    28          throw new Exception("Unable to find the selected gallery"); 
    29       } 
    30  
    31  
     19      $dir = ''; 
     20      $index = true; 
     21      return $this->common($dir, $index); 
     22   } 
     23    
     24   /** 
     25    *  
     26    * @param Pluf_HTTP_Request $request 
     27    * @param array $match 
     28    * @return Pluf_Template_Context 
     29    */ 
     30   public function folder($request, $match) { 
     31      $dir = files::removeTailSlash($match[1]); 
     32      $index = false; 
     33      return $this->common($dir, $index); 
     34   } 
     35    
     36   /** 
     37    * Common function that display an index or folder page 
     38    * 
     39    * @param String $dir 
     40    * @param boolean $index 
     41    * @return Pluf_Template_Context 
     42    */ 
     43   private function common($dir, $index) { 
     44       
    3245      // Check if the gallery is private 
    33          $this->checkDir($dir); 
     46      $this->checkDir($dir); 
    3447      $this->checkPrivate($dir); 
    3548 
    36       $galleries = new luxBumIndex ($dir); 
     49      $galleries = new luxBumIndex($dir); 
    3750      $galleries->addAllGallery (); 
    3851       
  • trunk/index.php

    r227 r250  
    6363// Index views 
    6464$dispatcher->registerController('ui_public_Index', 'index', '#^/$#i'); 
    65 $dispatcher->registerController('ui_public_Index', 'index', '#^/folder/(.*)/$#i'); 
     65$dispatcher->registerController('ui_public_Index', 'folder', '#^/folder/(.*)/$#i'); 
    6666 
    6767// View files (image & flv) 
     
    8181// Private views 
    8282$dispatcher->registerController('ui_public_Private', 'action', '#^/private/(.*)/$#i'); 
    83 $dispatcher->registerController('ui_public_Private', 'action', '#^/private/(.*)/(.*)$#i'); 
    8483 
    8584// Gallery views 
    86 $dispatcher->registerController('ui_public_Gallery', 'view', '#^/gallery/(.*)/$#i'); 
    8785$dispatcher->registerController('ui_public_Gallery', 'view', '#^/gallery/(.*)/(.*)$#i'); 
    88 $dispatcher->registerController('ui_public_Gallery', 'view', '#^/gallery/(.+)/(.+\.flv)$#i'); 
    8986 
    9087// File display view