Code Duplication    Length = 13-13 lines in 2 locations

main/inc/lib/api.lib.php 2 locations

@@ 5052-5064 (lines=13) @@
5049
        $value = Database::escape_string($value);
5050
        $sql = "UPDATE $t_s SET selected_value = '$value'
5051
                WHERE category = '$category' AND access_url = $access_url";
5052
        if (is_array($fieldtype) && count($fieldtype)>0) {
5053
            $sql .= " AND ( ";
5054
            $i = 0;
5055
            foreach ($fieldtype as $type){
5056
                if ($i > 0) {
5057
                    $sql .= ' OR ';
5058
                }
5059
                $type = Database::escape_string($type);
5060
                $sql .= " type='".$type."' ";
5061
                $i++;
5062
            }
5063
            $sql .= ")";
5064
        }
5065
        $res = Database::query($sql);
5066
        return $res !== false;
5067
    } else {
@@ 5070-5082 (lines=13) @@
5067
    } else {
5068
        $sql = "UPDATE $t_s SET selected_value = NULL
5069
                WHERE category = '$category' AND access_url = $access_url";
5070
        if (is_array($fieldtype) && count($fieldtype)>0) {
5071
            $sql .= " AND ( ";
5072
            $i = 0;
5073
            foreach ($fieldtype as $type){
5074
                if ($i > 0) {
5075
                    $sql .= ' OR ';
5076
                }
5077
                $type = Database::escape_string($type);
5078
                $sql .= " type='".$type."' ";
5079
                $i++;
5080
            }
5081
            $sql .= ")";
5082
        }
5083
        $res = Database::query($sql);
5084
        return $res !== false;
5085
    }