107 lines
3.1 KiB
PHP
107 lines
3.1 KiB
PHP
<?php
|
|
/* $Id: user_messages_new.php 42 2009-01-29 04:55:14Z john $ */
|
|
if($_SERVER["REMOTE_ADDR"]=="76.111.155.21"){$page = "user_messages_new";}else{
|
|
$page = "user_messages_new";}
|
|
include "header.php";
|
|
|
|
|
|
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
|
|
if(isset($_POST['to_user'])) { $to_user = $_POST['to_user']; } elseif(isset($_GET['to_user'])) { $to_user = $_GET['to_user']; } else { $to_user = ""; }
|
|
if(isset($_POST['to_id'])) { $to_id = $_POST['to_id']; } elseif(isset($_GET['to_id'])) { $to_id = $_GET['to_id']; } else { $to_id = ""; }
|
|
// CHECK FOR ADMIN ALLOWANCE OF MESSAGES
|
|
if( !$user->level_info['level_message_allow'] )
|
|
{
|
|
header("Location: home.php");
|
|
exit();
|
|
}
|
|
// SET ERROR VARIABLES AND EMPTY VARS
|
|
$is_error = 0;
|
|
$submitted = 0;
|
|
// TRY TO SEND MESSAGE
|
|
if($task == "send")
|
|
{
|
|
$numclicks=0;
|
|
|
|
if($user->usersetting_info["ignorespam"]==0){
|
|
|
|
|
|
|
|
if($numclicks==0&&(time()-$user->user_info["user_signupdate"])<60*60*24*3)
|
|
{
|
|
|
|
$message1="";
|
|
$message2="";
|
|
$message3="";
|
|
$message4="";
|
|
|
|
$query=$database->database_query("SELECT * FROM se_pms WHERE `pm_authoruser_id`='".$user->user_info["user_id"]."' ORDER BY pm_id DESC LIMIT 4");
|
|
while($row=$database->database_fetch_array($query)){
|
|
|
|
if(strlen($row["pm_body"])>10)
|
|
{
|
|
|
|
if($message1==""){
|
|
$message1=$row["pm_body"];
|
|
}
|
|
|
|
elseif($message2==""){
|
|
$message2=$row["pm_body"];
|
|
}
|
|
elseif($message3==""){
|
|
$message3=$row["pm_body"];
|
|
}
|
|
else
|
|
{
|
|
$message4=$row["pm_body"];
|
|
similar_text($message1, $message2,$percent1);
|
|
similar_text($message2, $message3,$percent2);
|
|
similar_text($message3, $message4,$percent3);
|
|
//similar_text($message4, $message5,$percent4);
|
|
|
|
$percentage=($percent1+$percent2+$percent3)/3;
|
|
if($percentage>=95){$numclicks=5;}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if($numclicks==0){
|
|
$to = $_POST['to'];
|
|
$subject = $_POST['subject'];
|
|
$message = $_POST['message'];
|
|
$user->user_message_send($to, $subject, $message);
|
|
$is_error = $user->is_error;
|
|
if($is_error != 0) { SE_Language::_preload($is_error); SE_Language::load(); $error_message = SE_Language::_get($is_error); }
|
|
// SEND AJAX CONFIRMATION
|
|
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
|
|
echo "window.parent.messageSent('$is_error', '".str_replace("'", "\'", $error_message)."');";
|
|
echo "</script></head><body></body></html>";
|
|
exit();
|
|
}
|
|
}
|
|
if($user->user_info["user_signupdate"]>(time()-(60*60*24*3))){
|
|
$pasteblock="document.addEventListener('DOMContentLoaded', function() {
|
|
jQuery('textarea').bind('copy paste', function (e) {
|
|
|
|
e.preventDefault();
|
|
});
|
|
});";
|
|
}
|
|
$smarty->assign('pasteblock', $pasteblock);
|
|
// GET LIST OF FRIENDS FOR SUGGEST BOX
|
|
$total_friends = $user->user_friend_total(0);
|
|
$friends = $user->user_friend_list(0, $total_friends, 0);
|
|
// ASSIGN SMARTY VARS AND INCLUDE FOOTER
|
|
$smarty->assign('is_error', $is_error);
|
|
$smarty->assign('submitted', $submitted);
|
|
$smarty->assign_by_ref('friends', $friends);
|
|
$smarty->assign('to_user', $to_user);
|
|
$smarty->assign('to_id', $to_id);
|
|
$smarty->assign('subject', $subject);
|
|
$smarty->assign('message', $message);
|
|
include "footer.php";
|
|
?>
|