mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Bugsnag integration and some bugfixes in for cycles.
This commit is contained in:
parent
8104657016
commit
f7cc55b984
10 changed files with 39 additions and 25 deletions
|
@ -398,7 +398,7 @@ if ($view === 'attachments') {
|
||||||
for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) {
|
||||||
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
|
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
|
||||||
|
|
||||||
for ($j = 0, $iMax = count($delete_id_list); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($delete_id_list); $j < $jMax; $j++) {
|
||||||
if ($delete_id_list[$j] == $attachments[$i]['attach_id']) {
|
if ($delete_id_list[$j] == $attachments[$i]['attach_id']) {
|
||||||
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" checked="checked" />';
|
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" checked="checked" />';
|
||||||
break;
|
break;
|
||||||
|
@ -409,7 +409,7 @@ if ($view === 'attachments') {
|
||||||
|
|
||||||
// Is the Attachment assigned to more than one post ?
|
// Is the Attachment assigned to more than one post ?
|
||||||
// If it's not assigned to any post, it's an private message thingy. ;)
|
// If it's not assigned to any post, it's an private message thingy. ;)
|
||||||
$post_titles = array();
|
$post_titles = [];
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM " . BB_ATTACHMENTS . "
|
FROM " . BB_ATTACHMENTS . "
|
||||||
|
|
|
@ -252,7 +252,7 @@ if ($submit && $mode == 'groups') {
|
||||||
$allowed_list = array();
|
$allowed_list = array();
|
||||||
|
|
||||||
for ($i = 0, $iMax = count($group_allowed_list); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($group_allowed_list); $i < $iMax; $i++) {
|
||||||
for ($j = 0, $jMax = count($group_change_list); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($group_change_list); $j < $jMax; $j++) {
|
||||||
if ($group_allowed_list[$i] == $group_change_list[$j]) {
|
if ($group_allowed_list[$i] == $group_change_list[$j]) {
|
||||||
$allowed_list[$j] = 1;
|
$allowed_list[$j] = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ if (empty($forum_id)) {
|
||||||
reset($simple_auth_ary);
|
reset($simple_auth_ary);
|
||||||
foreach ($simple_auth_ary as $key => $auth_levels) {
|
foreach ($simple_auth_ary as $key => $auth_levels) {
|
||||||
$matched = 1;
|
$matched = 1;
|
||||||
for ($k = 0, $kMax = count($auth_levels); $k < $iMax; $k++) {
|
for ($k = 0, $kMax = count($auth_levels); $k < $kMax; $k++) {
|
||||||
$matched_type = $key;
|
$matched_type = $key;
|
||||||
|
|
||||||
if ($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k]) {
|
if ($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k]) {
|
||||||
|
@ -189,7 +189,7 @@ if (empty($forum_id)) {
|
||||||
if (empty($adv)) {
|
if (empty($adv)) {
|
||||||
$simple_auth = '<select name="simpleauth">';
|
$simple_auth = '<select name="simpleauth">';
|
||||||
|
|
||||||
for ($j = 0, $jMax = count($simple_auth_types); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($simple_auth_types); $j < $jMax; $j++) {
|
||||||
$selected = ($matched_type == $j) ? ' selected="selected"' : '';
|
$selected = ($matched_type == $j) ? ' selected="selected"' : '';
|
||||||
$simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
|
$simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
|
||||||
}
|
}
|
||||||
|
@ -207,10 +207,10 @@ if (empty($forum_id)) {
|
||||||
// Output values of individual
|
// Output values of individual
|
||||||
// fields
|
// fields
|
||||||
//
|
//
|
||||||
for ($j = 0, $jMax = count($forum_auth_fields); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($forum_auth_fields); $j < $jMax; $j++) {
|
||||||
$custom_auth[$j] = ' <select name="' . $forum_auth_fields[$j] . '">';
|
$custom_auth[$j] = ' <select name="' . $forum_auth_fields[$j] . '">';
|
||||||
|
|
||||||
for ($k = 0, $kMax = count($forum_auth_levels); $k < $iMax; $k++) {
|
for ($k = 0, $kMax = count($forum_auth_levels); $k < $kMax; $k++) {
|
||||||
$selected = ($forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k]) ? ' selected="selected"' : '';
|
$selected = ($forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k]) ? ' selected="selected"' : '';
|
||||||
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . strtoupper($forum_auth_levels[$k])] . '</OPTION>';
|
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . strtoupper($forum_auth_levels[$k])] . '</OPTION>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ if (empty($forum_id) && empty($cat_id)) {
|
||||||
'CAT_URL' => 'admin_forumauth_list.php' . '?' . POST_CAT_URL . '=' . $category_rows[$i]['cat_id'])
|
'CAT_URL' => 'admin_forumauth_list.php' . '?' . POST_CAT_URL . '=' . $category_rows[$i]['cat_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($j = 0, $jMax = count($forum_rows); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($forum_rows); $j < $jMax; $j++) {
|
||||||
if ($cat_id == $forum_rows[$j]['cat_id']) {
|
if ($cat_id == $forum_rows[$j]['cat_id']) {
|
||||||
$template->assign_block_vars('cat_row.forum_row', array(
|
$template->assign_block_vars('cat_row.forum_row', array(
|
||||||
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
|
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
|
||||||
|
@ -232,9 +232,9 @@ if (empty($forum_id) && empty($cat_id)) {
|
||||||
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
|
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
|
||||||
));
|
));
|
||||||
|
|
||||||
for ($k = 0, $kMax = count($forum_auth_fields); $k < $iMax; $k++) {
|
for ($k = 0, $kMax = count($forum_auth_fields); $k < $kMax; $k++) {
|
||||||
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
|
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
|
||||||
for ($l = 0, $lMax = count($forum_auth_const); $l < $iMax; $l++) {
|
for ($l = 0, $lMax = count($forum_auth_const); $l < $lMax; $l++) {
|
||||||
if ($item_auth_value == $forum_auth_const[$l]) {
|
if ($item_auth_value == $forum_auth_const[$l]) {
|
||||||
$item_auth_level = $forum_auth_levels[$l];
|
$item_auth_level = $forum_auth_levels[$l];
|
||||||
break;
|
break;
|
||||||
|
@ -283,7 +283,7 @@ if (empty($forum_id) && empty($cat_id)) {
|
||||||
'CAT_URL' => 'admin_forumauth_list.php?' . POST_CAT_URL . '=' . $cat_id)
|
'CAT_URL' => 'admin_forumauth_list.php?' . POST_CAT_URL . '=' . $cat_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($j = 0, $jMax = count($forum_rows); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($forum_rows); $j < $jMax; $j++) {
|
||||||
if ($cat_id == $forum_rows[$j]['cat_id']) {
|
if ($cat_id == $forum_rows[$j]['cat_id']) {
|
||||||
$template->assign_block_vars('cat_row.forum_row', array(
|
$template->assign_block_vars('cat_row.forum_row', array(
|
||||||
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
|
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
|
||||||
|
@ -291,9 +291,9 @@ if (empty($forum_id) && empty($cat_id)) {
|
||||||
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
|
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
|
||||||
));
|
));
|
||||||
|
|
||||||
for ($k = 0, $kMax = count($forum_auth_fields); $k < $iMax; $k++) {
|
for ($k = 0, $kMax = count($forum_auth_fields); $k < $kMax; $k++) {
|
||||||
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
|
$item_auth_value = $forum_rows[$j][$forum_auth_fields[$k]];
|
||||||
for ($l = 0, $lMax = count($forum_auth_const); $l < $iMax; $l++) {
|
for ($l = 0, $lMax = count($forum_auth_const); $l < $lMax; $l++) {
|
||||||
if ($item_auth_value == $forum_auth_const[$l]) {
|
if ($item_auth_value == $forum_auth_const[$l]) {
|
||||||
$item_auth_level = $forum_auth_levels[$l];
|
$item_auth_level = $forum_auth_levels[$l];
|
||||||
break;
|
break;
|
||||||
|
@ -311,10 +311,10 @@ if (empty($forum_id) && empty($cat_id)) {
|
||||||
// next generate the information to allow the permissions to be changed
|
// next generate the information to allow the permissions to be changed
|
||||||
// note: we always read from the first forum in the category
|
// note: we always read from the first forum in the category
|
||||||
//
|
//
|
||||||
for ($j = 0, $jMax = count($forum_auth_fields); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($forum_auth_fields); $j < $jMax; $j++) {
|
||||||
$custom_auth[$j] = '<select name="' . $forum_auth_fields[$j] . '">';
|
$custom_auth[$j] = '<select name="' . $forum_auth_fields[$j] . '">';
|
||||||
|
|
||||||
for ($k = 0, $kMax = count($forum_auth_levels); $k < $iMax; $k++) {
|
for ($k = 0, $kMax = count($forum_auth_levels); $k < $kMax; $k++) {
|
||||||
$selected = (!empty($forum_rows) && $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k]) ? ' selected="selected"' : '';
|
$selected = (!empty($forum_rows) && $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k]) ? ' selected="selected"' : '';
|
||||||
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . $forum_auth_levels[$k]] . '</option>';
|
$custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['FORUM_' . $forum_auth_levels[$k]] . '</option>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
|
||||||
for ($i = 0, $iMax = count($fcontents); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($fcontents); $i < $iMax; $i++) {
|
||||||
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
|
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
|
||||||
|
|
||||||
for ($j = 2, $jMax = count($smile_data); $j < $iMax; $j++) {
|
for ($j = 2, $jMax = count($smile_data); $j < $jMax; $j++) {
|
||||||
// Replace > and < with the proper html_entities for matching
|
// Replace > and < with the proper html_entities for matching
|
||||||
$smile_data[$j] = str_replace('<', '<', $smile_data[$j]);
|
$smile_data[$j] = str_replace('<', '<', $smile_data[$j]);
|
||||||
$smile_data[$j] = str_replace('>', '>', $smile_data[$j]);
|
$smile_data[$j] = str_replace('>', '>', $smile_data[$j]);
|
||||||
|
|
|
@ -100,7 +100,7 @@ if (isset($_POST['submit'])) {
|
||||||
} elseif (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i]))) {
|
} elseif (preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i]))) {
|
||||||
$ip = gethostbynamel(trim($ip_list_temp[$i]));
|
$ip = gethostbynamel(trim($ip_list_temp[$i]));
|
||||||
|
|
||||||
for ($j = 0, $jMax = count($ip); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($ip); $j < $jMax; $j++) {
|
||||||
if (!empty($ip[$j])) {
|
if (!empty($ip[$j])) {
|
||||||
$ip_list[] = encode_ip($ip[$j]);
|
$ip_list[] = encode_ip($ip[$j]);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ if (isset($_POST['submit'])) {
|
||||||
$kill_session_sql = '';
|
$kill_session_sql = '';
|
||||||
for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
|
||||||
$in_banlist = false;
|
$in_banlist = false;
|
||||||
for ($j = 0, $jMax = count($current_banlist); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||||
if ($user_list[$i] == $current_banlist[$j]['ban_userid']) {
|
if ($user_list[$i] == $current_banlist[$j]['ban_userid']) {
|
||||||
$in_banlist = true;
|
$in_banlist = true;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ if (isset($_POST['submit'])) {
|
||||||
|
|
||||||
for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
|
||||||
$in_banlist = false;
|
$in_banlist = false;
|
||||||
for ($j = 0, $jMax = count($current_banlist); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||||
if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) {
|
if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) {
|
||||||
$in_banlist = true;
|
$in_banlist = true;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ if (isset($_POST['submit'])) {
|
||||||
|
|
||||||
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
|
||||||
$in_banlist = false;
|
$in_banlist = false;
|
||||||
for ($j = 0, $jMax = count($current_banlist); $j < $iMax; $j++) {
|
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
|
||||||
if ($email_list[$i] == $current_banlist[$j]['ban_email']) {
|
if ($email_list[$i] == $current_banlist[$j]['ban_email']) {
|
||||||
$in_banlist = true;
|
$in_banlist = true;
|
||||||
}
|
}
|
||||||
|
|
4
ajax.php
4
ajax.php
|
@ -26,10 +26,10 @@
|
||||||
define('BB_SCRIPT', 'ajax');
|
define('BB_SCRIPT', 'ajax');
|
||||||
define('IN_AJAX', true);
|
define('IN_AJAX', true);
|
||||||
|
|
||||||
$ajax = new TorrentPier\Legacy\Ajax();
|
|
||||||
|
|
||||||
require __DIR__ . '/common.php';
|
require __DIR__ . '/common.php';
|
||||||
|
|
||||||
|
$ajax = new TorrentPier\Legacy\Ajax();
|
||||||
|
|
||||||
$ajax->init();
|
$ajax->init();
|
||||||
|
|
||||||
// Init userdata
|
// Init userdata
|
||||||
|
|
12
common.php
12
common.php
|
@ -57,14 +57,20 @@ header('X-Frame-Options: SAMEORIGIN');
|
||||||
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
|
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
|
||||||
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
|
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
// Get initial config
|
// Get initial config
|
||||||
require __DIR__ . '/library/config.php';
|
require __DIR__ . '/library/config.php';
|
||||||
|
|
||||||
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
// Bugsnag error reporting
|
||||||
$server_port = (in_array($bb_cfg['server_port'], array(80, 443))) ? '' : ':' . $bb_cfg['server_port'];
|
if ($bb_cfg['bugsnag']['enabled'] && !empty($bb_cfg['bugsnag']['api_key'])) {
|
||||||
|
/** @var Bugsnag\Handler $bugsnag */
|
||||||
|
$bugsnag = Bugsnag\Client::make($bb_cfg['bugsnag']['api_key']);
|
||||||
|
Bugsnag\Handler::register($bugsnag);
|
||||||
|
}
|
||||||
|
|
||||||
|
$server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
|
||||||
|
$server_port = in_array($bb_cfg['server_port'], array(80, 443), true) ? '' : ':' . $bb_cfg['server_port'];
|
||||||
define('FORUM_PATH', $bb_cfg['script_path']);
|
define('FORUM_PATH', $bb_cfg['script_path']);
|
||||||
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
|
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
|
||||||
unset($server_protocol, $server_port);
|
unset($server_protocol, $server_port);
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^5.3 || ^7.0",
|
"php": "^5.3 || ^7.0",
|
||||||
|
"bugsnag/bugsnag": "^3.0",
|
||||||
"gigablah/sphinxphp": "^2.0",
|
"gigablah/sphinxphp": "^2.0",
|
||||||
"google/recaptcha": "^1.0",
|
"google/recaptcha": "^1.0",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
* Registration
|
* Registration
|
||||||
* Email
|
* Email
|
||||||
* Debug
|
* Debug
|
||||||
|
* Bugsnag error reporting
|
||||||
* Special users (dbg_users, unlimited_users, super_admins)
|
* Special users (dbg_users, unlimited_users, super_admins)
|
||||||
* Log options
|
* Log options
|
||||||
* Error reporting
|
* Error reporting
|
||||||
|
@ -417,6 +418,12 @@ define('SQL_LOG_SLOW_QUERIES', true); // log sql slow queries
|
||||||
define('SQL_SLOW_QUERY_TIME', 10); // slow query in seconds
|
define('SQL_SLOW_QUERY_TIME', 10); // slow query in seconds
|
||||||
define('SQL_PREPEND_SRC_COMM', false); // prepend source file comment to sql query
|
define('SQL_PREPEND_SRC_COMM', false); // prepend source file comment to sql query
|
||||||
|
|
||||||
|
// Bugsnag error reporting
|
||||||
|
$bb_cfg['bugsnag'] = [
|
||||||
|
'enabled' => false,
|
||||||
|
'api_key' => '',
|
||||||
|
];
|
||||||
|
|
||||||
// Special users
|
// Special users
|
||||||
$bb_cfg['dbg_users'] = array(
|
$bb_cfg['dbg_users'] = array(
|
||||||
# user_id => 'name',
|
# user_id => 'name',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue