Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5070-5082 (lines=13) @@
5067
        $value = Database::escape_string($value);
5068
        $sql = "UPDATE $t_s SET selected_value = '$value'
5069
                WHERE category = '$category' AND access_url = $access_url";
5070
        if (is_array($fieldtype) && count($fieldtype)>0) {
5071
            $sql .= " AND ( ";
5072
            $i = 0;
5073
            foreach ($fieldtype as $type){
5074
                if ($i > 0) {
5075
                    $sql .= ' OR ';
5076
                }
5077
                $type = Database::escape_string($type);
5078
                $sql .= " type='".$type."' ";
5079
                $i++;
5080
            }
5081
            $sql .= ")";
5082
        }
5083
        $res = Database::query($sql);
5084
        return $res !== false;
5085
    } else {
@@ 5088-5100 (lines=13) @@
5085
    } else {
5086
        $sql = "UPDATE $t_s SET selected_value = NULL
5087
                WHERE category = '$category' AND access_url = $access_url";
5088
        if (is_array($fieldtype) && count($fieldtype)>0) {
5089
            $sql .= " AND ( ";
5090
            $i = 0;
5091
            foreach ($fieldtype as $type){
5092
                if ($i > 0) {
5093
                    $sql .= ' OR ';
5094
                }
5095
                $type = Database::escape_string($type);
5096
                $sql .= " type='".$type."' ";
5097
                $i++;
5098
            }
5099
            $sql .= ")";
5100
        }
5101
        $res = Database::query($sql);
5102
        return $res !== false;
5103
    }