Merge pull request #431 from Exile37/bugfix/various-bugfixes

Various bug fixes described on the forum
This commit is contained in:
Yuriy Pikhtarev 2017-07-29 09:08:58 +03:00 committed by GitHub
commit 670a46d9b0
11 changed files with 25 additions and 22 deletions

View file

@ -40,6 +40,7 @@ For installation you need to follow a few simple steps:
1. Create database and import dump located at **install/sql/mysql.sql**
1. Edit database configuration settings in the configuration file or a local copy (see below)
1. Edit domain name in the configuration file or a local copy (see below)
1. Edit domain ssl setting in the configuration file or a local copy (see below)
1. Edit this files:
1. **favicon.png** (change on your own)
1. **robots.txt** (change the addresses in lines **Host** and **Sitemap** on your own)

View file

@ -39,7 +39,7 @@ if (isset($_POST['add_name'])) {
if ($disallowed_user == '') {
bb_die($lang['FIELDS_EMPTY']);
}
if (!validate_username($disallowed_user)) {
if (validate_username($disallowed_user)) {
$message = $lang['DISALLOWED_ALREADY'];
} else {
$sql = 'INSERT INTO ' . BB_DISALLOW . " (disallow_username) VALUES('" . DB()->escape($disallowed_user) . "')";

View file

@ -14,17 +14,17 @@
{
"name": "Exile",
"email": "admin@torrentpier.com",
"homepage": "https://torrentpier.com/forum/members/exile.1/",
"homepage": "https://github.com/Exile37",
"role": "Developer"
},
{
"name": "Diolektor",
"homepage": "https://torrentpier.com/forum/members/diolektor.5765/",
"homepage": "https://github.com/VasyOk",
"role": "Developer"
},
{
"name": "PheRum",
"homepage": "https://torrentpier.com/forum/members/pherum.23/",
"homepage": "https://github.com/PheRum",
"role": "Developer"
}
],
@ -41,7 +41,6 @@
"gigablah/sphinxphp": "^2.0",
"google/recaptcha": "^1.1",
"longman/ip-tools": "^1.2",
"roave/security-advisories": "dev-master",
"rych/bencode": "^1.0",
"samdark/sitemap": "^2.0",
"swiftmailer/swiftmailer": "^5.4",

View file

@ -29,6 +29,7 @@ if (!defined('BB_ROOT')) {
$domain_name = 'torrentpier.com'; // enter here your primary domain name of your site
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
$domain_ssl = true;
$bb_cfg = [];
@ -366,7 +367,7 @@ $bb_cfg['show_sidebar2_on_every_page'] = false;
// Cookie
$bb_cfg['cookie_domain'] = in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost'], true) ? '' : ".$domain_name";
$bb_cfg['cookie_secure'] = !empty($_SERVER['HTTPS']) ? 1 : 0;
$bb_cfg['cookie_secure'] = $domain_ssl ? true : (!empty($_SERVER['HTTPS']) ? true : false);
$bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_'
// Sessions

View file

@ -1851,7 +1851,7 @@ function log_sphinx_error($err_type, $err_msg, $query = '')
}
}
function get_title_match_topics($title_match_sql, array $forum_ids = array())
function get_title_match_topics($title_match_sql, $forum_ids = [])
{
global $bb_cfg, $sphinx, $userdata, $title_match, $lang;

View file

@ -32,11 +32,11 @@ if (!defined('BB_ROOT')) {
function update_forum_feed($forum_id, $forum_data)
{
global $bb_cfg;
global $bb_cfg, $lang;
$file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom';
$select_tor_sql = $join_tor_sql = '';
if ($forum_id == 0) {
$forum_data['forum_name'] = 'Общая по всем разделам';
$forum_data['forum_name'] = $lang['ATOM_GLOBAL_FEED'];
}
if ($forum_id > 0 && $forum_data['allow_reg_tracker']) {
$select_tor_sql = ', tor.size AS tor_size, tor.tor_status';
@ -97,9 +97,9 @@ function update_forum_feed($forum_id, $forum_data)
}
if (create_atom($file_path, 'f', $forum_id, htmlCHR($forum_data['forum_name']), $topics)) {
return true;
} else {
return false;
}
return false;
}
function update_user_feed($user_id, $username)
@ -143,14 +143,14 @@ function update_user_feed($user_id, $username)
}
if (create_atom($file_path, 'u', $user_id, wbr($username), $topics)) {
return true;
} else {
return false;
}
return false;
}
function create_atom($file_path, $mode, $id, $title, $topics)
{
global $bb_cfg;
global $lang;
$dir = dirname($file_path);
if (!file_exists($dir)) {
if (!bb_mkdir($dir)) {
@ -168,11 +168,11 @@ function create_atom($file_path, $mode, $id, $title, $topics)
}
$atom = "";
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\">\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . FULL_URL . "\">\n";
$atom .= "<title>$title</title>\n";
$atom .= "<updated>" . $date . "T$time+00:00</updated>\n";
$atom .= "<id>tag:rto.feed,2000:/$mode/$id</id>\n";
$atom .= "<link href=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\" />\n";
$atom .= "<link href=\"" . FULL_URL . "\" />\n";
foreach ($topics as $topic) {
$topic_id = $topic['topic_id'];
$tor_size = '';
@ -187,7 +187,7 @@ function create_atom($file_path, $mode, $id, $title, $topics)
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$topic_title = wbr($topic_title);
$author_name = ($topic['first_username']) ? wbr($topic['first_username']) : 'Гость';
$author_name = $topic['first_username'] ? wbr($topic['first_username']) : $lang['GUEST'];
$last_time = $topic['topic_last_post_time'];
if ($topic['topic_last_post_edit_time']) {
$last_time = $topic['topic_last_post_edit_time'];
@ -197,7 +197,7 @@ function create_atom($file_path, $mode, $id, $title, $topics)
$updated = '';
$checktime = TIMENOW - 604800; // неделя (week)
if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) {
$updated = '[Обновлено] ';
$updated = '[' . $lang['ATOM_UPDATED'] . '] ';
}
$atom .= "<entry>\n";
$atom .= " <title type=\"html\"><![CDATA[$updated$topic_title$tor_size]]></title>\n";

View file

@ -57,7 +57,7 @@ function tz_select($default, $select_name = 'timezone')
global $sys_timezone, $lang;
if (!isset($default)) {
$default == $sys_timezone;
$default = $sys_timezone;
}
$tz_select = '<select name="' . $select_name . '">';

View file

@ -2757,6 +2757,8 @@ $lang['ATOM_SUBSCRIBE'] = 'Subscribe to the feed';
$lang['ATOM_NO_MODE'] = 'Do not specify a mode for the feed';
$lang['ATOM_NO_FORUM'] = 'This forum does not have a feed (no ongoing topics)';
$lang['ATOM_NO_USER'] = 'This user does not have a feed (no ongoing topics)';
$lang['ATOM_UPDATED'] = 'Updated';
$lang['ATOM_GLOBAL_FEED'] = 'Global feed for all forums';
$lang['HASH_INVALID'] = 'Hash %s is invalid';
$lang['HASH_NOT_FOUND'] = 'Release with hash %s not found';

View file

@ -68,7 +68,7 @@ class CronHelper
*/
public static function touchLockFile($lock_file)
{
file_write(make_rand_str(20), $lock_file, 0, true, true);
file_write('', $lock_file, 0, true, true);
}
/**

View file

@ -67,7 +67,7 @@ $(document).ready(function(){
');
$('#jumpbox-container').one('click', function(){
$('#jumpbox-title').html('&nbsp;&nbsp; {L_LOADING} ... &nbsp;');
var jumpbox_src = '{AJAX_HTML_DIR}' + ({LOGGED_IN} ? '/jumpbox_user.html' : '/jumpbox_guest.html');
var jumpbox_src = '/internal_data/ajax_html' + ({LOGGED_IN} ? '/jumpbox_user.html' : '/jumpbox_guest.html');
$(this).load(jumpbox_src);
$('#jumpbox-submit').click(function(){ window.location.href='{FORUM_URL}'+$('#jumpbox').val(); });
});

View file

@ -67,7 +67,7 @@ document.write('<input type="hidden" name="user_timezone" value="'+tz+'" />');
</tr>
<tr>
<td class="prof-title">{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><br /><h6>{L_EMAIL_EXPLAIN}</h6><!-- ENDIF --></td>
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE --><!-- IF $bb_cfg['emailer_disabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE --><!-- IF !$bb_cfg['emailer']['enabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<span id="check_email"></span></td>
</tr>
<!-- IF EDIT_PROFILE and not ADM_EDIT -->