Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5110-5122 (lines=13) @@
5107
        $value = Database::escape_string($value);
5108
        $sql = "UPDATE $t_s SET selected_value = '$value'
5109
                WHERE category = '$category' AND access_url = $access_url";
5110
        if (is_array($fieldtype) && count($fieldtype)>0) {
5111
            $sql .= " AND ( ";
5112
            $i = 0;
5113
            foreach ($fieldtype as $type){
5114
                if ($i > 0) {
5115
                    $sql .= ' OR ';
5116
                }
5117
                $type = Database::escape_string($type);
5118
                $sql .= " type='".$type."' ";
5119
                $i++;
5120
            }
5121
            $sql .= ")";
5122
        }
5123
        $res = Database::query($sql);
5124
        return $res !== false;
5125
    } else {
@@ 5128-5140 (lines=13) @@
5125
    } else {
5126
        $sql = "UPDATE $t_s SET selected_value = NULL
5127
                WHERE category = '$category' AND access_url = $access_url";
5128
        if (is_array($fieldtype) && count($fieldtype)>0) {
5129
            $sql .= " AND ( ";
5130
            $i = 0;
5131
            foreach ($fieldtype as $type){
5132
                if ($i > 0) {
5133
                    $sql .= ' OR ';
5134
                }
5135
                $type = Database::escape_string($type);
5136
                $sql .= " type='".$type."' ";
5137
                $i++;
5138
            }
5139
            $sql .= ")";
5140
        }
5141
        $res = Database::query($sql);
5142
        return $res !== false;
5143
    }