[pLog-svn] r2333 - in plog/trunk/class: action/admin gallery/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Jul 14 21:44:16 GMT 2005


Author: oscar
Date: 2005-07-14 21:44:16 +0000 (Thu, 14 Jul 2005)
New Revision: 2333

Modified:
   plog/trunk/class/action/admin/adminaddresourceaction.class.php
   plog/trunk/class/gallery/dao/galleryalbums.class.php
   plog/trunk/class/gallery/dao/galleryresource.class.php
   plog/trunk/class/gallery/dao/galleryresources.class.php
Log:
reorganized the includes of GalleryAlbums and GalleryResources


Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php	2005-07-14 20:34:14 UTC (rev 2332)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php	2005-07-14 21:44:16 UTC (rev 2333)
@@ -9,6 +9,7 @@
 	include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
     include_once( PLOG_CLASS_PATH."class/view/admin/adminsimpleresourceslistview.class.php" );	
+    include_once( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
 
     /**
      * \ingroup Action

Modified: plog/trunk/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbums.class.php	2005-07-14 20:34:14 UTC (rev 2332)
+++ plog/trunk/class/gallery/dao/galleryalbums.class.php	2005-07-14 21:44:16 UTC (rev 2333)
@@ -1,10 +1,8 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbum.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
 
     /**
 	 * \ingroup Gallery
@@ -211,6 +209,7 @@
          */
 		function addAlbum( $album )
         {
+		    include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );        
             $tf = new Textfilter();
         	$query = "INSERT INTO ".$this->getPrefix()."gallery_albums (
                       owner_id, description, name, flags, parent_id, properties, 
@@ -264,6 +263,8 @@
             if ($album->getId() == $album->getParentId()){
 				return false;
 			}
+			
+		    include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );			
             $tf = new TextFilter();
             $query = "UPDATE ".$this->getPrefix()."gallery_albums SET
                       description = '".Db::qstr($album->getDescription())."',

Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresource.class.php	2005-07-14 20:34:14 UTC (rev 2332)
+++ plog/trunk/class/gallery/dao/galleryresource.class.php	2005-07-14 21:44:16 UTC (rev 2333)
@@ -1,13 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/mimetype.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourceimagemetadatareader.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcesoundmetadatareader.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcevideometadatareader.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcezipmetadatareader.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/galleryconstants.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
     
     // Add this to avoid long file name error in windows server
     define('GETID3_HELPERAPPSDIR', 'no_helper_apps_needed'); 
@@ -175,6 +169,8 @@
 		 */
         function getMimeType()
         {
+        	include_once( PLOG_CLASS_PATH."class/data/mimetype.class.php" );        
+        
         	$mimeType = new MimeType();
         	return $mimeType->getType( $this->_fileName );
         }
@@ -205,7 +201,9 @@
 		 * @return an string with all the bytes or false otherwise
 		 */
         function getData()
-        {
+        {    
+        	include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );        
+        
         	$fileParts = explode( ".", $this->getFileName());
             $fileExt = $fileParts[count($fileParts)-1];
 
@@ -292,6 +290,11 @@
 		 */
         function getMetadataReader()
         {
+		    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourceimagemetadatareader.class.php" );
+		    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcesoundmetadatareader.class.php" );
+		    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcevideometadatareader.class.php" );
+		    include_once( PLOG_CLASS_PATH."class/gallery/data/galleryresourcezipmetadatareader.class.php" );
+                
         	switch( $this->getResourceType()) {
             	case GALLERY_RESOURCE_IMAGE:
                 	$reader = new GalleryResourceImageMetadataReader( $this );
@@ -331,6 +334,8 @@
 		 */
 		function getPreviewFileName()
 		{
+    		include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );		
+		
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) {
 				$fileParts = explode( ".", $this->getFileName());
 				$fileExt = $fileParts[count($fileParts)-1];
@@ -369,6 +374,8 @@
 		 */
 		function getMediumSizePreviewFileName()
 		{
+			include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );		
+		
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) {
 				$fileParts = explode( ".", $this->getFileName());
 				$fileExt = $fileParts[count($fileParts)-1];

Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php	2005-07-14 20:34:14 UTC (rev 2332)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php	2005-07-14 21:44:16 UTC (rev 2333)
@@ -13,18 +13,10 @@
 	 */
 
 	include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" );
-    include_once( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/getid3/getid3.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/galleryconstants.php" );
-    include_once( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
-    include_once( PLOG_CLASS_PATH."class/data/validator/uploadvalidator.class.php" );
 	include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
-	include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-	include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcequotas.class.php" );
 	include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
 
     /**
@@ -320,6 +312,7 @@
 			$config =& Config::getConfig();
 			$thumbnailFormat = $config->getValue( "thumbnail_format" );
 			// prepare some other stuff
+			include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );			
 			$tf = new Textfilter();
 			$normalizedDescription = $tf->normalizeText( $description );
 
@@ -380,7 +373,9 @@
 			$fileName = $ownerId."-".$resourceId.".".$fileExt;
 			
 			// and start the resizing process
+			include_once( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );			
 			$resizer = new GalleryResizer( $resFile );
+			include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );			
 			GalleryResourceStorage::checkPreviewsStorageFolder( $ownerId );
 			$outFile = GalleryResourceStorage::getPreviewsFolder( $ownerId ).$fileName;
 			
@@ -412,7 +407,9 @@
 			$fileName = $ownerId."-".$resourceId.".".$fileExt;
 			
 			// and start the resizing process
+		    include_once( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );			
 			$resizer = new GalleryResizer( $resFile );
+		    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );			
 			GalleryResourceStorage::checkMediumSizePreviewsStorageFolder( $ownerId );
 			$outFile = GalleryResourceStorage::getMediumSizePreviewsFolder( $ownerId ).$fileName;
 			
@@ -447,6 +444,7 @@
         {
             // check if quotas are enabled, and if this file would make us go
             // over the quota
+            include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcequotas.class.php" );            
             if( GalleryResourceQuotas::isBlogOverResourceQuota( $ownerId, $upload->getSize())) {
                 return GALLERY_ERROR_QUOTA_EXCEEDED;
             }
@@ -457,12 +455,14 @@
             // or
             // UPLOAD_VALIDATOR_ERROR_FORBIDDEN_EXTENSION (-2)
             // in case the file is not valid.
+            include_once( PLOG_CLASS_PATH."class/data/validator/uploadvalidator.class.php" );            
             $uploadValidator = new UploadValidator();
             $error = $uploadValidator->validate( $upload );
             if( $error < 0 )
                 return $error;
             
             // get the metadata
+            include_once( PLOG_CLASS_PATH."class/gallery/getid3/getid3.php" );            
             $getId3 = new GetID3();
             $metadata = $getId3->analyze( $upload->getTmpName());
 			
@@ -482,6 +482,7 @@
 			
             // and finally move the file to the right place in disk
             // move the file to disk
+		    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
             $storage = new GalleryResourceStorage();
             $resFile = $storage->storeUpload( $resourceId, $ownerId, $upload );
             
@@ -529,6 +530,7 @@
         {
             // check if quotas are enabled, and if this file would make us go
             // over the quota
+            include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcequotas.class.php" );            
             if( GalleryResourceQuotas::isBlogOverResourceQuota( $ownerId, File::getSize( $fullFilePath ))) {
                 return GALLERY_ERROR_QUOTA_EXCEEDED;
             }
@@ -537,6 +539,7 @@
             $filePath = dirname( $fullFilePath );
         
             // get the metadata
+            include_once( PLOG_CLASS_PATH."class/gallery/getid3/getid3.php" );            
             $getId3 = new GetID3();
             $metadata = $getId3->analyze( $fullFilePath );
     
@@ -556,6 +559,7 @@
     
             // and finally move the file to the right place in disk
             // move the file to disk
+		    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
             $storage = new GalleryResourceStorage();
             $resFile = $storage->storeFile( $resourceId, $ownerId, $fullFilePath,
                                             RESOURCE_STORAGE_STORE_MOVE );
@@ -623,6 +627,7 @@
          */
         function updateResource( $resource ) 
         {
+        	include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );        
             $tf = new TextFilter();
         	$query = "UPDATE ".$this->getPrefix()."gallery_resources
                       SET album_id = ".$resource->getAlbumId().",
@@ -676,6 +681,7 @@
             	return false;
 
             // otherwise, proceed and remove the file from disk
+		    include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
             $storage = new GalleryResourceStorage();
             return $storage->remove( $resource );
         }




More information about the pLog-svn mailing list