Subversion Repositories php-qbpwcf

Rev

Rev 218 | Rev 226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 218 Rev 220
Line 5697... Line 5697...
5697
		#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
5697
		#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
5698
		#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
5698
		#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
5699
		#$result["notNeedVar"],字串陣列,多餘的參數名稱.
5699
		#$result["notNeedVar"],字串陣列,多餘的參數名稱.
5700
		#必填參數:
5700
		#必填參數:
5701
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
5701
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
5702
		$conf["variable::checkArguments"]["varInput"]=&$conf;
5702
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
5703
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
5703
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
5704
		$conf["variable::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
5704
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
5705
		#可省略參數:
5705
		#可省略參數:
5706
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
5706
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
5707
		$conf["variable::checkArguments"]["mustBeFilledVariableName"]=array("str");
5707
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("str");
5708
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".
5708
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".
5709
		$conf["variable::checkArguments"]["mustBeFilledVariableType"]=array("string");
5709
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
5710
		#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
5710
		#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
5711
		#$conf["canBeEmptyString"]="false";
5711
		#$conf["canBeEmptyString"]="false";
5712
		#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
5712
		#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
5713
		#$conf["canNotBeEmpty"]=array();
5713
		#$conf["canNotBeEmpty"]=array();
5714
		#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
5714
		#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
Line 5731... Line 5731...
5731
		#$conf["arrayCountEqualCheck"][]=array();
5731
		#$conf["arrayCountEqualCheck"][]=array();
5732
		#參考資料:
5732
		#參考資料:
5733
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5733
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5734
		#備註:
5734
		#備註:
5735
		#無.
5735
		#無.
5736
		$checkArguments=variableCheck::checkArguments($conf["variable::checkArguments"]);
5736
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5737
		unset($conf["variable::checkArguments"]);
5737
		unset($conf["variable::checkArguments"]);
5738
	
5738
	
5739
		#如果檢查參數失敗
5739
		#如果檢查參數失敗
5740
		if($checkArguments["status"]==="false"){
5740
		if($checkArguments["status"]==="false"){
5741
		
5741
		
Line 5749... Line 5749...
5749
			return $result;
5749
			return $result;
5750
			
5750
			
5751
			}#if end
5751
			}#if end
5752
			
5752
			
5753
		#如果檢查參數不通過
5753
		#如果檢查參數不通過
5754
		if($checkArguments["status"]==="false"){
5754
		if($checkArguments["passed"]==="false"){
5755
		
5755
		
5756
			#設置執行失敗
5756
			#設置執行失敗
5757
			$result["status"]="false";
5757
			$result["status"]="false";
5758
			
5758
			
5759
			#設置錯誤訊息陣列
5759
			#設置錯誤訊息陣列
Line 5771... Line 5771...
5771
		$result["urlEncodeStr"]="";
5771
		$result["urlEncodeStr"]="";
5772
		
5772
		
5773
		#如果不是空字串
5773
		#如果不是空字串
5774
		if($strLength!==0){
5774
		if($strLength!==0){
5775
		
5775
		
-
 
5776
			#函式說明:
-
 
5777
			#將檔案目錄的絕對位置中的 "../" 剔除變成直觀的路徑.
-
 
5778
			#回傳結果:
-
 
5779
			#$result["status"],執行是否成功,"true"代表執行成功,"false"代表執行失敗.
-
 
5780
			#$result["function"],當前執行的函數.
-
 
5781
			#$result["error"],錯誤訊息陣列.
-
 
5782
			#$result["argu"],使用者參數.
-
 
5783
			#$result["changedPath"],處理完後回傳的目錄字串.
-
 
5784
			#$result["oriPath"],原始的路徑字串
-
 
5785
			#必填參數:
-
 
5786
			#$conf["dirStr"],字串,要處理的檔案目錄字串.
-
 
5787
			$conf["stringProcess::changeDirByDotDotSolidus"]["dirStr"]=pathinfo(__FILE__)["dirname"]."/../../bin/parse";
-
 
5788
			#可省略參數:
-
 
5789
			#無.
-
 
5790
			#參考資料:
-
 
5791
			#無.
-
 
5792
			#備註:
-
 
5793
			#考慮用realpath取代
-
 
5794
			$changeDirByDotDotSolidus=stringProcess::changeDirByDotDotSolidus($conf["stringProcess::changeDirByDotDotSolidus"]);
-
 
5795
			unset($conf["stringProcess::changeDirByDotDotSolidus"]);
-
 
5796
		
-
 
5797
			#如果檢查參數失敗
-
 
5798
			if($changeDirByDotDotSolidus["status"]==="false"){
-
 
5799
			
-
 
5800
				#設置執行失敗
-
 
5801
				$result["status"]="false";
-
 
5802
				
-
 
5803
				#設置錯誤訊息陣列
-
 
5804
				$result["error"]=$changeDirByDotDotSolidus;
-
 
5805
				
-
 
5806
				#回傳結果
-
 
5807
				return $result;
-
 
5808
				
-
 
5809
				}#if end
-
 
5810
		
5776
			#設置要執行的指令	
5811
			#設置要執行的指令	
5777
			$cmd=escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../bin/parse")." ".$conf["str"];
5812
			$cmd=escapeshellarg($changeDirByDotDotSolidus["changedPath"])." ".$conf["str"];
5778
		
5813
		
5779
			#執行指令
5814
			#執行指令
5780
			exec($cmd,$output,$status);
5815
			exec($cmd,$output,$status);
5781
		
5816
		
5782
			#如果執行失敗
5817
			#如果執行失敗
Line 5869... Line 5904...
5869
						$result["status"]="false";
5904
						$result["status"]="false";
5870
						
5905
						
5871
						#設置錯誤訊息陣列
5906
						#設置錯誤訊息陣列
5872
						$result["error"][]="run command(".$cmd.") failed!";
5907
						$result["error"][]="run command(".$cmd.") failed!";
5873
						
5908
						
-
 
5909
						#設置錯誤訊息陣列
-
 
5910
						$result["error"][]="output:".print_r($output,true);
-
 
5911
						
5874
						#回傳結果
5912
						#回傳結果
5875
						return $result;
5913
						return $result;
5876
					
5914
					
5877
						}#if end
5915
						}#if end
5878
						
5916