Subversion Repositories php-qbpwcf

Rev

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

Rev 350 Rev 404
Line 1401... Line 1401...
1401
	#回傳結果:
1401
	#回傳結果:
1402
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1402
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1403
	#$reuslt["error"],執行不正常結束的錯訊息陣列.
1403
	#$reuslt["error"],執行不正常結束的錯訊息陣列.
1404
	#$result["function"],當前執行的函式名稱.
1404
	#$result["function"],當前執行的函式名稱.
1405
	#$result["argu"],所使用的參數.
1405
	#$result["argu"],所使用的參數.
1406
	#$result["content"],字串陣列,該行RR(DNS記錄)的資訊,key可能有"type","value","content","query","update",也可能為空陣列.
1406
	#$result["content"],字串陣列,該行RR(DNS記錄)的資訊,key可能有"type","value","content","query","update",也可能為空陣列,"type"的數值可能為"A"、"AAAA"、"$TTL"、"$ORIGIN"、"CNAME"、"TXT"、"NS"、"SOA".
1407
	#$result["domain"],字串,RR所屬domain.
1407
	#$result["domain"],字串,RR所屬domain.
1408
	#$result["defaultTTL"],字串,預設的RR更新時間.
1408
	#$result["defaultTTL"],字串,預設的RR更新時間,若line參數解析後type不為$TTL,則不會有該回傳結果.
1409
	#$result["comment"],字串,一行的註解.
1409
	#$result["comment"],字串,一行的註解.
1410
	#必填參數:
1410
	#必填參數:
1411
	#$conf["line"],字串,要解析的行內容.
1411
	#$conf["line"],字串,要解析的行內容.
1412
	$conf["line"]="";
1412
	$conf["line"]="";
1413
	#可省略參數:
1413
	#可省略參數:
Line 2588... Line 2588...
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
2593
			if( $info["type"]!=="CNAME" && $info["type"]!=="TXT" && $info["type"]!=="SOA" ){
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
			
2598
				#判斷是否有 ";" 存在
2598
				#判斷是否有 ";" 存在
Line 2657... Line 2657...
2657
				#回傳結果
2657
				#回傳結果
2658
				return $result;
2658
				return $result;
2659
			
2659
			
2660
				}#if end
2660
				}#if end
2661
		
2661
		
2662
			#執行到這邊,代表type為CNAME或TXT或SOA
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
2667
				#如果要debug
Line 3031... Line 3031...
3031
			
3031
			
3032
				}#if end
3032
				}#if end
3033
			
3033
			
3034
			#執行到這邊代表不是 SOA
3034
			#執行到這邊代表不是 SOA
3035
			
3035
			
-
 
3036
			#如果是 CAA
-
 
3037
			if($info["type"]!=="CAA"){
-
 
3038
			
-
 
3039
				#判斷內容是否為合法的 CAA value
-
 
3040
				#0 issue ";";comment
-
 
3041
				#0 issue "domain.name";comment
-
 
3042
				#函式說明:
-
 
3043
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
3044
				#回傳結果:
-
 
3045
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3046
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
3047
				#$result["function"],當前執行的函式名稱.
-
 
3048
				#$result["argu"],所使用的參數.
-
 
3049
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
3050
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
3051
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
3052
				#必填參數:
-
 
3053
				#$conf["input"],字串,要檢查的字串.
-
 
3054
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
3055
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
3056
				$conf["search::findSpecifyStrFormat"]["format"]="0 issue \"\${domain}\";\${comment}";
-
 
3057
				#可省略參數:
-
 
3058
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
3059
				#$conf["varEqual"]=array(null,"found");
-
 
3060
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
3061
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
3062
				#參考資料:
-
 
3063
				#無.
-
 
3064
				#備註:
-
 
3065
				#無.
-
 
3066
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
3067
				unset($conf["search::findSpecifyStrFormat"]);
-
 
3068
			
-
 
3069
				#如果執行異常
-
 
3070
				if($findSpecifyStrFormat["status"]==="false"){
-
 
3071
				
-
 
3072
					#設置錯誤識別
-
 
3073
					$result["status"]="false";
-
 
3074
 
-
 
3075
					#設置錯誤訊息
-
 
3076
					$result["error"]=$findSpecifyStrFormat;
-
 
3077
 
-
 
3078
					#回傳結果
-
 
3079
					return $result;
-
 
3080
				
-
 
3081
					}#if end
-
 
3082
					
-
 
3083
				#如果有 有符合 "0 issue \"\${domain}\";\${comment}" 的格式
-
 
3084
				if($findSpecifyStrFormat["found"]==="true"){
-
 
3085
				
-
 
3086
					#儲存value
-
 
3087
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
3088
				
-
 
3089
					#儲存comment
-
 
3090
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
3091
				
-
 
3092
					#儲存 RR 的記錄
-
 
3093
					$result["content"]=$info;
-
 
3094
					
-
 
3095
					#設置執行正常
-
 
3096
					$result["status"]="true";
-
 
3097
					
-
 
3098
					#回傳結果
-
 
3099
					return $result;
-
 
3100
				
-
 
3101
					}#if end
-
 
3102
					
-
 
3103
				#判斷內容是否為合法的 CAA value
-
 
3104
				#0 issue ";"
-
 
3105
				#0 issue "domain.name"
-
 
3106
				#函式說明:
-
 
3107
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
3108
				#回傳結果:
-
 
3109
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3110
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
3111
				#$result["function"],當前執行的函式名稱.
-
 
3112
				#$result["argu"],所使用的參數.
-
 
3113
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
3114
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
3115
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
3116
				#必填參數:
-
 
3117
				#$conf["input"],字串,要檢查的字串.
-
 
3118
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
3119
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
3120
				$conf["search::findSpecifyStrFormat"]["format"]="0 issue \"\${domain}\"";
-
 
3121
				#可省略參數:
-
 
3122
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
3123
				#$conf["varEqual"]=array(null,"found");
-
 
3124
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
3125
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
3126
				#參考資料:
-
 
3127
				#無.
-
 
3128
				#備註:
-
 
3129
				#無.
-
 
3130
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
3131
				unset($conf["search::findSpecifyStrFormat"]);
-
 
3132
			
-
 
3133
				#如果執行異常
-
 
3134
				if($findSpecifyStrFormat["status"]==="false"){
-
 
3135
				
-
 
3136
					#設置錯誤識別
-
 
3137
					$result["status"]="false";
-
 
3138
 
-
 
3139
					#設置錯誤訊息
-
 
3140
					$result["error"]=$findSpecifyStrFormat;
-
 
3141
 
-
 
3142
					#回傳結果
-
 
3143
					return $result;
-
 
3144
				
-
 
3145
					}#if end
-
 
3146
					
-
 
3147
				#如果有 有符合 "0 issue \"\${domain}\"" 的格式
-
 
3148
				if($findSpecifyStrFormat["found"]==="true"){
-
 
3149
				
-
 
3150
					#儲存value
-
 
3151
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
3152
				
-
 
3153
					#儲存 RR 的記錄
-
 
3154
					$result["content"]=$info;
-
 
3155
					
-
 
3156
					#設置執行正常
-
 
3157
					$result["status"]="true";
-
 
3158
					
-
 
3159
					#回傳結果
-
 
3160
					return $result;
-
 
3161
				
-
 
3162
					}#if end
-
 
3163
			
-
 
3164
				}#if end
-
 
3165
			
-
 
3166
			#執行到這邊代表不是 CAA
-
 
3167
			
3036
			#尋找是否有(...)...的內容存在
3168
			#尋找是否有(...)...的內容存在
3037
			#函式說明:
3169
			#函式說明:
3038
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
3170
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
3039
			#回傳結果:
3171
			#回傳結果:
3040
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3172
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 3572... Line 3704...
3572
		$TTL 86400	;default TTL for zone
3704
		$TTL 86400	;default TTL for zone
3573
		@	1200	IN	SOA	dns.server.domain. admin.server.domain. 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
3705
		@	1200	IN	SOA	dns.server.domain. admin.server.domain. 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
3574
		@	3600	IN	TXT	"v=spf1 a mx ~all"
3706
		@	3600	IN	TXT	"v=spf1 a mx ~all"
3575
		@	86400	IN	MX	1 mail.server.domain.
3707
		@	86400	IN	MX	1 mail.server.domain.
3576
		@	86400	IN	A	1.1.1.1
3708
		@	86400	IN	A	1.1.1.1
-
 
3709
		@		IN	CAA	0 issue ";"
3577
		mail.server.domain.	IN	1.1.1.1
3710
		mail.server.domain.	IN	1.1.1.1
3578
		10-42-0-1	IN	A	10.42.0.1
3711
		10-42-0-1	IN	A	10.42.0.1
3579
		101-free        IN      A	101.101.101.101
3712
		101-free        IN      A	101.101.101.101
3580
		127-0-0-1	IN	A	127.0.0.1
3713
		127-0-0-1	IN	A	127.0.0.1
3581
		_dmarc	IN	TXT	"v=DMARC1;p=reject;sp=reject;pct=100;adkim=r;aspf=r;fo=1;ri=86400;rua=mailto:admin@server.domain"
3714
		_dmarc	IN	TXT	"v=DMARC1;p=reject;sp=reject;pct=100;adkim=r;aspf=r;fo=1;ri=86400;rua=mailto:admin@server.domain"
Line 3771... Line 3904...
3771
				continue;
3904
				continue;
3772
			
3905
			
3773
				}#if end
3906
				}#if end
3774
		
3907
		
3775
			#另存一份要處理的RR
3908
			#另存一份要處理的RR
3776
			$unFormatStr=$line;
3909
			#$unFormatStr=$line;
3777
		
3910
		
3778
			#如果要debug
3911
			#如果要debug
3779
			if($conf["debug"]==="true"){
3912
			if($conf["debug"]==="true"){
3780
			
3913
			
3781
				#函式說明:
3914
				#函式說明:
Line 3805... Line 3938...
3805
				$record=logs::record($conf["logs::record"]);
3938
				$record=logs::record($conf["logs::record"]);
3806
				unset($conf["logs::record"]);
3939
				unset($conf["logs::record"]);
3807
				
3940
				
3808
				}#if end
3941
				}#if end
3809
			
3942
			
3810
			#初始化該行的資訊陣列
-
 
3811
			$info=array();
-
 
3812
		
-
 
3813
			#尋找";"開頭的內容,亦即整行都是註解.
-
 
3814
			#函式說明:
3943
			#函式說明:
3815
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
3944
			#解析RR檔案中其中的一行內容,回傳結果.
3816
			#回傳結果:
3945
			#回傳結果:
3817
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3946
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3818
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
3947
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
3819
			#$result["function"],當前執行的函式名稱.
3948
			#$result["function"],當前執行的函式名稱.
3820
			#$result["argu"],所使用的參數.
3949
			#$result["argu"],所使用的參數.
3821
			#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
3950
			#$result["content"],字串陣列,該行RR(DNS記錄)的資訊,key可能有"type","value","content","query","update",也可能為空陣列.
3822
			#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
3951
			#$result["domain"],字串,RR所屬domain.
3823
			#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
3952
			#$result["defaultTTL"],字串,預設的RR更新時間.
-
 
3953
			#$result["comment"],字串,一行的註解.
3824
			#必填參數:
3954
			#必填參數:
3825
			#$conf["input"],字串,要檢查的字串.
3955
			#$conf["line"],字串,要解析的行內容.
3826
			$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
3956
			$conf["zerossl::parseRRline"]["line"]=$line;
3827
			#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
3828
			$conf["search::findSpecifyStrFormat"]["format"]=";\${else}";
-
 
3829
			#可省略參數:
3957
			#可省略參數:
3830
			#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
3831
			#$conf["varEqual"]=array(null,"found");
-
 
3832
			#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
3833
			#$conf["varCon"]=array("no_tail"=>" not");
-
 
3834
			#參考資料:
-
 
3835
			#無.
-
 
3836
			#備註:
-
 
3837
			#無.
3958
			#無.
3838
			$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
3839
			unset($conf["search::findSpecifyStrFormat"]);
-
 
3840
		
-
 
3841
			#如果執行異常
-
 
3842
			if($findSpecifyStrFormat["status"]==="false"){
-
 
3843
			
-
 
3844
				#設置錯誤識別
-
 
3845
				$result["status"]="false";
-
 
3846
 
-
 
3847
				#設置錯誤訊息
-
 
3848
				$result["error"]=$findSpecifyStrFormat;
-
 
3849
 
-
 
3850
				#回傳結果
-
 
3851
				return $result;
-
 
3852
			
-
 
3853
				}#if end
-
 
3854
				
-
 
3855
			#如果有找到符合格式的內容
-
 
3856
			if($findSpecifyStrFormat["found"]==="true"){
-
 
3857
			
-
 
3858
				#儲存為註解
-
 
3859
				$result["comment"][]=$unFormatStr;
-
 
3860
			
-
 
3861
				#換下一行
-
 
3862
				continue;
-
 
3863
			
-
 
3864
				}#if end
-
 
3865
		
-
 
3866
			#函式說明:
-
 
3867
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
3868
			#回傳結果:
-
 
3869
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3870
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
3871
			#$result["function"],當前執行的函式名稱.
-
 
3872
			#$result["argu"],所使用的參數.
-
 
3873
			#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
3874
			#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
3875
			#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
3876
			#必填參數:
-
 
3877
			#$conf["input"],字串,要檢查的字串.
-
 
3878
			$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
3879
			#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
3880
			$conf["search::findSpecifyStrFormat"]["format"]="\$ORIGIN\${else}";
-
 
3881
			#可省略參數:
-
 
3882
			#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
3883
			#$conf["varEqual"]=array(null,"found");
-
 
3884
			#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
3885
			#$conf["varCon"]=array("no_tail"=>" not");
-
 
3886
			#參考資料:
3959
			#參考資料:
3887
			#無.
3960
			#無.
3888
			#備註:
3961
			#備註:
3889
			#無.
3962
			#無.
3890
			$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
3963
			$parseRRline=zerossl::parseRRline($conf["zerossl::parseRRline"]);
3891
			unset($conf["search::findSpecifyStrFormat"]);
3964
			unset($conf["zerossl::parseRRline"]);
3892
		
-
 
3893
			#如果執行異常
-
 
3894
			if($findSpecifyStrFormat["status"]==="false"){
-
 
3895
			
3965
			
3896
				#設置錯誤識別
-
 
3897
				$result["status"]="false";
-
 
3898
 
-
 
3899
				#設置錯誤訊息
-
 
3900
				$result["error"]=$findSpecifyStrFormat;
-
 
3901
 
-
 
3902
				#回傳結果
-
 
3903
				return $result;
-
 
3904
			
-
 
3905
				}#if end
-
 
3906
				
-
 
3907
			#如果有找到符合格式的內容
-
 
3908
			if($findSpecifyStrFormat["found"]==="true"){
-
 
3909
			
-
 
3910
				#設置 type 的數值
-
 
3911
				$info["type"]="\$ORIGIN";
-
 
3912
			
-
 
3913
				#取得後面待處理的內容
-
 
3914
				$unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
-
 
3915
			
-
 
3916
				#函式說明:
-
 
3917
				#將字串開頭的特定關鍵字移除.
-
 
3918
				#回傳結果:
-
 
3919
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3920
				#$result["error"],錯誤訊息陣列.
-
 
3921
				#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
3922
				#$result["function"],當前執行的函數名稱.
-
 
3923
				#$result["argu"],使用的參數.
-
 
3924
				#$result["content"],處理好的的字串內容.
-
 
3925
				#$result["deleted"],被移除的內容.
-
 
3926
				#必填參數:
-
 
3927
				#$conf["stringIn"],字串,要處理的字串.
-
 
3928
				$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
3929
				#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
3930
				$conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
-
 
3931
				#可省略參數:
-
 
3932
				#無.
-
 
3933
				#參考資料:
-
 
3934
				#無.
-
 
3935
				#備註:
-
 
3936
				#無.
-
 
3937
				$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
3938
				unset($conf["stringProcess::delHeadStr"]);
-
 
3939
					
-
 
3940
				#如果執行異常
-
 
3941
				if($delHeadStr["status"]==="false"){
-
 
3942
				
-
 
3943
					#設置錯誤識別
-
 
3944
					$result["status"]="false";
-
 
3945
 
-
 
3946
					#設置錯誤訊息
-
 
3947
					$result["error"]=$delHeadStr;
-
 
3948
 
-
 
3949
					#回傳結果
-
 
3950
					return $result;
-
 
3951
				
-
 
3952
					}#if end
-
 
3953
					
-
 
3954
				#如果有移除開頭的字串
-
 
3955
				if($delHeadStr["founded"]==="true"){
-
 
3956
				
-
 
3957
					#取得處理後的結果
-
 
3958
					$unFormatStr=$delHeadStr["content"];
-
 
3959
				
-
 
3960
					}#if end
-
 
3961
				
-
 
3962
				#解析 $ORIGN 的數值, 以及後面是否有註解...
-
 
3963
				#函式說明:
-
 
3964
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
3965
				#回傳結果:
-
 
3966
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
3967
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
3968
				#$result["function"],當前執行的函式名稱.
-
 
3969
				#$result["argu"],所使用的參數.
-
 
3970
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
3971
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
3972
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
3973
				#必填參數:
-
 
3974
				#$conf["input"],字串,要檢查的字串.
-
 
3975
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
3976
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
3977
				$conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
-
 
3978
				#可省略參數:
-
 
3979
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
3980
				#$conf["varEqual"]=array(null,"found");
-
 
3981
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3966
			#如果解析異常 
3982
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
3983
				#參考資料:
-
 
3984
				#無.
-
 
3985
				#備註:
-
 
3986
				#無.
-
 
3987
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
3988
				unset($conf["search::findSpecifyStrFormat"]);
-
 
3989
			
-
 
3990
				#如果執行異常
-
 
3991
				if($findSpecifyStrFormat["status"]==="false"){
-
 
3992
				
-
 
3993
					#設置錯誤識別
-
 
3994
					$result["status"]="false";
-
 
3995
 
-
 
3996
					#設置錯誤訊息
-
 
3997
					$result["error"]=$findSpecifyStrFormat;
-
 
3998
 
-
 
3999
					#回傳結果
-
 
4000
					return $result;
-
 
4001
				
-
 
4002
					}#if end
-
 
4003
					
-
 
4004
				#如果有數值跟註解
-
 
4005
				if($findSpecifyStrFormat["found"]==="true"){
-
 
4006
				
-
 
4007
					#儲存數值
-
 
4008
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
4009
				
-
 
4010
					#儲存zone domain
-
 
4011
					$result["domain"]=trim($info["value"]);
-
 
4012
				
-
 
4013
					#儲存註解
-
 
4014
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
4015
				
-
 
4016
					#儲存解析好的RR
-
 
4017
					$result["content"][]=$info;
-
 
4018
				
-
 
4019
					#換下一行
-
 
4020
					continue;
-
 
4021
					
-
 
4022
					}#if end
-
 
4023
					
-
 
4024
				#執行到這邊代表剩下的內容都是 value
-
 
4025
				$info["value"]=$unFormatStr;
-
 
4026
				
-
 
4027
				#儲存zone domain
-
 
4028
				$result["domain"]=trim($info["value"]);
-
 
4029
			
-
 
4030
				#儲存解析好的RR
-
 
4031
				$result["content"][]=$info;
-
 
4032
			
-
 
4033
				#換下一行
-
 
4034
				continue;
-
 
4035
			
-
 
4036
				}#if end
-
 
4037
				
-
 
4038
			#檢查是否為 $TTL 開頭
-
 
4039
			#函式說明:
-
 
4040
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4041
			#回傳結果:
-
 
4042
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4043
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4044
			#$result["function"],當前執行的函式名稱.
-
 
4045
			#$result["argu"],所使用的參數.
-
 
4046
			#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4047
			#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4048
			#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
4049
			#必填參數:
-
 
4050
			#$conf["input"],字串,要檢查的字串.
-
 
4051
			$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4052
			#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4053
			$conf["search::findSpecifyStrFormat"]["format"]="\$TTL\${else}";
-
 
4054
			#可省略參數:
-
 
4055
			#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4056
			#$conf["varEqual"]=array(null,"found");
-
 
4057
			#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3967
			if($parseRRline["status"]==="false"){
4058
			#$conf["varCon"]=array("no_tail"=>" not");
-
 
4059
			#參考資料:
-
 
4060
			#無.
-
 
4061
			#備註:
-
 
4062
			#無.
-
 
4063
			$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4064
			unset($conf["search::findSpecifyStrFormat"]);
-
 
4065
		
-
 
4066
			#如果執行異常
-
 
4067
			if($findSpecifyStrFormat["status"]==="false"){
-
 
4068
			
3968
			
4069
				#設置錯誤識別
3969
				#設置錯誤識別
4070
				$result["status"]="false";
3970
				$result["status"]="false";
4071
 
3971
 
4072
				#設置錯誤訊息
3972
				#設置錯誤訊息
4073
				$result["error"]=$findSpecifyStrFormat;
3973
				$result["error"]=$proc;
4074
 
3974
 
4075
				#回傳結果
3975
				#回傳結果
4076
				return $result;
3976
				return $result;
4077
			
3977
			
4078
				}#if end
3978
				}#iif end
4079
				
3979
				
4080
			#如果有找到符合格式的內容
3980
			#取得該RR的解析結果
4081
			if($findSpecifyStrFormat["found"]==="true"){
3981
			$info=$parseRRline["content"];
4082
			
3982
			
4083
				#設置 type 的數值
3983
			#如果是TTL列
4084
				$info["type"]="\$TTL";
3984
			if($info["type"]==="\$TTL"){
4085
				
-
 
4086
				#取得後面待處理的內容
-
 
4087
				$unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
-
 
4088
			
3985
			
4089
				#函式說明:
-
 
4090
				#將字串開頭的特定關鍵字移除.
-
 
4091
				#回傳結果:
-
 
4092
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4093
				#$result["error"],錯誤訊息陣列.
-
 
4094
				#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4095
				#$result["function"],當前執行的函數名稱.
-
 
4096
				#$result["argu"],使用的參數.
-
 
4097
				#$result["content"],處理好的的字串內容.
-
 
4098
				#$result["deleted"],被移除的內容.
-
 
4099
				#必填參數:
-
 
4100
				#$conf["stringIn"],字串,要處理的字串.
-
 
4101
				$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4102
				#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4103
				$conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
-
 
4104
				#可省略參數:
-
 
4105
				#無.
-
 
4106
				#參考資料:
-
 
4107
				#無.
-
 
4108
				#備註:
-
 
4109
				#無.
-
 
4110
				$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4111
				unset($conf["stringProcess::delHeadStr"]);
-
 
4112
				
-
 
4113
				#如果執行異常
-
 
4114
				if($delHeadStr["status"]==="false"){
-
 
4115
				
-
 
4116
					#設置錯誤識別
3986
				#設置預設的TTL
4117
					$result["status"]="false";
-
 
4118
 
-
 
4119
					#設置錯誤訊息
-
 
4120
					$result["error"]=$delHeadStr;
-
 
4121
 
-
 
4122
					#回傳結果
-
 
4123
					return $result;
-
 
4124
				
-
 
4125
					}#if end
-
 
4126
					
-
 
4127
				#如果有移除開頭的字串
-
 
4128
				if($delHeadStr["founded"]==="true"){
-
 
4129
				
-
 
4130
					#取得處理後的結果
-
 
4131
					$unFormatStr=$delHeadStr["content"];
-
 
4132
				
-
 
4133
					}#if end
-
 
4134
				
-
 
4135
				#解析 $TTL 的數值, 以及後面是否有註解...
-
 
4136
				#函式說明:
-
 
4137
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4138
				#回傳結果:
-
 
4139
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4140
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4141
				#$result["function"],當前執行的函式名稱.
-
 
4142
				#$result["argu"],所使用的參數.
-
 
4143
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4144
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4145
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
4146
				#必填參數:
-
 
4147
				#$conf["input"],字串,要檢查的字串.
-
 
4148
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4149
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4150
				$conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
-
 
4151
				#可省略參數:
-
 
4152
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4153
				#$conf["varEqual"]=array(null,"found");
-
 
4154
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3987
				$result["defaultTTL"]=$info["defaultTTL"];
4155
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
4156
				#參考資料:
-
 
4157
				#無.
-
 
4158
				#備註:
-
 
4159
				#無.
-
 
4160
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4161
				unset($conf["search::findSpecifyStrFormat"]);
-
 
4162
			
3988
			
4163
				#如果執行異常
-
 
4164
				if($findSpecifyStrFormat["status"]==="false"){
-
 
4165
				
-
 
4166
					#設置錯誤識別
-
 
4167
					$result["status"]="false";
-
 
4168
 
-
 
4169
					#設置錯誤訊息
-
 
4170
					$result["error"]=$findSpecifyStrFormat;
-
 
4171
 
-
 
4172
					#回傳結果
-
 
4173
					return $result;
-
 
4174
				
-
 
4175
					}#if end
-
 
4176
					
-
 
4177
				#如果有數值跟註解
-
 
4178
				if($findSpecifyStrFormat["found"]==="true"){
-
 
4179
				
-
 
4180
					#儲存數值
-
 
4181
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
4182
				
-
 
4183
					#儲存註解
-
 
4184
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
4185
				
-
 
4186
					#儲存預設的 TTL
-
 
4187
					$result["defaultTTL"]=trim($info["value"]);
-
 
4188
				
-
 
4189
					#儲存解析好的RR
-
 
4190
					$result["content"][]=$info;
-
 
4191
				
-
 
4192
					#換下一行
-
 
4193
					continue;
-
 
4194
					
-
 
4195
					}#if end
-
 
4196
					
-
 
4197
				#執行到這邊代表剩下的內容都是 value
-
 
4198
				$info["value"]=$unFormatStr;
-
 
4199
				
-
 
4200
				#儲存預設的 TTL
-
 
4201
				$result["defaultTTL"]=trim($info["value"]);
-
 
4202
				
-
 
4203
				#儲存解析好的RR
-
 
4204
				$result["content"][]=$info;
-
 
4205
				
-
 
4206
				#換下一行
-
 
4207
				continue;
-
 
4208
			
-
 
4209
				}#if end
-
 
4210
			
-
 
4211
			#如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
-
 
4212
			
-
 
4213
			#函式說明:
-
 
4214
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4215
			#回傳結果:
-
 
4216
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4217
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4218
			#$result["function"],當前執行的函式名稱.
-
 
4219
			#$result["argu"],所使用的參數.
-
 
4220
			#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4221
			#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4222
			#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
4223
			#必填參數:
-
 
4224
			#$conf["input"],字串,要檢查的字串.
-
 
4225
			$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4226
			#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4227
			$conf["search::findSpecifyStrFormat"]["format"]="\${left}(\${right}";
-
 
4228
			#可省略參數:
-
 
4229
			#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4230
			#$conf["varEqual"]=array(null,"found");
-
 
4231
			#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
4232
			#$conf["varCon"]=array("no_tail"=>" not");
-
 
4233
			#參考資料:
-
 
4234
			#無.
-
 
4235
			#備註:
-
 
4236
			#無.
-
 
4237
			$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4238
			unset($conf["search::findSpecifyStrFormat"]);
-
 
4239
		
-
 
4240
			#如果執行異常
-
 
4241
			if($findSpecifyStrFormat["status"]==="false"){
-
 
4242
			
-
 
4243
				#設置錯誤識別
-
 
4244
				$result["status"]="false";
-
 
4245
 
-
 
4246
				#設置錯誤訊息
-
 
4247
				$result["error"]=$findSpecifyStrFormat;
-
 
4248
 
-
 
4249
				#回傳結果
-
 
4250
				return $result;
-
 
4251
		
-
 
4252
				}#if end
3989
				}#if end
4253
				
3990
				
4254
			#如果存在"("
3991
			#如果是ORIGIN列
4255
			if($findSpecifyStrFormat["found"]==="true"){
3992
			if($info["type"]==="\$ORIGIN"){	
4256
			
3993
			
4257
				#取得無"("的內容
-
 
4258
				$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
4259
				
-
 
4260
				#取得拆下來的含開頭"("內容
-
 
4261
				$unFormatStr2add="(".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
4262
				
-
 
4263
				}#if end
-
 
4264
			
-
 
4265
			#反之
-
 
4266
			else{
-
 
4267
			
-
 
4268
				#函式說明:
-
 
4269
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4270
				#回傳結果:
-
 
4271
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4272
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4273
				#$result["function"],當前執行的函式名稱.
-
 
4274
				#$result["argu"],所使用的參數.
-
 
4275
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4276
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4277
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
4278
				#必填參數:
-
 
4279
				#$conf["input"],字串,要檢查的字串.
-
 
4280
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4281
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4282
				$conf["search::findSpecifyStrFormat"]["format"]="\${left}\"\${right}";
-
 
4283
				#可省略參數:
-
 
4284
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4285
				#$conf["varEqual"]=array(null,"found");
-
 
4286
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3994
				#設置RR所屬的domain
4287
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
4288
				#參考資料:
-
 
4289
				#無.
-
 
4290
				#備註:
-
 
4291
				#無.
-
 
4292
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4293
				unset($conf["search::findSpecifyStrFormat"]);
-
 
4294
			
-
 
4295
				#如果執行異常
-
 
4296
				if($findSpecifyStrFormat["status"]==="false"){
-
 
4297
				
-
 
4298
					#設置錯誤識別
-
 
4299
					$result["status"]="false";
-
 
4300
 
-
 
4301
					#設置錯誤訊息
-
 
4302
					$result["error"]=$findSpecifyStrFormat;
-
 
4303
 
-
 
4304
					#回傳結果
-
 
4305
					return $result;
-
 
4306
			
-
 
4307
					}#if end
-
 
4308
					
-
 
4309
				#如果存在"
-
 
4310
				if($findSpecifyStrFormat["found"]==="true"){
-
 
4311
				
-
 
4312
					#取得無"的內容
-
 
4313
					$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
4314
					
-
 
4315
					#取得拆下來的含開頭"內容
-
 
4316
					$unFormatStr2add="\"".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
4317
					
-
 
4318
					}#if end
-
 
4319
					
-
 
4320
				#反之
-
 
4321
				else{
-
 
4322
				
-
 
4323
					#函式說明:
-
 
4324
					#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4325
					#回傳結果:
-
 
4326
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4327
					#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4328
					#$result["function"],當前執行的函式名稱.
-
 
4329
					#$result["argu"],所使用的參數.
-
 
4330
					#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4331
					#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4332
					#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
4333
					#必填參數:
-
 
4334
					#$conf["input"],字串,要檢查的字串.
-
 
4335
					$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4336
					#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4337
					$conf["search::findSpecifyStrFormat"]["format"]="\${left};\${right}";
-
 
4338
					#可省略參數:
-
 
4339
					#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4340
					#$conf["varEqual"]=array(null,"found");
-
 
4341
					#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3995
				$result["domain"]=$info["domain"];
4342
					#$conf["varCon"]=array("no_tail"=>" not");
-
 
4343
					#參考資料:
-
 
4344
					#無.
-
 
4345
					#備註:
-
 
4346
					#無.
-
 
4347
					$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4348
					unset($conf["search::findSpecifyStrFormat"]);
-
 
4349
				
-
 
4350
					#如果執行異常
-
 
4351
					if($findSpecifyStrFormat["status"]==="false"){
-
 
4352
					
-
 
4353
						#設置錯誤識別
-
 
4354
						$result["status"]="false";
-
 
4355
 
-
 
4356
						#設置錯誤訊息
-
 
4357
						$result["error"]=$findSpecifyStrFormat;
-
 
4358
 
-
 
4359
						#回傳結果
-
 
4360
						return $result;
-
 
4361
				
-
 
4362
						}#if end
-
 
4363
						
-
 
4364
					#如果存在";"
-
 
4365
					if($findSpecifyStrFormat["found"]==="true"){
-
 
4366
					
-
 
4367
						#取得無";"的內容
-
 
4368
						$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
4369
						
-
 
4370
						#取得拆下來的含開頭";"內容
-
 
4371
						$unFormatStr2add=";".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
4372
						
-
 
4373
						}#if end
-
 
4374
				
-
 
4375
					}#else end
-
 
4376
			
-
 
4377
				}#else end
-
 
4378
			
-
 
4379
			#檢查是否為 @ 開頭
-
 
4380
			#函式說明:
-
 
4381
			#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4382
			#回傳結果:
-
 
4383
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4384
			#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4385
			#$result["function"],當前執行的函式名稱.
-
 
4386
			#$result["argu"],所使用的參數.
-
 
4387
			#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4388
			#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4389
			#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
4390
			#必填參數:
-
 
4391
			#$conf["input"],字串,要檢查的字串.
-
 
4392
			$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4393
			#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4394
			$conf["search::findSpecifyStrFormat"]["format"]="@\${else}";
-
 
4395
			#可省略參數:
-
 
4396
			#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4397
			#$conf["varEqual"]=array(null,"found");
-
 
4398
			#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
4399
			#$conf["varCon"]=array("no_tail"=>" not");
-
 
4400
			#參考資料:
-
 
4401
			#無.
-
 
4402
			#備註:
-
 
4403
			#無.
-
 
4404
			$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4405
			unset($conf["search::findSpecifyStrFormat"]);
-
 
4406
		
-
 
4407
			#如果執行異常
-
 
4408
			if($findSpecifyStrFormat["status"]==="false"){
-
 
4409
			
-
 
4410
				#設置錯誤識別
-
 
4411
				$result["status"]="false";
-
 
4412
 
-
 
4413
				#設置錯誤訊息
-
 
4414
				$result["error"]=$findSpecifyStrFormat;
-
 
4415
 
-
 
4416
				#回傳結果
-
 
4417
				return $result;
-
 
4418
			
-
 
4419
				}#if end
-
 
4420
				
-
 
4421
			#如果有找到符合格式的內容
-
 
4422
			if($findSpecifyStrFormat["found"]==="true"){
-
 
4423
			
-
 
4424
				#設置 query 的數值
-
 
4425
				$info["query"]="@";
-
 
4426
				
-
 
4427
				#取得後面待處理的內容
-
 
4428
				$unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
-
 
4429
				
-
 
4430
				#函式說明:
-
 
4431
				#將字串開頭的特定關鍵字移除.
-
 
4432
				#回傳結果:
-
 
4433
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4434
				#$result["error"],錯誤訊息陣列.
-
 
4435
				#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4436
				#$result["function"],當前執行的函數名稱.
-
 
4437
				#$result["argu"],使用的參數.
-
 
4438
				#$result["content"],處理好的的字串內容.
-
 
4439
				#$result["deleted"],被移除的內容.
-
 
4440
				#必填參數:
-
 
4441
				#$conf["stringIn"],字串,要處理的字串.
-
 
4442
				$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4443
				#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4444
				$conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
-
 
4445
				#可省略參數:
-
 
4446
				#無.
-
 
4447
				#參考資料:
-
 
4448
				#無.
-
 
4449
				#備註:
-
 
4450
				#無.
-
 
4451
				$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4452
				unset($conf["stringProcess::delHeadStr"]);
-
 
4453
				
-
 
4454
				#如果執行異常
-
 
4455
				if($delHeadStr["status"]==="false"){
-
 
4456
				
-
 
4457
					#設置錯誤識別
-
 
4458
					$result["status"]="false";
-
 
4459
 
-
 
4460
					#設置錯誤訊息
-
 
4461
					$result["error"]=$delHeadStr;
-
 
4462
 
-
 
4463
					#回傳結果
-
 
4464
					return $result;
-
 
4465
				
-
 
4466
					}#if end
-
 
4467
					
-
 
4468
				#如果有移除開頭的字串
-
 
4469
				if($delHeadStr["founded"]==="true"){
-
 
4470
				
-
 
4471
					#取得處理後的結果 update time..IN..type...value;comment
-
 
4472
					$unFormatStr=$delHeadStr["content"];
-
 
4473
				
-
 
4474
					}#if end
-
 
4475
					
-
 
4476
				#debug
-
 
4477
				#var_dump(__LINE__,$delHeadStr);
-
 
4478
				
3996
				
4479
				}#if end
3997
				}#if end
4480
			
3998
			
4481
			#反之
-
 
4482
			else{
-
 
4483
				
-
 
4484
				#執行到這邊,代表 query 為一非 @ 的字串
-
 
4485
				#函式說明:
-
 
4486
				#將指令字串解析成陣列,方便給予 external::callShell 使用
-
 
4487
				#回傳結果:
-
 
4488
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4489
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4490
				#$result["function"],當前執行的函式名稱.
-
 
4491
				#$result["content"],解析好的指令陣列.
-
 
4492
				#$result["cmd"],解析好的指令名稱.
-
 
4493
				#$result["argus"],解析好的參數陣列.
-
 
4494
				#$result["argu"],所使用的參數.
-
 
4495
				#必填參數
-
 
4496
				#$conf["cmdStr"],字串,要解析的指令字串
-
 
4497
				$conf["stringProcess::parseCmdString"]["cmdStr"]=$unFormatStr;
-
 
4498
				#可省略參數:
-
 
4499
				#無.
-
 
4500
				#參考資料:
-
 
4501
				#無.
-
 
4502
				#備註:
-
 
4503
				#無.
-
 
4504
				$parseCmdString=cmd::parseCmdString($conf["stringProcess::parseCmdString"]);
-
 
4505
				unset($conf["stringProcess::parseCmdString"]);
-
 
4506
				
-
 
4507
				#如果執行失敗
-
 
4508
				if($parseCmdString["status"]==="false"){
-
 
4509
				
-
 
4510
					#設置錯誤識別
-
 
4511
					$result["status"]="false";
-
 
4512
 
-
 
4513
					#設置錯誤訊息
-
 
4514
					$result["error"]=$parseCmdString;
-
 
4515
					
-
 
4516
					#debug
-
 
4517
					#$result["errorProcessLine"]=$line;
-
 
4518
 
-
 
4519
					#回傳結果
-
 
4520
					return $result;
-
 
4521
				
-
 
4522
					}#if end
-
 
4523
					
-
 
4524
				#取得 query 的內容
-
 
4525
				$info["query"]=$parseCmdString["content"][0];
-
 
4526
				
-
 
4527
				#剔除 query以及後面的" "跟\t
-
 
4528
				#函式說明:
-
 
4529
				#將字串開頭的特定關鍵字移除.
-
 
4530
				#回傳結果:
-
 
4531
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4532
				#$result["error"],錯誤訊息陣列.
-
 
4533
				#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4534
				#$result["function"],當前執行的函數名稱.
-
 
4535
				#$result["argu"],使用的參數.
-
 
4536
				#$result["content"],處理好的的字串內容.
-
 
4537
				#$result["deleted"],被移除的內容.
-
 
4538
				#必填參數:
-
 
4539
				#$conf["stringIn"],字串,要處理的字串.
-
 
4540
				$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4541
				#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4542
				$conf["stringProcess::delHeadStr"]["headStr"]=array($info["query"]," ","\t");
-
 
4543
				#可省略參數:
-
 
4544
				#無.
-
 
4545
				#參考資料:
-
 
4546
				#無.
-
 
4547
				#備註:
-
 
4548
				#無.
-
 
4549
				$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4550
				unset($conf["stringProcess::delHeadStr"]);
-
 
4551
				
-
 
4552
				#如果執行異常
-
 
4553
				if($delHeadStr["status"]==="false"){
-
 
4554
				
-
 
4555
					#設置錯誤識別
-
 
4556
					$result["status"]="false";
-
 
4557
 
-
 
4558
					#設置錯誤訊息
-
 
4559
					$result["error"]=$delHeadStr;
-
 
4560
 
-
 
4561
					#回傳結果
-
 
4562
					return $result;
-
 
4563
				
-
 
4564
					}#if end
-
 
4565
					
-
 
4566
				#取得update time..IN..type...value;comment
-
 
4567
				$unFormatStr=$delHeadStr["content"];
-
 
4568
			
-
 
4569
				}#else end
-
 
4570
			
-
 
4571
			#無窮迴圈
-
 
4572
			while(true){
-
 
4573
				
-
 
4574
				#如果要debug
-
 
4575
				if($conf["debug"]==="true"){
-
 
4576
				
-
 
4577
					#函式說明:
-
 
4578
					#撰寫log
-
 
4579
					#回傳結果:
-
 
4580
					#$result["status"],狀態,"true"或"false".
-
 
4581
					#$result["error"],錯誤訊息陣列.
-
 
4582
					#$result["function"],當前函式的名稱.
-
 
4583
					#$result["argu"],使用的參數.
-
 
4584
					#$result["content"],要寫入log的內容字串.
-
 
4585
					#必填參數:
-
 
4586
					#$conf["path"],字串,log檔案的路徑與名稱.
-
 
4587
					$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
4588
					#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
4589
					$conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
-
 
4590
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
4591
					$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
4592
					#可省略參數:
-
 
4593
					#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
4594
					#$conf["rewrite"]="false";
-
 
4595
					#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
4596
					#$conf["returnOnly"]="true";
-
 
4597
					#參考資料:
-
 
4598
					#無.
-
 
4599
					#備註:
-
 
4600
					#無.
-
 
4601
					$record=logs::record($conf["logs::record"]);
-
 
4602
					unset($conf["logs::record"]);
-
 
4603
					
-
 
4604
					}#if end
-
 
4605
				
-
 
4606
				#解析 updateTime..IN..type...value...comment
-
 
4607
			
-
 
4608
				#判斷是否無 update time
-
 
4609
				
-
 
4610
				#函式說明:
-
 
4611
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4612
				#回傳結果:
-
 
4613
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4614
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4615
				#$result["function"],當前執行的函式名稱.
-
 
4616
				#$result["argu"],所使用的參數.
-
 
4617
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
4618
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
4619
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
4620
				#必填參數:
-
 
4621
				#$conf["input"],字串,要檢查的字串.
-
 
4622
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
4623
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
4624
				$conf["search::findSpecifyStrFormat"]["format"]="IN\${else}";
-
 
4625
				#可省略參數:
-
 
4626
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
4627
				#$conf["varEqual"]=array(null,"found");
-
 
4628
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
4629
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
4630
				#參考資料:
-
 
4631
				#無.
-
 
4632
				#備註:
-
 
4633
				#無.
-
 
4634
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
4635
				unset($conf["search::findSpecifyStrFormat"]);
-
 
4636
			
-
 
4637
				#如果執行異常
-
 
4638
				if($findSpecifyStrFormat["status"]==="false"){
-
 
4639
				
-
 
4640
					#設置錯誤識別
-
 
4641
					$result["status"]="false";
-
 
4642
 
-
 
4643
					#設置錯誤訊息
-
 
4644
					$result["error"]=$findSpecifyStrFormat;
-
 
4645
 
-
 
4646
					#回傳結果
-
 
4647
					return $result;
-
 
4648
				
-
 
4649
					}#if end
-
 
4650
					
-
 
4651
				#如果有找到符合格式的內容
-
 
4652
				if($findSpecifyStrFormat["found"]==="true"){
-
 
4653
				
-
 
4654
					#代表沒有 update time 欄位,因此儲存預設的TTL
-
 
4655
					$info["update"]=&$result["defaultTTL"];
-
 
4656
					
-
 
4657
					#取得剩下的 ...type...value;comment
-
 
4658
					$unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
-
 
4659
					
-
 
4660
					#設置該行沒有指定 update time
-
 
4661
					$noUpdateTime="true";
-
 
4662
					
-
 
4663
					#如果要debug
-
 
4664
					if($conf["debug"]==="true"){
-
 
4665
					
-
 
4666
						#函式說明:
-
 
4667
						#撰寫log
-
 
4668
						#回傳結果:
-
 
4669
						#$result["status"],狀態,"true"或"false".
-
 
4670
						#$result["error"],錯誤訊息陣列.
-
 
4671
						#$result["function"],當前函式的名稱.
-
 
4672
						#$result["argu"],使用的參數.
-
 
4673
						#$result["content"],要寫入log的內容字串.
-
 
4674
						#必填參數:
-
 
4675
						#$conf["path"],字串,log檔案的路徑與名稱.
-
 
4676
						$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
4677
						#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
4678
						$conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
-
 
4679
						#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
4680
						$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
4681
						#可省略參數:
-
 
4682
						#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
4683
						#$conf["rewrite"]="false";
-
 
4684
						#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
4685
						#$conf["returnOnly"]="true";
-
 
4686
						#參考資料:
-
 
4687
						#無.
-
 
4688
						#備註:
-
 
4689
						#無.
-
 
4690
						$record=logs::record($conf["logs::record"]);
-
 
4691
						unset($conf["logs::record"]);
-
 
4692
					
-
 
4693
						}#if end
-
 
4694
				
-
 
4695
					}#if end
-
 
4696
					
-
 
4697
				#反之
-
 
4698
				else{
-
 
4699
				
-
 
4700
					#設置該行有指定 update time
-
 
4701
					$noUpdateTime="false";
-
 
4702
				
-
 
4703
					#如果有指定 update time
-
 
4704
					if($noUpdateTime==="false"){
-
 
4705
					
-
 
4706
						#要來解析 update time
-
 
4707
						#函式說明:
-
 
4708
						#將字串進行解析,變成多個參數.
-
 
4709
						#回傳結果:
-
 
4710
						#$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
-
 
4711
						#$result["function"],當前執行的函式內容.
-
 
4712
						#$result["error"],錯誤訊息陣列.
-
 
4713
						#$result["content"],參數陣列.
-
 
4714
						#$result["count"],總共有幾個參數.
-
 
4715
						#必填參數:
-
 
4716
						#$conf["input"],字串,要解析成參數的字串.
-
 
4717
						$conf["stringProcess::parse"]["input"]=$unFormatStr;
-
 
4718
						#可省略參數:
-
 
4719
						#無.
-
 
4720
						#參考資料:
-
 
4721
						#無.
-
 
4722
						#備註:
-
 
4723
						#無.
-
 
4724
						$parse=stringProcess::parse($conf["stringProcess::parse"]);
-
 
4725
						unset($conf["stringProcess::parse"]);
-
 
4726
						
-
 
4727
						#如果執行異常
-
 
4728
						if($parse["status"]==="false"){
-
 
4729
						
-
 
4730
							#設置錯誤識別
-
 
4731
							$result["status"]="false";
-
 
4732
 
-
 
4733
							#設置錯誤訊息
-
 
4734
							$result["error"]=$parse;
-
 
4735
 
-
 
4736
							#回傳結果
-
 
4737
							return $result;
-
 
4738
							
-
 
4739
							}#if end
-
 
4740
							
-
 
4741
						#取得更新時間
-
 
4742
						$info["update"]=$parse["content"][0];
-
 
4743
					
-
 
4744
						#取得 update time 後面的內容
-
 
4745
						#函式說明:
-
 
4746
						#將字串開頭的特定關鍵字移除.
-
 
4747
						#回傳結果:
-
 
4748
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4749
						#$result["error"],錯誤訊息陣列.
-
 
4750
						#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4751
						#$result["function"],當前執行的函數名稱.
-
 
4752
						#$result["argu"],使用的參數.
-
 
4753
						#$result["content"],處理好的的字串內容.
-
 
4754
						#$result["deleted"],被移除的內容.
-
 
4755
						#必填參數:
-
 
4756
						#$conf["stringIn"],字串,要處理的字串.
-
 
4757
						$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4758
						#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4759
						$conf["stringProcess::delHeadStr"]["headStr"]=array($info["update"]);
-
 
4760
						#可省略參數:
-
 
4761
						#無.
-
 
4762
						#參考資料:
-
 
4763
						#無.
-
 
4764
						#備註:
-
 
4765
						#無.
-
 
4766
						$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4767
						unset($conf["stringProcess::delHeadStr"]);
-
 
4768
						
-
 
4769
						#如果執行異常
-
 
4770
						if($delHeadStr["status"]==="false"){
-
 
4771
						
-
 
4772
							#設置錯誤識別
-
 
4773
							$result["status"]="false";
-
 
4774
 
-
 
4775
							#設置錯誤訊息
-
 
4776
							$result["error"]=$delHeadStr;
-
 
4777
 
-
 
4778
							#回傳結果
-
 
4779
							return $result;
-
 
4780
						
-
 
4781
							}#if end
-
 
4782
						
-
 
4783
						#取得...IN...value;comment
-
 
4784
						$unFormatStr=$delHeadStr["content"];
-
 
4785
					
-
 
4786
						}#if end
-
 
4787
					
-
 
4788
					#取得 ...IN... 後面的內容
-
 
4789
					#函式說明:
-
 
4790
					#將字串開頭的特定關鍵字移除.
-
 
4791
					#回傳結果:
-
 
4792
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4793
					#$result["error"],錯誤訊息陣列.
-
 
4794
					#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4795
					#$result["function"],當前執行的函數名稱.
-
 
4796
					#$result["argu"],使用的參數.
-
 
4797
					#$result["content"],處理好的的字串內容.
-
 
4798
					#$result["deleted"],被移除的內容.
-
 
4799
					#必填參數:
-
 
4800
					#$conf["stringIn"],字串,要處理的字串.
-
 
4801
					$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4802
					#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4803
					$conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t","IN");
-
 
4804
					#可省略參數:
-
 
4805
					#無.
-
 
4806
					#參考資料:
-
 
4807
					#無.
-
 
4808
					#備註:
-
 
4809
					#無.
-
 
4810
					$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4811
					unset($conf["stringProcess::delHeadStr"]);
-
 
4812
					
-
 
4813
					#如果執行異常
-
 
4814
					if($delHeadStr["status"]==="false"){
-
 
4815
					
-
 
4816
						#設置錯誤識別
-
 
4817
						$result["status"]="false";
-
 
4818
 
-
 
4819
						#設置錯誤訊息
-
 
4820
						$result["error"]=$delHeadStr;
-
 
4821
 
-
 
4822
						#回傳結果
-
 
4823
						return $result;
-
 
4824
					
-
 
4825
						}#if end
-
 
4826
					
-
 
4827
					#取得IN...value;comment
-
 
4828
					$unFormatStr=$delHeadStr["content"];
-
 
4829
					
-
 
4830
					#如果要debug
-
 
4831
					if($conf["debug"]==="true"){
-
 
4832
					
-
 
4833
						#函式說明:
-
 
4834
						#撰寫log
-
 
4835
						#回傳結果:
-
 
4836
						#$result["status"],狀態,"true"或"false".
-
 
4837
						#$result["error"],錯誤訊息陣列.
-
 
4838
						#$result["function"],當前函式的名稱.
-
 
4839
						#$result["argu"],使用的參數.
-
 
4840
						#$result["content"],要寫入log的內容字串.
-
 
4841
						#必填參數:
-
 
4842
						#$conf["path"],字串,log檔案的路徑與名稱.
-
 
4843
						$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
4844
						#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
4845
						$conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
-
 
4846
						#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
4847
						$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
4848
						#可省略參數:
-
 
4849
						#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
4850
						#$conf["rewrite"]="false";
-
 
4851
						#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
4852
						#$conf["returnOnly"]="true";
-
 
4853
						#參考資料:
-
 
4854
						#無.
-
 
4855
						#備註:
-
 
4856
						#無.
-
 
4857
						$record=logs::record($conf["logs::record"]);
-
 
4858
						unset($conf["logs::record"]);
-
 
4859
					
-
 
4860
						}#if end
-
 
4861
					
-
 
4862
					}#else end
-
 
4863
				
-
 
4864
				#解析 type...value;comment
-
 
4865
				#函式說明:
-
 
4866
				#將字串進行解析,變成多個參數.
-
 
4867
				#回傳結果:
-
 
4868
				#$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
-
 
4869
				#$result["function"],當前執行的函式內容.
-
 
4870
				#$result["error"],錯誤訊息陣列.
-
 
4871
				#$result["content"],參數陣列.
-
 
4872
				#$result["count"],總共有幾個參數.
-
 
4873
				#必填參數:
-
 
4874
				#$conf["input"],字串,要解析成參數的字串.
-
 
4875
				$conf["stringProcess::parse"]["input"]=$unFormatStr;
-
 
4876
				#可省略參數:
-
 
4877
				#無.
-
 
4878
				#參考資料:
-
 
4879
				#無.
-
 
4880
				#備註:
-
 
4881
				#無.
-
 
4882
				$parse=stringProcess::parse($conf["stringProcess::parse"]);
-
 
4883
				unset($conf["stringProcess::parse"]);
-
 
4884
				
-
 
4885
				#如果執行異常
-
 
4886
				if($parse["status"]==="false"){
-
 
4887
				
-
 
4888
					#設置錯誤識別
-
 
4889
					$result["status"]="false";
-
 
4890
 
-
 
4891
					#設置錯誤訊息
-
 
4892
					$result["error"]=$parse;
-
 
4893
 
-
 
4894
					#回傳結果
-
 
4895
					return $result;
-
 
4896
					
-
 
4897
					}#if end
-
 
4898
				
-
 
4899
				#取得 type
-
 
4900
				$info["type"]=$parse["content"][0];
-
 
4901
				
-
 
4902
				#取得 type...後面的value;comment內容
-
 
4903
				#函式說明:
-
 
4904
				#將字串開頭的特定關鍵字移除.
-
 
4905
				#回傳結果:
-
 
4906
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4907
				#$result["error"],錯誤訊息陣列.
-
 
4908
				#$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
-
 
4909
				#$result["function"],當前執行的函數名稱.
-
 
4910
				#$result["argu"],使用的參數.
-
 
4911
				#$result["content"],處理好的的字串內容.
-
 
4912
				#$result["deleted"],被移除的內容.
-
 
4913
				#必填參數:
-
 
4914
				#$conf["stringIn"],字串,要處理的字串.
-
 
4915
				$conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
-
 
4916
				#$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
-
 
4917
				$conf["stringProcess::delHeadStr"]["headStr"]=array($info["type"]," ","\t");
-
 
4918
				#可省略參數:
-
 
4919
				#無.
-
 
4920
				#參考資料:
-
 
4921
				#無.
-
 
4922
				#備註:
-
 
4923
				#無.
-
 
4924
				$delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
-
 
4925
				unset($conf["stringProcess::delHeadStr"]);
-
 
4926
				
-
 
4927
				#如果執行異常
-
 
4928
				if($delHeadStr["status"]==="false"){
-
 
4929
				
-
 
4930
					#設置錯誤識別
-
 
4931
					$result["status"]="false";
-
 
4932
 
-
 
4933
					#設置錯誤訊息
-
 
4934
					$result["error"]=$delHeadStr;
-
 
4935
 
-
 
4936
					#回傳結果
-
 
4937
					return $result;
-
 
4938
				
-
 
4939
					}#if end
-
 
4940
					
-
 
4941
				#取得 value;comment
-
 
4942
				$unFormatStr=$delHeadStr["content"];
-
 
4943
				
-
 
4944
				#如果有要合併回去的內容
-
 
4945
				if(isset($unFormatStr2add)){
-
 
4946
				
-
 
4947
					#合併回去內容
-
 
4948
					$unFormatStr=$unFormatStr.$unFormatStr2add;
-
 
4949
				
-
 
4950
					#移除用不到的變數
-
 
4951
					unset($unFormatStr2add);
-
 
4952
				
-
 
4953
					}#if end
-
 
4954
				
-
 
4955
				#如果要debug
-
 
4956
				if($conf["debug"]==="true"){
-
 
4957
				
-
 
4958
					#函式說明:
-
 
4959
					#撰寫log
-
 
4960
					#回傳結果:
-
 
4961
					#$result["status"],狀態,"true"或"false".
-
 
4962
					#$result["error"],錯誤訊息陣列.
-
 
4963
					#$result["function"],當前函式的名稱.
-
 
4964
					#$result["argu"],使用的參數.
-
 
4965
					#$result["content"],要寫入log的內容字串.
-
 
4966
					#必填參數:
-
 
4967
					#$conf["path"],字串,log檔案的路徑與名稱.
-
 
4968
					$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
4969
					#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
4970
					$conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
-
 
4971
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
4972
					$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
4973
					#可省略參數:
-
 
4974
					#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
4975
					#$conf["rewrite"]="false";
-
 
4976
					#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
4977
					#$conf["returnOnly"]="true";
-
 
4978
					#參考資料:
-
 
4979
					#無.
-
 
4980
					#備註:
-
 
4981
					#無.
-
 
4982
					$record=logs::record($conf["logs::record"]);
-
 
4983
					unset($conf["logs::record"]);
-
 
4984
				
-
 
4985
					}#if end
-
 
4986
				
-
 
4987
				#如果type不為 CNAME 跟 TXT 跟 SOA
-
 
4988
				if( $info["type"]!=="CNAME" && $info["type"]!=="TXT" && $info["type"]!=="SOA" ){
-
 
4989
				
-
 
4990
					#儲存value
-
 
4991
					$info["value"]=$unFormatStr;
-
 
4992
				
-
 
4993
					#判斷是否有 ";" 存在
-
 
4994
					#函式說明:
-
 
4995
					#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
4996
					#回傳結果:
-
 
4997
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
4998
					#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
4999
					#$result["function"],當前執行的函式名稱.
-
 
5000
					#$result["argu"],所使用的參數.
-
 
5001
					#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5002
					#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5003
					#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5004
					#必填參數:
-
 
5005
					#$conf["input"],字串,要檢查的字串.
-
 
5006
					$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5007
					#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5008
					$conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
-
 
5009
					#可省略參數:
-
 
5010
					#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5011
					#$conf["varEqual"]=array(null,"found");
-
 
5012
					#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5013
					#$conf["varCon"]=array("no_tail"=>" not");
-
 
5014
					#參考資料:
-
 
5015
					#無.
-
 
5016
					#備註:
-
 
5017
					#無.
-
 
5018
					$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5019
					unset($conf["search::findSpecifyStrFormat"]);
-
 
5020
				
-
 
5021
					#如果執行異常
-
 
5022
					if($findSpecifyStrFormat["status"]==="false"){
-
 
5023
					
-
 
5024
						#設置錯誤識別
-
 
5025
						$result["status"]="false";
-
 
5026
 
-
 
5027
						#設置錯誤訊息
-
 
5028
						$result["error"]=$findSpecifyStrFormat;
-
 
5029
 
-
 
5030
						#回傳結果
-
 
5031
						return $result;
-
 
5032
					
-
 
5033
						}#if end
-
 
5034
						
-
 
5035
					#如果有 ";"
-
 
5036
					if($findSpecifyStrFormat["found"]==="true"){
-
 
5037
					
-
 
5038
						#儲存value
-
 
5039
						$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5040
					
-
 
5041
						#儲存comment
-
 
5042
						$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
5043
					
-
 
5044
						}#if end
-
 
5045
						
-
 
5046
					#儲存該筆RR
-
 
5047
					$result["content"][]=$info;
-
 
5048
						
-
 
5049
					#解析完畢換下一行
-
 
5050
					continue 2;
-
 
5051
				
-
 
5052
					}#if end
-
 
5053
			
-
 
5054
				#執行到這邊,代表type為CNAME或TXT或SOA
-
 
5055
				
-
 
5056
				#如果 type 是 SOA
-
 
5057
				if($info["type"]==="SOA"){
-
 
5058
				
-
 
5059
					#如果要debug
-
 
5060
					if($conf["debug"]==="true"){
-
 
5061
					
-
 
5062
						#函式說明:
-
 
5063
						#撰寫log
-
 
5064
						#回傳結果:
-
 
5065
						#$result["status"],狀態,"true"或"false".
-
 
5066
						#$result["error"],錯誤訊息陣列.
-
 
5067
						#$result["function"],當前函式的名稱.
-
 
5068
						#$result["argu"],使用的參數.
-
 
5069
						#$result["content"],要寫入log的內容字串.
-
 
5070
						#必填參數:
-
 
5071
						#$conf["path"],字串,log檔案的路徑與名稱.
-
 
5072
						$conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
-
 
5073
						#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
-
 
5074
						$conf["logs::record"]["content"]="lineNo:".__LINE__." type:".$info["type"].PHP_EOL;
-
 
5075
						#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
-
 
5076
						$conf["logs::record"]["fileArgu"]=__FILE__;
-
 
5077
						#可省略參數:
-
 
5078
						#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
-
 
5079
						#$conf["rewrite"]="false";
-
 
5080
						#$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
-
 
5081
						#$conf["returnOnly"]="true";
-
 
5082
						#參考資料:
-
 
5083
						#無.
-
 
5084
						#備註:
-
 
5085
						#無.
-
 
5086
						$record=logs::record($conf["logs::record"]);
-
 
5087
						unset($conf["logs::record"]);
-
 
5088
					
-
 
5089
						}#if end
-
 
5090
						
-
 
5091
					#SOA 範例
-
 
5092
					#@	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
-
 
5093
				
-
 
5094
					#再度嘗試分割
-
 
5095
					#如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
-
 
5096
			
-
 
5097
					#函式說明:
-
 
5098
					#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5099
					#回傳結果:
-
 
5100
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5101
					#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5102
					#$result["function"],當前執行的函式名稱.
-
 
5103
					#$result["argu"],所使用的參數.
-
 
5104
					#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5105
					#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5106
					#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
5107
					#必填參數:
-
 
5108
					#$conf["input"],字串,要檢查的字串.
-
 
5109
					$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5110
					#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5111
					$conf["search::findSpecifyStrFormat"]["format"]="\${left}(\${right}";
-
 
5112
					#可省略參數:
-
 
5113
					#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5114
					#$conf["varEqual"]=array(null,"found");
-
 
5115
					#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5116
					#$conf["varCon"]=array("no_tail"=>" not");
-
 
5117
					#參考資料:
-
 
5118
					#無.
-
 
5119
					#備註:
-
 
5120
					#無.
-
 
5121
					$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5122
					unset($conf["search::findSpecifyStrFormat"]);
-
 
5123
				
-
 
5124
					#如果執行異常
-
 
5125
					if($findSpecifyStrFormat["status"]==="false"){
-
 
5126
					
-
 
5127
						#設置錯誤識別
-
 
5128
						$result["status"]="false";
-
 
5129
 
-
 
5130
						#設置錯誤訊息
-
 
5131
						$result["error"]=$findSpecifyStrFormat;
-
 
5132
 
-
 
5133
						#回傳結果
-
 
5134
						return $result;
-
 
5135
				
-
 
5136
						}#if end
-
 
5137
						
-
 
5138
					#如果存在"("
-
 
5139
					if($findSpecifyStrFormat["found"]==="true"){
-
 
5140
					
-
 
5141
						#取得無"("的內容
-
 
5142
						$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
5143
						
-
 
5144
						#取得拆下來的含開頭"("內容
-
 
5145
						$unFormatStr2add="(".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
5146
						
-
 
5147
						}#if end
-
 
5148
					
-
 
5149
					#反之
-
 
5150
					else{
-
 
5151
					
-
 
5152
						#函式說明:
-
 
5153
						#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5154
						#回傳結果:
-
 
5155
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5156
						#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5157
						#$result["function"],當前執行的函式名稱.
-
 
5158
						#$result["argu"],所使用的參數.
-
 
5159
						#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5160
						#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5161
						#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
5162
						#必填參數:
-
 
5163
						#$conf["input"],字串,要檢查的字串.
-
 
5164
						$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5165
						#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5166
						$conf["search::findSpecifyStrFormat"]["format"]="\${left}\"\${right}";
-
 
5167
						#可省略參數:
-
 
5168
						#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5169
						#$conf["varEqual"]=array(null,"found");
-
 
5170
						#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
3999
			#儲存 RR 的記錄
5171
						#$conf["varCon"]=array("no_tail"=>" not");
-
 
5172
						#參考資料:
-
 
5173
						#無.
-
 
5174
						#備註:
-
 
5175
						#無.
-
 
5176
						$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5177
						unset($conf["search::findSpecifyStrFormat"]);
-
 
5178
					
-
 
5179
						#如果執行異常
-
 
5180
						if($findSpecifyStrFormat["status"]==="false"){
-
 
5181
						
-
 
5182
							#設置錯誤識別
-
 
5183
							$result["status"]="false";
-
 
5184
 
-
 
5185
							#設置錯誤訊息
-
 
5186
							$result["error"]=$findSpecifyStrFormat;
-
 
5187
 
-
 
5188
							#回傳結果
-
 
5189
							return $result;
-
 
5190
					
-
 
5191
							}#if end
-
 
5192
							
-
 
5193
						#如果存在"
-
 
5194
						if($findSpecifyStrFormat["found"]==="true"){
-
 
5195
						
-
 
5196
							#取得無"的內容
-
 
5197
							$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
5198
							
-
 
5199
							#取得拆下來的含開頭"內容
-
 
5200
							$unFormatStr2add="\"".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
5201
							
-
 
5202
							}#if end
-
 
5203
							
-
 
5204
						#反之
-
 
5205
						else{
-
 
5206
						
-
 
5207
							#函式說明:
-
 
5208
							#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5209
							#回傳結果:
-
 
5210
							#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5211
							#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5212
							#$result["function"],當前執行的函式名稱.
-
 
5213
							#$result["argu"],所使用的參數.
-
 
5214
							#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5215
							#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5216
							#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
-
 
5217
							#必填參數:
-
 
5218
							#$conf["input"],字串,要檢查的字串.
-
 
5219
							$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5220
							#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5221
							$conf["search::findSpecifyStrFormat"]["format"]="\${left};\${right}";
-
 
5222
							#可省略參數:
-
 
5223
							#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5224
							#$conf["varEqual"]=array(null,"found");
-
 
5225
							#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
4000
			$result["content"][]=$info;
5226
							#$conf["varCon"]=array("no_tail"=>" not");
-
 
5227
							#參考資料:
-
 
5228
							#無.
-
 
5229
							#備註:
-
 
5230
							#無.
-
 
5231
							$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5232
							unset($conf["search::findSpecifyStrFormat"]);
-
 
5233
						
-
 
5234
							#如果執行異常
-
 
5235
							if($findSpecifyStrFormat["status"]==="false"){
-
 
5236
							
-
 
5237
								#設置錯誤識別
-
 
5238
								$result["status"]="false";
-
 
5239
 
-
 
5240
								#設置錯誤訊息
-
 
5241
								$result["error"]=$findSpecifyStrFormat;
-
 
5242
 
-
 
5243
								#回傳結果
-
 
5244
								return $result;
-
 
5245
						
-
 
5246
								}#if end
-
 
5247
								
-
 
5248
							#如果存在";"
-
 
5249
							if($findSpecifyStrFormat["found"]==="true"){
-
 
5250
							
-
 
5251
								#取得無";"的內容
-
 
5252
								$unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
-
 
5253
								
-
 
5254
								#取得拆下來的含開頭";"內容
-
 
5255
								$unFormatStr2add=";".$findSpecifyStrFormat["parsedVar"]["right"][0];
-
 
5256
								
-
 
5257
								}#if end
-
 
5258
						
-
 
5259
							}#else end
-
 
5260
					
-
 
5261
						}#else end
-
 
5262
				
-
 
5263
					#取得 serial number
-
 
5264
					#函式說明:
-
 
5265
					#將字串進行解析,變成多個參數.
-
 
5266
					#回傳結果:
-
 
5267
					#$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
-
 
5268
					#$result["function"],當前執行的函式內容.
-
 
5269
					#$result["error"],錯誤訊息陣列.
-
 
5270
					#$result["content"],參數陣列.
-
 
5271
					#$result["count"],總共有幾個參數.
-
 
5272
					#必填參數:
-
 
5273
					#$conf["input"],字串,要解析成參數的字串.
-
 
5274
					$conf["stringProcess::parse"]["input"]=$unFormatStr;
-
 
5275
					#可省略參數:
-
 
5276
					#無.
-
 
5277
					#參考資料:
-
 
5278
					#無.
-
 
5279
					#備註:
-
 
5280
					#無.
-
 
5281
					$parse=stringProcess::parse($conf["stringProcess::parse"]);
-
 
5282
					unset($conf["stringProcess::parse"]);
-
 
5283
					
-
 
5284
					#如果執行異常
-
 
5285
					if($parse["status"]==="false"){
-
 
5286
					
-
 
5287
						#設置錯誤識別
-
 
5288
						$result["status"]="false";
-
 
5289
 
-
 
5290
						#設置錯誤訊息
-
 
5291
						$result["error"]=$parse;
-
 
5292
 
-
 
5293
						#回傳結果
-
 
5294
						return $result;
-
 
5295
					
-
 
5296
						}#if end
-
 
5297
					
-
 
5298
					#取得serial number
-
 
5299
					$serialNo=$parse["content"][2];
-
 
5300
				
-
 
5301
					#serialNo+1
-
 
5302
					$serialNo++;
-
 
5303
				
-
 
5304
					#回存
-
 
5305
					$parse["content"][2]=(string)$serialNo;
-
 
5306
					
-
 
5307
					#函式說明:
-
 
5308
					#將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
-
 
5309
					#回傳的結果:
-
 
5310
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5311
					#$result["function"],當前執行的function名稱
-
 
5312
					#$result["error"],錯誤訊息陣列.
-
 
5313
					#$result["content"],處理好的字串.
-
 
5314
					#$result["argu"],使用的參數.
-
 
5315
					#必填參數:
-
 
5316
					#$conf["inputArray"],字串陣列,要轉成字串的一維陣列.
-
 
5317
					$conf["arrays::arrayToString"]["inputArray"]=$parse["content"];
-
 
5318
					#可省略參數:
-
 
5319
					#$conf["spiltSymbol"],字串,用來區隔字串的符號,預設為;
-
 
5320
					$conf["arrays::arrayToString"]["spiltSymbol"]=" ";
-
 
5321
					#$conf["skipEnd"],字串,結尾是否不要加上符號,預設為"false",要加上符號,"true"代表不要加上符號。
-
 
5322
					$conf["arrays::arrayToString"]["skipEnd"]="true";
-
 
5323
					#$conf["spiltSymbolAtStart"],字串,是否要在開頭加上spiltSymbol,預設為"false",代表不要;反之為“true”.
-
 
5324
					#$conf["spiltSymbolAtStart"]="";
-
 
5325
					#參考資料:
-
 
5326
					#無.
-
 
5327
					#備註:
-
 
5328
					#無.
-
 
5329
					$arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
-
 
5330
					unset($conf["arrays::arrayToString"]);
-
 
5331
					
-
 
5332
					#如果執行異常
-
 
5333
					if($arrayToString["status"]==="false"){
-
 
5334
					
-
 
5335
						#設置錯誤識別
-
 
5336
						$result["status"]="false";
-
 
5337
 
-
 
5338
						#設置錯誤訊息
-
 
5339
						$result["error"]=$arrayToString;
-
 
5340
 
-
 
5341
						#回傳結果
-
 
5342
						return $result;
-
 
5343
					
-
 
5344
						}#if end
-
 
5345
					
-
 
5346
					#取得更新 serial number 後的 SOA value string
-
 
5347
					$unFormatStr=$arrayToString["content"];
-
 
5348
				
-
 
5349
					#如果有要合併回去的內容
-
 
5350
					if(isset($unFormatStr2add)){
-
 
5351
					
-
 
5352
						#合併回去內容
-
 
5353
						$unFormatStr=$unFormatStr.$unFormatStr2add;
-
 
5354
					
-
 
5355
						#移除用不到的變數
-
 
5356
						unset($unFormatStr2add);
-
 
5357
					
-
 
5358
						}#if end
-
 
5359
				
-
 
5360
					#假設剩下的沒有註解都是 value
-
 
5361
					$info["value"]=$unFormatStr;
-
 
5362
				
-
 
5363
					#函式說明:
-
 
5364
					#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5365
					#回傳結果:
-
 
5366
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5367
					#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5368
					#$result["function"],當前執行的函式名稱.
-
 
5369
					#$result["argu"],所使用的參數.
-
 
5370
					#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5371
					#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5372
					#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5373
					#必填參數:
-
 
5374
					#$conf["input"],字串,要檢查的字串.
-
 
5375
					$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5376
					#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5377
					$conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
-
 
5378
					#可省略參數:
-
 
5379
					#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5380
					#$conf["varEqual"]=array(null,"found");
-
 
5381
					#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5382
					#$conf["varCon"]=array("no_tail"=>" not");
-
 
5383
					#參考資料:
-
 
5384
					#無.
-
 
5385
					#備註:
-
 
5386
					#無.
-
 
5387
					$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5388
					unset($conf["search::findSpecifyStrFormat"]);
-
 
5389
				
-
 
5390
					#如果執行異常
-
 
5391
					if($findSpecifyStrFormat["status"]==="false"){
-
 
5392
					
-
 
5393
						#設置錯誤識別
-
 
5394
						$result["status"]="false";
-
 
5395
 
-
 
5396
						#設置錯誤訊息
-
 
5397
						$result["error"]=$findSpecifyStrFormat;
-
 
5398
 
-
 
5399
						#回傳結果
-
 
5400
						return $result;
-
 
5401
					
-
 
5402
						}#if end
-
 
5403
						
-
 
5404
					#如果有符合格式
-
 
5405
					if($findSpecifyStrFormat["found"]==="true"){
-
 
5406
					
-
 
5407
						#儲存 value
-
 
5408
						$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5409
					
-
 
5410
						#儲存 comment
-
 
5411
						$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
5412
					
-
 
5413
						}#if end
-
 
5414
					
-
 
5415
					#儲存該筆RR
-
 
5416
					$result["content"][]=$info;
-
 
5417
					
-
 
5418
					#換下解析下筆RR
-
 
5419
					continue 2;
-
 
5420
				
-
 
5421
					}#if end
-
 
5422
				
-
 
5423
				#執行到這邊代表不是 SOA
-
 
5424
				
-
 
5425
				#尋找是否有(...)...的內容存在
-
 
5426
				#函式說明:
-
 
5427
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5428
				#回傳結果:
-
 
5429
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5430
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5431
				#$result["function"],當前執行的函式名稱.
-
 
5432
				#$result["argu"],所使用的參數.
-
 
5433
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5434
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5435
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5436
				#必填參數:
-
 
5437
				#$conf["input"],字串,要檢查的字串.
-
 
5438
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5439
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5440
				$conf["search::findSpecifyStrFormat"]["format"]="(\${value};\${comment}";
-
 
5441
				#可省略參數:
-
 
5442
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5443
				#$conf["varEqual"]=array(null,"found");
-
 
5444
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5445
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
5446
				#參考資料:
-
 
5447
				#無.
-
 
5448
				#備註:
-
 
5449
				#無.
-
 
5450
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5451
				unset($conf["search::findSpecifyStrFormat"]);
-
 
5452
			
-
 
5453
				#如果執行異常
-
 
5454
				if($findSpecifyStrFormat["status"]==="false"){
-
 
5455
				
-
 
5456
					#設置錯誤識別
-
 
5457
					$result["status"]="false";
-
 
5458
 
-
 
5459
					#設置錯誤訊息
-
 
5460
					$result["error"]=$findSpecifyStrFormat;
-
 
5461
 
-
 
5462
					#回傳結果
-
 
5463
					return $result;
-
 
5464
				
-
 
5465
					}#if end
-
 
5466
					
-
 
5467
				#如果有 有符合 ($value);${comment} 的格式
-
 
5468
				if($findSpecifyStrFormat["found"]==="true"){
-
 
5469
				
-
 
5470
					#儲存value
-
 
5471
					$info["value"]="(".$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5472
				
-
 
5473
					#儲存comment
-
 
5474
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
5475
				
-
 
5476
					#儲存 RR 的記錄
-
 
5477
					$result["content"][]=$info;
-
 
5478
					
-
 
5479
					#跳到下一筆要解析的RR
-
 
5480
					continue 2;
-
 
5481
				
-
 
5482
					}#if end
-
 
5483
				
-
 
5484
				#執行到這邊代表沒有 (...)... 的內容存在
-
 
5485
				
-
 
5486
				#尋找是否有 (...) 的內容存在
-
 
5487
				#函式說明:
-
 
5488
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5489
				#回傳結果:
-
 
5490
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5491
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5492
				#$result["function"],當前執行的函式名稱.
-
 
5493
				#$result["argu"],所使用的參數.
-
 
5494
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5495
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5496
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5497
				#必填參數:
-
 
5498
				#$conf["input"],字串,要檢查的字串.
-
 
5499
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5500
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5501
				$conf["search::findSpecifyStrFormat"]["format"]="(\${value})";
-
 
5502
				#可省略參數:
-
 
5503
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5504
				#$conf["varEqual"]=array(null,"found");
-
 
5505
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5506
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
5507
				#參考資料:
-
 
5508
				#無.
-
 
5509
				#備註:
-
 
5510
				#無.
-
 
5511
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5512
				unset($conf["search::findSpecifyStrFormat"]);
-
 
5513
			
-
 
5514
				#如果執行異常
-
 
5515
				if($findSpecifyStrFormat["status"]==="false"){
-
 
5516
				
-
 
5517
					#設置錯誤識別
-
 
5518
					$result["status"]="false";
-
 
5519
 
-
 
5520
					#設置錯誤訊息
-
 
5521
					$result["error"]=$findSpecifyStrFormat;
-
 
5522
 
-
 
5523
					#回傳結果
-
 
5524
					return $result;
-
 
5525
				
-
 
5526
					}#if end
-
 
5527
					
-
 
5528
				#如果有 有符合 ($value);${comment} 的格式
-
 
5529
				if($findSpecifyStrFormat["found"]==="true"){
-
 
5530
				
-
 
5531
					#儲存value
-
 
5532
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5533
				
-
 
5534
					#儲存 RR 的記錄
-
 
5535
					$result["content"][]=$info;
-
 
5536
					
-
 
5537
					#跳到下一筆要解析的RR
-
 
5538
					continue 2;
-
 
5539
				
-
 
5540
					}#if end
-
 
5541
					
-
 
5542
				#執行到這邊代表沒有 (...) 的內容存在
-
 
5543
				
-
 
5544
				#尋找有無 "...";... 的內容存在
-
 
5545
				#函式說明:
-
 
5546
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5547
				#回傳結果:
-
 
5548
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5549
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5550
				#$result["function"],當前執行的函式名稱.
-
 
5551
				#$result["argu"],所使用的參數.
-
 
5552
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5553
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5554
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5555
				#必填參數:
-
 
5556
				#$conf["input"],字串,要檢查的字串.
-
 
5557
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5558
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5559
				$conf["search::findSpecifyStrFormat"]["format"]="\"\${value};\${comment}";
-
 
5560
				#可省略參數:
-
 
5561
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5562
				#$conf["varEqual"]=array(null,"found");
-
 
5563
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5564
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
5565
				#參考資料:
-
 
5566
				#無.
-
 
5567
				#備註:
-
 
5568
				#無.
-
 
5569
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5570
				unset($conf["search::findSpecifyStrFormat"]);
-
 
5571
			
-
 
5572
				#如果執行異常
-
 
5573
				if($findSpecifyStrFormat["status"]==="false"){
-
 
5574
				
-
 
5575
					#設置錯誤識別
-
 
5576
					$result["status"]="false";
-
 
5577
 
-
 
5578
					#設置錯誤訊息
-
 
5579
					$result["error"]=$findSpecifyStrFormat;
-
 
5580
 
-
 
5581
					#回傳結果
-
 
5582
					return $result;
-
 
5583
				
-
 
5584
					}#if end
-
 
5585
					
-
 
5586
				#如果有 有符合 "$value";${comment} 的格式
-
 
5587
				if($findSpecifyStrFormat["found"]==="true"){
-
 
5588
				
-
 
5589
					#儲存value
-
 
5590
					$info["value"]="\"".$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5591
					
-
 
5592
					#儲存comment
-
 
5593
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
5594
				
-
 
5595
					#儲存 RR 的記錄
-
 
5596
					$result["content"][]=$info;
-
 
5597
					
-
 
5598
					#跳到下一筆要解析的RR
-
 
5599
					continue 2;
-
 
5600
				
-
 
5601
					}#if end
-
 
5602
					
-
 
5603
				#執行到這邊代表沒有 "$value";${comment} 的格式
-
 
5604
				
-
 
5605
				#尋找有無 "..." 的內容存在
-
 
5606
				#函式說明:
-
 
5607
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5608
				#回傳結果:
-
 
5609
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5610
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5611
				#$result["function"],當前執行的函式名稱.
-
 
5612
				#$result["argu"],所使用的參數.
-
 
5613
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5614
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5615
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5616
				#必填參數:
-
 
5617
				#$conf["input"],字串,要檢查的字串.
-
 
5618
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5619
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5620
				$conf["search::findSpecifyStrFormat"]["format"]="\"\${value}\"";
-
 
5621
				#可省略參數:
-
 
5622
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5623
				#$conf["varEqual"]=array(null,"found");
-
 
5624
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5625
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
5626
				#參考資料:
-
 
5627
				#無.
-
 
5628
				#備註:
-
 
5629
				#無.
-
 
5630
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5631
				unset($conf["search::findSpecifyStrFormat"]);
-
 
5632
			
-
 
5633
				#如果執行異常
-
 
5634
				if($findSpecifyStrFormat["status"]==="false"){
-
 
5635
				
-
 
5636
					#設置錯誤識別
-
 
5637
					$result["status"]="false";
-
 
5638
 
-
 
5639
					#設置錯誤訊息
-
 
5640
					$result["error"]=$findSpecifyStrFormat;
-
 
5641
 
-
 
5642
					#回傳結果
-
 
5643
					return $result;
-
 
5644
				
-
 
5645
					}#if end
-
 
5646
					
-
 
5647
				#如果有 有符合 "$value" 的格式
-
 
5648
				if($findSpecifyStrFormat["found"]==="true"){
-
 
5649
				
-
 
5650
					#儲存value
-
 
5651
					$info["value"]="\"".$findSpecifyStrFormat["parsedVar"]["value"][0]."\"";
-
 
5652
					
-
 
5653
					#儲存 RR 的記錄
-
 
5654
					$result["content"][]=$info;
-
 
5655
					
-
 
5656
					#跳到下一筆要解析的RR
-
 
5657
					continue 2;
-
 
5658
				
-
 
5659
					}#if end
-
 
5660
					
-
 
5661
				#執行到這邊代表沒有 "$value" 格式的內容
-
 
5662
				
-
 
5663
				#檢查是否有 $value;$comment 格式的內容
-
 
5664
				#函式說明:
-
 
5665
				#尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
-
 
5666
				#回傳結果:
-
 
5667
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
-
 
5668
				#$reuslt["error"],執行不正常結束的錯訊息陣列.
-
 
5669
				#$result["function"],當前執行的函式名稱.
-
 
5670
				#$result["argu"],所使用的參數.
-
 
5671
				#$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
-
 
5672
				#$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
-
 
5673
				#$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
-
 
5674
				#必填參數:
-
 
5675
				#$conf["input"],字串,要檢查的字串.
-
 
5676
				$conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
-
 
5677
				#$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
-
 
5678
				$conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
-
 
5679
				#可省略參數:
-
 
5680
				#$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
-
 
5681
				#$conf["varEqual"]=array(null,"found");
-
 
5682
				#$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
-
 
5683
				#$conf["varCon"]=array("no_tail"=>" not");
-
 
5684
				#參考資料:
-
 
5685
				#無.
-
 
5686
				#備註:
-
 
5687
				#無.
-
 
5688
				$findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
-
 
5689
				unset($conf["search::findSpecifyStrFormat"]);
-
 
5690
			
-
 
5691
				#如果執行異常
-
 
5692
				if($findSpecifyStrFormat["status"]==="false"){
-
 
5693
				
-
 
5694
					#設置錯誤識別
-
 
5695
					$result["status"]="false";
-
 
5696
 
-
 
5697
					#設置錯誤訊息
-
 
5698
					$result["error"]=$findSpecifyStrFormat;
-
 
5699
 
-
 
5700
					#回傳結果
-
 
5701
					return $result;
-
 
5702
				
-
 
5703
					}#if end
-
 
5704
					
-
 
5705
				#如果有 有符合 "$value" 的格式
-
 
5706
				if($findSpecifyStrFormat["found"]==="true"){
-
 
5707
				
-
 
5708
					#儲存value
-
 
5709
					$info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
-
 
5710
					
-
 
5711
					#儲存comment
-
 
5712
					$info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
-
 
5713
					
-
 
5714
					#儲存 RR 的記錄
-
 
5715
					$result["content"][]=$info;
-
 
5716
					
-
 
5717
					#跳到下一筆要解析的RR
-
 
5718
					continue 2;
-
 
5719
				
-
 
5720
					}#if end
-
 
5721
			
-
 
5722
				#執行到這邊代表沒有 ${value};${comment} 格式的內容
-
 
5723
				
-
 
5724
				#亦即剩下的內容都是 value
-
 
5725
				
-
 
5726
				#儲存value
-
 
5727
				$info["value"]=$unFormatStr;
-
 
5728
				
-
 
5729
				#儲存 RR 的記錄
-
 
5730
				$result["content"][]=$info;
-
 
5731
				
-
 
5732
				#跳到下一筆要解析的RR
-
 
5733
				continue 2;
-
 
5734
				
-
 
5735
				}#while end
-
 
5736
			
4001
			
5737
			}#foreach end
4002
			}#foreach end
5738
			
4003
			
5739
		#如果要啟用多執行序
4004
		#如果要啟用多執行序
5740
		if($conf["multiThreads"]==="true"){
4005
		if($conf["multiThreads"]==="true"){
Line 5938... Line 4203...
5938
						
4203
						
5939
					#如果有 defaultTTL 存在
4204
					#如果有 defaultTTL 存在
5940
					if(isset($jsonRes->defaultTTL)){
4205
					if(isset($jsonRes->defaultTTL)){
5941
					
4206
					
5942
						#儲存domain
4207
						#儲存domain
5943
						$result["domain"]=$jsonRes->defaultTTL;
4208
						$result["defaultTTL"]=$jsonRes->defaultTTL;
5944
					
4209
					
5945
						}#if end
4210
						}#if end
5946
						
4211
						
5947
					#如果有 comment 存在
4212
					#如果有 comment 存在
5948
					if(isset($jsonRes->comment)){
4213
					if(isset($jsonRes->comment)){
Line 6144... Line 4409...
6144
				#回傳結果
4409
				#回傳結果
6145
				return $result;
4410
				return $result;
6146
			
4411
			
6147
				}#if end
4412
				}#if end
6148
				
4413
				
6149
			#如果 query 結尾不是"@"也不為"."結尾
4414
			#如果 query 不是"@"也不為"."結尾
6150
			if( ($newRR["query"]!=="@") && ($newRR["query"][strlen($newRR["query"])-1]!==".") ){
4415
			if( ($newRR["query"]!=="@") && ($newRR["query"][strlen($newRR["query"])-1]!==".") ){
6151
			
4416
			
6152
				#加上 "."
4417
				#加上 "."
6153
				$conf["add"][$nri]["query"]=$newRR["query"]=$newRR["query"].".";
4418
				$conf["add"][$nri]["query"]=$newRR["query"]=$newRR["query"].".";
6154
			
4419
			
Line 6445... Line 4710...
6445
					
4710
					
6446
					}#if end
4711
					}#if end
6447
			
4712
			
6448
				}#if end
4713
				}#if end
6449
			
4714
			
-
 
4715
			/* 看起來怪怪的
-
 
4716
			
6450
			#如果新 RR 的 type 不是 A 且 value 不為 "." 結尾.
4717
			#如果新 RR 的 type 不是 A 且 value 不為 "." 結尾.
6451
			if( $newRR["type"]!=="A" && $newRR["value"][strlen($newRR["value"])-1]!=="." ){
4718
			if( $newRR["type"]!=="A" && $newRR["value"][strlen($newRR["value"])-1]!=="." ){
6452
			
4719
			
6453
				#new RR add dot to value end.
4720
				#new RR add dot to value end.
6454
				$conf["add"][$nri]["value"]=$newRR["value"]=$newRR["value"].".";
4721
				$conf["add"][$nri]["value"]=$newRR["value"]=$newRR["value"].".";
Line 6512... Line 4779...
6512
					
4779
					
6513
					}#if end
4780
					}#if end
6514
			
4781
			
6515
				}#if end
4782
				}#if end
6516
			
4783
			
-
 
4784
			*/
-
 
4785
			
6517
			#針對 zone file 中既有的每個RR記錄
4786
			#針對 zone file 中既有的每個RR記錄
6518
			foreach($result["content"] as $index => $oldRR){
4787
			foreach($result["content"] as $index => $oldRR){
6519
			
4788
			
6520
				#如果既有的跟新的RR都為 $ORIGIN
4789
				#如果既有的跟新的RR都為 $ORIGIN
6521
				if($oldRR["type"]==="\$ORIGIN" && $newRR["type"]==="\$ORIGIN"){
4790
				if($oldRR["type"]==="\$ORIGIN" && $newRR["type"]==="\$ORIGIN"){
Line 6591... Line 4860...
6591
						
4860
						
6592
							}#else end
4861
							}#else end
6593
					
4862
					
6594
						}#if end
4863
						}#if end
6595
					
4864
					
6596
					#反之如果跟既有的 query、type有相同,且type 為 "CNAME"
4865
					#反之如果跟既有的 query、type有相同,且type 為 "CNAME" 或 "CAA"
6597
					else if($newRR["query"]===$oldRR["query"] && $newRR["type"]===$oldRR["type"] && $newRR["type"]==="CNAME"){
4866
					else if($newRR["query"]===$oldRR["query"] && $newRR["type"]===$oldRR["type"] && ( $newRR["type"]==="CNAME" || $newRR["type"]==="CAA" ) ){
6598
					
4867
					
6599
						#更新既有 RR 的 value
4868
						#更新既有 RR 的 value
6600
						$result["content"][$index]["value"]=$newRR["value"];
4869
						$result["content"][$index]["value"]=$newRR["value"];
6601
						
4870
						
6602
						#換看下一筆newRR
4871
						#換看下一筆newRR