Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5123-5135 (lines=13) @@
5120
        $value = Database::escape_string($value);
5121
        $sql = "UPDATE $t_s SET selected_value = '$value'
5122
                WHERE category = '$category' AND access_url = $access_url";
5123
        if (is_array($fieldtype) && count($fieldtype)>0) {
5124
            $sql .= " AND ( ";
5125
            $i = 0;
5126
            foreach ($fieldtype as $type){
5127
                if ($i > 0) {
5128
                    $sql .= ' OR ';
5129
                }
5130
                $type = Database::escape_string($type);
5131
                $sql .= " type='".$type."' ";
5132
                $i++;
5133
            }
5134
            $sql .= ")";
5135
        }
5136
        $res = Database::query($sql);
5137
        return $res !== false;
5138
    } else {
@@ 5141-5153 (lines=13) @@
5138
    } else {
5139
        $sql = "UPDATE $t_s SET selected_value = NULL
5140
                WHERE category = '$category' AND access_url = $access_url";
5141
        if (is_array($fieldtype) && count($fieldtype)>0) {
5142
            $sql .= " AND ( ";
5143
            $i = 0;
5144
            foreach ($fieldtype as $type){
5145
                if ($i > 0) {
5146
                    $sql .= ' OR ';
5147
                }
5148
                $type = Database::escape_string($type);
5149
                $sql .= " type='".$type."' ";
5150
                $i++;
5151
            }
5152
            $sql .= ")";
5153
        }
5154
        $res = Database::query($sql);
5155
        return $res !== false;
5156
    }