Code Duplication    Length = 11-13 lines in 2 locations

api/functions.php 2 locations

@@ 1763-1775 (lines=13) @@
1760
                $array_category = explode(';', $GLOBALS['request'][2]);
1761
1762
                // get user info
1763
                if (isset($GLOBALS['request'][3]) && !empty($GLOBALS['request'][3])) {
1764
                    $userData = DB::queryFirstRow(
1765
                        "SELECT `id` FROM ".$pre."users WHERE login = %s",
1766
                        $GLOBALS['request'][3]
1767
                    );
1768
                    if (DB::count() == 0) {
1769
                        $user_id = API_USER_ID;
1770
                    } else {
1771
                        $user_id = $userData['id'];
1772
                    }
1773
                } else {
1774
                    $user_id = API_USER_ID;
1775
                }
1776
1777
                if (count($array_category) > 0 && count($array_category) < 5) {
1778
                    // load passwordLib library
@@ 1850-1860 (lines=11) @@
1847
                $array_items = explode(';', $GLOBALS['request'][2]);
1848
1849
                // get user info
1850
                if (isset($GLOBALS['request'][3]) && !empty($GLOBALS['request'][3])) {
1851
                    $userData = DB::queryFirstRow(
1852
                        "SELECT `id` FROM ".$pre."users WHERE login = %s",
1853
                        $GLOBALS['request'][3]
1854
                    );
1855
                    if (DB::count() == 0) {
1856
                        $user_id = API_USER_ID;
1857
                    } else {
1858
                        $user_id = $userData['id'];
1859
                    }
1860
                }
1861
1862
                for ($i = 0; $i < count($array_items); $i++) {
1863
                    DB::update(