Code Duplication    Length = 10-14 lines in 3 locations

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

@@ 6061-6070 (lines=10) @@
6058
        } else {
6059
            return false;
6060
        }
6061
    } elseif ($format == 'ogg' || $format == 'ogx' || $format == 'ogv' || $format == 'oga') {
6062
        //native ogg, ogv,oga support
6063
        if (($current_browser == 'Firefox' && $current_majorver >= 3) ||
6064
            ($current_browser == 'Chrome' && $current_majorver >= 3) ||
6065
            ($current_browser == 'Opera' && $current_majorver >= 9)) {
6066
            return true;
6067
        } else {
6068
            return false;
6069
        }
6070
    } elseif ($format == 'mpg' || $format == 'mpeg') {
6071
        //native mpg support
6072
        if (($current_browser == 'Safari' && $current_majorver >= 5)) {
6073
            return true;
@@ 6105-6117 (lines=13) @@
6102
        } else {
6103
            return false;
6104
        }
6105
    } elseif ($format == 'webm') {
6106
        //native webm support (TODO:check IE9, Chrome9, Android)
6107
        if (($current_browser == 'Firefox' && $current_majorver >= 4) ||
6108
            ($current_browser == 'Opera' && $current_majorver >= 9) ||
6109
            ($current_browser == 'Internet Explorer' && $current_majorver >= 9) ||
6110
            ($current_browser == 'Chrome' && $current_majorver >= 9) ||
6111
            $current_browser == 'Android'
6112
        ) {
6113
            return true;
6114
        } else {
6115
            return false;
6116
        }
6117
    } elseif ($format == 'wav') {
6118
        //native wav support (only some codecs !)
6119
        if (($current_browser == 'Firefox' && $current_majorver >= 4) ||
6120
            ($current_browser == 'Safari' && $current_majorver >= 5) ||
@@ 6152-6165 (lines=14) @@
6149
        } else {
6150
            return false;
6151
        }
6152
    } elseif ($format == 'mp3') {
6153
        //native mp3 support (TODO:check Android, iPhone)
6154
        if (($current_browser == 'Safari' && $current_majorver >= 5) ||
6155
            ($current_browser == 'Chrome' && $current_majorver >= 6) ||
6156
            ($current_browser == 'Internet Explorer' && $current_majorver >= 9) ||
6157
            $current_browser == 'Android' ||
6158
            $current_browser == 'iPhone' ||
6159
            $current_browser == 'Firefox'
6160
        ) {
6161
            return true;
6162
        } else {
6163
            return false;
6164
        }
6165
    } elseif ($format == "check_browser") {
6166
        $array_check_browser = array($current_browser, $current_majorver);
6167
        return $array_check_browser;
6168
    } else {