Esempio n. 1
0
            Database::get()->query("DELETE FROM course_user " . " WHERE status <> ?d AND status <> ?d AND user_id = ?d " . " AND course_id = ?d", USER_TEACHER, USER_GUEST, $uid, $cid);
            // logging
            Log::record($cid, MODULE_ID_USERS, LOG_DELETE, array('uid' => $uid, 'right' => 0));
        }
    }
    $errorExists = false;
    foreach ($selectCourse as $key => $value) {
        $cid = intval($value);
        $course_info = Database::get()->querySingle("SELECT public_code, password, visible FROM course WHERE id = ?d", $cid);
        if ($course_info) {
            if (($course_info->visible == COURSE_REGISTRATION or $course_info->visible == COURSE_OPEN) and !empty($course_info->password) and $course_info->password !== $_POST['pass' . $cid]) {
                $errorExists = true;
                $restrictedCourses[] = $course_info->public_code;
                continue;
            }
            if (is_restricted($cid) and !in_array($cid, $selectCourse)) {
                // do not allow registration to restricted course
                $errorExists = true;
                $restrictedCourses[] = $course_info->public_code;
            } else {
                Database::get()->query("INSERT IGNORE INTO `course_user` (`course_id`, `user_id`, `status`, `reg_date`)\n                                        VALUES (?d, ?d, ?d, CURDATE())", $cid, intval($uid), USER_STUDENT);
            }
        }
    }
    if ($errorExists) {
        $tool_content .= "<div class='alert alert-danger'>{$langWrongPassCourse} " . q(join(', ', $restrictedCourses)) . "</div><br />";
    } else {
        $tool_content .= "<div class='alert alert-success'>{$langRegDone}</div>";
    }
    $tool_content .= "<div><a href='../../index.php'>{$langHome}</a></div>";
} else {
/**
 *
 */
function hide_network_menus()
{
    if (is_restricted()) {
        remove_menu_page("themes.php");
        remove_menu_page("plugins.php");
        remove_menu_page("settings.php");
        remove_submenu_page("index.php", "update-core.php");
        remove_submenu_page("index.php", "upgrade.php");
        remove_menu_page("admin.php?page=pb_stats");
        remove_action('network_admin_notices', 'update_nag', 3);
        remove_action('network_admin_notices', 'site_admin_notice');
    }
}
Esempio n. 3
0
        }
    }

    $errorExists = false;
    foreach ($selectCourse as $key => $value) {
        $cid = intval($value);
        $course_info = Database::get()->querySingle("SELECT public_code, password, visible FROM course WHERE id = ?d", $cid);
        if ($course_info) {
            if (($course_info->visible == COURSE_REGISTRATION or
                    $course_info->visible == COURSE_OPEN) and !empty($course_info->password) and
                    $course_info->password !== $_POST['pass' . $cid]) {
                $errorExists = true;
                $restrictedCourses[] = $course_info->public_code;
                continue;
            }
            if (is_restricted($cid) and !in_array($cid, $selectCourse)) { // do not allow registration to restricted course
                $errorExists = true;
                $restrictedCourses[] = $course_info->public_code;
            } else {
                Database::get()->query("INSERT IGNORE INTO `course_user` (`course_id`, `user_id`, `status`, `reg_date`)
                                        VALUES (?d, ?d, ?d, NOW())", $cid, intval($uid), USER_STUDENT);
            }
        }
    }

    if ($errorExists) {
        $tool_content .= "<div class='alert alert-danger'>$langWrongPassCourse " .
                q(join(', ', $restrictedCourses)) . "</div><br />";
    } else {
        $tool_content .= "<div class='alert alert-success'>$langRegDone</div>";
    }