diff --git a/index.php b/index.php
index aa6ba51e663..c455013755e 100644
--- a/index.php
+++ b/index.php
@@ -6,7 +6,7 @@
include("mod/reading/lib.php");
include("mod/forum/lib.php");
- if (! $site = get_record("course", "category", 0)) {
+ if (! $site = get_site()) {
redirect("$CFG->wwwroot/admin/");
}
diff --git a/lang/en/strings.php b/lang/en/strings.php
index edf662201b3..768efbcc4d4 100644
--- a/lang/en/strings.php
+++ b/lang/en/strings.php
@@ -4,24 +4,54 @@
$string[address] = "Address";
$string[admin] = "Admin";
$string[adminpage] = "Admin page";
+$string[again] = "again";
$string[alllogs] = "All logs";
+$string[allfieldsrequired] = "All fields are required";
+$string[alphanumerical] = "Can only contain alphabetical letters or numbers";
+$string[alreadyconfirmed] = "Registration has already been confirmed";
$string[availablecourses] = "Available Courses";
+$string[changepassword] = "Change password";
+$string[changedpassword] = "Changed password";
$string[city] = "City/town";
+$string[confirmed] = "Your registration has been confirmed";
$string[contributions] = "Contributions";
$string[country] = "Country";
$string[course] = "Course";
$string[courses] = "Courses";
+$string[createaccount] = "Create my new account";
$string[currentlocaltime] = "your current local time";
$string[delete] = "Delete";
$string[editmyprofile] = "Edit my profile";
-$string[email] = "Email";
+$string[email] = "Email address";
$string[emailformat] = "Email format";
+$string[emailconfirm] = "Confirm your account";
$string[emailconfirmsent] = "
An email should have been sent to your address at \$a
It contains easy instructions to complete your registration.
If you continue to have difficulty, contact the site administrator.";
+$string[emailconfirmation] = "Hi \$a->firstname,
+A new account has been requested at '\$a->sitename'
+using your email address.
+
+To confirm your new account, please go to the
+following web address:
+
+ \$a->link
+
+In most mail programs, this should appear as a blue link
+which you can just click on. If that doesn't work,
+then cut and paste the address into the address
+line at the top of your web browser window.
+
+Cheers from the '\$a->sitename' administrator,
+\$a->admin";
+
+$string[emailexists] = "This email address is already registered.";
$string[entercourse] = "Click to enter this course";
+$string[enteremailaddress] = "Enter in your email address to reset your
+ password and have the new password sent to you via email.";
+$string[firstname] = "First name";
$string[firsttime] = "Is this your first time here?";
$string[forgotten] = "Forgotten your username or password?";
$string[fullprofile] = "Full profile";
@@ -30,7 +60,9 @@ $string[htmlformat] = "Pretty HTML format";
$string[icqnumber] = "ICQ number";
$string[idnumber] = "ID number";
$string[invalidlogin] = "Invalid login, please try again";
+$string[invalidemail] = "Invalid email address";
$string[lastaccess] = "Last access";
+$string[lastname] = "Last name";
$string[location] = "Location";
$string[loggedinas] = "You are logged in as \$a.";
$string[loggedinnot] = "You are not logged in.";
@@ -39,9 +71,8 @@ $string[loginas] = "Login as";
$string[loginguest] = "Login as a guest";
$string[loginsite] = "Login to the site";
$string[loginusing] = "Login using your username and password";
-$string[loginsteps] = "
- Hi! For full access to courses you'll need to take a minute to create
- a new account for yourself on this web site.
+$string[loginsteps] = "Hi! For full access to courses you'll need to take
+ a minute to create a new account for yourself on this web site.
Each of the individual courses may also have a one-time
"enrolment key", which you won't need until later. Here are
the steps:
@@ -60,13 +91,53 @@ $string[loginsteps] = "
";
$string[logout] = "Logout";
$string[mainmenu] = "Main menu";
+$string[missingcity] = "Missing city/town";
+$string[missingcountry] = "Missing country";
+$string[missingemail] = "Missing email address";
+$string[missingfirstname] = "Missing first name";
+$string[missinglastname] = "Missing last name";
+$string[missingnewpassword] = "Missing new password";
+$string[missingpassword] = "Missing password";
+$string[missingusername] = "Missing username";
$string[movedown] = "Move down";
$string[moveup] = "Move up";
$string[mustconfirm] = "You need to confirm your login";
+$string[newaccount] = "New account";
+$string[newpassword] = "New password";
+$string[newpasswordtext] = "Hi \$a->firstname,
+
+Your account password at '\$a->sitename' has been reset
+and you have been issued with a new temporary password.
+
+Your current login information is now:
+ username: \$a->username
+ password: \$a->newpassword
+
+Please go to this page to change your password:
+ \$a->link
+
+In most mail programs, this should appear as a blue link
+which you can just click on. If that doesn't work,
+then cut and paste the address into the address
+line at the top of your web browser window.
+
+Cheers from the '\$a->sitename' administrator,
+\$a->signoff\n";
+
$string[newpicture] = "New picture";
+$string[nosuchemail] = "No such email address";
$string[notenrolled] = "\$a is not enrolled in this course.";
+$string[ok] = "OK";
$string[participants] = "Participants";
$string[password] = "Password";
+$string[passwordchanged] = "Password has been changed";
+$string[passwordsdiffer] = "These passwords do not match";
+$string[passwordsent] = "Password has been sent";
+$string[passwordsenttext] = "
+
An email has been sent to your address at \$a->email.
+
Please check your email for your new password
+
The new password was automatically generated, so you might like to
+ link>change it to something easier to remember.";
$string[personalprofile] = "Personal profile";
$string[phone] = "Phone";
$string[returningtosite] = "Returning to this web site?";
@@ -81,6 +152,7 @@ $string[startsignup] = "Start now by creating a new account!";
$string[teacheronly] = "for the \$a only";
$string[textformat] = "Plain text format";
$string[timezone] = "Timezone";
+$string[thanks] = "Thanks";
$string[todaylogs] = "Today's logs";
$string[unenrol] = "Unenrol";
$string[unenrolme] = "Unenrol me from \$a";
@@ -88,6 +160,9 @@ $string[update] = "Update";
$string[updatemyprofile] = "Update my profile";
$string[userdescription] = "Description";
$string[username] = "Username";
+$string[usernameexists] = "This username already exists, choose another";
+$string[userprofilefor] = "User profile for \$a";
$string[webpage] = "Web page";
+$string[wrongpassword] = "Incorrect password for this username";
?>
diff --git a/lib/weblib.php b/lib/weblib.php
index 2efda8dd988..376a821f271 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -6,29 +6,7 @@
//
//
-function nvl(&$var, $default="") {
-// if $var is undefined, return $default, otherwise return $var
-
- return isset($var) ? $var : $default;
-}
-
-function ov(&$var) {
-// returns $var with the HTML characters (like "<", ">", etc.) properly quoted,
-// or if $var is undefined, will return an empty string. note this function
-// must be called with a variable, for normal strings or functions use o()
-
- return isset($var) ? htmlSpecialChars(stripslashes($var)) : "";
-}
-
-function pv(&$var) {
-// prints $var with the HTML characters (like "<", ">", etc.) properly quoted,
-// or if $var is undefined, will print an empty string. note this function
-// must be called with a variable, for normal strings or functions use p()
-
- echo isset($var) ? htmlSpecialChars(stripslashes($var)) : "";
-}
-
-function o($var) {
+function s($var) {
// returns $var with HTML characters (like "<", ">", etc.) properly quoted,
// or if $var is empty, will return an empty string.
@@ -42,6 +20,11 @@ function p($var) {
echo empty($var) ? "" : htmlSpecialChars(stripslashes($var));
}
+function nvl(&$var, $default="") {
+// if $var is undefined, return $default, otherwise return $var
+
+ return isset($var) ? $var : $default;
+}
function strip_querystring($url) {
// takes a URL and returns it without the querystring portion
@@ -56,11 +39,10 @@ function strip_querystring($url) {
function get_referer() {
// returns the URL of the HTTP_REFERER, less the querystring portion
- $HTTP_REFERER = getenv("HTTP_REFERER");
- return strip_querystring(nvl($HTTP_REFERER));
+ $HTTP_REFERER = getenv("HTTP_REFERER");
+ return strip_querystring(nvl($HTTP_REFERER));
}
-
function me() {
// returns the name of the current script, WITH the querystring portion.
// this function is necessary because PHP_SELF and REQUEST_URI and PATH_INFO
diff --git a/login/change_password.php b/login/change_password.php
index c3d601ae99c..8181b73c20c 100644
--- a/login/change_password.php
+++ b/login/change_password.php
@@ -28,8 +28,9 @@
reset_login_count();
- print_header("Changed password", "Password changed successfully", "Changed Password", "");
- notice("Password changed successfully", "$CFG->wwwroot/course/");
+ $passwordchanged = get_string("passwordchanged");
+ print_header($passwordchanged, $passwordchanged, $passwordchanged, "");
+ notice($passwordchanged, "$CFG->wwwroot/course/");
print_footer();
exit;
}
@@ -46,8 +47,8 @@
$focus = "form.username";
}
-
- print_header("Change password", "Change Password", "Change Password", "$focus");
+ $changepassword = get_string("changepassword");
+ print_header($changepassword, $changepassword, $changepassword, $focus);
print_simple_box_start("center", "", $THEME->cellheading);
include("change_password_form.html");
print_simple_box_end();
@@ -62,22 +63,22 @@
function validate_form($frm, &$err) {
if (empty($frm->username))
- $err->username = "Missing username";
+ $err->username = get_string("missingusername");
else if (empty($frm->password))
- $err->password = "Missing password";
+ $err->password = get_string("missingpassword");
else if (!verify_login($frm->username, $frm->password))
- $err->password = "Incorrect password for this username";
+ $err->password = get_string("wrongpassword");
if (empty($frm->newpassword1))
- $err->newpassword1 = "Missing new password";
+ $err->newpassword1 = get_string("missingnewpassword");
if (empty($frm->newpassword2))
- $err->newpassword2 = "Missing new password";
+ $err->newpassword2 = get_string("missingnewpassword");
else if ($frm->newpassword1 <> $frm->newpassword2)
- $err->newpassword2 = "Passwords not the same";
+ $err->newpassword2 = get_string("passwordsdiffer");
return;
}
diff --git a/login/change_password_form.html b/login/change_password_form.html
index e66953c4037..cf52bd918f0 100644
--- a/login/change_password_form.html
+++ b/login/change_password_form.html
@@ -1,33 +1,33 @@
-
\n";
print_footer();
exit;
}
@@ -25,7 +25,9 @@
$rs = $db->Execute("UPDATE user SET confirmed=1, lastIP='$REMOTE_ADDR',
firstaccess='$timenow', lastaccess='$timenow'
WHERE id = '$USER->id' ");
- if (!$rs) error("Could not update this user while confirming");
+ if (!$rs) {
+ error("Could not update this user while confirming");
+ }
set_moodle_cookie($USER->username);
@@ -37,11 +39,12 @@
redirect("$goto");
}
- print_header("Registration confirmed", "Confirmed", "Confirmed", "");
- echo "