Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap update & beginning of the develop branch partial merge #303

Merged
merged 2 commits into from Jun 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 30 additions & 30 deletions admin/admin_attach_cp.php
Expand Up @@ -179,7 +179,7 @@
}

print_confirmation(array(
'FORM_ACTION' => "admin_attach_cp.php",
'FORM_ACTION' => 'admin_attach_cp.php',
'HIDDEN_FIELDS' => $hidden_fields,
));
}
Expand Down Expand Up @@ -214,9 +214,9 @@
while ($attachrow = DB()->sql_fetchrow($result)) {
if (isset($attachments['_' . $attachrow['attach_id']])) {
if ($attachrow['comment'] != $attachments['_' . $attachrow['attach_id']]['comment'] || $attachrow['download_count'] != $attachments['_' . $attachrow['attach_id']]['download_count']) {
$sql = "UPDATE " . BB_ATTACHMENTS_DESC . "
SET comment = '" . attach_mod_sql_escape($attachments['_' . $attachrow['attach_id']]['comment']) . "', download_count = " . (int)$attachments['_' . $attachrow['attach_id']]['download_count'] . "
WHERE attach_id = " . (int)$attachrow['attach_id'];
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . "
SET comment = '" . attach_mod_sql_escape($attachments['_' . $attachrow['attach_id']]['comment']) . "', download_count = " . (int)$attachments['_' . $attachrow['attach_id']]['download_count'] . '
WHERE attach_id = ' . (int)$attachrow['attach_id'];

if (!DB()->sql_query($sql)) {
bb_die('Could not update attachments informations');
Expand All @@ -234,17 +234,17 @@
$attachment_quota = humn_size($attach_config['attachment_quota']);

// number_of_attachments
$row = DB()->fetch_row("SELECT COUNT(*) AS total FROM " . BB_ATTACHMENTS_DESC);
$row = DB()->fetch_row('SELECT COUNT(*) AS total FROM ' . BB_ATTACHMENTS_DESC);
$number_of_attachments = $number_of_posts = $row['total'];

$number_of_pms = 0;

// number_of_topics
$row = DB()->fetch_row("SELECT COUNT(*) AS topics FROM " . BB_TOPICS . " WHERE topic_attachment = 1");
$row = DB()->fetch_row('SELECT COUNT(*) AS topics FROM ' . BB_TOPICS . ' WHERE topic_attachment = 1');
$number_of_topics = $row['topics'];

// number_of_users
$row = DB()->fetch_row("SELECT COUNT(DISTINCT user_id_1) AS users FROM " . BB_ATTACHMENTS . " WHERE post_id != 0");
$row = DB()->fetch_row('SELECT COUNT(DISTINCT user_id_1) AS users FROM ' . BB_ATTACHMENTS . ' WHERE post_id != 0');
$number_of_users = $row['users'];

$template->assign_vars(array(
Expand All @@ -263,10 +263,10 @@
if ($view === 'search') {
// Get Forums and Categories
//sf - add [, f.forum_parent]
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id, f.forum_parent
FROM " . BB_CATEGORIES . " c, " . BB_FORUMS . " f
$sql = 'SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id, f.forum_parent
FROM ' . BB_CATEGORIES . ' c, ' . BB_FORUMS . ' f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_id, f.forum_order";
ORDER BY c.cat_id, f.forum_order';

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain forum_name / forum_id');
Expand All @@ -275,7 +275,7 @@
$s_forums = '';
$list_cat = [];
while ($row = DB()->sql_fetchrow($result)) { //sf
$s_forums .= '<option value="' . $row['forum_id'] . '">' . (($row['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>';
$s_forums .= '<option value="' . $row['forum_id'] . '">' . ($row['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>';

if (empty($list_cat[$row['cat_id']])) {
$list_cat[$row['cat_id']] = $row['cat_title'];
Expand Down Expand Up @@ -318,7 +318,7 @@

// Attachments
if ($view === 'attachments') {
$user_based = ($uid) ? true : false;
$user_based = $uid ? true : false;
$search_based = (isset($_POST['search']) && $_POST['search']);

$hidden_fields = '';
Expand All @@ -333,7 +333,7 @@

// Are we called from Username ?
if ($user_based) {
$sql = "SELECT username FROM " . BB_USERS . " WHERE user_id = " . (int)$uid;
$sql = 'SELECT username FROM ' . BB_USERS . ' WHERE user_id = ' . (int)$uid;

if (!($result = DB()->sql_query($sql))) {
bb_die('Error getting username');
Expand All @@ -352,10 +352,10 @@
'L_STATISTICS_FOR_USER' => sprintf($lang['STATISTICS_FOR_USER'], $username),
));

$sql = "SELECT attach_id
FROM " . BB_ATTACHMENTS . "
WHERE user_id_1 = " . (int)$uid . "
GROUP BY attach_id";
$sql = 'SELECT attach_id
FROM ' . BB_ATTACHMENTS . '
WHERE user_id_1 = ' . (int)$uid . '
GROUP BY attach_id';

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query attachments #1');
Expand All @@ -377,9 +377,9 @@
$attach_id[] = (int)$attach_ids[$j]['attach_id'];
}

$sql = "SELECT a.*
FROM " . BB_ATTACHMENTS_DESC . " a
WHERE a.attach_id IN (" . implode(', ', $attach_id) . ") " .
$sql = 'SELECT a.*
FROM ' . BB_ATTACHMENTS_DESC . ' a
WHERE a.attach_id IN (' . implode(', ', $attach_id) . ') ' .
$order_by;

if (!($result = DB()->sql_query($sql))) {
Expand Down Expand Up @@ -411,9 +411,9 @@
// If it's not assigned to any post, it's an private message thingy. ;)
$post_titles = [];

$sql = "SELECT *
FROM " . BB_ATTACHMENTS . "
WHERE attach_id = " . (int)$attachments[$i]['attach_id'];
$sql = 'SELECT *
FROM ' . BB_ATTACHMENTS . '
WHERE attach_id = ' . (int)$attachments[$i]['attach_id'];

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query attachments #3');
Expand All @@ -425,10 +425,10 @@

for ($j = 0; $j < $num_ids; $j++) {
if ($ids[$j]['post_id'] != 0) {
$sql = "SELECT t.topic_title
FROM " . BB_TOPICS . " t, " . BB_POSTS . " p
WHERE p.post_id = " . (int)$ids[$j]['post_id'] . " AND p.topic_id = t.topic_id
GROUP BY t.topic_id, t.topic_title";
$sql = 'SELECT t.topic_title
FROM ' . BB_TOPICS . ' t, ' . BB_POSTS . ' p
WHERE p.post_id = ' . (int)$ids[$j]['post_id'] . ' AND p.topic_id = t.topic_id
GROUP BY t.topic_id, t.topic_title';

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query topic');
Expand All @@ -455,13 +455,13 @@
$hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';

$template->assign_block_vars('attachrow', array(
'ROW_NUMBER' => $i + (@$_GET['start'] + 1),
'ROW_NUMBER' => $i + ($_GET['start'] + 1),
'ROW_CLASS' => $row_class,

'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']),
'COMMENT' => htmlspecialchars($attachments[$i]['comment']),
'EXTENSION' => $attachments[$i]['extension'],
'SIZE' => round(($attachments[$i]['filesize'] / 1024), 2),
'SIZE' => round($attachments[$i]['filesize'] / 1024, 2),
'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
'POST_TIME' => bb_date($attachments[$i]['filetime']),
'POST_TITLE' => $post_titles,
Expand All @@ -475,7 +475,7 @@

if (!$search_based && !$user_based) {
if (!$attachments) {
$sql = "SELECT attach_id FROM " . BB_ATTACHMENTS_DESC;
$sql = 'SELECT attach_id FROM ' . BB_ATTACHMENTS_DESC;

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query attachment description table');
Expand Down
42 changes: 21 additions & 21 deletions admin/admin_attachments.php
Expand Up @@ -49,10 +49,10 @@
$quota_size = request_var('quota_size', '');
$pm_size = request_var('pm_size', '');

$submit = (isset($_POST['submit'])) ? true : false;
$check_upload = (isset($_POST['settings'])) ? true : false;
$check_image_cat = (isset($_POST['cat_settings'])) ? true : false;
$search_imagick = (isset($_POST['search_imagick'])) ? true : false;
$submit = isset($_POST['submit']) ? true : false;
$check_upload = isset($_POST['settings']) ? true : false;
$check_image_cat = isset($_POST['cat_settings']) ? true : false;
$search_imagick = isset($_POST['search_imagick']) ? true : false;

// Re-evaluate the Attachment Configuration
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
Expand Down Expand Up @@ -118,11 +118,11 @@
}
}

$sql = "UPDATE " . BB_ATTACH_CONFIG . "
$sql = 'UPDATE ' . BB_ATTACH_CONFIG . "
SET config_value = '" . attach_mod_sql_escape($new_attach[$config_name]) . "'
WHERE config_name = '" . attach_mod_sql_escape($config_name) . "'";
} else {
$sql = "UPDATE " . BB_ATTACH_CONFIG . "
$sql = 'UPDATE ' . BB_ATTACH_CONFIG . "
SET config_value = '" . attach_mod_sql_escape($new_attach[$config_name]) . "'
WHERE config_name = '" . attach_mod_sql_escape($config_name) . "'";
}
Expand Down Expand Up @@ -168,13 +168,13 @@
} elseif (preg_match('/WIN/i', PHP_OS)) {
$path = 'c:/imagemagick/convert.exe';

if (!@file_exists(@amod_realpath($path))) {
if (!@file_exists(amod_realpath($path))) {
$imagick = $path;
}
}
}

if (!@file_exists(@amod_realpath(trim($imagick)))) {
if (!@file_exists(amod_realpath(trim($imagick)))) {
$new_attach['img_imagick'] = trim($imagick);
} else {
$new_attach['img_imagick'] = '';
Expand Down Expand Up @@ -209,7 +209,7 @@
$error = false;

// Does the target directory exist, is it a directory and writeable
if (!@file_exists(@amod_realpath($upload_dir))) {
if (!@file_exists(amod_realpath($upload_dir))) {
$error = true;
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $attach_config['upload_dir']) . '<br />';
}
Expand Down Expand Up @@ -359,11 +359,11 @@
$error = false;

// Does the target directory exist, is it a directory and writeable
if (!@file_exists(@amod_realpath($upload_dir))) {
@mkdir($upload_dir, 0755);
if (!@file_exists(amod_realpath($upload_dir))) {
mkdir($upload_dir, 0755);
@chmod($upload_dir, 0777);

if (!@file_exists(@amod_realpath($upload_dir))) {
if (!@file_exists(amod_realpath($upload_dir))) {
$error = true;
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />';
}
Expand Down Expand Up @@ -403,10 +403,10 @@
$filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]);

$sql = 'UPDATE ' . BB_QUOTA_LIMITS . "
SET quota_desc = '" . attach_mod_sql_escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . "
WHERE quota_limit_id = " . (int)$quota_change_list[$i];
SET quota_desc = '" . attach_mod_sql_escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . '
WHERE quota_limit_id = ' . (int)$quota_change_list[$i];

if (!(DB()->sql_query($sql))) {
if (!DB()->sql_query($sql)) {
bb_die('Could not update quota limits');
}
}
Expand Down Expand Up @@ -435,7 +435,7 @@
$quota_desc = get_var('quota_description', '');
$filesize = get_var('add_max_filesize', 0);
$size_select = get_var('add_size_select', '');
$add = (isset($_POST['add_quota_check'])) ? true : false;
$add = isset($_POST['add_quota_check']) ? true : false;

if ($quota_desc != '' && $add) {
// check Quota Description
Expand Down Expand Up @@ -464,10 +464,10 @@
if (!$error) {
$filesize = ($size_select == 'kb') ? round($filesize * 1024) : (($size_select == 'mb') ? round($filesize * 1048576) : $filesize);

$sql = "INSERT INTO " . BB_QUOTA_LIMITS . " (quota_desc, quota_limit)
VALUES ('" . attach_mod_sql_escape($quota_desc) . "', " . (int)$filesize . ")";
$sql = 'INSERT INTO ' . BB_QUOTA_LIMITS . " (quota_desc, quota_limit)
VALUES ('" . attach_mod_sql_escape($quota_desc) . "', " . (int)$filesize . ')';

if (!(DB()->sql_query($sql))) {
if (!DB()->sql_query($sql)) {
bb_die('Could not add quota limit');
}
}
Expand Down Expand Up @@ -495,7 +495,7 @@
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=quota',
));

$sql = "SELECT * FROM " . BB_QUOTA_LIMITS . " ORDER BY quota_limit DESC";
$sql = 'SELECT * FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit DESC';

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not get quota limits #1');
Expand Down Expand Up @@ -532,7 +532,7 @@

$template->assign_block_vars('switch_quota_limit_desc', array());

$sql = "SELECT * FROM " . BB_QUOTA_LIMITS . " WHERE quota_limit_id = " . (int)$quota_id . " LIMIT 1";
$sql = 'SELECT * FROM ' . BB_QUOTA_LIMITS . ' WHERE quota_limit_id = ' . (int)$quota_id . ' LIMIT 1';

if (!($result = DB()->sql_query($sql))) {
bb_die('Could not get quota limits #2');
Expand Down
29 changes: 16 additions & 13 deletions admin/admin_board.php
Expand Up @@ -39,10 +39,10 @@
'config_mods' => '<br /><br />' . sprintf($lang['CLICK_RETURN_CONFIG_MODS'], '<a href="admin_board.php?mode=config_mods">', '</a>')
);

//
// Pull all config data
//
$sql = "SELECT * FROM " . BB_CONFIG;
/**
* Pull all config data
*/
$sql = 'SELECT * FROM ' . BB_CONFIG;
if (!$result = DB()->sql_query($sql)) {
bb_die('Could not query config information in admin_board');
} else {
Expand All @@ -54,7 +54,11 @@
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name];

if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
if ($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release' || $config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') {
if ($config_name == 'seed_bonus_points' ||
$config_name == 'seed_bonus_release' ||
$config_name == 'bonus_upload' ||
$config_name == 'bonus_upload_price'
) {
$new[$config_name] = serialize(str_replace(',', '.', $new[$config_name]));
}
bb_update_config(array($config_name => $new[$config_name]));
Expand Down Expand Up @@ -92,7 +96,6 @@
'BIRTHDAY_CHECK_DAY' => $new['birthday_check_day'],
'PREMOD' => $new['premod'],
'TOR_COMMENT' => $new['tor_comment'],
'NEW_TPLS' => $new['new_tpls'],
'SEED_BONUS_ENABLED' => $new['seed_bonus_enabled'],
'SEED_BONUS_TOR_SIZE' => $new['seed_bonus_tor_size'],
'SEED_BONUS_USER_REGDATE' => $new['seed_bonus_user_regdate'],
Expand Down Expand Up @@ -138,8 +141,8 @@

'SITENAME' => htmlCHR($new['sitename']),
'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),
'DISABLE_BOARD' => ($new['board_disable']) ? true : false,
'ALLOW_AUTOLOGIN' => ($new['allow_autologin']) ? true : false,
'DISABLE_BOARD' => $new['board_disable'] ? true : false,
'ALLOW_AUTOLOGIN' => $new['allow_autologin'] ? true : false,
'AUTOLOGIN_TIME' => (int)$new['max_autologin_time'],
'MAX_POLL_OPTIONS' => $new['max_poll_options'],
'FLOOD_INTERVAL' => $new['flood_interval'],
Expand All @@ -151,12 +154,12 @@
'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => ($new['prune_enable']) ? true : false,
'ALLOW_BBCODE' => ($new['allow_bbcode']) ? true : false,
'ALLOW_SMILIES' => ($new['allow_smilies']) ? true : false,
'ALLOW_SIG' => ($new['allow_sig']) ? true : false,
'PRUNE_ENABLE' => $new['prune_enable'] ? true : false,
'ALLOW_BBCODE' => $new['allow_bbcode'] ? true : false,
'ALLOW_SMILIES' => $new['allow_smilies'] ? true : false,
'ALLOW_SIG' => $new['allow_sig'] ? true : false,
'SIG_SIZE' => $new['max_sig_chars'],
'ALLOW_NAMECHANGE' => ($new['allow_namechange']) ? true : false,
'ALLOW_NAMECHANGE' => $new['allow_namechange'] ? true : false,
'SMILIES_PATH' => $new['smilies_path'],
));
break;
Expand Down
20 changes: 13 additions & 7 deletions admin/admin_bt_forum_cfg.php
Expand Up @@ -37,9 +37,11 @@
$submit = isset($_POST['submit']);
$confirm = isset($_POST['confirm']);

$cfg = array();
$cfg = [];

// All config names with default values
/**
* All config names with default values
*/
$default_cfg_str = array(
'bt_announce_url' => 'http://demo.torrentpier.me/bt/',
);
Expand Down Expand Up @@ -82,10 +84,14 @@
'self_moderated' => 0, // Users can move theirs topic to another forum
);

// Get config
/**
* Get config
*/
$cfg = bb_get_config(BB_CONFIG, true, false);

// Submit new config
/**
* Submit new config
*/
if ($submit && $confirm) {
foreach ($db_fields_bool as $field_name => $field_def_val) {
update_table_bool(BB_FORUMS, 'forum_id', $field_name, $field_def_val);
Expand Down Expand Up @@ -113,10 +119,10 @@
set_tpl_vars_lang($db_fields_bool);

// Get Forums list
$sql = "SELECT f.*
FROM " . BB_CATEGORIES . " c, " . BB_FORUMS . " f
$sql = 'SELECT f.*
FROM ' . BB_CATEGORIES . ' c, ' . BB_FORUMS . ' f
WHERE f.cat_id = c.cat_id
ORDER BY c.cat_order, f.forum_order";
ORDER BY c.cat_order, f.forum_order';

if (!$result = DB()->sql_query($sql)) {
bb_die('Could not obtain forum names');
Expand Down