[pLog-svn] r3568 - in plog/trunk/class: action/admin template

mark at devel.lifetype.net mark at devel.lifetype.net
Tue Jun 13 17:56:12 GMT 2006


Author: mark
Date: 2006-06-13 17:56:11 +0000 (Tue, 13 Jun 2006)
New Revision: 3568

Modified:
   plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php
   plog/trunk/class/action/admin/adminaddtemplateaction.class.php
   plog/trunk/class/template/templatesandbox.class.php
Log:
Fixed bug http://bugs.lifetype.net/view.php?id=797

Modified: plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php	2006-06-09 08:22:08 UTC (rev 3567)
+++ plog/trunk/class/action/admin/adminaddblogtemplateaction.class.php	2006-06-13 17:56:11 UTC (rev 3568)
@@ -120,8 +120,7 @@
 
             // if the template set was installed ok in the template folder, we can record
             // it as a valid set
-            $fileParts = explode( ".", $upload->getFileName());
-            $templateName = $fileParts[0];
+			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
             $ts->addTemplate( $templateName, $this->_blogInfo->getId());
 
             // remove the file

Modified: plog/trunk/class/action/admin/adminaddtemplateaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2006-06-09 08:22:08 UTC (rev 3567)
+++ plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2006-06-13 17:56:11 UTC (rev 3568)
@@ -119,8 +119,7 @@
             // if the template set was installed ok in the template folder, we can record
             // it as a valid set
             $ts = new TemplateSetStorage();
-            $fileParts = explode( ".", $upload->getFileName());
-            $templateName = $fileParts[0];
+			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
             $ts->addTemplate( $templateName );
 
             $this->_view = new AdminSiteTemplatesListView( $this->_blogInfo );

Modified: plog/trunk/class/template/templatesandbox.class.php
===================================================================
--- plog/trunk/class/template/templatesandbox.class.php	2006-06-09 08:22:08 UTC (rev 3567)
+++ plog/trunk/class/template/templatesandbox.class.php	2006-06-13 17:56:11 UTC (rev 3568)
@@ -94,8 +94,7 @@
 
             // if the file was correctly unpacked, now we will need the TemplateSetValidator
             // class to do some work for us
-            $fileNameParts = explode( '.', $file );
-            $fileNameNoExt = $fileNameParts[0];
+            $fileNameNoExt = $this->toTemplateSetName( $file );
 
             // we can use the checkTenmplateFolder which will do all the rest of
             // the work for us...
@@ -158,5 +157,19 @@
 
             return true;
         }
+
+		/**
+		 * Convert the upload file name to template set name
+		 * 
+		 * @param $uploadFile The name of the upload file
+		 * @return Return the template set name
+		 */
+		function toTemplateSetName( $uploadFile )
+		{
+            $fileWithoutVersion = preg_replace( '/[0-1]\.[0-9.]*_/', '', $uploadFile );
+            $fileParts = explode( ".", $fileWithoutVersion );
+            $templateName = $fileParts[0];
+            return $templateName;
+		}
     }
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list