Revision 1425
Added by Luisehahne almost 15 years ago
| branches/2.8.x/CHANGELOG | ||
|---|---|---|
| 11 | 11 |
! = Update/Change |
| 12 | 12 |
|
| 13 | 13 |
------------------------------------- 2.8.2 ------------------------------------- |
| 14 |
03 Feb-2011 Build 1425 Dietmar Woellbrink (Luisehahne) |
|
| 15 |
! redefined wrong admin backlinks |
|
| 14 | 16 |
31 Jan-2011 Build 1424 Werner v.d.Decken(DarkViper) |
| 15 | 17 |
# typo fix and simplify used_octets calculation |
| 16 | 18 |
30 Jan-2011 Build 1423 Werner v.d.Decken(DarkViper) |
| branches/2.8.x/wb/admin/groups/save.php | ||
|---|---|---|
| 21 | 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 22 | 22 |
$admin = new admin('Access', 'groups_modify');
|
| 23 | 23 |
|
| 24 |
// Create a javascript back link |
|
| 25 |
$js_back = ADMIN_URL.'/groups/index.php'; |
|
| 26 |
|
|
| 24 | 27 |
if (!$admin->checkFTAN()) |
| 25 | 28 |
{
|
| 26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
|
|
| 29 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
|
|
| 27 | 30 |
exit(); |
| 28 | 31 |
} |
| 29 | 32 |
|
| ... | ... | |
| 38 | 41 |
// Gather details entered |
| 39 | 42 |
$group_name = $admin->get_post_escaped('group_name');
|
| 40 | 43 |
|
| 41 |
// Create a javascript back link |
|
| 42 |
$js_back = "javascript: history.go(-1);"; |
|
| 43 |
|
|
| 44 | 44 |
// Check values |
| 45 | 45 |
if($group_name == "") {
|
| 46 | 46 |
$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back); |
| branches/2.8.x/wb/admin/groups/groups.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category admin |
|
| 5 |
* @package groups |
|
| 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 |
// Include config file and admin class file |
|
| 20 |
require('../../config.php');
|
|
| 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 22 |
|
|
| 23 |
// Create new database object |
|
| 24 |
// $database = new database(); |
|
| 25 |
|
|
| 26 |
if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {
|
|
| 27 |
header("Location: index.php");
|
|
| 28 |
exit(0); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
// Set parameter 'action' as alternative to javascript mechanism |
|
| 32 |
if(isset($_POST['modify'])) |
|
| 33 |
$_POST['action'] = "modify"; |
|
| 34 |
if(isset($_POST['delete'])) |
|
| 35 |
$_POST['action'] = "delete"; |
|
| 36 |
|
|
| 37 |
// Check if group group_id is a valid number and doesnt equal 1 |
|
| 38 |
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
|
|
| 39 |
header("Location: index.php");
|
|
| 40 |
exit(0); |
|
| 41 |
} |
|
| 42 |
|
|
| 43 |
if($_POST['action'] == 'modify') {
|
|
| 44 |
// Create new admin object |
|
| 45 |
$admin = new admin('Access', 'groups_modify', false);
|
|
| 46 |
|
|
| 47 |
if (!$admin->checkFTAN()) |
|
| 48 |
{
|
|
| 49 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL); |
|
| 50 |
exit(); |
|
| 51 |
} |
|
| 52 |
// Print header |
|
| 53 |
$admin->print_header(); |
|
| 54 |
// Get existing values |
|
| 55 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'");
|
|
| 56 |
$group = $results->fetchRow(); |
|
| 57 |
// Setup template object |
|
| 58 |
$template = new Template(THEME_PATH.'/templates'); |
|
| 59 |
$template->set_file('page', 'groups_form.htt');
|
|
| 60 |
$template->set_block('page', 'main_block', 'main');
|
|
| 61 |
$template->set_var( array( |
|
| 62 |
'ACTION_URL' => ADMIN_URL.'/groups/save.php', |
|
| 63 |
'SUBMIT_TITLE' => $TEXT['SAVE'], |
|
| 64 |
'GROUP_ID' => $group['group_id'], |
|
| 65 |
'GROUP_NAME' => $group['name'], |
|
| 66 |
'ADVANCED_ACTION' => 'groups.php', |
|
| 67 |
'FTAN' => $admin->getFTAN() |
|
| 68 |
)); |
|
| 69 |
// Tell the browser whether or not to show advanced options |
|
| 70 |
if( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
|
|
| 71 |
$template->set_var('DISPLAY_ADVANCED', '');
|
|
| 72 |
$template->set_var('DISPLAY_BASIC', 'display:none;');
|
|
| 73 |
$template->set_var('ADVANCED', 'yes');
|
|
| 74 |
$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
|
|
| 75 |
} else {
|
|
| 76 |
$template->set_var('DISPLAY_ADVANCED', 'display:none;');
|
|
| 77 |
$template->set_var('DISPLAY_BASIC', '');
|
|
| 78 |
$template->set_var('ADVANCED', 'no');
|
|
| 79 |
$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
|
|
| 80 |
} |
|
| 81 |
|
|
| 82 |
// Explode system permissions |
|
| 83 |
$system_permissions = explode(',', $group['system_permissions']);
|
|
| 84 |
// Check system permissions boxes |
|
| 85 |
foreach($system_permissions AS $name) {
|
|
| 86 |
$template->set_var($name.'_checked', ' checked="checked"'); |
|
| 87 |
} |
|
| 88 |
// Explode module permissions |
|
| 89 |
$module_permissions = explode(',', $group['module_permissions']);
|
|
| 90 |
// Explode template permissions |
|
| 91 |
$template_permissions = explode(',', $group['template_permissions']);
|
|
| 92 |
|
|
| 93 |
// Insert values into module list |
|
| 94 |
$template->set_block('main_block', 'module_list_block', 'module_list');
|
|
| 95 |
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
|
|
| 96 |
if($result->numRows() > 0) {
|
|
| 97 |
while($addon = $result->fetchRow()) {
|
|
| 98 |
$template->set_var('VALUE', $addon['directory']);
|
|
| 99 |
$template->set_var('NAME', $addon['name']);
|
|
| 100 |
if(!is_numeric(array_search($addon['directory'], $module_permissions))) {
|
|
| 101 |
$template->set_var('CHECKED', ' checked="checked"');
|
|
| 102 |
} else {
|
|
| 103 |
$template->set_var('CHECKED', '');
|
|
| 104 |
} |
|
| 105 |
$template->parse('module_list', 'module_list_block', true);
|
|
| 106 |
} |
|
| 107 |
} |
|
| 108 |
|
|
| 109 |
// Insert values into template list |
|
| 110 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
|
| 111 |
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
|
|
| 112 |
if($result->numRows() > 0) {
|
|
| 113 |
while($addon = $result->fetchRow()) {
|
|
| 114 |
$template->set_var('VALUE', $addon['directory']);
|
|
| 115 |
$template->set_var('NAME', $addon['name']);
|
|
| 116 |
if(!is_numeric(array_search($addon['directory'], $template_permissions))) {
|
|
| 117 |
$template->set_var('CHECKED', ' checked="checked"');
|
|
| 118 |
} else {
|
|
| 119 |
$template->set_var('CHECKED', '');
|
|
| 120 |
} |
|
| 121 |
$template->parse('template_list', 'template_list_block', true);
|
|
| 122 |
} |
|
| 123 |
} |
|
| 124 |
|
|
| 125 |
// Insert language text and messages |
|
| 126 |
$template->set_var(array( |
|
| 127 |
'TEXT_RESET' => $TEXT['RESET'], |
|
| 128 |
'TEXT_ACTIVE' => $TEXT['ACTIVE'], |
|
| 129 |
'TEXT_DISABLED' => $TEXT['DISABLED'], |
|
| 130 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
| 131 |
'TEXT_USERNAME' => $TEXT['USERNAME'], |
|
| 132 |
'TEXT_PASSWORD' => $TEXT['PASSWORD'], |
|
| 133 |
'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'], |
|
| 134 |
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], |
|
| 135 |
'TEXT_EMAIL' => $TEXT['EMAIL'], |
|
| 136 |
'TEXT_GROUP' => $TEXT['GROUP'], |
|
| 137 |
'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'], |
|
| 138 |
'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'], |
|
| 139 |
'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'], |
|
| 140 |
'TEXT_NAME' => $TEXT['NAME'], |
|
| 141 |
'SECTION_PAGES' => $MENU['PAGES'], |
|
| 142 |
'SECTION_MEDIA' => $MENU['MEDIA'], |
|
| 143 |
'SECTION_MODULES' => $MENU['MODULES'], |
|
| 144 |
'SECTION_TEMPLATES' => $MENU['TEMPLATES'], |
|
| 145 |
'SECTION_LANGUAGES' => $MENU['LANGUAGES'], |
|
| 146 |
'SECTION_SETTINGS' => $MENU['SETTINGS'], |
|
| 147 |
'SECTION_USERS' => $MENU['USERS'], |
|
| 148 |
'SECTION_GROUPS' => $MENU['GROUPS'], |
|
| 149 |
'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'], |
|
| 150 |
'TEXT_VIEW' => $TEXT['VIEW'], |
|
| 151 |
'TEXT_ADD' => $TEXT['ADD'], |
|
| 152 |
'TEXT_LEVEL' => $TEXT['LEVEL'], |
|
| 153 |
'TEXT_MODIFY' => $TEXT['MODIFY'], |
|
| 154 |
'TEXT_DELETE' => $TEXT['DELETE'], |
|
| 155 |
'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'], |
|
| 156 |
'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
| 157 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'], |
|
| 158 |
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], |
|
| 159 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
| 160 |
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], |
|
| 161 |
'TEXT_BASIC' => $TEXT['BASIC'], |
|
| 162 |
'TEXT_ADVANCED' => $TEXT['ADVANCED'], |
|
| 163 |
'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'], |
|
| 164 |
'HEADING_MODIFY_GROUP' => $HEADING['MODIFY_GROUP'], |
|
| 165 |
)); |
|
| 166 |
|
|
| 167 |
// Parse template object |
|
| 168 |
$template->parse('main', 'main_block', false);
|
|
| 169 |
$template->pparse('output', 'page');
|
|
| 170 |
} elseif($_POST['action'] == 'delete') {
|
|
| 171 |
// Create new admin object |
|
| 172 |
$admin = new admin('Access', 'groups_delete', false);
|
|
| 173 |
|
|
| 174 |
if (!$admin->checkFTAN()) |
|
| 175 |
{
|
|
| 176 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL); |
|
| 177 |
exit(); |
|
| 178 |
} |
|
| 179 |
|
|
| 180 |
// Print header |
|
| 181 |
$admin->print_header(); |
|
| 182 |
// Delete the group |
|
| 183 |
$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1");
|
|
| 184 |
if($database->is_error()) {
|
|
| 185 |
$admin->print_error($database->get_error()); |
|
| 186 |
} else {
|
|
| 187 |
// Delete users in the group |
|
| 188 |
$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'");
|
|
| 189 |
if($database->is_error()) {
|
|
| 190 |
$admin->print_error($database->get_error()); |
|
| 191 |
} else {
|
|
| 192 |
$admin->print_success($MESSAGE['GROUPS']['DELETED']); |
|
| 193 |
} |
|
| 194 |
} |
|
| 195 |
} |
|
| 196 |
|
|
| 197 |
// Print admin footer |
|
| 198 |
$admin->print_footer(); |
|
| 199 |
|
|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category admin |
|
| 5 |
* @package groups |
|
| 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 |
// Include config file and admin class file |
|
| 20 |
require('../../config.php');
|
|
| 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 22 |
|
|
| 23 |
// Create new database object |
|
| 24 |
// $database = new database(); |
|
| 25 |
|
|
| 26 |
if(!isset($_POST['action']) OR ($_POST['action'] != "modify" AND $_POST['action'] != "delete")) {
|
|
| 27 |
header("Location: index.php");
|
|
| 28 |
exit(0); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
// Set parameter 'action' as alternative to javascript mechanism |
|
| 32 |
if(isset($_POST['modify'])) |
|
| 33 |
$_POST['action'] = "modify"; |
|
| 34 |
if(isset($_POST['delete'])) |
|
| 35 |
$_POST['action'] = "delete"; |
|
| 36 |
|
|
| 37 |
// Check if group group_id is a valid number and doesnt equal 1 |
|
| 38 |
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
|
|
| 39 |
header("Location: index.php");
|
|
| 40 |
exit(0); |
|
| 41 |
} |
|
| 42 |
|
|
| 43 |
if($_POST['action'] == 'modify') {
|
|
| 44 |
// Create new admin object |
|
| 45 |
$admin = new admin('Access', 'groups_modify', false);
|
|
| 46 |
/* */ |
|
| 47 |
if (!$admin->checkFTAN()) |
|
| 48 |
{
|
|
| 49 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL); |
|
| 50 |
exit(); |
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
// Print header |
|
| 54 |
$admin->print_header(); |
|
| 55 |
// Get existing values |
|
| 56 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'");
|
|
| 57 |
$group = $results->fetchRow(); |
|
| 58 |
// Setup template object |
|
| 59 |
$template = new Template(THEME_PATH.'/templates'); |
|
| 60 |
$template->set_file('page', 'groups_form.htt');
|
|
| 61 |
$template->set_block('page', 'main_block', 'main');
|
|
| 62 |
$template->set_var( array( |
|
| 63 |
'ACTION_URL' => ADMIN_URL.'/groups/save.php', |
|
| 64 |
'SUBMIT_TITLE' => $TEXT['SAVE'], |
|
| 65 |
'GROUP_ID' => $group['group_id'], |
|
| 66 |
'GROUP_NAME' => $group['name'], |
|
| 67 |
'ADVANCED_ACTION' => 'groups.php', |
|
| 68 |
'FTAN' => $admin->getFTAN() |
|
| 69 |
)); |
|
| 70 |
// Tell the browser whether or not to show advanced options |
|
| 71 |
if( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
|
|
| 72 |
$template->set_var('DISPLAY_ADVANCED', '');
|
|
| 73 |
$template->set_var('DISPLAY_BASIC', 'display:none;');
|
|
| 74 |
$template->set_var('ADVANCED', 'yes');
|
|
| 75 |
$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
|
|
| 76 |
} else {
|
|
| 77 |
$template->set_var('DISPLAY_ADVANCED', 'display:none;');
|
|
| 78 |
$template->set_var('DISPLAY_BASIC', '');
|
|
| 79 |
$template->set_var('ADVANCED', 'no');
|
|
| 80 |
$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
|
|
| 81 |
} |
|
| 82 |
|
|
| 83 |
// Explode system permissions |
|
| 84 |
$system_permissions = explode(',', $group['system_permissions']);
|
|
| 85 |
// Check system permissions boxes |
|
| 86 |
foreach($system_permissions AS $name) {
|
|
| 87 |
$template->set_var($name.'_checked', ' checked="checked"'); |
|
| 88 |
} |
|
| 89 |
// Explode module permissions |
|
| 90 |
$module_permissions = explode(',', $group['module_permissions']);
|
|
| 91 |
// Explode template permissions |
|
| 92 |
$template_permissions = explode(',', $group['template_permissions']);
|
|
| 93 |
|
|
| 94 |
// Insert values into module list |
|
| 95 |
$template->set_block('main_block', 'module_list_block', 'module_list');
|
|
| 96 |
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
|
|
| 97 |
if($result->numRows() > 0) {
|
|
| 98 |
while($addon = $result->fetchRow()) {
|
|
| 99 |
$template->set_var('VALUE', $addon['directory']);
|
|
| 100 |
$template->set_var('NAME', $addon['name']);
|
|
| 101 |
if(!is_numeric(array_search($addon['directory'], $module_permissions))) {
|
|
| 102 |
$template->set_var('CHECKED', ' checked="checked"');
|
|
| 103 |
} else {
|
|
| 104 |
$template->set_var('CHECKED', '');
|
|
| 105 |
} |
|
| 106 |
$template->parse('module_list', 'module_list_block', true);
|
|
| 107 |
} |
|
| 108 |
} |
|
| 109 |
|
|
| 110 |
// Insert values into template list |
|
| 111 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
|
| 112 |
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
|
|
| 113 |
if($result->numRows() > 0) {
|
|
| 114 |
while($addon = $result->fetchRow()) {
|
|
| 115 |
$template->set_var('VALUE', $addon['directory']);
|
|
| 116 |
$template->set_var('NAME', $addon['name']);
|
|
| 117 |
if(!is_numeric(array_search($addon['directory'], $template_permissions))) {
|
|
| 118 |
$template->set_var('CHECKED', ' checked="checked"');
|
|
| 119 |
} else {
|
|
| 120 |
$template->set_var('CHECKED', '');
|
|
| 121 |
} |
|
| 122 |
$template->parse('template_list', 'template_list_block', true);
|
|
| 123 |
} |
|
| 124 |
} |
|
| 125 |
|
|
| 126 |
// Insert language text and messages |
|
| 127 |
$template->set_var(array( |
|
| 128 |
'TEXT_RESET' => $TEXT['RESET'], |
|
| 129 |
'TEXT_ACTIVE' => $TEXT['ACTIVE'], |
|
| 130 |
'TEXT_DISABLED' => $TEXT['DISABLED'], |
|
| 131 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
| 132 |
'TEXT_USERNAME' => $TEXT['USERNAME'], |
|
| 133 |
'TEXT_PASSWORD' => $TEXT['PASSWORD'], |
|
| 134 |
'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'], |
|
| 135 |
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], |
|
| 136 |
'TEXT_EMAIL' => $TEXT['EMAIL'], |
|
| 137 |
'TEXT_GROUP' => $TEXT['GROUP'], |
|
| 138 |
'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'], |
|
| 139 |
'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'], |
|
| 140 |
'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'], |
|
| 141 |
'TEXT_NAME' => $TEXT['NAME'], |
|
| 142 |
'SECTION_PAGES' => $MENU['PAGES'], |
|
| 143 |
'SECTION_MEDIA' => $MENU['MEDIA'], |
|
| 144 |
'SECTION_MODULES' => $MENU['MODULES'], |
|
| 145 |
'SECTION_TEMPLATES' => $MENU['TEMPLATES'], |
|
| 146 |
'SECTION_LANGUAGES' => $MENU['LANGUAGES'], |
|
| 147 |
'SECTION_SETTINGS' => $MENU['SETTINGS'], |
|
| 148 |
'SECTION_USERS' => $MENU['USERS'], |
|
| 149 |
'SECTION_GROUPS' => $MENU['GROUPS'], |
|
| 150 |
'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'], |
|
| 151 |
'TEXT_VIEW' => $TEXT['VIEW'], |
|
| 152 |
'TEXT_ADD' => $TEXT['ADD'], |
|
| 153 |
'TEXT_LEVEL' => $TEXT['LEVEL'], |
|
| 154 |
'TEXT_MODIFY' => $TEXT['MODIFY'], |
|
| 155 |
'TEXT_DELETE' => $TEXT['DELETE'], |
|
| 156 |
'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'], |
|
| 157 |
'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
| 158 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'], |
|
| 159 |
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], |
|
| 160 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
| 161 |
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], |
|
| 162 |
'TEXT_BASIC' => $TEXT['BASIC'], |
|
| 163 |
'TEXT_ADVANCED' => $TEXT['ADVANCED'], |
|
| 164 |
'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'], |
|
| 165 |
'HEADING_MODIFY_GROUP' => $HEADING['MODIFY_GROUP'], |
|
| 166 |
)); |
|
| 167 |
|
|
| 168 |
// Parse template object |
|
| 169 |
$template->parse('main', 'main_block', false);
|
|
| 170 |
$template->pparse('output', 'page');
|
|
| 171 |
} elseif($_POST['action'] == 'delete') {
|
|
| 172 |
// Create new admin object |
|
| 173 |
$admin = new admin('Access', 'groups_delete', false);
|
|
| 174 |
/* */ |
|
| 175 |
if (!$admin->checkFTAN()) |
|
| 176 |
{
|
|
| 177 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL); |
|
| 178 |
exit(); |
|
| 179 |
} |
|
| 180 |
|
|
| 181 |
// Print header |
|
| 182 |
$admin->print_header(); |
|
| 183 |
// Delete the group |
|
| 184 |
$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1");
|
|
| 185 |
if($database->is_error()) {
|
|
| 186 |
$admin->print_error($database->get_error()); |
|
| 187 |
} else {
|
|
| 188 |
// Delete users in the group |
|
| 189 |
$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'");
|
|
| 190 |
if($database->is_error()) {
|
|
| 191 |
$admin->print_error($database->get_error()); |
|
| 192 |
} else {
|
|
| 193 |
$admin->print_success($MESSAGE['GROUPS']['DELETED']); |
|
| 194 |
} |
|
| 195 |
} |
|
| 196 |
} |
|
| 197 |
|
|
| 198 |
// Print admin footer |
|
| 199 |
$admin->print_footer(); |
|
| 200 |
|
|
| 200 | 201 |
?> |
| branches/2.8.x/wb/admin/groups/add.php | ||
|---|---|---|
| 21 | 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 22 | 22 |
$admin = new admin('Access', 'groups_add');
|
| 23 | 23 |
|
| 24 |
// Create a javascript back link |
|
| 25 |
$js_back = ADMIN_URL.'/groups/index.php'; |
|
| 26 |
|
|
| 24 | 27 |
if (!$admin->checkFTAN()) |
| 25 | 28 |
{
|
| 26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
|
|
| 29 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
|
|
| 27 | 30 |
exit(); |
| 28 | 31 |
} |
| 29 | 32 |
|
| 30 | 33 |
// Gather details entered |
| 31 | 34 |
$group_name = $admin->get_post('group_name');
|
| 32 | 35 |
|
| 33 |
// Create a javascript back link |
|
| 34 |
$js_back = "javascript: history.go(-1);"; |
|
| 35 |
|
|
| 36 | 36 |
// Check values |
| 37 | 37 |
if($group_name == "") {
|
| 38 | 38 |
$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back); |
| branches/2.8.x/wb/admin/media/rename2.php | ||
|---|---|---|
| 23 | 23 |
|
| 24 | 24 |
if (!$admin->checkFTAN()) |
| 25 | 25 |
{
|
| 26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 26 |
$admin->print_error('RN5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 27 | 27 |
exit(); |
| 28 | 28 |
} |
| 29 | 29 |
|
| ... | ... | |
| 54 | 54 |
// Get the temp id |
| 55 | 55 |
$file_id = $admin->checkIDKEY('id', false, 'POST');
|
| 56 | 56 |
if (!$file_id) {
|
| 57 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 57 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
// Get home folder not to show |
| branches/2.8.x/wb/admin/media/setparameter.php | ||
|---|---|---|
| 1 |
<?php
|
|
| 2 |
/**
|
|
| 3 |
*
|
|
| 4 |
* @category admin
|
|
| 5 |
* @package admintools
|
|
| 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 |
require('../../config.php');
|
|
| 20 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
| 21 |
$admin = new admin('Media', 'media', false);
|
|
| 22 |
// Include the WB functions file
|
|
| 23 |
require_once(WB_PATH.'/framework/functions.php');
|
|
| 24 |
|
|
| 25 |
// check if theme language file exists for the language set by the user (e.g. DE, EN)
|
|
| 26 |
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
|
|
| 27 |
// no theme language file exists for the language set by the user, include default theme language file EN.php
|
|
| 28 |
require_once(THEME_PATH .'/languages/EN.php');
|
|
| 29 |
} else {
|
|
| 30 |
// a theme language file exists for the language defined by the user, load it
|
|
| 31 |
require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
|
|
| 32 |
}
|
|
| 33 |
|
|
| 34 |
//Save post vars to the parameters file
|
|
| 35 |
if ( !is_null($admin->get_post_escaped("save"))) {
|
|
| 36 |
if (!$admin->checkFTAN())
|
|
| 37 |
{
|
|
| 38 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 39 |
exit();
|
|
| 40 |
}
|
|
| 41 |
|
|
| 42 |
//Check for existing settings entry, if not existing, create a record first!
|
|
| 43 |
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
|
|
| 44 |
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
|
|
| 45 |
}
|
|
| 46 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
|
| 47 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
|
| 48 |
foreach($dirs AS $name) {
|
|
| 49 |
$r = str_replace(WB_PATH, '', $name);
|
|
| 50 |
$r = str_replace(array('/',' '),'_',$r);
|
|
| 51 |
$w = (int)$admin->get_post_escaped($r.'-w');
|
|
| 52 |
$h = (int)$admin->get_post_escaped($r.'-h');
|
|
| 53 |
$pathsettings[$r]['width']=$w;
|
|
| 54 |
$pathsettings[$r]['height']=$h;
|
|
| 55 |
}
|
|
| 56 |
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
|
|
| 57 |
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
|
|
| 58 |
$fieldSerialized = serialize($pathsettings);
|
|
| 59 |
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" );
|
|
| 60 |
header ("Location: browse.php");
|
|
| 61 |
}
|
|
| 62 |
|
|
| 63 |
include ('parameters.php');
|
|
| 64 |
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
|
|
| 65 |
echo "Sorry, settings not available";
|
|
| 66 |
exit();
|
|
| 67 |
}
|
|
| 68 |
|
|
| 69 |
// Read data to display
|
|
| 70 |
$caller = "setparameter";
|
|
| 71 |
|
|
| 72 |
$template = new Template(THEME_PATH.'/templates');
|
|
| 73 |
$template->set_file('page', 'setparameter.htt');
|
|
| 74 |
$template->set_block('page', 'main_block', 'main');
|
|
| 75 |
if ($_SESSION['GROUP_ID'] != 1) {
|
|
| 76 |
$template->set_var('DISPLAY_ADMIN', 'hide');
|
|
| 77 |
}
|
|
| 78 |
$template->set_var(array(
|
|
| 79 |
'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
|
|
| 80 |
'SAVE_TEXT' => $TEXT['SAVE'],
|
|
| 81 |
'BACK' => $TEXT['BACK'],
|
|
| 82 |
)
|
|
| 83 |
);
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
$template->set_block('main_block', 'list_block', 'list');
|
|
| 87 |
$row_bg_color = '';
|
|
| 88 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
|
|
| 89 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY;
|
|
| 90 |
|
|
| 91 |
$array_lowercase = array_map('strtolower', $dirs);
|
|
| 92 |
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs);
|
|
| 93 |
|
|
| 94 |
foreach($dirs AS $name) {
|
|
| 95 |
$relative = str_replace(WB_PATH, '', $name);
|
|
| 96 |
$safepath = str_replace(array('/',' '),'_',$relative);
|
|
| 97 |
$cur_width = $cur_height = '';
|
|
| 98 |
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width'];
|
|
| 99 |
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height'];
|
|
| 100 |
$cur_width = ($cur_width ? (int)$cur_width : '-');
|
|
| 101 |
$cur_height = ($cur_height ? (int)$cur_height : '-');
|
|
| 102 |
|
|
| 103 |
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
|
|
| 104 |
else $row_bg_color = 'DEDEDE';
|
|
| 105 |
|
|
| 106 |
$template->set_var(array(
|
|
| 107 |
'ADMIN_URL' => ADMIN_URL,
|
|
| 108 |
'PATH_NAME' => $relative,
|
|
| 109 |
'WIDTH' => $TEXT['WIDTH'],
|
|
| 110 |
'HEIGHT' => $TEXT['HEIGHT'],
|
|
| 111 |
'FIELD_NAME_W' => $safepath.'-w',
|
|
| 112 |
'FIELD_NAME_H' => $safepath.'-h',
|
|
| 113 |
'CUR_WIDTH' => $cur_width,
|
|
| 114 |
'CUR_HEIGHT' => $cur_height,
|
|
| 115 |
'SETTINGS' => $TEXT['SETTINGS'],
|
|
| 116 |
'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
|
|
| 117 |
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'],
|
|
| 118 |
'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
|
|
| 119 |
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'],
|
|
| 120 |
'ROW_BG_COLOR' => $row_bg_color,
|
|
| 121 |
'FTAN' => $admin->getFTAN()
|
|
| 122 |
)
|
|
| 123 |
);
|
|
| 124 |
$template->parse('list', 'list_block', true);
|
|
| 125 |
}
|
|
| 126 |
|
|
| 127 |
$template->parse('main', 'main_block', false);
|
|
| 128 |
$template->pparse('output', 'page');
|
|
| 129 |
|
|
| 130 |
|
|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category admin |
|
| 5 |
* @package admintools |
|
| 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 |
require('../../config.php');
|
|
| 20 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 21 |
$admin = new admin('Media', 'media', false);
|
|
| 22 |
// Include the WB functions file |
|
| 23 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 24 |
|
|
| 25 |
// check if theme language file exists for the language set by the user (e.g. DE, EN) |
|
| 26 |
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
|
|
| 27 |
// no theme language file exists for the language set by the user, include default theme language file EN.php |
|
| 28 |
require_once(THEME_PATH .'/languages/EN.php'); |
|
| 29 |
} else {
|
|
| 30 |
// a theme language file exists for the language defined by the user, load it |
|
| 31 |
require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php'); |
|
| 32 |
} |
|
| 33 |
|
|
| 34 |
//Save post vars to the parameters file |
|
| 35 |
if ( !is_null($admin->get_post_escaped("save"))) {
|
|
| 36 |
if (!$admin->checkFTAN()) |
|
| 37 |
{
|
|
| 38 |
$admin->print_error('SP5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 39 |
exit(); |
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
//Check for existing settings entry, if not existing, create a record first! |
|
| 43 |
if (!$database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" )) {
|
|
| 44 |
$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
|
|
| 45 |
} |
|
| 46 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
|
| 47 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
|
| 48 |
foreach($dirs AS $name) {
|
|
| 49 |
$r = str_replace(WB_PATH, '', $name); |
|
| 50 |
$r = str_replace(array('/',' '),'_',$r);
|
|
| 51 |
$w = (int)$admin->get_post_escaped($r.'-w'); |
|
| 52 |
$h = (int)$admin->get_post_escaped($r.'-h'); |
|
| 53 |
$pathsettings[$r]['width']=$w; |
|
| 54 |
$pathsettings[$r]['height']=$h; |
|
| 55 |
} |
|
| 56 |
$pathsettings['global']['admin_only'] = ($admin->get_post_escaped('admin_only')!=''?'checked':'');
|
|
| 57 |
$pathsettings['global']['show_thumbs'] = ($admin->get_post_escaped('show_thumbs')!=''?'checked':'');
|
|
| 58 |
$fieldSerialized = serialize($pathsettings); |
|
| 59 |
$database->query ( "UPDATE ".TABLE_PREFIX."settings SET `value` = '$fieldSerialized' WHERE `name`='mediasettings'" ); |
|
| 60 |
header ("Location: browse.php");
|
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
include ('parameters.php');
|
|
| 64 |
if ($_SESSION['GROUP_ID'] != 1 && $pathsettings['global']['admin_only']) {
|
|
| 65 |
echo "Sorry, settings not available"; |
|
| 66 |
exit(); |
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
// Read data to display |
|
| 70 |
$caller = "setparameter"; |
|
| 71 |
|
|
| 72 |
$template = new Template(THEME_PATH.'/templates'); |
|
| 73 |
$template->set_file('page', 'setparameter.htt');
|
|
| 74 |
$template->set_block('page', 'main_block', 'main');
|
|
| 75 |
if ($_SESSION['GROUP_ID'] != 1) {
|
|
| 76 |
$template->set_var('DISPLAY_ADMIN', 'hide');
|
|
| 77 |
} |
|
| 78 |
$template->set_var(array( |
|
| 79 |
'TEXT_HEADER' => $TEXT['TEXT_HEADER'], |
|
| 80 |
'SAVE_TEXT' => $TEXT['SAVE'], |
|
| 81 |
'BACK' => $TEXT['BACK'], |
|
| 82 |
) |
|
| 83 |
); |
|
| 84 |
|
|
| 85 |
|
|
| 86 |
$template->set_block('main_block', 'list_block', 'list');
|
|
| 87 |
$row_bg_color = ''; |
|
| 88 |
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY); |
|
| 89 |
$dirs[] = WB_PATH.MEDIA_DIRECTORY; |
|
| 90 |
|
|
| 91 |
$array_lowercase = array_map('strtolower', $dirs);
|
|
| 92 |
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $dirs); |
|
| 93 |
|
|
| 94 |
foreach($dirs AS $name) {
|
|
| 95 |
$relative = str_replace(WB_PATH, '', $name); |
|
| 96 |
$safepath = str_replace(array('/',' '),'_',$relative);
|
|
| 97 |
$cur_width = $cur_height = ''; |
|
| 98 |
if (isset($pathsettings[$safepath]['width'])) $cur_width = $pathsettings[$safepath]['width']; |
|
| 99 |
if (isset($pathsettings[$safepath]['height'])) $cur_height = $pathsettings[$safepath]['height']; |
|
| 100 |
$cur_width = ($cur_width ? (int)$cur_width : '-'); |
|
| 101 |
$cur_height = ($cur_height ? (int)$cur_height : '-'); |
|
| 102 |
|
|
| 103 |
if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE'; |
|
| 104 |
else $row_bg_color = 'DEDEDE'; |
|
| 105 |
|
|
| 106 |
$template->set_var(array( |
|
| 107 |
'ADMIN_URL' => ADMIN_URL, |
|
| 108 |
'PATH_NAME' => $relative, |
|
| 109 |
'WIDTH' => $TEXT['WIDTH'], |
|
| 110 |
'HEIGHT' => $TEXT['HEIGHT'], |
|
| 111 |
'FIELD_NAME_W' => $safepath.'-w', |
|
| 112 |
'FIELD_NAME_H' => $safepath.'-h', |
|
| 113 |
'CUR_WIDTH' => $cur_width, |
|
| 114 |
'CUR_HEIGHT' => $cur_height, |
|
| 115 |
'SETTINGS' => $TEXT['SETTINGS'], |
|
| 116 |
'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'], |
|
| 117 |
'ADMIN_ONLY_SELECTED' => $pathsettings['global']['admin_only'], |
|
| 118 |
'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'], |
|
| 119 |
'NO_SHOW_THUMBS_SELECTED' => $pathsettings['global']['show_thumbs'], |
|
| 120 |
'ROW_BG_COLOR' => $row_bg_color, |
|
| 121 |
'FTAN' => $admin->getFTAN() |
|
| 122 |
) |
|
| 123 |
); |
|
| 124 |
$template->parse('list', 'list_block', true);
|
|
| 125 |
} |
|
| 126 |
|
|
| 127 |
$template->parse('main', 'main_block', false);
|
|
| 128 |
$template->pparse('output', 'page');
|
|
| 129 |
|
|
| 130 |
|
|
| 131 | 131 |
?> |
| branches/2.8.x/wb/admin/media/browse.php | ||
|---|---|---|
| 82 | 82 |
|
| 83 | 83 |
// Check to see if it contains ../ |
| 84 | 84 |
if (!check_media_path($directory)) {
|
| 85 |
$admin->print_header(); |
|
| 85 |
// $admin->print_header();
|
|
| 86 | 86 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']); |
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
if(!file_exists(WB_PATH.MEDIA_DIRECTORY.$directory)) {
|
| 90 |
$admin->print_header(); |
|
| 90 |
// $admin->print_header();
|
|
| 91 | 91 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOES_NOT_EXIST']); |
| 92 | 92 |
} |
| 93 | 93 |
|
| branches/2.8.x/wb/admin/media/delete.php | ||
|---|---|---|
| 39 | 39 |
// Get the temp id |
| 40 | 40 |
$file_id = $admin->checkIDKEY('id', false, 'GET');
|
| 41 | 41 |
if (!$file_id) {
|
| 42 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL,false); |
|
| 42 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.'/admin/media/browse.php?dir=',false);
|
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 | 45 |
// Get home folder not to show |
| branches/2.8.x/wb/admin/media/create.php | ||
|---|---|---|
| 37 | 37 |
|
| 38 | 38 |
if (!$admin->checkFTAN()) |
| 39 | 39 |
{
|
| 40 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 40 |
$admin->print_error('CR5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 41 | 41 |
exit(); |
| 42 | 42 |
} |
| 43 | 43 |
|
| branches/2.8.x/wb/admin/media/upload.php | ||
|---|---|---|
| 35 | 35 |
|
| 36 | 36 |
if (!$admin->checkFTAN()) |
| 37 | 37 |
{
|
| 38 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 38 |
$admin->print_error('UP5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 39 | 39 |
exit(); |
| 40 | 40 |
} |
| 41 | 41 |
|
| ... | ... | |
| 43 | 43 |
require_once(WB_PATH.'/framework/functions.php'); |
| 44 | 44 |
|
| 45 | 45 |
// Check to see if target contains ../ |
| 46 |
if (!check_media_path($target, false)) {
|
|
| 47 |
$admin->print_error($MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH']); |
|
| 46 |
if (!check_media_path($target, false)) |
|
| 47 |
{
|
|
| 48 |
$admin->print_error('TD5::'.$MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH']);
|
|
| 48 | 49 |
} |
| 49 | 50 |
|
| 50 | 51 |
// Create relative path of the target location for the file |
| branches/2.8.x/wb/admin/media/rename.php | ||
|---|---|---|
| 38 | 38 |
// Get the temp id |
| 39 | 39 |
$file_id = $admin->checkIDKEY('id', false, 'GET');
|
| 40 | 40 |
if (!$file_id) {
|
| 41 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL);
|
|
| 41 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// Get home folder not to show |
| branches/2.8.x/wb/admin/templates/uninstall.php | ||
|---|---|---|
| 37 | 37 |
|
| 38 | 38 |
if( !$admin->checkFTAN() ) |
| 39 | 39 |
{
|
| 40 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 40 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 41 | 41 |
exit(); |
| 42 | 42 |
} |
| 43 | 43 |
|
| branches/2.8.x/wb/admin/templates/details.php | ||
|---|---|---|
| 24 | 24 |
|
| 25 | 25 |
if( !$admin->checkFTAN() ) |
| 26 | 26 |
{
|
| 27 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 27 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 28 | 28 |
exit(); |
| 29 | 29 |
} |
| 30 | 30 |
|
| branches/2.8.x/wb/admin/templates/install.php | ||
|---|---|---|
| 32 | 32 |
|
| 33 | 33 |
if( !$admin->checkFTAN() ) |
| 34 | 34 |
{
|
| 35 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 35 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 36 | 36 |
exit(); |
| 37 | 37 |
} |
| 38 | 38 |
|
| branches/2.8.x/wb/admin/pages/save.php | ||
|---|---|---|
| 22 | 22 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 23 | 23 |
$admin = new admin('Pages', 'pages_modify');
|
| 24 | 24 |
|
| 25 |
if (!$admin->checkFTAN()) |
|
| 26 |
{
|
|
| 27 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php'); |
|
| 28 |
exit(); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 | 25 |
// Get page & section id |
| 32 | 26 |
if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id'])) {
|
| 33 | 27 |
header("Location: index.php");
|
| ... | ... | |
| 43 | 37 |
$section_id = intval($_POST['section_id']); |
| 44 | 38 |
} |
| 45 | 39 |
|
| 40 |
// $js_back = "javascript: history.go(-1);"; |
|
| 41 |
$js_back = ADMIN_URL.'/pages/modify.php?page_id='.$page_id |
|
| 42 |
|
|
| 43 |
if (!$admin->checkFTAN()) |
|
| 44 |
{
|
|
| 45 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back ); |
|
| 46 |
exit(); |
|
| 47 |
} |
|
| 48 |
|
|
| 46 | 49 |
/* |
| 47 | 50 |
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
|
| 48 | 51 |
{
|
| ... | ... | |
| 57 | 60 |
} |
| 58 | 61 |
*/ |
| 59 | 62 |
|
| 60 |
$js_back = "javascript: history.go(-1);"; |
|
| 61 |
|
|
| 62 | 63 |
// Get perms |
| 63 | 64 |
$sql = 'SELECT `admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` '; |
| 64 | 65 |
$sql .= 'WHERE `page_id` = '.$page_id; |
| ... | ... | |
| 111 | 112 |
// Check if there is a db error, otherwise say successful |
| 112 | 113 |
if($database->is_error()) |
| 113 | 114 |
{
|
| 114 |
$admin->print_error($database->get_error(), $js_back);
|
|
| 115 |
$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'] );
|
|
| 115 | 116 |
} else {
|
| 116 | 117 |
$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'] ); |
| 117 | 118 |
} |
| branches/2.8.x/wb/admin/pages/sections_save.php | ||
|---|---|---|
| 33 | 33 |
|
| 34 | 34 |
if (!$admin->checkFTAN()) |
| 35 | 35 |
{
|
| 36 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 36 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
|
|
| 37 | 37 |
exit(); |
| 38 | 38 |
} |
| 39 | 39 |
|
| branches/2.8.x/wb/admin/pages/settings2.php | ||
|---|---|---|
| 22 | 22 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 23 | 23 |
$admin = new admin('Pages', 'pages_settings');
|
| 24 | 24 |
|
| 25 |
if (!$admin->checkFTAN()) |
|
| 26 |
{
|
|
| 27 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php'); |
|
| 28 |
exit(); |
|
| 29 |
} |
|
| 30 |
|
|
| 31 | 25 |
// Get page id |
| 32 | 26 |
if(!isset($_POST['page_id']) || !is_numeric($_POST['page_id'])) |
| 33 | 27 |
{
|
| ... | ... | |
| 36 | 30 |
} else {
|
| 37 | 31 |
$page_id = $_POST['page_id']; |
| 38 | 32 |
} |
| 33 |
$pagetree_url = ADMIN_URL.'/pages/index.php'; |
|
| 34 |
$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id; |
|
| 39 | 35 |
|
| 36 |
if (!$admin->checkFTAN()) |
|
| 37 |
{
|
|
| 38 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$target_url); |
|
| 39 |
exit(); |
|
| 40 |
} |
|
| 41 |
|
|
| 40 | 42 |
/* |
| 41 | 43 |
if( (!($page_id = $admin->checkIDKEY('page_id', 0, $_SERVER['REQUEST_METHOD']))) )
|
| 42 | 44 |
{
|
| ... | ... | |
| 310 | 312 |
|
| 311 | 313 |
/* END page "access file" code */ |
| 312 | 314 |
|
| 313 |
$pagetree_url = ADMIN_URL.'/pages/index.php'; |
|
| 314 |
$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id; |
|
| 315 |
//$pagetree_url = ADMIN_URL.'/pages/index.php';
|
|
| 316 |
//$target_url = ADMIN_URL.'/pages/settings.php?page_id='.$page_id;
|
|
| 315 | 317 |
// Check if there is a db error, otherwise say successful |
| 316 | 318 |
if($database->is_error()) |
| 317 | 319 |
{
|
| branches/2.8.x/wb/admin/pages/add.php | ||
|---|---|---|
| 23 | 23 |
|
| 24 | 24 |
if (!$admin->checkFTAN()) |
| 25 | 25 |
{
|
| 26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 26 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']); |
|
| 27 | 27 |
exit(); |
| 28 | 28 |
} |
| 29 | 29 |
|
| 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', '1424');
|
|
| 55 |
if(!defined('REVISION')) define('REVISION', '1425');
|
|
| 56 | 56 |
|
| 57 | 57 |
?> |
| branches/2.8.x/wb/admin/settings/save.php | ||
|---|---|---|
| 33 | 33 |
$admin = new admin('Settings', 'settings_advanced');
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 |
// Create a javascript back link |
|
| 37 |
$js_back = ADMIN_URL.'/settings/index.php'.$advanced; |
|
| 38 |
|
|
| 36 | 39 |
if( !$admin->checkFTAN() ) |
| 37 | 40 |
{
|
| 38 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 41 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back );
|
|
| 39 | 42 |
exit(); |
| 40 | 43 |
} |
| 41 | 44 |
|
| 42 |
// Create a javascript back link |
|
| 43 |
$js_back = "javascript: history.go(-1);"; |
|
| 44 |
|
|
| 45 | 45 |
// Ensure that the specified default email is formally valid |
| 46 | 46 |
if(isset($_POST['server_email'])) |
| 47 | 47 |
{
|
| ... | ... | |
| 189 | 189 |
if (!$database->query($sql)) |
| 190 | 190 |
{
|
| 191 | 191 |
if($database->is_error()) {
|
| 192 |
$admin->print_error($database->get_error, ADMIN_URL.'/settings/index.php'.$advanced);
|
|
| 192 |
$admin->print_error($database->get_error, $js_back );
|
|
| 193 | 193 |
} |
| 194 | 194 |
} |
| 195 | 195 |
} |
| ... | ... | |
| 201 | 201 |
$res_search = $database->query($sql); |
| 202 | 202 |
|
| 203 | 203 |
if($database->is_error()) {
|
| 204 |
$admin->print_error($database->is_error(), ADMIN_URL.'/settings/index.php'.$advanced);
|
|
| 204 |
$admin->print_error($database->is_error(), $js_back );
|
|
| 205 | 205 |
} |
| 206 | 206 |
|
| 207 | 207 |
while($search_setting = $res_search->fetchRow()) |
| ... | ... | |
| 229 | 229 |
|
| 230 | 230 |
// Check if there was an error updating the db |
| 231 | 231 |
if($database->is_error()) {
|
| 232 |
$admin->print_error($database->get_error, ADMIN_URL.'/settings/index.php'.$advanced);
|
|
| 232 |
$admin->print_error($database->get_error, $js_back );
|
|
| 233 | 233 |
} else {
|
| 234 |
$admin->print_success($MESSAGE['SETTINGS']['SAVED'], ADMIN_URL.'/settings/index.php'.$advanced);
|
|
| 234 |
$admin->print_success($MESSAGE['SETTINGS']['SAVED'], $js_back );
|
|
| 235 | 235 |
} |
| 236 | 236 |
$admin->print_footer(); |
| 237 | 237 |
|
| branches/2.8.x/wb/admin/users/save.php | ||
|---|---|---|
| 21 | 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 22 | 22 |
$admin = new admin('Access', 'users_modify');
|
| 23 | 23 |
|
| 24 |
|
|
| 25 |
// Create a javascript back link |
|
| 26 |
$js_back = ADMIN_URL.'/users/index.php'; |
|
| 27 |
|
|
| 24 | 28 |
// Create new database object |
| 25 | 29 |
//$database = new database(); |
| 26 | 30 |
if( !$admin->checkFTAN() ) |
| 27 | 31 |
{
|
| 28 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 32 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
|
|
| 29 | 33 |
exit(); |
| 30 | 34 |
} |
| 31 | 35 |
|
| ... | ... | |
| 48 | 52 |
$email = $admin->get_post_escaped('email');
|
| 49 | 53 |
$home_folder = $admin->get_post_escaped('home_folder');
|
| 50 | 54 |
|
| 51 |
// Create a javascript back link |
|
| 52 |
$js_back = "javascript: history.go(-1);"; |
|
| 53 |
|
|
| 54 | 55 |
// Check values |
| 55 | 56 |
if($groups_id == "") {
|
| 56 | 57 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back); |
| ... | ... | |
| 106 | 107 |
} |
| 107 | 108 |
$database->query($query); |
| 108 | 109 |
if($database->is_error()) {
|
| 109 |
$admin->print_error($database->get_error()); |
|
| 110 |
$admin->print_error($database->get_error(),$js_back);
|
|
| 110 | 111 |
} else {
|
| 111 | 112 |
$admin->print_success($MESSAGE['USERS']['SAVED']); |
| 112 | 113 |
} |
| branches/2.8.x/wb/admin/users/add.php | ||
|---|---|---|
| 21 | 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 22 | 22 |
$admin = new admin('Access', 'users_add');
|
| 23 | 23 |
|
| 24 |
// Create a javascript back link |
|
| 25 |
$js_back = ADMIN_URL.'/users/index.php'; |
|
| 26 |
|
|
| 24 | 27 |
// Create new database object |
| 25 | 28 |
//$database = new database(); |
| 26 | 29 |
if( !$admin->checkFTAN() ) |
| 27 | 30 |
{
|
| 28 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],'index.php');
|
|
| 31 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back);
|
|
| 29 | 32 |
exit(); |
| 30 | 33 |
} |
| 31 | 34 |
|
| ... | ... | |
| 42 | 45 |
$home_folder = $admin->get_post_escaped('home_folder');
|
| 43 | 46 |
$default_language = DEFAULT_LANGUAGE; |
| 44 | 47 |
|
| 45 |
// Create a javascript back link |
|
| 46 |
$js_back = 'javascript: history.go(-1);'; |
|
| 47 |
|
|
| 48 | 48 |
// Check values |
| 49 | 49 |
if($groups_id == '') {
|
| 50 | 50 |
$admin->print_error($MESSAGE['USERS']['NO_GROUP'], $js_back); |
| branches/2.8.x/wb/admin/preferences/save.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category admin |
|
| 5 |
* @package preferences |
|
| 6 |
* @author Independend-Software-Team |
|
| 7 |
* @author WebsiteBaker Project |
|
| 8 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 9 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
| 10 |
* @link http://www.websitebaker2.org/ |
|
| 11 |
* @license http://www.gnu.org/licenses/gpl.html |
|
| 12 |
* @platform WebsiteBaker 2.8.x |
|
| 13 |
* @requirements PHP 5.2.2 and higher |
|
| 14 |
* @version $Id$ |
|
| 15 |
* @filesource $HeadURL$ |
|
| 16 |
* @lastmodified $Date$ |
|
| 17 |
* |
|
| 18 |
*/ |
|
| 19 |
|
|
| 20 |
|
|
| 21 |
// Print admin header |
|
| 22 |
require('../../config.php');
|
|
| 23 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 24 |
$admin = new admin('Preferences');
|
|
| 25 |
$js_back = "javascript: history.go(-1);"; // Create a javascript back link |
|
| 26 |
|
|
| 27 |
function save_preferences( &$admin, &$database) |
|
| 28 |
{
|
|
| 29 |
global $MESSAGE; |
|
| 30 |
$err_msg = array(); |
|
| 31 |
$min_pass_length = 6; |
|
| 32 |
// first check form-tan |
|
| 33 |
if(!$admin->checkFTAN()){ $err_msg[] = $MESSAGE['GENERIC_SECURITY_ACCESS']; }
|
|
| 34 |
// Get entered values and validate all |
|
| 35 |
// remove any dangerouse chars from display_name |
|
| 36 |
$display_name = $admin->add_slashes(strip_tags(trim($admin->get_post('display_name'))));
|
|
| 37 |
$display_name = ( $display_name == '' ? $admin->get_display_name() : $display_name ); |
|
| 38 |
// check that display_name is unique in whoole system (prevents from User-faking) |
|
| 39 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
|
| 40 |
$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"'; |
|
| 41 |
if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['USERNAME_TAKEN']; }
|
|
| 42 |
// language must be 2 upercase letters only |
|
| 43 |
$language = strtoupper($admin->get_post('language'));
|
|
| 44 |
$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
|
|
| 45 |
// timezone must be between -12 and +13 or -20 as system_default |
|
| 46 |
$timezone = $admin->get_post('timezone');
|
|
| 47 |
$timezone = (is_numeric($timezone) ? $timezone : -20); |
|
| 48 |
$timezone = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600; |
|
| 49 |
// date_format must be a key from /interface/date_formats |
|
| 50 |
$date_format = $admin->get_post('date_format');
|
|
| 51 |
$date_format_key = str_replace(' ', '|', $date_format);
|
|
| 52 |
$user_time = true; |
|
| 53 |
include( ADMIN_PATH.'/interface/date_formats.php' ); |
|
| 54 |
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default'); |
|
| 55 |
$date_format = ($date_format == 'system_default' ? '' : $date_format); |
|
| 56 |
unset($DATE_FORMATS); |
|
| 57 |
// time_format must be a key from /interface/time_formats |
|
| 58 |
$time_format = $admin->get_post('time_format');
|
|
| 59 |
$time_format_key = str_replace(' ', '|', $time_format);
|
|
| 60 |
$user_time = true; |
|
| 61 |
include( ADMIN_PATH.'/interface/time_formats.php' ); |
|
| 62 |
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default'); |
|
| 63 |
$time_format = ($time_format == 'system_default' ? '' : $time_format); |
|
| 64 |
unset($TIME_FORMATS); |
|
| 65 |
// email should be validatet by core |
|
| 66 |
$email = ( $admin->get_post('email') == null ? '' : $admin->get_post('email') );
|
|
| 67 |
if( !$admin->validate_email($email) ) |
|
| 68 |
{
|
|
| 69 |
$email = ''; |
|
| 70 |
$err_msg[] = $MESSAGE['USERS']['INVALID_EMAIL']; |
|
| 71 |
}else {
|
|
| 72 |
// check that email is unique in whoole system |
|
| 73 |
$email = $admin->add_slashes($email); |
|
| 74 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
|
| 75 |
$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `email` LIKE "'.$email.'"'; |
|
| 76 |
if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['EMAIL_TAKEN']; }
|
|
| 77 |
} |
|
| 78 |
// receive password vars and calculate needed action |
|
| 79 |
$current_password = $admin->get_post('current_password');
|
|
| 80 |
$current_password = ($current_password == null ? '' : $current_password); |
|
| 81 |
$new_password_1 = $admin->get_post('new_password_1');
|
|
| 82 |
$new_password_1 = (($new_password_1 == null || $new_password_1 == '') ? '' : $new_password_1); |
|
| 83 |
$new_password_2 = $admin->get_post('new_password_2');
|
|
| 84 |
$new_password_2 = (($new_password_2 == null || $new_password_2 == '') ? '' : $new_password_2); |
|
| 85 |
if($current_password == '') |
|
| 86 |
{
|
|
| 87 |
$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT']; |
|
| 88 |
}else {
|
|
| 89 |
// if new_password is empty, still let current one |
|
| 90 |
if( $new_password_1 == '' ) |
|
| 91 |
{
|
|
| 92 |
$new_password_1 = $current_password; |
|
| 93 |
$new_password_2 = $current_password; |
|
| 94 |
} |
|
| 95 |
|
|
| 96 |
// is password lenght matching min_pass_lenght ? |
|
| 97 |
if( $new_password_1 != $current_password ) |
|
| 98 |
{
|
|
| 99 |
if( strlen($new_password_1) < $min_pass_length ) |
|
| 100 |
{
|
|
| 101 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT']; |
|
| 102 |
} |
|
| 103 |
$pattern = '/[^'.$admin->password_chars.']/'; |
|
| 104 |
if( preg_match($pattern, $new_password_1) ) |
|
| 105 |
{
|
|
| 106 |
$err_msg[] = $MESSAGE['PREFERENCES']['INVALID_CHARS']; |
|
| 107 |
} |
|
| 108 |
} |
|
| 109 |
// is password lenght matching min_pass_lenght ? |
|
| 110 |
if( $new_password_1 != $current_password && strlen($new_password_1) < $min_pass_length ) |
|
| 111 |
{
|
|
| 112 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT']; |
|
| 113 |
} |
|
| 114 |
// password_1 matching password_2 ? |
|
| 115 |
if( $new_password_1 != $new_password_2 ) |
|
| 116 |
{
|
|
| 117 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_MISMATCH']; |
|
| 118 |
} |
|
| 119 |
} |
|
| 120 |
$current_password = md5($current_password); |
|
| 121 |
$new_password_1 = md5($new_password_1); |
|
| 122 |
$new_password_2 = md5($new_password_2); |
|
| 123 |
// if no validation errors, try to update the database, otherwise return errormessages |
|
| 124 |
if(sizeof($err_msg) == 0) |
|
| 125 |
{
|
|
| 126 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` '; |
|
| 127 |
$sql .= 'SET `display_name` = "'.$display_name.'", '; |
|
| 128 |
$sql .= '`password` = "'.$new_password_1.'", '; |
|
| 129 |
$sql .= '`email` = "'.$email.'", '; |
|
| 130 |
$sql .= '`language` = "'.$language.'", '; |
|
| 131 |
$sql .= '`timezone` = "'.$timezone.'", '; |
|
| 132 |
$sql .= '`date_format` = "'.$date_format.'", '; |
|
| 133 |
$sql .= '`time_format` = "'.$time_format.'" '; |
|
| 134 |
$sql .= 'WHERE `user_id` = '.(int)$admin->get_user_id().' AND `password` = "'.$current_password.'"'; |
|
| 135 |
if( $database->query($sql) ) |
|
| 136 |
{
|
|
| 137 |
$sql_info = mysql_info($database->db_handle); |
|
| 138 |
if(preg_match('/matched: *([1-9][0-9]*)/i', $sql_info) != 1)
|
|
| 139 |
{ // if the user_id and password dosn't match
|
|
| 140 |
$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT']; |
|
| 141 |
}else {
|
|
| 142 |
// update successfull, takeover values into the session |
|
| 143 |
$_SESSION['DISPLAY_NAME'] = $display_name; |
|
| 144 |
$_SESSION['LANGUAGE'] = $language; |
|
| 145 |
$_SESSION['TIMEZONE'] = $timezone; |
|
| 146 |
$_SESSION['EMAIL'] = $email; |
|
| 147 |
// Update date format |
|
| 148 |
if($date_format != '') {
|
|
| 149 |
$_SESSION['DATE_FORMAT'] = $date_format; |
|
| 150 |
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
|
|
| 151 |
} else {
|
|
| 152 |
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true; |
|
| 153 |
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
|
|
| 154 |
} |
|
| 155 |
// Update time format |
|
| 156 |
if($time_format != '') {
|
|
| 157 |
$_SESSION['TIME_FORMAT'] = $time_format; |
|
| 158 |
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
|
|
| 159 |
} else {
|
|
| 160 |
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true; |
|
| 161 |
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
|
|
| 162 |
} |
|
| 163 |
} |
|
| 164 |
}else {
|
|
| 165 |
$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__; |
|
| 166 |
} |
|
| 167 |
} |
|
| 168 |
return ( (sizeof($err_msg) > 0) ? implode('<br />', $err_msg) : '' );
|
|
| 169 |
} |
|
| 170 |
$retval = save_preferences($admin, $database); |
|
| 171 |
if( $retval == '') |
|
| 172 |
{
|
|
| 173 |
$admin->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED']); |
|
| 174 |
$admin->print_footer(); |
|
| 175 |
}else {
|
|
| 176 |
$admin->print_error($retval, $js_back); |
|
| 177 |
} |
|
| 178 |
|
|
| 1 |
<?php |
|
| 2 |
/** |
|
| 3 |
* |
|
| 4 |
* @category admin |
|
| 5 |
* @package preferences |
|
| 6 |
* @author Independend-Software-Team |
|
| 7 |
* @author WebsiteBaker Project |
|
| 8 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 9 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
| 10 |
* @link http://www.websitebaker2.org/ |
|
| 11 |
* @license http://www.gnu.org/licenses/gpl.html |
|
| 12 |
* @platform WebsiteBaker 2.8.x |
|
| 13 |
* @requirements PHP 5.2.2 and higher |
|
| 14 |
* @version $Id$ |
|
| 15 |
* @filesource $HeadURL$ |
|
| 16 |
* @lastmodified $Date$ |
|
| 17 |
* |
|
| 18 |
*/ |
|
| 19 |
|
|
| 20 |
|
|
| 21 |
// Print admin header |
|
| 22 |
require('../../config.php');
|
|
| 23 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 24 |
$admin = new admin('Preferences');
|
|
| 25 |
// $js_back = "javascript: history.go(-1);"; // Create a javascript back link |
|
| 26 |
|
|
| 27 |
function save_preferences( &$admin, &$database) |
|
| 28 |
{
|
|
| 29 |
global $MESSAGE; |
|
| 30 |
$err_msg = array(); |
|
| 31 |
$min_pass_length = 6; |
|
| 32 |
// first check form-tan |
|
| 33 |
if(!$admin->checkFTAN()){ $err_msg[] = $MESSAGE['GENERIC_SECURITY_ACCESS']; }
|
|
| 34 |
// Get entered values and validate all |
|
| 35 |
// remove any dangerouse chars from display_name |
|
| 36 |
$display_name = $admin->add_slashes(strip_tags(trim($admin->get_post('display_name'))));
|
|
| 37 |
$display_name = ( $display_name == '' ? $admin->get_display_name() : $display_name ); |
|
| 38 |
// check that display_name is unique in whoole system (prevents from User-faking) |
|
| 39 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
|
| 40 |
$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `display_name` LIKE "'.$display_name.'"'; |
|
| 41 |
if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['USERNAME_TAKEN']; }
|
|
| 42 |
// language must be 2 upercase letters only |
|
| 43 |
$language = strtoupper($admin->get_post('language'));
|
|
| 44 |
$language = (preg_match('/^[A-Z]{2}$/', $language) ? $language : DEFAULT_LANGUAGE);
|
|
| 45 |
// timezone must be between -12 and +13 or -20 as system_default |
|
| 46 |
$timezone = $admin->get_post('timezone');
|
|
| 47 |
$timezone = (is_numeric($timezone) ? $timezone : -20); |
|
| 48 |
$timezone = ( ($timezone >= -12 && $timezone <= 13) ? $timezone : -20 ) * 3600; |
|
| 49 |
// date_format must be a key from /interface/date_formats |
|
| 50 |
$date_format = $admin->get_post('date_format');
|
|
| 51 |
$date_format_key = str_replace(' ', '|', $date_format);
|
|
| 52 |
$user_time = true; |
|
| 53 |
include( ADMIN_PATH.'/interface/date_formats.php' ); |
|
| 54 |
$date_format = (array_key_exists($date_format_key, $DATE_FORMATS) ? $date_format : 'system_default'); |
|
| 55 |
$date_format = ($date_format == 'system_default' ? '' : $date_format); |
|
| 56 |
unset($DATE_FORMATS); |
|
| 57 |
// time_format must be a key from /interface/time_formats |
|
| 58 |
$time_format = $admin->get_post('time_format');
|
|
| 59 |
$time_format_key = str_replace(' ', '|', $time_format);
|
|
| 60 |
$user_time = true; |
|
| 61 |
include( ADMIN_PATH.'/interface/time_formats.php' ); |
|
| 62 |
$time_format = (array_key_exists($time_format_key, $TIME_FORMATS) ? $time_format : 'system_default'); |
|
| 63 |
$time_format = ($time_format == 'system_default' ? '' : $time_format); |
|
| 64 |
unset($TIME_FORMATS); |
|
| 65 |
// email should be validatet by core |
|
| 66 |
$email = ( $admin->get_post('email') == null ? '' : $admin->get_post('email') );
|
|
| 67 |
if( !$admin->validate_email($email) ) |
|
| 68 |
{
|
|
| 69 |
$email = ''; |
|
| 70 |
$err_msg[] = $MESSAGE['USERS']['INVALID_EMAIL']; |
|
| 71 |
}else {
|
|
| 72 |
// check that email is unique in whoole system |
|
| 73 |
$email = $admin->add_slashes($email); |
|
| 74 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
|
| 75 |
$sql .= 'WHERE `user_id` <> '.(int)$admin->get_user_id().' AND `email` LIKE "'.$email.'"'; |
|
| 76 |
if( $database->get_one($sql) > 0 ){ $err_msg[] = $MESSAGE['USERS']['EMAIL_TAKEN']; }
|
|
| 77 |
} |
|
| 78 |
// receive password vars and calculate needed action |
|
| 79 |
$current_password = $admin->get_post('current_password');
|
|
| 80 |
$current_password = ($current_password == null ? '' : $current_password); |
|
| 81 |
$new_password_1 = $admin->get_post('new_password_1');
|
|
| 82 |
$new_password_1 = (($new_password_1 == null || $new_password_1 == '') ? '' : $new_password_1); |
|
| 83 |
$new_password_2 = $admin->get_post('new_password_2');
|
|
| 84 |
$new_password_2 = (($new_password_2 == null || $new_password_2 == '') ? '' : $new_password_2); |
|
| 85 |
if($current_password == '') |
|
| 86 |
{
|
|
| 87 |
$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT']; |
|
| 88 |
}else {
|
|
| 89 |
// if new_password is empty, still let current one |
|
| 90 |
if( $new_password_1 == '' ) |
|
| 91 |
{
|
|
| 92 |
$new_password_1 = $current_password; |
|
| 93 |
$new_password_2 = $current_password; |
|
| 94 |
} |
|
| 95 |
|
|
| 96 |
// is password lenght matching min_pass_lenght ? |
|
| 97 |
if( $new_password_1 != $current_password ) |
|
| 98 |
{
|
|
| 99 |
if( strlen($new_password_1) < $min_pass_length ) |
|
| 100 |
{
|
|
| 101 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT']; |
|
| 102 |
} |
|
| 103 |
$pattern = '/[^'.$admin->password_chars.']/'; |
|
| 104 |
if( preg_match($pattern, $new_password_1) ) |
|
| 105 |
{
|
|
| 106 |
$err_msg[] = $MESSAGE['PREFERENCES']['INVALID_CHARS']; |
|
| 107 |
} |
|
| 108 |
} |
|
| 109 |
// is password lenght matching min_pass_lenght ? |
|
| 110 |
if( $new_password_1 != $current_password && strlen($new_password_1) < $min_pass_length ) |
|
| 111 |
{
|
|
| 112 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_TOO_SHORT']; |
|
| 113 |
} |
|
| 114 |
// password_1 matching password_2 ? |
|
| 115 |
if( $new_password_1 != $new_password_2 ) |
|
| 116 |
{
|
|
| 117 |
$err_msg[] = $MESSAGE['USERS']['PASSWORD_MISMATCH']; |
|
| 118 |
} |
|
| 119 |
} |
|
| 120 |
$current_password = md5($current_password); |
|
| 121 |
$new_password_1 = md5($new_password_1); |
|
| 122 |
$new_password_2 = md5($new_password_2); |
|
| 123 |
// if no validation errors, try to update the database, otherwise return errormessages |
|
| 124 |
if(sizeof($err_msg) == 0) |
|
| 125 |
{
|
|
| 126 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` '; |
|
| 127 |
$sql .= 'SET `display_name` = "'.$display_name.'", '; |
|
| 128 |
$sql .= '`password` = "'.$new_password_1.'", '; |
|
| 129 |
$sql .= '`email` = "'.$email.'", '; |
|
| 130 |
$sql .= '`language` = "'.$language.'", '; |
|
| 131 |
$sql .= '`timezone` = "'.$timezone.'", '; |
|
| 132 |
$sql .= '`date_format` = "'.$date_format.'", '; |
|
| 133 |
$sql .= '`time_format` = "'.$time_format.'" '; |
|
| 134 |
$sql .= 'WHERE `user_id` = '.(int)$admin->get_user_id().' AND `password` = "'.$current_password.'"'; |
|
| 135 |
if( $database->query($sql) ) |
|
| 136 |
{
|
|
| 137 |
$sql_info = mysql_info($database->db_handle); |
|
| 138 |
if(preg_match('/matched: *([1-9][0-9]*)/i', $sql_info) != 1)
|
|
| 139 |
{ // if the user_id and password dosn't match
|
|
| 140 |
$err_msg[] = $MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT']; |
|
| 141 |
}else {
|
|
| 142 |
// update successfull, takeover values into the session |
|
| 143 |
$_SESSION['DISPLAY_NAME'] = $display_name; |
|
| 144 |
$_SESSION['LANGUAGE'] = $language; |
|
| 145 |
$_SESSION['TIMEZONE'] = $timezone; |
|
| 146 |
$_SESSION['EMAIL'] = $email; |
|
| 147 |
// Update date format |
|
| 148 |
if($date_format != '') {
|
|
| 149 |
$_SESSION['DATE_FORMAT'] = $date_format; |
|
| 150 |
if(isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) { unset($_SESSION['USE_DEFAULT_DATE_FORMAT']); }
|
|
| 151 |
} else {
|
|
| 152 |
$_SESSION['USE_DEFAULT_DATE_FORMAT'] = true; |
|
| 153 |
if(isset($_SESSION['DATE_FORMAT'])) { unset($_SESSION['DATE_FORMAT']); }
|
|
| 154 |
} |
|
| 155 |
// Update time format |
|
| 156 |
if($time_format != '') {
|
|
| 157 |
$_SESSION['TIME_FORMAT'] = $time_format; |
|
| 158 |
if(isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) { unset($_SESSION['USE_DEFAULT_TIME_FORMAT']); }
|
|
| 159 |
} else {
|
|
| 160 |
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true; |
|
| 161 |
if(isset($_SESSION['TIME_FORMAT'])) { unset($_SESSION['TIME_FORMAT']); }
|
|
| 162 |
} |
|
| 163 |
} |
|
| 164 |
}else {
|
|
| 165 |
$err_msg[] = 'invalid database UPDATE call in '.__FILE__.'::'.__FUNCTION__.'before line '.__LINE__; |
|
| 166 |
} |
|
| 167 |
} |
|
| 168 |
return ( (sizeof($err_msg) > 0) ? implode('<br />', $err_msg) : '' );
|
|
| 169 |
} |
|
| 170 |
$retval = save_preferences($admin, $database); |
|
| 171 |
if( $retval == '') |
|
| 172 |
{
|
|
| 173 |
$admin->print_success($MESSAGE['PREFERENCES']['DETAILS_SAVED']); |
|
| 174 |
$admin->print_footer(); |
|
| 175 |
}else {
|
|
Also available in: Unified diff
redefined wrong admin backlinks