Code Duplication    Length = 9-11 lines in 3 locations

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

@@ 620-630 (lines=11) @@
617
     * @param int $urlId
618
     * @return int
619
     */
620
    public static function addUserGroupToUrl($userGroupId, $urlId)
621
    {
622
        $urlRelUserGroupTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
623
        $sql = "INSERT INTO $urlRelUserGroupTable
624
                SET
625
                usergroup_id = '".intval($userGroupId)."',
626
                access_url_id = ".intval($urlId);
627
        Database::query($sql);
628
629
        return Database::insert_id();
630
    }
631
632
    /**
633
     * @param int $categoryId

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

@@ 295-303 (lines=9) @@
292
     *
293
     * @return bool
294
     */
295
    public static function session_name_exists($name)
296
    {
297
        $name = Database::escape_string($name);
298
        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
299
                WHERE name = '$name'";
300
        $result = Database::fetch_array(Database::query($sql));
301
302
        return $result['count'] > 0;
303
    }
304
305
    /**
306
     * @param string $where_condition

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

@@ 5836-5844 (lines=9) @@
5833
     * @param int  $category_id
5834
     * @return int course id
5835
     */
5836
    public static function get_course_by_category($category_id)
5837
    {
5838
        $category_id = intval($category_id);
5839
        $info = Database::fetch_array(
5840
            Database::query('SELECT c_id FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . '
5841
            WHERE id=' . $category_id), 'ASSOC'
5842
        );
5843
        return $info ? $info['c_id'] : false;
5844
    }
5845
5846
    /**
5847
     * This function gets all the courses that are not in a session