PluginProbe
FeedWordPress / 2009.0613
FeedWordPress v2009.0613
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
← All changes | compatability.php +39 -1 2008.12142009.0613 View file →
@@ -14,8 +14,36 @@
14 14 endif;
15 15 return $good;
16 16 } /* function fwp_test_wp_version () */
17 17
18 +class FeedWordPressCompatibility {
19 + /*static*/ function validate_http_request ($action = -1, $capability = null) {
20 + // Only worry about this if we're using a method with significant side-effects
21 + if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') :
22 + // Limit post by user capabilities
23 + if (!is_null($capability) and !current_user_can($capability)) :
24 + wp_die(__('Cheatin’ uh?'));
25 + endif;
26 +
27 + // If check_admin_referer() checks a nonce.
28 + if (function_exists('wp_verify_nonce')) :
29 + check_admin_referer($action);
30 +
31 + // No nonces means no checking nonces.
32 + else :
33 + check_admin_referer();
34 + endif;
35 + endif;
36 + } /* FeedWordPressCompatibility::validate_http_request() */
37 +
38 + /*static*/ function stamp_nonce ($action = -1) {
39 + // stamp form with hidden fields for a nonce in WP 2.0.3 & later
40 + if (function_exists('wp_nonce_field')) :
41 + wp_nonce_field($action);
42 + endif;
43 + } /* FeedWordPressCompatibility::stamp_nonce() */
44 +} /* class FeedWordPressCompatibility */
45 +
18 46 if (!function_exists('stripslashes_deep')) {
19 47 function stripslashes_deep($value) {
20 48 $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
21 49 return $value;
@@ -44,8 +72,11 @@
44 72 break;
45 73 case 'manage_links':
46 74 $can = ($user_level >= 5);
47 75 break;
76 + case 'edit_files':
77 + $can = ($user_level >= 9);
78 + break;
48 79 endswitch;
49 80 return $can;
50 81 }
51 82 } else {
@@ -82,10 +113,16 @@
82 113 $id = $wpdb->insert_id;
83 114
84 115 return $id;
85 116 }
86 -}
117 +} /* if (!function_exists('wp_insert_user')) */
87 118
119 +if (!function_exists('wp_die')) {
120 + function wp_die ( $message, $title = '', $args = array() ) {
121 + die($message);
122 + } /* wp_die() */
123 +} /* if */
124 +
88 125 function fwp_category_checklist ($post_id = 0, $descendents_and_self = 0, $selected_cats = false) {
89 126 if (function_exists('wp_category_checklist')) :
90 127 wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
91 128 else :
@@ -162,8 +199,9 @@
162 199
163 200 <p>This may take several minutes for a large installation.</p>
164 201
165 202 <form action="" method="post">
203 +<?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_upgrade'); ?>
166 204 <div class="submit"><input type="submit" name="action" value="Upgrade" /></div>
167 205 </form>
168 206 </div>
169 207 <?php