From b54c9d0c2eedba13aee51837ccaf03be3a1e8820 Mon Sep 17 00:00:00 2001 From: Yuriy Pikhtarev Date: Sat, 29 Jul 2017 09:05:12 +0300 Subject: [PATCH] Various bug fixes described on the forum. --- README.md | 1 + admin/admin_disallow.php | 2 +- composer.json | 7 +++---- library/config.php | 3 ++- library/includes/functions.php | 2 +- library/includes/functions_atom.php | 22 ++++++++++---------- library/includes/functions_selects.php | 2 +- library/language/source/main.php | 2 ++ src/Helpers/CronHelper.php | 2 +- styles/templates/default/page_header.tpl | 2 +- styles/templates/default/usercp_register.tpl | 2 +- 11 files changed, 25 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ac3657f1e..2b78813c2 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/admin/admin_disallow.php b/admin/admin_disallow.php index f7743a564..7f6275c1d 100644 --- a/admin/admin_disallow.php +++ b/admin/admin_disallow.php @@ -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) . "')"; diff --git a/composer.json b/composer.json index 9ab4061c5..a03a45ed1 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/library/config.php b/library/config.php index 2eab9723e..508f4d1c5 100644 --- a/library/config.php +++ b/library/config.php @@ -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 diff --git a/library/includes/functions.php b/library/includes/functions.php index bb4a708e7..896a9a316 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -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; diff --git a/library/includes/functions_atom.php b/library/includes/functions_atom.php index a0ecf1e46..bce0fd06f 100644 --- a/library/includes/functions_atom.php +++ b/library/includes/functions_atom.php @@ -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 .= "\n"; - $atom .= "\n"; + $atom .= "\n"; $atom .= "$title\n"; $atom .= "" . $date . "T$time+00:00\n"; $atom .= "tag:rto.feed,2000:/$mode/$id\n"; - $atom .= "\n"; + $atom .= "\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 .= "\n"; $atom .= " <![CDATA[$updated$topic_title$tor_size]]>\n"; diff --git a/library/includes/functions_selects.php b/library/includes/functions_selects.php index 51be4af06..9edd4a424 100644 --- a/library/includes/functions_selects.php +++ b/library/includes/functions_selects.php @@ -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 = ''); {L_EMAIL}: *
{L_EMAIL_EXPLAIN}
- readonly="readonly" style="color: gray;" /> + readonly="readonly" style="color: gray;" />