Code Duplication    Length = 8-8 lines in 3 locations

api/functions.php 3 locations

@@ 160-167 (lines=8) @@
157
}
158
159
function rest_delete() {
160
    if (!@count($GLOBALS['request']) == 0) {
161
        $request_uri = $GLOBALS['_SERVER']['REQUEST_URI'];
162
        preg_match('/\/api(\/index.php|)\/(.*)\?apikey=(.*)/', $request_uri, $matches);
163
        if (count($matches) == 0) {
164
            rest_error('REQUEST_SENT_NOT_UNDERSTANDABLE');
165
        }
166
        $GLOBALS['request'] = explode('/', $matches[2]);
167
    }
168
    if (apikey_checker($GLOBALS['apikey'])) {
169
        global $server, $user, $pass, $database, $pre, $link;
170
        include "../sources/main.functions.php";
@@ 273-280 (lines=8) @@
270
function rest_get() {
271
    global $api_version;
272
273
    if (!@count($GLOBALS['request']) == 0) {
274
        $request_uri = $GLOBALS['_SERVER']['REQUEST_URI'];
275
        preg_match('/\/api(\/index.php|)\/(.*)\?apikey=(.*)/', $request_uri, $matches);
276
        if (count($matches) == 0) {
277
            rest_error('REQUEST_SENT_NOT_UNDERSTANDABLE');
278
        }
279
        $GLOBALS['request'] = explode('/', $matches[2]);
280
    }
281
282
    if (apikey_checker($GLOBALS['apikey'])) {
283
        global $server, $user, $pass, $database, $pre, $link;
@@ 2020-2027 (lines=8) @@
2017
}
2018
2019
function rest_put() {
2020
    if (!@count($GLOBALS['request']) == 0) {
2021
        $request_uri = $GLOBALS['_SERVER']['REQUEST_URI'];
2022
        preg_match('/\/api(\/index.php|)\/(.*)\?apikey=(.*)/', $request_uri, $matches);
2023
        if (count($matches) == 0) {
2024
            rest_error('REQUEST_SENT_NOT_UNDERSTANDABLE');
2025
        }
2026
        $GLOBALS['request'] = explode('/', $matches[2]);
2027
    }
2028
    if (apikey_checker($GLOBALS['apikey'])) {
2029
        global $server, $user, $pass, $database, $pre, $link;
2030
        teampass_connect();