90 lines
3.8 KiB
PHP
90 lines
3.8 KiB
PHP
<?php
|
||
|
||
if(!defined('DATALIFEENGINE'))
|
||
{
|
||
die("Hacking attempt!");
|
||
}
|
||
|
||
$id = intval($_REQUEST['id']);
|
||
|
||
$result = $db->super_query("SELECT `how`, `komu`, `author`, `text` FROM `" . USERPREFIX . "_reputation` WHERE `id`='$id'" );
|
||
$author_log = $db->super_query("SELECT `user_id`, `name`, `repa`, `repa_mod` FROM `" . USERPREFIX . "_users` WHERE `name`='$result[author]'" );
|
||
$to_log = $db->super_query("SELECT `user_id`, `name`, `repa`, `repa_mod` FROM `" . USERPREFIX . "_users` WHERE `name`='$result[komu]'" );
|
||
|
||
$target = $db->safesql( $result['komu'] );
|
||
$how_text = $db->safesql( $result['text'] );
|
||
|
||
$repa_mod_mas = explode ("|", $to_log['repa_mod']);
|
||
$user_repa = $to_log['repa'];
|
||
$repa_delete = false;
|
||
|
||
if ($author_log['name'] == "")
|
||
$author_log['name'] = $repa_cf['robot'];
|
||
|
||
if ($result['how'] < 0)
|
||
{
|
||
$user_repa = $user_repa + 1;
|
||
$repa_mod_mas[1] = $repa_mod_mas[1] - 1;
|
||
$user_repa_mod = $repa_mod_mas[0]."|".$repa_mod_mas[1];
|
||
$db->query("UPDATE " . USERPREFIX . "_users SET repa = '$user_repa', repa_mod = '$user_repa_mod' WHERE name = '{$target}'");
|
||
|
||
$db->query("DELETE FROM `".USERPREFIX."_reputation` WHERE `id`='$id' LIMIT 1");
|
||
|
||
$repa_delete = true;
|
||
}
|
||
elseif ($result['how'] > 0)
|
||
{
|
||
$user_repa = $user_repa - 1;
|
||
$repa_mod_mas[0] = $repa_mod_mas[0] - 1;
|
||
$user_repa_mod = $repa_mod_mas[0]."|".$repa_mod_mas[1];
|
||
$db->query("UPDATE " . USERPREFIX . "_users SET repa = '$user_repa', repa_mod = '$user_repa_mod' WHERE name = '{$target}'");
|
||
|
||
$db->query("DELETE FROM `".USERPREFIX."_reputation` WHERE `id`='$id' LIMIT 1");
|
||
|
||
$repa_delete = true;
|
||
}
|
||
elseif ($result['how'] == 'totalminus')
|
||
{
|
||
$user_repa = $user_repa - $vminus_autor;
|
||
$repa_mod_mas[1] = $repa_mod_mas[1] - $vminus_autor;
|
||
$user_repa_mod = $repa_mod_mas[0]."|".$repa_mod_mas[1];
|
||
$db->query("UPDATE `".USERPREFIX."_users` SET `repa`='$user_repa', `repa_mod`='$user_repa_mod' WHERE `name`='$target'");
|
||
|
||
$db->query("DELETE FROM `".USERPREFIX."_reputation` WHERE `id`='$id' LIMIT 1");
|
||
|
||
$repa_delete = true;
|
||
}
|
||
elseif ($result['how'] == 'totalplus')
|
||
{
|
||
$user_repa = $user_repa - $repa_cf['adm_plus'];
|
||
$repa_mod_mas[0] = $repa_mod_mas[0] - $vplus_autor;
|
||
$user_repa_mod = $repa_mod_mas[0]."|".$repa_mod_mas[1];
|
||
$db->query("UPDATE `".USERPREFIX."_users` SET `repa`='$user_repa', `repa_mod`='$user_repa_mod' WHERE `name`='$target'");
|
||
|
||
$db->query("DELETE FROM `".USERPREFIX."_reputation` WHERE `id`='$id' LIMIT 1");
|
||
|
||
$repa_delete = true;
|
||
}
|
||
else
|
||
msg("info", $langms['sea_info'], "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<br><br><input type='button' value=\" {$lang_repa['repa_go_back']} \" class='bbcodes' onclick=\"window.location='$PHP_SELF?mod=repa&action=control'\">", "");
|
||
|
||
if ($repa_cf['msgs_del_status'] == "yes" AND $repa_delete)
|
||
{
|
||
if($config['allow_alt_url'] == "yes")
|
||
$whois = "<a href=\"".$config['http_home_url']."user/$member_id[name]\">$member_id[name]</a>";
|
||
else
|
||
$whois = "<a href=\"$PHP_SELF?subaction=userinfo&user=".urlencode($member_id[name])."\">$member_id[name]</a>";
|
||
$izvestie = $repa_cf['msgs_del_template'];
|
||
$izvestie = str_replace('{%kto%}', $whois, $izvestie);
|
||
$izvestie = str_replace('{%ot_kogo%}', $author_log[name], $izvestie);
|
||
$izvestie = str_replace('{%text%}', $how_text, $izvestie);
|
||
$time = time()+($config['date_adjust']*60);
|
||
$db->query("INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder) values ('$lang_repa[repa_msg_changed]', '$izvestie', '$to_log[user_id]', '$member_id[name]', '$time', 'no', 'inbox')");
|
||
$db->query("UPDATE " . USERPREFIX . "_users set pm_all=pm_all+1, pm_unread=pm_unread+1 where user_id='$to_log[user_id]'");
|
||
}
|
||
if ($repa_delete)
|
||
{
|
||
msg("info", $langms['sea_info'], "{$lang_repa['repa_done_minus_1']} {$to_log[name]} {$lang_repa['repa_done_minus_2']}<br><br><input type='button' value=\" {$lang_repa['repa_go_back']} \" class='bbcodes' onclick=\"window.location='$PHP_SELF?mod=repa&action=control'\">", "");
|
||
}
|
||
|
||
?>
|