$dms, 'user'=>$user)); $accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings); if (!$accessop->check_controller_access($controller, $_GET)) { header('Content-Type: application/json'); echo json_encode(array('success'=>false, 'message'=>getMLText('access_denied'))); exit; } /* Check if the form data comes from a trusted request */ if(!checkFormKey('sendnotification', 'GET')) { header('Content-Type: application/json'); echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'))); exit; } if (!isset($_GET["userid"]) || !is_numeric($_GET["userid"]) || intval($_GET["userid"])<1) { header('Content-Type: application/json'); echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_user_id'))); } $userid = $_GET["userid"]; $newuser = $dms->getUser($userid); if (!is_object($newuser)) { header('Content-Type: application/json'); echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_user_id'))); exit; } $recvtype = 1; if (isset($_GET["recvtype"])) { $recvtype = (int) $_GET["recvtype"]; } $template = 'send_notification'; if (isset($_GET["template"])) { $template = $_GET["template"]; } if($notifier) { header('Content-Type: application/json'); if($notifier->toIndividual($user, $newuser, $template.'_email_subject', $template.'_email_body', [], $recvtype)) { echo json_encode(array('success'=>true, 'message'=>getMLText('splash_send_notification'))); } else { echo json_encode(array('success'=>false, 'message'=>getMLText('error_send_notification'))); } }