CMXX - Mailer update

This commit is contained in:
“VeLiTi”
2025-05-09 14:18:06 +02:00
parent da78217dd9
commit c20d2d9c6e
30 changed files with 4535 additions and 159 deletions

View File

@@ -122,6 +122,7 @@ $location_new = (($post_content['location'] != '' && $post_content['location'] !
//STEP 3 - Send to user
$mail_location = (file_exists($_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php') ? $_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php' : './assets/mail/email_template_reset.php');
include_once $mail_location;
send_mail($user_data['email'],$subject,$message,'','');
}

View File

@@ -55,7 +55,7 @@ if(isset($get_content) && $get_content!=''){
//Define Query
if(isset($criterias['totals']) && $criterias['totals'] ==''){
//Request for total rows
$sql = 'SELECT count(*) as count FROM dealers '.$whereclause.'';
$sql = 'SELECT count(*) as count FROM dealers d '.$whereclause.'';
}
elseif (isset($criterias['list']) && $criterias['list'] ==''){
$sql = 'SELECT d.* FROM dealers d '.$whereclause;
@@ -115,6 +115,7 @@ else {
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
//------------------------------------------
//JSON_ENCODE
//------------------------------------------

View File

@@ -14,7 +14,7 @@ if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} el
//default whereclause
$whereclause = '';
list($whereclause,$condition) = getWhereclause('',$permission,$partner,'get');
list($whereclause,$condition) = getWhereclauselvl2('',$permission,$partner,'get');
//NEW ARRAY
$criterias = [];

View File

@@ -369,7 +369,7 @@ else
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
//default whereclause
list($whereclause,$condition) = getWhereclause('',$permission,$partner,'');
list($whereclause,$condition) = getWhereclauselvl2('',$permission,$partner,'');
//BUILD UP PARTNERHIERARCHY FROM USER

57
api/v2/post/mailer.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
defined($security_key) or exit;
//------------------------------------------
// Products attributes
//------------------------------------------
//Connect to DB
$pdo = dbConnect($dbname);
//CONTENT FROM API (POST)
$post_content = json_decode($input,true);
//VALIDATE INPUT CRITERIA
if (isset($post_content['type']) && $post_content['type'] !=''){
//GET TYPE OF EMAIL
$mail_type = $post_content['type'] ?? '';
$mail_content = isset($post_content['content']) ? $post_content['content']: '';
$mail_subject = isset($post_content['subject']) ? $post_content['subject']: '';
$mail_to = isset($post_content['to']) ? $post_content['to']: email;
//QUERY AND VERIFY ALLOWED
if ($command == 'update' && isAllowed('mailer',$profile,$permission,'U') === 1){
//CHECK MAIL TYPE
switch ($mail_type) {
case 'contactform':
//GET TEMPLATE
$mail_location = (file_exists($_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_contactform.php') ? $_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_contactform.php' : './assets/mail/email_template_contactform.php');
include_once $mail_location;
//SEND MAIL
send_mail($mail_to,$mail_subject,$message,'','');
echo json_encode(array('status' => 'send'));
break;
case 'reset':
//GET TEMPLATE
$mail_location = (file_exists($_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php') ? $_SERVER['DOCUMENT_ROOT'].'/custom/'.$domain.'/mail/email_template_reset.php' : './assets/mail/email_template_reset.php');
include_once $mail_location;
//SEND MAIL
send_mail($mail_to,$subject,$message,'','');
break;
}
}
else
{
//do nothing
}
} else {
exit;
}
?>