mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
61 lines
No EOL
1.6 KiB
PHP
61 lines
No EOL
1.6 KiB
PHP
<?php
|
|
|
|
class ReportActions extends Actions
|
|
{
|
|
public static function executeDmca()
|
|
{
|
|
if (!Request::isPost())
|
|
{
|
|
return ['report/dmca'];
|
|
}
|
|
|
|
$values = [];
|
|
$errors = [];
|
|
|
|
foreach (['name', 'email', 'rightsholder', 'identifier'] as $field)
|
|
{
|
|
$value = Request::getPostParam($field);
|
|
|
|
if (!$value)
|
|
{
|
|
$errors[$field] = __('form_error.required');
|
|
}
|
|
elseif($field == 'email' && !filter_var($value, FILTER_VALIDATE_EMAIL))
|
|
{
|
|
$errors[$field] = __('form_error.invalid');
|
|
}
|
|
|
|
$values[$field] = $value;
|
|
}
|
|
|
|
if (!$errors)
|
|
{
|
|
$values['report_id'] = Encoding::base58Encode(random_bytes(6));
|
|
Mailgun::sendDmcaReport($values);
|
|
Session::setFlash('success', '<h3>Report Submitted</h3><p>We will respond shortly.</p><p>This ID for this report is <strong>' . $values['report_id'] . '</strong>. Please reference this ID when contacting us regarding this report.</p>');
|
|
return Controller::redirect(Request::getRelativeUri(), 303);
|
|
}
|
|
|
|
return ['report/dmca', ['errors' => $errors, 'values' => $values]];
|
|
}
|
|
|
|
public static function executeYouTubeSub()
|
|
{
|
|
if (!Request::isPost())
|
|
{
|
|
return Controller::redirect('/youtube');
|
|
}
|
|
|
|
$email = Request::getPostParam('email');
|
|
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
|
|
{
|
|
Session::setFlash('error', 'Please enter a valid email.');
|
|
return Controller::redirect('/youtube');
|
|
}
|
|
|
|
Mailgun::sendYouTubeWarmLead(['email' => $email]);
|
|
|
|
return Controller::redirect(Request::getRelativeUri(), 303);
|
|
}
|
|
} |