Skip to content

Commit 0cb22dd

Browse files
committed
Added tags config on client side
1 parent d7d2264 commit 0cb22dd

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

lib/net/authorize/util/ANetSensitiveFields.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,24 @@ private static function getDefaulSensitiveXmlTags(){
2020
public static function getSensitiveXmlTags(){
2121
$sensitiveTags = array();
2222
$configFilePath = dirname(__FILE__) . "/" . ANET_SENSITIVE_XMLTAGS_JSON_FILE;
23-
if (file_exists($configFilePath)) {
23+
$userConfigFilePath = ANET_SENSITIVE_XMLTAGS_JSON_FILE;
24+
if (file_exists($userConfigFilePath)) { //client config for tags
2425
//read list of tags(and associate regex-patterns and replacements) from .json file
2526
$sensitiveTags = json_decode(file_get_contents($configFilePath));
26-
if (json_last_error() === JSON_ERROR_NONE) {
27-
// JSON is valid
27+
if (json_last_error() === JSON_ERROR_NONE) {// JSON is valid
2828
}
2929
else{
30-
echo "ERROR: Invalid json in: " . $configFilePath . " json_last_error_msg : " . json_last_error_msg();
30+
echo "ERROR: Invalid json in: " . $userConfigFilePath . " json_last_error_msg : " . json_last_error_msg();
3131
return self::getDefaulSensitiveXmlTags();
3232
}
3333
}
34-
else {
35-
// if not present, create a local config file
36-
$sensitiveTags = self::getDefaulSensitiveXmlTags();
37-
file_put_contents($configFilePath, json_encode($sensitiveTags, JSON_PRETTY_PRINT));
34+
else if (file_exists($configFilePath)) { //default sdk config for tags
35+
$sensitiveTags = json_decode(file_get_contents($configFilePath));
36+
if (json_last_error() === JSON_ERROR_NONE) {
37+
}
38+
else{
39+
exit("ERROR: Invalid json in: " . $configFilePath . " json_last_error_msg : " . json_last_error_msg());
40+
}
3841
}
3942
//Check for disableMask flag in case of client json.
4043
$applySensitiveTags = array();

0 commit comments

Comments
 (0)