Project

General

Profile

« Previous | Next » 

Revision 1420

Added by Dietmar almost 14 years ago

YGN Ethical Hacker Group (2.8.2 / 2.9.0)

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
------------------------------------- 2.8.2 -------------------------------------
14
26 Jan-2011 Build 1420 Dietmar Woellbrink (Luisehahne)
15
# YGN Ethical Hacker Group (2.8.2 / 2.9.0)
14 16
26 Jan-2011 Build 1419 Dietmar Woellbrink (Luisehahne)
15 17
! update rel handling FCKeditor for urls
16 18
25 Jan-2011 Build 1418 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
52 52

  
53 53
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
54 54
if(!defined('VERSION')) define('VERSION', '2.8.2.RC5');
55
if(!defined('REVISION')) define('REVISION', '1419');
55
if(!defined('REVISION')) define('REVISION', '1420');
56 56

  
57 57
?>
branches/2.8.x/wb/account/login_form.php
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
if(!defined('WB_URL')) die(header('Location: ../../index.php'));
20

  
21
$username_fieldname = 'username';
22
$password_fieldname = 'password';
23
	
24
if(defined('SMART_LOGIN') AND SMART_LOGIN == 'enabled') {
25
	// Generate username field name
26
	$username_fieldname = 'username_';
27
	$password_fieldname = 'password_';
28

  
29
	$temp = array_merge(range('a','z'), range(0,9));
30
	shuffle($temp);
31
	for($i=0;$i<=7;$i++) {
32
		$username_fieldname .= $temp[$i];
33
		$password_fieldname .= $temp[$i];
34
	}
35
}
36
?>
37
<h1>&nbsp;Login</h1>
38
&nbsp;<?php echo $thisApp->message; ?>
39
<br />
40
<br />
41

  
42
<form action="<?php echo WB_URL.'/account/login.php'; ?>" method="post">
43
<p style="display:none;"><input type="hidden" name="username_fieldname" value="<?php echo $username_fieldname; ?>" /></p>
44
<p style="display:none;"><input type="hidden" name="password_fieldname" value="<?php echo $password_fieldname; ?>" /></p>
45
<p style="display:none;"><input type="hidden" name="redirect" value="<?php echo $thisApp->redirect_url;?>" /></p>
46

  
47
<table cellpadding="5" cellspacing="0" border="0" width="90%">
48
<tr>
49
	<td style="width:100px"><?php echo $TEXT['USERNAME']; ?>:</td>
50
	<td class="value_input">
51
		<input type="text" name="<?php echo $username_fieldname; ?>" maxlength="30" style="width:220px;"/>
52
    	<script type="text/javascript">
53
    	// document.login.<?php echo $username_fieldname; ?>.focus();
54
    	var ref= document.getElementById("<?php echo $username_fieldname; ?>");
55
    	if (ref) ref.focus();
56
    	</script>
57
	</td>
58
</tr>
59
<tr>
60
	<td style="width:100px"><?php echo $TEXT['PASSWORD']; ?>:</td>
61
	<td class="value_input">
62
		<input type="password" name="<?php echo $password_fieldname; ?>" maxlength="30" style="width:220px;"/>
63
	</td>
64
</tr>
65
<?php if($username_fieldname != 'username') { ?>
66
<tr>
67
	<td>&nbsp;</td>
68
	<td>
69
		<input type="checkbox" name="remember" id="remember" value="true"/>
70
		<label for="remember"><?php echo $TEXT['REMEMBER_ME']; ?></label>
71
	</td>
72
</tr>
73
<?php } ?>
74
<tr>
75
	<td>&nbsp;</td>
76
	<td>
77
		<input type="submit" name="submit" value="<?php echo $TEXT['LOGIN']; ?>"  />
78
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>"  />
79
	</td>
80
</tr>
81
</table>
82

  
83
</form>
84

  
85
<br />
86

  
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21

  
22
$username_fieldname = 'username';
23
$password_fieldname = 'password';
24
	
25
if(defined('SMART_LOGIN') AND SMART_LOGIN == 'enabled') {
26
	// Generate username field name
27
	$username_fieldname = 'username_';
28
	$password_fieldname = 'password_';
29

  
30
	$temp = array_merge(range('a','z'), range(0,9));
31
	shuffle($temp);
32
	for($i=0;$i<=7;$i++) {
33
		$username_fieldname .= $temp[$i];
34
		$password_fieldname .= $temp[$i];
35
	}
36
}
37
?>
38
<h1>&nbsp;Login</h1>
39
&nbsp;<?php echo $thisApp->message; ?>
40
<br />
41
<br />
42

  
43
<form action="<?php echo WB_URL.'/account/login.php'; ?>" method="post">
44
<p style="display:none;"><input type="hidden" name="username_fieldname" value="<?php echo $username_fieldname; ?>" /></p>
45
<p style="display:none;"><input type="hidden" name="password_fieldname" value="<?php echo $password_fieldname; ?>" /></p>
46
<p style="display:none;"><input type="hidden" name="redirect" value="<?php echo $thisApp->redirect_url;?>" /></p>
47

  
48
<table cellpadding="5" cellspacing="0" border="0" width="90%">
49
<tr>
50
	<td style="width:100px"><?php echo $TEXT['USERNAME']; ?>:</td>
51
	<td class="value_input">
52
		<input type="text" name="<?php echo $username_fieldname; ?>" maxlength="30" style="width:220px;"/>
53
    	<script type="text/javascript">
54
    	// document.login.<?php echo $username_fieldname; ?>.focus();
55
    	var ref= document.getElementById("<?php echo $username_fieldname; ?>");
56
    	if (ref) ref.focus();
57
    	</script>
58
	</td>
59
</tr>
60
<tr>
61
	<td style="width:100px"><?php echo $TEXT['PASSWORD']; ?>:</td>
62
	<td class="value_input">
63
		<input type="password" name="<?php echo $password_fieldname; ?>" maxlength="30" style="width:220px;"/>
64
	</td>
65
</tr>
66
<?php if($username_fieldname != 'username') { ?>
67
<tr>
68
	<td>&nbsp;</td>
69
	<td>
70
		<input type="checkbox" name="remember" id="remember" value="true"/>
71
		<label for="remember"><?php echo $TEXT['REMEMBER_ME']; ?></label>
72
	</td>
73
</tr>
74
<?php } ?>
75
<tr>
76
	<td>&nbsp;</td>
77
	<td>
78
		<input type="submit" name="submit" value="<?php echo $TEXT['LOGIN']; ?>"  />
79
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>"  />
80
	</td>
81
</tr>
82
</table>
83

  
84
</form>
85

  
86
<br />
87

  
87 88
<a href="<?php echo WB_URL; ?>/account/forgot.php"><?php echo $TEXT['FORGOTTEN_DETAILS']; ?></a>
branches/2.8.x/wb/account/password.php
16 16
 *
17 17
 */
18 18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../index.php');
21
	exit(0);
22
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
23 21

  
24 22
// Get the values entered
25 23
$current_password = $_POST['current_password'];
branches/2.8.x/wb/account/forgot_form.php
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../pages/index.php');
21
	exit(0);
22
}
23

  
24
// Create new database object
25
// $database = new database();
26

  
27
// Check if the user has already submitted the form, otherwise show it
28
if(isset($_POST['email']) && $_POST['email'] != "" &&
29
    preg_match("/([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}/i", $_POST['email'])) {
30
	$email = strip_tags($_POST['email']);
31
	
32
	// Check if the email exists in the database
33
	$query = "SELECT user_id,username,display_name,email,last_reset,password FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($_POST['email'])."'";
34
	$results = $database->query($query);
35
	if($results->numRows() > 0) {
36
	
37
		// Get the id, username, email, and last_reset from the above db query
38
		$results_array = $results->fetchRow();
39
		
40
		// Check if the password has been reset in the last 2 hours
41
		$last_reset = $results_array['last_reset'];
42
		$time_diff = time()-$last_reset; // Time since last reset in seconds
43
		$time_diff = $time_diff/60/60; // Time since last reset in hours
44
		if($time_diff < 2) {
45
			
46
			// Tell the user that their password cannot be reset more than once per hour
47
			$message = $MESSAGE['FORGOT_PASS']['ALREADY_RESET'];
48
			
49
		} else {
50
		
51
			$old_pass = $results_array['password'];
52

  
53
			// Generate a random password then update the database with it
54
			$new_pass = '';
55
			$salt = "abchefghjkmnpqrstuvwxyz0123456789";
56
			srand((double)microtime()*1000000);
57
			$i = 0;
58
			while ($i <= 7) {
59
				$num = rand() % 33;
60
				$tmp = substr($salt, $num, 1);
61
				$new_pass = $new_pass . $tmp;
62
				$i++;
63
			}
64
			$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".md5($new_pass)."', last_reset = '".time()."' WHERE user_id = '".$results_array['user_id']."'");
65
			
66
			if($database->is_error()) {
67
				// Error updating database
68
				$message = $database->get_error();
69
			} else {
70
				// Setup email to send
71
				$mail_to = $email;
72
				$mail_subject = $MESSAGE['SIGNUP2']['SUBJECT_LOGIN_INFO'];
73

  
74
				// Replace placeholders from language variable with values
75
				$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
76
				$replace = array($results_array['display_name'], WEBSITE_TITLE, $results_array['username'], $new_pass); 
77
				$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2']['BODY_LOGIN_FORGOT']);
78

  
79
				// Try sending the email
80
				if($wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) { 
81
					$message = $MESSAGE['FORGOT_PASS']['PASSWORD_RESET'];
82
					$display_form = false;
83
				} else {
84
					$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".$old_pass."' WHERE user_id = '".$results_array['user_id']."'");
85
					$message = $MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'];
86
				}
87
			}
88
		
89
		}
90

  
91
	} else {
92
		// Email doesn't exist, so tell the user
93
		$message = $MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'];
94
	}
95
	
96
} else {
97
	$email = '';
98
}
99

  
100
if(!isset($message)) {
101
	$message = $MESSAGE['FORGOT_PASS']['NO_DATA'];
102
	$message_color = '000000';
103
} else {
104
	$message_color = 'FF0000';
105
}
106
	
107
?>
108
<h1 style="text-align: center;"><?php echo $MENU['FORGOT']; ?></h1>
109

  
110
<form name="forgot_pass" action="<?php echo WB_URL.'/account/forgot.php'; ?>" method="post">
111
	<input type="hidden" name="url" value="{URL}" />
112
		<table cellpadding="5" cellspacing="0" border="0" align="center" width="500">
113
		<tr>
114
			<td height="40" align="center" style="color: #<?php echo $message_color; ?>;" colspan="2">
115
			<?php echo $message; ?>
116
			</td>
117
		</tr>
118
		<?php if(!isset($display_form) OR $display_form != false) { ?>
119
		<tr>
120
			<td height="10" colspan="2"></td>
121
		</tr>
122
		<tr>
123
			<td width="165" height="30" align="right"><?php echo $TEXT['EMAIL']; ?>:</td>
124
			<td><input type="text" maxlength="255" name="email" value="<?php echo $email; ?>" style="width: 180px;" /></td>
125
			<td><input type="submit" name="submit" value="<?php echo $TEXT['SEND_DETAILS']; ?>" style="width: 180px; font-size: 10px; color: #003366; border: 1px solid #336699; background-color: #DDDDDD; padding: 3px; text-transform: uppercase;" /></td>
126
		</tr>
127
<!--
128
		<tr>
129
			<td>&nbsp;</td>
130
		</tr>
131
		<tr style="display: {DISPLAY_FORM}">
132
			<td height="10" colspan="2"></td>
133
		</tr>
134
-->
135
		<?php } ?>
136
		</table>
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21

  
22
// Create new database object
23
// $database = new database();
24

  
25
// Check if the user has already submitted the form, otherwise show it
26
if(isset($_POST['email']) && $_POST['email'] != "" &&
27
    preg_match("/([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}/i", $_POST['email'])) {
28
	$email = strip_tags($_POST['email']);
29
	
30
	// Check if the email exists in the database
31
	$query = "SELECT user_id,username,display_name,email,last_reset,password FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($_POST['email'])."'";
32
	$results = $database->query($query);
33
	if($results->numRows() > 0) {
34
	
35
		// Get the id, username, email, and last_reset from the above db query
36
		$results_array = $results->fetchRow();
37
		
38
		// Check if the password has been reset in the last 2 hours
39
		$last_reset = $results_array['last_reset'];
40
		$time_diff = time()-$last_reset; // Time since last reset in seconds
41
		$time_diff = $time_diff/60/60; // Time since last reset in hours
42
		if($time_diff < 2) {
43
			
44
			// Tell the user that their password cannot be reset more than once per hour
45
			$message = $MESSAGE['FORGOT_PASS']['ALREADY_RESET'];
46
			
47
		} else {
48
		
49
			$old_pass = $results_array['password'];
50

  
51
			// Generate a random password then update the database with it
52
			$new_pass = '';
53
			$salt = "abchefghjkmnpqrstuvwxyz0123456789";
54
			srand((double)microtime()*1000000);
55
			$i = 0;
56
			while ($i <= 7) {
57
				$num = rand() % 33;
58
				$tmp = substr($salt, $num, 1);
59
				$new_pass = $new_pass . $tmp;
60
				$i++;
61
			}
62
			$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".md5($new_pass)."', last_reset = '".time()."' WHERE user_id = '".$results_array['user_id']."'");
63
			
64
			if($database->is_error()) {
65
				// Error updating database
66
				$message = $database->get_error();
67
			} else {
68
				// Setup email to send
69
				$mail_to = $email;
70
				$mail_subject = $MESSAGE['SIGNUP2']['SUBJECT_LOGIN_INFO'];
71

  
72
				// Replace placeholders from language variable with values
73
				$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
74
				$replace = array($results_array['display_name'], WEBSITE_TITLE, $results_array['username'], $new_pass); 
75
				$mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2']['BODY_LOGIN_FORGOT']);
76

  
77
				// Try sending the email
78
				if($wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message)) { 
79
					$message = $MESSAGE['FORGOT_PASS']['PASSWORD_RESET'];
80
					$display_form = false;
81
				} else {
82
					$database->query("UPDATE ".TABLE_PREFIX."users SET password = '".$old_pass."' WHERE user_id = '".$results_array['user_id']."'");
83
					$message = $MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'];
84
				}
85
			}
86
		
87
		}
88

  
89
	} else {
90
		// Email doesn't exist, so tell the user
91
		$message = $MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'];
92
	}
93
	
94
} else {
95
	$email = '';
96
}
97

  
98
if(!isset($message)) {
99
	$message = $MESSAGE['FORGOT_PASS']['NO_DATA'];
100
	$message_color = '000000';
101
} else {
102
	$message_color = 'FF0000';
103
}
104
	
105
?>
106
<h1 style="text-align: center;"><?php echo $MENU['FORGOT']; ?></h1>
107

  
108
<form name="forgot_pass" action="<?php echo WB_URL.'/account/forgot.php'; ?>" method="post">
109
	<input type="hidden" name="url" value="{URL}" />
110
		<table cellpadding="5" cellspacing="0" border="0" align="center" width="500">
111
		<tr>
112
			<td height="40" align="center" style="color: #<?php echo $message_color; ?>;" colspan="2">
113
			<?php echo $message; ?>
114
			</td>
115
		</tr>
116
		<?php if(!isset($display_form) OR $display_form != false) { ?>
117
		<tr>
118
			<td height="10" colspan="2"></td>
119
		</tr>
120
		<tr>
121
			<td width="165" height="30" align="right"><?php echo $TEXT['EMAIL']; ?>:</td>
122
			<td><input type="text" maxlength="255" name="email" value="<?php echo $email; ?>" style="width: 180px;" /></td>
123
			<td><input type="submit" name="submit" value="<?php echo $TEXT['SEND_DETAILS']; ?>" style="width: 180px; font-size: 10px; color: #003366; border: 1px solid #336699; background-color: #DDDDDD; padding: 3px; text-transform: uppercase;" /></td>
124
		</tr>
125
<!--
126
		<tr>
127
			<td>&nbsp;</td>
128
		</tr>
129
		<tr style="display: {DISPLAY_FORM}">
130
			<td height="10" colspan="2"></td>
131
		</tr>
132
-->
133
		<?php } ?>
134
		</table>
137 135
</form>
branches/2.8.x/wb/account/preferences_form.php
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
if(!defined('WB_URL')) die(header('Location: ../../index.php'));
20
$ftan = $wb->getFTAN();
21
?>
22

  
23
<h2>&nbsp;<?php print $HEADING['MY_SETTINGS']; ?></h2>
24

  
25
<form name="user" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
26
<input type="hidden" name="user_id" value="{USER_ID}" />
27
<?php echo $ftan; ?>
28
<table cellpadding="5" cellspacing="0" border="0" width="97%">
29
<tr>
30
	<td width="140"><?php print $TEXT['DISPLAY_NAME']; ?>:</td>
31
	<td class="value_input">
32
		<input type="text" name="display_name" style="width: 380px;" maxlength="255" value="<?php print $wb->get_display_name(); ?>" />
33
	</td>
34
</tr>
35
<tr>
36
	<td><?php print $TEXT['LANGUAGE']; ?>:</td>
37
	<td>
38
		<select name="language" style="width: 380px;">
39
		<?php
40
		/**
41
		 *
42
		 *	Getting the languages from the database. (addons)
43
		 *	It's a little bit corious, but the language-shortform is
44
		 *	storred in the field "directory" ...
45
		 *
46
		 */
47
		$query = "SELECT directory, name from ".TABLE_PREFIX."addons where type='language' order by 'name'";
48
		$result = $database->query($query);
49
		if ($result) {
50
			$options_html = "";
51
			while($data = $result->fetchRow()) {
52
				$sel = ($data['directory'] == LANGUAGE) ? " selected=\"selected\" " : "";
53
				$options_html .= "<option value=\"".$data['directory']."\" ".$sel.">".$data['name']." (".$data['directory'].")</option>\n";
54
			}
55
			echo $options_html;
56
		}
57
		?>
58
		</select>
59
	</td>
60
</tr>
61
<tr>
62
	<td><?php print $TEXT['TIMEZONE']; ?>:</td>
63
	<td>
64
		<select name="timezone" style="width: 380px;">
65
			<option value="-20"><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
66
			<?php
67
				// Insert default timezone values
68
				require_once(ADMIN_PATH.'/interface/timezones.php');
69
				$test_time = $wb->get_timezone();
70
				$options_html = "";
71
				foreach($TIMEZONES as $hour_offset => $title) {
72
					$sel = ($test_time == $hour_offset*60*60) ? " selected=\"selected\" " : ""; 
73
					$options_html .= "<option value=\"".$hour_offset."\" ".$sel.">".$title."</option>\n";
74
				}
75
				print $options_html;
76
?>
77

  
78
		</select>
79
	</td>
80
</tr>
81
<tr>
82
	<td><?php print $TEXT['DATE_FORMAT']; ?>:</td>
83
	<td>
84
		<select name="date_format" style="width: 98%;">
85
			<option value=""><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
86
			<?php
87
			// Insert date format list
88
			$user_time = true;
89
			require_once(ADMIN_PATH.'/interface/date_formats.php');
90
			foreach($DATE_FORMATS AS $format => $title) {
91
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
92
				if($format != 'system_default') {
93
					$value = $format;
94
				} else {
95
					$value = '';
96
				}
97
				if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
98
					$selected = ' selected="selected"';
99
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
100
					$selected = ' selected="selected"';
101
				} else {
102
					$selected = '';
103
				}
104
				print '<option value="'.$value.'"'.$selected.'>'.$title.'</option>'."\n";
105
			}
106
			?>
107
		</select>
108
	</td>
109
</tr>
110
<tr>
111
	<td><?php print $TEXT['TIME_FORMAT']; ?>:</td>
112
	<td>
113
		<select name="time_format" style="width: 98%;">
114
			<option value=""><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
115
			<?php
116
			// Insert time format list
117
			$user_time = true;
118
			require_once(ADMIN_PATH.'/interface/time_formats.php');
119
			foreach($TIME_FORMATS AS $format => $title)
120
            {
121
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
122
                $value = ($format != 'system_default') ? $format : '';
123

  
124
                $selected = ((TIME_FORMAT == $format AND ! isset($_SESSION['USE_DEFAULT_TIME_FORMAT']))
125
                    OR ($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])))
126
                	? ' selected="selected"' : '';
127

  
128
				print '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
129
			}
130
			?>
131
		</select>
132
	</td>
133
</tr>
134
<tr>
135
	<td>&nbsp;</td>
136
	<td>
137
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
138
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
139
	</td>
140
</tr>
141
</table>
142

  
143
</form>
144

  
145
<h2>&nbsp;<?php print $HEADING['MY_EMAIL']; ?></h2>
146

  
147
<form name="email" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
148
<input type="hidden" name="user_id" value="{USER_ID}" />
149
<?php echo $ftan; ?>
150
<table cellpadding="5" cellspacing="0" border="0" width="97%">
151
<tr>
152
	<td width="140"><?php print $TEXT['CURRENT_PASSWORD']; ?>:</td>
153
	<td>
154
		<input type="password" name="current_password" style="width: 380px;" />
155
	</td>
156
</tr>
157
<tr>
158
	<td><?php print $TEXT['EMAIL']; ?>:</td>
159
	<td class="value_input">
160
		<input type="text" name="email" style="width: 380px;" maxlength="255" value="<?php print $wb->get_email(); ?>" />
161
	</td>
162
</tr>
163
<tr>
164
	<td>&nbsp;</td>
165
	<td>
166
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
167
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
168
	</td>
169
</tr>
170
</table>
171

  
172
</form>
173

  
174

  
175
<h2>&nbsp;<?php print $HEADING['MY_PASSWORD']; ?></h2>
176

  
177
<form name="user" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post">
178
<input type="hidden" name="user_id" value="{USER_ID}" />
179
<?php echo $ftan; ?>
180
<table cellpadding="5" cellspacing="0" border="0" width="97%">
181
<tr>
182
	<td width="140"><?php print $TEXT['CURRENT_PASSWORD']; ?>:</td>
183
	<td>
184
		<input type="password" name="current_password" style="width: 380px;" />
185
	</td>
186
</tr>
187
<tr>
188
	<td><?php print $TEXT['NEW_PASSWORD']; ?>:</td>
189
	<td>
190
		<input type="password" name="new_password" style="width: 380px;" />
191
	</td>
192
</tr>
193
<tr>
194
	<td><?php print $TEXT['RETYPE_NEW_PASSWORD']; ?>:</td>
195
	<td>
196
		<input type="password" name="new_password2" style="width: 380px;" />
197
	</td>
198
</tr>
199
<tr>
200
	<td>&nbsp;</td>
201
	<td>
202
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
203
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
204
	</td>
205
</tr>
206
</table>
207

  
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21

  
22
$ftan = $wb->getFTAN();
23
?>
24

  
25
<h2>&nbsp;<?php print $HEADING['MY_SETTINGS']; ?></h2>
26

  
27
<form name="user" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
28
<input type="hidden" name="user_id" value="{USER_ID}" />
29
<?php echo $ftan; ?>
30
<table cellpadding="5" cellspacing="0" border="0" width="97%">
31
<tr>
32
	<td width="140"><?php print $TEXT['DISPLAY_NAME']; ?>:</td>
33
	<td class="value_input">
34
		<input type="text" name="display_name" style="width: 380px;" maxlength="255" value="<?php print $wb->get_display_name(); ?>" />
35
	</td>
36
</tr>
37
<tr>
38
	<td><?php print $TEXT['LANGUAGE']; ?>:</td>
39
	<td>
40
		<select name="language" style="width: 380px;">
41
		<?php
42
		/**
43
		 *
44
		 *	Getting the languages from the database. (addons)
45
		 *	It's a little bit corious, but the language-shortform is
46
		 *	storred in the field "directory" ...
47
		 *
48
		 */
49
		$query = "SELECT directory, name from ".TABLE_PREFIX."addons where type='language' order by 'name'";
50
		$result = $database->query($query);
51
		if ($result) {
52
			$options_html = "";
53
			while($data = $result->fetchRow()) {
54
				$sel = ($data['directory'] == LANGUAGE) ? " selected=\"selected\" " : "";
55
				$options_html .= "<option value=\"".$data['directory']."\" ".$sel.">".$data['name']." (".$data['directory'].")</option>\n";
56
			}
57
			echo $options_html;
58
		}
59
		?>
60
		</select>
61
	</td>
62
</tr>
63
<tr>
64
	<td><?php print $TEXT['TIMEZONE']; ?>:</td>
65
	<td>
66
		<select name="timezone" style="width: 380px;">
67
			<option value="-20"><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
68
			<?php
69
				// Insert default timezone values
70
				require_once(ADMIN_PATH.'/interface/timezones.php');
71
				$test_time = $wb->get_timezone();
72
				$options_html = "";
73
				foreach($TIMEZONES as $hour_offset => $title) {
74
					$sel = ($test_time == $hour_offset*60*60) ? " selected=\"selected\" " : ""; 
75
					$options_html .= "<option value=\"".$hour_offset."\" ".$sel.">".$title."</option>\n";
76
				}
77
				print $options_html;
78
?>
79

  
80
		</select>
81
	</td>
82
</tr>
83
<tr>
84
	<td><?php print $TEXT['DATE_FORMAT']; ?>:</td>
85
	<td>
86
		<select name="date_format" style="width: 98%;">
87
			<option value=""><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
88
			<?php
89
			// Insert date format list
90
			$user_time = true;
91
			require_once(ADMIN_PATH.'/interface/date_formats.php');
92
			foreach($DATE_FORMATS AS $format => $title) {
93
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
94
				if($format != 'system_default') {
95
					$value = $format;
96
				} else {
97
					$value = '';
98
				}
99
				if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
100
					$selected = ' selected="selected"';
101
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
102
					$selected = ' selected="selected"';
103
				} else {
104
					$selected = '';
105
				}
106
				print '<option value="'.$value.'"'.$selected.'>'.$title.'</option>'."\n";
107
			}
108
			?>
109
		</select>
110
	</td>
111
</tr>
112
<tr>
113
	<td><?php print $TEXT['TIME_FORMAT']; ?>:</td>
114
	<td>
115
		<select name="time_format" style="width: 98%;">
116
			<option value=""><?php print $TEXT['PLEASE_SELECT']; ?>...</option>
117
			<?php
118
			// Insert time format list
119
			$user_time = true;
120
			require_once(ADMIN_PATH.'/interface/time_formats.php');
121
			foreach($TIME_FORMATS AS $format => $title)
122
            {
123
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
124
                $value = ($format != 'system_default') ? $format : '';
125

  
126
                $selected = ((TIME_FORMAT == $format AND ! isset($_SESSION['USE_DEFAULT_TIME_FORMAT']))
127
                    OR ($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])))
128
                	? ' selected="selected"' : '';
129

  
130
				print '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
131
			}
132
			?>
133
		</select>
134
	</td>
135
</tr>
136
<tr>
137
	<td>&nbsp;</td>
138
	<td>
139
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
140
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
141
	</td>
142
</tr>
143
</table>
144

  
145
</form>
146

  
147
<h2>&nbsp;<?php print $HEADING['MY_EMAIL']; ?></h2>
148

  
149
<form name="email" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
150
<input type="hidden" name="user_id" value="{USER_ID}" />
151
<?php echo $ftan; ?>
152
<table cellpadding="5" cellspacing="0" border="0" width="97%">
153
<tr>
154
	<td width="140"><?php print $TEXT['CURRENT_PASSWORD']; ?>:</td>
155
	<td>
156
		<input type="password" name="current_password" style="width: 380px;" />
157
	</td>
158
</tr>
159
<tr>
160
	<td><?php print $TEXT['EMAIL']; ?>:</td>
161
	<td class="value_input">
162
		<input type="text" name="email" style="width: 380px;" maxlength="255" value="<?php print $wb->get_email(); ?>" />
163
	</td>
164
</tr>
165
<tr>
166
	<td>&nbsp;</td>
167
	<td>
168
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
169
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
170
	</td>
171
</tr>
172
</table>
173

  
174
</form>
175

  
176

  
177
<h2>&nbsp;<?php print $HEADING['MY_PASSWORD']; ?></h2>
178

  
179
<form name="user" action="<?php print WB_URL.'/account/preferences.php'; ?>" method="post">
180
<input type="hidden" name="user_id" value="{USER_ID}" />
181
<?php echo $ftan; ?>
182
<table cellpadding="5" cellspacing="0" border="0" width="97%">
183
<tr>
184
	<td width="140"><?php print $TEXT['CURRENT_PASSWORD']; ?>:</td>
185
	<td>
186
		<input type="password" name="current_password" style="width: 380px;" />
187
	</td>
188
</tr>
189
<tr>
190
	<td><?php print $TEXT['NEW_PASSWORD']; ?>:</td>
191
	<td>
192
		<input type="password" name="new_password" style="width: 380px;" />
193
	</td>
194
</tr>
195
<tr>
196
	<td><?php print $TEXT['RETYPE_NEW_PASSWORD']; ?>:</td>
197
	<td>
198
		<input type="password" name="new_password2" style="width: 380px;" />
199
	</td>
200
</tr>
201
<tr>
202
	<td>&nbsp;</td>
203
	<td>
204
		<input type="submit" name="submit" value="<?php print $TEXT['SAVE']; ?>" />
205
		<input type="reset" name="reset" value="<?php print $TEXT['RESET']; ?>" />
206
	</td>
207
</tr>
208
</table>
209

  
208 210
</form>
branches/2.8.x/wb/account/details.php
16 16
 *
17 17
 */
18 18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../pages/index.php');
21
	exit(0);
22
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
23 21

  
24 22
// Get and sanitize entered values
25 23
$display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
branches/2.8.x/wb/account/email.php
16 16
 *
17 17
 */
18 18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../index.php');
21
	exit(0);
22
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
23 21

  
24 22
// Get the values entered
25 23
$current_password = $wb->get_post('current_password');
branches/2.8.x/wb/account/signup2.php
16 16
 *
17 17
 */
18 18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../pages/index.php');
21
	exit(0);
22
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
23 21

  
24 22
require_once(WB_PATH.'/framework/class.wb.php');
25 23
$wb = new wb('Start', 'start', false, false);
branches/2.8.x/wb/account/signup_form.php
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../index.php');
21
	exit(0);
22
}
23
require_once(WB_PATH.'/include/captcha/captcha.php');
24

  
25
?>
26

  
27
<h1>&nbsp;<?php echo $TEXT['SIGNUP']; ?></h1>
28

  
29
<form name="user" action="<?php echo WB_URL.'/account/signup.php'; ?>" method="post">
30
	<?php echo $admin->getFTAN(); ?>
31
	<?php if(ENABLED_ASP) { // add some honeypot-fields
32
	?>
33
    <div style="display:none;">
34
	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
35
	<p class="nixhier">
36
	email-address:
37
	<label for="email-address">Leave this field email-address blank:</label>
38
	<input id="email-address" name="email-address" size="60" value="" /><br />
39
	username (id):
40
	<label for="name">Leave this field name blank:</label>
41
	<input id="name" name="name" size="60" value="" /><br />
42
	Full Name:
43
	<label for="full_name">Leave this field full_name blank:</label>
44
	<input id="full_name" name="full_name" size="60" value="" /><br />
45
	</p>
46
	<?php }
47
	?>
48
    </div>
49
<table cellpadding="5" cellspacing="0" border="0" width="90%">
50
<tr>
51
	<td width="180"><?php echo $TEXT['USERNAME']; ?>:</td>
52
	<td class="value_input">
53
		<input type="text" name="username" maxlength="30" style="width:300px;"/>
54
	</td>
55
</tr>
56
<tr>
57
	<td><?php echo $TEXT['DISPLAY_NAME']; ?> (<?php echo $TEXT['FULL_NAME']; ?>):</td>
58
	<td class="value_input">
59
		<input type="text" name="display_name" maxlength="255" style="width:300px;" />
60
	</td>
61
</tr>
62
<tr>
63
	<td><?php echo $TEXT['EMAIL']; ?>:</td>
64
	<td class="value_input">
65
		<input type="text" name="email" maxlength="255" style="width:300px;"/>
66
	</td>
67
</tr>
68
<?php
69
// Captcha
70
if(ENABLED_CAPTCHA) {
71
	?><tr>
72
		<td class="field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td>
73
		<td><?php call_captcha(); ?></td>
74
		</tr>
75
	<?php
76
}
77
?>
78
<tr>
79
	<td>&nbsp;</td>
80
	<td>
81
		<input type="submit" name="submit" value="<?php echo $TEXT['SIGNUP']; ?>" />
82
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
83
	</td>
84
</tr>
85
</table>
86

  
87
</form>
88

  
89
<br />
90
&nbsp; 
1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21

  
22
require_once(WB_PATH.'/include/captcha/captcha.php');
23

  
24
?>
25

  
26
<h1>&nbsp;<?php echo $TEXT['SIGNUP']; ?></h1>
27

  
28
<form name="user" action="<?php echo WB_URL.'/account/signup.php'; ?>" method="post">
29
	<?php echo $admin->getFTAN(); ?>
30
	<?php if(ENABLED_ASP) { // add some honeypot-fields
31
	?>
32
    <div style="display:none;">
33
	<input type="hidden" name="submitted_when" value="<?php $t=time(); echo $t; $_SESSION['submitted_when']=$t; ?>" />
34
	<p class="nixhier">
35
	email-address:
36
	<label for="email-address">Leave this field email-address blank:</label>
37
	<input id="email-address" name="email-address" size="60" value="" /><br />
38
	username (id):
39
	<label for="name">Leave this field name blank:</label>
40
	<input id="name" name="name" size="60" value="" /><br />
41
	Full Name:
42
	<label for="full_name">Leave this field full_name blank:</label>
43
	<input id="full_name" name="full_name" size="60" value="" /><br />
44
	</p>
45
	<?php }
46
	?>
47
    </div>
48
<table cellpadding="5" cellspacing="0" border="0" width="90%">
49
<tr>
50
	<td width="180"><?php echo $TEXT['USERNAME']; ?>:</td>
51
	<td class="value_input">
52
		<input type="text" name="username" maxlength="30" style="width:300px;"/>
53
	</td>
54
</tr>
55
<tr>
56
	<td><?php echo $TEXT['DISPLAY_NAME']; ?> (<?php echo $TEXT['FULL_NAME']; ?>):</td>
57
	<td class="value_input">
58
		<input type="text" name="display_name" maxlength="255" style="width:300px;" />
59
	</td>
60
</tr>
61
<tr>
62
	<td><?php echo $TEXT['EMAIL']; ?>:</td>
63
	<td class="value_input">
64
		<input type="text" name="email" maxlength="255" style="width:300px;"/>
65
	</td>
66
</tr>
67
<?php
68
// Captcha
69
if(ENABLED_CAPTCHA) {
70
	?><tr>
71
		<td class="field_title"><?php echo $TEXT['VERIFICATION']; ?>:</td>
72
		<td><?php call_captcha(); ?></td>
73
		</tr>
74
	<?php
75
}
76
?>
77
<tr>
78
	<td>&nbsp;</td>
79
	<td>
80
		<input type="submit" name="submit" value="<?php echo $TEXT['SIGNUP']; ?>" />
81
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
82
	</td>
83
</tr>
84
</table>
85

  
86
</form>
87

  
88
<br />
89
&nbsp; 
branches/2.8.x/wb/framework/class.admin.php
16 16
 *
17 17
 */
18 18

  
19
if(!defined('WB_URL')) {
20
	header('Location: ../index.php');
21
	exit(0);
22
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
23 21

  
24 22
require_once(WB_PATH.'/framework/class.wb.php');
25 23

  
branches/2.8.x/wb/framework/functions-utf8.php
43 43
//   entities_to_umlauts2()
44 44
//   umlauts_to_entities2()
45 45

  
46
if(!defined('WB_URL')) {
47
	header('Location: ../index.php');
48
	exit(0);
49
}
46
// Must include code to stop this file being access directly
47
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
50 48

  
51 49
/*
52 50
 * check for mb_string support
branches/2.8.x/wb/framework/module.functions.php
31 31
	NOTE: Some functions were added for module developers to make the creation of own module easier
32 32
*/
33 33

  
34
// prevent this file from being accessed directly
35
if(!defined('WB_PATH')) die(header('Location: index.php'));  
34
// Must include code to stop this file being access directly
35
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
36 36

  
37 37
/*
38 38
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
branches/2.8.x/wb/framework/initialize.php
16 16
 *
17 17
 */
18 18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
19 21
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
20 22

  
21 23
if (file_exists(WB_PATH.'/framework/class.database.php')) {
branches/2.8.x/wb/framework/class.wbmailer.php
23 23

  
24 24
*/
25 25

  
26
/*
26
// Must include code to stop this file being access directly
27
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
27 28

  
28
wbmailer class
29

  
30
This class is a subclass of the PHPMailer class and replaces the mail() function of PHP
31

  
32
*/
33

  
34 29
// Include PHPMailer class
35 30
require_once(WB_PATH."/include/phpmailer/class.phpmailer.php");
36 31

  
branches/2.8.x/wb/framework/class.database.php
25 25

  
26 26
*/
27 27

  
28
// Stop this file from being accessed directly
29
if(!defined('WB_URL')) {
30
	header('Location: ../index.php');
31
	exit(0);
32
}
28
// Must include code to stop this file being access directly
29
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
33 30

  
34 31
if(!defined('DB_URL')) {
35 32
	//define('DB_URL', DB_TYPE.'://'.DB_USERNAME.':'.DB_PASSWORD.'@'.DB_HOST.'/'.DB_NAME);
branches/2.8.x/wb/framework/functions.php
16 16
 *
17 17
*/
18 18

  
19
// Stop this file from being accessed directly
20
if(!defined('WB_URL')) {
21
	header('Location: ../index.php');
22
	exit;
23
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
24 21

  
25 22
// Define that this file has been loaded
26 23
define('FUNCTIONS_FILE_LOADED', true);
branches/2.8.x/wb/framework/class.login.php
16 16
 *
17 17
 */
18 18

  
19
// Stop this file from being accessed directly
20
if(!defined('WB_URL')) {
21
	header('Location: ../index.php');
22
	exit(0);
23
}
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
24 21

  
25 22
define('LOGIN_CLASS_LOADED', true);
26 23

  
branches/2.8.x/wb/framework/class.wb.php
16 16
 *
17 17
 */
18 18

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
19 21
// Include PHPLIB template class
20 22
require_once(WB_PATH."/include/phplib/template.inc");
21 23

  
branches/2.8.x/wb/framework/class.order.php
32 32

  
33 33
*/
34 34

  
35
// Stop this file from being accessed directly
36
if(!defined('WB_URL')) {
37
	header('Location: ../index.php');
38
	exit(0);
39
}
35
// Must include code to stop this file being access directly
36
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
40 37

  
41 38
define('ORDERING_CLASS_LOADED', true);
42 39

  
branches/2.8.x/wb/framework/addon.precheck.inc.php
1
<?php
2
/**
3
 *
4
 * @category        module
5
 * @package         precheck
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
// prevent this file from being accessed directly
20
if (!defined('WB_PATH')) die(header('Location: ../index.php'));
21

  
22
function getVersion($version, $strip_suffix = true)
23
{
24
	/**
25
	 * This funtion creates a version string following the major.minor.revision convention
26
	 * The minor and revision part of the version may not exceed 999 (three digits)
27
	 * An optional suffix part can be added after revision (requires $strip_suffix = false)
28
	 *
29
	 * EXAMPLES: input --> output
30
	 *	5 --> 5.000000; 5.0 --> 5.000000; 5.0.0 --> 5.000000
31
	 * 	5.2 --> 5.002000; 5.20 --> 5.002000; 5.2.0 --> 5.002000
32
	 * 	5.21 --> 5.002001; 5.2.1 --> 5.002001;
33
	 * 	5.27.1 --> 5.027001; 5.2.71 --> 5.002071;
34
	 * 	5.27.1 rc1 --> 5.027001_RC1 ($strip_suffix:= false)
35
	 */
36
	// replace comma by decimal point
37
	$version = str_replace(',', '.', $version);
38

  
39
	// convert version into major.minor.revision numbering system
40
	list($major, $minor, $revision) = explode('.', $version, 3);
41

  
42
	// convert versioning style 5.21 into 5.2.1
43
	if ($revision == '' && strlen(intval($minor)) == 2) {
44
		$revision = substr($minor, -1);
45
		$minor = substr($minor, 0, 1);
46
	}
47
	
48
	// extract possible non numerical suffix from revision part (e.g. Alpha, Beta, RC1)
49
	$suffix = strtoupper(trim(substr($revision, strlen(intval($revision)))));
50

  
51
/*
52
	return (int)$major . '.' . sprintf('%03d', (int)$minor) . sprintf('%03d', (int)$revision) .
53
		(($strip_suffix == false && $suffix != '') ? '_' . $suffix : '');
54
*/
55
	// return standard version number (minor and revision numbers may not exceed 999)
56
    return sprintf('%d.%03d.%03d%s', (int)$major, (int)minor, (int)$revision,
57
    (($strip_suffix == false && $suffix != '') ? '_' . $suffix : ''));
58
}
59

  
60
/**
61
 *	As "version_compare" it self seems only got trouble 
62
 *	within words like "Alpha", "Beta" a.s.o. this function
63
 *	only modify the version-string in the way that these words are replaced by values/numbers.
64
 *
65
 *	E.g:	"1.2.3 Beta2" => "1.2.322"
66
 *			"0.1.1 ALPHA" => "0.1.11"
67
 *
68
 *	Notice:	Please keep in mind, that this will not correct the way "version_control" 
69
 *			handel "1 < 1.0 < 1.0.0 < 1.0.0.0" and will not correct missformed version-strings
70
 *			below 2.7, e.g. "1.002 released candidate 2.3"
71
 *			
72
 *	@since	2.8.0 RC2
73
 *
74
 *	@param	string	A versionstring
75
 *	@return	string	The modificated versionstring
76
 *
77
 */
78
function getVersion2 ($version="") {
79
	
80
	$states = array (
81
		'1' => "alpha",
82
		'2' => "beta",
83
		'4' => "rc",
84
		'8' => "final"	
85
	);
86

  
87
	$version = strtolower($version);
88
	
89
	foreach($states as $value=>$keys) $version = str_replace($keys, $value, $version);
90

  
91
	$version = str_replace(" ", "", $version);
92

  
93
	return $version;
94
}
95

  
96
function versionCompare($version1, $version2, $operator = '>=')
97
{
98
	/**
99
	 * This funtion performs a comparison of two provided version strings
100
	 * The versions are first converted into a string following the major.minor.revision 
101
	 * convention and performs a version_compare afterwards.
102
	 */
103
	// return version_compare(getVersion($version1), getVersion($version2), $operator);
104
	return version_compare(getVersion2($version1), getVersion2($version2), $operator);
105
}
106

  
107
function sortPreCheckArray($precheck_array)
108
{
109
	/**
110
	 * This funtion sorts the precheck array to a common format
111
	 */
112
	// define desired precheck order
113
	$key_order = array('WB_VERSION', 'WB_ADDONS', 'PHP_VERSION', 'PHP_EXTENSIONS', 'PHP_SETTINGS', 'CUSTOM_CHECKS');
114

  
115
	$temp_array = array();
116
	foreach($key_order as $key) {
117
		if (!isset($precheck_array[$key])) continue;
118
		$temp_array[$key] = $precheck_array[$key];
119
	}
120
	return $temp_array;
121
}
122

  
123
function preCheckAddon($temp_addon_file)
124
{
125
	/**
126
	 * This funtion performs pretest upfront of the Add-On installation process.
127
	 * The requirements can be specified via the array $PRECHECK which needs to
128
	 * be defined in the optional Add-on file precheck.php.
129
	 */
130
	global $database, $admin, $TEXT, $HEADING, $MESSAGE;
131
	
132
	// path to the temporary Add-on folder
133
	$temp_path = WB_PATH . '/temp/unzip';
134
	
135
	// check if file precheck.php exists for the Add-On uploaded via WB installation routine
136
	if (!file_exists($temp_path . '/precheck.php')) return;
137
	
138
	// unset any previous declared PRECHECK array
139
	unset($PRECHECK);
140

  
141
	// include Add-On precheck.php file
142
	include($temp_path . '/precheck.php');
143
	
144
	// check if there are any Add-On requirements to check for
145
	if (!(isset($PRECHECK) && count($PRECHECK) > 0)) return;
146
	
147
	// sort precheck array
148
	$PRECHECK = sortPreCheckArray($PRECHECK);
149
	
150
	$failed_checks = 0;
151
	$msg = array();
152
	// check if specified addon requirements are fullfilled
153
	foreach ($PRECHECK as $key => $value) {
154
		switch ($key) {
155
			case 'WB_VERSION':
156
				if (isset($value['VERSION'])) {
157
					// obtain operator for string comparison if exist
158
					$operator = (isset($value['OPERATOR']) &&  trim($value['OPERATOR']) != '') ? $value['OPERATOR'] : '>=';
159
				
160
					// compare versions and extract actual status
161
					$status = versionCompare(WB_VERSION, $value['VERSION'], $operator);
162
					$msg[] = array(
163
						'check'		=> 'WB-' . $TEXT['VERSION'] .': ',
164
						'required'	=> htmlentities($operator) . $value['VERSION'],
165
						'actual'	=> WB_VERSION,
166
						'status'	=> $status
167
					);
168

  
169
					// increase counter if required
170
					if (!$status) $failed_checks++;
171
				}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff