Social Login - Version 7.2.0

Version Description

Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Social Login
Version 7.2.0
Comparing to
See all releases

Code changes from version 7.1.6 to 7.2.0

class-mo-openid-login-widget.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
- include "twitter_oauth.php";
 
3
 
4
  /*
5
  * Login Widget
@@ -45,39 +46,39 @@ include "twitter_oauth.php";
45
  <?php
46
  }
47
 
48
- $selected_theme = get_option('mo_openid_login_theme');
49
- $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable') | get_option('mo_openid_yahoo_enable');
50
- $spacebetweenicons = get_option('mo_login_icon_space');
51
- $customWidth = get_option('mo_login_icon_custom_width');
52
- $customHeight = get_option('mo_login_icon_custom_height');
53
- $customSize = get_option('mo_login_icon_custom_size');
54
- $customBackground = get_option('mo_login_icon_custom_color');
55
- $customTheme = get_option('mo_openid_login_custom_theme');
56
- $customTextofTitle = get_option('mo_openid_login_button_customize_text');
57
- $customBoundary = get_option('mo_login_icon_custom_boundary');
58
- $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
59
- $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
60
- $customTextColor = get_option('mo_login_openid_login_widget_customize_textcolor');
61
- $customText = get_option('mo_openid_login_widget_customize_text');
62
-
63
- $facebook_custom_app = $this->if_custom_app_exists('facebook');
64
- $google_custom_app = $this->if_custom_app_exists('google');
65
- $twitter_custom_app = $this->if_custom_app_exists('twitter');
66
- $salesforce_custom_app = $this->if_custom_app_exists('salesforce');
67
- $linkedin_custom_app = $this->if_custom_app_exists('linkedin');
68
- $windowslive_custom_app = $this->if_custom_app_exists('windowslive');
69
- $vkontakte_custom_app = $this->if_custom_app_exists('vkontakte');
70
- $amazon_custom_app = $this->if_custom_app_exists('amazon');
71
- $instagram_custom_app = $this->if_custom_app_exists('instagram');
72
- $yahoo_custom_app = $this->if_custom_app_exists('yahoo');
73
 
74
  if (get_option('mo_openid_gdpr_consent_enable')) {
75
  $gdpr_setting = "disabled='disabled'";
76
  } else
77
  $gdpr_setting = '';
78
 
79
- $url = get_option('mo_openid_privacy_policy_url');
80
- $text = get_option('mo_openid_privacy_policy_text');
81
 
82
  if (!empty($text) && strpos(get_option('mo_openid_gdpr_consent_message'), $text)) {
83
  $consent_message = str_replace(get_option('mo_openid_privacy_policy_text'), '<a target="_blank" href="' . $url . '">' . $text . '</a>', get_option('mo_openid_gdpr_consent_message'));
@@ -97,7 +98,6 @@ include "twitter_oauth.php";
97
  </p>
98
  <?php if (get_option('mo_openid_gdpr_consent_enable')) {
99
  $consent_message = isset($consent_message) ? $consent_message : ''; ?>
100
- <!-- space -->
101
  <label class="mo-consent" style="padding-right: 10px;"><input type="checkbox"
102
  onchange="mo_openid_on_consent_change(this,value)"
103
  value="1"
@@ -653,7 +653,7 @@ include "twitter_oauth.php";
653
 
654
  public function if_custom_app_exists($app_name){
655
  if(get_option('mo_openid_apps_list'))
656
- $appslist = get_option('mo_openid_apps_list');
657
  else
658
  $appslist = array();
659
 
@@ -671,35 +671,33 @@ include "twitter_oauth.php";
671
  if (mo_openid_is_customer_registered()) {
672
  global $post;
673
  $html = '';
674
- //$this->error_message();
675
- $selected_theme = isset($atts['shape']) ? $atts['shape'] : get_option('mo_openid_login_theme');
676
- $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable') | get_option('mo_openid_yahoo_enable');
677
- $spacebetweenicons = isset($atts['space']) ? $atts['space'] : get_option('mo_login_icon_space');
678
- $customWidth = isset($atts['width']) ? $atts['width'] : get_option('mo_login_icon_custom_width');
679
- $customHeight = isset($atts['height']) ? $atts['height'] : get_option('mo_login_icon_custom_height');
680
- $customSize = isset($atts['size']) ? $atts['size'] : get_option('mo_login_icon_custom_size');
681
- $customBackground = isset($atts['background']) ? $atts['background'] : get_option('mo_login_icon_custom_color');
682
- $customTheme = isset($atts['theme']) ? $atts['theme'] : get_option('mo_openid_login_custom_theme');
683
- $customText = get_option('mo_openid_login_widget_customize_text');
684
- $buttonText = get_option('mo_openid_login_button_customize_text');
685
- $customTextofTitle = get_option('mo_openid_login_button_customize_text');
686
- $logoutUrl = wp_logout_url(site_url());
687
- $customBoundary = isset($atts['edge']) ? $atts['edge'] : get_option('mo_login_icon_custom_boundary');
688
- $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text');
689
- $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text');
690
- $customTextColor = isset($atts['color']) ? $atts['color'] : get_option('mo_login_openid_login_widget_customize_textcolor');
691
- $customText = isset($atts['heading']) ? $atts['heading'] : get_option('mo_openid_login_widget_customize_text');
692
-
693
- $facebook_custom_app = $this->if_custom_app_exists('facebook');
694
- $google_custom_app = $this->if_custom_app_exists('google');
695
- $twitter_custom_app = $this->if_custom_app_exists('twitter');
696
- $salesforce_custom_app = $this->if_custom_app_exists('salesforce');
697
- $linkedin_custom_app = $this->if_custom_app_exists('linkedin');
698
- $windowslive_custom_app = $this->if_custom_app_exists('windowslive');
699
- $vkontakte_custom_app = $this->if_custom_app_exists('vkontakte');
700
- $amazon_custom_app = $this->if_custom_app_exists('amazon');
701
- $instagram_custom_app = $this->if_custom_app_exists('instagram');
702
- $yahoo_custom_app = $this->if_custom_app_exists('yahoo');
703
 
704
  if ($selected_theme == 'longbuttonwithtext') {
705
  $selected_theme = 'longbutton';
@@ -713,8 +711,8 @@ include "twitter_oauth.php";
713
  } else
714
  $gdpr_setting = '';
715
 
716
- $url = get_option('mo_openid_privacy_policy_url');
717
- $text = get_option('mo_openid_privacy_policy_text');
718
 
719
  if (!empty($text) && strpos(get_option('mo_openid_gdpr_consent_message'), $text)) {
720
  $consent_message = str_replace(get_option('mo_openid_privacy_policy_text'), '<a target="_blank" href="' . $url . '">' . $text . '</a>', get_option('mo_openid_gdpr_consent_message'));
@@ -964,7 +962,6 @@ include "twitter_oauth.php";
964
  jQuery('#mo_openid_consent_checkbox').val(0);
965
  jQuery(".btn-mo").attr("disabled",false);
966
  jQuery(".login-button").removeClass("dis");
967
- //jQuery(".btn-mo").removeAttr("disabled");
968
  }
969
  }
970
 
@@ -983,42 +980,43 @@ include "twitter_oauth.php";
983
  $http = "http://";
984
  }
985
  ?>
986
- var base_url = '<?php echo site_url();?>';
987
  var request_uri = '<?php echo $_SERVER['REQUEST_URI'];?>';
988
  var http = '<?php echo $http;?>';
989
  var http_host = '<?php echo $_SERVER['HTTP_HOST'];?>';
 
 
990
 
991
  if(is_custom_app == 'false'){
992
 
993
  if ( request_uri.indexOf('wp-login.php') !=-1){
994
- var redirect_url = base_url + '/?option=getmosociallogin&app_name=';
995
 
996
 
997
  }else {
998
  var redirect_url = http + http_host + request_uri;
999
  if(redirect_url.indexOf('?') != -1){
1000
- redirect_url = redirect_url +'&option=getmosociallogin&app_name=';
1001
 
1002
  }
1003
  else
1004
  {
1005
- redirect_url = redirect_url +'?option=getmosociallogin&app_name=';
1006
 
1007
  }
1008
  }
1009
-
1010
  }
1011
  else {
1012
 
1013
  if ( request_uri.indexOf('wp-login.php') !=-1){
1014
- var redirect_url = base_url + '/?option=oauthredirect&app_name=';
1015
 
1016
  }else {
1017
  var redirect_url = http + http_host + request_uri;
1018
  if(redirect_url.indexOf('?') != -1)
1019
- redirect_url = redirect_url +'&option=oauthredirect&app_name=';
1020
  else
1021
- redirect_url = redirect_url +'?option=oauthredirect&app_name=';
1022
  }
1023
 
1024
  }
@@ -1029,15 +1027,6 @@ include "twitter_oauth.php";
1029
  </script>
1030
  <?php
1031
  }
1032
-
1033
- /*public function error_message(){
1034
- if(isset($_SESSION['msg']) and $_SESSION['msg']){
1035
- echo '<div class="'.$_SESSION['msg_class'].'">'.$_SESSION['msg'].'</div>';
1036
- unset($_SESSION['msg']);
1037
- unset($_SESSION['msg_class']);
1038
- }
1039
- }*/
1040
-
1041
  }
1042
 
1043
  /**
@@ -1117,7 +1106,7 @@ include "twitter_oauth.php";
1117
  if ( ! empty( $wid_title ) )
1118
  echo $args['before_title'] . $wid_title . $args['after_title'];
1119
 
1120
- echo "<div class='mo_openid_vertical' style='" .(isset($alignment) && $alignment != '' && isset($instance[$alignment.'_offset']) ? $alignment .': '. ( $instance[$alignment.'_offset'] == '' ? 0 : $instance[$alignment.'_offset'] ) .'px;' : '').(isset($top_offset) ? 'top: '. ( $top_offset == '' ? 0 : $top_offset ) .'px;' : '') ."'>";
1121
 
1122
  $this->show_sharing_buttons_vertical($space_icons);
1123
 
@@ -1177,23 +1166,23 @@ include "twitter_oauth.php";
1177
  }
1178
  }
1179
  </script>
1180
- <label for="<?php echo $this->get_field_id( 'alignment' ); ?>">Alignment</label>
1181
- <select onchange="moOpenIDVerticalSharingOffset(this.value)" style="width: 95%" id="<?php echo $this->get_field_id( 'alignment' ); ?>" name="<?php echo $this->get_field_name( 'alignment' ); ?>">
1182
  <option value="left" <?php echo $instance['alignment'] == 'left' ? 'selected' : ''; ?>>Left</option>
1183
  <option value="right" <?php echo $instance['alignment'] == 'right' ? 'selected' : ''; ?>>Right</option>
1184
  </select>
1185
  <div class="moVerSharingLeftOffset" <?php echo $instance['alignment'] == 'right' ? 'style="display: none"' : ''; ?>>
1186
- <label for="<?php echo $this->get_field_id( 'left_offset' ); ?>">Left Offset</label>
1187
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'left_offset' ); ?>" name="<?php echo $this->get_field_name( 'left_offset' ); ?>" type="text" value="<?php echo $instance['left_offset']; ?>" />px<br/>
1188
  </div>
1189
  <div class="moVerSharingRightOffset" <?php echo $instance['alignment'] == 'left' ? 'style="display: none"' : ''; ?>>
1190
- <label for="<?php echo $this->get_field_id( 'right_offset' ); ?>">Right Offset</label>
1191
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'right_offset' ); ?>" name="<?php echo $this->get_field_name( 'right_offset' ); ?>" type="text" value="<?php echo $instance['right_offset']; ?>" />px<br/>
1192
  </div>
1193
- <label for="<?php echo $this->get_field_id( 'top_offset' ); ?>">Top Offset</label>
1194
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'top_offset' ); ?>" name="<?php echo $this->get_field_name( 'top_offset' ); ?>" type="text" value="<?php echo $instance['top_offset']; ?>" />px<br/>
1195
- <label for="<?php echo $this->get_field_id( 'space_icons' ); ?>">Space between icons</label>
1196
- <input style="width: 95%" id="<?php echo $this->get_field_id( 'space_icons' ); ?>" name="<?php echo $this->get_field_name( 'space_icons' ); ?>" type="text" value="<?php echo $instance['space_icons']; ?>" />px<br/>
1197
  </p>
1198
  <?php
1199
  }
@@ -1207,19 +1196,12 @@ include "twitter_oauth.php";
1207
  }
1208
 
1209
  function mo_openid_end_session() {
1210
-
1211
  session_start();
1212
  session_unset(); //unsets all session variables
1213
-
1214
- /*if( session_id() ) {
1215
- session_destroy();
1216
- }*/
1217
  }
1218
 
1219
  function encrypt_data($data, $key) {
1220
-
1221
  return base64_encode(openssl_encrypt($data, 'aes-128-ecb', $key, OPENSSL_RAW_DATA));
1222
-
1223
  }
1224
 
1225
  function decrypt_data($data, $key) {
@@ -1232,31 +1214,26 @@ include "twitter_oauth.php";
1232
 
1233
  if((isset($_POST['action'])) && (strpos($_POST['action'], 'delete_social_profile_data') !== false) && isset($_POST['user_id'])){
1234
  // delete first name, last name, user_url and profile_url from usermeta
1235
- global $wpdb;
1236
- $id = $_POST['user_id']; $metakey1 = 'first_name'; $metakey2 = 'last_name'; $metakey3 = 'moopenid_user_avatar'; $metakey4 = 'moopenid_user_profile_url';
1237
- $wpdb->query($wpdb->prepare('DELETE from '.$wpdb->prefix.'usermeta where user_id = %d and (meta_key = %s or meta_key = %s or meta_key = %s or meta_key = %s)',$id,$metakey1,$metakey2,$metakey3,$metakey4));
1238
- update_user_meta($id,'mo_openid_data_deleted','1');
1239
- exit;
1240
  }
1241
 
1242
  // ajax call - custom app over default app
1243
- elseif ((isset($_POST['selected_app'])) && (isset($_POST['selected_app_value']))){
1244
  if($_POST['selected_app_value'] == 'true'){
1245
  //if custome app enable
1246
- if($_POST['selected_app']=="facebook")
1247
- {
1248
  update_option('mo_openid_facebook_enable',1);
1249
  }
1250
- $option = 'mo_openid_enable_custom_app_' . $_POST['selected_app'];
1251
  update_option( $option, '1');
1252
  }
1253
  else{
1254
  //if custome app Disable
1255
- if($_POST['selected_app']=="facebook")
1256
- {
1257
  update_option('mo_openid_facebook_enable',0);
1258
  }
1259
- $option = 'mo_openid_enable_custom_app_' . $_POST['selected_app'];
1260
  update_option( $option, '0');
1261
  }
1262
  exit;
@@ -1267,661 +1244,120 @@ include "twitter_oauth.php";
1267
  exit;
1268
  }
1269
 
1270
- else if( isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_show_profile_form' ) !== false ){
1271
- echo mo_openid_profile_completion_form($_POST["last_name"],$_POST["first_name"], $_POST["user_full_name"],$_POST["user_url"], $_POST["user_picture"], $_POST['username_field'], $_POST['email_field'],$_POST["decrypted_app_name"],$_POST["decrypted_user_id"]);
1272
- exit;
1273
- }
1274
-
1275
- else if( isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_account_linking' ) !== false ){
1276
- mo_openid_start_session();
1277
- //link account
1278
- if(!isset($_POST['mo_openid_create_new_account'])){
1279
-
1280
- $url = site_url().'/wp-login.php?option=disable-social-login';
1281
- header('Location:'. $url);
1282
- exit;
1283
- }
1284
- //create new account
1285
- else {
1286
- mo_openid_start_session();
1287
-
1288
- $username = $_POST['username'];
1289
- $user_email = $_POST['user_email'];
1290
- $first_name = $_POST['first_name'];
1291
- $last_name = $_POST['last_name'];
1292
- $user_full_name = $_POST['user_full_name'];
1293
- $user_url = $_POST['user_url'];
1294
- $user_picture = $_POST['user_picture'];
1295
- $decrypted_app_name = $_POST['decrypted_app_name'];
1296
- $decrypted_user_id = $_POST['decrypted_user_id'];
1297
-
1298
-
1299
- if(get_option('mo_openid_auto_register_enable')) {
1300
-
1301
- $random_password = wp_generate_password( 10, false );
1302
- global $wpdb;
1303
- $db_prefix = $wpdb->prefix;
1304
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $username));
1305
-
1306
- if( !empty($username_user_id) ){
1307
- $email_explode = explode('@',$user_email );
1308
- $user_new_name = $email_explode[0];
1309
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $user_new_name));
1310
- $i = 1;
1311
- $uname='';
1312
- while(!empty($username_user_id) ){
1313
- $uname=$user_new_name .'_'.$i;
1314
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
1315
- $i++;
1316
- if(empty($username_user_id)){
1317
- $user_new_name=$uname;
1318
- }
1319
- }
1320
-
1321
- if( !empty($username_user_id) ){
1322
- wp_die("Error Code 1: ".get_option('mo_existing_username_error_message'));
1323
- }
1324
- $username = $user_new_name;
1325
- }
1326
-
1327
- $meta_user_url = $user_url;
1328
-
1329
- if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name =='facebook'){
1330
- $user_url = '';
1331
- }
1332
-
1333
- $userdata = array(
1334
- 'user_login' => $username,
1335
- 'user_email' => $user_email,
1336
- 'user_pass' => $random_password,
1337
- 'display_name' => $user_full_name,
1338
- 'first_name' => $first_name,
1339
- 'last_name' => $last_name,
1340
- 'user_url' => $user_url,
1341
- );
1342
-
1343
- $user_id = wp_insert_user( $userdata);
1344
-
1345
- if(is_wp_error( $user_id )) {
1346
- print_r($user_id);
1347
- wp_die("Error Code 1: ".get_option('mo_registration_error_message'));
1348
- }
1349
-
1350
- update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1351
-
1352
- $user = get_user_by('id', $user_id );
1353
-
1354
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1355
- update_user_meta($user_id, 'moopenid_user_avatar',$user_picture);
1356
- }
1357
-
1358
- mo_openid_start_session();
1359
-
1360
- $_SESSION['mo_login'] = true;
1361
- do_action( 'mo_user_register', $user_id,$meta_user_url);
1362
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1363
- do_action( 'wp_login', $user->user_login, $user );
1364
- wp_set_auth_cookie( $user_id, true );
1365
- }
1366
- //end of create account block
1367
-
1368
- $redirect_url = mo_openid_get_redirect_url();
1369
- wp_redirect($redirect_url);
1370
  exit;
1371
  }
1372
  }
1373
 
1374
- else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'getmosociallogin' ) !== false ) {
1375
- $client_name = "wordpress";
1376
- $timestamp = round( microtime(true) * 1000 );
1377
- $api_key = get_option('mo_openid_admin_api_key');
1378
- $token = $client_name . ':' . number_format($timestamp, 0, '', ''). ':' . $api_key;
1379
-
1380
- $customer_token = get_option('mo_openid_customer_token');
1381
- $encrypted_token = encrypt_data($token,$customer_token);
1382
- $encoded_token = urlencode( $encrypted_token );
1383
-
1384
- $userdata = get_option('moopenid_user_attributes')?'true':'false';
1385
-
1386
- $http = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
1387
-
1388
- $parts = parse_url($http . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
1389
- parse_str($parts['query'], $query);
1390
- $post = isset( $query['p'] ) ? '?p=' . $query['p'] : '';
1391
-
1392
- $base_return_url = $http . $_SERVER["HTTP_HOST"] . strtok($_SERVER["REQUEST_URI"],'?') . $post;
1393
-
1394
- $return_url = strpos($base_return_url, '?') !== false ? urlencode( $base_return_url . '&option=moopenid' ): urlencode( $base_return_url . '?option=moopenid' );
1395
-
1396
- $url = get_option('mo_openid_host_name') . '/moas/openid-connect/client-app/authenticate?token=' . $encoded_token . '&userdata=' . $userdata. '&id=' . get_option('mo_openid_admin_customer_key') . '&encrypted=true&app=' . $_REQUEST['app_name'] . '_oauth&returnurl=' . $return_url . '&encrypt_response=true';
1397
- wp_redirect($url);
1398
- exit;
1399
- }
1400
-
1401
- else if( isset( $_POST['username_field']) and isset($_POST['email_field']) and $_POST['option'] == 'mo_openid_profile_form_submitted' ){
1402
-
1403
- $username = $_POST['username_field'];
1404
- $user_email = $_POST['email_field'];
1405
- $user_picture = $_POST["user_picture"];
1406
- $user_url = $_POST["user_url"];
1407
- $last_name = $_POST["last_name"];
1408
- $user_full_name = $_POST["user_full_name"];
1409
- $first_name = $_POST["first_name"];
1410
- $decrypted_app_name = $_POST["decrypted_app_name"];
1411
- $decrypted_user_id = $_POST["decrypted_user_id"];
1412
-
1413
- if(!isset($_POST['otp_field'])) {
1414
- $user_email = sanitize_email($user_email);
1415
- $username = preg_replace('/[\x00-\x1F][\x7F][\x81][\x8D][\x8F][\x90][\x9D][\xA0][\xAD]/', '', $username);
1416
- //$username = strtolower(str_replace(" ","",$username));
1417
-
1418
- global $wpdb;
1419
- if(empty($user_email)){
1420
- $email_user_id = NULL;
1421
- }
1422
- else {
1423
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
1424
- }
1425
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1426
-
1427
- //if email exists, dont check if username is in db or not, send otp and get it over wordpress
1428
- if( isset($email_user_id)){
1429
-
1430
- $send_content = send_otp_token($user_email);
1431
- if($send_content['status']=='FAILURE'){
1432
- $message ="Error Code 1: ".get_option('mo_email_failure_message');
1433
- wp_die($message);
1434
- }
1435
-
1436
- $transaction_id = $send_content['tId'];
1437
- echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url,$last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
1438
  exit;
1439
-
1440
  }
1441
- //email doesnt exist, check if username is in db or not, acc show form and proceed further
1442
  else {
1443
-
1444
- if( isset($username_user_id) ){
1445
- echo mo_openid_username_already_exists($last_name, $first_name, $user_full_name, $user_url, $user_picture, $username, $user_email, $decrypted_app_name, $decrypted_user_id);
1446
- exit;
1447
- }
1448
- else {
1449
-
1450
- $send_content = send_otp_token($user_email);
1451
- if($send_content['status']=='FAILURE'){
1452
- $message ="Error Code 2: ".get_option('mo_email_failure_message');
1453
- wp_die($message);
1454
- }
1455
-
1456
- $transaction_id = $send_content['tId'];
1457
- echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
1458
- exit;
1459
- }
1460
-
1461
  }
1462
  }
1463
  }
1464
 
1465
- else if( isset( $_POST['otp_field']) and $_POST['option'] == 'mo_openid_otp_validation' ){
1466
-
1467
- $username = $_POST["username_field"];
1468
- $user_email = $_POST["email_field"];
1469
- $transaction_id = $_POST["transaction_id"];
1470
- $otp_token = $_POST['otp_field'];
1471
- $user_picture = $_POST["user_picture"];
1472
- $user_url = $_POST["user_url"];
1473
- $last_name = $_POST["last_name"];
1474
- $user_full_name = $_POST["user_full_name"];
1475
- $first_name = $_POST["first_name"];
1476
- $decrypted_app_name = $_POST["decrypted_app_name"];
1477
- $decrypted_user_id = $_POST["decrypted_user_id"];
1478
-
1479
- if(isset($_POST['resend_otp']))
1480
- {
1481
- $send_content = send_otp_token($user_email);
1482
- if($send_content['status']=='FAILURE'){
1483
- $message ="Error Code 3: ".get_option('mo_email_failure_message');
1484
- wp_die($message);
1485
- }
1486
-
1487
- $transaction_id = $send_content['tId'];
1488
- echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
1489
-
1490
- exit;
1491
- }
1492
-
1493
- $validate_content = validate_otp_token($transaction_id, $otp_token);
1494
- $status = $validate_content['status'];
1495
-
1496
- //if invalid OTP
1497
- if($status == 'FAILURE'){
1498
- $message = 'You have entered an invalid verification code. Enter a valid code.';
1499
- echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id,$message);
1500
- exit;
1501
-
1502
- }
1503
- //if OTP is Valid
1504
- else{
1505
- global $wpdb;
1506
- $db_prefix = $wpdb->prefix;
1507
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = %s",$user_email));
1508
- if(empty($user_email)){
1509
- $existing_email_user_id = NULL;
1510
- }
1511
- else {
1512
- $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
1513
- }
1514
-
1515
- // if linked user exists log him in
1516
- mo_openid_start_session();
1517
- if(isset($email_user_id) || isset($existing_email_user_id) )
1518
- {
1519
- $email_user_id = isset($email_user_id)? $email_user_id:$existing_email_user_id;
1520
-
1521
- mo_openid_start_session();
1522
- $_SESSION['username'] = $username;
1523
- $_SESSION['user_email'] = $user_email;
1524
- $_SESSION['user_full_name'] = $user_full_name;
1525
- $_SESSION['first_name'] = $first_name;
1526
- $_SESSION['last_name'] = $last_name;
1527
- $_SESSION['user_url'] = $user_url;
1528
- $_SESSION['user_picture'] = $user_picture;
1529
- $_SESSION['social_app_name'] = $decrypted_app_name;
1530
- $_SESSION['social_user_id'] = $decrypted_user_id;
1531
-
1532
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1533
- update_user_meta($email_user_id, 'moopenid_user_avatar', $user_picture);
1534
- $_SESSION['mo_login'] = true;
1535
-
1536
- $user = get_user_by('id', $email_user_id );
1537
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1538
- do_action( 'wp_login', $user->user_login, $user );
1539
- wp_set_auth_cookie( $email_user_id, true );
1540
- }
1541
- // if account linking is enable and email is set
1542
- else if ( get_option('mo_openid_account_linking_enable') && (!mo_openid_restrict_user())){
1543
- mo_openid_start_session();
1544
- $_SESSION['username'] = $username;
1545
- $_SESSION['user_email'] = $user_email;
1546
- $_SESSION['user_full_name'] = $user_full_name;
1547
- $_SESSION['first_name'] = $first_name;
1548
- $_SESSION['last_name'] = $last_name;
1549
- $_SESSION['user_url'] = $user_url;
1550
- $_SESSION['user_picture'] = $user_picture;
1551
- $_SESSION['social_app_name'] = $decrypted_app_name;
1552
- $_SESSION['social_user_id'] = $decrypted_user_id;
1553
-
1554
- echo mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
1555
- exit;
1556
- }
1557
- // else register
1558
- else{
1559
- //check if auto-registration is enabled
1560
- if(get_option('mo_openid_auto_register_enable')) {
1561
-
1562
- $random_password = wp_generate_password( 10, false );
1563
- $user_profile_url = $user_url;
1564
-
1565
- if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
1566
- $user_url = '';
1567
- }
1568
-
1569
- $userdata = array(
1570
- 'user_login' => $username,
1571
- 'user_email' => $user_email,
1572
- 'user_pass' => $random_password,
1573
- 'display_name' => $user_full_name,
1574
- 'first_name' => $first_name,
1575
- 'last_name' => $last_name,
1576
- 'user_url' => $user_url,
1577
- );
1578
-
1579
- $user_id = wp_insert_user( $userdata);
1580
-
1581
- if(is_wp_error( $user_id )) {
1582
- print_r($user_id);
1583
- wp_die("Error Code 2: ".get_option('mo_registration_error_message'));
1584
- }
1585
-
1586
- $_SESSION['social_app_name'] = $decrypted_app_name;
1587
- $_SESSION['user_email'] = $user_email;
1588
- $_SESSION['social_user_id'] = $decrypted_user_id;
1589
-
1590
- $user = get_user_by('email', $user_email );
1591
-
1592
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1593
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1594
- }
1595
- $_SESSION['mo_login'] = true;
1596
- do_action( 'mo_user_register', $user_id, $user_profile_url);
1597
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1598
- do_action( 'wp_login', $user->user_login, $user );
1599
- wp_set_auth_cookie( $user_id, true );
1600
- }
1601
-
1602
- $redirect_url = mo_openid_get_redirect_url();
1603
- wp_redirect($redirect_url);
1604
- exit;
1605
  }
1606
  }
1607
  }
1608
 
1609
- else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'moopenid' ) !== false ){
1610
-
1611
- if( is_user_logged_in()){
1612
- return;
1613
- }
1614
-
1615
- //Decrypt all entries
1616
- $decrypted_email = isset($_POST['email']) ? mo_openid_decrypt_sanitize($_POST['email']): '';
1617
- $decrypted_user_name = isset($_POST['username']) ? mo_openid_decrypt_sanitize($_POST['username']): '';
1618
- $decrypted_user_picture = isset($_POST['profilePic']) ? mo_openid_decrypt_sanitize($_POST['profilePic']): '';
1619
- $decrypted_user_url = isset($_POST['profileUrl']) ? mo_openid_decrypt_sanitize($_POST['profileUrl']): '';
1620
- $decrypted_first_name = isset($_POST['firstName']) ? mo_openid_decrypt_sanitize($_POST['firstName']): '';
1621
- $decrypted_last_name = isset($_POST['lastName']) ? mo_openid_decrypt_sanitize($_POST['lastName']): '';
1622
- $decrypted_app_name = isset($_POST['appName']) ? mo_openid_decrypt_sanitize($_POST['appName']): '';
1623
- $decrypted_user_id = isset($_POST['userid']) ? mo_openid_decrypt_sanitize($_POST['userid']): '';
1624
-
1625
-
1626
- $decrypted_user_name = str_replace(' ', '-', $decrypted_user_name);
1627
- $decrypted_user_name = sanitize_user($decrypted_user_name, true);
1628
-
1629
- if($decrypted_user_name == '-' || $decrypted_user_name == ''){
1630
- $splitemail = explode('@', $decrypted_email);
1631
- $decrypted_user_name = $splitemail[0];
1632
- }
1633
-
1634
- $decrypted_app_name = mo_openid_filter_app_name($decrypted_app_name);
1635
-
1636
- if(isset( $_POST['firstName'] ) && isset( $_POST['lastName'] )){
1637
- if(strcmp($decrypted_first_name, $decrypted_last_name)!=0)
1638
- $user_full_name = $decrypted_first_name.' '.$decrypted_last_name;
1639
- else
1640
- $user_full_name = $decrypted_first_name;
1641
- $first_name = $decrypted_first_name;
1642
- $last_name = $decrypted_last_name;
1643
- }
1644
- else{
1645
- $user_full_name = $decrypted_user_name;
1646
- $first_name = '';
1647
- $last_name = '';
1648
  }
1649
- //Set Display Picture
1650
- $user_picture = $decrypted_user_picture;
1651
-
1652
- //Set User URL
1653
- $user_url = $decrypted_user_url;
1654
-
1655
- //if email or username not returned from app
1656
- if ( empty($decrypted_email) || empty($decrypted_user_name) ){
1657
-
1658
- //check if provider + identifier group exists
1659
- global $wpdb;
1660
- $db_prefix = $wpdb->prefix;
1661
- $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
1662
- if(empty($decrypted_email)){
1663
- $email_user_id = NULL;
1664
- }
1665
- else {
1666
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
1667
- }
1668
- mo_openid_start_session();
1669
- // if returning user whose appname + identifier exists, log him in
1670
- if((isset($id_returning_user)) || (isset($email_user_id)) ){
1671
- if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
1672
- $id_returning_user = $email_user_id;
1673
- mo_openid_insert_query($decrypted_app_name,$decrypted_email,$id_returning_user,$decrypted_user_id);
1674
- }
1675
- $user = get_user_by('id', $id_returning_user );
1676
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1677
- update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
1678
- $_SESSION['mo_login'] = true;
1679
- $_SESSION['social_app_name'] = $decrypted_app_name;
1680
- $_SESSION['user_email'] = $decrypted_email;
1681
- $_SESSION['social_user_id'] = $decrypted_user_id;
1682
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1683
- do_action( 'wp_login', $user->user_login, $user );
1684
- wp_set_auth_cookie( $id_returning_user, true );
1685
- }
1686
- // if new user and profile completion is enabled
1687
- elseif (get_option('mo_openid_enable_profile_completion')){
1688
- echo mo_openid_profile_completion_form($last_name, $first_name, $user_full_name, $user_url, $user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id);
1689
- exit;
1690
- }
1691
- // if new user and profile completion and account linking is disabled, auto create dummy data and register user
1692
- else{
1693
- // auto registration is enabled
1694
- if(get_option('mo_openid_auto_register_enable')) {
1695
-
1696
- if(!empty($decrypted_email))
1697
- {
1698
- $split_email = explode('@',$decrypted_email);
1699
- $username = $split_email[0];
1700
- $user_email = $decrypted_email;
1701
- }
1702
- else if(!empty($decrypted_user_name))
1703
- {
1704
- $split_app_name = explode('_',$decrypted_app_name);
1705
- $username = $decrypted_user_name;
1706
- $user_email = $decrypted_user_name.'@'.$split_app_name[0].'.com';
1707
- }
1708
- else
1709
- {
1710
- $split_app_name = explode('_',$decrypted_app_name);
1711
- $username = 'user_'.get_option('mo_openid_user_count');
1712
- $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
1713
- }
1714
- // remove white space from email
1715
- $user_email = str_replace(' ', '', $user_email);
1716
-
1717
- //account linking
1718
- if ( get_option('mo_openid_account_linking_enable') && (!mo_openid_restrict_user())){
1719
- mo_openid_start_session();
1720
- $_SESSION['username'] = $decrypted_user_name;
1721
- $_SESSION['user_email'] = $user_email;
1722
- $_SESSION['user_full_name'] = $user_full_name;
1723
- $_SESSION['first_name'] = $first_name;
1724
- $_SESSION['last_name'] = $last_name;
1725
- $_SESSION['user_url'] = $user_url;
1726
- $_SESSION['user_picture'] = $user_picture;
1727
- $_SESSION['social_app_name'] = $decrypted_app_name;
1728
- $_SESSION['social_user_id'] = $decrypted_user_id;
1729
-
1730
- echo mo_openid_account_linking_form($decrypted_user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
1731
- exit;
1732
- }
1733
-
1734
- $random_password = wp_generate_password( 10, false );
1735
- $user_profile_url = $user_url;
1736
-
1737
- if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
1738
- $user_url = '';
1739
- }
1740
-
1741
- $userdata = array(
1742
- 'user_login' => $username,
1743
- 'user_email' => $user_email,
1744
- 'user_pass' => $random_password,
1745
- 'display_name' => $user_full_name,
1746
- 'first_name' => $first_name,
1747
- 'last_name' => $last_name,
1748
- 'user_url' => $user_url,
1749
- );
1750
-
1751
- $user_id = wp_insert_user( $userdata);
1752
- if(is_wp_error( $user_id )) {
1753
- print_r($user_id);
1754
- wp_die("Error Code 3: ".get_option('mo_registration_error_message'));
1755
- }
1756
-
1757
- update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1758
-
1759
- $_SESSION['social_app_name'] = $decrypted_app_name;
1760
- $_SESSION['user_email'] = $user_email;
1761
- $_SESSION['social_user_id'] = $decrypted_user_id;
1762
-
1763
- $user = get_user_by('id', $user_id );
1764
 
1765
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1766
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1767
- }
1768
- $_SESSION['mo_login'] = true;
1769
-
1770
- //registration hook
1771
- do_action( 'mo_user_register', $user_id, $user_profile_url);
1772
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1773
- //login hook
1774
- do_action( 'wp_login', $user->user_login, $user );
1775
- wp_set_auth_cookie( $user_id, true );
 
 
 
 
 
 
 
 
 
 
 
1776
  }
 
 
1777
 
1778
- $redirect_url = mo_openid_get_redirect_url();
1779
- wp_redirect($redirect_url);
1780
  exit;
1781
-
1782
  }
1783
 
 
1784
  }
1785
- //email and username are both returned..dont show profile completion
1786
- else{
1787
-
1788
- global $wpdb;
1789
- $user_email = sanitize_email($decrypted_email);
1790
- $username = $decrypted_user_name;
1791
-
1792
- //Checking if email or username already exist
1793
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1794
-
1795
- $db_prefix = $wpdb->prefix;
1796
- $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
1797
-
1798
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$decrypted_email));
1799
-
1800
- if(empty($decrypted_email)){
1801
- $existing_email_user_id = NULL;
1802
- }
1803
- else {
1804
- $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
1805
- }
1806
-
1807
- mo_openid_start_session();
1808
- if((isset($linked_email_id)) || (isset($email_user_id)) || isset($existing_email_user_id)) { // user is a member
1809
-
1810
- if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
1811
- $linked_email_id = $email_user_id;
1812
- mo_openid_insert_query($decrypted_app_name,$user_email,$linked_email_id,$decrypted_user_id);
1813
- }
1814
-
1815
- if(isset($linked_email_id)){
1816
- $user = get_user_by('id', $linked_email_id );
1817
- $user_id = $user->ID;
1818
- }
1819
- else if(isset($email_user_id)){
1820
- $user = get_user_by('id', $email_user_id );
1821
- $user_id = $user->ID;
1822
- }
1823
- else{
1824
- $user = get_user_by('id', $existing_email_user_id );
1825
- $user_id = $user->ID;
1826
- }
1827
-
1828
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1829
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1830
- $_SESSION['mo_login'] = true;
1831
- $_SESSION['social_app_name'] = $decrypted_app_name;
1832
- $_SESSION['social_user_id'] = $decrypted_user_id;
1833
- $_SESSION['user_email'] = $user_email;
1834
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1835
- do_action( 'wp_login', $user->user_login, $user );
1836
- wp_set_auth_cookie( $user_id, true );
1837
- }
1838
- else if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
1839
- mo_openid_start_session();
1840
- $_SESSION['username'] = $decrypted_user_name;
1841
- $_SESSION['user_email'] = $user_email;
1842
- $_SESSION['user_full_name'] = $user_full_name;
1843
- $_SESSION['first_name'] = $first_name;
1844
- $_SESSION['last_name'] = $last_name;
1845
- $_SESSION['user_url'] = $user_url;
1846
- $_SESSION['user_picture'] = $user_picture;
1847
- $_SESSION['social_app_name'] = $decrypted_app_name;
1848
- $_SESSION['social_user_id'] = $decrypted_user_id;
1849
- echo mo_openid_account_linking_form($decrypted_user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
1850
- exit;
1851
- }
1852
- else {
1853
- // this user is a guest
1854
- // auto registration is enabled
1855
- if(get_option('mo_openid_auto_register_enable')) {
1856
- $random_password = wp_generate_password( 10, false );
1857
-
1858
- if( isset($username_user_id) ){
1859
- $email = explode('@', $user_email);
1860
- $username = $email[0];
1861
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1862
-
1863
- $i = 1;
1864
- while(!empty($username_user_id) ){
1865
- $uname=$username.'_' . $i;
1866
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
1867
- $i++;
1868
- if(empty($username_user_id)){
1869
- $username= $uname;
1870
- }
1871
- }
1872
- if( isset($username_user_id) ){
1873
- echo '<br/>'."Error Code 2: ".get_option('mo_existing_username_error_message');
1874
- exit();
1875
- }
1876
- }
1877
-
1878
- $user_profile_url = $user_url;
1879
-
1880
- if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
1881
- $user_url = '';
1882
- }
1883
-
1884
- $userdata = array(
1885
- 'user_login' => $username,
1886
- 'user_email' => $user_email,
1887
- 'user_pass' => $random_password,
1888
- 'display_name' => $user_full_name,
1889
- 'first_name' => $first_name,
1890
- 'last_name' => $last_name,
1891
- 'user_url' => $user_url
1892
- );
1893
-
1894
-
1895
- $user_id = wp_insert_user( $userdata);
1896
-
1897
- if(is_wp_error( $user_id )) {
1898
- print_r($user_id);
1899
- wp_die("Error Code 4: ".get_option('mo_registration_error_message'));
1900
- }
1901
-
1902
- $_SESSION['social_app_name'] = $decrypted_app_name;
1903
- $_SESSION['user_email'] = $user_email;
1904
- $_SESSION['social_user_id'] = $decrypted_user_id;
1905
-
1906
- $user = get_user_by('email', $user_email );
1907
 
1908
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1909
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1910
- }
1911
- $_SESSION['mo_login'] = true;
1912
-
1913
- //registration hook
1914
- do_action( 'mo_user_register', $user_id,$user_profile_url);
1915
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1916
- //login hook
1917
- do_action( 'wp_login', $user->user_login, $user );
1918
- wp_set_auth_cookie( $user_id, true );
1919
- }
1920
- $redirect_url = mo_openid_get_redirect_url();
1921
- wp_redirect($redirect_url);
1922
- exit;
1923
- }
1924
- }
1925
  }
1926
 
1927
  else if( isset( $_REQUEST['autoregister'] ) and strpos( $_REQUEST['autoregister'],'false') !== false ) {
@@ -1931,620 +1367,22 @@ include "twitter_oauth.php";
1931
  }
1932
 
1933
  else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'oauthredirect' ) !== false ) {
1934
- $appname = $_REQUEST['app_name'];
1935
-
1936
- if(isset($_REQUEST['test']))
1937
- setcookie("mo_oauth_test", true);
1938
- else
1939
- setcookie("mo_oauth_test", false);
1940
-
1941
- // NEW
1942
- if(get_option('mo_openid_apps_list')) {
1943
- $appslist = get_option('mo_openid_apps_list');
1944
- }
1945
- else{
1946
- $appslist = array();
1947
- }
1948
- if(get_option('mo_openid_malform_error')){
1949
- if(get_option( 'permalink_structure' )) {
1950
-
1951
- $social_app_redirect_uri = site_url() .'/openidcallback/'.$appname;
1952
-
1953
- }
1954
- else{
1955
- $social_app_redirect_uri = site_url() . '/?openidcallback='.$appname;
1956
- }
1957
-
1958
- }
1959
- else{
1960
- if(get_option( 'permalink_structure' )) {
1961
- $social_app_redirect_uri = site_url() . '/openidcallback';
1962
-
1963
- }
1964
- else{
1965
- $social_app_redirect_uri = site_url() .'/?openidcallback';
1966
- }
1967
- }
1968
-
1969
- mo_openid_start_session();
1970
-
1971
- foreach($appslist as $key=>$currentapp){
1972
-
1973
- if($key == "facebook" && $appname == "facebook"){
1974
- $_SESSION["appname"] = "facebook";
1975
- $client_id = $currentapp['clientid'];
1976
- $scope = $currentapp['scope'];
1977
- $login_dialog_url = "https://www.facebook.com/v2.11/dialog/oauth?client_id=".$client_id. '&redirect_uri='. $social_app_redirect_uri .'&response_type=code&scope='.$scope;
1978
- break;
1979
- }
1980
- else if($key == "google" && $appname == "google"){
1981
-
1982
- $_SESSION["appname"] = "google";
1983
- $client_id = $currentapp['clientid'];
1984
- $scope = $currentapp['scope'];
1985
- $login_dialog_url = 'https://accounts.google.com/o/oauth2/auth?redirect_uri=' .$social_app_redirect_uri .'&response_type=code&client_id=' .$client_id .'&scope='.$scope.'&access_type=offline';
1986
-
1987
- break;
1988
- }
1989
- else if($key == "twitter" && $appname == "twitter")
1990
- { $_SESSION['appname'] = "twitter";
1991
- $client_id = $currentapp['clientid'];
1992
- $client_secret = $currentapp['clientsecret'];
1993
- $twiter_getrequest_object = new twitter_oauth($client_id,$client_secret); //creating the object of twitter_oauth class
1994
- $oauth_token = $twiter_getrequest_object->getRequestToken(); //function call
1995
- $login_dialog_url = "https://api.twitter.com/oauth/authenticate?oauth_token=" . $oauth_token;
1996
- break;
1997
  }
1998
  }
1999
-
2000
- header('Location:'. $login_dialog_url);
2001
- exit;
2002
  }
2003
 
2004
  else if( strpos( $_SERVER['REQUEST_URI'], "openidcallback") !== false ||((strpos( $_SERVER['REQUEST_URI'], "oauth_token")!== false)&&(strpos( $_SERVER['REQUEST_URI'], "oauth_verifier") ) )) {
2005
-
2006
- if( is_user_logged_in() && get_option('mo_openid_test_configuration') != 1){
2007
- return;
2008
- }
2009
-
2010
- $code = $profile_url = $client_id = $current_url = $client_secret = $access_token_uri = $postData = $oauth_token = $user_url = $username = $email = '';
2011
- $oauth_access_token = $redirect_url = $option = $oauth_token_secret = $screen_name = $profile_json_output = $oauth_verifier = $twitter_oauth_token = $access_token_json_output =[];
2012
-
2013
- mo_openid_start_session();
2014
- if(strpos( $_SERVER['REQUEST_URI'], "oauth_verifier") !== false) {
2015
- $_SESSION['appname'] = "twitter";
2016
- }
2017
-
2018
- if($_SESSION['appname']) {
2019
- $appname = $_SESSION['appname'];
2020
- }else {
2021
- if ((strpos($_SERVER['REQUEST_URI'], "openidcallback/google") !== false ) || (strpos($_SERVER['REQUEST_URI'], "openidcallback=google") !== false )) {
2022
- $appname = "google";
2023
- }
2024
-
2025
- if ((strpos($_SERVER['REQUEST_URI'], "openidcallback/facebook") !== false) || (strpos($_SERVER['REQUEST_URI'], "openidcallback=facebook") !== false )) {
2026
- $appname = "facebook";
2027
-
2028
- }
2029
- }
2030
-
2031
- if($appname == "twitter"){
2032
- $dirs = explode('&', $_SERVER['REQUEST_URI']);
2033
- $oauth_verifier = explode('=', $dirs[1]);
2034
- $twitter_oauth_token = explode('=', $dirs[0]);
2035
- }
2036
- else{
2037
- if(isset($_REQUEST['code'] )){
2038
- $code = $_REQUEST['code'];
2039
- }
2040
- else if(isset( $_REQUEST['error_reason'] )){
2041
-
2042
- echo $_REQUEST['error_description'] . "<br>";
2043
- wp_die("Allow access to your profile to get logged in. Click <a href=".get_site_url().">here</a> to go back to the website.");
2044
- }
2045
- }
2046
-
2047
- if(get_option('mo_openid_apps_list')){
2048
- $appslist = get_option('mo_openid_apps_list');
2049
- }
2050
- else{
2051
- $appslist = array();
2052
- }
2053
- if(get_option('mo_openid_malform_error')){
2054
- if(get_option( 'permalink_structure' )) {
2055
-
2056
- $social_app_redirect_uri = site_url() .'/openidcallback/'.$appname;
2057
-
2058
- }
2059
- else{
2060
- $social_app_redirect_uri = site_url() . '/?openidcallback='.$appname;
2061
- }
2062
-
2063
- }
2064
- else{
2065
- if(get_option( 'permalink_structure' )) {
2066
- $social_app_redirect_uri = site_url() . '/openidcallback';
2067
-
2068
- }
2069
- else{
2070
- $social_app_redirect_uri = site_url() .'/?openidcallback';
2071
- }
2072
- }
2073
-
2074
- foreach($appslist as $key=>$currentapp){
2075
- if($key == "facebook" && $appname == "facebook"){
2076
- $client_id = $currentapp['clientid'];
2077
- $client_secret = $currentapp['clientsecret'];
2078
- $access_token_uri = 'https://graph.facebook.com/v2.11/oauth/access_token';
2079
- $postData = 'client_id=' .$client_id .'&redirect_uri=' . $social_app_redirect_uri . '&client_secret=' . $client_secret . '&code=' .$code;
2080
- break;
2081
- }
2082
- else if($key == "google" && $appname == "google"){
2083
- $client_id = $currentapp['clientid'];
2084
- $client_secret = $currentapp['clientsecret'];
2085
- $access_token_uri = 'https://accounts.google.com/o/oauth2/token';
2086
- $postData = 'code=' .$code .'&client_id=' .$client_id .'&client_secret=' . $client_secret . '&redirect_uri=' . $social_app_redirect_uri . '&grant_type=authorization_code';
2087
- break;
2088
- }
2089
- else if($key == "twitter" && $appname == "twitter")
2090
- {
2091
- $client_id = $currentapp['clientid'];
2092
- $client_secret = $currentapp['clientsecret'];
2093
- $twitter_getaccesstoken_object = new twitter_oauth($client_id,$client_secret);
2094
- $oauth_token = $twitter_getaccesstoken_object->getAccessToken($oauth_verifier[1],$twitter_oauth_token[1]);
2095
- break;
2096
- }
2097
- }
2098
-
2099
- if($appname != "twitter"){
2100
- $ch = curl_init(); // Initiate cURL
2101
- curl_setopt($ch, CURLOPT_URL,$access_token_uri);
2102
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
2103
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
2104
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
2105
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
2106
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
2107
- curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
2108
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
2109
- curl_setopt($ch, CURLOPT_POST, 1); // Tell cURL you want to post something
2110
- curl_setopt($ch, CURLOPT_HEADER, 0);
2111
- if($appname == "google")
2112
- {
2113
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
2114
- }
2115
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); // Define what you want to post
2116
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the output in string format
2117
-
2118
- $result = curl_exec($ch);
2119
-
2120
- if( curl_errno( $ch ) ){
2121
- update_option( 'mo_openid_test_configuration', 0);
2122
- echo 'Request Error:' . curl_error( $ch );
2123
- exit();
2124
- }
2125
- $access_token_json_output = json_decode($result, true);
2126
- // this handles incorrect client secret for all apps.
2127
- if ((array_key_exists('error', $access_token_json_output)) || array_key_exists('error_message', $access_token_json_output)){
2128
- if( is_user_logged_in() && get_option('mo_openid_test_configuration') == 1 ) {
2129
- update_option('mo_openid_test_configuration', 0);
2130
- //Test configuration failed window.
2131
- echo '<div style="color: #a94442;background-color: #f2dede;padding: 15px;margin-bottom: 20px;text-align:center;border:1px solid #E6B3B2;font-size:18pt;">TEST FAILED</div>
2132
- <div style="color: #a94442;font-size:14pt; margin-bottom:20px;">WARNING: Client secret is incorrect for this app. Please check the client secret and try again.<br/>';
2133
- print_r($access_token_json_output);
2134
- echo '</div>
2135
- <div style="display:block;text-align:center;margin-bottom:4%;"><img style="width:15%;"src="' . plugin_dir_url(__FILE__) . '/includes/images/wrong.png"></div>';
2136
- exit;
2137
- }
2138
- }
2139
-
2140
- }
2141
- else{
2142
- $oauth_token_array = explode('&', $oauth_token);
2143
- $oauth_access_token = isset($oauth_token_array[0]) ? $oauth_token_array[0] : null;
2144
- $oauth_access_token = explode('=', $oauth_access_token);
2145
- $oauth_token_secret = isset($oauth_token_array[1]) ? $oauth_token_array[1] : null;
2146
- $oauth_token_secret = explode('=', $oauth_token_secret);
2147
- $screen_name = isset($oauth_token_array[3]) ? $oauth_token_array[3] : null;
2148
- $screen_name = explode('=', $screen_name);
2149
- }
2150
-
2151
- mo_openid_start_session();
2152
- foreach($appslist as $key=>$currentapp){
2153
- if($key == "facebook" && $appname == "facebook"){
2154
- $profile_url ='https://graph.facebook.com/me/?fields=id,name,email,picture.height(961),age_range,first_name,gender,last_name,link&access_token=' .$access_token_json_output['access_token'];
2155
- break;
2156
- }
2157
- else if($key == "google" && $appname == "google"){
2158
- $profile_url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=' .$access_token_json_output['access_token'];
2159
- break;
2160
- }
2161
- else if($key == "twitter" && $appname == "twitter"){
2162
- $twitter_getprofile_signature_object = new twitter_oauth($client_id,$client_secret);
2163
- $oauth_access_token1 = isset($oauth_access_token[1]) ? $oauth_access_token[1] : '';
2164
- $oauth_token_secret1 = isset($oauth_token_secret[1]) ? $oauth_token_secret[1] : '';
2165
- $screen_name1 = isset($screen_name[1]) ? $screen_name[1] : '';
2166
- $profile_json_output = $twitter_getprofile_signature_object->getprofile_signature($oauth_access_token1,$oauth_token_secret1,$screen_name1);
2167
- break;
2168
- }
2169
- }
2170
-
2171
- if($appname != "twitter"){
2172
- $churl = curl_init($profile_url);
2173
- curl_setopt( $churl, CURLOPT_FOLLOWLOCATION, true );
2174
- curl_setopt( $churl, CURLOPT_ENCODING, "" );
2175
- curl_setopt( $churl, CURLOPT_RETURNTRANSFER, true );
2176
- curl_setopt( $churl, CURLOPT_AUTOREFERER, true );
2177
- curl_setopt( $churl, CURLOPT_SSL_VERIFYPEER, false );
2178
- curl_setopt( $churl, CURLOPT_SSL_VERIFYHOST, 0 );
2179
- curl_setopt( $churl, CURLOPT_MAXREDIRS, 10 );
2180
- curl_setopt( $churl, CURLOPT_POST, false);
2181
- curl_setopt($churl, CURLOPT_HTTPHEADER, array(
2182
- 'Authorization: Bearer '.$access_token_json_output['access_token']
2183
- ));
2184
-
2185
- $output = curl_exec($churl);
2186
-
2187
- if( curl_errno( $churl ) ){
2188
- echo 'Request Error:' . curl_error( $churl );
2189
- exit();
2190
- }
2191
-
2192
- $profile_json_output = json_decode($output, true);
2193
-
2194
- }
2195
- //Test Configuration
2196
- if( is_user_logged_in() && get_option('mo_openid_test_configuration') == 1 ){
2197
- update_option( 'mo_openid_test_configuration', 0);
2198
- $print = '<div style="color: #3c763d;
2199
- background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; border:1px solid #AEDB9A; font-size:18pt;">TEST SUCCESSFUL</div>
2200
- <div style="display:block;text-align:center;margin-bottom:1%;"><img style="width:15%;"src="'. plugin_dir_url(__FILE__) . '/includes/images/green_check.png"></div>';
2201
-
2202
-
2203
- $print .= mo_openid_json_to_htmltable($profile_json_output);
2204
-
2205
-
2206
-
2207
- echo $print;
2208
- exit;
2209
- }
2210
- $social_app_name = $appname;
2211
- $first_name = $last_name = $email = $user_name = $user_url = $user_picture = $social_user_id = '';
2212
-
2213
- if ($appname == "facebook"){
2214
- $first_name = isset( $profile_json_output['first_name']) ? $profile_json_output['first_name'] : '';
2215
- $last_name = isset( $profile_json_output['last_name']) ? $profile_json_output['last_name'] : '';
2216
- $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
2217
- $user_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
2218
- $user_url = isset( $profile_json_output['link']) ? $profile_json_output['link'] : '';
2219
- $user_picture = isset( $profile_json_output['picture']['data']['url']) ? $profile_json_output['picture']['data']['url'] : '';
2220
- $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
2221
- }
2222
- else if ($appname == "google"){
2223
- $first_name = isset( $profile_json_output['given_name']) ? $profile_json_output['given_name'] : '';
2224
- $user_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
2225
- $last_name = isset( $profile_json_output['family_name']) ? $profile_json_output['family_name'] : '';
2226
- $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
2227
- $user_url = isset( $profile_json_output['link']) ? $profile_json_output['link'] : '';
2228
- $user_picture = isset( $profile_json_output['picture']) ? $profile_json_output['picture'] : '';
2229
- $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
2230
- }
2231
- else if($appname == "twitter") {
2232
- if (isset($profile_json_output['name'])) {
2233
- $full_name = explode(" ", $profile_json_output['name']);
2234
- $first_name = isset( $full_name[0]) ? $full_name[0] : '';
2235
- $last_name = isset( $full_name[1]) ? $full_name[1] : '';
2236
- }
2237
- $user_name = isset( $profile_json_output['screen_name']) ? $profile_json_output['screen_name'] : '';
2238
- $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
2239
- $user_url = isset( $profile_json_output['url']) ? $profile_json_output['url'] : '';
2240
- $user_picture = isset( $profile_json_output['profile_image_url']) ? $profile_json_output['profile_image_url'] : '';
2241
- $social_user_id = isset( $profile_json_output['id_str']) ? $profile_json_output['id_str'] : '';
2242
- }
2243
-
2244
- $user_name = str_replace(' ', '-', $user_name);
2245
- $user_name = sanitize_user($user_name, true);
2246
-
2247
- if($user_name == '-' || $user_name == ''){
2248
- $splitemail = explode('@', $email);
2249
- $user_name = $splitemail[0];
2250
- }
2251
-
2252
- //Set User Full Name
2253
- if(isset( $first_name ) && isset( $last_name )){
2254
- if(strcmp($first_name, $last_name)!=0)
2255
- $user_full_name = $first_name.' '.$last_name;
2256
- else
2257
- $user_full_name = $first_name;
2258
- }
2259
- else{
2260
- $user_full_name = $user_name;
2261
- $first_name = '';
2262
- $last_name = '';
2263
- }
2264
-
2265
- // if email and user name is empty
2266
- if ( empty($email) || empty($user_name) ){
2267
- global $wpdb;
2268
- $db_prefix = $wpdb->prefix;
2269
- $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
2270
- if(empty($email)){
2271
- $email_user_id = NULL;
2272
- }
2273
- else {
2274
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $email));
2275
- }
2276
-
2277
- mo_openid_start_session();
2278
-
2279
- // if returning user whose appname + identifier exists, log him in
2280
- if((isset($id_returning_user)) || (isset($email_user_id))){
2281
- if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
2282
- $id_returning_user = $email_user_id;
2283
- mo_openid_insert_query($social_app_name,$email,$id_returning_user,$social_user_id);
2284
- }
2285
- $user = get_user_by('id', $id_returning_user );
2286
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
2287
- update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
2288
-
2289
- $_SESSION['mo_login'] = true;
2290
- $_SESSION['social_app_name'] = $social_app_name;
2291
- $_SESSION['user_email'] = $email;
2292
- $_SESSION['social_user_id'] = $social_user_id;
2293
-
2294
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
2295
- do_action( 'wp_login', $user->user_login, $user );
2296
- wp_set_auth_cookie( $id_returning_user, true );
2297
- }
2298
- // if new user and profile completion is enabled
2299
- elseif (get_option('mo_openid_enable_profile_completion')){
2300
- echo mo_openid_profile_completion_form($last_name, $first_name, $user_full_name, $user_url, $user_picture, $user_name, $email, $social_app_name, $social_user_id);
2301
- exit;
2302
- }
2303
- // if new user and profile completion is disabled, auto create dummy data and register user
2304
- else{
2305
- // auto registration is enabled
2306
- if(get_option('mo_openid_auto_register_enable')) {
2307
-
2308
- if(!empty($email))
2309
- {
2310
- $split_email = explode('@',$email);
2311
- $username = $split_email[0];
2312
- $user_email = $email;
2313
- }
2314
- else if(!empty($user_name))
2315
- {
2316
- $split_app_name = explode('_',$social_app_name);
2317
- $username = $user_name;
2318
- $user_email = $user_name.'@'.$split_app_name[0].'.com';
2319
- }
2320
- else
2321
- {
2322
- $split_app_name = explode('_',$social_app_name);
2323
- $username = 'user_'.get_option('mo_openid_user_count');
2324
- $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
2325
- }
2326
- $user_email = str_replace(' ', '', $user_email);
2327
-
2328
- if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
2329
- mo_openid_start_session();
2330
- $_SESSION['username'] = $username;
2331
- $_SESSION['user_email'] = $user_email;
2332
- $_SESSION['user_full_name'] = $user_full_name;
2333
- $_SESSION['first_name'] = $first_name;
2334
- $_SESSION['last_name'] = $last_name;
2335
- $_SESSION['user_url'] = $user_url;
2336
- $_SESSION['user_picture'] = $user_picture;
2337
- $_SESSION['social_app_name'] = $social_app_name;
2338
- $_SESSION['social_user_id'] = $social_user_id;
2339
- echo mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$social_app_name,$social_user_id);
2340
- exit;
2341
- }
2342
-
2343
- $random_password = wp_generate_password( 10, false );
2344
-
2345
- $user_profile_url = $user_url;
2346
-
2347
- if(isset($social_app_name) && !empty($social_app_name) && $social_app_name=='facebook'){
2348
- $user_url = '';
2349
- }
2350
-
2351
- $userdata = array(
2352
- 'user_login' => $username,
2353
- 'user_email' => $user_email,
2354
- 'user_pass' => $random_password,
2355
- 'display_name' => $user_full_name,
2356
- 'first_name' => $first_name,
2357
- 'last_name' => $last_name,
2358
- 'user_url' => $user_url,
2359
- );
2360
-
2361
- $user_id = wp_insert_user( $userdata);
2362
-
2363
- if(is_wp_error( $user_id )) {
2364
- print_r($user_id);
2365
- wp_die("Error Code 5: ".get_option('mo_registration_error_message'));
2366
- }
2367
-
2368
- update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
2369
- $_SESSION['mo_login'] = true;
2370
- $_SESSION['social_app_name'] = $social_app_name;
2371
- $_SESSION['user_email'] = $user_email;
2372
- $_SESSION['social_user_id'] = $social_user_id;
2373
-
2374
- $user = get_user_by('email', $user_email );
2375
-
2376
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
2377
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
2378
- }
2379
-
2380
- //registration hook
2381
- do_action( 'mo_user_register', $user_id, $user_profile_url);
2382
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
2383
- //login hook
2384
- do_action( 'wp_login', $user->user_login, $user );
2385
- wp_set_auth_cookie( $user_id, true );
2386
- }
2387
- $redirect_url = mo_openid_get_redirect_url();
2388
- wp_redirect($redirect_url);
2389
- exit;
2390
- }
2391
- $redirect_url = mo_openid_get_redirect_url();
2392
- wp_redirect($redirect_url);
2393
- exit;
2394
- }
2395
- //email and username are both returned..dont show profile completion
2396
- else{
2397
- global $wpdb;
2398
- $user_email = sanitize_email($email);
2399
- $username = $user_name;
2400
-
2401
- //Checking if username already exist
2402
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
2403
-
2404
- $db_prefix = $wpdb->prefix;
2405
- $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
2406
-
2407
- $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$user_email));
2408
- if(empty($user_email)){
2409
- $existing_email_user_id = NULL;
2410
- }
2411
- else {
2412
- $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
2413
- }
2414
-
2415
- mo_openid_start_session();
2416
- if((isset($linked_email_id)) || (isset($email_user_id)) || (isset($existing_email_user_id)) ) { // user is a member
2417
- if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
2418
-
2419
- $linked_email_id = $email_user_id;
2420
- mo_openid_insert_query($social_app_name,$user_email,$linked_email_id,$social_user_id);
2421
- }
2422
-
2423
- if(isset($linked_email_id)){
2424
- $user = get_user_by('id', $linked_email_id );
2425
- $user_id = $user->ID;
2426
- }
2427
- else if(isset($email_user_id)){
2428
- $user = get_user_by('id', $email_user_id );
2429
- $user_id = $user->ID;
2430
- }
2431
- else{
2432
- $user = get_user_by('id', $existing_email_user_id );
2433
- $user_id = $user->ID;
2434
- }
2435
-
2436
- if(get_option('moopenid_social_login_avatar') && isset($user_picture))
2437
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
2438
- $_SESSION['mo_login'] = true;
2439
- $_SESSION['social_app_name'] = $social_app_name;
2440
- $_SESSION['social_user_id'] = $social_user_id;
2441
- $_SESSION['user_email'] = $user_email;
2442
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
2443
- do_action( 'wp_login', $user->user_login, $user );
2444
- wp_set_auth_cookie( $user_id, true );
2445
-
2446
- }
2447
- //if account linking is enable
2448
- else if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
2449
- mo_openid_start_session();
2450
- $_SESSION['username'] = $user_name;
2451
- $_SESSION['user_email'] = $user_email;
2452
- $_SESSION['user_full_name'] = $user_full_name;
2453
- $_SESSION['first_name'] = $first_name;
2454
- $_SESSION['last_name'] = $last_name;
2455
- $_SESSION['user_url'] = $user_url;
2456
- $_SESSION['user_picture'] = $user_picture;
2457
- $_SESSION['social_app_name'] = $social_app_name;
2458
- $_SESSION['social_user_id'] = $social_user_id;
2459
-
2460
- echo mo_openid_account_linking_form($user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$social_app_name,$social_user_id);
2461
- exit;
2462
- }
2463
- else {
2464
-
2465
- // this user is a guest
2466
- // auto registration is enabled
2467
- if(get_option('mo_openid_auto_register_enable')) {
2468
- $random_password = wp_generate_password( 10, false );
2469
-
2470
- if( isset($username_user_id) ){
2471
- $email_array = explode('@', $user_email);
2472
- $username = $email_array[0];
2473
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
2474
- $i = 1;
2475
- while(!empty($username_user_id) ){
2476
- $uname=$username.'_' . $i;
2477
- $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
2478
- $i++;
2479
- if(empty($username_user_id)){
2480
- $username= $uname;
2481
- }
2482
- }
2483
-
2484
- if( isset($username_user_id) ){
2485
- echo '<br/>'."Error Code 3: ".get_option('mo_existing_username_error_message');
2486
- exit();
2487
- }
2488
- }
2489
-
2490
- $user_profile_url = $user_url;
2491
-
2492
- if(isset($social_app_name) && !empty($social_app_name) && $social_app_name=='facebook'){
2493
- $user_url = '';
2494
- }
2495
-
2496
- $userdata = array(
2497
- 'user_login' => $username,
2498
- 'user_email' => $user_email,
2499
- 'user_pass' => $random_password,
2500
- 'display_name' => $user_full_name,
2501
- 'first_name' => $first_name,
2502
- 'last_name' => $last_name,
2503
- 'user_url' => $user_url,
2504
- );
2505
-
2506
- $user_id = wp_insert_user( $userdata);
2507
- if(is_wp_error( $user_id )) {
2508
- print_r($user_id);
2509
- wp_die("Error Code 6: ".get_option('mo_registration_error_message'));
2510
- }
2511
-
2512
- mo_openid_start_session();
2513
- $_SESSION['username'] = $user_name;
2514
- $_SESSION['user_email'] = $user_email;
2515
- $_SESSION['user_full_name'] = $user_full_name;
2516
- $_SESSION['first_name'] = $first_name;
2517
- $_SESSION['last_name'] = $last_name;
2518
- $_SESSION['user_url'] = $user_url;
2519
- $_SESSION['user_picture'] = $user_picture;
2520
- $_SESSION['social_app_name'] = $social_app_name;
2521
- $_SESSION['social_user_id'] = $social_user_id;
2522
-
2523
- $user = get_user_by('id', $user_id );
2524
- if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
2525
- update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
2526
- }
2527
- $_SESSION['mo_login'] = true;
2528
-
2529
- //registration hook
2530
- do_action( 'mo_user_register', $user_id, $user_profile_url);
2531
- do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
2532
- //login hook
2533
-
2534
- do_action( 'wp_login', $user->user_login, $user );
2535
- wp_set_auth_cookie( $user_id, true );
2536
- }
2537
- $redirect_url = mo_openid_get_redirect_url();
2538
- wp_redirect($redirect_url);
2539
- exit;
2540
- }
2541
-
2542
- $redirect_url = mo_openid_get_redirect_url();
2543
- wp_redirect($redirect_url);
2544
- exit;
2545
- }
2546
- }
2547
  }
 
2548
  function mo_openid_json_to_htmltable($arr) {
2549
  $str = "<table border='1'><tbody>";
2550
  foreach ($arr as $key => $val) {
@@ -2567,10 +1405,9 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2567
 
2568
  function mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name ,$first_name, $decrypted_app_name, $decrypted_user_id,$message = ''){
2569
  $path = mo_openid_get_wp_style();
 
2570
  if($message=='')
2571
- {
2572
  $message=get_option('mo_email_verify_message');
2573
- }
2574
  else
2575
  $message=get_option('mo_email_verify_wrong_otp');
2576
 
@@ -2602,20 +1439,21 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2602
  <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
2603
  <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>'.$message.'</div> <br>
2604
  <p>
2605
- <label for="user_login">'.get_option('mo_email_verify_verification_code_instruction').'<br/>
2606
  <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" /></label>
2607
  </p>
2608
- <input type="hidden" name="username_field" value='.$username.'>
2609
- <input type="hidden" name="email_field" value='.$user_email.'>
2610
- <input type="hidden" name="first_name" value='.$first_name.'>
2611
- <input type="hidden" name="last_name" value='.$last_name.'>
2612
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2613
- <input type="hidden" name="user_url" value='.$user_url.'>
2614
- <input type="hidden" name="user_picture" value='.$user_picture.'>
2615
- <input type="hidden" name="transaction_id" value='.$transaction_id.'>
2616
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2617
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2618
  <input type="hidden" name="option" value="mo_openid_otp_validation">
 
2619
  </div>
2620
  <div style="float: right;margin-right: 11px;">
2621
  <input type="submit" style="margin-left:10px" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
@@ -2629,20 +1467,21 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2629
  if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2630
  $html .= mo_openid_customize_logo();
2631
  }
2632
-
2633
  $html.= '</form>
2634
  <form style="display:none;" name="go_back_form" id="go_back_form" method="post">
2635
  <input hidden name="option" value="mo_openid_show_profile_form"/>
2636
- <input type="hidden" name="username_field" value='.$username.'>
2637
- <input type="hidden" name="email_field" value='.$user_email.'>
2638
- <input type="hidden" name="first_name" value='.$first_name.'>
2639
- <input type="hidden" name="last_name" value='.$last_name.'>
2640
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2641
- <input type="hidden" name="user_url" value='.$user_url.'>
2642
- <input type="hidden" name="user_picture" value='.$user_picture.'>
2643
- <input type="hidden" name="transaction_id" value='.$transaction_id.'>
2644
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2645
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
 
2646
  </form>
2647
  </div>
2648
  </div>
@@ -2657,6 +1496,7 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2657
 
2658
  function mo_openid_username_already_exists($last_name,$first_name,$user_full_name,$user_url,$user_picture,$username,$user_email, $decrypted_app_name, $decrypted_user_id){
2659
  $path = mo_openid_get_wp_style();
 
2660
  $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style>
2661
  <style>
2662
  .mocomp {
@@ -2682,11 +1522,11 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2682
  <form name="f" method="post" action="">
2683
  <div style="background: white;margin-top:-15px;padding: 15px;">
2684
 
2685
- <div style="text-align:center"><span style="font-size: 24px;font-family: Arial">'.get_option('mo_profile_complete_title').'</span></div>
2686
  <p><br>
2687
- <label for="user_login">'.get_option('mo_profile_complete_username_label').'<br/>
2688
- <input type="text" class="input" name="username_field" value='.$username.' size="20" required>
2689
- <span align="center" class="form-input-validation is-error">'.get_option('mo_profile_complete_uname_exist').'</span>
2690
  </label>
2691
  </p>
2692
  <br>
@@ -2694,14 +1534,15 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2694
  <label for="user_pass">'.get_option('mo_profile_complete_email_label').'<br/>
2695
  <input type="email" name="email_field" class="input" value='.$user_email.' size="20" required></label>
2696
  </p>
2697
- <input type="hidden" name="first_name" value='.$first_name.'>
2698
- <input type="hidden" name="last_name" value='.$last_name.'>
2699
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2700
- <input type="hidden" name="user_url" value='.$user_url.'>
2701
- <input type="hidden" name="user_picture" value='.$user_picture.'>
2702
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2703
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2704
  <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
 
2705
  </div>
2706
  <p class="submit">
2707
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
@@ -2721,6 +1562,7 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2721
 
2722
  function mo_openid_profile_completion_form($last_name,$first_name,$user_full_name,$user_url,$user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id){
2723
  $path = mo_openid_get_wp_style();
 
2724
  $html = '<style>.form-input-validation.note {color: #d94f4f;}</style>
2725
  <style>
2726
  .mocomp {
@@ -2744,27 +1586,28 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2744
  <form name="f" method="post" action="">
2745
  <div style="background: white;margin-top:-15px;padding: 15px;">
2746
 
2747
- <div style="text-align:center"><span style="font-size: 24px;font-family: Arial">'.get_option('mo_profile_complete_title').'</span></div><br>
2748
  <div style="padding: 12px;"></div>
2749
  <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
2750
- <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>'.get_option('mo_profile_complete_instruction').'</div><br>
2751
  <p>
2752
- <label for="user_login">'.get_option('mo_profile_complete_username_label').'<br/>
2753
- <input type="text" class="input" name="username_field" size="20" required value='.$decrypted_user_name.'></label>
2754
  </p>
2755
  <p>
2756
- <label for="user_pass">'.get_option('mo_profile_complete_email_label').'<br/>
2757
- <input type="email" class="input" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+$" name="email_field" size="20" required value='.$decrypted_email.'></label>
2758
- <span align="center" class="form-input-validation note">'.get_option('mo_profile_complete_extra_instruction').'</span>
2759
  </p>
2760
- <input type="hidden" name="first_name" value='.$first_name.'>
2761
- <input type="hidden" name="last_name" value='.$last_name.'>
2762
- <input type="hidden" name="user_full_name" value='.$user_full_name.'>
2763
- <input type="hidden" name="user_url" value='.$user_url.'>
2764
- <input type="hidden" name="user_picture" value='.$user_picture.'>
2765
- <input type="hidden" name="decrypted_app_name" value='.$decrypted_app_name.'>
2766
- <input type="hidden" name="decrypted_user_id" value='.$decrypted_user_id.'>
2767
  <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
 
2768
  </div>
2769
  <p class="submit">
2770
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
@@ -2783,6 +1626,7 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2783
 
2784
  function mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id){
2785
  $path = mo_openid_get_wp_style();
 
2786
  $html = "
2787
  <style>
2788
  .mocomp {
@@ -2804,27 +1648,28 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2804
  <div class='mocomp'>
2805
  <form name = 'f' method = 'post' action='' style='margin-left: 2%;margin-right: 2%;'>
2806
  <input type = 'hidden' name = 'option' value = 'mo_openid_account_linking'/>
2807
- <input type='hidden' name='user_email' value=".$user_email.">
2808
- <input type='hidden' name='username' value=".$username.">
2809
- <input type='hidden' name='first_name' value=".$first_name.">
2810
- <input type='hidden' name='last_name' value=".$last_name.">
2811
- <input type='hidden' name='user_full_name' value=".$user_full_name.">
2812
- <input type='hidden' name='user_url' value=".$user_url.">
2813
- <input type='hidden' name='user_picture' value=".$user_picture.">
2814
- <input type='hidden' name='decrypted_app_name' value=".$decrypted_app_name.">
2815
- <input type='hidden' name='decrypted_user_id' value=".$decrypted_user_id.">
 
2816
  <div style = 'background-color:white; padding:12px; top:100px; right: 350px; padding-bottom: 20px;left:350px; overflow:hidden; outline:1px black;border-radius: 5px;'>
2817
 
2818
  <br>
2819
- <div style=\"text-align:center\"><span style='font-size: 24px;font-family: Arial;text-align:center'>".get_option('mo_account_linking_title')."</span></div><br>
2820
  <div style='padding: 12px;'></div>
2821
  <div style=' padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;'>".get_option('mo_account_linking_new_user_instruction').".<br><br>".get_option('mo_account_linking_existing_user_instruction')."".get_option('mo_account_linking_extra_instruction')."
2822
  </div>
2823
  <br><br>
2824
 
2825
- <input type = 'submit' value = '".get_option('mo_account_linking_existing_user_button')."' name = 'mo_openid_link_account' class='button button-primary button-large' style = 'margin-left: 3%;margin-right: 0%;'/>
2826
 
2827
- <input type = 'submit' value = '".get_option('mo_account_linking_new_user_button')."' name = 'mo_openid_create_new_account' class='button button-primary button-large' style = 'margin-left: 5%margin-right: 5%;'/>";
2828
 
2829
  if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
2830
  $html .= mo_openid_customize_logo();
@@ -2858,9 +1703,9 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2858
  }
2859
  mo_openid_start_session();
2860
 
2861
- $user_email = isset($_SESSION['user_email']) ? $_SESSION['user_email']:'';
2862
- $social_app_identifier = isset($_SESSION['social_user_id']) ? $_SESSION['social_user_id']:'';
2863
- $social_app_name = isset($_SESSION['social_app_name']) ? $_SESSION['social_app_name']:'';
2864
 
2865
  //if user is coming through default wordpress login, do not proceed further and return
2866
  if(isset($userid) && empty($social_app_identifier) && empty($social_app_name) ) {
@@ -2911,10 +1756,10 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
2911
  )
2912
  );
2913
  if($result === false){
2914
- /* $wpdb->show_errors();
 
2915
  $wpdb->print_error();
2916
- exit;*/
2917
- //wp_die('Error in insert query');
2918
  }
2919
  }
2920
  }
@@ -3147,11 +1992,11 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
3147
  global $wpdb;
3148
  $db_prefix = $wpdb->prefix;
3149
  $result = $wpdb->get_var($wpdb->prepare("DELETE from ".$db_prefix."mo_openid_linked_user where user_id = %s ",$user_id));
3150
- if($result === false){
3151
- /*$wpdb->show_errors();
3152
- $wpdb->print_error();
3153
- exit;*/
3154
  wp_die(get_option('mo_delete_user_error_message'));
 
 
 
3155
  }
3156
  }
3157
 
@@ -3190,28 +2035,6 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
3190
  $columns['mo_openid_delete_profile_data'] = 'Delete Social Profile Data';
3191
  return $columns;
3192
  }
3193
- add_filter('manage_users_columns', 'mo_openid_add_custom_column');
3194
-
3195
- add_action( 'widgets_init', function(){register_widget( "mo_openid_login_wid" );});
3196
- add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_ver_wid" );});
3197
- add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_hor_wid" );});
3198
-
3199
- add_action( 'init', 'mo_openid_login_validate' );
3200
- //add_action( 'init', 'mo_openid_start_session' );
3201
- add_action( 'wp_logout', 'mo_openid_end_session',1 );
3202
- add_action( 'mo_user_register', 'mo_openid_update_role', 1, 2);
3203
- add_action( 'wp_login', 'mo_openid_login_redirect', 10, 2);
3204
- add_action( 'wp_login', 'mo_openid_link_account', 9, 2);
3205
- add_filter( 'login_message', 'mo_openid_account_linking');
3206
- add_action( 'delete_user', 'mo_openid_delete_account_linking_rows' );
3207
- add_action( 'mo_user_register','mo_openid_send_email',1, 2 );
3208
-
3209
-
3210
- //compatibility with international characters
3211
- add_filter('sanitize_user', 'mo_openid_sanitize_user', 10, 3);
3212
-
3213
- // remove_filter('sanitize_title','sanitize_title_with_dashes', 10);
3214
- // add_filter( 'sanitize_title', 'mo_openid_sanitize_title_with_dashes', 10, 3 );
3215
 
3216
  function mo_openid_delete_social_profile_script(){
3217
  ?>
@@ -3233,8 +2056,6 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
3233
 
3234
  }
3235
 
3236
- add_action('admin_head', 'mo_openid_delete_social_profile_script');
3237
-
3238
  function mo_openid_sanitize_user($username, $raw_username, $strict) {
3239
 
3240
  $username = wp_strip_all_tags( $raw_username );
@@ -3250,4 +2071,23 @@ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; bord
3250
  return $username;
3251
  }
3252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3253
  ?>
1
  <?php
2
+ include "class-mo-openid-twitter-oauth.php";
3
+ include "class-mo-openid-social-login-functions.php";
4
 
5
  /*
6
  * Login Widget
46
  <?php
47
  }
48
 
49
+ $selected_theme = esc_attr(get_option('mo_openid_login_theme'));
50
+ $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
51
+ $spacebetweenicons = esc_attr(get_option('mo_login_icon_space'));
52
+ $customWidth = esc_attr(get_option('mo_login_icon_custom_width'));
53
+ $customHeight = esc_attr(get_option('mo_login_icon_custom_height'));
54
+ $customSize = esc_attr(get_option('mo_login_icon_custom_size'));
55
+ $customBackground = esc_attr(get_option('mo_login_icon_custom_color'));
56
+ $customTheme = esc_attr(get_option('mo_openid_login_custom_theme'));
57
+ $customTextofTitle = esc_attr(get_option('mo_openid_login_button_customize_text'));
58
+ $customBoundary = esc_attr(get_option('mo_login_icon_custom_boundary'));
59
+ $customLogoutName = esc_attr(get_option('mo_openid_login_widget_customize_logout_name_text'));
60
+ $customLogoutLink = esc_url(get_option('mo_openid_login_widget_customize_logout_text'));
61
+ $customTextColor= esc_attr(get_option('mo_login_openid_login_widget_customize_textcolor'));
62
+ $customText = esc_html(get_option('mo_openid_login_widget_customize_text'));
63
+
64
+ $facebook_custom_app = esc_attr($this->if_custom_app_exists('facebook'));
65
+ $google_custom_app = esc_attr($this->if_custom_app_exists('google'));
66
+ $twitter_custom_app = esc_attr($this->if_custom_app_exists('twitter'));
67
+ $salesforce_custom_app = esc_attr($this->if_custom_app_exists('salesforce'));
68
+ $linkedin_custom_app = esc_attr($this->if_custom_app_exists('linkedin'));
69
+ $windowslive_custom_app = esc_attr($this->if_custom_app_exists('windowslive'));
70
+ $vkontakte_custom_app = esc_attr($this->if_custom_app_exists('vkontakte'));
71
+ $amazon_custom_app = esc_attr($this->if_custom_app_exists('amazon'));
72
+ $instagram_custom_app = esc_attr($this->if_custom_app_exists('instagram'));
73
+ $yahoo_custom_app = esc_attr($this->if_custom_app_exists('yahoo'));
74
 
75
  if (get_option('mo_openid_gdpr_consent_enable')) {
76
  $gdpr_setting = "disabled='disabled'";
77
  } else
78
  $gdpr_setting = '';
79
 
80
+ $url = esc_url(get_option('mo_openid_privacy_policy_url'));
81
+ $text = esc_html(get_option('mo_openid_privacy_policy_text'));
82
 
83
  if (!empty($text) && strpos(get_option('mo_openid_gdpr_consent_message'), $text)) {
84
  $consent_message = str_replace(get_option('mo_openid_privacy_policy_text'), '<a target="_blank" href="' . $url . '">' . $text . '</a>', get_option('mo_openid_gdpr_consent_message'));
98
  </p>
99
  <?php if (get_option('mo_openid_gdpr_consent_enable')) {
100
  $consent_message = isset($consent_message) ? $consent_message : ''; ?>
 
101
  <label class="mo-consent" style="padding-right: 10px;"><input type="checkbox"
102
  onchange="mo_openid_on_consent_change(this,value)"
103
  value="1"
653
 
654
  public function if_custom_app_exists($app_name){
655
  if(get_option('mo_openid_apps_list'))
656
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
657
  else
658
  $appslist = array();
659
 
671
  if (mo_openid_is_customer_registered()) {
672
  global $post;
673
  $html = '';
674
+ $selected_theme = isset( $atts['shape'] )? esc_attr($atts['shape']) : esc_attr(get_option('mo_openid_login_theme'));
675
+ $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') |get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable');
676
+ $spacebetweenicons = isset( $atts['space'] )? esc_attr(intval($atts['space'])) : esc_attr(intval(get_option('mo_login_icon_space')));
677
+ $customWidth = isset( $atts['width'] )? esc_attr(intval($atts['width'])) : esc_attr(intval(get_option('mo_login_icon_custom_width')));
678
+ $customHeight = isset( $atts['height'] )? esc_attr(intval($atts['height'])) : esc_attr(intval(get_option('mo_login_icon_custom_height')));
679
+ $customSize = isset( $atts['size'] )? esc_attr(intval($atts['size'])) : esc_attr(intval(get_option('mo_login_icon_custom_size')));
680
+ $customBackground = isset( $atts['background'] )? esc_attr($atts['background']) : esc_attr(get_option('mo_login_icon_custom_color'));
681
+ $customTheme = isset( $atts['theme'] )? esc_attr($atts['theme']) : esc_attr(get_option('mo_openid_login_custom_theme'));
682
+ $buttonText = esc_html(get_option('mo_openid_login_button_customize_text'));
683
+ $customTextofTitle = esc_attr(get_option('mo_openid_login_button_customize_text'));
684
+ $logoutUrl = esc_url(wp_logout_url(site_url()));
685
+ $customBoundary = isset( $atts['edge'] )? esc_attr($atts['edge']) : esc_attr(get_option('mo_login_icon_custom_boundary'));
686
+ $customLogoutName = esc_attr(get_option('mo_openid_login_widget_customize_logout_name_text'));
687
+ $customLogoutLink = esc_url(get_option('mo_openid_login_widget_customize_logout_text'));
688
+ $customTextColor= isset( $atts['color'] )? esc_attr($atts['color']) : esc_attr(get_option('mo_login_openid_login_widget_customize_textcolor'));
689
+ $customText=isset( $atts['heading'] )? esc_html($atts['heading']) :esc_html(get_option('mo_openid_login_widget_customize_text'));
690
+
691
+ $facebook_custom_app = esc_attr($this->if_custom_app_exists('facebook'));
692
+ $google_custom_app = esc_attr($this->if_custom_app_exists('google'));
693
+ $twitter_custom_app = esc_attr($this->if_custom_app_exists('twitter'));
694
+ $salesforce_custom_app = esc_attr($this->if_custom_app_exists('salesforce'));
695
+ $linkedin_custom_app = esc_attr($this->if_custom_app_exists('linkedin'));
696
+ $windowslive_custom_app = esc_attr($this->if_custom_app_exists('windowslive'));
697
+ $vkontakte_custom_app = esc_attr($this->if_custom_app_exists('vkontakte'));
698
+ $amazon_custom_app = esc_attr($this->if_custom_app_exists('amazon'));
699
+ $instagram_custom_app = esc_attr($this->if_custom_app_exists('instagram'));
700
+ $yahoo_custom_app = esc_attr($this->if_custom_app_exists('yahoo'));
 
 
701
 
702
  if ($selected_theme == 'longbuttonwithtext') {
703
  $selected_theme = 'longbutton';
711
  } else
712
  $gdpr_setting = '';
713
 
714
+ $url = esc_url(get_option('mo_openid_privacy_policy_url'));
715
+ $text = esc_html(get_option('mo_openid_privacy_policy_text'));
716
 
717
  if (!empty($text) && strpos(get_option('mo_openid_gdpr_consent_message'), $text)) {
718
  $consent_message = str_replace(get_option('mo_openid_privacy_policy_text'), '<a target="_blank" href="' . $url . '">' . $text . '</a>', get_option('mo_openid_gdpr_consent_message'));
962
  jQuery('#mo_openid_consent_checkbox').val(0);
963
  jQuery(".btn-mo").attr("disabled",false);
964
  jQuery(".login-button").removeClass("dis");
 
965
  }
966
  }
967
 
980
  $http = "http://";
981
  }
982
  ?>
983
+ var base_url = '<?php echo esc_url(site_url());?>';
984
  var request_uri = '<?php echo $_SERVER['REQUEST_URI'];?>';
985
  var http = '<?php echo $http;?>';
986
  var http_host = '<?php echo $_SERVER['HTTP_HOST'];?>';
987
+ var default_nonce = '<?php echo wp_create_nonce( 'mo-openid-get-social-login-nonce' ); ?>';
988
+ var custom_nonce = '<?php echo wp_create_nonce( 'mo-openid-oauth-app-nonce' ); ?>';
989
 
990
  if(is_custom_app == 'false'){
991
 
992
  if ( request_uri.indexOf('wp-login.php') !=-1){
993
+ var redirect_url = base_url + '/?option=getmosociallogin&wp_nonce=' + default_nonce + '&app_name=';
994
 
995
 
996
  }else {
997
  var redirect_url = http + http_host + request_uri;
998
  if(redirect_url.indexOf('?') != -1){
999
+ redirect_url = redirect_url +'&option=getmosociallogin&wp_nonce=' + default_nonce + '&app_name=';
1000
 
1001
  }
1002
  else
1003
  {
1004
+ redirect_url = redirect_url +'?option=getmosociallogin&wp_nonce=' + default_nonce + '&app_name=';
1005
 
1006
  }
1007
  }
 
1008
  }
1009
  else {
1010
 
1011
  if ( request_uri.indexOf('wp-login.php') !=-1){
1012
+ var redirect_url = base_url + '/?option=oauthredirect&wp_nonce=' + custom_nonce + '&app_name=';
1013
 
1014
  }else {
1015
  var redirect_url = http + http_host + request_uri;
1016
  if(redirect_url.indexOf('?') != -1)
1017
+ redirect_url = redirect_url +'&option=oauthredirect&wp_nonce=' + custom_nonce + '&app_name=';
1018
  else
1019
+ redirect_url = redirect_url +'?option=oauthredirect&wp_nonce=' + custom_nonce + '&app_name=';
1020
  }
1021
 
1022
  }
1027
  </script>
1028
  <?php
1029
  }
 
 
 
 
 
 
 
 
 
1030
  }
1031
 
1032
  /**
1106
  if ( ! empty( $wid_title ) )
1107
  echo $args['before_title'] . $wid_title . $args['after_title'];
1108
 
1109
+ echo "<div class='mo_openid_vertical' style='" .(isset($alignment) && $alignment != '' && isset($instance[$alignment.'_offset']) ? esc_attr($alignment) .': '. ( $instance[$alignment.'_offset'] == '' ? 0 : esc_attr($instance[$alignment.'_offset'] )) .'px;' : '').(isset($top_offset) ? 'top: '. ( $top_offset == '' ? 0 : esc_attr($top_offset) ) .'px;' : '') ."'>";
1110
 
1111
  $this->show_sharing_buttons_vertical($space_icons);
1112
 
1166
  }
1167
  }
1168
  </script>
1169
+ <label for="<?php echo esc_attr($this->get_field_id( 'alignment' )); ?>">Alignment</label>
1170
+ <select onchange="moOpenIDVerticalSharingOffset(this.value)" style="width: 95%" id="<?php echo esc_attr($this->get_field_id( 'alignment' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'alignment' )); ?>">
1171
  <option value="left" <?php echo $instance['alignment'] == 'left' ? 'selected' : ''; ?>>Left</option>
1172
  <option value="right" <?php echo $instance['alignment'] == 'right' ? 'selected' : ''; ?>>Right</option>
1173
  </select>
1174
  <div class="moVerSharingLeftOffset" <?php echo $instance['alignment'] == 'right' ? 'style="display: none"' : ''; ?>>
1175
+ <label for="<?php echo esc_attr($this->get_field_id( 'left_offset' )); ?>">Left Offset</label>
1176
+ <input style="width: 95%" id="<?php echo esc_attr($this->get_field_id( 'left_offset' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'left_offset' )); ?>" type="text" value="<?php echo $instance['left_offset']; ?>" />px<br/>
1177
  </div>
1178
  <div class="moVerSharingRightOffset" <?php echo $instance['alignment'] == 'left' ? 'style="display: none"' : ''; ?>>
1179
+ <label for="<?php echo esc_attr($this->get_field_id( 'right_offset' )); ?>">Right Offset</label>
1180
+ <input style="width: 95%" id="<?php echo esc_attr($this->get_field_id( 'right_offset' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'right_offset' )); ?>" type="text" value="<?php echo $instance['right_offset']; ?>" />px<br/>
1181
  </div>
1182
+ <label for="<?php echo esc_attr($this->get_field_id( 'top_offset' )); ?>">Top Offset</label>
1183
+ <input style="width: 95%" id="<?php echo esc_attr($this->get_field_id( 'top_offset' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'top_offset' )); ?>" type="text" value="<?php echo $instance['top_offset']; ?>" />px<br/>
1184
+ <label for="<?php echo esc_attr($this->get_field_id( 'space_icons' )); ?>">Space between icons</label>
1185
+ <input style="width: 95%" id="<?php echo esc_attr($this->get_field_id( 'space_icons' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'space_icons' )); ?>" type="text" value="<?php echo $instance['space_icons']; ?>" />px<br/>
1186
  </p>
1187
  <?php
1188
  }
1196
  }
1197
 
1198
  function mo_openid_end_session() {
 
1199
  session_start();
1200
  session_unset(); //unsets all session variables
 
 
 
 
1201
  }
1202
 
1203
  function encrypt_data($data, $key) {
 
1204
  return base64_encode(openssl_encrypt($data, 'aes-128-ecb', $key, OPENSSL_RAW_DATA));
 
1205
  }
1206
 
1207
  function decrypt_data($data, $key) {
1214
 
1215
  if((isset($_POST['action'])) && (strpos($_POST['action'], 'delete_social_profile_data') !== false) && isset($_POST['user_id'])){
1216
  // delete first name, last name, user_url and profile_url from usermeta
1217
+ $id = sanitize_text_field($_POST['user_id']);
1218
+ mo_openid_delete_social_profile($id);
 
 
 
1219
  }
1220
 
1221
  // ajax call - custom app over default app
1222
+ else if ((isset($_POST['selected_app'])) && (isset($_POST['selected_app_value']))){
1223
  if($_POST['selected_app_value'] == 'true'){
1224
  //if custome app enable
1225
+ if($_POST['selected_app']=="facebook") {
 
1226
  update_option('mo_openid_facebook_enable',1);
1227
  }
1228
+ $option = 'mo_openid_enable_custom_app_' . sanitize_text_field($_POST['selected_app']);
1229
  update_option( $option, '1');
1230
  }
1231
  else{
1232
  //if custome app Disable
1233
+ if($_POST['selected_app']=="facebook") {
 
1234
  update_option('mo_openid_facebook_enable',0);
1235
  }
1236
+ $option = 'mo_openid_enable_custom_app_' . sanitize_text_field($_POST['selected_app']);
1237
  update_option( $option, '0');
1238
  }
1239
  exit;
1244
  exit;
1245
  }
1246
 
1247
+ else if( isset($_POST['mo_openid_show_profile_form_nonce']) and isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_show_profile_form' ) !== false ){
1248
+ $nonce = $_POST['mo_openid_show_profile_form_nonce'];
1249
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-user-show-profile-form-nonce' ) ) {
1250
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1251
+ } else {
1252
+ $last_name = sanitize_text_field($_POST["last_name"]);
1253
+ $first_name = sanitize_text_field($_POST["first_name"]);
1254
+ $full_name = sanitize_text_field($_POST["user_full_name"]);
1255
+ $url = sanitize_text_field($_POST["user_url"]);
1256
+ $user_picture = sanitize_text_field($_POST["user_picture"]);
1257
+ $username_field = sanitize_text_field($_POST['username_field']);
1258
+ $email_field = sanitize_email($_POST['email_field']);
1259
+ $decrypted_app_name = sanitize_text_field($_POST["decrypted_app_name"]);
1260
+ $decrypted_user_id = sanitize_text_field($_POST["decrypted_user_id"]);
1261
+ echo mo_openid_profile_completion_form($last_name, $first_name, $full_name, $url, $user_picture, $username_field, $email_field, $decrypted_app_name, $decrypted_user_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1262
  exit;
1263
  }
1264
  }
1265
 
1266
+ else if( isset($_POST['mo_openid_account_linking_nonce']) and isset( $_POST['option'] ) and strpos( $_POST['option'], 'mo_openid_account_linking' ) !== false ){
1267
+ $nonce = $_POST['mo_openid_account_linking_nonce'];
1268
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-account-linking-nonce' ) ) {
1269
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1270
+ } else {
1271
+ mo_openid_start_session();
1272
+ //link account
1273
+ if(!isset($_POST['mo_openid_create_new_account'])){
1274
+ $nonce = wp_create_nonce( 'mo-openid-disable-social-login-nonce' );
1275
+ $url = site_url().'/wp-login.php?option=disable-social-login&wp_nonce=' . $nonce;
1276
+ header('Location:'. $url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1277
  exit;
 
1278
  }
1279
+ //create new account
1280
  else {
1281
+ $username = sanitize_text_field($_POST['username']);
1282
+ $user_email = sanitize_email($_POST['user_email']);
1283
+ $first_name = sanitize_text_field($_POST['first_name']);
1284
+ $last_name = sanitize_text_field($_POST['last_name']);
1285
+ $user_full_name = sanitize_text_field($_POST['user_full_name']);
1286
+ $user_url = sanitize_text_field($_POST['user_url']);
1287
+ $user_picture = sanitize_text_field($_POST['user_picture']);
1288
+ $decrypted_app_name = sanitize_text_field($_POST['decrypted_app_name']);
1289
+ $decrypted_user_id = sanitize_text_field($_POST['decrypted_user_id']);
1290
+
1291
+ mo_openid_process_account_linking($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id);
 
 
 
 
 
 
 
1292
  }
1293
  }
1294
  }
1295
 
1296
+ else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'getmosociallogin' ) !== false ) {
1297
+ if(isset($_REQUEST['wp_nonce'])){
1298
+ $nonce = $_REQUEST['wp_nonce'];
1299
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-get-social-login-nonce' ) ) {
1300
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1301
+ } else {
1302
+ mo_openid_initialize_social_login();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1303
  }
1304
  }
1305
  }
1306
 
1307
+ else if( isset($_POST['mo_openid_profile_form_submitted_nonce']) and isset( $_POST['username_field']) and isset($_POST['email_field']) and $_POST['option'] == 'mo_openid_profile_form_submitted' ){
1308
+ $nonce = $_POST['mo_openid_profile_form_submitted_nonce'];
1309
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-profile-form-submitted-nonce' ) ) {
1310
+ wp_die('<strong>ERROR</strong>: Invalid Request.' . $nonce);
1311
+ } else {
1312
+ $username = sanitize_text_field($_POST['username_field']);
1313
+ $user_email = sanitize_email($_POST['email_field']);
1314
+ $user_picture = sanitize_text_field($_POST["user_picture"]);
1315
+ $user_url = sanitize_text_field($_POST["user_url"]);
1316
+ $last_name = sanitize_text_field($_POST["last_name"]);
1317
+ $user_full_name = sanitize_text_field($_POST["user_full_name"]);
1318
+ $first_name = sanitize_text_field($_POST["first_name"]);
1319
+ $decrypted_app_name = sanitize_text_field($_POST["decrypted_app_name"]);
1320
+ $decrypted_user_id = sanitize_text_field($_POST["decrypted_user_id"]);
1321
+
1322
+ mo_openid_save_profile_completion_form($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1323
  }
1324
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1325
 
1326
+ else if( isset($_POST['mo_openid_user_otp_validation_nonce']) and isset( $_POST['otp_field']) and $_POST['option'] == 'mo_openid_otp_validation' ){
1327
+ $nonce = $_POST['mo_openid_user_otp_validation_nonce'];
1328
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-user-otp-validation-nonce' ) ) {
1329
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1330
+ } else {
1331
+ $username = sanitize_text_field($_POST["username_field"]);
1332
+ $user_email = sanitize_email($_POST["email_field"]);
1333
+ $transaction_id = sanitize_text_field($_POST["transaction_id"]);
1334
+ $otp_token = sanitize_text_field($_POST['otp_field']);
1335
+ $user_picture = sanitize_text_field($_POST["user_picture"]);
1336
+ $user_url = sanitize_text_field($_POST["user_url"]);
1337
+ $last_name = sanitize_text_field($_POST["last_name"]);
1338
+ $user_full_name = sanitize_text_field($_POST["user_full_name"]);
1339
+ $first_name = sanitize_text_field($_POST["first_name"]);
1340
+ $decrypted_app_name = sanitize_text_field($_POST["decrypted_app_name"]);
1341
+ $decrypted_user_id = sanitize_text_field($_POST["decrypted_user_id"]);
1342
+
1343
+ if(isset($_POST['resend_otp'])) {
1344
+ $send_content = send_otp_token($user_email);
1345
+ if($send_content['status']=='FAILURE'){
1346
+ $message ="Error Code 3: ".get_option('mo_email_failure_message');
1347
+ wp_die($message);
1348
  }
1349
+ $transaction_id = $send_content['tId'];
1350
+ echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
1351
 
 
 
1352
  exit;
 
1353
  }
1354
 
1355
+ mo_openid_social_login_validate_otp($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $otp_token, $transaction_id);
1356
  }
1357
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1358
 
1359
+ else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'moopenid' ) !== false ){
1360
+ mo_openid_process_social_login();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1361
  }
1362
 
1363
  else if( isset( $_REQUEST['autoregister'] ) and strpos( $_REQUEST['autoregister'],'false') !== false ) {
1367
  }
1368
 
1369
  else if( isset( $_REQUEST['option'] ) and strpos( $_REQUEST['option'], 'oauthredirect' ) !== false ) {
1370
+ if(isset($_REQUEST['wp_nonce'])){
1371
+ $nonce = $_REQUEST['wp_nonce'];
1372
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-oauth-app-nonce' ) ) {
1373
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1374
+ } else {
1375
+ $appname = sanitize_text_field($_REQUEST['app_name']);
1376
+ mo_openid_custom_app_oauth_redirect($appname);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1377
  }
1378
  }
 
 
 
1379
  }
1380
 
1381
  else if( strpos( $_SERVER['REQUEST_URI'], "openidcallback") !== false ||((strpos( $_SERVER['REQUEST_URI'], "oauth_token")!== false)&&(strpos( $_SERVER['REQUEST_URI'], "oauth_verifier") ) )) {
1382
+ mo_openid_process_custom_app_callback();
1383
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1384
  }
1385
+
1386
  function mo_openid_json_to_htmltable($arr) {
1387
  $str = "<table border='1'><tbody>";
1388
  foreach ($arr as $key => $val) {
1405
 
1406
  function mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name ,$first_name, $decrypted_app_name, $decrypted_user_id,$message = ''){
1407
  $path = mo_openid_get_wp_style();
1408
+ $nonce = wp_create_nonce( 'mo-openid-user-otp-validation-nonce' );
1409
  if($message=='')
 
1410
  $message=get_option('mo_email_verify_message');
 
1411
  else
1412
  $message=get_option('mo_email_verify_wrong_otp');
1413
 
1439
  <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
1440
  <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>'.$message.'</div> <br>
1441
  <p>
1442
+ <label for="user_login">'.esc_html(get_option('mo_email_verify_verification_code_instruction')).'<br/>
1443
  <input type="text" pattern="\d{4,5}" class="input" name="otp_field" value="" size="20" /></label>
1444
  </p>
1445
+ <input type="hidden" name="username_field" value='.esc_attr($username).'>
1446
+ <input type="hidden" name="email_field" value='.esc_attr($user_email).'>
1447
+ <input type="hidden" name="first_name" value='.esc_attr($first_name).'>
1448
+ <input type="hidden" name="last_name" value='.esc_attr($last_name).'>
1449
+ <input type="hidden" name="user_full_name" value='.esc_attr($user_full_name).'>
1450
+ <input type="hidden" name="user_url" value='.esc_url($user_url).'>
1451
+ <input type="hidden" name="user_picture" value='.esc_url($user_picture).'>
1452
+ <input type="hidden" name="transaction_id" value='.esc_attr($transaction_id).'>
1453
+ <input type="hidden" name="decrypted_app_name" value='.esc_attr($decrypted_app_name).'>
1454
+ <input type="hidden" name="decrypted_user_id" value='.esc_attr($decrypted_user_id).'>
1455
  <input type="hidden" name="option" value="mo_openid_otp_validation">
1456
+ <input type="hidden" name="mo_openid_user_otp_validation_nonce" value="'.$nonce.'"/>
1457
  </div>
1458
  <div style="float: right;margin-right: 11px;">
1459
  <input type="submit" style="margin-left:10px" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
1467
  if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
1468
  $html .= mo_openid_customize_logo();
1469
  }
1470
+ $nonce = wp_create_nonce( 'mo-openid-user-show-profile-form-nonce' );
1471
  $html.= '</form>
1472
  <form style="display:none;" name="go_back_form" id="go_back_form" method="post">
1473
  <input hidden name="option" value="mo_openid_show_profile_form"/>
1474
+ <input type="hidden" name="mo_openid_show_profile_form_nonce" value="'.$nonce.'"/>
1475
+ <input type="hidden" name="username_field" value='.esc_attr($username).'>
1476
+ <input type="hidden" name="email_field" value='.esc_attr($user_email).'>
1477
+ <input type="hidden" name="first_name" value='.esc_attr($first_name).'>
1478
+ <input type="hidden" name="last_name" value='.esc_attr($last_name).'>
1479
+ <input type="hidden" name="user_full_name" value='.esc_attr($user_full_name).'>
1480
+ <input type="hidden" name="user_url" value='.esc_url($user_url).'>
1481
+ <input type="hidden" name="user_picture" value='.esc_url($user_picture).'>
1482
+ <input type="hidden" name="transaction_id" value='.esc_attr($transaction_id).'>
1483
+ <input type="hidden" name="decrypted_app_name" value='.esc_attr($decrypted_app_name).'>
1484
+ <input type="hidden" name="decrypted_user_id" value='.esc_attr($decrypted_user_id).'>
1485
  </form>
1486
  </div>
1487
  </div>
1496
 
1497
  function mo_openid_username_already_exists($last_name,$first_name,$user_full_name,$user_url,$user_picture,$username,$user_email, $decrypted_app_name, $decrypted_user_id){
1498
  $path = mo_openid_get_wp_style();
1499
+ $nonce = wp_create_nonce( 'mo-openid-user-profile-form-submitted-nonce' );
1500
  $html = '<style>.form-input-validation.is-error {color: #d94f4f;}</style>
1501
  <style>
1502
  .mocomp {
1522
  <form name="f" method="post" action="">
1523
  <div style="background: white;margin-top:-15px;padding: 15px;">
1524
 
1525
+ <div style="text-align:center"><span style="font-size: 24px;font-family: Arial">'.esc_html(get_option('mo_profile_complete_title')).'</span></div>
1526
  <p><br>
1527
+ <label for="user_login">'.esc_html(get_option('mo_profile_complete_username_label')).'<br/>
1528
+ <input type="text" class="input" name="username_field" value='.esc_attr($username).' size="20" required>
1529
+ <span align="center" class="form-input-validation is-error">'.esc_html(get_option('mo_profile_complete_uname_exist')).'</span>
1530
  </label>
1531
  </p>
1532
  <br>
1534
  <label for="user_pass">'.get_option('mo_profile_complete_email_label').'<br/>
1535
  <input type="email" name="email_field" class="input" value='.$user_email.' size="20" required></label>
1536
  </p>
1537
+ <input type="hidden" name="first_name" value='.esc_attr($first_name).'>
1538
+ <input type="hidden" name="last_name" value='.esc_attr($last_name).'>
1539
+ <input type="hidden" name="user_full_name" value='.esc_attr($user_full_name).'>
1540
+ <input type="hidden" name="user_url" value='.esc_url($user_url).'>
1541
+ <input type="hidden" name="user_picture" value='.esc_url($user_picture).'>
1542
+ <input type="hidden" name="decrypted_app_name" value='.esc_attr($decrypted_app_name).'>
1543
+ <input type="hidden" name="decrypted_user_id" value='.esc_attr($decrypted_user_id).'>
1544
  <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
1545
+ <input type="hidden" name="mo_openid_user_profile_form_submitted_nonce" value="'.$nonce.'"/>
1546
  </div>
1547
  <p class="submit">
1548
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
1562
 
1563
  function mo_openid_profile_completion_form($last_name,$first_name,$user_full_name,$user_url,$user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id){
1564
  $path = mo_openid_get_wp_style();
1565
+ $nonce = wp_create_nonce( 'mo-openid-profile-form-submitted-nonce' );
1566
  $html = '<style>.form-input-validation.note {color: #d94f4f;}</style>
1567
  <style>
1568
  .mocomp {
1586
  <form name="f" method="post" action="">
1587
  <div style="background: white;margin-top:-15px;padding: 15px;">
1588
 
1589
+ <div style="text-align:center"><span style="font-size: 24px;font-family: Arial">'.esc_html(get_option('mo_profile_complete_title')).'</span></div><br>
1590
  <div style="padding: 12px;"></div>
1591
  <div style=" padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;">
1592
+ <span style=" margin-left: 15px;color: black;font-weight: bold;float: right;font-size: 22px;line-height: 20px;cursor: pointer;font-family: Arial;transition: 0.3s"></span>'.esc_html(get_option('mo_profile_complete_instruction')).'</div><br>
1593
  <p>
1594
+ <label for="user_login">'.esc_html(get_option('mo_profile_complete_username_label')).'<br/>
1595
+ <input type="text" class="input" name="username_field" size="20" required value='.esc_attr($decrypted_user_name).'></label>
1596
  </p>
1597
  <p>
1598
+ <label for="user_pass">'.esc_html(get_option('mo_profile_complete_email_label')).'<br/>
1599
+ <input type="email" class="input" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+$" name="email_field" size="20" required value='.esc_attr($decrypted_email).'></label>
1600
+ <span align="center" class="form-input-validation note">'.esc_html(get_option('mo_profile_complete_extra_instruction')).'</span>
1601
  </p>
1602
+ <input type="hidden" name="first_name" value='.esc_attr($first_name).'>
1603
+ <input type="hidden" name="last_name" value='.esc_attr($last_name).'>
1604
+ <input type="hidden" name="user_full_name" value='.esc_attr($user_full_name).'>
1605
+ <input type="hidden" name="user_url" value='.esc_url($user_url).'>
1606
+ <input type="hidden" name="user_picture" value='.esc_url($user_picture).'>
1607
+ <input type="hidden" name="decrypted_app_name" value='.esc_attr($decrypted_app_name).'>
1608
+ <input type="hidden" name="decrypted_user_id" value='.esc_attr($decrypted_user_id).'>
1609
  <input type="hidden" name="option" value="mo_openid_profile_form_submitted">
1610
+ <input type="hidden" name="mo_openid_profile_form_submitted_nonce" value="'.$nonce.'"/>
1611
  </div>
1612
  <p class="submit">
1613
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="'.get_option('mo_profile_complete_submit_button').'"/>
1626
 
1627
  function mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id){
1628
  $path = mo_openid_get_wp_style();
1629
+ $nonce = wp_create_nonce( 'mo-openid-account-linking-nonce' );
1630
  $html = "
1631
  <style>
1632
  .mocomp {
1648
  <div class='mocomp'>
1649
  <form name = 'f' method = 'post' action='' style='margin-left: 2%;margin-right: 2%;'>
1650
  <input type = 'hidden' name = 'option' value = 'mo_openid_account_linking'/>
1651
+ <input type='hidden' name='mo_openid_account_linking_nonce' value='". $nonce."'/>
1652
+ <input type='hidden' name='user_email' value=".esc_attr($user_email).">
1653
+ <input type='hidden' name='username' value=".esc_attr($username).">
1654
+ <input type='hidden' name='first_name' value=".esc_attr($first_name).">
1655
+ <input type='hidden' name='last_name' value=".esc_attr($last_name).">
1656
+ <input type='hidden' name='user_full_name' value=".esc_attr($user_full_name).">
1657
+ <input type='hidden' name='user_url' value=".esc_url($user_url).">
1658
+ <input type='hidden' name='user_picture' value=".esc_url($user_picture).">
1659
+ <input type='hidden' name='decrypted_app_name' value=".esc_attr($decrypted_app_name).">
1660
+ <input type='hidden' name='decrypted_user_id' value=".esc_attr($decrypted_user_id).">
1661
  <div style = 'background-color:white; padding:12px; top:100px; right: 350px; padding-bottom: 20px;left:350px; overflow:hidden; outline:1px black;border-radius: 5px;'>
1662
 
1663
  <br>
1664
+ <div style=\"text-align:center\"><span style='font-size: 24px;font-family: Arial;text-align:center'>".esc_html(get_option('mo_account_linking_title'))."</span></div><br>
1665
  <div style='padding: 12px;'></div>
1666
  <div style=' padding: 16px;background-color:rgba(1, 145, 191, 0.117647);color: black;'>".get_option('mo_account_linking_new_user_instruction').".<br><br>".get_option('mo_account_linking_existing_user_instruction')."".get_option('mo_account_linking_extra_instruction')."
1667
  </div>
1668
  <br><br>
1669
 
1670
+ <input type = 'submit' value = '".esc_attr(get_option('mo_account_linking_existing_user_button'))."' name = 'mo_openid_link_account' class='button button-primary button-large' style = 'margin-left: 3%;margin-right: 0%;'/>
1671
 
1672
+ <input type = 'submit' value = '".esc_attr(get_option('mo_account_linking_new_user_button'))."' name = 'mo_openid_create_new_account' class='button button-primary button-large' style = 'margin-left: 5%margin-right: 5%;'/>";
1673
 
1674
  if(get_option('mo_openid_oauth')=='1' && get_option('moopenid_logo_check') == 1) {
1675
  $html .= mo_openid_customize_logo();
1703
  }
1704
  mo_openid_start_session();
1705
 
1706
+ $user_email = isset($_SESSION['user_email']) ? sanitize_text_field($_SESSION['user_email']):'';
1707
+ $social_app_identifier = isset($_SESSION['social_user_id']) ? sanitize_text_field($_SESSION['social_user_id']):'';
1708
+ $social_app_name = isset($_SESSION['social_app_name']) ? sanitize_text_field($_SESSION['social_app_name']):'';
1709
 
1710
  //if user is coming through default wordpress login, do not proceed further and return
1711
  if(isset($userid) && empty($social_app_identifier) && empty($social_app_name) ) {
1756
  )
1757
  );
1758
  if($result === false){
1759
+ wp_die('Error in insert query');
1760
+ $wpdb->show_errors();
1761
  $wpdb->print_error();
1762
+ exit;
 
1763
  }
1764
  }
1765
  }
1992
  global $wpdb;
1993
  $db_prefix = $wpdb->prefix;
1994
  $result = $wpdb->get_var($wpdb->prepare("DELETE from ".$db_prefix."mo_openid_linked_user where user_id = %s ",$user_id));
1995
+ if($result === false){
 
 
 
1996
  wp_die(get_option('mo_delete_user_error_message'));
1997
+ $wpdb->show_errors();
1998
+ $wpdb->print_error();
1999
+ exit;
2000
  }
2001
  }
2002
 
2035
  $columns['mo_openid_delete_profile_data'] = 'Delete Social Profile Data';
2036
  return $columns;
2037
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2038
 
2039
  function mo_openid_delete_social_profile_script(){
2040
  ?>
2056
 
2057
  }
2058
 
 
 
2059
  function mo_openid_sanitize_user($username, $raw_username, $strict) {
2060
 
2061
  $username = wp_strip_all_tags( $raw_username );
2071
  return $username;
2072
  }
2073
 
2074
+ add_filter('manage_users_columns', 'mo_openid_add_custom_column');
2075
+
2076
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_login_wid" );});
2077
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_ver_wid" );});
2078
+ add_action( 'widgets_init', function(){register_widget( "mo_openid_sharing_hor_wid" );});
2079
+
2080
+ add_action( 'init', 'mo_openid_login_validate' );
2081
+ add_action( 'wp_logout', 'mo_openid_end_session',1 );
2082
+ add_action( 'mo_user_register', 'mo_openid_update_role', 1, 2);
2083
+ add_action( 'wp_login', 'mo_openid_login_redirect', 10, 2);
2084
+ add_action( 'wp_login', 'mo_openid_link_account', 9, 2);
2085
+ add_filter( 'login_message', 'mo_openid_account_linking');
2086
+ add_action( 'delete_user', 'mo_openid_delete_account_linking_rows' );
2087
+ add_action( 'mo_user_register','mo_openid_send_email',1, 2 );
2088
+ add_action('admin_head', 'mo_openid_delete_social_profile_script');
2089
+
2090
+ //compatibility with international characters
2091
+ add_filter('sanitize_user', 'mo_openid_sanitize_user', 10, 3);
2092
+
2093
  ?>
class-mo-openid-social-comment.php CHANGED
@@ -8,24 +8,24 @@
8
  function moOpenIDShowCommentForms() {
9
  var commentFormElement = document.getElementById("respond");
10
  if (commentFormElement) {
11
- <?php wp_enqueue_script('moopenid-comment-fb', plugins_url('includes/js/social/fb_comment.js', __FILE__), array('jquery'));?>
12
- var commentForm = '<div><h3 id="mo_reply_label" class="comment-reply-title"><?php echo get_option("mo_openid_social_comment_heading_label") ?></h3><br/><ul class="mo_openid_comment_tab">';
13
  <?php if(get_option('mo_openid_social_comment_default')){ $commentsCount = wp_count_comments($post->ID); ?>
14
- commentForm += '<li id="moopenid_social_comment_default" class="mo_openid_selected_tab"><?php echo get_option("mo_openid_social_comment_default_label") ?>(<?php echo($commentsCount && isset($commentsCount->approved) ? $commentsCount->approved : '') ?>)</li>';
15
  <?php } if(get_option('mo_openid_social_comment_fb')){ ?>
16
- commentForm += '<li id="moopenid_social_comment_fb"><?php echo get_option("mo_openid_social_comment_fb_label") ?></li>';
17
  <?php } if(get_option('mo_openid_social_comment_google')){ ?>
18
- commentForm += '<li id="moopenid_social_comment_google"><?php echo get_option("mo_openid_social_comment_google_label") ?></li>';
19
  <?php } ?>
20
  commentForm += '</ul>';
21
  commentForm += '<br/><div id="moopenid_comment_form_default" style="display:none;">';
22
  commentForm += document.getElementById("respond").innerHTML;
23
  commentForm += '</div>';
24
- commentForm += '<div id="moopenid_comment_form_fb" style="display:none;"><div class="fb-comments" data-href=' + '"<?php echo $url ?>"' + '></div></div>';
25
  commentForm += '<br/><div id="moopenid_comment_form_google" style="display:none;"></div>';
26
  commentForm += '</div>';
27
  document.getElementById("respond").innerHTML = commentForm;
28
- document.getElementById("reply-title") && jQuery("#reply-title").remove();
29
 
30
  <?php $mo_disqus_shortname = get_option("mo_openid_social_comment_disqus_shortname"); ?>
31
  var sg1 = document.createElement("script");
8
  function moOpenIDShowCommentForms() {
9
  var commentFormElement = document.getElementById("respond");
10
  if (commentFormElement) {
11
+ <?php wp_enqueue_script( 'moopenid-comment-fb',plugins_url('includes/js/social/fb_comment.js', __FILE__), array('jquery'));?>
12
+ var commentForm = '<div><h3 id="mo_reply_label" class="comment-reply-title"><?php echo esc_attr(get_option("mo_openid_social_comment_heading_label")) ?></h3><br/><ul class="mo_openid_comment_tab">';
13
  <?php if(get_option('mo_openid_social_comment_default')){ $commentsCount = wp_count_comments($post->ID); ?>
14
+ commentForm += '<li id="moopenid_social_comment_default" class="mo_openid_selected_tab"><?php echo esc_html(get_option("mo_openid_social_comment_default_label")) ?>(<?php echo ($commentsCount && isset($commentsCount -> approved) ? esc_html($commentsCount -> approved) : '') ?>)</li>';
15
  <?php } if(get_option('mo_openid_social_comment_fb')){ ?>
16
+ commentForm += '<li id="moopenid_social_comment_fb"><?php echo esc_html(get_option("mo_openid_social_comment_fb_label")) ?></li>';
17
  <?php } if(get_option('mo_openid_social_comment_google')){ ?>
18
+ commentForm += '<li id="moopenid_social_comment_google"><?php echo esc_html(get_option("mo_openid_social_comment_google_label")) ?></li>';
19
  <?php } ?>
20
  commentForm += '</ul>';
21
  commentForm += '<br/><div id="moopenid_comment_form_default" style="display:none;">';
22
  commentForm += document.getElementById("respond").innerHTML;
23
  commentForm += '</div>';
24
+ commentForm += '<div id="moopenid_comment_form_fb" style="display:none;"><div class="fb-comments" data-href=' + '"<?php echo esc_url($url) ?>"' + '></div></div>';
25
  commentForm += '<br/><div id="moopenid_comment_form_google" style="display:none;"></div>';
26
  commentForm += '</div>';
27
  document.getElementById("respond").innerHTML = commentForm;
28
+ document.getElementById("reply-title")&&jQuery("#reply-title").remove();
29
 
30
  <?php $mo_disqus_shortname = get_option("mo_openid_social_comment_disqus_shortname"); ?>
31
  var sg1 = document.createElement("script");
class-mo-openid-social-login-functions.php ADDED
@@ -0,0 +1,1197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function mo_openid_delete_social_profile($id){
4
+ // delete first name, last name, user_url and profile_url from usermeta
5
+ global $wpdb;
6
+ $metakey1 = 'first_name';
7
+ $metakey2 = 'last_name';
8
+ $metakey3 = 'moopenid_user_avatar';
9
+ $metakey4 = 'moopenid_user_profile_url';
10
+ $wpdb->query($wpdb->prepare('DELETE from '.$wpdb->prefix.'usermeta where user_id = %d and (meta_key = %s or meta_key = %s or meta_key = %s or meta_key = %s)',$id,$metakey1,$metakey2,$metakey3,$metakey4));
11
+ update_user_meta($id,'mo_openid_data_deleted','1');
12
+ exit;
13
+ }
14
+
15
+ function mo_openid_process_account_linking($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id){
16
+ mo_openid_start_session();
17
+
18
+ if(get_option('mo_openid_auto_register_enable')) {
19
+
20
+ $random_password = wp_generate_password( 10, false );
21
+ global $wpdb;
22
+ $db_prefix = $wpdb->prefix;
23
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $username));
24
+
25
+ if( !empty($username_user_id) ){
26
+ $email_explode = explode('@',$user_email );
27
+ $user_new_name = $email_explode[0];
28
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $user_new_name));
29
+ $i = 1;
30
+ $uname='';
31
+ while(!empty($username_user_id) ){
32
+ $uname=$user_new_name .'_'.$i;
33
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
34
+ $i++;
35
+ if(empty($username_user_id)){
36
+ $user_new_name=$uname;
37
+ }
38
+ }
39
+
40
+ if( !empty($username_user_id) ){
41
+ wp_die("Error Code 1: ".get_option('mo_existing_username_error_message'));
42
+ }
43
+ $username = $user_new_name;
44
+ }
45
+
46
+ $meta_user_url = $user_url;
47
+
48
+ if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name =='facebook'){
49
+ $user_url = '';
50
+ }
51
+
52
+ $userdata = array(
53
+ 'user_login' => $username,
54
+ 'user_email' => $user_email,
55
+ 'user_pass' => $random_password,
56
+ 'display_name' => $user_full_name,
57
+ 'first_name' => $first_name,
58
+ 'last_name' => $last_name,
59
+ 'user_url' => $user_url,
60
+ );
61
+
62
+ $user_id = wp_insert_user( $userdata);
63
+
64
+ if(is_wp_error( $user_id )) {
65
+ print_r($user_id);
66
+ wp_die("Error Code 1: ".get_option('mo_registration_error_message'));
67
+ }
68
+
69
+ update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
70
+
71
+ $user = get_user_by('id', $user_id );
72
+
73
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
74
+ update_user_meta($user_id, 'moopenid_user_avatar',$user_picture);
75
+ }
76
+
77
+ mo_openid_start_session();
78
+
79
+ $_SESSION['mo_login'] = true;
80
+ do_action( 'mo_user_register', $user_id,$meta_user_url);
81
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
82
+ do_action( 'wp_login', $user->user_login, $user );
83
+ wp_set_auth_cookie( $user_id, true );
84
+ }
85
+ //end of create account block
86
+
87
+ $redirect_url = mo_openid_get_redirect_url();
88
+ wp_redirect($redirect_url);
89
+ exit;
90
+ }
91
+
92
+ function mo_openid_initialize_social_login(){
93
+ $client_name = "wordpress";
94
+ $timestamp = round( microtime(true) * 1000 );
95
+ $api_key = get_option('mo_openid_admin_api_key');
96
+ $token = $client_name . ':' . number_format($timestamp, 0, '', ''). ':' . $api_key;
97
+
98
+ $customer_token = get_option('mo_openid_customer_token');
99
+ $encrypted_token = encrypt_data($token,$customer_token);
100
+ $encoded_token = urlencode( $encrypted_token );
101
+
102
+ $userdata = get_option('moopenid_user_attributes')?'true':'false';
103
+
104
+ $http = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
105
+
106
+ $parts = parse_url($http . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
107
+ parse_str($parts['query'], $query);
108
+ $post = isset( $query['p'] ) ? '?p=' . $query['p'] : '';
109
+
110
+ $base_return_url = $http . $_SERVER["HTTP_HOST"] . strtok($_SERVER["REQUEST_URI"],'?') . $post;
111
+
112
+ $return_url = strpos($base_return_url, '?') !== false ? urlencode( $base_return_url . '&option=moopenid' ): urlencode( $base_return_url . '?option=moopenid' );
113
+
114
+ $url = get_option('mo_openid_host_name') . '/moas/openid-connect/client-app/authenticate?token=' . $encoded_token . '&userdata=' . $userdata. '&id=' . get_option('mo_openid_admin_customer_key') . '&encrypted=true&app=' . $_REQUEST['app_name'] . '_oauth&returnurl=' . $return_url . '&encrypt_response=true';
115
+ wp_redirect($url);
116
+ exit;
117
+ }
118
+
119
+ function mo_openid_save_profile_completion_form($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id){
120
+ if(!isset($_POST['otp_field'])) {
121
+ $user_email = sanitize_email($user_email);
122
+ $username = preg_replace('/[\x00-\x1F][\x7F][\x81][\x8D][\x8F][\x90][\x9D][\xA0][\xAD]/', '', $username);
123
+
124
+ global $wpdb;
125
+ if(empty($user_email)){
126
+ $email_user_id = NULL;
127
+ }
128
+ else {
129
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email));
130
+ }
131
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
132
+
133
+ //if email exists, dont check if username is in db or not, send otp and get it over wordpress
134
+ if( isset($email_user_id)){
135
+
136
+ $send_content = send_otp_token($user_email);
137
+ if($send_content['status']=='FAILURE'){
138
+ $message ="Error Code 1: ".get_option('mo_email_failure_message');
139
+ wp_die($message);
140
+ }
141
+
142
+ $transaction_id = $send_content['tId'];
143
+ echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url,$last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
144
+ exit;
145
+
146
+ }
147
+ //email doesnt exist, check if username is in db or not, acc show form and proceed further
148
+ else {
149
+
150
+ if( isset($username_user_id) ){
151
+ echo mo_openid_username_already_exists($last_name, $first_name, $user_full_name, $user_url, $user_picture, $username, $user_email, $decrypted_app_name, $decrypted_user_id);
152
+ exit;
153
+ }
154
+ else {
155
+
156
+ $send_content = send_otp_token($user_email);
157
+ if($send_content['status']=='FAILURE'){
158
+ $message ="Error Code 2: ".get_option('mo_email_failure_message');
159
+ wp_die($message);
160
+ }
161
+
162
+ $transaction_id = $send_content['tId'];
163
+ echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id);
164
+ exit;
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
+ function mo_openid_social_login_validate_otp($username, $user_email, $first_name, $last_name, $user_full_name, $user_url, $user_picture, $decrypted_app_name, $decrypted_user_id, $otp_token, $transaction_id){
171
+
172
+ $validate_content = validate_otp_token($transaction_id, $otp_token);
173
+ $status = $validate_content['status'];
174
+
175
+ //if invalid OTP
176
+ if($status == 'FAILURE'){
177
+ $message = 'You have entered an invalid verification code. Enter a valid code.';
178
+ echo mo_openid_validate_otp_form($username, $user_email, $transaction_id, $user_picture, $user_url, $last_name, $user_full_name,$first_name, $decrypted_app_name, $decrypted_user_id,$message);
179
+ exit;
180
+
181
+ }
182
+ //if OTP is Valid
183
+ else{
184
+ global $wpdb;
185
+ $db_prefix = $wpdb->prefix;
186
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = %s",$user_email));
187
+ if(empty($user_email)){
188
+ $existing_email_user_id = NULL;
189
+ }
190
+ else {
191
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
192
+ }
193
+
194
+ // if linked user exists log him in
195
+ mo_openid_start_session();
196
+ if(isset($email_user_id) || isset($existing_email_user_id) )
197
+ {
198
+ $email_user_id = isset($email_user_id)? $email_user_id:$existing_email_user_id;
199
+
200
+ mo_openid_start_session();
201
+ $_SESSION['username'] = $username;
202
+ $_SESSION['user_email'] = $user_email;
203
+ $_SESSION['user_full_name'] = $user_full_name;
204
+ $_SESSION['first_name'] = $first_name;
205
+ $_SESSION['last_name'] = $last_name;
206
+ $_SESSION['user_url'] = $user_url;
207
+ $_SESSION['user_picture'] = $user_picture;
208
+ $_SESSION['social_app_name'] = $decrypted_app_name;
209
+ $_SESSION['social_user_id'] = $decrypted_user_id;
210
+
211
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
212
+ update_user_meta($email_user_id, 'moopenid_user_avatar', $user_picture);
213
+ $_SESSION['mo_login'] = true;
214
+
215
+ $user = get_user_by('id', $email_user_id );
216
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
217
+ do_action( 'wp_login', $user->user_login, $user );
218
+ wp_set_auth_cookie( $email_user_id, true );
219
+ }
220
+ // if account linking is enable and email is set
221
+ else if ( get_option('mo_openid_account_linking_enable') && (!mo_openid_restrict_user())){
222
+ mo_openid_start_session();
223
+ $_SESSION['username'] = $username;
224
+ $_SESSION['user_email'] = $user_email;
225
+ $_SESSION['user_full_name'] = $user_full_name;
226
+ $_SESSION['first_name'] = $first_name;
227
+ $_SESSION['last_name'] = $last_name;
228
+ $_SESSION['user_url'] = $user_url;
229
+ $_SESSION['user_picture'] = $user_picture;
230
+ $_SESSION['social_app_name'] = $decrypted_app_name;
231
+ $_SESSION['social_user_id'] = $decrypted_user_id;
232
+
233
+ echo mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
234
+ exit;
235
+ }
236
+ // else register
237
+ else{
238
+ //check if auto-registration is enabled
239
+ if(get_option('mo_openid_auto_register_enable')) {
240
+
241
+ $random_password = wp_generate_password( 10, false );
242
+ $user_profile_url = $user_url;
243
+
244
+ if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
245
+ $user_url = '';
246
+ }
247
+
248
+ $userdata = array(
249
+ 'user_login' => $username,
250
+ 'user_email' => $user_email,
251
+ 'user_pass' => $random_password,
252
+ 'display_name' => $user_full_name,
253
+ 'first_name' => $first_name,
254
+ 'last_name' => $last_name,
255
+ 'user_url' => $user_url,
256
+ );
257
+
258
+ $user_id = wp_insert_user( $userdata);
259
+
260
+ if(is_wp_error( $user_id )) {
261
+ print_r($user_id);
262
+ wp_die("Error Code 2: ".get_option('mo_registration_error_message'));
263
+ }
264
+
265
+ $_SESSION['social_app_name'] = $decrypted_app_name;
266
+ $_SESSION['user_email'] = $user_email;
267
+ $_SESSION['social_user_id'] = $decrypted_user_id;
268
+
269
+ $user = get_user_by('email', $user_email );
270
+
271
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
272
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
273
+ }
274
+ $_SESSION['mo_login'] = true;
275
+ do_action( 'mo_user_register', $user_id, $user_profile_url);
276
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
277
+ do_action( 'wp_login', $user->user_login, $user );
278
+ wp_set_auth_cookie( $user_id, true );
279
+ }
280
+
281
+ $redirect_url = mo_openid_get_redirect_url();
282
+ wp_redirect($redirect_url);
283
+ exit;
284
+ }
285
+ }
286
+ }
287
+
288
+ function mo_openid_process_social_login(){
289
+ if( is_user_logged_in()){
290
+ return;
291
+ }
292
+
293
+ //Decrypt all entries
294
+ $decrypted_email = isset($_POST['email']) ? mo_openid_decrypt_sanitize($_POST['email']): '';
295
+ $decrypted_user_name = isset($_POST['username']) ? mo_openid_decrypt_sanitize($_POST['username']): '';
296
+ $decrypted_user_picture = isset($_POST['profilePic']) ? mo_openid_decrypt_sanitize($_POST['profilePic']): '';
297
+ $decrypted_user_url = isset($_POST['profileUrl']) ? mo_openid_decrypt_sanitize($_POST['profileUrl']): '';
298
+ $decrypted_first_name = isset($_POST['firstName']) ? mo_openid_decrypt_sanitize($_POST['firstName']): '';
299
+ $decrypted_last_name = isset($_POST['lastName']) ? mo_openid_decrypt_sanitize($_POST['lastName']): '';
300
+ $decrypted_app_name = isset($_POST['appName']) ? mo_openid_decrypt_sanitize($_POST['appName']): '';
301
+ $decrypted_user_id = isset($_POST['userid']) ? mo_openid_decrypt_sanitize($_POST['userid']): '';
302
+
303
+
304
+ $decrypted_user_name = str_replace(' ', '-', $decrypted_user_name);
305
+ $decrypted_user_name = sanitize_user($decrypted_user_name, true);
306
+
307
+ if($decrypted_user_name == '-' || $decrypted_user_name == ''){
308
+ $splitemail = explode('@', $decrypted_email);
309
+ $decrypted_user_name = $splitemail[0];
310
+ }
311
+
312
+ $decrypted_app_name = mo_openid_filter_app_name($decrypted_app_name);
313
+
314
+ if(isset( $raw_first_name ) && isset( $raw_last_name )){
315
+ if(strcmp($decrypted_first_name, $decrypted_last_name)!=0)
316
+ $user_full_name = $decrypted_first_name.' '.$decrypted_last_name;
317
+ else
318
+ $user_full_name = $decrypted_first_name;
319
+ $first_name = $decrypted_first_name;
320
+ $last_name = $decrypted_last_name;
321
+ }
322
+ else{
323
+ $user_full_name = $decrypted_user_name;
324
+ $first_name = '';
325
+ $last_name = '';
326
+ }
327
+ //Set Display Picture
328
+ $user_picture = $decrypted_user_picture;
329
+
330
+ //Set User URL
331
+ $user_url = $decrypted_user_url;
332
+
333
+ //if email or username not returned from app
334
+ if ( empty($decrypted_email) || empty($decrypted_user_name) ){
335
+
336
+ //check if provider + identifier group exists
337
+ global $wpdb;
338
+ $db_prefix = $wpdb->prefix;
339
+ $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
340
+ if(empty($decrypted_email)){
341
+ $email_user_id = NULL;
342
+ }
343
+ else {
344
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
345
+ }
346
+ mo_openid_start_session();
347
+ // if returning user whose appname + identifier exists, log him in
348
+ if((isset($id_returning_user)) || (isset($email_user_id)) ){
349
+ if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
350
+ $id_returning_user = $email_user_id;
351
+ mo_openid_insert_query($decrypted_app_name,$decrypted_email,$id_returning_user,$decrypted_user_id);
352
+ }
353
+ $user = get_user_by('id', $id_returning_user );
354
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
355
+ update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
356
+ $_SESSION['mo_login'] = true;
357
+ $_SESSION['social_app_name'] = $decrypted_app_name;
358
+ $_SESSION['user_email'] = $decrypted_email;
359
+ $_SESSION['social_user_id'] = $decrypted_user_id;
360
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
361
+ do_action( 'wp_login', $user->user_login, $user );
362
+ wp_set_auth_cookie( $id_returning_user, true );
363
+ }
364
+ // if new user and profile completion is enabled
365
+ elseif (get_option('mo_openid_enable_profile_completion')){
366
+ echo mo_openid_profile_completion_form($last_name, $first_name, $user_full_name, $user_url, $user_picture, $decrypted_user_name, $decrypted_email, $decrypted_app_name, $decrypted_user_id);
367
+ exit;
368
+ }
369
+ // if new user and profile completion and account linking is disabled, auto create dummy data and register user
370
+ else{
371
+ // auto registration is enabled
372
+ if(get_option('mo_openid_auto_register_enable')) {
373
+
374
+ if(!empty($decrypted_email))
375
+ {
376
+ $split_email = explode('@',$decrypted_email);
377
+ $username = $split_email[0];
378
+ $user_email = $decrypted_email;
379
+ }
380
+ else if(!empty($decrypted_user_name))
381
+ {
382
+ $split_app_name = explode('_',$decrypted_app_name);
383
+ $username = $decrypted_user_name;
384
+ $user_email = $decrypted_user_name.'@'.$split_app_name[0].'.com';
385
+ }
386
+ else
387
+ {
388
+ $split_app_name = explode('_',$decrypted_app_name);
389
+ $username = 'user_'.get_option('mo_openid_user_count');
390
+ $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
391
+ }
392
+ // remove white space from email
393
+ $user_email = str_replace(' ', '', $user_email);
394
+
395
+ //account linking
396
+ if ( get_option('mo_openid_account_linking_enable') && (!mo_openid_restrict_user())){
397
+ mo_openid_start_session();
398
+ $_SESSION['username'] = $decrypted_user_name;
399
+ $_SESSION['user_email'] = $user_email;
400
+ $_SESSION['user_full_name'] = $user_full_name;
401
+ $_SESSION['first_name'] = $first_name;
402
+ $_SESSION['last_name'] = $last_name;
403
+ $_SESSION['user_url'] = $user_url;
404
+ $_SESSION['user_picture'] = $user_picture;
405
+ $_SESSION['social_app_name'] = $decrypted_app_name;
406
+ $_SESSION['social_user_id'] = $decrypted_user_id;
407
+
408
+ echo mo_openid_account_linking_form($decrypted_user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
409
+ exit;
410
+ }
411
+
412
+ $random_password = wp_generate_password( 10, false );
413
+ $user_profile_url = $user_url;
414
+
415
+ if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
416
+ $user_url = '';
417
+ }
418
+
419
+ $userdata = array(
420
+ 'user_login' => $username,
421
+ 'user_email' => $user_email,
422
+ 'user_pass' => $random_password,
423
+ 'display_name' => $user_full_name,
424
+ 'first_name' => $first_name,
425
+ 'last_name' => $last_name,
426
+ 'user_url' => $user_url,
427
+ );
428
+
429
+ $user_id = wp_insert_user( $userdata);
430
+ if(is_wp_error( $user_id )) {
431
+ print_r($user_id);
432
+ wp_die("Error Code 3: ".get_option('mo_registration_error_message'));
433
+ }
434
+
435
+ update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
436
+
437
+ $_SESSION['social_app_name'] = $decrypted_app_name;
438
+ $_SESSION['user_email'] = $user_email;
439
+ $_SESSION['social_user_id'] = $decrypted_user_id;
440
+
441
+ $user = get_user_by('id', $user_id );
442
+
443
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
444
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
445
+ }
446
+ $_SESSION['mo_login'] = true;
447
+
448
+ //registration hook
449
+ do_action( 'mo_user_register', $user_id, $user_profile_url);
450
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
451
+ //login hook
452
+ do_action( 'wp_login', $user->user_login, $user );
453
+ wp_set_auth_cookie( $user_id, true );
454
+ }
455
+
456
+ $redirect_url = mo_openid_get_redirect_url();
457
+ wp_redirect($redirect_url);
458
+ exit;
459
+ }
460
+ }
461
+ //email and username are both returned..dont show profile completion
462
+ else{
463
+
464
+ global $wpdb;
465
+ $user_email = sanitize_email($decrypted_email);
466
+ $username = $decrypted_user_name;
467
+
468
+ //Checking if email or username already exist
469
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
470
+
471
+ $db_prefix = $wpdb->prefix;
472
+ $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$decrypted_app_name,$decrypted_user_id));
473
+
474
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$decrypted_email));
475
+
476
+ if(empty($decrypted_email)){
477
+ $existing_email_user_id = NULL;
478
+ }
479
+ else {
480
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $decrypted_email));
481
+ }
482
+
483
+ mo_openid_start_session();
484
+ if((isset($linked_email_id)) || (isset($email_user_id)) || isset($existing_email_user_id)) { // user is a member
485
+
486
+ if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
487
+ $linked_email_id = $email_user_id;
488
+ mo_openid_insert_query($decrypted_app_name,$user_email,$linked_email_id,$decrypted_user_id);
489
+ }
490
+
491
+ if(isset($linked_email_id)){
492
+ $user = get_user_by('id', $linked_email_id );
493
+ $user_id = $user->ID;
494
+ }
495
+ else if(isset($email_user_id)){
496
+ $user = get_user_by('id', $email_user_id );
497
+ $user_id = $user->ID;
498
+ }
499
+ else{
500
+ $user = get_user_by('id', $existing_email_user_id );
501
+ $user_id = $user->ID;
502
+ }
503
+
504
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
505
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
506
+ $_SESSION['mo_login'] = true;
507
+ $_SESSION['social_app_name'] = $decrypted_app_name;
508
+ $_SESSION['social_user_id'] = $decrypted_user_id;
509
+ $_SESSION['user_email'] = $user_email;
510
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
511
+ do_action( 'wp_login', $user->user_login, $user );
512
+ wp_set_auth_cookie( $user_id, true );
513
+ }
514
+ else if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
515
+ mo_openid_start_session();
516
+ $_SESSION['username'] = $decrypted_user_name;
517
+ $_SESSION['user_email'] = $user_email;
518
+ $_SESSION['user_full_name'] = $user_full_name;
519
+ $_SESSION['first_name'] = $first_name;
520
+ $_SESSION['last_name'] = $last_name;
521
+ $_SESSION['user_url'] = $user_url;
522
+ $_SESSION['user_picture'] = $user_picture;
523
+ $_SESSION['social_app_name'] = $decrypted_app_name;
524
+ $_SESSION['social_user_id'] = $decrypted_user_id;
525
+ echo mo_openid_account_linking_form($decrypted_user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$decrypted_app_name,$decrypted_user_id);
526
+ exit;
527
+ }
528
+ else {
529
+ // this user is a guest
530
+ // auto registration is enabled
531
+ if(get_option('mo_openid_auto_register_enable')) {
532
+ $random_password = wp_generate_password( 10, false );
533
+
534
+ if( isset($username_user_id) ){
535
+ $email = explode('@', $user_email);
536
+ $username = $email[0];
537
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
538
+
539
+ $i = 1;
540
+ while(!empty($username_user_id) ){
541
+ $uname=$username.'_' . $i;
542
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
543
+ $i++;
544
+ if(empty($username_user_id)){
545
+ $username= $uname;
546
+ }
547
+ }
548
+ if( isset($username_user_id) ){
549
+ echo '<br/>'."Error Code 2: ".get_option('mo_existing_username_error_message');
550
+ exit();
551
+ }
552
+ }
553
+
554
+ $user_profile_url = $user_url;
555
+
556
+ if(isset($decrypted_app_name) && !empty($decrypted_app_name) && $decrypted_app_name=='facebook'){
557
+ $user_url = '';
558
+ }
559
+
560
+ $userdata = array(
561
+ 'user_login' => $username,
562
+ 'user_email' => $user_email,
563
+ 'user_pass' => $random_password,
564
+ 'display_name' => $user_full_name,
565
+ 'first_name' => $first_name,
566
+ 'last_name' => $last_name,
567
+ 'user_url' => $user_url
568
+ );
569
+
570
+
571
+ $user_id = wp_insert_user( $userdata);
572
+
573
+ if(is_wp_error( $user_id )) {
574
+ print_r($user_id);
575
+ wp_die("Error Code 4: ".get_option('mo_registration_error_message'));
576
+ }
577
+
578
+ $_SESSION['social_app_name'] = $decrypted_app_name;
579
+ $_SESSION['user_email'] = $user_email;
580
+ $_SESSION['social_user_id'] = $decrypted_user_id;
581
+
582
+ $user = get_user_by('email', $user_email );
583
+
584
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
585
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
586
+ }
587
+ $_SESSION['mo_login'] = true;
588
+
589
+ //registration hook
590
+ do_action( 'mo_user_register', $user_id,$user_profile_url);
591
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
592
+ //login hook
593
+ do_action( 'wp_login', $user->user_login, $user );
594
+ wp_set_auth_cookie( $user_id, true );
595
+ }
596
+ $redirect_url = mo_openid_get_redirect_url();
597
+ wp_redirect($redirect_url);
598
+ exit;
599
+ }
600
+ }
601
+ }
602
+
603
+ function mo_openid_custom_app_oauth_redirect($appname){
604
+ if(isset($_REQUEST['test']))
605
+ setcookie("mo_oauth_test", true);
606
+ else
607
+ setcookie("mo_oauth_test", false);
608
+
609
+ // NEW
610
+ if(get_option('mo_openid_apps_list')) {
611
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
612
+ }
613
+ else {
614
+ $appslist = array();
615
+ }
616
+ if(get_option('mo_openid_malform_error')){
617
+ if(get_option( 'permalink_structure' )) {
618
+ $social_app_redirect_uri = site_url() .'/openidcallback/'.$appname;
619
+ }
620
+ else {
621
+ $social_app_redirect_uri = site_url() . '/?openidcallback='.$appname;
622
+ }
623
+ }
624
+ else {
625
+ if(get_option( 'permalink_structure' )) {
626
+ $social_app_redirect_uri = site_url() . '/openidcallback';
627
+ }
628
+ else{
629
+ $social_app_redirect_uri = site_url() .'/?openidcallback';
630
+ }
631
+ }
632
+
633
+ mo_openid_start_session();
634
+
635
+ foreach($appslist as $key=>$currentapp){
636
+
637
+ if($key == "facebook" && $appname == "facebook"){
638
+ $_SESSION["appname"] = "facebook";
639
+ $client_id = $currentapp['clientid'];
640
+ $scope = $currentapp['scope'];
641
+ $login_dialog_url = "https://www.facebook.com/v2.11/dialog/oauth?client_id=".$client_id. '&redirect_uri='. $social_app_redirect_uri .'&response_type=code&scope='.$scope;
642
+ break;
643
+ }
644
+ else if($key == "google" && $appname == "google"){
645
+
646
+ $_SESSION["appname"] = "google";
647
+ $client_id = $currentapp['clientid'];
648
+ $scope = $currentapp['scope'];
649
+ $login_dialog_url = 'https://accounts.google.com/o/oauth2/auth?redirect_uri=' .$social_app_redirect_uri .'&response_type=code&client_id=' .$client_id .'&scope='.$scope.'&access_type=offline';
650
+
651
+ break;
652
+ }
653
+ else if($key == "twitter" && $appname == "twitter")
654
+ { $_SESSION['appname'] = "twitter";
655
+ $client_id = $currentapp['clientid'];
656
+ $client_secret = $currentapp['clientsecret'];
657
+ $twiter_getrequest_object = new Mo_Openid_Twitter_OAuth($client_id,$client_secret); //creating the object of Mo_Openid_Twitter_OAuth class
658
+ $oauth_token = $twiter_getrequest_object->mo_twitter_get_request_token(); //function call
659
+ $login_dialog_url = "https://api.twitter.com/oauth/authenticate?oauth_token=" . $oauth_token;
660
+ break;
661
+ }
662
+ }
663
+
664
+ header('Location:'. $login_dialog_url);
665
+ exit;
666
+ }
667
+
668
+ function mo_openid_process_custom_app_callback(){
669
+ if( is_user_logged_in() && get_option('mo_openid_test_configuration') != 1){
670
+ return;
671
+ }
672
+
673
+ $code = $profile_url = $client_id = $current_url = $client_secret = $access_token_uri = $postData = $oauth_token = $user_url = $username = $email = '';
674
+ $oauth_access_token = $redirect_url = $option = $oauth_token_secret = $screen_name = $profile_json_output = $oauth_verifier = $twitter_oauth_token = $access_token_json_output =[];
675
+
676
+ mo_openid_start_session();
677
+ if(strpos( $_SERVER['REQUEST_URI'], "oauth_verifier") !== false) {
678
+ $_SESSION['appname'] = "twitter";
679
+ }
680
+
681
+ if($_SESSION['appname']) {
682
+ $appname = sanitize_text_field($_SESSION['appname']);
683
+ }else {
684
+ if ((strpos($_SERVER['REQUEST_URI'], "openidcallback/google") !== false ) || (strpos($_SERVER['REQUEST_URI'], "openidcallback=google") !== false )) {
685
+ $appname = "google";
686
+ }
687
+
688
+ if ((strpos($_SERVER['REQUEST_URI'], "openidcallback/facebook") !== false) || (strpos($_SERVER['REQUEST_URI'], "openidcallback=facebook") !== false )) {
689
+ $appname = "facebook";
690
+
691
+ }
692
+ }
693
+
694
+ if($appname == "twitter"){
695
+ $dirs = explode('&', $_SERVER['REQUEST_URI']);
696
+ $oauth_verifier = explode('=', $dirs[1]);
697
+ $twitter_oauth_token = explode('=', $dirs[0]);
698
+ }
699
+ else{
700
+ if(isset($_REQUEST['code'] )){
701
+ $code = $_REQUEST['code'];
702
+ }
703
+ else if(isset( $_REQUEST['error_reason'] )){
704
+
705
+ echo $_REQUEST['error_description'] . "<br>";
706
+ wp_die("Allow access to your profile to get logged in. Click <a href=".get_site_url().">here</a> to go back to the website.");
707
+ }
708
+ }
709
+
710
+ if(get_option('mo_openid_apps_list')){
711
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
712
+ }
713
+ else{
714
+ $appslist = array();
715
+ }
716
+ if(get_option('mo_openid_malform_error')){
717
+ if(get_option( 'permalink_structure' )) {
718
+
719
+ $social_app_redirect_uri = site_url() .'/openidcallback/'.$appname;
720
+
721
+ }
722
+ else{
723
+ $social_app_redirect_uri = site_url() . '/?openidcallback='.$appname;
724
+ }
725
+
726
+ }
727
+ else{
728
+ if(get_option( 'permalink_structure' )) {
729
+ $social_app_redirect_uri = site_url() . '/openidcallback';
730
+
731
+ }
732
+ else{
733
+ $social_app_redirect_uri = site_url() .'/?openidcallback';
734
+ }
735
+ }
736
+
737
+ foreach($appslist as $key=>$currentapp){
738
+ if($key == "facebook" && $appname == "facebook"){
739
+ $client_id = $currentapp['clientid'];
740
+ $client_secret = $currentapp['clientsecret'];
741
+ $access_token_uri = 'https://graph.facebook.com/v2.11/oauth/access_token';
742
+ $postData = 'client_id=' .$client_id .'&redirect_uri=' . $social_app_redirect_uri . '&client_secret=' . $client_secret . '&code=' .$code;
743
+ break;
744
+ }
745
+ else if($key == "google" && $appname == "google"){
746
+ $client_id = $currentapp['clientid'];
747
+ $client_secret = $currentapp['clientsecret'];
748
+ $access_token_uri = 'https://accounts.google.com/o/oauth2/token';
749
+ $postData = 'code=' .$code .'&client_id=' .$client_id .'&client_secret=' . $client_secret . '&redirect_uri=' . $social_app_redirect_uri . '&grant_type=authorization_code';
750
+ break;
751
+ }
752
+ else if($key == "twitter" && $appname == "twitter")
753
+ {
754
+ $client_id = $currentapp['clientid'];
755
+ $client_secret = $currentapp['clientsecret'];
756
+ $twitter_getaccesstoken_object = new Mo_Openid_Twitter_OAuth($client_id,$client_secret);
757
+ $oauth_token = $twitter_getaccesstoken_object->mo_twitter_get_access_token($oauth_verifier[1],$twitter_oauth_token[1]);
758
+ break;
759
+ }
760
+ }
761
+
762
+ if($appname != "twitter"){
763
+
764
+
765
+ if($appname == "google")
766
+ {
767
+ $headers = array("Content-Type"=>"application/x-www-form-urlencoded");
768
+ }
769
+
770
+ $args = array(
771
+ 'method' => 'POST',
772
+ 'body' => $postData,
773
+ 'timeout' => '5',
774
+ 'redirection' => '5',
775
+ 'httpversion' => '1.0',
776
+ 'blocking' => true,
777
+ 'headers' => $headers
778
+ );
779
+
780
+ $result = wp_remote_post($access_token_uri,$args);
781
+
782
+ if(is_wp_error($result)){
783
+ update_option( 'mo_openid_test_configuration', 0);
784
+ echo $result['body'];
785
+ exit();
786
+ }
787
+
788
+
789
+ $access_token_json_output = json_decode($result['body'], true);
790
+ // this handles incorrect client secret for all apps.
791
+ if ((array_key_exists('error', $access_token_json_output)) || array_key_exists('error_message', $access_token_json_output)){
792
+ if( is_user_logged_in() && get_option('mo_openid_test_configuration') == 1 ) {
793
+ update_option('mo_openid_test_configuration', 0);
794
+ //Test configuration failed window.
795
+ echo '<div style="color: #a94442;background-color: #f2dede;padding: 15px;margin-bottom: 20px;text-align:center;border:1px solid #E6B3B2;font-size:18pt;">TEST FAILED</div>
796
+ <div style="color: #a94442;font-size:14pt; margin-bottom:20px;">WARNING: Client secret is incorrect for this app. Please check the client secret and try again.<br/>';
797
+ print_r($access_token_json_output);
798
+ echo '</div>
799
+ <div style="display:block;text-align:center;margin-bottom:4%;"><img style="width:15%;"src="' . plugin_dir_url(__FILE__) . '/includes/images/wrong.png"></div>';
800
+ exit;
801
+ }
802
+ }
803
+
804
+ }
805
+ else{
806
+ $oauth_token_array = explode('&', $oauth_token);
807
+ $oauth_access_token = isset($oauth_token_array[0]) ? $oauth_token_array[0] : null;
808
+ $oauth_access_token = explode('=', $oauth_access_token);
809
+ $oauth_token_secret = isset($oauth_token_array[1]) ? $oauth_token_array[1] : null;
810
+ $oauth_token_secret = explode('=', $oauth_token_secret);
811
+ $screen_name = isset($oauth_token_array[3]) ? $oauth_token_array[3] : null;
812
+ $screen_name = explode('=', $screen_name);
813
+ }
814
+ mo_openid_start_session();
815
+ foreach($appslist as $key=>$currentapp){
816
+ if($key == "facebook" && $appname == "facebook"){
817
+ $profile_url ='https://graph.facebook.com/me/?fields=id,name,email,picture.height(961),age_range,first_name,gender,last_name,link&access_token=' .$access_token_json_output['access_token'];
818
+ break;
819
+ }
820
+ else if($key == "google" && $appname == "google"){
821
+ $profile_url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=' .$access_token_json_output['access_token'];
822
+ break;
823
+ }
824
+ else if($key == "twitter" && $appname == "twitter"){
825
+ $twitter_getprofile_signature_object = new Mo_Openid_Twitter_OAuth($client_id,$client_secret);
826
+ $oauth_access_token1 = isset($oauth_access_token[1]) ? $oauth_access_token[1] : '';
827
+ $oauth_token_secret1 = isset($oauth_token_secret[1]) ? $oauth_token_secret[1] : '';
828
+ $screen_name1 = isset($screen_name[1]) ? $screen_name[1] : '';
829
+ $profile_json_output = $twitter_getprofile_signature_object->mo_twitter_get_profile_signature($oauth_access_token1,$oauth_token_secret1,$screen_name1);
830
+ break;
831
+ }
832
+ }
833
+
834
+ if($appname != "twitter"){
835
+
836
+ $access_token_header = "application/x-www-form-urlencoded" . $access_token_json_output['access_token'];
837
+ $headers = array("Authorization"=>$access_token_header);
838
+ $args = array();
839
+
840
+ $result = wp_remote_get($profile_url,$args);
841
+ if(is_wp_error($result)){
842
+ update_option( 'mo_openid_test_configuration', 0);
843
+ echo $result['body'];
844
+ exit();
845
+ }
846
+
847
+ $profile_json_output = json_decode($result['body'], true);
848
+ }
849
+ //Test Configuration
850
+ if( is_user_logged_in() && get_option('mo_openid_test_configuration') == 1 ){
851
+ update_option( 'mo_openid_test_configuration', 0);
852
+ $print = '<div style="color: #3c763d;
853
+ background-color: #dff0d8; padding:2%;margin-bottom:20px;text-align:center; border:1px solid #AEDB9A; font-size:18pt;">TEST SUCCESSFUL</div>
854
+ <div style="display:block;text-align:center;margin-bottom:1%;"><img style="width:15%;"src="'. plugin_dir_url(__FILE__) . '/includes/images/green_check.png"></div>';
855
+
856
+
857
+ $print .= mo_openid_json_to_htmltable($profile_json_output);
858
+ echo $print;
859
+ exit;
860
+ }
861
+ $social_app_name = $appname;
862
+ $first_name = $last_name = $email = $user_name = $user_url = $user_picture = $social_user_id = '';
863
+
864
+ if ($appname == "facebook"){
865
+ $first_name = isset( $profile_json_output['first_name']) ? $profile_json_output['first_name'] : '';
866
+ $last_name = isset( $profile_json_output['last_name']) ? $profile_json_output['last_name'] : '';
867
+ $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
868
+ $user_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
869
+ $user_url = isset( $profile_json_output['link']) ? $profile_json_output['link'] : '';
870
+ $user_picture = isset( $profile_json_output['picture']['data']['url']) ? $profile_json_output['picture']['data']['url'] : '';
871
+ $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
872
+ }
873
+ else if ($appname == "google"){
874
+ $first_name = isset( $profile_json_output['given_name']) ? $profile_json_output['given_name'] : '';
875
+ $user_name = isset( $profile_json_output['name']) ? $profile_json_output['name'] : '';
876
+ $last_name = isset( $profile_json_output['family_name']) ? $profile_json_output['family_name'] : '';
877
+ $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
878
+ $user_url = isset( $profile_json_output['link']) ? $profile_json_output['link'] : '';
879
+ $user_picture = isset( $profile_json_output['picture']) ? $profile_json_output['picture'] : '';
880
+ $social_user_id = isset( $profile_json_output['id']) ? $profile_json_output['id'] : '';
881
+ }
882
+ else if($appname == "twitter") {
883
+ if (isset($profile_json_output['name'])) {
884
+ $full_name = explode(" ", $profile_json_output['name']);
885
+ $first_name = isset( $full_name[0]) ? $full_name[0] : '';
886
+ $last_name = isset( $full_name[1]) ? $full_name[1] : '';
887
+ }
888
+ $user_name = isset( $profile_json_output['screen_name']) ? $profile_json_output['screen_name'] : '';
889
+ $email = isset( $profile_json_output['email']) ? $profile_json_output['email'] : '';
890
+ $user_url = isset( $profile_json_output['url']) ? $profile_json_output['url'] : '';
891
+ $user_picture = isset( $profile_json_output['profile_image_url']) ? $profile_json_output['profile_image_url'] : '';
892
+ $social_user_id = isset( $profile_json_output['id_str']) ? $profile_json_output['id_str'] : '';
893
+ }
894
+
895
+ $user_name = str_replace(' ', '-', $user_name);
896
+ $user_name = sanitize_user($user_name, true);
897
+
898
+ if($user_name == '-' || $user_name == ''){
899
+ $splitemail = explode('@', $email);
900
+ $user_name = $splitemail[0];
901
+ }
902
+
903
+ //Set User Full Name
904
+ if(isset( $first_name ) && isset( $last_name )){
905
+ if(strcmp($first_name, $last_name)!=0)
906
+ $user_full_name = $first_name.' '.$last_name;
907
+ else
908
+ $user_full_name = $first_name;
909
+ }
910
+ else{
911
+ $user_full_name = $user_name;
912
+ $first_name = '';
913
+ $last_name = '';
914
+ }
915
+
916
+ // if email and user name is empty
917
+ if ( empty($email) || empty($user_name) ){
918
+ global $wpdb;
919
+ $db_prefix = $wpdb->prefix;
920
+ $id_returning_user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
921
+ if(empty($email)){
922
+ $email_user_id = NULL;
923
+ }
924
+ else {
925
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $email));
926
+ }
927
+
928
+ mo_openid_start_session();
929
+
930
+ // if returning user whose appname + identifier exists, log him in
931
+ if((isset($id_returning_user)) || (isset($email_user_id))){
932
+ if ((!isset($id_returning_user)) && (isset($email_user_id)) ){
933
+ $id_returning_user = $email_user_id;
934
+ mo_openid_insert_query($social_app_name,$email,$id_returning_user,$social_user_id);
935
+ }
936
+ $user = get_user_by('id', $id_returning_user );
937
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
938
+ update_user_meta($id_returning_user, 'moopenid_user_avatar', $user_picture);
939
+
940
+ $_SESSION['mo_login'] = true;
941
+ $_SESSION['social_app_name'] = $social_app_name;
942
+ $_SESSION['user_email'] = $email;
943
+ $_SESSION['social_user_id'] = $social_user_id;
944
+
945
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
946
+ do_action( 'wp_login', $user->user_login, $user );
947
+ wp_set_auth_cookie( $id_returning_user, true );
948
+ }
949
+ // if new user and profile completion is enabled
950
+ elseif (get_option('mo_openid_enable_profile_completion')){
951
+ echo mo_openid_profile_completion_form($last_name, $first_name, $user_full_name, $user_url, $user_picture, $user_name, $email, $social_app_name, $social_user_id);
952
+ exit;
953
+ }
954
+ // if new user and profile completion is disabled, auto create dummy data and register user
955
+ else{
956
+ // auto registration is enabled
957
+ if(get_option('mo_openid_auto_register_enable')) {
958
+
959
+ if(!empty($email))
960
+ {
961
+ $split_email = explode('@',$email);
962
+ $username = $split_email[0];
963
+ $user_email = $email;
964
+ }
965
+ else if(!empty($user_name))
966
+ {
967
+ $split_app_name = explode('_',$social_app_name);
968
+ $username = $user_name;
969
+ $user_email = $user_name.'@'.$split_app_name[0].'.com';
970
+ }
971
+ else
972
+ {
973
+ $split_app_name = explode('_',$social_app_name);
974
+ $username = 'user_'.get_option('mo_openid_user_count');
975
+ $user_email = 'user_'.get_option('mo_openid_user_count').'@'.$split_app_name[0].'.com';
976
+ }
977
+ $user_email = str_replace(' ', '', $user_email);
978
+
979
+ if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
980
+ mo_openid_start_session();
981
+ $_SESSION['username'] = $username;
982
+ $_SESSION['user_email'] = $user_email;
983
+ $_SESSION['user_full_name'] = $user_full_name;
984
+ $_SESSION['first_name'] = $first_name;
985
+ $_SESSION['last_name'] = $last_name;
986
+ $_SESSION['user_url'] = $user_url;
987
+ $_SESSION['user_picture'] = $user_picture;
988
+ $_SESSION['social_app_name'] = $social_app_name;
989
+ $_SESSION['social_user_id'] = $social_user_id;
990
+ echo mo_openid_account_linking_form($username,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$social_app_name,$social_user_id);
991
+ exit;
992
+ }
993
+
994
+ $random_password = wp_generate_password( 10, false );
995
+
996
+ $user_profile_url = $user_url;
997
+
998
+ if(isset($social_app_name) && !empty($social_app_name) && $social_app_name=='facebook'){
999
+ $user_url = '';
1000
+ }
1001
+
1002
+ $userdata = array(
1003
+ 'user_login' => $username,
1004
+ 'user_email' => $user_email,
1005
+ 'user_pass' => $random_password,
1006
+ 'display_name' => $user_full_name,
1007
+ 'first_name' => $first_name,
1008
+ 'last_name' => $last_name,
1009
+ 'user_url' => $user_url,
1010
+ );
1011
+
1012
+ $user_id = wp_insert_user( $userdata);
1013
+
1014
+ if(is_wp_error( $user_id )) {
1015
+ print_r($user_id);
1016
+ wp_die("Error Code 5: ".get_option('mo_registration_error_message'));
1017
+ }
1018
+
1019
+ update_option('mo_openid_user_count',get_option('mo_openid_user_count')+1);
1020
+ $_SESSION['mo_login'] = true;
1021
+ $_SESSION['social_app_name'] = $social_app_name;
1022
+ $_SESSION['user_email'] = $user_email;
1023
+ $_SESSION['social_user_id'] = $social_user_id;
1024
+
1025
+ $user = get_user_by('email', $user_email );
1026
+
1027
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1028
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1029
+ }
1030
+
1031
+ //registration hook
1032
+ do_action( 'mo_user_register', $user_id, $user_profile_url);
1033
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1034
+ //login hook
1035
+ do_action( 'wp_login', $user->user_login, $user );
1036
+ wp_set_auth_cookie( $user_id, true );
1037
+ }
1038
+ $redirect_url = mo_openid_get_redirect_url();
1039
+ wp_redirect($redirect_url);
1040
+ exit;
1041
+ }
1042
+ $redirect_url = mo_openid_get_redirect_url();
1043
+ wp_redirect($redirect_url);
1044
+ exit;
1045
+ }
1046
+ //email and username are both returned..dont show profile completion
1047
+ else{
1048
+ global $wpdb;
1049
+ $user_email = sanitize_email($email);
1050
+ $username = $user_name;
1051
+
1052
+ //Checking if username already exist
1053
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1054
+
1055
+ $db_prefix = $wpdb->prefix;
1056
+ $linked_email_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_social_app = \"%s\" AND identifier = %s",$social_app_name,$social_user_id));
1057
+
1058
+ $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ".$db_prefix."mo_openid_linked_user where linked_email = \"%s\"",$user_email));
1059
+ if(empty($user_email)){
1060
+ $existing_email_user_id = NULL;
1061
+ }
1062
+ else {
1063
+ $existing_email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = \"%s\"", $user_email));
1064
+ }
1065
+
1066
+ mo_openid_start_session();
1067
+ if((isset($linked_email_id)) || (isset($email_user_id)) || (isset($existing_email_user_id)) ) { // user is a member
1068
+ if ((!isset($linked_email_id)) && (isset($email_user_id)) ){
1069
+
1070
+ $linked_email_id = $email_user_id;
1071
+ mo_openid_insert_query($social_app_name,$user_email,$linked_email_id,$social_user_id);
1072
+ }
1073
+
1074
+ if(isset($linked_email_id)){
1075
+ $user = get_user_by('id', $linked_email_id );
1076
+ $user_id = $user->ID;
1077
+ }
1078
+ else if(isset($email_user_id)){
1079
+ $user = get_user_by('id', $email_user_id );
1080
+ $user_id = $user->ID;
1081
+ }
1082
+ else{
1083
+ $user = get_user_by('id', $existing_email_user_id );
1084
+ $user_id = $user->ID;
1085
+ }
1086
+
1087
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture))
1088
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1089
+ $_SESSION['mo_login'] = true;
1090
+ $_SESSION['social_app_name'] = $social_app_name;
1091
+ $_SESSION['social_user_id'] = $social_user_id;
1092
+ $_SESSION['user_email'] = $user_email;
1093
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1094
+ do_action( 'wp_login', $user->user_login, $user );
1095
+ wp_set_auth_cookie( $user_id, true );
1096
+
1097
+ }
1098
+ //if account linking is enable
1099
+ else if ( get_option('mo_openid_account_linking_enable')&& (!mo_openid_restrict_user())){
1100
+ mo_openid_start_session();
1101
+ $_SESSION['username'] = $user_name;
1102
+ $_SESSION['user_email'] = $user_email;
1103
+ $_SESSION['user_full_name'] = $user_full_name;
1104
+ $_SESSION['first_name'] = $first_name;
1105
+ $_SESSION['last_name'] = $last_name;
1106
+ $_SESSION['user_url'] = $user_url;
1107
+ $_SESSION['user_picture'] = $user_picture;
1108
+ $_SESSION['social_app_name'] = $social_app_name;
1109
+ $_SESSION['social_user_id'] = $social_user_id;
1110
+
1111
+ echo mo_openid_account_linking_form($user_name,$user_email,$first_name,$last_name,$user_full_name,$user_url,$user_picture,$social_app_name,$social_user_id);
1112
+ exit;
1113
+ }
1114
+ else {
1115
+
1116
+ // this user is a guest
1117
+ // auto registration is enabled
1118
+ if(get_option('mo_openid_auto_register_enable')) {
1119
+ $random_password = wp_generate_password( 10, false );
1120
+
1121
+ if( isset($username_user_id) ){
1122
+ $email_array = explode('@', $user_email);
1123
+ $username = $email_array[0];
1124
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username));
1125
+ $i = 1;
1126
+ while(!empty($username_user_id) ){
1127
+ $uname=$username.'_' . $i;
1128
+ $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " .$db_prefix."users where user_login = %s", $uname));
1129
+ $i++;
1130
+ if(empty($username_user_id)){
1131
+ $username= $uname;
1132
+ }
1133
+ }
1134
+
1135
+ if( isset($username_user_id) ){
1136
+ echo '<br/>'."Error Code 3: ".get_option('mo_existing_username_error_message');
1137
+ exit();
1138
+ }
1139
+ }
1140
+
1141
+ $user_profile_url = $user_url;
1142
+
1143
+ if(isset($social_app_name) && !empty($social_app_name) && $social_app_name=='facebook'){
1144
+ $user_url = '';
1145
+ }
1146
+
1147
+ $userdata = array(
1148
+ 'user_login' => $username,
1149
+ 'user_email' => $user_email,
1150
+ 'user_pass' => $random_password,
1151
+ 'display_name' => $user_full_name,
1152
+ 'first_name' => $first_name,
1153
+ 'last_name' => $last_name,
1154
+ 'user_url' => $user_url,
1155
+ );
1156
+
1157
+ $user_id = wp_insert_user( $userdata);
1158
+ if(is_wp_error( $user_id )) {
1159
+ print_r($user_id);
1160
+ wp_die("Error Code 6: ".get_option('mo_registration_error_message'));
1161
+ }
1162
+
1163
+ mo_openid_start_session();
1164
+ $_SESSION['username'] = $user_name;
1165
+ $_SESSION['user_email'] = $user_email;
1166
+ $_SESSION['user_full_name'] = $user_full_name;
1167
+ $_SESSION['first_name'] = $first_name;
1168
+ $_SESSION['last_name'] = $last_name;
1169
+ $_SESSION['user_url'] = $user_url;
1170
+ $_SESSION['user_picture'] = $user_picture;
1171
+ $_SESSION['social_app_name'] = $social_app_name;
1172
+ $_SESSION['social_user_id'] = $social_user_id;
1173
+
1174
+ $user = get_user_by('id', $user_id );
1175
+ if(get_option('moopenid_social_login_avatar') && isset($user_picture)){
1176
+ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture);
1177
+ }
1178
+ $_SESSION['mo_login'] = true;
1179
+
1180
+ //registration hook
1181
+ do_action( 'mo_user_register', $user_id, $user_profile_url);
1182
+ do_action( 'miniorange_collect_attributes_for_authenticated_user', $user, mo_openid_get_redirect_url());
1183
+ //login hook
1184
+
1185
+ do_action( 'wp_login', $user->user_login, $user );
1186
+ wp_set_auth_cookie( $user_id, true );
1187
+ }
1188
+ $redirect_url = mo_openid_get_redirect_url();
1189
+ wp_redirect($redirect_url);
1190
+ exit;
1191
+ }
1192
+
1193
+ $redirect_url = mo_openid_get_redirect_url();
1194
+ wp_redirect($redirect_url);
1195
+ exit;
1196
+ }
1197
+ }
class-mo-openid-social-share.php CHANGED
@@ -4,21 +4,21 @@ if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !=
4
  } else {
5
  $http = "http://";
6
  }
7
- $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
8
 
9
 
10
- $selected_theme = get_option('mo_openid_share_theme');
11
- $selected_direction = get_option('mo_openid_share_widget_customize_direction');
12
- $sharingSize = get_option('mo_sharing_icon_custom_size');
13
- $custom_color = get_option('mo_sharing_icon_custom_color');
14
- $custom_theme = get_option('mo_openid_share_custom_theme');
15
- $fontColor = get_option('mo_sharing_icon_custom_font');
16
- $spaceBetweenIcons = get_option('mo_sharing_icon_space');
17
  $twitter_username = get_option('mo_openid_share_twitter_username');
18
- $heading_text = get_option('mo_openid_share_widget_customize_text');
19
- $heading_color = get_option('mo_openid_share_widget_customize_text_color');
20
 
21
- $email_subject = get_option('mo_openid_share_email_subject');
22
  $email_body = get_option('mo_openid_share_email_body');
23
  $email_body = str_replace('##url##', $url, $email_body);
24
 
@@ -62,28 +62,28 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
62
  <?php
63
  if($custom_theme == 'custom'){
64
  if( get_option('mo_openid_facebook_share_enable') ) {
65
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
66
  ?>
67
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-facebook" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
68
  <?php
69
  }
70
 
71
  if( get_option('mo_openid_twitter_share_enable') ) {
72
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
73
  ?>
74
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-twitter" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
75
  <?php
76
  }
77
 
78
  if( get_option('mo_openid_google_share_enable') ) {
79
- $link = 'https://plus.google.com/share?url='.$url;
80
  ?>
81
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-google-plus" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;"></i></a>
82
  <?php
83
  }
84
 
85
  if( get_option('mo_openid_vkontakte_share_enable') ) {
86
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
87
  ?>
88
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-vk" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
89
  <?php
@@ -97,21 +97,21 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
97
  }
98
 
99
  if( get_option('mo_openid_stumble_share_enable') ) {
100
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
101
  ?>
102
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-stumbleupon" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
103
  <?php
104
  }
105
 
106
  if( get_option('mo_openid_linkedin_share_enable') ) {
107
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
108
  ?>
109
  <a rel='nofollow' title="LinkekIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-linkedin" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
110
  <?php
111
  }
112
 
113
  if( get_option('mo_openid_reddit_share_enable') ) {
114
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
115
  ?>
116
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-reddit" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
117
  <?php
@@ -124,28 +124,28 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
124
  }
125
 
126
  if( get_option('mo_openid_pocket_share_enable') ) {
127
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
128
  ?>
129
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-get-pocket" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
130
  <?php
131
  }
132
 
133
  if( get_option('mo_openid_digg_share_enable') ) {
134
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
135
  ?>
136
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-digg" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
137
  <?php
138
  }
139
 
140
  if( get_option('mo_openid_delicious_share_enable') ) {
141
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
142
  ?>
143
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-delicious" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
144
  <?php
145
  }
146
 
147
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
148
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
149
  ?>
150
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
151
  <?php
@@ -180,56 +180,56 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
180
 
181
  else if($custom_theme == 'customFont'){
182
  if( get_option('mo_openid_facebook_share_enable') ) {
183
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
184
  ?>
185
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-facebook" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
186
  <?php
187
  }
188
 
189
  if( get_option('mo_openid_twitter_share_enable') ) {
190
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
191
  ?>
192
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-twitter" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
193
  <?php
194
  }
195
 
196
  if( get_option('mo_openid_google_share_enable') ) {
197
- $link = 'https://plus.google.com/share?url='.$url;
198
  ?>
199
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-google-plus" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
200
  <?php
201
  }
202
 
203
  if( get_option('mo_openid_vkontakte_share_enable') ) {
204
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
205
  ?>
206
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-vk" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
207
  <?php
208
  }
209
 
210
  if( get_option('mo_openid_tumblr_share_enable') ) {
211
- $link = 'http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title;
212
  ?>
213
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-tumblr" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
214
  <?php
215
  }
216
 
217
  if( get_option('mo_openid_stumble_share_enable') ) {
218
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
219
  ?>
220
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-stumbleupon" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
221
  <?php
222
  }
223
 
224
  if( get_option('mo_openid_linkedin_share_enable') ) {
225
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
226
  ?>
227
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-linkedin" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
228
  <?php
229
  }
230
 
231
  if( get_option('mo_openid_reddit_share_enable') ) {
232
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
233
  ?>
234
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-reddit" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
235
  <?php
@@ -242,27 +242,27 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
242
  }
243
 
244
  if( get_option('mo_openid_pocket_share_enable') ) {
245
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
246
  ?>
247
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-get-pocket" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
248
  <?php
249
  }
250
 
251
  if( get_option('mo_openid_digg_share_enable') ) {
252
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
253
  ?>
254
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-digg" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
255
  <?php
256
  }
257
 
258
  if( get_option('mo_openid_delicious_share_enable') ) {
259
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
260
  ?>
261
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-delicious" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
262
  <?php
263
  }
264
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
265
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
266
  ?>
267
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
268
  <?php
@@ -299,56 +299,56 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
299
 
300
 
301
  if( get_option('mo_openid_facebook_share_enable') ) {
302
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
303
  ?>
304
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Facebook' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
305
  <?php
306
  }
307
 
308
  if( get_option('mo_openid_twitter_share_enable') ) {
309
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
310
  ?>
311
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Twitter' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
312
  <?php
313
  }
314
 
315
  if( get_option('mo_openid_google_share_enable') ) {
316
- $link = 'https://plus.google.com/share?url='.$url;
317
  ?>
318
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Google' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
319
  <?php
320
  }
321
 
322
  if( get_option('mo_openid_vkontakte_share_enable') ) {
323
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
324
  ?>
325
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Vkontakte' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
326
  <?php
327
  }
328
 
329
  if( get_option('mo_openid_tumblr_share_enable') ) {
330
- $link = 'http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title;
331
  ?>
332
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Tumblr' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/tumblr.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
333
  <?php
334
  }
335
 
336
  if( get_option('mo_openid_stumble_share_enable') ) {
337
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
338
  ?>
339
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='StumbleUpon' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/stumble.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
340
  <?php
341
  }
342
 
343
  if( get_option('mo_openid_linkedin_share_enable') ) {
344
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
345
  ?>
346
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='LinkedIn' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
347
  <?php
348
  }
349
 
350
  if( get_option('mo_openid_reddit_share_enable') ) {
351
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
352
  ?>
353
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Reddit' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/reddit.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
354
  <?php
@@ -359,25 +359,25 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
359
  <?php
360
  }
361
  if( get_option('mo_openid_pocket_share_enable') ) {
362
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
363
  ?>
364
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Pocket' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/pocket.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
365
  <?php
366
  }
367
  if( get_option('mo_openid_digg_share_enable') ) {
368
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
369
  ?>
370
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Digg' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/digg.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
371
  <?php
372
  }
373
  if( get_option('mo_openid_delicious_share_enable') ) {
374
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
375
  ?>
376
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Delicious' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/delicious.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
377
  <?php
378
  }
379
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
380
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
381
  ?>
382
  <a rel='nofollow'title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Odnoklassniki' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/odnoklassniki.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
383
  <?php
@@ -420,56 +420,56 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
420
  <?php
421
  if($custom_theme == 'custom'){
422
  if( get_option('mo_openid_facebook_share_enable') ) {
423
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
424
  ?>
425
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-facebook" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
426
  <?php
427
  }
428
 
429
  if( get_option('mo_openid_twitter_share_enable') ) {
430
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
431
  ?>
432
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-twitter" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
433
  <?php
434
  }
435
 
436
  if( get_option('mo_openid_google_share_enable') ) {
437
- $link = 'https://plus.google.com/share?url='.$url;
438
  ?>
439
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-google-plus" style="margin-bottom:<?php echo $space_icons-4?>px!important; padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
440
  <?php
441
  }
442
 
443
  if( get_option('mo_openid_vkontakte_share_enable') ) {
444
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
445
  ?>
446
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-vk" style="margin-bottom:<?php echo $space_icons-4?>px!important; padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
447
  <?php
448
  }
449
 
450
  if( get_option('mo_openid_tumblr_share_enable') ) {
451
- $link = 'http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title;
452
  ?>
453
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-tumblr" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
454
  <?php
455
  }
456
 
457
  if( get_option('mo_openid_stumble_share_enable') ) {
458
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
459
  ?>
460
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-stumbleupon" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
461
  <?php
462
  }
463
 
464
  if( get_option('mo_openid_linkedin_share_enable') ) {
465
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
466
  ?>
467
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-linkedin" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
468
  <?php
469
  }
470
 
471
  if( get_option('mo_openid_reddit_share_enable') ) {
472
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
473
  ?>
474
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-reddit" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
475
  <?php
@@ -482,28 +482,28 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
482
  }
483
 
484
  if( get_option('mo_openid_pocket_share_enable') ) {
485
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
486
  ?>
487
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-get-pocket" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
488
  <?php
489
  }
490
 
491
  if( get_option('mo_openid_digg_share_enable') ) {
492
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
493
  ?>
494
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-digg" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
495
  <?php
496
  }
497
 
498
  if( get_option('mo_openid_delicious_share_enable') ) {
499
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
500
  ?>
501
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-delicious" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
502
  <?php
503
  }
504
 
505
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
506
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
507
  ?>
508
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
509
  <?php
@@ -537,56 +537,56 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
537
  }
538
  else if($custom_theme == 'customFont'){
539
  if( get_option('mo_openid_facebook_share_enable') ) {
540
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
541
  ?>
542
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-facebook" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top : 4px !important;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
543
  <?php
544
  }
545
 
546
  if( get_option('mo_openid_twitter_share_enable') ) {
547
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
548
  ?>
549
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-twitter" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
550
  <?php
551
  }
552
 
553
  if( get_option('mo_openid_google_share_enable') ) {
554
- $link = 'https://plus.google.com/share?url='.$url;
555
  ?>
556
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-google-plus" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
557
  <?php
558
  }
559
 
560
  if( get_option('mo_openid_vkontakte_share_enable') ) {
561
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
562
  ?>
563
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-vk" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
564
  <?php
565
  }
566
 
567
  if( get_option('mo_openid_tumblr_share_enable') ) {
568
- $link = 'http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title;
569
  ?>
570
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-tumblr" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
571
  <?php
572
  }
573
 
574
  if( get_option('mo_openid_stumble_share_enable') ) {
575
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
576
  ?>
577
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-stumbleupon" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
578
  <?php
579
  }
580
 
581
  if( get_option('mo_openid_linkedin_share_enable') ) {
582
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
583
  ?>
584
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-linkedin" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px !important;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
585
  <?php
586
  }
587
 
588
  if( get_option('mo_openid_reddit_share_enable') ) {
589
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
590
  ?>
591
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-reddit" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
592
  <?php
@@ -599,28 +599,28 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
599
  }
600
 
601
  if( get_option('mo_openid_pocket_share_enable') ) {
602
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
603
  ?>
604
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-get-pocket" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
605
  <?php
606
  }
607
 
608
  if( get_option('mo_openid_digg_share_enable') ) {
609
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
610
  ?>
611
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-digg" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
612
  <?php
613
  }
614
 
615
  if( get_option('mo_openid_delicious_share_enable') ) {
616
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
617
  ?>
618
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-delicious" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
619
  <?php
620
  }
621
 
622
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
623
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
624
  ?>
625
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
626
  <?php
@@ -654,56 +654,56 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
654
  }
655
  else{
656
  if( get_option('mo_openid_facebook_share_enable') ) {
657
- $link = 'https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url;
658
  ?>
659
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link"><img alt='Facebook' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
660
  <?php
661
  }
662
 
663
  if( get_option('mo_openid_twitter_share_enable') ) {
664
- $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username;
665
  ?>
666
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><img alt='Twitter' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
667
  <?php
668
  }
669
 
670
  if( get_option('mo_openid_google_share_enable') ) {
671
- $link = 'https://plus.google.com/share?url='.$url;
672
  ?>
673
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><img alt='Google' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
674
  <?php
675
  }
676
 
677
  if( get_option('mo_openid_vkontakte_share_enable') ) {
678
- $link = 'http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
679
  ?>
680
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><img alt='Vkontakte' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
681
  <?php
682
  }
683
 
684
  if( get_option('mo_openid_tumblr_share_enable') ) {
685
- $link = 'http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title;
686
  ?>
687
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Tumblr' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/tumblr.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
688
  <?php
689
  }
690
 
691
  if( get_option('mo_openid_stumble_share_enable') ) {
692
- $link = 'http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title;
693
  ?>
694
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='StumbleUpon' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/stumble.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
695
  <?php
696
  }
697
 
698
  if( get_option('mo_openid_linkedin_share_enable') ) {
699
- $link = 'https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt;
700
  ?>
701
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='LinkedIn' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
702
  <?php
703
  }
704
 
705
  if( get_option('mo_openid_reddit_share_enable') ) {
706
- $link = 'http://www.reddit.com/submit?url='.$url.'&amp;title='.$title;
707
  ?>
708
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Reddit' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/reddit.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
709
  <?php
@@ -716,28 +716,28 @@ $url = $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
716
  }
717
 
718
  if( get_option('mo_openid_pocket_share_enable') ) {
719
- $link = 'https://getpocket.com/save?url='.$url.'&amp;title='.$title;
720
  ?>
721
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Pocket' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/pocket.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
722
  <?php
723
  }
724
 
725
  if( get_option('mo_openid_digg_share_enable') ) {
726
- $link = 'http://digg.com/submit?url='.$url.'&amp;title='.$title;
727
  ?>
728
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Digg' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/digg.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
729
  <?php
730
  }
731
 
732
  if( get_option('mo_openid_delicious_share_enable') ) {
733
- $link = 'http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title;
734
  ?>
735
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Delicoius' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/delicious.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
736
  <?php
737
  }
738
 
739
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
740
- $link = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url;
741
  ?>
742
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Odnoklassniki' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/odnoklassniki.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
743
  <?php
4
  } else {
5
  $http = "http://";
6
  }
7
+ $url = esc_url($http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']);
8
 
9
 
10
+ $selected_theme = esc_attr(get_option('mo_openid_share_theme'));
11
+ $selected_direction = esc_attr(get_option('mo_openid_share_widget_customize_direction'));
12
+ $sharingSize = esc_attr(get_option('mo_sharing_icon_custom_size'));
13
+ $custom_color = esc_attr(get_option('mo_sharing_icon_custom_color'));
14
+ $custom_theme = esc_attr(get_option('mo_openid_share_custom_theme'));
15
+ $fontColor = esc_attr(get_option('mo_sharing_icon_custom_font'));
16
+ $spaceBetweenIcons = esc_attr(get_option('mo_sharing_icon_space'));
17
  $twitter_username = get_option('mo_openid_share_twitter_username');
18
+ $heading_text = esc_html(get_option('mo_openid_share_widget_customize_text'));
19
+ $heading_color = esc_attr(get_option('mo_openid_share_widget_customize_text_color'));
20
 
21
+ $email_subject = esc_attr(get_option('mo_openid_share_email_subject'));
22
  $email_body = get_option('mo_openid_share_email_body');
23
  $email_body = str_replace('##url##', $url, $email_body);
24
 
62
  <?php
63
  if($custom_theme == 'custom'){
64
  if( get_option('mo_openid_facebook_share_enable') ) {
65
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
66
  ?>
67
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-facebook" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
68
  <?php
69
  }
70
 
71
  if( get_option('mo_openid_twitter_share_enable') ) {
72
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
73
  ?>
74
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-twitter" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
75
  <?php
76
  }
77
 
78
  if( get_option('mo_openid_google_share_enable') ) {
79
+ $link = esc_url('https://plus.google.com/share?url='.$url);
80
  ?>
81
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-google-plus" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;"></i></a>
82
  <?php
83
  }
84
 
85
  if( get_option('mo_openid_vkontakte_share_enable') ) {
86
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
87
  ?>
88
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-vk" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
89
  <?php
97
  }
98
 
99
  if( get_option('mo_openid_stumble_share_enable') ) {
100
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
101
  ?>
102
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-stumbleupon" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
103
  <?php
104
  }
105
 
106
  if( get_option('mo_openid_linkedin_share_enable') ) {
107
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt);
108
  ?>
109
  <a rel='nofollow' title="LinkekIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-linkedin" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
110
  <?php
111
  }
112
 
113
  if( get_option('mo_openid_reddit_share_enable') ) {
114
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
115
  ?>
116
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-reddit" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
117
  <?php
124
  }
125
 
126
  if( get_option('mo_openid_pocket_share_enable') ) {
127
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
128
  ?>
129
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-get-pocket" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
130
  <?php
131
  }
132
 
133
  if( get_option('mo_openid_digg_share_enable') ) {
134
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
135
  ?>
136
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-digg" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
137
  <?php
138
  }
139
 
140
  if( get_option('mo_openid_delicious_share_enable') ) {
141
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
142
  ?>
143
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-delicious" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
144
  <?php
145
  }
146
 
147
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
148
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
149
  ?>
150
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
151
  <?php
180
 
181
  else if($custom_theme == 'customFont'){
182
  if( get_option('mo_openid_facebook_share_enable') ) {
183
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
184
  ?>
185
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-facebook" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
186
  <?php
187
  }
188
 
189
  if( get_option('mo_openid_twitter_share_enable') ) {
190
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
191
  ?>
192
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-twitter" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
193
  <?php
194
  }
195
 
196
  if( get_option('mo_openid_google_share_enable') ) {
197
+ $link = esc_url('https://plus.google.com/share?url='.$url);
198
  ?>
199
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-google-plus" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
200
  <?php
201
  }
202
 
203
  if( get_option('mo_openid_vkontakte_share_enable') ) {
204
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
205
  ?>
206
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-vk" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
207
  <?php
208
  }
209
 
210
  if( get_option('mo_openid_tumblr_share_enable') ) {
211
+ $link = esc_url('http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title);
212
  ?>
213
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-tumblr" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
214
  <?php
215
  }
216
 
217
  if( get_option('mo_openid_stumble_share_enable') ) {
218
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
219
  ?>
220
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-stumbleupon" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
221
  <?php
222
  }
223
 
224
  if( get_option('mo_openid_linkedin_share_enable') ) {
225
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt);
226
  ?>
227
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-linkedin" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
228
  <?php
229
  }
230
 
231
  if( get_option('mo_openid_reddit_share_enable') ) {
232
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
233
  ?>
234
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-reddit" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
235
  <?php
242
  }
243
 
244
  if( get_option('mo_openid_pocket_share_enable') ) {
245
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
246
  ?>
247
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-get-pocket" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
248
  <?php
249
  }
250
 
251
  if( get_option('mo_openid_digg_share_enable') ) {
252
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
253
  ?>
254
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-digg" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
255
  <?php
256
  }
257
 
258
  if( get_option('mo_openid_delicious_share_enable') ) {
259
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
260
  ?>
261
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-delicious" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
262
  <?php
263
  }
264
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
265
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
266
  ?>
267
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons-6?>px !important"><i class=" <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize-4; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
268
  <?php
299
 
300
 
301
  if( get_option('mo_openid_facebook_share_enable') ) {
302
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
303
  ?>
304
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Facebook' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
305
  <?php
306
  }
307
 
308
  if( get_option('mo_openid_twitter_share_enable') ) {
309
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
310
  ?>
311
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Twitter' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
312
  <?php
313
  }
314
 
315
  if( get_option('mo_openid_google_share_enable') ) {
316
+ $link = esc_url('https://plus.google.com/share?url='.$url);
317
  ?>
318
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Google' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
319
  <?php
320
  }
321
 
322
  if( get_option('mo_openid_vkontakte_share_enable') ) {
323
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
324
  ?>
325
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Vkontakte' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
326
  <?php
327
  }
328
 
329
  if( get_option('mo_openid_tumblr_share_enable') ) {
330
+ $link = esc_url('http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title);
331
  ?>
332
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Tumblr' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/tumblr.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
333
  <?php
334
  }
335
 
336
  if( get_option('mo_openid_stumble_share_enable') ) {
337
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
338
  ?>
339
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='StumbleUpon' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/stumble.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
340
  <?php
341
  }
342
 
343
  if( get_option('mo_openid_linkedin_share_enable') ) {
344
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt);
345
  ?>
346
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='LinkedIn' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
347
  <?php
348
  }
349
 
350
  if( get_option('mo_openid_reddit_share_enable') ) {
351
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
352
  ?>
353
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Reddit' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/reddit.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
354
  <?php
359
  <?php
360
  }
361
  if( get_option('mo_openid_pocket_share_enable') ) {
362
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
363
  ?>
364
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Pocket' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/pocket.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
365
  <?php
366
  }
367
  if( get_option('mo_openid_digg_share_enable') ) {
368
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
369
  ?>
370
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Digg' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/digg.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
371
  <?php
372
  }
373
  if( get_option('mo_openid_delicious_share_enable') ) {
374
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
375
  ?>
376
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Delicious' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/delicious.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
377
  <?php
378
  }
379
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
380
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
381
  ?>
382
  <a rel='nofollow'title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-left : <?php echo $spaceBetweenIcons?>px !important"><img alt='Odnoklassniki' style= 'height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/odnoklassniki.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
383
  <?php
420
  <?php
421
  if($custom_theme == 'custom'){
422
  if( get_option('mo_openid_facebook_share_enable') ) {
423
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
424
  ?>
425
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-facebook" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
426
  <?php
427
  }
428
 
429
  if( get_option('mo_openid_twitter_share_enable') ) {
430
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
431
  ?>
432
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-twitter" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
433
  <?php
434
  }
435
 
436
  if( get_option('mo_openid_google_share_enable') ) {
437
+ $link = esc_url('https://plus.google.com/share?url='.$url);
438
  ?>
439
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-google-plus" style="margin-bottom:<?php echo $space_icons-4?>px!important; padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
440
  <?php
441
  }
442
 
443
  if( get_option('mo_openid_vkontakte_share_enable') ) {
444
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
445
  ?>
446
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" style="margin-bottom:<?php echo $space_icons?>px !important;"><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-vk" style="margin-bottom:<?php echo $space_icons-4?>px!important; padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
447
  <?php
448
  }
449
 
450
  if( get_option('mo_openid_tumblr_share_enable') ) {
451
+ $link = esc_url('http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title);
452
  ?>
453
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-tumblr" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
454
  <?php
455
  }
456
 
457
  if( get_option('mo_openid_stumble_share_enable') ) {
458
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
459
  ?>
460
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-stumbleupon" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
461
  <?php
462
  }
463
 
464
  if( get_option('mo_openid_linkedin_share_enable') ) {
465
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp);summary='.$excerpt);
466
  ?>
467
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-linkedin" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
468
  <?php
469
  }
470
 
471
  if( get_option('mo_openid_reddit_share_enable') ) {
472
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
473
  ?>
474
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-reddit" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
475
  <?php
482
  }
483
 
484
  if( get_option('mo_openid_pocket_share_enable') ) {
485
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
486
  ?>
487
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-get-pocket" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
488
  <?php
489
  }
490
 
491
  if( get_option('mo_openid_digg_share_enable') ) {
492
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
493
  ?>
494
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-digg" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
495
  <?php
496
  }
497
 
498
  if( get_option('mo_openid_delicious_share_enable') ) {
499
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
500
  ?>
501
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-delicious" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
502
  <?php
503
  }
504
 
505
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
506
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
507
  ?>
508
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class="mo-custom-share-icon <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="margin-bottom:<?php echo $space_icons-4?>px!important;padding-top:8px;text-align:center;color:#ffffff;font-size:<?php echo ($sharingSize-16); ?>px !important;background-color:#<?php echo $custom_color?>;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
509
  <?php
537
  }
538
  else if($custom_theme == 'customFont'){
539
  if( get_option('mo_openid_facebook_share_enable') ) {
540
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
541
  ?>
542
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-facebook" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top : 4px !important;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
543
  <?php
544
  }
545
 
546
  if( get_option('mo_openid_twitter_share_enable') ) {
547
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
548
  ?>
549
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-twitter" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
550
  <?php
551
  }
552
 
553
  if( get_option('mo_openid_google_share_enable') ) {
554
+ $link = esc_url('https://plus.google.com/share?url='.$url);
555
  ?>
556
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-google-plus" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
557
  <?php
558
  }
559
 
560
  if( get_option('mo_openid_vkontakte_share_enable') ) {
561
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
562
  ?>
563
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><i class=" <?php echo $selected_theme; ?> fa fa-vk" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
564
  <?php
565
  }
566
 
567
  if( get_option('mo_openid_tumblr_share_enable') ) {
568
+ $link = esc_url('http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title);
569
  ?>
570
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-tumblr" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
571
  <?php
572
  }
573
 
574
  if( get_option('mo_openid_stumble_share_enable') ) {
575
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
576
  ?>
577
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-stumbleupon" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
578
  <?php
579
  }
580
 
581
  if( get_option('mo_openid_linkedin_share_enable') ) {
582
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt);
583
  ?>
584
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-linkedin" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px !important;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
585
  <?php
586
  }
587
 
588
  if( get_option('mo_openid_reddit_share_enable') ) {
589
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
590
  ?>
591
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-reddit" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
592
  <?php
599
  }
600
 
601
  if( get_option('mo_openid_pocket_share_enable') ) {
602
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
603
  ?>
604
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-get-pocket" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
605
  <?php
606
  }
607
 
608
  if( get_option('mo_openid_digg_share_enable') ) {
609
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
610
  ?>
611
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-digg" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
612
  <?php
613
  }
614
 
615
  if( get_option('mo_openid_delicious_share_enable') ) {
616
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
617
  ?>
618
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-delicious" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
619
  <?php
620
  }
621
 
622
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
623
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
624
  ?>
625
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><i class=" <?php echo $selected_theme; ?> fa fa-odnoklassniki" style="margin-bottom:<?php echo $space_icons-4?>px !important;padding-top:4px;text-align:center;color:#<?php echo $fontColor ?> !important;font-size:<?php echo $sharingSize; ?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important"></i></a>
626
  <?php
654
  }
655
  else{
656
  if( get_option('mo_openid_facebook_share_enable') ) {
657
+ $link = esc_url('https://www.facebook.com/dialog/share?app_id=766555246789034&amp;display=popup&amp;href='.$url);
658
  ?>
659
  <a rel='nofollow' title="Facebook" onclick="popupCenter('<?php echo $link; ?>', 800, 400);" class="mo-openid-share-link"><img alt='Facebook' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/facebook.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
660
  <?php
661
  }
662
 
663
  if( get_option('mo_openid_twitter_share_enable') ) {
664
+ $link = esc_url(empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username);
665
  ?>
666
  <a rel='nofollow' title="Twitter" onclick="popupCenter('<?php echo $link; ?>', 600, 300);" class="mo-openid-share-link" ><img alt='Twitter' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/twitter.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
667
  <?php
668
  }
669
 
670
  if( get_option('mo_openid_google_share_enable') ) {
671
+ $link = esc_url('https://plus.google.com/share?url='.$url);
672
  ?>
673
  <a rel='nofollow' title="Google" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><img alt='Google' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/google.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
674
  <?php
675
  }
676
 
677
  if( get_option('mo_openid_vkontakte_share_enable') ) {
678
+ $link = esc_url('http://vk.com/share.php?url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt);
679
  ?>
680
  <a rel='nofollow' title="Vkontakte" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link"><img alt='Vkontakte' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color: <?php echo $selected_theme; ?>' src="<?php echo plugins_url( 'includes/images/icons/vk.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
681
  <?php
682
  }
683
 
684
  if( get_option('mo_openid_tumblr_share_enable') ) {
685
+ $link = esc_url('http://www.tumblr.com/share/link?url='.$url.'&amp;title='.$title);
686
  ?>
687
  <a rel='nofollow' title="Tumblr" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Tumblr' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/tumblr.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
688
  <?php
689
  }
690
 
691
  if( get_option('mo_openid_stumble_share_enable') ) {
692
+ $link = esc_url('http://www.stumbleupon.com/submit?url='.$url.'&amp;title='.$title);
693
  ?>
694
  <a rel='nofollow' title="StumbleUpon" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='StumbleUpon' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/stumble.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
695
  <?php
696
  }
697
 
698
  if( get_option('mo_openid_linkedin_share_enable') ) {
699
+ $link = esc_url('https://www.linkedin.com/shareArticle?mini=true&amp;title='.$title.'&amp;url='.$url.'&amp;summary='.$excerpt);
700
  ?>
701
  <a rel='nofollow' title="LinkedIn" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='LinkedIn' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;background-color:white;' src="<?php echo plugins_url( 'includes/images/icons/linkedin.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
702
  <?php
703
  }
704
 
705
  if( get_option('mo_openid_reddit_share_enable') ) {
706
+ $link = esc_url('http://www.reddit.com/submit?url='.$url.'&amp;title='.$title);
707
  ?>
708
  <a rel='nofollow' title="Reddit" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Reddit' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/reddit.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
709
  <?php
716
  }
717
 
718
  if( get_option('mo_openid_pocket_share_enable') ) {
719
+ $link = esc_url('https://getpocket.com/save?url='.$url.'&amp;title='.$title);
720
  ?>
721
  <a rel='nofollow' title="Pocket" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Pocket' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/pocket.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
722
  <?php
723
  }
724
 
725
  if( get_option('mo_openid_digg_share_enable') ) {
726
+ $link = esc_url('http://digg.com/submit?url='.$url.'&amp;title='.$title);
727
  ?>
728
  <a rel='nofollow' title="Digg" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Digg' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/digg.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
729
  <?php
730
  }
731
 
732
  if( get_option('mo_openid_delicious_share_enable') ) {
733
+ $link = esc_url('http://www.delicious.com/save?v=5&noui&jump=close&url='.$url.'&amp;title='.$title);
734
  ?>
735
  <a rel='nofollow' title="Delicious" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Delicoius' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/delicious.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
736
  <?php
737
  }
738
 
739
  if( get_option('mo_openid_odnoklassniki_share_enable') ) {
740
+ $link = esc_url('http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st.comments='.$excerpt.'&amp;st._surl='.$url);
741
  ?>
742
  <a rel='nofollow' title="Odnoklassniki" onclick="popupCenter('<?php echo $link; ?>', 800, 500);" class="mo-openid-share-link" ><img alt='Odnoklassniki' style= 'margin-bottom:<?php echo $space_icons-6?>px !important;height:<?php echo $sharingSize; ?>px !important;width:<?php echo $sharingSize; ?>px !important;' src="<?php echo plugins_url( 'includes/images/icons/odnoklassniki.png', __FILE__ )?>" class="mo-openid-app-share-icons <?php echo $selected_theme; ?>" ></a>
743
  <?php
class-mo-openid-sso-customer.php CHANGED
@@ -22,64 +22,50 @@ This library is miniOrange Authentication Service.
22
  Contains Request Calls to Customer service.
23
 
24
  **/
 
25
  class CustomerOpenID {
26
 
27
  public $email;
28
  public $phone;
29
 
 
 
 
30
  private $defaultCustomerKey = "16555";
31
  private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
32
 
33
  function create_customer(){
34
 
35
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/add';
36
- $ch = curl_init( $url );
37
- global $current_user;
38
  $current_user = wp_get_current_user();
39
  $this->email = get_option('mo_openid_admin_email');
40
- $this->phone = get_option('mo_openid_admin_phone');
41
- $company = get_option('mo_openid_admin_company_name');
42
- $first_name = get_option('mo_openid_admin_first_name');
43
- $last_name = get_option('mo_openid_admin_last_name');
44
  $password = get_option('mo_openid_admin_password');
45
 
46
  $fields = array(
47
- 'companyName' => $company,
48
  'areaOfInterest' => 'WP OpenID Connect Login Plugin',
49
- 'firstname' => $first_name,
50
- 'lastname' => $last_name,
51
  'email' => $this->email,
52
- 'phone' => $this->phone,
53
  'password' => $password
54
  );
55
  $field_string = json_encode($fields);
56
 
57
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
58
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
59
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
60
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
61
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
62
-
63
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
64
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
65
- curl_setopt( $ch, CURLOPT_POST, true );
66
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string );
67
- $content = curl_exec( $ch );
68
-
69
- if( curl_errno( $ch ) ){
70
- echo 'Request Error:' . curl_error( $ch );
71
- exit();
72
- }
73
 
74
- curl_close( $ch );
75
- return $content;
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
  function get_customer_key() {
79
  $url = get_option('mo_openid_host_name') . "/moas/rest/customer/key";
80
- $ch = curl_init( $url );
81
  $email = get_option("mo_openid_admin_email");
82
-
83
  $password = get_option("mo_openid_admin_password");
84
 
85
  $fields = array(
@@ -88,59 +74,47 @@ class CustomerOpenID {
88
  );
89
  $field_string = json_encode( $fields );
90
 
91
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
92
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
93
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
94
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
95
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
96
-
97
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
98
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
99
- curl_setopt( $ch, CURLOPT_POST, true);
100
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
101
- $content = curl_exec( $ch );
102
- if( curl_errno( $ch ) ){
103
- echo 'Request Error:' . curl_error( $ch );
104
- exit();
105
- }
106
- curl_close( $ch );
107
 
108
- return $content;
109
  }
110
 
111
  function check_customer() {
112
  $url = get_option('mo_openid_host_name') . "/moas/rest/customer/check-if-exists";
113
- $ch = curl_init( $url );
114
  $email = get_option("mo_openid_admin_email");
115
 
 
116
  $fields = array(
117
- 'email' => $email,
118
  );
119
  $field_string = json_encode( $fields );
120
 
121
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
122
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
123
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
124
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
125
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
126
-
127
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
128
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
129
- curl_setopt( $ch, CURLOPT_POST, true);
130
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
131
- $content = curl_exec( $ch );
132
- if( curl_errno( $ch ) ){
133
- echo 'Request Error:' . curl_error( $ch );
134
- exit();
135
- }
136
- curl_close( $ch );
137
-
138
- return $content;
139
  }
140
 
141
  function send_otp_token($authType){
142
  $url = get_option('mo_openid_host_name') . '/moas/api/auth/challenge';
143
- $ch = curl_init($url);
144
  $customerKey = $this->defaultCustomerKey;
145
  $apiKey = $this->defaultApiKey;
146
 
@@ -152,10 +126,6 @@ class CustomerOpenID {
152
  $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
153
  $hashValue = hash("sha512", $stringToHash);
154
 
155
- $customerKeyHeader = "Customer-Key: " . $customerKey;
156
- $timestampHeader = "Timestamp: " . $currentTimeInMillis;
157
- $authorizationHeader = "Authorization: " . $hashValue;
158
-
159
  if($authType == 'EMAIL') {
160
  $fields = array(
161
  'customerKey' => $customerKey,
@@ -173,113 +143,72 @@ class CustomerOpenID {
173
  }
174
  $field_string = json_encode($fields);
175
 
176
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
177
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
178
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
179
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
180
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); # required for https urls
181
- curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 2 );
182
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
183
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader, $timestampHeader, $authorizationHeader));
184
- curl_setopt( $ch, CURLOPT_POST, true);
185
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
186
- $proxy_host = get_option("mo_proxy_host");
187
- if(!empty($proxy_host)){
188
- curl_setopt($ch, CURLOPT_PROXY, get_option("mo_proxy_host"));
189
- curl_setopt($ch, CURLOPT_PROXYPORT, get_option("mo_proxy_port"));
190
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
191
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, get_option("mo_proxy_username").':'.get_option("mo_proxy_password"));
192
- }
193
- $content = curl_exec($ch);
194
-
195
- if(curl_errno($ch)){
196
- echo 'Request Error:' . curl_error($ch);
197
- exit();
198
- }
199
- curl_close($ch);
200
- return $content;
201
  }
202
 
203
- function get_timestamp() {
204
- $url = get_option ( 'mo_openid_host_name' ) . '/moas/rest/mobile/get-timestamp';
205
- $ch = curl_init ( $url );
206
-
207
- curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, true );
208
- curl_setopt ( $ch, CURLOPT_ENCODING, "" );
209
- curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
210
- curl_setopt ( $ch, CURLOPT_AUTOREFERER, true );
211
- curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
212
- curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 2 ); // required for https urls
213
-
214
- curl_setopt ( $ch, CURLOPT_MAXREDIRS, 10 );
215
-
216
- curl_setopt ( $ch, CURLOPT_POST, true );
217
-
218
- $proxy_host = get_option("mo_proxy_host");
219
- if(!empty($proxy_host)){
220
- curl_setopt($ch, CURLOPT_PROXY, get_option("mo_proxy_host"));
221
- curl_setopt($ch, CURLOPT_PROXYPORT, get_option("mo_proxy_port"));
222
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
223
- curl_setopt($ch, CURLOPT_PROXYUSERPWD, get_option("mo_proxy_username").':'.get_option("mo_proxy_password"));
224
- }
225
- $content = curl_exec ( $ch );
226
-
227
- if (curl_errno ( $ch )) {
228
- echo 'Error in sending curl Request';
229
- exit ();
230
- }
231
- curl_close ( $ch );
232
- $currentTimeInMillis = round( microtime( true ) * 1000 );
233
- return empty( $content ) ? number_format($currentTimeInMillis, 0, '', ''): $content;
234
- }
235
 
236
  function check_customer_valid(){
237
  $url = get_option('mo_openid_host_name') . '/moas/api/customer/license';
238
- $ch = curl_init($url);
239
  $customerKey = get_option('mo_openid_admin_customer_key');
240
  $apiKey = get_option('mo_openid_admin_api_key');
241
 
242
- $username = get_option('mo_openid_admin_email');
243
- $phone = get_option('mo_openid_admin_phone');
244
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
245
- $currentTimeInMillis = self::get_timestamp();
246
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
247
  /* Creating the Hash using SHA-512 algorithm */
248
  $hashValue = hash("sha512", $stringToHash);
249
 
250
- $customerKeyHeader = "Customer-Key: " . $customerKey;
251
- $timestampHeader = "Timestamp: " . $currentTimeInMillis;
252
- $authorizationHeader = "Authorization: " . $hashValue;
253
  $fields = array(
254
- 'customerId' => $customerKey,
255
- 'applicationName' => 'wp_social_login'
256
- );
257
  $field_string = json_encode($fields);
258
 
259
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
260
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
261
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
262
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
263
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
264
-
265
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
266
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
267
- $timestampHeader, $authorizationHeader));
268
- curl_setopt( $ch, CURLOPT_POST, true);
269
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
270
- $content = curl_exec($ch);
271
-
272
- if(curl_errno($ch)){
273
- echo 'Request Error:' . curl_error($ch);
274
- exit();
275
- }
276
- curl_close($ch);
277
- return $content;
278
  }
279
 
280
  function validate_otp_token($transactionId,$otpToken){
281
  $url = get_option('mo_openid_host_name') . '/moas/api/auth/validate';
282
- $ch = curl_init($url);
283
 
284
  $customerKey = $this->defaultCustomerKey;
285
  $apiKey = $this->defaultApiKey;
@@ -287,118 +216,113 @@ class CustomerOpenID {
287
  $username = get_option('mo_openid_admin_email');
288
 
289
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
290
- $currentTimeInMillis = self::get_timestamp();
291
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
292
  $hashValue = hash("sha512", $stringToHash);
293
 
294
- $customerKeyHeader = "Customer-Key: " . $customerKey;
295
- $timestampHeader = "Timestamp: " . $currentTimeInMillis;
296
- $authorizationHeader = "Authorization: " . $hashValue;
297
 
298
  $fields = '';
299
 
300
- //*check for otp over sms/email
301
- $fields = array(
302
- 'txId' => $transactionId,
303
- 'token' => $otpToken,
304
- );
305
 
306
  $field_string = json_encode($fields);
307
 
308
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
309
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
310
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
311
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
312
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
313
-
314
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
315
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
316
- $timestampHeader, $authorizationHeader));
317
- curl_setopt( $ch, CURLOPT_POST, true);
318
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
319
- $content = curl_exec($ch);
320
-
321
- if(curl_errno($ch)){
322
- echo 'Request Error:' . curl_error($ch);
323
- exit();
324
- }
325
- curl_close($ch);
326
- return $content;
327
  }
328
 
329
- function mo_openid_send_email_alert($email,$phone,$message){
330
-
331
- // $hostname = Utilities::getHostname();
332
- $hostname = get_site_option('mo_openid_host_name') ;
333
- $url = $hostname.'/moas/api/notify/send';
334
- $ch = curl_init($url);
335
-
336
- // $customer_details = Utilities::getCustomerDetails();
337
- $customerKey = $this->defaultCustomerKey;
338
- $apiKey = $this->defaultApiKey;
339
-
340
- $currentTimeInMillis= round(microtime(true) * 1000);
341
- $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
342
- $hashValue = hash("sha512", $stringToHash);
343
- $customerKeyHeader = "Customer-Key: " . $customerKey;
344
- $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
345
- $authorizationHeader= "Authorization: " . $hashValue;
346
- $fromEmail = $email;
347
- $subject = "MiniOrange Social Login Plugin Feedback: ".$email;
348
- $site_url=site_url();
349
-
350
- $user= get_userdata(get_current_user_id());
351
-
352
-
353
- $query =" MiniOrange Social Login [Free] ";
354
- $content='<div >Hello, <br><br>First Name :'.$user->user_firstname.'<br><br>Last Name :'.$user->user_lastname.' <br><br>Company :<a href="'.$_SERVER['SERVER_NAME'].'" target="_blank" >'.$_SERVER['SERVER_NAME'].'</a><br><br>Phone Number :'.$phone.'<br><br><b>Email :<a href="mailto:'.$fromEmail.'" target="_blank">'.$fromEmail.'</a></b><br><br><b>Plugin Deactivated: '.$query.'</b><br><br><b>Reason: '.$message.'</b></div>';
355
-
356
-
357
- $fields = array(
358
- 'customerKey' => $customerKey,
359
- 'sendEmail' => true,
360
- 'email' => array(
361
- 'customerKey' => $customerKey,
362
- 'fromEmail' => $fromEmail,
363
- 'bccEmail' => 'socialloginsupport@miniorange.com',
364
- 'fromName' => 'miniOrange',
365
- 'toEmail' => 'socialloginsupport@miniorange.com',
366
- 'toName' => 'socialloginsupport@miniorange.com',
367
- 'subject' => $subject,
368
- 'content' => $content
369
- ),
370
- );
371
- $field_string = json_encode($fields);
372
-
373
-
374
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
375
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
376
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
377
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
378
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
379
-
380
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
381
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
382
- $timestampHeader, $authorizationHeader));
383
- curl_setopt( $ch, CURLOPT_POST, true);
384
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
385
- $content = curl_exec($ch);
386
-
387
- if(curl_errno($ch)){
388
- return json_encode(array("status"=>'ERROR','statusMessage'=>curl_error($ch)));
389
- }
390
- curl_close($ch);
391
-
392
- return ($content);
393
- }
394
 
395
  function submit_contact_us( $email, $phone, $query ) {
396
- global $current_user;
397
  $current_user = wp_get_current_user();
398
- $company = get_option('mo_openid_admin_company_name') ? get_option('mo_openid_admin_company_name') : '';
399
- $first_name = get_option('mo_openid_admin_first_name') ? get_option('mo_openid_admin_first_name') : '';
400
- $last_name = get_option('mo_openid_admin_last_name') ? get_option('mo_openid_admin_last_name') : '';
401
- $query = '[WP OpenID Connect Login Free Plugin] ' . $query;
402
  $fields = array(
403
  'firstName' => $first_name,
404
  'lastName' => $last_name,
@@ -409,80 +333,76 @@ class CustomerOpenID {
409
  );
410
  $field_string = json_encode( $fields );
411
 
412
- $url = get_option('mo_openid_host_name') . '/moas/rest/customer/contact-us';
 
 
 
 
 
 
 
 
 
 
 
 
413
 
414
- $ch = curl_init( $url );
415
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
416
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
417
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
418
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
419
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
420
-
421
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
422
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF-8', 'Authorization: Basic' ) );
423
- curl_setopt( $ch, CURLOPT_POST, true);
424
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
425
- $content = curl_exec( $ch );
426
-
427
- if( curl_errno( $ch ) ){
428
- echo 'Request Error:' . curl_error( $ch );
429
- return false;
430
- }
431
- //echo " Content: " . $content;
432
 
433
- curl_close( $ch );
434
 
435
- return true;
436
- }
437
-
438
- function forgot_password($email){
439
-
440
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/password-reset';
441
- $ch = curl_init($url);
442
-
443
  /* The customer Key provided to you */
444
  $customerKey = get_option('mo_openid_admin_customer_key');
445
-
446
  /* The customer API Key provided to you */
447
  $apiKey = get_option('mo_openid_admin_api_key');
448
-
449
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
450
- $currentTimeInMillis = self::get_timestamp();
451
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
452
  $hashValue = hash("sha512", $stringToHash);
453
-
454
- $customerKeyHeader = "Customer-Key: " . $customerKey;
455
- $timestampHeader = "Timestamp: " . $currentTimeInMillis;
456
- $authorizationHeader = "Authorization: " . $hashValue;
457
-
458
  $fields = '';
459
-
460
  //*check for otp over sms/email
461
  $fields = array(
462
  'email' => $email
463
  );
464
-
465
  $field_string = json_encode($fields);
466
-
467
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
468
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
469
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
470
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
471
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
472
-
473
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
474
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
475
- $timestampHeader, $authorizationHeader));
476
- curl_setopt( $ch, CURLOPT_POST, true);
477
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
478
- curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
479
- curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
480
- $content = curl_exec($ch);
481
-
482
- if(curl_errno($ch)){
483
- return null;
 
 
 
 
 
 
 
 
 
 
 
484
  }
485
- curl_close($ch);
486
- return $content;
487
  }
 
 
 
488
  }?>
22
  Contains Request Calls to Customer service.
23
 
24
  **/
25
+
26
  class CustomerOpenID {
27
 
28
  public $email;
29
  public $phone;
30
 
31
+ /*
32
+ The customer key and API key given below are used to send email OTP notifications through the miniOrange server and will be common for all the users. Along with that the user's OTP is also validated through these keys which are important to call our cloud OTP service. Since this is an integral part of our registration process, these keys are hard-coded and set here. These keys are used by three functions - send_otp_token (send OTP on email), validate_otp_token (validate OTP) and mo_openid_send_email_alert (feedback email).
33
+ */
34
  private $defaultCustomerKey = "16555";
35
  private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
36
 
37
  function create_customer(){
38
 
39
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/add';
 
 
40
  $current_user = wp_get_current_user();
41
  $this->email = get_option('mo_openid_admin_email');
 
 
 
 
42
  $password = get_option('mo_openid_admin_password');
43
 
44
  $fields = array(
 
45
  'areaOfInterest' => 'WP OpenID Connect Login Plugin',
 
 
46
  'email' => $this->email,
 
47
  'password' => $password
48
  );
49
  $field_string = json_encode($fields);
50
 
51
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ $args = array(
54
+ 'method' => 'POST',
55
+ 'body' => $field_string,
56
+ 'timeout' => '5',
57
+ 'redirection' => '5',
58
+ 'httpversion' => '1.0',
59
+ 'blocking' => true,
60
+ 'headers' => $headers
61
+ );
62
+ $response = self::mo_openid_wp_remote_post($url, $args);
63
+ return $response['body'];
64
  }
65
 
66
  function get_customer_key() {
67
  $url = get_option('mo_openid_host_name') . "/moas/rest/customer/key";
 
68
  $email = get_option("mo_openid_admin_email");
 
69
  $password = get_option("mo_openid_admin_password");
70
 
71
  $fields = array(
74
  );
75
  $field_string = json_encode( $fields );
76
 
77
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
78
+ $args = array(
79
+ 'method' => 'POST',
80
+ 'body' => $field_string,
81
+ 'timeout' => '5',
82
+ 'redirection' => '5',
83
+ 'httpversion' => '1.0',
84
+ 'blocking' => true,
85
+ 'headers' => $headers
86
+ );
87
+ $response = self::mo_openid_wp_remote_post($url, $args);
88
+ return $response['body'];
 
 
 
 
89
 
 
90
  }
91
 
92
  function check_customer() {
93
  $url = get_option('mo_openid_host_name') . "/moas/rest/customer/check-if-exists";
 
94
  $email = get_option("mo_openid_admin_email");
95
 
96
+
97
  $fields = array(
98
+ 'email' => $email
99
  );
100
  $field_string = json_encode( $fields );
101
 
102
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
103
+ $args = array(
104
+ 'method' => 'POST',
105
+ 'body' => $field_string,
106
+ 'timeout' => '5',
107
+ 'redirection' => '5',
108
+ 'httpversion' => '1.0',
109
+ 'blocking' => true,
110
+ 'headers' => $headers
111
+ );
112
+ $response = self::mo_openid_wp_remote_post($url, $args);
113
+ return $response['body'];
 
 
 
 
 
 
114
  }
115
 
116
  function send_otp_token($authType){
117
  $url = get_option('mo_openid_host_name') . '/moas/api/auth/challenge';
 
118
  $customerKey = $this->defaultCustomerKey;
119
  $apiKey = $this->defaultApiKey;
120
 
126
  $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
127
  $hashValue = hash("sha512", $stringToHash);
128
 
 
 
 
 
129
  if($authType == 'EMAIL') {
130
  $fields = array(
131
  'customerKey' => $customerKey,
143
  }
144
  $field_string = json_encode($fields);
145
 
146
+
147
+ $headers = array(
148
+ "Content-Type" => "application/json",
149
+ "Customer-Key" => $customerKey,
150
+ "Timestamp" => $currentTimeInMillis,
151
+ "Authorization" => $hashValue
152
+ );
153
+ $args = array(
154
+ 'method' => 'POST',
155
+ 'body' => $field_string,
156
+ 'timeout' => '5',
157
+ 'redirection' => '5',
158
+ 'httpversion' => '1.0',
159
+ 'blocking' => true,
160
+ 'headers' => $headers
161
+ );
162
+ $response = self::mo_openid_wp_remote_post($url, $args);
163
+ return $response['body'];
164
+
 
 
 
 
 
 
165
  }
166
 
167
+ function get_timestamp() {
168
+ $url = get_option ( 'mo_openid_host_name' ) . '/moas/rest/mobile/get-timestamp';
169
+ $response = self::mo_openid_wp_remote_post($url);
170
+ return $response['body'];
171
+
172
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  function check_customer_valid(){
175
  $url = get_option('mo_openid_host_name') . '/moas/api/customer/license';
 
176
  $customerKey = get_option('mo_openid_admin_customer_key');
177
  $apiKey = get_option('mo_openid_admin_api_key');
178
 
 
 
179
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
180
+ $currentTimeInMillis = self::get_timestamp();
181
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
182
  /* Creating the Hash using SHA-512 algorithm */
183
  $hashValue = hash("sha512", $stringToHash);
184
 
 
 
 
185
  $fields = array(
186
+ 'customerId' => $customerKey,
187
+ 'applicationName' => 'wp_social_login'
188
+ );
189
  $field_string = json_encode($fields);
190
 
191
+ $headers = array(
192
+ "Content-Type" => "application/json",
193
+ "Customer-Key" => $customerKey,
194
+ "Timestamp" => $currentTimeInMillis,
195
+ "Authorization" => $hashValue
196
+ );
197
+ $args = array(
198
+ 'method' => 'POST',
199
+ 'body' => $field_string,
200
+ 'timeout' => '5',
201
+ 'redirection' => '5',
202
+ 'httpversion' => '1.0',
203
+ 'blocking' => true,
204
+ 'headers' => $headers
205
+ );
206
+ $response = self::mo_openid_wp_remote_post($url, $args);
207
+ return $response['body'];
 
 
208
  }
209
 
210
  function validate_otp_token($transactionId,$otpToken){
211
  $url = get_option('mo_openid_host_name') . '/moas/api/auth/validate';
 
212
 
213
  $customerKey = $this->defaultCustomerKey;
214
  $apiKey = $this->defaultApiKey;
216
  $username = get_option('mo_openid_admin_email');
217
 
218
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
219
+ $currentTimeInMillis = self::get_timestamp();
220
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
221
  $hashValue = hash("sha512", $stringToHash);
222
 
 
 
 
223
 
224
  $fields = '';
225
 
226
+ //*check for otp over sms/email
227
+ $fields = array(
228
+ 'txId' => $transactionId,
229
+ 'token' => $otpToken
230
+ );
231
 
232
  $field_string = json_encode($fields);
233
 
234
+ $headers = array(
235
+ "Content-Type" => "application/json",
236
+ "Customer-Key" => $customerKey,
237
+ "Timestamp" => $currentTimeInMillis,
238
+ "Authorization" => $hashValue
239
+ );
240
+ $args = array(
241
+ 'method' => 'POST',
242
+ 'body' => $field_string,
243
+ 'timeout' => '5',
244
+ 'redirection' => '5',
245
+ 'httpversion' => '1.0',
246
+ 'blocking' => true,
247
+ 'headers' => $headers
248
+ );
249
+ $response = self::mo_openid_wp_remote_post($url, $args);
250
+ return $response['body'];
 
 
251
  }
252
 
253
+ function mo_openid_send_email_alert($email,$phone,$message){
254
+
255
+ // $hostname = Utilities::getHostname();
256
+ $hostname = get_site_option('mo_openid_host_name') ;
257
+ $url = $hostname.'/moas/api/notify/send';
258
+
259
+ // $customer_details = Utilities::getCustomerDetails();
260
+ $customerKey = $this->defaultCustomerKey;
261
+ $apiKey = $this->defaultApiKey;
262
+
263
+ $currentTimeInMillis = self::get_timestamp();
264
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
265
+ $hashValue = hash("sha512", $stringToHash);
266
+ $fromEmail = $email;
267
+ $subject = "MiniOrange Social Login Plugin Feedback: ".$email;
268
+ $site_url=site_url();
269
+
270
+ global $user;
271
+ $user= wp_get_current_user();
272
+
273
+ $query =" MiniOrange Social Login [Free] ";
274
+ $content='<div >Hello, <br><br>First Name :
275
+ <br><br>Last Name :
276
+ <br><br>Company :
277
+ <br><br>Phone Number :'.$phone.'
278
+ <br><br><b>Email :<a href="mailto:'.$fromEmail.'" target="_blank">'.$fromEmail.'</a></b>
279
+ <br><br><b>Plugin Deactivated: '.$query.'</b>
280
+ <br><br><b>Reason: '.$message.'</b></div>';
281
+
282
+
283
+ $fields = array(
284
+ 'customerKey' => $customerKey,
285
+ 'sendEmail' => true,
286
+ 'email' => array(
287
+ 'customerKey' => $customerKey,
288
+ 'fromEmail' => $fromEmail,
289
+ 'bccEmail' => 'socialloginsupport@miniorange.com',
290
+ 'fromName' => 'miniOrange',
291
+ 'toEmail' => 'socialloginsupport@miniorange.com',
292
+ 'toName' => 'socialloginsupport@miniorange.com',
293
+ 'subject' => $subject,
294
+ 'content' => $content
295
+ ),
296
+ );
297
+ $field_string = json_encode($fields);
298
+
299
+
300
+ $headers = array(
301
+ "Content-Type" => "application/json",
302
+ "Customer-Key" => $customerKey,
303
+ "Timestamp" => $currentTimeInMillis,
304
+ "Authorization" => $hashValue
305
+ );
306
+ $args = array(
307
+ 'method' => 'POST',
308
+ 'body' => $field_string,
309
+ 'timeout' => '5',
310
+ 'redirection' => '5',
311
+ 'httpversion' => '1.0',
312
+ 'blocking' => true,
313
+ 'headers' => $headers
314
+ );
315
+ $response = self::mo_openid_wp_remote_post($url, $args);
316
+ return $response['body'];
317
+ }
318
 
319
  function submit_contact_us( $email, $phone, $query ) {
320
+ $url = get_option('mo_openid_host_name') . '/moas/rest/customer/contact-us';
321
  $current_user = wp_get_current_user();
322
+ $company = get_option('mo_openid_admin_company_name') ? get_option('mo_openid_admin_company_name') : $_SERVER ['SERVER_NAME'];
323
+ $first_name = get_option('mo_openid_admin_first_name') ? get_option('mo_openid_admin_first_name') : $current_user->user_firstname;
324
+ $last_name = get_option('mo_openid_admin_last_name') ? get_option('mo_openid_admin_last_name') : $current_user->user_lastname;
325
+ $query = '[WP OpenID Connect Social Login Free Plugin] ' . $query;
326
  $fields = array(
327
  'firstName' => $first_name,
328
  'lastName' => $last_name,
333
  );
334
  $field_string = json_encode( $fields );
335
 
336
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
337
+ $args = array(
338
+ 'method' => 'POST',
339
+ 'body' => $field_string,
340
+ 'timeout' => '5',
341
+ 'redirection' => '5',
342
+ 'httpversion' => '1.0',
343
+ 'blocking' => true,
344
+ 'headers' => $headers
345
+ );
346
+ $response = self::mo_openid_wp_remote_post($url, $args);
347
+ return $response['body'];
348
+ }
349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
 
351
+ function forgot_password($email) {
352
 
 
 
 
 
 
353
  $url = get_option('mo_openid_host_name') . '/moas/rest/customer/password-reset';
354
+
 
355
  /* The customer Key provided to you */
356
  $customerKey = get_option('mo_openid_admin_customer_key');
357
+
358
  /* The customer API Key provided to you */
359
  $apiKey = get_option('mo_openid_admin_api_key');
360
+
361
  /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
362
+ $currentTimeInMillis = round ( microtime ( true ) * 1000 );
363
+ $stringToHash = $customerKey . number_format ( $currentTimeInMillis, 0, '', '' ) . $apiKey;
364
  $hashValue = hash("sha512", $stringToHash);
365
+
 
 
 
 
366
  $fields = '';
367
+
368
  //*check for otp over sms/email
369
  $fields = array(
370
  'email' => $email
371
  );
372
+
373
  $field_string = json_encode($fields);
374
+
375
+ $headers = array(
376
+ "Content-Type" => "application/json",
377
+ "Customer-Key" => $customerKey,
378
+ "Timestamp" => $currentTimeInMillis,
379
+ "Authorization" => $hashValue
380
+ );
381
+ $args = array(
382
+ 'method' => 'POST',
383
+ 'body' => $field_string,
384
+ 'timeout' => '5',
385
+ 'redirection' => '5',
386
+ 'httpversion' => '1.0',
387
+ 'blocking' => true,
388
+ 'headers' => $headers
389
+ );
390
+ $response = self::mo_openid_wp_remote_post($url, $args);
391
+ return $response['body'];
392
+ }
393
+
394
+ function mo_openid_wp_remote_post($url, $args = array()){
395
+
396
+ $response = wp_remote_post($url, $args);
397
+ if(!is_wp_error($response)){
398
+ return $response;
399
+ } else {
400
+ $show_error = new Miniorange_OpenID_SSO();
401
+ update_option('mo_openid_message', 'Unable to connect to the Internet. Please try again.');
402
+ $show_error->mo_openid_success_message();
403
  }
 
 
404
  }
405
+
406
+
407
+
408
  }?>
class-mo-openid-sso-shortcode-buttons.php CHANGED
@@ -7,31 +7,32 @@ function mo_openid_share_shortcode( $atts = '', $title = '', $excerpt = '' )
7
  if (mo_openid_is_customer_registered())
8
  {
9
  $html = '';
10
- $selected_theme = isset($atts['shape']) ? $atts['shape'] : get_option('mo_openid_share_theme');
11
- $selected_direction = get_option('mo_openid_share_widget_customize_direction');
12
- $sharingSize = isset($atts['size']) ? $atts['size'] : get_option('mo_sharing_icon_custom_size');
13
- $custom_color = isset($atts['backgroundcolor']) ? $atts['backgroundcolor'] : get_option('mo_sharing_icon_custom_color');
14
- $custom_theme = isset($atts['theme']) ? $atts['theme'] : get_option('mo_openid_share_custom_theme');
15
- $fontColor = isset($atts['fontcolor']) ? $atts['fontcolor'] : get_option('mo_sharing_icon_custom_font');
16
- $spaceBetweenIcons = isset($atts['space']) ? $atts['space'] : get_option('mo_sharing_icon_space');
17
- $textColor = isset($atts['color']) ? $atts['color'] : '#' . get_option('mo_openid_share_widget_customize_text_color');
18
- $text = isset($atts['heading']) ? $atts ['heading'] : get_option('mo_openid_share_widget_customize_text');
19
- $twitter_username = get_option('mo_openid_share_twitter_username');
20
- $url = isset($atts['url']) ? $atts['url'] : get_permalink();
21
- if (!$url) {
22
- $url = get_site_url();
23
- }
24
-
25
- if ($fontColor) {
26
- if (ctype_xdigit($fontColor) && strlen($fontColor) == 6 && strpos($fontColor, '#') == false) {
27
- $fontColor = "#" . $fontColor;
28
- } else
29
- $fontColor;
30
- }
31
-
32
- $email_subject = get_option('mo_openid_share_email_subject');
33
- $email_body = get_option('mo_openid_share_email_body');
34
- $email_body = str_replace('##url##', $url, $email_body);
 
35
 
36
  if ($custom_theme == 'custombackground') {
37
  $custom_theme = 'custom';
@@ -309,28 +310,26 @@ function mo_openid_share_shortcode( $atts = '', $title = '', $excerpt = '' )
309
  }
310
 
311
  function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt = '' ) {
312
- //$url = get_site_url();
313
- //$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
314
  if (mo_openid_is_customer_registered()) {
315
  $html = '';
316
- $selected_theme = isset($atts['shape']) ? $atts['shape'] : get_option('mo_openid_share_theme');
317
- $selected_direction = get_option('mo_openid_share_widget_customize_direction');
318
- $sharingSize = isset($atts['size']) ? $atts['size'] : get_option('mo_sharing_icon_custom_size');
319
- $custom_color = isset($atts['backgroundcolor']) ? $atts['backgroundcolor'] : get_option('mo_sharing_icon_custom_color');
320
- $custom_theme = isset($atts['theme']) ? $atts['theme'] : get_option('mo_openid_share_custom_theme');
321
- $fontColor = isset($atts['fontcolor']) ? $atts['fontcolor'] : get_option('mo_sharing_icon_custom_font');
322
- $spaceBetweenIcons = isset($atts['space']) ? $atts['space'] : '10';
323
-
324
- $alignment = isset($atts['alignment']) ? $atts['alignment'] : 'left';
325
- $left_offset = isset($atts['leftoffset']) ? $atts['leftoffset'] : '20';
326
- $right_offset = isset($atts['rightoffset']) ? $atts['rightoffset'] : '10';
327
- $top_offset = isset($atts['topoffset']) ? $atts['topoffset'] : '100';
328
-
329
-
330
  $twitter_username = get_option('mo_openid_share_twitter_username');
331
- $url = isset($atts['url']) ? $atts['url'] : "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
332
 
333
- $email_subject = get_option('mo_openid_share_email_subject');
334
  $email_body = get_option('mo_openid_share_email_body');
335
  $email_body = str_replace('##url##', $url, $email_body);
336
 
@@ -341,13 +340,10 @@ function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt =
341
  $custom_theme = 'customFont';
342
  }
343
 
344
- //$orientation = 'ver';
345
-
346
  $html .= "<div class='mo_openid_vertical' style='" . (isset($alignment) && $alignment != '' ? $alignment . ': ' . (${$alignment . '_offset'} == '' ? 0 : ${$alignment . '_offset'}) . 'px;' : '') . (isset($top_offset) ? 'top: ' . ($top_offset == '' ? 0 : $top_offset) . 'px;' : '') . "'>";
347
 
348
  $html .= '<div class="mo-openid-app-icons circle ">';
349
  $html .= '<p>';
350
- //if( $orientation == 'ver' ) {
351
 
352
  $html .= "<div id='mo_floating_vertical_shortcode'>";
353
  if ($custom_theme == 'custom') {
7
  if (mo_openid_is_customer_registered())
8
  {
9
  $html = '';
10
+ $selected_theme = isset( $atts['shape'] )? esc_attr($atts['shape']) : esc_attr(get_option('mo_openid_share_theme'));
11
+ $selected_direction = esc_attr(get_option('mo_openid_share_widget_customize_direction'));
12
+ $sharingSize = isset( $atts['size'] )? esc_attr($atts['size']) : esc_attr(get_option('mo_sharing_icon_custom_size'));
13
+ $custom_color = isset( $atts['backgroundcolor'] )? esc_attr($atts['backgroundcolor']) : esc_attr(get_option('mo_sharing_icon_custom_color'));
14
+ $custom_theme = isset( $atts['theme'] )? esc_attr($atts['theme']) : esc_attr(get_option('mo_openid_share_custom_theme'));
15
+ $fontColor = isset( $atts['fontcolor'] )? esc_attr($atts['fontcolor']) : esc_attr(get_option('mo_sharing_icon_custom_font'));
16
+ $spaceBetweenIcons = isset( $atts['space'] )? esc_attr($atts['space']) : esc_attr(get_option('mo_sharing_icon_space'));
17
+ $textColor = isset( $atts['color'] ) ? esc_attr($atts['color']) : '#'.esc_attr(get_option('mo_openid_share_widget_customize_text_color'));
18
+ $text = isset( $atts['heading'] ) ? esc_attr($atts ['heading']) : esc_attr(get_option('mo_openid_share_widget_customize_text'));
19
+ $twitter_username = get_option('mo_openid_share_twitter_username');
20
+ $url = isset( $atts['url'])? esc_url($atts['url']) : esc_url(get_permalink());
21
+ if(!$url) {
22
+ $url = esc_attr(get_site_url());
23
+ }
24
+
25
+ if($fontColor)
26
+ {
27
+ if(ctype_xdigit($fontColor) && strlen($fontColor)==6 && strpos($fontColor,'#')==false){
28
+ $fontColor= "#".$fontColor;
29
+ }else
30
+ $fontColor;
31
+ }
32
+
33
+ $email_subject = esc_html(get_option('mo_openid_share_email_subject'));
34
+ $email_body = get_option('mo_openid_share_email_body');
35
+ $email_body = str_replace('##url##', $url, $email_body);
36
 
37
  if ($custom_theme == 'custombackground') {
38
  $custom_theme = 'custom';
310
  }
311
 
312
  function mo_openid_vertical_share_shortcode( $atts = '', $title = '', $excerpt = '' ) {
 
 
313
  if (mo_openid_is_customer_registered()) {
314
  $html = '';
315
+ $selected_theme = isset( $atts['shape'] )? esc_attr($atts['shape']) : esc_attr(get_option('mo_openid_share_theme'));
316
+ $selected_direction = esc_attr(get_option('mo_openid_share_widget_customize_direction'));
317
+ $sharingSize = isset( $atts['size'] )? esc_attr($atts['size']) : esc_attr(get_option('mo_sharing_icon_custom_size'));
318
+ $custom_color = isset( $atts['backgroundcolor'] )? esc_attr($atts['backgroundcolor']) : esc_attr(get_option('mo_sharing_icon_custom_color'));
319
+ $custom_theme = isset( $atts['theme'] )? esc_attr($atts['theme']) : esc_attr(get_option('mo_openid_share_custom_theme'));
320
+ $fontColor = isset( $atts['fontcolor'] )? esc_attr($atts['fontcolor']) : esc_attr(get_option('mo_sharing_icon_custom_font'));
321
+ $spaceBetweenIcons = isset( $atts['space'] )? esc_attr($atts['space']) : '10';
322
+
323
+ $alignment = isset( $atts['alignment'] )? esc_attr($atts['alignment']) : 'left';
324
+ $left_offset = isset( $atts['leftoffset'] )? esc_attr($atts['leftoffset']) : '20';
325
+ $right_offset = isset( $atts['rightoffset'] )? esc_attr($atts['rightoffset']) : '10';
326
+ $top_offset = isset( $atts['topoffset'] )? esc_attr($atts['topoffset']) : '100';
327
+
328
+
329
  $twitter_username = get_option('mo_openid_share_twitter_username');
330
+ $url = isset( $atts['url'])? esc_url($atts['url']) : esc_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
331
 
332
+ $email_subject = esc_attr(get_option('mo_openid_share_email_subject'));
333
  $email_body = get_option('mo_openid_share_email_body');
334
  $email_body = str_replace('##url##', $url, $email_body);
335
 
340
  $custom_theme = 'customFont';
341
  }
342
 
 
 
343
  $html .= "<div class='mo_openid_vertical' style='" . (isset($alignment) && $alignment != '' ? $alignment . ': ' . (${$alignment . '_offset'} == '' ? 0 : ${$alignment . '_offset'}) . 'px;' : '') . (isset($top_offset) ? 'top: ' . ($top_offset == '' ? 0 : $top_offset) . 'px;' : '') . "'>";
344
 
345
  $html .= '<div class="mo-openid-app-icons circle ">';
346
  $html .= '<p>';
 
347
 
348
  $html .= "<div id='mo_floating_vertical_shortcode'>";
349
  if ($custom_theme == 'custom') {
class-mo-openid-twitter-oauth.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mo_Openid_Twitter_OAuth
4
+ {
5
+ var $key = '';
6
+ var $secret = '';
7
+
8
+ var $request_token = "https://twitter.com/oauth/request_token";
9
+ var $access_token = "https://twitter.com/oauth/access_token";
10
+ var $profile = "https://api.twitter.com/1.1/account/verify_credentials.json";
11
+
12
+ function __construct($client_key,$client_secret)
13
+ {
14
+ $this->key = $client_key; // consumer key from twitter
15
+ $this->secret = $client_secret; // secret from twitter
16
+ }
17
+
18
+ function mo_twitter_get_request_token()
19
+ {
20
+ // Default params
21
+ $params = array(
22
+ "oauth_version" => "1.0",
23
+ "oauth_nonce" => time(),
24
+ "oauth_timestamp" => time(),
25
+ "oauth_consumer_key" => $this->key,
26
+ "oauth_signature_method" => "HMAC-SHA1"
27
+ );
28
+
29
+ // BUILD SIGNATURE
30
+ // encode params keys, values, join and then sort.
31
+ $keys = $this->mo_twitter_url_encode_rfc3986(array_keys($params));
32
+ $values = $this->mo_twitter_url_encode_rfc3986(array_values($params));
33
+ $params = array_combine($keys, $values);
34
+ uksort($params, 'strcmp');
35
+
36
+ // convert params to string
37
+ foreach ($params as $k => $v) {
38
+ $pairs[] = $this->mo_twitter_url_encode_rfc3986($k).'='.$this->mo_twitter_url_encode_rfc3986($v);
39
+ }
40
+ $concatenatedParams = implode('&', $pairs);
41
+
42
+ // form base string (first key)
43
+ $baseString= "GET&".$this->mo_twitter_url_encode_rfc3986($this->request_token)."&".$this->mo_twitter_url_encode_rfc3986($concatenatedParams);
44
+ // form secret (second key)
45
+ $secret = $this->mo_twitter_url_encode_rfc3986($this->secret)."&";
46
+ // make signature and append to params
47
+ $params['oauth_signature'] = $this->mo_twitter_url_encode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
48
+
49
+ // BUILD URL
50
+ // Resort
51
+ uksort($params, 'strcmp');
52
+ // convert params to string
53
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
54
+ $concatenatedUrlParams = implode('&', $urlPairs);
55
+ // form url
56
+ $url = $this->request_token."?".$concatenatedUrlParams;
57
+
58
+ // Send to cURL
59
+ return $this->mo_twitter_http($url);
60
+ }
61
+
62
+ function mo_twitter_get_access_token($oauth_verifier,$twitter_oauth_token)
63
+ {
64
+ $params = array(
65
+ "oauth_version" => "1.0",
66
+ "oauth_nonce" => time(),
67
+ "oauth_timestamp" => time(),
68
+ "oauth_consumer_key" => $this->key,
69
+ "oauth_token" => $twitter_oauth_token,
70
+ "oauth_signature_method" => "HMAC-SHA1"
71
+ );
72
+
73
+ $keys = $this->mo_twitter_url_encode_rfc3986(array_keys($params));
74
+ $values = $this->mo_twitter_url_encode_rfc3986(array_values($params));
75
+ $params = array_combine($keys, $values);
76
+ uksort($params, 'strcmp');
77
+
78
+ foreach ($params as $k => $v) {
79
+ $pairs[] = $this->mo_twitter_url_encode_rfc3986($k).'='.$this->mo_twitter_url_encode_rfc3986($v);
80
+ }
81
+ $concatenatedParams = implode('&', $pairs);
82
+
83
+ $baseString= "GET&".$this->mo_twitter_url_encode_rfc3986($this->access_token)."&".$this->mo_twitter_url_encode_rfc3986($concatenatedParams);
84
+ $secret = $this->mo_twitter_url_encode_rfc3986($this->secret)."&";
85
+ $params['oauth_signature'] = $this->mo_twitter_url_encode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
86
+
87
+ uksort($params, 'strcmp');
88
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
89
+ $concatenatedUrlParams = implode('&', $urlPairs);
90
+ $url = $this->access_token."?".$concatenatedUrlParams;
91
+ $postData = 'oauth_verifier=' .$oauth_verifier;
92
+
93
+ return $this->mo_twitter_http($url,$postData);
94
+ }
95
+
96
+ function mo_twitter_get_profile_signature($oauth_token,$oauth_token_secret,$screen_name)
97
+ {
98
+ $params = array(
99
+ "oauth_version" => "1.0",
100
+ "oauth_nonce" => time(),
101
+ "oauth_timestamp" => time(),
102
+ "oauth_consumer_key" => $this->key,
103
+ "oauth_token" => $oauth_token,
104
+ "oauth_signature_method" => "HMAC-SHA1",
105
+ "screen_name" => $screen_name,
106
+ "include_email" => "true"
107
+ );
108
+
109
+ $keys = $this->mo_twitter_url_encode_rfc3986(array_keys($params));
110
+ $values = $this->mo_twitter_url_encode_rfc3986(array_values($params));
111
+ $params = array_combine($keys, $values);
112
+ uksort($params, 'strcmp');
113
+
114
+ foreach ($params as $k => $v) {
115
+ $pairs[] = $this->mo_twitter_url_encode_rfc3986($k).'='.$this->mo_twitter_url_encode_rfc3986($v);
116
+ }
117
+ $concatenatedParams = implode('&', $pairs);
118
+
119
+ $baseString= "GET&".$this->mo_twitter_url_encode_rfc3986($this->profile)."&".$this->mo_twitter_url_encode_rfc3986($concatenatedParams);
120
+
121
+ $secret = $this->mo_twitter_url_encode_rfc3986($this->secret)."&". $this->mo_twitter_url_encode_rfc3986($oauth_token_secret);
122
+ $params['oauth_signature'] = $this->mo_twitter_url_encode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
123
+
124
+ uksort($params, 'strcmp');
125
+ foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
126
+ $concatenatedUrlParams = implode('&', $urlPairs);
127
+ $url = $this->profile."?".$concatenatedUrlParams;
128
+
129
+ $args = array();
130
+
131
+ $get_response = wp_remote_get($url,$args);
132
+
133
+ $profile_json_output = json_decode($get_response['body'], true);
134
+
135
+ return $profile_json_output;
136
+ }
137
+
138
+ function mo_twitter_http($url, $post_data = null)
139
+ {
140
+
141
+ if(isset($post_data))
142
+ {
143
+
144
+ $args = array(
145
+ 'method' => 'POST',
146
+ 'body' => $post_data,
147
+ 'timeout' => '5',
148
+ 'redirection' => '5',
149
+ 'httpversion' => '1.0',
150
+ 'blocking' => true
151
+ );
152
+
153
+ $post_response = wp_remote_post($url,$args);
154
+
155
+ return $post_response['body'];
156
+
157
+ }
158
+ $args = array();
159
+
160
+ $get_response = wp_remote_get($url,$args);
161
+ $response = $get_response['body'];
162
+ mo_openid_start_session();
163
+
164
+ $dirs = explode('&', $response);
165
+ $dirs1 = explode('=', $dirs[0]);
166
+ return $dirs1[1];
167
+
168
+ }
169
+
170
+ function mo_twitter_url_encode_rfc3986($input)
171
+ {
172
+ if (is_array($input)) {
173
+ return array_map(array('Mo_Openid_Twitter_OAuth', 'mo_twitter_url_encode_rfc3986'), $input);
174
+ }
175
+ else if (is_scalar($input)) {
176
+ return str_replace('+',' ',str_replace('%7E', '~', rawurlencode($input)));
177
+ }
178
+ else{
179
+ return '';
180
+ }
181
+ }
182
+ }
183
+ ?>
includes/images/icons/google.png CHANGED
Binary file
includes/images/icons/mail.png CHANGED
Binary file
includes/images/icons/print.png CHANGED
Binary file
includes/images/icons/whatsapp.png CHANGED
Binary file
includes/images/icons/yahoo.png CHANGED
Binary file
miniorange_openid_sso_settings.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Social Login, Social Sharing by miniOrange
4
  * Plugin URI: https://www.miniorange.com/social-login
5
  * Description: Allow your users to login, comment and share with social login apps like Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
6
- * Version: 7.1.6
7
  * Author: social login (miniOrange)
8
  * License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
  */
@@ -13,7 +13,7 @@ include_once dirname( __FILE__ ) . '/class-mo-openid-login-widget.php';
13
  require('class-mo-openid-sso-customer.php');
14
  require('class-mo-openid-sso-shortcode-buttons.php');
15
  require('class-mo-openid-social-comment.php');
16
- define('MO_OPENID_SOCIAL_LOGIN_VERSION', '7.1.6');
17
  include dirname( __FILE__ ) . '/mo_openid_feedback_form.php';
18
  class Miniorange_OpenID_SSO {
19
 
@@ -84,13 +84,6 @@ class Miniorange_OpenID_SSO {
84
  add_action( 'woocommerce_after_checkout_billing_form', array($this, 'mo_openid_add_social_login'));
85
  }
86
 
87
- /* if(get_option('mo_openid_woocommerce_edit_account_form_start') == 1){
88
- add_action( 'woocommerce_edit_account_form_start', array($this, 'mo_openid_add_social_login'));
89
- }
90
- if(get_option('mo_openid_woocommerce_edit_account_form_end') == 1){
91
- add_action( 'woocommerce_edit_account_form_end', array($this, 'mo_openid_add_social_login'));
92
- }*/
93
-
94
  //add social login to buddypress
95
  if(get_option('mo_openid_bp_before_register_page') == 1){
96
  add_action( 'bp_before_register_page', array($this, 'mo_openid_add_social_login'));
@@ -275,8 +268,6 @@ Thank you.';
275
  add_option( 'mo_openid_woocommerce_register_form_end','0');
276
  add_option( 'mo_openid_woocommerce_before_checkout_billing_form','0');
277
  add_option( 'mo_openid_woocommerce_after_checkout_billing_form','0');
278
- // add_option( 'mo_openid_woocommerce_edit_account_form_start');
279
- // add_option( 'mo_openid_woocommerce_edit_account_form_end');
280
  //buddypress display options
281
  add_option( 'mo_openid_bp_before_register_page','0');
282
  add_option( 'mo_openid_bp_before_account_details_fields','0');
@@ -390,10 +381,10 @@ Thank you.';
390
  )
391
  );
392
  if($output === false){
393
- /*$wpdb->show_errors();
394
  $wpdb->print_error();
395
- exit;*/
396
  wp_die('Error in insert Query');
 
397
  }
398
 
399
  }
@@ -419,10 +410,10 @@ Thank you.';
419
  )
420
  );
421
  if($result === false){
422
- /*$wpdb->show_errors();
423
  $wpdb->print_error();
424
- exit;*/
425
  wp_die('Error in deletion query');
 
426
  }
427
  }
428
  update_option('mo_openid_social_login_version',MO_OPENID_SOCIAL_LOGIN_VERSION);
@@ -434,10 +425,9 @@ Thank you.';
434
  }
435
 
436
  function mo_openid_add_social_login(){
437
-
438
- if(!is_user_logged_in() && mo_openid_is_customer_registered() && strpos( $_SERVER['QUERY_STRING'], 'disable-social-login' ) == false){
439
- $mo_login_widget = new mo_openid_login_wid();
440
- $mo_login_widget->openidloginForm();
441
  }
442
  }
443
 
@@ -615,7 +605,7 @@ Thank you.';
615
 
616
  public function if_custom_app_exists($app_name){
617
  if(get_option('mo_openid_apps_list'))
618
- $appslist = get_option('mo_openid_apps_list');
619
  else
620
  $appslist = array();
621
 
@@ -636,101 +626,105 @@ Thank you.';
636
  add_action('admin_notices', array($this, 'mo_openid_activation_message'));
637
  }
638
 
639
- if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_connect_register_customer" ) { //register the admin to miniOrange
640
-
641
- //validation and sanitization
642
- $company = '';
643
- $first_name = '';
644
- $last_name = '';
645
- $email = '';
646
- $phone = '';
647
- $password = '';
648
- $confirmPassword = '';
649
- $illegal = "#$%^*()+=[]';,/{}|:<>?~";
650
- $illegal = $illegal . '"';
651
- if( $this->mo_openid_check_empty_or_null( $_POST['company'] ) || $this->mo_openid_check_empty_or_null( $_POST['email'] ) || $this->mo_openid_check_empty_or_null( $_POST['password'] ) || $this->mo_openid_check_empty_or_null( $_POST['confirmPassword'] ) ) {
652
- update_option( 'mo_openid_message', 'All the fields are required. Please enter valid entries.');
653
- $this->mo_openid_show_error_message();
654
- if(get_option('regi_pop_up') =="yes") {
655
- update_option('pop_regi_msg', get_option('mo_openid_message'));
656
- mo_openid_registeration_modal();
657
- }
658
- return;
659
- } else if( strlen( $_POST['password'] ) < 6 || strlen( $_POST['confirmPassword'] ) < 6){ //check password is of minimum length 6
660
- update_option( 'mo_openid_message', 'Choose a password with minimum length 6.');
661
- $this->mo_openid_show_error_message();
662
- if(get_option('regi_pop_up') =="yes"){
663
- update_option('pop_regi_msg', get_option('mo_openid_message'));
664
- mo_openid_registeration_modal();
665
- }
666
- return;
667
- } else if(strpbrk($_POST['email'],$illegal)) {
668
- update_option( 'mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
669
- $this->mo_openid_show_error_message();
670
- if(get_option('regi_pop_up') =="yes"){
671
- update_option('pop_regi_msg', get_option('mo_openid_message'));
672
- mo_openid_registeration_modal();
673
- }
674
- return;
675
  } else {
676
- $company = sanitize_text_field($_POST['company']);
677
- $first_name = sanitize_text_field(isset($_POST['fname'])?$_POST['fname']:'');
678
- $last_name = sanitize_text_field(isset($_POST['lname'])?$_POST['lname']:'');
679
- $email = sanitize_email( $_POST['email'] );
680
- $phone = sanitize_text_field( isset($_POST['phone'])?$_POST['phone']:'' );
681
- $password = stripslashes( $_POST['password'] );
682
- $confirmPassword = stripslashes( $_POST['confirmPassword'] );
683
-
684
- }
685
-
686
- update_option( 'mo_openid_admin_company_name', $company);
687
- update_option( 'mo_openid_admin_first_name', $first_name);
688
- update_option( 'mo_openid_admin_last_name', $last_name);
689
- update_option( 'mo_openid_admin_email', $email );
690
- update_option( 'mo_openid_admin_phone', $phone );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
 
692
- if( strcmp( $password, $confirmPassword) == 0 ) {
693
- update_option( 'mo_openid_admin_password', $password );
694
 
695
- $customer = new CustomerOpenID();
696
- $content = json_decode($customer->check_customer(), true);
697
- if( strcasecmp( $content['status'], 'CUSTOMER_NOT_FOUND') == 0 ){
698
- $content = json_decode($customer->send_otp_token('EMAIL'), true);
699
- if(strcasecmp($content['status'], 'SUCCESS') == 0) {
700
- if(get_option('mo_openid_email_otp_count')){
701
- update_option('mo_openid_email_otp_count',get_option('mo_openid_email_otp_count') + 1);
702
- update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_email_otp_count') . ' )</b> for verification to ' . get_option('mo_openid_admin_email'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
  }else{
704
- update_option( 'mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
705
- update_option('mo_openid_email_otp_count',1);
706
- }
707
- update_option('mo_openid_transactionId',$content['txId']);
708
- update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
709
 
710
- $this->mo_openid_show_success_message();
711
- if(get_option('regi_pop_up') =="yes")
712
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
 
 
 
713
  }else{
714
-
715
- update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
716
- update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
717
- $this->mo_openid_show_error_message();
718
- if(get_option('regi_pop_up') =="yes")
719
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
720
  }
721
- }else{
722
- $this->get_current_customer();
723
- }
724
 
725
- } else {
726
 
727
- update_option( 'mo_openid_message', 'Passwords do not match.');
728
- if(get_option('regi_pop_up') =="yes"){
729
- update_option('pop_regi_msg', get_option('mo_openid_message'));
730
- mo_openid_registeration_modal();
 
 
 
731
  }
732
- delete_option('mo_openid_verify_customer');
733
- $this->mo_openid_show_error_message();
734
  }
735
 
736
  } else if( isset( $_POST['show_login'] ) )
@@ -738,642 +732,679 @@ Thank you.';
738
 
739
  mo_pop_show_verify_password_page();
740
  }
741
- else if(isset($_POST['option']) and $_POST['option'] == "mo_openid_validate_otp"){
742
- //validation and sanitization
743
- $otp_token = '';
744
- if( $this->mo_openid_check_empty_or_null( $_POST['otp_token'] ) ) {
745
- update_option( 'mo_openid_message', 'Please enter a value in OTP field.');
746
- update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
747
-
748
- $this->mo_openid_show_error_message();
749
- if(get_option('regi_pop_up') =="yes")
750
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
751
- return;
752
- } else if(!preg_match('/^[0-9]*$/', $_POST['otp_token'])) {
753
- update_option( 'mo_openid_message', 'Please enter a valid value in OTP field.');
754
- update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
755
- $this->mo_openid_show_error_message();
756
-
757
- if(get_option('regi_pop_up') =="yes")
758
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
759
- return;
760
- } else{
761
- $otp_token = sanitize_text_field( $_POST['otp_token'] );
762
- }
763
 
764
- $customer = new CustomerOpenID();
765
- $content = json_decode($customer->validate_otp_token(get_option('mo_openid_transactionId'), $otp_token ),true);
766
- if(strcasecmp($content['status'], 'SUCCESS') == 0) {
767
- $this->create_customer();
768
- update_option('mo_openid_oauth','1');
769
- update_option('mo_openid_new_user','1');
770
- update_option('mo_openid_malform_error','1');
771
-
772
- }else{
773
- update_option( 'mo_openid_message','Invalid one time passcode. Please enter a valid passcode.');
774
- update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
775
- $this->mo_openid_show_error_message();
776
- if(get_option('regi_pop_up') =="yes")
777
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
778
- }
779
- }
780
- else if( isset($_POST['option']) and $_POST['option'] == 'mo_openid_phone_verification'){ //at registration time
781
- $phone = sanitize_text_field($_POST['phone_number']);
782
-
783
- $phone = str_replace(' ', '', $phone);
784
- update_option('mo_openid_admin_phone',$phone);
785
- $auth_type = 'SMS';
786
- $customer = new CustomerOpenID();
787
- $send_otp_response = json_decode($customer->send_otp_token($auth_type),true);
788
- if(strcasecmp($send_otp_response['status'], 'SUCCESS') == 0){
789
- //Save txId
790
-
791
- update_option('mo_openid_transactionId',$send_otp_response['txId']);
792
- update_option( 'mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
793
- if(get_option('mo_openid_sms_otp_count')){
794
- update_option('mo_openid_sms_otp_count',get_option('mo_openid_sms_otp_count') + 1);
795
- update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_sms_otp_count') . ' )</b> for verification to ' . $phone);
796
- }else{
797
 
798
- update_option('mo_openid_message', 'One Time Passcode has been sent for verification to ' . $phone);
799
- update_option('mo_openid_sms_otp_count',1);
 
 
 
800
  }
801
 
802
- $this->mo_openid_show_success_message();
803
-
804
- }else{
805
- update_option('mo_openid_message','There was an error in sending sms. Please click on Resend OTP link next to phone number textbox.');
806
- update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
807
- $this->mo_openid_show_error_message();
 
808
 
 
 
 
 
 
 
 
809
  }
810
  }
811
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_connect_verify_customer" ) { //register the admin to miniOrange
 
 
 
 
 
812
 
813
- //validation and sanitization
814
- $email = '';
815
- $password = '';
816
- $illegal = "#$%^*()+=[]';,/{}|:<>?~";
817
- $illegal = $illegal . '"';
818
- if( $this->mo_openid_check_empty_or_null( $_POST['email'] ) || $this->mo_openid_check_empty_or_null( $_POST['password'] ) ) {
819
- update_option( 'mo_openid_message', 'All the fields are required. Please enter valid entries.');
820
- $this->mo_openid_show_error_message();
821
- return;
822
- } else if(strpbrk($_POST['email'],$illegal)) {
823
- update_option( 'mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
824
- $this->mo_openid_show_error_message();
825
- return;
826
- } else{
827
- $email = sanitize_email( $_POST['email'] );
828
- $password = stripslashes( $_POST['password'] );
829
- }
830
 
831
- update_option( 'mo_openid_admin_email', $email );
832
- update_option( 'mo_openid_admin_password', $password );
833
- $customer = new CustomerOpenID();
834
- $content = $customer->get_customer_key();
835
- $customerKey = json_decode( $content, true );
836
- if( isset($customerKey) ) {
837
- update_option( 'mo_openid_admin_customer_key', $customerKey['id'] );
838
- update_option( 'mo_openid_admin_api_key', $customerKey['apiKey'] );
839
- update_option( 'mo_openid_customer_token', $customerKey['token'] );
840
- update_option( 'mo_openid_admin_phone', $customerKey['phone'] );
841
- update_option('mo_openid_admin_password', '');
842
- update_option( 'mo_openid_message', 'Your account has been retrieved successfully.');
843
- delete_option('mo_openid_verify_customer');
844
- $this->mo_openid_show_success_message();
845
- } else {
846
- update_option( 'mo_openid_message', 'Invalid username or password. Please try again.');
847
- $this->mo_openid_show_error_message();
848
- if(get_option('regi_pop_up') =="yes") {
849
- update_option("pop_login_msg",get_option("mo_openid_message"));
850
- mo_pop_show_verify_password_page();
851
 
852
  }
853
  }
854
- update_option('mo_openid_admin_password', '');
855
  }
856
- else if(isset($_POST['option']) and $_POST['option'] == 'mo_openid_forgot_password'){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
857
 
858
- $email ='';
859
- if( $this->mo_openid_check_empty_or_null( $email ) ) {
860
- if( $this->mo_openid_check_empty_or_null( $_POST['email'] ) ) {
861
- update_option( 'mo_openid_message', 'No email provided. Please enter your email below to reset password.');
 
 
 
 
 
 
 
 
 
 
 
 
862
  $this->mo_openid_show_error_message();
863
- if(get_option('regi_pop_up') =="yes"){
864
  update_option("pop_login_msg",get_option("mo_openid_message"));
865
  mo_pop_show_verify_password_page();
866
 
867
  }
868
- return;
869
- } else {
870
- $email = $_POST['email'];
871
-
872
  }
 
873
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
 
 
 
 
 
875
 
876
- $customer = new CustomerOpenID();
877
- $content = json_decode($customer->forgot_password($email),true);
878
- if(strcasecmp($content['status'], 'SUCCESS') == 0){
879
- update_option( 'mo_openid_message','You password has been reset successfully. Please enter the new password sent to your registered mail here.');
880
- $this->mo_openid_show_success_message();
881
- if(get_option('regi_pop_up') =="yes"){
882
- update_option("pop_login_msg",get_option("mo_openid_message"));
883
- mo_pop_show_verify_password_page();
884
-
885
  }
886
- }else{
887
- update_option( 'mo_openid_message','An error occured while processing your request. Please make sure you are registered with miniOrange with the given email address.');
888
- $this->mo_openid_show_error_message();
889
- if(get_option('regi_pop_up') =="yes"){
890
- update_option("pop_login_msg",get_option("mo_openid_message"));
891
- mo_pop_show_verify_password_page();
892
 
893
- }
894
- }
895
- }
896
- else if(isset($_POST['option']) and $_POST['option'] == 'mo_openid_check_license'){
897
- if(mo_openid_is_customer_registered()) {
898
  $customer = new CustomerOpenID();
899
- $content = json_decode($customer->check_customer_valid(),true);
900
  if(strcasecmp($content['status'], 'SUCCESS') == 0){
901
- update_option( 'mo_openid_admin_customer_valid', strcasecmp($content['licenseType'], 'Premium') !== FALSE ? 1 : 0);
902
- update_option( 'mo_openid_admin_customer_plan', isset($content['licensePlan']) ? base64_encode($content['licensePlan']) : 0);
903
- if(get_option('mo_openid_admin_customer_valid') && isset($content['licensePlan'])){
904
- $license = explode(' -', $content['licensePlan']);
905
- $lp = $license[0];
906
- update_option( 'mo_openid_message','You are on the old ' . $lp . '.');
907
- } else
908
- update_option( 'mo_openid_message','You are on the Free Plan.');
909
- $this->mo_openid_show_success_message();
910
- }else if(strcasecmp($content['status'], 'FAILED') == 0){
911
- update_option('mo_openid_message', 'You are on Free Plan.');
912
  $this->mo_openid_show_success_message();
 
 
 
 
 
913
  }else{
914
- update_option( 'mo_openid_message','An error occured while processing your request. Please try again.');
915
  $this->mo_openid_show_error_message();
 
 
 
 
 
916
  }
917
- } else {
918
- update_option('mo_openid_message', 'Please register an account before trying to check your plan');
919
- $this->mo_openid_show_error_message();
920
  }
921
  }
922
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_enable_apps" ) {
923
-
924
-
925
- update_option( 'mo_openid_google_enable', isset( $_POST['mo_openid_google_enable']) ? $_POST['mo_openid_google_enable'] : 0);
926
- update_option( 'mo_openid_salesforce_enable', isset( $_POST['mo_openid_salesforce_enable']) ? $_POST['mo_openid_salesforce_enable'] : 0);
927
- if($this->if_custom_app_exists('facebook')) {
928
- update_option('mo_openid_facebook_enable', isset($_POST['mo_openid_facebook_enable']) ? $_POST['mo_openid_facebook_enable'] : 0);
929
- }
930
- else if(isset($_POST['mo_openid_facebook_enable'])) {
931
- update_option('mo_openid_facebook_enable',0);
932
- $this->mo_openid_show_facebook_error_message();
933
-
934
- }
935
- update_option( 'mo_openid_linkedin_enable', isset( $_POST['mo_openid_linkedin_enable']) ? $_POST['mo_openid_linkedin_enable'] : 0);
936
- update_option( 'mo_openid_windowslive_enable', isset( $_POST['mo_openid_windowslive_enable']) ? $_POST['mo_openid_windowslive_enable'] : 0);
937
- update_option( 'mo_openid_amazon_enable', isset( $_POST['mo_openid_amazon_enable']) ? $_POST['mo_openid_amazon_enable'] : 0);
938
- update_option( 'mo_openid_instagram_enable', isset( $_POST['mo_openid_instagram_enable']) ? $_POST['mo_openid_instagram_enable'] : 0);
939
- update_option( 'mo_openid_twitter_enable', isset( $_POST['mo_openid_twitter_enable']) ? $_POST['mo_openid_twitter_enable'] : 0);
940
- update_option( 'mo_openid_vkontakte_enable', isset( $_POST['mo_openid_vkontakte_enable']) ? $_POST['mo_openid_vkontakte_enable'] : 0);
941
- update_option( 'mo_openid_yahoo_enable', isset( $_POST['mo_openid_yahoo_enable']) ? $_POST['mo_openid_yahoo_enable'] : 0);
942
-
943
- update_option( 'mo_openid_default_login_enable', isset( $_POST['mo_openid_default_login_enable']) ? $_POST['mo_openid_default_login_enable'] : 0);
944
- update_option( 'mo_openid_default_register_enable', isset( $_POST['mo_openid_default_register_enable']) ? $_POST['mo_openid_default_register_enable'] : 0);
945
- update_option( 'mo_openid_default_comment_enable', isset( $_POST['mo_openid_default_comment_enable']) ? $_POST['mo_openid_default_comment_enable'] : 0);
946
-
947
-
948
-
949
- // GDPR options
950
- update_option( 'mo_openid_gdpr_consent_enable', isset( $_POST['mo_openid_gdpr_consent_enable']) ? $_POST['mo_openid_gdpr_consent_enable'] : 0);
951
- if(get_option('mo_openid_gdpr_consent_enable') == 1 && (!mo_openid_restrict_user())) {
952
- update_option('mo_openid_privacy_policy_url', isset($_POST['mo_openid_privacy_policy_url']) ? $_POST['mo_openid_privacy_policy_url'] : get_option('mo_openid_privacy_policy_url'));
953
- update_option('mo_openid_privacy_policy_text', isset($_POST['mo_openid_privacy_policy_text']) ? $_POST['mo_openid_privacy_policy_text'] : get_option('mo_openid_privacy_policy_text'));
954
- update_option('mo_openid_gdpr_consent_message', isset($_POST['mo_openid_gdpr_consent_message']) ? stripslashes($_POST['mo_openid_gdpr_consent_message']) : get_option('mo_openid_gdpr_consent_message'));
955
- }
956
- //Redirect URL
957
- update_option( 'mo_openid_login_redirect', $_POST['mo_openid_login_redirect']);
958
- update_option( 'mo_openid_login_redirect_url', $_POST['mo_openid_login_redirect_url'] );
959
- update_option( 'mo_openid_relative_login_redirect_url', isset( $_POST['mo_openid_relative_login_redirect_url']) ? $_POST['mo_openid_relative_login_redirect_url'] : "" );
960
-
961
- //Logout Url
962
- update_option( 'mo_openid_logout_redirection_enable', isset( $_POST['mo_openid_logout_redirection_enable']) ? $_POST['mo_openid_logout_redirection_enable'] : 0);
963
- update_option( 'mo_openid_logout_redirect', $_POST['mo_openid_logout_redirect']);
964
- update_option( 'mo_openid_logout_redirect_url', $_POST['mo_openid_logout_redirect_url'] );
965
-
966
- //auto register
967
- update_option( 'mo_openid_auto_register_enable', isset( $_POST['mo_openid_auto_register_enable']) ? $_POST['mo_openid_auto_register_enable'] : 0);
968
- update_option( 'mo_openid_register_disabled_message', $_POST['mo_openid_register_disabled_message']);
969
-
970
-
971
- //email notification
972
- update_option( 'mo_openid_email_enable', isset( $_POST['mo_openid_email_enable']) ? $_POST['mo_openid_email_enable'] : 0);
973
-
974
- //Customized text
975
- update_option('mo_openid_login_widget_customize_text',$_POST['mo_openid_login_widget_customize_text'] );
976
- update_option( 'mo_openid_login_button_customize_text',$_POST['mo_openid_login_button_customize_text'] );
977
-
978
- //profile completion
979
- update_option('mo_openid_enable_profile_completion', isset( $_POST['mo_openid_enable_profile_completion']) ? $_POST['mo_openid_enable_profile_completion'] : 0);
980
-
981
- if(get_option('mo_openid_enable_profile_completion') == 1) {
982
- // update_option('mo_profile_completion_form_title', $_POST['mo_profile_completion_form_title']);
983
- //update_option('mo_profile_completion_form_message', $_POST['mo_profile_completion_form_message']);
984
-
985
- update_option('mo_profile_complete_title', $_POST['mo_profile_complete_title']);
986
- update_option('mo_profile_complete_username_label', $_POST['mo_profile_complete_username_label']);
987
- update_option('mo_profile_complete_email_label', $_POST['mo_profile_complete_email_label']);
988
- update_option('mo_profile_complete_submit_button', $_POST['mo_profile_complete_submit_button']);
989
- update_option('mo_profile_complete_instruction', $_POST['mo_profile_complete_instruction']);
990
- update_option('mo_profile_complete_extra_instruction', $_POST['mo_profile_complete_extra_instruction']);
991
- update_option('mo_profile_complete_uname_exist', $_POST['mo_profile_complete_uname_exist']);
992
-
993
- update_option('mo_email_verify_resend_otp_button', $_POST['mo_email_verify_resend_otp_button']);
994
- update_option('mo_email_verify_back_button', $_POST['mo_email_verify_back_button']);
995
- update_option('mo_email_verify_title', $_POST['mo_email_verify_title']);
996
- update_option('mo_email_verify_message', $_POST['mo_email_verify_message']);
997
- update_option('mo_email_verify_verification_code_instruction', $_POST['mo_email_verify_verification_code_instruction']);
998
- update_option('mo_email_verify_wrong_otp', $_POST['mo_email_verify_wrong_otp']);
999
-
1000
- $_POST['custom_otp_msg']=stripslashes( $_POST['custom_otp_msg']);
1001
- update_option('custom_otp_msg',$_POST['custom_otp_msg']);
1002
  }
1003
- //account-linking
1004
- update_option( 'mo_openid_account_linking_enable', isset( $_POST['mo_openid_account_linking_enable']) ? $_POST['mo_openid_account_linking_enable'] : 0);
 
 
 
 
1005
 
1006
- if(get_option('mo_openid_account_linking_enable') == 1 && (!mo_openid_restrict_user()))
1007
- {
1008
- // update_option('mo_account_linking_form_title', $_POST['mo_account_linking_form_title']);
1009
- //update_option('mo_account_linking_form_message', $_POST['mo_account_linking_form_message']);
 
 
 
 
1010
 
1011
- update_option('mo_account_linking_title', $_POST['mo_account_linking_title']);
1012
- update_option('mo_account_linking_new_user_button', $_POST['mo_account_linking_new_user_button']);
1013
- update_option('mo_account_linking_existing_user_button', $_POST['mo_account_linking_existing_user_button']);
1014
- update_option('mo_account_linking_new_user_instruction', $_POST['mo_account_linking_new_user_instruction']);
1015
- update_option('mo_account_linking_existing_user_instruction', $_POST['mo_account_linking_existing_user_instruction']);
1016
- update_option('mo_account_linking_extra_instruction', $_POST['mo_account_linking_extra_instruction']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1017
 
 
1018
 
1019
- }
 
 
 
 
 
 
1020
 
1021
- update_option('mo_openid_login_widget_customize_logout_name_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_name_text']));
1022
- update_option( 'mo_openid_login_widget_customize_logout_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_text']));
1023
- update_option('moopenid_logo_check', isset( $_POST['moopenid_logo_check']) ? $_POST['moopenid_logo_check'] : 0);
1024
- update_option('mo_login_openid_login_widget_customize_textcolor',$_POST['mo_login_openid_login_widget_customize_textcolor']);
1025
- update_option('mo_openid_login_theme',$_POST['mo_openid_login_theme'] );
1026
- update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1027
 
1028
- //customization of icons
1029
- update_option('mo_login_icon_custom_size',$_POST['mo_login_icon_custom_size'] );
1030
- update_option('mo_login_icon_space',$_POST['mo_login_icon_space'] );
1031
- update_option('mo_login_icon_custom_width',$_POST['mo_login_icon_custom_width'] );
1032
- update_option('mo_login_icon_custom_height',$_POST['mo_login_icon_custom_height'] );
1033
- update_option('mo_openid_login_custom_theme',$_POST['mo_openid_login_custom_theme'] );
1034
- update_option( 'mo_login_icon_custom_color', $_POST['mo_login_icon_custom_color'] );
1035
- update_option('mo_login_icon_custom_boundary',$_POST['mo_login_icon_custom_boundary']);
1036
 
1037
- // avatar
1038
- update_option( 'moopenid_social_login_avatar', isset( $_POST['moopenid_social_login_avatar']) ? $_POST['moopenid_social_login_avatar'] : 0);
1039
 
1040
 
1041
- if(isset($_POST['mapping_value_default']))
1042
- update_option('mo_openid_login_role_mapping', isset( $_POST['mapping_value_default']) ? $_POST['mapping_value_default'] : 'subscriber');
1043
 
1044
- if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')){
1045
- //Attribute collection
1046
- update_option( 'moopenid_user_attributes', isset( $_POST['moopenid_user_attributes']) ? $_POST['moopenid_user_attributes'] : 0);
1047
- }
1048
 
1049
- $this->mo_openid_show_success_message();
1050
- if(!mo_openid_is_customer_registered()) {
1051
- mo_openid_registeration_modal();
 
1052
  }
1053
 
1054
-
1055
  }else if(isset($_POST['go_to_register'])) {
1056
  mo_openid_registeration_modal();
1057
- } else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_woocommerce_field" ) {
1058
- //woocommerce integration
1059
- // woocommerce display options
1060
- if(!mo_openid_restrict_user()) {
1061
-
1062
- update_option('mo_openid_woocommerce_login_form', isset($_POST['mo_openid_woocommerce_login_form']) ? $_POST['mo_openid_woocommerce_login_form'] : 0);
1063
- update_option('mo_openid_woocommerce_before_login_form', isset($_POST['mo_openid_woocommerce_before_login_form']) ? $_POST['mo_openid_woocommerce_before_login_form'] : 0);
1064
- update_option('mo_openid_woocommerce_center_login_form', isset($_POST['mo_openid_woocommerce_center_login_form']) ? $_POST['mo_openid_woocommerce_center_login_form'] : 0);
1065
- update_option('mo_openid_woocommerce_register_form_start', isset($_POST['mo_openid_woocommerce_register_form_start']) ? $_POST['mo_openid_woocommerce_register_form_start'] : 0);
1066
- update_option('mo_openid_woocommerce_center_register_form', isset($_POST['mo_openid_woocommerce_center_register_form']) ? $_POST['mo_openid_woocommerce_center_register_form'] : 0);
1067
- update_option('mo_openid_woocommerce_register_form_end', isset($_POST['mo_openid_woocommerce_register_form_end']) ? $_POST['mo_openid_woocommerce_register_form_end'] : 0);
1068
- update_option('mo_openid_woocommerce_before_checkout_billing_form', isset($_POST['mo_openid_woocommerce_before_checkout_billing_form']) ? $_POST['mo_openid_woocommerce_before_checkout_billing_form'] : 0);
1069
- update_option('mo_openid_woocommerce_after_checkout_billing_form', isset($_POST['mo_openid_woocommerce_after_checkout_billing_form']) ? $_POST['mo_openid_woocommerce_after_checkout_billing_form'] : 0);
 
 
 
 
 
1070
  }
1071
-
1072
- }else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_buddypress_field" ){
1073
-
1074
- //buddypress display options
1075
- if(!mo_openid_restrict_user()) {
1076
- update_option('mo_openid_bp_before_register_page', isset($_POST['mo_openid_bp_before_register_page']) ? $_POST['mo_openid_bp_before_register_page'] : 0);
1077
- update_option('mo_openid_bp_before_account_details_fields', isset($_POST['mo_openid_bp_before_account_details_fields']) ? $_POST['mo_openid_bp_before_account_details_fields'] : 0);
1078
- update_option('mo_openid_bp_after_register_page', isset($_POST['mo_openid_bp_after_register_page']) ? $_POST['mo_openid_bp_after_register_page'] : 0);
 
 
 
1079
  }
1080
-
1081
-
1082
  }
1083
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_comment_settings" ) {
1084
-
 
 
 
1085
 
1086
- //commenting
1087
- update_option( 'mo_openid_social_comment_fb', isset( $_POST['mo_openid_social_comment_fb']) ? $_POST['mo_openid_social_comment_fb'] : 0);
1088
- update_option( 'mo_openid_social_comment_google', isset( $_POST['mo_openid_social_comment_google']) ? $_POST['mo_openid_social_comment_google'] : 0);
1089
- update_option( 'mo_openid_social_comment_default', isset( $_POST['mo_openid_social_comment_default']) ? $_POST['mo_openid_social_comment_default'] : 0);
1090
 
1091
- //comment position
1092
- update_option( 'mo_openid_social_comment_blogpost', isset( $_POST['mo_openid_social_comment_blogpost']) ? $_POST['mo_openid_social_comment_blogpost'] : 0);
1093
- update_option( 'mo_openid_social_comment_static', isset( $_POST['mo_openid_social_comment_static']) ? $_POST['mo_openid_social_comment_static'] : 0);
1094
 
1095
- //comment labels
1096
- update_option('mo_openid_social_comment_default_label',$_POST['mo_openid_social_comment_default_label'] );
1097
- update_option('mo_openid_social_comment_fb_label',$_POST['mo_openid_social_comment_fb_label'] );
1098
- update_option('mo_openid_social_comment_google_label',$_POST['mo_openid_social_comment_google_label'] );
1099
- update_option('mo_openid_social_comment_heading_label',$_POST['mo_openid_social_comment_heading_label'] );
1100
 
1101
- update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1102
- $this->mo_openid_show_success_message();
1103
- if(!mo_openid_is_customer_registered()) {
1104
 
1105
- $redirect = add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] );
1106
- update_option('mo_openid_message', 'Your settings are successfully saved. Please <a href=\" '. $redirect .'\">Register or Login with miniOrange</a> to enable Social Login and Social Sharing.');
1107
- $this->mo_openid_show_error_message();
 
1108
  }
1109
-
1110
-
1111
  }
1112
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_contact_us_query_option" ) {
1113
- // Contact Us query
1114
- $email = $_POST['mo_openid_contact_us_email'];
1115
- $phone = $_POST['mo_openid_contact_us_phone'];
1116
- $query = $_POST['mo_openid_contact_us_query'];
1117
- $customer = new CustomerOpenID();
1118
- if ( $this->mo_openid_check_empty_or_null( $email ) || $this->mo_openid_check_empty_or_null( $query ) ) {
1119
- update_option('mo_openid_message', 'Please fill up Email and Query fields to submit your query.');
1120
- $this->mo_openid_show_error_message();
1121
  } else {
1122
- $submited = $customer->submit_contact_us( $email, $phone, $query );
1123
- if ( $submited == false ) {
1124
- update_option('mo_openid_message', 'Your query could not be submitted. Please try again.');
 
 
 
 
1125
  $this->mo_openid_show_error_message();
1126
  } else {
1127
- update_option('mo_openid_message', 'Thanks for getting in touch! We shall get back to you shortly.');
1128
- $this->mo_openid_show_success_message();
 
 
 
 
 
 
1129
  }
1130
  }
1131
  }
1132
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_resend_otp" ) {
1133
-
1134
- $customer = new CustomerOpenID();
1135
- $content = json_decode($customer->send_otp_token('EMAIL'), true);
1136
- if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1137
- if(get_option('mo_openid_email_otp_count')){
1138
- update_option('mo_openid_email_otp_count',get_option('mo_openid_email_otp_count') + 1);
1139
- update_option('mo_openid_message', 'Another One Time Passcode has been sent <b>( ' . get_option('mo_openid_email_otp_count') . ' )</b> for verification to ' . get_option('mo_openid_admin_email'));
1140
- if(get_option('regi_pop_up') =="yes")
1141
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
 
 
 
 
 
 
 
 
 
 
 
 
1142
  }else{
1143
- update_option( 'mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
1144
- update_option('mo_openid_email_otp_count',1);
 
 
1145
  if(get_option('regi_pop_up') =="yes")
1146
  mo_pop_show_otp_verification(get_option('mo_openid_message'));
1147
  }
1148
- update_option('mo_openid_transactionId',$content['txId']);
1149
- update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
1150
- $this->mo_openid_show_success_message();
1151
- }else{
1152
-
1153
- update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
1154
- update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
1155
- $this->mo_openid_show_error_message();
1156
- if(get_option('regi_pop_up') =="yes")
1157
- mo_pop_show_otp_verification(get_option('mo_openid_message'));
1158
  }
1159
-
1160
- }else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back" ){
1161
- update_option('mo_openid_registration_status','');
1162
- delete_option('mo_openid_new_registration');
1163
- delete_option('mo_openid_admin_email');
1164
- delete_option('mo_openid_sms_otp_count');
1165
- delete_option('mo_openid_email_otp_count');
1166
-
1167
- }else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back_login" ){
1168
- update_option('mo_openid_registration_status','');
1169
- delete_option('mo_openid_admin_email');
1170
- delete_option('mo_openid_admin_phone');
1171
- delete_option('mo_openid_admin_password');
1172
- delete_option('mo_openid_admin_customer_key');
1173
- delete_option('mo_openid_verify_customer');
1174
-
1175
- }else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back_registration" ){
1176
- update_option('mo_openid_verify_customer','true');
1177
-
1178
- }else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_other_settings" ){
1179
-
1180
- update_option( 'mo_openid_google_share_enable', isset( $_POST['mo_openid_google_share_enable']) ? $_POST['mo_openid_google_share_enable'] : 0);
1181
- update_option( 'mo_openid_facebook_share_enable', isset( $_POST['mo_openid_facebook_share_enable']) ? $_POST['mo_openid_facebook_share_enable'] : 0);
1182
- update_option( 'mo_openid_linkedin_share_enable', isset( $_POST['mo_openid_linkedin_share_enable']) ? $_POST['mo_openid_linkedin_share_enable'] : 0);
1183
- update_option( 'mo_openid_reddit_share_enable', isset( $_POST['mo_openid_reddit_share_enable']) ? $_POST['mo_openid_reddit_share_enable'] : 0);
1184
- update_option( 'mo_openid_pinterest_share_enable', isset( $_POST['mo_openid_pinterest_share_enable']) ? $_POST['mo_openid_pinterest_share_enable'] : 0);
1185
- update_option( 'mo_openid_twitter_share_enable', isset( $_POST['mo_openid_twitter_share_enable']) ? $_POST['mo_openid_twitter_share_enable'] : 0);
1186
- update_option( 'mo_openid_tumblr_share_enable', isset( $_POST['mo_openid_tumblr_share_enable']) ? $_POST['mo_openid_tumblr_share_enable'] : 0);
1187
- update_option( 'mo_openid_delicious_share_enable', isset( $_POST['mo_openid_delicious_share_enable']) ? $_POST['mo_openid_delicious_share_enable'] : 0);
1188
- update_option( 'mo_openid_vkontakte_share_enable', isset( $_POST['mo_openid_vkontakte_share_enable']) ? $_POST['mo_openid_vkontakte_share_enable'] : 0);
1189
- update_option( 'mo_openid_stumble_share_enable', isset( $_POST['mo_openid_stumble_share_enable']) ? $_POST['mo_openid_stumble_share_enable'] : 0);
1190
- update_option( 'mo_openid_odnoklassniki_share_enable', isset( $_POST['mo_openid_odnoklassniki_share_enable']) ? $_POST['mo_openid_odnoklassniki_share_enable'] : 0);
1191
- update_option( 'mo_openid_digg_share_enable', isset( $_POST['mo_openid_digg_share_enable']) ? $_POST['mo_openid_digg_share_enable'] : 0);
1192
- update_option( 'mo_openid_pocket_share_enable', isset( $_POST['mo_openid_pocket_share_enable']) ? $_POST['mo_openid_pocket_share_enable'] : 0);
1193
-
1194
- update_option( 'mo_openid_mail_share_enable', isset( $_POST['mo_openid_mail_share_enable']) ? $_POST['mo_openid_mail_share_enable'] : 0);
1195
- update_option( 'mo_openid_print_share_enable', isset( $_POST['mo_openid_print_share_enable']) ? $_POST['mo_openid_print_share_enable'] : 0);
1196
- update_option( 'mo_openid_whatsapp_share_enable', isset( $_POST['mo_openid_whatsapp_share_enable']) ? $_POST['mo_openid_whatsapp_share_enable'] : 0);
1197
-
1198
- update_option('mo_share_options_enable_home_page',isset( $_POST['mo_share_options_home_page']) ? $_POST['mo_share_options_home_page'] : 0);
1199
- update_option('mo_share_options_enable_post',isset( $_POST['mo_share_options_post']) ? $_POST['mo_share_options_post'] : 0);
1200
- update_option('mo_share_options_enable_static_pages',isset( $_POST['mo_share_options_static_pages']) ? $_POST['mo_share_options_static_pages'] : 0);
1201
- update_option('mo_share_options_wc_sp_summary',isset( $_POST['mo_share_options_wc_sp_summary']) ? $_POST['mo_share_options_wc_sp_summary'] : 0);
1202
- update_option('mo_share_options_wc_sp_summary_top',isset( $_POST['mo_share_options_wc_sp_summary_top']) ? $_POST['mo_share_options_wc_sp_summary_top'] : 0);
1203
- update_option('mo_share_options_enable_post_position',$_POST['mo_share_options_enable_post_position'] );
1204
- update_option('mo_share_options_home_page_position',$_POST['mo_share_options_home_page_position'] );
1205
- update_option('mo_share_options_static_pages_position',$_POST['mo_share_options_static_pages_position'] );
1206
- update_option('mo_share_options_bb_forum_position',$_POST['mo_share_options_bb_forum_position'] );
1207
- update_option('mo_share_options_bb_topic_position',$_POST['mo_share_options_bb_topic_position'] );
1208
- update_option('mo_share_options_bb_reply_position',$_POST['mo_share_options_bb_reply_position'] );
1209
- update_option('mo_openid_share_theme',$_POST['mo_openid_share_theme'] );
1210
- update_option('mo_share_vertical_hide_mobile',isset( $_POST['mo_share_vertical_hide_mobile']) ? $_POST['mo_share_vertical_hide_mobile'] : 0);
1211
- update_option('mo_share_options_bb_forum',isset( $_POST['mo_share_options_bb_forum']) ? $_POST['mo_share_options_bb_forum'] : 0);
1212
- update_option('mo_share_options_bb_topic',isset( $_POST['mo_share_options_bb_topic']) ? $_POST['mo_share_options_bb_topic'] : 0);
1213
- update_option('mo_share_options_bb_reply',isset( $_POST['mo_share_options_bb_reply']) ? $_POST['mo_share_options_bb_reply'] : 0);
1214
- update_option('mo_openid_share_widget_customize_text',$_POST['mo_openid_share_widget_customize_text'] );
1215
- update_option('mo_openid_share_widget_customize_text_color',$_POST['mo_openid_share_widget_customize_text_color'] );
1216
- update_option('mo_openid_share_twitter_username', sanitize_text_field($_POST['mo_openid_share_twitter_username'])) ;
1217
- update_option('mo_openid_share_email_subject', sanitize_text_field($_POST['mo_openid_share_email_subject'])) ;
1218
- update_option('mo_openid_share_email_body', sanitize_text_field($_POST['mo_openid_share_email_body'])) ;
1219
-
1220
- update_option('mo_openid_share_widget_customize_direction_horizontal',isset( $_POST['mo_openid_share_widget_customize_direction_horizontal']) ? $_POST['mo_openid_share_widget_customize_direction_horizontal'] : 0);
1221
- update_option('mo_openid_share_widget_customize_direction_vertical',isset( $_POST['mo_openid_share_widget_customize_direction_vertical']) ? $_POST['mo_openid_share_widget_customize_direction_vertical'] : 0);
1222
- update_option('mo_sharing_icon_custom_size',isset( $_POST['mo_sharing_icon_custom_size']) ? $_POST['mo_sharing_icon_custom_size'] : 35);
1223
- update_option('mo_sharing_icon_custom_color',$_POST['mo_sharing_icon_custom_color'] );
1224
- update_option('mo_openid_share_custom_theme',$_POST['mo_openid_share_custom_theme'] );
1225
- update_option('mo_sharing_icon_custom_font',$_POST['mo_sharing_icon_custom_font'] );
1226
- update_option('mo_sharing_icon_space',$_POST['mo_sharing_icon_space'] );
1227
- update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1228
- $this->mo_openid_show_success_message();
1229
- if(!mo_openid_is_customer_registered()) {
1230
- $redirect = add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] );
1231
- update_option('mo_openid_message', 'Your settings are successfully saved. Please <a href=\" '. $redirect .'\">Register or Login with miniOrange</a> to enable Social Login and Social Sharing.');
1232
- $this->mo_openid_show_error_message();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1233
  }
1234
  }
1235
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_add_custom_app" ) {
1236
- if($this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_id']) || $this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_secret'])) {
1237
- update_option( 'message', 'Please enter valid Client ID and Client Secret.');
1238
- $this->mo_openid_show_error_message();
1239
- return;
1240
- } else{
1241
- $scope = stripslashes(sanitize_text_field( $_POST['mo_oauth_scope'] ));
1242
- $clientid = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_id'] ));
1243
- $clientsecret = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_secret'] ));
1244
- $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_app_name'] ));
1245
-
1246
- if(get_option('mo_openid_apps_list'))
1247
- $appslist = get_option('mo_openid_apps_list');
1248
- else
1249
- $appslist = array();
1250
-
1251
- $newapp = array();
1252
-
1253
- foreach($appslist as $key => $currentapp){
1254
- if($appname == $key){
1255
- $newapp = $currentapp;
1256
- break;
 
 
 
 
 
1257
  }
1258
- }
1259
 
1260
- $newapp['clientid'] = $clientid;
1261
- $newapp['clientsecret'] = $clientsecret;
1262
- $newapp['scope'] = $scope;
1263
- $newapp['redirecturi'] = site_url().'/openidcallback';
1264
- if($appname=="facebook"){
1265
- $authorizeurl = 'https://www.facebook.com/dialog/oauth';
1266
- $accesstokenurl = 'https://graph.facebook.com/v2.8/oauth/access_token';
1267
- $resourceownerdetailsurl = 'https://graph.facebook.com/me/?fields=id,name,email,age_range,first_name,gender,last_name,link&access_token=';
1268
- } else if($appname=="google"){
1269
- $authorizeurl = "https://accounts.google.com/o/oauth2/auth";
1270
- $accesstokenurl = "https://www.googleapis.com/oauth2/v3/token";
1271
- //private static final String VERIFY_TOKEN_ENDPOINT = "https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=";
1272
- //private static final String GET_USER_INFO_ENDPOINT = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=";
1273
- $resourceownerdetailsurl = "https://www.googleapis.com/plus/v1/people/me";
1274
- } else if($appname=="twitter"){
1275
- $authorizeurl = "https://api.twitter.com/oauth/authorize";
1276
- $accesstokenurl = "https://api.twitter.com/oauth/access_token";
1277
- $resourceownerdetailsurl = "https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials?include_email=true";
1278
- }else {
1279
- $authorizeurl = stripslashes(sanitize_text_field($_POST['mo_oauth_authorizeurl']));
1280
- $accesstokenurl = stripslashes(sanitize_text_field($_POST['mo_oauth_accesstokenurl']));
1281
- $resourceownerdetailsurl = stripslashes(sanitize_text_field($_POST['mo_oauth_resourceownerdetailsurl']));
1282
- $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_custom_app_name'] ));
1283
- }
1284
 
1285
- $newapp['authorizeurl'] = $authorizeurl;
1286
- $newapp['accesstokenurl'] = $accesstokenurl;
1287
- $newapp['resourceownerdetailsurl'] = $resourceownerdetailsurl;
1288
- $appslist[$appname] = $newapp;
1289
- update_option('mo_openid_apps_list', $appslist);
1290
- wp_redirect('admin.php?page=mo_openid_settings&tab=custom_app');
1291
- }
1292
- }
1293
- else if( isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_custom_app_attribute_mapping" ) {
1294
- $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_app_name'] ));
1295
- $email_attr = stripslashes(sanitize_text_field( $_POST['mo_oauth_email_attr'] ));
1296
- $name_attr = stripslashes(sanitize_text_field( $_POST['mo_oauth_name_attr'] ));
1297
-
1298
- $appslist = get_option('mo_openid_apps_list');
1299
- foreach($appslist as $key => $currentapp){
1300
- if($appname == $key){
1301
- $currentapp['email_attr'] = $email_attr;
1302
- $currentapp['name_attr'] = $name_attr;
1303
- $appslist[$key] = $currentapp;
1304
- break;
1305
  }
1306
  }
1307
- update_option('mo_openid_apps_list', $appslist);
1308
- update_option( 'message', 'Your settings are saved successfully.' );
1309
- $this->mo_openid_show_success_message();
1310
- wp_redirect('admin.php?page=mo_openid_settings&tab=custom_app&action=update&app='.urlencode($appname));
1311
  }
1312
- }
1313
-
1314
 
1315
- if(isset($_POST['mo_openid_option']) and $_POST['mo_openid_option']=='mo_openid_skip_feedback'){
1316
 
1317
- update_option('mo_openid_feedback_form',1);
1318
- deactivate_plugins( '/miniorange-login-openid/miniorange_openid_sso_settings.php' );
 
 
 
 
 
 
1319
 
1320
  }
1321
- if(isset($_POST['mo_openid_feedback']) and $_POST['mo_openid_feedback']=='mo_openid_feedback')
1322
- {
1323
- $message='';
1324
- if(isset($_POST['deactivate_plugin']) )
1325
- {
1326
- $message.=' '. $_POST['deactivate_plugin'];
1327
- if($_POST['mo_openid_query_feedback']!='')
 
1328
  {
1329
- $message.='. '.$_POST['mo_openid_query_feedback'];
1330
- }
 
 
 
1331
 
1332
- if(get_option('mo_openid_admin_email'))
1333
- {
1334
- $email=get_option('mo_openid_admin_email');
1335
- }else {
1336
- $user_info = get_userdata(get_current_user_id());
1337
- $email = $user_info->user_email;
1338
- }
1339
 
1340
- //only reason
1341
- $phone='';
1342
- $contact_us = new CustomerOpenID();
1343
- $submited = json_decode( $contact_us->mo_openid_send_email_alert( $email, $phone, $message ), true );
1344
 
1345
- if ( json_last_error() == JSON_ERROR_NONE ) {
1346
- if ( is_array( $submited ) && array_key_exists( 'status', $submited ) && $submited['status'] == 'ERROR' )
1347
- {
1348
- if( isset($submited['message']))
1349
  {
1350
- update_option('mo_openid_message',$submited['message']);
1351
- $this->mo_openid_show_error_message();
1352
- }
 
 
1353
 
1354
 
1355
- } else
1356
- {
1357
- if ( $submited == false )
1358
  {
1359
- update_option( 'mo_openid_message',"ERROR_WHILE_SUBMITTING_QUERY");
1360
- $this->mo_openid_show_success_message();
1361
- } else {
1362
-
1363
- update_option('mo_openid_message',"Your response is submitted successfully");
1364
- $this->mo_openid_show_success_message();
1365
- update_option('mo_openid_feedback_form',1);
 
 
 
1366
  }
1367
  }
 
 
1368
  }
1369
- update_option('mo_openid_feedback_form',1);
1370
- deactivate_plugins( '/miniorange-login-openid/miniorange_openid_sso_settings.php' );
1371
-
1372
-
1373
-
1374
  }
1375
  }
1376
-
1377
  }
1378
  function create_customer(){
1379
  delete_option('mo_openid_sms_otp_count');
@@ -1505,7 +1536,6 @@ Thank you.';
1505
  if (!(is_dir($filename))) {
1506
  $user_meta_thumbnail = get_user_meta($user_id, 'moopenid_user_avatar', true); //Read the avatar
1507
  $user_meta_name = get_user_meta($user_id, 'user_name', true); //read user details
1508
- // if ( $options['apsl_user_avatar_options'] == 'social' ) {
1509
  $user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : '');
1510
  if ($user_picture !== false AND strlen(trim($user_picture)) > 0) { //Avatar found?
1511
  return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
3
  * Plugin Name: Social Login, Social Sharing by miniOrange
4
  * Plugin URI: https://www.miniorange.com/social-login
5
  * Description: Allow your users to login, comment and share with social login apps like Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
6
+ * Version: 7.2
7
  * Author: social login (miniOrange)
8
  * License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
  */
13
  require('class-mo-openid-sso-customer.php');
14
  require('class-mo-openid-sso-shortcode-buttons.php');
15
  require('class-mo-openid-social-comment.php');
16
+ define('MO_OPENID_SOCIAL_LOGIN_VERSION', '7.2');
17
  include dirname( __FILE__ ) . '/mo_openid_feedback_form.php';
18
  class Miniorange_OpenID_SSO {
19
 
84
  add_action( 'woocommerce_after_checkout_billing_form', array($this, 'mo_openid_add_social_login'));
85
  }
86
 
 
 
 
 
 
 
 
87
  //add social login to buddypress
88
  if(get_option('mo_openid_bp_before_register_page') == 1){
89
  add_action( 'bp_before_register_page', array($this, 'mo_openid_add_social_login'));
268
  add_option( 'mo_openid_woocommerce_register_form_end','0');
269
  add_option( 'mo_openid_woocommerce_before_checkout_billing_form','0');
270
  add_option( 'mo_openid_woocommerce_after_checkout_billing_form','0');
 
 
271
  //buddypress display options
272
  add_option( 'mo_openid_bp_before_register_page','0');
273
  add_option( 'mo_openid_bp_before_account_details_fields','0');
381
  )
382
  );
383
  if($output === false){
384
+ $wpdb->show_errors();
385
  $wpdb->print_error();
 
386
  wp_die('Error in insert Query');
387
+ exit;
388
  }
389
 
390
  }
410
  )
411
  );
412
  if($result === false){
413
+ $wpdb->show_errors();
414
  $wpdb->print_error();
 
415
  wp_die('Error in deletion query');
416
+ exit;
417
  }
418
  }
419
  update_option('mo_openid_social_login_version',MO_OPENID_SOCIAL_LOGIN_VERSION);
425
  }
426
 
427
  function mo_openid_add_social_login(){
428
+ if(!is_user_logged_in() && mo_openid_is_customer_registered() && strpos( $_SERVER['QUERY_STRING'], 'disable-social-login' ) == false){
429
+ $mo_login_widget = new mo_openid_login_wid();
430
+ $mo_login_widget->openidloginForm();
 
431
  }
432
  }
433
 
605
 
606
  public function if_custom_app_exists($app_name){
607
  if(get_option('mo_openid_apps_list'))
608
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
609
  else
610
  $appslist = array();
611
 
626
  add_action('admin_notices', array($this, 'mo_openid_activation_message'));
627
  }
628
 
629
+ if( isset($_POST['mo_openid_connect_register_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_connect_register_customer" ) { //register the admin to miniOrange
630
+ $nonce = $_POST['mo_openid_connect_register_nonce'];
631
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-connect-register-nonce' ) ) {
632
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
  } else {
634
+ //validation and sanitization
635
+ $company = '';
636
+ $first_name = '';
637
+ $last_name = '';
638
+ $email = '';
639
+ $phone = '';
640
+ $password = '';
641
+ $confirmPassword = '';
642
+ $illegal = "#$%^*()+=[]';,/{}|:<>?~";
643
+ $illegal = $illegal . '"';
644
+ if( $this->mo_openid_check_empty_or_null( $_POST['company'] ) || $this->mo_openid_check_empty_or_null( $_POST['email'] ) || $this->mo_openid_check_empty_or_null( $_POST['password'] ) || $this->mo_openid_check_empty_or_null( $_POST['confirmPassword'] ) ) {
645
+ update_option( 'mo_openid_message', 'All the fields are required. Please enter valid entries.');
646
+ $this->mo_openid_show_error_message();
647
+ if(get_option('regi_pop_up') =="yes") {
648
+ update_option('pop_regi_msg', get_option('mo_openid_message'));
649
+ mo_openid_registeration_modal();
650
+ }
651
+ return;
652
+ } else if( strlen( $_POST['password'] ) < 6 || strlen( $_POST['confirmPassword'] ) < 6){ //check password is of minimum length 6
653
+ update_option( 'mo_openid_message', 'Choose a password with minimum length 6.');
654
+ $this->mo_openid_show_error_message();
655
+ if(get_option('regi_pop_up') =="yes"){
656
+ update_option('pop_regi_msg', get_option('mo_openid_message'));
657
+ mo_openid_registeration_modal();
658
+ }
659
+ return;
660
+ } else if(strpbrk($_POST['email'],$illegal)) {
661
+ update_option( 'mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
662
+ $this->mo_openid_show_error_message();
663
+ if(get_option('regi_pop_up') =="yes"){
664
+ update_option('pop_regi_msg', get_option('mo_openid_message'));
665
+ mo_openid_registeration_modal();
666
+ }
667
+ return;
668
+ } else {
669
+ $company = sanitize_text_field($_POST['company']);
670
+ $first_name = sanitize_text_field(isset($_POST['fname'])?$_POST['fname']:'');
671
+ $last_name = sanitize_text_field(isset($_POST['lname'])?$_POST['lname']:'');
672
+ $email = sanitize_email( $_POST['email'] );
673
+ $phone = sanitize_text_field( isset($_POST['phone'])?$_POST['phone']:'' );
674
+ $password = stripslashes( $_POST['password'] );
675
+ $confirmPassword = stripslashes( $_POST['confirmPassword'] );
676
 
677
+ }
 
678
 
679
+ update_option( 'mo_openid_admin_company_name', $company);
680
+ update_option( 'mo_openid_admin_first_name', $first_name);
681
+ update_option( 'mo_openid_admin_last_name', $last_name);
682
+ update_option( 'mo_openid_admin_email', $email );
683
+ update_option( 'mo_openid_admin_phone', $phone );
684
+
685
+ if( strcmp( $password, $confirmPassword) == 0 ) {
686
+ update_option( 'mo_openid_admin_password', $password );
687
+
688
+ $customer = new CustomerOpenID();
689
+ $content = json_decode($customer->check_customer(), true);
690
+ if( strcasecmp( $content['status'], 'CUSTOMER_NOT_FOUND') == 0 ){
691
+ $content = json_decode($customer->send_otp_token('EMAIL'), true);
692
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
693
+ if(get_option('mo_openid_email_otp_count')){
694
+ update_option('mo_openid_email_otp_count',get_option('mo_openid_email_otp_count') + 1);
695
+ update_option('mo_openid_message', 'Another One Time Passcode has been sent(' . get_option('mo_openid_email_otp_count') . ') for verification to ' . get_option('mo_openid_admin_email'));
696
+ }else{
697
+ update_option( 'mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
698
+ update_option('mo_openid_email_otp_count',1);
699
+ }
700
+ update_option('mo_openid_transactionId',$content['txId']);
701
+ update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
702
+
703
+ $this->mo_openid_show_success_message();
704
+ if(get_option('regi_pop_up') =="yes")
705
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
706
  }else{
 
 
 
 
 
707
 
708
+ update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
709
+ update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
710
+ $this->mo_openid_show_error_message();
711
+ if(get_option('regi_pop_up') =="yes")
712
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
713
+ }
714
  }else{
715
+ $this->get_current_customer();
 
 
 
 
 
716
  }
 
 
 
717
 
718
+ } else {
719
 
720
+ update_option( 'mo_openid_message', 'Passwords do not match.');
721
+ if(get_option('regi_pop_up') =="yes"){
722
+ update_option('pop_regi_msg', get_option('mo_openid_message'));
723
+ mo_openid_registeration_modal();
724
+ }
725
+ delete_option('mo_openid_verify_customer');
726
+ $this->mo_openid_show_error_message();
727
  }
 
 
728
  }
729
 
730
  } else if( isset( $_POST['show_login'] ) )
732
 
733
  mo_pop_show_verify_password_page();
734
  }
735
+ else if(isset($_POST['mo_openid_validate_otp_nonce']) and isset($_POST['option']) and $_POST['option'] == "mo_openid_validate_otp"){
736
+ $nonce = $_POST['mo_openid_validate_otp_nonce'];
737
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-validate-otp-nonce' ) ) {
738
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
739
+ } else {
740
+ //validation and sanitization
741
+ $otp_token = '';
742
+ if( $this->mo_openid_check_empty_or_null( $_POST['otp_token'] ) ) {
743
+ update_option( 'mo_openid_message', 'Please enter a value in OTP field.');
744
+ update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
 
 
 
 
 
 
 
 
 
 
 
 
745
 
746
+ $this->mo_openid_show_error_message();
747
+ if(get_option('regi_pop_up') =="yes")
748
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
749
+ return;
750
+ } else if(!preg_match('/^[0-9]*$/', $_POST['otp_token'])) {
751
+ update_option( 'mo_openid_message', 'Please enter a valid value in OTP field.');
752
+ update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
753
+ $this->mo_openid_show_error_message();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
 
755
+ if(get_option('regi_pop_up') =="yes")
756
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
757
+ return;
758
+ } else{
759
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
760
  }
761
 
762
+ $customer = new CustomerOpenID();
763
+ $content = json_decode($customer->validate_otp_token(get_option('mo_openid_transactionId'), $otp_token ),true);
764
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
765
+ $this->create_customer();
766
+ update_option('mo_openid_oauth','1');
767
+ update_option('mo_openid_new_user','1');
768
+ update_option('mo_openid_malform_error','1');
769
 
770
+ }else{
771
+ update_option( 'mo_openid_message','Invalid one time passcode. Please enter a valid passcode.');
772
+ update_option('mo_openid_registration_status','MO_OTP_VALIDATION_FAILURE');
773
+ $this->mo_openid_show_error_message();
774
+ if(get_option('regi_pop_up') =="yes")
775
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
776
+ }
777
  }
778
  }
779
+ else if( isset($_POST['mo_openid_phone_verification_nonce']) and isset($_POST['option']) and $_POST['option'] == 'mo_openid_phone_verification'){ //at registration time
780
+ $nonce = $_POST['mo_openid_phone_verification_nonce'];
781
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-phone-verification-nonce' ) ) {
782
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
783
+ } else {
784
+ $phone = sanitize_text_field($_POST['phone_number']);
785
 
786
+ $phone = str_replace(' ', '', $phone);
787
+ update_option('mo_openid_admin_phone',$phone);
788
+ $auth_type = 'SMS';
789
+ $customer = new CustomerOpenID();
790
+ $send_otp_response = json_decode($customer->send_otp_token($auth_type),true);
791
+ if(strcasecmp($send_otp_response['status'], 'SUCCESS') == 0){
792
+ //Save txId
793
+
794
+ update_option('mo_openid_transactionId',$send_otp_response['txId']);
795
+ update_option( 'mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
796
+ if(get_option('mo_openid_sms_otp_count')){
797
+ update_option('mo_openid_sms_otp_count',get_option('mo_openid_sms_otp_count') + 1);
798
+ update_option('mo_openid_message', 'Another One Time Passcode has been sent (' . get_option('mo_openid_sms_otp_count') . ') for verification to ' . $phone);
799
+ }else{
 
 
 
800
 
801
+ update_option('mo_openid_message', 'One Time Passcode has been sent for verification to ' . $phone);
802
+ update_option('mo_openid_sms_otp_count',1);
803
+ }
804
+
805
+ $this->mo_openid_show_success_message();
806
+
807
+ }else{
808
+ update_option('mo_openid_message','There was an error in sending sms. Please click on Resend OTP link next to phone number textbox.');
809
+ update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
810
+ $this->mo_openid_show_error_message();
 
 
 
 
 
 
 
 
 
 
811
 
812
  }
813
  }
 
814
  }
815
+ else if( isset($_POST['mo_openid_connect_verify_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_connect_verify_customer" ) { //register the admin to miniOrange
816
+ $nonce = $_POST['mo_openid_connect_verify_nonce'];
817
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-connect-verify-nonce' ) ) {
818
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
819
+ } else {
820
+ //validation and sanitization
821
+ $email = '';
822
+ $password = '';
823
+ $illegal = "#$%^*()+=[]';,/{}|:<>?~";
824
+ $illegal = $illegal . '"';
825
+ if( $this->mo_openid_check_empty_or_null( $_POST['email'] ) || $this->mo_openid_check_empty_or_null( $_POST['password'] ) ) {
826
+ update_option( 'mo_openid_message', 'All the fields are required. Please enter valid entries.');
827
+ $this->mo_openid_show_error_message();
828
+ return;
829
+ } else if(strpbrk($_POST['email'],$illegal)) {
830
+ update_option( 'mo_openid_message', 'Please match the format of Email. No special characters are allowed.');
831
+ $this->mo_openid_show_error_message();
832
+ return;
833
+ } else{
834
+ $email = sanitize_email( $_POST['email'] );
835
+ $password = stripslashes( $_POST['password'] );
836
+ }
837
 
838
+ update_option( 'mo_openid_admin_email', $email );
839
+ update_option( 'mo_openid_admin_password', $password );
840
+ $customer = new CustomerOpenID();
841
+ $content = $customer->get_customer_key();
842
+ $customerKey = json_decode( $content, true );
843
+ if( isset($customerKey) ) {
844
+ update_option( 'mo_openid_admin_customer_key', $customerKey['id'] );
845
+ update_option( 'mo_openid_admin_api_key', $customerKey['apiKey'] );
846
+ update_option( 'mo_openid_customer_token', $customerKey['token'] );
847
+ update_option( 'mo_openid_admin_phone', $customerKey['phone'] );
848
+ update_option('mo_openid_admin_password', '');
849
+ update_option( 'mo_openid_message', 'Your account has been retrieved successfully.');
850
+ delete_option('mo_openid_verify_customer');
851
+ $this->mo_openid_show_success_message();
852
+ } else {
853
+ update_option( 'mo_openid_message', 'Invalid username or password. Please try again.');
854
  $this->mo_openid_show_error_message();
855
+ if(get_option('regi_pop_up') =="yes") {
856
  update_option("pop_login_msg",get_option("mo_openid_message"));
857
  mo_pop_show_verify_password_page();
858
 
859
  }
 
 
 
 
860
  }
861
+ update_option('mo_openid_admin_password', '');
862
  }
863
+ }
864
+ else if(isset($_POST['mo_openid_forgot_password_nonce']) and isset($_POST['option']) and $_POST['option'] == 'mo_openid_forgot_password'){
865
+ $nonce = $_POST['mo_openid_forgot_password_nonce'];
866
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-forgot-password-nonce' ) ) {
867
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
868
+ } else {
869
+ $email ='';
870
+ if( $this->mo_openid_check_empty_or_null( $email ) ) {
871
+ if( $this->mo_openid_check_empty_or_null( $_POST['email'] ) ) {
872
+ update_option( 'mo_openid_message', 'No email provided. Please enter your email below to reset password.');
873
+ $this->mo_openid_show_error_message();
874
+ if(get_option('regi_pop_up') =="yes"){
875
+ update_option("pop_login_msg",get_option("mo_openid_message"));
876
+ mo_pop_show_verify_password_page();
877
 
878
+ }
879
+ return;
880
+ } else {
881
+ $email = $_POST['email'];
882
 
883
+ }
 
 
 
 
 
 
 
 
884
  }
 
 
 
 
 
 
885
 
886
+
 
 
 
 
887
  $customer = new CustomerOpenID();
888
+ $content = json_decode($customer->forgot_password($email),true);
889
  if(strcasecmp($content['status'], 'SUCCESS') == 0){
890
+ update_option( 'mo_openid_message','You password has been reset successfully. Please enter the new password sent to your registered mail here.');
 
 
 
 
 
 
 
 
 
 
891
  $this->mo_openid_show_success_message();
892
+ if(get_option('regi_pop_up') =="yes"){
893
+ update_option("pop_login_msg",get_option("mo_openid_message"));
894
+ mo_pop_show_verify_password_page();
895
+
896
+ }
897
  }else{
898
+ update_option( 'mo_openid_message','An error occured while processing your request. Please make sure you are registered with miniOrange with the given email address.');
899
  $this->mo_openid_show_error_message();
900
+ if(get_option('regi_pop_up') =="yes"){
901
+ update_option("pop_login_msg",get_option("mo_openid_message"));
902
+ mo_pop_show_verify_password_page();
903
+
904
+ }
905
  }
 
 
 
906
  }
907
  }
908
+ else if(isset($_POST['mo_openid_check_license_nonce']) and isset($_POST['option']) and $_POST['option'] == 'mo_openid_check_license'){
909
+ $nonce = $_POST['mo_openid_check_license_nonce'];
910
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-check-license-nonce' ) ) {
911
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
912
+ } else {
913
+ if(mo_openid_is_customer_registered()) {
914
+ $customer = new CustomerOpenID();
915
+ $content = json_decode($customer->check_customer_valid(),true);
916
+ if(strcasecmp($content['status'], 'SUCCESS') == 0){
917
+ update_option( 'mo_openid_admin_customer_valid', strcasecmp($content['licenseType'], 'Premium') !== FALSE ? 1 : 0);
918
+ update_option( 'mo_openid_admin_customer_plan', isset($content['licensePlan']) ? base64_encode($content['licensePlan']) : 0);
919
+ if(get_option('mo_openid_admin_customer_valid') && isset($content['licensePlan'])){
920
+ $license = explode(' -', $content['licensePlan']);
921
+ $lp = $license[0];
922
+ update_option( 'mo_openid_message','You are on the old ' . $lp . '.');
923
+ } else
924
+ update_option( 'mo_openid_message','You are on the Free Plan.');
925
+ $this->mo_openid_show_success_message();
926
+ }else if(strcasecmp($content['status'], 'FAILED') == 0){
927
+ update_option('mo_openid_message', 'You are on Free Plan.');
928
+ $this->mo_openid_show_success_message();
929
+ }else{
930
+ update_option( 'mo_openid_message','An error occured while processing your request. Please try again.');
931
+ $this->mo_openid_show_error_message();
932
+ }
933
+ } else {
934
+ update_option('mo_openid_message', 'Please register an account before trying to check your plan');
935
+ $this->mo_openid_show_error_message();
936
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
937
  }
938
+ }
939
+ else if( isset($_POST['mo_openid_enable_apps_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_enable_apps" ) {
940
+ $nonce = $_POST['mo_openid_enable_apps_nonce'];
941
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-enable-apps-nonce' ) ) {
942
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
943
+ } else {
944
 
945
+ update_option( 'mo_openid_google_enable', isset( $_POST['mo_openid_google_enable']) ? $_POST['mo_openid_google_enable'] : 0);
946
+ update_option( 'mo_openid_salesforce_enable', isset( $_POST['mo_openid_salesforce_enable']) ? $_POST['mo_openid_salesforce_enable'] : 0);
947
+ if($this->if_custom_app_exists('facebook')) {
948
+ update_option('mo_openid_facebook_enable', isset($_POST['mo_openid_facebook_enable']) ? $_POST['mo_openid_facebook_enable'] : 0);
949
+ }
950
+ else if(isset($_POST['mo_openid_facebook_enable'])) {
951
+ update_option('mo_openid_facebook_enable',0);
952
+ $this->mo_openid_show_facebook_error_message();
953
 
954
+ }
955
+ update_option( 'mo_openid_linkedin_enable', isset( $_POST['mo_openid_linkedin_enable']) ? $_POST['mo_openid_linkedin_enable'] : 0);
956
+ update_option( 'mo_openid_windowslive_enable', isset( $_POST['mo_openid_windowslive_enable']) ? $_POST['mo_openid_windowslive_enable'] : 0);
957
+ update_option( 'mo_openid_amazon_enable', isset( $_POST['mo_openid_amazon_enable']) ? $_POST['mo_openid_amazon_enable'] : 0);
958
+ update_option( 'mo_openid_instagram_enable', isset( $_POST['mo_openid_instagram_enable']) ? $_POST['mo_openid_instagram_enable'] : 0);
959
+ update_option( 'mo_openid_twitter_enable', isset( $_POST['mo_openid_twitter_enable']) ? $_POST['mo_openid_twitter_enable'] : 0);
960
+ update_option( 'mo_openid_vkontakte_enable', isset( $_POST['mo_openid_vkontakte_enable']) ? $_POST['mo_openid_vkontakte_enable'] : 0);
961
+ update_option( 'mo_openid_yahoo_enable', isset( $_POST['mo_openid_yahoo_enable']) ? $_POST['mo_openid_yahoo_enable'] : 0);
962
+
963
+ update_option( 'mo_openid_default_login_enable', isset( $_POST['mo_openid_default_login_enable']) ? $_POST['mo_openid_default_login_enable'] : 0);
964
+ update_option( 'mo_openid_default_register_enable', isset( $_POST['mo_openid_default_register_enable']) ? $_POST['mo_openid_default_register_enable'] : 0);
965
+ update_option( 'mo_openid_default_comment_enable', isset( $_POST['mo_openid_default_comment_enable']) ? $_POST['mo_openid_default_comment_enable'] : 0);
966
+
967
+
968
+
969
+ // GDPR options
970
+ update_option( 'mo_openid_gdpr_consent_enable', isset( $_POST['mo_openid_gdpr_consent_enable']) ? $_POST['mo_openid_gdpr_consent_enable'] : 0);
971
+ if(get_option('mo_openid_gdpr_consent_enable') == 1 && (!mo_openid_restrict_user())) {
972
+ update_option('mo_openid_privacy_policy_url', isset($_POST['mo_openid_privacy_policy_url']) ? $_POST['mo_openid_privacy_policy_url'] : get_option('mo_openid_privacy_policy_url'));
973
+ update_option('mo_openid_privacy_policy_text', isset($_POST['mo_openid_privacy_policy_text']) ? $_POST['mo_openid_privacy_policy_text'] : get_option('mo_openid_privacy_policy_text'));
974
+ update_option('mo_openid_gdpr_consent_message', isset($_POST['mo_openid_gdpr_consent_message']) ? stripslashes($_POST['mo_openid_gdpr_consent_message']) : get_option('mo_openid_gdpr_consent_message'));
975
+ }
976
+ //Redirect URL
977
+ update_option( 'mo_openid_login_redirect', $_POST['mo_openid_login_redirect']);
978
+ update_option( 'mo_openid_login_redirect_url', $_POST['mo_openid_login_redirect_url'] );
979
+ update_option( 'mo_openid_relative_login_redirect_url', isset( $_POST['mo_openid_relative_login_redirect_url']) ? $_POST['mo_openid_relative_login_redirect_url'] : "" );
980
+
981
+ //Logout Url
982
+ update_option( 'mo_openid_logout_redirection_enable', isset( $_POST['mo_openid_logout_redirection_enable']) ? $_POST['mo_openid_logout_redirection_enable'] : 0);
983
+ update_option( 'mo_openid_logout_redirect', $_POST['mo_openid_logout_redirect']);
984
+ update_option( 'mo_openid_logout_redirect_url', $_POST['mo_openid_logout_redirect_url'] );
985
+
986
+ //auto register
987
+ update_option( 'mo_openid_auto_register_enable', isset( $_POST['mo_openid_auto_register_enable']) ? $_POST['mo_openid_auto_register_enable'] : 0);
988
+ update_option( 'mo_openid_register_disabled_message', $_POST['mo_openid_register_disabled_message']);
989
+
990
+
991
+ //email notification
992
+ update_option( 'mo_openid_email_enable', isset( $_POST['mo_openid_email_enable']) ? $_POST['mo_openid_email_enable'] : 0);
993
+
994
+ //Customized text
995
+ update_option('mo_openid_login_widget_customize_text',$_POST['mo_openid_login_widget_customize_text'] );
996
+ update_option( 'mo_openid_login_button_customize_text',$_POST['mo_openid_login_button_customize_text'] );
997
+
998
+ //profile completion
999
+ update_option('mo_openid_enable_profile_completion', isset( $_POST['mo_openid_enable_profile_completion']) ? $_POST['mo_openid_enable_profile_completion'] : 0);
1000
+
1001
+ if(get_option('mo_openid_enable_profile_completion') == 1) {
1002
+
1003
+ update_option('mo_profile_complete_title', $_POST['mo_profile_complete_title']);
1004
+ update_option('mo_profile_complete_username_label', $_POST['mo_profile_complete_username_label']);
1005
+ update_option('mo_profile_complete_email_label', $_POST['mo_profile_complete_email_label']);
1006
+ update_option('mo_profile_complete_submit_button', $_POST['mo_profile_complete_submit_button']);
1007
+ update_option('mo_profile_complete_instruction', $_POST['mo_profile_complete_instruction']);
1008
+ update_option('mo_profile_complete_extra_instruction', $_POST['mo_profile_complete_extra_instruction']);
1009
+ update_option('mo_profile_complete_uname_exist', $_POST['mo_profile_complete_uname_exist']);
1010
+
1011
+ update_option('mo_email_verify_resend_otp_button', $_POST['mo_email_verify_resend_otp_button']);
1012
+ update_option('mo_email_verify_back_button', $_POST['mo_email_verify_back_button']);
1013
+ update_option('mo_email_verify_title', $_POST['mo_email_verify_title']);
1014
+ update_option('mo_email_verify_message', $_POST['mo_email_verify_message']);
1015
+ update_option('mo_email_verify_verification_code_instruction', $_POST['mo_email_verify_verification_code_instruction']);
1016
+ update_option('mo_email_verify_wrong_otp', $_POST['mo_email_verify_wrong_otp']);
1017
+
1018
+ $_POST['custom_otp_msg']=stripslashes( $_POST['custom_otp_msg']);
1019
+ update_option('custom_otp_msg',$_POST['custom_otp_msg']);
1020
+ }
1021
+ //account-linking
1022
+ update_option( 'mo_openid_account_linking_enable', isset( $_POST['mo_openid_account_linking_enable']) ? $_POST['mo_openid_account_linking_enable'] : 0);
1023
 
1024
+ if(get_option('mo_openid_account_linking_enable') == 1 && (!mo_openid_restrict_user())) {
1025
 
1026
+ update_option('mo_account_linking_title', $_POST['mo_account_linking_title']);
1027
+ update_option('mo_account_linking_new_user_button', $_POST['mo_account_linking_new_user_button']);
1028
+ update_option('mo_account_linking_existing_user_button', $_POST['mo_account_linking_existing_user_button']);
1029
+ update_option('mo_account_linking_new_user_instruction', $_POST['mo_account_linking_new_user_instruction']);
1030
+ update_option('mo_account_linking_existing_user_instruction', $_POST['mo_account_linking_existing_user_instruction']);
1031
+ update_option('mo_account_linking_extra_instruction', $_POST['mo_account_linking_extra_instruction']);
1032
+ }
1033
 
1034
+ update_option('mo_openid_login_widget_customize_logout_name_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_name_text']));
1035
+ update_option( 'mo_openid_login_widget_customize_logout_text',sanitize_text_field($_POST['mo_openid_login_widget_customize_logout_text']));
1036
+ update_option('moopenid_logo_check', isset( $_POST['moopenid_logo_check']) ? $_POST['moopenid_logo_check'] : 0);
1037
+ update_option('mo_login_openid_login_widget_customize_textcolor',$_POST['mo_login_openid_login_widget_customize_textcolor']);
1038
+ update_option('mo_openid_login_theme',$_POST['mo_openid_login_theme'] );
1039
+ update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1040
 
1041
+ //customization of icons
1042
+ update_option('mo_login_icon_custom_size',$_POST['mo_login_icon_custom_size'] );
1043
+ update_option('mo_login_icon_space',$_POST['mo_login_icon_space'] );
1044
+ update_option('mo_login_icon_custom_width',$_POST['mo_login_icon_custom_width'] );
1045
+ update_option('mo_login_icon_custom_height',$_POST['mo_login_icon_custom_height'] );
1046
+ update_option('mo_openid_login_custom_theme',$_POST['mo_openid_login_custom_theme'] );
1047
+ update_option( 'mo_login_icon_custom_color', $_POST['mo_login_icon_custom_color'] );
1048
+ update_option('mo_login_icon_custom_boundary',$_POST['mo_login_icon_custom_boundary']);
1049
 
1050
+ // avatar
1051
+ update_option( 'moopenid_social_login_avatar', isset( $_POST['moopenid_social_login_avatar']) ? $_POST['moopenid_social_login_avatar'] : 0);
1052
 
1053
 
1054
+ if(isset($_POST['mapping_value_default']))
1055
+ update_option('mo_openid_login_role_mapping', isset( $_POST['mapping_value_default']) ? $_POST['mapping_value_default'] : 'subscriber');
1056
 
1057
+ if(mo_openid_is_customer_valid() && !mo_openid_get_customer_plan('Do It Yourself')){
1058
+ //Attribute collection
1059
+ update_option( 'moopenid_user_attributes', isset( $_POST['moopenid_user_attributes']) ? $_POST['moopenid_user_attributes'] : 0);
1060
+ }
1061
 
1062
+ $this->mo_openid_show_success_message();
1063
+ if(!mo_openid_is_customer_registered()) {
1064
+ mo_openid_registeration_modal();
1065
+ }
1066
  }
1067
 
 
1068
  }else if(isset($_POST['go_to_register'])) {
1069
  mo_openid_registeration_modal();
1070
+ } else if( isset($_POST['mo_openid_save_woocommerce_field_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_woocommerce_field" ) {
1071
+ $nonce = $_POST['mo_openid_save_woocommerce_field_nonce'];
1072
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-save-woocommerce-field-nonce' ) ) {
1073
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1074
+ } else {
1075
+ //woocommerce integration
1076
+ // woocommerce display options
1077
+ if(!mo_openid_restrict_user()) {
1078
+
1079
+ update_option('mo_openid_woocommerce_login_form', isset($_POST['mo_openid_woocommerce_login_form']) ? $_POST['mo_openid_woocommerce_login_form'] : 0);
1080
+ update_option('mo_openid_woocommerce_before_login_form', isset($_POST['mo_openid_woocommerce_before_login_form']) ? $_POST['mo_openid_woocommerce_before_login_form'] : 0);
1081
+ update_option('mo_openid_woocommerce_center_login_form', isset($_POST['mo_openid_woocommerce_center_login_form']) ? $_POST['mo_openid_woocommerce_center_login_form'] : 0);
1082
+ update_option('mo_openid_woocommerce_register_form_start', isset($_POST['mo_openid_woocommerce_register_form_start']) ? $_POST['mo_openid_woocommerce_register_form_start'] : 0);
1083
+ update_option('mo_openid_woocommerce_center_register_form', isset($_POST['mo_openid_woocommerce_center_register_form']) ? $_POST['mo_openid_woocommerce_center_register_form'] : 0);
1084
+ update_option('mo_openid_woocommerce_register_form_end', isset($_POST['mo_openid_woocommerce_register_form_end']) ? $_POST['mo_openid_woocommerce_register_form_end'] : 0);
1085
+ update_option('mo_openid_woocommerce_before_checkout_billing_form', isset($_POST['mo_openid_woocommerce_before_checkout_billing_form']) ? $_POST['mo_openid_woocommerce_before_checkout_billing_form'] : 0);
1086
+ update_option('mo_openid_woocommerce_after_checkout_billing_form', isset($_POST['mo_openid_woocommerce_after_checkout_billing_form']) ? $_POST['mo_openid_woocommerce_after_checkout_billing_form'] : 0);
1087
+ }
1088
  }
1089
+ }else if( isset($_POST['mo_openid_save_buddypress_field_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_buddypress_field" ){
1090
+ $nonce = $_POST['mo_openid_save_buddypress_field_nonce'];
1091
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-save-buddypress-field-nonce' ) ) {
1092
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1093
+ } else {
1094
+ //buddypress display options
1095
+ if(!mo_openid_restrict_user()) {
1096
+ update_option('mo_openid_bp_before_register_page', isset($_POST['mo_openid_bp_before_register_page']) ? $_POST['mo_openid_bp_before_register_page'] : 0);
1097
+ update_option('mo_openid_bp_before_account_details_fields', isset($_POST['mo_openid_bp_before_account_details_fields']) ? $_POST['mo_openid_bp_before_account_details_fields'] : 0);
1098
+ update_option('mo_openid_bp_after_register_page', isset($_POST['mo_openid_bp_after_register_page']) ? $_POST['mo_openid_bp_after_register_page'] : 0);
1099
+ }
1100
  }
 
 
1101
  }
1102
+ else if( isset($_POST['mo_openid_comment_settings_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_comment_settings" ) {
1103
+ $nonce = $_POST['mo_openid_comment_settings_nonce'];
1104
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-comment-settings-nonce' ) ) {
1105
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1106
+ } else {
1107
 
1108
+ //commenting
1109
+ update_option( 'mo_openid_social_comment_fb', isset( $_POST['mo_openid_social_comment_fb']) ? $_POST['mo_openid_social_comment_fb'] : 0);
1110
+ update_option( 'mo_openid_social_comment_google', isset( $_POST['mo_openid_social_comment_google']) ? $_POST['mo_openid_social_comment_google'] : 0);
1111
+ update_option( 'mo_openid_social_comment_default', isset( $_POST['mo_openid_social_comment_default']) ? $_POST['mo_openid_social_comment_default'] : 0);
1112
 
1113
+ //comment position
1114
+ update_option( 'mo_openid_social_comment_blogpost', isset( $_POST['mo_openid_social_comment_blogpost']) ? $_POST['mo_openid_social_comment_blogpost'] : 0);
1115
+ update_option( 'mo_openid_social_comment_static', isset( $_POST['mo_openid_social_comment_static']) ? $_POST['mo_openid_social_comment_static'] : 0);
1116
 
1117
+ //comment labels
1118
+ update_option('mo_openid_social_comment_default_label',$_POST['mo_openid_social_comment_default_label'] );
1119
+ update_option('mo_openid_social_comment_fb_label',$_POST['mo_openid_social_comment_fb_label'] );
1120
+ update_option('mo_openid_social_comment_google_label',$_POST['mo_openid_social_comment_google_label'] );
1121
+ update_option('mo_openid_social_comment_heading_label',$_POST['mo_openid_social_comment_heading_label'] );
1122
 
1123
+ update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1124
+ $this->mo_openid_show_success_message();
1125
+ if(!mo_openid_is_customer_registered()) {
1126
 
1127
+ $redirect = add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] );
1128
+ update_option('mo_openid_message', 'Your settings are successfully saved. Please <a href=\" '. $redirect .'\">Register or Login with miniOrange</a> to enable Social Login and Social Sharing.');
1129
+ $this->mo_openid_show_error_message();
1130
+ }
1131
  }
 
 
1132
  }
1133
+ else if( isset($_POST['mo_openid_contact_us_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_contact_us_query_option" ) {
1134
+ $nonce = $_POST['mo_openid_contact_us_nonce'];
1135
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-contact-us-nonce' ) ) {
1136
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
 
 
 
 
 
1137
  } else {
1138
+ // Contact Us query
1139
+ $email = $_POST['mo_openid_contact_us_email'];
1140
+ $phone = $_POST['mo_openid_contact_us_phone'];
1141
+ $query = $_POST['mo_openid_contact_us_query'];
1142
+ $customer = new CustomerOpenID();
1143
+ if ( $this->mo_openid_check_empty_or_null( $email ) || $this->mo_openid_check_empty_or_null( $query ) ) {
1144
+ update_option('mo_openid_message', 'Please fill up Email and Query fields to submit your query.');
1145
  $this->mo_openid_show_error_message();
1146
  } else {
1147
+ $submited = $customer->submit_contact_us( $email, $phone, $query );
1148
+ if ( $submited == false ) {
1149
+ update_option('mo_openid_message', 'Your query could not be submitted. Please try again.');
1150
+ $this->mo_openid_show_error_message();
1151
+ } else {
1152
+ update_option('mo_openid_message', 'Thanks for getting in touch! We shall get back to you shortly.');
1153
+ $this->mo_openid_show_success_message();
1154
+ }
1155
  }
1156
  }
1157
  }
1158
+ else if( isset($_POST['mo_openid_resend_otp_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_resend_otp" ) {
1159
+ $nonce = $_POST['mo_openid_resend_otp_nonce'];
1160
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-resend-otp-nonce' ) ) {
1161
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1162
+ } else {
1163
+ $customer = new CustomerOpenID();
1164
+ $content = json_decode($customer->send_otp_token('EMAIL'), true);
1165
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1166
+ if(get_option('mo_openid_email_otp_count')){
1167
+ update_option('mo_openid_email_otp_count',get_option('mo_openid_email_otp_count') + 1);
1168
+ update_option('mo_openid_message', 'Another One Time Passcode has been sent (' . get_option('mo_openid_email_otp_count') . ') for verification to ' . get_option('mo_openid_admin_email'));
1169
+ if(get_option('regi_pop_up') =="yes")
1170
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
1171
+ }else{
1172
+ update_option( 'mo_openid_message', ' A passcode is sent to ' . get_option('mo_openid_admin_email') . '. Please enter the otp here to verify your email.');
1173
+ update_option('mo_openid_email_otp_count',1);
1174
+ if(get_option('regi_pop_up') =="yes")
1175
+ mo_pop_show_otp_verification(get_option('mo_openid_message'));
1176
+ }
1177
+ update_option('mo_openid_transactionId',$content['txId']);
1178
+ update_option('mo_openid_registration_status','MO_OTP_DELIVERED_SUCCESS');
1179
+ $this->mo_openid_show_success_message();
1180
  }else{
1181
+
1182
+ update_option('mo_openid_message','There was an error in sending email. Please click on Resend OTP to try again.');
1183
+ update_option('mo_openid_registration_status','MO_OTP_DELIVERED_FAILURE');
1184
+ $this->mo_openid_show_error_message();
1185
  if(get_option('regi_pop_up') =="yes")
1186
  mo_pop_show_otp_verification(get_option('mo_openid_message'));
1187
  }
 
 
 
 
 
 
 
 
 
 
1188
  }
1189
+ }else if( isset($_POST['mo_openid_go_back_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back" ){
1190
+ $nonce = $_POST['mo_openid_go_back_nonce'];
1191
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-go-back-nonce' ) ) {
1192
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1193
+ } else {
1194
+ update_option('mo_openid_registration_status','');
1195
+ delete_option('mo_openid_new_registration');
1196
+ delete_option('mo_openid_admin_email');
1197
+ delete_option('mo_openid_sms_otp_count');
1198
+ delete_option('mo_openid_email_otp_count');
1199
+ }
1200
+ }else if( isset($_POST['mo_openid_go_back_login_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back_login" ){
1201
+ $nonce = $_POST['mo_openid_go_back_login_nonce'];
1202
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-go-back-login-nonce' ) ) {
1203
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1204
+ } else {
1205
+ update_option('mo_openid_registration_status','');
1206
+ delete_option('mo_openid_admin_email');
1207
+ delete_option('mo_openid_admin_phone');
1208
+ delete_option('mo_openid_admin_password');
1209
+ delete_option('mo_openid_admin_customer_key');
1210
+ delete_option('mo_openid_verify_customer');
1211
+ }
1212
+ }else if( isset($_POST['mo_openid_go_back_registration_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_go_back_registration" ){
1213
+ $nonce = $_POST['mo_openid_go_back_registration_nonce'];
1214
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-go-back-register-nonce' ) ) {
1215
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1216
+ } else {
1217
+ update_option('mo_openid_verify_customer','true');
1218
+ }
1219
+ }else if( isset($_POST['mo_openid_save_other_settings_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_save_other_settings" ){
1220
+ $nonce = $_POST['mo_openid_save_other_settings_nonce'];
1221
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-save-other-settings-nonce' ) ) {
1222
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1223
+ } else {
1224
+ update_option( 'mo_openid_google_share_enable', isset( $_POST['mo_openid_google_share_enable']) ? $_POST['mo_openid_google_share_enable'] : 0);
1225
+ update_option( 'mo_openid_facebook_share_enable', isset( $_POST['mo_openid_facebook_share_enable']) ? $_POST['mo_openid_facebook_share_enable'] : 0);
1226
+ update_option( 'mo_openid_linkedin_share_enable', isset( $_POST['mo_openid_linkedin_share_enable']) ? $_POST['mo_openid_linkedin_share_enable'] : 0);
1227
+ update_option( 'mo_openid_reddit_share_enable', isset( $_POST['mo_openid_reddit_share_enable']) ? $_POST['mo_openid_reddit_share_enable'] : 0);
1228
+ update_option( 'mo_openid_pinterest_share_enable', isset( $_POST['mo_openid_pinterest_share_enable']) ? $_POST['mo_openid_pinterest_share_enable'] : 0);
1229
+ update_option( 'mo_openid_twitter_share_enable', isset( $_POST['mo_openid_twitter_share_enable']) ? $_POST['mo_openid_twitter_share_enable'] : 0);
1230
+ update_option( 'mo_openid_tumblr_share_enable', isset( $_POST['mo_openid_tumblr_share_enable']) ? $_POST['mo_openid_tumblr_share_enable'] : 0);
1231
+ update_option( 'mo_openid_delicious_share_enable', isset( $_POST['mo_openid_delicious_share_enable']) ? $_POST['mo_openid_delicious_share_enable'] : 0);
1232
+ update_option( 'mo_openid_vkontakte_share_enable', isset( $_POST['mo_openid_vkontakte_share_enable']) ? $_POST['mo_openid_vkontakte_share_enable'] : 0);
1233
+ update_option( 'mo_openid_stumble_share_enable', isset( $_POST['mo_openid_stumble_share_enable']) ? $_POST['mo_openid_stumble_share_enable'] : 0);
1234
+ update_option( 'mo_openid_odnoklassniki_share_enable', isset( $_POST['mo_openid_odnoklassniki_share_enable']) ? $_POST['mo_openid_odnoklassniki_share_enable'] : 0);
1235
+ update_option( 'mo_openid_digg_share_enable', isset( $_POST['mo_openid_digg_share_enable']) ? $_POST['mo_openid_digg_share_enable'] : 0);
1236
+ update_option( 'mo_openid_pocket_share_enable', isset( $_POST['mo_openid_pocket_share_enable']) ? $_POST['mo_openid_pocket_share_enable'] : 0);
1237
+
1238
+ update_option( 'mo_openid_mail_share_enable', isset( $_POST['mo_openid_mail_share_enable']) ? $_POST['mo_openid_mail_share_enable'] : 0);
1239
+ update_option( 'mo_openid_print_share_enable', isset( $_POST['mo_openid_print_share_enable']) ? $_POST['mo_openid_print_share_enable'] : 0);
1240
+ update_option( 'mo_openid_whatsapp_share_enable', isset( $_POST['mo_openid_whatsapp_share_enable']) ? $_POST['mo_openid_whatsapp_share_enable'] : 0);
1241
+
1242
+ update_option('mo_share_options_enable_home_page',isset( $_POST['mo_share_options_home_page']) ? $_POST['mo_share_options_home_page'] : 0);
1243
+ update_option('mo_share_options_enable_post',isset( $_POST['mo_share_options_post']) ? $_POST['mo_share_options_post'] : 0);
1244
+ update_option('mo_share_options_enable_static_pages',isset( $_POST['mo_share_options_static_pages']) ? $_POST['mo_share_options_static_pages'] : 0);
1245
+ update_option('mo_share_options_wc_sp_summary',isset( $_POST['mo_share_options_wc_sp_summary']) ? $_POST['mo_share_options_wc_sp_summary'] : 0);
1246
+ update_option('mo_share_options_wc_sp_summary_top',isset( $_POST['mo_share_options_wc_sp_summary_top']) ? $_POST['mo_share_options_wc_sp_summary_top'] : 0);
1247
+ update_option('mo_share_options_enable_post_position',$_POST['mo_share_options_enable_post_position'] );
1248
+ update_option('mo_share_options_home_page_position',$_POST['mo_share_options_home_page_position'] );
1249
+ update_option('mo_share_options_static_pages_position',$_POST['mo_share_options_static_pages_position'] );
1250
+ update_option('mo_share_options_bb_forum_position',$_POST['mo_share_options_bb_forum_position'] );
1251
+ update_option('mo_share_options_bb_topic_position',$_POST['mo_share_options_bb_topic_position'] );
1252
+ update_option('mo_share_options_bb_reply_position',$_POST['mo_share_options_bb_reply_position'] );
1253
+ update_option('mo_openid_share_theme',$_POST['mo_openid_share_theme'] );
1254
+ update_option('mo_share_vertical_hide_mobile',isset( $_POST['mo_share_vertical_hide_mobile']) ? $_POST['mo_share_vertical_hide_mobile'] : 0);
1255
+ update_option('mo_share_options_bb_forum',isset( $_POST['mo_share_options_bb_forum']) ? $_POST['mo_share_options_bb_forum'] : 0);
1256
+ update_option('mo_share_options_bb_topic',isset( $_POST['mo_share_options_bb_topic']) ? $_POST['mo_share_options_bb_topic'] : 0);
1257
+ update_option('mo_share_options_bb_reply',isset( $_POST['mo_share_options_bb_reply']) ? $_POST['mo_share_options_bb_reply'] : 0);
1258
+ update_option('mo_openid_share_widget_customize_text',$_POST['mo_openid_share_widget_customize_text'] );
1259
+ update_option('mo_openid_share_widget_customize_text_color',$_POST['mo_openid_share_widget_customize_text_color'] );
1260
+ update_option('mo_openid_share_twitter_username', sanitize_text_field($_POST['mo_openid_share_twitter_username'])) ;
1261
+ update_option('mo_openid_share_email_subject', sanitize_text_field($_POST['mo_openid_share_email_subject'])) ;
1262
+ update_option('mo_openid_share_email_body', sanitize_text_field($_POST['mo_openid_share_email_body'])) ;
1263
+
1264
+ update_option('mo_openid_share_widget_customize_direction_horizontal',isset( $_POST['mo_openid_share_widget_customize_direction_horizontal']) ? $_POST['mo_openid_share_widget_customize_direction_horizontal'] : 0);
1265
+ update_option('mo_openid_share_widget_customize_direction_vertical',isset( $_POST['mo_openid_share_widget_customize_direction_vertical']) ? $_POST['mo_openid_share_widget_customize_direction_vertical'] : 0);
1266
+ update_option('mo_sharing_icon_custom_size',isset( $_POST['mo_sharing_icon_custom_size']) ? $_POST['mo_sharing_icon_custom_size'] : 35);
1267
+ update_option('mo_sharing_icon_custom_color',$_POST['mo_sharing_icon_custom_color'] );
1268
+ update_option('mo_openid_share_custom_theme',$_POST['mo_openid_share_custom_theme'] );
1269
+ update_option('mo_sharing_icon_custom_font',$_POST['mo_sharing_icon_custom_font'] );
1270
+ update_option('mo_sharing_icon_space',$_POST['mo_sharing_icon_space'] );
1271
+ update_option( 'mo_openid_message', 'Your settings are saved successfully.' );
1272
+ $this->mo_openid_show_success_message();
1273
+ if(!mo_openid_is_customer_registered()) {
1274
+ $redirect = add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] );
1275
+ update_option('mo_openid_message', 'Your settings are successfully saved. Please <a href=\" '. $redirect .'\">Register or Login with miniOrange</a> to enable Social Login and Social Sharing.');
1276
+ $this->mo_openid_show_error_message();
1277
+ }
1278
  }
1279
  }
1280
+ else if( isset($_POST['mo_openid_add_custom_nonce']) and isset( $_POST['option'] ) and $_POST['option'] == "mo_openid_add_custom_app" ) {
1281
+ $nonce = $_POST['mo_openid_add_custom_nonce'];
1282
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-add-custom-app-nonce' ) ) {
1283
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1284
+ } else {
1285
+ if($this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_id']) || $this->mo_oauth_check_empty_or_null($_POST['mo_oauth_client_secret'])) {
1286
+ update_option( 'message', 'Please enter valid Client ID and Client Secret.');
1287
+ $this->mo_openid_show_error_message();
1288
+ return;
1289
+ } else{
1290
+ $scope = stripslashes(sanitize_text_field( $_POST['mo_oauth_scope'] ));
1291
+ $clientid = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_id'] ));
1292
+ $clientsecret = stripslashes(sanitize_text_field( $_POST['mo_oauth_client_secret'] ));
1293
+ $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_app_name'] ));
1294
+
1295
+ if(get_option('mo_openid_apps_list'))
1296
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
1297
+ else
1298
+ $appslist = array();
1299
+
1300
+ $newapp = array();
1301
+
1302
+ foreach($appslist as $key => $currentapp){
1303
+ if($appname == $key){
1304
+ $newapp = $currentapp;
1305
+ break;
1306
+ }
1307
  }
 
1308
 
1309
+ $newapp['clientid'] = $clientid;
1310
+ $newapp['clientsecret'] = $clientsecret;
1311
+ $newapp['scope'] = $scope;
1312
+ $newapp['redirecturi'] = site_url().'/openidcallback';
1313
+ if($appname=="facebook"){
1314
+ $authorizeurl = 'https://www.facebook.com/dialog/oauth';
1315
+ $accesstokenurl = 'https://graph.facebook.com/v2.8/oauth/access_token';
1316
+ $resourceownerdetailsurl = 'https://graph.facebook.com/me/?fields=id,name,email,age_range,first_name,gender,last_name,link&access_token=';
1317
+ } else if($appname=="google"){
1318
+ $authorizeurl = "https://accounts.google.com/o/oauth2/auth";
1319
+ $accesstokenurl = "https://www.googleapis.com/oauth2/v3/token";
1320
+ $resourceownerdetailsurl = "https://www.googleapis.com/plus/v1/people/me";
1321
+ } else if($appname=="twitter"){
1322
+ $authorizeurl = "https://api.twitter.com/oauth/authorize";
1323
+ $accesstokenurl = "https://api.twitter.com/oauth/access_token";
1324
+ $resourceownerdetailsurl = "https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials?include_email=true";
1325
+ }else {
1326
+ $authorizeurl = stripslashes(sanitize_text_field($_POST['mo_oauth_authorizeurl']));
1327
+ $accesstokenurl = stripslashes(sanitize_text_field($_POST['mo_oauth_accesstokenurl']));
1328
+ $resourceownerdetailsurl = stripslashes(sanitize_text_field($_POST['mo_oauth_resourceownerdetailsurl']));
1329
+ $appname = stripslashes(sanitize_text_field( $_POST['mo_oauth_custom_app_name'] ));
1330
+ }
 
 
1331
 
1332
+ $newapp['authorizeurl'] = $authorizeurl;
1333
+ $newapp['accesstokenurl'] = $accesstokenurl;
1334
+ $newapp['resourceownerdetailsurl'] = $resourceownerdetailsurl;
1335
+ $appslist[$appname] = $newapp;
1336
+ update_option('mo_openid_apps_list', maybe_serialize($appslist));
1337
+ wp_redirect('admin.php?page=mo_openid_settings&tab=custom_app');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1338
  }
1339
  }
 
 
 
 
1340
  }
1341
+ }
 
1342
 
 
1343
 
1344
+ if(isset($_POST['mo_openid_feedback_close_nonce']) and isset($_POST['mo_openid_option']) and $_POST['mo_openid_option']=='mo_openid_skip_feedback'){
1345
+ $nonce = $_POST['mo_openid_feedback_close_nonce'];
1346
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-feedback-close-nonce' ) ) {
1347
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1348
+ } else {
1349
+ update_option('mo_openid_feedback_form',1);
1350
+ deactivate_plugins( '/miniorange-login-openid/miniorange_openid_sso_settings.php' );
1351
+ }
1352
 
1353
  }
1354
+ if(isset($_POST['mo_openid_feedback_nonce']) and isset($_POST['mo_openid_feedback']) and $_POST['mo_openid_feedback']=='mo_openid_feedback') {
1355
+ $nonce = $_POST['mo_openid_feedback_nonce'];
1356
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-feedback-nonce' ) ) {
1357
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
1358
+ } else {
1359
+ $message='';
1360
+ $email = '';
1361
+ if(isset($_POST['deactivate_plugin']) )
1362
  {
1363
+ $message.=' '. $_POST['deactivate_plugin'];
1364
+ if($_POST['mo_openid_query_feedback']!='')
1365
+ {
1366
+ $message.='. '.$_POST['mo_openid_query_feedback'];
1367
+ }
1368
 
1369
+ if(get_option('mo_openid_admin_email'))
1370
+ {
1371
+ $email=get_option('mo_openid_admin_email');
1372
+ }
 
 
 
1373
 
1374
+ //only reason
1375
+ $phone='';
1376
+ $contact_us = new CustomerOpenID();
1377
+ $submited = json_decode( $contact_us->mo_openid_send_email_alert( $email, $phone, $message ), true );
1378
 
1379
+ if ( json_last_error() == JSON_ERROR_NONE ) {
1380
+ if ( is_array( $submited ) && array_key_exists( 'status', $submited ) && $submited['status'] == 'ERROR' )
 
 
1381
  {
1382
+ if( isset($submited['message']))
1383
+ {
1384
+ update_option('mo_openid_message',$submited['message']);
1385
+ $this->mo_openid_show_error_message();
1386
+ }
1387
 
1388
 
1389
+ } else
 
 
1390
  {
1391
+ if ( $submited == false )
1392
+ {
1393
+ update_option( 'mo_openid_message',"ERROR_WHILE_SUBMITTING_QUERY");
1394
+ $this->mo_openid_show_success_message();
1395
+ } else {
1396
+
1397
+ update_option('mo_openid_message',"Your response is submitted successfully");
1398
+ $this->mo_openid_show_success_message();
1399
+ update_option('mo_openid_feedback_form',1);
1400
+ }
1401
  }
1402
  }
1403
+ update_option('mo_openid_feedback_form',1);
1404
+ deactivate_plugins( '/miniorange-login-openid/miniorange_openid_sso_settings.php' );
1405
  }
 
 
 
 
 
1406
  }
1407
  }
 
1408
  }
1409
  function create_customer(){
1410
  delete_option('mo_openid_sms_otp_count');
1536
  if (!(is_dir($filename))) {
1537
  $user_meta_thumbnail = get_user_meta($user_id, 'moopenid_user_avatar', true); //Read the avatar
1538
  $user_meta_name = get_user_meta($user_id, 'user_name', true); //read user details
 
1539
  $user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : '');
1540
  if ($user_picture !== false AND strlen(trim($user_picture)) > 0) { //Avatar found?
1541
  return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
miniorange_openid_sso_settings_page.php CHANGED
@@ -156,9 +156,9 @@ function mo_register_openid() {
156
  }
157
 
158
  function popup_delete_app(selected_app){
159
-
160
- if (confirm("Are you sure you want to delete the app.")) {
161
- location.href='admin.php?page=mo_openid_settings&tab=custom_app&action=delete&app=' + selected_app ;
162
 
163
  }
164
  }
@@ -170,7 +170,6 @@ function mo_register_openid() {
170
  <div id="mo_openid_msgs"></div>
171
  <table style="width:100%;">
172
  <tr>
173
- <!--td style="vertical-align:top;width:65%;"-->
174
  <?php
175
  if( $active_tab == 'share' ) {
176
  mo_openid_other_settings();
@@ -220,11 +219,6 @@ function mo_register_openid() {
220
 
221
 
222
  ?>
223
- <!--/td>
224
- <td style="vertical-align:top;padding-left:1%;">
225
- <?php if($active_tab!='custom_app')
226
- echo miniorange_openid_support(); ?>
227
- </td-->
228
  </table>
229
  <?php
230
  }
@@ -239,7 +233,8 @@ function mo_openid_show_new_registration_page() {
239
  <!--Register with miniOrange-->
240
  <form name="f" method="post" action="" id="register-form">
241
  <input type="hidden" name="option" value="mo_openid_connect_register_customer" />
242
-
 
243
 
244
 
245
  <div class="mo_openid_table_layout">
@@ -252,7 +247,7 @@ function mo_openid_show_new_registration_page() {
252
  <td><b><font color="#FF0000">*</font>Email:</b></td>
253
  <td><input class="mo_openid_table_textbox" type="email" name="email"
254
  required placeholder="person@example.com"
255
- value="<?php echo $current_user->user_email;?>" /></td>
256
  </tr>
257
  <tr>
258
  <td><b><font color="#FF0000">*</font>Website/Company Name:</b></td>
@@ -284,6 +279,8 @@ function mo_openid_show_new_registration_page() {
284
  </form>
285
  <form name="f" method="post" action="" id="openidgobackloginform">
286
  <input type="hidden" name="option" value="mo_openid_go_back_registration"/>
 
 
287
  </form>
288
  <script>
289
  jQuery('#mo_openid_go_back_registration').click(function() {
@@ -307,6 +304,8 @@ function mo_openid_show_verify_password_page() {
307
  <!--Verify password with miniOrange-->
308
  <form name="f" method="post" action="">
309
  <input type="hidden" name="option" value="mo_openid_connect_verify_customer" />
 
 
310
  <div class="mo_openid_table_layout">
311
  <h3>Login with miniOrange</h3>
312
  <p><b>It seems you already have an account with miniOrange. Please enter your miniOrange email and password. <a href="#forgot_password">Click here if you forgot your password?</a></b></p>
@@ -315,7 +314,7 @@ function mo_openid_show_verify_password_page() {
315
  <td><b><font color="#FF0000">*</font>Email:</b></td>
316
  <td><input class="mo_openid_table_textbox" id="email" type="email" name="email"
317
  required placeholder="person@example.com"
318
- value="<?php echo get_option('mo_openid_admin_email');?>" /></td>
319
  </tr>
320
  <td><b><font color="#FF0000">*</font>Password:</b></td>
321
  <td><input class="mo_openid_table_textbox" required type="password"
@@ -334,9 +333,13 @@ function mo_openid_show_verify_password_page() {
334
  </form>
335
  <form name="f" method="post" action="" id="openidgobackform">
336
  <input type="hidden" name="option" value="mo_openid_go_back_login"/>
 
 
337
  </form>
338
  <form name="forgotpassword" method="post" action="" id="openidforgotpasswordform">
339
  <input type="hidden" name="option" value="mo_openid_forgot_password"/>
 
 
340
  <input type="hidden" id="forgot_pass_email" name="email" value=""/>
341
  </form>
342
  <script>
@@ -362,7 +365,8 @@ function mo_openid_apps_config() {
362
  <!-- Google configurations -->
363
  <form id="form-apps" name="form-apps" method="post" action="">
364
  <input type="hidden" name="option" value="mo_openid_enable_apps" />
365
-
 
366
 
367
  <div class="mo_openid_table_layout">
368
 
@@ -475,20 +479,20 @@ function mo_openid_apps_config() {
475
  </span>
476
 
477
  <span style="margin-left:111px;">
478
- <input style="width:50px" onkeyup="moLoginSpaceValidate(this)" id="mo_login_icon_space" name="mo_login_icon_space" type="text" value="<?php echo get_option('mo_login_icon_space')?>" />
479
  <input id="mo_login_space_plus" type="button" value="+" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
480
  <input id="mo_login_space_minus" type="button" value="-" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
481
  </span>
482
 
483
 
484
  <span id="commontheme" style="margin-left:115px">
485
- <input style="width:50px" id="mo_login_icon_size" onkeyup="moLoginSizeValidate(this)" name="mo_login_icon_custom_size" type="text" value="<?php echo get_option('mo_login_icon_custom_size')?>" >
486
  <input id="mo_login_size_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
487
  <input id="mo_login_size_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
488
 
489
  </span>
490
  <span style="margin-left:91px" class="longbuttontheme">Width:&nbsp;
491
- <input style="width:50px" id="mo_login_icon_width" onkeyup="moLoginWidthValidate(this)" name="mo_login_icon_custom_width" type="text" value="<?php echo get_option('mo_login_icon_custom_width')?>" >
492
  <span style="margin-left:3px;">
493
 
494
  <input id="mo_login_width_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
@@ -515,7 +519,7 @@ function mo_openid_apps_config() {
515
 
516
 
517
  <span style="margin-left:235px" class="longbuttontheme" >Height:
518
- <input style="width:50px" id="mo_login_icon_height" onkeyup="moLoginHeightValidate(this)" name="mo_login_icon_custom_height" type="text" value="<?php echo get_option('mo_login_icon_custom_height')?>" >
519
  <span style="margin-left:1px;">
520
 
521
  <input id="mo_login_height_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
@@ -531,13 +535,13 @@ function mo_openid_apps_config() {
531
  <?php checked( get_option('mo_openid_login_theme') == 'square' );?> />Square
532
 
533
  <span style="margin-left:113px;">
534
- <input id="mo_login_icon_custom_color" style="width:135px;" name="mo_login_icon_custom_color" class="color" value="<?php echo get_option('mo_login_icon_custom_color')?>" onchange="moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
535
  </span>
536
 
537
 
538
  <span style="margin-left:228px" class="longbuttontheme">Curve:&nbsp;
539
  <input style="width:50px" id="mo_login_icon_custom_boundary" onkeyup="moLoginBoundaryValidate(this)" name="mo_login_icon_custom_boundary" type="text" value=
540
- "<?php echo get_option('mo_login_icon_custom_boundary')?>" />
541
  <span style="margin-left:4px;">
542
 
543
  <input id="mo_login_boundary_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
@@ -568,25 +572,25 @@ function mo_openid_apps_config() {
568
 
569
  <div>
570
  <a id="mo_login_button_preview_facebook" class="btn btn-block btn-defaulttheme btn-social btn-facebook btn-custom-size"> <i class="fa fa-facebook"></i><?php
571
- echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
572
  <a id="mo_login_button_preview_google" class="btn btn-block btn-defaulttheme btn-social btn-google btn-custom-size"> <i class="fa fa-google"></i><?php
573
- echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
574
  <a id="mo_login_button_preview_vkontakte" class="btn btn-block btn-defaulttheme btn-social btn-vk btn-custom-size"> <i class="fa fa-vk"></i><?php
575
- echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
576
  <a id="mo_login_button_preview_twitter" class="btn btn-block btn-defaulttheme btn-social btn-twitter btn-custom-size"> <i class="fa fa-twitter"></i><?php
577
- echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
578
  <a id="mo_login_button_preview_instagram" class="btn btn-block btn-defaulttheme btn-social btn-instagram btn-custom-size"> <i class="fa fa-instagram"></i><?php
579
- echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
580
  <a id="mo_login_button_preview_linkedin" class="btn btn-block btn-defaulttheme btn-social btn-linkedin btn-custom-size"> <i class="fa fa-linkedin"></i><?php
581
- echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
582
  <a id="mo_login_button_preview_amazon" class="btn btn-block btn-defaulttheme btn-social btn-soundcloud btn-custom-size"> <i class="fa fa-amazon"></i><?php
583
- echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
584
  <a id="mo_login_button_preview_salesforce" class="btn btn-block btn-defaulttheme btn-social btn-vimeo btn-custom-size"> <i class="fa fa-cloud"></i><?php
585
- echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
586
  <a id="mo_login_button_preview_windowslive" class="btn btn-block btn-defaulttheme btn-social btn-microsoft btn-custom-size"> <i class="fa fa-windows"></i><?php
587
- echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
588
  <a id="mo_login_button_preview_yahoo" class="btn btn-block btn-defaulttheme btn-social btn-yahoo btn-custom-size"> <i class="fa fa-yahoo"></i><?php
589
- echo get_option('mo_openid_login_button_customize_text'); ?> Yahoo</a>
590
 
591
  </div>
592
  <div>
@@ -603,25 +607,25 @@ function mo_openid_apps_config() {
603
  </div>
604
  <div>
605
  <a id="mo_custom_login_button_preview_facebook" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-facebook"></i><?php
606
- echo get_option('mo_openid_login_button_customize_text'); ?> Facebook</a>
607
  <a id="mo_custom_login_button_preview_google" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-google"></i><?php
608
- echo get_option('mo_openid_login_button_customize_text'); ?> Google</a>
609
  <a id="mo_custom_login_button_preview_vkontakte" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-vk"></i><?php
610
- echo get_option('mo_openid_login_button_customize_text'); ?> Vkontakte</a>
611
  <a id="mo_custom_login_button_preview_twitter" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-twitter"></i><?php
612
- echo get_option('mo_openid_login_button_customize_text'); ?> Twitter</a>
613
  <a id="mo_custom_login_button_preview_instagram" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-instagram"></i><?php
614
- echo get_option('mo_openid_login_button_customize_text'); ?> Instagram</a>
615
  <a id="mo_custom_login_button_preview_linkedin" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-linkedin"></i><?php
616
- echo get_option('mo_openid_login_button_customize_text'); ?> LinkedIn</a>
617
  <a id="mo_custom_login_button_preview_amazon" class="btn btn-block btn-customtheme btn-social btn-custom-size"><i class="fa fa-amazon"></i><?php
618
- echo get_option('mo_openid_login_button_customize_text'); ?> Amazon</a>
619
  <a id="mo_custom_login_button_preview_salesforce" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-cloud"></i><?php
620
- echo get_option('mo_openid_login_button_customize_text'); ?> Salesforce</a>
621
  <a id="mo_custom_login_button_preview_windows" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-windows"></i><?php
622
- echo get_option('mo_openid_login_button_customize_text'); ?> Windows</a>
623
  <a id="mo_custom_login_button_preview_yahoo" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-yahoo"></i><?php
624
- echo get_option('mo_openid_login_button_customize_text'); ?> Yahoo</a>
625
 
626
  </div>
627
  </td>
@@ -645,7 +649,7 @@ function mo_openid_apps_config() {
645
  <td>
646
  <b>Select color for customize text:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
647
  <span style="margin-left:15px;">
648
- <input id="mo_openid_table_textbox" style="width:135px;" name="mo_login_openid_login_widget_customize_textcolor" class="color" value="<?php echo get_option('mo_login_openid_login_widget_customize_textcolor')?>" > </td>
649
  </span>
650
  </td>
651
  </tr>
@@ -653,13 +657,13 @@ function mo_openid_apps_config() {
653
  <tr>
654
  <td><b>Enter text to show above login widget:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
655
 
656
- <input class="mo_openid_table_textbox" style="margin-left:12px;width:50%" type="text" name="mo_openid_login_widget_customize_text" value="<?php echo get_option('mo_openid_login_widget_customize_text'); ?>" /></td>
657
  </tr>
658
  <tr>
659
  <td><b>Enter text to show on your login buttons (If you have</b>
660
  <br/><b> selected shape 4 from 'Customize Login Icons' section):</b>&nbsp;&nbsp;&nbsp;&nbsp;
661
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_button_customize_text"
662
- value="<?php echo get_option('mo_openid_login_button_customize_text'); ?>" /></td>
663
  </tr>
664
 
665
  <tr>
@@ -672,12 +676,12 @@ function mo_openid_apps_config() {
672
  <tr>
673
  <td><b>Enter text to show before the logout link</b>
674
  <br/>Use ##username## to display current username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
675
- <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_name_text" value="<?php echo get_option('mo_openid_login_widget_customize_logout_name_text'); ?>" /></td>
676
  </tr>
677
  <tr>
678
  <td><b>Enter text to show as logout link:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
679
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_text"
680
- value="<?php echo get_option('mo_openid_login_widget_customize_logout_text'); ?>" /></td>
681
  </tr>
682
 
683
  <tr><td>
@@ -770,14 +774,14 @@ function mo_openid_apps_config() {
770
  <input type="radio" id="login_redirect_customurl" name="mo_openid_login_redirect" value="custom"
771
  <?php checked( get_option('mo_openid_login_redirect') == 'custom' );?> />Custom URL
772
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
773
- <input type="url" id="login_redirect_url" style="width:50%;margin-left: 12px;" name="mo_openid_login_redirect_url" value="<?php echo get_option('mo_openid_login_redirect_url')?>" />
774
  </td>
775
  </tr>
776
  <tr>
777
  <td>
778
  <input type="radio" id="login_redirect_relativeurl" name="mo_openid_login_redirect" value="relative" <?php checked( get_option('mo_openid_login_redirect') == 'relative' );?> />Relative URL
779
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo site_url();?>
780
- <input type="text" id="login_redirect_url" style="width:50%" name="mo_openid_relative_login_redirect_url" value="<?php echo get_option('mo_openid_relative_login_redirect_url')?>" />
781
  </td>
782
  </tr>
783
 
@@ -813,7 +817,7 @@ function mo_openid_apps_config() {
813
  <?php checked( get_option('mo_openid_logout_redirect') == 'custom' );?> />Relative URL
814
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
815
  <?php echo site_url();?>
816
- <input type="text" id="logout_redirect_url" style="width:50%" name="mo_openid_logout_redirect_url" value="<?php echo get_option('mo_openid_logout_redirect_url')?>" />
817
  </td>
818
  </tr>
819
  </table></td></tr>
@@ -833,7 +837,7 @@ function mo_openid_apps_config() {
833
  <?php checked( get_option('mo_openid_auto_register_enable') == 1 );?> /><b>Auto-register users</b>
834
  <br/><br/>
835
  <b>Registration disabled message: </b>
836
- <textarea id="auto_register_disabled_message" style="width:80%" name="mo_openid_register_disabled_message" ><?php echo get_option('mo_openid_register_disabled_message')?></textarea>
837
  </td>
838
  </tr>
839
  <tr>
@@ -878,13 +882,13 @@ function mo_openid_apps_config() {
878
  <?php checked( get_option('mo_openid_gdpr_consent_enable') == 1 );?> /><b>Take consent from users</b>
879
  <br/><br/>
880
  <b>Enter the Consent message: </b><br>
881
- <textarea style="width:80%" name="mo_openid_gdpr_consent_message"><?php echo get_option('mo_openid_gdpr_consent_message')?></textarea>
882
  <br><br>
883
  <b>Enter the text that redirects to Privacy Policy URL: </b><br>
884
- <input type="text" style="width:90%" name="mo_openid_privacy_policy_text" value="<?php echo get_option('mo_openid_privacy_policy_text')?>" <?php if(!mo_openid_is_customer_registered()) echo 'disabled';?>/>
885
  <br><br>
886
  <b>Enter Privacy Policy URL: </b><br>
887
- <input type="text" style="width:90%" name="mo_openid_privacy_policy_url" value="<?php echo get_option('mo_openid_privacy_policy_url')?>" <?php if(!mo_openid_is_customer_registered()) echo 'disabled';?> />
888
  </td>
889
  </tr>
890
  <td>
@@ -904,17 +908,17 @@ function mo_openid_apps_config() {
904
  <?php if(get_option('mo_openid_account_linking_enable')){?>
905
  <tr id="account_link_customized_text"><td><h3 style="float: left">Customize Text for Account Linking</h3><a style="float: right;margin-right: 325px;margin-top: 20px" onclick="customize_account_linking_img()">View Dialogue Box</a></td></tr>
906
  <tr id="acc_link_img"><td></td></tr>
907
- <tr id="account_link_customized_text"><td><b>1. Enter title of Account linking form:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left:135px;" type="text" name="mo_account_linking_title" value="<?php echo get_option('mo_account_linking_title'); ?>" /></td></tr>
908
- <tr id="account_link_customized_text"><td><b>2. Enter button text for create new user:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 115px" type="text" name="mo_account_linking_new_user_button" value="<?php echo get_option('mo_account_linking_new_user_button'); ?>"/></td></tr>
909
  <tr id="account_link_customized_text">
910
  <td>
911
- <b>3. Enter button text for Link to existing user:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left:89px" type="text" name="mo_account_linking_existing_user_button" value="<?php echo get_option('mo_account_linking_existing_user_button'); ?>"/></td></tr>
912
- <tr id="account_link_customized_text"><td ><b>4. Enter instruction to Create New Account :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_account_linking_new_user_instruction" value="<?php echo get_option('mo_account_linking_new_user_instruction'); ?>"/>
913
  </td>
914
  </tr>
915
  <tr id="account_link_customized_text">
916
  <td>
917
- <b>5. Enter instructions to link to an existing account :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_account_linking_existing_user_instruction" value="<?php echo get_option('mo_account_linking_existing_user_instruction'); ?>"/></td></tr><tr id="account_link_customized_text"><td><b>5. Enter extra instructions for account linking :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px;" type="text" name="mo_account_linking_extra_instruction" value="<?php echo get_option('mo_account_linking_extra_instruction'); ?>"/>
918
  </td>
919
  </tr>
920
  <?php }?><?php ;} ?>
@@ -939,17 +943,17 @@ function mo_openid_apps_config() {
939
  <?php if(get_option('mo_openid_enable_profile_completion')){?>
940
  <tr id="profile_completion_customized_text"><td><h3 style="float: left">Customize Text for Profile Completion</h3><a style="float: right;margin-right: 300px;margin-top: 20px" onclick="customize_profile_completion_img()">View Dialogue Box</a></td></tr>
941
  <tr id="profile_completion_img"><td></td></tr>
942
- <tr id="profile_completion_customized_text"><td><b>1. Enter title of Profle Completion:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 150px" type="text" name="mo_profile_complete_title" value="<?php echo get_option('mo_profile_complete_title'); ?>" /></td></tr>
943
- <tr id="profile_completion_customized_text"><td><b>2. Enter Username Label text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 177px" type="text" name="mo_profile_complete_username_label" value="<?php echo get_option('mo_profile_complete_username_label'); ?>"/></td></tr>
944
- <tr id="profile_completion_customized_text"><td><b>3. Enter Email Label text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 205px" type="text" name="mo_profile_complete_email_label" value="<?php echo get_option('mo_profile_complete_email_label'); ?>"/></td></tr>
945
- <tr id="profile_completion_customized_text"><td><b>4. Enter Submit button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 184px" type="text" name="mo_profile_complete_submit_button" value="<?php echo get_option('mo_profile_complete_submit_button'); ?>"/></td></tr>
946
- <tr id="profile_completion_customized_text"><td><b style="margin-top:20px">5. Enter instruction for Profile Completion :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px;margin-bottom:5px" type="text" name="mo_profile_complete_instruction" value="<?php echo get_option('mo_profile_complete_instruction'); ?>"/></td></tr>
947
- <tr id="profile_completion_customized_text"><td><b>6. Enter extra instruction for Profile Completion :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_profile_complete_extra_instruction" value="<?php echo get_option('mo_profile_complete_extra_instruction'); ?>"/></td></tr>
948
- <tr id="profile_completion_customized_text"><td><b>Enter username already exists warning message text :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_profile_complete_uname_exist" value="<?php echo get_option('mo_profile_complete_uname_exist'); ?>"/></td></tr>
949
  <tr id="profile_completion_customized_text"><td><h3 style="float: left">Customize Text for Email Verification</h3><a style="float: right;margin-right: 300px;margin-top: 20px" onclick="customize_email_verify_img()">View Dialogue Box
950
- </a></td></tr> <tr id="email_verify"><td></td></tr><tr id="profile_completion_customized_text"><td><b>1. Enter title of Email Verification form:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 125px" type="text" name="mo_email_verify_title" value="<?php echo get_option('mo_email_verify_title'); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>2. Enter Resend OTP button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 160px" type="text" name="mo_email_verify_resend_otp_button" value="<?php echo get_option('mo_email_verify_resend_otp_button'); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>3. Enter Back button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 202px" type="text" name="mo_email_verify_back_button" value="<?php echo get_option('mo_email_verify_back_button'); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>4. Enter instruction for Email Verification form:</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_message" value="<?php echo get_option('mo_email_verify_message'); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>5. Enter verification code in Email Verification form:</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_verification_code_instruction" value="<?php echo get_option('mo_email_verify_verification_code_instruction'); ?>"/></td></tr>
951
- <tr id="profile_completion_customized_text"><td><b> Enter Message for wrong OTP :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_wrong_otp" value="<?php echo get_option('mo_email_verify_wrong_otp'); ?>"/></td></tr>
952
- <tr id="profile_completion_customized_text"><td><br><h3> <b>Customized OTP Message:</b> </h3><textarea class="tinymce" rows="6" id="mo_openid_email_message_id" style="width:100%" name="custom_otp_msg" ><?php echo get_option('custom_otp_msg')?></textarea></td></tr>
953
  <tr id='profile_completion_customized_text'><td><b>NOTE</b>: Please enter <b>##otp##</b> in message where you want to show otp.</td></tr>
954
  <?php } ?>
955
  <tr id="prof_completion"><td> </td></tr>
@@ -968,9 +972,9 @@ var checkbox2 = document.getElementById('profile_completion_enable');
968
  if (checkbox1.checked == true){
969
  if(custom_link==1){
970
  jQuery("<tr id=\"account_link_customized_text\"><td><h3 style=\"float: left\">Customize Text for Account Linking</h3><a style=\"float: right;margin-right: 302px;margin-top: 20px\" onclick=\"customize_account_linking_img()\">View Dialogue Box</a></td></tr><tr id=\"acc_link_img\"><td></td></tr><tr id=\"account_link_customized_text\"><td><b>1. Enter title of Account linking form:</b>\n"+
971
- "\n"+"\t\t\t<input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 132px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_title\" value=\"<?php echo get_option('mo_account_linking_title'); ?>\" /></td>\n"+"\t</tr><tr id=\"account_link_customized_text\"><td><b>2. Enter button text for create new user:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 115px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_new_user_button\" value=\"<?php echo get_option('mo_account_linking_new_user_button'); ?>\"/></td></tr><tr id=\"account_link_customized_text\"><td><b>3. Enter button text for Link to existing user:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 89px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_existing_user_button\" value=\"<?php echo get_option('mo_account_linking_existing_user_button'); ?>\"/></td></tr><tr id=\"account_link_customized_text\">\n"+"\t\t<td ><b style=\"margin-top:20px\">4. Enter instruction to Create New Account :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n"+
972
- " <input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_new_user_instruction\" value=\"<?php echo get_option('mo_account_linking_new_user_instruction'); ?>\"/></td>\n"+
973
- "\t</tr><tr id=\"account_link_customized_text\"><td><b>5. Enter instructions to link to an existing account :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_existing_user_instruction\" value=\"<?php echo get_option('mo_account_linking_existing_user_instruction'); ?>\"/></td></tr><tr id=\"account_link_customized_text\"><td><b>5. Enter extra instructions for account linking :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_extra_instruction\" value=\"<?php echo get_option('mo_account_linking_extra_instruction'); ?>\"/></td></tr>").insertBefore(jQuery("#acc_link"));
974
  custom_link=2;
975
  }
976
  }
@@ -986,9 +990,9 @@ var checkbox2 = document.getElementById('profile_completion_enable');
986
  if (checkbox2.checked == true){
987
  if(custom_prof_completion==1) {
988
  jQuery("<tr id=\"profile_completion_customized_text\"><td><h3 style=\"float: left\">Customize Text for Profile Completion</h3><a style=\"float: right;margin-right: 300px;margin-top: 20px\" onclick=\"customize_profile_completion_img()\">View Dialogue Box</a></td></tr><tr id=\"profile_completion_img\"><td></td></tr><tr id=\"profile_completion_customized_text\"><td><b>1. Enter title of Profle Completion:</b>\n"+
989
- "\n"+"\t\t\t<input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 145px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_title\" value=\"<?php echo get_option('mo_profile_complete_title'); ?>\" /></td>\n"+"\t</tr><tr id=\"profile_completion_customized_text\"><td><b>2. Enter Username Label text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 175px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_username_label\" value=\"<?php echo get_option('mo_profile_complete_username_label'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>3. Enter Email Label text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 202px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_email_label\" value=\"<?php echo get_option('mo_profile_complete_email_label'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>4. Enter Submit button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 182px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_submit_button\" value=\"<?php echo get_option('mo_profile_complete_submit_button'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\">\n"+"\t\t<td ><b style=\"margin-top:20px\">5. Enter instruction for Profile Completion :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n"+
990
- " <input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_instruction\" value=\"<?php echo get_option('mo_profile_complete_instruction'); ?>\"/></td>\n"+
991
- "\t</tr><tr id=\"profile_completion_customized_text\"><td><b>6. Enter extra instruction for Profile Completion :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_extra_instruction\" value=\"<?php echo get_option('mo_profile_complete_extra_instruction'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>Enter username already exists warning message text :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_uname_exist\" value=\"<?php echo get_option('mo_profile_complete_uname_exist');?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><h3 style=\"float: left\">Customize Text for Email Verification</h3><a style=\"float: right;margin-right: 300px;margin-top: 20px\" onclick=\"customize_email_verify_img();\">View Dialogue Box</a></td></tr><tr id=\"email_verify\"><td></td></tr><tr id=\"profile_completion_customized_text\"><td><b>1. Enter title of Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 125px\" type=\"text\" name=\"mo_email_verify_title\" value=\"<?php echo get_option('mo_email_verify_title'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>2. Enter Resend OTP button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 160px\" type=\"text\" name=\"mo_email_verify_resend_otp_button\" value=\"<?php echo get_option('mo_email_verify_resend_otp_button'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>3. Enter Back button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 201px\" type=\"text\" name=\"mo_email_verify_back_button\" value=\"<?php echo get_option('mo_email_verify_back_button'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>4. Enter instruction for Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_message\" value=\"<?php echo get_option('mo_email_verify_message'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>5. Enter verification code in Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_verification_code_instruction\" value=\"<?php echo get_option('mo_email_verify_verification_code_instruction'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b> Enter Message for wrong OTP :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_wrong_otp\" value=\"<?php echo get_option('mo_email_verify_wrong_otp'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><br><h3> <b>Customized OTP Message:</b> </h3><textarea class=\"tinymce\" rows=\"6\" style=\"width:100%\" name=\"custom_otp_msg\">"+ <?php echo json_encode(get_option('custom_otp_msg'));?>+"</textarea></td></tr><tr id='profile_completion_customized_text'><td><b>NOTE</b>: Please enter <b>##otp##</b> in message where you want to show otp.</td></tr>").insertBefore(jQuery("#prof_completion"));
992
  custom_prof_completion=2;
993
  }
994
  }
@@ -1043,10 +1047,11 @@ function customize_email_verify_img(){
1043
  function redirectto_custom_tab(x)
1044
  {
1045
  var site_url = '<?php echo site_url();?>';
 
1046
  box1 = document.getElementById('facebook_enable');
1047
  if (box1.checked == true){
1048
  if(x==0){
1049
- window.location= site_url+"/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app&action=add&app_name=facebook";
1050
  }
1051
  if(x==1){
1052
  window.location= site_url+"/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app&setup_msg";
@@ -1054,13 +1059,13 @@ function customize_email_verify_img(){
1054
  }
1055
  }
1056
 
1057
- var tempHorSize = '<?php echo get_option('mo_login_icon_custom_size') ?>';
1058
- var tempHorTheme = '<?php echo get_option('mo_openid_login_theme') ?>';
1059
- var tempHorCustomTheme = '<?php echo get_option('mo_openid_login_custom_theme') ?>';
1060
- var tempHorCustomColor = '<?php echo get_option('mo_login_icon_custom_color') ?>';
1061
- var tempHorSpace = '<?php echo get_option('mo_login_icon_space')?>';
1062
- var tempHorHeight = '<?php echo get_option('mo_login_icon_custom_height') ?>';
1063
- var tempHorBoundary='<?php echo get_option('mo_login_icon_custom_boundary')?>';
1064
  function moLoginIncrement(e,t,r,a,i){
1065
  var h,s,c=!1,_=a;s=function(){
1066
  "add"==t&&r.value<60?r.value++:"subtract"==t&&r.value>20&&r.value--,h=setTimeout(s,_),_>20&&(_*=i),c||(document.onmouseup=function(){clearTimeout(h),document.onmouseup=null,c=!1,_=a},c=!0)},e.onmousedown=s}
@@ -1476,7 +1481,7 @@ function customize_email_verify_img(){
1476
  <td>
1477
  <br/>
1478
  <input type="checkbox" id="auto_email_enable" name="mo_openid_email_enable" value="1"
1479
- <?php checked( get_option('mo_openid_email_enable') == 1 );?> /><b>Enable Email Notification to Admin - <?php echo get_option("mo_openid_admin_email");?> on User Registration</b>
1480
  <br/>
1481
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <b>Notice:</b> SMTP should be configured. ]
1482
  </td>
@@ -1547,7 +1552,7 @@ function customize_email_verify_img(){
1547
  <input type="checkbox" disabled="disabled" /><b>Take consent from users</b>
1548
  <br/><br/>
1549
  <b>Enter the Consent message: </b><br>
1550
- <textarea style="width:80%" disabled="disabled"><?php echo get_option('mo_openid_gdpr_consent_message')?></textarea>
1551
  <br><br>
1552
  <b>Enter the text that redirects to Privacy Policy URL: </b><br>
1553
  <input type="text" style="width:90%" disabled="disabled"/>
@@ -1594,11 +1599,6 @@ function mo_openid_integrations(){
1594
 
1595
  .tableborder tr:nth-child(even){background-color: #f2f2f2}
1596
  </style>
1597
- <!--<?php if(!mo_openid_is_customer_registered()) { ?>
1598
- <div style="display:block;margin-top:10px;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">
1599
- Please <a href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Register or Login with miniOrange</a> to enable Social Login and Social Sharing.
1600
- </div>
1601
- <?php }?>-->
1602
 
1603
  <div style="display:block;">
1604
  <b><span style="display:block;margin-top:10px;background-color:aliceblue;padding:5px;border:solid 1px deepskyblue;">*NOTE: These features are available in the <a target="_blank" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">premium</a> version of the plugin.</span>
@@ -1609,8 +1609,10 @@ function mo_openid_integrations(){
1609
 
1610
  <h3><span style='color:red;'>*</span>BuddyPress</h3>
1611
 
1612
- <form name="mo_openid_mailchimp_form" method="post" id="mo_openid_mailchimp_form">
1613
  <input type="hidden" name="option" value="mo_openid_save_buddypress_field"/>
 
 
1614
  <table>
1615
  <tr><td>
1616
  <b>BuddyPress display options</b>
@@ -1641,7 +1643,7 @@ function mo_openid_integrations(){
1641
 
1642
  ?>
1643
 
1644
- <!--MailChimp form-->
1645
  <form name="mo_openid_mailchimp_form" method="post" id="mo_openid_mailchimp_form">
1646
  <input type="hidden" name="option" value="mo_openid_save_mailchimp_field"/><br>
1647
  <hr>
@@ -1662,9 +1664,11 @@ function mo_openid_integrations(){
1662
  </a><br>
1663
  </form>
1664
 
1665
- <!-- Woocommerce form-->
1666
  <form name="mo_openid_woocommerce_form" method="post" id="mo_openid_woocommerce_form">
1667
  <input type="hidden" name="option" value="mo_openid_save_woocommerce_field"/>
 
 
1668
  <br>
1669
  <hr>
1670
  <h3><span style="color:red;">*</span>Woocommerce</h3>
@@ -1740,28 +1744,18 @@ function mo_openid_integrations(){
1740
  function mo_openid_email_notification(){
1741
  ?>
1742
  <td style="vertical-align:top;width:65%;">
1743
- <form name="f" method="post" id="mail_notification" action="">
1744
- <input type="hidden" name="option" value="mo_openid_mail_configuration" />
1745
  <div class="mo_openid_table_layout">
1746
 
1747
- <!--<?php if(!mo_openid_is_customer_registered()) { ?>
1748
- <div style="display:block;margin-top:10px;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">
1749
- Please <a href="<?php echo add_query_arg( array('tab' => 'register'), $_SERVER['REQUEST_URI'] ); ?>">Login with miniOrange</a> to enable Social Login and Social Sharing.
1750
- </div>
1751
- <?php } ?>-->
1752
-
1753
  <div style="display:block;">
1754
  <b><span style="display:block;margin-top:10px;background-color:aliceblue;padding:5px;border:solid 1px deepskyblue;">*NOTE: These features are available in the <a target="_blank" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">standard and premium</a> version of the plugin.</span>
1755
  </b>
1756
  </div>
1757
 
1758
  <table style="width:99%;">
1759
-
1760
  <tr>
1761
  <td>
1762
  <h3> Send Mail To Admin</h3>
1763
  </td>
1764
-
1765
  </tr>
1766
  </table>
1767
  <table style="width:99%;" >
@@ -1769,16 +1763,14 @@ function mo_openid_email_notification(){
1769
  <tr>
1770
  <td>
1771
  <span style="color:red;">*</span><b>If you want to send Email Notification to multiple admins, enter emails of all admins here:</b><br>(If left empty only administrator gets email)<br><br>
1772
- <textarea disabled rows="2" id="mo_openid_multiple_email_id" placeholder="Emails should be separated by comma" style="width:100%;background: #DCDAD1;" name="mo_openid_multiple_admin_emails" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?>><?php echo get_option('mo_openid_multiple_admin_emails')?></textarea>
1773
-
1774
  </td>
1775
  </tr>
1776
 
1777
  <tr>
1778
  <td>
1779
  <br>
1780
- <input style ="background: #DCDAD1;" disabled type="checkbox" id="mo_admin_email_template" name="mo_admin_email_template" value="1"
1781
- <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> <?php checked( get_option('mo_admin_email_template') == 1 );?> /><b><span style="color:red;">*</span>Edit Email Notification Template to Admin</b>
1782
  <br/>
1783
  </td>
1784
  </tr>
@@ -1787,7 +1779,7 @@ function mo_openid_email_notification(){
1787
  <td><br />
1788
  <span style="color:red;">*</span>
1789
  <b>Email Subject:</b>
1790
- <textarea disabled rows="2" id="mo_openid_email_subject" placeholder="Enter your subject line here" style="width:100%;background: #DCDAD1;" name="mo_openid_email_subject" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?>><?php echo get_option('mo_openid_email_subject')?></textarea>
1791
  <br/>
1792
  </td>
1793
  </tr>
@@ -1797,13 +1789,7 @@ function mo_openid_email_notification(){
1797
  <br />
1798
  <span style="color:red;">*</span>
1799
  <b>Edit Content of Email:</b>
1800
- <?php
1801
- $editor_id = 'emailtemplate';
1802
- $content = get_option('mo_openid_registration_email_content');
1803
-
1804
- ?>
1805
- <textarea disabled rows="6" id="mo_openid_email_message_id" style="width:100%;background: #DCDAD1;" name="mo_openid_registration_email_content" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?>><?php echo get_option('mo_openid_registration_email_content')?></textarea>
1806
-
1807
  </td>
1808
  </tr>
1809
 
@@ -1811,76 +1797,56 @@ function mo_openid_email_notification(){
1811
  <td>
1812
  <br>
1813
  <hr>
1814
-
1815
  <h3>Send Mail to User</h3>
1816
  </td>
1817
  </tr>
1818
-
1819
  <tr>
1820
  <td>
1821
-
1822
  <input style="background: #DCDAD1;" disabled type="checkbox" id="auto_welcome_email_enable" name="mo_openid_welcome_email_enable" value="1"
1823
  <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> <?php checked( get_option('mo_openid_welcome_email_enable') == 1 );?> /><b><span style="color:red;">*</span>Enable Email Notification to User on User Registration*</b>
1824
  <br/>
1825
  </td>
1826
  </tr>
1827
-
1828
-
1829
  <tr class="mo_openid_welcome_email_subject">
1830
  <td><br />
1831
  <span style="color:red;">*</span>
1832
  <b>Email Subject:</b>
1833
- <textarea disabled rows="2" id="mo_openid_welcome_email_subject" placeholder="Enter your subject line here" style="width:100%;background: #DCDAD1;" name="mo_openid_welcome_email_subject" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?>><?php echo get_option('mo_openid_welcome_email_subject')?></textarea>
1834
  <br/>
1835
  </td>
1836
  </tr>
1837
-
1838
-
1839
  <tr>
1840
  <td>
1841
  <br/ >
1842
  <span style="color:red;">*</span>
1843
  <b>Edit Content of Email:</b>
1844
- <?php
1845
- $editor_id = 'emailtemplate';
1846
- $content = get_option('mo_openid_user_register_message');
1847
- ?>
1848
- <textarea disabled rows="6" id="mo_openid_email_message_id" style="width:100%;background: #DCDAD1;" name="mo_openid_user_register_message" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?>><?php echo get_option('mo_openid_user_register_message')?></textarea>
1849
 
1850
  </td>
1851
  </tr>
1852
  </table>
1853
  <table class="mo_openid_display_table">
1854
  <tr>
1855
- <td><br /><input disabled type="submit" name="submit" value="Save" style="width:100px;" <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> class="button button-primary button-large" />
1856
  </td>
1857
  </tr>
1858
  </table>
1859
-
1860
  <br><b>*NOTE: These features require SMTP to be setup.</b>
1861
-
1862
  </div>
1863
- </form>
1864
-
1865
-
1866
-
1867
  </td>
1868
-
1869
  <td style="vertical-align:top;padding-left:1%;">
1870
  <?php echo miniorange_openid_support(); ?>
1871
  </td>
1872
-
1873
-
1874
  <?php exit;
1875
  }
1876
 
1877
  function mo_openid_app_comment() {
1878
  ?>
1879
-
1880
  <td style="vertical-align:top;width:65%;">
1881
-
1882
  <form name="f" method="post" id="comment_settings_form" action="">
1883
  <input type="hidden" name="option" value="mo_openid_save_comment_settings" />
 
 
1884
  <div class="mo_openid_table_layout">
1885
 
1886
  <table class="mo_openid_display_table">
@@ -1946,19 +1912,19 @@ function mo_openid_app_comment() {
1946
  </tr>
1947
  <tr>
1948
  <td><b>Comment Section Heading:</b></td>
1949
- <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_heading_label" value="<?php echo get_option('mo_openid_social_comment_heading_label'); ?>" /></td>
1950
  </tr>
1951
  <tr>
1952
  <td><b>Comments - Default Label:</b></td>
1953
- <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_default_label" value="<?php echo get_option('mo_openid_social_comment_default_label'); ?>" /></td>
1954
  </tr>
1955
  <tr>
1956
  <td><b>Comments - Facebook Label:</b></td>
1957
- <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_fb_label" value="<?php echo get_option('mo_openid_social_comment_fb_label'); ?>" /></td>
1958
  </tr>
1959
  <tr>
1960
  <td><b>Comments - Google Label:</b></td>
1961
- <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_google_label" value="<?php echo get_option('mo_openid_social_comment_google_label'); ?>" /></td>
1962
  </tr></table></td></tr>
1963
 
1964
  <tr>
@@ -2051,6 +2017,8 @@ function mo_openid_show_otp_verification(){
2051
  <!-- Enter otp -->
2052
  <form name="f" method="post" id="otp_form" action="">
2053
  <input type="hidden" name="option" value="mo_openid_validate_otp" />
 
 
2054
  <div class="mo_openid_table_layout">
2055
  <table class="mo_openid_settings_table">
2056
  <h3>Verify Your Email</h3>
@@ -2069,7 +2037,9 @@ function mo_openid_show_otp_verification(){
2069
  </form>
2070
  <form name="f" method="post">
2071
  <td style="width:18%">
2072
- <input type="hidden" name="option" value="mo_openid_go_back"/>
 
 
2073
  <input type="submit" name="submit" value="Back" class="button button-primary button-large" />
2074
  </td>
2075
  </form>
@@ -2077,6 +2047,8 @@ function mo_openid_show_otp_verification(){
2077
  <td>
2078
 
2079
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
 
 
2080
  </td>
2081
  </tr>
2082
  </form>
@@ -2087,6 +2059,8 @@ function mo_openid_show_otp_verification(){
2087
  <h3>I did not recieve any email with OTP . What should I do ?</h3>
2088
  <form id="phone_verification" method="post" action="">
2089
  <input type="hidden" name="option" value="mo_openid_phone_verification" />
 
 
2090
  If you can't see the email from miniOrange in your mails, please check your <b>SPAM Folder</b>. If you don't see an email even in SPAM folder, verify your identity with our alternate method.
2091
  <br><br>
2092
  <b>Enter your valid phone number here and verify your identity using one time passcode sent to your phone.</b>
@@ -2094,7 +2068,7 @@ function mo_openid_show_otp_verification(){
2094
  <table class="mo_openid_settings_table">
2095
  <tr>
2096
  <td colspan="3">
2097
- <input class="mo_openid_table_textbox" required pattern="[0-9\+]{12,18}" autofocus="true" style="width:100%;" type="tel" name="phone_number" id="phone" placeholder="Enter Phone Number" value="<?php echo get_option('mo_openid_admin_phone'); ?>" title="Enter phone number(at least 10 digits) without any space or dashes."/>
2098
  </td>
2099
  <td>&nbsp;&nbsp;
2100
  <a style="cursor:pointer;" onclick="document.getElementById('phone_verification').submit();">Resend OTP ?</a>
@@ -2126,12 +2100,14 @@ function mo_openid_other_settings(){
2126
  <td style="vertical-align:top;width:65%;">
2127
  <form name="f" method="post" id="settings_form" action="">
2128
  <input type="hidden" name="option" value="mo_openid_save_other_settings" />
 
 
2129
  <div class="mo_openid_table_layout">
2130
 
2131
  <table>
2132
  <tr>
2133
  <td colspan="2">
2134
- <h3>Social Sharing <input type="submit" id="share_save" name="submit" value="Save" style="width:100px;float:right;margin-right:2%" class="button button-primary button-large" onclick="end_tour();"/><button type="button" id="mo_openid_restart_tour" class="button button-primary button-large"style="float:right; margin-right:2%;width:20%" onclick="restart_tour();"><i class="fa fa-refresh"></i> Social Sharing Tour</button>
2135
  </h3>
2136
  <b>Select applications to add share icons. Customize sharing icons by using a range of shapes, themes and sizes to suit to your website. You can also choose different places to display these icons. Additionally, place vertical floating icons on your pages.</b>
2137
  </td>
@@ -2274,12 +2250,12 @@ function mo_openid_other_settings(){
2274
  <?php checked( get_option('mo_openid_share_custom_theme') == 'default' );?> />Default
2275
  </td>
2276
  <td> <!-- Size between icons buttons-->
2277
- <input style="width:50px" onkeyup="moSharingSpaceValidate(this)" id="mo_sharing_icon_space" name="mo_sharing_icon_space" type="text" value="<?php echo get_option('mo_sharing_icon_space')?>" />
2278
  <input id="mo_sharing_space_plus" type="button" value="+" onmouseup="moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value ,setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value)"/>
2279
  <input id="mo_sharing_space_minus" type="button" value="-" onmouseup="moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value ,setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value)" />
2280
  </td>
2281
  <td> <!-- Size buttons-->
2282
- <input style="width:50px" id="mo_sharing_icon_size" onkeyup="moSharingSizeValidate(this)" name="mo_sharing_icon_custom_size" type="text" value="<?php echo get_option('mo_sharing_icon_custom_size')?>" >
2283
 
2284
  <input id="mo_sharing_size_plus" type="button" value="+" onmouseup="tempHorSize = document.getElementById('mo_sharing_icon_size').value;moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value , setTheme(), setCustomTheme(), document.getElementById('mo_sharing_icon_custom_color').value, document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value)" >
2285
 
@@ -2308,7 +2284,7 @@ function mo_openid_other_settings(){
2308
  <td> <!-- Theme radio buttons -->
2309
  <!-- Custom background textbox -->
2310
 
2311
- <input id="mo_sharing_icon_custom_color" name="mo_sharing_icon_custom_color" class="color" value="<?php echo get_option('mo_sharing_icon_custom_color')?>" onchange="moSharingPreview('horizontal', document.getElementById('mo_sharing_icon_size').value, setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value)" >
2312
  </td>
2313
  <td></td>
2314
  <td></td>
@@ -2326,7 +2302,7 @@ function mo_openid_other_settings(){
2326
  <td></td>
2327
  <td> <!-- Theme radio buttons -->
2328
  <!-- No background textbox-->
2329
- <input id="mo_sharing_icon_custom_font" name="mo_sharing_icon_custom_font" class="color" value="<?php echo get_option('mo_sharing_icon_custom_font')?>" onchange="moSharingPreview('horizontal', document.getElementById('mo_sharing_icon_size').value, setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value,document.getElementById('mo_sharing_icon_custom_font').value)" />
2330
  </td>
2331
  <td></td>
2332
  <td></td>
@@ -2405,12 +2381,12 @@ function mo_openid_other_settings(){
2405
  </tr></table></td></tr>
2406
 
2407
  <script>
2408
- var tempHorSize = '<?php echo get_option('mo_sharing_icon_custom_size') ?>';
2409
- var tempHorShape = '<?php echo get_option('mo_openid_share_theme') ?>';
2410
- var tempHorTheme = '<?php echo get_option('mo_openid_share_custom_theme') ?>';
2411
- var tempbackColor = '<?php echo get_option('mo_sharing_icon_custom_color')?>';
2412
- var tempHorSpace = '<?php echo get_option('mo_sharing_icon_space')?>';
2413
- var tempHorFontColor = '<?php echo get_option('mo_sharing_icon_custom_font')?>';
2414
  function moSharingIncrement(e,t,r,a,i){
2415
  var h,s,c=!1,_=a;s=function(){
2416
  "add"==t&&r.value<60?r.value++:"subtract"==t&&r.value>10&&r.value--,h=setTimeout(s,_),_>20&&(_*=i),c||(document.onmouseup=function(){clearTimeout(h),document.onmouseup=null,c=!1,_=a},c=!0)},e.onmousedown=s}
@@ -2820,14 +2796,14 @@ function mo_openid_other_settings(){
2820
 
2821
  <tr>
2822
  <td><b>Select color for share heading:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2823
- <input id="mo_openid_table_textbox" style="width:135px;" name="mo_openid_share_widget_customize_text_color" class="color" value="<?php echo get_option('mo_openid_share_widget_customize_text_color')?>" > </td>
2824
  </tr>
2825
  <tr>
2826
  <td>
2827
  <b>Enter text to show above share widget:</b>
2828
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2829
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_widget_customize_text"
2830
- value="<?php echo get_option('mo_openid_share_widget_customize_text'); ?>" />
2831
  </td>
2832
  </tr>
2833
  <tr>
@@ -2835,7 +2811,7 @@ function mo_openid_other_settings(){
2835
  <b>Enter your twitter Username (without @):</b>
2836
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2837
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_twitter_username"
2838
- value="<?php echo get_option('mo_openid_share_twitter_username'); ?>" />
2839
  </td>
2840
  </tr>
2841
  <tr>
@@ -2844,7 +2820,7 @@ function mo_openid_other_settings(){
2844
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2845
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2846
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_email_subject"
2847
- value="<?php echo get_option('mo_openid_share_email_subject'); ?>" />
2848
  </td>
2849
  </tr>
2850
  <tr>
@@ -2852,7 +2828,7 @@ function mo_openid_other_settings(){
2852
  <b>Enter the Email body (add ##url## to place the URL):</b>
2853
  &nbsp;&nbsp;&nbsp;&nbsp;
2854
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_email_body"
2855
- value="<?php echo get_option('mo_openid_share_email_body'); ?>" />
2856
  </td>
2857
  </tr>
2858
  <tr id="disp_options"><td><table><tr>
@@ -3090,9 +3066,7 @@ function mo_openid_shortcode_info(){
3090
  <h3><a id="openid_sharing_shortcode_title" >Social Sharing Shortcode</a></h3>
3091
  <div hidden="" id="openid_sharing_shortcode" style="font-size:13px !important">
3092
  <b>Horizontal</b> --> <code>[miniorange_social_sharing]</code><br>
3093
- <b>Vertical</b> --> <code>[miniorange_social_sharing_vertical]</code>
3094
- <!--Use [miniorange_social_sharing] Shortcode in the content of required page/post where you want to display horizontal Social Sharing Icons. Use [miniorange_social_sharing_vertical] shortcode for vertical Social Sharing Icons.--><br>
3095
-
3096
 
3097
  <h4>For Sharing Icons</h4>
3098
  You can use different attribute to customize social sharing icons. All attributes are optional.<br>
@@ -3410,6 +3384,8 @@ function mo_openid_pricing_info(){
3410
  </form>
3411
  <form method="post" id="checkLicenseForm">
3412
  <input type="hidden" name="option" value="mo_openid_check_license">
 
 
3413
  </form>
3414
 
3415
  <script>
@@ -3875,31 +3851,58 @@ function mo_openid_custom_app_config(){?>
3875
  <div class="mo_table_layout" style="min-height: 400px;">
3876
  <?php
3877
 
3878
- if(isset($_GET['action']) && $_GET['action']=='delete'){
3879
- if(isset($_GET['app']))
3880
- delete_custom_app($_GET['app']);
3881
- } else if(isset($_GET['action']) && $_GET['action']=='instructions'){
3882
- if(isset($_GET['app']))
3883
- mo_custom_app_instructions($_GET['app']);
 
 
 
 
 
3884
  }
3885
-
3886
- if(isset($_GET['action']) && $_GET['action']=='add'){
3887
- add_custom_app();
3888
- }
3889
- else if(isset($_GET['action']) && $_GET['action']=='update'){
3890
- if(isset($_GET['app'])) {
3891
- update_custom_app($_GET['app']);
3892
- mo_custom_app_instructions($_GET['app']);
3893
- }
3894
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3895
  else if(get_option('mo_openid_apps_list')){
3896
  if(strpos($_SERVER['REQUEST_URI'], "setup_msg")!== false)
3897
  {
3898
  ?><div id="upgrade_notice" class="notice notice-success is-dismissible" style="width: 92.5%;margin-left: 0%;"><p><strong>Please enable the Facebook custom app.</strong></p></div>
3899
  <?php
3900
  }
3901
- $appslist = get_option('mo_openid_apps_list');
3902
- echo "<br><input onclick='window.location.href=\"admin.php?page=mo_openid_settings&tab=custom_app&action=add\"' type='button' class='button button-primary button-large' style='float:right;text-align:center;' value='Add Application'>";
 
3903
  echo "<h3>Applications List</h3>";
3904
  echo "<table class='tableborder'>";
3905
  echo "<tr><th><b>Name</b></th><th>Action</th><th>Enable Custom app</tr></tr>";
@@ -3919,8 +3922,9 @@ function mo_openid_custom_app_config(){?>
3919
  }
3920
  else {
3921
  $test_config = '';
3922
- }
3923
- echo "<tr><td>".$key."</td><td><a href='admin.php?page=mo_openid_settings&tab=custom_app&action=update&app=".$key."'>Edit</a> | ".$test_config." <a onclick='popup_delete_app(\"".$key."\")'>Delete</a>
 
3924
  </td><td><label class='mo-switch'>
3925
  <input type='checkbox' ". $enable_status ." onclick='enable_custom_app(\"".$key."\"); ' id='mo_id_".$key."' >
3926
  <div class='mo-slider round' id='switch_checkbox' >
@@ -3933,8 +3937,9 @@ function mo_openid_custom_app_config(){?>
3933
  </p></div>";
3934
 
3935
  }elseif (get_option('mo_openid_apps_list')==null){
 
3936
  echo "<div style='text-align: center'><p>You have not configured any custom apps yet. Please click on <b>Add Application</b> to configure your own app.</p>";
3937
- echo "<br><input type='button' onclick='window.location.href=\"admin.php?page=mo_openid_settings&tab=custom_app&action=add\"' class='button button-primary button-large' style='text-align:center;' value='Add Application'>";
3938
  echo "<br><br><br><br><br>";?>
3939
  <img style="margin-top: -3%" src="<?php echo plugin_dir_url(__FILE__);?>includes/images/custom_app.png">
3940
 
@@ -3968,7 +3973,7 @@ function mo_openid_custom_app_config(){?>
3968
  data: {appname: selected_app, test_configuration : true},
3969
  dataType: 'text',
3970
  success:function(result){
3971
- var myWindow = window.open('<?php echo home_url(); ?>' + '/?option=oauthredirect&app_name='+selected_app,"", "width=950, height=600");
3972
  }
3973
  });
3974
  }
@@ -4013,6 +4018,8 @@ function add_custom_app(){
4013
  </div>
4014
  <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
4015
  <input type="hidden" name="option" value="mo_openid_add_custom_app" />
 
 
4016
  <table class="mo_settings_table">
4017
  <tr>
4018
  <td><strong><font color="#FF0000">*</font>Select Application:</strong></td>
@@ -4062,7 +4069,7 @@ function add_custom_app(){
4062
  }
4063
  function update_custom_app($appname){
4064
 
4065
- $appslist = get_option('mo_openid_apps_list');
4066
  foreach($appslist as $key => $app){
4067
  if($appname == $key){
4068
  $currentappname = $appname;
@@ -4079,27 +4086,29 @@ function update_custom_app($appname){
4079
  <h3>Update Application</h3>
4080
  </div>
4081
  <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
4082
- <input type="hidden" name="option" value="mo_openid_add_custom_app" />
 
 
4083
  <table class="mo_settings_table">
4084
  <tr>
4085
  <td><strong><font color="#FF0000">*</font>Application:</strong></td>
4086
  <td>
4087
  <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_app_name" value="<?php echo $currentappname;?>">
4088
  <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_custom_app_name" value="<?php echo $currentappname;?>">
4089
- <?php echo $currentappname;?><br><br>
4090
  </td>
4091
  </tr>
4092
  <tr>
4093
  <td><strong><font color="#FF0000">*</font>Client ID:</strong></td>
4094
- <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_id" value="<?php echo $currentapp['clientid'];?>"></td>
4095
  </tr>
4096
  <tr>
4097
  <td><strong><font color="#FF0000">*</font>Client Secret:</strong></td>
4098
- <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_secret" value="<?php echo $currentapp['clientsecret'];?>"></td>
4099
  </tr>
4100
  <tr>
4101
  <td><strong>Scope:</strong></td>
4102
- <td><input class="mo_table_textbox" style="height: 27px; width:500px" type="text" name="mo_oauth_scope" value="<?php echo $currentapp['scope'];?>"></td>
4103
  </tr>
4104
  <tr>
4105
  <td>&nbsp;</td>
@@ -4122,17 +4131,20 @@ function update_custom_app($appname){
4122
  }
4123
 
4124
  function delete_custom_app($appname){
4125
- $appslist = get_option('mo_openid_apps_list');
4126
  foreach($appslist as $key => $app){
4127
  if($appname == $key){
4128
  unset($appslist[$key]);
4129
  }
4130
  }
4131
- if($appname=="facebook")
4132
- {
4133
- update_option('mo_openid_facebook_enable',0);
4134
- }
4135
- update_option('mo_openid_apps_list', $appslist);
 
 
 
4136
  }
4137
 
4138
  function mo_custom_app_instructions($appname){
@@ -4183,6 +4195,8 @@ function miniorange_openid_support(){
4183
  <p>Need any help? Couldn't find an answer in <a href="<?php echo add_query_arg( array('tab' => 'help'), $_SERVER['REQUEST_URI'] ); ?>">FAQ</a>?<br>Just send us a query so we can help you.</p>
4184
  <form method="post" action="">
4185
  <input type="hidden" name="option" value="mo_openid_contact_us_query_option" />
 
 
4186
  <table class="mo_openid_settings_table">
4187
  <tr>
4188
  <td><input type="email" class="mo_openid_table_contact" required placeholder="Enter your Email" name="mo_openid_contact_us_email" value="<?php echo get_option("mo_openid_admin_email"); ?>"></td>
@@ -4239,7 +4253,7 @@ function miniorange_openid_support(){
4239
  }
4240
 
4241
  function mo_openid_is_customer_valid(){
4242
- $valid = get_option('mo_openid_admin_customer_valid');
4243
  if(isset($valid) && get_option('mo_openid_admin_customer_plan'))
4244
  return $valid;
4245
  else
@@ -4247,7 +4261,7 @@ function mo_openid_is_customer_valid(){
4247
  }
4248
 
4249
  function mo_openid_get_customer_plan($customerPlan){
4250
- $plan = get_option('mo_openid_admin_customer_plan');
4251
  $planName = isset($plan) ? base64_decode($plan) : 0;
4252
  if($planName) {
4253
  if(strpos($planName, $customerPlan) !== FALSE)
@@ -4305,7 +4319,7 @@ function mo_openid_registeration_modal(){
4305
  <h1>Save As</h1>
4306
  </div>
4307
  <br>
4308
- <span id="msg1" style="text-align: center;color: #56b11e"><?php echo get_option("pop_regi_msg"); update_option('pop_regi_msg','Your settings are saved successfully. Please enter your valid email address to enable social login.');?></span>
4309
  <br>
4310
  <br>
4311
  <br>
@@ -4315,7 +4329,8 @@ function mo_openid_registeration_modal(){
4315
 
4316
  <form name="f" method="post" action="" id="pop-register-form">
4317
  <input name="option" value="mo_openid_connect_register_customer" type="hidden"/>
4318
-
 
4319
  <div>
4320
 
4321
 
@@ -4377,7 +4392,7 @@ function mo_openid_registeration_modal(){
4377
  regi_button.display = '';
4378
 
4379
  jQuery("[id*=pop_next]").css('display','none');
4380
- document.getElementById("msg1").innerHTML = "Please enter and confirm the password";
4381
  jQuery("[id*=pop_register]").css('display',''); //and $('#Id').css('padding-left','20%');
4382
  }
4383
  </script>
@@ -4399,7 +4414,7 @@ function mo_pop_show_otp_verification($msg){
4399
  <h1>Verify Your Email </h1>
4400
  </div>
4401
  <br>
4402
- <span style="text-align: center;color: #56b11e"><?php echo $msg;?></span>
4403
  <br>
4404
  <br>
4405
  <div id="mo_saml_show_registeration_modal" >
@@ -4409,6 +4424,8 @@ function mo_pop_show_otp_verification($msg){
4409
 
4410
  <form name="f" method="post" action="" id="pop-otp-form" style="margin-left: 28%;">
4411
  <input type="hidden" name="option" value="mo_openid_validate_otp" />
 
 
4412
  <div>
4413
 
4414
  <table style="text-align: left;width: 100%">
@@ -4433,13 +4450,15 @@ function mo_pop_show_otp_verification($msg){
4433
 
4434
  </form>
4435
  <form method="post">
4436
- &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <input type="submit" id="go_to_register" name="go_to_register" value="Register" class="button button-primary button-large" style="margin-left: -29%;margin-top: -8.2%;">
4437
  </form>
4438
 
4439
  </div>
4440
  <div style="margin-left: 14%;"><form name="f" id="pop_resend_otp_form" method="post" action="">
4441
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
4442
- &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <input type="submit" value="Click Here To Get A New OTP?" id="resend_otp" style="cursor:pointer ;background: none!important;border:none;padding:0!important;margin-left: -29%;margin-top: -8.2%;color: darkblue;""/>
 
 
4443
  </form></div>
4444
  </div>
4445
 
@@ -4459,7 +4478,6 @@ function mo_pop_show_otp_verification($msg){
4459
 
4460
  function mo_pop_show_verify_password_page() {
4461
  update_option('regi_pop_up','yes');
4462
- //add_option('pop_login_msg','');
4463
  ?>
4464
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
4465
  <div id="request_registeration" class="mo_openid_modal" style="height:100%">
@@ -4467,18 +4485,19 @@ function mo_pop_show_verify_password_page() {
4467
  <!-- Modal content -->
4468
  <div class="mo_openid_modal-content" style="text-align:center;margin-left: 32%;margin-top: 2%;width: 37%;">
4469
  <div class="modal-head">
4470
- <!-- <span class="mo_close">&times;</span>-->
4471
  <a href="" class="mo_close" id="mo_close" style="text-decoration:none;margin-top: 3%;">&times;</a>
4472
  <h1>Login</h1>
4473
  </div>
4474
  <br>
4475
- <span style="text-align: center;color: #56b11e"><?php echo get_option("pop_login_msg"); update_option('pop_login_msg','Enter Your Login Credentials.');?></span>
4476
  <br><br>
4477
  <div id="mo_saml_show_registeration_modal" >
4478
 
4479
  <!--Register with miniOrange-->
4480
  <form name="f" method="post" action="" id="pop-register-form">
4481
  <input type="hidden" name="option" value="mo_openid_connect_verify_customer" />
 
 
4482
  <div>
4483
  <table style="text-align: left;width: 100%">
4484
 
@@ -4486,7 +4505,7 @@ function mo_pop_show_verify_password_page() {
4486
  <td><b><font color="#FF0000">*</font>Email:</b></td>
4487
  <td><input class="mo_openid_table_textbox" id="email" type="email" name="email"
4488
  required placeholder="person@example.com"
4489
- value="<?php echo get_option('mo_openid_admin_email');?>" />
4490
  </td>
4491
  </tr>
4492
 
@@ -4511,6 +4530,8 @@ function mo_pop_show_verify_password_page() {
4511
  <p><b><a href="#forgot_password">Click here if you forgot your password?</a></b></p>
4512
  <form name="forgotpassword" method="post" action="" id="openidforgotpasswordform">
4513
  <input type="hidden" name="option" value="mo_openid_forgot_password"/>
 
 
4514
  <input type="hidden" id="forgot_pass_email" name="email" value=""/>
4515
  </form>
4516
  </div>
@@ -4530,7 +4551,7 @@ function mo_pop_show_verify_password_page() {
4530
  function is_custom_app($app_name){
4531
 
4532
  if(get_option('mo_openid_apps_list'))
4533
- $appslist = get_option('mo_openid_apps_list');
4534
  else
4535
  $appslist = array();
4536
 
156
  }
157
 
158
  function popup_delete_app(selected_app){
159
+ <?php $nonce = wp_create_nonce( 'mo-openid-delete-selected-app-nonce' ); ?>
160
+ if (confirm("Are you sure you want to delete the app?")) {
161
+ location.href='admin.php?page=mo_openid_settings&tab=custom_app&action=delete&app=' + selected_app + '&wp_nonce=' + '<?php echo $nonce ?>';
162
 
163
  }
164
  }
170
  <div id="mo_openid_msgs"></div>
171
  <table style="width:100%;">
172
  <tr>
 
173
  <?php
174
  if( $active_tab == 'share' ) {
175
  mo_openid_other_settings();
219
 
220
 
221
  ?>
 
 
 
 
 
222
  </table>
223
  <?php
224
  }
233
  <!--Register with miniOrange-->
234
  <form name="f" method="post" action="" id="register-form">
235
  <input type="hidden" name="option" value="mo_openid_connect_register_customer" />
236
+ <input type="hidden" name="mo_openid_connect_register_nonce"
237
+ value="<?php echo wp_create_nonce( 'mo-openid-connect-register-nonce' ); ?>"/>
238
 
239
 
240
  <div class="mo_openid_table_layout">
247
  <td><b><font color="#FF0000">*</font>Email:</b></td>
248
  <td><input class="mo_openid_table_textbox" type="email" name="email"
249
  required placeholder="person@example.com"
250
+ value="<?php echo esc_attr($current_user->user_email);?>" /></td>
251
  </tr>
252
  <tr>
253
  <td><b><font color="#FF0000">*</font>Website/Company Name:</b></td>
279
  </form>
280
  <form name="f" method="post" action="" id="openidgobackloginform">
281
  <input type="hidden" name="option" value="mo_openid_go_back_registration"/>
282
+ <input type="hidden" name="mo_openid_go_back_registration_nonce"
283
+ value="<?php echo wp_create_nonce( 'mo-openid-go-back-register-nonce' ); ?>"/>
284
  </form>
285
  <script>
286
  jQuery('#mo_openid_go_back_registration').click(function() {
304
  <!--Verify password with miniOrange-->
305
  <form name="f" method="post" action="">
306
  <input type="hidden" name="option" value="mo_openid_connect_verify_customer" />
307
+ <input type="hidden" name="mo_openid_connect_verify_nonce"
308
+ value="<?php echo wp_create_nonce( 'mo-openid-connect-verify-nonce' ); ?>"/>
309
  <div class="mo_openid_table_layout">
310
  <h3>Login with miniOrange</h3>
311
  <p><b>It seems you already have an account with miniOrange. Please enter your miniOrange email and password. <a href="#forgot_password">Click here if you forgot your password?</a></b></p>
314
  <td><b><font color="#FF0000">*</font>Email:</b></td>
315
  <td><input class="mo_openid_table_textbox" id="email" type="email" name="email"
316
  required placeholder="person@example.com"
317
+ value="<?php echo esc_attr(get_option('mo_openid_admin_email'));?>" /></td>
318
  </tr>
319
  <td><b><font color="#FF0000">*</font>Password:</b></td>
320
  <td><input class="mo_openid_table_textbox" required type="password"
333
  </form>
334
  <form name="f" method="post" action="" id="openidgobackform">
335
  <input type="hidden" name="option" value="mo_openid_go_back_login"/>
336
+ <input type="hidden" name="mo_openid_go_back_login_nonce"
337
+ value="<?php echo wp_create_nonce( 'mo-openid-go-back-login-nonce' ); ?>"/>
338
  </form>
339
  <form name="forgotpassword" method="post" action="" id="openidforgotpasswordform">
340
  <input type="hidden" name="option" value="mo_openid_forgot_password"/>
341
+ <input type="hidden" name="mo_openid_forgot_password_nonce"
342
+ value="<?php echo wp_create_nonce( 'mo-openid-forgot-password-nonce' ); ?>"/>
343
  <input type="hidden" id="forgot_pass_email" name="email" value=""/>
344
  </form>
345
  <script>
365
  <!-- Google configurations -->
366
  <form id="form-apps" name="form-apps" method="post" action="">
367
  <input type="hidden" name="option" value="mo_openid_enable_apps" />
368
+ <input type="hidden" name="mo_openid_enable_apps_nonce"
369
+ value="<?php echo wp_create_nonce( 'mo-openid-enable-apps-nonce' ); ?>"/>
370
 
371
  <div class="mo_openid_table_layout">
372
 
479
  </span>
480
 
481
  <span style="margin-left:111px;">
482
+ <input style="width:50px" onkeyup="moLoginSpaceValidate(this)" id="mo_login_icon_space" name="mo_login_icon_space" type="text" value="<?php echo esc_attr(get_option('mo_login_icon_space'))?>" />
483
  <input id="mo_login_space_plus" type="button" value="+" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
484
  <input id="mo_login_space_minus" type="button" value="-" onmouseup="moLoginPreview(setSizeOfIcons() ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
485
  </span>
486
 
487
 
488
  <span id="commontheme" style="margin-left:115px">
489
+ <input style="width:50px" id="mo_login_icon_size" onkeyup="moLoginSizeValidate(this)" name="mo_login_icon_custom_size" type="text" value="<?php echo esc_attr(get_option('mo_login_icon_custom_size'))?>" >
490
  <input id="mo_login_size_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
491
  <input id="mo_login_size_minus" type="button" value="-" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_size').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
492
 
493
  </span>
494
  <span style="margin-left:91px" class="longbuttontheme">Width:&nbsp;
495
+ <input style="width:50px" id="mo_login_icon_width" onkeyup="moLoginWidthValidate(this)" name="mo_login_icon_custom_width" type="text" value="<?php echo esc_attr(get_option('mo_login_icon_custom_width'))?>" >
496
  <span style="margin-left:3px;">
497
 
498
  <input id="mo_login_width_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value ,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
519
 
520
 
521
  <span style="margin-left:235px" class="longbuttontheme" >Height:
522
+ <input style="width:50px" id="mo_login_icon_height" onkeyup="moLoginHeightValidate(this)" name="mo_login_icon_custom_height" type="text" value="<?php echo esc_attr(get_option('mo_login_icon_custom_height'))?>" >
523
  <span style="margin-left:1px;">
524
 
525
  <input id="mo_login_height_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
535
  <?php checked( get_option('mo_openid_login_theme') == 'square' );?> />Square
536
 
537
  <span style="margin-left:113px;">
538
+ <input id="mo_login_icon_custom_color" style="width:135px;" name="mo_login_icon_custom_color" class="color" value="<?php echo esc_attr(get_option('mo_login_icon_custom_color'))?>" onchange="moLoginPreview(setSizeOfIcons(), setLoginTheme(),'custom',document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_custom_boundary').value)" >
539
  </span>
540
 
541
 
542
  <span style="margin-left:228px" class="longbuttontheme">Curve:&nbsp;
543
  <input style="width:50px" id="mo_login_icon_custom_boundary" onkeyup="moLoginBoundaryValidate(this)" name="mo_login_icon_custom_boundary" type="text" value=
544
+ "<?php echo esc_attr(get_option('mo_login_icon_custom_boundary'))?>" />
545
  <span style="margin-left:4px;">
546
 
547
  <input id="mo_login_boundary_plus" type="button" value="+" onmouseup="moLoginPreview(document.getElementById('mo_login_icon_width').value,setLoginTheme(),setLoginCustomTheme(),document.getElementById('mo_login_icon_custom_color').value,document.getElementById('mo_login_icon_space').value,document.getElementById('mo_login_icon_height').value,document.getElementById('mo_login_icon_custom_boundary').value)" />
572
 
573
  <div>
574
  <a id="mo_login_button_preview_facebook" class="btn btn-block btn-defaulttheme btn-social btn-facebook btn-custom-size"> <i class="fa fa-facebook"></i><?php
575
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Facebook</a>
576
  <a id="mo_login_button_preview_google" class="btn btn-block btn-defaulttheme btn-social btn-google btn-custom-size"> <i class="fa fa-google"></i><?php
577
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Google</a>
578
  <a id="mo_login_button_preview_vkontakte" class="btn btn-block btn-defaulttheme btn-social btn-vk btn-custom-size"> <i class="fa fa-vk"></i><?php
579
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Vkontakte</a>
580
  <a id="mo_login_button_preview_twitter" class="btn btn-block btn-defaulttheme btn-social btn-twitter btn-custom-size"> <i class="fa fa-twitter"></i><?php
581
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Twitter</a>
582
  <a id="mo_login_button_preview_instagram" class="btn btn-block btn-defaulttheme btn-social btn-instagram btn-custom-size"> <i class="fa fa-instagram"></i><?php
583
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Instagram</a>
584
  <a id="mo_login_button_preview_linkedin" class="btn btn-block btn-defaulttheme btn-social btn-linkedin btn-custom-size"> <i class="fa fa-linkedin"></i><?php
585
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> LinkedIn</a>
586
  <a id="mo_login_button_preview_amazon" class="btn btn-block btn-defaulttheme btn-social btn-soundcloud btn-custom-size"> <i class="fa fa-amazon"></i><?php
587
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Amazon</a>
588
  <a id="mo_login_button_preview_salesforce" class="btn btn-block btn-defaulttheme btn-social btn-vimeo btn-custom-size"> <i class="fa fa-cloud"></i><?php
589
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Salesforce</a>
590
  <a id="mo_login_button_preview_windowslive" class="btn btn-block btn-defaulttheme btn-social btn-microsoft btn-custom-size"> <i class="fa fa-windows"></i><?php
591
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Windows</a>
592
  <a id="mo_login_button_preview_yahoo" class="btn btn-block btn-defaulttheme btn-social btn-yahoo btn-custom-size"> <i class="fa fa-yahoo"></i><?php
593
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Yahoo</a>
594
 
595
  </div>
596
  <div>
607
  </div>
608
  <div>
609
  <a id="mo_custom_login_button_preview_facebook" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-facebook"></i><?php
610
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Facebook</a>
611
  <a id="mo_custom_login_button_preview_google" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-google"></i><?php
612
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Google</a>
613
  <a id="mo_custom_login_button_preview_vkontakte" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-vk"></i><?php
614
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Vkontakte</a>
615
  <a id="mo_custom_login_button_preview_twitter" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-twitter"></i><?php
616
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Twitter</a>
617
  <a id="mo_custom_login_button_preview_instagram" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-instagram"></i><?php
618
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Instagram</a>
619
  <a id="mo_custom_login_button_preview_linkedin" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-linkedin"></i><?php
620
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> LinkedIn</a>
621
  <a id="mo_custom_login_button_preview_amazon" class="btn btn-block btn-customtheme btn-social btn-custom-size"><i class="fa fa-amazon"></i><?php
622
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Amazon</a>
623
  <a id="mo_custom_login_button_preview_salesforce" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-cloud"></i><?php
624
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Salesforce</a>
625
  <a id="mo_custom_login_button_preview_windows" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-windows"></i><?php
626
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Windows</a>
627
  <a id="mo_custom_login_button_preview_yahoo" class="btn btn-block btn-customtheme btn-social btn-custom-size"> <i class="fa fa-yahoo"></i><?php
628
+ echo esc_html(get_option('mo_openid_login_button_customize_text')); ?> Yahoo</a>
629
 
630
  </div>
631
  </td>
649
  <td>
650
  <b>Select color for customize text:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
651
  <span style="margin-left:15px;">
652
+ <input id="mo_openid_table_textbox" style="width:135px;" name="mo_login_openid_login_widget_customize_textcolor" class="color" value="<?php echo esc_attr(get_option('mo_login_openid_login_widget_customize_textcolor'))?>" > </td>
653
  </span>
654
  </td>
655
  </tr>
657
  <tr>
658
  <td><b>Enter text to show above login widget:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
659
 
660
+ <input class="mo_openid_table_textbox" style="margin-left:12px;width:50%" type="text" name="mo_openid_login_widget_customize_text" value="<?php echo esc_attr(get_option('mo_openid_login_widget_customize_text')); ?>" /></td>
661
  </tr>
662
  <tr>
663
  <td><b>Enter text to show on your login buttons (If you have</b>
664
  <br/><b> selected shape 4 from 'Customize Login Icons' section):</b>&nbsp;&nbsp;&nbsp;&nbsp;
665
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_button_customize_text"
666
+ value="<?php echo esc_attr(get_option('mo_openid_login_button_customize_text')); ?>" /></td>
667
  </tr>
668
 
669
  <tr>
676
  <tr>
677
  <td><b>Enter text to show before the logout link</b>
678
  <br/>Use ##username## to display current username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
679
+ <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_name_text" value="<?php echo esc_attr(get_option('mo_openid_login_widget_customize_logout_name_text')); ?>" /></td>
680
  </tr>
681
  <tr>
682
  <td><b>Enter text to show as logout link:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
683
  <input class="mo_openid_table_textbox" style="width:50%" type="text" name="mo_openid_login_widget_customize_logout_text"
684
+ value="<?php echo esc_attr(get_option('mo_openid_login_widget_customize_logout_text')); ?>" /></td>
685
  </tr>
686
 
687
  <tr><td>
774
  <input type="radio" id="login_redirect_customurl" name="mo_openid_login_redirect" value="custom"
775
  <?php checked( get_option('mo_openid_login_redirect') == 'custom' );?> />Custom URL
776
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
777
+ <input type="url" id="login_redirect_url" style="width:50%;margin-left: 12px;" name="mo_openid_login_redirect_url" value="<?php echo esc_url(get_option('mo_openid_login_redirect_url'))?>" />
778
  </td>
779
  </tr>
780
  <tr>
781
  <td>
782
  <input type="radio" id="login_redirect_relativeurl" name="mo_openid_login_redirect" value="relative" <?php checked( get_option('mo_openid_login_redirect') == 'relative' );?> />Relative URL
783
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo site_url();?>
784
+ <input type="text" id="login_redirect_url" style="width:50%" name="mo_openid_relative_login_redirect_url" value="<?php echo esc_url(get_option('mo_openid_relative_login_redirect_url'))?>" />
785
  </td>
786
  </tr>
787
 
817
  <?php checked( get_option('mo_openid_logout_redirect') == 'custom' );?> />Relative URL
818
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
819
  <?php echo site_url();?>
820
+ <input type="text" id="logout_redirect_url" style="width:50%" name="mo_openid_logout_redirect_url" value="<?php echo esc_url(get_option('mo_openid_logout_redirect_url'))?>" />
821
  </td>
822
  </tr>
823
  </table></td></tr>
837
  <?php checked( get_option('mo_openid_auto_register_enable') == 1 );?> /><b>Auto-register users</b>
838
  <br/><br/>
839
  <b>Registration disabled message: </b>
840
+ <textarea id="auto_register_disabled_message" style="width:80%" name="mo_openid_register_disabled_message" ><?php echo esc_textarea(get_option('mo_openid_register_disabled_message'))?></textarea>
841
  </td>
842
  </tr>
843
  <tr>
882
  <?php checked( get_option('mo_openid_gdpr_consent_enable') == 1 );?> /><b>Take consent from users</b>
883
  <br/><br/>
884
  <b>Enter the Consent message: </b><br>
885
+ <textarea style="width:80%" name="mo_openid_gdpr_consent_message"><?php echo esc_textarea(get_option('mo_openid_gdpr_consent_message'))?></textarea>
886
  <br><br>
887
  <b>Enter the text that redirects to Privacy Policy URL: </b><br>
888
+ <input type="text" style="width:90%" name="mo_openid_privacy_policy_text" value="<?php echo esc_attr(get_option('mo_openid_privacy_policy_text'))?>" <?php if(!mo_openid_is_customer_registered()) echo 'disabled';?>/>
889
  <br><br>
890
  <b>Enter Privacy Policy URL: </b><br>
891
+ <input type="text" style="width:90%" name="mo_openid_privacy_policy_url" value="<?php echo esc_url(get_option('mo_openid_privacy_policy_url'))?>" <?php if(!mo_openid_is_customer_registered()) echo 'disabled';?> />
892
  </td>
893
  </tr>
894
  <td>
908
  <?php if(get_option('mo_openid_account_linking_enable')){?>
909
  <tr id="account_link_customized_text"><td><h3 style="float: left">Customize Text for Account Linking</h3><a style="float: right;margin-right: 325px;margin-top: 20px" onclick="customize_account_linking_img()">View Dialogue Box</a></td></tr>
910
  <tr id="acc_link_img"><td></td></tr>
911
+ <tr id="account_link_customized_text"><td><b>1. Enter title of Account linking form:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left:135px;" type="text" name="mo_account_linking_title" value="<?php echo esc_attr(get_option('mo_account_linking_title')); ?>" /></td></tr>
912
+ <tr id="account_link_customized_text"><td><b>2. Enter button text for create new user:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 115px" type="text" name="mo_account_linking_new_user_button" value="<?php echo esc_attr(get_option('mo_account_linking_new_user_button')); ?>"/></td></tr>
913
  <tr id="account_link_customized_text">
914
  <td>
915
+ <b>3. Enter button text for Link to existing user:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left:89px" type="text" name="mo_account_linking_existing_user_button" value="<?php echo esc_attr(get_option('mo_account_linking_existing_user_button')); ?>"/></td></tr>
916
+ <tr id="account_link_customized_text"><td ><b>4. Enter instruction to Create New Account :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_account_linking_new_user_instruction" value="<?php echo esc_attr(get_option('mo_account_linking_new_user_instruction')); ?>"/>
917
  </td>
918
  </tr>
919
  <tr id="account_link_customized_text">
920
  <td>
921
+ <b>5. Enter instructions to link to an existing account :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_account_linking_existing_user_instruction" value="<?php echo esc_attr(get_option('mo_account_linking_existing_user_instruction')); ?>"/></td></tr><tr id="account_link_customized_text"><td><b>5. Enter extra instructions for account linking :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px;" type="text" name="mo_account_linking_extra_instruction" value="<?php echo esc_attr(get_option('mo_account_linking_extra_instruction')); ?>"/>
922
  </td>
923
  </tr>
924
  <?php }?><?php ;} ?>
943
  <?php if(get_option('mo_openid_enable_profile_completion')){?>
944
  <tr id="profile_completion_customized_text"><td><h3 style="float: left">Customize Text for Profile Completion</h3><a style="float: right;margin-right: 300px;margin-top: 20px" onclick="customize_profile_completion_img()">View Dialogue Box</a></td></tr>
945
  <tr id="profile_completion_img"><td></td></tr>
946
+ <tr id="profile_completion_customized_text"><td><b>1. Enter title of Profle Completion:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 150px" type="text" name="mo_profile_complete_title" value="<?php echo esc_attr(get_option('mo_profile_complete_title')); ?>" /></td></tr>
947
+ <tr id="profile_completion_customized_text"><td><b>2. Enter Username Label text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 177px" type="text" name="mo_profile_complete_username_label" value="<?php echo esc_attr(get_option('mo_profile_complete_username_label')); ?>"/></td></tr>
948
+ <tr id="profile_completion_customized_text"><td><b>3. Enter Email Label text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 205px" type="text" name="mo_profile_complete_email_label" value="<?php echo esc_attr(get_option('mo_profile_complete_email_label')); ?>"/></td></tr>
949
+ <tr id="profile_completion_customized_text"><td><b>4. Enter Submit button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 184px" type="text" name="mo_profile_complete_submit_button" value="<?php echo esc_attr(get_option('mo_profile_complete_submit_button')); ?>"/></td></tr>
950
+ <tr id="profile_completion_customized_text"><td><b style="margin-top:20px">5. Enter instruction for Profile Completion :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px;margin-bottom:5px" type="text" name="mo_profile_complete_instruction" value="<?php echo esc_attr(get_option('mo_profile_complete_instruction')); ?>"/></td></tr>
951
+ <tr id="profile_completion_customized_text"><td><b>6. Enter extra instruction for Profile Completion :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_profile_complete_extra_instruction" value="<?php echo esc_attr(get_option('mo_profile_complete_extra_instruction')); ?>"/></td></tr>
952
+ <tr id="profile_completion_customized_text"><td><b>Enter username already exists warning message text :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_profile_complete_uname_exist" value="<?php echo esc_attr(get_option('mo_profile_complete_uname_exist')); ?>"/></td></tr>
953
  <tr id="profile_completion_customized_text"><td><h3 style="float: left">Customize Text for Email Verification</h3><a style="float: right;margin-right: 300px;margin-top: 20px" onclick="customize_email_verify_img()">View Dialogue Box
954
+ </a></td></tr> <tr id="email_verify"><td></td></tr><tr id="profile_completion_customized_text"><td><b>1. Enter title of Email Verification form:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 125px" type="text" name="mo_email_verify_title" value="<?php echo esc_attr(get_option('mo_email_verify_title')); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>2. Enter Resend OTP button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 160px" type="text" name="mo_email_verify_resend_otp_button" value="<?php echo esc_attr(get_option('mo_email_verify_resend_otp_button')); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>3. Enter Back button text:</b><input class="mo_openid_table_textbox" style="width:50%;margin-left: 202px" type="text" name="mo_email_verify_back_button" value="<?php echo esc_attr(get_option('mo_email_verify_back_button')); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>4. Enter instruction for Email Verification form:</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_message" value="<?php echo esc_attr(get_option('mo_email_verify_message')); ?>"/></td></tr><tr id="profile_completion_customized_text"><td><b>5. Enter verification code in Email Verification form:</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_verification_code_instruction" value="<?php echo esc_attr(get_option('mo_email_verify_verification_code_instruction')); ?>"/></td></tr>
955
+ <tr id="profile_completion_customized_text"><td><b> Enter Message for wrong OTP :</b><input class="mo_openid_table_textbox" style="width:98%;margin-left: 0px" type="text" name="mo_email_verify_wrong_otp" value="<?php echo esc_attr(get_option('mo_email_verify_wrong_otp')); ?>"/></td></tr>
956
+ <tr id="profile_completion_customized_text"><td><br><h3> <b>Customized OTP Message:</b> </h3><textarea class="tinymce" rows="6" id="mo_openid_email_message_id" style="width:100%" name="custom_otp_msg" ><?php echo esc_html(get_option('custom_otp_msg'))?></textarea></td></tr>
957
  <tr id='profile_completion_customized_text'><td><b>NOTE</b>: Please enter <b>##otp##</b> in message where you want to show otp.</td></tr>
958
  <?php } ?>
959
  <tr id="prof_completion"><td> </td></tr>
972
  if (checkbox1.checked == true){
973
  if(custom_link==1){
974
  jQuery("<tr id=\"account_link_customized_text\"><td><h3 style=\"float: left\">Customize Text for Account Linking</h3><a style=\"float: right;margin-right: 302px;margin-top: 20px\" onclick=\"customize_account_linking_img()\">View Dialogue Box</a></td></tr><tr id=\"acc_link_img\"><td></td></tr><tr id=\"account_link_customized_text\"><td><b>1. Enter title of Account linking form:</b>\n"+
975
+ "\n"+"\t\t\t<input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 132px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_title\" value=\"<?php echo esc_attr(get_option('mo_account_linking_title')); ?>\" /></td>\n"+"\t</tr><tr id=\"account_link_customized_text\"><td><b>2. Enter button text for create new user:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 115px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_new_user_button\" value=\"<?php echo get_option('mo_account_linking_new_user_button'); ?>\"/></td></tr><tr id=\"account_link_customized_text\"><td><b>3. Enter button text for Link to existing user:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 89px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_existing_user_button\" value=\"<?php echo esc_attr(get_option('mo_account_linking_existing_user_button')); ?>\"/></td></tr><tr id=\"account_link_customized_text\">\n"+"\t\t<td ><b style=\"margin-top:20px\">4. Enter instruction to Create New Account :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n"+
976
+ " <input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_new_user_instruction\" value=\"<?php echo esc_attr(get_option('mo_account_linking_new_user_instruction')); ?>\"/></td>\n"+
977
+ "\t</tr><tr id=\"account_link_customized_text\"><td><b>5. Enter instructions to link to an existing account :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_existing_user_instruction\" value=\"<?php echo esc_attr(get_option('mo_account_linking_existing_user_instruction')); ?>\"/></td></tr><tr id=\"account_link_customized_text\"><td><b>5. Enter extra instructions for account linking :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:0px\" type=\"text\" name=\"mo_account_linking_extra_instruction\" value=\"<?php echo esc_attr(get_option('mo_account_linking_extra_instruction')); ?>\"/></td></tr>").insertBefore(jQuery("#acc_link"));
978
  custom_link=2;
979
  }
980
  }
990
  if (checkbox2.checked == true){
991
  if(custom_prof_completion==1) {
992
  jQuery("<tr id=\"profile_completion_customized_text\"><td><h3 style=\"float: left\">Customize Text for Profile Completion</h3><a style=\"float: right;margin-right: 300px;margin-top: 20px\" onclick=\"customize_profile_completion_img()\">View Dialogue Box</a></td></tr><tr id=\"profile_completion_img\"><td></td></tr><tr id=\"profile_completion_customized_text\"><td><b>1. Enter title of Profle Completion:</b>\n"+
993
+ "\n"+"\t\t\t<input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 145px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_title\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_title')); ?>\" /></td>\n"+"\t</tr><tr id=\"profile_completion_customized_text\"><td><b>2. Enter Username Label text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 175px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_username_label\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_username_label')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>3. Enter Email Label text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 202px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_email_label\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_email_label')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>4. Enter Submit button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 182px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_submit_button\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_submit_button')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\">\n"+"\t\t<td ><b style=\"margin-top:20px\">5. Enter instruction for Profile Completion :</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n"+
994
+ " <input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_instruction\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_instruction')); ?>\"/></td>\n"+
995
+ "\t</tr><tr id=\"profile_completion_customized_text\"><td><b>6. Enter extra instruction for Profile Completion :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_extra_instruction\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_extra_instruction')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>Enter username already exists warning message text :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px;margin-bottom:5px\" type=\"text\" name=\"mo_profile_complete_uname_exist\" value=\"<?php echo esc_attr(get_option('mo_profile_complete_uname_exist'));?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><h3 style=\"float: left\">Customize Text for Email Verification</h3><a style=\"float: right;margin-right: 300px;margin-top: 20px\" onclick=\"customize_email_verify_img();\">View Dialogue Box</a></td></tr><tr id=\"email_verify\"><td></td></tr><tr id=\"profile_completion_customized_text\"><td><b>1. Enter title of Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 125px\" type=\"text\" name=\"mo_email_verify_title\" value=\"<?php echo esc_attr(get_option('mo_email_verify_title')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>2. Enter Resend OTP button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 160px\" type=\"text\" name=\"mo_email_verify_resend_otp_button\" value=\"<?php echo esc_attr(get_option('mo_email_verify_resend_otp_button')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>3. Enter Back button text:</b><input class=\"mo_openid_table_textbox\" style=\"width:50%;margin-left: 201px\" type=\"text\" name=\"mo_email_verify_back_button\" value=\"<?php echo esc_attr(get_option('mo_email_verify_back_button')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>4. Enter instruction for Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_message\" value=\"<?php echo get_option('mo_email_verify_message'); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b>5. Enter verification code in Email Verification form:</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_verification_code_instruction\" value=\"<?php echo esc_attr(get_option('mo_email_verify_verification_code_instruction')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><b> Enter Message for wrong OTP :</b><input class=\"mo_openid_table_textbox\" style=\"width:98%;margin-left: 0px\" type=\"text\" name=\"mo_email_verify_wrong_otp\" value=\"<?php echo esc_attr(get_option('mo_email_verify_wrong_otp')); ?>\"/></td></tr><tr id=\"profile_completion_customized_text\"><td><br><h3> <b>Customized OTP Message:</b> </h3><textarea class=\"tinymce\" rows=\"6\" style=\"width:100%\" name=\"custom_otp_msg\">"+ <?php echo json_encode(get_option('custom_otp_msg'));?>+"</textarea></td></tr><tr id='profile_completion_customized_text'><td><b>NOTE</b>: Please enter <b>##otp##</b> in message where you want to show otp.</td></tr>").insertBefore(jQuery("#prof_completion"));
996
  custom_prof_completion=2;
997
  }
998
  }
1047
  function redirectto_custom_tab(x)
1048
  {
1049
  var site_url = '<?php echo site_url();?>';
1050
+ var nonce = '<?php echo wp_create_nonce( 'mo-openid-add-selected-app-nonce' ); ?>';
1051
  box1 = document.getElementById('facebook_enable');
1052
  if (box1.checked == true){
1053
  if(x==0){
1054
+ window.location= site_url+"/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app&action=add&wp_nonce=" + nonce + "&app_name=facebook";
1055
  }
1056
  if(x==1){
1057
  window.location= site_url+"/wp-admin/admin.php?page=mo_openid_settings&tab=custom_app&setup_msg";
1059
  }
1060
  }
1061
 
1062
+ var tempHorSize = '<?php echo esc_attr(get_option('mo_login_icon_custom_size')) ?>';
1063
+ var tempHorTheme = '<?php echo esc_attr(get_option('mo_openid_login_theme')) ?>';
1064
+ var tempHorCustomTheme = '<?php echo esc_attr(get_option('mo_openid_login_custom_theme')) ?>';
1065
+ var tempHorCustomColor = '<?php echo esc_attr(get_option('mo_login_icon_custom_color')) ?>';
1066
+ var tempHorSpace = '<?php echo esc_attr(get_option('mo_login_icon_space'))?>';
1067
+ var tempHorHeight = '<?php echo esc_attr(get_option('mo_login_icon_custom_height')) ?>';
1068
+ var tempHorBoundary='<?php echo esc_attr(get_option('mo_login_icon_custom_boundary'))?>';
1069
  function moLoginIncrement(e,t,r,a,i){
1070
  var h,s,c=!1,_=a;s=function(){
1071
  "add"==t&&r.value<60?r.value++:"subtract"==t&&r.value>20&&r.value--,h=setTimeout(s,_),_>20&&(_*=i),c||(document.onmouseup=function(){clearTimeout(h),document.onmouseup=null,c=!1,_=a},c=!0)},e.onmousedown=s}
1481
  <td>
1482
  <br/>
1483
  <input type="checkbox" id="auto_email_enable" name="mo_openid_email_enable" value="1"
1484
+ <?php checked( get_option('mo_openid_email_enable') == 1 );?> /><b>Enable Email Notification to Admin - <?php echo esc_html(get_option("mo_openid_admin_email"));?> on User Registration</b>
1485
  <br/>
1486
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <b>Notice:</b> SMTP should be configured. ]
1487
  </td>
1552
  <input type="checkbox" disabled="disabled" /><b>Take consent from users</b>
1553
  <br/><br/>
1554
  <b>Enter the Consent message: </b><br>
1555
+ <textarea style="width:80%" disabled="disabled"><?php echo esc_textarea(get_option('mo_openid_gdpr_consent_message'))?></textarea>
1556
  <br><br>
1557
  <b>Enter the text that redirects to Privacy Policy URL: </b><br>
1558
  <input type="text" style="width:90%" disabled="disabled"/>
1599
 
1600
  .tableborder tr:nth-child(even){background-color: #f2f2f2}
1601
  </style>
 
 
 
 
 
1602
 
1603
  <div style="display:block;">
1604
  <b><span style="display:block;margin-top:10px;background-color:aliceblue;padding:5px;border:solid 1px deepskyblue;">*NOTE: These features are available in the <a target="_blank" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">premium</a> version of the plugin.</span>
1609
 
1610
  <h3><span style='color:red;'>*</span>BuddyPress</h3>
1611
 
1612
+ <form name="mo_openid_buddypress_form" method="post" id="mo_openid_buddypress_form">
1613
  <input type="hidden" name="option" value="mo_openid_save_buddypress_field"/>
1614
+ <input type="hidden" name="mo_openid_save_buddypress_field_nonce"
1615
+ value="<?php echo wp_create_nonce( 'mo-openid-save-buddypress-field-nonce' ); ?>"/>
1616
  <table>
1617
  <tr><td>
1618
  <b>BuddyPress display options</b>
1643
 
1644
  ?>
1645
 
1646
+ <!--MailChimp form --- remove serverside code-->
1647
  <form name="mo_openid_mailchimp_form" method="post" id="mo_openid_mailchimp_form">
1648
  <input type="hidden" name="option" value="mo_openid_save_mailchimp_field"/><br>
1649
  <hr>
1664
  </a><br>
1665
  </form>
1666
 
1667
+ <!-- Woocommerce form -->
1668
  <form name="mo_openid_woocommerce_form" method="post" id="mo_openid_woocommerce_form">
1669
  <input type="hidden" name="option" value="mo_openid_save_woocommerce_field"/>
1670
+ <input type="hidden" name="mo_openid_save_woocommerce_field_nonce"
1671
+ value="<?php echo wp_create_nonce( 'mo-openid-save-woocommerce-field-nonce' ); ?>"/>
1672
  <br>
1673
  <hr>
1674
  <h3><span style="color:red;">*</span>Woocommerce</h3>
1744
  function mo_openid_email_notification(){
1745
  ?>
1746
  <td style="vertical-align:top;width:65%;">
 
 
1747
  <div class="mo_openid_table_layout">
1748
 
 
 
 
 
 
 
1749
  <div style="display:block;">
1750
  <b><span style="display:block;margin-top:10px;background-color:aliceblue;padding:5px;border:solid 1px deepskyblue;">*NOTE: These features are available in the <a target="_blank" href="<?php echo add_query_arg( array('tab' => 'pricing'), $_SERVER['REQUEST_URI'] ); ?>">standard and premium</a> version of the plugin.</span>
1751
  </b>
1752
  </div>
1753
 
1754
  <table style="width:99%;">
 
1755
  <tr>
1756
  <td>
1757
  <h3> Send Mail To Admin</h3>
1758
  </td>
 
1759
  </tr>
1760
  </table>
1761
  <table style="width:99%;" >
1763
  <tr>
1764
  <td>
1765
  <span style="color:red;">*</span><b>If you want to send Email Notification to multiple admins, enter emails of all admins here:</b><br>(If left empty only administrator gets email)<br><br>
1766
+ <textarea disabled rows="2" id="mo_openid_multiple_email_id" placeholder="Emails should be separated by comma" style="width:100%;background: #DCDAD1;" name="mo_openid_multiple_admin_emails"></textarea>
 
1767
  </td>
1768
  </tr>
1769
 
1770
  <tr>
1771
  <td>
1772
  <br>
1773
+ <input style ="background: #DCDAD1;" disabled type="checkbox" id="mo_admin_email_template" name="mo_admin_email_template" value="1"/><b><span style="color:red;">*</span>Edit Email Notification Template to Admin</b>
 
1774
  <br/>
1775
  </td>
1776
  </tr>
1779
  <td><br />
1780
  <span style="color:red;">*</span>
1781
  <b>Email Subject:</b>
1782
+ <textarea disabled rows="2" id="mo_openid_email_subject" placeholder="Enter your subject line here" style="width:100%;background: #DCDAD1;" name="mo_openid_email_subject"></textarea>
1783
  <br/>
1784
  </td>
1785
  </tr>
1789
  <br />
1790
  <span style="color:red;">*</span>
1791
  <b>Edit Content of Email:</b>
1792
+ <textarea disabled rows="6" id="mo_openid_email_message_id" style="width:100%;background: #DCDAD1;" name="mo_openid_registration_email_content"></textarea>
 
 
 
 
 
 
1793
  </td>
1794
  </tr>
1795
 
1797
  <td>
1798
  <br>
1799
  <hr>
 
1800
  <h3>Send Mail to User</h3>
1801
  </td>
1802
  </tr>
 
1803
  <tr>
1804
  <td>
 
1805
  <input style="background: #DCDAD1;" disabled type="checkbox" id="auto_welcome_email_enable" name="mo_openid_welcome_email_enable" value="1"
1806
  <?php if(!mo_openid_is_customer_registered()) echo 'disabled'?> <?php checked( get_option('mo_openid_welcome_email_enable') == 1 );?> /><b><span style="color:red;">*</span>Enable Email Notification to User on User Registration*</b>
1807
  <br/>
1808
  </td>
1809
  </tr>
 
 
1810
  <tr class="mo_openid_welcome_email_subject">
1811
  <td><br />
1812
  <span style="color:red;">*</span>
1813
  <b>Email Subject:</b>
1814
+ <textarea disabled rows="2" id="mo_openid_welcome_email_subject" placeholder="Enter your subject line here" style="width:100%;background: #DCDAD1;" name="mo_openid_welcome_email_subject"></textarea>
1815
  <br/>
1816
  </td>
1817
  </tr>
 
 
1818
  <tr>
1819
  <td>
1820
  <br/ >
1821
  <span style="color:red;">*</span>
1822
  <b>Edit Content of Email:</b>
1823
+ <textarea disabled rows="6" id="mo_openid_email_message_id" style="width:100%;background: #DCDAD1;" name="mo_openid_user_register_message"></textarea>
 
 
 
 
1824
 
1825
  </td>
1826
  </tr>
1827
  </table>
1828
  <table class="mo_openid_display_table">
1829
  <tr>
1830
+ <td><br /><input disabled type="submit" name="submit" value="Save" style="width:100px;" class="button button-primary button-large" />
1831
  </td>
1832
  </tr>
1833
  </table>
 
1834
  <br><b>*NOTE: These features require SMTP to be setup.</b>
 
1835
  </div>
 
 
 
 
1836
  </td>
 
1837
  <td style="vertical-align:top;padding-left:1%;">
1838
  <?php echo miniorange_openid_support(); ?>
1839
  </td>
 
 
1840
  <?php exit;
1841
  }
1842
 
1843
  function mo_openid_app_comment() {
1844
  ?>
 
1845
  <td style="vertical-align:top;width:65%;">
 
1846
  <form name="f" method="post" id="comment_settings_form" action="">
1847
  <input type="hidden" name="option" value="mo_openid_save_comment_settings" />
1848
+ <input type="hidden" name="mo_openid_comment_settings_nonce"
1849
+ value="<?php echo wp_create_nonce( 'mo-openid-comment-settings-nonce' ); ?>"/>
1850
  <div class="mo_openid_table_layout">
1851
 
1852
  <table class="mo_openid_display_table">
1912
  </tr>
1913
  <tr>
1914
  <td><b>Comment Section Heading:</b></td>
1915
+ <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_heading_label" value="<?php echo esc_attr(get_option('mo_openid_social_comment_heading_label')); ?>" /></td>
1916
  </tr>
1917
  <tr>
1918
  <td><b>Comments - Default Label:</b></td>
1919
+ <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_default_label" value="<?php echo esc_attr(get_option('mo_openid_social_comment_default_label')); ?>" /></td>
1920
  </tr>
1921
  <tr>
1922
  <td><b>Comments - Facebook Label:</b></td>
1923
+ <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_fb_label" value="<?php echo esc_attr(get_option('mo_openid_social_comment_fb_label')); ?>" /></td>
1924
  </tr>
1925
  <tr>
1926
  <td><b>Comments - Google Label:</b></td>
1927
+ <td><input class="mo_openid_table_textbox" type="text" name="mo_openid_social_comment_google_label" value="<?php echo esc_attr(get_option('mo_openid_social_comment_google_label')); ?>" /></td>
1928
  </tr></table></td></tr>
1929
 
1930
  <tr>
2017
  <!-- Enter otp -->
2018
  <form name="f" method="post" id="otp_form" action="">
2019
  <input type="hidden" name="option" value="mo_openid_validate_otp" />
2020
+ <input type="hidden" name="mo_openid_validate_otp_nonce"
2021
+ value="<?php echo wp_create_nonce( 'mo-openid-validate-otp-nonce' ); ?>"/>
2022
  <div class="mo_openid_table_layout">
2023
  <table class="mo_openid_settings_table">
2024
  <h3>Verify Your Email</h3>
2037
  </form>
2038
  <form name="f" method="post">
2039
  <td style="width:18%">
2040
+ <input type="hidden" name="option" value="mo_openid_go_back"/>4
2041
+ <input type="hidden" name="mo_openid_go_back_nonce"
2042
+ value="<?php echo wp_create_nonce( 'mo-openid-go-back-nonce' ); ?>"/>
2043
  <input type="submit" name="submit" value="Back" class="button button-primary button-large" />
2044
  </td>
2045
  </form>
2047
  <td>
2048
 
2049
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
2050
+ <input type="hidden" name="mo_openid_resend_otp_nonce"
2051
+ value="<?php echo wp_create_nonce( 'mo-openid-resend-otp-nonce' ); ?>"/>
2052
  </td>
2053
  </tr>
2054
  </form>
2059
  <h3>I did not recieve any email with OTP . What should I do ?</h3>
2060
  <form id="phone_verification" method="post" action="">
2061
  <input type="hidden" name="option" value="mo_openid_phone_verification" />
2062
+ <input type="hidden" name="mo_openid_phone_verification_nonce"
2063
+ value="<?php echo wp_create_nonce( 'mo-openid-phone-verification-nonce' ); ?>"/>
2064
  If you can't see the email from miniOrange in your mails, please check your <b>SPAM Folder</b>. If you don't see an email even in SPAM folder, verify your identity with our alternate method.
2065
  <br><br>
2066
  <b>Enter your valid phone number here and verify your identity using one time passcode sent to your phone.</b>
2068
  <table class="mo_openid_settings_table">
2069
  <tr>
2070
  <td colspan="3">
2071
+ <input class="mo_openid_table_textbox" required pattern="[0-9\+]{12,18}" autofocus="true" style="width:100%;" type="tel" name="phone_number" id="phone" placeholder="Enter Phone Number" value="<?php echo esc_attr(get_option('mo_openid_admin_phone')); ?>" title="Enter phone number(at least 10 digits) without any space or dashes."/>
2072
  </td>
2073
  <td>&nbsp;&nbsp;
2074
  <a style="cursor:pointer;" onclick="document.getElementById('phone_verification').submit();">Resend OTP ?</a>
2100
  <td style="vertical-align:top;width:65%;">
2101
  <form name="f" method="post" id="settings_form" action="">
2102
  <input type="hidden" name="option" value="mo_openid_save_other_settings" />
2103
+ <input type="hidden" name="mo_openid_save_other_settings_nonce"
2104
+ value="<?php echo wp_create_nonce( 'mo-openid-save-other-settings-nonce' ); ?>"/>
2105
  <div class="mo_openid_table_layout">
2106
 
2107
  <table>
2108
  <tr>
2109
  <td colspan="2">
2110
+ <h3>Social Sharing <input type="submit" id="share_save" name="submit" value="Save" style="width:100px;float:right;margin-right:2%" class="button button-primary button-large" onclick="end_tour();"/><button type="button" id="mo_openid_restart_tour" class="button button-primary button-large"style="float:right; margin-right:2%;width:22%" onclick="restart_tour();"><i class="fa fa-refresh"></i> Social Sharing Tour</button>
2111
  </h3>
2112
  <b>Select applications to add share icons. Customize sharing icons by using a range of shapes, themes and sizes to suit to your website. You can also choose different places to display these icons. Additionally, place vertical floating icons on your pages.</b>
2113
  </td>
2250
  <?php checked( get_option('mo_openid_share_custom_theme') == 'default' );?> />Default
2251
  </td>
2252
  <td> <!-- Size between icons buttons-->
2253
+ <input style="width:50px" onkeyup="moSharingSpaceValidate(this)" id="mo_sharing_icon_space" name="mo_sharing_icon_space" type="text" value="<?php echo esc_attr(get_option('mo_sharing_icon_space'))?>" />
2254
  <input id="mo_sharing_space_plus" type="button" value="+" onmouseup="moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value ,setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value)"/>
2255
  <input id="mo_sharing_space_minus" type="button" value="-" onmouseup="moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value ,setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value)" />
2256
  </td>
2257
  <td> <!-- Size buttons-->
2258
+ <input style="width:50px" id="mo_sharing_icon_size" onkeyup="moSharingSizeValidate(this)" name="mo_sharing_icon_custom_size" type="text" value="<?php echo esc_attr(get_option('mo_sharing_icon_custom_size'))?>" >
2259
 
2260
  <input id="mo_sharing_size_plus" type="button" value="+" onmouseup="tempHorSize = document.getElementById('mo_sharing_icon_size').value;moSharingPreview('horizontal',document.getElementById('mo_sharing_icon_size').value , setTheme(), setCustomTheme(), document.getElementById('mo_sharing_icon_custom_color').value, document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value)" >
2261
 
2284
  <td> <!-- Theme radio buttons -->
2285
  <!-- Custom background textbox -->
2286
 
2287
+ <input id="mo_sharing_icon_custom_color" name="mo_sharing_icon_custom_color" class="color" value="<?php echo esc_attr(get_option('mo_sharing_icon_custom_color'))?>" onchange="moSharingPreview('horizontal', document.getElementById('mo_sharing_icon_size').value, setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value)" >
2288
  </td>
2289
  <td></td>
2290
  <td></td>
2302
  <td></td>
2303
  <td> <!-- Theme radio buttons -->
2304
  <!-- No background textbox-->
2305
+ <input id="mo_sharing_icon_custom_font" name="mo_sharing_icon_custom_font" class="color" value="<?php echo esc_attr(get_option('mo_sharing_icon_custom_font'))?>" onchange="moSharingPreview('horizontal', document.getElementById('mo_sharing_icon_size').value, setTheme(),setCustomTheme(),document.getElementById('mo_sharing_icon_custom_color').value,document.getElementById('mo_sharing_icon_space').value,document.getElementById('mo_sharing_icon_custom_font').value,document.getElementById('mo_sharing_icon_custom_font').value)" />
2306
  </td>
2307
  <td></td>
2308
  <td></td>
2381
  </tr></table></td></tr>
2382
 
2383
  <script>
2384
+ var tempHorSize = '<?php echo esc_attr(get_option('mo_sharing_icon_custom_size')) ?>';
2385
+ var tempHorShape = '<?php echo esc_attr(get_option('mo_openid_share_theme')) ?>';
2386
+ var tempHorTheme = '<?php echo esc_attr(get_option('mo_openid_share_custom_theme')) ?>';
2387
+ var tempbackColor = '<?php echo esc_attr(get_option('mo_sharing_icon_custom_color'))?>';
2388
+ var tempHorSpace = '<?php echo esc_attr(get_option('mo_sharing_icon_space'))?>';
2389
+ var tempHorFontColor = '<?php echo esc_attr(get_option('mo_sharing_icon_custom_font'))?>';
2390
  function moSharingIncrement(e,t,r,a,i){
2391
  var h,s,c=!1,_=a;s=function(){
2392
  "add"==t&&r.value<60?r.value++:"subtract"==t&&r.value>10&&r.value--,h=setTimeout(s,_),_>20&&(_*=i),c||(document.onmouseup=function(){clearTimeout(h),document.onmouseup=null,c=!1,_=a},c=!0)},e.onmousedown=s}
2796
 
2797
  <tr>
2798
  <td><b>Select color for share heading:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2799
+ <input id="mo_openid_table_textbox" style="width:135px;" name="mo_openid_share_widget_customize_text_color" class="color" value="<?php echo esc_attr(get_option('mo_openid_share_widget_customize_text_color'))?>" > </td>
2800
  </tr>
2801
  <tr>
2802
  <td>
2803
  <b>Enter text to show above share widget:</b>
2804
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2805
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_widget_customize_text"
2806
+ value="<?php echo esc_attr(get_option('mo_openid_share_widget_customize_text')); ?>" />
2807
  </td>
2808
  </tr>
2809
  <tr>
2811
  <b>Enter your twitter Username (without @):</b>
2812
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2813
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_twitter_username"
2814
+ value="<?php echo esc_attr(get_option('mo_openid_share_twitter_username')); ?>" />
2815
  </td>
2816
  </tr>
2817
  <tr>
2820
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2821
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2822
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_email_subject"
2823
+ value="<?php echo esc_attr(get_option('mo_openid_share_email_subject')); ?>" />
2824
  </td>
2825
  </tr>
2826
  <tr>
2828
  <b>Enter the Email body (add ##url## to place the URL):</b>
2829
  &nbsp;&nbsp;&nbsp;&nbsp;
2830
  <input class="mo_openid_table_textbox" style="width:50%;" type="text" name="mo_openid_share_email_body"
2831
+ value="<?php echo esc_attr(get_option('mo_openid_share_email_body')); ?>" />
2832
  </td>
2833
  </tr>
2834
  <tr id="disp_options"><td><table><tr>
3066
  <h3><a id="openid_sharing_shortcode_title" >Social Sharing Shortcode</a></h3>
3067
  <div hidden="" id="openid_sharing_shortcode" style="font-size:13px !important">
3068
  <b>Horizontal</b> --> <code>[miniorange_social_sharing]</code><br>
3069
+ <b>Vertical</b> --> <code>[miniorange_social_sharing_vertical]</code>
 
 
3070
 
3071
  <h4>For Sharing Icons</h4>
3072
  You can use different attribute to customize social sharing icons. All attributes are optional.<br>
3384
  </form>
3385
  <form method="post" id="checkLicenseForm">
3386
  <input type="hidden" name="option" value="mo_openid_check_license">
3387
+ <input type="hidden" name="mo_openid_check_license_nonce"
3388
+ value="<?php echo wp_create_nonce( 'mo-openid-check-license-nonce' ); ?>"/>
3389
  </form>
3390
 
3391
  <script>
3851
  <div class="mo_table_layout" style="min-height: 400px;">
3852
  <?php
3853
 
3854
+ if(isset($_GET['action']) && $_GET['action']=='delete'){
3855
+ if(isset($_GET['wp_nonce'])){
3856
+ $nonce = $_GET['wp_nonce'];
3857
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-delete-selected-app-nonce' ) ) {
3858
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
3859
+ } else {
3860
+ if(isset($_GET['app'])){
3861
+ $app = sanitize_text_field($_GET['app']);
3862
+ delete_custom_app($app);
3863
+ }
3864
+ }
3865
  }
3866
+ } else if(isset($_GET['action']) && $_GET['action']=='instructions'){
3867
+ if(isset($_GET['app'])){
3868
+ $app = sanitize_text_field($_GET['app']);
3869
+ mo_custom_app_instructions($_GET['app']);
 
 
 
 
 
3870
  }
3871
+ }
3872
+
3873
+ if(isset($_GET['action']) && $_GET['action']=='add'){
3874
+ if(isset($_GET['wp_nonce'])){
3875
+ $nonce = $_GET['wp_nonce'];
3876
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-add-selected-app-nonce' ) ) {
3877
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
3878
+ } else {
3879
+ add_custom_app();
3880
+ }
3881
+ }
3882
+ }
3883
+ else if(isset($_GET['action']) && $_GET['action']=='update'){
3884
+ if(isset($_GET['wp_nonce'])){
3885
+ $nonce = $_GET['wp_nonce'];
3886
+ if ( ! wp_verify_nonce( $nonce, 'mo-openid-update-selected-app-nonce' ) ) {
3887
+ wp_die('<strong>ERROR</strong>: Invalid Request.');
3888
+ } else {
3889
+ if(isset($_GET['app'])) {
3890
+ $app = sanitize_text_field($_GET['app']);
3891
+ update_custom_app($app);
3892
+ mo_custom_app_instructions($app);
3893
+ }
3894
+ }
3895
+ }
3896
+ }
3897
  else if(get_option('mo_openid_apps_list')){
3898
  if(strpos($_SERVER['REQUEST_URI'], "setup_msg")!== false)
3899
  {
3900
  ?><div id="upgrade_notice" class="notice notice-success is-dismissible" style="width: 92.5%;margin-left: 0%;"><p><strong>Please enable the Facebook custom app.</strong></p></div>
3901
  <?php
3902
  }
3903
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
3904
+ $nonce = wp_create_nonce( 'mo-openid-add-selected-app-nonce' );
3905
+ echo "<br><input onclick='window.location.href=\"admin.php?page=mo_openid_settings&tab=custom_app&action=add&wp_nonce=".$nonce."\"' type='button' class='button button-primary button-large' style='float:right;text-align:center;' value='Add Application'>";
3906
  echo "<h3>Applications List</h3>";
3907
  echo "<table class='tableborder'>";
3908
  echo "<tr><th><b>Name</b></th><th>Action</th><th>Enable Custom app</tr></tr>";
3922
  }
3923
  else {
3924
  $test_config = '';
3925
+ }
3926
+ $nonce_update = wp_create_nonce( 'mo-openid-update-selected-app-nonce' );
3927
+ echo "<tr><td>".$key."</td><td><a href='admin.php?page=mo_openid_settings&tab=custom_app&action=update&app=".$key."&wp_nonce=" . $nonce_update . "'>Edit</a> | ".$test_config." <a onclick='popup_delete_app(\"".$key."\")'>Delete</a>
3928
  </td><td><label class='mo-switch'>
3929
  <input type='checkbox' ". $enable_status ." onclick='enable_custom_app(\"".$key."\"); ' id='mo_id_".$key."' >
3930
  <div class='mo-slider round' id='switch_checkbox' >
3937
  </p></div>";
3938
 
3939
  }elseif (get_option('mo_openid_apps_list')==null){
3940
+ $nonce = wp_create_nonce( 'mo-openid-add-selected-app-nonce' );
3941
  echo "<div style='text-align: center'><p>You have not configured any custom apps yet. Please click on <b>Add Application</b> to configure your own app.</p>";
3942
+ echo "<br><input type='button' onclick='window.location.href=\"admin.php?page=mo_openid_settings&tab=custom_app&action=add&wp_nonce=" . $nonce . "\"' class='button button-primary button-large' style='text-align:center;' value='Add Application'>";
3943
  echo "<br><br><br><br><br>";?>
3944
  <img style="margin-top: -3%" src="<?php echo plugin_dir_url(__FILE__);?>includes/images/custom_app.png">
3945
 
3973
  data: {appname: selected_app, test_configuration : true},
3974
  dataType: 'text',
3975
  success:function(result){
3976
+ var myWindow = window.open('<?php echo home_url(); ?>' + '/?option=oauthredirect&app_name='+selected_app+'&wp_nonce='+'<?php echo wp_create_nonce( 'mo-openid-oauth-app-nonce' ); ?>',"", "width=950, height=600");
3977
  }
3978
  });
3979
  }
4018
  </div>
4019
  <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
4020
  <input type="hidden" name="option" value="mo_openid_add_custom_app" />
4021
+ <input type="hidden" name="mo_openid_add_custom_nonce"
4022
+ value="<?php echo wp_create_nonce( 'mo-openid-add-custom-app-nonce' ); ?>"/>
4023
  <table class="mo_settings_table">
4024
  <tr>
4025
  <td><strong><font color="#FF0000">*</font>Select Application:</strong></td>
4069
  }
4070
  function update_custom_app($appname){
4071
 
4072
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
4073
  foreach($appslist as $key => $app){
4074
  if($appname == $key){
4075
  $currentappname = $appname;
4086
  <h3>Update Application</h3>
4087
  </div>
4088
  <form id="form-common" name="form-common" method="post" action="admin.php?page=mo_openid_settings&tab=custom_app">
4089
+ <input type="hidden" name="option" value="mo_openid_add_custom_app" />
4090
+ <input type="hidden" name="mo_openid_custom_app_nonce"
4091
+ value="<?php echo wp_create_nonce( 'mo-openid-custom-app-nonce' ); ?>"/>
4092
  <table class="mo_settings_table">
4093
  <tr>
4094
  <td><strong><font color="#FF0000">*</font>Application:</strong></td>
4095
  <td>
4096
  <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_app_name" value="<?php echo $currentappname;?>">
4097
  <input class="mo_table_textbox" required="" type="hidden" name="mo_oauth_custom_app_name" value="<?php echo $currentappname;?>">
4098
+ <?php echo esc_html($currentappname);?><br><br>
4099
  </td>
4100
  </tr>
4101
  <tr>
4102
  <td><strong><font color="#FF0000">*</font>Client ID:</strong></td>
4103
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_id" value="<?php echo esc_html($currentapp['clientid']);?>"></td>
4104
  </tr>
4105
  <tr>
4106
  <td><strong><font color="#FF0000">*</font>Client Secret:</strong></td>
4107
+ <td><input class="mo_table_textbox" required="" style="height: 27px; width:500px" type="text" name="mo_oauth_client_secret" value="<?php echo esc_html($currentapp['clientsecret']);?>"></td>
4108
  </tr>
4109
  <tr>
4110
  <td><strong>Scope:</strong></td>
4111
+ <td><input class="mo_table_textbox" style="height: 27px; width:500px" type="text" name="mo_oauth_scope" value="<?php echo esc_html($currentapp['scope']);?>"></td>
4112
  </tr>
4113
  <tr>
4114
  <td>&nbsp;</td>
4131
  }
4132
 
4133
  function delete_custom_app($appname){
4134
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
4135
  foreach($appslist as $key => $app){
4136
  if($appname == $key){
4137
  unset($appslist[$key]);
4138
  }
4139
  }
4140
+ if($appname=="facebook")
4141
+ {
4142
+ update_option('mo_openid_facebook_enable',0);
4143
+ }
4144
+ if(!empty($appslist))
4145
+ update_option('mo_openid_apps_list', maybe_serialize($appslist));
4146
+ else
4147
+ delete_option('mo_openid_apps_list');
4148
  }
4149
 
4150
  function mo_custom_app_instructions($appname){
4195
  <p>Need any help? Couldn't find an answer in <a href="<?php echo add_query_arg( array('tab' => 'help'), $_SERVER['REQUEST_URI'] ); ?>">FAQ</a>?<br>Just send us a query so we can help you.</p>
4196
  <form method="post" action="">
4197
  <input type="hidden" name="option" value="mo_openid_contact_us_query_option" />
4198
+ <input type="hidden" name="mo_openid_contact_us_nonce"
4199
+ value="<?php echo wp_create_nonce( 'mo-openid-contact-us-nonce' ); ?>"/>
4200
  <table class="mo_openid_settings_table">
4201
  <tr>
4202
  <td><input type="email" class="mo_openid_table_contact" required placeholder="Enter your Email" name="mo_openid_contact_us_email" value="<?php echo get_option("mo_openid_admin_email"); ?>"></td>
4253
  }
4254
 
4255
  function mo_openid_is_customer_valid(){
4256
+ $valid = sanitize_text_field(get_option('mo_openid_admin_customer_valid'));
4257
  if(isset($valid) && get_option('mo_openid_admin_customer_plan'))
4258
  return $valid;
4259
  else
4261
  }
4262
 
4263
  function mo_openid_get_customer_plan($customerPlan){
4264
+ $plan = sanitize_text_field(get_option('mo_openid_admin_customer_plan'));
4265
  $planName = isset($plan) ? base64_decode($plan) : 0;
4266
  if($planName) {
4267
  if(strpos($planName, $customerPlan) !== FALSE)
4319
  <h1>Save As</h1>
4320
  </div>
4321
  <br>
4322
+ <span id="msg1" style="text-align: center;color: #56b11e"><?php echo esc_html(get_option("pop_regi_msg")); update_option('pop_regi_msg','Your settings are saved successfully. Please enter your valid email address to enable social login.');?></span>
4323
  <br>
4324
  <br>
4325
  <br>
4329
 
4330
  <form name="f" method="post" action="" id="pop-register-form">
4331
  <input name="option" value="mo_openid_connect_register_customer" type="hidden"/>
4332
+ <input type="hidden" name="mo_openid_connect_register_nonce"
4333
+ value="<?php echo wp_create_nonce( 'mo-openid-connect-register-nonce' ); ?>"/>
4334
  <div>
4335
 
4336
 
4392
  regi_button.display = '';
4393
 
4394
  jQuery("[id*=pop_next]").css('display','none');
4395
+ document.getElementById("msg1").innerHTML = "Please select and enter a password";
4396
  jQuery("[id*=pop_register]").css('display',''); //and $('#Id').css('padding-left','20%');
4397
  }
4398
  </script>
4414
  <h1>Verify Your Email </h1>
4415
  </div>
4416
  <br>
4417
+ <span style="text-align: center;color: #56b11e"><?php echo esc_html($msg);?></span>
4418
  <br>
4419
  <br>
4420
  <div id="mo_saml_show_registeration_modal" >
4424
 
4425
  <form name="f" method="post" action="" id="pop-otp-form" style="margin-left: 28%;">
4426
  <input type="hidden" name="option" value="mo_openid_validate_otp" />
4427
+ <input type="hidden" name="mo_openid_validate_otp_nonce"
4428
+ value="<?php echo wp_create_nonce( 'mo-openid-validate-otp-nonce' ); ?>"/>
4429
  <div>
4430
 
4431
  <table style="text-align: left;width: 100%">
4450
 
4451
  </form>
4452
  <form method="post">
4453
+ &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <input type="submit" id="go_to_register" name="go_to_register" value="Back to register" class="button button-primary button-large" style="margin-left: -29%;margin-top: -8.2%;">
4454
  </form>
4455
 
4456
  </div>
4457
  <div style="margin-left: 14%;"><form name="f" id="pop_resend_otp_form" method="post" action="">
4458
  <input type="hidden" name="option" value="mo_openid_resend_otp"/>
4459
+ <input type="hidden" name="mo_openid_resend_otp_nonce"
4460
+ value="<?php echo wp_create_nonce( 'mo-openid-resend-otp-nonce' ); ?>"/>
4461
+ &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <input type="submit" value="Did not get the OTP? Resend OTP" id="resend_otp" style="cursor:pointer ;background: none!important;border:none;padding:0!important;margin-left: -29%;margin-top: -8.2%;color: darkblue;""/>
4462
  </form></div>
4463
  </div>
4464
 
4478
 
4479
  function mo_pop_show_verify_password_page() {
4480
  update_option('regi_pop_up','yes');
 
4481
  ?>
4482
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
4483
  <div id="request_registeration" class="mo_openid_modal" style="height:100%">
4485
  <!-- Modal content -->
4486
  <div class="mo_openid_modal-content" style="text-align:center;margin-left: 32%;margin-top: 2%;width: 37%;">
4487
  <div class="modal-head">
 
4488
  <a href="" class="mo_close" id="mo_close" style="text-decoration:none;margin-top: 3%;">&times;</a>
4489
  <h1>Login</h1>
4490
  </div>
4491
  <br>
4492
+ <span style="text-align: center;color: #56b11e"><?php echo esc_html(get_option("pop_login_msg")); update_option('pop_login_msg','Enter Your Login Credentials.');?></span>
4493
  <br><br>
4494
  <div id="mo_saml_show_registeration_modal" >
4495
 
4496
  <!--Register with miniOrange-->
4497
  <form name="f" method="post" action="" id="pop-register-form">
4498
  <input type="hidden" name="option" value="mo_openid_connect_verify_customer" />
4499
+ <input type="hidden" name="mo_openid_connect_verify_nonce"
4500
+ value="<?php echo wp_create_nonce( 'mo-openid-connect-verify-nonce' ); ?>"/>
4501
  <div>
4502
  <table style="text-align: left;width: 100%">
4503
 
4505
  <td><b><font color="#FF0000">*</font>Email:</b></td>
4506
  <td><input class="mo_openid_table_textbox" id="email" type="email" name="email"
4507
  required placeholder="person@example.com"
4508
+ value="<?php echo esc_attr(get_option('mo_openid_admin_email'));?>" />
4509
  </td>
4510
  </tr>
4511
 
4530
  <p><b><a href="#forgot_password">Click here if you forgot your password?</a></b></p>
4531
  <form name="forgotpassword" method="post" action="" id="openidforgotpasswordform">
4532
  <input type="hidden" name="option" value="mo_openid_forgot_password"/>
4533
+ <input type="hidden" name="mo_openid_forgot_password_nonce"
4534
+ value="<?php echo wp_create_nonce( 'mo-openid-forgot-password-nonce' ); ?>"/>
4535
  <input type="hidden" id="forgot_pass_email" name="email" value=""/>
4536
  </form>
4537
  </div>
4551
  function is_custom_app($app_name){
4552
 
4553
  if(get_option('mo_openid_apps_list'))
4554
+ $appslist = maybe_unserialize(get_option('mo_openid_apps_list'));
4555
  else
4556
  $appslist = array();
4557
 
mo_openid_feedback_form.php CHANGED
@@ -20,6 +20,8 @@
20
  <h3>What Happened? </h3>
21
  <form name="f" method="post" action="" id="mo_openid_feedback">
22
  <input type="hidden" name="mo_openid_feedback" value="mo_openid_feedback"/>
 
 
23
  <div>
24
  <p style="margin-left:2%">
25
 
@@ -39,9 +41,9 @@
39
  foreach ( $deactivate_reasons as $deactivate_reasons ) {?>
40
 
41
  <div class="radio" style="padding:1px;margin-left:2%">
42
- <label style="font-weight:normal;font-size:14.6px" for="<?php echo $deactivate_reasons; ?>">
43
- <input type="radio" name="deactivate_plugin" value="<?php echo $deactivate_reasons;?>" required >
44
- <?php echo $deactivate_reasons;?>
45
  </label>
46
  </div>
47
  <span id="link_id_<?php echo $p;$p++;?>"></span>
@@ -56,6 +58,8 @@
56
  </form>
57
  <form name="f" method="post" action="" id="mo_openid_feedback_form_close">
58
  <input type="hidden" name="mo_openid_option" value="mo_openid_skip_feedback"/>
 
 
59
  </form>
60
 
61
  </div>
@@ -67,17 +71,17 @@
67
  jQuery('#mo_openid_feedback_form_close').submit();
68
  }
69
  jQuery('a[aria-label="Deactivate Social Login, Social Sharing by miniOrange"]').click(function(){
70
- // Get the mo_openid_modal
71
  <?php if(!get_option('mo_openid_feedback_form')){ ?>
72
  var mo_openid_modal = document.getElementById('myModal');
73
 
74
- // Get the button that opens the mo_openid_modal
75
  var btn = document.getElementById("myBtn");
76
 
77
- // Get the <span> element that closes the mo_openid_modal
78
  var span = document.getElementsByClassName("mo_openid_close")[0];
79
 
80
- // When the user clicks the button, open the mo_openid_modal
81
 
82
  mo_openid_modal.style.display = "block";
83
  var i=0;
@@ -94,7 +98,6 @@
94
  add_text_box(3,"Let us know what feature are you looking for");
95
  }else if(reason=="Other Reasons:"){
96
  add_text_box(8,"Can you let us know the reason for deactivation?");
97
- // jQuery('#mo_openid_query_feedback').prop("required", true);
98
  }else if(reason=="Not Receiving OTP During Registration"){
99
  show_link='<p style="background-color:#feffb2;padding:5px 10px;">Please '+'<a href="https://www.miniorange.com/businessfreetrial" target="_blank"><b>click here</b></a>'+' to create an account.</p>';
100
  add_text_box(2,"Can you please describe the issue in detail?");
20
  <h3>What Happened? </h3>
21
  <form name="f" method="post" action="" id="mo_openid_feedback">
22
  <input type="hidden" name="mo_openid_feedback" value="mo_openid_feedback"/>
23
+ <input type="hidden" name="mo_openid_feedback_nonce"
24
+ value="<?php echo wp_create_nonce( 'mo-openid-feedback-nonce' ); ?>"/>
25
  <div>
26
  <p style="margin-left:2%">
27
 
41
  foreach ( $deactivate_reasons as $deactivate_reasons ) {?>
42
 
43
  <div class="radio" style="padding:1px;margin-left:2%">
44
+ <label style="font-weight:normal;font-size:14.6px" for="<?php echo esc_attr($deactivate_reasons); ?>">
45
+ <input type="radio" name="deactivate_plugin" value="<?php echo esc_attr($deactivate_reasons);?>" required >
46
+ <?php echo esc_html($deactivate_reasons);?>
47
  </label>
48
  </div>
49
  <span id="link_id_<?php echo $p;$p++;?>"></span>
58
  </form>
59
  <form name="f" method="post" action="" id="mo_openid_feedback_form_close">
60
  <input type="hidden" name="mo_openid_option" value="mo_openid_skip_feedback"/>
61
+ <input type="hidden" name="mo_openid_feedback_close_nonce"
62
+ value="<?php echo wp_create_nonce( 'mo-openid-feedback-close-nonce' ); ?>"/>
63
  </form>
64
 
65
  </div>
71
  jQuery('#mo_openid_feedback_form_close').submit();
72
  }
73
  jQuery('a[aria-label="Deactivate Social Login, Social Sharing by miniOrange"]').click(function(){
74
+ // Get the mo_openid_modal
75
  <?php if(!get_option('mo_openid_feedback_form')){ ?>
76
  var mo_openid_modal = document.getElementById('myModal');
77
 
78
+ // Get the button that opens the mo_openid_modal
79
  var btn = document.getElementById("myBtn");
80
 
81
+ // Get the <span> element that closes the mo_openid_modal
82
  var span = document.getElementsByClassName("mo_openid_close")[0];
83
 
84
+ // When the user clicks the button, open the mo_openid_modal
85
 
86
  mo_openid_modal.style.display = "block";
87
  var i=0;
98
  add_text_box(3,"Let us know what feature are you looking for");
99
  }else if(reason=="Other Reasons:"){
100
  add_text_box(8,"Can you let us know the reason for deactivation?");
 
101
  }else if(reason=="Not Receiving OTP During Registration"){
102
  show_link='<p style="background-color:#feffb2;padding:5px 10px;">Please '+'<a href="https://www.miniorange.com/businessfreetrial" target="_blank"><b>click here</b></a>'+' to create an account.</p>';
103
  add_text_box(2,"Can you please describe the issue in detail?");
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.miniorange.com
4
  Tags: social login, facebook login, google login, twitter login, Vkontakte login, social, facebook, twitter, google, login, google, social connect, social network login, social plugin, Vkontakte, LinkedIn
5
  Requires at least: 2.0.2
6
  Tested up to: 5.1
7
- Stable tag: 7.1.6
8
  License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
 
10
  Social Login with Google, Facebook, Twitter, Vkontakte, LinkedIn and more. GDPR compliant. Social sharing and social comments. Quickest setup.
@@ -175,6 +175,13 @@ Please email us at info@miniorange.com. You can also submit your query from the
175
 
176
 
177
  == Changelog ==
 
 
 
 
 
 
 
178
  = 7.1.6 =
179
  * Fixed Non-English Character issue in the username.
180
  * Fixed the role mapping error message while login.
@@ -614,6 +621,13 @@ Please email us at info@miniorange.com. You can also submit your query from the
614
  * First version of Social Login, Social Sharing plugin.
615
 
616
  == Upgrade Notice ==
 
 
 
 
 
 
 
617
  = 7.1.6 =
618
  * Fixed Non-English Character issue in the username.
619
  * Fixed the role mapping error message while login.
4
  Tags: social login, facebook login, google login, twitter login, Vkontakte login, social, facebook, twitter, google, login, google, social connect, social network login, social plugin, Vkontakte, LinkedIn
5
  Requires at least: 2.0.2
6
  Tested up to: 5.1
7
+ Stable tag: 7.2
8
  License URI: http://miniorange.com/usecases/miniOrange_User_Agreement.pdf
9
 
10
  Social Login with Google, Facebook, Twitter, Vkontakte, LinkedIn and more. GDPR compliant. Social sharing and social comments. Quickest setup.
175
 
176
 
177
  == Changelog ==
178
+ = 7.2 =
179
+ SECURITY FIXES
180
+ * Added nonce check for all forms
181
+ * Added sanitization and escape
182
+ * Changed cURL calls to WordPress HTTP API calls
183
+ * Fixed issue on custom app delete
184
+
185
  = 7.1.6 =
186
  * Fixed Non-English Character issue in the username.
187
  * Fixed the role mapping error message while login.
621
  * First version of Social Login, Social Sharing plugin.
622
 
623
  == Upgrade Notice ==
624
+ = 7.2 =
625
+ SECURITY FIXES
626
+ * Added nonce check for all forms
627
+ * Added sanitization and escape
628
+ * Changed cURL calls to WordPress HTTP API calls
629
+ * Fixed issue on custom app delete
630
+
631
  = 7.1.6 =
632
  * Fixed Non-English Character issue in the username.
633
  * Fixed the role mapping error message while login.
twitter_oauth.php DELETED
@@ -1,204 +0,0 @@
1
- <?php
2
-
3
- class twitter_oauth
4
- {
5
- var $key = '';
6
- var $secret = '';
7
-
8
- var $request_token = "https://twitter.com/oauth/request_token";
9
- var $access_token = "https://twitter.com/oauth/access_token";
10
- var $profile = "https://api.twitter.com/1.1/account/verify_credentials.json";
11
-
12
- function __construct($client_key,$client_secret)
13
- {
14
- $this->key = $client_key; // consumer key from twitter
15
- $this->secret = $client_secret; // secret from twitter
16
- }
17
-
18
- function getRequestToken()
19
- {
20
- // Default params
21
- $params = array(
22
- "oauth_version" => "1.0",
23
- "oauth_nonce" => time(),
24
- "oauth_timestamp" => time(),
25
- "oauth_consumer_key" => $this->key,
26
- "oauth_signature_method" => "HMAC-SHA1"
27
- );
28
-
29
- // BUILD SIGNATURE
30
- // encode params keys, values, join and then sort.
31
- $keys = $this->_urlencode_rfc3986(array_keys($params));
32
- $values = $this->_urlencode_rfc3986(array_values($params));
33
- $params = array_combine($keys, $values);
34
- uksort($params, 'strcmp');
35
-
36
- // convert params to string
37
- foreach ($params as $k => $v) {
38
- $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
39
- }
40
- $concatenatedParams = implode('&', $pairs);
41
-
42
- // form base string (first key)
43
- $baseString= "GET&".$this->_urlencode_rfc3986($this->request_token)."&".$this->_urlencode_rfc3986($concatenatedParams);
44
- // form secret (second key)
45
- $secret = $this->_urlencode_rfc3986($this->secret)."&";
46
- // make signature and append to params
47
- $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
48
-
49
- // BUILD URL
50
- // Resort
51
- uksort($params, 'strcmp');
52
- // convert params to string
53
- foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
54
- $concatenatedUrlParams = implode('&', $urlPairs);
55
- // form url
56
- $url = $this->request_token."?".$concatenatedUrlParams;
57
-
58
- // Send to cURL
59
- return $this->_http($url);
60
- }
61
-
62
- function getAccessToken($oauth_verifier,$twitter_oauth_token)
63
- {
64
- $params = array(
65
- "oauth_version" => "1.0",
66
- "oauth_nonce" => time(),
67
- "oauth_timestamp" => time(),
68
- "oauth_consumer_key" => $this->key,
69
- "oauth_token" => $twitter_oauth_token,
70
- "oauth_signature_method" => "HMAC-SHA1"
71
- );
72
-
73
- $keys = $this->_urlencode_rfc3986(array_keys($params));
74
- $values = $this->_urlencode_rfc3986(array_values($params));
75
- $params = array_combine($keys, $values);
76
- uksort($params, 'strcmp');
77
-
78
- foreach ($params as $k => $v) {
79
- $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
80
- }
81
- $concatenatedParams = implode('&', $pairs);
82
-
83
- $baseString= "GET&".$this->_urlencode_rfc3986($this->access_token)."&".$this->_urlencode_rfc3986($concatenatedParams);
84
- $secret = $this->_urlencode_rfc3986($this->secret)."&";
85
- $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
86
-
87
- uksort($params, 'strcmp');
88
- foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
89
- $concatenatedUrlParams = implode('&', $urlPairs);
90
- $url = $this->access_token."?".$concatenatedUrlParams;
91
- $postData = 'oauth_verifier=' .$oauth_verifier;
92
-
93
- return $this->_http($url,$postData);
94
- }
95
-
96
- function getprofile_signature($oauth_token,$oauth_token_secret,$screen_name)
97
- {
98
- $params = array(
99
- "oauth_version" => "1.0",
100
- "oauth_nonce" => time(),
101
- "oauth_timestamp" => time(),
102
- "oauth_consumer_key" => $this->key,
103
- "oauth_token" => $oauth_token,
104
- "oauth_signature_method" => "HMAC-SHA1",
105
- "screen_name" => $screen_name,
106
- "include_email" => "true"
107
- );
108
-
109
- $keys = $this->_urlencode_rfc3986(array_keys($params));
110
- $values = $this->_urlencode_rfc3986(array_values($params));
111
- $params = array_combine($keys, $values);
112
- uksort($params, 'strcmp');
113
-
114
- foreach ($params as $k => $v) {
115
- $pairs[] = $this->_urlencode_rfc3986($k).'='.$this->_urlencode_rfc3986($v);
116
- }
117
- $concatenatedParams = implode('&', $pairs);
118
-
119
- $baseString= "GET&".$this->_urlencode_rfc3986($this->profile)."&".$this->_urlencode_rfc3986($concatenatedParams);
120
-
121
- $secret = $this->_urlencode_rfc3986($this->secret)."&". $this->_urlencode_rfc3986($oauth_token_secret);
122
- $params['oauth_signature'] = $this->_urlencode_rfc3986(base64_encode(hash_hmac('sha1', $baseString, $secret, TRUE)));
123
-
124
- uksort($params, 'strcmp');
125
- foreach ($params as $k => $v) {$urlPairs[] = $k."=".$v;}
126
- $concatenatedUrlParams = implode('&', $urlPairs);
127
- $url = $this->profile."?".$concatenatedUrlParams;
128
- return $this->get_profile($url);
129
- }
130
-
131
- function _http($url, $post_data = null)
132
- {
133
- $ch = curl_init();
134
- //echo $url; exit;
135
-
136
- curl_setopt($ch, CURLOPT_URL, $url);
137
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
138
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
139
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
140
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
141
-
142
- if(isset($post_data))
143
- {
144
- curl_setopt($ch, CURLOPT_POST, 1);
145
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
146
- }
147
-
148
- $response = curl_exec($ch);
149
- mo_openid_start_session();
150
-
151
- $this->http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
152
- $this->last_api_call = $url;
153
- curl_close($ch);
154
-
155
- if($post_data != null)
156
- {
157
- return $response;
158
- }
159
- else
160
- {
161
- $dirs = explode('&', $response);
162
- $dirs1 = explode('=', $dirs[0]);
163
- return $dirs1[1];
164
- }
165
-
166
- }
167
-
168
- function get_profile($url, $post_data = null)
169
- {
170
- $ch = curl_init();
171
- curl_setopt($ch, CURLOPT_URL, $url);
172
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
173
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
174
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
175
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
176
-
177
- if(isset($post_data))
178
- {
179
- curl_setopt($ch, CURLOPT_POST, 1);
180
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
181
- }
182
-
183
- $response = curl_exec($ch);
184
- $profile_json_output = json_decode($response, true);
185
-
186
-
187
- return $profile_json_output;
188
- curl_close($ch);
189
- }
190
-
191
- function _urlencode_rfc3986($input)
192
- {
193
- if (is_array($input)) {
194
- return array_map(array('twitter_oauth', '_urlencode_rfc3986'), $input);
195
- }
196
- else if (is_scalar($input)) {
197
- return str_replace('+',' ',str_replace('%7E', '~', rawurlencode($input)));
198
- }
199
- else{
200
- return '';
201
- }
202
- }
203
- }
204
- ?>