statusId != 1)
{
notification::setError(t("report_abuse_error_file_not_active", "The file url you've set is not active."));
}
}
}
// add to database and send email to admin
if (notification::isErrors() == false)
{
// add to database
$dbInsert = new DBObject("file_report", array("file_id", "report_date", "reported_by_name",
"reported_by_email", "reported_by_address", "reported_by_telephone_number", "digital_signature",
"report_status", "reported_by_ip", "other_information")
);
$dbInsert->file_id = $file->id;
$dbInsert->report_date = coreFunctions::sqlDateTime();
$dbInsert->reported_by_name = $reported_by_name;
$dbInsert->reported_by_email = $reported_by_email;
$dbInsert->reported_by_address = $reported_by_address;
$dbInsert->reported_by_telephone_number = $reported_by_telephone_number;
$dbInsert->digital_signature = $digital_signature;
$dbInsert->report_status = 'pending';
$dbInsert->reported_by_ip = coreFunctions::getUsersIPAddress();
$dbInsert->other_information = $other_information;
if ($dbInsert->insert())
{
// send email
$subject = t('report_file_email_subject', 'New abuse report on [[[SITE_NAME]]]', array('SITE_NAME' => SITE_CONFIG_SITE_NAME));
$replacements = array(
'FILE_DETAILS' => $file_url,
'SITE_NAME' => SITE_CONFIG_SITE_NAME,
'WEB_ROOT' => WEB_ROOT,
'USERS_IP' => coreFunctions::getUsersIPAddress()
);
$defaultContent = "There is a new abuse report on [[[SITE_NAME]]] with the following details:
";
$defaultContent .= "***************************************
";
$defaultContent .= "[[[FILE_DETAILS]]]
";
$defaultContent .= "***************************************
";
$defaultContent .= "Submitted IP: [[[USERS_IP]]]
";
$defaultContent .= "***************************************
";
$defaultContent .= "Please login via [[[WEB_ROOT]]]/admin/ to investigate further.";
$htmlMsg = t('report_file_email_content', $defaultContent, $replacements);
coreFunctions::sendHtmlEmail(SITE_CONFIG_REPORT_ABUSE_EMAIL, $subject, $htmlMsg, SITE_CONFIG_REPORT_ABUSE_EMAIL, strip_tags(str_replace("
", "\n", $htmlMsg)), false, $reported_by_name, true, $reported_by_email);
coreFunctions::redirect(WEB_ROOT . '/report_file.' . SITE_CONFIG_PAGE_EXTENSION . '?s=1');
}
else
{
notification::setError(t("report_abuse_error_failed_reporting", "Failed reporting file, please try again later"));
}
}
}
else
{
// if url has been passed
if (isset($_REQUEST['file_url']))
{
$file_url = trim($_REQUEST['file_url']);
}
// if user logged in
if ($Auth->loggedIn())
{
$reported_by_email = $Auth->user->email;
}
}
// include header
require_once(SITE_TEMPLATES_PATH . '/partial/_header.inc.php');
?>