L
logon
Гость
Вот выкладываю можно так сказать мод комментарий к статусу раздачи.
tpl
torstasus.php заменить на все что после require(INC_DIR .'functions_torrent.php');
tpl
Код:
<lebel><input name="notes" type="text" id="notes" size="19" value="Заметки..." class="hint" maxlength="255" /></label>
Код:
function make_bbcode_uid ()
{
// Unique ID for this message..
return make_rand_str(BBCODE_UID_LEN);
}
function pm_by_id($userid,$subject="!",$post = "!")
{
global $db;
define('BBCODE_UID_LEN', 10);
$type = 1;
$date = time();
$ip = $_SERVER['REMOTE_ADDR'];
$d_ip = encode_ip($ip);
$userfrom = -746;
$enable_bb = 1;
$enable_sm = 1;
$userto = $userid;
$sql1 = "INSERT INTO bb_privmsgs (privmsgs_date,privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_from_userid, privmsgs_ip, privmsgs_subject, privmsgs_to_userid, privmsgs_type)
VALUES ($date, $enable_bb, $enable_sm, $userfrom, '$d_ip', '$subject', $userto, $type)";
$db->sql_query($sql1);
$last_id = $db->sql_nextid();;
$sql2 = "INSERT INTO bb_privmsgs_text (privmsgs_text_id, privmsgs_text)
VALUES ($last_id, '" . str_replace("\'", "''", addslashes($post)) . "')";
$db->sql_query($sql2);
$sql3 = "UPDATE bb_users
SET user_new_privmsg = user_new_privmsg+1, user_newest_pm_id = $last_id, user_last_privmsg = $date
WHERE user_id = $userto";
$db->sql_query($sql3);
}
// Start session management
$user->session_start();
// Check if user logged in
if (!$userdata['session_logged_in'])
{
redirect(append_sid("login.php?redirect=index.php", true));
}
$sid = (@$_REQUEST['sid']) ? $_REQUEST['sid'] : '';
$confirm = isset($_POST['status_confirm']);
// Set received variables
// Strings
$input_vars_str = array(
'mode' => 'mode'
);
// Numeric
$input_vars_num = array(
'attach_id' => 'id',
'req_uid' => 'u'
);
// Strings
foreach ($input_vars_str as $var => $param)
{
$$var = (isset($_REQUEST[$param])) ? $_REQUEST[$param] : '';
}
// Numeric
foreach ($input_vars_num as $var => $param)
{
$$var = (isset($_REQUEST[$param])) ? intval($_REQUEST[$param]) : '';
}
if (($mode == 'reg' || $mode == 'unreg' || !empty($_POST['tor_action'])) && !$attach_id)
{
message_die(GENERAL_ERROR, 'Invalid attach_id');
}
// Show users torrent-profile
if ($mode == 'userprofile')
{
redirect(append_sid("profile.php?mode=viewprofile&u=$req_uid"), true);
}
// check SID
if ($sid == '' || $sid !== $userdata['session_id'])
{
//message_die(GENERAL_ERROR, 'Invalid_session');
}
if (!empty($_POST['tor_status']) && $confirm)
{
$new_tor_status = $_POST['tor_status'];
change_tor_status($attach_id, $new_tor_status);
$sql = "update ". BT_TORRENTS_TABLE ." set checked_user_id=". $userdata['user_id'] .", checked_time=". time() ." WHERE attach_id=". $attach_id;
$db->sql_query($sql);
if (!empty($_POST['notes']) && $confirm)
{
$notes = trim(substr($_POST['notes'],0,254));
} else { $notes = ' Специальных замечаний нет'; }
// pm
if ($new_tor_status ==1) { $status = "Закрыто"; }
if ($new_tor_status ==2) { $status = "Проверено"; }
if ($new_tor_status ==3) { $status = "Повтор"; }
if ($new_tor_status ==4) { $status = "Неоформлено"; }
if ($new_tor_status ==5) { $status = "Недооформлено"; }
if ($new_tor_status ==6) { $status = "Сомнительно"; }
if ($new_tor_status ==7) { $status = "Закрыто правообладателем"; }
if ($new_tor_status ==8) { $status = "Временная раздача"; }
if ($new_tor_status ==0) { $status = "Не проверено"; }
$row_topic = $db->fetch_row("SELECT topic_id,poster_id FROM bb_bt_torrents WHERE attach_id = $attach_id");
$topic = $row_topic['topic_id'];
$poster_id = $row_topic['poster_id'];
$row_moder = $db->fetch_row("SELECT username FROM bb_users WHERE user_id = ". $userdata['user_id']);
$moder = $row_moder['username'];
$row_top_name = $db->fetch_row("SELECT topic_title FROM bb_topics WHERE topic_id = ". $topic);
$topic_name = $row_top_name['topic_title'];
$subject = "Статус вашего релиза изменён: <$status>. Модератор: $moder";
$post = "<b>Изменения произведены модератором: </b> <strong><em>$moder</em></strong>.
По всем вопросам обращайтесь к модератору <strong><em>$moder</em></strong>, а не к <strong>Bot</strong>. <hr>
$topic_name
Статус вашего релиза был <b>изменен</b> на: <b><$status></b><hr>
http://Site/viewtopic.php?t=$topic<hr>
<b>Замечания:</b> $notes";
pm_by_id($poster_id, $subject, $post);
redirect("viewtopic.php?t=$topic_id");
//end torrent status mod
}
?>