Project

General

Profile

« Previous | Next » 

Revision 1634

Added by Dietmar over 12 years ago

! update language files and rework some core files (read DEVINFOS)
! compress mdcr.js
+ add DEVINFOS Instructions/Informations for modulecoder

View differences:

signup2.php
40 40
*/
41 41
// Check values
42 42
if($groups_id == "") {
43
	$wb->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back, false);
43
	$wb->print_error($MESSAGE['USERS_NO_GROUP'], $js_back, false);
44 44
}
45
if(!preg_match('/^[a-z]{1}[a-z0-9_-]{2,}$/i', $username)) {
45
if(!preg_match('/^[a-z]{1}[a-z0-9._-]{2,}$/i', $username)) {
46 46
	$wb->print_error( $MESSAGE['USERS_NAME_INVALID_CHARS'].' / '.
47 47
	                  $MESSAGE['USERS_USERNAME_TOO_SHORT'], $js_back);
48 48
}
49 49
if($email != "") {
50 50
	if($wb->validate_email($email) == false) {
51
		$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
51
		$wb->print_error($MESSAGE['USERS_INVALID_EMAIL'], $js_back, false);
52 52
	}
53 53
} else {
54
	$wb->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back, false);
54
	$wb->print_error($MESSAGE['SIGNUP_NO_EMAIL'], $js_back, false);
55 55
}
56 56

  
57 57
$email = $wb->add_slashes($email);
58

  
58
$search = array('{SERVER_EMAIL}');
59
$replace = array( SERVER_EMAIL);
59 60
// Captcha
60 61
if(ENABLED_CAPTCHA) {
62
	$MESSAGE['MOD_FORM_INCORRECT_CAPTCHA'] = str_replace($search,$replace,$MESSAGE['MOD_FORM_INCORRECT_CAPTCHA']);
61 63
	if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
62 64
		// Check for a mismatch
63 65
		if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
64
			$wb->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back, false);
66
			$wb->print_error($MESSAGE['MOD_FORM_INCORRECT_CAPTCHA'], $js_back, false);
65 67
		}
66 68
	} else {
67
		$wb->print_error($MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'], $js_back, false);
69
		$wb->print_error($MESSAGE['MOD_FORM_INCORRECT_CAPTCHA'], $js_back, false);
68 70
	}
69 71
}
70 72
if(isset($_SESSION['captcha'])) { unset($_SESSION['captcha']); }
......
85 87
// Check if username already exists
86 88
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE username = '$username'");
87 89
if($results->numRows() > 0) {
88
	$wb->print_error($MESSAGE['USERS']['USERNAME_TAKEN'], $js_back, false);
90
	$wb->print_error($MESSAGE['USERS_USERNAME_TAKEN'], $js_back, false);
89 91
}
90 92

  
91 93
// Check if the email already exists
92 94
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($email)."'");
93 95
if($results->numRows() > 0) {
94
	if(isset($MESSAGE['USERS']['EMAIL_TAKEN'])) {
95
		$wb->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back, false);
96
	if(isset($MESSAGE['USERS_EMAIL_TAKEN'])) {
97
		$wb->print_error($MESSAGE['USERS_EMAIL_TAKEN'], $js_back, false);
96 98
	} else {
97
		$wb->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back, false);
99
		$wb->print_error($MESSAGE['USERS_INVALID_EMAIL'], $js_back, false);
98 100
	}
99 101
}
100 102

  
......
116 118
	// Replace placeholders from language variable with values
117 119
	$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
118 120
	$replace = array($display_name, WEBSITE_TITLE, $username, $new_pass); 
119
	$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2']['BODY_LOGIN_INFO']);
121
	$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2_BODY_LOGIN_INFO']);
120 122

  
121 123
	// Try sending the email
122 124
	if($wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) {
123 125
		$display_form = false;
124
		$wb->print_success($MESSAGE['FORGOT_PASS']['PASSWORD_RESET'], WB_URL.'/account/login.php' );
126
		$wb->print_success($MESSAGE['FORGOT_PASS_PASSWORD_RESET'], WB_URL.'/account/login.php' );
125 127
	} else {
126 128
		$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE username = '$username'");
127
		$wb->print_error($MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'], $js_back, false);
129
		$wb->print_error($MESSAGE['FORGOT_PASS_CANNOT_EMAIL'], $js_back, false);
128 130
	}
129 131
}
130 132

  

Also available in: Unified diff