]> git.mjollnir.org Git - moodle.git/commitdiff
Changes related to internationalision strings and printing them
authormartin <martin>
Thu, 11 Jul 2002 05:30:57 +0000 (05:30 +0000)
committermartin <martin>
Thu, 11 Jul 2002 05:30:57 +0000 (05:30 +0000)
17 files changed:
index.php
lang/en/strings.php
lib/weblib.php
login/change_password.php
login/change_password_form.html
login/confirm.php
login/forgot_password.php
login/forgot_password_change.html [deleted file]
login/forgot_password_form.html
login/index.php
login/index_confirm.html
login/index_form.html
login/signup.php
login/signup_confirm.html [deleted file]
login/signup_form.php
user/edit.html
user/edit.php

index aa6ba51e663ec39081eb0ce6f15e48571dfb5bc7..c455013755e5e40c24356b005a3b4fbf4407d25c 100644 (file)
--- 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/");
     }
 
index edf662201b3ba8e5775eb3545610eff6670c0785..768efbcc4d4e1ff7cadead9c5d5bdb7174e84d9e 100644 (file)
@@ -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] = "
    <P>An email should have been sent to your address at <B>\$a</B>
    <P>It contains easy instructions to complete your registration.
    <P>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
    &quot;enrolment key&quot;, which you won't need until later. Here are
    the steps:
@@ -60,13 +91,53 @@ $string[loginsteps] = "
    </OL>";
 $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] = "
+   <P>An email has been sent to your address at \$a->email.
+   <P><B>Please check your email for your new password</B>
+   <P>The new password was automatically generated, so you might like to
+   <A HREF=\$a->link>change it to something easier to remember</A>.";
 $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";
 
 ?>
index 2efda8dd988d35976bb0229ab9f642f206daf50f..376a821f271f1dd66ab79c266c8a019d9a9d52e1 100644 (file)
@@ -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
index c3d601ae99c1b8e2099b84d37b4d6c7450e76578..8181b73c20c095fca84c3d897f0d69c5d89fbdd6 100644 (file)
@@ -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();
 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;
 }
index e66953c403715150be61a47b633a647ee5a9ebdf..cf52bd918f09fdeba83335240e6cbb327d52ddff 100644 (file)
@@ -1,33 +1,33 @@
-<P><B>All fields are required</B></P>
+<P><B><? print_string("allfieldsrequired") ?></B></P>
 
 <form name="form" method="post" action="change_password.php">
 <table cellpadding=10>
 <tr valign=top>
-       <td><P>Username:</P></td>
-       <td><input type="text" name="username" size=25 value="<? pv($frm->username) ?>">
+       <td><P><? print_string("username") ?>:</P></td>
+       <td><input type="text" name="username" size=25 value="<? p($frm->username) ?>">
        <? formerr($err->username) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>Password:</P></td>
-       <td><input type="text" name="password" size=25 value="<? pv($frm->password) ?>">
+       <td><P><? print_string("password") ?>:</P></td>
+       <td><input type="text" name="password" size=25 value="<? p($frm->password) ?>">
        <? formerr($err->password) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>New Password:</P></td>
-       <td><input type="text" name="newpassword1" size=25 value="<? pv($frm->newpassword1) ?>">
+       <td><P><? print_string("newpassword") ?>:</P></td>
+       <td><input type="text" name="newpassword1" size=25 value="<? p($frm->newpassword1) ?>">
        <? formerr($err->newpassword1) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>New Password (again):</P></td>
-       <td><input type="text" name="newpassword2" size=25 value="<? pv($frm->newpassword2) ?>">
+       <td><P><? print_string("newpassword") ?> (<? print_string("again") ?>):</P></td>
+       <td><input type="text" name="newpassword2" size=25 value="<? p($frm->newpassword2) ?>">
        <? formerr($err->newpassword2) ?>
        </td>
 </tr>
 <tr>
        <td></td>
-       <td><input type="submit" value="Change Password"></td>
+       <td><input type="submit" value="<? print_string("changepassword") ?>"></td>
 </table>
 </form>
index 27a9ca490fd69034c23de4a704cc0016d750b8eb..869f2bea82e0b94093b19d7dfd62c2fa15b104d3 100644 (file)
                        if ($user->username == $s) {
 
                 if ($user->confirmed) {
-                                   print_header("Registration already confirmed", "Already confirmed", "Confirmed", "");
-                                   echo "<CENTER><H3>Thanks, ". $USER->firstname ." ". $USER->lastname . "</H3>\n";
-                           echo "<H4>Your registration has already been confirmed.</H4>\n";
-                           echo "<H3><A HREF=\"$CFG->wwwroot/course/\">Proceed to the courses</A></H3>\n";
+                                   print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), "", "");
+                                   echo "<CENTER><H3>".get_string("thanks").", ". $USER->firstname ." ". $USER->lastname . "</H3>\n";
+                           echo "<H4>".get_string("alreadyconfirmed")."</H4>\n";
+                           echo "<H3><A HREF=\"$CFG->wwwroot/course/\">".get_string("courses")."</A></H3>\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);
 
                                        redirect("$goto");
                        }
  
-                               print_header("Registration confirmed", "Confirmed", "Confirmed", "");
-                               echo "<CENTER><H3>Thanks, ". $USER->firstname ." ". $USER->lastname . "</H3>\n";
-                       echo "<H4>Your registration is now confirmed.</H4>\n";
-                       echo "<H3><A HREF=\"$CFG->wwwroot/course/\">Show me the courses</A></H3>\n";
+                               print_header(get_string("confirmed"), get_string("confirmed"), "", "");
+                               echo "<CENTER><H3>".get_string("thanks").", ". $USER->firstname ." ". $USER->lastname . "</H3>\n";
+                       echo "<H4>".get_string("confirmed")."</H4>\n";
+                       echo "<H3><A HREF=\"$CFG->wwwroot/course/\">".get_string("courses")."</A></H3>\n";
                                print_footer();
+
                        } else {
                                error("Invalid confirmation data");
                        }
index bcf0c0a91d6ed076d80f1afadaf755037243ccb3..3a10783bab68ddf2255f88a447e6aa0c9add0a56 100644 (file)
             }
 
                        reset_login_count();
-               print_header("Password has been sent", "Password has been sent", "Password Sent", "");
-               include("forgot_password_change.html");
+               print_header(get_string("passwordsent"), get_string("passwordsent"), get_string("passwordsent"));
+            echo "<CENTER>";
+            $a->email = $frm->email;
+            $a->link = "$CFG->wwwroot/login/change_password.php";
+               print_string("passwordsenttext", "", $a);
+            echo "</CENTER>";
+            print_footer();
                        exit;
                }
        }
                }
        }
 
-       print_header("Email your login details", "Email your login details", "<A HREF=\"$CFG->wwwroot/login\">Login</A> -> Email username and password", "form.email");
-
+       print_header(get_string("senddetails"), get_string("senddetails"), 
+                 "<A HREF=\"$CFG->wwwroot/login\">".get_string("login")."</A> -> ".get_string("senddetails"), 
+                 "form.email");
        include("forgot_password_form.html");
+    print_footer();
 
 
 /******************************************************************************
 function validate_form($frm, &$err) {
 
     if (empty($frm->email))
-        $err->email = "Missing email address";
+        $err->email = get_string("missingemail");
 
     else if (! validate_email($frm->email))
-        $err->email = "Invalid email address";
+        $err->email = get_string("invalidemail");
 
     else if (! record_exists("user", "email", $frm->email))
-        $err->email = "No such email address on file";
+        $err->email = get_string("nosuchemail");
 
 }
 
@@ -69,34 +76,19 @@ function reset_password_and_mail($user) {
         error("Could not set user password!");
     }
 
-    $message  = "Hi $user->firstname,\n\n";
-
-    $message .= "Your account password at '$site->fullname' has been reset\n";
-    $message .= "and you have been issued with a new temporary password.\n\n";
-
-    $message .= "Your current login information is now:\n\n";
-
-    $message .= "   username: $user->username\n";
-    $message .= "   password: $newpassword\n\n";
-
-    $message .= "Please go to this page to change your password:\n\n";
+    $a->firstname = $user->firstname;
+    $a->sitename = $site->fullname;
+    $a->username = $user->username;
+    $a->newpassword = $newpassword;
+    $a->link = "$CFG->wwwroot/login/change_password.php";
+    $a->signoff = "$from->firstname $from->lastname ($from->email)";
 
-    $message .= "$CFG->wwwroot/login/change_password.php\n\n";
+    $message = get_string("newpasswordtext", "", $a);
 
-    $message .= "In most mail programs, this should appear as a blue link\n";
-    $message .= "which you can just click on.  If that doesn't work, \n";
-    $message .= "then cut and paste the address into the address\n";
-    $message .= "line at the top of your web browser window.\n\n";
-
-    $message .= "Cheers from the '$site->fullname' administrator,\n";
-    $message .= "$from->firstname $from->lastname ($from->email)\n";
-
-    $subject  = "$site->fullname: Changed password";
+    $subject  = "$site->fullname: ".get_string("changedpassword");
 
     return email_to_user($user, $from, $subject, $message);
 
 }
 
-
-
 ?>
diff --git a/login/forgot_password_change.html b/login/forgot_password_change.html
deleted file mode 100644 (file)
index bff2199..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<CENTER>
-
-<P>An email has been sent to your address at <? pv($frm->email) ?> </P>
-
-<P><B>Please check your email for your new password</B>
-
-<P>The new password was automatically generated, so you might like to 
-   <A HREF="<?=$CFG->wwwroot ?>/login/change_password.php">change it to something easier to remember</A>.
-</P>
-
-<HR>
-<CENTER>
-<P><A HREF="<?=$CFG->wwwroot ?>">Home</A></P>
-
-
index 93bacaae6a3ed9eef2a5a6c01cfdfcc899af335d..8a1b2d2ae2456001cbb1fad2f6a5dcbdfaab0a4e 100644 (file)
@@ -1,25 +1,20 @@
 <table cellpadding=20 align=center>
 <tr valign=top>
 <td width=300 class=normal>
-       <p>Enter in your email address to reset your password, and 
-       have the new password sent to you via email.
-
-       <p>Otherwise, you can return to the 
-       <a href="<?=$CFG->wwwroot ?>/login/">login screen</a> or the
-       <a href="<?=$CFG->wwwroot ?>">home page</a> now.
+       <p><? print_string("enteremailaddress") ?>
 </td>
 
 <td bgcolor="<?=$THEME->cellheading?>">
        <form name="form" method="post" action="<?=$ME?>">
        <table>
        <tr>
-               <td class=label>Email:</td>
-               <td><input type="text" name="email" size=25 value="<? pv($frm->email) ?>"> 
+               <td class=label><? print_string("email") ?>:</td>
+               <td><input type="text" name="email" size=25 value="<? p($frm->email) ?>"> 
                <? formerr($err->email); ?>
        </tr>
        <tr>
                <td></td>
-               <td><input type="submit" value="Submit">
+               <td><input type="submit" value="<? print_string("ok") ?>">
                        <input type="button" value="Cancel" onClick="javascript: history.go(-1)">
                </td>
        </table>
@@ -28,7 +23,3 @@
 </tr>
 </table>
 
-<HR>
-<CENTER>
-<P><A HREF="<?=$CFG->wwwroot ?>">Home</A></P>
-
index ab73b0b7a268232925ff10b2248264d1ae332ff5..0319c998e12b8aeb71e59adaf7cf625c16b0f63f 100644 (file)
@@ -30,6 +30,7 @@
             if (! $user->confirmed ) {       // they never confirmed via email 
                 print_header(get_string("mustconfirm"), get_string("mustconfirm") ); 
                 include("index_confirm.html");
+                print_footer();
                 die;
             }
     
@@ -79,8 +80,8 @@
     $loginsite = get_string("loginsite");
 
     print_header($loginsite, $loginsite, get_string("login"), $focus); 
-
     include("index_form.html");
+    print_footer();
 
     exit;
 
index e3327aaf040ad879358ba473528096aae88dab35..e7700b67608898fdb1d4ed7d136c9478d5a8b251 100644 (file)
@@ -1,7 +1,4 @@
 <CENTER>
 <H2><? print_string("mustconfirm") ?></H2>
 <? print_string("emailconfirmsent", "", $user->email) ?>
-<HR>
-<P><A HREF="<?=$CFG->wwwroot ?>"><? print_string("home") ?></A></P>
-</CENTER>
 
index 89ad7e5cd24b5b80ab3af99005eb207c63b26116..18a61b2c9ce39df9c8bc02a6c1e9b49cab67a477 100644 (file)
@@ -69,7 +69,3 @@
       </TD>\r
   </TR>\r
 </TABLE>\r
-\r
-<HR>\r
-<CENTER>\r
-<P><A HREF="<?=$CFG->wwwroot ?>"><? print_string("home") ?></A></P>\r
index ada95adcc1ce18fb83e10bda118a83cb98cc9f99..5e381dbc54cc41dfd2a5b983538860fc8bc97d9d 100644 (file)
                 error("Tried to send you an email but failed!");
             }
        
-               print_header("Check your email", "Check your email", "Confirm", "");
-                       include("signup_confirm.html");
+            $emailconfirm = get_string("emailconfirm");
+               print_header($emailconfirm, $emailconfirm, $emailconfirm);
+            print_string("emailconfirmsent", "", $user->email);
+            print_footer();
                        exit;
                }
        }
                }
        }
 
-       print_header("New account", "New account", 
-                 "<A HREF=\".\">Login</A> -> New Account", $focus);
+    $newaccount = get_string("newaccount");
+    $login = get_string("login");
 
+       print_header($newaccount, $newaccount, "<A HREF=\".\">$login</A> -> $newaccount", $focus);
        include("signup_form.php");
+    print_footer();
 
 
 
 function validate_form($user, &$err) {
 
        if (empty($user->username))
-               $err->username = "Missing username";
+               $err->username = get_string("missingusername");
 
     else if (record_exists("user", "username", $user->username))
-        $err->username = "This username already exists, choose another";
+        $err->username = get_string("usernameexists");
 
     else {
         $string = eregi_replace("[^([:alnum:])]", "", $user->username);
         if (strcmp($user->username, $string)) 
-            $err->username = "Must only contain alphabetical characters";
+            $err->username = get_string("alphanumerical");
     }
 
 
        if (empty($user->password)) 
-               $err->password = "Missing password";
+               $err->password = get_string("missingpassword");
 
     if (empty($user->firstname))
-        $err->firstname = "Missing first name";
+        $err->firstname = get_string("missingfirstname");
         
     if (empty($user->lastname))
-        $err->lastname = "Missing last name";
+        $err->lastname = get_string("missinglastname");
         
 
     if (empty($user->email))
-        $err->email = "Missing email address";
+        $err->email = get_string("missingemail");
         
     else if (! validate_email($user->email))
-        $err->email = "Invalid email address, check carefully";
+        $err->email = get_string("invalidemail");
        
     else if (record_exists("user", "email", $user->email)) 
-               $err->email = "Email address already registered. <A HREF=forgot_password.php>New password?</A>";
+               $err->email = get_string("emailexists")."<A HREF=forgot_password.php>".get_string("newpassword")."</A>";
 
 
        if (empty($user->city)) 
-               $err->city = "Missing city";
+               $err->city = get_string("missingcity");
 
        if (empty($user->country)) 
-               $err->country = "Missing country";
+               $err->country = get_string("missingcountry");
 
     return;
 }
@@ -94,28 +98,16 @@ function send_confirmation_email($user) {
 
     global $CFG;
 
-    $site  = get_site();
+    $site = get_site();
     $from = get_admin();
 
-    $message  = "Hi $user->firstname,\n\n";
+    $data->firstname = $user->firstname;
+    $data->sitename = $site->fullname;
+    $data->link = "$CFG->wwwroot/login/confirm.php?x=$user->id&s=$user->username";
+    $data->admin = "$from->firstname $from->lastname ($from->email)";
 
-    $message .= "A new account has been requested at '$site->fullname'\n";
-    $message .= "using your email address.\n\n";
-
-    $message .= "To confirm your new account, please go to the \n";
-    $message .= "following web address:\n\n";
-
-    $message .= "$CFG->wwwroot/login/confirm.php?x=$user->id&s=$user->username\n\n";
-
-    $message .= "In most mail programs, this should appear as a blue link\n";
-    $message .= "which you can just click on.  If that doesn't work, \n";
-    $message .= "then cut and paste the address into the address\n";
-    $message .= "line at the top of your web browser window.\n\n";
-
-    $message .= "Cheers from the '$site->fullname' administrator,\n";
-    $message .= "$from->firstname $from->lastname ($from->email)\n";
-
-    $subject  = "$site->fullname account confirmation";
+    $message = get_string("emailconfirmation", "", $data);
+    $subject = "$site->fullname account confirmation";
 
     return email_to_user($user, $from, $subject, $message);
 
diff --git a/login/signup_confirm.html b/login/signup_confirm.html
deleted file mode 100644 (file)
index a4a8203..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<CENTER>
-
-<h2>Thanks, <? pv($user->firstname) ?></h2>
-<h2>Your new account is almost finished</h2>
-
-<h2>Please check your email!</h2>
-
-<p class=normal>
-An email has been sent to your address at <? pv($user->email) ?>
-
-</p>
-<p class=normal>
-It contains easy instructions to confirm your new account.
-</p>
-
-<HR>
-<CENTER>
-<P><A HREF="<?=$CFG->wwwroot ?>">Home</A></P>
-
index 1acfe5d87a95721c6448bbc63a87d4b4eb3c899d..b3f933786e7a2ae163082e006f3aa2aa54487482 100644 (file)
@@ -7,14 +7,14 @@
        <td colspan=2><P><B>Create a new username and password to log in with:</td>
 </tr>
 <tr valign=top>
-       <td><P>New username:</td>
-       <td><input type="text" name="username" size=12 value="<? pv($user->username) ?>">
+       <td><P><? print_string("username") ?>:</td>
+       <td><input type="text" name="username" size=12 value="<? p($user->username) ?>">
        <? formerr($err->username) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>New password:</td>
-       <td><input type="text" name="password" size=12 value="<? pv($user->password) ?>">
+       <td><P><? print_string("password") ?>:</td>
+       <td><input type="text" name="password" size=12 value="<? p($user->password) ?>">
        <? formerr($err->password) ?>
        </td>
 </tr>
        <td colspan=2><BR><P><B>Please supply some information about yourself:</B><BR>(Note: your email address must be a real one)</P>
 </tr>
 <tr valign=top>
-       <td><P>Email address:</td>
-       <td><input type="text" name="email" size=25 value="<? pv($user->email) ?>">
+       <td><P><? print_string("email") ?>:</td>
+       <td><input type="text" name="email" size=25 value="<? p($user->email) ?>">
        <? formerr($err->email) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>First name:</td>
-       <td><input type="text" name="firstname" size=25 value="<? pv($user->firstname) ?>">
+       <td><P><? print_string("firstname") ?>:</td>
+       <td><input type="text" name="firstname" size=25 value="<? p($user->firstname) ?>">
        <? formerr($err->firstname) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>Last name:</td>
-       <td><input type="text" name="lastname" size=25 value="<? pv($user->lastname) ?>">
+       <td><P><? print_string("lastname") ?>:</td>
+       <td><input type="text" name="lastname" size=25 value="<? p($user->lastname) ?>">
        <? formerr($err->lastname) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>ID Number:</td>
-       <td><input type="text" name="idnumber" size=25 value="<? pv($user->idnumber) ?>"> (optional)
+       <td><P><? print_string("idnumber") ?>:</td>
+       <td><input type="text" name="idnumber" size=25 value="<? p($user->idnumber) ?>"> (optional)
        <? formerr($err->idnumber) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>Phone number:</td>
-       <td><input type="text" name="phone" size=25 value="<? pv($user->phone) ?>"> (optional)
+       <td><P><? print_string("phone") ?>:</td>
+       <td><input type="text" name="phone" size=25 value="<? p($user->phone) ?>"> (optional)
        <? formerr($err->phone) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>City or town:</td>
-       <td><input type="text" name="city" size=25 value="<? pv($user->city) ?>">
+       <td><P><? print_string("city") ?>:</td>
+       <td><input type="text" name="city" size=25 value="<? p($user->city) ?>">
        <? formerr($err->city) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P>Country:</td>
-       <td><? choose_from_menu ($COUNTRIES, "country", $user->country, "Select a country...", "", "") ?>
+       <td><P><? print_string("country") ?>:</td>
+       <td><? choose_from_menu ($COUNTRIES, "country", $user->country, get_string("selectacountry"), "", "") ?>
        <? formerr($err->country) ?>
        </td>
 </tr>
 <tr>
        <td></td>
-       <td><input type="submit" value="Create my new account"></td>
+       <td><input type="submit" value="<? print_string("createaccount") ?>"></td>
 </table>
 </form>
 
 </td></tr></table>
 
-<HR>
-<CENTER>
-<P><A HREF="<?=$CFG->wwwroot ?>">Home</A></P>
-
index 5718a6cedc26d047f06ee99b1eb1fab776968d56..f2e2b74f4dbd298740b7d05e5f2eca4f24dd5570 100644 (file)
@@ -1,7 +1,7 @@
 <FORM METHOD="post" ENCTYPE="multipart/form-data" action="edit.php">
 <table cellpadding=9 cellspacing=0 >
 <tr valign=top>
-       <td><P><? echo get_string("newpicture") ?>:</td>
+       <td><P><? print_string("newpicture") ?>:</td>
        <td>
     <INPUT type="hidden" name="MAX_FILE_SIZE" value="4000000">
     <input type="file" name="imagefile" size=40> ( .jpg / .png ) <? helpbutton("picture") ?>
@@ -9,19 +9,19 @@
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("userdescription") ?>:</td>
-       <td><TEXTAREA NAME=description COLS=50 ROWS=10 WRAP=virtual><?=$user->description ?></TEXTAREA> 
+       <td><P><? print_string("userdescription") ?>:</td>
+       <td><TEXTAREA NAME=description COLS=50 ROWS=10 WRAP=virtual><? p($user->description) ?></TEXTAREA> 
     <? helpbutton("text") ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("email") ?>:</td>
-       <td><input type="text" name="email" size=30 value="<?=$user->email ?>">
+       <td><P><? print_string("email") ?>:</td>
+       <td><input type="text" name="email" size=30 value="<? p($user->email) ?>">
        <? formerr($err["email"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("emailformat") ?>:</td>
+       <td><P><? print_string("emailformat") ?>:</td>
        <td><? 
     $choices["0"] = get_string("textformat");
     $choices["1"] = get_string("htmlformat");
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("webpage") ?>:</td>
-       <td><input type="text" name="url" size=30 value="<?=$user->url ?>">
+       <td><P><? print_string("webpage") ?>:</td>
+       <td><input type="text" name="url" size=30 value="<? p($user->url) ?>">
        <? formerr($err["url"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("icqnumber") ?>:</td>
-       <td><input type="text" name="icq" size=25 value="<?=$user->icq ?>">
+       <td><P><? print_string("icqnumber") ?>:</td>
+       <td><input type="text" name="icq" size=25 value="<? p($user->icq) ?>">
        <? formerr($err["icq"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("idnumber") ?>:</td>
-       <td><input type="text" name="idnumber" size=25 value="<?=$user->idnumber ?>"> <?=$teacheronly ?>
+       <td><P><? print_string("idnumber") ?>:</td>
+       <td><input type="text" name="idnumber" size=25 value="<? p($user->idnumber) ?>"> <? p($teacheronly) ?>
        <? formerr($err["idnumber"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("phone") ?> 1:</td>
-       <td><input type="text" name="phone1" size=25 value="<?=$user->phone1 ?>"> <?=$teacheronly ?>
+       <td><P><? print_string("phone") ?> 1:</td>
+       <td><input type="text" name="phone1" size=25 value="<? p($user->phone1) ?>"> <? p($teacheronly) ?>
        <? formerr($err["phone1"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("phone") ?> 2:</td>
-       <td><input type="text" name="phone2" size=25 value="<?=$user->phone2 ?>"> <?=$teacheronly ?>
+       <td><P><? print_string("phone") ?> 2:</td>
+       <td><input type="text" name="phone2" size=25 value="<? p($user->phone2) ?>"> <? p($teacheronly) ?>
        <? formerr($err["phone2"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("address") ?>:</td>
-       <td><input type="text" name="address" size=25 value="<?=$user->address ?>"> <?=$teacheronly ?>
+       <td><P><? print_string("address") ?>:</td>
+       <td><input type="text" name="address" size=25 value="<? p($user->address) ?>"> <? p($teacheronly) ?>
        <? formerr($err["address"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("city") ?>:</td>
-       <td><input type="text" name="city" size=25 value="<?=$user->city ?>">
+       <td><P><? print_string("city") ?>:</td>
+       <td><input type="text" name="city" size=25 value="<? p($user->city) ?>">
        <? formerr($err["city"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("country") ?>:</td>
+       <td><P><? print_string("country") ?>:</td>
        <td><? choose_from_menu ($COUNTRIES, "country", $user->country, get_string("selectacountry")."...", "", "") ?>
        <? formerr($err["country"]) ?>
        </td>
 </tr>
 <tr valign=top>
-       <td><P><? echo get_string("timezone") ?>:</td>
+       <td><P><? print_string("timezone") ?>:</td>
        <td><?
        if (abs($user->timezone) > 12) {
            $user->timezone = 99;
 </tr>
 <tr>
        <td></td>
-       <td><input type="submit" value="<? echo get_string("updatemyprofile") ?>"></td>
+       <td><input type="submit" value="<? print_string("updatemyprofile") ?>"></td>
 </TABLE>
-<INPUT type="hidden" name="course" value="<?=$course->id ?>">
-<INPUT type="hidden" name="id" value="<?=$user->id ?>"> 
+<INPUT type="hidden" name="course" value="<? p($course->id) ?>">
+<INPUT type="hidden" name="id" value="<? p($user->id) ?>"> 
 </FORM>
index 343899b273cdbe5de10886066fcf6cf1dfc4cd1b..0d36c886b769e1db60d85126dc4b02ab247a2369 100644 (file)
     
 /// Otherwise fill and print the form.
 
+    $editmyprofile = get_string("editmyprofile");
+    $participants = get_string("participants");
+
     if ($course->category) {
-           print_header("Edit user profile", "Edit user profile"
+           print_header($editmyprofile, $editmyprofile
                     "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> 
-                    -> <A HREF=\"index.php?id=$course->id\">Participants</A>
+                    -> <A HREF=\"index.php?id=$course->id\">$participants</A>
                     -> <A HREF=\"view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A> 
-                    -> Edit profile", "");
+                    -> $editmyprofile", "");
     } else {
-           print_header("Edit user profile", "Edit user profile", 
+           print_header($editmyprofile, $editmyprofile,
                      "<A HREF=\"view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A> 
-                      -> Edit profile", "");
+                      -> $editmyprofile", "");
     }
 
     $teacher = strtolower($course->teacher);
     $teacheronly = "(".get_string("teacheronly", "", $teacher).")";
 
     print_simple_box_start("center", "", "$THEME->cellheading");
-    echo "<H2>User profile for $user->firstname $user->lastname</H2>";
+    print_heading( get_string("userprofilefor", "", "$user->firstname $user->lastname") );
        include("edit.html");
     print_simple_box_end();
-
     print_footer($course);
 
 
 function find_form_errors(&$user, &$usernew, &$err) {
 
     if (empty($usernew->email))
-        $err["email"] = "Missing email address";
+        $err["email"] = get_string("missingemail");
 
     if (empty($usernew->city))
-        $err["city"] = "Missing city or town";
+        $err["city"] = get_string("missingcity");
 
     if (empty($usernew->country))
-        $err["country"] = "Missing country";
+        $err["country"] = get_string("missingcountry");
 
     else if (! validate_email($usernew->email))
-        $err["email"] = "Invalid email address, check carefully";
+        $err["email"] = get_string("invalidemail");
 
     else if ($otheruser = get_record("user", "email", $usernew->email)) {
         if ($otheruser->id <> $user->id) {
-            $err["email"] = "Email address already in use by someone else.";
+            $err["email"] = get_string("emailexists");
         }
     }