Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Set up the SMTP.
- */
- function configure_fpt_smtp(PHPMailer $phpmailer) { // obfuscate this function
- // get the SMTP data from DB which is updated every 12 hours by making a request to flothemes.com API
- // the data in the DB is encrypted, and we have to decrypt it
- $smtp_data = get_option('fpt_forms_smtp', '');
- if(is_array($smtp_data)) {
- if(isset($smtp_data['h'])) {
- $host = base64_decode($smtp_data['h']);
- }
- if(isset($smtp_data['pi'])) {
- $port = base64_decode($smtp_data['pi']);
- }
- if(isset($smtp_data['u'])) {
- $user_name = base64_decode($smtp_data['u']);
- }
- if(isset($smtp_data['p'])) {
- $password = base64_decode($smtp_data['p']);
- }
- if(isset($host) && isset($port) && isset($user_name) && isset($password)) {
- $phpmailer->isSMTP(); //switch to smtp
- $phpmailer->SMTPAuth = true;
- $phpmailer->Host = $host;
- $phpmailer->Port = $port;
- $phpmailer->Username = $user_name;
- $phpmailer->Password = $password;
- }
- }
- }
- function fpt_forms_update_smtp() { // obfuscate this function
- $api_url = 'https://flothemes.com/wp-json/flo/v1/floforms';
- //$api_url = 'http://localhost/flocom/wp-json/flo/v1/floforms';
- $args = array(
- 'method' => 'GET',
- 'body' => array(
- //'a' => 'lorem_ipsum',
- )
- );
- $response = wp_remote_get( $api_url, $args );
- if ( is_array( $response ) ) {
- $body = json_decode( wp_remote_retrieve_body( $response ), true );
- //var_dump('body: ', $body);
- update_option('fpt_forms_smtp', $body, $autoload = false);
- }
- }
- // OBFUSCATION END
Add Comment
Please, Sign In to add comment