diff --git a/admin/index.php b/admin/index.php
index af41e667551..6bfba862b88 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -501,19 +501,7 @@
/// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
- $guest->auth = "manual";
- $guest->username = "guest";
- $guest->password = md5("guest");
- $guest->firstname = addslashes(get_string("guestuser"));
- $guest->lastname = " ";
- $guest->email = "root@localhost";
- $guest->description = addslashes(get_string("guestuserinfo"));
- $guest->mnethostid = $CFG->mnet_localhost_id;
- $guest->confirmed = 1;
- $guest->lang = $CFG->lang;
- $guest->timemodified= time();
-
- if (! $guest->id = insert_record("user", $guest)) {
+ if (! $guest = create_guest_record()) {
notify("Could not create guest user record !!!");
}
}
diff --git a/auth/README2 b/auth/README2
deleted file mode 100644
index 2934800fa14..00000000000
--- a/auth/README2
+++ /dev/null
@@ -1,91 +0,0 @@
-AUTHENTICATION PLUGINS
-----------------------
-Each authentication plugin is now contained in a subfolder as a class definition
-in the auth.php file. For instance, the LDAP authentication plugin is the class
-called auth_plugin_ldap defined in:
-
- /auth/ldap/auth.php
-
-To instantiate the class, there is a function in lib/moodlelib called
-get_auth_plugin() that does the work for you:
-
- $ldapauth = get_auth_plugin('ldap');
-
-Auth plugin classes are pretty basic. They contain the same functions that were
-previously in each plugin's lib.php file, but refactored to become class
-methods, and tweaked to reference the plugin's instantiated config to get at the
-settings, rather than the global $CFG variable.
-
-Configuration
------------------
-
-All auth plugins must have a config property that contains the name value pairs
-from the config_plugins table. This is populated using the get_config() function
-in the constructor. The settings keys have also had the "auth_" prefix, as well
-as the auth plugin name, trimmed. For instance, what used to be
-
- echo $CFG->auth_ldapversion;
-
-is now accessed as
-
- echo $ldapauth->config->version;
-
-Authentication settings have been moved to the config_plugins database table,
-with the plugin field set to "auth/foo" (for instance, "auth/ldap").
-
-Method Names
------------------
-
-When the functions from lib.php were ported to methods in auth.php, the "auth_"
-prefix was dropped. For instance, calls to
-
- auth_user_login($user, $pass);
-
-now become
-
- $ldapauth->user_login($user, $pass);
-
-this also avoids having to worry about which auth/lib file to include since
-Moodle takes care of it for you when you create an instance with
-get_auth_plugin().
-
-Code Use
------------------
-
-Code calling auth plugins can use method_exists() to determine plugin
-functionality, much in the same way that function_exists() was used until now.
-In addition, auth plugins provide some methods by default that can be called:
-
-user_login($username, $password)
- This is the primary method that is used by the authenticate_user_login()
- function in moodlelib.php. This method should return a boolean indicating
- whether or not the username and password authenticate successfully.
- Both parameter must have magic quotes applied.
-
-is_internal()
- Returns true if this authentication plugin is "internal" (which means that
- Moodle stores the users' passwords and other details in the local Moodle
- database).
-
-can_change_password()
- Returns true if the plugin can change the users' passwords.
-
-change_password_url()
- Returns the URL for changing the users' passwords, or false if the default
- URL can be used.
-
-Other Methods
------------------
-
-get_userinfo($username)
- This method should return an array of fields from the authentication source
- for the given username. Username parameter must have magic quotes applied.
- The returned array does not have magic quotes applied.
-
-Upgrading from Moodle 1.7
------------------------------
-
-Moodle will upgrade the old auth settings (in $CFG->auth_foobar where foo is the
-auth plugin and bar is the setting) to the new style in the config_plugin
-database table.
-
diff --git a/auth/cas/auth_ldap_sync_users.php b/auth/cas/auth_ldap_sync_users.php
deleted file mode 100644
index e4caec4b45d..00000000000
--- a/auth/cas/auth_ldap_sync_users.php
+++ /dev/null
@@ -1,48 +0,0 @@
-dirroot.'/course/lib.php');
-require_once($CFG->dirroot.'/lib/blocklib.php');
-require_once($CFG->dirroot.'/mod/resource/lib.php');
-require_once($CFG->dirroot.'/mod/forum/lib.php');
-require_once($CFG->dirroot.'/lib/moodlelib.php');
-
-if (!is_enabled_auth('cas')) {
- echo "Plugin not enabled!";
- die;
-}
-
-$casauth = get_auth_plugin('cas');
-$casauth->sync_users(1000, true);
-
-?>
\ No newline at end of file
diff --git a/auth/cas/forbidden.html b/auth/cas/forbidden.html
deleted file mode 100644
index fb4674bef68..00000000000
--- a/auth/cas/forbidden.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
diff --git a/auth/cas/forbidden.php b/auth/cas/forbidden.php
deleted file mode 100644
index 918261ecf65..00000000000
--- a/auth/cas/forbidden.php
+++ /dev/null
@@ -1,18 +0,0 @@
-fullname: $loginsite", $site->fullname, $loginsite);
- include("forbidden.html");
- print_footer();
- exit;
-?>
-
diff --git a/auth/cas/index_form.html b/auth/cas/index_form.html
deleted file mode 100644
index 5a1c85e2e39..00000000000
--- a/auth/cas/index_form.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
- |
-
- |
-
-
- |
-
-
-
- |
- :
- ()
-
-
-
-guestloginbutton) { ?>
-
- :
-
-
-
-
-
-
-
-
-
- |
-
-
-
-auth) {
- case "email":
- print_string("loginsteps", "", "signup.php");
-?>
-
-auth);
- echo format_text($CFG->auth_instructions);
- if (!empty($authplugin->config->user_create) and method_exists($authplugin, 'user_create')) {
-?>
-
-
-
-
- |
-
-
-
diff --git a/auth/cas/login.php b/auth/cas/login.php
deleted file mode 100644
index 7551bc88c40..00000000000
--- a/auth/cas/login.php
+++ /dev/null
@@ -1,313 +0,0 @@
-langmenu)) {
- $langmenu = "";
- } else {
- $currlang = current_language();
- $langs = get_list_of_languages();
- if (empty($CFG->loginhttps)) {
- $wwwroot = $CFG->wwwroot;
- } else {
- $wwwroot = str_replace('http:','https:',$CFG->wwwroot);
- }
- $langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
- }
-
- $loginsite = get_string("loginsite");
- $casauth = get_auth_plugin('cas');
- $ldapauth = get_auth_plugin('ldap');
-
-
- $frm = false;
- $user = false;
- if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,'username=guest')) or $loginguest) {
- /// Log in as guest automatically (idea from Zbigniew Fiedorowicz)
- $frm->username = 'guest';
- $frm->password = 'guest';
- } else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot.'/login/weblinkauth.php')) {
- // Handles the case of another Moodle site linking into a page on this site
- include($CFG->dirroot.'/login/weblinkauth.php');
- if (function_exists(weblink_auth)) {
- $user = weblink_auth($SESSION->wantsurl);
- }
- if ($user) {
- $frm->username = $user->username;
- } else {
- $frm = data_submitted();
- }
- } else {
- $frm = data_submitted();
- }
-
- if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
-
- $errormsg = get_string("cookiesnotenabled");
-
- } else if ($frm) { // Login WITH cookies
-
- $frm->username = trim(moodle_strtolower($frm->username));
-
- if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
- $user = false; /// Can't log in as guest if guest button is disabled
- $frm = false;
- } else if (!$user) {
- if ($CFG->auth == "cas" && $frm->username != 'guest') { /// Cas SSO case
- $user = $casauth->authenticate_user_login($frm->username, $frm->password);
- }else{
- $user = authenticate_user_login($frm->username, $frm->password);
- }
- }
- update_login_count();
-
- if ($user) {
- if (! $user->confirmed ) { // they never confirmed via email
- print_header(get_string("mustconfirm"), get_string("mustconfirm") );
- print_heading(get_string("mustconfirm"));
- print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
- print_footer();
- die;
- }
-
- $USER = $user;
- if (!empty($USER->description)) {
- $USER->description = true; // No need to cart all of it around
- }
- $USER->loggedin = true;
- $USER->site = $CFG->wwwroot; // for added security, store the site in the session
- sesskey(); // for added security, used to check script parameters
-
- if ($USER->username == "guest") {
- $USER->lang = $CFG->lang; // Guest language always same as site
- $USER->firstname = get_string("guestuser"); // Name always in current language
- $USER->lastname = " ";
- }
-
- if (!update_user_login_times()) {
- error("Wierd error: could not update login records");
- }
-
- set_moodle_cookie($USER->username);
-
- unset($SESSION->lang);
- $SESSION->justloggedin = true;
-
- // Restore the calendar filters, if saved
- if (intval(get_user_preferences('calendar_persistflt', 0))) {
- include_once($CFG->dirroot.'/calendar/lib.php');
- calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
- }
-
- //Select password change url
- $userauth = get_auth_plugin($USER->auth);
- if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) {
- $passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
- }
-
- // check whether the user should be changing password
- if (get_user_preferences('auth_forcepasswordchange', false)) {
- if (isset($passwordchangeurl)) {
- redirect($passwordchangeurl);
- } else {
- print_error('auth_cas_broken_password','auth');
- }
- }
-
-
- add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
-
- if (user_not_fully_set_up($USER)) {
- $urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
- // We don't delete $SESSION->wantsurl yet, so we get there later
-
- } else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
- $urltogo = $SESSION->wantsurl; /// Because it's an address in this site
- unset($SESSION->wantsurl);
-
- } else {
- $urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
- unset($SESSION->wantsurl); /// Just in case
- }
-
- // check if user password has expired
- // Currently supported only for ldap-authentication module
- if ($ldapauth->config->expiration == 1) {
- $days2expire = $ldapauth->password_expire($USER->username);
- if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
- print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "$langmenu
");
- notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
- print_footer();
- exit;
- } elseif (intval($days2expire) < 0 ) {
- print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "$langmenu
");
- notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
- print_footer();
- exit;
- }
- }
-
- reset_login_count();
-
- load_all_capabilities(); /// This is what lets the user do anything on the site :-)
-
- redirect($urltogo);
-
- exit;
-
- } else {
- if ($CFG->auth == "cas" ) { /// CAS error login
- $errormsg = get_string("invalidcaslogin");
- phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
- }else{
- $errormsg = get_string("invalidlogin");
- }
- }
- }
- $user = $casauth->automatic_authenticate($user);
- if ($user) {
- if (! $user->confirmed ) { // they never confirmed via email
- print_header(get_string("mustconfirm"), get_string("mustconfirm") );
- print_heading(get_string("mustconfirm"));
- print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
- print_footer();
- die;
- }
-
- $USER = $user;
- if (!empty($USER->description)) {
- $USER->description = true; // No need to cart all of it around
- }
- $USER->loggedin = true;
- $USER->site = $CFG->wwwroot; // for added security, store the site in the session
- sesskey(); // for added security, used to check script parameters
-
- if ($USER->username == "guest") {
- $USER->lang = $CFG->lang; // Guest language always same as site
- $USER->firstname = get_string("guestuser"); // Name always in current language
- $USER->lastname = " ";
- }
-
- if (!update_user_login_times()) {
- error("Wierd error: could not update login records");
- }
-
- set_moodle_cookie($USER->username);
-
- unset($SESSION->lang);
- $SESSION->justloggedin = true;
-
- // Restore the calendar filters, if saved
- if (intval(get_user_preferences('calendar_persistflt', 0))) {
- include_once($CFG->dirroot.'/calendar/lib.php');
- calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
- }
-
- //Select password change url
- $userauth = get_auth_plugin($USER->auth);
- if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) {
- $passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
- }
-
- // check whether the user should be changing password
- if (get_user_preferences('auth_forcepasswordchange', false)) {
- if (isset($passwordchangeurl)) {
- redirect($passwordchangeurl);
- } else {
- print_error('auth_cas_broken_password','auth');
- }
- }
-
-
- add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
-
- if (user_not_fully_set_up($USER)) {
- $urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
- // We don't delete $SESSION->wantsurl yet, so we get there later
-
- } else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
- $urltogo = $SESSION->wantsurl; /// Because it's an address in this site
- unset($SESSION->wantsurl);
-
- } else {
- $urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
- unset($SESSION->wantsurl); /// Just in case
- }
-
- // check if user password has expired
- // Currently supported only for ldap-authentication module
- if ($ldapauth->config->expiration == 1) {
- $days2expire = $ldapauth->password_expire($USER->username);
- if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
- print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "");
- notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
- print_footer();
- exit;
- } elseif (intval($days2expire) < 0 ) {
- print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "");
- notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
- print_footer();
- exit;
- }
- }
-
- reset_login_count();
-
- load_all_capabilities(); /// This is what lets the user do anything on the site :-)
-
- redirect($urltogo);
-
- exit;
- } else {
- if (!$CFG->guestloginbutton) {
- $errormsg = get_string("invalidcaslogin");
- phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
- }
- }
-
- if (empty($errormsg)) {
- $errormsg = "";
- }
-
- if (empty($SESSION->wantsurl)) {
- $SESSION->wantsurl = array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER["HTTP_REFERER"] : $CFG->wwwroot.'/';
- }
-
- if (get_moodle_cookie() == '') {
- set_moodle_cookie('nobody'); // To help search for cookies
- }
-
- if (empty($frm->username)) {
- $frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
- $frm->password = "";
- }
-
- if (!empty($frm->username)) {
- $focus = "login.password";
- } else {
- $focus = "login.username";
- }
-
- if ($CFG->auth == "email" or $CFG->auth == "none" or chop($CFG->auth_instructions) <> "" ) {
- $show_instructions = true;
- } else {
- $show_instructions = false;
- }
-
- print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "$langmenu
");
- include($CFG->dirroot.'/auth/cas/index_form.html');
- print_footer();
-
- exit;
-
- // No footer on this page
-
-?>
diff --git a/auth/cas/logout.php b/auth/cas/logout.php
deleted file mode 100644
index 5f0a5cc87ad..00000000000
--- a/auth/cas/logout.php
+++ /dev/null
@@ -1,15 +0,0 @@
-cas_logout) {
- require_once($CFG->dirroot.'/config.php');
- include_once($CFG->dirroot.'/lib/cas/CAS.php');
- phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
- $backurl = $CFG->wwwroot;
- phpCAS::logout($backurl);
- }
-
-?>
\ No newline at end of file
diff --git a/auth/nologin/auth.php b/auth/nologin/auth.php
index f91ec9c8a7f..91070593673 100644
--- a/auth/nologin/auth.php
+++ b/auth/nologin/auth.php
@@ -1,7 +1,7 @@
libdir.'/authlib.php');
/**
- * Plugin for no authentication.
+ * Plugin for no authentication - disabled user.
*/
class auth_plugin_nologin extends auth_plugin_base {
@@ -32,10 +32,10 @@ class auth_plugin_nologin extends auth_plugin_base {
}
/**
- * Do not allow any login
+ * Do not allow any login.
*
*/
- function user_login ($username, $password) {
+ function user_login($username, $password) {
return false;
}
@@ -47,18 +47,17 @@ class auth_plugin_nologin extends auth_plugin_base {
}
/**
- * Returns true if this authentication plugin is 'internal'.
+ * No external data sync.
*
* @return bool
*/
function is_internal() {
//we do not know if it was internal or external originally
- return false;
+ return true;
}
/**
- * Returns true if this authentication plugin can change the user's
- * password.
+ * No changing of password.
*
* @return bool
*/
@@ -67,21 +66,10 @@ class auth_plugin_nologin extends auth_plugin_base {
}
/**
- * Prints a form for configuring this authentication plugin.
- *
- * This function is called from admin/auth.php, and outputs a full page with
- * a form for configuring this plugin.
- *
- * @param array $page An object containing all the data for this page.
+ * No password resetting.
*/
- function config_form($config, $err, $user_fields) {
- }
-
- /**
- * Processes and stores configuration data for this authentication plugin.
- */
- function process_config($config) {
- return true;
+ function can_reset_password() {
+ return false;
}
}
diff --git a/backup/db/mysql.sql b/backup/db/mysql.sql
deleted file mode 100644
index 66c9359a7b4..00000000000
--- a/backup/db/mysql.sql
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Table structure for table `prefix_backup_files`
-#
-
-CREATE TABLE `prefix_backup_files` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `backup_code` int(10) unsigned NOT NULL default '0',
- `file_type` varchar(10) NOT NULL default '',
- `path` varchar(255) NOT NULL default '',
- `old_id` int(10) unsigned NOT NULL default '0',
- `new_id` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`)
-) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.';
-# --------------------------------------------------------
-
-#
-# Table structure for table `prefix_backup_ids`
-#
-
-CREATE TABLE `prefix_backup_ids` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `backup_code` int(12) unsigned NOT NULL default '0',
- `table_name` varchar(30) NOT NULL default '',
- `old_id` int(10) unsigned NOT NULL default '0',
- `new_id` int(10) unsigned NOT NULL default '0',
- `info` mediumtext NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
-) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore';
-# --------------------------------------------------------
-
-#
-# Table structure for table `prefix_backup_config`
-#
-
-CREATE TABLE `prefix_backup_config` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `name` varchar(255) NOT NULL default '',
- `value` varchar(255) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
-) TYPE=MyISAM COMMENT='To store backup configuration variables';
-# --------------------------------------------------------
-
-#
-# Table structure for table `prefix_backup_courses`
-#
-
-CREATE TABLE `prefix_backup_courses` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `courseid` int(10) unsigned NOT NULL default '0',
- `laststarttime` int(10) unsigned NOT NULL default '0',
- `lastendtime` int(10) unsigned NOT NULL default '0',
- `laststatus` varchar(1) NOT NULL default '0',
- `nextstarttime` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `courseid` (`courseid`)
-) TYPE=MyISAM COMMENT='To store every course backup status';
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `prefix_backup_log`
-#
-
-CREATE TABLE `prefix_backup_log` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `courseid` int(10) unsigned NOT NULL default '0',
- `time` int(10) unsigned NOT NULL default '0',
- `laststarttime` int(10) unsigned NOT NULL default '0',
- `info` varchar(255) NOT NULL default '',
- PRIMARY KEY (`id`)
-) TYPE=MyISAM COMMENT='To store every course backup log info';
-# --------------------------------------------------------
diff --git a/backup/db/postgres7.sql b/backup/db/postgres7.sql
deleted file mode 100644
index d39f76402db..00000000000
--- a/backup/db/postgres7.sql
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Table structure for table prefix_backup_files
-#
-
-CREATE TABLE prefix_backup_files (
- id SERIAL PRIMARY KEY,
- backup_code integer NOT NULL default '0',
- file_type varchar(10) NOT NULL default '',
- path varchar(255) NOT NULL default '',
- old_id integer default NULL,
- new_id integer default NULL,
- CONSTRAINT prefix_backup_files_uk UNIQUE (backup_code, file_type, path)
-);
-
-
-#
-# Table structure for table prefix_backup_ids
-#
-
-CREATE TABLE prefix_backup_ids (
- id SERIAL PRIMARY KEY,
- backup_code integer NOT NULL default '0',
- table_name varchar(30) NOT NULL default '',
- old_id integer NOT NULL default '0',
- new_id integer default NULL,
- info text,
- CONSTRAINT prefix_backup_ids_uk UNIQUE (backup_code, table_name, old_id)
-);
-
-
-#
-# Table structure for table prefix_backup_config
-#
-
-CREATE TABLE prefix_backup_config (
- id SERIAL PRIMARY KEY,
- name varchar(255) UNIQUE NOT NULL default '',
- value varchar(255) NOT NULL default ''
-);
-
-
-#
-# Table structure for table prefix_backup_courses
-#
-
-CREATE TABLE prefix_backup_courses (
- id SERIAL PRIMARY KEY,
- courseid integer UNIQUE NOT NULL default '0',
- laststarttime integer NOT NULL default '0',
- lastendtime integer NOT NULL default '0',
- laststatus varchar(1) NOT NULL default '0',
- nextstarttime integer NOT NULL default '0'
-);
-
-
-
-#
-# Table structure for table prefix_backup_log
-#
-
-CREATE TABLE prefix_backup_log (
- id SERIAL PRIMARY KEY,
- courseid integer NOT NULL default '0',
- time integer NOT NULL default '0',
- laststarttime integer NOT NULL default '0',
- info varchar(255) NOT NULL default ''
-);
diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php
index f69aa8bc55b..c257e104e53 100644
--- a/blocks/blog_tags/block_blog_tags.php
+++ b/blocks/blog_tags/block_blog_tags.php
@@ -132,7 +132,7 @@ class block_blog_tags extends block_base {
case BLOG_GROUP_LEVEL:
$filtertype = 'group';
- $filterselect = get_current_group($this->instance->pageid);
+ $filterselect = get_and_set_current_group($COURSE, groupmode($COURSE));
break;
case BLOG_COURSE_LEVEL:
diff --git a/blocks/db/mysql.sql b/blocks/db/mysql.sql
deleted file mode 100644
index 8aafe1b6fda..00000000000
--- a/blocks/db/mysql.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-# $Id$
-#
-# Table structure for table `blocks`
-#
-
-CREATE TABLE `prefix_block` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `name` varchar(40) NOT NULL default '',
- `version` int(10) NOT NULL default '0',
- `cron` int(10) unsigned NOT NULL default '0',
- `lastcron` int(10) unsigned NOT NULL default '0',
- `visible` tinyint(1) NOT NULL default '1',
- `multiple` tinyint(1) NOT NULL default '0',
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
-CREATE TABLE `prefix_block_instance` (
- `id` int(10) not null auto_increment,
- `blockid` int(10) not null default '0',
- `pageid` int(10) not null default '0',
- `pagetype` varchar(20) not null default '',
- `position` varchar(10) not null default '',
- `weight` tinyint(3) not null default '0',
- `visible` tinyint(1) not null default '0',
- `configdata` text not null default '',
- PRIMARY KEY(`id`),
- INDEX pageid(`pageid`),
- INDEX pagetype(`pagetype`)
-) TYPE=MyISAM;
-
-CREATE TABLE `prefix_block_pinned` (
- `id` int(10) not null auto_increment,
- `blockid` int(10) not null default '0',
- `pagetype` varchar(20) not null default '',
- `position` varchar(10) not null default '',
- `weight` tinyint(3) not null default '0',
- `visible` tinyint(1) not null default '0',
- `configdata` text not null default '',
- PRIMARY KEY(`id`),
- INDEX pagetype(`pagetype`)
-) TYPE=MyISAM;
-
-
-
-# --------------------------------------------------------
diff --git a/blocks/db/postgres7.sql b/blocks/db/postgres7.sql
deleted file mode 100644
index 352774cd2a9..00000000000
--- a/blocks/db/postgres7.sql
+++ /dev/null
@@ -1,41 +0,0 @@
-# $Id$
-#
-# Table structure for table blocks
-#
-
-CREATE TABLE prefix_block (
- id SERIAL8 PRIMARY KEY,
- name varchar(40) NOT NULL default '',
- version INT8 NOT NULL default '0',
- cron INT8 NOT NULL default '0',
- lastcron INT8 NOT NULL default '0',
- visible int NOT NULL default '1',
- multiple int NOT NULL default '0'
-) ;
-
-CREATE TABLE prefix_block_instance (
- id SERIAL8 PRIMARY KEY,
- blockid INT8 not null default '0',
- pageid INT8 not null default '0',
- pagetype varchar(20) not null default '',
- position varchar(10) not null default '',
- weight int not null default '0',
- visible int not null default '0',
- configdata text not null default ''
-) ;
-CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid);
-CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype);
-
-CREATE TABLE prefix_block_pinned (
- id SERIAL8 PRIMARY KEY,
- blockid INT8 NOT NULL default 0,
- pagetype varchar(20) NOT NULL default '',
- position varchar(10) NOT NULL default '',
- weight INT NOT NULL default 0,
- visible INT NOT NULL default 0,
- configdata text NOT NULL default 0
-) ;
-
-CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);
-
-# --------------------------------------------------------
diff --git a/blocks/news_items/block_news_items.php b/blocks/news_items/block_news_items.php
index 8f46dfadebf..a4d7f3e2fd3 100644
--- a/blocks/news_items/block_news_items.php
+++ b/blocks/news_items/block_news_items.php
@@ -29,46 +29,29 @@ class block_news_items extends block_base {
$text = '';
if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
- return $this->content;
+ return '';
}
+ if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
+ return '';
+ }
+
+ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// First work out whether we can post to this group and if so, include a link
+ $groupmode = groupmode($COURSE, $cm);
+ $currentgroup = get_and_set_current_group($COURSE, $groupmode);
+
- if (has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { /// Teachers can always post
- $visiblegroups = -1;
-
+ if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
$text .= '';
-
- } else { /// Check the group situation
- $currentgroup = get_current_group($COURSE->id);
-
- if (forum_user_can_post_discussion($forum, $currentgroup)) {
- $text .= '';
- }
-
- if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
- $this->content->text = $text;
- return $this->content;
- }
-
- $groupmode = groupmode($COURSE, $cm);
-
- /// Decides if current user is allowed to see ALL the current discussions or not
-
- if (!$currentgroup and ($groupmode != SEPARATEGROUPS) ) {
- $visiblegroups = -1;
- } else {
- $visiblegroups = $currentgroup;
- }
}
/// Get all the recent discussions we're allowed to see
if (! $discussions = forum_get_discussions($forum->id, 'p.modified DESC', 0, false,
- $visiblegroups, $COURSE->newsitems) ) {
+ $currentgroup, $COURSE->newsitems) ) {
$text .= '('.get_string('nonews', 'forum').')';
$this->content->text = $text;
return $this->content;
diff --git a/blocks/online_users/block_online_users.php b/blocks/online_users/block_online_users.php
index 389c900ae38..fc019867bb4 100644
--- a/blocks/online_users/block_online_users.php
+++ b/blocks/online_users/block_online_users.php
@@ -43,7 +43,7 @@ class block_online_users extends block_base {
&& !has_capability('moodle/site:accessallgroups', $context));
//Get the user current group
- $currentgroup = $isseparategroups ? get_current_group($COURSE->id) : NULL;
+ $currentgroup = $isseparategroups ? get_and_set_current_group($COURSE, groupmode($COURSE)) : NULL;
$groupmembers = "";
$groupselect = "";
@@ -51,7 +51,7 @@ class block_online_users extends block_base {
//Add this to the SQL to show only group users
if ($currentgroup !== NULL) {
$groupmembers = ', '.groups_members_from_sql(); //TODO: ", {$CFG->prefix}groups_members gm ";
- $groupselect .= groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
+ $groupselect = ' AND '.groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
}
if ($COURSE->id == SITEID) { // Site-level
diff --git a/blocks/rss_client/db/mysql.sql b/blocks/rss_client/db/mysql.sql
deleted file mode 100644
index fd41951d1ed..00000000000
--- a/blocks/rss_client/db/mysql.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-# This file contains a complete database schema for all the
-# tables used by this module, written in SQL
-
-# It may also contain INSERT statements for particular data
-# that may be used, especially new entries in the table log_display
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `prefix_block_rss_client`
-#
-
-CREATE TABLE prefix_block_rss_client (
- `id` int(11) NOT NULL auto_increment,
- `userid` int(11) NOT NULL default '0',
- `title` text NOT NULL default '',
- `preferredtitle` varchar(64) NOT NULL default '',
- `description` text NOT NULL default '',
- `shared` int(2) NOT NULL default '0',
- `url` varchar(255) NOT NULL default '',
-PRIMARY KEY (`id`)
-) TYPE=MyISAM COMMENT='Remote news feed information. Contains the news feed id, the userid of the user who added the feed, the title of the feed itself and a description of the feed contents along with the url used to access the remote feed. Preferredtitle is a field for future use - intended to allow for custom titles rather than those found in the feed.';
\ No newline at end of file
diff --git a/blocks/rss_client/db/postgres7.sql b/blocks/rss_client/db/postgres7.sql
deleted file mode 100644
index 7cd0a8793e7..00000000000
--- a/blocks/rss_client/db/postgres7.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-# $Id$
-# This file contains a complete database schema for all the
-# tables used by this module, written in SQL
-
-# It may also contain INSERT statements for particular data
-# that may be used, especially new entries in the table log_display
-
-#
-# Table structure for table `block_rss_client`
-#
-
-CREATE TABLE prefix_block_rss_client (
- id SERIAL PRIMARY KEY,
- userid INTEGER NOT NULL default '0',
- title text NOT NULL default '',
- preferredtitle varchar(64) NOT NULL default '',
- description text NOT NULL default '',
- shared INTEGER NOT NULL default '0',
- url varchar(255) NOT NULL default ''
-);
diff --git a/course/grades.php b/course/grades.php
index 64c93076456..33928b17dd9 100644
--- a/course/grades.php
+++ b/course/grades.php
@@ -22,11 +22,8 @@
$stractivityreport = get_string("activityreport");
/// Check to see if groups are being used in this course
- if ($groupmode = groupmode($course)) { // Groups are being used
- $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
- } else {
- $currentgroup = false;
- }
+ $groupmode = groupmode($course);
+ $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
/// Get a list of all students
if ($currentgroup) {
@@ -308,7 +305,6 @@
$options["download"] = "xls";
print_single_button("grades.php", $options, get_string("downloadexcel"));
echo "";
- $options = array();
$options["download"] = "txt";
print_single_button("grades.php", $options, get_string("downloadtext"));
echo "";
diff --git a/course/group-edit.html b/course/group-edit.html
deleted file mode 100644
index 2c3cd954e20..00000000000
--- a/course/group-edit.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
diff --git a/course/group.php b/course/group.php
deleted file mode 100644
index 96e14e4713e..00000000000
--- a/course/group.php
+++ /dev/null
@@ -1,85 +0,0 @@
-id);
-
- if (! $group = get_record("groups", "id", $group, "courseid", $course->id)) {
- notice('Specified group could not be found!', "#");
- close_window_button();
- }
-
- // this is fine since group inherits course settings, this allows 1) teacher to edit all groups
- // 2 someone with a role with a cap to modify a specific group
- $context = get_context_instance(CONTEXT_GROUP, $group->id);
-
- // this is really weird
- if (!has_capability('moodle/course:managegroups', $context)) {
- close_window();
- }
-
-/// Print the headers of the page
-
- print_header(get_string('groupinfoedit').' : '.$group->name);
-
-
-/// If data submitted, then process and store.
-
- if ($form = data_submitted() and confirm_sesskey()) {
-
- if (empty($form->name)) {
- $err['name'] = get_string("missingname");
-
- } else {
- require_once($CFG->dirroot.'/lib/uploadlib.php');
-
- $um = new upload_manager('imagefile',false,false,null,false,0,true,true);
- if ($um->preprocess_files()) {
- require_once("$CFG->libdir/gdlib.php");
-
- if (save_profile_image($group->id, $um, 'groups')) {
- $group->picture = 1;
- }
- }
-
- // Setting a new object in order to avoid updating other columns for the record,
- // which could lead to SQL injection vulnerabilities.
-
- // Be VERY sure to sanitize all parameters that go into $dataobj!
-
- $dataobj = new stdClass;
- $dataobj->id = $group->id;
- $dataobj->name = clean_text($form->name);
- $dataobj->description = clean_text($form->description);
- $dataobj->hidepicture = empty($form->hidepicture) ? 0 : 1;
- $dataobj->password = required_param('password', PARAM_ALPHANUM);
- $dataobj->picture = $group->picture;
- if (!update_record('groups', $dataobj)) {
- notify("A strange error occurred while trying to save");
- } else {
- notify(get_string('changessaved'));
- }
- close_window(3);
- }
- }
-
-
- $usehtmleditor = false;
-
- include('group-edit.html');
-
- echo " |