Advertisement
Guest User

Untitled

a guest
Dec 24th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function autologinfrommail_config()
  15. {
  16. $moduleVersion = '1.2.3';
  17. $ModuleUpdateChecker = autologinfrommail_moduleupdatechecker();
  18. if (version_compare($ModuleUpdateChecker['Version'], $moduleVersion, 'gt') && !empty($ModuleUpdateChecker['Version'])) {
  19. $ModuleUpdateAvailable = '<a class=\'btn btn-warning btn-xs\' href=\'https://whmcs.deploymentcode.com\' target=\'_blank\'>Update available</a>';
  20. }
  21.  
  22. $configarray = [
  23. 'name' => 'Auto Login from Mails',
  24. 'description' => 'Let your clients login automatically from mails. ' . $ModuleUpdateAvailable,
  25. 'version' => $moduleVersion,
  26. 'author' => 'Deploymentcode.com',
  27. 'fields' => [
  28. 'option1' => ['FriendlyName' => 'License Key', 'Type' => 'text', 'Size' => '25', 'Description' => 'Key from deploymentcode.com', 'Default' => ''],
  29. 'option3' => ['FriendlyName' => 'Auth Link is valid for', 'Type' => 'text', 'Size' => '4', 'Description' => 'hours', 'Default' => '24'],
  30. 'option7' => ['FriendlyName' => 'Maxmium Page Views', 'Type' => 'text', 'Size' => '4', 'Description' => '<br />The client will be logged out automatically if the defined amount of page views is reached. <br />' . "\n" . ' This function could be used to allow only viewing the current page (e.g. invoice or ticket feedback page). <b>Default:</b> blank', 'Default' => ''],
  31. 'option8' => ['FriendlyName' => 'First URL Token Parameter', 'Type' => 'text', 'Size' => '4', 'Description' => 'With this option you can change the first token parameter which will be used in the auto login mail. <b>Default:</b> lauto', 'Default' => 'lauto'],
  32. 'option9' => ['FriendlyName' => 'Second URL Token Parameter', 'Type' => 'text', 'Size' => '4', 'Description' => 'With this option you can change the second token parameter which will be used in the auto login mail. <b>Default:</b> lauth', 'Default' => 'lauth'],
  33. 'option6' => ['FriendlyName' => 'Expire all other links on click', 'Type' => 'yesno', 'Description' => 'If enabled, all other auto-login links from the client will expire if he opens an auto login link.', 'Default' => ''],
  34. 'option11' => ['FriendlyName' => 'Expire all links on password change', 'Type' => 'yesno', 'Default' => 'yes', 'Size' => '4', 'Description' => 'Expire all auto-login links if client changes his password'],
  35. 'option12' => ['FriendlyName' => 'Expire all links on mail change', 'Type' => 'yesno', 'Default' => 'yes', 'Size' => '4', 'Description' => 'Expire all auto-login links if client changes his mail address'],
  36. 'option14' => ['FriendlyName' => 'Dont expire link on click', 'Type' => 'yesno', 'Size' => '4', 'Description' => 'Link can be used multiple times to login and is valid until it expire'],
  37. 'option13' => ['FriendlyName' => '2 Factor Authentication', 'Type' => 'yesno', 'Default' => 'yes', 'Size' => '4', 'Description' => 'When enabling this option, clients with enabled 2 factor authentication must login normally.'],
  38. 'option10' => ['FriendlyName' => 'Alert Boxes via Javascript', 'Type' => 'yesno', 'Default' => 'yes', 'Size' => '4', 'Description' => 'A alert box on the login page will appear if the Autologin Link is not valid or the maximum page view value is reached. <br />You can modify the output by editing the file template.php<br />' . "\n" . ' If you do not want to use the Javascript mode, you can modify your template by hand or do not display any alert box. Please refer to the module docs for more informations.'],
  39. 'option2' => ['FriendlyName' => 'Enable Opt-Out / Opt-In', 'Type' => 'yesno', 'Description' => 'With this option your clients can opt-out or opt-in from auto login by mail.', 'Default' => '']
  40. ]
  41. ];
  42. $Options = [];
  43.  
  44. if (Illuminate\Database\Capsule\Manager::table('tbladdonmodules')->where('module', 'autologinfrommail')->where('setting', 'option2')->first()->value === 'on') {
  45. foreach (Illuminate\Database\Capsule\Manager::table('tblcustomfields')->where('type', 'client')->get() as $SelectField) {
  46. $Options[$SelectField->fieldname] = $SelectField->fieldname;
  47. }
  48.  
  49. $configarray['fields']['option4'] = ['FriendlyName' => 'Opt-In / Opt-Out Field', 'Type' => 'dropdown', 'Options' => $Options, 'Description' => '<br />Your clients can Opt-In or Opt-Out from receiving working auto-login links. <br />Some customers may do not want to bypass the password login.<br />' . "\n" . ' Deactive "Enable Opt-Out / Opt-In" to disable.'];
  50. $configarray['fields']['option5'] = ['FriendlyName' => 'Client must Opt-in', 'Type' => 'yesno', 'Description' => 'Enable this option if the clients should explicit opt-in for auto login.<br />' . "\n" . ' If this option is not enabled: The clients can opt-out by check mark your custom field. <br />' . "\n" . ' If this option is enabled: The clients must check mark your custom field for auto login from mails.', 'Default' => ''];
  51. }
  52.  
  53. return $configarray;
  54. }
  55.  
  56. function autologinfrommail_activate()
  57. {
  58. Illuminate\Database\Capsule\Manager::statement('CREATE TABLE IF NOT EXISTS `mod_mailautologin` (' . "\n" . ' `id` int(11) NOT NULL AUTO_INCREMENT,' . "\n" . ' `date` text NOT NULL,' . "\n" . ' `userid` int(11) NOT NULL,' . "\n" . ' `token` text NOT NULL,' . "\n" . ' `token2` text NOT NULL,' . "\n" . ' PRIMARY KEY (`id`)' . "\n" . ' ) ENGINE=InnoDB DEFAULT CHARSET=latin1;');
  59. return ['status' => 'success', 'description' => 'Module installed!'];
  60. return ['status' => 'error', 'description' => 'There was an error, please check logs'];
  61. return ['status' => 'info', 'description' => 'OK'];
  62. }
  63.  
  64. function autologinfrommail_deactivate()
  65. {
  66. return ['status' => 'success', 'description' => 'Module removed'];
  67. return ['status' => 'error', 'description' => 'There was an error, please check logs'];
  68. ...................................................................
  69. ..........................................
  70. .........................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement