Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5218-5230 (lines=13) @@
5215
        $value = Database::escape_string($value);
5216
        $sql = "UPDATE $t_s SET selected_value = '$value'
5217
                WHERE category = '$category' AND access_url = $access_url";
5218
        if (is_array($fieldtype) && count($fieldtype)>0) {
5219
            $sql .= " AND ( ";
5220
            $i = 0;
5221
            foreach ($fieldtype as $type){
5222
                if ($i > 0) {
5223
                    $sql .= ' OR ';
5224
                }
5225
                $type = Database::escape_string($type);
5226
                $sql .= " type='".$type."' ";
5227
                $i++;
5228
            }
5229
            $sql .= ")";
5230
        }
5231
        $res = Database::query($sql);
5232
        return $res !== false;
5233
    } else {
@@ 5236-5248 (lines=13) @@
5233
    } else {
5234
        $sql = "UPDATE $t_s SET selected_value = NULL
5235
                WHERE category = '$category' AND access_url = $access_url";
5236
        if (is_array($fieldtype) && count($fieldtype)>0) {
5237
            $sql .= " AND ( ";
5238
            $i = 0;
5239
            foreach ($fieldtype as $type){
5240
                if ($i > 0) {
5241
                    $sql .= ' OR ';
5242
                }
5243
                $type = Database::escape_string($type);
5244
                $sql .= " type='".$type."' ";
5245
                $i++;
5246
            }
5247
            $sql .= ")";
5248
        }
5249
        $res = Database::query($sql);
5250
        return $res !== false;
5251
    }