-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
66 lines (51 loc) · 1.4 KB
/
ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
$root = dirname(__FILE__);
$position = strrpos($root, "wp-content");
$wp_installation = substr($root, 0 , $position );
include( $wp_installation.'wp-load.php' );
$_POST = array_map( 'stripslashes_deep', $_POST );
$action = isset( $_POST['action'] ) ? $_POST['action'] : false;
function validateInput($optionName){
$requests =
['_colorbox_style',
'_colorbox_transition',
'_colorbox_speed',
'_colorbox_scrolling',
'_colorbox_opacity',
'_colorbox_returnFocus',
'_colorbox_fastIframe',
'_colorbox_closeBtn',
'_colorbox_escKey',
'_menu_object_nos',
'_menu_obj_'];
return (in_array($optionName,$requests) && is_admin());
}
switch ( $action ) {
case 'update_content' :
if(validateInput( $_POST['update'])) {
update_option($_POST['update'], $_POST['value']);
$start = false;
$new_options = array();
foreach ($flb->options() as $value) {
if ($start)
$new_options[] = $value;
if ($value['type'] == 'open_ajax' && $value['id'] == $_POST['ajax'])
$start = true;
if ($value['type'] == 'close_ajax' && $value['id'] == $_POST['ajax'] . "_close")
break;
}
$flb->construct_form($new_options);
}
break;
case 'update_option' :
if(validateInput( $_POST['id'])) {
update_option($_POST['id'], $_POST['value']);
}
break;
case 'delete_option' :
if(validateInput($_POST['id'])) {
delete_option($_POST['id']);
}
break;
}
?>