[xoops-cvslog 3133] CVS update: xoops2jp/html/modules/legacyRender/admin/forms

Back to archive index

Minahito minah****@users*****
2006年 5月 25日 (木) 14:19:05 JST


Index: xoops2jp/html/modules/legacyRender/admin/forms/TplsetUploadForm.class.php
diff -u xoops2jp/html/modules/legacyRender/admin/forms/TplsetUploadForm.class.php:1.1.2.1 xoops2jp/html/modules/legacyRender/admin/forms/TplsetUploadForm.class.php:1.1.2.2
--- xoops2jp/html/modules/legacyRender/admin/forms/TplsetUploadForm.class.php:1.1.2.1	Fri May 19 20:05:21 2006
+++ xoops2jp/html/modules/legacyRender/admin/forms/TplsetUploadForm.class.php	Thu May 25 14:19:05 2006
@@ -10,6 +10,7 @@
 	var $mOldFileName = null;
 	var $_mIsNew = null;
 	var $mFormFile = null;
+	var $_allowExtensions = array('tar', 'tar.gz', 'tgz', 'gz');
 
 	function getTokenName()
 	{
@@ -36,6 +37,21 @@
 		$this->mFieldProperties['tplset_name']->addMessage('maxlength', _AD_LEGACYRENDER_ERROR_MAXLENGTH, _AD_LEGACYRENDER_LANG_TPLSET_DESC, '50');
 		$this->mFieldProperties['tplset_name']->addVar('maxlength', '50');
 	}
+	
+	function validateUpload()
+	{
+		$formFile = $this->get('upload');
+		if ($formFile != null) {
+			$flag = false;
+			foreach ($this->_allowExtensions as $ext) {
+				$flag |= preg_match("/" . str_replace(".", "\.", $ext) . "$/", $formFile->getFileName());
+			}
+			
+			if (!$flag) {
+				$this->addErrorMessage(_AD_LEGACYRENDER_ERROR_EXTENSION_IS_WRONG);
+			}
+		}
+	}
 }
 
 ?>


xoops-cvslog メーリングリストの案内
Back to archive index