Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5187-5199 (lines=13) @@
5184
        $value = Database::escape_string($value);
5185
        $sql = "UPDATE $t_s SET selected_value = '$value'
5186
                WHERE category = '$category' AND access_url = $access_url";
5187
        if (is_array($fieldtype) && count($fieldtype)>0) {
5188
            $sql .= " AND ( ";
5189
            $i = 0;
5190
            foreach ($fieldtype as $type){
5191
                if ($i > 0) {
5192
                    $sql .= ' OR ';
5193
                }
5194
                $type = Database::escape_string($type);
5195
                $sql .= " type='".$type."' ";
5196
                $i++;
5197
            }
5198
            $sql .= ")";
5199
        }
5200
        $res = Database::query($sql);
5201
        return $res !== false;
5202
    } else {
@@ 5205-5217 (lines=13) @@
5202
    } else {
5203
        $sql = "UPDATE $t_s SET selected_value = NULL
5204
                WHERE category = '$category' AND access_url = $access_url";
5205
        if (is_array($fieldtype) && count($fieldtype)>0) {
5206
            $sql .= " AND ( ";
5207
            $i = 0;
5208
            foreach ($fieldtype as $type){
5209
                if ($i > 0) {
5210
                    $sql .= ' OR ';
5211
                }
5212
                $type = Database::escape_string($type);
5213
                $sql .= " type='".$type."' ";
5214
                $i++;
5215
            }
5216
            $sql .= ")";
5217
        }
5218
        $res = Database::query($sql);
5219
        return $res !== false;
5220
    }