@@ -1061,24 +1061,16 @@ private function showLog() {
1061
1061
1062
1062
protected function writeLog ($ text ,$ action ) {
1063
1063
if ($ this ->logging ) {
1064
- // Hiding userid in the logging
1065
- if (($ start = strpos ($ text ,'<clID> ' )) !== false ) {
1066
- if (($ end = strpos ($ text ,'</clID> ' )) !== false ) {
1067
- $ text = substr ($ text ,0 ,$ start +6 ).'XXXXXXXXXXXXXXXX ' .substr ($ text ,$ end ,99999 );
1068
- }
1069
- }
1070
- // Hiding password in the logging
1071
- if (($ start = strpos ($ text ,'<pw><![CDATA[ ' )) !== false ) {
1072
- if (($ end = strpos ($ text ,']]></pw> ' )) !== false ) {
1073
- $ text = substr ($ text ,0 ,$ start +4 ).'XXXXXXXXXXXXXXXX ' .substr ($ text ,$ end +3 ,99999 );
1074
- }
1075
- }
1076
- // Hiding password in the logging
1077
- if (($ start = strpos ($ text ,'<pw> ' )) !== false ) {
1078
- if (($ end = strpos ($ text ,'</pw> ' )) !== false ) {
1079
- $ text = substr ($ text ,0 ,$ start +4 ).'XXXXXXXXXXXXXXXX ' .substr ($ text ,$ end ,99999 );
1080
- }
1081
- }
1064
+ // Hide userid in the logging
1065
+ $ text = $ this ->hideTextBetween ($ text ,'<clID> ' ,'</clID> ' );
1066
+ // Hide password in the logging
1067
+ $ text = $ this ->hideTextBetween ($ text ,'<pw> ' ,'</pw> ' );
1068
+ // Hide password in the logging
1069
+ $ text = $ this ->hideTextBetween ($ text ,'<pw><![CDATA[ ' ,']]></pw> ' );
1070
+ // Hide new password in the logging
1071
+ $ text = $ this ->hideTextBetween ($ text ,'<newPW> ' ,'</newPW> ' );
1072
+ // Hide new password in the logging
1073
+ $ text = $ this ->hideTextBetween ($ text ,'<newPW><![CDATA[ ' ,']]></newPW> ' );
1082
1074
//echo "-----".date("Y-m-d H:i:s")."-----".$text."-----end-----\n";
1083
1075
$ log = "----- " . $ action . "----- " . date ("Y-m-d H:i:s " ) . "----- \n" . $ text . "\n-----END----- " . date ("Y-m-d H:i:s " ) . "----- \n" ;
1084
1076
$ this ->logentries [] = $ log ;
@@ -1088,6 +1080,21 @@ protected function writeLog($text,$action) {
1088
1080
}
1089
1081
}
1090
1082
1083
+ /**
1084
+ * @param $text
1085
+ * @param $start
1086
+ * @param $end
1087
+ * @return string
1088
+ */
1089
+ protected function hideTextBetween ($ text , $ start , $ end ) {
1090
+ if (($ startpos = strpos (strtolower ($ text ),strtolower ($ start ))) !== false ) {
1091
+ if (($ endpos = strpos (strtolower ($ text ),strtolower ($ end ))) !== false ) {
1092
+ $ text = substr ($ text ,0 ,$ startpos +strlen ($ start )).'XXXXXXXXXXXXXXXX ' .substr ($ text ,$ endpos ,99999 );
1093
+ }
1094
+ }
1095
+ return $ text ;
1096
+ }
1097
+
1091
1098
/**
1092
1099
* @param null|string $connectionComment
1093
1100
* @return eppConnection
0 commit comments