Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 5042-5054 (lines=13) @@
5039
        $value = Database::escape_string($value);
5040
        $sql = "UPDATE $t_s SET selected_value = '$value'
5041
                WHERE category = '$category' AND access_url = $access_url";
5042
        if (is_array($fieldtype) && count($fieldtype)>0) {
5043
            $sql .= " AND ( ";
5044
            $i = 0;
5045
            foreach ($fieldtype as $type){
5046
                if ($i > 0) {
5047
                    $sql .= ' OR ';
5048
                }
5049
                $type = Database::escape_string($type);
5050
                $sql .= " type='".$type."' ";
5051
                $i++;
5052
            }
5053
            $sql .= ")";
5054
        }
5055
        $res = Database::query($sql);
5056
        return $res !== false;
5057
    } else {
@@ 5060-5072 (lines=13) @@
5057
    } else {
5058
        $sql = "UPDATE $t_s SET selected_value = NULL
5059
                WHERE category = '$category' AND access_url = $access_url";
5060
        if (is_array($fieldtype) && count($fieldtype)>0) {
5061
            $sql .= " AND ( ";
5062
            $i = 0;
5063
            foreach ($fieldtype as $type){
5064
                if ($i > 0) {
5065
                    $sql .= ' OR ';
5066
                }
5067
                $type = Database::escape_string($type);
5068
                $sql .= " type='".$type."' ";
5069
                $i++;
5070
            }
5071
            $sql .= ")";
5072
        }
5073
        $res = Database::query($sql);
5074
        return $res !== false;
5075
    }