nlozovan

Untitled

Jul 12th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. /**
  2.  * Set up the SMTP.
  3.  */
  4. function configure_fpt_smtp(PHPMailer $phpmailer) { // obfuscate this function
  5.  
  6.     // get the SMTP data from DB which is updated every 12 hours by making a request to flothemes.com API
  7.     // the data in the DB is encrypted, and we have to decrypt it
  8.     $smtp_data = get_option('fpt_forms_smtp', '');
  9.  
  10.     if(is_array($smtp_data)) {
  11.         if(isset($smtp_data['h'])) {
  12.             $host = base64_decode($smtp_data['h']);
  13.         }
  14.  
  15.         if(isset($smtp_data['pi'])) {
  16.             $port = base64_decode($smtp_data['pi']);
  17.         }
  18.  
  19.         if(isset($smtp_data['u'])) {
  20.             $user_name = base64_decode($smtp_data['u']);
  21.         }
  22.  
  23.         if(isset($smtp_data['p'])) {
  24.             $password = base64_decode($smtp_data['p']);
  25.         }
  26.  
  27.         if(isset($host) && isset($port) && isset($user_name) && isset($password)) {
  28.             $phpmailer->isSMTP(); //switch to smtp
  29.             $phpmailer->SMTPAuth = true;
  30.             $phpmailer->Host = $host;
  31.             $phpmailer->Port = $port;
  32.             $phpmailer->Username = $user_name;
  33.             $phpmailer->Password = $password;
  34.         }
  35.     }
  36.  
  37. }
  38.  
  39.  
  40. function fpt_forms_update_smtp() { // obfuscate this function
  41.     $api_url = 'https://flothemes.com/wp-json/flo/v1/floforms';
  42.     //$api_url = 'http://localhost/flocom/wp-json/flo/v1/floforms';
  43.  
  44.     $args = array(
  45.         'method' => 'GET',
  46.         'body' => array(
  47.             //'a' => 'lorem_ipsum',
  48.         )
  49.     );
  50.  
  51.     $response = wp_remote_get( $api_url, $args );
  52.  
  53.     if ( is_array( $response ) ) {
  54.         $body = json_decode( wp_remote_retrieve_body( $response ), true );
  55.  
  56.         //var_dump('body: ', $body);
  57.         update_option('fpt_forms_smtp', $body, $autoload = false);
  58.     }
  59.  
  60. }
  61.  
  62.  
  63. // OBFUSCATION END
  64.  
Add Comment
Please, Sign In to add comment