Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5196-5208 (lines=13) @@
5193
        $value = Database::escape_string($value);
5194
        $sql = "UPDATE $t_s SET selected_value = '$value'
5195
                WHERE category = '$category' AND access_url = $access_url";
5196
        if (is_array($fieldtype) && count($fieldtype)>0) {
5197
            $sql .= " AND ( ";
5198
            $i = 0;
5199
            foreach ($fieldtype as $type){
5200
                if ($i > 0) {
5201
                    $sql .= ' OR ';
5202
                }
5203
                $type = Database::escape_string($type);
5204
                $sql .= " type='".$type."' ";
5205
                $i++;
5206
            }
5207
            $sql .= ")";
5208
        }
5209
        $res = Database::query($sql);
5210
        return $res !== false;
5211
    } else {
@@ 5214-5226 (lines=13) @@
5211
    } else {
5212
        $sql = "UPDATE $t_s SET selected_value = NULL
5213
                WHERE category = '$category' AND access_url = $access_url";
5214
        if (is_array($fieldtype) && count($fieldtype)>0) {
5215
            $sql .= " AND ( ";
5216
            $i = 0;
5217
            foreach ($fieldtype as $type){
5218
                if ($i > 0) {
5219
                    $sql .= ' OR ';
5220
                }
5221
                $type = Database::escape_string($type);
5222
                $sql .= " type='".$type."' ";
5223
                $i++;
5224
            }
5225
            $sql .= ")";
5226
        }
5227
        $res = Database::query($sql);
5228
        return $res !== false;
5229
    }