DC++ magnets + filelist fix

Поиск в DC++ по имени файла и расширению. Исправление ошибки с переполнением int в списке файлов (отрицательные размеры).
This commit is contained in:
Exile 2014-08-19 01:47:48 +04:00
commit 85b7ce7681
7 changed files with 15 additions and 4 deletions

View file

@ -81,8 +81,6 @@ class torrent
function build_filelist_array () function build_filelist_array ()
{ {
global $lang;
$info = $this->tor_decoded['info']; $info = $this->tor_decoded['info'];
if (isset($info['name.utf-8'])) if (isset($info['name.utf-8']))
@ -149,7 +147,7 @@ class torrent
{ {
$this->multiple = false; $this->multiple = false;
$name = isset($info['name']) ? clean_tor_dirname($info['name']) : ''; $name = isset($info['name']) ? clean_tor_dirname($info['name']) : '';
$length = isset($info['length']) ? (int) $info['length'] : 0; $length = isset($info['length']) ? (float) $info['length'] : 0;
$this->files_ary['/'][] = $this->build_file_item($name, $length); $this->files_ary['/'][] = $this->build_file_item($name, $length);
natsort($this->files_ary['/']); natsort($this->files_ary['/']);
@ -158,7 +156,12 @@ class torrent
function build_file_item ($name, $length) function build_file_item ($name, $length)
{ {
return "$name <i>$length</i>"; global $images, $lang;
$magnet_name = '<a title="'.$lang['DC_MAGNET'].'" href="dchub:magnet:?kt='.$name.'&xl='.$length.'"><img src="'. $images['icon_dc_magnet'] .'" width="10" height="10" border="0" /></a>';
$magnet_ext = '<a title="'.$lang['DC_MAGNET_EXT'].'" href="dchub:magnet:?kt=.'.substr(strrchr($name, '.'), 1).'&xl='.$length.'"><img src="'. $images['icon_dc_magnet_ext'] .'" width="10" height="10" border="0" /></a>';
return "$name <i>$length</i> $magnet_name $magnet_ext";
} }
function build_filelist_html () function build_filelist_html ()

BIN
upload/images/dc_magnet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -1114,6 +1114,8 @@ $lang['SEEDING'] = 'Seed';
$lang['LEECHING'] = 'Leech'; $lang['LEECHING'] = 'Leech';
$lang['IS_REGISTERED'] = 'Registered'; $lang['IS_REGISTERED'] = 'Registered';
$lang['MAGNET'] = 'Magnet'; $lang['MAGNET'] = 'Magnet';
$lang['DC_MAGNET'] = 'Search in DC++ by filename';
$lang['DC_MAGNET_EXT'] = 'Search in DC++ by extension';
//torrent status mod //torrent status mod
$lang['TOR_STATUS'] = 'Status'; $lang['TOR_STATUS'] = 'Status';

View file

@ -1114,6 +1114,8 @@ $lang['SEEDING'] = 'Сидер';
$lang['LEECHING'] = 'Личер'; $lang['LEECHING'] = 'Личер';
$lang['IS_REGISTERED'] = 'Зарегистрирован'; $lang['IS_REGISTERED'] = 'Зарегистрирован';
$lang['MAGNET'] = 'Magnet'; $lang['MAGNET'] = 'Magnet';
$lang['DC_MAGNET'] = 'Поиск в DC++ по имени файла';
$lang['DC_MAGNET_EXT'] = 'Поиск в DC++ по расширению';
//torrent status mod //torrent status mod
$lang['TOR_STATUS'] = 'Статус'; $lang['TOR_STATUS'] = 'Статус';

View file

@ -1114,6 +1114,8 @@ $lang['SEEDING'] = 'Сідер';
$lang['LEECHING'] = 'Лічер'; $lang['LEECHING'] = 'Лічер';
$lang['IS_REGISTERED'] = 'Зареєстрований'; $lang['IS_REGISTERED'] = 'Зареєстрований';
$lang['MAGNET'] = 'Magnet'; $lang['MAGNET'] = 'Magnet';
$lang['DC_MAGNET'] = 'Пошук в DC++ по імені файлу';
$lang['DC_MAGNET_EXT'] = 'Пошук в DC++ по розширенню';
//torrent status mod //torrent status mod
$lang['TOR_STATUS'] = 'Статус'; $lang['TOR_STATUS'] = 'Статус';

View file

@ -62,6 +62,8 @@ $images['folder_dl_hot_new'] = $_main .'folder_dl_hot_new.gif';
$images['icon_clip'] = $_img .'icon_clip.gif'; $images['icon_clip'] = $_img .'icon_clip.gif';
$images['icon_dn'] = $_img .'icon_dn.gif'; $images['icon_dn'] = $_img .'icon_dn.gif';
$images['icon_magnet'] = $_img .'magnet.png'; $images['icon_magnet'] = $_img .'magnet.png';
$images['icon_dc_magnet'] = $_img .'dc_magnet.png';
$images['icon_dc_magnet_ext'] = $_img .'dc_magnet_ext.png';
// posting_icons // posting_icons
$images['post_new'] = $_lang .'post.gif'; $images['post_new'] = $_lang .'post.gif';