313 lines
9.4 KiB
PHP
313 lines
9.4 KiB
PHP
<?php
|
|
|
|
|
|
|
|
/* $Id: user_report.php 42 2009-01-29 04:55:14Z john $ */
|
|
|
|
|
|
|
|
include "header.php";
|
|
|
|
if(isset($_POST['form'])) { $form = $_POST['form']; } elseif(isset($_GET['form'])) { $form = $_GET['form']; } else { $form = ""; }
|
|
if(isset($_POST['item'])) { $item = $_POST['item']; } elseif(isset($_GET['item'])) { $item = $_GET['item']; } else { $item = ""; }
|
|
if(isset($_POST['objectid'])) { $objectid = $_POST['objectid']; } elseif(isset($_GET['objectid'])) { $objectid = $_GET['objectid']; } else { $objectid = ""; }
|
|
|
|
if(!SE_DEBUG1&&$item=="blog"){$item="blog1";}
|
|
|
|
//$page = "user_report";
|
|
|
|
|
|
if($form=="profile"){
|
|
$page="user_report_profile";
|
|
$reportingwhat=$owner->user_info["user_username"]."'s profile";
|
|
}
|
|
elseif($form=="poll")
|
|
{
|
|
$page="user_report_poll";
|
|
$reportingwhat=$owner->user_info["user_username"]."'s poll";
|
|
}
|
|
elseif($form=="comments")
|
|
{
|
|
$page="user_report_comment";
|
|
$reportingwhat=$owner->user_info["user_username"]."'s comment";
|
|
if(isset($_POST['comment'])) { $comment = $_POST['comment']; } elseif(isset($_GET['comment'])) { $comment = $_GET['comment']; } else { $comment = ""; }
|
|
$commenttext=base64_decode($comment);
|
|
$comment=html_entity_decode(base64_decode($comment));
|
|
|
|
$smarty->assign('comment', $comment);
|
|
$smarty->assign('commenttext', $commenttext);
|
|
}
|
|
else{
|
|
$page = "user_report";
|
|
|
|
}
|
|
|
|
if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "main"; }
|
|
|
|
if(isset($_POST['return_url'])) { $return_url = $_POST['return_url']; } elseif(isset($_GET['return_url'])) { $return_url = $_GET['return_url']; } else { $return_url = ""; }
|
|
|
|
|
|
|
|
// EXIT IF USER IS NOT LOGGED IN
|
|
|
|
if( !$user->user_exists ) { exit(); }
|
|
|
|
|
|
|
|
// MAKE SURE RETURN URL IS SET
|
|
|
|
//if($return_url == "") { exit(); }
|
|
|
|
|
|
|
|
// ENCODE RETURN URL
|
|
$return_url = urldecode($return_url);
|
|
|
|
$return_url = str_replace("&", "&", $return_url);
|
|
|
|
|
|
|
|
// SET VARS
|
|
|
|
$submitted = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// SEND REPORT
|
|
|
|
if($task == "dosend")
|
|
{
|
|
|
|
// ENCODE RETURN URL
|
|
|
|
$return_url = urlencode($return_url);
|
|
|
|
|
|
|
|
// GET REPORT REASON AND DETAILS
|
|
|
|
$report_reason = $_POST['report_reason'];
|
|
|
|
$report_details = $_POST['report_details'];
|
|
|
|
|
|
|
|
// ADD TO DATABASE
|
|
|
|
|
|
if($report_reason==1){
|
|
|
|
|
|
|
|
$email="reportspam@bateworld.com";
|
|
$subject="Spam Reported";
|
|
$reports = $database->database_query("SELECT * FROM se_reports WHERE report_url='". $database->database_real_escape_string($return_url)."' AND time>".(time()-(60*5))."");
|
|
|
|
//if(SE_DEBUG){mail("leprakhauns@gmail.com", "eee", $return_url));}
|
|
|
|
if($database->database_num_rows($reports)>=3){
|
|
|
|
$explode=explode("user%3D",$return_url);
|
|
$explode1=explode("%",$explode[1]);
|
|
$report_info["reportusername"]=$explode1[0];
|
|
|
|
$database->database_query("UPDATE se_users SET user_enabled='-1' WHERE user_username='".$database->database_real_escape_string($report_info["reportusername"])."'");
|
|
|
|
$report_array[] = $report_info;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
elseif($report_reason==2){
|
|
$email="reportinappropriate@bateworld.com";
|
|
$subject="Inappropriate Content Reported";
|
|
}
|
|
elseif($report_reason==3){
|
|
$email="reportabuse@bateworld.com";
|
|
$subject="Abuse Reported";
|
|
}
|
|
elseif($report_reason==0){
|
|
$email="reportother@bateworld.com";
|
|
$subject="Other Reported";
|
|
}
|
|
|
|
try{
|
|
|
|
// DECODE SUBJECT AND EMAIL FOR SENDING
|
|
//$subject = htmlspecialchars_decode($subject, ENT_QUOTES);
|
|
//$message = htmlspecialchars_decode($message, ENT_QUOTES);
|
|
|
|
// REPLACE VARIABLES IN SUBJECT AND MESSAGE
|
|
//$subject = str_replace($search, $replace, $subject);
|
|
////$message = str_replace($search, $replace, $message);
|
|
|
|
// ENCODE SUBJECT FOR UTF8
|
|
//$subject="=?UTF-8?B?".base64_encode($subject)."?=";
|
|
|
|
// REPLACE CARRIAGE RETURNS WITH BREAKS
|
|
//$message = str_replace("\n", "<br>", $message);
|
|
|
|
require_once('/home/bateworld/public_html/mailer/class.phpmailer.php');
|
|
|
|
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
|
|
//$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
|
//$mail->IsSMTP(); // telling the class to use SMTP
|
|
$mail = new PHPMailer();
|
|
//$mail->IsSMTP(); // telling the class to use SMTP
|
|
//$mail->Host = "mail.b8world.com"; // SMTP server
|
|
//$mail->SMTPAuth = true; // authentication enabled
|
|
//$mail->SMTPSecure = 'ssl';
|
|
//$mail->Port = 587;
|
|
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
|
|
//$mail->Username = "happybirthday@b8world.com"; // SMTP account username
|
|
//$mail->Password = "y2sWJ*#h8)xG"; // SMTP account password
|
|
//$mail->From = "mailservices@b8world.com";
|
|
$mail->SetFrom($user->user_info["user_email"]);
|
|
//$mail->AddReplyTo($user->user_info["user_email"], 'Bateworld');
|
|
$mail->AddAddress('BateWorld@cayzuemail.com');
|
|
|
|
$mail->Subject = $subject;
|
|
//$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
|
$mail->MsgHTML("User: <a href='https://bateworld.com/bwadmin/admin_viewusers.php?f_user=".$user->user_info["user_username"]."' target='_blank'>".$user->user_info["user_username"]."</a> reported <a href='https://bateworld.com/bwadmin/admin_loginasuser.php?user_id=".$user->user_info["user_id"]."&return_url=".$return_url."' target='_blank'>".urldecode($return_url)."</a> and sent the message:<br>".$report_details."<br><strong>Please do not delete reported content</strong>");
|
|
//$mail->AddAttachment('images/61916url_logo.png'); // attachment
|
|
//$mail->AddAttachment('mailer/images/phpmailer_mini.gif'); // attachment
|
|
if($_FILES["screenshot"]!=""){
|
|
$name_of_uploaded_file =
|
|
basename($_FILES['screenshot']['name']);
|
|
|
|
//get the file extension of the file
|
|
$type_of_uploaded_file =
|
|
substr($name_of_uploaded_file,
|
|
strrpos($name_of_uploaded_file, '.') + 1);
|
|
|
|
$size_of_uploaded_file =
|
|
$_FILES["screenshot"]["size"]/1024;//size in KBs
|
|
|
|
|
|
|
|
$array = explode('.', $name_of_uploaded_file);
|
|
$extension = end($array);
|
|
//Settings
|
|
$max_allowed_file_size = 2000; // size in KB
|
|
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
|
|
|
|
//Validations
|
|
if($size_of_uploaded_file > $max_allowed_file_size )
|
|
{
|
|
$errors .= "\n Size of file should be less than $max_allowed_file_size";
|
|
}
|
|
|
|
//------ Validate the file extension -----
|
|
$allowed_ext = false;
|
|
for($i=0; $i<sizeof($allowed_extensions); $i++)
|
|
{
|
|
if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
|
|
{
|
|
$allowed_ext = true;
|
|
}
|
|
}
|
|
|
|
if(!$allowed_ext)
|
|
{
|
|
$errors .= "\n The uploaded file is not supported file type. ".
|
|
" Only the following file types are supported: ".implode(',',$allowed_extensions);
|
|
}
|
|
$rand=rand(1, 1100000);
|
|
//copy the temp. uploaded file to uploads folder
|
|
$path_of_uploaded_file = "screenshots/" . $rand.".".$extension;
|
|
$tmp_path = $_FILES["screenshot"]["tmp_name"];
|
|
|
|
if(is_uploaded_file($tmp_path))
|
|
{
|
|
if(!copy($tmp_path,$path_of_uploaded_file))
|
|
{
|
|
$errors .= '\n error while copying the uploaded file';
|
|
}
|
|
}
|
|
|
|
$mail->AddAttachment($path_of_uploaded_file);
|
|
|
|
} // attachment
|
|
$mail->Send();
|
|
if($path_of_uploaded_file!=""){
|
|
@unlink($path_of_uploaded_file);
|
|
}
|
|
$mail1 = new PHPMailer();
|
|
//$mail->IsSMTP(); // telling the class to use SMTP
|
|
//$mail->Host = "mail.b8world.com"; // SMTP server
|
|
//$mail->SMTPAuth = true; // authentication enabled
|
|
//$mail->SMTPSecure = 'ssl';
|
|
//$mail->Port = 587;
|
|
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
|
|
//$mail->Username = "happybirthday@b8world.com"; // SMTP account username
|
|
//$mail->Password = "y2sWJ*#h8)xG"; // SMTP account password
|
|
//$mail->From = "mailservices@b8world.com";
|
|
$mail1->SetFrom("support@bateworld.com");
|
|
//$mail->AddReplyTo($user->user_info["user_email"], 'Bateworld');
|
|
$mail1->AddAddress($user->user_info["user_email"]);
|
|
|
|
$mail1->Subject = "We have received your report";
|
|
//$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
|
$mail1->MsgHTML("We have received your report and will review the issue as soon as possible. We may reach out directly if additional information is required. If you need further assistance please check the <a href='https://support.bateworld.com/'>helpdesk FAQ</a> for answers to common questions, or reply to this email to open a new Support Ticket. <br><br>Members like you help keep our community stronger and safer. Thanks for being part of BateWorld. <br><br>The BateWorld Team ");
|
|
//$mail->AddAttachment('images/61916url_logo.png'); // attachment
|
|
//$mail->AddAttachment('mailer/images/phpmailer_mini.gif'); // attachment
|
|
|
|
$mail1->Send();
|
|
|
|
//echo "Message Sent OK<p></p>\n";
|
|
|
|
//echo "Message Sent OK<p></p>\n";
|
|
} catch (phpmailerException $e) {
|
|
//mail("porembaphilip@gmail.com", "MAIL ERROR", $e->errorMessage());
|
|
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage(); //Boring error messages from anything else!
|
|
//mail("porembaphilip@gmail.com", "MAIL ERROR", $e->getMessage());
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// IF DATABASE HAS OVER 5000 REPORTS, CLEAN THEM OUT
|
|
|
|
/* $reports_total = $database->database_num_rows($database->database_query("SELECT report_id FROM se_reports"));
|
|
|
|
if($reports_total > 5000)
|
|
|
|
{
|
|
|
|
$database->database_query("DELETE FROM se_reports WHERE report_id ORDER BY report_id ASC LIMIT 100");
|
|
|
|
}
|
|
*/
|
|
|
|
|
|
$submitted = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ASSIGN SMARTY VARIABLES AND INCLUDE FOOTER
|
|
|
|
$smarty->assign('reportingwhat', $reportingwhat);
|
|
$smarty->assign('return_url', $return_url);
|
|
$smarty->assign('item', $item);
|
|
$smarty->assign('objectid', $objectid);
|
|
$smarty->assign('submitted', $submitted);
|
|
|
|
include "footer.php";
|
|
|
|
?>
|