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, "\\$&");
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;