Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5312-5324 (lines=13) @@
5309
        $value = Database::escape_string($value);
5310
        $sql = "UPDATE $t_s SET selected_value = '$value'
5311
                WHERE category = '$category' AND access_url = $access_url";
5312
        if (is_array($fieldtype) && count($fieldtype)>0) {
5313
            $sql .= " AND ( ";
5314
            $i = 0;
5315
            foreach ($fieldtype as $type){
5316
                if ($i > 0) {
5317
                    $sql .= ' OR ';
5318
                }
5319
                $type = Database::escape_string($type);
5320
                $sql .= " type='".$type."' ";
5321
                $i++;
5322
            }
5323
            $sql .= ")";
5324
        }
5325
        $res = Database::query($sql);
5326
        return $res !== false;
5327
    } else {
@@ 5330-5342 (lines=13) @@
5327
    } else {
5328
        $sql = "UPDATE $t_s SET selected_value = NULL
5329
                WHERE category = '$category' AND access_url = $access_url";
5330
        if (is_array($fieldtype) && count($fieldtype)>0) {
5331
            $sql .= " AND ( ";
5332
            $i = 0;
5333
            foreach ($fieldtype as $type){
5334
                if ($i > 0) {
5335
                    $sql .= ' OR ';
5336
                }
5337
                $type = Database::escape_string($type);
5338
                $sql .= " type='".$type."' ";
5339
                $i++;
5340
            }
5341
            $sql .= ")";
5342
        }
5343
        $res = Database::query($sql);
5344
        return $res !== false;
5345
    }