Code Duplication    Length = 13-13 lines in 2 locations

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

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