Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5298-5310 (lines=13) @@
5295
        $value = Database::escape_string($value);
5296
        $sql = "UPDATE $t_s SET selected_value = '$value'
5297
                WHERE category = '$category' AND access_url = $access_url";
5298
        if (is_array($fieldtype) && count($fieldtype)>0) {
5299
            $sql .= " AND ( ";
5300
            $i = 0;
5301
            foreach ($fieldtype as $type){
5302
                if ($i > 0) {
5303
                    $sql .= ' OR ';
5304
                }
5305
                $type = Database::escape_string($type);
5306
                $sql .= " type='".$type."' ";
5307
                $i++;
5308
            }
5309
            $sql .= ")";
5310
        }
5311
        $res = Database::query($sql);
5312
        return $res !== false;
5313
    } else {
@@ 5316-5328 (lines=13) @@
5313
    } else {
5314
        $sql = "UPDATE $t_s SET selected_value = NULL
5315
                WHERE category = '$category' AND access_url = $access_url";
5316
        if (is_array($fieldtype) && count($fieldtype)>0) {
5317
            $sql .= " AND ( ";
5318
            $i = 0;
5319
            foreach ($fieldtype as $type){
5320
                if ($i > 0) {
5321
                    $sql .= ' OR ';
5322
                }
5323
                $type = Database::escape_string($type);
5324
                $sql .= " type='".$type."' ";
5325
                $i++;
5326
            }
5327
            $sql .= ")";
5328
        }
5329
        $res = Database::query($sql);
5330
        return $res !== false;
5331
    }