Project

General

Profile

« Previous | Next » 

Revision 1389

Added by FrankH almost 14 years ago

  1. Security fixes for modules captcha_control, code and droplets

View differences:

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

  
13 13
------------------------------------- 2.8.2 -------------------------------------
14
16 Jan-2011 Build 1389 Frank Heyne (FrankH)
15
# Security fixes for modules captcha_control, code and droplets
14 16
16 Jan-2011 Build 1388 Dietmar Woellbrink (Luisehahne)
15 17
# more Security fix for admin/pages
16 18
16 Jan-2011 Build 1387 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.RC4');
55
if(!defined('REVISION')) define('REVISION', '1388');
55
if(!defined('REVISION')) define('REVISION', '1389');
56 56

  
57 57
?>
branches/2.8.x/wb/modules/captcha_control/info.php
31 31
$module_directory 	= 'captcha_control';
32 32
$module_name 			= 'Captcha and Advanced-Spam-Protection (ASP) Control';
33 33
$module_function 		= 'tool';
34
$module_version 		= '1.0';
34
$module_version 		= '1.1';
35 35
$module_platform 		= '2.7 | 2.8.x';
36 36
$module_author 		= 'Thomas Hornik (thorn)';
37 37
$module_license 		= 'GNU General Public License';
branches/2.8.x/wb/modules/captcha_control/tool.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
// direct access prevention
27
defined('WB_PATH') OR die(header('Location: ../index.php'));
28

  
29
// check if module language file exists for the language set by the user (e.g. DE, EN)
30
if(!file_exists(WB_PATH .'/modules/captcha_control/languages/'.LANGUAGE .'.php')) {
31
	// no module language file exists for the language set by the user, include default module language file EN.php
32
	require_once(WB_PATH .'/modules/captcha_control/languages/EN.php');
33
} else {
34
	// a module language file exists for the language defined by the user, load it
35
	require_once(WB_PATH .'/modules/captcha_control/languages/'.LANGUAGE .'.php');
36
}
37

  
38
$table = TABLE_PREFIX.'mod_captcha_control';
39
$js_back = "javascript: history.go(-1);";
40

  
41
// check if data was submitted
42
if(isset($_POST['save_settings'])) {
43
	// get configuration settings
44
	$enabled_captcha = ($_POST['enabled_captcha'] == '1') ? '1' : '0';
45
	$enabled_asp = ($_POST['enabled_asp'] == '1') ? '1' : '0';
46
	$captcha_type = $admin->add_slashes($_POST['captcha_type']);
47
	
48
	// update database settings
49
	$database->query("UPDATE $table SET
50
		enabled_captcha = '$enabled_captcha',
51
		enabled_asp = '$enabled_asp',
52
		captcha_type = '$captcha_type'
53
	");
54

  
55
	// save text-captchas
56
	if($captcha_type == 'text') { // ct_text
57
		$text_qa=$admin->add_slashes($_POST['text_qa']);
58
		if(!preg_match('/### .*? ###/', $text_qa)) {
59
			$database->query("UPDATE $table SET ct_text = '$text_qa'");
60
		}
61
	}
62
	
63
	// check if there is a database error, otherwise say successful
64
	if($database->is_error()) {
65
		$admin->print_error($database->get_error(), $js_back);
66
	} else {
67
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=captcha_control');
68
	}
69

  
70
} else {
71
	
72
	// include captcha-file
73
	require_once(WB_PATH .'/include/captcha/captcha.php');
74

  
75
	// load text-captchas
76
	$text_qa='';
77
	if($query = $database->query("SELECT ct_text FROM $table")) {
78
		$data = $query->fetchRow();
79
		$text_qa = $data['ct_text'];
80
	}
81
	if($text_qa == '')
82
		$text_qa = $MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'];
83

  
84
// script to load image
85
?>
86
<script type="text/javascript">
87
	var pics = new Array();
88

  
89
	pics["ttf_image"] = new Image();
90
	pics["ttf_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/ttf_image.png'?>";
91

  
92
	pics["calc_image"] = new Image();
93
	pics["calc_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_image.png'?>";
94

  
95
	pics["calc_ttf_image"] = new Image();
96
	pics["calc_ttf_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_ttf_image.png'?>";
97

  
98
	pics["old_image"] = new Image();
99
	pics["old_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/old_image.png'?>";
100
	
101
	pics["calc_text"] = new Image();
102
	pics["calc_text"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>";
103
	
104
	pics["text"] = new Image();
105
	pics["text"].src = "<?php echo WB_URL.'/include/captcha/captchas/text.png'?>";
106

  
107
	function load_captcha_image() {
108
		document.captcha_example.src = pics[document.store_settings.captcha_type.value].src;
109
		toggle_text_qa();
110
	}
111
	
112
	function toggle_text_qa() {
113
		if(document.store_settings.captcha_type.value == 'text' ) {
114
			document.getElementById('text_qa').style.display = '';
115
		} else {
116
			document.getElementById('text_qa').style.display = 'none';
117
		}
118
	}
119

  
120
</script>
121
<?php
122

  
123
	// connect to database and read out captcha settings
124
	if($query = $database->query("SELECT * FROM $table")) {
125
		$data = $query->fetchRow();
126
		$enabled_captcha = $data['enabled_captcha'];
127
		$enabled_asp = $data['enabled_asp'];
128
		$captcha_type = $data['captcha_type'];
129
	} else {
130
		// something went wrong, use dummy value
131
		$enabled_captcha = '1';
132
		$enabled_asp = '1';
133
		$captcha_type = 'calc_text';
134
	}
135
		
136
	// write out heading
137
	echo '<h2>' .$MOD_CAPTCHA_CONTROL['HEADING'] .'</h2>';
138

  
139
	// output the form with values from the database
140
	echo '<p>' .$MOD_CAPTCHA_CONTROL['HOWTO'] .'</p>';
141
?>
142
<form name="store_settings" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
143
	<table width="98%" cellspacing="0" border="0" cellpadding="5px" class="row_a">
144
	<tr><td colspan="2"><strong><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_CONF'];?>:</strong></td></tr>
145
	<tr>
146
		<td width="30%"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_TYPE'];?>:</td>
147
		<td>
148
		<select name="captcha_type" id="captcha_type" onchange="load_captcha_image()" style="width: 98%;">
149
			<?php foreach($useable_captchas AS $key=>$text) {
150
			echo "<option value=\"$key\" ".($captcha_type==$key ? ' selected="selected"' : '').">$text</option>";
151
			} ?>
152
		</select>
153
		</td>
154
	</tr>
155
	<tr>
156
		<td>&nbsp;</td>
157
		<td align="left" width="150px">
158
            <img alt="captcha_example" id="captcha_example" src="<?php echo WB_URL.'/include/captcha/captchas/'.$captcha_type.'.png'?>" />
159
        </td>
160
	</tr>
161
	<tr id="text_qa" style="display:<?php if($captcha_type=='text') echo ''; else echo 'none'; ;?>;">
162
		<td valign="top" class="setting_name"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_ENTER_TEXT'];?>:</td>
163
		<td class="setting_value" colspan="2">
164
			<textarea name="text_qa" cols="60" rows="10"><?php echo $text_qa; ?></textarea>
165
		</td>
166
	</tr>
167
	<tr>
168
		<td><?php echo $MOD_CAPTCHA_CONTROL['USE_SIGNUP_CAPTCHA'];?>:</td>
169
		<td>
170
			<input type="radio" <?php echo ($enabled_captcha=='1') ?'checked="checked"' :'';?>
171
				name="enabled_captcha" value="1" /><?php echo $MOD_CAPTCHA_CONTROL['ENABLED'];?>
172
			<input type="radio" <?php echo ($enabled_captcha=='0') ?'checked="checked"' :'';?>
173
				name="enabled_captcha" value="0" /><?php echo $MOD_CAPTCHA_CONTROL['DISABLED'];?>
174
		</td>
175
	</tr>
176
	<tr><td>&nbsp;</td><td style="font-size:smaller;"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_EXP'];?></td></tr>
177
	<tr><td colspan="2"><br /><strong><?php echo $MOD_CAPTCHA_CONTROL['ASP_CONF'];?>:</strong></td></tr>
178
	<tr>
179
		<td><?php echo $MOD_CAPTCHA_CONTROL['ASP_TEXT'];?>:</td>
180
		<td>
181
			<input type="radio" <?php echo ($enabled_asp=='1') ?'checked="checked"' :'';?>
182
				name="enabled_asp" value="1" /><?php echo $MOD_CAPTCHA_CONTROL['ENABLED'];?>
183
			<input type="radio" <?php echo ($enabled_asp=='0') ?'checked="checked"' :'';?>
184
				name="enabled_asp" value="0" /><?php echo $MOD_CAPTCHA_CONTROL['DISABLED'];?>
185
		</td>
186
	</tr>
187
	<tr>
188
        <td>&nbsp;</td>
189
        <td style="font-size:smaller;"><?php echo $MOD_CAPTCHA_CONTROL['ASP_EXP'];?></td>
190
    </tr>
191
	</table>
192
	<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" />
193
</form>
194
<?php
195
}
196

  
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
// direct access prevention
27
defined('WB_PATH') OR die(header('Location: ../index.php'));
28

  
29
// check if module language file exists for the language set by the user (e.g. DE, EN)
30
if(!file_exists(WB_PATH .'/modules/captcha_control/languages/'.LANGUAGE .'.php')) {
31
	// no module language file exists for the language set by the user, include default module language file EN.php
32
	require_once(WB_PATH .'/modules/captcha_control/languages/EN.php');
33
} else {
34
	// a module language file exists for the language defined by the user, load it
35
	require_once(WB_PATH .'/modules/captcha_control/languages/'.LANGUAGE .'.php');
36
}
37

  
38
$table = TABLE_PREFIX.'mod_captcha_control';
39
$js_back = "javascript: history.go(-1);";
40

  
41
// check if data was submitted
42
if(isset($_POST['save_settings'])) {
43
	if (!$admin->checkFTAN())
44
	{
45
		$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
46
		exit();
47
	}
48
	
49
	// get configuration settings
50
	$enabled_captcha = ($_POST['enabled_captcha'] == '1') ? '1' : '0';
51
	$enabled_asp = ($_POST['enabled_asp'] == '1') ? '1' : '0';
52
	$captcha_type = $admin->add_slashes($_POST['captcha_type']);
53
	
54
	// update database settings
55
	$database->query("UPDATE $table SET
56
		enabled_captcha = '$enabled_captcha',
57
		enabled_asp = '$enabled_asp',
58
		captcha_type = '$captcha_type'
59
	");
60

  
61
	// save text-captchas
62
	if($captcha_type == 'text') { // ct_text
63
		$text_qa=$admin->add_slashes($_POST['text_qa']);
64
		if(!preg_match('/### .*? ###/', $text_qa)) {
65
			$database->query("UPDATE $table SET ct_text = '$text_qa'");
66
		}
67
	}
68
	
69
	// check if there is a database error, otherwise say successful
70
	if($database->is_error()) {
71
		$admin->print_error($database->get_error(), $js_back);
72
	} else {
73
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=captcha_control');
74
	}
75

  
76
} else {
77
	
78
	// include captcha-file
79
	require_once(WB_PATH .'/include/captcha/captcha.php');
80

  
81
	// load text-captchas
82
	$text_qa='';
83
	if($query = $database->query("SELECT ct_text FROM $table")) {
84
		$data = $query->fetchRow();
85
		$text_qa = $data['ct_text'];
86
	}
87
	if($text_qa == '')
88
		$text_qa = $MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'];
89

  
90
// script to load image
91
?>
92
<script type="text/javascript">
93
	var pics = new Array();
94

  
95
	pics["ttf_image"] = new Image();
96
	pics["ttf_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/ttf_image.png'?>";
97

  
98
	pics["calc_image"] = new Image();
99
	pics["calc_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_image.png'?>";
100

  
101
	pics["calc_ttf_image"] = new Image();
102
	pics["calc_ttf_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_ttf_image.png'?>";
103

  
104
	pics["old_image"] = new Image();
105
	pics["old_image"].src = "<?php echo WB_URL.'/include/captcha/captchas/old_image.png'?>";
106
	
107
	pics["calc_text"] = new Image();
108
	pics["calc_text"].src = "<?php echo WB_URL.'/include/captcha/captchas/calc_text.png'?>";
109
	
110
	pics["text"] = new Image();
111
	pics["text"].src = "<?php echo WB_URL.'/include/captcha/captchas/text.png'?>";
112

  
113
	function load_captcha_image() {
114
		document.captcha_example.src = pics[document.store_settings.captcha_type.value].src;
115
		toggle_text_qa();
116
	}
117
	
118
	function toggle_text_qa() {
119
		if(document.store_settings.captcha_type.value == 'text' ) {
120
			document.getElementById('text_qa').style.display = '';
121
		} else {
122
			document.getElementById('text_qa').style.display = 'none';
123
		}
124
	}
125

  
126
</script>
127
<?php
128

  
129
	// connect to database and read out captcha settings
130
	if($query = $database->query("SELECT * FROM $table")) {
131
		$data = $query->fetchRow();
132
		$enabled_captcha = $data['enabled_captcha'];
133
		$enabled_asp = $data['enabled_asp'];
134
		$captcha_type = $data['captcha_type'];
135
	} else {
136
		// something went wrong, use dummy value
137
		$enabled_captcha = '1';
138
		$enabled_asp = '1';
139
		$captcha_type = 'calc_text';
140
	}
141
		
142
	// write out heading
143
	echo '<h2>' .$MOD_CAPTCHA_CONTROL['HEADING'] .'</h2>';
144

  
145
	// output the form with values from the database
146
	echo '<p>' .$MOD_CAPTCHA_CONTROL['HOWTO'] .'</p>';
147
?>
148
<form name="store_settings" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
149
	<?php echo $admin->getFTAN(); ?>
150
	<table width="98%" cellspacing="0" border="0" cellpadding="5px" class="row_a">
151
	<tr><td colspan="2"><strong><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_CONF'];?>:</strong></td></tr>
152
	<tr>
153
		<td width="30%"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_TYPE'];?>:</td>
154
		<td>
155
		<select name="captcha_type" id="captcha_type" onchange="load_captcha_image()" style="width: 98%;">
156
			<?php foreach($useable_captchas AS $key=>$text) {
157
			echo "<option value=\"$key\" ".($captcha_type==$key ? ' selected="selected"' : '').">$text</option>";
158
			} ?>
159
		</select>
160
		</td>
161
	</tr>
162
	<tr>
163
		<td>&nbsp;</td>
164
		<td align="left" width="150px">
165
            <img alt="captcha_example" id="captcha_example" src="<?php echo WB_URL.'/include/captcha/captchas/'.$captcha_type.'.png'?>" />
166
        </td>
167
	</tr>
168
	<tr id="text_qa" style="display:<?php if($captcha_type=='text') echo ''; else echo 'none'; ;?>;">
169
		<td valign="top" class="setting_name"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_ENTER_TEXT'];?>:</td>
170
		<td class="setting_value" colspan="2">
171
			<textarea name="text_qa" cols="60" rows="10"><?php echo $text_qa; ?></textarea>
172
		</td>
173
	</tr>
174
	<tr>
175
		<td><?php echo $MOD_CAPTCHA_CONTROL['USE_SIGNUP_CAPTCHA'];?>:</td>
176
		<td>
177
			<input type="radio" <?php echo ($enabled_captcha=='1') ?'checked="checked"' :'';?>
178
				name="enabled_captcha" value="1" /><?php echo $MOD_CAPTCHA_CONTROL['ENABLED'];?>
179
			<input type="radio" <?php echo ($enabled_captcha=='0') ?'checked="checked"' :'';?>
180
				name="enabled_captcha" value="0" /><?php echo $MOD_CAPTCHA_CONTROL['DISABLED'];?>
181
		</td>
182
	</tr>
183
	<tr><td>&nbsp;</td><td style="font-size:smaller;"><?php echo $MOD_CAPTCHA_CONTROL['CAPTCHA_EXP'];?></td></tr>
184
	<tr><td colspan="2"><br /><strong><?php echo $MOD_CAPTCHA_CONTROL['ASP_CONF'];?>:</strong></td></tr>
185
	<tr>
186
		<td><?php echo $MOD_CAPTCHA_CONTROL['ASP_TEXT'];?>:</td>
187
		<td>
188
			<input type="radio" <?php echo ($enabled_asp=='1') ?'checked="checked"' :'';?>
189
				name="enabled_asp" value="1" /><?php echo $MOD_CAPTCHA_CONTROL['ENABLED'];?>
190
			<input type="radio" <?php echo ($enabled_asp=='0') ?'checked="checked"' :'';?>
191
				name="enabled_asp" value="0" /><?php echo $MOD_CAPTCHA_CONTROL['DISABLED'];?>
192
		</td>
193
	</tr>
194
	<tr>
195
        <td>&nbsp;</td>
196
        <td style="font-size:smaller;"><?php echo $MOD_CAPTCHA_CONTROL['ASP_EXP'];?></td>
197
    </tr>
198
	</table>
199
	<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" />
200
</form>
201
<?php
202
}
203

  
197 204
?>
branches/2.8.x/wb/modules/code/htt/modify.htt
5 5

  
6 6
<input type="hidden" name="page_id" value="{PAGE_ID}" />
7 7
<input type="hidden" name="section_id" value="{SECTION_ID}" />
8

  
8
{FTAN}
9 9
<textarea cols="2" rows="20"  id="content{SECTION}" name="content" style="width: 100%; height: 380px">{CONTENT}</textarea>
10 10

  
11 11
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
branches/2.8.x/wb/modules/code/info.php
19 19
$module_directory	= 'code';
20 20
$module_name		= 'Code';
21 21
$module_function	= 'page';
22
$module_version		= '2.8.1';
22
$module_version		= '2.8.2';
23 23
$module_platform	= '2.7 | 2.8.x';
24 24
$module_author		= 'Ryan Djurovich';
25 25
$module_license		= 'GNU General Public License';
branches/2.8.x/wb/modules/code/save.php
22 22
$update_when_modified = true; // Tells script to update when this page was last updated
23 23
require(WB_PATH.'/modules/admin.php');
24 24

  
25
if (!$admin->checkFTAN())
26
{
27
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
28
	exit();
29
}
30

  
25 31
// Update the mod_wysiwygs table with the contents
26 32
if(isset($_POST['content'])) {
27 33
	$tags = array('<?php', '?>' , '<?');
branches/2.8.x/wb/modules/code/modify.php
37 37
		'CONTENT'				=> $content,
38 38
		'TEXT_SAVE'				=> $TEXT['SAVE'],
39 39
		'TEXT_CANCEL'			=> $TEXT['CANCEL'],
40
		'SECTION'				=> $section_id
40
		'SECTION'				=> $section_id,
41
		'FTAN'					=> $admin->getFTAN()
41 42
	)
42 43
);
43 44

  
branches/2.8.x/wb/modules/droplets/delete_droplet.php
19 19

  
20 20
require('../../config.php');
21 21

  
22
// Get id
23
if(!isset($_GET['droplet_id']) OR !is_numeric($_GET['droplet_id'])) {
24
	header("Location: ".ADMIN_URL."/pages/index.php");
25
} else {
26
	$droplet_id = $_GET['droplet_id'];
27
}
28

  
29 22
// Include WB admin wrapper script
30 23
require_once(WB_PATH.'/framework/class.admin.php');
31 24
require_once(WB_PATH.'/framework/functions.php');
32 25

  
26
// Get id
27
$droplet_id = $admin->checkIDKEY('droplet_id', false, 'GET');
28
if (!$droplet_id) {
29
 $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
30
 exit();
31
}
32

  
33 33
// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
34 34
if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
35 35
	$admintool_link = ADMIN_URL .'/admintools/index.php';
branches/2.8.x/wb/modules/droplets/info.php
20 20
$module_directory = 'droplets';
21 21
$module_name = 'Droplets';
22 22
$module_function = 'tool';
23
$module_version = '1.0.3';
23
$module_version = '1.0.4';
24 24
$module_platform = '2.8.x';
25 25
$module_author = 'Ruud and pcwacht';
26 26
$module_license = 'GNU General Public License';
branches/2.8.x/wb/modules/droplets/tool.php
58 58
	<td valign="top" width="50%" align="right">
59 59
		<a href="#" onclick="javascript: window.open('<?php echo WB_URL; ?>/modules/droplets/readme/<?php echo $DR_TEXT['README']; ?>','helpwindow','width=700,height=550,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');"><?php echo $DR_TEXT['HELP']; ?></a>
60 60
		<br /><br />
61
		<a href="#" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/droplets/backup_droplets.php';"><?php echo $DR_TEXT['BACKUP']; ?></a>
61
		<a href="#" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/droplets/backup_droplets.php?id=<?php echo $admin->getIDKEY(999) . '\';">' .$DR_TEXT['BACKUP']; ?></a>
62 62
	</td>
63 63
</tr>
64 64
</table>
......
108 108
		
109 109
		<tr class="row_<?php echo $row; ?>" >
110 110
			<td >
111
				<a href="<?php echo WB_URL; ?>/modules/droplets/modify_droplet.php?droplet_id=<?php echo $droplet['id']?>" title="<?php echo $TEXT['MODIFY']; ?>">
111
				<a href="<?php echo WB_URL; ?>/modules/droplets/modify_droplet.php?droplet_id=<?php echo $admin->getIDKEY($droplet['id']); ?>" title="<?php echo $TEXT['MODIFY']; ?>">
112 112
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify" /> 
113 113
				</a>
114 114
			</td>
115 115
			<td >
116
				<a href="<?php echo WB_URL; ?>/modules/droplets/modify_droplet.php?droplet_id=<?php echo $droplet['id']?>" class="tooltip">
116
				<a href="<?php echo WB_URL; ?>/modules/droplets/modify_droplet.php?droplet_id=<?php echo $admin->getIDKEY($droplet['id']); ?>" class="tooltip">
117 117
							<?php if ($valid_code && $unique_droplet) { ?><img src="<?php echo WB_URL; ?>/modules/droplets/img/droplet.png" border="0" alt=""/>
118 118
							<?php } else {  ?><img src="<?php echo WB_URL; ?>/modules/droplets/img/invalid.gif" border="0" title="" alt=""/><?php }  ?>
119 119
					<?php echo $droplet['name']; ?><?php echo $comments; ?>
......
126 126
				<b><?php if($droplet['active'] == 1){ echo '<span style="color: green;">'. $TEXT['YES']. '</span>'; } else { echo '<span style="color: red;">'.$TEXT['NO'].'</span>';  } ?></b>
127 127
			</td>
128 128
			<td >
129
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/droplets/delete_droplet.php?droplet_id=<?php echo $droplet['id']?>');" title="<?php echo $TEXT['DELETE']; ?>">
129
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/droplets/delete_droplet.php?droplet_id=<?php echo $admin->getIDKEY($droplet['id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>">
130 130
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
131 131
				</a>
132 132
			</td>
branches/2.8.x/wb/modules/droplets/modify_droplet.php
19 19

  
20 20
require('../../config.php');
21 21

  
22
require_once(WB_PATH.'/framework/class.admin.php');
23
require_once(WB_PATH.'/framework/functions.php');
24

  
22 25
// Get id
23
if(!isset($_GET['droplet_id']) OR !is_numeric($_GET['droplet_id'])) {
24
	header("Location: ".ADMIN_URL."/pages/index.php");
25
} else {
26
	$droplet_id = $_GET['droplet_id'];
26
$droplet_id = $admin->checkIDKEY('droplet_id', false, 'GET');
27
if (!$droplet_id) {
28
 $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
29
 exit();
27 30
}
28 31

  
29
require_once(WB_PATH.'/framework/class.admin.php');
30
require_once(WB_PATH.'/framework/functions.php');
31

  
32 32
$admintool_link = ADMIN_URL .'/admintools/index.php';
33 33
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
34 34
$admin = new admin('admintools', 'admintools');
......
70 70
<input type="hidden" name="data_codepress" value="" />
71 71
<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>" />
72 72
<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>" />
73
<?php echo $admin->getFTAN(); ?>
73 74

  
74 75
<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
75 76
		<tr>
branches/2.8.x/wb/modules/droplets/add_droplet.php
41 41
	if($database->is_error()) {
42 42
		$admin->print_error($database->get_error(), $module_edit_link);
43 43
	} else {
44
		$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
44
		$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
45 45
	}
46 46

  
47 47
	// Print admin footer
branches/2.8.x/wb/modules/droplets/backup_droplets.php
20 20
// tool_edit.php
21 21
require_once('../../config.php');
22 22
require_once(WB_PATH.'/framework/class.admin.php');
23

  
23 24
require_once(WB_PATH.'/framework/functions.php');
24 25
// create admin object depending on platform (admin tools were moved out of settings with WB 2.7)
25 26
$admin = new admin('admintools', 'admintools');
......
27 28
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
28 29
$template_edit_link = ADMIN_URL .'/admintools/tool.php?tool=templateedit';
29 30

  
31
// protect from CSRF
32
$id = $admin->checkIDKEY('id', false, 'GET');
33
if (!$id or $id != 999) {
34
 $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
35
 exit();
36
}
30 37

  
31 38
?>
32 39
<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
branches/2.8.x/wb/modules/droplets/save_droplet.php
23 23
if(!isset($_POST['droplet_id']) OR !is_numeric($_POST['droplet_id'])) {
24 24
	header("Location: ".ADMIN_URL."/pages/index.php");
25 25
} else {
26
	$droplet_id = $_POST['droplet_id'];
26
	$droplet_id = (int) $_POST['droplet_id'];
27 27
}
28 28
// Include WB admin wrapper script
29 29
require_once(WB_PATH.'/framework/class.admin.php');
30 30
require_once(WB_PATH.'/framework/functions.php');
31 31

  
32
if (!$admin->checkFTAN())
33
{
34
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
35
	exit();
36
}
37

  
32 38
// check website baker platform (with WB 2.7, Admin-Tools were moved out of settings dialogue)
33 39
if(file_exists(ADMIN_PATH .'/admintools/tool.php')) {
34 40
	$admintool_link = ADMIN_URL .'/admintools/index.php';
......
45 51
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
46 52
} else {
47 53
	$title = $admin->add_slashes($admin->get_post('title'));
48
	$active = $admin->get_post('active');
49
	$admin_view = $admin->get_post('admin_view');
50
	$admin_edit = $admin->get_post('admin_edit');
51
	$show_wysiwyg = $admin->get_post('show_wysiwyg');
54
	$active = (int) $admin->get_post('active');
55
	$admin_view = (int) $admin->get_post('admin_view');
56
	$admin_edit = (int) $admin->get_post('admin_edit');
57
	$show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
52 58
	$description = $admin->add_slashes($admin->get_post('description'));
53 59
	$tags = array('<?php', '?>' , '<?');
54 60
	$content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
55 61
	
56 62
	$comments = $admin->add_slashes($admin->get_post('comments'));
57 63
	$modified_when = time();
58
	$modified_by = $admin->get_user_id(); 
64
	$modified_by = (int) $admin->get_user_id(); 
59 65
}
60 66

  
61 67
// Update row
......
63 69

  
64 70
// Check if there is a db error, otherwise say successful
65 71
if($database->is_error()) {
66
	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='.$droplet_id);
72
	$admin->print_error($database->get_error(), WB_URL.'/modules/droplets/modify_droplet.php?droplet_id='. $admin->getIDKEY($droplet_id));
67 73
} else {
68 74
    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
69 75
}

Also available in: Unified diff