Пустые строки, фикс получения аттачей (не торрентов)

This commit is contained in:
Exile 2015-05-13 09:49:31 +03:00
commit d341d49eb7
12 changed files with 11 additions and 39 deletions

3
.gitignore vendored
View file

@ -32,5 +32,4 @@ $RECYCLE.BIN/
.Spotlight-V100 .Spotlight-V100
.Trashes .Trashes
*.orig *.orig
*.rej *.rej

3
dl.php
View file

@ -39,7 +39,6 @@ if (IS_GUEST && $bb_cfg['guest_tracker']) $guest_allow = true;
if ($t_data['attach_ext_id'] != 8 && !$is_auth['auth_download']) login_redirect($bb_cfg['dl_url'] . $topic_id); if ($t_data['attach_ext_id'] != 8 && !$is_auth['auth_download']) login_redirect($bb_cfg['dl_url'] . $topic_id);
if ($t_data['attach_ext_id'] == 8 && (!$is_auth['auth_download'] || !$guest_allow)) login_redirect($bb_cfg['dl_url'] . $topic_id); if ($t_data['attach_ext_id'] == 8 && (!$is_auth['auth_download'] || !$guest_allow)) login_redirect($bb_cfg['dl_url'] . $topic_id);
// Проверка рефёрера (не качать с других сайтов) // Проверка рефёрера (не качать с других сайтов)
$referer = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ''; $referer = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
if (!preg_match("/". $bb_cfg['server_name']."/", $referer)) exit; if (!preg_match("/". $bb_cfg['server_name']."/", $referer)) exit;
@ -84,7 +83,7 @@ if ($t_data['attach_ext_id'] == 8)
} }
// All other // All other
$file_path = get_attach_path($topic_id); $file_path = get_attach_path($topic_id, $t_data['attach_ext_id']);
if (($file_contents = @file_get_contents($file_path)) === false) if (($file_contents = @file_get_contents($file_path)) === false)
{ {

View file

@ -9,18 +9,22 @@ class Html_Common
* @type string * @type string
*/ */
var $options = ''; var $options = '';
/** /**
* @type array * @type array
*/ */
var $attr = []; var $attr = [];
/** /**
* @type null * @type null
*/ */
var $cur_attr = null; var $cur_attr = null;
/** /**
* @type int * @type int
*/ */
var $max_length = HTML_SELECT_MAX_LENGTH; var $max_length = HTML_SELECT_MAX_LENGTH;
/** /**
* @type array * @type array
*/ */
@ -153,8 +157,7 @@ class Html_Common
* *
* @return string * @return string
*/ */
public function build_checkbox ($name, $title, $checked = false, $disabled = false, $class = null, $id = null, public function build_checkbox ($name, $title, $checked = false, $disabled = false, $class = null, $id = null, $value = 1)
$value = 1)
{ {
$name = ' name="' . $name . '" '; $name = ' name="' . $name . '" ';
$value = ' value="' . $value . '" '; $value = ' value="' . $value . '" ';

View file

@ -19,10 +19,12 @@ class Log_Action
'adm_user_ban' => 8, 'adm_user_ban' => 8,
'adm_user_unban' => 9, 'adm_user_unban' => 9,
]; ];
/** /**
* @type array * @type array
*/ */
public $log_type_select = []; public $log_type_select = [];
/** /**
* @type bool * @type bool
*/ */

View file

@ -76,7 +76,6 @@ class Sessions
public $level; public $level;
public $opt; public $opt;
function __construct () function __construct ()
{ {
$this->get_sessiondata(); $this->get_sessiondata();
@ -568,7 +567,6 @@ class Sessions
return $autologin_id; return $autologin_id;
} }
public function set_shortcuts () public function set_shortcuts ()
{ {
$this->id =& $this->data['user_id']; $this->id =& $this->data['user_id'];
@ -582,7 +580,6 @@ class Sessions
$this->ip = CLIENT_IP; $this->ip = CLIENT_IP;
} }
public function init_userprefs () public function init_userprefs ()
{ {
global $bb_cfg, $theme, $lang; global $bb_cfg, $theme, $lang;

View file

@ -359,7 +359,6 @@ function sphUnpackI64 ( $v )
return $neg . $h . $l; return $neg . $h . $l;
} }
function sphFixUint ( $value ) function sphFixUint ( $value )
{ {
if ( PHP_INT_SIZE>=8 ) if ( PHP_INT_SIZE>=8 )
@ -375,7 +374,6 @@ function sphFixUint ( $value )
} }
} }
/// sphinx searchd client class /// sphinx searchd client class
class SphinxClient extends cache_common class SphinxClient extends cache_common
{ {
@ -522,7 +520,6 @@ class SphinxClient extends cache_common
$this->_timeout = $timeout; $this->_timeout = $timeout;
} }
function _Send ( $handle, $data, $length ) function _Send ( $handle, $data, $length )
{ {
if ( feof($handle) || fwrite ( $handle, $data, $length ) !== $length ) if ( feof($handle) || fwrite ( $handle, $data, $length ) !== $length )
@ -1406,7 +1403,6 @@ class SphinxClient extends cache_common
return $res; return $res;
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// keyword generation // keyword generation
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -241,9 +241,7 @@ function auth ($type, $forum_id, $ug_data, $f_access = [], $group_perm = UG_PERM
$auth = $auth_fields = $u_access = []; $auth = $auth_fields = $u_access = [];
$add_auth_type_desc = ($forum_id != AUTH_LIST_ALL); $add_auth_type_desc = ($forum_id != AUTH_LIST_ALL);
//
// Get $auth_fields // Get $auth_fields
//
if ($type == AUTH_ALL) if ($type == AUTH_ALL)
{ {
$auth_fields = array_keys($bf['forum_perm']); $auth_fields = array_keys($bf['forum_perm']);
@ -258,9 +256,7 @@ function auth ($type, $forum_id, $ug_data, $f_access = [], $group_perm = UG_PERM
trigger_error(__FUNCTION__ .'(): empty $auth_fields', E_USER_ERROR); trigger_error(__FUNCTION__ .'(): empty $auth_fields', E_USER_ERROR);
} }
//
// Get $f_access // Get $f_access
//
// If f_access has been passed, or auth is needed to return an array of forums // If f_access has been passed, or auth is needed to return an array of forums
// then we need to pull the auth information on the given forum (or all forums) // then we need to pull the auth information on the given forum (or all forums)
if (empty($f_access)) if (empty($f_access))
@ -291,9 +287,7 @@ function auth ($type, $forum_id, $ug_data, $f_access = [], $group_perm = UG_PERM
trigger_error(__FUNCTION__ .'(): empty $f_access', E_USER_ERROR); trigger_error(__FUNCTION__ .'(): empty $f_access', E_USER_ERROR);
} }
//
// Get user or group permissions // Get user or group permissions
//
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND aa.forum_id = ". (int) $forum_id : ''; $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND aa.forum_id = ". (int) $forum_id : '';
// GROUP mode // GROUP mode
@ -449,8 +443,6 @@ function get_select ($select, $selected = null, $return_as = 'html', $first_opt
return ($return_as == 'html') ? build_select($select_name, $select_ary, $selected) : $select_ary; return ($return_as == 'html') ? build_select($select_name, $select_ary, $selected) : $select_ary;
} }
function build_select ($name, $params, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '') function build_select ($name, $params, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '')
{ {
global $html; global $html;
@ -1223,7 +1215,6 @@ function setup_style ()
return $theme; return $theme;
} }
function bb_date ($gmepoch, $format = false, $friendly_date = true) function bb_date ($gmepoch, $format = false, $friendly_date = true)
{ {
global $bb_cfg, $lang, $userdata; global $bb_cfg, $lang, $userdata;
@ -1320,9 +1311,7 @@ function generate_pagination ($base_url, $num_items, $per_page, $start_item, $ad
if ($on_page > 1 && $on_page < $total_pages) if ($on_page > 1 && $on_page < $total_pages)
{ {
$page_string .= ( $on_page > ($begin_end + $from_middle + 1) ) ? ' ... ' : ', '; $page_string .= ( $on_page > ($begin_end + $from_middle + 1) ) ? ' ... ' : ', ';
$init_page_min = ( $on_page > ($begin_end + $from_middle) ) ? $on_page : ($begin_end + $from_middle + 1); $init_page_min = ( $on_page > ($begin_end + $from_middle) ) ? $on_page : ($begin_end + $from_middle + 1);
$init_page_max = ( $on_page < $total_pages - ($begin_end + $from_middle) ) ? $on_page : $total_pages - ($begin_end + $from_middle); $init_page_max = ( $on_page < $total_pages - ($begin_end + $from_middle) ) ? $on_page : $total_pages - ($begin_end + $from_middle);
for ($i = $init_page_min - $from_middle; $i < $init_page_max + ($from_middle + 1); $i++) for ($i = $init_page_min - $from_middle; $i < $init_page_max + ($from_middle + 1); $i++)
@ -1372,7 +1361,6 @@ function generate_pagination ($base_url, $num_items, $per_page, $start_item, $ad
{ {
$page_string .= '&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ( $on_page * $per_page ) . '">' . $lang['NEXT_PAGE'] . '</a>'; $page_string .= '&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ( $on_page * $per_page ) . '">' . $lang['NEXT_PAGE'] . '</a>';
} }
} }
$pagination = ($page_string) ? '<a class="menu-root" href="#pg-jump">'. $lang['GOTO_PAGE'] .'</a> :&nbsp;&nbsp;'. $page_string : ''; $pagination = ($page_string) ? '<a class="menu-root" href="#pg-jump">'. $lang['GOTO_PAGE'] .'</a> :&nbsp;&nbsp;'. $page_string : '';
@ -1388,7 +1376,6 @@ function generate_pagination ($base_url, $num_items, $per_page, $start_item, $ad
return $pagination; return $pagination;
} }
function obtain_word_list (&$orig_word, &$replacement_word) function obtain_word_list (&$orig_word, &$replacement_word)
{ {
global $bb_cfg; global $bb_cfg;
@ -1537,7 +1524,6 @@ function redirect ($url)
exit; exit;
} }
function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $list = 'sort') function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $list = 'sort')
{ {
global $lang; global $lang;
@ -1554,7 +1540,6 @@ function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $li
$list_name = 'forum_display_' . $list; $list_name = 'forum_display_' . $list;
$listrow = $$list_name; $listrow = $$list_name;
$res = ''; $res = '';
if ( $selected_row > count($listrow['lang_key']) ) if ( $selected_row > count($listrow['lang_key']) )
{ {
@ -1574,6 +1559,7 @@ function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $li
{ {
$res = $listrow['fields'][$selected_row]; $res = $listrow['fields'][$selected_row];
} }
return $res; return $res;
} }
@ -1583,7 +1569,6 @@ function clear_dl_list ($topics_csv)
DB()->query("DELETE FROM ". BB_BT_DLSTATUS_SNAP ." WHERE topic_id IN($topics_csv)"); DB()->query("DELETE FROM ". BB_BT_DLSTATUS_SNAP ." WHERE topic_id IN($topics_csv)");
} }
function get_id_csv ($ids) function get_id_csv ($ids)
{ {
$ids = array_values((array) $ids); $ids = array_values((array) $ids);
@ -1591,7 +1576,6 @@ function get_id_csv ($ids)
return (string) join(',', $ids); return (string) join(',', $ids);
} }
function get_id_ary ($ids) function get_id_ary ($ids)
{ {
$ids = is_string($ids) ? explode(',', $ids) : array_values((array) $ids); $ids = is_string($ids) ? explode(',', $ids) : array_values((array) $ids);
@ -1689,7 +1673,6 @@ function build_topic_pagination ($url, $replies, $per_page)
return $pg; return $pg;
} }
function get_poll_data_items_js ($topic_id) function get_poll_data_items_js ($topic_id)
{ {
if (!$topic_id_csv = get_id_csv($topic_id)) if (!$topic_id_csv = get_id_csv($topic_id))
@ -1954,7 +1937,6 @@ function get_title_match_topics($search)
} }
// для более корректного поиска по словам содержащим одиночную кавычку // для более корректного поиска по словам содержащим одиночную кавычку
function encode_text_match ($txt) function encode_text_match ($txt)
{ {
return str_replace("'", '&#039;', $txt); return str_replace("'", '&#039;', $txt);

View file

@ -430,8 +430,6 @@ $userdata =& $user->data;
if (DBG_USER) require(INC_DIR .'functions_dev.php'); if (DBG_USER) require(INC_DIR .'functions_dev.php');
$html = new Html_Common(); $html = new Html_Common();
$log_action = new Log_Action(); $log_action = new Log_Action();

View file

@ -51,7 +51,6 @@ function get_attachments_from_post($post_id_array)
return $attachments; return $attachments;
} }
/** /**
* Get attachment mod configuration * Get attachment mod configuration
*/ */

View file

@ -156,4 +156,4 @@ switch ($mode)
default: default:
bb_die('Invalid mode: '. htmlCHR($mode)); bb_die('Invalid mode: '. htmlCHR($mode));
} }

View file

@ -42,8 +42,6 @@ if ($mode == 'smilies')
$tracking_topics = get_tracks('topic'); $tracking_topics = get_tracks('topic');
$tracking_forums = get_tracks('forum'); $tracking_forums = get_tracks('forum');
set_die_append_msg($forum_id, $topic_id); set_die_append_msg($forum_id, $topic_id);
// What auth type do we need to check? // What auth type do we need to check?

View file

@ -22,7 +22,6 @@ $post_id = (!$topic_id && isset($_GET[POST_POST_URL])) ? (int) $_GET[POST_POST_
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0; $start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
$newest = 0; $newest = 0;
// Posts per page // Posts per page
$posts_per_page = $bb_cfg['posts_per_page']; $posts_per_page = $bb_cfg['posts_per_page'];
$select_ppp = ''; $select_ppp = '';