403Webshell
Server IP : 104.129.129.72  /  Your IP : 216.73.216.229
Web Server : LiteSpeed
System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : answe8064 ( 1002)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/123answers.ca/public_html/saskatoon/wp-content/themes/directorytheme/npm/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/123answers.ca/public_html/saskatoon/wp-content/themes/directorytheme/npm/listing_notify.php
<?php

/* Notify admin on email when someone (user) create a new listing */		

//notify admin
add_action('acf/save_post', 'my_save_post',99);
function my_save_post( $post_id ) {
	$key_1_value = get_post_meta( $post_id, 'premium_pay_status', true );
	$listing_paid_or_not = get_post_meta( $post_id, 'listing_paid_or_not', true );
	update_post_meta($post_id,'listing_paid_or_not',$_POST['listing_paid_or_not']);
		
	//if( ($_POST['listing_paid_or_not'] > $listing_paid_or_not)) {
	if( $_POST['action'] == 'add_listing' && $_POST['listing_paid_or_not'] > 1) {
		delete_post_meta( $post_id, 'premium_pay_status');
		$key_1_value = get_post_meta( $post_id, 'premium_pay_status', true );
		# bail early if editing in admin
		if( is_admin() ) {		
			return;		
		}		
		if ( ! empty( $key_1_value ) && $key_1_value == 'pay_done') {
			return;	
		} else{
			$return = get_field('pay_listing_page', 'option');
			wp_redirect($return.'?post_id='.$post_id);	
			exit;
		}
	}

	if($_POST['action'] == 'edit_listing' && ($listing_paid_or_not == 0 || empty($listing_paid_or_not)) ){
		$listing_paid_or_not = 1;
	}

	if( $_POST['action'] == 'edit_listing' && !empty($listing_paid_or_not) && ($_POST['listing_paid_or_not'] > $listing_paid_or_not)) {
		delete_post_meta( $post_id, 'premium_pay_status');
		$key_1_value = get_post_meta( $post_id, 'premium_pay_status', true );
		# bail early if editing in admin
		if( is_admin() ) {		
			return;		
		}		
		if ( ! empty( $key_1_value ) && $key_1_value == 'pay_done') {
			return;	
		} else{
			$return = get_field('pay_listing_page', 'option');
			wp_redirect($return.'?post_id='.$post_id);	
			exit;
		}
	}
	
	# add conditional to check form was triggered
	//for listing notification
	if(($_POST['acf']['field_5a508d0511150'] !='')) {
		# bail early if editing in admin
		if( is_admin() ) {		
			return;		
		}
		
		# vars
		$post = get_post( $post_id );	
	
		echo $post_id;
	 	$companyname1 = get_the_title($post_id);
		echo $companyname = htmlspecialchars_decode($companyname1); 
	
		$price = get_field('price', $post_id);
		$phone = get_field('phone', $post_id);
		$email = get_field('email_address', $post_id);
		$website = get_field('website', $post_id);

		$term = get_field('category', $post_id);
		$result="";
		foreach($term as $cat_list) :
			$result.=$cat_list->name.', '; 
		endforeach;
		$trimmed=rtrim($result, ', ');

		$contact_address = get_field('address', $post_id);		
    	$address = explode( "," , $contact_address['address']);
 
		echo $trimmed.'.';
	
		# email data
		$to = get_field('listing_notification', 'option');
		if($to==""){
			$to = get_bloginfo('admin_email');
		}
		$current_user = wp_get_current_user();
		if($email == ''){
	    	$email = print_r($current_user->user_email,true);
		}
	
	 	$headers = 'From: '. $to . "\r\n" .'Reply-To: ' . $email . "\r\n";
	 	$headers = array('Content-Type: text/html; charset=UTF-8','Reply-To: <'.$email.'>');

		$subject = get_field('listing_subject', 'option');	
		if($subject==""){
			$subject = 'New Listing Added';
		}		
		
		$body = 'Waiting For Approval ' ."\r\n";	
		$body .= 'Company Name: '.$companyname. "\r\n\r\n";
		if($price!=""){	
			$body .= 'Price: '.$price. "\r\n\r\n";	
		}	
		if($address!=""){		
			$body .= 'Address: '.$address[0].', ' .$address[1].','.$address[2] ."\r\n\r\n";	
		}
		if($phone!=""){		
			$body .= 'Phone: '.$phone. "\r\n\r\n";
		}
		if($email!=""){		
			$body .= 'Email: '.$email. "\r\n\r\n";	
		}
		if($website!=""){		
			$body .= 'Website: '.$website. "\r\n\r\n";
		}	
		
		# send email

		wp_mail( $to, $subject, $body, $headers );

	}
	
	//for contact form notification
	if(($_POST['acf']['field_5a56fd92872ea'] !='')) {
	
		# bail early if editing in admin
		if( is_admin() ) {		
			return;		
		}
		
		# vars
		$post = get_post( $post_id );	
	
		# get user registration details
		$name = get_the_title($post_id);
		$c_phone = get_field('c_phone', $post_id);
		$c_email = get_field('c_email', $post_id);
		$c_subject = get_field('c_subject', $post_id);
		$c_message = get_field('c_message', $post_id);
	
		# email data
		$to = get_field('contact_notification', 'option');
		echo $to;
	
		if($to==""){
			$to = get_bloginfo('admin_email');
		}
		
		if($c_subject==""){
			$c_subject = get_field('subject', 'option');
		}
	 	$headers = 'From: '. $to . "\r\n" .'Reply-To: ' . $c_email . "\r\n";
	 	$headers = array('Content-Type: text/html; charset=UTF-8','Reply-To: <'.$c_email.'>');	 
		
		$body .= 'From: '.$name. "\r\n";	
		$body .= 'Email: '.$c_email. "\r\n\r\n";
	    $body .= 'Phone: '.$c_phone. "\r\n\r\n";
		$body .= ''.$c_message. "\r\n";		
		
		# send email
	
		wp_mail( $to, $c_subject, $body, $headers );
	}
	
}
//end notify admin

Youez - 2016 - github.com/yon3zu
LinuXploit