Source for file FileProxyFactory.php

Documentation is available at FileProxyFactory.php

  1. <?php
  2. /**
  3. * Build the right type of file proxy based on the request
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Julien-Samuel Lacroix
  9. @copyright Mapgears
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * Construit le bon type de file proxy selon le type de requete
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Proxy
  19. @author     Julien-Samuel Lacroix
  20. */  
  21. {
  22.     /**
  23.     * Return the good file proxy
  24.     * 
  25.     * @param org_geoprisma_service_FileService $pobjService Service
  26.     * 
  27.     * @return org_geoprisma_proxy_file_FileProxy 
  28.     */
  29.     public static function getFileProxy(org_geoprisma_service_FileService $pobjService)
  30.     {
  31.         // Set default to get
  32.         $objFileProxy new org_geoprisma_proxy_file_FileGetProxy($pobjService);
  33.  
  34.         if (self::isDownload()) 
  35.         {    
  36.             $objFileProxy new org_geoprisma_proxy_file_FileDownloadProxy($pobjService);
  37.         }
  38.         else if (self::isUpload()) 
  39.         {
  40.             $objFileProxy new org_geoprisma_proxy_file_FileUploadProxy($pobjService);
  41.         }
  42.         else if (self::isNewDir()) 
  43.         {
  44.             $objFileProxy new org_geoprisma_proxy_file_FileNewDirProxy($pobjService);
  45.         }
  46.    
  47.         return $objFileProxy;
  48.     }
  49.     
  50.     /**
  51.     * Check if query is the type of download | cmd = download
  52.     * 
  53.     * @return bool 
  54.     */
  55.     private static function isDownload()
  56.     {
  57.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'download' && 
  58.                 isset($_REQUEST['path']&& $_REQUEST['path'!= '');
  59.     }
  60.  
  61.     /**
  62.     * Check if query is the type of upload | cmd = upload
  63.     * 
  64.     * @return bool 
  65.     */
  66.     private static function isUpload()
  67.     {
  68.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'upload' && 
  69.                 isset($_REQUEST['path']&& $_REQUEST['path'!= '' &&
  70.                 isset($_FILES&& isset($_FILES['x-filename']&&
  71.                 isset($_REQUEST['dir']&& $_REQUEST['dir'!= '');
  72.     }
  73.  
  74.     /**
  75.     * Check if query is the type of new directory | cmd = newdir
  76.     * 
  77.     * @return bool 
  78.     */
  79.     private static function isNewDir()
  80.     {
  81.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'newdir' && 
  82.                 isset($_REQUEST['dir']&& $_REQUEST['dir'!= '');
  83.     }
  84. }
  85. ?>

Documentation generated on Thu, 19 Jan 2012 00:08:32 +0400 by phpDocumentor 1.4.1