Code Duplication    Length = 12-15 lines in 3 locations

core/Federation.php 1 location

@@ 387-401 (lines=15) @@
384
385
        $optioninstance = Options::instance();
386
387
        while ($queryResult = mysqli_fetch_object($fedAttributes)) {
388
            $lang = "";
389
            // decode base64 for files (respecting multi-lang)
390
            $optinfo = $optioninstance->optionType($queryResult->option_name);
391
            $flag = $optinfo['flag'];
392
393
            if ($optinfo['type'] != "file") {
394
                $this->attributes[] = array("name" => $queryResult->option_name, "value" => $queryResult->option_value, "level" => "FED", "row" => $queryResult->row, "flag" => $flag);
395
            } else {
396
                
397
                $decodedAttribute = $this->decodeFileAttribute($queryResult->option_value);
398
399
                $this->attributes[] = array("name" => $queryResult->option_name, "value" => ($decodedAttribute['lang'] == "" ? $decodedAttribute['content'] : serialize($decodedAttribute)), "level" => "FED", "row" => $queryResult->row, "flag" => $flag);
400
            }
401
        }
402
        $this->attributes[] = array("name" => "internal:country",
403
            "value" => $this->name,
404
            "level" => "FED",

core/IdP.php 1 location

@@ 87-99 (lines=13) @@
84
        $IdPAttributes = DBConnection::exec($this->databaseType, "SELECT DISTINCT option_name,option_value, row FROM institution_option
85
              WHERE institution_id = $this->identifier  ORDER BY option_name");
86
87
        while ($attributeQuery = mysqli_fetch_object($IdPAttributes)) {
88
            // decode base64 for files (respecting multi-lang)
89
            $optinfo = $optioninstance->optionType($attributeQuery->option_name);
90
            $flag = $optinfo['flag'];
91
92
            if ($optinfo['type'] != "file") {
93
                $this->attributes[] = ["name" => $attributeQuery->option_name, "value" => $attributeQuery->option_value, "level" => "IdP", "row" => $attributeQuery->row, "flag" => $flag];
94
            } else {
95
                $decodedAttribute = $this->decodeFileAttribute($attributeQuery->option_value);
96
97
                $this->attributes[] = ["name" => $attributeQuery->option_name, "value" => ($decodedAttribute['lang'] == "" ? $decodedAttribute['content'] : serialize($decodedAttribute)), "level" => "IdP", "row" => $attributeQuery->row, "flag" => $flag];
98
            }
99
        }
100
        $this->attributes[] = ["name" => "internal:country",
101
            "value" => $this->federation,
102
            "level" => "IdP",

core/User.php 1 location

@@ 71-82 (lines=12) @@
68
            }
69
        } else {
70
            $user_options = DBConnection::exec($this->databaseType, "SELECT option_name, option_value, id AS row FROM user_options WHERE user_id = '$user_id'");
71
            while ($a = mysqli_fetch_object($user_options)) {
72
// decode base64 for files (respecting multi-lang)
73
                $optinfo = $optioninstance->optionType($a->option_name);
74
                $flag = $optinfo['flag'];
75
76
                if ($optinfo['type'] != "file") {
77
                    $this->attributes[] = ["name" => $a->option_name, "value" => $a->option_value, "level" => "User", "row" => $a->row, "flag" => $flag];
78
                } else {
79
                    $decodedAttribute = $this->decodeFileAttribute($a->option_value);
80
                    $this->attributes[] = ["name" => $a->option_name, "value" => ($decodedAttribute['lang'] == "" ? $decodedAttribute['content'] : serialize($decodedAttribute)), "level" => "User", "row" => $a->row, "flag" => $flag];
81
                }
82
            }
83
        }
84
    }
85