Code Duplication    Length = 15-20 lines in 2 locations

plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php 1 location

@@ 948-967 (lines=20) @@
945
    {
946
        $userId = intval($userId);
947
        $sessionId = intval($sessionId);
948
        if (!empty($userId) && !empty($sessionId)) {
949
            $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
950
            $row = Database::select(
951
                'status',
952
                $queueTable,
953
                array(
954
                    'where' => array(
955
                        'user_id = ? AND session_id = ?' => array($userId, $sessionId),
956
                    )
957
                )
958
            );
959
960
            if (count($row) == 1) {
961
962
                return $row[0]['status'];
963
            } else {
964
965
                return ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE;
966
            }
967
        }
968
969
        return false;
970
    }

main/inc/lib/api.lib.php 1 location

@@ 1547-1561 (lines=15) @@
1544
 */
1545
function api_get_course_int_id($code = null)
1546
{
1547
    if (!empty($code)) {
1548
        $code = Database::escape_string($code);
1549
        $row = Database::select(
1550
            'id',
1551
            Database::get_main_table(TABLE_MAIN_COURSE),
1552
            array('where'=> array('code = ?' => array($code))),
1553
            'first'
1554
        );
1555
1556
        if (is_array($row) && isset($row['id'])) {
1557
            return $row['id'];
1558
        } else {
1559
            return false;
1560
        }
1561
    }
1562
    return Session::read('_real_cid', 0);
1563
}
1564