Changeset 985
- Timestamp:
- 02/20/07 15:20:41 (2 years ago)
- Files:
-
- devel/_invite/new_password.php (modified) (1 diff)
- devel/config-dist.php (modified) (2 diffs)
- devel/lib/elgglib.php (modified) (1 diff)
- devel/lib/setup.php (modified) (1 diff)
- devel/mod/template/templates/Default_Template/css (modified) (6 diffs)
- devel/units/communities/userdetails_actions.php (modified) (1 diff)
- devel/units/gettext/library.php (modified) (1 diff)
- devel/units/invite/new_password.php (modified) (1 diff)
- devel/units/invite/password_request.php (modified) (3 diffs)
- devel/units/users/userdetails_actions.php (modified) (2 diffs)
- devel/units/users/userdetails_edit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/_invite/new_password.php
r796 r985 8 8 9 9 run("invite:init"); 10 templates_page_setup(); 10 templates_page_setup(); 11 11 $title = sprintf(__gettext("Get new %s password"), sitename); 12 12 devel/config-dist.php
r942 r985 198 198 $CFG->curlpath = false; 199 199 200 // Whether to prevent users from changing their passwords. 201 // For use with an external authentication system that doesn't look at the elgg user's password. 202 // You'll probably want to disable registration and invites too. 203 $CFG->disable_passwordchanging = false; 200 204 201 205 // Some other $CFG variables found in codebase. … … 204 208 // $CFG->admin 205 209 // $CFG->allowobjectembed // boolean - whether to allow <object> and <embed> tags through input-cleaning 206 // $CFG->auth 210 // $CFG->auth // string - which auth plugin to use 207 211 // $CFG->cachetext 208 212 // $CFG->currenttextiscacheable devel/lib/elgglib.php
r983 r985 4178 4178 * @return integer 4179 4179 */ 4180 function page_owner() {4181 4182 static $owner, $called;4183 if (!$called) {4184 4185 $owner = optional_param('owner',-1,PARAM_INT);4186 if ($allmods = get_list_of_plugins('mod') ) {4187 foreach ($allmods as $mod) {4188 $mod_page_owner = $mod . '_page_owner';4189 if (function_exists($mod_page_owner)) {4190 if ($value = $mod_page_owner()) {4191 4192 $owner = $value;4193 4194 }4195 }4196 }4197 }4198 $called = true;4199 }4200 4201 return $owner;4202 }4180 function page_owner() { 4181 4182 static $owner, $called; 4183 if (!$called) { 4184 4185 $owner = optional_param('owner',-1,PARAM_INT); 4186 if ($allmods = get_list_of_plugins('mod') ) { 4187 foreach ($allmods as $mod) { 4188 $mod_page_owner = $mod . '_page_owner'; 4189 if (function_exists($mod_page_owner)) { 4190 if ($value = $mod_page_owner()) { 4191 4192 $owner = $value; 4193 4194 } 4195 } 4196 } 4197 } 4198 $called = true; 4199 } 4200 4201 return $owner; 4202 } 4203 4203 4204 4204 ?> devel/lib/setup.php
r902 r985 68 68 if (empty($CFG->disable_publiccomments)) { 69 69 $CFG->disable_publiccomments = false; 70 } 71 72 if (empty($CFG->disable_passwordchanging)) { 73 $CFG->disable_passwordchanging = false; 70 74 } 71 75 devel/mod/template/templates/Default_Template/css
r962 r985 101 101 width:100%; 102 102 height:120px; 103 }103 } 104 104 105 105 /* … … 171 171 overflow:hidden; 172 172 position:relative; 173 }173 } 174 174 175 175 div#content-holder a:hover { … … 240 240 width: 200px; 241 241 margin:0 0 0 20px; 242 }242 } 243 243 244 244 div#splitpane-sidebar ul { … … 255 255 256 256 div#splitpane-sidebar ul li ul li a { 257 padding:0 0 0 5px;257 padding:0 0 0 5px; 258 258 } 259 259 … … 292 292 div#footer a:hover { 293 293 text-decoration:underline; 294 }294 } 295 295 296 296 div#footer a:link, div#footer a:visited { … … 313 313 padding:0px; 314 314 margin:2px; 315 }315 } 316 316 317 317 /* devel/units/communities/userdetails_actions.php
r758 r985 13 13 case "userdetails:update": 14 14 15 $community_owner = trim(optional_param('community_owner')); 16 if (!empty($community_owner)) { 17 if ($new_owner = user_info_username("ident",$community_owner)) { 18 if (user_info("user_type",$new_owner) != "community") { 19 if ($info = get_record('users','ident',$id)) { 20 21 $info->owner = $new_owner; 22 update_record('users',$info); 23 $messages[] = sprintf(__gettext("Community ownership transferred to %s."),$community_owner); 24 25 } else { 26 $messages[] = __gettext("Could not retrieve community details."); 27 } 28 } 29 } 30 } 31 break; 15 $community_owner = trim(optional_param('community_owner')); 16 if (!empty($community_owner)) { 17 if ($new_owner = user_info_username("ident",$community_owner)) { 18 if (user_info("user_type",$new_owner) != "community") { 19 if ($info = get_record('users','ident',$id)) { 20 21 $info->owner = $new_owner; 22 update_record('users',$info); 23 $messages[] = sprintf(__gettext("Community ownership transferred to %s."),$community_owner); 24 25 } else { 26 $messages[] = __gettext("Could not retrieve community details."); 27 } 28 } else { 29 $messages[] = sprintf(__gettext("Could not find new owner %s. Community owner not changed."),$community_owner); 30 } 31 } 32 } 33 break; 32 34 33 35 } devel/units/gettext/library.php
r780 r985 481 481 } 482 482 } 483 else484 {485 $messages[] .= __gettext("Preferred language") . " " . __gettext("not changed") .".";486 }487 483 } 488 484 } devel/units/invite/new_password.php
r861 r985 2 2 global $CFG; 3 3 // Generate a new password 4 4 5 5 $sitename = sitename; 6 6 devel/units/invite/password_request.php
r659 r985 1 1 <?php 2 2 3 global $CFG; 4 5 if (!empty($CFG->disable_passwordchanging)) { 6 7 $nope = __gettext('The site administrator has disabled password changing.'); 8 $run_result .= '<p>' . $nope . '</p>'; 9 10 } else { 11 3 12 // Join 4 $sitename = sitename;5 $desc = sprintf(__gettext("To generate a new password at %s!, enter your username below. We will send the address of a unique verification page to you via email click on the link in the body of the message and a new password will be sent to you."), $sitename); // gettext variable6 $thismethod = __gettext("This method reduces the chance of a mistakenly reset password.");7 8 $run_result .= <<< END13 $sitename = sitename; 14 $desc = sprintf(__gettext("To generate a new password at %s!, enter your username below. We will send the address of a unique verification page to you via email click on the link in the body of the message and a new password will be sent to you."), $sitename); // gettext variable 15 $thismethod = __gettext("This method reduces the chance of a mistakenly reset password."); 16 17 $run_result .= <<< END 9 18 10 19 <p> … … 17 26 18 27 END; 19 20 $run_result .= templates_draw(array(21 'context' => 'databoxvertical',22 'name' => __gettext("Your username"),23 'contents' => display_input_field(array("password_request_name","","text"))24 )25 );26 $request = __gettext("Request new password"); // gettext variable27 $run_result .= <<< END28 29 $run_result .= templates_draw(array( 30 'context' => 'databoxvertical', 31 'name' => __gettext("Your username"), 32 'contents' => display_input_field(array("password_request_name","","text")) 33 ) 34 ); 35 $request = __gettext("Request new password"); // gettext variable 36 $run_result .= <<< END 28 37 <p align="center"> 29 38 <input type="hidden" name="action" value="invite_password_request" /> … … 31 40 </p> 32 41 </form> 33 42 34 43 END; 35 44 45 } 46 36 47 ?> devel/units/users/userdetails_actions.php
r703 r985 11 11 12 12 switch ($action) { 13 14 // Update user details 15 case "userdetails:update": 13 16 14 // Update user details15 case "userdetails:update":17 $usertype = user_type($page_owner); 18 16 19 $name = trim(optional_param('name')); 17 20 if (!empty($name)) { 18 $userdetails_ok = "yes";19 21 if (strlen($name) > 64) { 20 22 $messages[] = __gettext("Your suggested name was too long. Please try something shorter."); 21 $userdetails_ok = "no"; 22 } 23 24 $usertype = user_type($page_owner); 25 $email = trim(optional_param('email')); 26 if ($usertype == 'person' && !empty($email)) { 27 if (!validate_email($email)) { 28 $messages[] = __gettext("Your suggested email address $email doesn't appear to be valid."); 29 30 $userdetails_ok = "no"; 31 } else { 32 $u = new StdClass; 33 $u->email = $email; 34 $u->ident = $id; 35 update_record('users',$u); 36 if ($USER->ident == $page_owner) { 37 $USER->email = $email; 38 $_SESSION['email'] = $email; 39 } 40 $messages[] = __gettext("Email address updated."); 41 } 42 } 43 44 $moderation = optional_param('moderation'); 45 if (!empty($moderation) && in_array($moderation,array('yes','no','priv'))) { 46 set_field('users','moderation',$moderation,'ident',$id); 47 $messages[] = __gettext("Your moderation preferences have been changed."); 48 } 49 50 if (!$CFG->disable_publiccomments) { 51 $publiccomments = optional_param('publiccomments'); 52 if ($usertype == 'person' && !empty($publiccomments)) { 53 if ($publiccomments == "yes") { 54 user_flag_set("publiccomments", "1", $id); 55 $messages[] = __gettext("Public comments and discussion set to 'on'."); 56 } else { 57 user_flag_unset("publiccomments",$id); 58 $messages[] = __gettext("Public comments and discussion set to 'off'."); 59 } 60 } 61 } 62 63 $receiveemails = optional_param('receiveemails'); 64 if ($usertype == 'person' && isset($receiveemails)) { 65 if ($receiveemails == "yes") { 66 user_flag_set("emailreplies", "1", $id); 67 $messages[] = __gettext("Email comments and discussion set to 'on'."); 68 } else { 69 user_flag_unset("emailreplies",$id); 70 $messages[] = __gettext("Email comments and discussion set to 'off'."); 71 } 72 } 73 74 $receiveemails = optional_param('receivenotifications'); 75 if ($usertype == 'person' && isset($receiveemails)) { 76 if ($receiveemails == "yes") { 77 user_flag_set("emailnotifications", "1", $id); 78 $messages[] = __gettext("Email notifications set to 'on'."); 79 } else { 80 user_flag_unset("emailnotifications",$id); 81 $messages[] = __gettext("Email notifications set to 'off'."); 82 } 83 } 84 85 if ($userdetails_ok == "yes") { 86 $messages[] = "Name updated."; 23 } elseif ($name != $USER->name) { 87 24 $u = new StdClass; 88 25 $u->name = $name; … … 90 27 update_record('users',$u); 91 28 if ($USER->ident == $page_owner) { 92 $USER->name = stripslashes($name);93 $_SESSION['name'] = stripslashes($name);29 $USER->name = $name; 30 $_SESSION['name'] = $name; 94 31 } 32 $messages[] = "Name updated."; 33 } 34 } 35 36 $email = trim(optional_param('email')); 37 if ($usertype == 'person' && !empty($email)) { 38 if (!validate_email($email)) { 39 $messages[] = __gettext("Your suggested email address $email doesn't appear to be valid."); 40 } elseif ($email != $USER->email) { 41 $u = new StdClass; 42 $u->email = $email; 43 $u->ident = $id; 44 update_record('users',$u); 45 if ($USER->ident == $page_owner) { 46 $USER->email = $email; 47 $_SESSION['email'] = $email; 48 } 49 $messages[] = __gettext("Email address updated."); 50 } 51 } 52 53 $moderation = optional_param('moderation'); 54 if (!empty($moderation) && in_array($moderation,array('yes','no','priv'))) { 55 set_field('users','moderation',$moderation,'ident',$id); 56 $messages[] = __gettext("Your moderation preferences have been changed."); 57 } 58 59 if (!$CFG->disable_publiccomments) { 60 $publiccomments = optional_param('publiccomments'); 61 if ($usertype == 'person' && !empty($publiccomments)) { 62 if ($publiccomments == "yes") { 63 user_flag_set("publiccomments", "1", $id); 64 $messages[] = __gettext("Public comments and discussion set to 'on'."); 65 } else { 66 user_flag_unset("publiccomments",$id); 67 $messages[] = __gettext("Public comments and discussion set to 'off'."); 68 } 69 } 70 } 71 72 $receiveemails = optional_param('receiveemails'); 73 if ($usertype == 'person' && isset($receiveemails)) { 74 if ($receiveemails == "yes") { 75 user_flag_set("emailreplies", "1", $id); 76 $messages[] = __gettext("Email comments and discussion set to 'on'."); 95 77 } else { 96 $messages[] = __gettext("Details were not changed."); 78 user_flag_unset("emailreplies",$id); 79 $messages[] = __gettext("Email comments and discussion set to 'off'."); 97 80 } 81 } 82 83 $receiveemails = optional_param('receivenotifications'); 84 if ($usertype == 'person' && isset($receiveemails)) { 85 if ($receiveemails == "yes") { 86 user_flag_set("emailnotifications", "1", $id); 87 $messages[] = __gettext("Email notifications set to 'on'."); 88 } else { 89 user_flag_unset("emailnotifications",$id); 90 $messages[] = __gettext("Email notifications set to 'off'."); 91 } 92 } 93 94 if (empty($CFG->disable_passwordchanging)) { 95 $password1 = optional_param('password1'); 96 $password2 = optional_param('password2'); 98 97 99 } 100 101 $password1 = optional_param('password1'); 102 $password2 = optional_param('password2'); 103 104 if (!empty($password1) || !empty($password2)) { 105 if (($password1 == $password2)) { 106 if (strlen($password1) < 4 || strlen($password1) > 32) { 107 $messages[] = __gettext("Password not changed: Your password is either too short or too long. It must be between 4 and 32 characters in length."); 108 } else if (!preg_match("/^[a-zA-Z0-9]*$/i",$password1)) { 109 $messages[] = __gettext("Password not changed: Your password can only consist of letters or numbers."); 98 if (!empty($password1) || !empty($password2)) { 99 if (($password1 == $password2)) { 100 if (strlen($password1) < 4 || strlen($password1) > 32) { 101 $messages[] = __gettext("Password not changed: Your password is either too short or too long. It must be between 4 and 32 characters in length."); 102 } else if (!preg_match("/^[a-zA-Z0-9]*$/i",$password1)) { 103 $messages[] = __gettext("Password not changed: Your password can only consist of letters or numbers."); 104 } else { 105 $messages[] = __gettext("Your password was updated."); 106 $u = new StdClass; 107 $u->password = md5($password1); 108 $u->ident = $page_owner; 109 update_record('users',$u); 110 } 110 111 } else { 111 $messages[] = __gettext("Your password was updated."); 112 $u = new StdClass; 113 $u->password = md5($password1); 114 $u->ident = $page_owner; 115 update_record('users',$u); 112 $messages[] = __gettext("Password not changed: The password and its verification string did not match."); 116 113 } 117 } else {118 $messages[] = __gettext("Password not changed: The password and its verification string did not match.");119 114 } 120 115 } devel/units/users/userdetails_edit.php
r979 r985 149 149 } 150 150 151 $password = __gettext("Change your password:"); // gettext variable 152 $passwordRules = __gettext("Leave this blank if you're happy to leave your password as it is."); // gettext variable 153 $body .= <<< END 151 if (empty($CFG->disable_passwordchanging)) { 152 $password = __gettext("Change your password:"); // gettext variable 153 $passwordRules = __gettext("Leave this blank if you're happy to leave your password as it is."); // gettext variable 154 $body .= <<< END 154 155 155 156 <h2> … … 162 163 END; 163 164 164 $body .= templates_draw(array( 165 'context' => 'databox', 166 'name' => __gettext("Your password: "), 167 'column1' => "<input type=\"password\" name=\"password1\" value=\"\" />" 168 ) 169 ); 170 171 $body .= templates_draw(array( 172 'context' => 'databox', 173 'name' => __gettext("Again for verification purposes: "), 174 'column1' => "<input type=\"password\" name=\"password2\" value=\"\" />" 175 ) 176 ); 165 $body .= templates_draw(array( 166 'context' => 'databox', 167 'name' => __gettext("Your password: "), 168 'column1' => "<input type=\"password\" name=\"password1\" value=\"\" />" 169 ) 170 ); 171 172 $body .= templates_draw(array( 173 'context' => 'databox', 174 'name' => __gettext("Again for verification purposes: "), 175 'column1' => "<input type=\"password\" name=\"password2\" value=\"\" />" 176 ) 177 ); 178 } 177 179 178 180 // Allow plug-ins to add stuff ...
