Revision 1392
Added by Dietmar almost 14 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
|
13 | 13 |
------------------------------------- 2.8.2 ------------------------------------- |
14 |
16 Jan-2011 Build 1392 Dietmar Woellbrink (Luisehahne) |
|
15 |
! update headerinfos, change secure messages |
|
14 | 16 |
16 Jan-2011 Build 1389-1391 Frank Heyne (FrankH) |
15 | 17 |
# Security fixes for modules captcha_control, code and droplets |
16 | 18 |
16 Jan-2011 Build 1388 Dietmar Woellbrink (Luisehahne) |
branches/2.8.x/wb/admin/templates/uninstall.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package templates |
|
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/settings/save.php $ |
|
15 |
* @lastmodified $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $ |
|
16 |
* |
|
17 |
*/ |
|
2 | 18 |
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 | 19 |
// Check if user selected template |
27 | 20 |
if(!isset($_POST['file']) OR $_POST['file'] == "") { |
28 | 21 |
header("Location: index.php"); |
... | ... | |
44 | 37 |
|
45 | 38 |
if( !$admin->checkFTAN() ) |
46 | 39 |
{ |
47 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
40 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
48 | 41 |
exit(); |
49 | 42 |
} |
50 | 43 |
|
branches/2.8.x/wb/admin/templates/details.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
// Include the config file |
|
27 |
require('../../config.php'); |
|
28 |
require_once(WB_PATH .'/framework/functions.php'); |
|
29 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
30 |
$admin = new admin('Addons', 'templates_view',false); |
|
31 |
|
|
32 |
if( !$admin->checkFTAN() ) |
|
33 |
{ |
|
34 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php'); |
|
35 |
exit(); |
|
36 |
} |
|
37 |
|
|
38 |
// Get template name |
|
39 |
if(!isset($_POST['file']) OR $_POST['file'] == "") { |
|
40 |
header("Location: index.php"); |
|
41 |
exit(0); |
|
42 |
} else { |
|
43 |
$file = preg_replace("/\W/", "", $admin->add_slashes($_POST['file'])); // fix secunia 2010-92-2 |
|
44 |
} |
|
45 |
|
|
46 |
// Check if the template exists |
|
47 |
if(!file_exists(WB_PATH.'/templates/'.$file)) { |
|
48 |
header("Location: index.php"); |
|
49 |
exit(0); |
|
50 |
} |
|
51 |
|
|
52 |
// Print admin header |
|
53 |
$admin = new admin('Addons', 'templates_view'); |
|
54 |
|
|
55 |
// Setup template object |
|
56 |
$template = new Template(THEME_PATH.'/templates'); |
|
57 |
$template->set_file('page', 'templates_details.htt'); |
|
58 |
$template->set_block('page', 'main_block', 'main'); |
|
59 |
$template->set_var('FTAN', $admin->getFTAN()); |
|
60 |
|
|
61 |
// Insert values |
|
62 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'"); |
|
63 |
if($result->numRows() > 0) { |
|
64 |
$row = $result->fetchRow(); |
|
65 |
} |
|
66 |
|
|
67 |
// check if a template description exists for the displayed backend language |
|
68 |
$tool_description = false; |
|
69 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) { |
|
70 |
// read contents of the template language file into string |
|
71 |
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php'); |
|
72 |
// use regular expressions to fetch the content of the variable from the string |
|
73 |
$tool_description = get_variable_content('template_description', $data, false, false); |
|
74 |
// replace optional placeholder {WB_URL} with value stored in config.php |
|
75 |
if($tool_description !== false && strlen(trim($tool_description)) != 0) { |
|
76 |
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description); |
|
77 |
} else { |
|
78 |
$tool_description = false; |
|
79 |
} |
|
80 |
} |
|
81 |
if($tool_description !== false) { |
|
82 |
// Override the template-description with correct desription in users language |
|
83 |
$row['description'] = $tool_description; |
|
84 |
} |
|
85 |
|
|
86 |
$template->set_var(array( |
|
87 |
'NAME' => $row['name'], |
|
88 |
'AUTHOR' => $row['author'], |
|
89 |
'DESCRIPTION' => $row['description'], |
|
90 |
'VERSION' => $row['version'], |
|
91 |
'DESIGNED_FOR' => $row['platform'] |
|
92 |
) |
|
93 |
); |
|
94 |
|
|
95 |
// Insert language headings |
|
96 |
$template->set_var(array( |
|
97 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
98 |
) |
|
99 |
); |
|
100 |
// Insert language text and messages |
|
101 |
$template->set_var(array( |
|
102 |
'TEXT_NAME' => $TEXT['NAME'], |
|
103 |
'TEXT_AUTHOR' => $TEXT['AUTHOR'], |
|
104 |
'TEXT_VERSION' => $TEXT['VERSION'], |
|
105 |
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'], |
|
106 |
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'], |
|
107 |
'TEXT_BACK' => $TEXT['BACK'] |
|
108 |
) |
|
109 |
); |
|
110 |
|
|
111 |
// Parse template object |
|
112 |
$template->parse('main', 'main_block', false); |
|
113 |
$template->pparse('output', 'page'); |
|
114 |
|
|
115 |
// Print admin footer |
|
116 |
$admin->print_footer(); |
|
117 |
|
|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package templates |
|
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/settings/save.php $ |
|
15 |
* @lastmodified $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $ |
|
16 |
* |
|
17 |
*/ |
|
18 |
|
|
19 |
// Include the config file |
|
20 |
require('../../config.php'); |
|
21 |
require_once(WB_PATH .'/framework/functions.php'); |
|
22 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
23 |
$admin = new admin('Addons', 'templates_view',false); |
|
24 |
|
|
25 |
if( !$admin->checkFTAN() ) |
|
26 |
{ |
|
27 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php'); |
|
28 |
exit(); |
|
29 |
} |
|
30 |
|
|
31 |
// Get template name |
|
32 |
if(!isset($_POST['file']) OR $_POST['file'] == "") { |
|
33 |
header("Location: index.php"); |
|
34 |
exit(0); |
|
35 |
} else { |
|
36 |
$file = preg_replace("/\W/", "", $admin->add_slashes($_POST['file'])); // fix secunia 2010-92-2 |
|
37 |
} |
|
38 |
|
|
39 |
// Check if the template exists |
|
40 |
if(!file_exists(WB_PATH.'/templates/'.$file)) { |
|
41 |
header("Location: index.php"); |
|
42 |
exit(0); |
|
43 |
} |
|
44 |
|
|
45 |
// Print admin header |
|
46 |
$admin = new admin('Addons', 'templates_view'); |
|
47 |
|
|
48 |
// Setup template object |
|
49 |
$template = new Template(THEME_PATH.'/templates'); |
|
50 |
$template->set_file('page', 'templates_details.htt'); |
|
51 |
$template->set_block('page', 'main_block', 'main'); |
|
52 |
$template->set_var('FTAN', $admin->getFTAN()); |
|
53 |
|
|
54 |
// Insert values |
|
55 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'"); |
|
56 |
if($result->numRows() > 0) { |
|
57 |
$row = $result->fetchRow(); |
|
58 |
} |
|
59 |
|
|
60 |
// check if a template description exists for the displayed backend language |
|
61 |
$tool_description = false; |
|
62 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) { |
|
63 |
// read contents of the template language file into string |
|
64 |
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php'); |
|
65 |
// use regular expressions to fetch the content of the variable from the string |
|
66 |
$tool_description = get_variable_content('template_description', $data, false, false); |
|
67 |
// replace optional placeholder {WB_URL} with value stored in config.php |
|
68 |
if($tool_description !== false && strlen(trim($tool_description)) != 0) { |
|
69 |
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description); |
|
70 |
} else { |
|
71 |
$tool_description = false; |
|
72 |
} |
|
73 |
} |
|
74 |
if($tool_description !== false) { |
|
75 |
// Override the template-description with correct desription in users language |
|
76 |
$row['description'] = $tool_description; |
|
77 |
} |
|
78 |
|
|
79 |
$template->set_var(array( |
|
80 |
'NAME' => $row['name'], |
|
81 |
'AUTHOR' => $row['author'], |
|
82 |
'DESCRIPTION' => $row['description'], |
|
83 |
'VERSION' => $row['version'], |
|
84 |
'DESIGNED_FOR' => $row['platform'] |
|
85 |
) |
|
86 |
); |
|
87 |
|
|
88 |
// Insert language headings |
|
89 |
$template->set_var(array( |
|
90 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
91 |
) |
|
92 |
); |
|
93 |
// Insert language text and messages |
|
94 |
$template->set_var(array( |
|
95 |
'TEXT_NAME' => $TEXT['NAME'], |
|
96 |
'TEXT_AUTHOR' => $TEXT['AUTHOR'], |
|
97 |
'TEXT_VERSION' => $TEXT['VERSION'], |
|
98 |
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'], |
|
99 |
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'], |
|
100 |
'TEXT_BACK' => $TEXT['BACK'] |
|
101 |
) |
|
102 |
); |
|
103 |
|
|
104 |
// Parse template object |
|
105 |
$template->parse('main', 'main_block', false); |
|
106 |
$template->pparse('output', 'page'); |
|
107 |
|
|
108 |
// Print admin footer |
|
109 |
$admin->print_footer(); |
|
110 |
|
|
118 | 111 |
?> |
branches/2.8.x/wb/admin/templates/install.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package templates |
|
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: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/settings/save.php $ |
|
15 |
* @lastmodified $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $ |
|
16 |
* |
|
17 |
*/ |
|
2 | 18 |
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 | 19 |
// Check if user uploaded a file |
27 | 20 |
if(!isset($_FILES['userfile'])) { |
28 | 21 |
header("Location: index.php"); |
... | ... | |
39 | 32 |
|
40 | 33 |
if( !$admin->checkFTAN() ) |
41 | 34 |
{ |
42 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
35 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
43 | 36 |
exit(); |
44 | 37 |
} |
45 | 38 |
|
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.RC4'); |
55 |
if(!defined('REVISION')) define('REVISION', '1391');
|
|
55 |
if(!defined('REVISION')) define('REVISION', '1392');
|
|
56 | 56 |
|
57 | 57 |
?> |
branches/2.8.x/wb/admin/settings/save.php | ||
---|---|---|
35 | 35 |
|
36 | 36 |
if( !$admin->checkFTAN() ) |
37 | 37 |
{ |
38 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
38 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
39 | 39 |
exit(); |
40 | 40 |
} |
41 | 41 |
|
branches/2.8.x/wb/admin/users/save.php | ||
---|---|---|
25 | 25 |
//$database = new database(); |
26 | 26 |
if( !$admin->checkFTAN() ) |
27 | 27 |
{ |
28 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
28 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
29 | 29 |
exit(); |
30 | 30 |
} |
31 | 31 |
|
branches/2.8.x/wb/admin/users/add.php | ||
---|---|---|
1 |
<?php
|
|
2 |
/**
|
|
3 |
*
|
|
4 |
* @category admin
|
|
5 |
* @package users
|
|
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 |
// Print admin header
|
|
20 |
require('../../config.php');
|
|
21 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
22 |
$admin = new admin('Access', 'users_add');
|
|
23 |
|
|
24 |
// Create new database object
|
|
25 |
//$database = new database();
|
|
26 |
if( !$admin->checkFTAN() )
|
|
27 |
{
|
|
28 |
$admin->print_error($MESSAGE['PAGES_NOT_SAVED'],'index.php');
|
|
29 |
exit();
|
|
30 |
}
|
|
31 |
|
|
32 |
// Get details entered
|
|
33 |
$groups_id = implode(",", $admin->add_slashes($_POST['groups'])); //should check permissions
|
|
34 |
$groups_id = trim($groups_id, ','); // there will be an additional ',' when "Please Choose" was selected, too
|
|
35 |
$active = $admin->add_slashes($_POST['active'][0]);
|
|
36 |
$username_fieldname = $admin->get_post_escaped('username_fieldname');
|
|
37 |
$username = strtolower($admin->get_post_escaped($username_fieldname));
|
|
38 |
$password = $admin->get_post('password');
|
|
39 |
$password2 = $admin->get_post('password2');
|
|
40 |
$display_name = $admin->get_post_escaped('display_name');
|
|
41 |
$email = $admin->get_post_escaped('email');
|
|
42 |
$home_folder = $admin->get_post_escaped('home_folder');
|
|
43 |
$default_language = DEFAULT_LANGUAGE;
|
|
44 |
|
|
45 |
// Create a javascript back link
|
|
46 |
$js_back = 'javascript: history.go(-1);';
|
|
47 |
|
|
48 |
// Check values
|
|
49 |
if($groups_id == '') {
|
|
50 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back);
|
|
51 |
}
|
|
52 |
if(strlen($username) < 2) {
|
|
53 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TOO_SHORT'], $js_back);
|
|
54 |
}
|
|
55 |
if(strlen($password) < 2) {
|
|
56 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_TOO_SHORT'], $js_back);
|
|
57 |
}
|
|
58 |
if($password != $password2) {
|
|
59 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_MISMATCH'], $js_back);
|
|
60 |
}
|
|
61 |
if($email != '')
|
|
62 |
{
|
|
63 |
if($admin->validate_email($email) == false)
|
|
64 |
{
|
|
65 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
66 |
}
|
|
67 |
} else { // e-mail must be present
|
|
68 |
$admin->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back);
|
|
69 |
}
|
|
70 |
|
|
71 |
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
|
|
72 |
$gid_tmp = explode(',', $groups_id);
|
|
73 |
if(in_array('1', $gid_tmp)) $group_id = '1'; // if user is in administrator-group, get this group
|
|
74 |
else $group_id = $gid_tmp[0]; // else just get the first one
|
|
75 |
unset($gid_tmp);
|
|
76 |
|
|
77 |
// Check if username already exists
|
|
78 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE username = '$username'");
|
|
79 |
if($results->numRows() > 0) {
|
|
80 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TAKEN'], $js_back);
|
|
81 |
}
|
|
82 |
|
|
83 |
// Check if the email already exists
|
|
84 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$admin->add_slashes($_POST['email'])."'");
|
|
85 |
if($results->numRows() > 0)
|
|
86 |
{
|
|
87 |
if(isset($MESSAGE['USERS']['EMAIL_TAKEN']))
|
|
88 |
{
|
|
89 |
$admin->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back);
|
|
90 |
} else {
|
|
91 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back);
|
|
92 |
}
|
|
93 |
}
|
|
94 |
|
|
95 |
// MD5 supplied password
|
|
96 |
$md5_password = md5($password);
|
|
97 |
|
|
98 |
// Inser the user into the database
|
|
99 |
$query = "INSERT INTO ".TABLE_PREFIX."users (group_id,groups_id,active,username,password,display_name,home_folder,email,timezone, language) VALUES ('$group_id', '$groups_id', '$active', '$username','$md5_password','$display_name','$home_folder','$email','-72000', '$default_language')";
|
|
100 |
$database->query($query);
|
|
101 |
if($database->is_error()) {
|
|
102 |
$admin->print_error($database->get_error());
|
|
103 |
} else {
|
|
104 |
$admin->print_success($MESSAGE['USERS']['ADDED']);
|
|
105 |
}
|
|
106 |
|
|
107 |
// Print admin footer
|
|
108 |
$admin->print_footer();
|
|
109 |
|
|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package users |
|
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 |
// Print admin header |
|
20 |
require('../../config.php'); |
|
21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
22 |
$admin = new admin('Access', 'users_add'); |
|
23 |
|
|
24 |
// Create new database object |
|
25 |
//$database = new database(); |
|
26 |
if( !$admin->checkFTAN() ) |
|
27 |
{ |
|
28 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
29 |
exit(); |
|
30 |
} |
|
31 |
|
|
32 |
// Get details entered |
|
33 |
$groups_id = implode(",", $admin->add_slashes($_POST['groups'])); //should check permissions |
|
34 |
$groups_id = trim($groups_id, ','); // there will be an additional ',' when "Please Choose" was selected, too |
|
35 |
$active = $admin->add_slashes($_POST['active'][0]); |
|
36 |
$username_fieldname = $admin->get_post_escaped('username_fieldname'); |
|
37 |
$username = strtolower($admin->get_post_escaped($username_fieldname)); |
|
38 |
$password = $admin->get_post('password'); |
|
39 |
$password2 = $admin->get_post('password2'); |
|
40 |
$display_name = $admin->get_post_escaped('display_name'); |
|
41 |
$email = $admin->get_post_escaped('email'); |
|
42 |
$home_folder = $admin->get_post_escaped('home_folder'); |
|
43 |
$default_language = DEFAULT_LANGUAGE; |
|
44 |
|
|
45 |
// Create a javascript back link |
|
46 |
$js_back = 'javascript: history.go(-1);'; |
|
47 |
|
|
48 |
// Check values |
|
49 |
if($groups_id == '') { |
|
50 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back); |
|
51 |
} |
|
52 |
if(strlen($username) < 2) { |
|
53 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TOO_SHORT'], $js_back); |
|
54 |
} |
|
55 |
if(strlen($password) < 2) { |
|
56 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_TOO_SHORT'], $js_back); |
|
57 |
} |
|
58 |
if($password != $password2) { |
|
59 |
$admin->print_error($MESSAGE['USERS']['PASSWORD_MISMATCH'], $js_back); |
|
60 |
} |
|
61 |
if($email != '') |
|
62 |
{ |
|
63 |
if($admin->validate_email($email) == false) |
|
64 |
{ |
|
65 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back); |
|
66 |
} |
|
67 |
} else { // e-mail must be present |
|
68 |
$admin->print_error($MESSAGE['SIGNUP']['NO_EMAIL'], $js_back); |
|
69 |
} |
|
70 |
|
|
71 |
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up) |
|
72 |
$gid_tmp = explode(',', $groups_id); |
|
73 |
if(in_array('1', $gid_tmp)) $group_id = '1'; // if user is in administrator-group, get this group |
|
74 |
else $group_id = $gid_tmp[0]; // else just get the first one |
|
75 |
unset($gid_tmp); |
|
76 |
|
|
77 |
// Check if username already exists |
|
78 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE username = '$username'"); |
|
79 |
if($results->numRows() > 0) { |
|
80 |
$admin->print_error($MESSAGE['USERS']['USERNAME_TAKEN'], $js_back); |
|
81 |
} |
|
82 |
|
|
83 |
// Check if the email already exists |
|
84 |
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$admin->add_slashes($_POST['email'])."'"); |
|
85 |
if($results->numRows() > 0) |
|
86 |
{ |
|
87 |
if(isset($MESSAGE['USERS']['EMAIL_TAKEN'])) |
|
88 |
{ |
|
89 |
$admin->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back); |
|
90 |
} else { |
|
91 |
$admin->print_error($MESSAGE['USERS']['INVALID_EMAIL'], $js_back); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
// MD5 supplied password |
|
96 |
$md5_password = md5($password); |
|
97 |
|
|
98 |
// Inser the user into the database |
|
99 |
$query = "INSERT INTO ".TABLE_PREFIX."users (group_id,groups_id,active,username,password,display_name,home_folder,email,timezone, language) VALUES ('$group_id', '$groups_id', '$active', '$username','$md5_password','$display_name','$home_folder','$email','-72000', '$default_language')"; |
|
100 |
$database->query($query); |
|
101 |
if($database->is_error()) { |
|
102 |
$admin->print_error($database->get_error()); |
|
103 |
} else { |
|
104 |
$admin->print_success($MESSAGE['USERS']['ADDED']); |
|
105 |
} |
|
106 |
|
|
107 |
// Print admin footer |
|
108 |
$admin->print_footer(); |
|
109 |
|
|
110 | 110 |
?> |
Also available in: Unified diff
update headerinfos, change secure messages