Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5084-5096 (lines=13) @@
5081
        $value = Database::escape_string($value);
5082
        $sql = "UPDATE $t_s SET selected_value = '$value'
5083
                WHERE category = '$category' AND access_url = $access_url";
5084
        if (is_array($fieldtype) && count($fieldtype)>0) {
5085
            $sql .= " AND ( ";
5086
            $i = 0;
5087
            foreach ($fieldtype as $type){
5088
                if ($i > 0) {
5089
                    $sql .= ' OR ';
5090
                }
5091
                $type = Database::escape_string($type);
5092
                $sql .= " type='".$type."' ";
5093
                $i++;
5094
            }
5095
            $sql .= ")";
5096
        }
5097
        $res = Database::query($sql);
5098
        return $res !== false;
5099
    } else {
@@ 5102-5114 (lines=13) @@
5099
    } else {
5100
        $sql = "UPDATE $t_s SET selected_value = NULL
5101
                WHERE category = '$category' AND access_url = $access_url";
5102
        if (is_array($fieldtype) && count($fieldtype)>0) {
5103
            $sql .= " AND ( ";
5104
            $i = 0;
5105
            foreach ($fieldtype as $type){
5106
                if ($i > 0) {
5107
                    $sql .= ' OR ';
5108
                }
5109
                $type = Database::escape_string($type);
5110
                $sql .= " type='".$type."' ";
5111
                $i++;
5112
            }
5113
            $sql .= ")";
5114
        }
5115
        $res = Database::query($sql);
5116
        return $res !== false;
5117
    }