Subversion Repositories php-qbpwcf

Rev

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

Rev 405 Rev 406
Line 2587... Line 2587...
2587
				#移除用不到的變數
2587
				#移除用不到的變數
2588
				unset($unFormatStr2add);
2588
				unset($unFormatStr2add);
2589
			
2589
			
2590
				}#if end
2590
				}#if end
2591
			
2591
			
2592
			#如果type不為 CNAME 跟 TXT 跟 SOA
2592
			#如果type不為 CNAME 跟 TXT 跟 SOA 跟 CAA
2593
			if( $info["type"]!=="CNAME" && $info["type"]!=="TXT" && $info["type"]!=="SOA" && $info["type"]!=="CAA"){
2593
			if( $info["type"]!=="CNAME" && $info["type"]!=="TXT" && $info["type"]!=="SOA" && $info["type"]!=="CAA"){
2594
			
2594
			
2595
				#儲存value
2595
				#儲存value
2596
				$info["value"]=$unFormatStr;
2596
				$info["value"]=$unFormatStr;
2597
			
2597
			
Line 2662... Line 2662...
2662
			#執行到這邊,代表type為CNAME或TXT或SOA或CAA
2662
			#執行到這邊,代表type為CNAME或TXT或SOA或CAA
2663
			
2663
			
2664
			#如果 type 是 SOA
2664
			#如果 type 是 SOA
2665
			if($info["type"]==="SOA"){
2665
			if($info["type"]==="SOA"){
2666
			
2666
			
2667
				#如果要debug
-
 
2668
				if($conf["debug"]==="true"){
-
 
2669
				
-
 
2670
					#函式說明:
-
 
2671
					#撰寫log
-
 
2672
					#回傳結果:
-
 
2673
					#$result["status"],狀態,"true"或"false".
-
 
2674
					#$result["error"],錯誤訊息陣列.
-
 
2675
					#$result["function"],當前函式的名稱.
-
 
2676
					#$result["argu"],使用的參數.
-
 
2677
					#$result["content"],要寫入log的內容字串.
-
 
2678
					#必填參數:
-
 
2679
					#$conf["path"],字串,log檔案的路徑與名稱.
-
 
2680
					$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
2681
					#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
2682
					$conf["logs::record"]["content"]="lineNo:".__LINE__." type:".$info["type"].PHP_EOL;
-
 
2683
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
2684
					$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
2685
					#可省略參數:
-
 
2686
					#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
2687
					#$conf["rewrite"]="false";
-
 
2688
					#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
2689
					#$conf["returnOnly"]="true";
-
 
2690
					#參考資料:
-
 
2691
					#無.
-
 
2692
					#備註:
-
 
2693
					#無.
-
 
2694
					$record=logs::record($conf["logs::record"]);
-
 
2695
					unset($conf["logs::record"]);
-
 
2696
				
-
 
2697
					}#if end
-
 
2698
					
-
 
2699
				#SOA 範例
2667
				#SOA 範例
2700
				#@	1200	IN	SOA	dns.qbpwcf.org. liveuser.qbpwcf.org. 2026012205 10800 1800 1728000 1200 ;domain name server, admin mail, serial, refresh time, expire, Negative Caching, https://bind9.readthedocs.io/en/latest/chapter3.html#term-SOA-minimum
2668
				#@	1200	IN	SOA	dns.qbpwcf.org. liveuser.qbpwcf.org. 2026012205 10800 1800 1728000 1200 ;domain name server, admin mail, serial, refresh time, expire, Negative Caching, https://bind9.readthedocs.io/en/latest/chapter3.html#term-SOA-minimum
2701
			
2669
			
2702
				#再度嘗試分割
2670
				#再度嘗試分割
2703
				#如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
2671
				#如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
Line 3032... Line 3000...
3032
				}#if end
3000
				}#if end
3033
			
3001
			
3034
			#執行到這邊代表不是 SOA
3002
			#執行到這邊代表不是 SOA
3035
			
3003
			
3036
			#如果是 CAA
3004
			#如果是 CAA
3037
			if($info["type"]!=="CAA"){
3005
			if($info["type"]==="CAA"){
3038
			
3006
			
3039
				#判斷內容是否為合法的 CAA value
3007
				#判斷內容是否為合法的 CAA value
3040
				#0 issue ";";comment
3008
				#0 issue ";";comment
3041
				#0 issue "domain.name";comment
3009
				#0 issue "domain.name";comment
3042
				#函式說明:
3010
				#函式說明:
Line 3097... Line 3065...
3097
					
3065
					
3098
					#回傳結果
3066
					#回傳結果
3099
					return $result;
3067
					return $result;
3100
				
3068
				
3101
					}#if end
3069
					}#if end
3102
					
3070
				
3103
				#判斷內容是否為合法的 CAA value
3071
				#判斷內容是否為合法的 CAA value
3104
				#0 issue ";"
3072
				#0 issue ";"
3105
				#0 issue "domain.name"
3073
				#0 issue "domain.name"
3106
				#函式說明:
3074
				#函式說明:
3107
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
3075
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
Line 3146... Line 3114...
3146
					
3114
					
3147
				#如果有 有符合 "0 issue \"\${domain}\"" 的格式
3115
				#如果有 有符合 "0 issue \"\${domain}\"" 的格式
3148
				if($findSpecifyStrFormat["found"]==="true"){
3116
				if($findSpecifyStrFormat["found"]==="true"){
3149
				
3117
				
3150
					#儲存value
3118
					#儲存value
3151
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
3119
					$info["value"]=$unFormatStr;
3152
				
3120
				
3153
					#儲存 RR 的記錄
3121
					#儲存 RR 的記錄
3154
					$result["content"]=$info;
3122
					$result["content"]=$info;
3155
					
3123
					
3156
					#設置執行正常
3124
					#設置執行正常
Line 3968... Line 3936...
3968
			
3936
			
3969
				#設置錯誤識別
3937
				#設置錯誤識別
3970
				$result["status"]="false";
3938
				$result["status"]="false";
3971
 
3939
 
3972
				#設置錯誤訊息
3940
				#設置錯誤訊息
3973
				$result["error"]=$proc;
3941
				$result["error"]=$parseRRline;
3974
 
3942
 
3975
				#回傳結果
3943
				#回傳結果
3976
				return $result;
3944
				return $result;
3977
			
3945
			
3978
				}#iif end
3946
				}#iif end
Line 3982... Line 3950...
3982
			
3950
			
3983
			#如果是TTL列
3951
			#如果是TTL列
3984
			if($info["type"]==="\$TTL"){
3952
			if($info["type"]==="\$TTL"){
3985
			
3953
			
3986
				#設置預設的TTL
3954
				#設置預設的TTL
3987
				$result["defaultTTL"]=$info["defaultTTL"];
3955
				$result["defaultTTL"]=$parseRRline["defaultTTL"];
3988
			
3956
			
3989
				}#if end
3957
				}#if end
3990
				
3958
				
3991
			#如果是ORIGIN列
3959
			#如果是ORIGIN列
3992
			if($info["type"]==="\$ORIGIN"){	
3960
			if($info["type"]==="\$ORIGIN"){	
3993
			
3961
			
-
 
3962
				#debug
-
 
3963
				#var_dump($info);exit(1);
-
 
3964
			
3994
				#設置RR所屬的domain
3965
				#設置RR所屬的domain
3995
				$result["domain"]=$info["domain"];
3966
				$result["domain"]=$parseRRline["domain"];
3996
				
3967
				
3997
				}#if end
3968
				}#if end
3998
			
3969
			
3999
			#儲存 RR 的記錄
3970
			#儲存 RR 的記錄
4000
			$result["content"][]=$info;
3971
			$result["content"][]=$info;
Line 4874... Line 4845...
4874
						}#if end
4845
						}#if end
4875
						
4846
						
4876
					#反之如果跟既有的 query、type有相同,且type 為 "CAA"
4847
					#反之如果跟既有的 query、type有相同,且type 為 "CAA"
4877
					else if($newRR["query"]===$oldRR["query"] && $newRR["type"]===$oldRR["type"] && $newRR["type"]==="CAA" ){
4848
					else if($newRR["query"]===$oldRR["query"] && $newRR["type"]===$oldRR["type"] && $newRR["type"]==="CAA" ){
4878
					
4849
					
-
 
4850
						#debug
-
 
4851
						var_dump(__LINE__,$oldRR,$newRR);
-
 
4852
					
4879
						#如果既有的 value 為 0 issue ""
4853
						#如果既有的 value 為 0 issue ";"
4880
						if($oldRR["value"]==="0 issue \"\""){
4854
						if($oldRR["value"]==="0 issue \";\""){
-
 
4855
						
-
 
4856
							#debug
-
 
4857
							#var_dump(__LINE__,$oldRR["value"]);
4881
						
4858
						
4882
							#代表要從沒有限制變成右限制
4859
							#代表要從沒有限制變成有限制
4883
							
4860
							
4884
							#更新既有 RR 的 value
4861
							#更新既有 RR 的 value
4885
							$result["content"][$index]["value"]=$newRR["value"];
4862
							$result["content"][$index]["value"]=$newRR["value"];
4886
 
4863
 
4887
							#換看下一筆newRR
4864
							#換看下一筆newRR