Code Duplication    Length = 11-14 lines in 2 locations

main/inc/lib/AnnouncementManager.php 1 location

@@ 1314-1327 (lines=14) @@
1311
     * @param integer $id attachment file Id
1312
     * @return bool
1313
     */
1314
    public static function delete_announcement_attachment_file($id)
1315
    {
1316
        $table = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
1317
        $id = intval($id);
1318
        $course_id = api_get_course_int_id();
1319
        if (empty($course_id) || empty($id)) {
1320
            return false;
1321
        }
1322
        $sql = "DELETE FROM $table
1323
                WHERE c_id = $course_id AND id = $id";
1324
        Database::query($sql);
1325
1326
        return true;
1327
    }
1328
1329
    /**
1330
     * @param array $courseInfo

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

@@ 3425-3435 (lines=11) @@
3422
     * @return  boolean True if is admin, false otherwise
3423
     * @see main_api.lib.php::api_is_platform_admin() for a context-based check
3424
     */
3425
    public static function is_admin($user_id)
3426
    {
3427
        if (empty($user_id) || $user_id != strval(intval($user_id))) {
3428
            return false;
3429
        }
3430
        $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
3431
        $sql = "SELECT * FROM $admin_table WHERE user_id = $user_id";
3432
        $res = Database::query($sql);
3433
3434
        return Database::num_rows($res) === 1;
3435
    }
3436
3437
    /**
3438
     * Get the total count of users