Code Duplication    Length = 13-13 lines in 2 locations

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

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