$tabsmode = 'assign';
include_once('tabs.php');
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
- check_for_restricted_user($USER->username, $CFG->wwwroot);
-
/// Print a help notice about the need to use this page
if (!$frm = data_submitted()) {
}
print_footer($course);
-?>
\ No newline at end of file
+?>
error("Course ID was incorrect (can't find it)");
}
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-
//Print header
if (isadmin()) {
print_header("$site->shortname: $strcoursebackup", $site->fullname,
error("Course ID was incorrect (can't find it)");
}
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
-
//Print header
if (isadmin()) {
print_header("$site->shortname: $strcourserestore", $site->fullname,
}
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
- if (is_internal_auth() && !is_restricted_user($USER->username)) {
+ if (is_internal_auth()) {
$this->content->items[]='<a href="'.$securewwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
}
// Useful for webhost operators who have alternate methods of backups
// $CFG->disablescheduledbackups = true;
//
-// Restrict certain usernames from doing things that may mess up a site
-// This is especially useful for demonstration teacher accounts
-// $CFG->restrictusers = 'teacher,fred,jim';
-//
// Set global password for "Login as", teacher is prompted only once in each session.
// Set your own password and tell it only to teachers that should have access to this feature.
// $CFG->loginaspassword = 'yoursharedpassword';
if ($form = data_submitted() and confirm_sesskey()) {
- if (empty($course)) {
- check_for_restricted_user($USER->username, "$CFG->wwwroot");
- } else {
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
- }
-
$form->startdate = make_timestamp($form->startyear, $form->startmonth, $form->startday);
$form->category = clean_param($form->category, PARAM_INT);
error("Could not find a site!");
}
- check_for_restricted_user($USER->username);
/// Refreshing enrolment data in the USER session
if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassigncourses",
"studentform.searchtext");
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
/// Print a help notice about the need to use this page
error("Only teachers can use this page!");
}
- check_for_restricted_user($USER->username, "$CFG->wwwroot/user/view.php?id=$user&course=$course->id");
-
// validate loginaspassword if defined in config.php
if (empty($SESSION->loginasvalidated) && !empty($CFG->loginaspassword)) {
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassignstudents",
"studentform.searchtext");
-/// Don't allow restricted teachers to even see this page (because it contains
-/// a lot of email addresses and access to all student on the server
-
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
/// Print a help notice about the need to use this page
$SESSION->logincount = 0;
}
-/**
- * check_for_restricted_user
- *
- * @uses $CFG
- * @uses $USER
- * @param string $username ?
- * @param string $redirect ?
- * @todo Finish documenting this function
- */
-function check_for_restricted_user($username=NULL, $redirect='') {
- global $CFG, $USER;
-
- if (!$username) {
- if (!empty($USER->username)) {
- $username = $USER->username;
- } else {
- return false;
- }
- }
-
- if (!empty($CFG->restrictusers)) {
- $names = explode(',', $CFG->restrictusers);
- if (in_array($username, $names)) {
- error(get_string('restricteduser', 'error', fullname($USER)), $redirect);
- }
- }
-}
-
-function is_restricted_user($username){
- global $CFG;
-
- if (!empty($CFG->restrictusers)) {
- $names = explode(',', $CFG->restrictusers);
- if (in_array($username, $names)) {
- return true;
- }
- }
- return false;
-}
-
function sync_metacourses() {
global $CFG;
if ($frm = data_submitted()) {
validate_form($frm, $err);
- check_for_restricted_user($frm->username);
-
update_login_count();
if (!count((array)$err)) {
/// Check if the Form has been submitted and display confirmation
////////////////////////////////////////////////////////////
if ($form = data_submitted()) {
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
/// Moodle Log
/// Get additional info
$addloginfo="";
}
}
- if (isset($USER->username)) {
- check_for_restricted_user($USER->username, "$CFG->wwwroot/course/view.php?id=$course->id");
- }
-
if (isset($usernew->password)) {
unset($usernew->password);
}
// Print other functions
echo '<div class="buttons"><table align="center"><tr>';
- if ($currentuser and !isguest() and !is_restricted_user($USER->username)) {
+ if ($currentuser and !isguest()) {
if ($internalpassword ) {
echo "<td nowrap=\"nowrap\"><form action=\"$internalpassword\" method=\"get\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";