Code Duplication    Length = 13-13 lines in 2 locations

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

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