Поиск по info_hash

Wertos

Заблокирован
#1
functions.php в конец файла
PHP:
/**
*
*  Search info_hash, added by Wertos, 13.11.2013
*
**/
function getSearchHash($hash = '')
{
  global $lang;
  $hash = htmlCHR(trim($hash));
  if(($hash == '') || (mb_strlen($hash, 'UTF-8') != 40))
  {
    bb_die($lang['INVALID_HASH']);
  }
  $info_hash = DB()->escape(pack("H*", $hash));
  if($row = DB()->fetch_row("SELECT topic_id FROM ".BB_BT_TORRENTS." WHERE info_hash = '$info_hash'"))
  {
    redirect(TOPIC_URL.$row['topic_id']);
  }
  else
  {
    bb_die($lang['HASH_NOT_FOUND']);
  }
  bb_die($lang['HASH_NOT_FOUND']);
}
В lang_main.php
PHP:
$lang['INVALID_HASH'] = 'Хеш, который вы ввели не корректен !';
$lang['HASH_NOT_FOUND'] = 'Ничего не найдено. Воспользуйтесь расширенной формой поиска по торрентам';
$lang['INFO_HASH_S'] = 'по info_hash';
tracker.php
найти
PHP:
  'tor_type'      => array('tor_type', 0,        CHBOX),
ниже
PHP:
  'hash'          => array('info_hash', null,  REQUEST),
найти
PHP:
  if ($tm =& $_REQUEST[$title_match_key] AND is_string($tm))
  {
выше
PHP:
  if (isset($_REQUEST[$hash_key]))
  {
    getSearchHash($_REQUEST[$hash_key]);
  }
page_header.tpl
найти
HTML:
<option value="tracker.php#results" selected="selected"> {L_TRACKER_S} </option>
ниже
HTML:
<option class="info_hash" value="tracker.php">  {L_INFO_HASH_S} </option>
найти
HTML:
<form id="quick-search" action="" method="post" onsubmit="$(this).attr('action', $('#search-action').val());">
заменить на
HTML:
      <form id="quick-search" action="" method="post" onsubmit="
        $(this).attr('action', $('#search-action').val());
        if($('#search-action option:selected').attr('class') == 'info_hash') $('#search-text').attr('name', 'info_hash');
      " />
tracker.tpl
найти
HTML:
<legend>{L_TITLE_MATCH}</legend>
заменить на
HTML:
<legend><span class="a-like med bold" onclick="$(this).addClass('bold').next().removeClass('bold'); $('#title_search').attr('name','{TITLE_MATCH_NAME}');">{L_TITLE_MATCH}</span>&nbsp;&middot;&nbsp;<span class="a-like med" onclick="$(this).addClass('bold').prev().removeClass('bold'); $('#title_search').attr('name','info_hash');">{L_INFO_HASH_S}</span></legend>
найти
HTML:
<input style="width: 95%;" class="post" type="text" size="50" maxlength="{TITLE_MATCH_MAX}" name="{TITLE_MATCH_NAME}" value="{TITLE_MATCH_VAL}" />
заменить на
HTML:
<input id="title_search" style="width: 95%;" class="post" type="text" size="50" maxlength="{TITLE_MATCH_MAX}" name="{TITLE_MATCH_NAME}" value="{TITLE_MATCH_VAL}" />
main.css
HTML:
.a-like {
  color: #006699 !important;
  cursor: pointer;
}
.a-like:hover {
  color: #DD6900 !important;
  text-decoration: underline !important;
}
.a-like:active, .a-like:focus {
  color: #DD6900 !important;
  text-decoration: underline !important;
}
 
Сверху