Ultimate Member – User Profile & Membership Plugin - Version 1.3.69

Version Description

Download this release

Release Info

Developer champsupertramp
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 1.3.69
Comparing to
See all releases

Code changes from version 1.3.68 to 1.3.69

addons/generate_random_users.php CHANGED
@@ -55,9 +55,12 @@ class UM_ADDON_generate_random_users {
55
$response = file_get_contents( $json_url );
56
$json = json_decode( $response );
57
58
- if( ! empty( $json ) && ! get_option('um_generated_dumies') ){
59
60
- update_option('um_generated_dumies', $json );
61
62
foreach( $json->results as $dummy ){
63
@@ -66,27 +69,46 @@ class UM_ADDON_generate_random_users {
66
}else{
67
$password = wp_generate_password( 8, false );
68
}
69
70
$userdata = array(
71
'display_name' => ucfirst( $dummy->name->first )." ".ucfirst( $dummy->name->last ),
72
'first_name' => ucfirst( $dummy->name->first ),
73
'last_name' => ucfirst( $dummy->name->last ),
74
- 'user_email' => $dummy->email,
75
'user_login' => $dummy->login->username,
76
'user_pass' => $password,
77
);
78
79
$user_id = wp_insert_user( $userdata );
80
81
$usermeta = array(
82
'synced_profile_photo' => $dummy->picture->large,
83
'gender' => ucfirst($dummy->gender),
84
- 'birth_date' => date("Y/m/d", $dummy->dob),
85
- '_um_last_login' => date("Y/m/d", $dummy->registered),
86
'mobile_number' => $dummy->cell,
87
'phone_number' => $dummy->phone,
88
'synced_gravatar_hashed_id' => md5( strtolower( trim( $dummy->email ) ) ),
89
'account_status' => 'approved',
90
);
91
92
if( isset( $_GET['add_cover_photo'] ) && $_GET['add_cover_photo'] == 1 ){
@@ -101,23 +123,39 @@ class UM_ADDON_generate_random_users {
101
foreach ( $usermeta as $key => $value ) {
102
update_user_meta( $user_id, $key, $value );
103
}
104
}
105
}
106
107
break;
108
109
case 'remove_random_users':
110
111
- $json = get_option('um_generated_dumies');
112
-
113
- if( isset( $json->results ) ){
114
- foreach ( $json->results as $dummy ) {
115
- $user = get_user_by( 'email', $dummy->email );
116
- wp_delete_user( $user->ID );
117
}
118
}
119
-
120
delete_option('um_generated_dumies');
121
break;
122
123
default:
@@ -149,9 +187,27 @@ class UM_ADDON_generate_random_users {
149
} else { ?>
150
151
<p>This tool allows you to add dummies as Ultimate Member users. </p>
152
- <form method="get">
153
- <?php if( ! get_option('um_generated_dumies') ):?>
154
- <label for="total_users">How many dummies? <br/><input type="text" name="total_users" value="30" /> <br/><br/>
155
<label for="gender">Gender:</label> <br/>
156
<label><input type='radio' name="gender" value="male"/> Male</label> <br/>
157
<label><input type='radio' name="gender" value="female"/> Female</label> <br/>
@@ -178,23 +234,12 @@ class UM_ADDON_generate_random_users {
178
<br/><small>if you leave this blank, it will generate random strings password</small>
179
</label>
180
<br/>
181
- <?php endif; ?>
182
- <p>
183
- <?php if( ! get_option('um_generated_dumies') ):?>
184
- <input type="submit" class="button button-primary" value="Start Generating Dummies"/>
185
- <input type="hidden" name="um-addon-hook" value="generate_random_users"/>
186
- <?php endif; ?>
187
-
188
- <?php if( get_option('um_generated_dumies') ):?>
189
- <?php $dummies = get_option('um_generated_dumies'); ?>
190
- &nbsp;<input type="submit" class="button button-secondary" value="Remove Generated Dummies (<?php echo $dummies->info->results;?>)"/>
191
- <input type="hidden" name="um-addon-hook" value="remove_random_users"/>
192
- <?php endif; ?>
193
194
- <?php } ?>
195
- <input type="hidden" name="page" value="generate_random_users"/>
196
- </form>
197
-
198
</div><div class="clear"></div>
199
200
<?php
55
$response = file_get_contents( $json_url );
56
$json = json_decode( $response );
57
58
+ if( ! empty( $json ) ){
59
60
+ remove_action('um_after_new_user_register', 'um_after_new_user_register', 10, 2);
61
+
62
+ $failed_dummies = 0;
63
+ $default_role = um_get_option("default_role");
64
65
foreach( $json->results as $dummy ){
66
69
}else{
70
$password = wp_generate_password( 8, false );
71
}
72
+
73
+ $site_url = @$_SERVER['SERVER_NAME'];
74
+ $random_generate = wp_generate_password( 4, false );
75
+
76
+ if( username_exists( $dummy->login->username ) ){
77
+ $dummy->login->username = $dummy->login->username.'_'. $random_generate;
78
+ }
79
+
80
+ $dummy->login->email = $dummy->login->username."_dummy@{$site_url}";
81
+
82
+ if( email_exists( $dummy->login->email ) ){
83
+ $dummy->login->email = $dummy->login->username."_dummy_{$random_generate}@{$site_url}";
84
+ }
85
86
$userdata = array(
87
'display_name' => ucfirst( $dummy->name->first )." ".ucfirst( $dummy->name->last ),
88
'first_name' => ucfirst( $dummy->name->first ),
89
'last_name' => ucfirst( $dummy->name->last ),
90
+ 'user_email' => $dummy->login->email,
91
'user_login' => $dummy->login->username,
92
'user_pass' => $password,
93
);
94
95
$user_id = wp_insert_user( $userdata );
96
97
+ if( is_wp_error( $user_id ) ){
98
+ $failed_dummies++;
99
+ }
100
+
101
$usermeta = array(
102
'synced_profile_photo' => $dummy->picture->large,
103
'gender' => ucfirst($dummy->gender),
104
+ 'birth_date' => date("Y/m/d", strtotime( $dummy->dob) ),
105
+ '_um_last_login' => date("Y/m/d", strtotime( $dummy->registered ) ),
106
'mobile_number' => $dummy->cell,
107
'phone_number' => $dummy->phone,
108
'synced_gravatar_hashed_id' => md5( strtolower( trim( $dummy->email ) ) ),
109
'account_status' => 'approved',
110
+ '_um_profile_dummy' => true,
111
+ 'role' => isset( $default_role ) ? $default_role: 'member'
112
);
113
114
if( isset( $_GET['add_cover_photo'] ) && $_GET['add_cover_photo'] == 1 ){
123
foreach ( $usermeta as $key => $value ) {
124
update_user_meta( $user_id, $key, $value );
125
}
126
+
127
+
128
}
129
+ wp_redirect( admin_url("admin.php?page=generate_random_users") ); exit;
130
}
131
132
break;
133
134
case 'remove_random_users':
135
136
+ $dummies = new WP_User_Query(
137
+ array(
138
+ 'fields' => array('ID'),
139
+ 'meta_key' => '_um_profile_dummy',
140
+ 'meta_value' => true,
141
+ 'meta_compare' => '='
142
+ )
143
+ );
144
+
145
+ if( $dummies->total_users > 0 ){
146
+ foreach ( $dummies->get_results() as $dummy ) {
147
+
148
+ if( isset( $dummy->ID ) ){
149
+ wp_delete_user( $dummy->ID );
150
+ }
151
+
152
}
153
}
154
+
155
delete_option('um_generated_dumies');
156
+ wp_redirect( admin_url("admin.php?page=generate_random_users") );
157
+ exit;
158
+
159
break;
160
161
default:
187
} else { ?>
188
189
<p>This tool allows you to add dummies as Ultimate Member users. </p>
190
+ <?php
191
+ $dummies = new WP_User_Query(
192
+ array(
193
+ 'fields' => array('ID'),
194
+ 'meta_key' => '_um_profile_dummy',
195
+ 'meta_value' => true,
196
+ 'meta_compare' => '='
197
+ )
198
+ );
199
+ ?>
200
+ <?php if( $dummies->total_users > 0 ): ?>
201
+ <form method="get">
202
+ <p>
203
+ &nbsp;<input type="submit" class="button button-secondary" value="Remove Generated Dummies (<?php echo $dummies->total_users;?>)"/>
204
+ <input type="hidden" name="um-addon-hook" value="remove_random_users"/>
205
+ <input type="hidden" name="page" value="generate_random_users"/>
206
+ </form>
207
+ <br/>
208
+ <?php endif; ?>
209
+ <form method="get">
210
+ <label for="total_users">How many dummies? <br/><input type="text" name="total_users" value="30" /> <br/><br/>
211
<label for="gender">Gender:</label> <br/>
212
<label><input type='radio' name="gender" value="male"/> Male</label> <br/>
213
<label><input type='radio' name="gender" value="female"/> Female</label> <br/>
234
<br/><small>if you leave this blank, it will generate random strings password</small>
235
</label>
236
<br/>
237
+ <input type="submit" class="button button-primary" value="Start Generating Dummies"/>
238
+ <input type="hidden" name="um-addon-hook" value="generate_random_users"/>
239
+
240
+ <?php } ?>
241
+ </form>
242
243
</div><div class="clear"></div>
244
245
<?php
addons/system_info.php ADDED
@@ -0,0 +1,411 @@
1
+ <?php
2
+
3
+ class UM_ADDON_system_info {
4
+
5
+ function __construct() {
6
+
7
+ add_action('admin_menu', array(&$this, 'admin_menu'), 1001);
8
+
9
+ add_action('admin_init', array(&$this, 'admin_init'), 1);
10
+
11
+ add_action('um_admin_addon_hook', array(&$this, 'um_admin_addon_hook') );
12
+
13
+ }
14
+
15
+
16
+ function admin_menu() {
17
+
18
+ global $ultimatemember;
19
+ $this->addon = $ultimatemember->addons['system_info'];
20
+ add_submenu_page('ultimatemember', "System Info","System Info", 'manage_options', 'um_system_info', array(&$this, 'content') );
21
+
22
+ }
23
+
24
+ function um_admin_addon_hook( $hook ) {
25
+ global $ultimatemember;
26
+
27
+ switch ( $hook ) {
28
+
29
+ case 'download_system_info':
30
+
31
+ nocache_headers();
32
+
33
+ header( "Content-type: text/plain" );
34
+ header( 'Content-Disposition: attachment; filename="ultimatemember-system-info.txt"' );
35
+
36
+ echo wp_strip_all_tags( $_POST['um-sysinfo'] );
37
+ exit;
38
+
39
+ break;
40
+
41
+ default:
42
+
43
+ break;
44
+ }
45
+
46
+ }
47
+
48
+ function admin_init() {
49
+ if ( isset( $_REQUEST['um-addon-hook'] ) ) {
50
+ $hook = $_REQUEST['um-addon-hook'];
51
+ do_action("um_admin_addon_hook", $hook );
52
+ }
53
+ }
54
+
55
+ function content() {
56
+ global $wpdb, $ultimatemember;
57
+
58
+ if( !class_exists( 'Browser' ) )
59
+ require_once um_path . 'core/lib/browser.php';
60
+
61
+ // Detect browser
62
+ $browser = new Browser();
63
+
64
+ // Get theme info
65
+ $theme_data = wp_get_theme();
66
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
67
+
68
+ // Identify Hosting Provider
69
+ $host = um_get_host();
70
+
71
+ ?>
72
+
73
+ <div class="wrap">
74
+
75
+ <h2>Ultimate Member</h2>
76
+
77
+ <h3><?php echo $this->addon[0]; ?></h3>
78
+
79
+ <?php if ( isset( $this->content ) ) {
80
+ echo $this->content;
81
+ } else { ?>
82
+
83
+ <form action="<?php echo esc_url( admin_url( 'admin.php?page=um_system_info' ) ); ?>" method="post" dir="ltr">
84
+ <textarea style="width:100%; height:400px;" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="um-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd' ); ?>">
85
+ ### Begin System Info ###
86
+
87
+ ## Please include this information when posting support requests ##
88
+
89
+ <?php do_action( 'um_system_info_before' ); ?>
90
+
91
+ --- Site Info ---
92
+
93
+ Site URL: <?php echo site_url() . "\n"; ?>
94
+ Home URL: <?php echo home_url() . "\n"; ?>
95
+ Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
96
+
97
+ --- Hosting Provider ---
98
+
99
+ <?php if( $host ) : ?>
100
+ Host: <?php echo $host . "\n"; ?>
101
+ <?php endif; ?>
102
+
103
+ --- User Browser ---
104
+
105
+ <?php echo $browser ; ?>
106
+
107
+ --- WordPress Configurations ---
108
+
109
+ Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
110
+ Language: <?php echo get_locale()."\n"; ?>
111
+ Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
112
+ Active Theme: <?php echo $theme . "\n"; ?>
113
+ <?php $show_on_front = get_option( 'show_on_front' ); ?>
114
+ <?php if( $show_on_front == "posts" ): ?>
115
+ Show On Front: <?php echo get_option( 'show_on_front' ) . "/static\n" ?>
116
+ <?php elseif( $show_on_front == "page" ): ?>
117
+ Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
118
+ Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
119
+ <?php endif; ?>
120
+ ABSPATH: <?php echo ABSPATH."\n"; ?>
121
+ <?php $wp_count_posts = wp_count_posts(); ?>
122
+ All Posts/Pages: <?php echo array_sum((array)$wp_count_posts)."\n";?>
123
+ <?php
124
+ $request['cmd'] = '_notify-validate';
125
+
126
+ $params = array(
127
+ 'sslverify' => false,
128
+ 'timeout' => 60,
129
+ 'user-agent' => 'UltimateMember/' . ultimatemember_version,
130
+ 'body' => $request
131
+ );
132
+
133
+ $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
134
+
135
+ if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
136
+ $WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
137
+ } else {
138
+ $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
139
+ }
140
+ ?>
141
+ WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
142
+ WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
143
+ WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo ", Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?>
144
+ Memory Limit: <?php echo ( um_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?>
145
+
146
+ --- UM Configurations ---
147
+
148
+ Version: <?php echo ultimatemember_version . "\n"; ?>
149
+ Upgraded From: <?php echo get_option( 'um_version_upgraded_from', 'None' ) . "\n"; ?>
150
+ Current URL Method: <?php echo um_get_option( 'current_url_method' ). "\n"; ?>
151
+ Cache User Profile: <?php if( um_get_option( 'um_profile_object_cache_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
152
+ Generate Slugs on Directories: <?php if( um_get_option( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
153
+ Rewrite Rules: <?php if( um_get_option( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
154
+ Force UTF-8 Encoding: <?php if( um_get_option( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
155
+ Time Check Security: <?php if( um_get_option( 'enable_timebot' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
156
+ JS/CSS Compression: <?php if( um_get_option( 'disable_minify' ) == 0 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
157
+ <?php if( is_multisite() ): ?>
158
+ Network Structure: <?php echo um_get_option( 'network_permalink_structure' ). "\n"; ?>
159
+ <?php endif; ?>
160
+ Nav Menu Settings: <?php if( um_get_option( 'disable_menu' ) == 0 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
161
+ Port Forwarding in URL: <?php if( um_get_option( 'um_port_forwarding_url' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
162
+ Exclude CSS/JS on Home: <?php if( um_get_option( 'js_css_exlcude_home' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
163
+
164
+ --- UM Pages Configuration ---
165
+
166
+ <?php do_action("um_system_info_before_page_config") ?>
167
+ User: <?php echo get_permalink( um_get_option('core_user') ) . "\n"; ?>
168
+ Account: <?php echo get_permalink( um_get_option('core_account') ) . "\n"; ?>
169
+ Members: <?php echo get_permalink( um_get_option('core_members') ) . "\n"; ?>
170
+ Register: <?php echo get_permalink( um_get_option('core_register') ) . "\n"; ?>
171
+ Login: <?php echo get_permalink( um_get_option('core_login') ) . "\n"; ?>
172
+ Logout: <?php echo get_permalink( um_get_option('core_logout') ) . "\n"; ?>
173
+ Password Reset: <?php echo get_permalink( um_get_option('core_password-reset') ) . "\n"; ?>
174
+ <?php do_action("um_system_info_after_page_config") ?>
175
+
176
+ -- UM Users Configuration ---
177
+
178
+ Default New User Role: <?php echo um_get_option('default_role') . "\n"; ?>
179
+ Profile Permalink Base: <?php echo um_get_option('permalink_base') . "\n"; ?>
180
+ User Display Name: <?php echo um_get_option('display_name') . "\n"; ?>
181
+ Force Name to Uppercase: <?php echo $this->value( um_get_option('force_display_name_capitlized'), 'yesno', true ); ?>
182
+ Redirect author to profile: <?php echo $this->value( um_get_option('author_redirect'), 'yesno', true ); ?>
183
+ Enable Members Directory: <?php echo $this->value( um_get_option('members_page'), 'yesno', true ); ?>
184
+ Use Gravatars: <?php echo $this->value( um_get_option('use_gravatars'), 'yesno', true ); ?>
185
+ <?php if( um_get_option('use_gravatars') ): ?>Gravatar builtin image: <?php echo um_get_option('use_um_gravatar_default_builtin_image') . "\n"; ?>
186
+ UM Avatar as blank Gravatar: <?php echo $this->value( um_get_option('use_um_gravatar_default_image'), 'yesno', true ); ?><?php endif; ?>
187
+ Require a strong password: <?php echo $this->value( um_get_option('reset_require_strongpass'), 'onoff', true ); ?>
188
+ Editable primary email field in profile view: <?php echo $this->value( um_get_option('editable_primary_email_in_profile'), 'onoff', true ); ?>
189
+
190
+ -- UM Access Configuration ---
191
+
192
+ Panic Key: <?php echo um_get_option('panic_key') . "\n"; ?>
193
+ Global Site Access: <?php $arr = array('Site accessible to Everyone','','Site accessible to Logged In Users'); echo $arr[ intval( um_get_option('accessible') ) ] . "\n"; ?>
194
+ <?php if( um_get_option('accessible') == 2 ):?>
195
+ Custom Redirect URL: <?php echo um_get_option('access_redirect')."\n";?>
196
+ Exclude the following URLs:<?php echo "\t\t\t\t".implode("\t\n\t\t\t\t\t\t\t\t\t\t",um_get_option('access_exclude_uris') )."\n";?><?php endif;?>
197
+ Backend Login Screen for Guests: <?php echo $this->value( um_get_option('wpadmin_login'), 'yesno', true ); ?>
198
+ <?php if( ! um_get_option('wpadmin_login') ):?>Redirect to alternative login page: <?php if( um_get_option('wpadmin_login_redirect') == 'um_login_page' ){ echo um_get_core_page('login')."\n"; }else{ echo um_get_option('wpadmin_login_redirect_url')."\n"; }?><?php endif; ?>
199
+ Backend Register Screen for Guests: <?php echo $this->value( um_get_option('wpadmin_register'), 'yesno', true ); ?>
200
+ <?php if( ! um_get_option('wpadmin_register') ):?>Redirect to alternative register page: <?php if( um_get_option('wpadmin_register_redirect') == 'um_register_page' ){ echo um_get_core_page('register')."\n"; }else{ echo um_get_option('wpadmin_register_redirect_url')."\n"; }?><?php endif; ?>
201
+ Access Control widget for Admins only: <?php echo $this->value( um_get_option('access_widget_admin_only'), 'yesno', true ); ?>
202
+ Enable the Reset Password Limit: <?php echo $this->value( um_get_option('enable_reset_password_limit'), 'yesno', true ); ?>
203
+ <?php if( um_get_option('enable_reset_password_limit') ) {
204
+ echo "Reset Password Limit:\t\t\t\t\t\t".um_get_option('reset_password_limit_number')."\n";
205
+ echo "Disable Reset Password Limit for Admins:\t".$this->value( um_get_option('disable_admin_reset_password_limit'), 'yesno', true );
206
+ } ?>
207
+ <?php $wpadmin_allow_ips = um_get_option('wpadmin_allow_ips'); if( ! empty( $wpadmin_allow_ips ) ){ ?>
208
+ Whitelisted Backend IPs: <?php echo count( explode("\n",trim(um_get_option('wpadmin_allow_ips') ) ) )."\n"; ?>
209
+ <?php }?>
210
+ <?php $blocked_ips = um_get_option('blocked_ips'); if( ! empty( $blocked_ips ) ){ ?>
211
+ Blocked IP Addresses: <?php echo count( explode("\n",um_get_option('blocked_ips') ) )."\n"; ?>
212
+ <?php }?>
213
+ <?php $blocked_emails = um_get_option('blocked_emails'); if( ! empty( $blocked_emails ) ){ ?>
214
+ Blocked Email Addresses: <?php echo count( explode("\n",um_get_option('blocked_emails') ) )."\n"; ?>
215
+ <?php }?>
216
+ <?php $blocked_words = um_get_option('blocked_words'); if( ! empty( $blocked_words ) ){ ?>
217
+ Blacklist Words: <?php echo count( explode("\n",um_get_option('blocked_words') ) )."\n"; ?>
218
+ <?php }?>
219
+
220
+
221
+ --- UM Email Configurations --
222
+
223
+ Mail appears from: <?php $mail_from = um_get_option('mail_from'); if( ! empty( $mail_from ) ){echo um_get_option('mail_from');}else{echo "-";}; echo "\n";?>
224
+ Mail appears from address: <?php $mail_from_addr = um_get_option('mail_from_addr'); if( ! empty( $mail_from_addr ) ){echo um_get_option('mail_from_addr');}else{echo "-";}; echo "\n";?>
225
+ Use HTML for E-mails: <?php echo $this->value( um_get_option('email_html'), 'yesno', true ); ?>
226
+ Account Welcome Email: <?php echo $this->value( um_get_option('welcome_email_on'), 'yesno', true ); ?>
227
+ Account Activation Email: <?php echo $this->value( um_get_option('checkmail_email_on'), 'yesno', true ); ?>
228
+ Pending Review Email: <?php echo $this->value( um_get_option('pending_email_on'), 'yesno', true ); ?>
229
+ Account Approved Email: <?php echo $this->value( um_get_option('approved_email_on'), 'yesno', true ); ?>
230
+ Account Rejected Email: <?php echo $this->value( um_get_option('rejected_email_on'), 'yesno', true ); ?>
231
+ Account Deactivated Email: <?php echo $this->value( um_get_option('inactive_email_on'), 'yesno', true ); ?>
232
+ Account Deleted Email: <?php echo $this->value( um_get_option('deletion_email_on'), 'yesno', true ); ?>
233
+ Password Reset Email: <?php echo $this->value( um_get_option('resetpw_email_on'), 'yesno', true ); ?>
234
+ Password Changed Email: <?php echo $this->value( um_get_option('changedpw_email_on'), 'yesno', true ); ?>
235
+
236
+
237
+ --- UM Total Users ---
238
+
239
+ <?php
240
+
241
+ $result = count_users();
242
+ echo 'All Users('.$result['total_users'].")\n";
243
+ foreach($result['avail_roles'] as $role => $count){
244
+ echo $role."(".$count.")\n";
245
+ }
246
+ ?>
247
+
248
+
249
+ --- UM Roles ---
250
+
251
+ <?php
252
+
253
+ foreach( $ultimatemember->query->get_roles() as $role_id => $role ) {
254
+ echo $role." ({$role_id})\n";
255
+ }
256
+
257
+ ?>
258
+
259
+
260
+ --- UM Custom Templates ---
261
+
262
+ <?php
263
+ // Show templates that have been copied to the theme's edd_templates dir
264
+
265
+ $dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
266
+ if ( ! empty( $dir ) ){
267
+ $found = glob( $dir );
268
+ if( ! empty( $found ) ){
269
+ foreach ( glob( $dir ) as $file ) {
270
+ echo "File: " . $file . "\n";
271
+ }
272
+ }else {
273
+ echo 'N/A'."\n";
274
+ }
275
+ }
276
+ echo "\n\n";
277
+
278
+ $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html';
279
+ echo "-- UM Email HTML Templates -- \n\n";
280
+
281
+ if ( ! empty( $dir ) ){
282
+ $found = glob( $dir );
283
+ if( ! empty( $found ) ){
284
+ foreach ( glob( $dir ) as $file ) {
285
+ echo "File: ". $file . "\n";
286
+ }
287
+ }else {
288
+ echo 'N/A'."\n";
289
+ }
290
+ }
291
+
292
+ ?>
293
+
294
+ --- Web Server Configurations ---
295
+
296
+ PHP Version: <?php echo PHP_VERSION . "\n"; ?>
297
+ MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?>
298
+ Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
299
+
300
+ --- PHP Configurations --
301
+
302
+ PHP Safe Mode: <?php echo $this->value( ini_get( 'safe_mode' ), 'yesno', true ); ?>
303
+ PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
304
+ PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
305
+ PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
306
+ PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
307
+ PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
308
+ PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
309
+ PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
310
+ PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes\n" : "No\n"; ?>
311
+
312
+
313
+ --- Web Server Extensions/Modules ---
314
+
315
+ DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
316
+ FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
317
+ cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
318
+ SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?>
319
+ SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
320
+
321
+
322
+ --- Session Configurations ---
323
+
324
+ Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
325
+ Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
326
+ Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
327
+ Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
328
+ Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
329
+ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
330
+
331
+
332
+
333
+ --- WordPress Active Plugins ---
334
+
335
+ <?php
336
+ $plugins = get_plugins();
337
+ $active_plugins = get_option( 'active_plugins', array() );
338
+
339
+ foreach ( $plugins as $plugin_path => $plugin ) {
340
+ // If the plugin isn't active, don't show it.
341
+ if ( ! in_array( $plugin_path, $active_plugins ) )
342
+ continue;
343
+
344
+ echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
345
+ }
346
+
347
+ if ( is_multisite() ) :
348
+ ?>
349
+
350
+ --- WordPress Network Active Plugins ---
351
+
352
+ <?php
353
+ $plugins = wp_get_active_network_plugins();
354
+ $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
355
+
356
+ foreach ( $plugins as $plugin_path ) {
357
+ $plugin_base = plugin_basename( $plugin_path );
358
+
359
+ // If the plugin isn't active, don't show it.
360
+ if ( ! array_key_exists( $plugin_base, $active_plugins ) )
361
+ continue;
362
+
363
+ $plugin = get_plugin_data( $plugin_path );
364
+
365
+ echo $plugin['Name'] . ' :' . $plugin['Version'] ."\n";
366
+ }
367
+
368
+ endif;
369
+ ?>
370
+ <?php
371
+ do_action( 'um_system_info_after' );
372
+ ?>
373
+
374
+
375
+
376
+
377
+ ### End System Info ###</textarea>
378
+ <p class="submit">
379
+ <input type="hidden" name="um-addon-hook" value="download_system_info" />
380
+ <?php submit_button( 'Download System Info File', 'primary', 'download_system_info', false ); ?>
381
+ </p>
382
+ </form>
383
+
384
+ <?php } ?>
385
+
386
+ <?php
387
+
388
+ }
389
+
390
+ function value( $raw_value = '', $type = 'yesno', $default = '', $default_negate = '' ){
391
+
392
+ if( $type == 'yesno' ){
393
+ if( $default == $raw_value ){
394
+ $raw_value = "Yes";
395
+ }else{
396
+ $raw_value = "No";
397
+ }
398
+ }else if( $type == 'onoff' ){
399
+ if( $default == $raw_value ){
400
+ $raw_value = "On";
401
+ }else{
402
+ $raw_value = "Off";
403
+ }
404
+ }
405
+
406
+ return $raw_value."\n";
407
+ }
408
+
409
+ }
410
+
411
+ $UM_ADDON_system_info = new UM_ADDON_system_info();
admin/assets/css/um-admin-select2.css CHANGED
@@ -186,4 +186,8 @@ body.um-admin .select2-container--default .select2-results__option[aria-selected
186
187
body.um-admin .select2-container .select2-search--inline {
188
line-height: 37px !important;
189
}
186
187
body.um-admin .select2-container .select2-search--inline {
188
line-height: 37px !important;
189
+ }
190
+
191
+ body.um-admin .select2-drop-active {
192
+ z-index: 99999 !important;
193
}
admin/assets/js/um-admin-users.js CHANGED
@@ -1,3 +1,30 @@
1
jQuery(document).ready(function() {
2
-
3
- });
1
jQuery(document).ready(function() {
2
+
3
+ function getParameterByName(name, url) {
4
+ if (!url) url = window.location.href;
5
+ name = name.replace(/[\[\]]/g, "\\amp;");
6
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
7
+ results = regex.exec(url);
8
+ if (!results) return null;
9
+ if (!results[2]) return '';
10
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
11
+ }
12
+
13
+ jQuery("#_um_synced_role").on("change",function(){
14
+ $sync_button = jQuery("#_um_button_sync_update_button");
15
+ var url = $sync_button.attr("href");
16
+
17
+ if ( ! getParameterByName('wp_role', url) ) {
18
+ console.log("wp_role is not set");
19
+ }
20
+
21
+ var um_role = getParameterByName('um_role', url);
22
+ var wp_role = jQuery(this).val();
23
+ $sync_button.attr("href", window.location.href+'&um_adm_action=mass_role_sync&um_role='+um_role+'&wp_role='+wp_role );
24
+
25
+ });
26
+
27
+
28
+
29
+ });
30
+
admin/core/um-admin-actions.php CHANGED
@@ -163,24 +163,25 @@
163
add_action('um_admin_do_action__mass_role_sync', 'um_admin_do_action__mass_role_sync');
164
function um_admin_do_action__mass_role_sync( $action ){
165
global $ultimatemember;
166
- if ( !is_admin() || !current_user_can( 'edit_user' ) ) die();
167
168
- if ( !isset($_REQUEST['post']) || !is_numeric( $_REQUEST['post'] ) ) die();
169
170
$post_id = (int) $_REQUEST['post'];
171
172
$post = get_post( $post_id );
173
$slug = $post->post_name;
174
-
175
if ( $slug != $_REQUEST['um_role'] )
176
- die();
177
-
178
- if ( get_post_meta( $post_id, '_um_synced_role', true ) != $_REQUEST['wp_role'] )
179
- die();
180
181
if ( $slug == 'admin' ) {
182
$_REQUEST['wp_role'] = 'administrator';
183
update_post_meta( $post_id, '_um_synced_role', 'administrator' );
184
}
185
186
$wp_role = ( $_REQUEST['wp_role'] ) ? $_REQUEST['wp_role'] : 'subscriber';
163
add_action('um_admin_do_action__mass_role_sync', 'um_admin_do_action__mass_role_sync');
164
function um_admin_do_action__mass_role_sync( $action ){
165
global $ultimatemember;
166
+ if ( !is_admin() || !current_user_can( 'edit_user' ) ) wp_die('You don\'t have permissions to access this page.');
167
168
+ if ( !isset($_REQUEST['post']) || !is_numeric( $_REQUEST['post'] ) ) wp_die('You\'re not allowed to do this.');
169
170
$post_id = (int) $_REQUEST['post'];
171
172
$post = get_post( $post_id );
173
$slug = $post->post_name;
174
+
175
if ( $slug != $_REQUEST['um_role'] )
176
+ wp_die('Invalid community role.');
177
178
+ $um_synced_role = get_post_meta( $post_id, '_um_synced_role', true );
179
+
180
if ( $slug == 'admin' ) {
181
$_REQUEST['wp_role'] = 'administrator';
182
update_post_meta( $post_id, '_um_synced_role', 'administrator' );
183
+ }else{
184
+ update_post_meta( $post_id, '_um_synced_role', $_REQUEST['wp_role'] );
185
}
186
187
$wp_role = ( $_REQUEST['wp_role'] ) ? $_REQUEST['wp_role'] : 'subscriber';
admin/core/um-admin-dashboard.php CHANGED
@@ -41,7 +41,7 @@ class UM_Admin_Dashboard {
41
// Change the footer text
42
if ( ! get_option( 'um_admin_footer_text_rated' ) ) {
43
44
- $footer_text = sprintf( __( 'If you like Ultimate Member please consider leaving a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s review. It will help us to grow the plugin and make it more popular. Thank you.', 'ultimatemember' ), '<a href="https://wordpress.org/support/view/plugin-reviews/ultimate-member?filter=5#postform" target="_blank" class="um-admin-rating-link" data-rated="' . __( 'Thanks :)', 'ultimatemember' ) . '">', '</a>' );
45
46
$footer_text .= "<script type='text/javascript'>
47
jQuery('a.um-admin-rating-link').click(function() {
41
// Change the footer text
42
if ( ! get_option( 'um_admin_footer_text_rated' ) ) {
43
44
+ $footer_text = sprintf( __( 'If you like Ultimate Member please consider leaving a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s review. It will help us to grow the plugin and make it more popular. Thank you.', 'ultimatemember' ), '<a href="https://wordpress.org/support/plugin/ultimate-member/reviews/?filter=5" target="_blank" class="um-admin-rating-link" data-rated="' . __( 'Thanks :)', 'ultimatemember' ) . '">', '</a>' );
45
46
$footer_text .= "<script type='text/javascript'>
47
jQuery('a.um-admin-rating-link').click(function() {
admin/templates/role/sync.php CHANGED
@@ -25,7 +25,7 @@ $url = add_query_arg('wp_role', $saved_r, $url);
25
</span>
26
</p><div class="um-admin-clear"></div>
27
28
- <p><a href="<?php echo $url; ?>" class="button"><?php _e('Sync / update all existing users','ultimatemember'); ?></a></p>
29
30
</div>
31
25
</span>
26
</p><div class="um-admin-clear"></div>
27
28
+ <p><a href="<?php echo $url; ?>" id="_um_button_sync_update_button" class="button"><?php _e('Sync / update all existing users','ultimatemember'); ?></a></p>
29
30
</div>
31
core/lib/browser.php ADDED
@@ -0,0 +1,1103 @@
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Modified to remove var
8
+ * Chris Christoff on 12/26/2012
9
+ * Changes: Changes vars to publics
10
+ *
11
+ * Modified to work for EDD by
12
+ * Chris Christoff on 12/23/2012
13
+ * Changes: Removed the browser string return and added spacing. Also removed return HTML formatting.
14
+ *
15
+ * Modified to add formatted User Agent string for EDD System Info by
16
+ * Chris Christoff on 12/23/2012
17
+ * Changes: Split user string and add formatting so we can print a nicely
18
+ * formatted user agent string on the EDD System Info
19
+ *
20
+ * File: Browser.php
21
+ * Author: Chris Schuld (http://chrisschuld.com/)
22
+ * Last Modified: August 20th, 2010
23
+ *
24
+ * @version 1.9
25
+ * @package PegasusPHP
26
+ *
27
+ * Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
28
+ *
29
+ * This program is free software; you can redistribute it and/or
30
+ * modify it under the terms of the GNU General Public License as
31
+ * published by the Free Software Foundation; either version 2 of
32
+ * the License, or (at your option) any later version.
33
+ *
34
+ * This program is distributed in the hope that it will be useful,
35
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37
+ * GNU General Public License for more details at:
38
+ * http://www.gnu.org/copyleft/gpl.html
39
+ *
40
+ *
41
+ * Typical Usage:
42
+ *
43
+ * $browser = new Browser();
44
+ * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
45
+ * echo 'You have FireFox version 2 or greater';
46
+ * }
47
+ *
48
+ * User Agents Sampled from: http://www.useragentstring.com/
49
+ *
50
+ * This implementation is based on the original work from Gary White
51
+ * http://apptools.com/phptools/browser/
52
+ *
53
+ * UPDATES:
54
+ *
55
+ * 2010-08-20 (v1.9):
56
+ * + Added MSN Explorer Browser (legacy)
57
+ * + Added Bing/MSN Robot (Thanks Rob MacDonald)
58
+ * + Added the Android Platform (PLATFORM_ANDROID)
59
+ * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima)
60
+ *
61
+ * 2010-04-27 (v1.8):
62
+ * + Added iPad Support
63
+ *
64
+ * 2010-03-07 (v1.7):
65
+ * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s))
66
+ * + Almost allof Gary's original code has been replaced
67
+ * + Large PHPUNIT testing environment created to validate new releases and additions
68
+ * + Added FreeBSD Platform
69
+ * + Added OpenBSD Platform
70
+ * + Added NetBSD Platform
71
+ * + Added SunOS Platform
72
+ * + Added OpenSolaris Platform
73
+ * + Added support of the Iceweazel Browser
74
+ * + Added isChromeFrame() call to check if chromeframe is in use
75
+ * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents
76
+ * + Added the __toString() method (Thanks Deano)
77
+ *
78
+ * 2009-11-15:
79
+ * + Updated the checkes for Firefox
80
+ * + Added the NOKIA platform
81
+ * + Added Checks for the NOKIA brower(s)
82
+ *
83
+ * 2009-11-08:
84
+ * + PHP 5.3 Support
85
+ * + Added support for BlackBerry OS and BlackBerry browser
86
+ * + Added support for the Opera Mini browser
87
+ * + Added additional documenation
88
+ * + Added support for isRobot() and isMobile()
89
+ * + Added support for Opera version 10
90
+ * + Added support for deprecated Netscape Navigator version 9
91
+ * + Added support for IceCat
92
+ * + Added support for Shiretoko
93
+ *
94
+ * 2010-04-27 (v1.8):
95
+ * + Added iPad Support
96
+ *
97
+ * 2009-08-18:
98
+ * + Updated to support PHP 5.3 - removed all deprecated function calls
99
+ * + Updated to remove all double quotes (") -- converted to single quotes (')
100
+ *
101
+ * 2009-04-27:
102
+ * + Updated the IE check to remove a typo and bug (thanks John)
103
+ *
104
+ * 2009-04-22:
105
+ * + Added detection for GoogleBot
106
+ * + Added detection for the W3C Validator.
107
+ * + Added detection for Yahoo! Slurp
108
+ *
109
+ * 2009-03-14:
110
+ * + Added detection for iPods.
111
+ * + Added Platform detection for iPhones
112
+ * + Added Platform detection for iPods
113
+ *
114
+ * 2009-02-16: (Rick Hale)
115
+ * + Added version detection for Android phones.
116
+ *
117
+ * 2008-12-09:
118
+ * + Removed unused constant
119
+ *
120
+ * 2008-11-07:
121
+ * + Added Google's Chrome to the detection list
122
+ * + Added isBrowser(string) to the list of functions special thanks to
123
+ * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au)
124
+ *
125
+ *
126
+ * Gary White noted: "Since browser detection is so unreliable, I am
127
+ * no longer maintaining this script. You are free to use and or
128
+ * modify/update it as you want, however the author assumes no
129
+ * responsibility for the accuracy of the detected values."
130
+ *
131
+ * Anyone experienced with Gary's script might be interested in these notes:
132
+ *
133
+ * Added class constants
134
+ * Added detection and version detection for Google's Chrome
135
+ * Updated the version detection for Amaya
136
+ * Updated the version detection for Firefox
137
+ * Updated the version detection for Lynx
138
+ * Updated the version detection for WebTV
139
+ * Updated the version detection for NetPositive
140
+ * Updated the version detection for IE
141
+ * Updated the version detection for OmniWeb
142
+ * Updated the version detection for iCab
143
+ * Updated the version detection for Safari
144
+ * Updated Safari to remove mobile devices (iPhone)
145
+ * Added detection for iPhone
146
+ * Added detection for robots
147
+ * Added detection for mobile devices
148
+ * Added detection for BlackBerry
149
+ * Removed Netscape checks (matches heavily with firefox & mozilla)
150
+ *
151
+ */
152
+
153
+ class Browser {
154
+ public $_agent = '';
155
+ public $_browser_name = '';
156
+ public $_version = '';
157
+ public $_platform = '';
158
+ public $_os = '';
159
+ public $_is_aol = false;
160
+ public $_is_mobile = false;
161
+ public $_is_robot = false;
162
+ public $_aol_version = '';
163
+
164
+ public $BROWSER_UNKNOWN = 'unknown';
165
+ public $VERSION_UNKNOWN = 'unknown';
166
+
167
+ public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/
168
+ public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/
169
+ public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/
170
+ public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/
171
+ public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
172
+ public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/
173
+ public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/
174
+ public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/
175
+ public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/
176
+ public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html
177
+ public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/
178
+ public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko
179
+ public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/
180
+ public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/
181
+ public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx
182
+ public $BROWSER_SAFARI = 'Safari'; // Http://apple.com
183
+ public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com
184
+ public $BROWSER_IPOD = 'iPod'; // Http://apple.com
185
+ public $BROWSER_IPAD = 'iPad'; // Http://apple.com
186
+ public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome
187
+ public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/
188
+ public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot
189
+ public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp
190
+ public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/
191
+ public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/
192
+ public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat
193
+ public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60
194
+ public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
195
+ public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/
196
+ public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm
197
+ // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well)
198
+
199
+ public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED)
200
+ public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED)
201
+ public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
202
+ public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
203
+
204
+ public $PLATFORM_UNKNOWN = 'unknown';
205
+ public $PLATFORM_WINDOWS = 'Windows';
206
+ public $PLATFORM_WINDOWS_CE = 'Windows CE';
207
+ public $PLATFORM_APPLE = 'Apple';
208
+ public $PLATFORM_LINUX = 'Linux';
209
+ public $PLATFORM_OS2 = 'OS/2';
210
+ public $PLATFORM_BEOS = 'BeOS';
211
+ public $PLATFORM_IPHONE = 'iPhone';
212
+ public $PLATFORM_IPOD = 'iPod';
213
+ public $PLATFORM_IPAD = 'iPad';
214
+ public $PLATFORM_BLACKBERRY = 'BlackBerry';
215
+ public $PLATFORM_NOKIA = 'Nokia';
216
+ public $PLATFORM_FREEBSD = 'FreeBSD';
217
+ public $PLATFORM_OPENBSD = 'OpenBSD';
218
+ public $PLATFORM_NETBSD = 'NetBSD';
219
+ public $PLATFORM_SUNOS = 'SunOS';
220
+ public $PLATFORM_OPENSOLARIS = 'OpenSolaris';
221
+ public $PLATFORM_ANDROID = 'Android';
222
+
223
+ public $OPERATING_SYSTEM_UNKNOWN = 'unknown';
224
+
225
+ function __construct( $useragent="" ) {
226
+ $this->reset();
227
+ if ( $useragent != "" ) {
228
+ $this->setUserAgent( $useragent );
229
+ } else {
230
+ $this->determine();
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Reset all properties
236
+ */
237
+ function reset() {
238
+ $this->_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : "";
239
+ $this->_browser_name = $this->BROWSER_UNKNOWN;
240
+ $this->_version = $this->VERSION_UNKNOWN;
241
+ $this->_platform = $this->PLATFORM_UNKNOWN;
242
+ $this->_os = $this->OPERATING_SYSTEM_UNKNOWN;
243
+ $this->_is_aol = false;
244
+ $this->_is_mobile = false;
245
+ $this->_is_robot = false;
246
+ $this->_aol_version = $this->VERSION_UNKNOWN;
247
+ }
248
+
249
+ /**
250
+ * Check to see if the specific browser is valid
251
+ *
252
+ * @param string $browserName
253
+ * @return True if the browser is the specified browser
254
+ */
255
+ function isBrowser( $browserName ) { return 0 == strcasecmp( $this->_browser_name, trim( $browserName ) ); }
256
+
257
+ /**
258
+ * The name of the browser. All return types are from the class contants
259
+ *
260
+ * @return string Name of the browser
261
+ */
262
+ function getBrowser() { return $this->_browser_name; }
263
+ /**
264
+ * Set the name of the browser
265
+ *
266
+ * @param unknown $browser The name of the Browser
267
+ */
268
+ function setBrowser( $browser ) { return $this->_browser_name = $browser; }
269
+ /**
270
+ * The name of the platform. All return types are from the class contants
271
+ *
272
+ * @return string Name of the browser
273
+ */
274
+ function getPlatform() { return $this->_platform; }
275
+ /**
276
+ * Set the name of the platform
277
+ *
278
+ * @param unknown $platform The name of the Platform
279
+ */
280
+ function setPlatform( $platform ) { return $this->_platform = $platform; }
281
+ /**
282
+ * The version of the browser.
283
+ *
284
+ * @return string Version of the browser (will only contain alpha-numeric characters and a period)
285
+ */
286
+ function getVersion() { return $this->_version; }
287
+ /**
288
+ * Set the version of the browser
289
+ *
290
+ * @param unknown $version The version of the Browser
291
+ */
292
+ function setVersion( $version ) { $this->_version = preg_replace( '/[^0-9,.,a-z,A-Z-]/', '', $version ); }
293
+ /**
294
+ * The version of AOL.
295
+ *
296
+ * @return string Version of AOL (will only contain alpha-numeric characters and a period)
297
+ */
298
+ function getAolVersion() { return $this->_aol_version; }
299
+ /**
300
+ * Set the version of AOL
301
+ *
302
+ * @param unknown $version The version of AOL
303
+ */
304
+ function setAolVersion( $version ) { $this->_aol_version = preg_replace( '/[^0-9,.,a-z,A-Z]/', '', $version ); }
305
+ /**
306
+ * Is the browser from AOL?
307
+ *
308
+ * @return boolean True if the browser is from AOL otherwise false
309
+ */
310
+ function isAol() { return $this->_is_aol; }
311
+ /**
312
+ * Is the browser from a mobile device?
313
+ *
314
+ * @return boolean True if the browser is from a mobile device otherwise false
315
+ */
316
+ function isMobile() { return $this->_is_mobile; }
317
+ /**
318
+ * Is the browser from a robot (ex Slurp,GoogleBot)?
319
+ *
320
+ * @return boolean True if the browser is from a robot otherwise false
321
+ */
322
+ function isRobot() { return $this->_is_robot; }
323
+ /**
324
+ * Set the browser to be from AOL
325
+ *
326
+ * @param unknown $isAol
327
+ */
328
+ function setAol( $isAol ) { $this->_is_aol = $isAol; }
329
+ /**
330
+ * Set the Browser to be mobile
331
+ *
332
+ * @param boolean $value is the browser a mobile brower or not
333
+ */
334
+ function setMobile( $value=true ) { $this->_is_mobile = $value; }
335
+ /**
336
+ * Set the Browser to be a robot
337
+ *
338
+ * @param boolean $value is the browser a robot or not
339
+ */
340
+ function setRobot( $value=true ) { $this->_is_robot = $value; }
341
+ /**
342
+ * Get the user agent value in use to determine the browser
343
+ *
344
+ * @return string The user agent from the HTTP header
345
+ */
346
+ function getUserAgent() { return $this->_agent; }
347
+ /**
348
+ * Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
349
+ *
350
+ * @param unknown $agent_string The value for the User Agent
351
+ */
352
+ function setUserAgent( $agent_string ) {
353
+ $this->reset();
354
+ $this->_agent = $agent_string;
355
+ $this->determine();
356
+ }
357
+ /**
358
+ * Used to determine if the browser is actually "chromeframe"
359
+ *
360
+ * @since 1.7
361
+ * @return boolean True if the browser is using chromeframe
362
+ */
363
+ function isChromeFrame() {
364
+ return strpos( $this->_agent, "chromeframe" ) !== false;
365
+ }
366
+ /**
367
+ * Returns a formatted string with a summary of the details of the browser.
368
+ *
369
+ * @return string formatted string with a summary of the browser
370
+ */
371
+ function __toString() {
372
+ $text1 = $this->getUserAgent(); //grabs the UA (user agent) string
373
+ $UAline1 = substr( $text1, 0, 32 ); //the first line we print should only be the first 32 characters of the UA string
374
+ $text2 = $this->getUserAgent();//now we grab it again and save it to a string
375
+ $towrapUA = str_replace( $UAline1, '', $text2 );//the rest of the printoff (other than first line) is equivolent
376
+ // To the whole string minus the part we printed off. IE
377
+ // User Agent: thefirst32charactersfromUAline1
378
+ // the rest of it is now stored in
379
+ // $text2 to be printed off
380
+ // But we need to add spaces before each line that is split other than line 1
381
+ $space = '';
382
+ for ( $i = 0; $i < 25; $i++ ) {
383
+ $space .= ' ';
384
+ }
385
+ // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
386
+ $wordwrapped = chunk_split( $towrapUA, 32, "\n $space" );
387
+ return "Platform: {$this->getPlatform()} \n".
388
+ "Browser Name: {$this->getBrowser()} \n" .
389
+ "Browser Version: {$this->getVersion()} \n" .
390
+ "User Agent String: $UAline1 \n\t\t\t " .
391
+ "$wordwrapped";
392
+ }
393
+ /**
394
+ * Protected routine to calculate and determine what the browser is in use (including platform)
395
+ */
396
+ function determine() {
397
+ $this->checkPlatform();
398
+ $this->checkBrowsers();
399
+ $this->checkForAol();
400
+ }
401
+ /**
402
+ * Protected routine to determine the browser type
403
+ *
404
+ * @return boolean True if the browser was detected otherwise false
405
+ */
406
+ function checkBrowsers() {
407
+ return (
408
+ // Well-known, well-used
409
+ // Special Notes:
410
+ // (1) Opera must be checked before FireFox due to the odd
411
+ // user agents used in some older versions of Opera
412
+ // (2) WebTV is strapped onto Internet Explorer so we must
413
+ // check for WebTV before IE
414
+ // (3) (deprecated) Galeon is based on Firefox and needs to be
415
+ // tested before Firefox is tested
416
+ // (4) OmniWeb is based on Safari so OmniWeb check must occur
417
+ // before Safari
418
+ // (5) Netscape 9+ is based on Firefox so Netscape checks
419
+ // before FireFox are necessary
420
+ $this->checkBrowserWebTv() ||
421
+ $this->checkBrowserInternetExplorer() ||
422
+ $this->checkBrowserOpera() ||
423
+ $this->checkBrowserGaleon() ||
424
+ $this->checkBrowserNetscapeNavigator9Plus() ||
425
+ $this->checkBrowserFirefox() ||
426
+ $this->checkBrowserChrome() ||
427
+ $this->checkBrowserOmniWeb() ||
428
+
429
+ // Common mobile
430
+ $this->checkBrowserAndroid() ||
431
+ $this->checkBrowseriPad() ||
432
+ $this->checkBrowseriPod() ||
433
+ $this->checkBrowseriPhone() ||
434
+ $this->checkBrowserBlackBerry() ||
435
+ $this->checkBrowserNokia() ||
436
+
437
+ // Common bots
438
+ $this->checkBrowserGoogleBot() ||
439
+ $this->checkBrowserMSNBot() ||
440
+ $this->checkBrowserSlurp() ||
441
+
442
+ // WebKit base check (post mobile and others)
443
+ $this->checkBrowserSafari() ||
444
+
445
+ // Everyone else
446
+ $this->checkBrowserNetPositive() ||
447
+ $this->checkBrowserFirebird() ||
448
+ $this->checkBrowserKonqueror() ||
449
+ $this->checkBrowserIcab() ||
450
+ $this->checkBrowserPhoenix() ||
451
+ $this->checkBrowserAmaya() ||
452
+ $this->checkBrowserLynx() ||
453
+
454
+ $this->checkBrowserShiretoko() ||
455
+ $this->checkBrowserIceCat() ||
456
+ $this->checkBrowserW3CValidator() ||
457
+ $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
458
+ );
459
+ }
460
+
461
+ /**
462
+ * Determine if the user is using a BlackBerry (last updated 1.7)
463
+ *
464
+ * @return boolean True if the browser is the BlackBerry browser otherwise false
465
+ */
466
+ function checkBrowserBlackBerry() {
467
+ if ( stripos( $this->_agent, 'blackberry' ) !== false ) {
468
+ $aresult = explode( "/", stristr( $this->_agent, "BlackBerry" ) );
469
+ $aversion = explode( ' ', $aresult[1] );
470
+ $this->setVersion( $aversion[0] );
471
+ $this->_browser_name = $this->BROWSER_BLACKBERRY;
472
+ $this->setMobile( true );
473
+ return true;
474
+ }
475
+ return false;
476
+ }
477
+
478
+ /**
479
+ * Determine if the user is using an AOL User Agent (last updated 1.7)
480
+ *
481
+ * @return boolean True if the browser is from AOL otherwise false
482
+ */
483
+ function checkForAol() {
484
+ $this->setAol( false );
485
+ $this->setAolVersion( $this->VERSION_UNKNOWN );
486
+
487
+ if ( stripos( $this->_agent, 'aol' ) !== false ) {
488
+ $aversion = explode( ' ', stristr( $this->_agent, 'AOL' ) );
489
+ $this->setAol( true );
490
+ $this->setAolVersion( preg_replace( '/[^0-9\.a-z]/i', '', $aversion[1] ) );
491
+ return true;
492
+ }
493
+ return false;
494
+ }
495
+
496
+ /**
497
+ * Determine if the browser is the GoogleBot or not (last updated 1.7)
498
+ *
499
+ * @return boolean True if the browser is the GoogletBot otherwise false
500
+ */
501
+ function checkBrowserGoogleBot() {
502
+ if ( stripos( $this->_agent, 'googlebot' ) !== false ) {
503
+ $aresult = explode( '/', stristr( $this->_agent, 'googlebot' ) );
504
+ $aversion = explode( ' ', $aresult[1] );
505
+ $this->setVersion( str_replace( ';', '', $aversion[0] ) );
506
+ $this->_browser_name = $this->BROWSER_GOOGLEBOT;
507
+ $this->setRobot( true );
508
+ return true;
509
+ }
510
+ return false;
511
+ }
512
+
513
+ /**
514
+ * Determine if the browser is the MSNBot or not (last updated 1.9)
515
+ *
516
+ * @return boolean True if the browser is the MSNBot otherwise false
517
+ */
518
+ function checkBrowserMSNBot() {
519
+ if ( stripos( $this->_agent, "msnbot" ) !== false ) {
520
+ $aresult = explode( "/", stristr( $this->_agent, "msnbot" ) );
521
+ $aversion = explode( " ", $aresult[1] );
522
+ $this->setVersion( str_replace( ";", "", $aversion[0] ) );
523
+ $this->_browser_name = $this->BROWSER_MSNBOT;
524
+ $this->setRobot( true );
525
+ return true;
526
+ }
527
+ return false;
528
+ }
529
+
530
+ /**
531
+ * Determine if the browser is the W3C Validator or not (last updated 1.7)
532
+ *
533
+ * @return boolean True if the browser is the W3C Validator otherwise false
534
+ */
535
+ function checkBrowserW3CValidator() {
536
+ if ( stripos( $this->_agent, 'W3C-checklink' ) !== false ) {
537
+ $aresult = explode( '/', stristr( $this->_agent, 'W3C-checklink' ) );
538
+ $aversion = explode( ' ', $aresult[1] );
539
+ $this->setVersion( $aversion[0] );
540
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
541
+ return true;
542
+ } else if ( stripos( $this->_agent, 'W3C_Validator' ) !== false ) {
543
+ // Some of the Validator versions do not delineate w/ a slash - add it back in
544
+ $ua = str_replace( "W3C_Validator ", "W3C_Validator/", $this->_agent );
545
+ $aresult = explode( '/', stristr( $ua, 'W3C_Validator' ) );
546
+ $aversion = explode( ' ', $aresult[1] );
547
+ $this->setVersion( $aversion[0] );
548
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
549
+ return true;
550
+ }
551
+ return false;
552
+ }
553
+
554
+ /**
555
+ * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
556
+ *
557
+ * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
558
+ */
559
+ function checkBrowserSlurp() {
560
+ if ( stripos( $this->_agent, 'slurp' ) !== false ) {
561
+ $aresult = explode( '/', stristr( $this->_agent, 'Slurp' ) );
562
+ $aversion = explode( ' ', $aresult[1] );
563
+ $this->setVersion( $aversion[0] );
564
+ $this->_browser_name = $this->BROWSER_SLURP;
565
+ $this->setRobot( true );
566
+ $this->setMobile( false );
567
+ return true;
568
+ }
569
+ return false;
570
+ }
571
+
572
+ /**
573
+ * Determine if the browser is Internet Explorer or not (last updated 1.7)
574
+ *
575
+ * @return boolean True if the browser is Internet Explorer otherwise false
576
+ */
577
+ function checkBrowserInternetExplorer() {
578
+
579
+ // Test for v1 - v1.5 IE
580
+ if ( stripos( $this->_agent, 'microsoft internet explorer' ) !== false ) {
581
+ $this->setBrowser( $this->BROWSER_IE );
582
+ $this->setVersion( '1.0' );
583
+ $aresult = stristr( $this->_agent, '/' );
584
+ if ( preg_match( '/308|425|426|474|0b1/i', $aresult ) ) {
585
+ $this->setVersion( '1.5' );
586
+ }
587
+ return true;
588
+ }
589
+ // Test for versions > 1.5
590
+ else if ( stripos( $this->_agent, 'msie' ) !== false && stripos( $this->_agent, 'opera' ) === false ) {
591
+ // See if the browser is the odd MSN Explorer
592
+ if ( stripos( $this->_agent, 'msnb' ) !== false ) {
593
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'MSN' ) );
594
+ $this->setBrowser( $this->BROWSER_MSN );
595
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
596
+ return true;
597
+ }
598
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'msie' ) );
599
+ $this->setBrowser( $this->BROWSER_IE );
600
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
601
+ return true;
602
+ }
603
+ // Test for Pocket IE
604
+ else if ( stripos( $this->_agent, 'mspie' ) !== false || stripos( $this->_agent, 'pocket' ) !== false ) {
605
+ $aresult = explode( ' ', stristr( $this->_agent, 'mspie' ) );
606
+ $this->setPlatform( $this->PLATFORM_WINDOWS_CE );
607
+ $this->setBrowser( $this->BROWSER_POCKET_IE );
608
+ $this->setMobile( true );
609
+
610
+ if ( stripos( $this->_agent, 'mspie' ) !== false ) {
611
+ $this->setVersion( $aresult[1] );
612
+ } else {
613
+ $aversion = explode( '/', $this->_agent );
614
+ $this->setVersion( $aversion[1] );
615
+ }
616
+ return true;
617
+ }
618
+ return false;
619
+ }
620
+
621
+ /**
622
+ * Determine if the browser is Opera or not (last updated 1.7)
623
+ *
624
+ * @return boolean True if the browser is Opera otherwise false
625
+ */
626
+ function checkBrowserOpera() {
627
+ if ( stripos( $this->_agent, 'opera mini' ) !== false ) {
628
+ $resultant = stristr( $this->_agent, 'opera mini' );
629
+ if ( preg_match( '/\//', $resultant ) ) {
630
+ $aresult = explode( '/', $resultant );
631
+ $aversion = explode( ' ', $aresult[1] );
632
+ $this->setVersion( $aversion[0] );
633
+ } else {
634
+ $aversion = explode( ' ', stristr( $resultant, 'opera mini' ) );
635
+ $this->setVersion( $aversion[1] );
636
+ }
637
+ $this->_browser_name = $this->BROWSER_OPERA_MINI;
638
+ $this->setMobile( true );
639
+ return true;
640
+ } else if ( stripos( $this->_agent, 'opera' ) !== false ) {
641
+ $resultant = stristr( $this->_agent, 'opera' );
642
+ if ( preg_match( '/Version\/(10.*)#x2F;', $resultant, $matches ) ) {
643
+ $this->setVersion( $matches[1] );
644
+ } else if ( preg_match( '/\//', $resultant ) ) {
645
+ $aresult = explode( '/', str_replace( "(", " ", $resultant ) );
646
+ $aversion = explode( ' ', $aresult[1] );
647
+ $this->setVersion( $aversion[0] );
648
+ } else {
649
+ $aversion = explode( ' ', stristr( $resultant, 'opera' ) );
650
+ $this->setVersion( isset( $aversion[1] )?$aversion[1]:"" );
651
+ }
652
+ $this->_browser_name = $this->BROWSER_OPERA;
653
+ return true;
654
+ }
655
+ return false;
656
+ }
657
+
658
+ /**
659
+ * Determine if the browser is Chrome or not (last updated 1.7)
660
+ *
661
+ * @return boolean True if the browser is Chrome otherwise false
662
+ */
663
+ function checkBrowserChrome() {
664
+ if ( stripos( $this->_agent, 'Chrome' ) !== false ) {
665
+ $aresult = explode( '/', stristr( $this->_agent, 'Chrome' ) );
666
+ $aversion = explode( ' ', $aresult[1] );
667
+ $this->setVersion( $aversion[0] );
668
+ $this->setBrowser( $this->BROWSER_CHROME );
669
+ return true;
670
+ }
671
+ return false;
672
+ }
673
+
674
+
675
+ /**
676
+ * Determine if the browser is WebTv or not (last updated 1.7)
677
+ *
678
+ * @return boolean True if the browser is WebTv otherwise false
679
+ */
680
+ function checkBrowserWebTv() {
681
+ if ( stripos( $this->_agent, 'webtv' ) !== false ) {
682
+ $aresult = explode( '/', stristr( $this->_agent, 'webtv' ) );
683
+ $aversion = explode( ' ', $aresult[1] );
684
+ $this->setVersion( $aversion[0] );
685
+ $this->setBrowser( $this->BROWSER_WEBTV );
686
+ return true;
687
+ }
688
+ return false;
689
+ }
690
+
691
+ /**
692
+ * Determine if the browser is NetPositive or not (last updated 1.7)
693
+ *
694
+ * @return boolean True if the browser is NetPositive otherwise false
695
+ */
696
+ function checkBrowserNetPositive() {
697
+ if ( stripos( $this->_agent, 'NetPositive' ) !== false ) {
698
+ $aresult = explode( '/', stristr( $this->_agent, 'NetPositive' ) );
699
+ $aversion = explode( ' ', $aresult[1] );
700
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aversion[0] ) );
701
+ $this->setBrowser( $this->BROWSER_NETPOSITIVE );
702
+ return true;
703
+ }
704
+ return false;
705
+ }
706
+
707
+ /**
708
+ * Determine if the browser is Galeon or not (last updated 1.7)
709
+ *
710
+ * @return boolean True if the browser is Galeon otherwise false
711
+ */
712
+ function checkBrowserGaleon() {
713
+ if ( stripos( $this->_agent, 'galeon' ) !== false ) {
714
+ $aresult = explode( ' ', stristr( $this->_agent, 'galeon' ) );
715
+ $aversion = explode( '/', $aresult[0] );
716
+ $this->setVersion( $aversion[1] );
717
+ $this->setBrowser( $this->BROWSER_GALEON );
718
+ return true;
719
+ }
720
+ return false;
721
+ }
722
+
723
+ /**
724
+ * Determine if the browser is Konqueror or not (last updated 1.7)
725
+ *
726
+ * @return boolean True if the browser is Konqueror otherwise false
727
+ */
728
+ function checkBrowserKonqueror() {
729
+ if ( stripos( $this->_agent, 'Konqueror' ) !== false ) {
730
+ $aresult = explode( ' ', stristr( $this->_agent, 'Konqueror' ) );
731
+ $aversion = explode( '/', $aresult[0] );
732
+ $this->setVersion( $aversion[1] );
733
+ $this->setBrowser( $this->BROWSER_KONQUEROR );
734
+ return true;
735
+ }
736
+ return false;
737
+ }
738
+
739
+ /**
740
+ * Determine if the browser is iCab or not (last updated 1.7)
741
+ *
742
+ * @return boolean True if the browser is iCab otherwise false
743
+ */
744
+ function checkBrowserIcab() {
745
+ if ( stripos( $this->_agent, 'icab' ) !== false ) {
746
+ $aversion = explode( ' ', stristr( str_replace( '/', ' ', $this->_agent ), 'icab' ) );
747
+ $this->setVersion( $aversion[1] );
748
+ $this->setBrowser( $this->BROWSER_ICAB );
749
+ return true;
750
+ }
751
+ return false;
752
+ }
753
+
754
+ /**
755
+ * Determine if the browser is OmniWeb or not (last updated 1.7)
756
+ *
757
+ * @return boolean True if the browser is OmniWeb otherwise false
758
+ */
759
+ function checkBrowserOmniWeb() {
760
+ if ( stripos( $this->_agent, 'omniweb' ) !== false ) {
761
+ $aresult = explode( '/', stristr( $this->_agent, 'omniweb' ) );
762
+ $aversion = explode( ' ', isset( $aresult[1] )?$aresult[1]:"" );
763
+ $this->setVersion( $aversion[0] );
764
+ $this->setBrowser( $this->BROWSER_OMNIWEB );
765
+ return true;
766
+ }
767
+ return false;
768
+ }
769
+
770
+ /**
771
+ * Determine if the browser is Phoenix or not (last updated 1.7)
772
+ *
773
+ * @return boolean True if the browser is Phoenix otherwise false
774
+ */
775
+ function checkBrowserPhoenix() {
776
+ if ( stripos( $this->_agent, 'Phoenix' ) !== false ) {
777
+ $aversion = explode( '/', stristr( $this->_agent, 'Phoenix' ) );
778
+ $this->setVersion( $aversion[1] );
779
+ $this->setBrowser( $this->BROWSER_PHOENIX );
780
+ return true;
781
+ }
782
+ return false;
783
+ }
784
+
785
+ /**
786
+ * Determine if the browser is Firebird or not (last updated 1.7)
787
+ *
788
+ * @return boolean True if the browser is Firebird otherwise false
789
+ */
790
+ function checkBrowserFirebird() {
791
+ if ( stripos( $this->_agent, 'Firebird' ) !== false ) {
792
+ $aversion = explode( '/', stristr( $this->_agent, 'Firebird' ) );
793
+ $this->setVersion( $aversion[1] );
794
+ $this->setBrowser( $this->BROWSER_FIREBIRD );
795
+ return true;
796
+ }
797
+ return false;
798
+ }
799
+
800
+ /**
801
+ * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
802
+ * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
803
+ *
804
+ * @return boolean True if the browser is Netscape Navigator 9+ otherwise false
805
+ */
806
+ function checkBrowserNetscapeNavigator9Plus() {
807
+ if ( stripos( $this->_agent, 'Firefox' ) !== false && preg_match( '/Navigator\/([^ ]*)/i', $this->_agent, $matches ) ) {
808
+ $this->setVersion( $matches[1] );
809
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
810
+ return true;
811
+ } else if ( stripos( $this->_agent, 'Firefox' ) === false && preg_match( '/Netscape6?\/([^ ]*)/i', $this->_agent, $matches ) ) {
812
+ $this->setVersion( $matches[1] );
813
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
814
+ return true;
815
+ }
816
+ return false;
817
+ }
818
+
819
+ /**
820
+ * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
821
+ *
822
+ * @return boolean True if the browser is Shiretoko otherwise false
823
+ */
824
+ function checkBrowserShiretoko() {
825
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/Shiretoko\/([^ ]*)/i', $this->_agent, $matches ) ) {
826
+ $this->setVersion( $matches[1] );
827
+ $this->setBrowser( $this->BROWSER_SHIRETOKO );
828
+ return true;
829
+ }
830
+ return false;
831
+ }
832
+
833
+ /**
834
+ * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
835
+ *
836
+ * @return boolean True if the browser is Ice Cat otherwise false
837
+ */
838
+ function checkBrowserIceCat() {
839
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/IceCat\/([^ ]*)/i', $this->_agent, $matches ) ) {
840
+ $this->setVersion( $matches[1] );
841
+ $this->setBrowser( $this->BROWSER_ICECAT );
842
+ return true;
843
+ }
844
+ return false;
845
+ }
846
+
847
+ /**
848
+ * Determine if the browser is Nokia or not (last updated 1.7)
849
+ *
850
+ * @return boolean True if the browser is Nokia otherwise false
851
+ */
852
+ function checkBrowserNokia() {
853
+ if ( preg_match( "/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches ) ) {
854
+ $this->setVersion( $matches[2] );
855
+ if ( stripos( $this->_agent, 'Series60' ) !== false || strpos( $this->_agent, 'S60' ) !== false ) {
856
+ $this->setBrowser( $this->BROWSER_NOKIA_S60 );
857
+ } else {
858
+ $this->setBrowser( $this->BROWSER_NOKIA );
859
+ }
860
+ $this->setMobile( true );
861
+ return true;
862
+ }
863
+ return false;
864
+ }
865
+
866
+ /**
867
+ * Determine if the browser is Firefox or not (last updated 1.7)
868
+ *
869
+ * @return boolean True if the browser is Firefox otherwise false
870
+ */
871
+ function checkBrowserFirefox() {
872
+ if ( stripos( $this->_agent, 'safari' ) === false ) {
873
+ if ( preg_match( "/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches ) ) {
874
+ $this->setVersion( $matches[1] );
875
+ $this->setBrowser( $this->BROWSER_FIREFOX );
876
+ return true;
877
+ } else if ( preg_match( "/Firefox#x2F;i", $this->_agent, $matches ) ) {
878
+ $this->setVersion( "" );
879
+ $this->setBrowser( $this->BROWSER_FIREFOX );
880
+ return true;
881
+ }
882
+ }
883
+ return false;
884
+ }
885
+
886
+ /**
887
+ * Determine if the browser is Firefox or not (last updated 1.7)
888
+ *
889
+ * @return boolean True if the browser is Firefox otherwise false
890
+ */
891
+ function checkBrowserIceweasel() {
892
+ if ( stripos( $this->_agent, 'Iceweasel' ) !== false ) {
893
+ $aresult = explode( '/', stristr( $this->_agent, 'Iceweasel' ) );
894
+ $aversion = explode( ' ', $aresult[1] );
895
+ $this->setVersion( $aversion[0] );
896
+ $this->setBrowser( $this->BROWSER_ICEWEASEL );
897
+ return true;
898
+ }
899
+ return false;
900
+ }
901
+ /**
902
+ * Determine if the browser is Mozilla or not (last updated 1.7)
903
+ *
904
+ * @return boolean True if the browser is Mozilla otherwise false
905
+ */
906
+ function checkBrowserMozilla() {
907
+ if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
908
+ $aversion = explode( ' ', stristr( $this->_agent, 'rv:' ) );
909
+ preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion );
910
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
911
+ $this->setBrowser( $this->BROWSER_MOZILLA );
912
+ return true;
913
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9]\.[0-9]/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
914
+ $aversion = explode( '', stristr( $this->_agent, 'rv:' ) );
915
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
916
+ $this->setBrowser( $this->BROWSER_MOZILLA );
917
+ return true;
918
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/mozilla\/([^ ]*)/i', $this->_agent, $matches ) && stripos( $this->_agent, 'netscape' ) === false ) {
919
+ $this->setVersion( $matches[1] );
920
+ $this->setBrowser( $this->BROWSER_MOZILLA );
921
+ return true;
922
+ }
923
+ return false;
924
+ }
925
+
926
+ /**
927
+ * Determine if the browser is Lynx or not (last updated 1.7)
928
+ *
929
+ * @return boolean True if the browser is Lynx otherwise false
930
+ */
931
+ function checkBrowserLynx() {
932
+ if ( stripos( $this->_agent, 'lynx' ) !== false ) {
933
+ $aresult = explode( '/', stristr( $this->_agent, 'Lynx' ) );
934
+ $aversion = explode( ' ', ( isset( $aresult[1] )?$aresult[1]:"" ) );
935
+ $this->setVersion( $aversion[0] );
936
+ $this->setBrowser( $this->BROWSER_LYNX );
937
+ return true;
938
+ }
939
+ return false;
940
+ }
941
+
942
+ /**
943
+ * Determine if the browser is Amaya or not (last updated 1.7)
944
+ *
945
+ * @return boolean True if the browser is Amaya otherwise false
946
+ */
947
+ function checkBrowserAmaya() {
948
+ if ( stripos( $this->_agent, 'amaya' ) !== false ) {
949
+ $aresult = explode( '/', stristr( $this->_agent, 'Amaya' ) );
950
+ $aversion = explode( ' ', $aresult[1] );
951
+ $this->setVersion( $aversion[0] );
952
+ $this->setBrowser( $this->BROWSER_AMAYA );
953
+ return true;
954
+ }
955
+ return false;
956
+ }
957
+
958
+ /**
959
+ * Determine if the browser is Safari or not (last updated 1.7)
960
+ *
961
+ * @return boolean True if the browser is Safari otherwise false
962
+ */
963
+ function checkBrowserSafari() {
964
+ if ( stripos( $this->_agent, 'Safari' ) !== false && stripos( $this->_agent, 'iPhone' ) === false && stripos( $this->_agent, 'iPod' ) === false ) {
965
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
966
+ if ( isset( $aresult[1] ) ) {
967
+ $aversion = explode( ' ', $aresult[1] );
968
+ $this->setVersion( $aversion[0] );
969
+ } else {
970
+ $this->setVersion( $this->VERSION_UNKNOWN );
971
+ }
972
+ $this->setBrowser( $this->BROWSER_SAFARI );
973
+ return true;
974
+ }
975
+ return false;
976
+ }
977
+
978
+ /**
979
+ * Determine if the browser is iPhone or not (last updated 1.7)
980
+ *
981
+ * @return boolean True if the browser is iPhone otherwise false
982
+ */
983
+ function checkBrowseriPhone() {
984
+ if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
985
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
986
+ if ( isset( $aresult[1] ) ) {
987
+ $aversion = explode( ' ', $aresult[1] );
988
+ $this->setVersion( $aversion[0] );
989
+ } else {
990
+ $this->setVersion( $this->VERSION_UNKNOWN );
991
+ }
992
+ $this->setMobile( true );
993
+ $this->setBrowser( $this->BROWSER_IPHONE );
994
+ return true;
995
+ }
996
+ return false;
997
+ }
998
+
999
+ /**
1000
+ * Determine if the browser is iPod or not (last updated 1.7)
1001
+ *
1002
+ * @return boolean True if the browser is iPod otherwise false
1003
+ */
1004
+ function checkBrowseriPad() {
1005
+ if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1006
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1007
+ if ( isset( $aresult[1] ) ) {
1008
+ $aversion = explode( ' ', $aresult[1] );
1009
+ $this->setVersion( $aversion[0] );
1010
+ } else {
1011
+ $this->setVersion( $this->VERSION_UNKNOWN );
1012
+ }
1013
+ $this->setMobile( true );
1014
+ $this->setBrowser( $this->BROWSER_IPAD );
1015
+ return true;
1016
+ }
1017
+ return false;
1018
+ }
1019
+
1020
+ /**
1021
+ * Determine if the browser is iPod or not (last updated 1.7)
1022
+ *
1023
+ * @return boolean True if the browser is iPod otherwise false
1024
+ */
1025
+ function checkBrowseriPod() {
1026
+ if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1027
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1028
+ if ( isset( $aresult[1] ) ) {
1029
+ $aversion = explode( ' ', $aresult[1] );
1030
+ $this->setVersion( $aversion[0] );
1031
+ } else {
1032
+ $this->setVersion( $this->VERSION_UNKNOWN );
1033
+ }
1034
+ $this->setMobile( true );
1035
+ $this->setBrowser( $this->BROWSER_IPOD );
1036
+ return true;
1037
+ }
1038
+ return false;
1039
+ }
1040
+
1041
+ /**
1042
+ * Determine if the browser is Android or not (last updated 1.7)
1043
+ *
1044
+ * @return boolean True if the browser is Android otherwise false
1045
+ */
1046
+ function checkBrowserAndroid() {
1047
+ if ( stripos( $this->_agent, 'Android' ) !== false ) {
1048
+ $aresult = explode( ' ', stristr( $this->_agent, 'Android' ) );
1049
+ if ( isset( $aresult[1] ) ) {
1050
+ $aversion = explode( ' ', $aresult[1] );
1051
+ $this->setVersion( $aversion[0] );
1052
+ } else {
1053
+ $this->setVersion( $this->VERSION_UNKNOWN );
1054
+ }
1055
+ $this->setMobile( true );
1056
+ $this->setBrowser( $this->BROWSER_ANDROID );
1057
+ return true;
1058
+ }
1059
+ return false;
1060
+ }
1061
+
1062
+ /**
1063
+ * Determine the user's platform (last updated 1.7)
1064
+ */
1065
+ function checkPlatform() {
1066
+ if ( stripos( $this->_agent, 'windows' ) !== false ) {
1067
+ $this->_platform = $this->PLATFORM_WINDOWS;
1068
+ } else if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1069
+ $this->_platform = $this->PLATFORM_IPAD;
1070
+ } else if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1071
+ $this->_platform = $this->PLATFORM_IPOD;
1072
+ } else if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
1073
+ $this->_platform = $this->PLATFORM_IPHONE;
1074
+ } elseif ( stripos( $this->_agent, 'mac' ) !== false ) {
1075
+ $this->_platform = $this->PLATFORM_APPLE;
1076
+ } elseif ( stripos( $this->_agent, 'android' ) !== false ) {
1077
+ $this->_platform = $this->PLATFORM_ANDROID;
1078
+ } elseif ( stripos( $this->_agent, 'linux' ) !== false ) {
1079
+ $this->_platform = $this->PLATFORM_LINUX;
1080
+ } else if ( stripos( $this->_agent, 'Nokia' ) !== false ) {
1081
+ $this->_platform = $this->PLATFORM_NOKIA;
1082
+ } else if ( stripos( $this->_agent, 'BlackBerry' ) !== false ) {
1083
+ $this->_platform = $this->PLATFORM_BLACKBERRY;
1084
+ } elseif ( stripos( $this->_agent, 'FreeBSD' ) !== false ) {
1085
+ $this->_platform = $this->PLATFORM_FREEBSD;
1086
+ } elseif ( stripos( $this->_agent, 'OpenBSD' ) !== false ) {
1087
+ $this->_platform = $this->PLATFORM_OPENBSD;
1088
+ } elseif ( stripos( $this->_agent, 'NetBSD' ) !== false ) {
1089
+ $this->_platform = $this->PLATFORM_NETBSD;
1090
+ } elseif ( stripos( $this->_agent, 'OpenSolaris' ) !== false ) {
1091
+ $this->_platform = $this->PLATFORM_OPENSOLARIS;
1092
+ } elseif ( stripos( $this->_agent, 'SunOS' ) !== false ) {
1093
+ $this->_platform = $this->PLATFORM_SUNOS;
1094
+ } elseif ( stripos( $this->_agent, 'OS\/2' ) !== false ) {
1095
+ $this->_platform = $this->PLATFORM_OS2;
1096
+ } elseif ( stripos( $this->_agent, 'BeOS' ) !== false ) {
1097
+ $this->_platform = $this->PLATFORM_BEOS;
1098
+ } elseif ( stripos( $this->_agent, 'win' ) !== false ) {
1099
+ $this->_platform = $this->PLATFORM_WINDOWS;
1100
+ }
1101
+
1102
+ }
1103
+ }
core/lib/upload/um-file-upload.php CHANGED
@@ -21,10 +21,14 @@ $timestamp = $_POST['timestamp'];
21
$ultimatemember->fields->set_id = $_POST['set_id'];
22
$ultimatemember->fields->set_mode = $_POST['set_mode'];
23
24
- if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
25
- // This nonce is not valid.
26
- $ret['error'] = 'Invalid nonce';
27
- die( json_encode( $ret ) );
28
}
29
30
21
$ultimatemember->fields->set_id = $_POST['set_id'];
22
$ultimatemember->fields->set_mode = $_POST['set_mode'];
23
24
+ $um_file_upload_nonce = apply_filters("um_file_upload_nonce", true );
25
+
26
+ if( $um_file_upload_nonce ){
27
+ if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in()) {
28
+ // This nonce is not valid.
29
+ $ret['error'] = 'Invalid nonce';
30
+ die( json_encode( $ret ) );
31
+ }
32
}
33
34
core/lib/upload/um-image-upload.php CHANGED
@@ -20,10 +20,14 @@ $nonce = $_POST['_wpnonce'];
20
$ultimatemember->fields->set_id = $_POST['set_id'];
21
$ultimatemember->fields->set_mode = $_POST['set_mode'];
22
23
- if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
24
- // This nonce is not valid.
25
- $ret['error'] = 'Invalid nonce';
26
- die( json_encode( $ret ) );
27
}
28
29
if(isset($_FILES[$id]['name'])) {
20
$ultimatemember->fields->set_id = $_POST['set_id'];
21
$ultimatemember->fields->set_mode = $_POST['set_mode'];
22
23
+ $um_image_upload_nonce = apply_filters("um_image_upload_nonce", true );
24
+
25
+ if( $um_image_upload_nonce ){
26
+ if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
27
+ // This nonce is not valid.
28
+ $ret['error'] = 'Invalid nonce';
29
+ die( json_encode( $ret ) );
30
+ }
31
}
32
33
if(isset($_FILES[$id]['name'])) {
core/um-access.php CHANGED
@@ -11,13 +11,16 @@ class UM_Access {
11
12
}
13
14
- /***
15
- *** @do actions based on priority
16
- ***/
17
function template_redirect() {
18
global $post, $ultimatemember;
19
20
do_action('um_access_global_settings');
21
22
do_action('um_access_frontpage_per_role');
23
@@ -42,9 +45,12 @@ class UM_Access {
42
43
}
44
45
- /***
46
- *** @get meta
47
- ***/
48
function get_meta( $post_id ) {
49
global $post;
50
$meta = get_post_custom( $post_id );
@@ -62,4 +68,18 @@ class UM_Access {
62
return array('');
63
}
64
65
}
11
12
}
13
14
+
15
+ /**
16
+ * Set custom access actions and redirection
17
+ */
18
function template_redirect() {
19
global $post, $ultimatemember;
20
21
do_action('um_access_global_settings');
22
+
23
+ do_action('um_access_user_custom_homepage');
24
25
do_action('um_access_frontpage_per_role');
26
45
46
}
47
48
+
49
+ /**
50
+ * Get custom access settings meta
51
+ * @param integer $post_id
52
+ * @return array
53
+ */
54
function get_meta( $post_id ) {
55
global $post;
56
$meta = get_post_custom( $post_id );
68
return array('');
69
}
70
71
+ /**
72
+ * Sets a custom access referer in a redirect URL
73
+ * @param string $url
74
+ * @param string $referer
75
+ */
76
+ function set_referer( $url, $referer ){
77
+
78
+ $enable_referer = apply_filters("um_access_enable_referer", false );
79
+ if( ! $enable_referer ) return $url;
80
+
81