Torrent type / Тип торрента

Dream

Пользователь
#################################
# Мод: тип торрента
# Автор: mad_boy
# Адаптировал: Dream
# Время установки: ~1 min
#################################

Сделать запрос:

PHP:
ALTER TABLE `bb_bt_torrents` ADD `private` TINYINT( 1 ) NOT NULL DEFAULT '0';

Установка:

Открыть functions_torrent.php и найти:
PHP:
$size = sprintf('%.0f', (float) $totallen);

После добавить:
PHP:
    $private_key = (int) 0;
    if (@$info['private'])
    {
        $private_key = (int) 1;
    }

Найти:
PHP:
    $columns = ' info_hash,      post_id,  poster_id,  topic_id,  forum_id,  attach_id,    size,  reg_time,  tor_status';
    $values = "'$info_hash_sql', $post_id, $poster_id, $topic_id, $forum_id, $attach_id, '$size', $reg_time, $tor_status";

Заменить на:
PHP:
    $columns = ' info_hash,      post_id,  poster_id,  topic_id,  forum_id,  attach_id,    size,  reg_time,  tor_status, private';
    $values = "'$info_hash_sql', $post_id, $poster_id, $topic_id, $forum_id, $attach_id, '$size', $reg_time, $tor_status, $private_key";

Открыть ajax.php и найти:
PHP:
'change_tor_status' => array('user'),

После добавить:
PHP:
'tor_type'            => array('user'),

Перед function view_post () добавить:

PHP:
    function tor_type()
    {
        $attach_id = (int) $this->request['attach_id'];
   
        $row = DB()->fetch_row("SELECT private
            FROM " . BB_BT_TORRENTS . "
            WHERE attach_id = $attach_id
            LIMIT 1");
       
        if($row['private'] == 0) $this->response['html'] = '<span style="color: red;"><b>Публичный (DHT включена)</b></span>';
        elseif($row['private'] == 1) $this->response['html'] = '<span style="color: blue;"><b>Приватный (DHT выколючена)</b></span>';
 
    }

Открыть viewtopic_attach.tpl и найти:

PHP:
<td>{postrow.attach.tor_reged.TORRENT_SIZE}</td>
Заменить на:
PHP:
        <td>{postrow.attach.tor_reged.TORRENT_SIZE}
            <script type="text/javascript">
                ajax.get_tor_type = function(){
                    ajax.exec({
                        action: 'tor_type',
                        attach_id: {postrow.attach.tor_reged.ATTACH_ID}
                    })
                }
                ajax.callback.tor_type = function(data){$('#tor_type').html(data.html);};
            </script>
            &nbsp;&middot;&nbsp;
            <span id="tor_type" class="med"><span class="tor_type" onclick="ajax.get_tor_type();">Тип торрента</span></span>
        </td>
Открыть main.css в конец добавить:

PHP:
.tor_type      { color: #006699 !important; cursor: pointer; }
.tor_type:hover { color: #DD6900 !important; text-decoration: underline !important; }
 
Сверху