1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
DanieL 2022-10-07 12:50:00 -03:00
parent 26c68a9960
commit 9de8c7d4b0

View file

@ -1,47 +1,48 @@
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
global $global, $config; global $global, $config;
if (!isset($global['systemRootPath'])) { if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::canUpload()) { if (!User::canUpload()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not notify")); header("Location: {$global['webSiteRootURL']}?error=" . __("You can not notify"));
exit; exit;
} }
$user_id = User::getId(); $user_id = User::getId();
// if admin bring all subscribers // if admin bring all subscribers
if (User::isAdmin()) { if (User::isAdmin()) {
$user_id = ''; $user_id = '';
} }
require_once 'subscribe.php'; require_once 'subscribe.php';
header('Content-Type: application/json'); setRowCount(10000);
$Subscribes = Subscribe::getAllSubscribes($user_id); header('Content-Type: application/json');
$Subscribes = Subscribe::getAllSubscribes($user_id);
$obj = new stdClass();
//Create a new PHPMailer instance $obj = new stdClass();
$mail = new \PHPMailer\PHPMailer\PHPMailer(); //Create a new PHPMailer instance
setSiteSendMessage($mail); $mail = new \PHPMailer\PHPMailer\PHPMailer();
//Set who the message is to be sent from setSiteSendMessage($mail);
$mail->setFrom($config->getContactEmail()); //Set who the message is to be sent from
//Set who the message is to be sent to $mail->setFrom($config->getContactEmail());
//$mail->addAddress($config->getContactEmail()); //Set who the message is to be sent to
foreach ($Subscribes as $value) { //$mail->addAddress($config->getContactEmail());
$mail->addBCC($value["email"]); foreach ($Subscribes as $value) {
} $mail->addBCC($value["email"]);
$obj->total = count($Subscribes); }
//Set the subject line $obj->total = count($Subscribes);
$mail->Subject = 'Message From Site ' . $config->getWebSiteTitle(); //Set the subject line
$mail->msgHTML($_POST['message']); $mail->Subject = 'Message From Site ' . $config->getWebSiteTitle();
$mail->msgHTML($_POST['message']);
//send the message, check for errors
if (!$mail->send()) { //send the message, check for errors
$obj->error = __("Message could not be sent") . " " . $mail->ErrorInfo; if (!$mail->send()) {
} else { $obj->error = __("Message could not be sent") . " " . $mail->ErrorInfo;
$obj->success = __("Message sent"); } else {
} $obj->success = __("Message sent");
}
echo json_encode($obj);
echo json_encode($obj);