Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5097-5109 (lines=13) @@
5094
        $value = Database::escape_string($value);
5095
        $sql = "UPDATE $t_s SET selected_value = '$value'
5096
                WHERE category = '$category' AND access_url = $access_url";
5097
        if (is_array($fieldtype) && count($fieldtype)>0) {
5098
            $sql .= " AND ( ";
5099
            $i = 0;
5100
            foreach ($fieldtype as $type){
5101
                if ($i > 0) {
5102
                    $sql .= ' OR ';
5103
                }
5104
                $type = Database::escape_string($type);
5105
                $sql .= " type='".$type."' ";
5106
                $i++;
5107
            }
5108
            $sql .= ")";
5109
        }
5110
        $res = Database::query($sql);
5111
        return $res !== false;
5112
    } else {
@@ 5115-5127 (lines=13) @@
5112
    } else {
5113
        $sql = "UPDATE $t_s SET selected_value = NULL
5114
                WHERE category = '$category' AND access_url = $access_url";
5115
        if (is_array($fieldtype) && count($fieldtype)>0) {
5116
            $sql .= " AND ( ";
5117
            $i = 0;
5118
            foreach ($fieldtype as $type){
5119
                if ($i > 0) {
5120
                    $sql .= ' OR ';
5121
                }
5122
                $type = Database::escape_string($type);
5123
                $sql .= " type='".$type."' ";
5124
                $i++;
5125
            }
5126
            $sql .= ")";
5127
        }
5128
        $res = Database::query($sql);
5129
        return $res !== false;
5130
    }