Google Authenticator – WordPress Two Factor Authentication (2FA) - Version 5.3.6

Version Description

  • Google Authenticator-Two Factor Authentication (2FA) : Anti virus zip file fix.
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Google Authenticator – WordPress Two Factor Authentication (2FA)
Version 5.3.6
Comparing to
See all releases

Code changes from version 5.3.5 to 5.3.6

Files changed (43) hide show
  1. api/class-customer-setup.php +7 -6
  2. api/class-rba-attributes.php +2 -2
  3. api/class-two-factor-setup.php +2 -2
  4. api/mo2f_api.php +1 -1
  5. controllers/account.php +2 -2
  6. controllers/backup.php +1 -0
  7. controllers/login-security.php +1 -1
  8. controllers/login-spam.php +2 -0
  9. controllers/main_controller.php +1 -1
  10. controllers/scan_malware.php +2 -0
  11. controllers/two_fa_custom_login.php +3 -0
  12. controllers/two_fa_rba.php +3 -0
  13. controllers/two_fa_shortcode.php +3 -0
  14. controllers/waf.php +1 -1
  15. handler/encryption.php +18 -15
  16. handler/feedback_form.php +8 -13
  17. handler/gaonprem.php +10 -6
  18. handler/malware_scanner.php +45 -29
  19. handler/setup_twofa.php +7 -15
  20. handler/two_fa_settings.php +8 -8
  21. helper/curl.php +15 -8
  22. helper/utility.php +21 -0
  23. includes/css/button_styles.css.orig +111 -0
  24. includes/css/twofa_style_settings.css.orig +976 -0
  25. includes/images/Admin_Custom_Login.png +0 -0
  26. includes/images/Custom_Login_Page_Customizer_LoginPress.png +0 -0
  27. includes/images/RegistrationMagic_Custom_Registration_Forms_and_User_Login.png +0 -0
  28. includes/images/theme_my_login.png +0 -0
  29. includes/images/ultimate_member.png +0 -0
  30. includes/images/user_registration.png +0 -0
  31. includes/images/woocommerce.png +0 -0
  32. includes/jquery-qrcode/README.md.orig +40 -0
  33. includes/jquery-qrcode/jquery-qrcode.js.orig +2332 -0
  34. includes/jquery-qrcode/jquery-qrcode.min.js.orig +2 -0
  35. miniorange_2_factor_settings.php +2 -2
  36. readme.txt +7 -1
  37. uninstall.php +6 -0
  38. views/feedback_form.php +0 -1
  39. views/two_fa.php +49 -11
  40. views/two_fa_custom_form.php +8 -8
  41. views/two_fa_custom_login.php +157 -0
  42. views/two_fa_rba.php +179 -0
  43. views/two_fa_shortcode.php +51 -0
api/class-customer-setup.php CHANGED
@@ -109,7 +109,7 @@ class Customer_Setup {
109
  function create_customer() {
110
  global $Mo2fdbQueries;
111
  if ( ! MO2f_Utility::is_curl_installed() ) {
112
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
113
 
114
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
115
  }
@@ -142,7 +142,7 @@ class Customer_Setup {
142
 
143
  function get_customer_key() {
144
  if ( ! MO2f_Utility::is_curl_installed() ) {
145
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
146
 
147
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
148
  }
@@ -168,7 +168,7 @@ class Customer_Setup {
168
 
169
  function send_otp_token( $uKey, $authType, $cKey, $apiKey ) {
170
  if ( ! MO2f_Utility::is_curl_installed() ) {
171
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
172
 
173
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
174
  }
@@ -260,7 +260,7 @@ class Customer_Setup {
260
 
261
  function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey ) {
262
  if ( ! MO2f_Utility::is_curl_installed() ) {
263
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
264
 
265
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
266
  }
@@ -321,7 +321,7 @@ class Customer_Setup {
321
 
322
  function submit_contact_us( $q_email, $q_phone, $query ) {
323
  if ( ! MO2f_Utility::is_curl_installed() ) {
324
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
325
 
326
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
327
  }
@@ -340,8 +340,9 @@ class Customer_Setup {
340
  } else if ( $is_nc_with_1_user ) {
341
  $customer_feature = "V3";
342
  }
 
343
 
344
- $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $query;
345
  $fields = array(
346
  'firstName' => $user->user_firstname,
347
  'lastName' => $user->user_lastname,
109
  function create_customer() {
110
  global $Mo2fdbQueries;
111
  if ( ! MO2f_Utility::is_curl_installed() ) {
112
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
113
 
114
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
115
  }
142
 
143
  function get_customer_key() {
144
  if ( ! MO2f_Utility::is_curl_installed() ) {
145
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
146
 
147
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
148
  }
168
 
169
  function send_otp_token( $uKey, $authType, $cKey, $apiKey ) {
170
  if ( ! MO2f_Utility::is_curl_installed() ) {
171
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
172
 
173
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
174
  }
260
 
261
  function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey ) {
262
  if ( ! MO2f_Utility::is_curl_installed() ) {
263
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
264
 
265
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
266
  }
321
 
322
  function submit_contact_us( $q_email, $q_phone, $query ) {
323
  if ( ! MO2f_Utility::is_curl_installed() ) {
324
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
325
 
326
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
327
  }
340
  } else if ( $is_nc_with_1_user ) {
341
  $customer_feature = "V3";
342
  }
343
+ global $moWpnsUtility;
344
 
345
+ $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
346
  $fields = array(
347
  'firstName' => $user->user_firstname,
348
  'lastName' => $user->user_lastname,
api/class-rba-attributes.php CHANGED
@@ -47,10 +47,10 @@ class Miniorange_Rba_Attributes {
47
 
48
  function get_curl_error_message() {
49
  $message = mo2f_lt( 'Please enable curl extension.' ) .
50
- ' <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">' .
51
  mo2f_lt( 'Click here' ) .
52
  ' </a> ' .
53
- mo2f_lt( 'for the steps to enable curl or check Help & Troubleshooting.' );
54
 
55
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
56
  }
47
 
48
  function get_curl_error_message() {
49
  $message = mo2f_lt( 'Please enable curl extension.' ) .
50
+ ' <a href="admin.php?page=mo_2fa_troubleshooting">' .
51
  mo2f_lt( 'Click here' ) .
52
  ' </a> ' .
53
+ mo2f_lt( 'for the steps to enable curl.' );
54
 
55
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
56
  }
api/class-two-factor-setup.php CHANGED
@@ -49,10 +49,10 @@ class Two_Factor_Setup {
49
 
50
  function get_curl_error_message() {
51
  $message = mo2f_lt( 'Please enable curl extension.' ) .
52
- ' <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">' .
53
  mo2f_lt( 'Click here' ) .
54
  ' </a> ' .
55
- mo2f_lt( 'for the steps to enable curl or check Help & Troubleshooting.' );
56
 
57
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
58
  }
49
 
50
  function get_curl_error_message() {
51
  $message = mo2f_lt( 'Please enable curl extension.' ) .
52
+ ' <a href="admin.php?page=mo_2fa_troubleshooting">' .
53
  mo2f_lt( 'Click here' ) .
54
  ' </a> ' .
55
+ mo2f_lt( 'for the steps to enable curl.' );
56
 
57
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
58
  }
api/mo2f_api.php CHANGED
@@ -8,7 +8,7 @@ class Mo2f_Api
8
  if(!is_wp_error($response)){
9
  return $response['body'];
10
  } else {
11
- $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
12
 
13
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
14
  }
8
  if(!is_wp_error($response)){
9
  return $response['body'];
10
  } else {
11
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
12
 
13
  return json_encode( array( "status" => 'ERROR', "message" => $message ) );
14
  }
controllers/account.php CHANGED
@@ -261,14 +261,14 @@
261
  if ( $configured_2FA_method != 'NONE' && get_option( 'mo2f_is_NC' ) == 0 ) {
262
  $mo2f_message .= ' <b>' . $configured_2FA_method . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . '. ';
263
  }
264
- $mo2f_message .= '<a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" );
265
 
266
  delete_user_meta( $user->ID, 'register_account' );
267
 
268
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
269
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
270
  delete_option( 'mo2f_customer_selected_plan' );
271
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_pricing' );
272
  } else if ( $mo2f_second_factor == 'NONE' ) {
273
  if(get_user_meta( $user->ID, 'register_account_popup', true)){
274
  update_user_meta( $user->ID, 'configure_2FA', 1 );
261
  if ( $configured_2FA_method != 'NONE' && get_option( 'mo2f_is_NC' ) == 0 ) {
262
  $mo2f_message .= ' <b>' . $configured_2FA_method . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . '. ';
263
  }
264
+ $mo2f_message .= '<a href=\"admin.php?page=mo_2fa_two_fa\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" );
265
 
266
  delete_user_meta( $user->ID, 'register_account' );
267
 
268
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
269
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
270
  delete_option( 'mo2f_customer_selected_plan' );
271
+ header( 'Location: admin.php?page=mo_2fa_upgrade' );
272
  } else if ( $mo2f_second_factor == 'NONE' ) {
273
  if(get_user_meta( $user->ID, 'register_account_popup', true)){
274
  update_user_meta( $user->ID, 'configure_2FA', 1 );
controllers/backup.php CHANGED
@@ -8,6 +8,7 @@ $message = '<div id=\'backupmessage\'><h2>DO NOT :</h2><ol><li>Close this brow
8
  $message2a = 'Database Backup is Completed. Check <b><i>';
9
  $message2b = '</i></b>file in db-backups folder.';
10
 
 
11
 
12
  if(current_user_can( 'manage_options' ) && isset($_POST['option']))
13
  {
8
  $message2a = 'Database Backup is Completed. Check <b><i>';
9
  $message2b = '</i></b>file in db-backups folder.';
10
 
11
+ update_site_option('mo2f_visit_backup',true);
12
 
13
  if(current_user_can( 'manage_options' ) && isset($_POST['option']))
14
  {
controllers/login-security.php CHANGED
@@ -3,7 +3,7 @@
3
  global $moWpnsUtility,$dirName;
4
 
5
  $twofactor_url = add_query_arg(
6
- array('page' => 'miniOrange_2_factor_settings', 'tab'=>'mobile_configure')
7
  , $_SERVER['REQUEST_URI']
8
  );
9
 
3
  global $moWpnsUtility,$dirName;
4
 
5
  $twofactor_url = add_query_arg(
6
+ array('page' => 'mo_2fa_two_fa')
7
  , $_SERVER['REQUEST_URI']
8
  );
9
 
controllers/login-spam.php CHANGED
@@ -5,5 +5,7 @@ if( isset( $_GET[ 'tab' ] ) ) {
5
  } else {
6
  $active_tab = 'default';
7
  }
 
 
8
  include_once $dirName . 'views'.DIRECTORY_SEPARATOR.'login_spam.php';
9
  ?>
5
  } else {
6
  $active_tab = 'default';
7
  }
8
+ update_site_option('mo2f_visit_login_and_spam',true);
9
+
10
  include_once $dirName . 'views'.DIRECTORY_SEPARATOR.'login_spam.php';
11
  ?>
controllers/main_controller.php CHANGED
@@ -13,7 +13,7 @@
13
  switch($_GET['page'])
14
  {
15
  case 'mo_2fa_dashboard':
16
- include $controller . 'dashboard.php'; break;
17
  case 'mo_2fa_login_and_spam':
18
  include $controller . 'login-spam.php'; break;
19
  case 'default':
13
  switch($_GET['page'])
14
  {
15
  case 'mo_2fa_dashboard':
16
+ include $controller . 'dashboard.php'; break;
17
  case 'mo_2fa_login_and_spam':
18
  include $controller . 'login-spam.php'; break;
19
  case 'default':
controllers/scan_malware.php CHANGED
@@ -6,6 +6,8 @@ if(!get_option( 'mo_wpns_scan_files_extensions'))
6
  update_option( 'mo_wpns_scan_files_extensions','php');
7
  add_option('mo_wpns_skip_folders');
8
 
 
 
9
  include_once $dirName . 'views'.DIRECTORY_SEPARATOR.'malware_scan.php';
10
  ?>
11
 
6
  update_option( 'mo_wpns_scan_files_extensions','php');
7
  add_option('mo_wpns_skip_folders');
8
 
9
+ update_site_option('mo2f_visit_malware',true);
10
+
11
  include_once $dirName . 'views'.DIRECTORY_SEPARATOR.'malware_scan.php';
12
  ?>
13
 
controllers/two_fa_custom_login.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ include $dirName . 'views'.DIRECTORY_SEPARATOR.'two_fa_custom_login.php';
controllers/two_fa_rba.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ include $dirName . 'views'.DIRECTORY_SEPARATOR.'two_fa_rba.php';
controllers/two_fa_shortcode.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ include $dirName . 'views'.DIRECTORY_SEPARATOR.'two_fa_shortcode.php';
controllers/waf.php CHANGED
@@ -33,7 +33,7 @@
33
  {
34
  $totalAttacks = strval(intval($totalAttacks/1000)).'k+';
35
  }
36
-
37
 
38
  include $dirName . 'views'.DIRECTORY_SEPARATOR.'waf.php';
39
 
33
  {
34
  $totalAttacks = strval(intval($totalAttacks/1000)).'k+';
35
  }
36
+ update_site_option('mo2f_visit_waf',true);
37
 
38
  include $dirName . 'views'.DIRECTORY_SEPARATOR.'waf.php';
39
 
handler/encryption.php CHANGED
@@ -14,13 +14,14 @@ class mo2f_GAuth_AESEncryption {
14
  * @param string $data - the key=value pairs separated with &
15
  * @return string
16
  */
17
- public static function encrypt_data($data, $key) {
18
- $key = openssl_digest($key, 'sha256');
19
- $method = 'AES-128-ECB';
20
- $ivSize = openssl_cipher_iv_length($method);
21
- $iv = openssl_random_pseudo_bytes($ivSize);
22
- $strCrypt = openssl_encrypt ($data, $method, $key,OPENSSL_RAW_DATA||OPENSSL_ZERO_PADDING, $iv);
23
- return base64_encode($strCrypt);
 
24
  }
25
 
26
 
@@ -29,15 +30,17 @@ class mo2f_GAuth_AESEncryption {
29
  * @return string
30
  */
31
  public static function decrypt_data($data, $key) {
32
- $strIn = base64_decode($data) ;
33
- $key = openssl_digest($key, 'sha256');
34
- $method = 'AES-128-ECB';
35
- $ivSize = openssl_cipher_iv_length($method);
36
- $iv = substr($strIn,0,$ivSize);
37
- $data = substr($strIn,$ivSize);
38
- $clear = openssl_decrypt ($data, $method, $key, OPENSSL_RAW_DATA||OPENSSL_ZERO_PADDING, $iv);
 
 
39
 
40
- return $clear;
41
  }
42
 
43
  }
14
  * @param string $data - the key=value pairs separated with &
15
  * @return string
16
  */
17
+ public static function encrypt_data_ga($data, $key) {
18
+ $plaintext = $data;
19
+ $ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
20
+ $iv = openssl_random_pseudo_bytes($ivlen);
21
+ $ciphertext_raw = openssl_encrypt($plaintext, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
22
+ $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
23
+ $ciphertext = base64_encode( $iv.$hmac.$ciphertext_raw );
24
+ return $ciphertext;
25
  }
26
 
27
 
30
  * @return string
31
  */
32
  public static function decrypt_data($data, $key) {
33
+
34
+ $c = base64_decode($data);
35
+ $ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
36
+ $iv = substr($c, 0, $ivlen);
37
+ $hmac = substr($c, $ivlen, $sha2len=32);
38
+ $ciphertext_raw = substr($c, $ivlen+$sha2len);
39
+ $original_plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
40
+ $calcmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
41
+
42
 
43
+ return $original_plaintext;
44
  }
45
 
46
  }
handler/feedback_form.php CHANGED
@@ -13,25 +13,19 @@ class FeedbackHandler
13
 
14
  if (current_user_can('manage_options') && isset($_POST['option'])) {
15
  switch ($_REQUEST['option']) {
16
- case "mo_wpns_skip_feedback":
17
- $this->wpns_handle_skip_feedback($_POST); break;
18
- case "mo_wpns_feedback":
19
- $this->wpns_handle_feedback($_POST); break;
20
 
21
  }
22
  }
23
  }
24
 
25
- function wpns_handle_skip_feedback($postdata){
26
- do_action('wpns_show_message',MoWpnsMessages::showMessage('FEEDBACK'),'CUSTOM_MESSAGE');
27
- deactivate_plugins( dirname(dirname(__FILE__ ))."\\miniorange_2_factor_settings.php");
28
- }
29
 
30
  function wpns_handle_feedback($postdata)
31
  {
32
-
33
  $user = wp_get_current_user();
34
-
35
  $message = 'Plugin Deactivated';
36
 
37
  $deactivate_reason_message = array_key_exists('wpns_query_feedback', $_POST) ? htmlspecialchars($_POST['wpns_query_feedback']) : false;
@@ -53,10 +47,11 @@ class FeedbackHandler
53
 
54
  if (isset($_POST['rate']))
55
  $rate_value = htmlspecialchars($_POST['rate']);
56
-
 
57
  $message .= ', [Rating :' . $rate_value . ']';
58
 
59
- $email = $_POST['query_mail'];
60
  if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
61
  $email = get_option('mo2f_email');
62
  if (empty($email))
@@ -70,7 +65,7 @@ class FeedbackHandler
70
  deactivate_plugins(dirname(dirname(__FILE__ ))."\\miniorange_2_factor_settings.php");
71
  wp_redirect('plugins.php');
72
  } else {
73
- $submited = json_decode($feedback_reasons->send_email_alert($email, $phone, $message), true);
74
  if (json_last_error() == JSON_ERROR_NONE) {
75
  if (is_array($submited) && array_key_exists('status', $submited) && $submited['status'] == 'ERROR') {
76
  do_action('wpns_show_message',$submited['message'],'ERROR');
13
 
14
  if (current_user_can('manage_options') && isset($_POST['option'])) {
15
  switch ($_REQUEST['option']) {
16
+ case "mo_wpns_skip_feedback":
17
+ case "mo_wpns_feedback":
18
+ $this->wpns_handle_feedback($_POST); break;
 
19
 
20
  }
21
  }
22
  }
23
 
 
 
 
 
24
 
25
  function wpns_handle_feedback($postdata)
26
  {
 
27
  $user = wp_get_current_user();
28
+ $feedback_option = $_POST['option'];
29
  $message = 'Plugin Deactivated';
30
 
31
  $deactivate_reason_message = array_key_exists('wpns_query_feedback', $_POST) ? htmlspecialchars($_POST['wpns_query_feedback']) : false;
47
 
48
  if (isset($_POST['rate']))
49
  $rate_value = htmlspecialchars($_POST['rate']);
50
+ else
51
+ $rate_value = "--";
52
  $message .= ', [Rating :' . $rate_value . ']';
53
 
54
+ $email = isset($_POST['query_mail'])? $_POST['query_mail']: '';
55
  if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
56
  $email = get_option('mo2f_email');
57
  if (empty($email))
65
  deactivate_plugins(dirname(dirname(__FILE__ ))."\\miniorange_2_factor_settings.php");
66
  wp_redirect('plugins.php');
67
  } else {
68
+ $submited = json_decode($feedback_reasons->send_email_alert($email, $phone, $message, $feedback_option), true);
69
  if (json_last_error() == JSON_ERROR_NONE) {
70
  if (is_array($submited) && array_key_exists('status', $submited) && $submited['status'] == 'ERROR') {
71
  do_action('wpns_show_message',$submited['message'],'ERROR');
handler/gaonprem.php CHANGED
@@ -10,15 +10,19 @@ class Google_auth_onpremise{
10
  {
11
  $user=wp_get_current_user();
12
  $user_id=$user->ID;
13
- $secret = $this->createSecret();
14
- $this->mo_GAuth_set_secret($user_id,$secret);
 
 
 
 
15
  $issuer=get_option('mo2f_google_appname', 'miniOrangeAuth');
16
  $email=$user->user_email;
17
 
18
- $otpcode=$this->getCode($secret);
19
 
20
- $url=$this->geturl($secret,$issuer,$email);
21
- mo2f_configure_google_authenticator_onprem( $secret,$url,$otpcode );
22
 
23
  }
24
 
@@ -26,7 +30,7 @@ class Google_auth_onpremise{
26
  global $Mo2fdbQueries;
27
  $key=$this->random_str(8);
28
  update_user_meta( $user_id, 'mo2f_get_auth_rnd_string', $key);
29
- $secret=mo2f_GAuth_AESEncryption::encrypt_data($secret,$key);
30
  update_user_meta( $user_id, 'mo2f_gauth_key', $secret);
31
  }
32
 
10
  {
11
  $user=wp_get_current_user();
12
  $user_id=$user->ID;
13
+ if(!isset($_SESSION)){
14
+ session_start();
15
+ }
16
+ if(!isset($_SESSION['secret_ga'])){
17
+ $_SESSION['secret_ga'] = $this->createSecret();
18
+ }
19
  $issuer=get_option('mo2f_google_appname', 'miniOrangeAuth');
20
  $email=$user->user_email;
21
 
22
+ $otpcode=$this->getCode($_SESSION['secret_ga']);
23
 
24
+ $url=$this->geturl($_SESSION['secret_ga'] ,$issuer,$email);
25
+ mo2f_configure_google_authenticator_onprem( $_SESSION['secret_ga'] ,$url,$otpcode );
26
 
27
  }
28
 
30
  global $Mo2fdbQueries;
31
  $key=$this->random_str(8);
32
  update_user_meta( $user_id, 'mo2f_get_auth_rnd_string', $key);
33
+ $secret=mo2f_GAuth_AESEncryption::encrypt_data_ga($secret,$key);
34
  update_user_meta( $user_id, 'mo2f_gauth_key', $secret);
35
  }
36
 
handler/malware_scanner.php CHANGED
@@ -197,7 +197,17 @@ class Mo_wpns_Scan_Handler{
197
  $plugin_repo_files=array();
198
  $theme_repo_files=array();
199
  $scanresults=array();
200
- $extensions=['php'];
 
 
 
 
 
 
 
 
 
 
201
  $mo2f_malware_db_handler = new MoWpnsDB();
202
 
203
  $folder_paths=array();
@@ -213,9 +223,9 @@ class Mo_wpns_Scan_Handler{
213
  if ($item->isFile()) {
214
  $scanresult=array();
215
  $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
216
- if ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && in_array(explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0], $wp_default_themes)){
217
  continue;
218
- } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && in_array(explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0], $wp_default_plugins)){
219
  continue;
220
  } elseif ($value == $base && ($scan_config['core_scan'] == 1)){
221
  if(count(explode('wp-content'.DIRECTORY_SEPARATOR, $iterator->getSubPathName()))>1){
@@ -253,10 +263,12 @@ class Mo_wpns_Scan_Handler{
253
  array_push($theme_repo_files, $iterator->getSubPathName());
254
  $repo_file_path=$repo_path . DIRECTORY_SEPARATOR . 'themes';
255
  }
256
- $issues = $this->check_with_repo_files($file_content, $repo_file_path.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
257
- if(!empty($issues)){
258
- $scanresult['repo']=$issues;
259
- }
 
 
260
  }
261
 
262
  $hash_of_file= md5_file($source_file_path);
@@ -264,28 +276,32 @@ class Mo_wpns_Scan_Handler{
264
  if($res){}
265
  else{
266
  $flag_update=0;
267
- if(($scan_config['check_vulnerable'] == 1) || ($scan_config['check_sql'] == 1)){
268
- $contents = file_get_contents($source_file_path);
269
- $result = array();
270
- error_log("File Path " .print_r($source_file_path,true));
271
- $result = $this->check_vulnerable_code($contents);
272
- error_log("Scan Completely ");
273
- if(!empty($result)){
274
- $flag_update=1;
275
- foreach ($result as $index => $type_inf) {
276
- if($type_inf['i'] == 'vlc'){
277
- $scanresult['Vulnerable Code'] = $result;
278
- }else if($type_inf['i'] == 'shc'){
279
- $scanresult['Shell Script'] = $result;
280
- }else if($type_inf['i'] == 'sqc'){
281
- $scanresult['SQL Injection'] = $result;
 
 
 
 
 
 
 
282
  }
283
  }
284
- }
285
- }
286
- $ext = pathinfo($source_file_path, PATHINFO_EXTENSION);
287
- if(in_array($ext,$extensions)){
288
-
289
  if($scan_config['ext_link_check'] == 1){
290
  $elresult= $this->check_external_link($file_content);
291
  if(!empty($elresult)){
@@ -394,7 +410,7 @@ class Mo_wpns_Scan_Handler{
394
  if(!empty($issue))
395
  $issues[] = $issue;
396
  } else if(in_array(token_name($token[0]), array("T_STRING"))){
397
- if(in_array($token[1],array("fopen","popen","fsockopen","file_get_contents"))){
398
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", true);
399
  if(!empty($issue))
400
  $issues[] = $issue;
@@ -406,7 +422,7 @@ class Mo_wpns_Scan_Handler{
406
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "shc", false);
407
  if(!empty($issue))
408
  $issues[] = $issue;
409
- } else if(in_array($token[1],array("mysqli","mysql_connect","mysqli_connect","mysqli_real_connect","PDO"))){
410
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "sqc", false);
411
  if(!empty($issue))
412
  $issues[] = $issue;
197
  $plugin_repo_files=array();
198
  $theme_repo_files=array();
199
  $scanresults=array();
200
+ $file_ext = get_option('mo_wpns_scan_files_extensions');
201
+ $extensions = array();
202
+ if(empty($file_ext)){
203
+ $extensions = ['php'];
204
+ }else{
205
+ if(strpos($file_ext,';') !=false){
206
+ $extensions= explode(";",$file_ext);
207
+ }else{
208
+ $extensions= $file_ext;
209
+ }
210
+ }
211
  $mo2f_malware_db_handler = new MoWpnsDB();
212
 
213
  $folder_paths=array();
223
  if ($item->isFile()) {
224
  $scanresult=array();
225
  $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
226
+ if ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && in_array(explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0], $wp_default_plugins)){
227
  continue;
228
+ } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && in_array(explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0], $wp_default_themes)){
229
  continue;
230
  } elseif ($value == $base && ($scan_config['core_scan'] == 1)){
231
  if(count(explode('wp-content'.DIRECTORY_SEPARATOR, $iterator->getSubPathName()))>1){
263
  array_push($theme_repo_files, $iterator->getSubPathName());
264
  $repo_file_path=$repo_path . DIRECTORY_SEPARATOR . 'themes';
265
  }
266
+ if(! strpos($source_file_path, '.zip')){
267
+ $issues = $this->check_with_repo_files($file_content, $repo_file_path.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
268
+ if(!empty($issues)){
269
+ $scanresult['repo']=$issues;
270
+ }
271
+ }
272
  }
273
 
274
  $hash_of_file= md5_file($source_file_path);
276
  if($res){}
277
  else{
278
  $flag_update=0;
279
+ $getext=pathinfo($source_file_path, PATHINFO_EXTENSION);
280
+
281
+ $ext['0']=$getext;
282
+
283
+ if(in_array($extensions,$ext) && $ext != 'zip'){
284
+
285
+
286
+ if(($scan_config['check_vulnerable'] == 1) || ($scan_config['check_sql'] == 1)){
287
+ $contents = file_get_contents($source_file_path);
288
+ $result = array();
289
+ $result = $this->check_vulnerable_code($contents);
290
+ if(!empty($result)){
291
+
292
+ $flag_update=1;
293
+ foreach ($result as $index => $type_inf) {
294
+ if($type_inf['i'] == 'vlc'){
295
+ $scanresult['Vulnerable Code'] = $result;
296
+ }else if($type_inf['i'] == 'shc'){
297
+ $scanresult['Shell Script'] = $result;
298
+ }else if($type_inf['i'] == 'sqc'){
299
+ $scanresult['SQL Injection'] = $result;
300
+ }
301
  }
302
  }
303
+ }
304
+
 
 
 
305
  if($scan_config['ext_link_check'] == 1){
306
  $elresult= $this->check_external_link($file_content);
307
  if(!empty($elresult)){
410
  if(!empty($issue))
411
  $issues[] = $issue;
412
  } else if(in_array(token_name($token[0]), array("T_STRING"))){
413
+ if(in_array($token[1],array("popen","fsockopen"))){
414
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", true);
415
  if(!empty($issue))
416
  $issues[] = $issue;
422
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "shc", false);
423
  if(!empty($issue))
424
  $issues[] = $issue;
425
+ } else if(in_array($token[1],array("mysql_connect","mysqli_connect","mysqli_real_connect","PDO"))){
426
  $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "sqc", false);
427
  if(!empty($issue))
428
  $issues[] = $issue;
handler/setup_twofa.php CHANGED
@@ -162,7 +162,7 @@
162
  $form .= $is_auth_method_selected ? '#48b74b' : '#20b2aa';
163
 
164
  $form .= ';color:white">';
165
- $check = !$is_customer_registered? true : $auth_method != "Email Verification"? true : false;
166
  if ( $check ) {
167
  $form .= '<div class="mo2f_configure_2_factor">
168
  <button type="button" id="'.$auth_method_abr.'_configuration" class="mo2f_configure_set_2_factor" onclick="configureOrSet2ndFactor_' . $category . '(\'' . $auth_method_abr . '\', \'configure2factor\');"';
@@ -461,12 +461,8 @@ function mo2f_rba_description($mo2f_user_email) {?>
461
  <a onclick="mo2f_addonform('wp_2fa_addon_rba')" id="mo2f_purchase_rba_addon"
462
  class="mo_wpns_button mo_wpns_button1"
463
  style="float:right;"><?php echo __( 'Purchase', 'miniorange-2-factor-authentication' ); ?></a><?php } ?>
464
- <div id="mo2f_rba_addon_hide"><h3 id="toggle_rba_description"
465
- class="mo2f_pointer"><?php echo __( 'Description', 'miniorange-2-factor-authentication' ); ?> </h3>
466
- <p id="rba_description" style="margin:2% 2% 2% 4%">
467
- <?php echo __( 'This Add-On helps you in remembering the device, in which case you will not be prompted for the 2-factor authentication
468
- if you login from the remembered device again. You can also decide the number of devices that can be remembered. Users can also be restricted access to the site based on the IP address they are logging in from.', 'miniorange-2-factor-authentication' ); ?>
469
- </p>
470
  <br>
471
  <div id="mo2f_hide_rba_content">
472
 
@@ -530,10 +526,8 @@ function mo2f_personalization_description($mo2f_user_email) {?>
530
  style="float:right;"><?php echo __( 'Purchase', 'miniorange-2-factor-authentication' ); ?></a>
531
  <?php } ?>
532
  <div id="mo2f_custom_addon_hide">
533
- <h3 id="toggle_personalization_description" class="mo2f_pointer"><?php echo __( 'Description', 'miniorange-2-factor-authentication' ); ?> </h3>
534
- <p id="custom_description" style="margin:2% 2% 2% 4%">
535
- <?php echo __( 'This Add-On helps you modify and redesign the login screen\'s UI, and various customizations in the plugin dashboard. Along with customizing the plugin Icon and name, you can also customize the email and sms templates you and your users receive during authentication.', 'miniorange-2-factor-authentication' ); ?>
536
- </p>
537
  <br>
538
  <div id="mo2f_hide_custom_content">
539
  <div class="mo2f_box">
@@ -588,10 +582,8 @@ function mo2f_shortcode_description($mo2f_user_email) { ?>
588
  <?php } ?>
589
 
590
  <div id="shortcode" class="description">
591
- <h3 id="toggle_shortcode_description" class="mo2f_pointer"><?php echo __( 'Description ', 'miniorange-2-factor-authentication' ); ?></h3>
592
- <p id="shortcode_description" style="margin:2% 2% 2% 4%">
593
- <?php echo __( 'A shortcode is a WordPress-specific code that lets you do things with very little effort. Shortcodes can embed ugly code in just one line. You can use these shortcodes on any custom page. Just include the shortcode on your page and boom!', 'miniorange-2-factor-authentication' ); ?>
594
- </p>
595
  <br>
596
  <div id="mo2f_hide_shortcode_content" class="mo2f_box">
597
  <h3><?php echo __( 'List of Shortcodes', 'miniorange-2-factor-authentication' ); ?>:</h3>
162
  $form .= $is_auth_method_selected ? '#48b74b' : '#20b2aa';
163
 
164
  $form .= ';color:white">';
165
+ $check = !$is_customer_registered? true : ($auth_method != "Email Verification"? true : false);
166
  if ( $check ) {
167
  $form .= '<div class="mo2f_configure_2_factor">
168
  <button type="button" id="'.$auth_method_abr.'_configuration" class="mo2f_configure_set_2_factor" onclick="configureOrSet2ndFactor_' . $category . '(\'' . $auth_method_abr . '\', \'configure2factor\');"';
461
  <a onclick="mo2f_addonform('wp_2fa_addon_rba')" id="mo2f_purchase_rba_addon"
462
  class="mo_wpns_button mo_wpns_button1"
463
  style="float:right;"><?php echo __( 'Purchase', 'miniorange-2-factor-authentication' ); ?></a><?php } ?>
464
+ <div id="mo2f_rba_addon_hide">
465
+
 
 
 
 
466
  <br>
467
  <div id="mo2f_hide_rba_content">
468
 
526
  style="float:right;"><?php echo __( 'Purchase', 'miniorange-2-factor-authentication' ); ?></a>
527
  <?php } ?>
528
  <div id="mo2f_custom_addon_hide">
529
+
530
+
 
 
531
  <br>
532
  <div id="mo2f_hide_custom_content">
533
  <div class="mo2f_box">
582
  <?php } ?>
583
 
584
  <div id="shortcode" class="description">
585
+
586
+
 
 
587
  <br>
588
  <div id="mo2f_hide_shortcode_content" class="mo2f_box">
589
  <h3><?php echo __( 'List of Shortcodes', 'miniorange-2-factor-authentication' ); ?>:</h3>
handler/two_fa_settings.php CHANGED
@@ -290,7 +290,7 @@ class Miniorange_Authentication {
290
  if ( $selected_2_Factor_method == 'NONE' ) {
291
  if ( get_option( 'mo2f_enable_2fa_for_users' ) || ( current_user_can( 'manage_options' ) && get_option( 'mo2f_miniorange_admin' ) == $user->ID ) ) {
292
  echo '<div class="is-dismissible notice notice-warning"><p><b>' . mo2f_lt( "miniOrange 2-Factor Plugin: " ) . '</b>' . mo2f_lt( 'You have not configured your 2-factor authentication method yet.' ) .
293
- '<a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">' . mo2f_lt( ' Click here' ) . '</a>' . mo2f_lt( ' to set it up.' ) .
294
  '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' . mo2f_lt( 'Dismiss this notice.' ) . '</span></button></div>';
295
  }
296
  }
@@ -670,14 +670,14 @@ class Miniorange_Authentication {
670
  if ( $configured_2FA_method != 'NONE' && get_option( 'mo2f_is_NC' ) == 0 ) {
671
  $mo2f_message .= ' <b>' . $configured_2FA_method . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . '.';
672
  }
673
- $mo2f_message .= ' ' . '<a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" );
674
 
675
  delete_user_meta( $user->ID, 'register_account_popup' );
676
 
677
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
678
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
679
  delete_option( 'mo2f_customer_selected_plan' );
680
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_pricing' );
681
  } else if ( $mo2f_second_factor == 'NONE' ) {
682
  update_user_meta( $user->ID, 'configure_2FA', 1 );
683
  }
@@ -2332,7 +2332,7 @@ class Miniorange_Authentication {
2332
  $enduser = new Two_Factor_Setup();
2333
  $enduser->mo2f_update_userinfo( $email, 'OUT OF BAND EMAIL', null, 'API_2FA', true );
2334
 
2335
- update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ACCOUNT_RETRIEVED_SUCCESSFULLY" ) . ' <b>' . Mo2fConstants:: langTranslate( "EMAIL_VERFI" ) . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . ' <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" ) );
2336
  $this->mo_auth_show_success_message();
2337
  } else {
2338
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_CREATE_ACC_OTP" ) );
@@ -2386,9 +2386,9 @@ class Miniorange_Authentication {
2386
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
2387
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
2388
  delete_option( 'mo2f_customer_selected_plan' );
2389
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_pricing' );
2390
  } else {
2391
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mobile_configure' );
2392
  }
2393
 
2394
  } else {
@@ -2459,7 +2459,7 @@ class Miniorange_Authentication {
2459
  $message = Mo2fConstants:: langTranslate( "REGISTRATION_SUCCESS" );
2460
  update_option( 'mo2f_message', $message );
2461
  $this->mo_auth_show_success_message();
2462
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mobile_configure' );
2463
 
2464
  } else if ( strcasecmp( $check_user['status'], 'USER_NOT_FOUND' ) == 0 ) {
2465
  $content = json_decode( $enduser->mo_create_user( $user, $email ), true );
@@ -2480,7 +2480,7 @@ class Miniorange_Authentication {
2480
  $message = Mo2fConstants:: langTranslate( "REGISTRATION_SUCCESS" );
2481
  update_option( 'mo2f_message', $message );
2482
  $this->mo_auth_show_success_message();
2483
- header( 'Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mobile_configure' );
2484
 
2485
  } else {
2486
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_USER_REGISTRATION" ) );
290
  if ( $selected_2_Factor_method == 'NONE' ) {
291
  if ( get_option( 'mo2f_enable_2fa_for_users' ) || ( current_user_can( 'manage_options' ) && get_option( 'mo2f_miniorange_admin' ) == $user->ID ) ) {
292
  echo '<div class="is-dismissible notice notice-warning"><p><b>' . mo2f_lt( "miniOrange 2-Factor Plugin: " ) . '</b>' . mo2f_lt( 'You have not configured your 2-factor authentication method yet.' ) .
293
+ '<a href="admin.php?page=mo_2fa_two_fa">' . mo2f_lt( ' Click here' ) . '</a>' . mo2f_lt( ' to set it up.' ) .
294
  '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' . mo2f_lt( 'Dismiss this notice.' ) . '</span></button></div>';
295
  }
296
  }
670
  if ( $configured_2FA_method != 'NONE' && get_option( 'mo2f_is_NC' ) == 0 ) {
671
  $mo2f_message .= ' <b>' . $configured_2FA_method . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . '.';
672
  }
673
+ $mo2f_message .= ' ' . '<a href=\"admin.php?page=mo_2fa_two_fa\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" );
674
 
675
  delete_user_meta( $user->ID, 'register_account_popup' );
676
 
677
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
678
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
679
  delete_option( 'mo2f_customer_selected_plan' );
680
+ header( 'Location: admin.php?page=mo_2fa_upgrade' );
681
  } else if ( $mo2f_second_factor == 'NONE' ) {
682
  update_user_meta( $user->ID, 'configure_2FA', 1 );
683
  }
2332
  $enduser = new Two_Factor_Setup();
2333
  $enduser->mo2f_update_userinfo( $email, 'OUT OF BAND EMAIL', null, 'API_2FA', true );
2334
 
2335
+ update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ACCOUNT_RETRIEVED_SUCCESSFULLY" ) . ' <b>' . Mo2fConstants:: langTranslate( "EMAIL_VERFI" ) . '</b> ' . Mo2fConstants:: langTranslate( "DEFAULT_2ND_FACTOR" ) . ' <a href=\"admin.php?page=mo_2fa_two_fa\" >' . Mo2fConstants:: langTranslate( "CLICK_HERE" ) . '</a> ' . Mo2fConstants:: langTranslate( "CONFIGURE_2FA" ) );
2336
  $this->mo_auth_show_success_message();
2337
  } else {
2338
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_CREATE_ACC_OTP" ) );
2386
  $mo2f_customer_selected_plan = get_option( 'mo2f_customer_selected_plan' );
2387
  if ( ! empty( $mo2f_customer_selected_plan ) ) {
2388
  delete_option( 'mo2f_customer_selected_plan' );
2389
+ header( 'Location: admin.php?page=mo_2fa_upgrade' );
2390
  } else {
2391
+ header( 'Location: admin.php?page=mo_2fa_two_fa' );
2392
  }
2393
 
2394
  } else {
2459
  $message = Mo2fConstants:: langTranslate( "REGISTRATION_SUCCESS" );
2460
  update_option( 'mo2f_message', $message );
2461
  $this->mo_auth_show_success_message();
2462
+ header( 'Location: admin.php?page=mo_2fa_two_fa' );
2463
 
2464
  } else if ( strcasecmp( $check_user['status'], 'USER_NOT_FOUND' ) == 0 ) {
2465
  $content = json_decode( $enduser->mo_create_user( $user, $email ), true );
2480
  $message = Mo2fConstants:: langTranslate( "REGISTRATION_SUCCESS" );
2481
  update_option( 'mo2f_message', $message );
2482
  $this->mo_auth_show_success_message();
2483
+ header( 'Location: admin.php?page=mo_2fa_two_fa' );
2484
 
2485
  } else {
2486
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_USER_REGISTRATION" ) );
helper/curl.php CHANGED
@@ -48,8 +48,8 @@ class MocURL
48
  }else if ( $is_nc_with_1_user ) {
49
  $customer_feature = "V3";
50
  }
51
-
52
- $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $query;
53
 
54
  $fields = array(
55
  'firstName' => $current_user->user_firstname,
@@ -109,7 +109,6 @@ class MocURL
109
 
110
  function mo_wpns_forgot_password()
111
  {
112
-
113
  $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/password-reset';
114
  $email = get_option('mo2f_email');
115
  $customerKey = get_option('mo2f_customerKey');
@@ -131,7 +130,6 @@ class MocURL
131
  $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
132
 
133
  $headers .= 'From: '.$fromName.'<'.$fromEmail.'>' . "\r\n";
134
- //$headers .= 'Cc: cc@example.com' . "\r\n";
135
 
136
  mail($toEmail,$subject,$content,$headers);
137
 
@@ -140,15 +138,23 @@ class MocURL
140
 
141
  //added for feedback
142
 
143
- function send_email_alert($email,$phone,$message){
144
 
 
 
145
  $url = MoWpnsConstants::HOST_NAME . '/moas/api/notify/send';
146
  $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
147
  $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
148
  $fromEmail = 'no-reply@xecurify.com';
149
- $subject = "Feedback: WordPress miniOrange 2-Factor Plugin";
 
 
 
 
 
 
 
150
 
151
- global $user;
152
  $user = wp_get_current_user();
153
 
154
  $is_nc_with_1_user = get_option( 'mo2f_is_NC' ) && get_option( 'mo2f_is_NNC' );
@@ -157,6 +163,7 @@ class MocURL
157
 
158
  $customer_feature = "";
159
 
 
160
  if ( $is_ec_with_1_user ) {
161
  $customer_feature = "V1";
162
  }else if ( $is_nc_with_1_user ) {
@@ -166,7 +173,7 @@ class MocURL
166
  $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
167
 
168
 
169
- $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>Email :<a href="mailto:'.$email.'" target="_blank">'.$email.'</a><br><br>Query :'.$query.'</div>';
170
 
171
 
172
  $fields = array(
48
  }else if ( $is_nc_with_1_user ) {
49
  $customer_feature = "V3";
50
  }
51
+ global $moWpnsUtility;
52
+ $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
53
 
54
  $fields = array(
55
  'firstName' => $current_user->user_firstname,
109
 
110
  function mo_wpns_forgot_password()
111
  {
 
112
  $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/password-reset';
113
  $email = get_option('mo2f_email');
114
  $customerKey = get_option('mo2f_customerKey');
130
  $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
131
 
132
  $headers .= 'From: '.$fromName.'<'.$fromEmail.'>' . "\r\n";
 
133
 
134
  mail($toEmail,$subject,$content,$headers);
135
 
138
 
139
  //added for feedback
140
 
141
+ function send_email_alert($email,$phone,$message,$feedback_option){
142
 
143
+ global $moWpnsUtility;
144
+ global $user;
145
  $url = MoWpnsConstants::HOST_NAME . '/moas/api/notify/send';
146
  $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
147
  $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
148
  $fromEmail = 'no-reply@xecurify.com';
149
+ if ($feedback_option == 'mo_wpns_skip_feedback')
150
+ {
151
+ $subject = "Deactivate [Feedback Skipped]: WordPress miniOrange 2-Factor Plugin -". $email;;
152
+ }
153
+ elseif ($feedback_option == 'mo_wpns_feedback')
154
+ {
155
+ $subject = "Feedback: WordPress miniOrange 2-Factor Plugin - ". $email;;
156
+ }
157
 
 
158
  $user = wp_get_current_user();
159
 
160
  $is_nc_with_1_user = get_option( 'mo2f_is_NC' ) && get_option( 'mo2f_is_NNC' );
163
 
164
  $customer_feature = "";
165
 
166
+
167
  if ( $is_ec_with_1_user ) {
168
  $customer_feature = "V1";
169
  }else if ( $is_nc_with_1_user ) {
173
  $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
174
 
175
 
176
+ $content='<div >Hello, <br><br>Ticket ID:'.$moWpnsUtility->getFeatureStatus().'<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>Email :<a href="mailto:'.$email.'" target="_blank">'.$email.'</a><br><br>Query :'.$query.'</div>';
177
 
178
 
179
  $fields = array(
helper/utility.php CHANGED
@@ -258,5 +258,26 @@ class MoWpnsUtility
258
  else if(strpos($useragent, 'safari') !== false)
259
  return 'safari';
260
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
 
262
  }
258
  else if(strpos($useragent, 'safari') !== false)
259
  return 'safari';
260
  }
261
+
262
+ public static function getFeatureStatus(){
263
+ $status='';
264
+ $status.="#";
265
+
266
+ if(get_site_option('mo2f_visit_waf'))
267
+ $status.="WF1";
268
+ if(get_site_option('WAF'))
269
+ $status.="F1";
270
+ if(get_site_option('mo2f_visit_login_and_spam'))
271
+ $status.="LS1";
272
+ if(get_site_option('mo2f_enable_brute_force'))
273
+ $status.="BF1";
274
+ if(get_site_option('mo2f_visit_malware'))
275
+ $status.="M1";
276
+ if(get_site_option('mo2f_visit_backup'))
277
+ $status.="B1";
278
+
279
+ $status.="R".rand(0,1000);
280
+ return $status;
281
+ }
282
 
283
  }
includes/css/button_styles.css.orig ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mo_wpns_switch {
2
+ position: relative;
3
+ display: inline-block;
4
+ width: 60px;
5
+ height: 34px;
6
+ }
7
+
8
+ .mo_wpns_switch input {
9
+ opacity: 0;
10
+ width: 0;
11
+ height: 0;
12
+ }
13
+
14
+ .mo_wpns_slider {
15
+ position: absolute;
16
+ cursor: pointer;
17
+ top: 0;
18
+ left: 0;
19
+ right: 0;
20
+ bottom: 0;
21
+ background-color: #ccc;
22
+ -webkit-transition: .4s;
23
+ transition: .4s;
24
+ }
25
+
26
+ .mo_wpns_slider:before {
27
+ position: absolute;
28
+ content: "";
29
+ height: 26px;
30
+ width: 26px;
31
+ left: 4px;
32
+ bottom: 4px;
33
+ background-color: white;
34
+ -webkit-transition: .4s;
35
+ transition: .4s;
36
+ }
37
+
38
+ input:checked + .mo_wpns_slider {
39
+ background-color: #20b2aa;
40
+ }
41
+
42
+ input:focus + .mo_wpns_slider {
43
+ box-shadow: 0 0 1px #20b2aa;
44
+ }
45
+
46
+ input:checked + .mo_wpns_slider:before {
47
+ -webkit-transform: translateX(26px);
48
+ -ms-transform: translateX(26px);
49
+ transform: translateX(26px);
50
+ }
51
+
52
+ /* Rounded sliders */
53
+ .mo_wpns_slider.mo_wpns_round {
54
+ border-radius: 34px;
55
+ }
56
+
57
+ .mo_wpns_slider.mo_wpns_round:before {
58
+ border-radius: 50%;
59
+ }
60
+ .mo_wpns_switch_small {
61
+ position: relative;
62
+ display: inline-block;
63
+ width: 44px;
64
+ height: 24px;
65
+ }
66
+ .mo_wpns_switch_small input {
67
+ opacity: 0;
68
+ width: 0;
69
+ height: 0;
70
+ }
71
+ .mo_wpns_slider_small {
72
+ position: absolute;
73
+ cursor: pointer;
74
+ top: 0;
75
+ left: 0;
76
+ right: 0;
77
+ bottom: 0;
78
+ background-color: #ccc;
79
+ -webkit-transition: .4s;
80
+ transition: .4s;
81
+ }
82
+ .mo_wpns_slider_small:before {
83
+ position: absolute;
84
+ content: "";
85
+ height: 18px;
86
+ width: 18px;
87
+ left: 3px;
88
+ bottom: 3px;
89
+ background-color: white;
90
+ -webkit-transition: .4s;
91
+ transition: .4s;
92
+ }
93
+ input:checked + .mo_wpns_slider_small {
94
+ background-color: #20b2aa;
95
+ }
96
+ input:focus + .mo_wpns_slider_small {
97
+ box-shadow: 0 0 1px #20b2aa;
98
+ }
99
+
100
+ input:checked + .mo_wpns_slider_small:before {
101
+ -webkit-transform: translateX(17px);
102
+ -ms-transform: translateX(17px);
103
+ transform: translateX(17px);
104
+ }
105
+ .mo_wpns_slider_small.mo_wpns_round_small {
106
+ border-radius: 24px;
107
+ }
108
+
109
+ .mo_wpns_slider_small.mo_wpns_round_small:before {
110
+ border-radius: 50%;
111
+ }
includes/css/twofa_style_settings.css.orig ADDED
@@ -0,0 +1,976 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mo2f_modal-open {
2
+ overflow: hidden !important;
3
+ position: fixed !important;
4
+ width: 100% !important;
5
+
6
+ }
7
+
8
+ .mo2f_modal {
9
+ position: fixed !important;
10
+ top: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ left: 0;
14
+ z-index: 100000 !important;
15
+
16
+ overflow: hidden !important;
17
+ -webkit-overflow-scrolling: touch;
18
+ outline: 0;
19
+
20
+ }
21
+
22
+ .mo2f_modal_inner {
23
+ display: none;
24
+ }
25
+
26
+ .mo2f_modal.fade .mo2f_modal-dialog {
27
+ -webkit-transition: -webkit-transform .3s ease-out;
28
+ -o-transition: -o-transform .3s ease-out;
29
+ transition: transform .3s ease-out;
30
+ -webkit-transform: translate(0, -25%);
31
+ -ms-transform: translate(0, -25%);
32
+ -o-transform: translate(0, -25%);
33
+ transform: translate(0, -25%)
34
+ }
35
+
36
+ .mo2f_modal.in .mo2f_modal-dialog {
37
+ -webkit-transform: translate(0, 80px) !important;
38
+ -ms-transform: translate(0, 80px) !important;
39
+ -o-transform: translate(0, 80px) !important;
40
+ transform: translate(0, 80px) !important;
41
+
42
+ }
43
+
44
+ .mo2f_modal-open .mo2f_modal {
45
+ overflow-x: hidden;
46
+ overflow-y: hidden;
47
+ }
48
+
49
+ .mo2f_modal-dialog {
50
+ position: relative;
51
+ width: auto;
52
+ margin: 10px;
53
+
54
+ }
55
+
56
+ .login mo_customer_validation-modal-content {
57
+ position: relative !important;
58
+ background-color: #fff !important;
59
+ -webkit-background-clip: padding-box !important;
60
+ background-clip: padding-box !important;
61
+ border: 1px solid #999 !important;
62
+ border: 1px solid rgba(0, 0, 0, .2) !important;
63
+ border-radius: 6px !important;
64
+ outline: 0 !important;
65
+
66
+ -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5) !important;
67
+ box-shadow: 0 3px 9px rgba(0, 0, 0, .5) !important;
68
+ }
69
+
70
+ .mo2f-modal-backdrop {
71
+ position: absolute;
72
+ top: 0;
73
+ right: 0;
74
+ left: 0;
75
+ background-color: #f1f1f1 !important;
76
+ filter: alpha(opacity=50) !important;
77
+ opacity: 0.8 !important;
78
+ height: 100% !important;
79
+ }
80
+
81
+ #smsAlertModal {
82
+ background-color: black !important;
83
+ opacity: 0.8 !important;
84
+ font-family: Roboto;
85
+ }
86
+
87
+ #twoFAtestAlertModal {
88
+ background-color: black !important;
89
+ opacity: 0.8 !important;
90
+ filter: alpha(opacity=50) !important;
91
+ }
92
+
93
+ .mo2f_modal-header {
94
+ min-height: 14px;
95
+ padding: 10px;
96
+ border-bottom: 1px solid #e5e5e5
97
+ }
98
+
99
+ .mo2f_modal-title {
100
+ margin: 0 !important;
101
+ line-height: 1.0 !important;
102
+ font-size: 1rem;
103
+ }
104
+
105
+ .mo2f_modal-body {
106
+ / / width: 96 % !important;
107
+ position: relative !important;
108
+ padding: 15px !important;
109
+ overflow-y: auto !important;
110
+ max-height: 550px !important;
111
+ }
112
+
113
+ .mo2f_modal-footer {
114
+ padding: 15px;
115
+ text-align: right;
116
+ border-top: 1px solid #e5e5e5
117
+ }
118
+
119
+ .mo2f_modal-footer .btn + .btn {
120
+ margin-bottom: 0;
121
+ margin-left: 5px
122
+ }
123
+
124
+ .mo2f_modal-footer .btn-group .btn + .btn {
125
+ margin-left: -1px
126
+ }
127
+
128
+ .mo2f_modal-footer .btn-block + .btn-block {
129
+ margin-left: 0
130
+ }
131
+
132
+ .mo2f_modal-scrollbar-measure {
133
+ position: absolute;
134
+ top: -9999px;
135
+ width: 50px;
136
+ height: 50px;
137
+ overflow: scroll
138
+ }
139
+
140
+ .mo2f_close {
141
+ float: right;
142
+ font-size: 21px;
143
+ font-weight: 700;
144
+ line-height: 1;
145
+ color: #000;
146
+ text-shadow: 0 1px 0 #fff;
147
+ filter: alpha(opacity=20);
148
+ opacity: .2
149
+ }
150
+
151
+ .mo2f_close:hover, .mo2f_close:focus {
152
+ color: #000;
153
+ text-decoration: none;
154
+ cursor: pointer;
155
+ filter: alpha(opacity=50);
156
+ opacity: .5
157
+ }
158
+
159
+ button.mo2f_close {
160
+ -webkit-appearance: none;
161
+ padding: 0;
162
+ cursor: pointer;
163
+ background: 0 0;
164
+ border: 0
165
+ }
166
+
167
+ @media ( min-width: 768px) {
168
+ .mo2f_modal-dialog {
169
+ width: 373px;
170
+ margin: 0px auto
171
+ }
172
+
173
+ .login mo_customer_validation-modal-content {
174
+ -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
175
+ box-shadow: 0 5px 15px rgba(0, 0, 0, .5)
176
+ }
177
+
178
+ .mo2f_modal-sm {
179
+ width: 300px
180
+ }
181
+
182
+ .mo2f_modal-md {
183
+ width: 550px
184
+ }
185
+ }
186
+
187
+ @media ( min-width: 992px) {
188
+ .mo2f_modal-lg {
189
+ width: 900px;
190
+ }
191
+
192
+ .mo2f_modal-md {
193
+ width: 550px
194
+ }
195
+ }
196
+
197
+
198
+ @media ( min-width: 768px) {
199
+ .mo2f_modal-dialog {
200
+ width: 373px;
201
+ margin: 0px auto
202
+ }
203
+
204
+ .login mo_customer_validation-modal-content {
205
+ -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
206
+ box-shadow: 0 5px 15px rgba(0, 0, 0, .5)
207
+ }
208
+
209
+ .mo2f_modal-sm {
210
+ width: 300px
211
+ }
212
+
213
+ .mo2f_modal-md {
214
+ width: 550px
215
+ }
216
+ }
217
+
218
+ @media ( min-width: 992px) {
219
+ .mo2f_modal-lg {
220
+ width: 900px;
221
+ }
222
+
223
+ .mo2f_modal-md {
224
+ width: 550px
225
+ }
226
+ }
227
+
228
+ .center{
229
+
230
+ text-align: center !important;
231
+ }
232
+
233
+ #otpMessage {
234
+ border-radius: 1px;
235
+ padding: 1px 5px;
236
+ background: #f1f1f1;
237
+ }
238
+
239
+ .mo2f_carousel-indicators {
240
+ position: absolute;
241
+ bottom: -20px;
242
+ z-index: 15;
243
+ width: 60%;
244
+ list-style: none;
245
+ text-align: center;
246
+ }
247
+
248
+ .miniorange_kba_validate:hover, .miniorange_validate_otp:hover, .miniorange_login_forgotphone:hover,
249
+ .miniorange_login_offline:hover, .miniorange_login_forgotphone:hover, .miniorange_otp_token_submit:hover {
250
+ background-color: #0073AA !important
251
+ }
252
+
253
+ .miniorange_kba_validate, .miniorange_validate_otp, .miniorange_login_forgotphone,
254
+ .miniorange_login_offline, .miniorange_login_forgotphone, .miniorange_otp_token_submit {
255
+ background: #00A0D2 !important;
256
+ border-color: #0073AA !important;
257
+ box-shadow: 0 1px 0 rgba(120, 200, 230, .5) inset, 0 1px 0 rgba(0, 0, 0, .15) !important;
258
+ color: #FFF !important;
259
+ text-decoration: none !important;
260
+ cursor: pointer !important;
261
+ border-width: 1px !important;
262
+ border-style: solid !important;
263
+ border-radius: 3px !important;
264
+ white-space: nowrap !important;
265
+ box-sizing: border-box !important;
266
+ line-height: 28px !important;
267
+ padding: 0 12px !important;
268
+ font-size: 13px !important
269
+ }
270
+
271
+ .mo_customer_validation-modal.fade .mo_customer_validation-modal-dialog {
272
+ -webkit-transition: -webkit-transform .3s ease-out;
273
+ -o-transition: -o-transform .3s ease-out;
274
+ transition: transform .3s ease-out;
275
+ -webkit-transform: translate(0, -25%);
276
+ -ms-transform: translate(0, -25%);
277
+ -o-transform: translate(0, -25%);
278
+ transform: translate(0, -25%)
279
+ }
280
+
281
+ .mo_customer_validation-modal.in .mo_customer_validation-modal-dialog {
282
+ -webkit-transform: translate(0, 80px) !important;
283
+ -ms-transform: translate(0, 80px) !important;
284
+ -o-transform: translate(0, 80px) !important;
285
+ transform: translate(0, 80px) !important
286
+ }
287
+
288
+ .mo_customer_validation-modal-open .mo_customer_validation-modal {
289
+ overflow-x: hidden;
290
+ overflow-y: hidden
291
+ }
292
+
293
+ .mo_customer_validation-modal-dialog {
294
+ position: relative;
295
+ width: auto;
296
+ margin: 10px
297
+ }
298
+
299
+ .mo_customer_validation-modal-content {
300
+ position: relative;
301
+ -webkit-background-clip: padding-box;
302
+ border: 1px solid #999;
303
+ border: 1px solid rgba(0, 0, 0, .2);
304
+ outline: 0;
305
+ margin-top: 8%;
306
+ margin-left: 0;
307
+ padding: 15px 20px 0;
308
+ font-family: "Open Sans", sans-serif;
309
+ color: #777;
310
+ font-size: 14px;
311
+ line-height: 1.4em;
312
+ background: #FFF;
313
+ box-shadow: 0 1px 3px rgba(0, 0, 0, .13)
314
+ }
315
+
316
+ .mo_customer_validation-modal-backdrop {
317
+ position: absolute;
318
+ top: 0;
319
+ right: 0;
320
+ left: 0;
321
+ background-color: #000 !important;
322
+ filter: alpha(opacity=50) !important;
323
+ opacity: .9 !important;
324
+ height: 100% !important
325
+ }
326
+
327
+ .mo_customer_validation-modal-header {
328
+ min-height: 14px;
329
+ padding: 10px 10px 20px;
330
+ border-bottom: 1px solid #e5e5e5
331
+ }
332
+
333
+ .mo_customer_validation-modal-title {
334
+ margin: 0 !important;
335
+ line-height: 1 !important
336
+ }
337
+
338
+ .mo_customer_validation-modal-body {
339
+ position: relative;
340
+ padding: 5%;
341
+ overflow: hidden !important;
342
+ max-height: 550px !important
343
+ }
344
+
345
+ .mo_customer_validation-modal-footer {
346
+ padding: 15px;
347
+ text-align: right;
348
+ border-top: 1px solid #e5e5e5
349
+ }
350
+
351
+ .mo_customer_validation-modal-footer .btn + .btn {
352
+ margin-bottom: 0;
353
+ margin-left: 5px
354
+ }
355
+
356
+ .mo_customer_validation-modal-footer .btn-group .btn + .btn {
357
+ margin-left: -1px
358
+ }
359
+
360
+ .mo_customer_validation-modal-footer .btn-block + .btn-block {
361
+ margin-left: 0
362
+ }
363
+
364
+ .mo_customer_validation-modal-scrollbar-measure {
365
+ position: absolute;
366
+ top: -9999px;
367
+ width: 50px;
368
+ height: 50px;
369
+ overflow: scroll
370
+ }
371
+
372
+ @media (min-width: 768px) {
373
+ .mo_customer_validation-modal-dialog {
374
+ width: auto;
375
+ margin: 0 auto
376
+ }
377
+
378
+ .mo_customer_validation-modal-content {
379
+ -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
380
+ box-shadow: 0 5px 15px rgba(0, 0, 0, .5)
381
+ }
382
+
383
+ .mo_customer_validation-modal-sm {
384
+ width: 300px
385
+ }
386
+
387
+ .mo_customer_validation-modal-md {
388
+ width: 532px
389
+ }
390
+
391
+ .mo_customer_validation-modal-lg {
392
+ width: 50%
393
+ }
394
+ }
395
+
396
+ @media (min-width: 992px) {
397
+ .mo_customer_validation-modal-dialog {
398
+ width: auto;
399
+ margin: 0 auto
400
+ }
401
+
402
+ .mo_customer_validation-modal-lg {
403
+ width: 490px
404
+ }
405
+
406
+ .mo_customer_validation-modal-md {
407
+ width: 532px
408
+ }
409
+ }
410
+
411
+ .mo_customer_validation-textbox {
412
+ background: #FBFBFB;
413
+ font-family: "Open Sans", sans-serif;
414
+ font-size: 24px;
415
+ width: 100%;
416
+ border: 1px solid #DDD;
417
+ padding: 3px;
418
+ margin: 2px 6px 16px 0
419
+ }
420
+
421
+ .mo_customer_validation-textbox:focus {
422
+ border-color: #5B9DD9;
423
+ box-shadow: 0 0 2px rgba(30, 140, 190, .8)
424
+
425
+ }
426
+
427
+
428
+
429
+ /*Hode login*/
430
+
431
+ body.login-action-login div#login {
432
+ display: none;
433
+ }
434
+
435
+ body.login-action-login div#login form#loginform input#user_login {
436
+ display: none;
437
+ }
438
+
439
+ body.login-action-login div#login form#loginform p.forgetmenot {
440
+ display: none;
441
+ }
442
+
443
+ body.login-action-login div#login form#loginform p.submit input#wp-submit {
444
+ display: none;
445
+ }
446
+
447
+ body.login-action-login div#login form#loginform p label {
448
+ display: none;
449
+ }
450
+
451
+ body.login-action-login div#login p#nav {
452
+ display: none;
453
+ }
454
+
455
+ body.login-action-login div#login form#loginform input#user_pass {
456
+ display: none;
457
+ }
458
+
459
+ body.login-action-login div#login div#login_error {
460
+ display: none;
461
+ }
462
+
463
+ body.login-action-login p.message {
464
+ display: none;
465
+ }
466
+
467
+ body.login-action-login div#login #loginform {
468
+ box-shadow: inherit;
469
+ }
470
+
471
+ body.login-action-login div#login div#login_error1 {
472
+ border-left: 4px solid #dd3d36;
473
+ margin-left: 0;
474
+ padding: 12px;
475
+ background: #fff;
476
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
477
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
478
+ }
479
+
480
+ .mo2f_header {
481
+ font-size: 28px;
482
+ font-family: -webkit-body;
483
+ color: #777;
484
+ }
485
+
486
+ .mo2f_powered_by_miniorange {
487
+ width: 100px;
488
+ height: 25px;
489
+ -webkit-background-size: 100px 25px;
490
+ background-size: 100px 25px;
491
+ background-repeat: no-repeat;
492
+ display: inline-block;
493
+ vertical-align: middle;
494
+ }
495
+
496
+ .mo2f_powered_by_div {
497
+ text-align: right;
498
+ font-size: 9px;
499
+ padding-right: 2%;
500
+ background-color: #FFFFFF;
501
+ }
502
+
503
+ .button-green {
504
+ color: rgb(0, 160, 210);
505
+ background: none !important;
506
+ border: none;
507
+ padding: 0 !important;
508
+ font: inherit;
509
+ border-color: transparent !important;
510
+ /*border is optional*/
511
+ border-bottom: 1px solid #444;
512
+ cursor: pointer;
513
+ }
514
+
515
+ .mo2fa_display_message {
516
+ padding: 12px;
517
+ border-left: 4px solid #00a0d2;
518
+ background-color: #fff;
519
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
520
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
521
+
522
+ }
523
+
524
+ .mo2fa_messages_container {
525
+ width: 300px;
526
+ }
527
+
528
+ .mo2fa_otp_messages_container {
529
+ width: 400px;
530
+ }
531
+
532
+ .mo2fa_push_messages_container {
533
+ width: 300px;
534
+ }
535
+
536
+ .miniorange_mobile_auth, .miniorange_app_setup_page {
537
+ border: 1px none transparent;
538
+ padding: 10% 24px 10px 20px;
539
+ min-height: 360px;
540
+ background: transparent;
541
+ z-index: 99999;
542
+ }
543
+
544
+ .mo2f-textbox {
545
+ width: 160px;
546
+ margin: 15px 0px !important;
547
+ background-color: rgba(123, 110, 110, 0.06) !important;
548
+ border-radius: 4px !important;
549
+ padding: 3px !important;
550
+ }
551
+
552
+ .miniorange_kba_page {
553
+ border: 1px none transparent;
554
+ padding: 10% 24px 10px 20px;
555
+ min-height: 360px;
556
+ background: transparent;
557
+ z-index: 99999;
558
+
559
+ }
560
+
561
+ .miniorange_push_oobemail_auth, .miniorange_trust_device {
562
+ border: 1px none transparent;
563
+ padding: 10% 24px 10px 20px;
564
+ min-height: 360px;
565
+ background: transparent;
566
+ z-index: 99999;
567
+ }
568
+
569
+ .miniorange_soft_auth {
570
+ border: 1px none transparent;
571
+ padding: 10% 24px 10px 20px;
572
+ min-height: 360px;
573
+ background: transparent;
574
+ z-index: 99999;
575
+ }
576
+
577
+ .miniorange-inner-login-container {
578
+ background-color: #fff;
579
+ margin: 0px auto !important;
580
+ width: 400px;
581
+ border-radius: 5px;
582
+ border: 1px solid rgba(128, 128, 128, 0.06);
583
+ }
584
+
585
+ .miniorange-inner-kba-login-container {
586
+ background-color: #fff;
587
+ margin: 0px auto !important;
588
+ width: 500px;
589
+ border-radius: 5px;
590
+ z-index: 99999;
591
+ border: 1px solid rgba(128, 128, 128, 0.06);
592
+ }
593
+
594
+ .miniorange-inner-push-login-container {
595
+ background-color: #fff;
596
+ margin: 0px auto !important;
597
+ width: 300px;
598
+ border-radius: 5px;
599
+
600
+ z-index: 99999;
601
+ border: 1px solid rgba(128, 128, 128, 0.06);
602
+ }
603
+
604
+ .miniorange-button {
605
+ height: 30px;
606
+ display: inline-block;
607
+ font-size: 14px;
608
+ line-height: 28px;
609
+ padding: 0 12px 2px;
610
+ border-width: 1px;
611
+ vertical-align: baseline;
612
+ background: #00a0d2;
613
+ border-style: solid;
614
+ border-color: #0073aa;
615
+ -webkit-appearance: none;
616
+ -webkit-border-radius: 3px;
617
+ border-radius: 3px;
618
+ white-space: nowrap;
619
+ -webkit-box-sizing: border-box;
620
+ -moz-box-sizing: border-box;
621
+ box-sizing: border-box;
622
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, .5), 0 1px 0 rgba(0, 0, 0, .15);
623
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, .5), 0 1px 0 rgba(0, 0, 0, .15);
624
+ color: #fff;
625
+ text-decoration: none;
626
+ cursor: pointer;
627
+ }
628
+
629
+ .mo_green {
630
+ background: #2ECC71;
631
+ border-color: #2ECC71;
632
+ width: 37%;
633
+ }
634
+
635
+ .mo_red {
636
+ background: #E74C3C;
637
+ border-color: #E74C3C;
638
+ width: 37%;
639
+ }
640
+
641
+ .showQRHelp, .showOTPHelp {
642
+ text-align: center !important;
643
+ }
644
+
645
+ .mo_email_textbox {
646
+ width: 48%;
647
+ text-align: center;
648
+ height: 40px;
649
+ font-size: 18px;
650
+ border-radius: 5px;
651
+ }
652
+
653
+ .mo_header_background {
654
+ padding: 5px !important;
655
+ background-color: beige !important;
656
+ }
657
+
658
+ .mo2f_textbox {
659
+ width: 60% !important;
660
+ border-radius: 4px !important;
661
+ height: 30px !important;
662
+ font-size: 14px !important;
663
+ }
664
+
665
+ .mo2f_kba_textbox {
666
+ width: 100% !important;
667
+ border-radius: 4px !important;
668
+ height: 30px !important;
669
+ font-size: 14px !important;
670
+ }
671
+
672
+ .mo_hr {
673
+ border-top: 1px solid rgba(220, 214, 214, 0.25) !important;
674
+ margin-top: 5px !important;
675
+ margin-right: 10px !important;
676
+ }
677
+
678
+ .mo_margin_left {
679
+ margin-left: 20px !important;
680
+ }
681
+
682
+ .miniorange-app-setup-container {
683
+ background-color: #fff;
684
+ margin: 0px auto !important;
685
+ width: 700px;
686
+ border-radius: 5px;
687
+ margin-top: -100px !important;
688
+ z-index: 99999;
689
+ border: 1px solid rgba(128, 128, 128, 0.06);
690
+
691
+ }
692
+
693
+ .miniorange-ga-setup-container {
694
+ background-color: #fff;
695
+ margin: 0px auto !important;
696
+ width: 900px;
697
+ border-radius: 5px;
698
+ margin-top: -50px !important;
699
+ z-index: 99999;
700
+ border: 1px solid rgba(128, 128, 128, 0.06);
701
+ }
702
+
703
+ .mo_app_link {
704
+ text-decoration: none !important;
705
+ color: #000 !important;
706
+ }
707
+
708
+ .mo2fa_app_setup_messages {
709
+ width: 700px;
710
+ }
711
+
712
+ .mo2f_td_show {
713
+ display: grid !important;
714
+ }
715
+
716
+ .mo2f_td_hide {
717
+ display: none !important;
718
+ }
719
+
720
+ .mo2f_kba_ques {
721
+ width: 370px !important;
722
+ border-radius: 4px !important;
723
+ height: 30px !important;
724
+ font-size: 14px !important;
725
+ }
726
+
727
+ .mo2f_kba_table {
728
+ padding: 0 10px;
729
+ width: 100%;
730
+ }
731
+
732
+ .mo2f_kba_tb_data {
733
+ padding-left: 15px;
734
+ }
735
+
736
+ .mo2f_table_textbox {
737
+ width: 150px;
738
+ height: 30px !important;
739
+ font-size: 14px !important;
740
+
741
+ }
742
+
743
+ .mo2f_kba_header {
744
+ font-weight: bold;
745
+ }
746
+
747
+ .mo2f_separator {
748
+ border-left: 1px solid #EBECEC;
749
+ padding: 5px;
750
+ }
751
+
752
+ .mo2f_inline_padding {
753
+ padding-left: 20px;
754
+ padding-right: 20px;
755
+ }
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+ .mo2f_powered_by_miniorange {
764
+ width: 100px;
765
+ height: 30px;
766
+ -webkit-background-size: 100px 25px;
767
+ background-size: 100px 25px;
768
+ background-repeat: no-repeat;
769
+ display: inline-block;
770
+ vertical-align: middle;
771
+ }
772
+
773
+ .mo2f_powered_by_div {
774
+ text-align: right;
775
+ font-size: 9px;
776
+ padding-right: 5px;
777
+ background-color: #FFFFFF;
778
+ width: 92%;
779
+ border-radius: 6px;
780
+ }
781
+
782
+ .mo2f-login-container {
783
+ display: inline-block !important;
784
+ display: -moz-inline-stack !important;
785
+ text-align: center !important;
786
+ width: 100%;
787
+
788
+ }
789
+
790
+ .mo2f-button {
791
+ width: 100% !important;
792
+ color: #fff !important;
793
+ line-height: normal;
794
+ height: 30px !important;
795
+ margin: 0px !important;
796
+ font-size: 14px !important;
797
+ padding: 7px !important;
798
+ background-color: #f0ad4e !important;
799
+ border-color: #eea236 !important;
800
+ -webkit-appearance: none;
801
+ -webkit-border-radius: 3px !important;
802
+ border-radius: 3px !important;
803
+
804
+ }
805
+
806
+ .mo2fa_display_message_login {
807
+ text-align: left !important;
808
+ font-size: 13px !important;
809
+ }
810
+
811
+ .mo2f-link {
812
+ color: #0191BF !important;
813
+ font-size: 14px !important;
814
+ font-weight: bold !important;
815
+ cursor: pointer !important;
816
+ }
817
+
818
+ .mo_green {
819
+ background: #2ECC71 !important;
820
+ border-color: #2ECC71 !important;
821
+ width: 26% !important;
822
+ border-width: 1px;
823
+ vertical-align: middle !important;
824
+ border-radius: 3px !important;
825
+ color: white;
826
+ height: 30px;
827
+ cursor: pointer;
828
+ }
829
+
830
+ .mo_red {
831
+ background: #E74C3C !important;
832
+ border-color: #E74C3C !important;
833
+ width: 26% !important;
834
+ border-width: 1px;
835
+ vertical-align: middle !important;
836
+ border-radius: 3px !important;
837
+ color: white;
838
+ height: 30px;
839
+ cursor: pointer;
840
+ }
841
+
842
+ .mo_otp_token {
843
+ font-size: 15px;
844
+ color: #212F3C;
845
+ border: none;
846
+ display: block;
847
+ border-bottom-style: solid;
848
+ border-width: 2px;
849
+ border-color: #D0D3D4;
850
+ border-radius: 0px;
851
+ outline: none;
852
+ width: 140px;
853
+ text-align: center;
854
+ }
855
+
856
+ .showQRHelp, .showOTPHelp {
857
+ text-align: center !important;
858
+
859
+ }
860
+
861
+ .mo2f_device {
862
+ padding-left: 200px !important;
863
+ vertical-align: -webkit-baseline-middle !important;
864
+ line-height: 3 !important;
865
+ }
866
+
867
+ .miniorange-button {
868
+ height: 30px;
869
+ font-size: 14px !important;
870
+ line-height: 5px !important;
871
+ padding: 16px !important;
872
+ border-width: 1px;
873
+ vertical-align: middle !important;
874
+ background-color: #f0ad4e !important;
875
+ border-color: #eea236 !important;
876
+ -webkit-appearance: none;
877
+ border-style: solid;
878
+ -webkit-border-radius: 3px !important;
879
+ border-radius: 3px !important;
880
+ white-space: nowrap;
881
+ -webkit-box-sizing: border-box;
882
+ -moz-box-sizing: border-box;
883
+ box-sizing: border-box;
884
+ color: #fff;
885
+ text-decoration: none;
886
+ cursor: pointer;
887
+ }
888
+
889
+ .mo_hr {
890
+ border-top: 1px solid rgba(220, 214, 214, 0.25) !important;
891
+ margin-top: 5px !important;
892
+ margin-right: 10px !important;
893
+ }
894
+
895
+ .mo_margin_left {
896
+ margin-left: 20px !important;
897
+ }
898
+
899
+ .mo_app_link {
900
+ text-decoration: none !important;
901
+ color: #000 !important;
902
+ }
903
+
904
+ .mo2f_td_show {
905
+ display: grid !important;
906
+ }
907
+
908
+ .mo2f_td_hide {
909
+ display: none !important;
910
+ }
911
+
912
+ .mo2f_label {
913
+ font-weight: 100 !important;
914
+ margin-left: 10px !important;
915
+
916
+ }
917
+
918
+ .mo2f_kba_ques {
919
+ width: 394px !important;
920
+ border-radius: 4px !important;
921
+ height: 40px !important;
922
+ font-size: 14px !important;
923
+ }
924
+
925
+ .mo2f_kba_table {
926
+ padding: 0 10px;
927
+ width: 100%;
928
+ border: hidden !important;
929
+ }
930
+
931
+ .mo2f_kba_tb_data {
932
+ padding-left: 15px;
933
+ }
934
+
935
+ .mo2f_table_textbox_1 {
936
+ width: 150px;
937
+ height: 30px !important;
938
+ font-size: 14px !important;
939
+ }
940
+
941
+ .mo2f_table_textbox {
942
+ width: 200px;
943
+ height: 40px !important;
944
+ font-size: 14px !important;
945
+
946
+ }
947
+
948
+ .mo2f_kba_header {
949
+ font-weight: bold;
950
+ border: hidden !important;
951
+ }
952
+
953
+ .mo2f_kba_body {
954
+ border: hidden !important;
955
+ }
956
+
957
+ .mo2f_separator {
958
+ border-left: 1px solid #EBECEC;
959
+ padding: 5px;
960
+ }
961
+
962
+ .mo2f_authn_header {
963
+ font-size: 14px !important;
964
+ }
965
+
966
+ #mo2f_inline_table {
967
+ border: hidden !important;
968
+ }
969
+
970
+ .mo2f_ordered_list {
971
+ margin: 0 0 0 1em !important;
972
+ }
973
+
974
+ .mo2f_list {
975
+ font-size: 14px !important;
976
+ }
includes/images/Admin_Custom_Login.png ADDED
Binary file
includes/images/Custom_Login_Page_Customizer_LoginPress.png ADDED
Binary file
includes/images/RegistrationMagic_Custom_Registration_Forms_and_User_Login.png ADDED
Binary file
includes/images/theme_my_login.png ADDED
Binary file
includes/images/ultimate_member.png ADDED
Binary file
includes/images/user_registration.png ADDED
Binary file
includes/images/woocommerce.png ADDED
Binary file
includes/jquery-qrcode/README.md.orig ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # jQuery.qrcode
2
+
3
+ [![license][license-img]][github] [![web][web-img]][web] [![github][github-img]][github] [![bower][bower-img]][github]
4
+
5
+ jQuery plugin to dynamically generate QR codes. Uses [QR Code Generator][qrcode] (MIT).
6
+
7
+
8
+ ## License
9
+ The MIT License (MIT)
10
+
11
+ Copyright (c) 2016 Lars Jung (https://larsjung.de)
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and agauthciated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in
21
+ all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
+ THE SOFTWARE.
30
+
31
+
32
+ [web]: https://larsjung.de/qrcode/
33
+ [github]: https://github.com/lrsjng/jquery-qrcode
34
+
35
+ [license-img]: https://img.shields.io/badge/license-MIT-a0a060.svg?style=flat-square
36
+ [web-img]: https://img.shields.io/badge/web-larsjung.de/qrcode-a0a060.svg?style=flat-square
37
+ [github-img]: https://img.shields.io/badge/github-lrsjng/jquery--qrcode-a0a060.svg?style=flat-square
38
+ [bower-img]: https://img.shields.io/badge/bower-lrsjng/jquery--qrcode-a0a060.svg?style=flat-square
39
+
40
+ [qrcode]: https://github.com/kazuhikoarase/qrcode-generator
includes/jquery-qrcode/jquery-qrcode.js.orig ADDED
@@ -0,0 +1,2332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jquery-qrcode v0.14.0 - https://larsjung.de/jquery-qrcode/ */
2
+ (function (vendor_qrcode) {
3
+ 'use strict';
4
+
5
+ var jq = window.jQuery;
6
+
7
+ // Check if canvas is available in the browser (as Modernizr does)
8
+ var hasCanvas = (function () {
9
+ var elem = document.createElement('canvas');
10
+ return !!(elem.getContext && elem.getContext('2d'));
11
+ }());
12
+
13
+ // Wrapper for the original QR code generator.
14
+ function createQRCode(text, level, version, quiet) {
15
+ var qr = {};
16
+
17
+ var vqr = vendor_qrcode(version, level);
18
+ vqr.addData(text);
19
+ vqr.make();
20
+
21
+ quiet = quiet || 0;
22
+
23
+ var qrModuleCount = vqr.getModuleCount();
24
+ var quietModuleCount = vqr.getModuleCount() + 2 * quiet;
25
+
26
+ function isDark(row, col) {
27
+ row -= quiet;
28
+ col -= quiet;
29
+
30
+ if (row < 0 || row >= qrModuleCount || col < 0 || col >= qrModuleCount) {
31
+ return false;
32
+ }
33
+ return vqr.isDark(row, col);
34
+ }
35
+
36
+ function addBlank(l, t, r, b) {
37
+ var prevIsDark = qr.isDark;
38
+ var moduleSize = 1 / quietModuleCount;
39
+
40
+ qr.isDark = function (row, col) {
41
+ var ml = col * moduleSize;
42
+ var mt = row * moduleSize;
43
+ var mr = ml + moduleSize;
44
+ var mb = mt + moduleSize;
45
+
46
+ return prevIsDark(row, col) && (l > mr || ml > r || t > mb || mt > b);
47
+ };
48
+ }
49
+
50
+ qr.text = text;
51
+ qr.level = level;
52
+ qr.version = version;
53
+ qr.moduleCount = quietModuleCount;
54
+ qr.isDark = isDark;
55
+ qr.addBlank = addBlank;
56
+
57
+ return qr;
58
+ }
59
+
60
+ // Returns a minimal QR code for the given text starting with version `minVersion`.
61
+ // Returns `undefined` if `text` is too long to be encoded in `maxVersion`.
62
+ function createMinQRCode(text, level, minVersion, maxVersion, quiet) {
63
+ minVersion = Math.max(1, minVersion || 1);
64
+ maxVersion = Math.min(40, maxVersion || 40);
65
+ for (var version = minVersion; version <= maxVersion; version += 1) {
66
+ try {
67
+ return createQRCode(text, level, version, quiet);
68
+ } catch (err) {/* empty */}
69
+ }
70
+ return undefined;
71
+ }
72
+
73
+ function drawBackgroundLabel(qr, context, settings) {
74
+ var size = settings.size;
75
+ var font = 'bold ' + settings.mSize * size + 'px ' + settings.fontname;
76
+ var ctx = jq('<canvas/>')[0].getContext('2d');
77
+
78
+ ctx.font = font;
79
+
80
+ var w = ctx.measureText(settings.label).width;
81
+ var sh = settings.mSize;
82
+ var sw = w / size;
83
+ var sl = (1 - sw) * settings.mPosX;
84
+ var st = (1 - sh) * settings.mPosY;
85
+ var sr = sl + sw;
86
+ var sb = st + sh;
87
+ var pad = 0.01;
88
+
89
+ if (settings.mode === 1) {
90
+ // Strip
91
+ qr.addBlank(0, st - pad, size, sb + pad);
92
+ } else {
93
+ // Box
94
+ qr.addBlank(sl - pad, st - pad, sr + pad, sb + pad);
95
+ }
96
+
97
+ context.fillStyle = settings.fontcolor;
98
+ context.font = font;
99
+ context.fillText(settings.label, sl * size, st * size + 0.75 * settings.mSize * size);
100
+ }
101
+
102
+ function drawBackgroundImage(qr, context, settings) {
103
+ var size = settings.size;
104
+ var w = settings.image.naturalWidth || 1;
105
+ var h = settings.image.naturalHeight || 1;
106
+ var sh = settings.mSize;
107
+ var sw = sh * w / h;
108
+ var sl = (1 - sw) * settings.mPosX;
109
+ var st = (1 - sh) * settings.mPosY;
110
+ var sr = sl + sw;
111
+ var sb = st + sh;
112
+ var pad = 0.01;
113
+
114
+ if (settings.mode === 3) {
115
+ // Strip
116
+ qr.addBlank(0, st - pad, size, sb + pad);
117
+ } else {
118
+ // Box
119
+ qr.addBlank(sl - pad, st - pad, sr + pad, sb + pad);
120
+ }
121
+
122
+ context.drawImage(settings.image, sl * size, st * size, sw * size, sh * size);
123
+ }
124
+
125
+ function drawBackground(qr, context, settings) {
126
+ if (jq(settings.background).is('img')) {
127
+ context.drawImage(settings.background, 0, 0, settings.size, settings.size);
128
+ } else if (settings.background) {
129
+ context.fillStyle = settings.background;
130
+ context.fillRect(settings.left, settings.top, settings.size, settings.size);
131
+ }
132
+
133
+ var mode = settings.mode;
134
+ if (mode === 1 || mode === 2) {
135
+ drawBackgroundLabel(qr, context, settings);
136
+ } else if (mode === 3 || mode === 4) {
137
+ drawBackgroundImage(qr, context, settings);
138
+ }
139
+ }
140
+
141
+ function drawModuleDefault(qr, context, settings, left, top, width, row, col) {
142
+ if (qr.isDark(row, col)) {
143
+ context.rect(left, top, width, width);
144
+ }
145
+ }
146
+
147
+ function drawModuleRoundedDark(ctx, l, t, r, b, rad, nw, ne, se, sw) {
148
+ if (nw) {
149
+ ctx.moveTo(l + rad, t);
150
+ } else {
151
+ ctx.moveTo(l, t);
152
+ }
153
+
154
+ if (ne) {
155
+ ctx.lineTo(r - rad, t);
156
+ ctx.arcTo(r, t, r, b, rad);
157
+ } else {
158
+ ctx.lineTo(r, t);
159
+ }
160
+
161
+ if (se) {
162
+ ctx.lineTo(r, b - rad);
163
+ ctx.arcTo(r, b, l, b, rad);
164
+ } else {
165
+ ctx.lineTo(r, b);
166
+ }
167
+
168
+ if (sw) {
169
+ ctx.lineTo(l + rad, b);
170
+ ctx.arcTo(l, b, l, t, rad);
171
+ } else {
172
+ ctx.lineTo(l, b);
173
+ }
174
+
175
+ if (nw) {
176
+ ctx.lineTo(l, t + rad);
177
+ ctx.arcTo(l, t, r, t, rad);
178
+ } else {
179
+ ctx.lineTo(l, t);
180
+ }
181
+ }
182
+
183
+ function drawModuleRoundendLight(ctx, l, t, r, b, rad, nw, ne, se, sw) {
184
+ if (nw) {
185
+ ctx.moveTo(l + rad, t);
186
+ ctx.lineTo(l, t);
187
+ ctx.lineTo(l, t + rad);
188
+ ctx.arcTo(l, t, l + rad, t, rad);
189
+ }
190
+
191
+ if (ne) {
192
+ ctx.moveTo(r - rad, t);
193
+ ctx.lineTo(r, t);
194
+ ctx.lineTo(r, t + rad);
195
+ ctx.arcTo(r, t, r - rad, t, rad);
196
+ }
197
+
198
+ if (se) {
199
+ ctx.moveTo(r - rad, b);
200
+ ctx.lineTo(r, b);
201
+ ctx.lineTo(r, b - rad);
202
+ ctx.arcTo(r, b, r - rad, b, rad);
203
+ }
204
+
205
+ if (sw) {
206
+ ctx.moveTo(l + rad, b);
207
+ ctx.lineTo(l, b);
208
+ ctx.lineTo(l, b - rad);
209
+ ctx.arcTo(l, b, l + rad, b, rad);
210
+ }
211
+ }
212
+
213
+ function drawModuleRounded(qr, context, settings, left, top, width, row, col) {
214
+ var isDark = qr.isDark;
215
+ var right = left + width;
216
+ var bottom = top + width;
217
+ var radius = settings.radius * width;
218
+ var rowT = row - 1;
219
+ var rowB = row + 1;
220
+ var colL = col - 1;
221
+ var colR = col + 1;
222
+ var center = isDark(row, col);
223
+ var northwest = isDark(rowT, colL);
224
+ var north = isDark(rowT, col);
225
+ var northeast = isDark(rowT, colR);
226
+ var east = isDark(row, colR);
227
+ var southeast = isDark(rowB, colR);
228
+ var south = isDark(rowB, col);
229
+ var southwest = isDark(rowB, colL);
230
+ var west = isDark(row, colL);
231
+
232
+ if (center) {
233
+ drawModuleRoundedDark(context, left, top, right, bottom, radius, !north && !west, !north && !east, !south && !east, !south && !west);
234
+ } else {
235
+ drawModuleRoundendLight(context, left, top, right, bottom, radius, north && west && northwest, north && east && northeast, south && east && southeast, south && west && southwest);
236
+ }
237
+ }
238
+
239
+ function drawModules(qr, context, settings) {
240
+ var moduleCount = qr.moduleCount;
241
+ var moduleSize = settings.size / moduleCount;
242
+ var fn = drawModuleDefault;
243
+ var row;
244
+ var col;
245
+
246
+ if (settings.radius > 0 && settings.radius <= 0.5) {
247
+ fn = drawModuleRounded;
248
+ }
249
+
250
+ context.beginPath();
251
+ for (row = 0; row < moduleCount; row += 1) {
252
+ for (col = 0; col < moduleCount; col += 1) {
253
+ var l = settings.left + col * moduleSize;
254
+ var t = settings.top + row * moduleSize;
255
+ var w = moduleSize;
256
+
257
+ fn(qr, context, settings, l, t, w, row, col);
258
+ }
259
+ }
260
+ if (jq(settings.fill).is('img')) {
261
+ context.strokeStyle = 'rgba(0,0,0,0.5)';
262
+ context.lineWidth = 2;
263
+ context.stroke();
264
+ var prev = context.globalCompositeOperation;
265
+ context.globalCompositeOperation = 'destination-out';
266
+ context.fill();
267
+ context.globalCompositeOperation = prev;
268
+
269
+ context.clip();
270
+ context.drawImage(settings.fill, 0, 0, settings.size, settings.size);
271
+ context.restore();
272
+ } else {
273
+ context.fillStyle = settings.fill;
274
+ context.fill();
275
+ }
276
+ }
277
+
278
+ // Draws QR code to the given `canvas` and returns it.
279
+ function drawOnCanvas(canvas, settings) {
280
+ var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
281
+ if (!qr) {
282
+ return null;
283
+ }
284
+
285
+ var $canvas = jq(canvas).data('qrcode', qr);
286
+ var context = $canvas[0].getContext('2d');
287
+
288
+ drawBackground(qr, context, settings);
289
+ drawModules(qr, context, settings);
290
+
291
+ return $canvas;
292
+ }
293
+
294
+ // Returns a `canvas` element representing the QR code for the given settings.
295
+ function createCanvas(settings) {
296
+ var $canvas = jq('<canvas/>').attr('width', settings.size).attr('height', settings.size);
297
+ return drawOnCanvas($canvas, settings);
298
+ }
299
+
300
+ // Returns an `image` element representing the QR code for the given settings.
301
+ function createImage(settings) {
302
+ return jq('<img/>').attr('src', createCanvas(settings)[0].toDataURL('image/png'));
303
+ }
304
+
305
+ // Returns a `div` element representing the QR code for the given settings.
306
+ function createDiv(settings) {
307
+ var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
308
+ if (!qr) {
309
+ return null;
310
+ }
311
+
312
+ // some shortcuts to improve compression
313
+ var settings_size = settings.size;
314
+ var settings_bgColor = settings.background;
315
+ var math_floor = Math.floor;
316
+
317
+ var moduleCount = qr.moduleCount;
318
+ var moduleSize = math_floor(settings_size / moduleCount);
319
+ var offset = math_floor(0.5 * (settings_size - moduleSize * moduleCount));
320
+
321
+ var row;
322
+ var col;
323
+
324
+ var containerCSS = {
325
+ position: 'relative',
326
+ left: 0,
327
+ top: 0,
328
+ padding: 0,
329
+ margin: 0,
330
+ width: settings_size,
331
+ height: settings_size
332
+ };
333
+ var darkCSS = {
334
+ position: 'absolute',
335
+ padding: 0,
336
+ margin: 0,
337
+ width: moduleSize,
338
+ height: moduleSize,
339
+ 'background-color': settings.fill
340
+ };
341
+
342
+ var $div = jq('<div/>').data('qrcode', qr).css(containerCSS);
343
+
344
+ if (settings_bgColor) {
345
+ $div.css('background-color', settings_bgColor);
346
+ }
347
+
348
+ for (row = 0; row < moduleCount; row += 1) {
349
+ for (col = 0; col < moduleCount; col += 1) {
350
+ if (qr.isDark(row, col)) {
351
+ jq('<div/>')
352
+ .css(darkCSS)
353
+ .css({
354
+ left: offset + col * moduleSize,
355
+ top: offset + row * moduleSize
356
+ })
357
+ .appendTo($div);
358
+ }
359
+ }
360
+ }
361
+
362
+ return $div;
363
+ }
364
+
365
+ function createHTML(settings) {
366
+ if (hasCanvas && settings.render === 'canvas') {
367
+ return createCanvas(settings);
368
+ } else if (hasCanvas && settings.render === 'image') {
369
+ return createImage(settings);
370
+ }
371
+
372
+ return createDiv(settings);
373
+ }
374
+
375
+ // Plugin
376
+ // ======
377
+
378
+ // Default settings
379
+ // ----------------
380
+ var defaults = {
381
+ // render method: `'canvas'`, `'image'` or `'div'`
382
+ render: 'canvas',
383
+
384
+ // version range somewhere in 1 .. 40
385
+ minVersion: 1,
386
+ maxVersion: 40,
387
+
388
+ // error correction level: `'L'`, `'M'`, `'Q'` or `'H'`
389
+ ecLevel: 'L',
390
+
391
+ // offset in pixel if drawn onto existing canvas
392
+ left: 0,
393
+ top: 0,
394
+
395
+ // size in pixel
396
+ size: 200,
397
+
398
+ // code color or image element
399
+ fill: '#000',
400
+
401
+ // background color or image element, `null` for transparent background
402
+ background: null,
403
+
404
+ // content
405
+ text: 'no text',
406
+
407
+ // corner radius relative to module width: 0.0 .. 0.5
408
+ radius: 0,
409
+
410
+ // quiet zone in modules
411
+ quiet: 0,
412
+
413
+ // modes
414
+ // 0: normal
415
+ // 1: label strip
416
+ // 2: label box
417
+ // 3: image strip
418
+ // 4: image box
419
+ mode: 0,
420
+
421
+ mSize: 0.1,
422
+ mPosX: 0.5,
423
+ mPosY: 0.5,
424
+
425
+ label: 'no label',
426
+ fontname: 'sans',
427
+ fontcolor: '#000',
428
+
429
+ image: null
430
+ };
431
+
432
+ // Register the plugin
433
+ // -------------------
434
+ jq.fn.qrcode = function (options) {
435
+ var settings = jq.extend({}, defaults, options);
436
+
437
+ return this.each(function (idx, el) {
438
+ if (el.nodeName.toLowerCase() === 'canvas') {
439
+ drawOnCanvas(el, settings);
440
+ } else {
441
+ jq(el).append(createHTML(settings));
442
+ }
443
+ });
444
+ };
445
+ }(function () {
446
+ // `qrcode` is the single public function defined by the `QR Code Generator`
447
+ //---------------------------------------------------------------------
448
+ //
449
+ // QR Code Generator for JavaScript
450
+ //
451
+ // Copyright (c) 2009 Kazuhiko Arase
452
+ //
453
+ // URL: http://www.d-project.com/
454
+ //
455
+ // Licensed under the MIT license:
456
+ // http://www.opensource.org/licenses/mit-license.php
457
+ //
458
+ // The word 'QR Code' is registered trademark of
459
+ // DENSO WAVE INCORPORATED
460
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
461
+ //
462
+ //---------------------------------------------------------------------
463
+
464
+ var qrcode = function() {
465
+
466
+ //---------------------------------------------------------------------
467
+ // qrcode
468
+ //---------------------------------------------------------------------
469
+
470
+ /**
471
+ * qrcode
472
+ * @param typeNumber 1 to 40
473
+ * @param errorCorrectLevel 'L','M','Q','H'
474
+ */
475
+ var qrcode = function(typeNumber, errorCorrectLevel) {
476
+
477
+ var PAD0 = 0xEC;
478
+ var PAD1 = 0x11;
479
+
480
+ var _typeNumber = typeNumber;
481
+ var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
482
+ var _modules = null;
483
+ var _moduleCount = 0;
484
+ var _dataCache = null;
485
+ var _dataList = new Array();
486
+
487
+ var _this = {};
488
+
489
+ var makeImpl = function(test, maskPattern) {
490
+
491
+ _moduleCount = _typeNumber * 4 + 17;
492
+ _modules = function(moduleCount) {
493
+ var modules = new Array(moduleCount);
494
+ for (var row = 0; row < moduleCount; row += 1) {
495
+ modules[row] = new Array(moduleCount);
496
+ for (var col = 0; col < moduleCount; col += 1) {
497
+ modules[row][col] = null;
498
+ }
499
+ }
500
+ return modules;
501
+ }(_moduleCount);
502
+
503
+ setupPositionProbePattern(0, 0);
504
+ setupPositionProbePattern(_moduleCount - 7, 0);
505
+ setupPositionProbePattern(0, _moduleCount - 7);
506
+ setupPositionAdjustPattern();
507
+ setupTimingPattern();
508
+ setupTypeInfo(test, maskPattern);
509
+
510
+ if (_typeNumber >= 7) {
511
+ setupTypeNumber(test);
512
+ }
513
+
514
+ if (_dataCache == null) {
515
+ _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
516
+ }
517
+
518
+ mapData(_dataCache, maskPattern);
519
+ };
520
+
521
+ var setupPositionProbePattern = function(row, col) {
522
+
523
+ for (var r = -1; r <= 7; r += 1) {
524
+
525
+ if (row + r <= -1 || _moduleCount <= row + r) continue;
526
+
527
+ for (var c = -1; c <= 7; c += 1) {
528
+
529
+ if (col + c <= -1 || _moduleCount <= col + c) continue;
530
+
531
+ if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
532
+ || (0 <= c && c <= 6 && (r == 0 || r == 6) )
533
+ || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
534
+ _modules[row + r][col + c] = true;
535
+ } else {
536
+ _modules[row + r][col + c] = false;
537
+ }
538
+ }
539
+ }
540
+ };
541
+
542
+ var getBestMaskPattern = function() {
543
+
544
+ var minLostPoint = 0;
545
+ var pattern = 0;
546
+
547
+ for (var i = 0; i < 8; i += 1) {
548
+
549
+ makeImpl(true, i);
550
+
551
+ var lostPoint = QRUtil.getLostPoint(_this);
552
+
553
+ if (i == 0 || minLostPoint > lostPoint) {
554
+ minLostPoint = lostPoint;
555
+ pattern = i;
556
+ }
557
+ }
558
+
559
+ return pattern;
560
+ };
561
+
562
+ var setupTimingPattern = function() {
563
+
564
+ for (var r = 8; r < _moduleCount - 8; r += 1) {
565
+ if (_modules[r][6] != null) {
566
+ continue;
567
+ }
568
+ _modules[r][6] = (r % 2 == 0);
569
+ }
570
+
571
+ for (var c = 8; c < _moduleCount - 8; c += 1) {
572
+ if (_modules[6][c] != null) {
573
+ continue;
574
+ }
575
+ _modules[6][c] = (c % 2 == 0);
576
+ }
577
+ };
578
+
579
+ var setupPositionAdjustPattern = function() {
580
+
581
+ var pos = QRUtil.getPatternPosition(_typeNumber);
582
+
583
+ for (var i = 0; i < pos.length; i += 1) {
584
+
585
+ for (var j = 0; j < pos.length; j += 1) {
586
+
587
+ var row = pos[i];
588
+ var col = pos[j];
589
+
590
+ if (_modules[row][col] != null) {
591
+ continue;
592
+ }
593
+
594
+ for (var r = -2; r <= 2; r += 1) {
595
+
596
+ for (var c = -2; c <= 2; c += 1) {
597
+
598
+ if (r == -2 || r == 2 || c == -2 || c == 2
599
+ || (r == 0 && c == 0) ) {
600
+ _modules[row + r][col + c] = true;
601
+ } else {
602
+ _modules[row + r][col + c] = false;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ }
608
+ };
609
+
610
+ var setupTypeNumber = function(test) {
611
+
612
+ var bits = QRUtil.getBCHTypeNumber(_typeNumber);
613
+
614
+ for (var i = 0; i < 18; i += 1) {
615
+ var mod = (!test && ( (bits >> i) & 1) == 1);
616
+ _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
617
+ }
618
+
619
+ for (var i = 0; i < 18; i += 1) {
620
+ var mod = (!test && ( (bits >> i) & 1) == 1);
621
+ _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
622
+ }
623
+ };
624
+
625
+ var setupTypeInfo = function(test, maskPattern) {
626
+
627
+ var data = (_errorCorrectLevel << 3) | maskPattern;
628
+ var bits = QRUtil.getBCHTypeInfo(data);
629
+
630
+ // vertical
631
+ for (var i = 0; i < 15; i += 1) {
632
+
633
+ var mod = (!test && ( (bits >> i) & 1) == 1);
634
+
635
+ if (i < 6) {
636
+ _modules[i][8] = mod;
637
+ } else if (i < 8) {
638
+ _modules[i + 1][8] = mod;
639
+ } else {
640
+ _modules[_moduleCount - 15 + i][8] = mod;
641
+ }
642
+ }
643
+
644
+ // horizontal
645
+ for (var i = 0; i < 15; i += 1) {
646
+
647
+ var mod = (!test && ( (bits >> i) & 1) == 1);
648
+
649
+ if (i < 8) {
650
+ _modules[8][_moduleCount - i - 1] = mod;
651
+ } else if (i < 9) {
652
+ _modules[8][15 - i - 1 + 1] = mod;
653
+ } else {
654
+ _modules[8][15 - i - 1] = mod;
655
+ }
656
+ }
657
+
658
+ // fixed module
659
+ _modules[_moduleCount - 8][8] = (!test);
660
+ };
661
+
662
+ var mapData = function(data, maskPattern) {
663
+
664
+ var inc = -1;
665
+ var row = _moduleCount - 1;
666
+ var bitIndex = 7;
667
+ var byteIndex = 0;
668
+ var maskFunc = QRUtil.getMaskFunction(maskPattern);
669
+
670
+ for (var col = _moduleCount - 1; col > 0; col -= 2) {
671
+
672
+ if (col == 6) col -= 1;
673
+
674
+ while (true) {
675
+
676
+ for (var c = 0; c < 2; c += 1) {
677
+
678
+ if (_modules[row][col - c] == null) {
679
+
680
+ var dark = false;
681
+
682
+ if (byteIndex < data.length) {
683
+ dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
684
+ }
685
+
686
+ var mask = maskFunc(row, col - c);
687
+
688
+ if (mask) {
689
+ dark = !dark;
690
+ }
691
+
692
+ _modules[row][col - c] = dark;
693
+ bitIndex -= 1;
694
+
695
+ if (bitIndex == -1) {
696
+ byteIndex += 1;
697
+ bitIndex = 7;
698
+ }
699
+ }
700
+ }
701
+
702
+ row += inc;
703
+
704
+ if (row < 0 || _moduleCount <= row) {
705
+ row -= inc;
706
+ inc = -inc;
707
+ break;
708
+ }
709
+ }
710
+ }
711
+ };
712
+
713
+ var createBytes = function(buffer, rsBlocks) {
714
+
715
+ var offset = 0;
716
+
717
+ var maxDcCount = 0;
718
+ var maxEcCount = 0;
719
+
720
+ var dcdata = new Array(rsBlocks.length);
721
+ var ecdata = new Array(rsBlocks.length);
722
+
723
+ for (var r = 0; r < rsBlocks.length; r += 1) {
724
+
725
+ var dcCount = rsBlocks[r].dataCount;
726
+ var ecCount = rsBlocks[r].totalCount - dcCount;
727
+
728
+ maxDcCount = Math.max(maxDcCount, dcCount);
729
+ maxEcCount = Math.max(maxEcCount, ecCount);
730
+
731
+ dcdata[r] = new Array(dcCount);
732
+
733
+ for (var i = 0; i < dcdata[r].length; i += 1) {
734
+ dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
735
+ }
736
+ offset += dcCount;
737
+
738
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
739
+ var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
740
+
741
+ var modPoly = rawPoly.mod(rsPoly);
742
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
743
+ for (var i = 0; i < ecdata[r].length; i += 1) {
744
+ var modIndex = i + modPoly.getLength() - ecdata[r].length;
745
+ ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
746
+ }
747
+ }
748
+
749
+ var totalCodeCount = 0;
750
+ for (var i = 0; i < rsBlocks.length; i += 1) {
751
+ totalCodeCount += rsBlocks[i].totalCount;
752
+ }
753
+
754
+ var data = new Array(totalCodeCount);
755
+ var index = 0;
756
+
757
+ for (var i = 0; i < maxDcCount; i += 1) {
758
+ for (var r = 0; r < rsBlocks.length; r += 1) {
759
+ if (i < dcdata[r].length) {
760
+ data[index] = dcdata[r][i];
761
+ index += 1;
762
+ }
763
+ }
764
+ }
765
+
766
+ for (var i = 0; i < maxEcCount; i += 1) {
767
+ for (var r = 0; r < rsBlocks.length; r += 1) {
768
+ if (i < ecdata[r].length) {
769
+ data[index] = ecdata[r][i];
770
+ index += 1;
771
+ }
772
+ }
773
+ }
774
+
775
+ return data;
776
+ };
777
+
778
+ var createData = function(typeNumber, errorCorrectLevel, dataList) {
779
+
780
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
781
+
782
+ var buffer = qrBitBuffer();
783
+
784
+ for (var i = 0; i < dataList.length; i += 1) {
785
+ var data = dataList[i];
786
+ buffer.put(data.getMode(), 4);
787
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
788
+ data.write(buffer);
789
+ }
790
+
791
+ // calc num max data.
792
+ var totalDataCount = 0;
793
+ for (var i = 0; i < rsBlocks.length; i += 1) {
794
+ totalDataCount += rsBlocks[i].dataCount;
795
+ }
796
+
797
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
798
+ throw new Error('code length overflow. ('
799
+ + buffer.getLengthInBits()
800
+ + '>'
801
+ + totalDataCount * 8
802
+ + ')');
803
+ }
804
+
805
+ // end code
806
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
807
+ buffer.put(0, 4);
808
+ }
809
+
810
+ // padding
811
+ while (buffer.getLengthInBits() % 8 != 0) {
812
+ buffer.putBit(false);
813
+ }
814
+
815
+ // padding
816
+ while (true) {
817
+
818
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
819
+ break;
820
+ }
821
+ buffer.put(PAD0, 8);
822
+
823
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
824
+ break;
825
+ }
826
+ buffer.put(PAD1, 8);
827
+ }
828
+
829
+ return createBytes(buffer, rsBlocks);
830
+ };
831
+
832
+ _this.addData = function(data) {
833
+ var newData = qr8BitByte(data);
834
+ _dataList.push(newData);
835
+ _dataCache = null;
836
+ };
837
+
838
+ _this.isDark = function(row, col) {
839
+ if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
840
+ throw new Error(row + ',' + col);
841
+ }
842
+ return _modules[row][col];
843
+ };
844
+
845
+ _this.getModuleCount = function() {
846
+ return _moduleCount;
847
+ };
848
+
849
+ _this.make = function() {
850
+ makeImpl(false, getBestMaskPattern() );
851
+ };
852
+
853
+ _this.createTableTag = function(cellSize, margin) {
854
+
855
+ cellSize = cellSize || 2;
856
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
857
+
858
+ var qrHtml = '';
859
+
860
+ qrHtml += '<table style="';
861
+ qrHtml += ' border-width: 0px; border-style: none;';
862
+ qrHtml += ' border-collapse: collapse;';
863
+ qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
864
+ qrHtml += '">';
865
+ qrHtml += '<tbody>';
866
+
867
+ for (var r = 0; r < _this.getModuleCount(); r += 1) {
868
+
869
+ qrHtml += '<tr>';
870
+
871
+ for (var c = 0; c < _this.getModuleCount(); c += 1) {
872
+ qrHtml += '<td style="';
873
+ qrHtml += ' border-width: 0px; border-style: none;';
874
+ qrHtml += ' border-collapse: collapse;';
875
+ qrHtml += ' padding: 0px; margin: 0px;';
876
+ qrHtml += ' width: ' + cellSize + 'px;';
877
+ qrHtml += ' height: ' + cellSize + 'px;';
878
+ qrHtml += ' background-color: ';
879
+ qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
880
+ qrHtml += ';';
881
+ qrHtml += '"/>';
882
+ }
883
+
884
+ qrHtml += '</tr>';
885
+ }
886
+
887
+ qrHtml += '</tbody>';
888
+ qrHtml += '</table>';
889
+
890
+ return qrHtml;
891
+ };
892
+
893
+ _this.createImgTag = function(cellSize, margin) {
894
+
895
+ cellSize = cellSize || 2;
896
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
897
+
898
+ var size = _this.getModuleCount() * cellSize + margin * 2;
899
+ var min = margin;
900
+ var max = size - margin;
901
+
902
+ return createImgTag(size, size, function(x, y) {
903
+ if (min <= x && x < max && min <= y && y < max) {
904
+ var c = Math.floor( (x - min) / cellSize);
905
+ var r = Math.floor( (y - min) / cellSize);
906
+ return _this.isDark(r, c)? 0 : 1;
907
+ } else {
908
+ return 1;
909
+ }
910
+ } );
911
+ };
912
+
913
+ return _this;
914
+ };
915
+
916
+ //---------------------------------------------------------------------
917
+ // qrcode.stringToBytes
918
+ //---------------------------------------------------------------------
919
+
920
+ qrcode.stringToBytes = function(s) {
921
+ var bytes = new Array();
922
+ for (var i = 0; i < s.length; i += 1) {
923
+ var c = s.charCodeAt(i);
924
+ bytes.push(c & 0xff);
925
+ }
926
+ return bytes;
927
+ };
928
+
929
+ //---------------------------------------------------------------------
930
+ // qrcode.createStringToBytes
931
+ //---------------------------------------------------------------------
932
+
933
+ /**
934
+ * @param unicodeData base64 string of byte array.
935
+ * [16bit Unicode],[16bit Bytes], ...
936
+ * @param numChars
937
+ */
938
+ qrcode.createStringToBytes = function(unicodeData, numChars) {
939
+
940
+ // create conversion map.
941
+
942
+ var unicodeMap = function() {
943
+
944
+ var bin = base64DecodeInputStream(unicodeData);
945
+ var read = function() {
946
+ var b = bin.read();
947
+ if (b == -1) throw new Error();
948
+ return b;
949
+ };
950
+
951
+ var count = 0;
952
+ var unicodeMap = {};
953
+ while (true) {
954
+ var b0 = bin.read();
955
+ if (b0 == -1) break;
956
+ var b1 = read();
957
+ var b2 = read();
958
+ var b3 = read();
959
+ var k = String.fromCharCode( (b0 << 8) | b1);
960
+ var v = (b2 << 8) | b3;
961
+ unicodeMap[k] = v;
962
+ count += 1;
963
+ }
964
+ if (count != numChars) {
965
+ throw new Error(count + ' != ' + numChars);
966
+ }
967
+
968
+ return unicodeMap;
969
+ }();
970
+
971
+ var unknownChar = '?'.charCodeAt(0);
972
+
973
+ return function(s) {
974
+ var bytes = new Array();
975
+ for (var i = 0; i < s.length; i += 1) {
976
+ var c = s.charCodeAt(i);
977
+ if (c < 128) {
978
+ bytes.push(c);
979
+ } else {
980
+ var b = unicodeMap[s.charAt(i)];
981
+ if (typeof b == 'number') {
982
+ if ( (b & 0xff) == b) {
983
+ // 1byte
984
+ bytes.push(b);
985
+ } else {
986
+ // 2bytes
987
+ bytes.push(b >>> 8);
988
+ bytes.push(b & 0xff);
989
+ }
990
+ } else {
991
+ bytes.push(unknownChar);
992
+ }
993
+ }
994
+ }
995
+ return bytes;
996
+ };
997
+ };
998
+
999
+ //---------------------------------------------------------------------
1000
+ // QRMode
1001
+ //---------------------------------------------------------------------
1002
+
1003
+ var QRMode = {
1004
+ MODE_NUMBER : 1 << 0,
1005
+ MODE_ALPHA_NUM : 1 << 1,
1006
+ MODE_8BIT_BYTE : 1 << 2,
1007
+ MODE_KANJI : 1 << 3
1008
+ };
1009
+
1010
+ //---------------------------------------------------------------------
1011
+ // QRErrorCorrectLevel
1012
+ //---------------------------------------------------------------------
1013
+
1014
+ var QRErrorCorrectLevel = {
1015
+ L : 1,
1016
+ M : 0,
1017
+ Q : 3,
1018
+ H : 2
1019
+ };
1020
+
1021
+ //---------------------------------------------------------------------
1022
+ // QRMaskPattern
1023
+ //---------------------------------------------------------------------
1024
+
1025
+ var QRMaskPattern = {
1026
+ PATTERN000 : 0,
1027
+ PATTERN001 : 1,
1028
+ PATTERN010 : 2,
1029
+ PATTERN011 : 3,
1030
+ PATTERN100 : 4,
1031
+ PATTERN101 : 5,
1032
+ PATTERN110 : 6,
1033
+ PATTERN111 : 7
1034
+ };
1035
+
1036
+ //---------------------------------------------------------------------
1037
+ // QRUtil
1038
+ //---------------------------------------------------------------------
1039
+
1040
+ var QRUtil = function() {
1041
+
1042
+ var PATTERN_POSITION_TABLE = [
1043
+ [],
1044
+ [6, 18],
1045
+ [6, 22],
1046
+ [6, 26],
1047
+ [6, 30],
1048
+ [6, 34],
1049
+ [6, 22, 38],
1050
+ [6, 24, 42],
1051
+ [6, 26, 46],
1052
+ [6, 28, 50],
1053
+ [6, 30, 54],
1054
+ [6, 32, 58],
1055
+ [6, 34, 62],
1056
+ [6, 26, 46, 66],
1057
+ [6, 26, 48, 70],
1058
+ [6, 26, 50, 74],
1059
+ [6, 30, 54, 78],
1060
+ [6, 30, 56, 82],
1061
+ [6, 30, 58, 86],
1062
+ [6, 34, 62, 90],
1063
+ [6, 28, 50, 72, 94],
1064
+ [6, 26, 50, 74, 98],
1065
+ [6, 30, 54, 78, 102],
1066
+ [6, 28, 54, 80, 106],
1067
+ [6, 32, 58, 84, 110],
1068
+ [6, 30, 58, 86, 114],
1069
+ [6, 34, 62, 90, 118],
1070
+ [6, 26, 50, 74, 98, 122],
1071
+ [6, 30, 54, 78, 102, 126],
1072
+ [6, 26, 52, 78, 104, 130],
1073
+ [6, 30, 56, 82, 108, 134],
1074
+ [6, 34, 60, 86, 112, 138],
1075
+ [6, 30, 58, 86, 114, 142],
1076
+ [6, 34, 62, 90, 118, 146],
1077
+ [6, 30, 54, 78, 102, 126, 150],
1078
+ [6, 24, 50, 76, 102, 128, 154],
1079
+ [6, 28, 54, 80, 106, 132, 158],
1080
+ [6, 32, 58, 84, 110, 136, 162],
1081
+ [6, 26, 54, 82, 110, 138, 166],
1082
+ [6, 30, 58, 86, 114, 142, 170]
1083
+ ];
1084
+ var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
1085
+ var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
1086
+ var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
1087
+
1088
+ var _this = {};
1089
+
1090
+ var getBCHDigit = function(data) {
1091
+ var digit = 0;
1092
+ while (data != 0) {
1093
+ digit += 1;
1094
+ data >>>= 1;
1095
+ }
1096
+ return digit;
1097
+ };
1098
+
1099
+ _this.getBCHTypeInfo = function(data) {
1100
+ var d = data << 10;
1101
+ while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
1102
+ d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
1103
+ }
1104
+ return ( (data << 10) | d) ^ G15_MASK;
1105
+ };
1106
+
1107
+ _this.getBCHTypeNumber = function(data) {
1108
+ var d = data << 12;
1109
+ while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
1110
+ d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
1111
+ }
1112
+ return (data << 12) | d;
1113
+ };
1114
+
1115
+ _this.getPatternPosition = function(typeNumber) {
1116
+ return PATTERN_POSITION_TABLE[typeNumber - 1];
1117
+ };
1118
+
1119
+ _this.getMaskFunction = function(maskPattern) {
1120
+
1121
+ switch (maskPattern) {
1122
+
1123
+ case QRMaskPattern.PATTERN000 :
1124
+ return function(i, j) { return (i + j) % 2 == 0; };
1125
+ case QRMaskPattern.PATTERN001 :
1126
+ return function(i, j) { return i % 2 == 0; };
1127
+ case QRMaskPattern.PATTERN010 :
1128
+ return function(i, j) { return j % 3 == 0; };
1129
+ case QRMaskPattern.PATTERN011 :
1130
+ return function(i, j) { return (i + j) % 3 == 0; };
1131
+ case QRMaskPattern.PATTERN100 :
1132
+ return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
1133
+ case QRMaskPattern.PATTERN101 :
1134
+ return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
1135
+ case QRMaskPattern.PATTERN110 :
1136
+ return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
1137
+ case QRMaskPattern.PATTERN111 :
1138
+ return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };
1139
+
1140
+ default :
1141
+ throw new Error('bad maskPattern:' + maskPattern);
1142
+ }
1143
+ };
1144
+
1145
+ _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
1146
+ var a = qrPolynomial([1], 0);
1147
+ for (var i = 0; i < errorCorrectLength; i += 1) {
1148
+ a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
1149
+ }
1150
+ return a;
1151
+ };
1152
+
1153
+ _this.getLengthInBits = function(mode, type) {
1154
+
1155
+ if (1 <= type && type < 10) {
1156
+
1157
+ // 1 - 9
1158
+
1159
+ switch(mode) {
1160
+ case QRMode.MODE_NUMBER : return 10;
1161
+ case QRMode.MODE_ALPHA_NUM : return 9;
1162
+ case QRMode.MODE_8BIT_BYTE : return 8;
1163
+ case QRMode.MODE_KANJI : return 8;
1164
+ default :
1165
+ throw new Error('mode:' + mode);
1166
+ }
1167
+
1168
+ } else if (type < 27) {
1169
+
1170
+ // 10 - 26
1171
+
1172
+ switch(mode) {
1173
+ case QRMode.MODE_NUMBER : return 12;
1174
+ case QRMode.MODE_ALPHA_NUM : return 11;
1175
+ case QRMode.MODE_8BIT_BYTE : return 16;
1176
+ case QRMode.MODE_KANJI : return 10;
1177
+ default :
1178
+ throw new Error('mode:' + mode);
1179
+ }
1180
+
1181
+ } else if (type < 41) {
1182
+
1183
+ // 27 - 40
1184
+
1185
+ switch(mode) {
1186
+ case QRMode.MODE_NUMBER : return 14;
1187
+ case QRMode.MODE_ALPHA_NUM : return 13;
1188
+ case QRMode.MODE_8BIT_BYTE : return 16;
1189
+ case QRMode.MODE_KANJI : return 12;
1190
+ default :
1191
+ throw new Error('mode:' + mode);
1192
+ }
1193
+
1194
+ } else {
1195
+ throw new Error('type:' + type);
1196
+ }
1197
+ };
1198
+
1199
+ _this.getLostPoint = function(qrcode) {
1200
+
1201
+ var moduleCount = qrcode.getModuleCount();
1202
+
1203
+ var lostPoint = 0;
1204
+
1205
+ // LEVEL1
1206
+
1207
+ for (var row = 0; row < moduleCount; row += 1) {
1208
+ for (var col = 0; col < moduleCount; col += 1) {
1209
+
1210
+ var sameCount = 0;
1211
+ var dark = qrcode.isDark(row, col);
1212
+
1213
+ for (var r = -1; r <= 1; r += 1) {
1214
+
1215
+ if (row + r < 0 || moduleCount <= row + r) {
1216
+ continue;
1217
+ }
1218
+
1219
+ for (var c = -1; c <= 1; c += 1) {
1220
+
1221
+ if (col + c < 0 || moduleCount <= col + c) {
1222
+ continue;
1223
+ }
1224
+
1225
+ if (r == 0 && c == 0) {
1226
+ continue;
1227
+ }
1228
+
1229
+ if (dark == qrcode.isDark(row + r, col + c) ) {
1230
+ sameCount += 1;
1231
+ }
1232
+ }
1233
+ }
1234
+
1235
+ if (sameCount > 5) {
1236
+ lostPoint += (3 + sameCount - 5);
1237
+ }
1238
+ }
1239
+ };
1240
+
1241
+ // LEVEL2
1242
+
1243
+ for (var row = 0; row < moduleCount - 1; row += 1) {
1244
+ for (var col = 0; col < moduleCount - 1; col += 1) {
1245
+ var count = 0;
1246
+ if (qrcode.isDark(row, col) ) count += 1;
1247
+ if (qrcode.isDark(row + 1, col) ) count += 1;
1248
+ if (qrcode.isDark(row, col + 1) ) count += 1;
1249
+ if (qrcode.isDark(row + 1, col + 1) ) count += 1;
1250
+ if (count == 0 || count == 4) {
1251
+ lostPoint += 3;
1252
+ }
1253
+ }
1254
+ }
1255
+
1256
+ // LEVEL3
1257
+
1258
+ for (var row = 0; row < moduleCount; row += 1) {
1259
+ for (var col = 0; col < moduleCount - 6; col += 1) {
1260
+ if (qrcode.isDark(row, col)
1261
+ && !qrcode.isDark(row, col + 1)
1262
+ && qrcode.isDark(row, col + 2)
1263
+ && qrcode.isDark(row, col + 3)
1264
+ && qrcode.isDark(row, col + 4)
1265
+ && !qrcode.isDark(row, col + 5)
1266
+ && qrcode.isDark(row, col + 6) ) {
1267
+ lostPoint += 40;
1268
+ }
1269
+ }
1270
+ }
1271
+
1272
+ for (var col = 0; col < moduleCount; col += 1) {
1273
+ for (var row = 0; row < moduleCount - 6; row += 1) {
1274
+ if (qrcode.isDark(row, col)
1275
+ && !qrcode.isDark(row + 1, col)
1276
+ && qrcode.isDark(row + 2, col)
1277
+ && qrcode.isDark(row + 3, col)
1278
+ && qrcode.isDark(row + 4, col)
1279
+ && !qrcode.isDark(row + 5, col)
1280
+ && qrcode.isDark(row + 6, col) ) {
1281
+ lostPoint += 40;
1282
+ }
1283
+ }
1284
+ }
1285
+
1286
+ // LEVEL4
1287
+
1288
+ var darkCount = 0;
1289
+
1290
+ for (var col = 0; col < moduleCount; col += 1) {
1291
+ for (var row = 0; row < moduleCount; row += 1) {
1292
+ if (qrcode.isDark(row, col) ) {
1293
+ darkCount += 1;
1294
+ }
1295
+ }
1296
+ }
1297
+
1298
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
1299
+ lostPoint += ratio * 10;
1300
+
1301
+ return lostPoint;
1302
+ };
1303
+
1304
+ return _this;
1305
+ }();
1306
+
1307
+ //---------------------------------------------------------------------
1308
+ // QRMath
1309
+ //---------------------------------------------------------------------
1310
+
1311
+ var QRMath = function() {
1312
+
1313
+ var EXP_TABLE = new Array(256);
1314
+ var LOG_TABLE = new Array(256);
1315
+
1316
+ // initialize tables
1317
+ for (var i = 0; i < 8; i += 1) {
1318
+ EXP_TABLE[i] = 1 << i;
1319
+ }
1320
+ for (var i = 8; i < 256; i += 1) {
1321
+ EXP_TABLE[i] = EXP_TABLE[i - 4]
1322
+ ^ EXP_TABLE[i - 5]
1323
+ ^ EXP_TABLE[i - 6]
1324
+ ^ EXP_TABLE[i - 8];
1325
+ }
1326
+ for (var i = 0; i < 255; i += 1) {
1327
+ LOG_TABLE[EXP_TABLE[i] ] = i;
1328
+ }
1329
+
1330
+ var _this = {};
1331
+
1332
+ _this.glog = function(n) {
1333
+
1334
+ if (n < 1) {
1335
+ throw new Error('glog(' + n + ')');
1336
+ }
1337
+
1338
+ return LOG_TABLE[n];
1339
+ };
1340
+
1341
+ _this.gexp = function(n) {
1342
+
1343
+ while (n < 0) {
1344
+ n += 255;
1345
+ }
1346
+
1347
+ while (n >= 256) {
1348
+ n -= 255;
1349
+ }
1350
+
1351
+ return EXP_TABLE[n];
1352
+ };
1353
+
1354
+ return _this;
1355
+ }();
1356
+
1357
+ //---------------------------------------------------------------------
1358
+ // qrPolynomial
1359
+ //---------------------------------------------------------------------
1360
+
1361
+ function qrPolynomial(num, shift) {
1362
+
1363
+ if (typeof num.length == 'undefined') {
1364
+ throw new Error(num.length + '/' + shift);
1365
+ }
1366
+
1367
+ var _num = function() {
1368
+ var offset = 0;
1369
+ while (offset < num.length && num[offset] == 0) {
1370
+ offset += 1;
1371
+ }
1372
+ var _num = new Array(num.length - offset + shift);
1373
+ for (var i = 0; i < num.length - offset; i += 1) {
1374
+ _num[i] = num[i + offset];
1375
+ }
1376
+ return _num;
1377
+ }();
1378
+
1379
+ var _this = {};
1380
+
1381
+ _this.getAt = function(index) {
1382
+ return _num[index];
1383
+ };
1384
+
1385
+ _this.getLength = function() {
1386
+ return _num.length;
1387
+ };
1388
+
1389
+ _this.multiply = function(e) {
1390
+
1391
+ var num = new Array(_this.getLength() + e.getLength() - 1);
1392
+
1393
+ for (var i = 0; i < _this.getLength(); i += 1) {
1394
+ for (var j = 0; j < e.getLength(); j += 1) {
1395
+ num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
1396
+ }
1397
+ }
1398
+
1399
+ return qrPolynomial(num, 0);
1400
+ };
1401
+
1402
+ _this.mod = function(e) {
1403
+
1404
+ if (_this.getLength() - e.getLength() < 0) {
1405
+ return _this;
1406
+ }
1407
+
1408
+ var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );
1409
+
1410
+ var num = new Array(_this.getLength() );
1411
+ for (var i = 0; i < _this.getLength(); i += 1) {
1412
+ num[i] = _this.getAt(i);
1413
+ }
1414
+
1415
+ for (var i = 0; i < e.getLength(); i += 1) {
1416
+ num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
1417
+ }
1418
+
1419
+ // recursive call
1420
+ return qrPolynomial(num, 0).mod(e);
1421
+ };
1422
+
1423
+ return _this;
1424
+ };
1425
+
1426
+ //---------------------------------------------------------------------
1427
+ // QRRSBlock
1428
+ //---------------------------------------------------------------------
1429
+
1430
+ var QRRSBlock = function() {
1431
+
1432
+ var RS_BLOCK_TABLE = [
1433
+
1434
+ // L
1435
+ // M
1436
+ // Q
1437
+ // H
1438
+
1439
+ // 1
1440
+ [1, 26, 19],
1441
+ [1, 26, 16],
1442
+ [1, 26, 13],
1443
+ [1, 26, 9],
1444
+
1445
+ // 2
1446
+ [1, 44, 34],
1447
+ [1, 44, 28],
1448
+ [1, 44, 22],
1449
+ [1, 44, 16],
1450
+
1451
+ // 3
1452
+ [1, 70, 55],
1453
+ [1, 70, 44],
1454
+ [2, 35, 17],
1455
+ [2, 35, 13],
1456
+
1457
+ // 4
1458
+ [1, 100, 80],
1459
+ [2, 50, 32],
1460
+ [2, 50, 24],
1461
+ [4, 25, 9],
1462
+
1463
+ // 5
1464
+ [1, 134, 108],
1465
+ [2, 67, 43],
1466
+ [2, 33, 15, 2, 34, 16],
1467
+ [2, 33, 11, 2, 34, 12],
1468
+
1469
+ // 6
1470
+ [2, 86, 68],
1471
+ [4, 43, 27],
1472
+ [4, 43, 19],
1473
+ [4, 43, 15],
1474
+
1475
+ // 7
1476
+ [2, 98, 78],
1477
+ [4, 49, 31],
1478
+ [2, 32, 14, 4, 33, 15],
1479
+ [4, 39, 13, 1, 40, 14],
1480
+
1481
+ // 8
1482
+ [2, 121, 97],
1483
+ [2, 60, 38, 2, 61, 39],
1484
+ [4, 40, 18, 2, 41, 19],
1485
+ [4, 40, 14, 2, 41, 15],
1486
+
1487
+ // 9
1488
+ [2, 146, 116],
1489
+ [3, 58, 36, 2, 59, 37],
1490
+ [4, 36, 16, 4, 37, 17],
1491
+ [4, 36, 12, 4, 37, 13],
1492
+
1493
+ // 10
1494
+ [2, 86, 68, 2, 87, 69],
1495
+ [4, 69, 43, 1, 70, 44],
1496
+ [6, 43, 19, 2, 44, 20],
1497
+ [6, 43, 15, 2, 44, 16],
1498
+
1499
+ // 11
1500
+ [4, 101, 81],
1501
+ [1, 80, 50, 4, 81, 51],
1502
+ [4, 50, 22, 4, 51, 23],
1503
+ [3, 36, 12, 8, 37, 13],
1504
+
1505
+ // 12
1506
+ [2, 116, 92, 2, 117, 93],
1507
+ [6, 58, 36, 2, 59, 37],
1508
+ [4, 46, 20, 6, 47, 21],
1509
+ [7, 42, 14, 4, 43, 15],
1510
+
1511
+ // 13
1512
+ [4, 133, 107],
1513
+ [8, 59, 37, 1, 60, 38],
1514
+ [8, 44, 20, 4, 45, 21],
1515
+ [12, 33, 11, 4, 34, 12],
1516
+
1517
+ // 14
1518
+ [3, 145, 115, 1, 146, 116],
1519
+ [4, 64, 40, 5, 65, 41],
1520
+ [11, 36, 16, 5, 37, 17],
1521
+ [11, 36, 12, 5, 37, 13],
1522
+
1523
+ // 15
1524
+ [5, 109, 87, 1, 110, 88],
1525
+ [5, 65, 41, 5, 66, 42],
1526
+ [5, 54, 24, 7, 55, 25],
1527
+ [11, 36, 12, 7, 37, 13],
1528
+
1529
+ // 16
1530
+ [5, 122, 98, 1, 123, 99],
1531
+ [7, 73, 45, 3, 74, 46],
1532
+ [15, 43, 19, 2, 44, 20],
1533
+ [3, 45, 15, 13, 46, 16],
1534
+
1535
+ // 17
1536
+ [1, 135, 107, 5, 136, 108],
1537
+ [10, 74, 46, 1, 75, 47],
1538
+ [1, 50, 22, 15, 51, 23],
1539
+ [2, 42, 14, 17, 43, 15],
1540
+
1541
+ // 18
1542
+ [5, 150, 120, 1, 151, 121],
1543
+ [9, 69, 43, 4, 70, 44],
1544
+ [17, 50, 22, 1, 51, 23],
1545
+ [2, 42, 14, 19, 43, 15],
1546
+
1547
+ // 19
1548
+ [3, 141, 113, 4, 142, 114],
1549
+ [3, 70, 44, 11, 71, 45],
1550
+ [17, 47, 21, 4, 48, 22],
1551
+ [9, 39, 13, 16, 40, 14],
1552
+
1553
+ // 20
1554
+ [3, 135, 107, 5, 136, 108],
1555
+ [3, 67, 41, 13, 68, 42],
1556
+ [15, 54, 24, 5, 55, 25],
1557
+ [15, 43, 15, 10, 44, 16],
1558
+
1559
+ // 21
1560
+ [4, 144, 116, 4, 145, 117],
1561
+ [17, 68, 42],
1562
+ [17, 50, 22, 6, 51, 23],
1563
+ [19, 46, 16, 6, 47, 17],
1564
+
1565
+ // 22
1566
+ [2, 139, 111, 7, 140, 112],
1567
+ [17, 74, 46],
1568
+ [7, 54, 24, 16, 55, 25],
1569
+ [34, 37, 13],
1570
+
1571
+ // 23
1572
+ [4, 151, 121, 5, 152, 122],
1573
+ [4, 75, 47, 14, 76, 48],
1574
+ [11, 54, 24, 14, 55, 25],
1575
+ [16, 45, 15, 14, 46, 16],
1576
+
1577
+ // 24
1578
+ [6, 147, 117, 4, 148, 118],
1579
+ [6, 73, 45, 14, 74, 46],
1580
+ [11, 54, 24, 16, 55, 25],
1581
+ [30, 46, 16, 2, 47, 17],
1582
+
1583
+ // 25
1584
+ [8, 132, 106, 4, 133, 107],
1585
+ [8, 75, 47, 13, 76, 48],
1586
+ [7, 54, 24, 22, 55, 25],
1587
+ [22, 45, 15, 13, 46, 16],
1588
+
1589
+ // 26
1590
+ [10, 142, 114, 2, 143, 115],
1591
+ [19, 74, 46, 4, 75, 47],
1592
+ [28, 50, 22, 6, 51, 23],
1593
+ [33, 46, 16, 4, 47, 17],
1594
+
1595
+ // 27
1596
+ [8, 152, 122, 4, 153, 123],
1597
+ [22, 73, 45, 3, 74, 46],
1598
+ [8, 53, 23, 26, 54, 24],
1599
+ [12, 45, 15, 28, 46, 16],
1600
+
1601
+ // 28
1602
+ [3, 147, 117, 10, 148, 118],
1603
+ [3, 73, 45, 23, 74, 46],
1604
+ [4, 54, 24, 31, 55, 25],
1605
+ [11, 45, 15, 31, 46, 16],
1606
+
1607
+ // 29
1608
+ [7, 146, 116, 7, 147, 117],
1609
+ [21, 73, 45, 7, 74, 46],
1610
+ [1, 53, 23, 37, 54, 24],
1611
+ [19, 45, 15, 26, 46, 16],
1612
+
1613
+ // 30
1614
+ [5, 145, 115, 10, 146, 116],
1615
+ [19, 75, 47, 10, 76, 48],
1616
+ [15, 54, 24, 25, 55, 25],
1617
+ [23, 45, 15, 25, 46, 16],
1618
+
1619
+ // 31
1620
+ [13, 145, 115, 3, 146, 116],
1621
+ [2, 74, 46, 29, 75, 47],
1622
+ [42, 54, 24, 1, 55, 25],
1623
+ [23, 45, 15, 28, 46, 16],
1624
+
1625
+ // 32
1626
+ [17, 145, 115],
1627
+ [10, 74, 46, 23, 75, 47],
1628
+ [10, 54, 24, 35, 55, 25],
1629
+ [19, 45, 15, 35, 46, 16],
1630
+
1631
+ // 33
1632
+ [17, 145, 115, 1, 146, 116],
1633
+ [14, 74, 46, 21, 75, 47],
1634
+ [29, 54, 24, 19, 55, 25],
1635
+ [11, 45, 15, 46, 46, 16],
1636
+
1637
+ // 34
1638
+ [13, 145, 115, 6, 146, 116],
1639
+ [14, 74, 46, 23, 75, 47],
1640
+ [44, 54, 24, 7, 55, 25],
1641
+ [59, 46, 16, 1, 47, 17],
1642
+
1643
+ // 35
1644
+ [12, 151, 121, 7, 152, 122],
1645
+ [12, 75, 47, 26, 76, 48],
1646
+ [39, 54, 24, 14, 55, 25],
1647
+ [22, 45, 15, 41, 46, 16],
1648
+
1649
+ // 36
1650
+ [6, 151, 121, 14, 152, 122],
1651
+ [6, 75, 47, 34, 76, 48],
1652
+ [46, 54, 24, 10, 55, 25],
1653
+ [2, 45, 15, 64, 46, 16],
1654
+
1655
+ // 37
1656
+ [17, 152, 122, 4, 153, 123],
1657
+ [29, 74, 46, 14, 75, 47],
1658
+ [49, 54, 24, 10, 55, 25],
1659
+ [24, 45, 15, 46, 46, 16],
1660
+
1661
+ // 38
1662
+ [4, 152, 122, 18, 153, 123],
1663
+ [13, 74, 46, 32, 75, 47],
1664
+ [48, 54, 24, 14, 55, 25],
1665
+ [42, 45, 15, 32, 46, 16],
1666
+
1667
+ // 39
1668
+ [20, 147, 117, 4, 148, 118],
1669
+ [40, 75, 47, 7, 76, 48],
1670
+ [43, 54, 24, 22, 55, 25],
1671
+ [10, 45, 15, 67, 46, 16],
1672
+
1673
+ // 40
1674
+ [19, 148, 118, 6, 149, 119],
1675
+ [18, 75, 47, 31, 76, 48],
1676
+ [34, 54, 24, 34, 55, 25],
1677
+ [20, 45, 15, 61, 46, 16]
1678
+ ];
1679
+
1680
+ var qrRSBlock = function(totalCount, dataCount) {
1681
+ var _this = {};
1682
+ _this.totalCount = totalCount;
1683
+ _this.dataCount = dataCount;
1684
+ return _this;
1685
+ };
1686
+
1687
+ var _this = {};
1688
+
1689
+ var getRsBlockTable = function(typeNumber, errorCorrectLevel) {
1690
+
1691
+ switch(errorCorrectLevel) {
1692
+ case QRErrorCorrectLevel.L :
1693
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
1694
+ case QRErrorCorrectLevel.M :
1695
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
1696
+ case QRErrorCorrectLevel.Q :
1697
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
1698
+ case QRErrorCorrectLevel.H :
1699
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
1700
+ default :
1701
+ return undefined;
1702
+ }
1703
+ };
1704
+
1705
+ _this.getRSBlocks = function(typeNumber, errorCorrectLevel) {
1706
+
1707
+ var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
1708
+
1709
+ if (typeof rsBlock == 'undefined') {
1710
+ throw new Error('bad rs block @ typeNumber:' + typeNumber +
1711
+ '/errorCorrectLevel:' + errorCorrectLevel);
1712
+ }
1713
+
1714
+ var length = rsBlock.length / 3;
1715
+
1716
+ var list = new Array();
1717
+
1718
+ for (var i = 0; i < length; i += 1) {
1719
+
1720
+ var count = rsBlock[i * 3 + 0];
1721
+ var totalCount = rsBlock[i * 3 + 1];
1722
+ var dataCount = rsBlock[i * 3 + 2];
1723
+
1724
+ for (var j = 0; j < count; j += 1) {
1725
+ list.push(qrRSBlock(totalCount, dataCount) );
1726
+ }
1727
+ }
1728
+
1729
+ return list;
1730
+ };
1731
+
1732
+ return _this;
1733
+ }();
1734
+
1735
+ //---------------------------------------------------------------------
1736
+ // qrBitBuffer
1737
+ //---------------------------------------------------------------------
1738
+
1739
+ var qrBitBuffer = function() {
1740
+
1741
+ var _buffer = new Array();
1742
+ var _length = 0;
1743
+
1744
+ var _this = {};
1745
+
1746
+ _this.getBuffer = function() {
1747
+ return _buffer;
1748
+ };
1749
+
1750
+ _this.getAt = function(index) {
1751
+ var bufIndex = Math.floor(index / 8);
1752
+ return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
1753
+ };
1754
+
1755
+ _this.put = function(num, length) {
1756
+ for (var i = 0; i < length; i += 1) {
1757
+ _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
1758
+ }
1759
+ };
1760
+
1761
+ _this.getLengthInBits = function() {
1762
+ return _length;
1763
+ };
1764
+
1765
+ _this.putBit = function(bit) {
1766
+
1767
+ var bufIndex = Math.floor(_length / 8);
1768
+ if (_buffer.length <= bufIndex) {
1769
+ _buffer.push(0);
1770
+ }
1771
+
1772
+ if (bit) {
1773
+ _buffer[bufIndex] |= (0x80 >>> (_length % 8) );
1774
+ }
1775
+
1776
+ _length += 1;
1777
+ };
1778
+
1779
+ return _this;
1780
+ };
1781
+
1782
+ //---------------------------------------------------------------------
1783
+ // qr8BitByte
1784
+ //---------------------------------------------------------------------
1785
+
1786
+ var qr8BitByte = function(data) {
1787
+
1788
+ var _mode = QRMode.MODE_8BIT_BYTE;
1789
+ var _data = data;
1790
+ var _bytes = qrcode.stringToBytes(data);
1791
+
1792
+ var _this = {};
1793
+
1794
+ _this.getMode = function() {
1795
+ return _mode;
1796
+ };
1797
+
1798
+ _this.getLength = function(buffer) {
1799
+ return _bytes.length;
1800
+ };
1801
+
1802
+ _this.write = function(buffer) {
1803
+ for (var i = 0; i < _bytes.length; i += 1) {
1804
+ buffer.put(_bytes[i], 8);
1805
+ }
1806
+ };
1807
+
1808
+ return _this;
1809
+ };
1810
+
1811
+ //=====================================================================
1812
+ // GIF Support etc.
1813
+ //
1814
+
1815
+ //---------------------------------------------------------------------
1816
+ // byteArrayOutputStream
1817
+ //---------------------------------------------------------------------
1818
+
1819
+ var byteArrayOutputStream = function() {
1820
+
1821
+ var _bytes = new Array();
1822
+
1823
+ var _this = {};
1824
+
1825
+ _this.writeByte = function(b) {
1826
+ _bytes.push(b & 0xff);
1827
+ };
1828
+
1829
+ _this.writeShort = function(i) {
1830
+ _this.writeByte(i);
1831
+ _this.writeByte(i >>> 8);
1832
+ };
1833
+
1834
+ _this.writeBytes = function(b, off, len) {
1835
+ off = off || 0;
1836
+ len = len || b.length;
1837
+ for (var i = 0; i < len; i += 1) {
1838
+ _this.writeByte(b[i + off]);
1839
+ }
1840
+ };
1841
+
1842
+ _this.writeString = function(s) {
1843
+ for (var i = 0; i < s.length; i += 1) {
1844
+ _this.writeByte(s.charCodeAt(i) );
1845
+ }
1846
+ };
1847
+
1848
+ _this.toByteArray = function() {
1849
+ return _bytes;
1850
+ };
1851
+
1852
+ _this.toString = function() {
1853
+ var s = '';
1854
+ s += '[';
1855
+ for (var i = 0; i < _bytes.length; i += 1) {
1856
+ if (i > 0) {
1857
+ s += ',';
1858
+ }
1859
+ s += _bytes[i];
1860
+ }
1861
+ s += ']';
1862
+ return s;
1863
+ };
1864
+
1865
+ return _this;
1866
+ };
1867
+
1868
+ //---------------------------------------------------------------------
1869
+ // base64EncodeOutputStream
1870
+ //---------------------------------------------------------------------
1871
+
1872
+ var base64EncodeOutputStream = function() {
1873
+
1874
+ var _buffer = 0;
1875
+ var _buflen = 0;
1876
+ var _length = 0;
1877
+ var _base64 = '';
1878
+
1879
+ var _this = {};
1880
+
1881
+ var writeEncoded = function(b) {
1882
+ _base64 += String.fromCharCode(encode(b & 0x3f) );
1883
+ };
1884
+
1885
+ var encode = function(n) {
1886
+ if (n < 0) {
1887
+ // error.
1888
+ } else if (n < 26) {
1889
+ return 0x41 + n;
1890
+ } else if (n < 52) {
1891
+ return 0x61 + (n - 26);
1892
+ } else if (n < 62) {
1893
+ return 0x30 + (n - 52);
1894
+ } else if (n == 62) {
1895
+ return 0x2b;
1896
+ } else if (n == 63) {
1897
+ return 0x2f;
1898
+ }
1899
+ throw new Error('n:' + n);
1900
+ };
1901
+
1902
+ _this.writeByte = function(n) {
1903
+
1904
+ _buffer = (_buffer << 8) | (n & 0xff);
1905
+ _buflen += 8;
1906
+ _length += 1;
1907
+
1908
+ while (_buflen >= 6) {
1909
+ writeEncoded(_buffer >>> (_buflen - 6) );
1910
+ _buflen -= 6;
1911
+ }
1912
+ };
1913
+
1914
+ _this.flush = function() {
1915
+
1916
+ if (_buflen > 0) {
1917
+ writeEncoded(_buffer << (6 - _buflen) );
1918
+ _buffer = 0;
1919
+ _buflen = 0;
1920
+ }
1921
+
1922
+ if (_length % 3 != 0) {
1923
+ // padding
1924
+ var padlen = 3 - _length % 3;
1925
+ for (var i = 0; i < padlen; i += 1) {
1926
+ _base64 += '=';
1927
+ }
1928
+ }
1929
+ };
1930
+
1931
+ _this.toString = function() {
1932
+ return _base64;
1933
+ };
1934
+
1935
+ return _this;
1936
+ };
1937
+
1938
+ //---------------------------------------------------------------------
1939
+ // base64DecodeInputStream
1940
+ //---------------------------------------------------------------------
1941
+
1942
+ var base64DecodeInputStream = function(str) {
1943
+
1944
+ var _str = str;
1945
+ var _pos = 0;
1946
+ var _buffer = 0;
1947
+ var _buflen = 0;
1948
+
1949
+ var _this = {};
1950
+
1951
+ _this.read = function() {
1952
+
1953
+ while (_buflen < 8) {
1954
+
1955
+ if (_pos >= _str.length) {
1956
+ if (_buflen == 0) {
1957
+ return -1;
1958
+ }
1959
+ throw new Error('unexpected end of file./' + _buflen);
1960
+ }
1961
+
1962
+ var c = _str.charAt(_pos);
1963
+ _pos += 1;
1964
+
1965
+ if (c == '=') {
1966
+ _buflen = 0;
1967
+ return -1;
1968
+ } else if (c.match(/^\s$/) ) {
1969
+ // ignore if whitespace.
1970
+ continue;
1971
+ }
1972
+
1973
+ _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
1974
+ _buflen += 6;
1975
+ }
1976
+
1977
+ var n = (_buffer >>> (_buflen - 8) ) & 0xff;
1978
+ _buflen -= 8;
1979
+ return n;
1980
+ };
1981
+
1982
+ var decode = function(c) {
1983
+ if (0x41 <= c && c <= 0x5a) {
1984
+ return c - 0x41;
1985
+ } else if (0x61 <= c && c <= 0x7a) {
1986
+ return c - 0x61 + 26;
1987
+ } else if (0x30 <= c && c <= 0x39) {
1988
+ return c - 0x30 + 52;
1989
+ } else if (c == 0x2b) {
1990
+ return 62;
1991
+ } else if (c == 0x2f) {
1992
+ return 63;
1993
+ } else {
1994
+ throw new Error('c:' + c);
1995
+ }
1996
+ };
1997
+
1998
+ return _this;
1999
+ };
2000
+
2001
+ //---------------------------------------------------------------------
2002
+ // gifImage (B/W)
2003
+ //---------------------------------------------------------------------
2004
+
2005
+ var gifImage = function(width, height) {
2006
+
2007
+ var _width = width;
2008
+ var _height = height;
2009
+ var _data = new Array(width * height);
2010
+
2011
+ var _this = {};
2012
+
2013
+ _this.setPixel = function(x, y, pixel) {
2014
+ _data[y * _width + x] = pixel;
2015
+ };
2016
+
2017
+ _this.write = function(out) {
2018
+
2019
+ //---------------------------------
2020
+ // GIF Signature
2021
+
2022
+ out.writeString('GIF87a');
2023
+
2024
+ //---------------------------------
2025
+ // Screen Descriptor
2026
+
2027
+ out.writeShort(_width);
2028
+ out.writeShort(_height);
2029
+
2030
+ out.writeByte(0x80); // 2bit
2031
+ out.writeByte(0);
2032
+ out.writeByte(0);
2033
+
2034
+ //---------------------------------
2035
+ // Global Color Map
2036
+
2037
+ // black
2038
+ out.writeByte(0x00);
2039
+ out.writeByte(0x00);
2040
+ out.writeByte(0x00);
2041
+
2042
+ // white
2043
+ out.writeByte(0xff);
2044
+ out.writeByte(0xff);
2045
+ out.writeByte(0xff);
2046
+
2047
+ //---------------------------------
2048
+ // Image Descriptor
2049
+
2050
+ out.writeString(',');
2051
+ out.writeShort(0);
2052
+ out.writeShort(0);
2053
+ out.writeShort(_width);
2054
+ out.writeShort(_height);
2055
+ out.writeByte(0);
2056
+
2057
+ //---------------------------------
2058
+ // Local Color Map
2059
+
2060
+ //---------------------------------
2061
+ // Raster Data
2062
+
2063
+ var lzwMinCodeSize = 2;
2064
+ var raster = getLZWRaster(lzwMinCodeSize);
2065
+
2066
+ out.writeByte(lzwMinCodeSize);
2067
+
2068
+ var offset = 0;
2069
+
2070
+ while (raster.length - offset > 255) {
2071
+ out.writeByte(255);
2072
+ out.writeBytes(raster, offset, 255);
2073
+ offset += 255;
2074
+ }
2075
+
2076
+ out.writeByte(raster.length - offset);
2077
+ out.writeBytes(raster, offset, raster.length - offset);
2078
+ out.writeByte(0x00);
2079
+
2080
+ //---------------------------------
2081
+ // GIF Terminator
2082
+ out.writeString(';');
2083
+ };
2084
+
2085
+ var bitOutputStream = function(out) {
2086
+
2087
+ var _out = out;
2088
+ var _bitLength = 0;
2089
+ var _bitBuffer = 0;
2090
+
2091
+ var _this = {};
2092
+
2093
+ _this.write = function(data, length) {
2094
+
2095
+ if ( (data >>> length) != 0) {
2096
+ throw new Error('length over');
2097
+ }
2098
+
2099
+ while (_bitLength + length >= 8) {
2100
+ _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
2101
+ length -= (8 - _bitLength);
2102
+ data >>>= (8 - _bitLength);
2103
+ _bitBuffer = 0;
2104
+ _bitLength = 0;
2105
+ }
2106
+
2107
+ _bitBuffer = (data << _bitLength) | _bitBuffer;
2108
+ _bitLength = _bitLength + length;
2109
+ };
2110
+
2111
+ _this.flush = function() {
2112
+ if (_bitLength > 0) {
2113
+ _out.writeByte(_bitBuffer);
2114
+ }
2115
+ };
2116
+
2117
+ return _this;
2118
+ };
2119
+
2120
+ var getLZWRaster = function(lzwMinCodeSize) {
2121
+
2122
+ var clearCode = 1 << lzwMinCodeSize;
2123
+ var endCode = (1 << lzwMinCodeSize) + 1;
2124
+ var bitLength = lzwMinCodeSize + 1;
2125
+
2126
+ // Setup LZWTable
2127
+ var table = lzwTable();
2128
+
2129
+ for (var i = 0; i < clearCode; i += 1) {
2130
+ table.add(String.fromCharCode(i) );
2131
+ }
2132
+ table.add(String.fromCharCode(clearCode) );
2133
+ table.add(String.fromCharCode(endCode) );
2134
+
2135
+ var byteOut = byteArrayOutputStream();
2136
+ var bitOut = bitOutputStream(byteOut);
2137
+
2138
+ // clear code
2139
+ bitOut.write(clearCode, bitLength);
2140
+
2141
+ var dataIndex = 0;
2142
+
2143
+ var s = String.fromCharCode(_data[dataIndex]);
2144
+ dataIndex += 1;
2145
+
2146
+ while (dataIndex < _data.length) {
2147
+
2148
+ var c = String.fromCharCode(_data[dataIndex]);
2149
+ dataIndex += 1;
2150
+
2151
+ if (table.contains(s + c) ) {
2152
+
2153
+ s = s + c;
2154
+
2155
+ } else {
2156
+
2157
+ bitOut.write(table.indexOf(s), bitLength);
2158
+
2159
+ if (table.size() < 0xfff) {
2160
+
2161
+ if (table.size() == (1 << bitLength) ) {
2162
+ bitLength += 1;
2163
+ }
2164
+
2165
+ table.add(s + c);
2166
+ }
2167
+
2168
+ s = c;
2169
+ }
2170
+ }
2171
+
2172
+ bitOut.write(table.indexOf(s), bitLength);
2173
+
2174
+ // end code
2175
+ bitOut.write(endCode, bitLength);
2176
+
2177
+ bitOut.flush();
2178
+
2179
+ return byteOut.toByteArray();
2180
+ };
2181
+
2182
+ var lzwTable = function() {
2183
+
2184
+ var _map = {};
2185
+ var _size = 0;
2186
+
2187
+ var _this = {};
2188
+
2189
+ _this.add = function(key) {
2190
+ if (_this.contains(key) ) {
2191
+ throw new Error('dup key:' + key);
2192
+ }
2193
+ _map[key] = _size;
2194
+ _size += 1;
2195
+ };
2196
+
2197
+ _this.size = function() {
2198
+ return _size;
2199
+ };
2200
+
2201
+ _this.indexOf = function(key) {
2202
+ return _map[key];
2203
+ };
2204
+
2205
+ _this.contains = function(key) {
2206
+ return typeof _map[key] != 'undefined';
2207
+ };
2208
+
2209
+ return _this;
2210
+ };
2211
+
2212
+ return _this;
2213
+ };
2214
+
2215
+ var createImgTag = function(width, height, getPixel, alt) {
2216
+
2217
+ var gif = gifImage(width, height);
2218
+ for (var y = 0; y < height; y += 1) {
2219
+ for (var x = 0; x < width; x += 1) {
2220
+ gif.setPixel(x, y, getPixel(x, y) );
2221
+ }
2222
+ }
2223
+
2224
+ var b = byteArrayOutputStream();
2225
+ gif.write(b);
2226
+
2227
+ var base64 = base64EncodeOutputStream();
2228
+ var bytes = b.toByteArray();
2229
+ for (var i = 0; i < bytes.length; i += 1) {
2230
+ base64.writeByte(bytes[i]);
2231
+ }
2232
+ base64.flush();
2233
+
2234
+ var img = '';
2235
+ img += '<img';
2236
+ img += '\u0020src="';
2237
+ img += 'data:image/gif;base64,';
2238
+ img += base64;
2239
+ img += '"';
2240
+ img += '\u0020width="';
2241
+ img += width;
2242
+ img += '"';
2243
+ img += '\u0020height="';
2244
+ img += height;
2245
+ img += '"';
2246
+ if (alt) {
2247
+ img += '\u0020alt="';
2248
+ img += alt;
2249
+ img += '"';
2250
+ }
2251
+ img += '/>';
2252
+
2253
+ return img;
2254
+ };
2255
+
2256
+ //---------------------------------------------------------------------
2257
+ // returns qrcode function.
2258
+
2259
+ return qrcode;
2260
+ }();
2261
+
2262
+ (function (factory) {
2263
+ if (typeof define === 'function' && define.amd) {
2264
+ define([], factory);
2265
+ } else if (typeof exports === 'object') {
2266
+ module.exports = factory();
2267
+ }
2268
+ }(function () {
2269
+ return qrcode;
2270
+ }));
2271
+ //---------------------------------------------------------------------
2272
+ //
2273
+ // QR Code Generator for JavaScript UTF8 Support (optional)
2274
+ //
2275
+ // Copyright (c) 2011 Kazuhiko Arase
2276
+ //
2277
+ // URL: http://www.d-project.com/
2278
+ //
2279
+ // Licensed under the MIT license:
2280
+ // http://www.opensource.org/licenses/mit-license.php
2281
+ //
2282
+ // The word 'QR Code' is registered trademark of
2283
+ // DENSO WAVE INCORPORATED
2284
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
2285
+ //
2286
+ //---------------------------------------------------------------------
2287
+
2288
+ !function(qrcode) {
2289
+
2290
+ //---------------------------------------------------------------------
2291
+ // overwrite qrcode.stringToBytes
2292
+ //---------------------------------------------------------------------
2293
+
2294
+ qrcode.stringToBytes = function(s) {
2295
+ // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
2296
+ function toUTF8Array(str) {
2297
+ var utf8 = [];
2298
+ for (var i=0; i < str.length; i++) {
2299
+ var charcode = str.charCodeAt(i);
2300
+ if (charcode < 0x80) utf8.push(charcode);
2301
+ else if (charcode < 0x800) {
2302
+ utf8.push(0xc0 | (charcode >> 6),
2303
+ 0x80 | (charcode & 0x3f));
2304
+ }
2305
+ else if (charcode < 0xd800 || charcode >= 0xe000) {
2306
+ utf8.push(0xe0 | (charcode >> 12),
2307
+ 0x80 | ((charcode>>6) & 0x3f),
2308
+ 0x80 | (charcode & 0x3f));
2309
+ }
2310
+ // surrogate pair
2311
+ else {
2312
+ i++;
2313
+ // UTF-16 encodes 0x10000-0x10FFFF by
2314
+ // subtracting 0x10000 and splitting the
2315
+ // 20 bits of 0x0-0xFFFFF into two halves
2316
+ charcode = 0x10000 + (((charcode & 0x3ff)<<10)
2317
+ | (str.charCodeAt(i) & 0x3ff));
2318
+ utf8.push(0xf0 | (charcode >>18),
2319
+ 0x80 | ((charcode>>12) & 0x3f),
2320
+ 0x80 | ((charcode>>6) & 0x3f),
2321
+ 0x80 | (charcode & 0x3f));
2322
+ }
2323
+ }
2324
+ return utf8;
2325
+ }
2326
+ return toUTF8Array(s);
2327
+ };
2328
+
2329
+ }(qrcode);
2330
+
2331
+ return qrcode; // eslint-disable-line no-undef
2332
+ }()));
includes/jquery-qrcode/jquery-qrcode.min.js.orig ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! jquery-qrcode v0.14.0 - https://larsjung.de/jquery-qrcode/ */
2
+ !function(r){"use strict";function t(t,e,n,o){function a(r,t){return r-=o,t-=o,0>r||r>=c||0>t||t>=c?!1:f.isDark(r,t)}function i(r,t,e,n){var o=u.isDark,a=1/l;u.isDark=function(i,u){var f=u*a,c=i*a,l=f+a,g=c+a;return o(i,u)&&(r>l||f>e||t>g||c>n)}}var u={},f=r(n,e);f.addData(t),f.make(),o=o||0;var c=f.getModuleCount(),l=f.getModuleCount()+2*o;return u.text=t,u.level=e,u.version=n,u.moduleCount=l,u.isDark=a,u.addBlank=i,u}function e(r,e,n,o,a){n=Math.max(1,n||1),o=Math.min(40,o||40);for(var i=n;o>=i;i+=1)try{return t(r,e,i,a)}catch(u){}}function n(r,t,e){var n=e.size,o="bold "+e.mSize*n+"px "+e.fontname,a=w("<canvas/>")[0].getContext("2d");a.font=o;var i=a.measureText(e.label).width,u=e.mSize,f=i/n,c=(1-f)*e.mPosX,l=(1-u)*e.mPosY,g=c+f,s=l+u,v=.01;1===e.mode?r.addBlank(0,l-v,n,s+v):r.addBlank(c-v,l-v,g+v,s+v),t.fillStyle=e.fontcolor,t.font=o,t.fillText(e.label,c*n,l*n+.75*e.mSize*n)}function o(r,t,e){var n=e.size,o=e.image.naturalWidth||1,a=e.image.naturalHeight||1,i=e.mSize,u=i*o/a,f=(1-u)*e.mPosX,c=(1-i)*e.mPosY,l=f+u,g=c+i,s=.01;3===e.mode?r.addBlank(0,c-s,n,g+s):r.addBlank(f-s,c-s,l+s,g+s),t.drawImage(e.image,f*n,c*n,u*n,i*n)}function a(r,t,e){w(e.background).is("img")?t.drawImage(e.background,0,0,e.size,e.size):e.background&&(t.fillStyle=e.background,t.fillRect(e.left,e.top,e.size,e.size));var a=e.mode;1===a||2===a?n(r,t,e):(3===a||4===a)&&o(r,t,e)}function i(r,t,e,n,o,a,i,u){r.isDark(i,u)&&t.rect(n,o,a,a)}function u(r,t,e,n,o,a,i,u,f,c){i?r.moveTo(t+a,e):r.moveTo(t,e),u?(r.lineTo(n-a,e),r.arcTo(n,e,n,o,a)):r.lineTo(n,e),f?(r.lineTo(n,o-a),r.arcTo(n,o,t,o,a)):r.lineTo(n,o),c?(r.lineTo(t+a,o),r.arcTo(t,o,t,e,a)):r.lineTo(t,o),i?(r.lineTo(t,e+a),r.arcTo(t,e,n,e,a)):r.lineTo(t,e)}function f(r,t,e,n,o,a,i,u,f,c){i&&(r.moveTo(t+a,e),r.lineTo(t,e),r.lineTo(t,e+a),r.arcTo(t,e,t+a,e,a)),u&&(r.moveTo(n-a,e),r.lineTo(n,e),r.lineTo(n,e+a),r.arcTo(n,e,n-a,e,a)),f&&(r.moveTo(n-a,o),r.lineTo(n,o),r.lineTo(n,o-a),r.arcTo(n,o,n-a,o,a)),c&&(r.moveTo(t+a,o),r.lineTo(t,o),r.lineTo(t,o-a),r.arcTo(t,o,t+a,o,a))}function c(r,t,e,n,o,a,i,c){var l=r.isDark,g=n+a,s=o+a,v=e.radius*a,h=i-1,d=i+1,w=c-1,m=c+1,y=l(i,c),T=l(h,w),p=l(h,c),B=l(h,m),A=l(i,m),E=l(d,m),k=l(d,c),M=l(d,w),C=l(i,w);y?u(t,n,o,g,s,v,!p&&!C,!p&&!A,!k&&!A,!k&&!C):f(t,n,o,g,s,v,p&&C&&T,p&&A&&B,k&&A&&E,k&&C&&M)}function l(r,t,e){var n,o,a=r.moduleCount,u=e.size/a,f=i;for(e.radius>0&&e.radius<=.5&&(f=c),t.beginPath(),n=0;a>n;n+=1)for(o=0;a>o;o+=1){var l=e.left+o*u,g=e.top+n*u,s=u;f(r,t,e,l,g,s,n,o)}if(w(e.fill).is("img")){t.strokeStyle="rgba(0,0,0,0.5)",t.lineWidth=2,t.stroke();var v=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",t.fill(),t.globalCompositeOperation=v,t.clip(),t.drawImage(e.fill,0,0,e.size,e.size),t.restore()}else t.fillStyle=e.fill,t.fill()}function g(r,t){var n=e(t.text,t.ecLevel,t.minVersion,t.maxVersion,t.quiet);if(!n)return null;var o=w(r).data("qrcode",n),i=o[0].getContext("2d");return a(n,i,t),l(n,i,t),o}function s(r){var t=w("<canvas/>").attr("width",r.size).attr("height",r.size);return g(t,r)}function v(r){return w("<img/>").attr("src",s(r)[0].toDataURL("image/png"))}function h(r){var t=e(r.text,r.ecLevel,r.minVersion,r.maxVersion,r.quiet);if(!t)return null;var n,o,a=r.size,i=r.background,u=Math.floor,f=t.moduleCount,c=u(a/f),l=u(.5*(a-c*f)),g={position:"relative",left:0,top:0,padding:0,margin:0,width:a,height:a},s={position:"absolute",padding:0,margin:0,width:c,height:c,"background-color":r.fill},v=w("<div/>").data("qrcode",t).css(g);for(i&&v.css("background-color",i),n=0;f>n;n+=1)for(o=0;f>o;o+=1)t.isDark(n,o)&&w("<div/>").css(s).css({left:l+o*c,top:l+n*c}).appendTo(v);return v}function d(r){return m&&"canvas"===r.render?s(r):m&&"image"===r.render?v(r):h(r)}var w=window.jQuery,m=function(){var r=document.createElement("canvas");return!(!r.getContext||!r.getContext("2d"))}(),y={render:"canvas",minVersion:1,maxVersion:40,ecLevel:"L",left:0,top:0,size:200,fill:"#000",background:null,text:"no text",radius:0,quiet:0,mode:0,mSize:.1,mPosX:.5,mPosY:.5,label:"no label",fontname:"sans",fontcolor:"#000",image:null};w.fn.qrcode=function(r){var t=w.extend({},y,r);return this.each(function(r,e){"canvas"===e.nodeName.toLowerCase()?g(e,t):w(e).append(d(t))})}}(function(){var r=function(){function r(t,e){if("undefined"==typeof t.length)throw new Error(t.length+"/"+e);var n=function(){for(var r=0;r<t.length&&0==t[r];)r+=1;for(var n=new Array(t.length-r+e),o=0;o<t.length-r;o+=1)n[o]=t[o+r];return n}(),o={};return o.getAt=function(r){return n[r]},o.getLength=function(){return n.length},o.multiply=function(t){for(var e=new Array(o.getLength()+t.getLength()-1),n=0;n<o.getLength();n+=1)for(var a=0;a<t.getLength();a+=1)e[n+a]^=i.gexp(i.glog(o.getAt(n))+i.glog(t.getAt(a)));return r(e,0)},o.mod=function(t){if(o.getLength()-t.getLength()<0)return o;for(var e=i.glog(o.getAt(0))-i.glog(t.getAt(0)),n=new Array(o.getLength()),a=0;a<o.getLength();a+=1)n[a]=o.getAt(a);for(var a=0;a<t.getLength();a+=1)n[a]^=i.gexp(i.glog(t.getAt(a))+e);return r(n,0).mod(t)},o}var t=function(t,e){var o=236,i=17,l=t,g=n[e],s=null,v=0,d=null,w=new Array,m={},y=function(r,t){v=4*l+17,s=function(r){for(var t=new Array(r),e=0;r>e;e+=1){t[e]=new Array(r);for(var n=0;r>n;n+=1)t[e][n]=null}return t}(v),T(0,0),T(v-7,0),T(0,v-7),A(),B(),k(r,t),l>=7&&E(r),null==d&&(d=D(l,g,w)),M(d,t)},T=function(r,t){for(var e=-1;7>=e;e+=1)if(!(-1>=r+e||r+e>=v))for(var n=-1;7>=n;n+=1)-1>=t+n||t+n>=v||(e>=0&&6>=e&&(0==n||6==n)||n>=0&&6>=n&&(0==e||6==e)||e>=2&&4>=e&&n>=2&&4>=n?s[r+e][t+n]=!0:s[r+e][t+n]=!1)},p=function(){for(var r=0,t=0,e=0;8>e;e+=1){y(!0,e);var n=a.getLostPoint(m);(0==e||r>n)&&(r=n,t=e)}return t},B=function(){for(var r=8;v-8>r;r+=1)null==s[r][6]&&(s[r][6]=r%2==0);for(var t=8;v-8>t;t+=1)null==s[6][t]&&(s[6][t]=t%2==0)},A=function(){for(var r=a.getPatternPosition(l),t=0;t<r.length;t+=1)for(var e=0;e<r.length;e+=1){var n=r[t],o=r[e];if(null==s[n][o])for(var i=-2;2>=i;i+=1)for(var u=-2;2>=u;u+=1)-2==i||2==i||-2==u||2==u||0==i&&0==u?s[n+i][o+u]=!0:s[n+i][o+u]=!1}},E=function(r){for(var t=a.getBCHTypeNumber(l),e=0;18>e;e+=1){var n=!r&&1==(t>>e&1);s[Math.floor(e/3)][e%3+v-8-3]=n}for(var e=0;18>e;e+=1){var n=!r&&1==(t>>e&1);s[e%3+v-8-3][Math.floor(e/3)]=n}},k=function(r,t){for(var e=g<<3|t,n=a.getBCHTypeInfo(e),o=0;15>o;o+=1){var i=!r&&1==(n>>o&1);6>o?s[o][8]=i:8>o?s[o+1][8]=i:s[v-15+o][8]=i}for(var o=0;15>o;o+=1){var i=!r&&1==(n>>o&1);8>o?s[8][v-o-1]=i:9>o?s[8][15-o-1+1]=i:s[8][15-o-1]=i}s[v-8][8]=!r},M=function(r,t){for(var e=-1,n=v-1,o=7,i=0,u=a.getMaskFunction(t),f=v-1;f>0;f-=2)for(6==f&&(f-=1);;){for(var c=0;2>c;c+=1)if(null==s[n][f-c]){var l=!1;i<r.length&&(l=1==(r[i]>>>o&1));var g=u(n,f-c);g&&(l=!l),s[n][f-c]=l,o-=1,-1==o&&(i+=1,o=7)}if(n+=e,0>n||n>=v){n-=e,e=-e;break}}},C=function(t,e){for(var n=0,o=0,i=0,u=new Array(e.length),f=new Array(e.length),c=0;c<e.length;c+=1){var l=e[c].dataCount,g=e[c].totalCount-l;o=Math.max(o,l),i=Math.max(i,g),u[c]=new Array(l);for(var s=0;s<u[c].length;s+=1)u[c][s]=255&t.getBuffer()[s+n];n+=l;var v=a.getErrorCorrectPolynomial(g),h=r(u[c],v.getLength()-1),d=h.mod(v);f[c]=new Array(v.getLength()-1);for(var s=0;s<f[c].length;s+=1){var w=s+d.getLength()-f[c].length;f[c][s]=w>=0?d.getAt(w):0}}for(var m=0,s=0;s<e.length;s+=1)m+=e[s].totalCount;for(var y=new Array(m),T=0,s=0;o>s;s+=1)for(var c=0;c<e.length;c+=1)s<u[c].length&&(y[T]=u[c][s],T+=1);for(var s=0;i>s;s+=1)for(var c=0;c<e.length;c+=1)s<f[c].length&&(y[T]=f[c][s],T+=1);return y},D=function(r,t,e){for(var n=u.getRSBlocks(r,t),c=f(),l=0;l<e.length;l+=1){var g=e[l];c.put(g.getMode(),4),c.put(g.getLength(),a.getLengthInBits(g.getMode(),r)),g.write(c)}for(var s=0,l=0;l<n.length;l+=1)s+=n[l].dataCount;if(c.getLengthInBits()>8*s)throw new Error("code length overflow. ("+c.getLengthInBits()+">"+8*s+")");for(c.getLengthInBits()+4<=8*s&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;;){if(c.getLengthInBits()>=8*s)break;if(c.put(o,8),c.getLengthInBits()>=8*s)break;c.put(i,8)}return C(c,n)};return m.addData=function(r){var t=c(r);w.push(t),d=null},m.isDark=function(r,t){if(0>r||r>=v||0>t||t>=v)throw new Error(r+","+t);return s[r][t]},m.getModuleCount=function(){return v},m.make=function(){y(!1,p())},m.createTableTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e="";e+='<table style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: "+t+"px;",e+='">',e+="<tbody>";for(var n=0;n<m.getModuleCount();n+=1){e+="<tr>";for(var o=0;o<m.getModuleCount();o+=1)e+='<td style="',e+=" border-width: 0px; border-style: none;",e+=" border-collapse: collapse;",e+=" padding: 0px; margin: 0px;",e+=" width: "+r+"px;",e+=" height: "+r+"px;",e+=" background-color: ",e+=m.isDark(n,o)?"#000000":"#ffffff",e+=";",e+='"/>';e+="</tr>"}return e+="</tbody>",e+="</table>"},m.createImgTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e=m.getModuleCount()*r+2*t,n=t,o=e-t;return h(e,e,function(t,e){if(t>=n&&o>t&&e>=n&&o>e){var a=Math.floor((t-n)/r),i=Math.floor((e-n)/r);return m.isDark(i,a)?0:1}return 1})},m};t.stringToBytes=function(r){for(var t=new Array,e=0;e<r.length;e+=1){var n=r.charCodeAt(e);t.push(255&n)}return t},t.createStringToBytes=function(r,t){var e=function(){for(var e=s(r),n=function(){var r=e.read();if(-1==r)throw new Error;return r},o=0,a={};;){var i=e.read();if(-1==i)break;var u=n(),f=n(),c=n(),l=String.fromCharCode(i<<8|u),g=f<<8|c;a[l]=g,o+=1}if(o!=t)throw new Error(o+" != "+t);return a}(),n="?".charCodeAt(0);return function(r){for(var t=new Array,o=0;o<r.length;o+=1){var a=r.charCodeAt(o);if(128>a)t.push(a);else{var i=e[r.charAt(o)];"number"==typeof i?(255&i)==i?t.push(i):(t.push(i>>>8),t.push(255&i)):t.push(n)}}return t}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},a=function(){var t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,a=7973,u=21522,f={},c=function(r){for(var t=0;0!=r;)t+=1,r>>>=1;return t};return f.getBCHTypeInfo=function(r){for(var t=r<<10;c(t)-c(n)>=0;)t^=n<<c(t)-c(n);return(r<<10|t)^u},f.getBCHTypeNumber=function(r){for(var t=r<<12;c(t)-c(a)>=0;)t^=a<<c(t)-c(a);return r<<12|t},f.getPatternPosition=function(r){return t[r-1]},f.getMaskFunction=function(r){switch(r){case o.PATTERN000:return function(r,t){return(r+t)%2==0};case o.PATTERN001:return function(r,t){return r%2==0};case o.PATTERN010:return function(r,t){return t%3==0};case o.PATTERN011:return function(r,t){return(r+t)%3==0};case o.PATTERN100:return function(r,t){return(Math.floor(r/2)+Math.floor(t/3))%2==0};case o.PATTERN101:return function(r,t){return r*t%2+r*t%3==0};case o.PATTERN110:return function(r,t){return(r*t%2+r*t%3)%2==0};case o.PATTERN111:return function(r,t){return(r*t%3+(r+t)%2)%2==0};default:throw new Error("bad maskPattern:"+r)}},f.getErrorCorrectPolynomial=function(t){for(var e=r([1],0),n=0;t>n;n+=1)e=e.multiply(r([1,i.gexp(n)],0));return e},f.getLengthInBits=function(r,t){if(t>=1&&10>t)switch(r){case e.MODE_NUMBER:return 10;case e.MODE_ALPHA_NUM:return 9;case e.MODE_8BIT_BYTE:return 8;case e.MODE_KANJI:return 8;default:throw new Error("mode:"+r)}else if(27>t)switch(r){case e.MODE_NUMBER:return 12;case e.MODE_ALPHA_NUM:return 11;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 10;default:throw new Error("mode:"+r)}else{if(!(41>t))throw new Error("type:"+t);switch(r){case e.MODE_NUMBER:return 14;case e.MODE_ALPHA_NUM:return 13;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 12;default:throw new Error("mode:"+r)}}},f.getLostPoint=function(r){for(var t=r.getModuleCount(),e=0,n=0;t>n;n+=1)for(var o=0;t>o;o+=1){for(var a=0,i=r.isDark(n,o),u=-1;1>=u;u+=1)if(!(0>n+u||n+u>=t))for(var f=-1;1>=f;f+=1)0>o+f||o+f>=t||(0!=u||0!=f)&&i==r.isDark(n+u,o+f)&&(a+=1);a>5&&(e+=3+a-5)}for(var n=0;t-1>n;n+=1)for(var o=0;t-1>o;o+=1){var c=0;r.isDark(n,o)&&(c+=1),r.isDark(n+1,o)&&(c+=1),r.isDark(n,o+1)&&(c+=1),r.isDark(n+1,o+1)&&(c+=1),(0==c||4==c)&&(e+=3)}for(var n=0;t>n;n+=1)for(var o=0;t-6>o;o+=1)r.isDark(n,o)&&!r.isDark(n,o+1)&&r.isDark(n,o+2)&&r.isDark(n,o+3)&&r.isDark(n,o+4)&&!r.isDark(n,o+5)&&r.isDark(n,o+6)&&(e+=40);for(var o=0;t>o;o+=1)for(var n=0;t-6>n;n+=1)r.isDark(n,o)&&!r.isDark(n+1,o)&&r.isDark(n+2,o)&&r.isDark(n+3,o)&&r.isDark(n+4,o)&&!r.isDark(n+5,o)&&r.isDark(n+6,o)&&(e+=40);for(var l=0,o=0;t>o;o+=1)for(var n=0;t>n;n+=1)r.isDark(n,o)&&(l+=1);var g=Math.abs(100*l/t/t-50)/5;return e+=10*g},f}(),i=function(){for(var r=new Array(256),t=new Array(256),e=0;8>e;e+=1)r[e]=1<<e;for(var e=8;256>e;e+=1)r[e]=r[e-4]^r[e-5]^r[e-6]^r[e-8];for(var e=0;255>e;e+=1)t[r[e]]=e;var n={};return n.glog=function(r){if(1>r)throw new Error("glog("+r+")");return t[r]},n.gexp=function(t){for(;0>t;)t+=255;for(;t>=256;)t-=255;return r[t]},n}(),u=function(){var r=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(r,t){var e={};return e.totalCount=r,e.dataCount=t,e},e={},o=function(t,e){switch(e){case n.L:return r[4*(t-1)+0];case n.M:return r[4*(t-1)+1];case n.Q:return r[4*(t-1)+2];case n.H:return r[4*(t-1)+3];default:return}};return e.getRSBlocks=function(r,e){var n=o(r,e);if("undefined"==typeof n)throw new Error("bad rs block @ typeNumber:"+r+"/errorCorrectLevel:"+e);for(var a=n.length/3,i=new Array,u=0;a>u;u+=1)for(var f=n[3*u+0],c=n[3*u+1],l=n[3*u+2],g=0;f>g;g+=1)i.push(t(c,l));return i},e}(),f=function(){var r=new Array,t=0,e={};return e.getBuffer=function(){return r},e.getAt=function(t){var e=Math.floor(t/8);return 1==(r[e]>>>7-t%8&1)},e.put=function(r,t){for(var n=0;t>n;n+=1)e.putBit(1==(r>>>t-n-1&1))},e.getLengthInBits=function(){return t},e.putBit=function(e){var n=Math.floor(t/8);r.length<=n&&r.push(0),e&&(r[n]|=128>>>t%8),t+=1},e},c=function(r){var n=e.MODE_8BIT_BYTE,o=t.stringToBytes(r),a={};return a.getMode=function(){return n},a.getLength=function(r){return o.length},a.write=function(r){for(var t=0;t<o.length;t+=1)r.put(o[t],8)},a},l=function(){var r=new Array,t={};return t.writeByte=function(t){r.push(255&t)},t.writeShort=function(r){t.writeByte(r),t.writeByte(r>>>8)},t.writeBytes=function(r,e,n){e=e||0,n=n||r.length;for(var o=0;n>o;o+=1)t.writeByte(r[o+e])},t.writeString=function(r){for(var e=0;e<r.length;e+=1)t.writeByte(r.charCodeAt(e))},t.toByteArray=function(){return r},t.toString=function(){var t="";t+="[";for(var e=0;e<r.length;e+=1)e>0&&(t+=","),t+=r[e];return t+="]"},t},g=function(){var r=0,t=0,e=0,n="",o={},a=function(r){n+=String.fromCharCode(i(63&r))},i=function(r){if(0>r);else{if(26>r)return 65+r;if(52>r)return 97+(r-26);if(62>r)return 48+(r-52);if(62==r)return 43;if(63==r)return 47}throw new Error("n:"+r)};return o.writeByte=function(n){for(r=r<<8|255&n,t+=8,e+=1;t>=6;)a(r>>>t-6),t-=6},o.flush=function(){if(t>0&&(a(r<<6-t),r=0,t=0),e%3!=0)for(var o=3-e%3,i=0;o>i;i+=1)n+="="},o.toString=function(){return n},o},s=function(r){var t=r,e=0,n=0,o=0,a={};a.read=function(){for(;8>o;){if(e>=t.length){if(0==o)return-1;throw new Error("unexpected end of file./"+o)}var r=t.charAt(e);if(e+=1,"="==r)return o=0,-1;r.match(/^\s$/)||(n=n<<6|i(r.charCodeAt(0)),o+=6)}var a=n>>>o-8&255;return o-=8,a};var i=function(r){if(r>=65&&90>=r)return r-65;if(r>=97&&122>=r)return r-97+26;if(r>=48&&57>=r)return r-48+52;if(43==r)return 62;if(47==r)return 63;throw new Error("c:"+r)};return a},v=function(r,t){var e=r,n=t,o=new Array(r*t),a={};a.setPixel=function(r,t,n){o[t*e+r]=n},a.write=function(r){r.writeString("GIF87a"),r.writeShort(e),r.writeShort(n),r.writeByte(128),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(255),r.writeByte(255),r.writeByte(255),r.writeString(","),r.writeShort(0),r.writeShort(0),r.writeShort(e),r.writeShort(n),r.writeByte(0);var t=2,o=u(t);r.writeByte(t);for(var a=0;o.length-a>255;)r.writeByte(255),r.writeBytes(o,a,255),a+=255;r.writeByte(o.length-a),r.writeBytes(o,a,o.length-a),r.writeByte(0),r.writeString(";")};var i=function(r){var t=r,e=0,n=0,o={};return o.write=function(r,o){if(r>>>o!=0)throw new Error("length over");for(;e+o>=8;)t.writeByte(255&(r<<e|n)),o-=8-e,r>>>=8-e,n=0,e=0;n=r<<e|n,e+=o},o.flush=function(){e>0&&t.writeByte(n)},o},u=function(r){for(var t=1<<r,e=(1<<r)+1,n=r+1,a=f(),u=0;t>u;u+=1)a.add(String.fromCharCode(u));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(e));var c=l(),g=i(c);g.write(t,n);var s=0,v=String.fromCharCode(o[s]);for(s+=1;s<o.length;){var h=String.fromCharCode(o[s]);s+=1,a.contains(v+h)?v+=h:(g.write(a.indexOf(v),n),a.size()<4095&&(a.size()==1<<n&&(n+=1),a.add(v+h)),v=h)}return g.write(a.indexOf(v),n),g.write(e,n),g.flush(),c.toByteArray()},f=function(){var r={},t=0,e={};return e.add=function(n){if(e.contains(n))throw new Error("dup key:"+n);r[n]=t,t+=1},e.size=function(){return t},e.indexOf=function(t){return r[t]},e.contains=function(t){return"undefined"!=typeof r[t]},e};return a},h=function(r,t,e,n){for(var o=v(r,t),a=0;t>a;a+=1)for(var i=0;r>i;i+=1)o.setPixel(i,a,e(i,a));var u=l();o.write(u);for(var f=g(),c=u.toByteArray(),s=0;s<c.length;s+=1)f.writeByte(c[s]);f.flush();var h="";return h+="<img",h+=' src="',h+="data:image/gif;base64,",h+=f,h+='"',h+=' width="',h+=r,h+='"',h+=' height="',h+=t,h+='"',n&&(h+=' alt="',h+=n,h+='"'),h+="/>"};return t}();return function(r){"function"==typeof define&&define.amd?define([],r):"object"==typeof exports&&(module.exports=r())}(function(){return r}),!function(r){r.stringToBytes=function(r){function t(r){for(var t=[],e=0;e<r.length;e++){var n=r.charCodeAt(e);128>n?t.push(n):2048>n?t.push(192|n>>6,128|63&n):55296>n||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(e++,n=65536+((1023&n)<<10|1023&r.charCodeAt(e)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}return t(r)}}(r),r}());
miniorange_2_factor_settings.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
  * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 1 User in the free version of the plugin.
6
- * Version: 5.3.5
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
10
  */
11
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
12
- define( 'MO2F_VERSION', '5.3.5' );
13
  class Miniorange_twoFactor{
14
 
15
  function __construct()
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
  * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 1 User in the free version of the plugin.
6
+ * Version: 5.3.6
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
10
  */
11
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
12
+ define( 'MO2F_VERSION', '5.3.6' );
13
  class Miniorange_twoFactor{
14
 
15
  function __construct()
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://miniorange.com/
6
  Requires at least: 3.0.1
7
  Tested up to: 5.3
8
  Requires PHP: 5.3.0
9
- Stable tag: 5.3.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -272,6 +272,9 @@ miniOrange authentication service has 15+ authentication methods.One time passco
272
 
273
  == Changelog ==
274
 
 
 
 
275
  = 5.3.5 =
276
  * Google Authenticator-Two Factor Authentication (2FA) : Backup URL Fix and space issue in google authenticator.
277
 
@@ -678,6 +681,9 @@ More descriptive setup messages and UI changes.
678
 
679
  == Upgrade Notice ==
680
 
 
 
 
681
  = 5.3.5 =
682
  * Google Authenticator-Two Factor Authentication (2FA) : Backup URL Fix and space issue in google authenticator.
683
 
6
  Requires at least: 3.0.1
7
  Tested up to: 5.3
8
  Requires PHP: 5.3.0
9
+ Stable tag: 5.3.6
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
272
 
273
  == Changelog ==
274
 
275
+ = 5.3.6 =
276
+ * Google Authenticator-Two Factor Authentication (2FA) : Anti virus zip file fix.
277
+
278
  = 5.3.5 =
279
  * Google Authenticator-Two Factor Authentication (2FA) : Backup URL Fix and space issue in google authenticator.
280
 
681
 
682
  == Upgrade Notice ==
683
 
684
+ = 5.3.6 =
685
+ * Google Authenticator-Two Factor Authentication (2FA) : Anti virus zip file fix.
686
+
687
  = 5.3.5 =
688
  * Google Authenticator-Two Factor Authentication (2FA) : Backup URL Fix and space issue in google authenticator.
689
 
uninstall.php CHANGED
@@ -86,6 +86,12 @@
86
  delete_option('mo_file_backup_plugins');
87
  delete_option('mo_file_backup_themes');
88
  delete_option('mo_file_backup_wp_files');
 
 
 
 
 
 
89
 
90
  $users = get_users( array() );
91
  foreach ( $users as $user ) {
86
  delete_option('mo_file_backup_plugins');
87
  delete_option('mo_file_backup_themes');
88
  delete_option('mo_file_backup_wp_files');
89
+
90
+ delete_option('mo2f_visit_waf');
91
+ delete_option('mo2f_visit_login_and_spam');
92
+ delete_option('mo2f_visit_malware');
93
+ delete_option('mo2f_visit_backup');
94
+
95
 
96
  $users = get_users( array() );
97
  foreach ( $users as $user ) {
views/feedback_form.php CHANGED
@@ -160,7 +160,6 @@
160
  document.querySelector("#wpns_query_feedback").focus();
161
  span.onclick = function () {
162
  mo_modal.style.display = "none";
163
- jQuery('#mo_wpns_feedback_form_close').submit();
164
  }
165
 
166
  // When the user clicks anywhere outside of the mo2f_modal, mo2f_close it
160
  document.querySelector("#wpns_query_feedback").focus();
161
  span.onclick = function () {
162
  mo_modal.style.display = "none";
 
163
  }
164
 
165
  // When the user clicks anywhere outside of the mo2f_modal, mo2f_close it
views/two_fa.php CHANGED
@@ -5,27 +5,54 @@
5
  {
6
  ?>
7
  <button class="tablinks" onclick="openTab2fa(this)" id="login_option_2fa">Login Option</button>
 
8
  <?php
9
  }
10
  else
11
  {
12
  ?>
13
- <button class="tablinks" onclick="openTab2fa(this)" id="add_on_2fa">Add - on</button>
 
 
 
14
  <?php
15
  }
16
  ?>
17
- <button class="tablinks" onclick="openTab2fa(this)" id="custom_form_2fa">Custom Login form</button>
18
  <button class="tablinks" onclick="openTab2fa(this)" id="video_guide_2fa">Video Guide</button>
19
  </div>
20
  <br>
21
- <div id="mo_scan_message" style=" padding-top:8px"></div>
22
 
23
  <div class="mo_wpns_divided_layout" id="setup_2fa_div">
24
  <?php include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'setup_twofa.php'; ?>
25
  </div>
26
- <div class="mo_wpns_divided_layout" id="add_on_2fa_div">
27
- <?php include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_addon.php'; ?>
28
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  <div class="mo_wpns_divided_layout" id="login_option_2fa_div">
30
  <?php include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_login_option.php'; ?>
31
  </div>
@@ -37,7 +64,11 @@
37
  </div>
38
  <script>
39
  jQuery("#setup_2fa_div").css("display", "block");
40
- jQuery("#add_on_2fa_div").css("display", "none");
 
 
 
 
41
  jQuery("#login_option_2fa_div").css("display", "none");
42
  jQuery("#custom_form_2fa_div").css("display", "none");
43
  jQuery("#video_guide_2fa_div").css("display", "none");
@@ -45,7 +76,7 @@
45
  jQuery("#setup_2fa").addClass("active");
46
  function openTab2fa(elmt){
47
  var tabname = elmt.id;
48
- var tabarray = ["setup_2fa", "add_on_2fa","login_option_2fa", "custom_form_2fa", "video_guide_2fa"];
49
  for (var i = 0; i < tabarray.length; i++) {
50
  if(tabarray[i] == tabname){
51
  jQuery("#"+tabarray[i]).addClass("active");
@@ -62,9 +93,16 @@
62
  if(tab == "setup_twofa"){
63
  document.getElementById("setup_2fa").click();
64
  }
65
- else if(tab == "add_on_2fa"){
66
- document.getElementById("add_on_2fa").click();
67
- }
 
 
 
 
 
 
 
68
  else if(tab == "login_option_2fa"){
69
  document.getElementById("add_on_2fa").click();
70
  }
5
  {
6
  ?>
7
  <button class="tablinks" onclick="openTab2fa(this)" id="login_option_2fa">Login Option</button>
8
+ <button class="tablinks" onclick="openTab2fa(this)" id="custom_form_2fa">Integration</button>
9
  <?php
10
  }
11
  else
12
  {
13
  ?>
14
+ <button class="tablinks" onclick="openTab2fa(this)" id="rba_2fa">Remember Device</button>
15
+ <button class="tablinks" onclick="openTab2fa(this)" id="custom_login_2fa">Personalization</button>
16
+ <button class="tablinks" onclick="openTab2fa(this)" id="custom_form_2fa">Integration</button>
17
+ <button class="tablinks" onclick="openTab2fa(this)" id="shortcode_2fa">Shortcode</button>
18
  <?php
19
  }
20
  ?>
 
21
  <button class="tablinks" onclick="openTab2fa(this)" id="video_guide_2fa">Video Guide</button>
22
  </div>
23
  <br>
24
+ <div id="mo_scan_message" ></div>
25
 
26
  <div class="mo_wpns_divided_layout" id="setup_2fa_div">
27
  <?php include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'setup_twofa.php'; ?>
28
  </div>
29
+
30
+
31
+ <div class="mo_wpns_divided_layout" id="rba_2fa_div">
32
+ <?php
33
+ if ( get_option( 'mo2f_rba_installed' ) )
34
+ mo2f_rba_description($mo2f_user_email);
35
+ else
36
+ include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_rba.php';
37
+ ?>
38
+ </div>
39
+ <div class="mo_wpns_divided_layout" id="custom_login_2fa_div">
40
+ <?php
41
+ if ( get_option( 'mo2f_personalization_installed' ) )
42
+ mo2f_personalization_description($mo2f_user_email);
43
+ else
44
+ include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_custom_login.php';
45
+ ?>
46
+ </div>
47
+ <div class="mo_wpns_divided_layout" id="shortcode_2fa_div">
48
+ <?php
49
+ if ( get_option( 'mo2f_shortcode_installed' ) )
50
+ mo2f_shortcode_description($mo2f_user_email);
51
+ else
52
+ include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_shortcode.php';
53
+ ?>
54
+ </div>
55
+
56
  <div class="mo_wpns_divided_layout" id="login_option_2fa_div">
57
  <?php include_once $dirName . 'controllers'.DIRECTORY_SEPARATOR.'two_fa_login_option.php'; ?>
58
  </div>
64
  </div>
65
  <script>
66
  jQuery("#setup_2fa_div").css("display", "block");
67
+
68
+ jQuery("#rba_2fa_div").css("display", "none");
69
+ jQuery("#custom_login_2fa_div").css("display", "none");
70
+ jQuery("#shortcode_2fa_div").css("display", "none");
71
+
72
  jQuery("#login_option_2fa_div").css("display", "none");
73
  jQuery("#custom_form_2fa_div").css("display", "none");
74
  jQuery("#video_guide_2fa_div").css("display", "none");
76
  jQuery("#setup_2fa").addClass("active");
77
  function openTab2fa(elmt){
78
  var tabname = elmt.id;
79
+ var tabarray = ["setup_2fa","rba_2fa","custom_login_2fa","shortcode_2fa","login_option_2fa", "custom_form_2fa", "video_guide_2fa"];
80
  for (var i = 0; i < tabarray.length; i++) {
81
  if(tabarray[i] == tabname){
82
  jQuery("#"+tabarray[i]).addClass("active");
93
  if(tab == "setup_twofa"){
94
  document.getElementById("setup_2fa").click();
95
  }
96
+
97
+ else if(tab == "rba_2fa"){
98
+ document.getElementById("rba_2fa").click();
99
+ }
100
+ else if(tab == "custom_login_2fa"){
101
+ document.getElementById("custom_login_2fa").click();
102
+ }
103
+ else if(tab == "shortcode_2fa"){
104
+ document.getElementById("shortcode_2fa").click();
105
+ }
106
  else if(tab == "login_option_2fa"){
107
  document.getElementById("add_on_2fa").click();
108
  }
views/two_fa_custom_form.php CHANGED
@@ -2,14 +2,14 @@
2
  <h2>Custom Login Forms</h2>
3
  <p>We support most of the login forms present on the wordpress. And our plugin is tested with almost all the forms like Woocommerce, Ultimate Member, Restrict Content Pro and so on.</p>
4
  <ul>
5
- <li><b>Woocommerce</b></li>
6
- <li><b>Ultimate Member</b></li>
7
- <li><b>Restrict Content Pro</b></li>
8
- <li><b>My Theme Login</b></li>
9
- <li><b>User Registration</b></li>
10
- <li><b>Custom Login Page Customizer | LoginPress</b></li>
11
- <li><b>Admin Custom Login</b></li>
12
- <li><b>RegistrationMagic – Custom Registration Forms and User Login</b></li>
13
  </ul>
14
  <p>And many more which are not mentioned here.</p>
15
 
2
  <h2>Custom Login Forms</h2>
3
  <p>We support most of the login forms present on the wordpress. And our plugin is tested with almost all the forms like Woocommerce, Ultimate Member, Restrict Content Pro and so on.</p>
4
  <ul>
5
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/woocommerce.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">Woocommerce</h3></li> <br>
6
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/ultimate_member.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">Ultimate Member</h3></li><br>
7
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/restrict_content_pro.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">Restrict Content Pro</h3></li><br>
8
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/theme_my_login.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">My Theme Login</h3></li><br>
9
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/user_registration.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">User Registration</h3></li><br>
10
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/Custom_Login_Page_Customizer_LoginPress.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">Custom Login Page Customizer | LoginPress</h3></li><br>
11
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/Admin_Custom_Login.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">Admin Custom Login</h3></li><br>
12
+ <li><?php echo '<img style="width:30px; height:30px;display: inline;float: left;" src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/RegistrationMagic_Custom_Registration_Forms_and_User_Login.png">';?><h3 style="margin-left: 15px; font-size: large; display: inline; float: inherit;">RegistrationMagic – Custom Registration Forms and User Login</h3></li>
13
  </ul>
14
  <p>And many more which are not mentioned here.</p>
15
 
views/two_fa_custom_login.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $current_user;
3
+ $current_user = wp_get_current_user();
4
+ global $Mo2fdbQueries;
5
+ ?>
6
+ <form name="f" id="custom_css_form_add" method="post" action="">
7
+ <input type="hidden" name="option" value="mo_auth_custom_options_save" />
8
+
9
+ <div class="mo_wpns_setting_layout">
10
+ <div id="mo2f_custom_addon_hide">
11
+
12
+ <h3 id="custom_description" style=" color: #20b2aa;text-align: center;">
13
+ <?php echo __( 'This helps you to modify and redesign the 2FA prompt to match according to your website and various customizations in the plugin dashboard.', 'miniorange-2-factor-authentication' ); ?>
14
+ </h3>
15
+ <br>
16
+ </div>
17
+
18
+ <h3><?php echo mo2f_lt('Customize Plugin Icon');?></h3><hr><br>
19
+ <div style="margin-left:2%">
20
+ <input type="checkbox" id="mo2f_enable_custom_icon" name="mo2f_enable_custom_icon" value="1" <?php checked( get_option('mo2f_enable_custom_icon') == 1 );
21
+ echo 'disabled'; ?> />
22
+
23
+ <?php echo mo2f_lt('Change Plugin Icon.');?>
24
+ <div class="mo2f_advanced_options_note" ><p style="padding:5px;"><i><?php echo mo2f_lt('
25
+ Go to /wp-content/uploads/miniorange folder and upload a .png image with the name "plugin_icon" (Max Size: 20x34px).');?></i></p>
26
+ </div>
27
+ </div>
28
+
29
+ <br>
30
+ <h3><?php echo mo2f_lt('Customize Plugin Name');?></h3><hr><br>
31
+ <div style="margin-left:2%">
32
+ <?php echo mo2f_lt('Change Plugin Name:');?> &nbsp;
33
+ <input type="text" class="mo2f_table_textbox" style="width:35% " id="mo2f_custom_plugin_name" name="mo2f_custom_plugin_name" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_plugin_name')?>" placeholder="<?php echo mo2f_lt('Enter a custom Plugin Name.');?>" />
34
+
35
+ <div class="mo2f_advanced_options_note"><p style="padding:5px;"><i>
36
+ <?php echo mo2f_lt('This will be the Plugin Name You and your Users see in WordPress Dashboard.');?>
37
+ </i></p> </div>
38
+ </div>
39
+ <br>
40
+
41
+ <input type="submit" name="submit" value="Save Settings" style="margin-left:2%; background-color: #20b2aa; color: white;box-shadow:none;" class="mo_wpns_button mo_wpns_button1" <?php
42
+ echo 'disabled' ; ?> />
43
+ </div>
44
+
45
+ <br>
46
+
47
+
48
+ </form>
49
+
50
+ <?php show_2_factor_custom_design_options($current_user);?>
51
+ <br>
52
+ <div class="mo_wpns_setting_layout">
53
+ <h3><?php echo mo2f_lt('Custom Email and SMS Templates');
54
+
55
+ ?>
56
+ </h3><hr>
57
+ <div style="margin-left:2%">
58
+ <p><?php echo mo2f_lt('You can change the templates for Email and SMS as per your requirement.');?></p>
59
+ <?php if(mo2f_is_customer_registered()){
60
+ if( get_option('mo2f_miniorange_admin') == $current_user->ID ){ ?>
61
+ <a style="box-shadow: none;" class="mo_wpns_button mo_wpns_button1"<?php echo 'disabled'; ?>><?php echo mo2f_lt('Customize Email Template');?></a><span style="margin-left:10px;"></span>
62
+ <a style="box-shadow: none;" class="mo_wpns_button mo_wpns_button1"<?php echo 'disabled'; ?> ><?php echo mo2f_lt('Customize SMS Template');?></a>
63
+ <?php }
64
+ }else{ ?>
65
+ <a class="mo_wpns_button mo_wpns_button1"<?php echo 'disabled'; ?>style="pointer-events: none;cursor: default;box-shadow: none;"><?php echo mo2f_lt('Customize Email Template');?></a>
66
+ <span style="margin-left:10px;"></span>
67
+ <a class="mo_wpns_button mo_wpns_button1"<?php echo 'disabled'; ?> style="pointer-events: none;cursor: default;box-shadow: none;"><?php echo mo2f_lt('Customize SMS Template');?></a>
68
+ <?php } ?>
69
+ </div>
70
+ </div>
71
+ <br>
72
+
73
+ <div class="mo_wpns_setting_layout">
74
+ <h3><?php echo mo2f_lt('Integrate your websites\'s theme with the 2FA plugin\'s popups');?></h3><hr>
75
+ <div style="margin-left:2%">
76
+ <p><?php echo mo2f_lt('Contact Us through the support forum in the right for the UI integration.');?></p>
77
+ </div>
78
+
79
+ </div>
80
+ <br>
81
+ <form style="display:none;" id="mo2fa_addon_loginform" action="<?php echo get_option( 'mo2f_host_name').'/moas/login'; ?>"
82
+ target="_blank" method="post">
83
+ <input type="email" name="username" value="<?php echo $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $current_user->ID );?>" />
84
+ <input type="text" name="redirectUrl" value="" />
85
+ </form>
86
+ <script>
87
+ function mo2fLoginMiniOrangeDashboard(redirectUrl){
88
+ document.getElementById('mo2fa_addon_loginform').elements[1].value = redirectUrl;
89
+ jQuery('#mo2fa_addon_loginform').submit();
90
+ }
91
+ </script>
92
+
93
+ <?php
94
+ function show_2_factor_custom_design_options($current_user){
95
+ ?>
96
+
97
+ <br>
98
+ <div class="mo_wpns_setting_layout">
99
+ <div id="mo2f_custom_addon_hide">
100
+
101
+ <br>
102
+ </div>
103
+ <form name="f" id="custom_css_reset_form" method="post" action="" >
104
+ <input type="hidden" name="option" value="mo_auth_custom_design_options_reset" />
105
+
106
+ <h3><?php echo mo2f_lt('Customize UI of Login Pop up\'s');?></h3>
107
+ <input type="submit" name="submit" value="Reset Settings" class="mo_wpns_button mo_wpns_button1" style="float:right; background-color: #20b2aa; color: white;box-shadow: none;"<?php
108
+ echo 'disabled' ; ?> />
109
+
110
+ </form>
111
+ <form name="f" id="custom_css_form" method="post" action="">
112
+ <input type="hidden" name="option" value="mo_auth_custom_design_options_save" />
113
+
114
+
115
+
116
+ <table class="mo2f_settings_table" style="margin-left:2%">
117
+ <tr>
118
+ <td><?php echo mo2f_lt('Background Color:');?> </td>
119
+ <td><input type="text" id="mo2f_custom_background_color" name="mo2f_custom_background_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_background_color')?>" class="my-color-field" /> </td>
120
+ </tr>
121
+ <tr>
122
+ <td><?php echo mo2f_lt('Popup Background Color:');?> </td>
123
+ <td><input type="text" id="mo2f_custom_popup_bg_color" name="mo2f_custom_popup_bg_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_popup_bg_color')?>" class="my-color-field" /> </td>
124
+ </tr>
125
+ <tr>
126
+ <td><?php echo mo2f_lt('Button Color:');?> </td>
127
+ <td><input type="text" id="mo2f_custom_button_color" name="mo2f_custom_button_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_button_color')?>" class="my-color-field" /> </td>
128
+ </tr>
129
+ <tr>
130
+ <td><?php echo mo2f_lt('Links Text Color:');?> </td>
131
+ <td><input type="text" id="mo2f_custom_links_text_color" name="mo2f_custom_links_text_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_links_text_color')?>" class="my-color-field" /> </td>
132
+ </tr>
133
+ <tr>
134
+ <td><?php echo mo2f_lt('Popup Message Text Color:');?> </td>
135
+ <td><input type="text" id="mo2f_custom_notif_text_color" name="mo2f_custom_notif_text_color" <?php echo 'disabled';?> value="<?php echo get_option('mo2f_custom_notif_text_color')?>" class="my-color-field" /> </td>
136
+ </tr>
137
+ <tr>
138
+ <td><?php echo mo2f_lt('Popup Message Background Color:');?> </td>
139
+ <td><input type="text" id="mo2f_custom_notif_bg_color" name="mo2f_custom_notif_bg_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_notif_bg_color')?>" class="my-color-field" /> </td>
140
+ </tr>
141
+ <tr>
142
+ <td><?php echo mo2f_lt('OTP Token Background Color:');?> </td>
143
+ <td><input type="text" id="mo2f_custom_otp_bg_color" name="mo2f_custom_otp_bg_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_otp_bg_color')?>" class="my-color-field" /> </td>
144
+ </tr>
145
+ <tr>
146
+ <td><?php echo mo2f_lt('OTP Token Text Color:');?> </td>
147
+ <td><input type="text" id="mo2f_custom_otp_text_color" name="mo2f_custom_otp_text_color" <?php echo 'disabled'; ?> value="<?php echo get_option('mo2f_custom_otp_text_color')?>" class="my-color-field" /> </td>
148
+ </tr>
149
+ </table>
150
+ </br>
151
+ <input type="submit" name="submit" style="margin-left:2%; background-color: #20b2aa; color: white; box-shadow: none;" value="Save Settings" class="mo_wpns_button mo_wpns_button1" <?php
152
+ echo 'disabled' ; ?> />
153
+
154
+ </form>
155
+ </div>
156
+ <?php
157
+ }
views/two_fa_rba.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="mo_wpns_setting_layout" style="min-height:1310px">
2
+ <form id="settings_from_addon" method="post" action="">
3
+ <input type="hidden" name="option" value="mo_auth_addon_settings_save"/>
4
+ <h3 id="rba_description" style="color: #20b2aa; text-align: center;">
5
+ It helps you to remember the device where you will not be asked to authenticate the 2-factor if you login from the Remember Device.</h3>
6
+ <br>
7
+ <h3><?php echo mo2f_lt( 'Remember Device' ); ?></h3>
8
+ <hr>
9
+ <br>
10
+ <?php mo2f_rba_functionality(); ?>
11
+
12
+
13
+ </form>
14
+
15
+ <br><br>
16
+
17
+ <h3><?php echo mo2f_lt( 'Limit Number Of Device' ); ?></h3>
18
+ <hr>
19
+ <p><?php echo mo2f_lt( 'In this feature, the admin can restrict the number of devices from which the user can access the website. If the device limit is exceeded the admin can set three actions where it can allow the users to login, deny the access or challenge the user for authentication.' ); ?>
20
+ <br><br>
21
+
22
+
23
+ </p>
24
+ <div class="mo_wpns_setting_layout" style="background-color: aliceblue; border:none;">
25
+ <h3 style="display: inline;float: left">Device Configuration</h3><h3 style="color: red;"><b>&nbsp;&nbsp;&nbsp;&nbsp;[ PREMIUM ]</b></h3><hr>
26
+ <label class="mo_wpns_switch">
27
+ <input type="checkbox" id="pluginWAF" name="pluginWAF" <?php echo 'disabled'; ?>>
28
+ <span class="mo_wpns_slider mo_wpns_round"></span>
29
+ </label>
30
+ <span class="checkbox_text text_fonts" id="Allow_User_to_Register_Device" style="font-weight: 500;">Allow User to Register Device.</span>
31
+ <br><br>
32
+ <span class="input_field_fonts" style="font-weight: 500;">Number of Device Registrations Allowed :</span>
33
+ <input type="text" name="allowedDeviceRegistrations" maxlength="2" value="10" id="allowedDeviceRegistrations" class="form-control" title="Please enter Numbers only" pattern="\d*" <?php echo 'disabled';?>></p>
34
+ <br>
35
+ <span class="checkbox_text text_fonts" id="Allow_User_to_Register_Device1" style="font-weight: 500;">Action if number of devices exceeded</span>
36
+
37
+ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
38
+ <input type="radio" name="rbaConfiguration.deviceExceedAction" id="rbaConfiguration_deviceExceedActionCHALLENGE" value="CHALLENGE" class="radio spacing"><label for="rbaConfiguration_deviceExceedActionCHALLENGE" style="font-weight: 500;" class="radio spacing">Challenge</label>
39
+ <input type="radio" name="rbaConfiguration.deviceExceedAction" id="rbaConfiguration_deviceExceedActionDENY" checked="checked" value="DENY" class="radio spacing"><label for="rbaConfiguration_deviceExceedActionDENY" style="font-weight: 500;" class="radio spacing">Deny</label>
40
+ <script type="text/javascript">
41
+ document.getElementById("rbaConfiguration_deviceExceedActionCHALLENGE").disabled = true;
42
+ document.getElementById("rbaConfiguration_deviceExceedActionDENY").disabled = true;
43
+ </script>
44
+ <div style="margin-top: 20px;">
45
+ <label class="mo_wpns_switch">
46
+ <input type="checkbox" id="pluginWAF" name="pluginWAF" <?php echo 'disabled'; ?>>
47
+ <span class="mo_wpns_slider mo_wpns_round"></span>
48
+ </label>
49
+ <span class="checkbox_text text_fonts" style="font-weight: 500;">Send email alerts to Users if number of Device registrations exceeded allowed count.</span>
50
+ </div>
51
+
52
+ </div>
53
+ <div style="margin-top: 337px;margin-left: 8px;">
54
+ <button style="box-shadow: none;" class="mo_wpns_button mo_wpns_button1" id="set_device_limit_button" target="_blank"><?php echo mo2f_lt( 'Set Device Limit' ); ?>
55
+ </button>
56
+ </div>
57
+ <script type="text/javascript">
58
+ document.getElementById("set_device_limit_button").disabled = true;
59
+ </script>
60
+
61
+
62
+ <br><br>
63
+ <div >
64
+ <h3><?php echo mo2f_lt( 'IP Restriction: Limit users to login from specific IPs' ); ?></h3>
65
+ <hr>
66
+ <p><?php echo mo2f_lt( 'The Admin can enable IP restrictions for the users. It will provide additional security to the accounts and perform different action to the accounts only from the listed IP Ranges. If user tries to access with a restricted IP, Admin can set three action: Allow, challenge or deny. Depending upon the action it will allow the user to login, challenge(prompt) for authentication or deny the access.' ); ?>
67
+
68
+ <br><br>
69
+
70
+ </p>
71
+ <div class="mo_wpns_setting_layout" style="background-color: aliceblue; border:none;">
72
+ <h3 style="display: inline;float: left">IP Blocking Configuration </h3><h3 style="color: red;"><b>&nbsp;&nbsp;&nbsp;&nbsp;[ PREMIUM ]</b></h3><hr>
73
+ <label class="mo_wpns_switch">
74
+ <input type="checkbox" id="pluginWAF" name="pluginWAF" <?php echo 'disabled'; ?>>
75
+ <span class="mo_wpns_slider mo_wpns_round"></span>
76
+ </label>&nbsp;&nbsp;&nbsp;&nbsp;
77
+ <span class="checkbox_text text_fonts" id="Allow_User_to_Register_Device" style="font-weight: 500;">Allow All IPs</span>
78
+ <br><br>
79
+ <div class="col-md-7 top-buffer">
80
+ <span class="input_field_fonts" style="font-weight: 500;">Action if IP Address is not in the given list:</span>
81
+
82
+ </div>
83
+
84
+ <div class="radio col-md-5 col-xs-offset-1">
85
+ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
86
+ <input type="radio" name="rbaConfiguration.deviceExceedAction" id="rbaConfiguration_deviceExceedActionCHALLENGE2" value="CHALLENGE" class="radio spacing"><label for="rbaConfiguration_deviceExceedActionCHALLENGE" style="font-weight: 500;" class="radio spacing">Allow</label>
87
+ <input type="radio" name="rbaConfiguration.deviceExceedAction" id="rbaConfiguration_deviceExceedActionCHALLENGE1" value="CHALLENGE" class="radio spacing"><label for="rbaConfiguration_deviceExceedActionCHALLENGE" style="font-weight: 500;" class="radio spacing">Challenge</label>
88
+ <input type="radio" name="rbaConfiguration.deviceExceedAction" id="rbaConfiguration_deviceExceedActionDENY1" checked="checked" value="DENY" class="radio spacing"><label for="rbaConfiguration_deviceExceedActionDENY" style="font-weight: 500;" class="radio spacing">Deny</label>
89
+ <br><br>
90
+
91
+ </div>
92
+ <script type="text/javascript">
93
+ document.getElementById("rbaConfiguration_deviceExceedActionCHALLENGE2").disabled = true;
94
+ document.getElementById("rbaConfiguration_deviceExceedActionCHALLENGE1").disabled = true;
95
+ document.getElementById("rbaConfiguration_deviceExceedActionDENY1").disabled = true;
96
+
97
+ </script>
98
+
99
+ <input type="text" name="allowedDeviceRegistrations" maxlength="2" id="allowedDeviceRegistrations" class="form-control" title="Please enter Numbers only" pattern="\d*" placeholder="Enter Start IP" style="background-color: white;" <?php echo 'disabled';?>>&nbsp;&nbsp;
100
+ <input type="text" name="allowedDeviceRegistrations" maxlength="2" id="allowedDeviceRegistrations" class="form-control" title="Please enter Numbers only" pattern="\d*" placeholder="Enter End IP" style="background-color: white;" <?php echo 'disabled';?>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
101
+ <label class="mo_wpns_switch">
102
+ <input type="checkbox" id="pluginWAF" name="pluginWAF" <?php echo 'disabled'; ?>>
103
+ <span class="mo_wpns_slider mo_wpns_round"></span>
104
+ </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
105
+ <button type="button" style=" background-color: forestgreen;" id="add_ip" class="btn btn-success addipbutton pull-right">
106
+ <i class="glyphicon-white glyphicon-plus">+</i>
107
+ </button><br><br>
108
+ <input type="text" name="allowedDeviceRegistrations" maxlength="2" id="allowedDeviceRegistrations" class="form-control" title="Please enter Numbers only" pattern="\d*" placeholder="Enter Start IP" style="background-color: white;" <?php echo 'disabled';?>>&nbsp;&nbsp;
109
+ <input type="text" name="allowedDeviceRegistrations" maxlength="2" id="allowedDeviceRegistrations" class="form-control" title="Please enter Numbers only" pattern="\d*" placeholder="Enter End IP" style="background-color: white;" <?php echo 'disabled';?>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
110
+ <label class="mo_wpns_switch">
111
+ <input type="checkbox" id="pluginWAF" name="pluginWAF" <?php echo 'disabled'; ?>>
112
+ <span class="mo_wpns_slider mo_wpns_round"></span>
113
+ </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
114
+ <button type="button" style=" background-color: forestgreen;" id="add_ip" class="btn btn-success addipbutton pull-right">
115
+ <i class="glyphicon-white glyphicon-plus">+</i>
116
+ </button>
117
+
118
+
119
+
120
+ </div>
121
+ <div style="margin-top: 345px;margin-left: 8px;">
122
+ <a style="box-shadow: none;"
123
+ class="mo_wpns_button mo_wpns_button1"
124
+ target="_blank" <?php echo 'disabled' ; ?>><?php echo mo2f_lt( 'Restrict IP' ); ?></a>
125
+ </div>
126
+ </div>
127
+ </div>
128
+
129
+ <script>
130
+
131
+
132
+ jQuery('#mo2f_hide_rba_content').hide();
133
+ jQuery('#mo2f_activate_rba_addon').hide();
134
+ // jQuery('#mo2f_purchase_rba_addon').hide();
135
+
136
+ </script>
137
+ <?php
138
+
139
+
140
+ function mo2f_rba_functionality() {
141
+ global $current_user;
142
+ $current_user = wp_get_current_user();
143
+ global $dbQueries,$Mo2fdbQueries;
144
+ ?>
145
+
146
+ <div>
147
+ <div class="mo_wpns_setting_layout" style="background-color: aliceblue; border:none;">
148
+ <h3>Remember device</h3>
149
+ <input type="checkbox" id="mo2f_remember_device" name="mo2f_remember_device"
150
+ value="1" <?php checked( get_option( 'mo2f_remember_device' ) == 1 );
151
+
152
+ // if ( $Mo2fdbQueries->get_user_detail( 'mo_2factor_user_registration_status', $current_user->ID ) == 'MO_2_FACTOR_PLUGIN_SETTINGS' ) {
153
+ // } else {
154
+ echo 'disabled';
155
+ // }
156
+ ?> /><?php echo mo2f_lt( 'Enable' ); ?>
157
+ '<b><?php echo mo2f_lt( 'Remember device' ); ?></b>' <?php echo mo2f_lt( 'option ' ); ?>
158
+ <br><span
159
+ style="color:red;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<?php echo mo2f_lt( 'Applicable only for ' ); ?>
160
+ <i><?php echo mo2f_lt( 'Login with password + 2nd Factor' ); ?>)</i></span><br>
161
+ <br>
162
+ <div class="mo2f_advanced_options_note"><p style="padding:5px;">
163
+ <i><?php echo mo2f_lt( ' Checking this option will display an option ' ); ?>
164
+ '<b><?php echo mo2f_lt( 'Remember this device' ); ?></b>'<?php echo mo2f_lt( 'on 2nd factor screen. In the next login from the same device, user will bypass 2nd factor, i.e. user will be logged in through username + password only.' ); ?>
165
+ </div>
166
+ </i></p>
167
+ </div>
168
+ <div style="margin-left: 8px;">
169
+ <button style="box-shadow: none;" class="mo_wpns_button mo_wpns_button1" id="set_device_limit_button" target="_blank"><?php echo mo2f_lt( 'Save Settings' ); ?>
170
+ </button>
171
+ </div>
172
+ </div>
173
+
174
+
175
+ <?php
176
+ }
177
+
178
+
179
+ ?>
views/two_fa_shortcode.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $current_user;
3
+ $current_user = wp_get_current_user();
4
+ ?>
5
+
6
+ <div class="mo_wpns_setting_layout">
7
+
8
+
9
+ <div id="mo2f_hide_shortcode_content" >
10
+ <h3><?php echo __( 'List of Shortcodes', 'miniorange-2-factor-authentication' ); ?>:</h3>
11
+ <hr>
12
+ <ol style="margin-left:2%">
13
+ <li>
14
+ <b><?php echo __( 'Enable Two Factor: ', 'miniorange-2-factor-authentication' ); ?></b> <?php echo __( 'This shortcode provides an option to turn on/off 2-factor by user.', 'miniorange-2-factor-authentication' ); ?>
15
+ </li>
16
+ <li>
17
+ <b><?php echo __( 'Enable Reconfiguration: ', 'miniorange-2-factor-authentication' ); ?></b> <?php echo __( 'This shortcode provides an option to configure the Google Authenticator and Security Questions by user.', 'miniorange-2-factor-authentication' ); ?>
18
+ </li>
19
+ <li>
20
+ <b><?php echo __( 'Enable Remember Device: ', 'miniorange-2-factor-authentication' ); ?></b> <?php echo __( ' This shortcode provides\'Enable Remember Device\' from your custom login form.', 'miniorange-2-factor-authentication' ); ?>
21
+ </li>
22
+ </ol>
23
+ </div>
24
+ <h3><?php echo mo2f_lt('Shortcodes');?></h3>
25
+ <hr>
26
+ <div style="margin-left:2%">
27
+ <p>1. <b style="font-size:16px;color: #0085ba;">[miniorange_enable2fa]</b> :<?php echo mo2f_lt(' Add this shortcode to provide
28
+ the option to turn on/off 2-factor by user.');?><br><br>
29
+ 2. <b style="font-size:16px;color: #0085ba;">[mo2f_enable_reconfigure]</b> : <?php echo mo2f_lt('Add this shortcode to
30
+ provide the option to configure the Google Authenticator and Security Questions by user.');?><br>
31
+ <br>
32
+ 3. <b style="font-size:16px;color: #0085ba;">[mo2f_enable_rba_shortcode]</b> :<?php echo mo2f_lt(' Add this shortcode to
33
+ \'Enable Remember Device\' from your custom login form.');?>
34
+ </p>
35
+
36
+ <form name="f" id="custom_login_form" method="post" action="">
37
+ <?php echo mo2f_lt('Enter the id of your custom login form to use \'Enable Remember Device\' on the login page:');?>
38
+ <input type="text" class="mo2f_table_textbox" id="mo2f_rba_loginform_id"
39
+ name="mo2f_rba_loginform_id" <?php if (mo2f_is_customer_registered()) {
40
+ } else {
41
+ echo 'disabled';
42
+ } ?> value="<?php echo get_option('mo2f_rba_loginform_id') ?>"/>
43
+ <br><br>
44
+ <input type="hidden" name="option" value="custom_login_form_save"/>
45
+ <input type="submit" name="submit" value="Save Settings" style="background-color: #20b2aa; color: white;" class="mo_wpns_button mo_wpns_button1" <?php
46
+
47
+ echo 'disabled';
48
+ ?> />
49
+ </form>
50
+ </div>
51
+ </div>