forked from bgermann/cforms2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcforms-corrupted.php
More file actions
94 lines (76 loc) · 3.35 KB
/
cforms-corrupted.php
File metadata and controls
94 lines (76 loc) · 3.35 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/*
* Copyright (c) 2006-2012 Oliver Seidel (email : oliver.seidel @ deliciousdays.com)
* Copyright (c) 2014 Bastian Germann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
### Check Whether User Can Manage Database
cforms2_check_access_priv();
?>
<div class="wrap">
<div id="icon-cforms-corrupted" class="icon32"><br/></div><h2><?php _e('cforms error','cforms')?></h2>
<?php if( $_POST['fixsettings'] ) :?>
<div class="error"><p><?php _e('Please deactivate and then re-activate the cforms plugin now.','cforms'); ?></p></div>
<?php
$c = stripslashes($_POST['currentsettings']);
$nc='';
for($i=0; $i<strlen($c); $i++ ){
if ( substr($c,$i,2) == 's:' ){
$q1=strpos($c,'"',$i);
$q2=strpos($c,'";',$q1)-1;
$nc .= 's:'.($q2-$q1).':'.substr($c,$q1,($q2-$q1)+3);
$i = $i + ($q2-$q1) +6 + (strlen(strval($q2-$q1))) -1;
}
else
$nc .= substr($c,$i,1);
}
update_option('cforms_settings',$nc);
die();
?>
<?php elseif( $_POST['resetsettings'] ) : ?>
<div class="updated fade"><p><?php _e('Please deactivate and then re-activate the cforms plugin now.','cforms'); ?></p></div>
<?php
delete_option('cforms_settings');
global $cformsSettings;
$cformsSettings = array();
cforms2_setup_db();
wp_die();
?>
<?php else :?>
<div class="error"><p><?php _e('It appears that WP has corrupted your cforms settings, the settings array can not be read properly.','cforms'); ?></p></div>
<?php endif;
global $wpdb;
$c = str_replace('&','&',$wpdb->get_var("SELECT option_value FROM `$wpdb->options` WHERE option_name='cforms_settings'"));
?>
<form name="corruptedsettings" class="corruptedsettings" method="POST">
<h3><?php _e('Corrupted cforms settings detected','cforms'); ?></h2>
<table class="form-table">
<tr><td><?php _e('You can either try and fix the settings array or reset it and start from scratch.','cforms'); ?> <input class="allbuttons deleteall" type="submit" name="resetsettings" id="resetsettings" value="<?php _e('RESET','cforms'); ?>"/></td></tr>
</table>
<h3><?php _e('Corrupted cforms settings array (raw code)','cforms'); ?></h2>
<table class="form-table">
<tr><td>
<?php _e('Depending on your Wordpress/PHP skills you may want to try and fix the serialized data below, then hit the fix button or try just like that, cforms may magically fix it for you.','cforms'); ?>
</td></tr>
<tr><td>
<textarea rows="16" cols="10" name="currentsettings" id="currentsettings"><?php echo $c; ?></textarea>
</td></tr>
<tr><td>
<input class="allbuttons" type="submit" name="fixsettings" id="fixsettings" value="<?php _e('FIX and save data','cforms'); ?>"/>
</td></tr>
</table>
</form>
</div>
<?php wp_die();