Skip to content

Commit

Permalink
Merge v2.2.2 from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
yukoff committed Jul 11, 2017
2 parents 4529770 + 3b7a0fd commit c06e5a2
Show file tree
Hide file tree
Showing 70 changed files with 592 additions and 698 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Change Log

## [v2.2.2](https://github.com/torrentpier/torrentpier/tree/v2.2.2) (2017-06-23)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.1...v2.2.2)

**Merged pull requests:**

- Release preparation Crowdin language pack update [\#409](https://github.com/torrentpier/torrentpier/pull/409) ([Exile37](https://github.com/Exile37))
- Display source language if no user language variable [\#408](https://github.com/torrentpier/torrentpier/pull/408) ([Exile37](https://github.com/Exile37))
- Disable Bugsnag by default [\#407](https://github.com/torrentpier/torrentpier/pull/407) ([Exile37](https://github.com/Exile37))
- Fix empty birthday list [\#406](https://github.com/torrentpier/torrentpier/pull/406) ([Exile37](https://github.com/Exile37))
- Remove unused ranks functionality [\#405](https://github.com/torrentpier/torrentpier/pull/405) ([Exile37](https://github.com/Exile37))
- Complete renewal of the Ukrainian language from our toloka.to friends [\#404](https://github.com/torrentpier/torrentpier/pull/404) ([Exile37](https://github.com/Exile37))
- Some fixes, auto language removal \(so buggy\) and replenishable status [\#403](https://github.com/torrentpier/torrentpier/pull/403) ([Exile37](https://github.com/Exile37))

## [v2.2.1](https://github.com/torrentpier/torrentpier/tree/v2.2.1) (2017-06-16)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.0...v2.2.1)

**Merged pull requests:**

- Release 2.2.1 🐛 [\#392](https://github.com/torrentpier/torrentpier/pull/392) ([Exile37](https://github.com/Exile37))
- Partial renewal of the Ukrainian language from our toloka.to friends [\#391](https://github.com/torrentpier/torrentpier/pull/391) ([Exile37](https://github.com/Exile37))
- Create CODE\_OF\_CONDUCT.md [\#390](https://github.com/torrentpier/torrentpier/pull/390) ([Exile37](https://github.com/Exile37))
- Fix default users language in dump [\#389](https://github.com/torrentpier/torrentpier/pull/389) ([Exile37](https://github.com/Exile37))
Expand Down
46 changes: 8 additions & 38 deletions admin/admin_ranks.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@

require __DIR__ . '/pagestart.php';

$_POST['special_rank'] = 1;
$_POST['min_posts'] = -1;

if (isset($_GET['mode']) || isset($_POST['mode'])) {
$mode = isset($_GET['mode']) ? $_GET['mode'] : $_POST['mode'];
} else {
Expand Down Expand Up @@ -69,22 +66,14 @@

$rank_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
} else {
$rank_info['rank_special'] = 0;
}

$s_hidden_fields .= '<input type="hidden" name="mode" value="save" />';

$rank_is_special = !empty($rank_info['rank_special']) ? HTML_CHECKED : '';
$rank_is_not_special = empty($rank_info['rank_special']) ? HTML_CHECKED : '';

$template->assign_vars(array(
'TPL_RANKS_EDIT' => true,

'RANK' => !empty($rank_info['rank_title']) ? $rank_info['rank_title'] : '',
'SPECIAL_RANK' => $rank_is_special,
'NOT_SPECIAL_RANK' => $rank_is_not_special,
'MINIMUM' => $rank_is_special ? '' : $rank_info['rank_min'],
'IMAGE' => !empty($rank_info['rank_image']) ? $rank_info['rank_image'] : 'styles/images/ranks/rank_image.png',
'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '',
'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '<img src="../' . $rank_info['rank_image'] . '" />' : '',
Expand All @@ -100,19 +89,12 @@
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
$rank_title = isset($_POST['title']) ? trim($_POST['title']) : '';
$rank_style = isset($_POST['style']) ? trim($_POST['style']) : '';
$special_rank = ($_POST['special_rank'] == 1) ? true : 0;
$min_posts = isset($_POST['min_posts']) ? (int)$_POST['min_posts'] : -1;
$rank_image = isset($_POST['rank_image']) ? trim($_POST['rank_image']) : '';

if ($rank_title == '') {
bb_die($lang['MUST_SELECT_RANK']);
}

if ($special_rank == 1) {
$max_posts = -1;
$min_posts = -1;
}

//
// The rank image has to be a jpg, gif or png
//
Expand All @@ -123,24 +105,22 @@
}

if ($rank_id) {
if (!$special_rank) {
$sql = 'UPDATE ' . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql)) {
bb_die($lang['NO_UPDATE_RANKS']);
}

$sql = 'UPDATE ' . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql)) {
bb_die($lang['NO_UPDATE_RANKS']);
}

$sql = 'UPDATE ' . BB_RANKS . "
SET rank_title = '" . DB()->escape($rank_title) . "',
rank_special = $special_rank,
rank_min = $min_posts,
rank_image = '" . DB()->escape($rank_image) . "',
rank_style = '" . DB()->escape($rank_style) . "'
WHERE rank_id = $rank_id";

$message = $lang['RANK_UPDATED'];
} else {
$sql = 'INSERT INTO ' . BB_RANKS . " (rank_title, rank_special, rank_min, rank_image, rank_style)
VALUES ('" . DB()->escape($rank_title) . "', $special_rank, $min_posts, '" . DB()->escape($rank_image) . "', '" . DB()->escape($rank_style) . "')";
$sql = 'INSERT INTO ' . BB_RANKS . " (rank_title, rank_image, rank_style)
VALUES ('" . DB()->escape($rank_title) . "', '" . DB()->escape($rank_image) . "', '" . DB()->escape($rank_style) . "')";

$message = $lang['RANK_ADDED'];
}
Expand Down Expand Up @@ -190,7 +170,7 @@
//
// Show the default page
//
$sql = 'SELECT * FROM ' . BB_RANKS . ' ORDER BY rank_min, rank_title';
$sql = 'SELECT * FROM ' . BB_RANKS . ' ORDER BY rank_title';
if (!$result = DB()->sql_query($sql)) {
bb_die('Could not obtain ranks data #2');
}
Expand All @@ -204,25 +184,15 @@

for ($i = 0; $i < $rank_count; $i++) {
$rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min'];

if ($special_rank == 1) {
$rank_min = $rank_max = '-';
}

$row_class = !($i % 2) ? 'row1' : 'row2';

$rank_is_special = $special_rank ? $lang['YES'] : $lang['NO'];

$template->assign_block_vars('ranks', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank,
'STYLE' => $rank_rows[$i]['rank_style'],
'IMAGE_DISPLAY' => $rank_rows[$i]['rank_image'] ? '<img src="../' . $rank_rows[$i]['rank_image'] . '" />' : '',
'SPECIAL_RANK' => $rank_is_special,
'RANK_MIN' => $rank_min,

'U_RANK_EDIT' => "admin_ranks.php?mode=edit&amp;id=$rank_id",
'U_RANK_DELETE' => "admin_ranks.php?mode=delete&amp;id=$rank_id",
Expand Down
4 changes: 2 additions & 2 deletions admin/admin_user_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
}

$sql = 'SELECT * FROM ' . BB_RANKS . ' WHERE rank_special = 1 ORDER BY rank_title';
$sql = 'SELECT * FROM ' . BB_RANKS . ' ORDER BY rank_title';
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain ranks data');
}
Expand Down Expand Up @@ -482,7 +482,7 @@
bb_die($lang['SEARCH_INVALID_RANK']);
}

$sql = 'SELECT rank_title FROM ' . BB_RANKS . " WHERE rank_id = $rank_id AND rank_special = 1";
$sql = 'SELECT rank_title FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";

if (!$result = DB()->sql_query($sql)) {
bb_die('Could not select rank data');
Expand Down
2 changes: 0 additions & 2 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
CACHE('bb_cache')->set('admin_module_' . $user->id, $module, 600);
}

$module = CACHE('bb_cache')->get('admin_module_' . $user->id);

$template->assign_vars(array(
'TPL_ADMIN_NAVIGATE' => true,
'U_FORUM_INDEX' => '../index.php',
Expand Down
2 changes: 1 addition & 1 deletion bt/includes/init_tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function tracker_exit()

function silent_exit()
{
while (ob_end_clean()) ;
ob_end_clean();

tracker_exit();
}
Expand Down
32 changes: 16 additions & 16 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,19 @@ function value($value)
/**
* Progressive error reporting
*/
if ($bb_cfg['bugsnag']['enabled'] && env('APP_ENV', 'production') !== 'local') {
/** @var Bugsnag\Handler $bugsnag */
$bugsnag = Bugsnag\Client::make($bb_cfg['bugsnag']['api_key']);
Bugsnag\Handler::register($bugsnag);
}

if (DBG_USER && env('APP_ENV', 'production') === 'local') {
/** @var Whoops\Run $whoops */
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
if ($bb_cfg['bugsnag']['enabled']) {
if (env('APP_ENV', 'production') !== 'local') {
/** @var Bugsnag\Handler $bugsnag */
$bugsnag = Bugsnag\Client::make($bb_cfg['bugsnag']['api_key']);
Bugsnag\Handler::register($bugsnag);
}
} else {
if (DBG_USER) {
/** @var Whoops\Run $whoops */
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
}
}

/**
Expand Down Expand Up @@ -271,12 +273,10 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
rename($file, $new_name);
}
}
if (!$fp = fopen($file, 'ab')) {
if ($dir_created = bb_mkdir(dirname($file))) {
$fp = fopen($file, 'ab');
}
if (file_exists($file) && $dir_created = bb_mkdir(dirname($file))) {
$fp = fopen($file, 'ab+');
}
if ($fp) {
if (isset($fp)) {
if ($lock) {
flock($fp, LOCK_EX);
}
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
$week_list = $today_list = array();
$week_all = $today_all = false;

if (isset($stats['birthday_week_list'])) {
if (!empty($stats['birthday_week_list'])) {
shuffle($stats['birthday_week_list']);
foreach ($stats['birthday_week_list'] as $i => $week) {
if ($i >= 5) {
Expand All @@ -392,7 +392,7 @@
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
}

if (isset($stats['birthday_today_list'])) {
if (!empty($stats['birthday_today_list'])) {
shuffle($stats['birthday_today_list']);
foreach ($stats['birthday_today_list'] as $i => $today) {
if ($i >= 5) {
Expand Down
4 changes: 1 addition & 3 deletions install/sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,6 @@ INSERT INTO `bb_quota_limits` (`quota_limit_id`, `quota_desc`, `quota_limit`) VA
CREATE TABLE `bb_ranks` (
`rank_id` smallint(5) UNSIGNED NOT NULL,
`rank_title` varchar(50) NOT NULL DEFAULT '',
`rank_min` mediumint(8) NOT NULL DEFAULT 0,
`rank_special` tinyint(1) NOT NULL DEFAULT 1,
`rank_image` varchar(255) NOT NULL DEFAULT '',
`rank_style` varchar(255) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Expand All @@ -867,7 +865,7 @@ CREATE TABLE `bb_ranks` (
--

INSERT INTO `bb_ranks` (`rank_id`, `rank_title`, `rank_min`, `rank_special`, `rank_image`, `rank_style`) VALUES
(1, 'Адміністратор', -1, 1, 'styles/images/ranks/admin.png', 'colorAdmin');
(1, 'Адміністратор', 'styles/images/ranks/admin.png', 'colorAdmin');

-- --------------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions install/upgrade/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ UPDATE `bb_sessions` SET `session_ip` = '0';
ALTER TABLE `bb_sessions` CHANGE `session_ip` `session_ip` varchar(42) NOT NULL DEFAULT '0';
UPDATE `bb_banlist` SET `ban_ip` = '0';
ALTER TABLE `bb_banlist` CHANGE `ban_ip` `ban_ip` varchar(42) NOT NULL DEFAULT '0';

// 2.2.2
ALTER TABLE `bb_ranks` DROP `rank_min`;
ALTER TABLE `bb_ranks` DROP `rank_special`;
27 changes: 8 additions & 19 deletions library/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
$bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1;

// Version info
$bb_cfg['tp_version'] = '2.2.1';
$bb_cfg['tp_release_date'] = '16-06-2017';
$bb_cfg['tp_version'] = '2.2.2';
$bb_cfg['tp_release_date'] = '23-06-2017';
$bb_cfg['tp_release_codename'] = 'Aurochs';

// Database
Expand Down Expand Up @@ -106,7 +106,7 @@
$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name

// GZip
$bb_cfg['gzip_compress'] = true; // compress output
$bb_cfg['gzip_compress'] = false; // compress output

// Tracker
$bb_cfg['announce_interval'] = 2400; // Announce interval (default: 1800)
Expand Down Expand Up @@ -166,7 +166,6 @@

// Language
$bb_cfg['charset'] = 'UTF-8'; // page charset
$bb_cfg['auto_language'] = false; // select user-preferred language automatically
$bb_cfg['lang'] = [


Expand Down Expand Up @@ -427,7 +426,7 @@

// Bugsnag error reporting
$bb_cfg['bugsnag'] = [
'enabled' => true,
'enabled' => false,
'api_key' => 'ee1adc9739cfceb01ce4a450ae1e52bf',
];

Expand Down Expand Up @@ -701,6 +700,7 @@
TOR_CHECKING => '<span class="tor-icon tor-checking">%</span>',
TOR_TMP => '<span class="tor-icon tor-dup">T</span>',
TOR_PREMOD => '<span class="tor-icon tor-dup">&#8719;</span>',
TOR_REPLENISH => '<span class="tor-icon tor-dup">R</span>',
];


Expand Down Expand Up @@ -758,19 +758,8 @@
$bb_cfg['post_img_width_decr'] = 52;
$bb_cfg['attach_img_width_decr'] = 130;

if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && $bb_cfg['auto_language']) {
$user_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if (file_exists(LANG_ROOT_DIR . '/' . $user_lang)) {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/' . $user_lang . '/';
$bb_cfg['default_lang'] = $user_lang;
} else {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/en/';
$bb_cfg['default_lang'] = 'en';
}
if (isset($bb_cfg['default_lang']) && file_exists(LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'])) {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/';
} else {
if (isset($bb_cfg['default_lang']) && file_exists(LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'])) {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/';
} else {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/en/';
}
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/en/';
}
31 changes: 16 additions & 15 deletions library/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,27 @@
define('MEM_USAGE', function_exists('memory_get_usage'));

// Gzip
define('GZIP_OUTPUT_ALLOWED', (extension_loaded('zlib') && !ini_get('zlib.output_compression')));
define('GZIP_OUTPUT_ALLOWED', extension_loaded('zlib') && !ini_get('zlib.output_compression'));
define('UA_GZIP_SUPPORTED', isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false);

// Torrents (reserved: -1)
define('TOR_NOT_APPROVED', 0); // не проверено
define('TOR_CLOSED', 1); // закрыто
define('TOR_APPROVED', 2); // проверено
define('TOR_NEED_EDIT', 3); // недооформлено
define('TOR_NO_DESC', 4); // неоформлено
define('TOR_DUP', 5); // повтор
define('TOR_CLOSED_CPHOLD', 6); // закрыто правообладателем
define('TOR_CONSUMED', 7); // поглощено
define('TOR_DOUBTFUL', 8); // сомнительно
define('TOR_CHECKING', 9); // проверяется
define('TOR_TMP', 10); // временная
define('TOR_PREMOD', 11); // премодерация
define('TOR_NOT_APPROVED', 0); // не проверено
define('TOR_CLOSED', 1); // закрыто
define('TOR_APPROVED', 2); // проверено
define('TOR_NEED_EDIT', 3); // недооформлено
define('TOR_NO_DESC', 4); // неоформлено
define('TOR_DUP', 5); // повтор
define('TOR_CLOSED_CPHOLD', 6); // закрыто правообладателем
define('TOR_CONSUMED', 7); // поглощено
define('TOR_DOUBTFUL', 8); // сомнительно
define('TOR_CHECKING', 9); // проверяется
define('TOR_TMP', 10); // временная
define('TOR_PREMOD', 11); // премодерация
define('TOR_REPLENISH', 12); // пополняемая

define('CRON_LOG_ENABLED', true); // global ON/OFF
define('CRON_LOG_ENABLED', true); // global ON/OFF
define('CRON_FORCE_LOG', false); // always log regardless of job settings
define('CRON_DIR', INC_DIR . '/cron/');
define('CRON_JOB_DIR', CRON_DIR . 'jobs/');
define('CRON_LOG_DIR', 'cron'); // inside LOG_DIR
define('CRON_LOG_FILE', 'cron'); // without ext
define('CRON_LOG_FILE', 'cron'); // without ext
2 changes: 1 addition & 1 deletion library/includes/page_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// Online userlist
if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
$online_full = !empty($_REQUEST['online_full']);
$online_list = ($online_full) ? 'online_' . $userdata['user_lang'] : 'online_short_' . $userdata['user_lang'];
$online_list = $online_full ? 'online_' . $userdata['user_lang'] : 'online_short_' . $userdata['user_lang'];

${$online_list} = array(
'stat' => '',
Expand Down
Loading

0 comments on commit c06e5a2

Please sign in to comment.