Code Duplication    Length = 13-13 lines in 2 locations

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

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