Code Duplication    Length = 9-11 lines in 3 locations

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

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

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/course.lib.php 1 location

@@ 5850-5858 (lines=9) @@
5847
     * @param int  $category_id
5848
     * @return int course id
5849
     */
5850
    public static function get_course_by_category($category_id)
5851
    {
5852
        $category_id = intval($category_id);
5853
        $info = Database::fetch_array(
5854
            Database::query('SELECT c_id FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . '
5855
            WHERE id=' . $category_id), 'ASSOC'
5856
        );
5857
        return $info ? $info['c_id'] : false;
5858
    }
5859
5860
    /**
5861
     * This function gets all the courses that are not in a session