mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
r221
git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@221 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
fbc90da355
commit
b224e95c84
2 changed files with 22 additions and 6 deletions
|
@ -2770,22 +2770,38 @@ function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div)
|
|||
return ($base_path ? "$base_path/" : '') . ($id % $sec_div) .'/'. $id . ($ext ? ".$ext" : '');
|
||||
}
|
||||
|
||||
function send_pm($user_id, $subject, $message)
|
||||
{
global $userdata;
|
||||
function send_pm($user_id, $subject, $message, $poster_id = false)
|
||||
{
|
||||
global $userdata;
|
||||
|
||||
$subject = DB()->escape($subject);
|
||||
$message = DB()->escape($message);
|
||||
|
||||
if($poster_id == BOT_UID)
|
||||
{
|
||||
$poster_ip = '7f000001';
|
||||
}
|
||||
else if($row = DB()->fetch_row("SELECT user_reg_ip ". BB_USERS ." WHERE user_id = $poster_id"))
|
||||
{
|
||||
$poster_ip = $row['user_reg_ip'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$poster_id = $userdata['user_id'];
|
||||
$poster_ip = USER_IP;
|
||||
}
|
||||
|
||||
DB()->sql_query("INSERT INTO ". BB_PRIVMSGS ." (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip)
|
||||
VALUES (". PRIVMSGS_NEW_MAIL .", '$subject', {$userdata['user_id']}, $user_id, ". TIMENOW .", '". USER_IP ."')");
|
||||
VALUES (". PRIVMSGS_NEW_MAIL .", '$subject', {$poster_id}, $user_id, ". TIMENOW .", '$poster_ip')");
|
||||
$pm_id = DB()->sql_nextid();
|
||||
|
||||
DB()->sql_query("INSERT INTO " . BB_PRIVMSGS_TEXT . " (privmsgs_text_id, privmsgs_text)
|
||||
VALUES ($privmsg_sent_id, '$message')");
|
||||
VALUES ($pm_id, '$message')");
|
||||
|
||||
DB()->sql_query("UPDATE ". BB_USERS ." SET
|
||||
user_new_privmsg = user_new_privmsg + 1,
|
||||
user_last_privmsg = ". TIMENOW .",
|
||||
user_newest_pm_id = $pm_id
|
||||
WHERE user_id = $user_id");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|||
// !!! $username должен быть предварительно обработан clean_username() !!!
|
||||
function validate_username ($username, $check_ban_and_taken = true)
|
||||
{
|
||||
global $userdata;
|
||||
global $userdata, $lang;
|
||||
|
||||
static $name_chars = 'a-z0-9а-яё_@$%^&;(){}\#\-\'.:+ ';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue