Code Duplication    Length = 13-13 lines in 2 locations

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

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