Subversion Repositories php-qbpwcf

Rev

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

Rev 36 Rev 42
Line 1391... Line 1391...
1391
				$result["status"]="false";
1391
				$result["status"]="false";
1392
 
1392
 
1393
				#設置錯誤訊息
1393
				#設置錯誤訊息
1394
				$result["error"][]="讀取檔案失敗";
1394
				$result["error"][]="讀取檔案失敗";
1395
 
1395
 
-
 
1396
				#取得詳細的錯誤訊息
-
 
1397
				$result["error"][]=$fileCheckResult;
-
 
1398
				
1396
				#回傳結果
1399
				#回傳結果
1397
				return $result;
1400
				return $result;
1398
				
1401
				
1399
				}#else end
1402
				}#else end
1400
 
1403
 
Line 1750... Line 1753...
1750
			
1753
			
1751
			#設置錯誤訊息
1754
			#設置錯誤訊息
1752
			$result["error"]=$checkArguments;
1755
			$result["error"]=$checkArguments;
1753
			
1756
			
1754
			#回傳結果
1757
			#回傳結果
1755
			return $result;				
1758
			return $result;
1756
			
1759
			
1757
			}#if end
1760
			}#if end
1758
			
1761
			
1759
		#如果 $checkArguments["passed"] 等於 "false"
1762
		#如果 $checkArguments["passed"] 等於 "false"
1760
		if($checkArguments["passed"]=="false"){
1763
		if($checkArguments["passed"]=="false"){
Line 1764... Line 1767...
1764
			
1767
			
1765
			#設置錯誤訊息
1768
			#設置錯誤訊息
1766
			$result["error"]=$checkArguments;
1769
			$result["error"]=$checkArguments;
1767
			
1770
			
1768
			#回傳結果
1771
			#回傳結果
1769
			return $result;				
1772
			return $result;
1770
			
1773
			
1771
			}#if end
1774
			}#if end
1772
		
1775
		
1773
		#初始化儲存每個檔案是否存在的陣列變數
1776
		#初始化儲存每個檔案是否存在的陣列變數
1774
		$result["varName"]=array();
1777
		$result["varName"]=array();
Line 1835... Line 1838...
1835
			else{
1838
			else{
1836
				
1839
				
1837
				#轉換好的絕對路徑
1840
				#轉換好的絕對路徑
1838
				$conf["fileArray"][$i]=$getInternetAddress["fileSystemAbsoulutePosition"];
1841
				$conf["fileArray"][$i]=$getInternetAddress["fileSystemAbsoulutePosition"];
1839
				
1842
				
1840
				#判斷該檔案是否存在
1843
				#無窮迴圈
1841
				$exist=file_exists($conf["fileArray"][$i]);
1844
				while(true){
1842
				
1845
				
1843
				#如果不存在或是指向不存在目標的連結
1846
					#判斷該檔案是否存在
1844
				if($exist===false){
1847
					$exist=file_exists($conf["fileArray"][$i]);
1845
				
1848
				
1846
					#判斷是否為軟連結
1849
					#如果不存在
-
 
1850
					if($exist===false){
-
 
1851
					
-
 
1852
						#無窮迴圈
-
 
1853
						while(true){
-
 
1854
						
-
 
1855
							#當要檢查的目標是 link 時
1847
					$exist=is_link($conf["fileArray"][$i]);
1856
							if(is_link($conf["fileArray"][$i])){
-
 
1857
							
-
 
1858
								#取得link的路徑
-
 
1859
								$conf["fileArray"][$i]=readlink($conf["fileArray"][$i]);
-
 
1860
								
-
 
1861
								#結束連結的判斷,回到判斷目標是否存在的地方.
-
 
1862
								continue 2;
-
 
1863
								
-
 
1864
								}#if end
-
 
1865
							
-
 
1866
							#結束連結的判斷
-
 
1867
							break;
-
 
1868
							
-
 
1869
							}#while end
-
 
1870
						
-
 
1871
						}#if end
-
 
1872
						
-
 
1873
					#結束到判斷目標是否存在
-
 
1874
					break;
1848
				
1875
				
1849
					}#if end`
1876
					}#while end
1850
				
1877
				
1851
				}#else end
1878
				}#else end
1852
			
1879
			
1853
			#如果 $exist 等於 false (檔案不存在) 且 沒有停用網路搜尋功能
1880
			#如果 $exist 等於 false (檔案不存在) 且 沒有停用網路搜尋功能
1854
			if($exist===FALSE && $conf["disableWebSearch"]==="false"){
1881
			if($exist===FALSE && $conf["disableWebSearch"]==="false"){
Line 1939... Line 1966...
1939
					$result["varName"][$i]=$getInternetAddress["content"];
1966
					$result["varName"][$i]=$getInternetAddress["content"];
1940
					
1967
					
1941
					#如果存在檔案路徑的絕對位置
1968
					#如果存在檔案路徑的絕對位置
1942
					if(isset($getInternetAddress["fileSystemAbsoulutePosition"])){
1969
					if(isset($getInternetAddress["fileSystemAbsoulutePosition"])){
1943
						
1970
						
1944
						#設置該檔案的絕對路徑位置						
1971
						#設置該檔案的絕對路徑位置
1945
						$result["varNameFullPath"][$i]=$getInternetAddress["fileSystemAbsoulutePosition"];
1972
						$result["varNameFullPath"][$i]=$getInternetAddress["fileSystemAbsoulutePosition"];
1946
											
1973
						
1947
						}#if end
1974
						}#if end
1948
					
1975
					
1949
					#反之代表輸入參數是網址	
1976
					#反之代表輸入參數是網址	
1950
					else{
1977
					else{
1951
						
1978
						
Line 10898... Line 10925...
10898
		$defaultTmpDir=$output[0];	
10925
		$defaultTmpDir=$output[0];	
10899
			
10926
			
10900
		#取得暫存檔案的路徑與名稱
10927
		#取得暫存檔案的路徑與名稱
10901
		$result["content"]=tempnam($defaultTmpDir,"qbpwcf_tmpfile_");
10928
		$result["content"]=tempnam($defaultTmpDir,"qbpwcf_tmpfile_");
10902
		
10929
		
-
 
10930
		#如果產生的暫存檔案位置異常
-
 
10931
		#參考資料:
-
 
10932
		#https://www.php.net/manual/en/function.tempnam.php
-
 
10933
		if(strpos("/tmp/",$result["content"])===0){
-
 
10934
		
-
 
10935
			#設置執行失敗
-
 
10936
			$result["status"]="false";
-
 
10937
 
-
 
10938
			#設置執行錯誤訊息
-
 
10939
			$result["error"][]="於暫存目錄建立檔案失敗";
-
 
10940
			
-
 
10941
			#回傳結果
-
 
10942
			return $result;
-
 
10943
		
-
 
10944
			}#if end
-
 
10945
		
10903
		#函式說明:
10946
		#函式說明:
10904
		#將字串特定關鍵字與其前面的內容剔除
10947
		#將字串特定關鍵字與其前面的內容剔除
10905
		#回傳結果:
10948
		#回傳結果:
10906
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
10949
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
10907
		#$result["error"],錯誤訊息陣列.
10950
		#$result["error"],錯誤訊息陣列.
Line 10913... Line 10956...
10913
		#$result["content"],處理好的的字串內容.	
10956
		#$result["content"],處理好的的字串內容.	
10914
		#必填參數:
10957
		#必填參數:
10915
		#$conf["stringIn"],字串,要處理的字串.
10958
		#$conf["stringIn"],字串,要處理的字串.
10916
		$conf["stringPorcess::delStrBeforeKeyWord"]["stringIn"]=$result["content"];
10959
		$conf["stringPorcess::delStrBeforeKeyWord"]["stringIn"]=$result["content"];
10917
		#$conf["keyWord"],字串,特定字串.
10960
		#$conf["keyWord"],字串,特定字串.
10918
		$conf["stringPorcess::delStrBeforeKeyWord"]["keyWord"]=$defaultTmpDir."/qbpwcf_tmpfile_";
10961
		$conf["stringPorcess::delStrBeforeKeyWord"]["keyWord"]=$defaultTmpDir."/";
10919
		#可省略參數:
10962
		#可省略參數:
10920
		#$conf["recursive"],字串,預設為"false"代表找到一個關鍵字就會停止;"true"代表會即重複執行,知道沒有關鍵字為止.
10963
		#$conf["recursive"],字串,預設為"false"代表找到一個關鍵字就會停止;"true"代表會即重複執行,知道沒有關鍵字為止.
10921
		#$conf["recursive"]="true";
10964
		$conf["stringPorcess::delStrBeforeKeyWord"]["recursive"]="true";
10922
		#$conf["lastResult"],陣列,本函式前次執行的結果,若沒有找到關鍵字,則會改回傳該內容.
10965
		#$conf["lastResult"],陣列,本函式前次執行的結果,若沒有找到關鍵字,則會改回傳該內容.
10923
		#$conf["lastResult"]=$delStrBeforeKeyWord;
10966
		#$conf["lastResult"]=$delStrBeforeKeyWord;
10924
		#參考資料:
10967
		#參考資料:
10925
		#無.
10968
		#無.
10926
		#備註:
10969
		#備註: