mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r408
комментарий к раздаче (часть 2) git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@408 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
e5a9b87e8f
commit
50a630c0c6
7 changed files with 130 additions and 68 deletions
|
@ -73,13 +73,13 @@ class ajax_common
|
||||||
'change_user_opt' => array('admin'),
|
'change_user_opt' => array('admin'),
|
||||||
'manage_user' => array('admin'),
|
'manage_user' => array('admin'),
|
||||||
|
|
||||||
'change_tor_status' => array('mod'),
|
|
||||||
'mod_action' => array('mod'),
|
'mod_action' => array('mod'),
|
||||||
'topic_tpl' => array('mod'),
|
'topic_tpl' => array('mod'),
|
||||||
'group_membership' => array('mod'),
|
'group_membership' => array('mod'),
|
||||||
|
|
||||||
'gen_passkey' => array('user'),
|
'gen_passkey' => array('user'),
|
||||||
'change_torrent' => array('user'),
|
'change_torrent' => array('user'),
|
||||||
|
'change_tor_status' => array('user'),
|
||||||
|
|
||||||
'view_post' => array('guest'),
|
'view_post' => array('guest'),
|
||||||
'view_torrent' => array('guest'),
|
'view_torrent' => array('guest'),
|
||||||
|
|
|
@ -4,26 +4,20 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang;
|
global $userdata, $bb_cfg, $lang;
|
||||||
|
|
||||||
if (!isset($this->request['attach_id']))
|
if (!isset($this->request['attach_id'])) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||||
{
|
|
||||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
|
||||||
}
|
|
||||||
if (!isset($this->request['status']))
|
|
||||||
{
|
|
||||||
$this->ajax_die($lang['TOR_DONT_CHANGE']);
|
|
||||||
}
|
|
||||||
$attach_id = (int) $this->request['attach_id'];
|
|
||||||
$new_status = (int) $this->request['status'];
|
|
||||||
|
|
||||||
// Валидность статуса
|
$attach_id = (int) $this->request['attach_id'];
|
||||||
if (!isset($lang['TOR_STATUS_NAME'][$new_status]))
|
$mode = (string) $this->request['mode'];
|
||||||
|
|
||||||
|
if($bb_cfg['tor_comment'])
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['TOR_STATUS_FAILED']);
|
$comment = (string) $this->request['comment'];
|
||||||
|
$topic_title = $this->request['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tor = DB()->fetch_row("
|
$tor = DB()->fetch_row("
|
||||||
SELECT
|
SELECT
|
||||||
tor.forum_id, tor.topic_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id
|
tor.poster_id, tor.forum_id, tor.topic_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id
|
||||||
FROM ". BB_BT_TORRENTS ." tor
|
FROM ". BB_BT_TORRENTS ." tor
|
||||||
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = tor.forum_id)
|
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = tor.forum_id)
|
||||||
WHERE tor.attach_id = $attach_id
|
WHERE tor.attach_id = $attach_id
|
||||||
|
@ -31,11 +25,22 @@ $tor = DB()->fetch_row("
|
||||||
");
|
");
|
||||||
if (!$tor) $this->ajax_die($lang['TORRENT_FAILED']);
|
if (!$tor) $this->ajax_die($lang['TORRENT_FAILED']);
|
||||||
|
|
||||||
|
switch($mode)
|
||||||
|
{
|
||||||
|
case 'status':
|
||||||
|
$new_status = (int) $this->request['status'];
|
||||||
|
|
||||||
|
// Валидность статуса
|
||||||
|
if (!isset($lang['TOR_STATUS_NAME'][$new_status])) $this->ajax_die($lang['TOR_STATUS_FAILED']);
|
||||||
|
if (!isset($this->request['status'])) $this->ajax_die($lang['TOR_DONT_CHANGE']);
|
||||||
|
if(!IS_AM) $this->ajax_die($lang['NOT_MODERATOR']);
|
||||||
|
|
||||||
// Тот же статус
|
// Тот же статус
|
||||||
if ($tor['tor_status'] == $new_status)
|
if ($tor['tor_status'] == $new_status)
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['TOR_STATUS_DUB']);
|
$this->ajax_die($lang['TOR_STATUS_DUB']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Запрет на изменение/присвоение CH-статуса модератором
|
// Запрет на изменение/присвоение CH-статуса модератором
|
||||||
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
|
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
|
||||||
{
|
{
|
||||||
|
@ -67,5 +72,35 @@ if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userda
|
||||||
|
|
||||||
change_tor_status($attach_id, $new_status);
|
change_tor_status($attach_id, $new_status);
|
||||||
|
|
||||||
$this->response['attach_id'] = $attach_id;
|
|
||||||
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> · '. profile_url($userdata) .' · <i>'. delta_time(TIMENOW) . $lang['BACK']. '</i>';
|
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> · '. profile_url($userdata) .' · <i>'. delta_time(TIMENOW) . $lang['BACK']. '</i>';
|
||||||
|
|
||||||
|
if($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply'])))
|
||||||
|
{
|
||||||
|
if($tor['poster_id'] > 0)
|
||||||
|
{
|
||||||
|
$subject = sprintf($lang['TOR_MOD_TITLE'], $topic_title);
|
||||||
|
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] .' '.$lang['TOR_STATUS_NAME'][$new_status]);
|
||||||
|
if($comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
|
||||||
|
|
||||||
|
send_pm($tor['poster_id'], $subject, $message, $userdata['user_id']);
|
||||||
|
|
||||||
|
cache_rm_user_sessions($tor['poster_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'status_reply':
|
||||||
|
if(!$bb_cfg['tor_comment']) $this->ajax_die($lang['MODULE_OFF']);
|
||||||
|
|
||||||
|
$subject = sprintf($lang['TOR_AUTH_TITLE'], $topic_title);
|
||||||
|
|
||||||
|
$message = sprintf($lang['TOR_AUTH_MSG'], get_username($tor['checked_user_id']), make_url(TOPIC_URL . $tor['topic_id']), $topic_title);
|
||||||
|
if($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
|
||||||
|
|
||||||
|
send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']);
|
||||||
|
|
||||||
|
cache_rm_user_sessions($tor['checked_user_id']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response['attach_id'] = $attach_id;
|
||||||
|
|
|
@ -204,9 +204,6 @@ if ($tor_reged && $tor_info)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//torrent status mod
|
|
||||||
$cuid = $tor_info['checked_user_id'];
|
|
||||||
//end torrent status mod
|
|
||||||
$template->assign_block_vars('postrow.attach.tor_reged', array(
|
$template->assign_block_vars('postrow.attach.tor_reged', array(
|
||||||
'DOWNLOAD_NAME' => $display_name,
|
'DOWNLOAD_NAME' => $display_name,
|
||||||
'TRACKER_LINK' => $tracker_link,
|
'TRACKER_LINK' => $tracker_link,
|
||||||
|
@ -214,12 +211,12 @@ if ($tor_reged && $tor_info)
|
||||||
'TOR_SILVER_GOLD' => $tor_type,
|
'TOR_SILVER_GOLD' => $tor_type,
|
||||||
|
|
||||||
// torrent status mod
|
// torrent status mod
|
||||||
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $poster_id)) ? true : '' : '',
|
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
||||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
||||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
||||||
'TOR_STATUS_BY' => ($cuid && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time'], 'd-M-Y H:i') .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['BACK'] .'</i></span>') : '',
|
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time'], 'd-M-Y H:i') .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['BACK'] .'</i></span>') : '',
|
||||||
'TOR_STATUS_SELECT' => build_select('', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
||||||
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $poster_id,
|
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||||
//end torrent status mod
|
//end torrent status mod
|
||||||
|
|
||||||
'S_UPLOAD_IMAGE' => $upload_image,
|
'S_UPLOAD_IMAGE' => $upload_image,
|
||||||
|
|
|
@ -52,8 +52,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array();
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.5 Beta';
|
$bb_cfg['tp_version'] = '2.5 Beta';
|
||||||
$bb_cfg['tp_release_state'] = 'R407';
|
$bb_cfg['tp_release_state'] = 'R408';
|
||||||
$bb_cfg['tp_release_date'] = '28-04-2012';
|
$bb_cfg['tp_release_date'] = '02-05-2012';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
|
|
@ -1244,8 +1244,15 @@ $lang['DEL_TORRENT'] = 'Are you sure you want to delete the torrent?';
|
||||||
$lang['DEL_MOVE_TORRENT'] = 'Are you sure you want to delete and move the topic?';
|
$lang['DEL_MOVE_TORRENT'] = 'Are you sure you want to delete and move the topic?';
|
||||||
$lang['UNEXECUTED_RELEASE'] = 'Do you have a shapeless release before creating a new fix his unformed!';
|
$lang['UNEXECUTED_RELEASE'] = 'Do you have a shapeless release before creating a new fix his unformed!';
|
||||||
$lang['STATUS_DOES_EXIST'] = 'Such status does not exist: ';
|
$lang['STATUS_DOES_EXIST'] = 'Such status does not exist: ';
|
||||||
$lang['TOR_FIXED'] = 'Fixed';
|
|
||||||
$lang['TOR_SENT_COMMENT'] = 'The information sent to the moderator. Expect.';
|
// tor_comment
|
||||||
|
$lang['TOR_MOD_TITLE'] = 'Changing the status of distribution - %s';
|
||||||
|
$lang['TOR_MOD_MSG'] = "Hello, %s.\n\n Status [url=%s]your[/url] distribution is changed to [b]%s[/b]";
|
||||||
|
|
||||||
|
$lang['TOR_AUTH_TITLE'] = 'Changes in the design - %s';
|
||||||
|
$lang['TOR_AUTH_MSG'] = "Hello, %s.\n\n Making my hand changed - [url=%s]%s[/url]\n\n Please re-check it.";
|
||||||
|
$lang['TOR_AUTH_FIXED'] = 'Fixed';
|
||||||
|
$lang['TOR_AUTH_SENT_COMMENT'] = ' · <span class="seed bold">The information sent to the moderator. Expect.</span>';
|
||||||
//end torrent status mod
|
//end torrent status mod
|
||||||
|
|
||||||
$lang['BT_TOPIC_TITLE'] = 'Topic title';
|
$lang['BT_TOPIC_TITLE'] = 'Topic title';
|
||||||
|
|
|
@ -1251,8 +1251,15 @@ $lang['DEL_TORRENT'] = 'Вы уверены, что хотите удалить
|
||||||
$lang['DEL_MOVE_TORRENT'] = 'Вы уверены, что хотите удалить и перенести топик?';
|
$lang['DEL_MOVE_TORRENT'] = 'Вы уверены, что хотите удалить и перенести топик?';
|
||||||
$lang['UNEXECUTED_RELEASE'] = 'У вас есть неоформленный релиз, прежде чем создавать новый - исправьте свой неоформленный!';
|
$lang['UNEXECUTED_RELEASE'] = 'У вас есть неоформленный релиз, прежде чем создавать новый - исправьте свой неоформленный!';
|
||||||
$lang['STATUS_DOES_EXIST'] = 'Такого статуса не существует: ';
|
$lang['STATUS_DOES_EXIST'] = 'Такого статуса не существует: ';
|
||||||
$lang['TOR_FIXED'] = 'Исправил';
|
|
||||||
$lang['TOR_SENT_COMMENT'] = 'Информация отправлена модератору. Ожидайте.';
|
// tor_comment
|
||||||
|
$lang['TOR_MOD_TITLE'] = 'Изменение статуса раздачи - %s';
|
||||||
|
$lang['TOR_MOD_MSG'] = "Здравствуйте, %s.\n\n Статус [url=%s]Вашей[/url] раздачи изменен на [b]%s[/b]";
|
||||||
|
|
||||||
|
$lang['TOR_AUTH_TITLE'] = 'Изменение в оформлении - %s';
|
||||||
|
$lang['TOR_AUTH_MSG'] = "Здравствуйте, %s.\n\n Оформление моей раздачи изменено - [url=%s]%s[/url]\n\n Просьба повторно её проверить.";
|
||||||
|
$lang['TOR_AUTH_FIXED'] = 'Исправил';
|
||||||
|
$lang['TOR_AUTH_SENT_COMMENT'] = ' · <span class="seed bold">Информация отправлена модератору. Ожидайте.</span>';
|
||||||
//end torrent status mod
|
//end torrent status mod
|
||||||
|
|
||||||
$lang['BT_TOPIC_TITLE'] = 'Название темы';
|
$lang['BT_TOPIC_TITLE'] = 'Название темы';
|
||||||
|
|
|
@ -264,24 +264,40 @@
|
||||||
<span id="tor-{postrow.attach.tor_reged.ATTACH_ID}-status">{postrow.attach.tor_reged.TOR_STATUS_ICON} <b>{postrow.attach.tor_reged.TOR_STATUS_TEXT}</b>
|
<span id="tor-{postrow.attach.tor_reged.ATTACH_ID}-status">{postrow.attach.tor_reged.TOR_STATUS_ICON} <b>{postrow.attach.tor_reged.TOR_STATUS_TEXT}</b>
|
||||||
<!-- IF postrow.attach.tor_reged.TOR_STATUS_BY -->{postrow.attach.tor_reged.TOR_STATUS_BY}<!-- ENDIF -->
|
<!-- IF postrow.attach.tor_reged.TOR_STATUS_BY -->{postrow.attach.tor_reged.TOR_STATUS_BY}<!-- ENDIF -->
|
||||||
</span>
|
</span>
|
||||||
<!-- IF AUTH_MOD -->
|
<!-- IF postrow.attach.tor_reged.TOR_STATUS_REPLY || AUTH_MOD -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
ajax.change_tor_status = function(status) {
|
ajax.change_tor_status = function(mode) {
|
||||||
ajax.exec({
|
ajax.exec({
|
||||||
action : 'change_tor_status',
|
action : 'change_tor_status',
|
||||||
attach_id : {postrow.attach.tor_reged.ATTACH_ID},
|
attach_id : {postrow.attach.tor_reged.ATTACH_ID},
|
||||||
status : status
|
mode : mode,
|
||||||
|
title : '{TOPIC_TITLE}',
|
||||||
|
status : $('#sel_status').val(),
|
||||||
|
comment : $('#comment').val(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
ajax.callback.change_tor_status = function(data) {
|
ajax.callback.change_tor_status = function(data) {
|
||||||
|
<!-- IF AUTH_MOD -->
|
||||||
$('#tor-'+ data.attach_id +'-status').html(data.status);
|
$('#tor-'+ data.attach_id +'-status').html(data.status);
|
||||||
|
<!-- ELSEIF postrow.attach.tor_reged.TOR_STATUS_REPLY -->
|
||||||
|
$('#tor_comment').html('{L_TOR_AUTH_SENT_COMMENT}');
|
||||||
|
<!-- ENDIF -->
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span id="tor-{postrow.attach.tor_reged.ATTACH_ID}">{postrow.attach.tor_reged.TOR_STATUS_SELECT}</span>
|
<span id="tor_comment">
|
||||||
<a href="#" onclick="ajax.change_tor_status($('#tor-{postrow.attach.tor_reged.ATTACH_ID} select').val()); return false;"><input type="submit" value="{L_EDIT}" class="liteoption" /></a>
|
<!-- IF $bb_cfg['tor_comment'] -->
|
||||||
|
<input type="text" id="comment" onfocus="if(this.value=='{L_COMMENT}') this.value='';" onblur="if(this.value=='') this.value='';" value="{L_COMMENT}" class="hint" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF AUTH_MOD -->
|
||||||
|
<span id="tor-{postrow.attach.tor_reged.ATTACH_ID}">{postrow.attach.tor_reged.TOR_STATUS_SELECT}</span>
|
||||||
|
<a href="#" onclick="ajax.change_tor_status('status'); return false;"><input type="submit" value="{L_EDIT}" class="liteoption" /></a>
|
||||||
|
<!-- ELSEIF postrow.attach.tor_reged.TOR_STATUS_REPLY -->
|
||||||
|
<a href="#" onclick="ajax.change_tor_status('status_reply'); return false;"><input type="submit" value="{L_TOR_AUTH_FIXED}" class="liteoption" /></a>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</span>
|
||||||
|
<!-- ENDIF / AUTH_MOD -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row1">
|
<tr class="row1">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue