mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Starting to remove the old attachment mode
Deletions and those edits that are more or less irrelevant to major changes
This commit is contained in:
parent
e5e325df85
commit
0153e318b3
52 changed files with 31 additions and 6489 deletions
|
@ -1,479 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!empty($setmodules)) {
|
||||
$module['ATTACHMENTS']['CONTROL_PANEL'] = basename(__FILE__);
|
||||
return;
|
||||
}
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
if (($attach_config['upload_dir'][0] == '/') || (($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':'))) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = '../' . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
include ATTACH_DIR . '/includes/functions_selects.php';
|
||||
|
||||
// Init Variables
|
||||
$start = get_var('start', 0);
|
||||
$sort_order = get_var('order', 'ASC');
|
||||
$sort_order = ($sort_order == 'ASC') ? 'ASC' : 'DESC';
|
||||
$mode = get_var('mode', '');
|
||||
$view = get_var('view', '');
|
||||
$uid = isset($_POST['u_id']) ? get_var('u_id', 0) : get_var('uid', 0);
|
||||
|
||||
$view = (isset($_POST['search']) && $_POST['search']) ? 'attachments' : $view;
|
||||
|
||||
// process modes based on view
|
||||
if ($view === 'username') {
|
||||
$mode_types_text = array($lang['SORT_USERNAME'], $lang['SORT_ATTACHMENTS'], $lang['SORT_SIZE']);
|
||||
$mode_types = array('username', 'attachments', 'filesize');
|
||||
|
||||
if (!$mode) {
|
||||
$mode = 'attachments';
|
||||
$sort_order = 'DESC';
|
||||
}
|
||||
} elseif ($view === 'attachments') {
|
||||
$mode_types_text = array($lang['SORT_FILENAME'], $lang['SORT_COMMENT'], $lang['SORT_EXTENSION'], $lang['SORT_SIZE'], $lang['SORT_DOWNLOADS'], $lang['SORT_POSTTIME']);
|
||||
$mode_types = array('real_filename', 'comment', 'extension', 'filesize', 'downloads', 'post_time');
|
||||
|
||||
if (!$mode) {
|
||||
$mode = 'real_filename';
|
||||
$sort_order = 'ASC';
|
||||
}
|
||||
} elseif ($view === 'search') {
|
||||
$mode_types_text = array($lang['SORT_FILENAME'], $lang['SORT_COMMENT'], $lang['SORT_EXTENSION'], $lang['SORT_SIZE'], $lang['SORT_DOWNLOADS'], $lang['SORT_POSTTIME']);
|
||||
$mode_types = array('real_filename', 'comment', 'extension', 'filesize', 'downloads', 'post_time');
|
||||
|
||||
$sort_order = 'DESC';
|
||||
} else {
|
||||
$view = 'stats';
|
||||
$mode_types_text = array();
|
||||
$sort_order = 'ASC';
|
||||
}
|
||||
|
||||
// Pagination ?
|
||||
$do_pagination = ($view !== 'stats' && $view !== 'search');
|
||||
|
||||
// Set Order
|
||||
$order_by = '';
|
||||
|
||||
if ($view === 'username') {
|
||||
switch ($mode) {
|
||||
case 'username':
|
||||
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'attachments':
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'filesize':
|
||||
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
default:
|
||||
$mode = 'attachments';
|
||||
$sort_order = 'DESC';
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
}
|
||||
} elseif ($view === 'attachments') {
|
||||
switch ($mode) {
|
||||
case 'filename':
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'comment':
|
||||
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'extension':
|
||||
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'filesize':
|
||||
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'downloads':
|
||||
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
case 'post_time':
|
||||
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
default:
|
||||
$mode = 'a.real_filename';
|
||||
$sort_order = 'ASC';
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set select fields
|
||||
$view_types_text = array($lang['VIEW_STATISTIC'], $lang['VIEW_SEARCH']);
|
||||
$view_types = array('stats', 'search');
|
||||
|
||||
$select_view = '<select name="view">';
|
||||
|
||||
for ($i = 0, $iMax = count($view_types_text); $i < $iMax; $i++) {
|
||||
$selected = ($view === $view_types[$i]) ? ' selected="selected"' : '';
|
||||
$select_view .= '<option value="' . $view_types[$i] . '"' . $selected . '>' . $view_types_text[$i] . '</option>';
|
||||
}
|
||||
$select_view .= '</select>';
|
||||
|
||||
if (count($mode_types_text) > 0) {
|
||||
$select_sort_mode = '<select name="mode">';
|
||||
|
||||
for ($i = 0, $iMax = count($mode_types_text); $i < $iMax; $i++) {
|
||||
$selected = ($mode === $mode_types[$i]) ? ' selected="selected"' : '';
|
||||
$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
|
||||
}
|
||||
$select_sort_mode .= '</select>';
|
||||
}
|
||||
|
||||
$select_sort_order = '<select name="order">';
|
||||
if ($sort_order === 'ASC') {
|
||||
$select_sort_order .= '<option value="ASC" selected="selected">' . $lang['ASC'] . '</option><option value="DESC">' . $lang['DESC'] . '</option>';
|
||||
} else {
|
||||
$select_sort_order .= '<option value="ASC">' . $lang['ASC'] . '</option><option value="DESC" selected="selected">' . $lang['DESC'] . '</option>';
|
||||
}
|
||||
$select_sort_order .= '</select>';
|
||||
|
||||
$submit_change = isset($_POST['submit_change']);
|
||||
$delete = isset($_POST['delete']);
|
||||
$delete_id_list = get_var('delete_id_list', array(0));
|
||||
|
||||
$confirm = isset($_POST['confirm']);
|
||||
|
||||
if ($confirm && count($delete_id_list) > 0) {
|
||||
$attachments = array();
|
||||
|
||||
delete_attachment(0, $delete_id_list);
|
||||
} elseif ($delete && count($delete_id_list) > 0) {
|
||||
// Not confirmed, show confirmation message
|
||||
$hidden_fields = '<input type="hidden" name="view" value="' . $view . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="order" value="' . $sort_order . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="u_id" value="' . $uid . '" />';
|
||||
$hidden_fields .= '<input type="hidden" name="start" value="' . $start . '" />';
|
||||
|
||||
foreach ($delete_id_list as $iValue) {
|
||||
$hidden_fields .= '<input type="hidden" name="delete_id_list[]" value="' . $iValue . '" />';
|
||||
}
|
||||
|
||||
print_confirmation(array(
|
||||
'FORM_ACTION' => 'admin_attach_cp.php',
|
||||
'HIDDEN_FIELDS' => $hidden_fields,
|
||||
));
|
||||
}
|
||||
|
||||
// Assign Default Template Vars
|
||||
$template->assign_vars(array(
|
||||
'S_VIEW_SELECT' => $select_view,
|
||||
'S_MODE_ACTION' => 'admin_attach_cp.php',
|
||||
));
|
||||
|
||||
if ($submit_change && $view === 'attachments') {
|
||||
$attach_change_list = get_var('attach_id_list', array(0));
|
||||
$attach_comment_list = get_var('attach_comment_list', array(''));
|
||||
$attach_download_count_list = get_var('attach_count_list', array(0));
|
||||
|
||||
// Generate correct Change List
|
||||
$attachments = array();
|
||||
|
||||
for ($i = 0, $iMax = count($attach_change_list); $i < $iMax; $i++) {
|
||||
$attachments['_' . $attach_change_list[$i]]['comment'] = $attach_comment_list[$i];
|
||||
$attachments['_' . $attach_change_list[$i]]['download_count'] = $attach_download_count_list[$i];
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . BB_ATTACHMENTS_DESC . '
|
||||
ORDER BY attach_id';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get attachment informations');
|
||||
}
|
||||
|
||||
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'];
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not update attachments informations');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Statistics
|
||||
if ($view == 'stats') {
|
||||
$upload_dir_size = get_formatted_dirsize();
|
||||
|
||||
$attachment_quota = humn_size($attach_config['attachment_quota']);
|
||||
|
||||
// number_of_attachments
|
||||
$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');
|
||||
$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');
|
||||
$number_of_users = $row['users'];
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_STATISTICS' => true,
|
||||
'TOTAL_FILESIZE' => $upload_dir_size,
|
||||
'ATTACH_QUOTA' => $attachment_quota,
|
||||
'NUMBER_OF_ATTACHMENTS' => $number_of_attachments,
|
||||
'NUMBER_OF_POSTS' => $number_of_posts,
|
||||
'NUMBER_OF_PMS' => $number_of_pms,
|
||||
'NUMBER_OF_TOPICS' => $number_of_topics,
|
||||
'NUMBER_OF_USERS' => $number_of_users,
|
||||
));
|
||||
}
|
||||
|
||||
// Search
|
||||
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
|
||||
WHERE f.cat_id = c.cat_id
|
||||
ORDER BY c.cat_id, f.forum_order';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain forum_name / forum_id');
|
||||
}
|
||||
|
||||
$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>';
|
||||
|
||||
if (empty($list_cat[$row['cat_id']])) {
|
||||
$list_cat[$row['cat_id']] = $row['cat_title'];
|
||||
}
|
||||
}
|
||||
|
||||
$s_categories = '';
|
||||
if ($s_forums) {
|
||||
$s_forums = '<option value="0">' . $lang['ALL_AVAILABLE'] . '</option>' . $s_forums;
|
||||
|
||||
// Category to search
|
||||
$s_categories = '<option value="0">' . $lang['ALL_AVAILABLE'] . '</option>';
|
||||
|
||||
foreach ($list_cat as $cat_id => $cat_title) {
|
||||
$s_categories .= '<option value="' . $cat_id . '">' . htmlCHR($cat_title) . '</option>';
|
||||
}
|
||||
} else {
|
||||
bb_die($lang['NO_SEARCHABLE_FORUMS']);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_SEARCH' => true,
|
||||
'S_FORUM_OPTIONS' => $s_forums,
|
||||
'S_CATEGORY_OPTIONS' => $s_categories,
|
||||
'S_SORT_OPTIONS' => $select_sort_mode,
|
||||
'S_SORT_ORDER' => $select_sort_order,
|
||||
));
|
||||
}
|
||||
|
||||
// Username
|
||||
if ($view === 'username') {
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_USER' => true,
|
||||
'S_MODE_SELECT' => $select_sort_mode,
|
||||
'S_ORDER_SELECT' => $select_sort_order,
|
||||
));
|
||||
$total_rows = 0;
|
||||
bb_die('removed');
|
||||
}
|
||||
|
||||
// Attachments
|
||||
if ($view === 'attachments') {
|
||||
$user_based = $uid ? true : false;
|
||||
$search_based = (isset($_POST['search']) && $_POST['search']);
|
||||
|
||||
$hidden_fields = '';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_ATTACHMENTS' => true,
|
||||
'S_MODE_SELECT' => $select_sort_mode,
|
||||
'S_ORDER_SELECT' => $select_sort_order,
|
||||
));
|
||||
|
||||
$total_rows = 0;
|
||||
|
||||
// Are we called from Username ?
|
||||
if ($user_based) {
|
||||
$sql = 'SELECT username FROM ' . BB_USERS . ' WHERE user_id = ' . (int)$uid;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Error getting username');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
$username = $row['username'];
|
||||
|
||||
$s_hidden = '<input type="hidden" name="u_id" value="' . (int)$uid . '" />';
|
||||
|
||||
$template->assign_block_vars('switch_user_based', array());
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_USER_HIDDEN' => $s_hidden,
|
||||
'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';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachments #1');
|
||||
}
|
||||
|
||||
$attach_ids = DB()->sql_fetchrowset($result);
|
||||
$num_attach_ids = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_attach_ids == 0) {
|
||||
bb_die('For some reason no attachments are assigned to the user ' . $username);
|
||||
}
|
||||
|
||||
$total_rows = $num_attach_ids;
|
||||
|
||||
$attach_id = array();
|
||||
|
||||
for ($j = 0; $j < $num_attach_ids; $j++) {
|
||||
$attach_id[] = (int)$attach_ids[$j]['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))) {
|
||||
bb_die('Could not query attachments #2');
|
||||
}
|
||||
|
||||
$attachments = DB()->sql_fetchrowset($result);
|
||||
$num_attach = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
} else {
|
||||
// we are called from search
|
||||
$attachments = search_attachments($order_by, $total_rows);
|
||||
}
|
||||
|
||||
if (count($attachments) > 0) {
|
||||
for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) {
|
||||
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
|
||||
|
||||
foreach ($delete_id_list as $jValue) {
|
||||
if ($jValue == $attachments[$i]['attach_id']) {
|
||||
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" checked="checked" />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$row_class = !($i % 2) ? 'row1' : 'row2';
|
||||
|
||||
// Is the Attachment assigned to more than one post ?
|
||||
// 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'];
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachments #3');
|
||||
}
|
||||
|
||||
$ids = DB()->sql_fetchrowset($result);
|
||||
$num_ids = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
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';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query topic');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
$post_title = $row['topic_title'];
|
||||
|
||||
if (strlen($post_title) > 32) {
|
||||
$post_title = str_short($post_title, 30);
|
||||
}
|
||||
|
||||
$view_topic = BB_ROOT . 'viewtopic.php?' . POST_POST_URL . '=' . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id'];
|
||||
|
||||
$post_titles[] = '<a href="' . $view_topic . '" class="gen" target="_blank">' . $post_title . '</a>';
|
||||
} else {
|
||||
$post_titles[] = $lang['PRIVATE_MESSAGE'];
|
||||
}
|
||||
}
|
||||
|
||||
$post_titles = implode('<br />', $post_titles);
|
||||
|
||||
$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_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),
|
||||
'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
|
||||
'POST_TIME' => bb_date($attachments[$i]['filetime']),
|
||||
'POST_TITLE' => $post_titles,
|
||||
|
||||
'S_DELETE_BOX' => $delete_box,
|
||||
'S_HIDDEN' => $hidden_field,
|
||||
'U_VIEW_ATTACHMENT' => BB_ROOT . DL_URL . $attachments[$i]['attach_id'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$search_based && !$user_based) {
|
||||
if (!$attachments) {
|
||||
$sql = 'SELECT attach_id FROM ' . BB_ATTACHMENTS_DESC;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachment description table');
|
||||
}
|
||||
|
||||
$total_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Pagination
|
||||
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
|
||||
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start);
|
||||
}
|
||||
|
||||
print_page('admin_attach_cp.tpl', 'admin');
|
|
@ -1,597 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!empty($setmodules)) {
|
||||
$filename = basename(__FILE__);
|
||||
$module['ATTACHMENTS']['MANAGE'] = $filename . '?mode=manage';
|
||||
$module['ATTACHMENTS']['SPECIAL_CATEGORIES'] = $filename . '?mode=cats';
|
||||
$module['ATTACHMENTS']['QUOTA_LIMITS'] = $filename . '?mode=quota';
|
||||
return;
|
||||
}
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
$error = false;
|
||||
|
||||
if (($attach_config['upload_dir'][0] == '/') || (($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':'))) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = '../' . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
include ATTACH_DIR . '/includes/functions_selects.php';
|
||||
|
||||
// Init Vars
|
||||
$mode = request_var('mode', '');
|
||||
$e_mode = request_var('e_mode', '');
|
||||
$size = request_var('size', '');
|
||||
$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;
|
||||
|
||||
// Re-evaluate the Attachment Configuration
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not find attachment config table #1');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$config_name = $row['config_name'];
|
||||
$config_value = $row['config_value'];
|
||||
|
||||
$new_attach[$config_name] = get_var($config_name, trim($attach_config[$config_name]));
|
||||
|
||||
if (!$size && !$submit && $config_name == 'max_filesize') {
|
||||
$size = ($attach_config[$config_name] >= 1048576) ? 'mb' : (($attach_config[$config_name] >= 1024) ? 'kb' : 'b');
|
||||
}
|
||||
|
||||
if (!$quota_size && !$submit && $config_name == 'attachment_quota') {
|
||||
$quota_size = ($attach_config[$config_name] >= 1048576) ? 'mb' : (($attach_config[$config_name] >= 1024) ? 'kb' : 'b');
|
||||
}
|
||||
|
||||
if (!$pm_size && !$submit && $config_name == 'max_filesize_pm') {
|
||||
$pm_size = ($attach_config[$config_name] >= 1048576) ? 'mb' : (($attach_config[$config_name] >= 1024) ? 'kb' : 'b');
|
||||
}
|
||||
|
||||
if (!$submit && ($config_name == 'max_filesize' || $config_name == 'attachment_quota' || $config_name == 'max_filesize_pm')) {
|
||||
if ($new_attach[$config_name] >= 1048576) {
|
||||
$new_attach[$config_name] = round($new_attach[$config_name] / 1048576 * 100) / 100;
|
||||
} elseif ($new_attach[$config_name] >= 1024) {
|
||||
$new_attach[$config_name] = round($new_attach[$config_name] / 1024 * 100) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if ($submit && ($mode == 'manage' || $mode == 'cats')) {
|
||||
if ($config_name == 'max_filesize') {
|
||||
$old = $new_attach[$config_name];
|
||||
$new_attach[$config_name] = ($size == 'kb') ? round($new_attach[$config_name] * 1024) : (($size == 'mb') ? round($new_attach[$config_name] * 1048576) : $new_attach[$config_name]);
|
||||
}
|
||||
|
||||
if ($config_name == 'attachment_quota') {
|
||||
$old = $new_attach[$config_name];
|
||||
$new_attach[$config_name] = ($quota_size == 'kb') ? round($new_attach[$config_name] * 1024) : (($quota_size == 'mb') ? round($new_attach[$config_name] * 1048576) : $new_attach[$config_name]);
|
||||
}
|
||||
|
||||
if ($config_name == 'max_filesize_pm') {
|
||||
$old = $new_attach[$config_name];
|
||||
$new_attach[$config_name] = ($pm_size == 'kb') ? round($new_attach[$config_name] * 1024) : (($pm_size == 'mb') ? round($new_attach[$config_name] * 1048576) : $new_attach[$config_name]);
|
||||
}
|
||||
|
||||
if ($config_name == 'max_filesize') {
|
||||
$old_size = $attach_config[$config_name];
|
||||
$new_size = $new_attach[$config_name];
|
||||
|
||||
if ($old_size != $new_size) {
|
||||
// See, if we have a similar value of old_size in Mime Groups. If so, update these values.
|
||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . '
|
||||
SET max_filesize = ' . (int)$new_size . '
|
||||
WHERE max_filesize = ' . (int)$old_size;
|
||||
|
||||
if (!($result_2 = DB()->sql_query($sql))) {
|
||||
bb_die('Could not update extension group information');
|
||||
}
|
||||
}
|
||||
|
||||
$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 . "
|
||||
SET config_value = '" . attach_mod_sql_escape($new_attach[$config_name]) . "'
|
||||
WHERE config_name = '" . attach_mod_sql_escape($config_name) . "'";
|
||||
}
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Failed to update attachment configuration for ' . $config_name);
|
||||
}
|
||||
|
||||
if ($config_name == 'max_filesize' || $config_name == 'attachment_quota' || $config_name == 'max_filesize_pm') {
|
||||
$new_attach[$config_name] = $old;
|
||||
}
|
||||
}
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
// Clear cached config
|
||||
CACHE('bb_cache')->rm('attach_config');
|
||||
|
||||
$select_size_mode = size_select('size', $size);
|
||||
$select_quota_size_mode = size_select('quota_size', $quota_size);
|
||||
$select_pm_size_mode = size_select('pm_size', $pm_size);
|
||||
|
||||
// Search Imagick
|
||||
if ($search_imagick) {
|
||||
$imagick = '';
|
||||
|
||||
if (false !== stripos($imagick, "convert")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($imagick != 'none') {
|
||||
if (!false !== stripos(PHP_OS, "WIN")) {
|
||||
$retval = @exec('whereis convert');
|
||||
$paths = explode(' ', $retval);
|
||||
|
||||
if (is_array($paths)) {
|
||||
foreach ($paths as $i => $iValue) {
|
||||
$path = basename($paths[$i]);
|
||||
|
||||
if ($path == 'convert') {
|
||||
$imagick = $iValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (false !== stripos(PHP_OS, "WIN")) {
|
||||
$path = 'c:/imagemagick/convert.exe';
|
||||
|
||||
if (!@file_exists(amod_realpath($path))) {
|
||||
$imagick = $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!@file_exists(amod_realpath(trim($imagick)))) {
|
||||
$new_attach['img_imagick'] = trim($imagick);
|
||||
} else {
|
||||
$new_attach['img_imagick'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Check Settings
|
||||
if ($check_upload) {
|
||||
// Some tests...
|
||||
$attach_config = array();
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not find attachment config table #2');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
$attach_config[$row[$i]['config_name']] = trim($row[$i]['config_value']);
|
||||
}
|
||||
|
||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
$error = false;
|
||||
|
||||
// Does the target directory exist, is it a directory and writeable
|
||||
if (!@file_exists(amod_realpath($upload_dir))) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $attach_config['upload_dir']) . '<br />';
|
||||
}
|
||||
|
||||
if (!$error && !is_dir($upload_dir)) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_IS_NOT_A_DIR'], $attach_config['upload_dir']) . '<br />';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $attach_config['upload_dir']) . '<br />';
|
||||
} else {
|
||||
@fclose($fp);
|
||||
unlink_attach($upload_dir . '/0_000000.000');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
bb_die($lang['TEST_SETTINGS_SUCCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_attachments.php?mode=manage">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
// Management
|
||||
if ($submit && $mode == 'manage') {
|
||||
if (!$error) {
|
||||
bb_die($lang['ATTACH_CONFIG_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_attachments.php?mode=manage">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'manage') {
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_MANAGE' => true,
|
||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=manage',
|
||||
'S_FILESIZE' => $select_size_mode,
|
||||
'S_FILESIZE_QUOTA' => $select_quota_size_mode,
|
||||
'S_FILESIZE_PM' => $select_pm_size_mode,
|
||||
'S_DEFAULT_UPLOAD_LIMIT' => default_quota_limit_select('default_upload_quota', (int)trim($new_attach['default_upload_quota'])),
|
||||
'S_DEFAULT_PM_LIMIT' => default_quota_limit_select('default_pm_quota', (int)trim($new_attach['default_pm_quota'])),
|
||||
|
||||
'UPLOAD_DIR' => $new_attach['upload_dir'],
|
||||
'ATTACHMENT_IMG_PATH' => $new_attach['upload_img'],
|
||||
'TOPIC_ICON' => $new_attach['topic_icon'],
|
||||
'MAX_FILESIZE' => $new_attach['max_filesize'],
|
||||
'ATTACHMENT_QUOTA' => $new_attach['attachment_quota'],
|
||||
'MAX_FILESIZE_PM' => $new_attach['max_filesize_pm'],
|
||||
'MAX_ATTACHMENTS' => $new_attach['max_attachments'],
|
||||
'MAX_ATTACHMENTS_PM' => $new_attach['max_attachments_pm'],
|
||||
'DISABLE_MOD_YES' => $new_attach['disable_mod'] !== '0' ? 'checked="checked"' : '',
|
||||
'DISABLE_MOD_NO' => $new_attach['disable_mod'] === '0' ? 'checked="checked"' : '',
|
||||
'PM_ATTACH_YES' => $new_attach['allow_pm_attach'] !== '0' ? 'checked="checked"' : '',
|
||||
'PM_ATTACH_NO' => $new_attach['allow_pm_attach'] === '0' ? 'checked="checked"' : '',
|
||||
'DISPLAY_ORDER_ASC' => $new_attach['display_order'] !== '0' ? 'checked="checked"' : '',
|
||||
'DISPLAY_ORDER_DESC' => $new_attach['display_order'] === '0' ? 'checked="checked"' : '',
|
||||
));
|
||||
}
|
||||
|
||||
if ($submit && $mode == 'cats') {
|
||||
if (!$error) {
|
||||
bb_die($lang['ATTACH_CONFIG_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_attachments.php?mode=cats">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'cats') {
|
||||
$s_assigned_group_images = $lang['NONE'];
|
||||
|
||||
$sql = 'SELECT group_name, cat_id FROM ' . BB_EXTENSION_GROUPS . ' WHERE cat_id > 0 ORDER BY cat_id';
|
||||
|
||||
$s_assigned_group_images = array();
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get group names from ' . BB_EXTENSION_GROUPS);
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0, $iMax = count($row); $i < $iMax; $i++) {
|
||||
if ($row[$i]['cat_id'] == IMAGE_CAT) {
|
||||
$s_assigned_group_images[] = $row[$i]['group_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$display_inlined_yes = ($new_attach['img_display_inlined'] != '0') ? 'checked="checked"' : '';
|
||||
$display_inlined_no = ($new_attach['img_display_inlined'] == '0') ? 'checked="checked"' : '';
|
||||
|
||||
$create_thumbnail_yes = ($new_attach['img_create_thumbnail'] != '0') ? 'checked="checked"' : '';
|
||||
$create_thumbnail_no = ($new_attach['img_create_thumbnail'] == '0') ? 'checked="checked"' : '';
|
||||
|
||||
$use_gd2_yes = ($new_attach['use_gd2'] != '0') ? 'checked="checked"' : '';
|
||||
$use_gd2_no = ($new_attach['use_gd2'] == '0') ? 'checked="checked"' : '';
|
||||
|
||||
// Check Thumbnail Support
|
||||
if (!is_imagick() && !@extension_loaded('gd')) {
|
||||
$new_attach['img_create_thumbnail'] = '0';
|
||||
} else {
|
||||
$template->assign_block_vars('switch_thumbnail_support', array());
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_SPECIAL_CATEGORIES' => true,
|
||||
'IMAGE_MAX_HEIGHT' => $new_attach['img_max_height'],
|
||||
'IMAGE_MAX_WIDTH' => $new_attach['img_max_width'],
|
||||
'IMAGE_LINK_HEIGHT' => $new_attach['img_link_height'],
|
||||
'IMAGE_LINK_WIDTH' => $new_attach['img_link_width'],
|
||||
'IMAGE_MIN_THUMB_FILESIZE' => $new_attach['img_min_thumb_filesize'],
|
||||
'IMAGE_IMAGICK_PATH' => $new_attach['img_imagick'],
|
||||
'DISPLAY_INLINED_YES' => $display_inlined_yes,
|
||||
'DISPLAY_INLINED_NO' => $display_inlined_no,
|
||||
'CREATE_THUMBNAIL_YES' => $create_thumbnail_yes,
|
||||
'CREATE_THUMBNAIL_NO' => $create_thumbnail_no,
|
||||
'USE_GD2_YES' => $use_gd2_yes,
|
||||
'USE_GD2_NO' => $use_gd2_no,
|
||||
'S_ASSIGNED_GROUP_IMAGES' => implode(', ', $s_assigned_group_images),
|
||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=cats',
|
||||
));
|
||||
}
|
||||
|
||||
// Check Cat Settings
|
||||
if ($check_image_cat) {
|
||||
// Some tests...
|
||||
$attach_config = array();
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not find attachment config table #3');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
$attach_config[$row[$i]['config_name']] = trim($row[$i]['config_value']);
|
||||
}
|
||||
|
||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
$upload_dir = $upload_dir . '/' . THUMB_DIR;
|
||||
|
||||
$error = false;
|
||||
|
||||
// Does the target directory exist, is it a directory and writeable
|
||||
if (!@file_exists(amod_realpath($upload_dir))) {
|
||||
if (!mkdir($upload_dir, 0755) && !is_dir($upload_dir)) {
|
||||
throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
|
||||
}
|
||||
@chmod($upload_dir, 0777);
|
||||
|
||||
if (!@file_exists(amod_realpath($upload_dir))) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !is_dir($upload_dir)) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_IS_NOT_A_DIR'], $upload_dir) . '<br />';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
|
||||
$error = true;
|
||||
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $upload_dir) . '<br />';
|
||||
} else {
|
||||
@fclose($fp);
|
||||
@unlink($upload_dir . '/0_000000.000');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
bb_die($lang['TEST_SETTINGS_SUCCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_attachments.php?mode=cats">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
// Quota Limit Settings
|
||||
if ($submit && $mode == 'quota') {
|
||||
// Change Quota Limit
|
||||
$quota_change_list = get_var('quota_change_list', array(0));
|
||||
$quota_desc_list = get_var('quota_desc_list', array(''));
|
||||
$filesize_list = get_var('max_filesize_list', array(0));
|
||||
$size_select_list = get_var('size_select_list', array(''));
|
||||
|
||||
$allowed_list = array();
|
||||
|
||||
for ($i = 0, $iMax = count($quota_change_list); $i < $iMax; $i++) {
|
||||
$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];
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not update quota limits');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Quota Limits
|
||||
$quota_id_list = get_var('quota_id_list', array(0));
|
||||
|
||||
$quota_id_sql = implode(', ', $quota_id_list);
|
||||
|
||||
if ($quota_id_sql != '') {
|
||||
$sql = 'DELETE FROM ' . BB_QUOTA_LIMITS . ' WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not delete quota limits');
|
||||
}
|
||||
|
||||
// Delete Quotas linked to this setting
|
||||
$sql = 'DELETE FROM ' . BB_QUOTA . ' WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not delete quotas');
|
||||
}
|
||||
}
|
||||
|
||||
// Add Quota Limit ?
|
||||
$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;
|
||||
|
||||
if ($quota_desc != '' && $add) {
|
||||
// check Quota Description
|
||||
$sql = 'SELECT quota_desc FROM ' . BB_QUOTA_LIMITS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query quota limits table');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if ($row[$i]['quota_desc'] == $quota_desc) {
|
||||
$error = true;
|
||||
if (isset($error_msg)) {
|
||||
$error_msg .= '<br />';
|
||||
}
|
||||
$error_msg .= sprintf($lang['QUOTA_LIMIT_EXIST'], $extension_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 . ')';
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not add quota limit');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
bb_die($lang['ATTACH_CONFIG_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_attachments.php?mode=quota">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'quota') {
|
||||
$max_add_filesize = $attach_config['max_filesize'];
|
||||
$size = ($max_add_filesize >= 1048576) ? 'mb' : (($max_add_filesize >= 1024) ? 'kb' : 'b');
|
||||
|
||||
if ($max_add_filesize >= 1048576) {
|
||||
$max_add_filesize = round($max_add_filesize / 1048576 * 100) / 100;
|
||||
} elseif ($max_add_filesize >= 1024) {
|
||||
$max_add_filesize = round($max_add_filesize / 1024 * 100) / 100;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_QUOTA' => true,
|
||||
'MAX_FILESIZE' => $max_add_filesize,
|
||||
'S_FILESIZE' => size_select('add_size_select', $size),
|
||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=quota',
|
||||
));
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
$rows = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0, $iMax = count($rows); $i < $iMax; $i++) {
|
||||
$size_format = ($rows[$i]['quota_limit'] >= 1048576) ? 'mb' : (($rows[$i]['quota_limit'] >= 1024) ? 'kb' : 'b');
|
||||
|
||||
if ($rows[$i]['quota_limit'] >= 1048576) {
|
||||
$rows[$i]['quota_limit'] = round($rows[$i]['quota_limit'] / 1048576 * 100) / 100;
|
||||
} elseif ($rows[$i]['quota_limit'] >= 1024) {
|
||||
$rows[$i]['quota_limit'] = round($rows[$i]['quota_limit'] / 1024 * 100) / 100;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('limit_row', array(
|
||||
'QUOTA_NAME' => $rows[$i]['quota_desc'],
|
||||
'QUOTA_ID' => $rows[$i]['quota_limit_id'],
|
||||
'S_FILESIZE' => size_select('size_select_list[]', $size_format),
|
||||
'U_VIEW' => "admin_attachments.php?mode=$mode&e_mode=view_quota&quota_id=" . $rows[$i]['quota_limit_id'],
|
||||
'MAX_FILESIZE' => $rows[$i]['quota_limit'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'quota' && $e_mode == 'view_quota') {
|
||||
$quota_id = get_var('quota_id', 0);
|
||||
|
||||
if (!$quota_id) {
|
||||
bb_die('Invalid call');
|
||||
}
|
||||
|
||||
$template->assign_block_vars('switch_quota_limit_desc', array());
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_QUOTA_LIMIT_DESC' => $row['quota_desc'],
|
||||
));
|
||||
|
||||
$sql = 'SELECT q.user_id, u.username, q.quota_type
|
||||
FROM ' . BB_QUOTA . ' q, ' . BB_USERS . ' u
|
||||
WHERE q.quota_limit_id = ' . (int)$quota_id . '
|
||||
AND q.user_id <> 0
|
||||
AND q.user_id = u.user_id';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get quota limits #3');
|
||||
}
|
||||
|
||||
$rows = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if ($rows[$i]['quota_type'] == QUOTA_UPLOAD_LIMIT) {
|
||||
$template->assign_block_vars('users_upload_row', array(
|
||||
'USER_ID' => $rows[$i]['user_id'],
|
||||
'USERNAME' => $rows[$i]['username'],
|
||||
));
|
||||
} elseif ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT) {
|
||||
$template->assign_block_vars('users_pm_row', array(
|
||||
'USER_ID' => $rows[$i]['user_id'],
|
||||
'USERNAME' => $rows[$i]['username'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT q.group_id, g.group_name, q.quota_type
|
||||
FROM ' . BB_QUOTA . ' q, ' . BB_GROUPS . ' g
|
||||
WHERE q.quota_limit_id = ' . (int)$quota_id . '
|
||||
AND q.group_id <> 0
|
||||
AND q.group_id = g.group_id';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get quota limits #4');
|
||||
}
|
||||
|
||||
$rows = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if ($rows[$i]['quota_type'] == QUOTA_UPLOAD_LIMIT) {
|
||||
$template->assign_block_vars('groups_upload_row', array(
|
||||
'GROUP_ID' => $rows[$i]['group_id'],
|
||||
'GROUPNAME' => $rows[$i]['group_name'],
|
||||
));
|
||||
} elseif ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT) {
|
||||
$template->assign_block_vars('groups_pm_row', array(
|
||||
'GROUP_ID' => $rows[$i]['group_id'],
|
||||
'GROUPNAME' => $rows[$i]['group_name'],
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
|
||||
}
|
||||
|
||||
print_page('admin_attachments.tpl', 'admin');
|
|
@ -1,672 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!empty($setmodules)) {
|
||||
$filename = basename(__FILE__);
|
||||
$module['ATTACHMENTS']['EXTENSION_CONTROL'] = $filename . '?mode=extensions';
|
||||
$module['ATTACHMENTS']['EXTENSION_GROUP_MANAGE'] = $filename . '?mode=groups';
|
||||
return;
|
||||
}
|
||||
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
function update_attach_extensions()
|
||||
{
|
||||
$GLOBALS['datastore']->update('attach_extensions');
|
||||
}
|
||||
|
||||
register_shutdown_function('update_attach_extensions');
|
||||
|
||||
if (($attach_config['upload_dir'][0] == '/') || (($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':'))) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
include ATTACH_DIR . '/includes/functions_selects.php';
|
||||
|
||||
// Init Vars
|
||||
$types_download = array(INLINE_LINK, PHYSICAL_LINK);
|
||||
$modes_download = array('inline', 'physical');
|
||||
|
||||
$types_category = array(IMAGE_CAT);
|
||||
$modes_category = array($lang['CATEGORY_IMAGES']);
|
||||
|
||||
$size = get_var('size', '');
|
||||
$mode = get_var('mode', '');
|
||||
$e_mode = get_var('e_mode', '');
|
||||
|
||||
$error = false;
|
||||
$add_forum = isset($_POST['add_forum']) ? true : false;
|
||||
$delete_forum = isset($_POST['del_forum']) ? true : false;
|
||||
$submit = isset($_POST['submit']) ? true : false;
|
||||
|
||||
// Get Attachment Config
|
||||
$attach_config = array();
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachment information');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$attach_config[$row['config_name']] = trim($row['config_value']);
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
// Extension Management
|
||||
if ($submit && $mode == 'extensions') {
|
||||
// Change Extensions ?
|
||||
$extension_change_list = get_var('extension_change_list', array(0));
|
||||
$extension_explain_list = get_var('extension_explain_list', array(''));
|
||||
$group_select_list = get_var('group_select', array(0));
|
||||
|
||||
// Generate correct Change List
|
||||
$extensions = array();
|
||||
|
||||
for ($i = 0, $iMax = count($extension_change_list); $i < $iMax; $i++) {
|
||||
$extensions['_' . $extension_change_list[$i]]['comment'] = $extension_explain_list[$i];
|
||||
$extensions['_' . $extension_change_list[$i]]['group_id'] = (int)$group_select_list[$i];
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_EXTENSIONS . ' ORDER BY ext_id';
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get extension informations #1');
|
||||
}
|
||||
|
||||
$num_rows = DB()->num_rows($result);
|
||||
$extension_row = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
for ($i = 0, $iMax = count($extension_row); $i < $iMax; $i++) {
|
||||
if ($extension_row[$i]['comment'] != $extensions['_' . $extension_row[$i]['ext_id']]['comment'] || (int)$extension_row[$i]['group_id'] != (int)$extensions['_' . $extension_row[$i]['ext_id']]['group_id']) {
|
||||
$sql_ary = array(
|
||||
'comment' => (string)$extensions['_' . $extension_row[$i]['ext_id']]['comment'],
|
||||
'group_id' => (int)$extensions['_' . $extension_row[$i]['ext_id']]['group_id']
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . BB_EXTENSIONS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE ext_id = ' . (int)$extension_row[$i]['ext_id'];
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not update extension informations');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Extension?
|
||||
$extension_id_list = get_var('extension_id_list', array(0));
|
||||
|
||||
$extension_id_sql = implode(', ', $extension_id_list);
|
||||
|
||||
if ($extension_id_sql != '') {
|
||||
$sql = 'DELETE FROM ' . BB_EXTENSIONS . ' WHERE ext_id IN (' . $extension_id_sql . ')';
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not delete extensions');
|
||||
}
|
||||
}
|
||||
|
||||
// Add Extension ?
|
||||
$extension = get_var('add_extension', '');
|
||||
$extension_explain = get_var('add_extension_explain', '');
|
||||
$extension_group = get_var('add_group_select', 0);
|
||||
$add = isset($_POST['add_extension_check']) ? true : false;
|
||||
|
||||
if ($extension != '' && $add) {
|
||||
$template->assign_vars(array(
|
||||
'ADD_EXTENSION' => $extension,
|
||||
'ADD_EXTENSION_EXPLAIN' => $extension_explain,
|
||||
));
|
||||
|
||||
if (!$error) {
|
||||
// check extension
|
||||
$sql = 'SELECT extension FROM ' . BB_EXTENSIONS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query extensions');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if (strtolower(trim($row[$i]['extension'])) == strtolower(trim($extension))) {
|
||||
$error = true;
|
||||
if (isset($error_msg)) {
|
||||
$error_msg .= '<br />';
|
||||
}
|
||||
$error_msg .= sprintf($lang['EXTENSION_EXIST'], strtolower(trim($extension)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql_ary = array(
|
||||
'group_id' => (int)$extension_group,
|
||||
'extension' => (string)strtolower($extension),
|
||||
'comment' => (string)$extension_explain
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . BB_EXTENSIONS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not add extension');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
bb_die($lang['ATTACH_CONFIG_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_extensions.php?mode=extensions">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'extensions') {
|
||||
// Extensions
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_EXTENSIONS' => true,
|
||||
'S_CANCEL_ACTION' => 'admin_extensions.php?mode=extensions',
|
||||
'S_ATTACH_ACTION' => 'admin_extensions.php?mode=extensions',
|
||||
));
|
||||
|
||||
if ($submit) {
|
||||
$template->assign_vars(array(
|
||||
'S_ADD_GROUP_SELECT' => group_select('add_group_select', $extension_group))
|
||||
);
|
||||
} else {
|
||||
$template->assign_vars(array(
|
||||
'S_ADD_GROUP_SELECT' => group_select('add_group_select'))
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_EXTENSIONS . ' ORDER BY group_id';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get extension informations #2');
|
||||
}
|
||||
|
||||
$extension_row = DB()->sql_fetchrowset($result);
|
||||
$num_extension_row = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_extension_row > 0) {
|
||||
$extension_row = sort_multi_array($extension_row, 'extension');
|
||||
|
||||
for ($i = 0; $i < $num_extension_row; $i++) {
|
||||
if ($submit) {
|
||||
$template->assign_block_vars('extension_row', array(
|
||||
'EXT_ID' => $extension_row[$i]['ext_id'],
|
||||
'EXTENSION' => $extension_row[$i]['extension'],
|
||||
'EXTENSION_EXPLAIN' => $extension_explain_list[$i],
|
||||
'S_GROUP_SELECT' => group_select('group_select[]', $group_select_list[$i]))
|
||||
);
|
||||
} else {
|
||||
$template->assign_block_vars('extension_row', array(
|
||||
'EXT_ID' => $extension_row[$i]['ext_id'],
|
||||
'EXTENSION' => $extension_row[$i]['extension'],
|
||||
'EXTENSION_EXPLAIN' => $extension_row[$i]['comment'],
|
||||
'S_GROUP_SELECT' => group_select('group_select[]', $extension_row[$i]['group_id']))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extension Groups
|
||||
if ($submit && $mode == 'groups') {
|
||||
// Change Extension Groups ?
|
||||
$group_change_list = get_var('group_change_list', array(0));
|
||||
$extension_group_list = get_var('extension_group_list', array(''));
|
||||
$group_allowed_list = get_var('allowed_list', array(0));
|
||||
$download_mode_list = get_var('download_mode_list', array(0));
|
||||
$category_list = get_var('category_list', array(0));
|
||||
$upload_icon_list = get_var('upload_icon_list', array(''));
|
||||
$filesize_list = get_var('max_filesize_list', array(0));
|
||||
$size_select_list = get_var('size_select_list', array(''));
|
||||
|
||||
$allowed_list = array();
|
||||
|
||||
foreach ($group_allowed_list as $iValue) {
|
||||
for ($j = 0, $jMax = count($group_change_list); $j < $jMax; $j++) {
|
||||
if ($iValue == $group_change_list[$j]) {
|
||||
$allowed_list[$j] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0, $iMax = count($group_change_list); $i < $iMax; $i++) {
|
||||
$allowed = isset($allowed_list[$i]) ? 1 : 0;
|
||||
|
||||
$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_ary = array(
|
||||
'group_name' => (string)$extension_group_list[$i],
|
||||
'cat_id' => (int)$category_list[$i],
|
||||
'allow_group' => (int)$allowed,
|
||||
'download_mode' => (int)$download_mode_list[$i],
|
||||
'upload_icon' => (string)$upload_icon_list[$i],
|
||||
'max_filesize' => (int)$filesize_list[$i]
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE group_id = ' . (int)$group_change_list[$i];
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not update extension groups informations');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Extension Groups
|
||||
$group_id_list = get_var('group_id_list', array(0));
|
||||
|
||||
$group_id_sql = implode(', ', $group_id_list);
|
||||
|
||||
if ($group_id_sql != '') {
|
||||
$sql = 'DELETE
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE group_id IN (' . $group_id_sql . ')';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not delete extension groups');
|
||||
}
|
||||
|
||||
// Set corresponding Extensions to a pending Group
|
||||
$sql = 'UPDATE ' . BB_EXTENSIONS . '
|
||||
SET group_id = 0
|
||||
WHERE group_id IN (' . $group_id_sql . ')';
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not assign extensions to pending group');
|
||||
}
|
||||
}
|
||||
|
||||
// Add Extensions?
|
||||
$extension_group = get_var('add_extension_group', '');
|
||||
$download_mode = get_var('add_download_mode', 0);
|
||||
$cat_id = get_var('add_category', 0);
|
||||
$upload_icon = get_var('add_upload_icon', '');
|
||||
$filesize = get_var('add_max_filesize', 0);
|
||||
$size_select = get_var('add_size_select', '');
|
||||
|
||||
$is_allowed = isset($_POST['add_allowed']) ? 1 : 0;
|
||||
$add = isset($_POST['add_extension_group_check']) ? true : false;
|
||||
|
||||
if ($extension_group != '' && $add) {
|
||||
// check Extension Group
|
||||
$sql = 'SELECT group_name FROM ' . BB_EXTENSION_GROUPS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query extension groups table');
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if ($row[$i]['group_name'] == $extension_group) {
|
||||
$error = true;
|
||||
if (isset($error_msg)) {
|
||||
$error_msg .= '<br />';
|
||||
}
|
||||
$error_msg .= sprintf($lang['EXTENSION_GROUP_EXIST'], $extension_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$filesize = ($size_select == 'kb') ? round($filesize * 1024) : (($size_select == 'mb') ? round($filesize * 1048576) : $filesize);
|
||||
|
||||
$sql_ary = array(
|
||||
'group_name' => (string)$extension_group,
|
||||
'cat_id' => (int)$cat_id,
|
||||
'allow_group' => (int)$is_allowed,
|
||||
'download_mode' => (int)$download_mode,
|
||||
'upload_icon' => (string)$upload_icon,
|
||||
'max_filesize' => (int)$filesize,
|
||||
'forum_permissions' => ''
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . BB_EXTENSION_GROUPS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not add extension group');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
bb_die($lang['ATTACH_CONFIG_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ATTACH_CONFIG'], '<a href="admin_extensions.php?mode=groups">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'groups') {
|
||||
// Extension Groups
|
||||
if (!$size && !$submit) {
|
||||
$max_add_filesize = $attach_config['max_filesize'];
|
||||
|
||||
$size = ($max_add_filesize >= 1048576) ? 'mb' : (($max_add_filesize >= 1024) ? 'kb' : 'b');
|
||||
}
|
||||
|
||||
if ($max_add_filesize >= 1048576) {
|
||||
$max_add_filesize = round($max_add_filesize / 1048576 * 100) / 100;
|
||||
} elseif ($max_add_filesize >= 1024) {
|
||||
$max_add_filesize = round($max_add_filesize / 1024 * 100) / 100;
|
||||
}
|
||||
|
||||
$viewgroup = get_var(POST_GROUPS_URL, 0);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_EXTENSION_GROUPS' => true,
|
||||
'ADD_GROUP_NAME' => $extension_group ?? '',
|
||||
'MAX_FILESIZE' => $max_add_filesize,
|
||||
'S_FILESIZE' => size_select('add_size_select', $size),
|
||||
'S_ADD_DOWNLOAD_MODE' => download_select('add_download_mode'),
|
||||
'S_SELECT_CAT' => category_select('add_category'),
|
||||
'S_CANCEL_ACTION' => 'admin_extensions.php?mode=groups',
|
||||
'S_ATTACH_ACTION' => 'admin_extensions.php?mode=groups',
|
||||
));
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_EXTENSION_GROUPS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get extension group informations');
|
||||
}
|
||||
|
||||
$extension_group = DB()->sql_fetchrowset($result);
|
||||
$num_extension_group = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($i = 0; $i < $num_extension_group; $i++) {
|
||||
// Format the filesize
|
||||
if (!$extension_group[$i]['max_filesize']) {
|
||||
$extension_group[$i]['max_filesize'] = $attach_config['max_filesize'];
|
||||
}
|
||||
|
||||
$size_format = ($extension_group[$i]['max_filesize'] >= 1048576) ? 'mb' : (($extension_group[$i]['max_filesize'] >= 1024) ? 'kb' : 'b');
|
||||
|
||||
if ($extension_group[$i]['max_filesize'] >= 1048576) {
|
||||
$extension_group[$i]['max_filesize'] = round($extension_group[$i]['max_filesize'] / 1048576 * 100) / 100;
|
||||
} elseif ($extension_group[$i]['max_filesize'] >= 1024) {
|
||||
$extension_group[$i]['max_filesize'] = round($extension_group[$i]['max_filesize'] / 1024 * 100) / 100;
|
||||
}
|
||||
|
||||
$s_allowed = ($extension_group[$i]['allow_group'] == 1) ? 'checked="checked"' : '';
|
||||
|
||||
$template->assign_block_vars('grouprow', array(
|
||||
'GROUP_ID' => $extension_group[$i]['group_id'],
|
||||
'EXTENSION_GROUP' => $extension_group[$i]['group_name'],
|
||||
'UPLOAD_ICON' => $extension_group[$i]['upload_icon'],
|
||||
|
||||
'S_ALLOW_SELECTED' => $s_allowed,
|
||||
'S_SELECT_CAT' => category_select('category_list[]', $extension_group[$i]['group_id']),
|
||||
'S_DOWNLOAD_MODE' => download_select('download_mode_list[]', $extension_group[$i]['group_id']),
|
||||
'S_FILESIZE' => size_select('size_select_list[]', $size_format),
|
||||
|
||||
'MAX_FILESIZE' => $extension_group[$i]['max_filesize'],
|
||||
'CAT_BOX' => ($viewgroup == $extension_group[$i]['group_id']) ? '-' : '+',
|
||||
'U_VIEWGROUP' => ($viewgroup == $extension_group[$i]['group_id']) ? 'admin_extensions.php?mode=groups' : 'admin_extensions.php?mode=groups&' . POST_GROUPS_URL . '=' . $extension_group[$i]['group_id'],
|
||||
'U_FORUM_PERMISSIONS' => "admin_extensions.php?mode=$mode&e_mode=perm&e_group=" . $extension_group[$i]['group_id'],
|
||||
));
|
||||
|
||||
if ($viewgroup && $viewgroup == $extension_group[$i]['group_id']) {
|
||||
$sql = 'SELECT comment, extension FROM ' . BB_EXTENSIONS . ' WHERE group_id = ' . (int)$viewgroup;
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not get extension informations #3');
|
||||
}
|
||||
|
||||
$extension = DB()->sql_fetchrowset($result);
|
||||
$num_extension = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
for ($j = 0; $j < $num_extension; $j++) {
|
||||
$template->assign_block_vars('grouprow.extensionrow', array(
|
||||
'EXPLANATION' => $extension[$j]['comment'],
|
||||
'EXTENSION' => $extension[$j]['extension'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($e_mode == 'perm') {
|
||||
$group = get_var('e_group', 0);
|
||||
|
||||
if (isset($_POST['close_perm'])) {
|
||||
$e_mode = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add Forums
|
||||
if ($add_forum && $e_mode == 'perm' && $group) {
|
||||
$add_forums_list = get_var('entries', array(0));
|
||||
$add_all_forums = false;
|
||||
|
||||
foreach ($add_forums_list as $iValue) {
|
||||
if ($iValue == 0) {
|
||||
$add_all_forums = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we add ALL FORUMS, we are able to overwrite the Permissions
|
||||
if ($add_all_forums) {
|
||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '' WHERE group_id = " . (int)$group;
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not update permissions #1');
|
||||
}
|
||||
}
|
||||
|
||||
// Else we have to add Permissions
|
||||
if (!$add_all_forums) {
|
||||
$sql = 'SELECT forum_permissions
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE group_id = ' . (int)$group . '
|
||||
LIMIT 1';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get group permissions from ' . BB_EXTENSION_GROUPS);
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if (trim($row['forum_permissions']) == '') {
|
||||
$auth_p = array();
|
||||
} else {
|
||||
$auth_p = auth_unpack($row['forum_permissions']);
|
||||
}
|
||||
|
||||
// Generate array for Auth_Pack, do not add doubled forums
|
||||
foreach ($add_forums_list as $i => $iValue) {
|
||||
if (!in_array($add_forums_list[$i], $auth_p)) {
|
||||
$auth_p[] = $iValue;
|
||||
}
|
||||
}
|
||||
|
||||
$auth_bitstream = auth_pack($auth_p);
|
||||
|
||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not update permissions #2');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Forums
|
||||
if ($delete_forum && $e_mode == 'perm' && $group) {
|
||||
$delete_forums_list = get_var('entries', array(0));
|
||||
|
||||
// Get the current Forums
|
||||
$sql = 'SELECT forum_permissions
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE group_id = ' . (int)$group . '
|
||||
LIMIT 1';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get group permissions from ' . BB_EXTENSION_GROUPS);
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$auth_p2 = auth_unpack(trim($row['forum_permissions']));
|
||||
$auth_p = array();
|
||||
|
||||
// Generate array for Auth_Pack, delete the chosen ones
|
||||
foreach ($auth_p2 as $i => $iValue) {
|
||||
if (!in_array($auth_p2[$i], $delete_forums_list)) {
|
||||
$auth_p[] = $iValue;
|
||||
}
|
||||
}
|
||||
|
||||
$auth_bitstream = (count($auth_p) > 0) ? auth_pack($auth_p) : '';
|
||||
|
||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not update permissions #3');
|
||||
}
|
||||
}
|
||||
|
||||
// Display the Group Permissions Box for configuring it
|
||||
if ($e_mode == 'perm' && $group) {
|
||||
$sql = 'SELECT group_name, forum_permissions
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE group_id = ' . (int)$group . '
|
||||
LIMIT 1';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get group name from ' . BB_EXTENSION_GROUPS);
|
||||
}
|
||||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$group_name = $row['group_name'];
|
||||
$allowed_forums = trim($row['forum_permissions']);
|
||||
|
||||
$forum_perm = array();
|
||||
|
||||
if ($allowed_forums == '') {
|
||||
$forum_perm[0]['forum_id'] = 0;
|
||||
$forum_perm[0]['forum_name'] = $lang['PERM_ALL_FORUMS'];
|
||||
} else {
|
||||
$forum_p = array();
|
||||
$act_id = 0;
|
||||
$forum_p = auth_unpack($allowed_forums);
|
||||
$sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS . ' WHERE forum_id IN (' . implode(', ', $forum_p) . ')';
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get forum names');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$forum_perm[$act_id]['forum_id'] = $row['forum_id'];
|
||||
$forum_perm[$act_id]['forum_name'] = $row['forum_name'];
|
||||
$act_id++;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0, $iMax = count($forum_perm); $i < $iMax; $i++) {
|
||||
$template->assign_block_vars('allow_option_values', array(
|
||||
'VALUE' => $forum_perm[$i]['forum_id'],
|
||||
'OPTION' => htmlCHR($forum_perm[$i]['forum_name']))
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_ATTACH_EXTENSION_GROUPS_PERMISSIONS' => true,
|
||||
'L_GROUP_PERMISSIONS_TITLE' => sprintf($lang['GROUP_PERMISSIONS_TITLE_ADMIN'], trim($group_name)),
|
||||
'A_PERM_ACTION' => "admin_extensions.php?mode=groups&e_mode=perm&e_group=$group",
|
||||
));
|
||||
|
||||
$forum_option_values = array(0 => $lang['PERM_ALL_FORUMS']);
|
||||
|
||||
$sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get forums #1');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$forum_option_values[(int)$row['forum_id']] = $row['forum_name'];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
foreach ($forum_option_values as $value => $option) {
|
||||
$template->assign_block_vars('forum_option_values', array(
|
||||
'VALUE' => $value,
|
||||
'OPTION' => htmlCHR($option))
|
||||
);
|
||||
}
|
||||
|
||||
$empty_perm_forums = array();
|
||||
|
||||
$sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS . ' WHERE auth_attachments < ' . AUTH_ADMIN;
|
||||
|
||||
if (!($f_result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get forums #2');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($f_result)) {
|
||||
$forum_id = $row['forum_id'];
|
||||
|
||||
$sql = 'SELECT forum_permissions
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE allow_group = 1
|
||||
ORDER BY group_name ASC';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query extension groups');
|
||||
}
|
||||
|
||||
$rows = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$found_forum = false;
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
$allowed_forums = auth_unpack(trim($rows[$i]['forum_permissions']));
|
||||
if (in_array($forum_id, $allowed_forums) || trim($rows[$i]['forum_permissions']) == '') {
|
||||
$found_forum = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found_forum) {
|
||||
$empty_perm_forums[$forum_id] = $row['forum_name'];
|
||||
}
|
||||
}
|
||||
DB()->sql_freeresult($f_result);
|
||||
|
||||
$message = '';
|
||||
|
||||
foreach ($empty_perm_forums as $forum_id => $forum_name) {
|
||||
$message .= ($message == '') ? $forum_name : '<br />' . $forum_name;
|
||||
}
|
||||
|
||||
if (count($empty_perm_forums) > 0) {
|
||||
$template->assign_vars(array('ERROR_MESSAGE' => $lang['NOTE_ADMIN_EMPTY_GROUP_PERMISSIONS'] . $message));
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
|
||||
}
|
||||
|
||||
print_page('admin_extensions.tpl', 'admin');
|
|
@ -16,8 +16,6 @@ require __DIR__ . '/pagestart.php';
|
|||
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0;
|
||||
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
|
||||
|
||||
attachment_quota_settings('group', isset($_POST['group_update']), $mode);
|
||||
|
||||
if (!empty($_POST['edit']) || !empty($_POST['new'])) {
|
||||
if (!empty($_POST['edit'])) {
|
||||
if (!$row = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
|
||||
|
|
|
@ -282,7 +282,7 @@ $up_add = ($lp_info && $uploaded > $lp_info['uploaded']) ? $uploaded - $lp_info[
|
|||
$down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0;
|
||||
|
||||
// Gold/Silver releases
|
||||
if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
||||
if ($down_add) {
|
||||
if ($tor_type == TOR_TYPE_GOLD) {
|
||||
$down_add = 0;
|
||||
} // Silver releases
|
||||
|
|
|
@ -81,7 +81,7 @@ define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $b
|
|||
unset($server_protocol, $server_port);
|
||||
|
||||
// Debug options
|
||||
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG])));
|
||||
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
||||
|
||||
// Board / tracker shared constants and functions
|
||||
define('BB_BT_TORRENTS', 'bb_bt_torrents');
|
||||
|
@ -428,7 +428,7 @@ function log_request($file = '', $prepend_str = false, $add_post = true)
|
|||
}
|
||||
|
||||
if (!empty($_POST) && $add_post) {
|
||||
$str[] = "post: " . str_compact(urldecode(http_build_query($_POST)));
|
||||
$str[] = 'Post: ' . str_compact(urldecode(http_build_query($_POST)));
|
||||
}
|
||||
$str = implode("\t", $str) . "\n";
|
||||
bb_log($str, $file);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'dl_list');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
$forum_id = isset($_REQUEST[POST_FORUM_URL]) ? (int)$_REQUEST[POST_FORUM_URL] : 0;
|
||||
|
|
3
feed.php
3
feed.php
|
@ -8,10 +8,9 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'feed');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
$user->session_start(array('req_login' => true));
|
||||
$user->session_start(['req_login' => true]);
|
||||
|
||||
$mode = $_REQUEST['mode'] ?? '';
|
||||
$type = $_POST['type'] ?? '';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'group');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
require INC_DIR . '/bbcode.php';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'group_edit');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
$page_cfg['include_bbcode_js'] = true;
|
||||
|
@ -38,13 +37,13 @@ if ($is_moderator) {
|
|||
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
|
||||
$upload = new TorrentPier\Legacy\Common\Upload();
|
||||
|
||||
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) and $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
|
||||
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) && $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
|
||||
$avatar_ext_id = (int)$upload->file_ext_id;
|
||||
} else {
|
||||
bb_die(implode($upload->errors));
|
||||
}
|
||||
|
||||
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id");
|
||||
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'index');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
$page_cfg['load_tpl_vars'] = array(
|
||||
|
|
1
info.php
1
info.php
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'info');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
// Start session management
|
||||
|
|
|
@ -16,7 +16,7 @@ global $bb_cfg, $lang, $user;
|
|||
$mode = (string)$this->request['mode'];
|
||||
$user_id = (int)$this->request['user_id'];
|
||||
|
||||
if (!$user_id or !$u_data = get_userdata($user_id)) {
|
||||
if (!$user_id || !($u_data = get_userdata($user_id))) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ switch ($mode) {
|
|||
$this->ajax_die('Invalid mode');
|
||||
}
|
||||
|
||||
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id");
|
||||
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");
|
||||
|
||||
\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ global $bf, $lang;
|
|||
$user_id = (int)$this->request['user_id'];
|
||||
$new_opt = json_decode($this->request['user_opt'], true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
if (!$user_id or !$u_data = get_userdata($user_id)) {
|
||||
if (!$user_id || !($u_data = get_userdata($user_id))) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ foreach ($bf['user_opt'] as $opt_name => $opt_bit) {
|
|||
}
|
||||
}
|
||||
|
||||
DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id");
|
||||
DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
|
||||
|
||||
// Удаляем данные из кеша
|
||||
\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
|
||||
|
|
|
@ -16,7 +16,7 @@ global $datastore, $lang;
|
|||
$ranks = $datastore->get('ranks');
|
||||
$rank_id = (int)$this->request['rank_id'];
|
||||
|
||||
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
||||
if (!($user_id = (int)$this->request['user_id']) || !($profiledata = get_userdata($user_id))) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ if ($rank_id != 0 && !isset($ranks[$rank_id])) {
|
|||
$this->ajax_die("invalid rank_id: $rank_id");
|
||||
}
|
||||
|
||||
DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id");
|
||||
DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1");
|
||||
|
||||
\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
|
|||
|
||||
global $bb_cfg, $userdata, $lang;
|
||||
|
||||
if (!$group_id = (int)$this->request['group_id'] or !$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
|
||||
if (!($group_id = (int)$this->request['group_id']) || !($group_info = \TorrentPier\Legacy\Group::get_group_data($group_id))) {
|
||||
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
||||
}
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
|
@ -51,4 +51,4 @@ switch ($mode) {
|
|||
}
|
||||
|
||||
$value_sql = DB()->escape($value, true);
|
||||
DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id");
|
||||
DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id LIMIT 1");
|
||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
|
|||
|
||||
global $bb_cfg, $lang;
|
||||
|
||||
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
||||
if (!($user_id = (int)$this->request['user_id']) || !($profiledata = get_userdata($user_id))) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
if (!$field = (string)$this->request['field']) {
|
||||
|
@ -109,7 +109,7 @@ switch ($field) {
|
|||
case 'user_regdate':
|
||||
case 'user_lastvisit':
|
||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
||||
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) {
|
||||
if ((($value = strtotime($value, $tz)) < $bb_cfg['board_startdate']) || ($value > TIMENOW)) {
|
||||
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
||||
}
|
||||
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
|
||||
|
@ -151,7 +151,7 @@ switch ($field) {
|
|||
}
|
||||
|
||||
$value_sql = DB()->escape($value, true);
|
||||
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id");
|
||||
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id LIMIT 1");
|
||||
|
||||
\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($user_id);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('IN_AJAX')) {
|
|||
|
||||
global $lang, $user;
|
||||
|
||||
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
||||
if (!($user_id = (int)$this->request['user_id']) || !($profiledata = get_userdata($user_id))) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ switch ($mode) {
|
|||
}
|
||||
|
||||
$html = ': ';
|
||||
$html .= ($moderators) ? implode(', ', $moderators) : $lang['NONE'];
|
||||
$html .= $moderators ? implode(', ', $moderators) : $lang['NONE'];
|
||||
unset($moderators, $mod);
|
||||
$datastore->rm('moderators');
|
||||
break;
|
||||
|
@ -88,7 +88,7 @@ switch ($mode) {
|
|||
}
|
||||
if ($tz != $bb_cfg['board_timezone']) {
|
||||
// Set current user timezone
|
||||
DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']);
|
||||
DB()->query('UPDATE ' . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id'] . ' LIMIT 1');
|
||||
$bb_cfg['board_timezone'] = $tz;
|
||||
\TorrentPier\Legacy\Sessions::cache_rm_user_sessions($userdata['user_id']);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ switch ($mode) {
|
|||
<th>' . $lang['UPLOADED'] . '</th>
|
||||
<th>' . $lang['RELEASED'] . '</th>
|
||||
<th>' . $lang['BONUS'] . '</th>';
|
||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row1">
|
||||
<td>' . $lang['TOTAL_TRAF'] . '</td>
|
||||
|
@ -118,13 +118,13 @@ switch ($mode) {
|
|||
<td id="u_up_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td>
|
||||
<td id="u_up_release"><span class="editable bold seedmed">' . humn_size($btu['u_up_release']) . '</span></td>
|
||||
<td id="u_up_bonus"><span class="editable bold seedmed">' . humn_size($btu['u_up_bonus']) . '</span></td>';
|
||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row5">
|
||||
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
|
||||
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
|
||||
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
|
||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td colspan="1"></td>' : '';
|
||||
$html .= '</tr>';
|
||||
|
||||
$this->response['user_ratio'] = '
|
||||
|
|
|
@ -115,7 +115,7 @@ switch ($mode) {
|
|||
$new_tpl_id = $tpl_id;
|
||||
$this->response['msg'] = "Включен шаблон $tpl_name";
|
||||
}
|
||||
DB()->query("UPDATE " . BB_FORUMS . " SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id");
|
||||
DB()->query("UPDATE " . BB_FORUMS . " SET forum_tpl_id = $new_tpl_id WHERE forum_id = $forum_id LIMIT 1");
|
||||
break;
|
||||
|
||||
// сохранение изменений
|
||||
|
@ -126,8 +126,8 @@ switch ($mode) {
|
|||
$msg .= 'Шаблон был отредактирован: ' . html_entity_decode($last_edit_by_username) . ', ' . delta_time($tpl_data['tpl_last_edit_tm']) . " назад\n\n";
|
||||
$this->ajax_die($msg);
|
||||
}
|
||||
$sql = "UPDATE " . BB_TOPIC_TPL . " SET " . DB()->build_array('UPDATE', $sql_args) . " WHERE tpl_id = $tpl_id";
|
||||
if (!@DB()->query($sql)) {
|
||||
$sql = "UPDATE " . BB_TOPIC_TPL . " SET " . DB()->build_array('UPDATE', $sql_args) . " WHERE tpl_id = $tpl_id LIMIT 1";
|
||||
if (!DB()->query($sql)) {
|
||||
$sql_error = DB()->sql_error();
|
||||
}
|
||||
$this->response['tpl_id'] = $tpl_id;
|
||||
|
@ -139,7 +139,7 @@ switch ($mode) {
|
|||
// создание нового шаблона
|
||||
case 'new':
|
||||
$sql = "INSERT INTO " . BB_TOPIC_TPL . DB()->build_array('INSERT', $sql_args);
|
||||
if (!@DB()->query($sql)) {
|
||||
if (!DB()->query($sql)) {
|
||||
$sql_error = DB()->sql_error();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -13,8 +13,8 @@ if (!defined('IN_AJAX')) {
|
|||
|
||||
global $user, $lang;
|
||||
|
||||
$post_id = (int)@$this->request['post_id'];
|
||||
$topic_id = (int)@$this->request['topic_id'];
|
||||
$post_id = (int)$this->request['post_id'];
|
||||
$topic_id = (int)$this->request['topic_id'];
|
||||
|
||||
if (!$post_id) {
|
||||
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id');
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Require all denied
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
require ATTACH_DIR . '/includes/functions_includes.php';
|
||||
require ATTACH_DIR . '/includes/functions_attach.php';
|
||||
require ATTACH_DIR . '/includes/functions_delete.php';
|
||||
require ATTACH_DIR . '/includes/functions_thumbs.php';
|
||||
require ATTACH_DIR . '/includes/functions_filetypes.php';
|
||||
|
||||
if (defined('ATTACH_INSTALL')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper function for determining the correct language directory
|
||||
*/
|
||||
function attach_mod_get_lang($language_file)
|
||||
{
|
||||
global $attach_config, $bb_cfg;
|
||||
|
||||
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
|
||||
if (file_exists($file)) {
|
||||
return $bb_cfg['default_lang'];
|
||||
}
|
||||
|
||||
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
|
||||
if (file_exists($file)) {
|
||||
return $attach_config['board_lang'];
|
||||
}
|
||||
|
||||
bb_die('Attachment mod language file does not exist: language/' . $attach_config['board_lang'] . '/' . $language_file . '.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachment mod configuration
|
||||
*/
|
||||
function get_config()
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$attach_config = array();
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachment information');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$attach_config[$row['config_name']] = trim($row['config_value']);
|
||||
}
|
||||
|
||||
// We assign the original default board language here, because it gets overwritten later with the users default language
|
||||
$attach_config['board_lang'] = trim($bb_cfg['default_lang']);
|
||||
|
||||
return $attach_config;
|
||||
}
|
||||
|
||||
// Get Attachment Config
|
||||
$attach_config = array();
|
||||
|
||||
if (!$attach_config = CACHE('bb_cache')->get('attach_config')) {
|
||||
$attach_config = get_config();
|
||||
CACHE('bb_cache')->set('attach_config', $attach_config, 86400);
|
||||
}
|
||||
|
||||
include ATTACH_DIR . '/displaying.php';
|
||||
include ATTACH_DIR . '/posting_attachments.php';
|
||||
|
||||
$upload_dir = $attach_config['upload_dir'];
|
|
@ -1,306 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$allowed_extensions = array();
|
||||
$display_categories = array();
|
||||
$download_modes = array();
|
||||
$upload_icons = array();
|
||||
$attachments = array();
|
||||
|
||||
/**
|
||||
* Create needed arrays for Extension Assignments
|
||||
*/
|
||||
function init_complete_extensions_data()
|
||||
{
|
||||
global $allowed_extensions, $display_categories, $download_modes, $upload_icons;
|
||||
|
||||
if (!$extension_informations = get_extension_informations()) {
|
||||
$GLOBALS['datastore']->update('attach_extensions');
|
||||
$extension_informations = get_extension_informations();
|
||||
}
|
||||
$allowed_extensions = array();
|
||||
|
||||
for ($i = 0, $size = count($extension_informations); $i < $size; $i++) {
|
||||
$extension = strtolower(trim($extension_informations[$i]['extension']));
|
||||
$allowed_extensions[] = $extension;
|
||||
$display_categories[$extension] = (int)$extension_informations[$i]['cat_id'];
|
||||
$download_modes[$extension] = (int)$extension_informations[$i]['download_mode'];
|
||||
$upload_icons[$extension] = trim($extension_informations[$i]['upload_icon']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writing Data into plain Template Vars
|
||||
*/
|
||||
function init_display_template($template_var, $replacement, $filename = 'viewtopic_attach.tpl')
|
||||
{
|
||||
global $template;
|
||||
|
||||
// This function is adapted from the old template class
|
||||
// I wish i had the functions from the 3.x one. :D (This class rocks, can't await to use it in Mods)
|
||||
|
||||
// Handle Attachment Informations
|
||||
if (!isset($template->uncompiled_code[$template_var]) && empty($template->uncompiled_code[$template_var])) {
|
||||
// If we don't have a file assigned to this handle, die.
|
||||
if (!isset($template->files[$template_var])) {
|
||||
die("Template->loadfile(): No file specified for handle $template_var");
|
||||
}
|
||||
|
||||
$filename_2 = $template->files[$template_var];
|
||||
|
||||
$str = file_get_contents($filename_2);
|
||||
if (empty($str)) {
|
||||
die("Template->loadfile(): File $filename_2 for handle $template_var is empty");
|
||||
}
|
||||
|
||||
$template->uncompiled_code[$template_var] = $str;
|
||||
}
|
||||
|
||||
$complete_filename = $filename;
|
||||
if ($complete_filename[0] != '/') {
|
||||
$complete_filename = $template->root . '/' . $complete_filename;
|
||||
}
|
||||
|
||||
if (!file_exists($complete_filename)) {
|
||||
die("Template->make_filename(): Error - file $complete_filename does not exist");
|
||||
}
|
||||
|
||||
$content = file_get_contents($complete_filename);
|
||||
if (empty($content)) {
|
||||
die('Template->loadfile(): File ' . $complete_filename . ' is empty');
|
||||
}
|
||||
|
||||
// replace $replacement with uncompiled code in $filename
|
||||
$template->uncompiled_code[$template_var] = str_replace($replacement, $content, $template->uncompiled_code[$template_var]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Attachments in Posts
|
||||
*/
|
||||
function display_post_attachments($post_id, $switch_attachment)
|
||||
{
|
||||
global $attach_config, $is_auth;
|
||||
|
||||
if ((int)$switch_attachment == 0 || (int)$attach_config['disable_mod']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($is_auth['auth_download'] && $is_auth['auth_view']) {
|
||||
display_attachments($post_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes some templating variables for displaying Attachments in Posts
|
||||
*/
|
||||
function init_display_post_attachments($switch_attachment)
|
||||
{
|
||||
global $attach_config, $is_auth, $template, $lang, $postrow, $total_posts, $attachments, $forum_row, $t_data;
|
||||
|
||||
if (empty($t_data) && !empty($forum_row)) {
|
||||
$switch_attachment = $forum_row['topic_attachment'];
|
||||
}
|
||||
|
||||
if ((int)$switch_attachment == 0 || (int)$attach_config['disable_mod'] || (!($is_auth['auth_download'] && $is_auth['auth_view']))) {
|
||||
init_display_template('body', '{postrow.ATTACHMENTS}', 'viewtopic_attach_guest.tpl');
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id_array = array();
|
||||
|
||||
for ($i = 0; $i < $total_posts; $i++) {
|
||||
if ($postrow[$i]['post_attachment'] == 1) {
|
||||
$post_id_array[] = (int)$postrow[$i]['post_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($post_id_array) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rows = get_attachments_from_post($post_id_array);
|
||||
$num_rows = count($rows);
|
||||
|
||||
if ($num_rows == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@reset($attachments);
|
||||
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
$attachments['_' . $rows[$i]['post_id']][] = $rows[$i];
|
||||
//bt
|
||||
if ($rows[$i]['tracker_status']) {
|
||||
if (defined('TORRENT_POST')) {
|
||||
bb_die('Multiple registered torrents in one topic<br /><br />first torrent found in post_id = ' . TORRENT_POST . '<br />current post_id = ' . $rows[$i]['post_id'] . '<br /><br />attachments info:<br /><pre style="text-align: left;">' . print_r($rows, true) . '</pre>');
|
||||
}
|
||||
define('TORRENT_POST', $rows[$i]['post_id']);
|
||||
}
|
||||
//bt end
|
||||
}
|
||||
|
||||
init_display_template('body', '{postrow.ATTACHMENTS}');
|
||||
|
||||
init_complete_extensions_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* END ATTACHMENT DISPLAY IN POSTS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assign Variables and Definitions based on the fetched Attachments - internal
|
||||
* used by all displaying functions, the Data was collected before, it's only dependend on the template used. :)
|
||||
* before this function is usable, init_display_attachments have to be called for specific pages (pm, posting, review etc...)
|
||||
*/
|
||||
function display_attachments($post_id)
|
||||
{
|
||||
global $template, $upload_dir, $userdata, $allowed_extensions, $display_categories, $download_modes, $lang, $attachments, $upload_icons, $attach_config;
|
||||
|
||||
$num_attachments = @count($attachments['_' . $post_id]);
|
||||
|
||||
if ($num_attachments == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow.attach', array());
|
||||
|
||||
for ($i = 0; $i < $num_attachments; $i++) {
|
||||
// Some basic things...
|
||||
$filename = $upload_dir . '/' . basename($attachments['_' . $post_id][$i]['physical_filename']);
|
||||
$thumbnail_filename = $upload_dir . '/' . THUMB_DIR . '/t_' . basename($attachments['_' . $post_id][$i]['physical_filename']);
|
||||
|
||||
$upload_image = '';
|
||||
|
||||
if ($attach_config['upload_img'] && empty($upload_icons[$attachments['_' . $post_id][$i]['extension']])) {
|
||||
$upload_image = '<img src="' . $attach_config['upload_img'] . '" alt="" border="0" />';
|
||||
} elseif (trim($upload_icons[$attachments['_' . $post_id][$i]['extension']]) != '') {
|
||||
$upload_image = '<img src="' . $upload_icons[$attachments['_' . $post_id][$i]['extension']] . '" alt="" border="0" />';
|
||||
}
|
||||
|
||||
$filesize = humn_size($attachments['_' . $post_id][$i]['filesize']);
|
||||
|
||||
$display_name = htmlspecialchars($attachments['_' . $post_id][$i]['real_filename']);
|
||||
$comment = htmlspecialchars($attachments['_' . $post_id][$i]['comment']);
|
||||
$comment = str_replace("\n", '<br />', $comment);
|
||||
|
||||
$denied = false;
|
||||
|
||||
// Admin is allowed to view forbidden Attachments, but the error-message is displayed too to inform the Admin
|
||||
if (!in_array($attachments['_' . $post_id][$i]['extension'], $allowed_extensions)) {
|
||||
$denied = true;
|
||||
|
||||
$template->assign_block_vars('postrow.attach.denyrow', array(
|
||||
'L_DENIED' => sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachments['_' . $post_id][$i]['extension']))
|
||||
);
|
||||
}
|
||||
|
||||
if (!$denied || IS_ADMIN) {
|
||||
// define category
|
||||
$image = false;
|
||||
$thumbnail = false;
|
||||
$link = false;
|
||||
|
||||
if (@(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT && (int)$attach_config['img_display_inlined']) {
|
||||
if ((int)$attach_config['img_link_width'] != 0 || (int)$attach_config['img_link_height'] != 0) {
|
||||
[$width, $height] = image_getdimension($filename);
|
||||
|
||||
if ($width == 0 && $height == 0) {
|
||||
$image = true;
|
||||
} else {
|
||||
if ($width <= (int)$attach_config['img_link_width'] && $height <= (int)$attach_config['img_link_height']) {
|
||||
$image = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$image = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (@(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT && $attachments['_' . $post_id][$i]['thumbnail'] == 1) {
|
||||
$thumbnail = true;
|
||||
$image = false;
|
||||
}
|
||||
|
||||
if (!$image && !$thumbnail) {
|
||||
$link = true;
|
||||
}
|
||||
|
||||
if ($image) {
|
||||
// Images
|
||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
|
||||
$img_source = BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'];
|
||||
$download_link = true;
|
||||
} else {
|
||||
$img_source = $filename;
|
||||
$download_link = false;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow.attach.cat_images', array(
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'S_UPLOAD_IMAGE' => $upload_image,
|
||||
'IMG_SRC' => $img_source,
|
||||
'FILESIZE' => $filesize,
|
||||
'COMMENT' => $comment,
|
||||
));
|
||||
|
||||
// Directly Viewed Image ... update the download count
|
||||
if (!$download_link) {
|
||||
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . '
|
||||
SET download_count = download_count + 1
|
||||
WHERE attach_id = ' . (int)$attachments['_' . $post_id][$i]['attach_id'];
|
||||
|
||||
if (!(DB()->sql_query($sql))) {
|
||||
bb_die('Could not update attachment download count');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($thumbnail) {
|
||||
// Images, but display Thumbnail
|
||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
|
||||
$thumb_source = BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1';
|
||||
} else {
|
||||
$thumb_source = $thumbnail_filename;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'S_UPLOAD_IMAGE' => $upload_image,
|
||||
'IMG_SRC' => BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'],
|
||||
'IMG_THUMB_SRC' => $thumb_source,
|
||||
'FILESIZE' => $filesize,
|
||||
'COMMENT' => $comment,
|
||||
));
|
||||
}
|
||||
|
||||
// bt
|
||||
if ($link && ($attachments['_' . $post_id][$i]['extension'] === TORRENT_EXT)) {
|
||||
include ATTACH_DIR . '/displaying_torrent.php';
|
||||
} elseif ($link) {
|
||||
$target_blank = ((@(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT)) ? 'target="_blank"' : '';
|
||||
|
||||
// display attachment
|
||||
$template->assign_block_vars('postrow.attach.attachrow', array(
|
||||
'U_DOWNLOAD_LINK' => BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'],
|
||||
'S_UPLOAD_IMAGE' => $upload_image,
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'FILESIZE' => $filesize,
|
||||
'COMMENT' => $comment,
|
||||
'TARGET_BLANK' => $target_blank,
|
||||
'DOWNLOAD_COUNT' => declension((int)$attachments['_' . $post_id][$i]['download_count'], 'times'),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,269 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set/change quotas
|
||||
*
|
||||
* @param $mode
|
||||
* @param $id
|
||||
* @param $quota_type
|
||||
* @param int $quota_limit_id
|
||||
*/
|
||||
function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||
{
|
||||
$id = (int)$id;
|
||||
$quota_type = (int)$quota_type;
|
||||
$quota_limit_id = (int)$quota_limit_id;
|
||||
|
||||
if ($mode == 'user') {
|
||||
if (!$quota_limit_id) {
|
||||
$sql = 'DELETE FROM ' . BB_QUOTA . " WHERE user_id = $id AND quota_type = $quota_type";
|
||||
} else {
|
||||
// Check if user is already entered
|
||||
$sql = 'SELECT user_id FROM ' . BB_QUOTA . " WHERE user_id = $id AND quota_type = $quota_type";
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not get entry #1');
|
||||
}
|
||||
|
||||
if (DB()->num_rows($result) == 0) {
|
||||
$sql_ary = [
|
||||
'user_id' => (int)$id,
|
||||
'group_id' => 0,
|
||||
'quota_type' => (int)$quota_type,
|
||||
'quota_limit_id' => (int)$quota_limit_id
|
||||
];
|
||||
$sql = 'INSERT INTO ' . BB_QUOTA . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
|
||||
} else {
|
||||
$sql = 'UPDATE ' . BB_QUOTA . "
|
||||
SET quota_limit_id = $quota_limit_id
|
||||
WHERE user_id = $id
|
||||
AND quota_type = $quota_type";
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Unable to update quota settings');
|
||||
}
|
||||
} elseif ($mode == 'group') {
|
||||
if (!$quota_limit_id) {
|
||||
$sql = 'DELETE FROM ' . BB_QUOTA . " WHERE group_id = $id AND quota_type = $quota_type";
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Unable to delete quota settings');
|
||||
}
|
||||
} else {
|
||||
// Check if user is already entered
|
||||
$sql = 'SELECT group_id FROM ' . BB_QUOTA . " WHERE group_id = $id AND quota_type = $quota_type";
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not get entry #2');
|
||||
}
|
||||
|
||||
if (DB()->num_rows($result) == 0) {
|
||||
$sql = 'INSERT INTO ' . BB_QUOTA . " (user_id, group_id, quota_type, quota_limit_id)
|
||||
VALUES (0, $id, $quota_type, $quota_limit_id)";
|
||||
} else {
|
||||
$sql = 'UPDATE ' . BB_QUOTA . " SET quota_limit_id = $quota_limit_id
|
||||
WHERE group_id = $id AND quota_type = $quota_type";
|
||||
}
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Unable to update quota settings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort multi-dimensional array
|
||||
*
|
||||
* @param array $sort_array
|
||||
* @param string|int $key
|
||||
* @param int $sort_order
|
||||
* @return array
|
||||
*/
|
||||
function sort_multi_array(array $sort_array, $key, int $sort_order = SORT_ASC): array
|
||||
{
|
||||
$keys = array_column($sort_array, $key);
|
||||
array_multisort($keys, $sort_order, $sort_array);
|
||||
|
||||
return $sort_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns size of the upload directory in human readable format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_formatted_dirsize()
|
||||
{
|
||||
global $lang, $upload_dir;
|
||||
|
||||
$upload_dir_size = 0;
|
||||
|
||||
if ($dirname = opendir($upload_dir)) {
|
||||
while ($file = readdir($dirname)) {
|
||||
if (
|
||||
$file != 'index.php' &&
|
||||
$file != '.htaccess' &&
|
||||
!is_dir($upload_dir . '/' . $file) &&
|
||||
!is_link($upload_dir . '/' . $file)
|
||||
) {
|
||||
$upload_dir_size += filesize($upload_dir . '/' . $file);
|
||||
}
|
||||
}
|
||||
closedir($dirname);
|
||||
} else {
|
||||
return $lang['NOT_AVAILABLE'];
|
||||
}
|
||||
|
||||
return humn_size($upload_dir_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build SQL statement for the search feature
|
||||
*
|
||||
* @param $order_by
|
||||
* @param $total_rows
|
||||
* @return array
|
||||
*/
|
||||
function search_attachments($order_by, &$total_rows)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$where_sql = [];
|
||||
|
||||
// Author name search
|
||||
$search_author = get_var('search_author', '');
|
||||
if ($search_author) {
|
||||
// Bring in line with 2.0.x expected username
|
||||
$search_author = addslashes(html_entity_decode($search_author));
|
||||
$search_author = stripslashes(clean_username($search_author));
|
||||
|
||||
// Prepare for directly going into sql query
|
||||
$search_author = str_replace('*', '%', attach_mod_sql_escape($search_author));
|
||||
|
||||
// We need the post_id's, because we want to query the Attachment Table
|
||||
$sql = 'SELECT user_id FROM ' . BB_USERS . " WHERE username LIKE '$search_author'";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain list of matching users (searching for: ' . $search_author . ')');
|
||||
}
|
||||
|
||||
$matching_userids = '';
|
||||
if ($row = DB()->sql_fetchrow($result)) {
|
||||
do {
|
||||
$matching_userids .= (($matching_userids != '') ? ', ' : '') . $row['user_id'];
|
||||
} while ($row = DB()->sql_fetchrow($result));
|
||||
|
||||
DB()->sql_freeresult($result);
|
||||
} else {
|
||||
bb_die($lang['NO_ATTACH_SEARCH_MATCH']);
|
||||
}
|
||||
|
||||
$where_sql[] = ' (t.user_id_1 IN (' . $matching_userids . ')) ';
|
||||
}
|
||||
|
||||
// Search Keyword
|
||||
$search_keyword_fname = get_var('search_keyword_fname', '');
|
||||
if ($search_keyword_fname) {
|
||||
$match_word = str_replace('*', '%', $search_keyword_fname);
|
||||
$where_sql[] = " (a.real_filename LIKE '" . attach_mod_sql_escape($match_word) . "') ";
|
||||
}
|
||||
|
||||
$search_keyword_comment = get_var('search_keyword_comment', '');
|
||||
if ($search_keyword_comment) {
|
||||
$match_word = str_replace('*', '%', $search_keyword_comment);
|
||||
$where_sql[] = " (a.comment LIKE '" . attach_mod_sql_escape($match_word) . "') ";
|
||||
}
|
||||
|
||||
// Search Download Count
|
||||
$search_count_smaller = get_var('search_count_smaller', '');
|
||||
$search_count_greater = get_var('search_count_greater', '');
|
||||
if ($search_count_smaller != '') {
|
||||
$where_sql[] = ' (a.download_count < ' . (int)$search_count_smaller . ') ';
|
||||
} elseif ($search_count_greater != '') {
|
||||
$where_sql[] = ' (a.download_count > ' . (int)$search_count_greater . ') ';
|
||||
}
|
||||
|
||||
// Search Filesize
|
||||
$search_size_smaller = get_var('search_size_smaller', '');
|
||||
$search_size_greater = get_var('search_size_greater', '');
|
||||
if ($search_size_smaller != '') {
|
||||
$where_sql[] = ' (a.filesize < ' . (int)$search_size_smaller . ') ';
|
||||
} elseif ($search_size_greater != '') {
|
||||
$where_sql[] = ' (a.filesize > ' . (int)$search_size_greater . ') ';
|
||||
}
|
||||
|
||||
// Search Attachment Time
|
||||
$search_days_greater = get_var('search_days_greater', '');
|
||||
if ($search_days_greater) {
|
||||
$where_sql[] = ' (a.filetime < ' . (TIMENOW - ((int)$search_days_greater * 86400)) . ') ';
|
||||
}
|
||||
|
||||
// Search Forum
|
||||
$search_forum = get_var('search_forum', '');
|
||||
if ($search_forum) {
|
||||
$where_sql[] = ' (p.forum_id = ' . (int)$search_forum . ') ';
|
||||
}
|
||||
|
||||
$sql = 'SELECT a.*, t.post_id, p.post_time, p.topic_id
|
||||
FROM ' . BB_ATTACHMENTS . ' t, ' . BB_ATTACHMENTS_DESC . ' a, ' . BB_POSTS . ' p WHERE ';
|
||||
|
||||
if (count($where_sql) > 0) {
|
||||
$sql .= implode('AND', $where_sql) . ' AND ';
|
||||
}
|
||||
|
||||
$sql .= 't.post_id = p.post_id AND a.attach_id = t.attach_id ';
|
||||
|
||||
$total_rows_sql = $sql;
|
||||
|
||||
$sql .= $order_by;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attachments #1');
|
||||
}
|
||||
|
||||
$attachments = DB()->sql_fetchrowset($result);
|
||||
$num_attach = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_attach == 0) {
|
||||
bb_die($lang['NO_ATTACH_SEARCH_MATCH']);
|
||||
}
|
||||
|
||||
if (!($result = DB()->sql_query($total_rows_sql))) {
|
||||
bb_die('Could not query attachments #2');
|
||||
}
|
||||
|
||||
$total_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform limit statement on arrays
|
||||
*
|
||||
* @param $array
|
||||
* @param $start
|
||||
* @param $pagelimit
|
||||
* @return array
|
||||
*/
|
||||
function limit_array($array, $start, $pagelimit)
|
||||
{
|
||||
// array from start - start+pagelimit
|
||||
$limit = (count($array) < ($start + $pagelimit)) ? count($array) : $start + $pagelimit;
|
||||
|
||||
$limit_array = [];
|
||||
|
||||
for ($i = $start; $i < $limit; $i++) {
|
||||
$limit_array[] = $array[$i];
|
||||
}
|
||||
|
||||
return $limit_array;
|
||||
}
|
|
@ -1,592 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* All Attachment Functions needed everywhere
|
||||
*/
|
||||
|
||||
/**
|
||||
* A simple dectobase64 function
|
||||
*/
|
||||
function base64_pack($number)
|
||||
{
|
||||
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-';
|
||||
$base = strlen($chars);
|
||||
|
||||
if ($number > 4096) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($number < $base) {
|
||||
return $chars[$number];
|
||||
}
|
||||
|
||||
$hexval = '';
|
||||
|
||||
while ($number > 0) {
|
||||
$remainder = $number % $base;
|
||||
|
||||
if ($remainder < $base) {
|
||||
$hexval = $chars[$remainder] . $hexval;
|
||||
}
|
||||
|
||||
$number = floor($number / $base);
|
||||
}
|
||||
|
||||
return $hexval;
|
||||
}
|
||||
|
||||
/**
|
||||
* base64todec function
|
||||
*/
|
||||
function base64_unpack($string)
|
||||
{
|
||||
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-';
|
||||
$base = strlen($chars);
|
||||
|
||||
$length = strlen($string);
|
||||
$number = 0;
|
||||
|
||||
for ($i = 1; $i <= $length; $i++) {
|
||||
$pos = $length - $i;
|
||||
$operand = strpos($chars, (string) $string[$pos]);
|
||||
$exponent = $base ** ($i - 1);
|
||||
$decValue = $operand * $exponent;
|
||||
$number += $decValue;
|
||||
}
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per Forum based Extension Group Permissions (Encode Number) -> Theoretically up to 158 Forums saveable. :)
|
||||
* We are using a base of 64, but splitting it to one-char and two-char numbers. :)
|
||||
*/
|
||||
function auth_pack($auth_array)
|
||||
{
|
||||
$one_char_encoding = '#';
|
||||
$two_char_encoding = '.';
|
||||
$one_char = $two_char = false;
|
||||
$auth_cache = '';
|
||||
|
||||
foreach ($auth_array as $i => $iValue) {
|
||||
$val = base64_pack((int)$auth_array[$i]);
|
||||
if (strlen($val) == 1 && !$one_char) {
|
||||
$auth_cache .= $one_char_encoding;
|
||||
$one_char = true;
|
||||
} elseif (strlen($val) == 2 && !$two_char) {
|
||||
$auth_cache .= $two_char_encoding;
|
||||
$two_char = true;
|
||||
}
|
||||
|
||||
$auth_cache .= $val;
|
||||
}
|
||||
|
||||
return $auth_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the auth_pack process
|
||||
*/
|
||||
function auth_unpack($auth_cache)
|
||||
{
|
||||
$one_char_encoding = '#';
|
||||
$two_char_encoding = '.';
|
||||
|
||||
$auth = [];
|
||||
$auth_len = 1;
|
||||
|
||||
for ($pos = 0, $posMax = strlen($auth_cache); $pos < $posMax; $pos += $auth_len) {
|
||||
$forum_auth = $auth_cache[$pos];
|
||||
if ($forum_auth == $one_char_encoding) {
|
||||
$auth_len = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($forum_auth == $two_char_encoding) {
|
||||
$auth_len = 2;
|
||||
$pos--;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forum_auth = substr($auth_cache, $pos, $auth_len);
|
||||
$forum_id = base64_unpack($forum_auth);
|
||||
$auth[] = (int)$forum_id;
|
||||
}
|
||||
return $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for determining if Forum ID is authed, please use this Function on all Posting Screens
|
||||
*/
|
||||
function is_forum_authed($auth_cache, $check_forum_id)
|
||||
{
|
||||
$one_char_encoding = '#';
|
||||
$two_char_encoding = '.';
|
||||
|
||||
if (trim($auth_cache) == '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$auth = [];
|
||||
$auth_len = 1;
|
||||
|
||||
for ($pos = 0, $posMax = strlen($auth_cache); $pos < $posMax; $pos += $auth_len) {
|
||||
$forum_auth = $auth_cache[$pos];
|
||||
if ($forum_auth == $one_char_encoding) {
|
||||
$auth_len = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($forum_auth == $two_char_encoding) {
|
||||
$auth_len = 2;
|
||||
$pos--;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forum_auth = substr($auth_cache, $pos, $auth_len);
|
||||
$forum_id = (int)base64_unpack($forum_auth);
|
||||
if ($forum_id == $check_forum_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an Attachment
|
||||
*/
|
||||
function unlink_attach($filename, $mode = false)
|
||||
{
|
||||
global $upload_dir, $attach_config;
|
||||
|
||||
$filename = basename($filename);
|
||||
|
||||
if ($mode == MODE_THUMBNAIL) {
|
||||
$filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $filename;
|
||||
} else {
|
||||
$filename = $upload_dir . '/' . $filename;
|
||||
}
|
||||
|
||||
return @unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Attachment exist
|
||||
*/
|
||||
function attachment_exists($filename)
|
||||
{
|
||||
global $upload_dir, $attach_config;
|
||||
|
||||
$filename = basename($filename);
|
||||
|
||||
if (!@file_exists(@amod_realpath($upload_dir . '/' . $filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Thumbnail exist
|
||||
*/
|
||||
function thumbnail_exists($filename)
|
||||
{
|
||||
global $upload_dir, $attach_config;
|
||||
|
||||
$filename = basename($filename);
|
||||
|
||||
if (!@file_exists(@amod_realpath($upload_dir . '/' . THUMB_DIR . '/t_' . $filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Physical Filename stored already ?
|
||||
*/
|
||||
function physical_filename_already_stored($filename)
|
||||
{
|
||||
if ($filename == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$filename = basename($filename);
|
||||
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . BB_ATTACHMENTS_DESC . "
|
||||
WHERE physical_filename = '" . attach_mod_sql_escape($filename) . "'
|
||||
LIMIT 1";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get attachment information for filename: ' . htmlspecialchars($filename));
|
||||
}
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
return $num_rows != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all attachments from a post (could be an post array too)
|
||||
*/
|
||||
function get_attachments_from_post($post_id_array)
|
||||
{
|
||||
global $attach_config;
|
||||
|
||||
$attachments = [];
|
||||
|
||||
if (!is_array($post_id_array)) {
|
||||
if (empty($post_id_array)) {
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
$post_id = (int)$post_id_array;
|
||||
|
||||
$post_id_array = [];
|
||||
$post_id_array[] = $post_id;
|
||||
}
|
||||
|
||||
$post_id_array = implode(', ', array_map('\intval', $post_id_array));
|
||||
|
||||
if ($post_id_array == '') {
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
$display_order = ((int)$attach_config['display_order'] == 0) ? 'DESC' : 'ASC';
|
||||
|
||||
$sql = 'SELECT a.post_id, d.*
|
||||
FROM ' . BB_ATTACHMENTS . ' a, ' . BB_ATTACHMENTS_DESC . " d
|
||||
WHERE a.post_id IN ($post_id_array)
|
||||
AND a.attach_id = d.attach_id
|
||||
ORDER BY d.filetime $display_order";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get attachment informations for post number ' . $post_id_array);
|
||||
}
|
||||
|
||||
$num_rows = DB()->num_rows($result);
|
||||
$attachments = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Filesize of Attachments in Database based on the attachment id
|
||||
*/
|
||||
function get_total_attach_filesize($attach_ids)
|
||||
{
|
||||
if (!is_array($attach_ids) || !count($attach_ids)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$attach_ids = implode(', ', array_map('\intval', $attach_ids));
|
||||
|
||||
if (!$attach_ids) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = 'SELECT filesize FROM ' . BB_ATTACHMENTS_DESC . " WHERE attach_id IN ($attach_ids)";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query total filesize');
|
||||
}
|
||||
|
||||
$total_filesize = 0;
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$total_filesize += (int)$row['filesize'];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
return $total_filesize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get allowed Extensions and their respective Values
|
||||
*/
|
||||
function get_extension_informations()
|
||||
{
|
||||
return $GLOBALS['datastore']->get('attach_extensions');
|
||||
}
|
||||
|
||||
//
|
||||
// Sync Topic
|
||||
//
|
||||
function attachment_sync_topic($topics)
|
||||
{
|
||||
if (is_array($topics)) {
|
||||
$topics = implode(',', $topics);
|
||||
}
|
||||
$posts_without_attach = $topics_without_attach = [];
|
||||
|
||||
// Check orphan post_attachment markers
|
||||
$sql = "SELECT p.post_id
|
||||
FROM " . BB_POSTS . " p
|
||||
LEFT JOIN " . BB_ATTACHMENTS . " a USING(post_id)
|
||||
WHERE p.topic_id IN($topics)
|
||||
AND p.post_attachment = 1
|
||||
AND a.post_id IS NULL";
|
||||
|
||||
if ($rowset = DB()->fetch_rowset($sql)) {
|
||||
foreach ($rowset as $row) {
|
||||
$posts_without_attach[] = $row['post_id'];
|
||||
}
|
||||
if ($posts_sql = implode(',', $posts_without_attach)) {
|
||||
DB()->query("UPDATE " . BB_POSTS . " SET post_attachment = 0 WHERE post_id IN($posts_sql)");
|
||||
}
|
||||
}
|
||||
|
||||
// Update missing topic_attachment markers
|
||||
DB()->query("
|
||||
UPDATE " . BB_TOPICS . " t, " . BB_POSTS . " p SET
|
||||
t.topic_attachment = 1
|
||||
WHERE p.topic_id IN($topics)
|
||||
AND p.post_attachment = 1
|
||||
AND p.topic_id = t.topic_id
|
||||
");
|
||||
|
||||
// Fix orphan topic_attachment markers
|
||||
$sql = "SELECT t.topic_id
|
||||
FROM " . BB_POSTS . " p, " . BB_TOPICS . " t
|
||||
WHERE t.topic_id = p.topic_id
|
||||
AND t.topic_id IN($topics)
|
||||
AND t.topic_attachment = 1
|
||||
GROUP BY p.topic_id
|
||||
HAVING SUM(p.post_attachment) = 0";
|
||||
|
||||
if ($rowset = DB()->fetch_rowset($sql)) {
|
||||
foreach ($rowset as $row) {
|
||||
$topics_without_attach[] = $row['topic_id'];
|
||||
}
|
||||
if ($topics_sql = implode(',', $topics_without_attach)) {
|
||||
DB()->query("UPDATE " . BB_TOPICS . " SET topic_attachment = 0 WHERE topic_id IN($topics_sql)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Extension
|
||||
*/
|
||||
function get_extension($filename)
|
||||
{
|
||||
if (false === strpos($filename, '.')) {
|
||||
return '';
|
||||
}
|
||||
$extension = strrchr(strtolower($filename), '.');
|
||||
$extension[0] = ' ';
|
||||
$extension = strtolower(trim($extension));
|
||||
if (is_array($extension)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Extension
|
||||
*/
|
||||
function delete_extension($filename)
|
||||
{
|
||||
return substr($filename, 0, strripos(trim($filename), '.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a user is within Group
|
||||
*/
|
||||
function user_in_group($user_id, $group_id)
|
||||
{
|
||||
$user_id = (int)$user_id;
|
||||
$group_id = (int)$group_id;
|
||||
|
||||
if (!$user_id || !$group_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'SELECT u.group_id
|
||||
FROM ' . BB_USER_GROUP . ' u, ' . BB_GROUPS . " g
|
||||
WHERE g.group_single_user = 0
|
||||
AND u.group_id = g.group_id
|
||||
AND u.user_id = $user_id
|
||||
AND g.group_id = $group_id
|
||||
LIMIT 1";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not get user group');
|
||||
}
|
||||
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
return !($num_rows == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Realpath replacement for attachment mod
|
||||
*/
|
||||
function amod_realpath($path)
|
||||
{
|
||||
return (function_exists('realpath')) ? realpath($path) : $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* _set_var
|
||||
*
|
||||
* Set variable, used by {@link get_var the get_var function}
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function _set_var(&$result, $var, $type, $multibyte = false)
|
||||
{
|
||||
settype($var, $type);
|
||||
$result = $var;
|
||||
|
||||
if ($type == 'string') {
|
||||
$result = trim(str_replace(array("\r\n", "\r", '\xFF'), array("\n", "\n", ' '), $result));
|
||||
// 2.0.x is doing addslashes on all variables
|
||||
$result = stripslashes($result);
|
||||
if ($multibyte) {
|
||||
$result = preg_replace('#&(\#[0-9]+;)#', '&\1', $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get passed variable
|
||||
*
|
||||
* @param $var_name
|
||||
* @param $default
|
||||
* @param bool $multibyte
|
||||
* @return array
|
||||
*/
|
||||
function get_var($var_name, $default, $multibyte = false)
|
||||
{
|
||||
$type = null;
|
||||
if (!isset($_REQUEST[$var_name]) ||
|
||||
(is_array($_REQUEST[$var_name]) && !is_array($default)) ||
|
||||
(is_array($default) && !is_array($_REQUEST[$var_name]))) {
|
||||
return (is_array($default)) ? [] : $default;
|
||||
}
|
||||
|
||||
$var = $_REQUEST[$var_name];
|
||||
|
||||
if (!is_array($default)) {
|
||||
$type = gettype($default);
|
||||
$key_type = null;
|
||||
} else {
|
||||
foreach ($default as $key_type => $type) {
|
||||
$key_type = gettype($key_type);
|
||||
$type = gettype($type);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($var)) {
|
||||
$_var = $var;
|
||||
$var = [];
|
||||
|
||||
foreach ($_var as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
foreach ($v as $_k => $_v) {
|
||||
_set_var($k, $k, $key_type);
|
||||
_set_var($_k, $_k, $key_type);
|
||||
_set_var($var[$k][$_k], $_v, $type, $multibyte);
|
||||
}
|
||||
} else {
|
||||
_set_var($k, $k, $key_type);
|
||||
_set_var($var[$k], $v, $type, $multibyte);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_set_var($var, $var, $type, $multibyte);
|
||||
}
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escaping SQL
|
||||
*/
|
||||
function attach_mod_sql_escape($text)
|
||||
{
|
||||
if (function_exists('mysqli_real_escape_string')) {
|
||||
return DB()->escape_string($text);
|
||||
}
|
||||
|
||||
return str_replace(['\\', "'"], ['\\\\', "''"], $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build sql statement from array for insert/update/select statements
|
||||
*
|
||||
* Idea for this from Ikonboard
|
||||
* Possible query values: INSERT, INSERT_SELECT, MULTI_INSERT, UPDATE, SELECT
|
||||
*/
|
||||
function attach_mod_sql_build_array($query, $assoc_ary = false)
|
||||
{
|
||||
if (!is_array($assoc_ary)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = [];
|
||||
$values = [];
|
||||
if ($query == 'INSERT' || $query == 'INSERT_SELECT') {
|
||||
foreach ($assoc_ary as $key => $var) {
|
||||
$fields[] = $key;
|
||||
|
||||
if (null === $var) {
|
||||
$values[] = 'NULL';
|
||||
} elseif (is_string($var)) {
|
||||
$values[] = "'" . attach_mod_sql_escape($var) . "'";
|
||||
} elseif (is_array($var) && is_string($var[0])) {
|
||||
$values[] = $var[0];
|
||||
} else {
|
||||
$values[] = (is_bool($var)) ? (int)$var : $var;
|
||||
}
|
||||
}
|
||||
|
||||
$query = ($query == 'INSERT') ? ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')' : ' (' . implode(', ', $fields) . ') SELECT ' . implode(', ', $values) . ' ';
|
||||
} elseif ($query == 'MULTI_INSERT') {
|
||||
$ary = [];
|
||||
foreach ($assoc_ary as $id => $sql_ary) {
|
||||
$values = [];
|
||||
foreach ($sql_ary as $key => $var) {
|
||||
if (null === $var) {
|
||||
$values[] = 'NULL';
|
||||
} elseif (is_string($var)) {
|
||||
$values[] = "'" . attach_mod_sql_escape($var) . "'";
|
||||
} else {
|
||||
$values[] = (is_bool($var)) ? (int)$var : $var;
|
||||
}
|
||||
}
|
||||
$ary[] = '(' . implode(', ', $values) . ')';
|
||||
}
|
||||
|
||||
$query = ' (' . implode(', ', array_keys($assoc_ary[0])) . ') VALUES ' . implode(', ', $ary);
|
||||
} elseif ($query == 'UPDATE' || $query == 'SELECT') {
|
||||
$values = [];
|
||||
foreach ($assoc_ary as $key => $var) {
|
||||
if (null === $var) {
|
||||
$values[] = "$key = NULL";
|
||||
} elseif (is_string($var)) {
|
||||
$values[] = "$key = '" . attach_mod_sql_escape($var) . "'";
|
||||
} else {
|
||||
$values[] = (is_bool($var)) ? "$key = " . (int)$var : "$key = $var";
|
||||
}
|
||||
}
|
||||
$query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
|
@ -1,239 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* All Attachment Functions processing the Deletion Process
|
||||
*/
|
||||
|
||||
/**
|
||||
* Delete Attachment(s) from post(s) (intern)
|
||||
*/
|
||||
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
|
||||
{
|
||||
$lang = [];
|
||||
// Generate Array, if it's not an array
|
||||
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($post_id_array === 0 && $attach_id_array !== 0) {
|
||||
$post_id_array = array();
|
||||
|
||||
if (!is_array($attach_id_array)) {
|
||||
if (false !== strpos($attach_id_array, ', ')) {
|
||||
$attach_id_array = explode(', ', $attach_id_array);
|
||||
} elseif (false !== strpos($attach_id_array, ',')) {
|
||||
$attach_id_array = explode(',', $attach_id_array);
|
||||
} else {
|
||||
$attach_id = (int)$attach_id_array;
|
||||
$attach_id_array = array();
|
||||
$attach_id_array[] = $attach_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the post_ids to fill the array
|
||||
$p_id = 'post_id';
|
||||
|
||||
$sql = "SELECT $p_id
|
||||
FROM " . BB_ATTACHMENTS . '
|
||||
WHERE attach_id IN (' . implode(', ', $attach_id_array) . ")
|
||||
GROUP BY $p_id";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select ids');
|
||||
}
|
||||
|
||||
$num_post_list = DB()->num_rows($result);
|
||||
|
||||
if ($num_post_list == 0) {
|
||||
DB()->sql_freeresult($result);
|
||||
return;
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$post_id_array[] = (int)$row[$p_id];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!is_array($post_id_array)) {
|
||||
if (trim($post_id_array) == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (false !== strpos($post_id_array, ', ')) {
|
||||
$post_id_array = explode(', ', $post_id_array);
|
||||
} elseif (false !== strpos($post_id_array, ',')) {
|
||||
$post_id_array = explode(',', $post_id_array);
|
||||
} else {
|
||||
$post_id = (int)$post_id_array;
|
||||
|
||||
$post_id_array = array();
|
||||
$post_id_array[] = $post_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($post_id_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First of all, determine the post id and attach_id
|
||||
if ($attach_id_array === 0) {
|
||||
$attach_id_array = array();
|
||||
|
||||
// Get the attach_ids to fill the array
|
||||
$whereclause = 'WHERE post_id IN (' . implode(', ', $post_id_array) . ')';
|
||||
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . BB_ATTACHMENTS . " $whereclause
|
||||
GROUP BY attach_id";
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select attachment id #1');
|
||||
}
|
||||
|
||||
$num_attach_list = DB()->num_rows($result);
|
||||
|
||||
if ($num_attach_list == 0) {
|
||||
DB()->sql_freeresult($result);
|
||||
return;
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$attach_id_array[] = (int)$row['attach_id'];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!is_array($attach_id_array)) {
|
||||
if (false !== strpos($attach_id_array, ', ')) {
|
||||
$attach_id_array = explode(', ', $attach_id_array);
|
||||
} elseif (false !== strpos($attach_id_array, ',')) {
|
||||
$attach_id_array = explode(',', $attach_id_array);
|
||||
} else {
|
||||
$attach_id = (int)$attach_id_array;
|
||||
|
||||
$attach_id_array = array();
|
||||
$attach_id_array[] = $attach_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($attach_id_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql_id = 'post_id';
|
||||
|
||||
if (count($post_id_array) && count($attach_id_array)) {
|
||||
$sql = 'DELETE FROM ' . BB_ATTACHMENTS . '
|
||||
WHERE attach_id IN (' . implode(', ', $attach_id_array) . ")
|
||||
AND $sql_id IN (" . implode(', ', $post_id_array) . ')';
|
||||
|
||||
if (!(DB()->sql_query($sql))) {
|
||||
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||
}
|
||||
|
||||
//bt
|
||||
if ($sql_id == 'post_id') {
|
||||
$sql = "SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE attach_id IN(" . implode(',', $attach_id_array) . ")";
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||
}
|
||||
|
||||
$torrents_sql = array();
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$torrents_sql[] = $row['topic_id'];
|
||||
}
|
||||
|
||||
if ($torrents_sql = implode(',', $torrents_sql)) {
|
||||
// Remove peers from tracker
|
||||
$sql = "DELETE FROM " . BB_BT_TRACKER . "
|
||||
WHERE topic_id IN($torrents_sql)";
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die('Could not delete peers');
|
||||
}
|
||||
}
|
||||
// Delete torrents
|
||||
$sql = "DELETE FROM " . BB_BT_TORRENTS . "
|
||||
WHERE attach_id IN(" . implode(',', $attach_id_array) . ")";
|
||||
|
||||
if (!DB()->sql_query($sql)) {
|
||||
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||
}
|
||||
}
|
||||
//bt end
|
||||
|
||||
foreach ($attach_id_array as $i => $iValue) {
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . BB_ATTACHMENTS . '
|
||||
WHERE attach_id = ' . (int)$attach_id_array[$i];
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select Attachment id #2');
|
||||
}
|
||||
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows == 0) {
|
||||
$sql = 'SELECT attach_id, physical_filename, thumbnail
|
||||
FROM ' . BB_ATTACHMENTS_DESC . '
|
||||
WHERE attach_id = ' . (int)$attach_id_array[$i];
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query attach description table');
|
||||
}
|
||||
$num_rows = DB()->num_rows($result);
|
||||
|
||||
if ($num_rows != 0) {
|
||||
$num_attach = $num_rows;
|
||||
$attachments = DB()->sql_fetchrowset($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
// delete attachments
|
||||
for ($j = 0; $j < $num_attach; $j++) {
|
||||
unlink_attach($attachments[$j]['physical_filename']);
|
||||
|
||||
if ((int)$attachments[$j]['thumbnail'] == 1) {
|
||||
unlink_attach($attachments[$j]['physical_filename'], MODE_THUMBNAIL);
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int)$attachments[$j]['attach_id'];
|
||||
|
||||
if (!(DB()->sql_query($sql))) {
|
||||
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now Sync the Topic/PM
|
||||
if (count($post_id_array)) {
|
||||
$sql = 'SELECT topic_id
|
||||
FROM ' . BB_POSTS . '
|
||||
WHERE post_id IN (' . implode(', ', $post_id_array) . ')
|
||||
GROUP BY topic_id';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select topic id');
|
||||
}
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
attachment_sync_topic($row['topic_id']);
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
}
|
||||
}
|
|
@ -1,258 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* All Attachment Functions needed to determine Special Files/Dimensions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read Long Int (4 Bytes) from File
|
||||
*/
|
||||
function read_longint($fp)
|
||||
{
|
||||
$data = fread($fp, 4);
|
||||
|
||||
$value = ord($data[0]) + (ord($data[1]) << 8) + (ord($data[2]) << 16) + (ord($data[3]) << 24);
|
||||
if ($value >= 4294967294) {
|
||||
$value -= 4294967296;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Word (2 Bytes) from File - Note: It's an Intel Word
|
||||
*/
|
||||
function read_word($fp)
|
||||
{
|
||||
$data = fread($fp, 2);
|
||||
|
||||
return ord($data[1]) * 256 + ord($data[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Byte
|
||||
*/
|
||||
function read_byte($fp)
|
||||
{
|
||||
$data = fread($fp, 1);
|
||||
|
||||
return ord($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Image Dimensions
|
||||
*/
|
||||
function image_getdimension($file)
|
||||
{
|
||||
$xmax = null;
|
||||
$xmin = null;
|
||||
$ymax = null;
|
||||
$ymin = null;
|
||||
$size = @getimagesize($file);
|
||||
|
||||
if ($size[0] != 0 || $size[1] != 0) {
|
||||
return $size;
|
||||
}
|
||||
|
||||
// Try to get the Dimension manually, depending on the mimetype
|
||||
$fp = @fopen($file, 'rb');
|
||||
if (!$fp) {
|
||||
return $size;
|
||||
}
|
||||
|
||||
$error = false;
|
||||
|
||||
// BMP - IMAGE
|
||||
|
||||
$tmp_str = fread($fp, 2);
|
||||
if ($tmp_str == 'BM') {
|
||||
$length = read_longint($fp);
|
||||
|
||||
if ($length <= 6) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$i = read_longint($fp);
|
||||
if ($i != 0) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$i = read_longint($fp);
|
||||
|
||||
if ($i != 0x3E && $i != 0x76 && $i != 0x436 && $i != 0x36) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$tmp_str = fread($fp, 4);
|
||||
$width = read_longint($fp);
|
||||
$height = read_longint($fp);
|
||||
|
||||
if ($width > 3000 || $height > 3000) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
fclose($fp);
|
||||
return array(
|
||||
$width,
|
||||
$height,
|
||||
6
|
||||
);
|
||||
}
|
||||
|
||||
$error = false;
|
||||
fclose($fp);
|
||||
|
||||
// GIF - IMAGE
|
||||
|
||||
$fp = @fopen($file, 'rb');
|
||||
|
||||
$tmp_str = fread($fp, 3);
|
||||
|
||||
if ($tmp_str == 'GIF') {
|
||||
$tmp_str = fread($fp, 3);
|
||||
$width = read_word($fp);
|
||||
$height = read_word($fp);
|
||||
|
||||
$info_byte = fread($fp, 1);
|
||||
$info_byte = ord($info_byte);
|
||||
if (($info_byte & 0x80) != 0x80 && ($info_byte & 0x80) != 0) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (($info_byte & 8) != 0) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
fclose($fp);
|
||||
return array(
|
||||
$width,
|
||||
$height,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
$error = false;
|
||||
fclose($fp);
|
||||
|
||||
// JPG - IMAGE
|
||||
$fp = @fopen($file, 'rb');
|
||||
|
||||
$tmp_str = fread($fp, 4);
|
||||
$w1 = read_word($fp);
|
||||
|
||||
if ((int)$w1 < 16) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$tmp_str = fread($fp, 4);
|
||||
if ($tmp_str == 'JFIF') {
|
||||
$o_byte = fread($fp, 1);
|
||||
if ((int)$o_byte != 0) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$str = fread($fp, 2);
|
||||
$b = read_byte($fp);
|
||||
|
||||
if ($b != 0 && $b != 1 && $b != 2) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$width = read_word($fp);
|
||||
$height = read_word($fp);
|
||||
|
||||
if ($width <= 0 || $height <= 0) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
fclose($fp);
|
||||
return array(
|
||||
$width,
|
||||
$height,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
$error = false;
|
||||
fclose($fp);
|
||||
|
||||
// PCX - IMAGE
|
||||
|
||||
$fp = @fopen($file, 'rb');
|
||||
|
||||
$tmp_str = fread($fp, 3);
|
||||
|
||||
if ((ord($tmp_str[0]) == 10) && (ord($tmp_str[1]) == 0 || ord($tmp_str[1]) == 2 || ord($tmp_str[1]) == 3 || ord($tmp_str[1]) == 4 || ord($tmp_str[1]) == 5) && (ord($tmp_str[2]) == 1)) {
|
||||
$b = fread($fp, 1);
|
||||
|
||||
if (ord($b) != 1 && ord($b) != 2 && ord($b) != 4 && ord($b) != 8 && ord($b) != 24) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$xmin = read_word($fp);
|
||||
$ymin = read_word($fp);
|
||||
$xmax = read_word($fp);
|
||||
$ymax = read_word($fp);
|
||||
$tmp_str = fread($fp, 52);
|
||||
|
||||
$b = fread($fp, 1);
|
||||
if ($b != 0) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$width = $xmax - $xmin + 1;
|
||||
$height = $ymax - $ymin + 1;
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
fclose($fp);
|
||||
return array(
|
||||
$width,
|
||||
$height,
|
||||
7
|
||||
);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
return $size;
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup s_auth_can in viewforum and viewtopic (viewtopic.php/viewforum.php)
|
||||
*/
|
||||
function attach_build_auth_levels($is_auth, &$s_auth_can)
|
||||
{
|
||||
global $lang, $attach_config;
|
||||
|
||||
if ((int)$attach_config['disable_mod']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
|
||||
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']) . '<br />';
|
||||
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']) . '<br />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from admin_users.php and admin_groups.php in order to process Quota Settings (admin/admin_users.php:admin/admin_groups.php)
|
||||
*/
|
||||
function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||
{
|
||||
global $template, $lang, $attach_config;
|
||||
$this_userdata = [];
|
||||
|
||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':')) {
|
||||
$upload_dir = $attach_config['upload_dir'];
|
||||
} else {
|
||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||
}
|
||||
|
||||
include ATTACH_DIR . '/includes/functions_selects.php';
|
||||
if (!function_exists("process_quota_settings")) {
|
||||
include ATTACH_DIR . '/includes/functions_admin.php';
|
||||
}
|
||||
|
||||
$user_id = 0;
|
||||
|
||||
if ($admin_mode == 'user') {
|
||||
// We overwrite submit here... to be sure
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
|
||||
if (!$submit && $mode != 'save') {
|
||||
$user_id = get_var(POST_USERS_URL, 0);
|
||||
$u_name = get_var('username', '');
|
||||
|
||||
if (!$user_id && !$u_name) {
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
|
||||
if ($user_id) {
|
||||
$this_userdata['user_id'] = $user_id;
|
||||
} else {
|
||||
// Get userdata is handling the sanitizing of username
|
||||
$this_userdata = get_userdata($_POST['username'], true);
|
||||
}
|
||||
|
||||
$user_id = (int)$this_userdata['user_id'];
|
||||
} else {
|
||||
$user_id = get_var('id', 0);
|
||||
|
||||
if (!$user_id) {
|
||||
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($admin_mode == 'user' && !$submit && $mode != 'save') {
|
||||
// Show the contents
|
||||
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE user_id = ' . (int)$user_id;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Unable to get quota settings #1');
|
||||
}
|
||||
|
||||
$pm_quota = $upload_quota = 0;
|
||||
|
||||
if ($row = DB()->sql_fetchrow($result)) {
|
||||
do {
|
||||
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT) {
|
||||
$upload_quota = $row['quota_limit_id'];
|
||||
} elseif ($row['quota_type'] == QUOTA_PM_LIMIT) {
|
||||
$pm_quota = $row['quota_limit_id'];
|
||||
}
|
||||
} while ($row = DB()->sql_fetchrow($result));
|
||||
} else {
|
||||
// Set Default Quota Limit
|
||||
$upload_quota = $attach_config['default_upload_quota'];
|
||||
$pm_quota = $attach_config['default_pm_quota'];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
|
||||
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
|
||||
));
|
||||
}
|
||||
|
||||
if ($admin_mode == 'user' && $submit && @$_POST['delete_user']) {
|
||||
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, 0);
|
||||
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, 0);
|
||||
} elseif ($admin_mode == 'user' && $submit && $mode == 'save') {
|
||||
// Get the contents
|
||||
$upload_quota = get_var('user_upload_quota', 0);
|
||||
$pm_quota = get_var('user_pm_quota', 0);
|
||||
|
||||
process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
|
||||
process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, $pm_quota);
|
||||
}
|
||||
|
||||
if ($admin_mode == 'group' && $mode == 'newgroup') {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($admin_mode == 'group' && !$submit && isset($_POST['edit'])) {
|
||||
// Get group id again
|
||||
$group_id = get_var(POST_GROUPS_URL, 0);
|
||||
|
||||
// Show the contents
|
||||
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE group_id = ' . (int)$group_id;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Unable to get quota settings #2');
|
||||
}
|
||||
|
||||
$pm_quota = $upload_quota = 0;
|
||||
|
||||
if ($row = DB()->sql_fetchrow($result)) {
|
||||
do {
|
||||
if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT) {
|
||||
$upload_quota = $row['quota_limit_id'];
|
||||
} elseif ($row['quota_type'] == QUOTA_PM_LIMIT) {
|
||||
$pm_quota = $row['quota_limit_id'];
|
||||
}
|
||||
} while ($row = DB()->sql_fetchrow($result));
|
||||
} else {
|
||||
// Set Default Quota Limit
|
||||
$upload_quota = $attach_config['default_upload_quota'];
|
||||
$pm_quota = $attach_config['default_pm_quota'];
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
|
||||
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
|
||||
));
|
||||
}
|
||||
|
||||
if ($admin_mode == 'group' && $submit && isset($_POST['group_delete'])) {
|
||||
$group_id = get_var(POST_GROUPS_URL, 0);
|
||||
|
||||
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, 0);
|
||||
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, 0);
|
||||
} elseif ($admin_mode == 'group' && $submit) {
|
||||
$group_id = get_var(POST_GROUPS_URL, 0);
|
||||
|
||||
// Get the contents
|
||||
$upload_quota = get_var('group_upload_quota', 0);
|
||||
$pm_quota = get_var('group_pm_quota', 0);
|
||||
|
||||
process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
|
||||
process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
|
||||
}
|
||||
}
|
|
@ -1,232 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Functions to build select boxes ;)
|
||||
*/
|
||||
|
||||
/**
|
||||
* select group
|
||||
*/
|
||||
function group_select($select_name, $default_group = 0)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$sql = 'SELECT group_id, group_name FROM ' . BB_EXTENSION_GROUPS . ' ORDER BY group_name';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query extension groups table #1');
|
||||
}
|
||||
|
||||
$group_select = '<select name="' . $select_name . '">';
|
||||
|
||||
$group_name = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
$group_name[$num_rows]['group_id'] = 0;
|
||||
$group_name[$num_rows]['group_name'] = $lang['NOT_ASSIGNED'];
|
||||
|
||||
for ($i = 0, $iMax = count($group_name); $i < $iMax; $i++) {
|
||||
if (!$default_group) {
|
||||
$selected = ($i == 0) ? ' selected="selected"' : '';
|
||||
} else {
|
||||
$selected = ($group_name[$i]['group_id'] == $default_group) ? ' selected="selected"' : '';
|
||||
}
|
||||
|
||||
$group_select .= '<option value="' . $group_name[$i]['group_id'] . '"' . $selected . '>' . $group_name[$i]['group_name'] . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$group_select .= '</select>';
|
||||
|
||||
return $group_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* select download mode
|
||||
*/
|
||||
function download_select($select_name, $group_id = 0)
|
||||
{
|
||||
global $types_download, $modes_download;
|
||||
|
||||
if ($group_id) {
|
||||
$sql = 'SELECT download_mode
|
||||
FROM ' . BB_EXTENSION_GROUPS . '
|
||||
WHERE group_id = ' . (int)$group_id;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query extension groups table #2');
|
||||
}
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if (!isset($row['download_mode'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$download_mode = $row['download_mode'];
|
||||
}
|
||||
|
||||
$group_select = '<select name="' . $select_name . '">';
|
||||
|
||||
for ($i = 0, $iMax = count($types_download); $i < $iMax; $i++) {
|
||||
if (!$group_id) {
|
||||
$selected = ($types_download[$i] == INLINE_LINK) ? ' selected="selected"' : '';
|
||||
} else {
|
||||
$selected = ($row['download_mode'] == $types_download[$i]) ? ' selected="selected"' : '';
|
||||
}
|
||||
|
||||
$group_select .= '<option value="' . $types_download[$i] . '"' . $selected . '>' . $modes_download[$i] . '</option>';
|
||||
}
|
||||
|
||||
$group_select .= '</select>';
|
||||
|
||||
return $group_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* select category types
|
||||
*/
|
||||
function category_select($select_name, $group_id = 0)
|
||||
{
|
||||
global $types_category, $modes_category;
|
||||
$category_type = null;
|
||||
|
||||
$sql = 'SELECT group_id, cat_id FROM ' . BB_EXTENSION_GROUPS;
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not select category');
|
||||
}
|
||||
|
||||
$rows = DB()->sql_fetchrowset($result);
|
||||
$num_rows = DB()->num_rows($result);
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
$type_category = 0;
|
||||
|
||||
if ($num_rows > 0) {
|
||||
for ($i = 0; $i < $num_rows; $i++) {
|
||||
if ($group_id == $rows[$i]['group_id']) {
|
||||
$category_type = $rows[$i]['cat_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$types = array(NONE_CAT);
|
||||
$modes = array('none');
|
||||
|
||||
for ($i = 0, $iMax = count($types_category); $i < $iMax; $i++) {
|
||||
$types[] = $types_category[$i];
|
||||
$modes[] = $modes_category[$i];
|
||||
}
|
||||
|
||||
$group_select = '<select name="' . $select_name . '" style="width:100px">';
|
||||
|
||||
for ($i = 0, $iMax = count($types); $i < $iMax; $i++) {
|
||||
if (!$group_id) {
|
||||
$selected = ($types[$i] == NONE_CAT) ? ' selected="selected"' : '';
|
||||
} else {
|
||||
$selected = ($types[$i] == $category_type) ? ' selected="selected"' : '';
|
||||
}
|
||||
|
||||
$group_select .= '<option value="' . $types[$i] . '"' . $selected . '>' . $modes[$i] . '</option>';
|
||||
}
|
||||
|
||||
$group_select .= '</select>';
|
||||
|
||||
return $group_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select size mode
|
||||
*/
|
||||
function size_select($select_name, $size_compare)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$size_types_text = array($lang['BYTES'], $lang['KB'], $lang['MB']);
|
||||
$size_types = array('b', 'kb', 'mb');
|
||||
|
||||
$select_field = '<select name="' . $select_name . '">';
|
||||
|
||||
for ($i = 0, $iMax = count($size_types_text); $i < $iMax; $i++) {
|
||||
$selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
|
||||
$select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
|
||||
}
|
||||
|
||||
$select_field .= '</select>';
|
||||
|
||||
return $select_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* select quota limit
|
||||
*/
|
||||
function quota_limit_select($select_name, $default_quota = 0)
|
||||
{
|
||||
global $lang;
|
||||
$quota_name = [];
|
||||
|
||||
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query quota limits table #1');
|
||||
}
|
||||
|
||||
$quota_select = '<select name="' . $select_name . '">';
|
||||
$quota_name[0]['quota_limit_id'] = 0;
|
||||
$quota_name[0]['quota_desc'] = $lang['NOT_ASSIGNED'];
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$quota_name[] = $row;
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
foreach ($quota_name as $i => $iValue) {
|
||||
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
|
||||
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
|
||||
}
|
||||
$quota_select .= '</select>';
|
||||
|
||||
return $quota_select;
|
||||
}
|
||||
|
||||
/**
|
||||
* select default quota limit
|
||||
*/
|
||||
function default_quota_limit_select($select_name, $default_quota = 0)
|
||||
{
|
||||
global $lang;
|
||||
$quota_name = [];
|
||||
|
||||
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
|
||||
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not query quota limits table #2');
|
||||
}
|
||||
|
||||
$quota_select = '<select name="' . $select_name . '">';
|
||||
$quota_name[0]['quota_limit_id'] = 0;
|
||||
$quota_name[0]['quota_desc'] = $lang['NO_QUOTA_LIMIT'];
|
||||
|
||||
while ($row = DB()->sql_fetchrow($result)) {
|
||||
$quota_name[] = $row;
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
foreach ($quota_name as $i => $iValue) {
|
||||
$selected = ($quota_name[$i]['quota_limit_id'] == $default_quota) ? ' selected="selected"' : '';
|
||||
$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
|
||||
}
|
||||
$quota_select .= '</select>';
|
||||
|
||||
return $quota_select;
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$imagick = '';
|
||||
|
||||
/**
|
||||
* Calculate the needed size for Thumbnail
|
||||
*/
|
||||
function get_img_size_format($width, $height)
|
||||
{
|
||||
// Maximum Width the Image can take
|
||||
$max_width = 400;
|
||||
|
||||
if ($width > $height) {
|
||||
return array(
|
||||
round($width * ($max_width / $width)),
|
||||
round($height * ($max_width / $width))
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
round($width * ($max_width / $height)),
|
||||
round($height * ($max_width / $height))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if imagick is present
|
||||
*/
|
||||
function is_imagick()
|
||||
{
|
||||
global $imagick, $attach_config;
|
||||
|
||||
if ($attach_config['img_imagick'] != '') {
|
||||
$imagick = $attach_config['img_imagick'];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get supported image types
|
||||
*/
|
||||
function get_supported_image_types($type)
|
||||
{
|
||||
if (@extension_loaded('gd')) {
|
||||
$format = imagetypes();
|
||||
$new_type = 0;
|
||||
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
|
||||
break;
|
||||
case 2:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
$new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
|
||||
break;
|
||||
case 3:
|
||||
$new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
|
||||
break;
|
||||
case 6:
|
||||
case 15:
|
||||
$new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return array(
|
||||
'gd' => ($new_type) ? true : false,
|
||||
'format' => $new_type,
|
||||
'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1
|
||||
);
|
||||
}
|
||||
|
||||
return array('gd' => false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create thumbnail
|
||||
*/
|
||||
function create_thumbnail($source, $new_file, $mimetype)
|
||||
{
|
||||
global $attach_config, $imagick;
|
||||
$image = null;
|
||||
|
||||
$source = amod_realpath($source);
|
||||
$min_filesize = (int)$attach_config['img_min_thumb_filesize'];
|
||||
$img_filesize = (@file_exists($source)) ? @filesize($source) : false;
|
||||
|
||||
if (!$img_filesize || $img_filesize <= $min_filesize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
[$width, $height, $type,] = getimagesize($source);
|
||||
|
||||
if (!$width || !$height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
[$new_width, $new_height] = get_img_size_format($width, $height);
|
||||
|
||||
$used_imagick = false;
|
||||
|
||||
if (is_imagick()) {
|
||||
passthru($imagick . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $new_file) . '"');
|
||||
if (@file_exists($new_file)) {
|
||||
$used_imagick = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$used_imagick) {
|
||||
$type = get_supported_image_types($type);
|
||||
|
||||
if ($type['gd']) {
|
||||
switch ($type['format']) {
|
||||
case IMG_GIF:
|
||||
$image = imagecreatefromgif($source);
|
||||
break;
|
||||
case IMG_JPG:
|
||||
$image = imagecreatefromjpeg($source);
|
||||
break;
|
||||
case IMG_PNG:
|
||||
$image = imagecreatefrompng($source);
|
||||
break;
|
||||
case IMG_WBMP:
|
||||
$image = imagecreatefromwbmp($source);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($type['version'] == 1 || !$attach_config['use_gd2']) {
|
||||
$new_image = imagecreate($new_width, $new_height);
|
||||
imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
||||
} else {
|
||||
$new_image = imagecreatetruecolor($new_width, $new_height);
|
||||
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
||||
}
|
||||
|
||||
switch ($type['format']) {
|
||||
case IMG_GIF:
|
||||
imagegif($new_image, $new_file);
|
||||
break;
|
||||
case IMG_JPG:
|
||||
imagejpeg($new_image, $new_file, 90);
|
||||
break;
|
||||
case IMG_PNG:
|
||||
imagepng($new_image, $new_file);
|
||||
break;
|
||||
case IMG_WBMP:
|
||||
imagewbmp($new_image, $new_file);
|
||||
break;
|
||||
}
|
||||
|
||||
imagedestroy($new_image);
|
||||
}
|
||||
}
|
||||
|
||||
if (!@file_exists($new_file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@chmod($new_file, 0664);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
define('FILENAME_PREFIX', false);
|
||||
define('FILENAME_PREFIX_LENGTH', 6);
|
||||
define('FILENAME_MAX_LENGTH', 180);
|
||||
define('FILENAME_CRYPTIC', false);
|
||||
define('FILENAME_CRYPTIC_LENGTH', 64);
|
||||
|
||||
/**
|
||||
* Entry Point
|
||||
*/
|
||||
function execute_posting_attachment_handling()
|
||||
{
|
||||
global $attachment_mod;
|
||||
|
||||
$attachment_mod['posting'] = new TorrentPier\Legacy\AttachPosting();
|
||||
$attachment_mod['posting']->posting_attachment_mod();
|
||||
}
|
|
@ -391,7 +391,6 @@ $bb_cfg['board_email_form'] = false; // can users send email to each other via b
|
|||
$bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends
|
||||
$bb_cfg['board_email_sitename'] = $domain_name; // sitename used in all emails header
|
||||
|
||||
$bb_cfg['topic_notify_enabled'] = true;
|
||||
$bb_cfg['pm_notify_enabled'] = true;
|
||||
$bb_cfg['group_send_email'] = true;
|
||||
$bb_cfg['email_change_disabled'] = false; // disable changing email by user
|
||||
|
@ -627,7 +626,6 @@ $bb_cfg['tracker'] = [
|
|||
'limit_seed_ips' => 0,
|
||||
'limit_leech_ips' => 0,
|
||||
'tor_topic_up' => true,
|
||||
'gold_silver_enabled' => true,
|
||||
'retracker' => true,
|
||||
'retracker_host' => 'http://retracker.local/announce',
|
||||
'freeleech' => false,
|
||||
|
|
|
@ -1,207 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
DB()->expect_slow_query(600);
|
||||
|
||||
$fix_errors = true;
|
||||
$debug_mode = false;
|
||||
|
||||
$tmp_attach_tbl = 'tmp_attachments';
|
||||
$db_max_packet = 800000;
|
||||
$sql_limit = 3000;
|
||||
|
||||
$check_attachments = false;
|
||||
$orphan_files = $orphan_db_attach = $orphan_tor = array();
|
||||
$posts_without_attach = $topics_without_attach = array();
|
||||
|
||||
DB()->query("
|
||||
CREATE TEMPORARY TABLE $tmp_attach_tbl (
|
||||
physical_filename VARCHAR(255) NOT NULL default '',
|
||||
KEY physical_filename (physical_filename(20))
|
||||
) ENGINE = MyISAM DEFAULT CHARSET = utf8
|
||||
");
|
||||
DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_attach_tbl");
|
||||
|
||||
// Get attach_mod config
|
||||
$attach_dir = get_attachments_dir();
|
||||
|
||||
// Get all names of existed attachments and insert them into $tmp_attach_tbl
|
||||
if ($dir = @opendir($attach_dir)) {
|
||||
$check_attachments = true;
|
||||
$files = array();
|
||||
$f_len = 0;
|
||||
|
||||
while (false !== ($f = readdir($dir))) {
|
||||
if ($f == 'index.php' || $f == '.htaccess' || is_dir("$attach_dir/$f") || is_link("$attach_dir/$f")) {
|
||||
continue;
|
||||
}
|
||||
$f = DB()->escape($f);
|
||||
$files[] = "('$f')";
|
||||
$f_len += strlen($f) + 5;
|
||||
|
||||
if ($f_len > $db_max_packet) {
|
||||
$files = implode(',', $files);
|
||||
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
|
||||
$files = array();
|
||||
$f_len = 0;
|
||||
}
|
||||
}
|
||||
if ($files = implode(',', $files)) {
|
||||
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
if ($check_attachments) {
|
||||
// Delete bad records
|
||||
DB()->query("
|
||||
DELETE a, d
|
||||
FROM " . BB_ATTACHMENTS_DESC . " d
|
||||
LEFT JOIN " . BB_ATTACHMENTS . " a USING(attach_id)
|
||||
WHERE (
|
||||
d.physical_filename = ''
|
||||
OR d.real_filename = ''
|
||||
OR d.extension = ''
|
||||
OR d.mimetype = ''
|
||||
OR d.filesize = 0
|
||||
OR d.filetime = 0
|
||||
OR a.post_id = 0
|
||||
)
|
||||
");
|
||||
|
||||
// Delete attachments that exist in file system but not exist in DB
|
||||
$sql = "SELECT f.physical_filename
|
||||
FROM $tmp_attach_tbl f
|
||||
LEFT JOIN " . BB_ATTACHMENTS_DESC . " d USING(physical_filename)
|
||||
WHERE d.physical_filename IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
if ($filename = basename($row['physical_filename'])) {
|
||||
if ($fix_errors) {
|
||||
@unlink("$attach_dir/$filename");
|
||||
@unlink("$attach_dir/" . THUMB_DIR . '/t_' . $filename);
|
||||
}
|
||||
if ($debug_mode) {
|
||||
$orphan_files[] = "$attach_dir/$filename";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Find DB records for attachments that exist in DB but not exist in file system
|
||||
$sql = "SELECT d.attach_id
|
||||
FROM " . BB_ATTACHMENTS_DESC . " d
|
||||
LEFT JOIN $tmp_attach_tbl f USING(physical_filename)
|
||||
WHERE f.physical_filename IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$orphan_db_attach[] = $row['attach_id'];
|
||||
}
|
||||
// Attachment exist in DESC_TABLE but not exist in ATTACH_TABLE
|
||||
$sql = "SELECT d.attach_id
|
||||
FROM " . BB_ATTACHMENTS_DESC . " d
|
||||
LEFT JOIN " . BB_ATTACHMENTS . " a USING(attach_id)
|
||||
WHERE a.attach_id IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$orphan_db_attach[] = $row['attach_id'];
|
||||
}
|
||||
// Attachment exist in ATTACH_TABLE but not exist in DESC_TABLE
|
||||
$sql = "SELECT a.attach_id
|
||||
FROM " . BB_ATTACHMENTS . " a
|
||||
LEFT JOIN " . BB_ATTACHMENTS_DESC . " d USING(attach_id)
|
||||
WHERE d.attach_id IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$orphan_db_attach[] = $row['attach_id'];
|
||||
}
|
||||
// Attachments without post
|
||||
$sql = "SELECT a.attach_id
|
||||
FROM " . BB_ATTACHMENTS . " a
|
||||
LEFT JOIN " . BB_POSTS . " p USING(post_id)
|
||||
WHERE p.post_id IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$orphan_db_attach[] = $row['attach_id'];
|
||||
}
|
||||
// Delete all orphan attachments
|
||||
if ($orphans_sql = implode(',', $orphan_db_attach)) {
|
||||
if ($fix_errors) {
|
||||
DB()->query("DELETE FROM " . BB_ATTACHMENTS_DESC . " WHERE attach_id IN($orphans_sql)");
|
||||
DB()->query("DELETE FROM " . BB_ATTACHMENTS . " WHERE attach_id IN($orphans_sql)");
|
||||
}
|
||||
}
|
||||
|
||||
// Torrents without attachments
|
||||
$sql = "SELECT tor.topic_id
|
||||
FROM " . BB_BT_TORRENTS . " tor
|
||||
LEFT JOIN " . BB_ATTACHMENTS_DESC . " d USING(attach_id)
|
||||
WHERE d.attach_id IS NULL
|
||||
LIMIT $sql_limit";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$orphan_tor[] = $row['topic_id'];
|
||||
}
|
||||
// Delete all orphan torrents
|
||||
if ($orphans_sql = implode(',', $orphan_tor)) {
|
||||
if ($fix_errors) {
|
||||
DB()->query("DELETE FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($orphans_sql)");
|
||||
}
|
||||
}
|
||||
|
||||
// Check post_attachment markers
|
||||
$sql = "SELECT p.post_id
|
||||
FROM " . BB_POSTS . " p
|
||||
LEFT JOIN " . BB_ATTACHMENTS . " a USING(post_id)
|
||||
WHERE p.post_attachment = 1
|
||||
AND a.post_id IS NULL";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$posts_without_attach[] = $row['post_id'];
|
||||
}
|
||||
if ($posts_sql = implode(',', $posts_without_attach)) {
|
||||
if ($fix_errors) {
|
||||
DB()->query("UPDATE " . BB_POSTS . " SET post_attachment = 0 WHERE post_id IN($posts_sql)");
|
||||
}
|
||||
}
|
||||
// Check topic_attachment markers
|
||||
$sql = "SELECT t.topic_id
|
||||
FROM " . BB_POSTS . " p, " . BB_TOPICS . " t
|
||||
WHERE t.topic_id = p.topic_id
|
||||
AND t.topic_attachment = 1
|
||||
GROUP BY p.topic_id
|
||||
HAVING SUM(p.post_attachment) = 0";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
$topics_without_attach[] = $row['topic_id'];
|
||||
}
|
||||
if ($topics_sql = implode(',', $topics_without_attach)) {
|
||||
if ($fix_errors) {
|
||||
DB()->query("UPDATE " . BB_TOPICS . " SET topic_attachment = 0 WHERE topic_id IN($topics_sql)");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($debug_mode) {
|
||||
prn_r($orphan_files, '$orphan_files');
|
||||
prn_r($orphan_db_attach, '$orphan_db_attach');
|
||||
prn_r($orphan_tor, '$orphan_tor');
|
||||
prn_r($posts_without_attach, '$posts_without_attach');
|
||||
prn_r($topics_without_attach, '$topics_without_attach');
|
||||
}
|
||||
|
||||
DB()->query("DROP TEMPORARY TABLE $tmp_attach_tbl");
|
||||
|
||||
unset($fix_errors, $debug_mode);
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (!defined('BB_ROOT')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
// Don't count on forbidden extensions table, because it is not allowed to allow forbidden extensions at all
|
||||
$extensions = DB()->fetch_rowset("
|
||||
SELECT
|
||||
e.extension, g.cat_id, g.download_mode, g.upload_icon
|
||||
FROM
|
||||
" . BB_EXTENSIONS . " e,
|
||||
" . BB_EXTENSION_GROUPS . " g
|
||||
WHERE
|
||||
e.group_id = g.group_id
|
||||
AND g.allow_group = 1
|
||||
");
|
||||
|
||||
$this->store('attach_extensions', $extensions);
|
|
@ -171,7 +171,7 @@ $bf['user_opt'] = array(
|
|||
'dis_avatar' => 2, // Запрет на аватар
|
||||
'dis_pm' => 3, // Запрет на отправку ЛС
|
||||
'user_viewonline' => 4, // Скрывать пребывание пользователя
|
||||
'user_notify' => 5, // Сообщать об ответах в отслеживаемых темах
|
||||
'user_notify' => 5, // Сообщать об ответах в отслеживаемых темах (не используется)
|
||||
'user_notify_pm' => 6, // Сообщать о новых ЛС
|
||||
'dis_passkey' => 7, // Запрет на добавление passkey, он же запрет на скачивание торрентов
|
||||
'user_porn_forums' => 8, // Скрывать контент 18+
|
||||
|
@ -239,7 +239,7 @@ function setbit(&$int, $bit_num, $on)
|
|||
All results are returned as associative arrays, even when a single auth type is
|
||||
specified.
|
||||
|
||||
If available you can send an array (either one or two dimensional) containing the
|
||||
If available you can send an array (either one or two-dimensional) containing the
|
||||
forum auth levels, this will prevent the auth function having to do its own
|
||||
lookup
|
||||
*/
|
||||
|
@ -2014,11 +2014,6 @@ function is_gold($type)
|
|||
{
|
||||
global $lang, $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['tracker']['gold_silver_enabled']) {
|
||||
$is_gold = '';
|
||||
return $is_gold;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case TOR_TYPE_GOLD:
|
||||
$is_gold = '<img src="styles/images/tor_gold.gif" width="16" height="15" title="' . $lang['GOLD'] . '" /> ';
|
||||
|
|
|
@ -208,7 +208,6 @@ $template->assign_vars(array(
|
|||
'SELECTED' => HTML_SELECTED,
|
||||
|
||||
'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&o=5",
|
||||
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
|
||||
));
|
||||
|
||||
if (!empty($bb_cfg['page']['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])) {
|
||||
|
|
|
@ -330,7 +330,6 @@ foreach ($profile_fields as $field => $can_edit) {
|
|||
# 'user_opt_name' => ($reg_mode) ? #reg_value : #in_login_change
|
||||
'user_viewemail' => $reg_mode ? false : true,
|
||||
'user_viewonline' => $reg_mode ? false : true,
|
||||
'user_notify' => $reg_mode ? true : true,
|
||||
'user_notify_pm' => $reg_mode ? true : true,
|
||||
'user_porn_forums' => $reg_mode ? false : true,
|
||||
'user_dls' => $reg_mode ? false : true,
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||
*
|
||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||
*/
|
||||
|
||||
if (empty($bb_cfg['topic_notify_enabled'])) {
|
||||
bb_die($lang['DISABLED']);
|
||||
}
|
||||
|
||||
$page_cfg['use_tablesorter'] = true;
|
||||
$page_cfg['include_bbcode_js'] = true;
|
||||
$tracking_topics = get_tracks('topic');
|
||||
|
||||
$user_id = $userdata['user_id'];
|
||||
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
|
||||
$per_page = $bb_cfg['topics_per_page'];
|
||||
|
||||
if (isset($_POST['topic_id_list'])) {
|
||||
$topic_ids = implode(",", $_POST['topic_id_list']);
|
||||
$sql = "DELETE FROM " . BB_TOPICS_WATCH . " WHERE topic_id IN(" . $topic_ids . ") AND user_id = $user_id";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not delete topic watch information #1');
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
|
||||
'S_FORM_ACTION' => BB_ROOT . 'profile.php?mode=watch',
|
||||
));
|
||||
|
||||
$sql = "SELECT COUNT(topic_id) as watch_count FROM " . BB_TOPICS_WATCH . " WHERE user_id = $user_id";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain watch topic information #2');
|
||||
}
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
$watch_count = ($row['watch_count']) ?: 0;
|
||||
DB()->sql_freeresult($result);
|
||||
|
||||
if ($watch_count > 0) {
|
||||
$sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
|
||||
u2.user_level as last_user_level, u2.user_rank as last_user_rank
|
||||
FROM " . BB_TOPICS_WATCH . " w, " . BB_TOPICS . " t, " . BB_USERS . " u, " . BB_FORUMS . " f, " . BB_POSTS . " p, " . BB_USERS . " u2
|
||||
WHERE w.topic_id = t.topic_id
|
||||
AND t.forum_id = f.forum_id
|
||||
AND p.post_id = t.topic_last_post_id
|
||||
AND p.poster_id = u2.user_id
|
||||
AND t.topic_poster = u.user_id
|
||||
AND w.user_id = $user_id
|
||||
GROUP BY t.topic_last_post_time DESC
|
||||
LIMIT $start, $per_page";
|
||||
if (!($result = DB()->sql_query($sql))) {
|
||||
bb_die('Could not obtain watch topic information #3');
|
||||
}
|
||||
$watch = DB()->sql_fetchrowset($result);
|
||||
|
||||
if ($watch) {
|
||||
for ($i = 0, $iMax = count($watch); $i < $iMax; $i++) {
|
||||
$is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
|
||||
|
||||
$template->assign_block_vars('watch', array(
|
||||
'ROW_CLASS' => (!($i % 2)) ? 'row1' : 'row2',
|
||||
'POST_ID' => $watch[$i]['topic_first_post_id'],
|
||||
'TOPIC_ID' => $watch[$i]['topic_id'],
|
||||
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
|
||||
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
|
||||
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
|
||||
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
|
||||
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
|
||||
'REPLIES' => $watch[$i]['topic_replies'],
|
||||
'AUTHOR' => profile_url($watch[$i]),
|
||||
'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) . '<br />' . profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
|
||||
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
||||
'IS_UNREAD' => $is_unread,
|
||||
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
||||
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
|
||||
'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start),
|
||||
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $per_page) + 1), ceil($watch_count / $per_page)),
|
||||
'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch',
|
||||
'PER_PAGE' => $per_page,
|
||||
));
|
||||
}
|
||||
DB()->sql_freeresult($result);
|
||||
} else {
|
||||
meta_refresh('index.php', 3);
|
||||
bb_die($lang['NO_WATCHED_TOPICS']);
|
||||
}
|
||||
|
||||
print_page('usercp_topic_watch.tpl');
|
|
@ -1,13 +0,0 @@
|
|||
Subject: Topic Reply Notification - {TOPIC_TITLE}
|
||||
|
||||
Hello,
|
||||
|
||||
You are receiving this email because you are watching the topic, "{TOPIC_TITLE}" at {SITENAME}. This topic has received a reply since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.
|
||||
|
||||
{U_TOPIC}
|
||||
|
||||
If you no longer wish to watch this topic you can either click the "Stop watching this topic link" found at the bottom of the topic above, or by clicking the following link:
|
||||
|
||||
{U_STOP_WATCHING_TOPIC}
|
||||
|
||||
{EMAIL_SIG}
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
define('BB_SCRIPT', 'login');
|
||||
define('IN_LOGIN', true);
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
array_deep($_POST, 'trim');
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'memberlist');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
$page_cfg['use_tablesorter'] = true;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
define('BB_SCRIPT', 'pm');
|
||||
define('IN_PM', true);
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
require INC_DIR . '/bbcode.php';
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
define('IN_PROFILE', true);
|
||||
define('BB_SCRIPT', 'profile');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
// Start session management
|
||||
|
@ -50,13 +49,6 @@ switch ($mode) {
|
|||
require UCP_DIR . '/bonus.php';
|
||||
break;
|
||||
|
||||
case 'watch':
|
||||
if (IS_GUEST) {
|
||||
login_redirect();
|
||||
}
|
||||
require UCP_DIR . '/topic_watch.php';
|
||||
break;
|
||||
|
||||
default:
|
||||
bb_die('Invalid mode');
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,256 +0,0 @@
|
|||
<h1>{L_CONTROL_PANEL_TITLE}</h1>
|
||||
|
||||
<p>{L_CONTROL_PANEL_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<!-- IF TPL_ATTACH_STATISTICS -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<form method="post" action="{S_MODE_ACTION}">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="right" nowrap="nowrap">{L_VIEW}: {S_VIEW_SELECT}
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th width="50%">{L_STATISTIC}</th>
|
||||
<th width="50%">{L_VALUE}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_NUMBER_OF_ATTACHMENTS}:</td>
|
||||
<td class="row2"><b>{NUMBER_OF_ATTACHMENTS}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_TOTAL_FILESIZE}:</td>
|
||||
<td class="row2"><b>{TOTAL_FILESIZE}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_ATTACH_QUOTA}:</td>
|
||||
<td class="row2"><b>{ATTACH_QUOTA}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_NUMBER_POSTS_ATTACH}:</td>
|
||||
<td class="row2"><b>{NUMBER_OF_POSTS}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_NUMBER_PMS_ATTACH}:</td>
|
||||
<td class="row2"><b>{NUMBER_OF_PMS}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_NUMBER_TOPICS_ATTACH}:</td>
|
||||
<td class="row2"><b>{NUMBER_OF_TOPICS}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap">{L_NUMBER_USERS_ATTACH}:</td>
|
||||
<td class="row2"><b>{NUMBER_OF_USERS}</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_STATISTICS -->
|
||||
|
||||
<!-- IF TPL_ATTACH_SEARCH -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<form method="post" action="{S_MODE_ACTION}">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="right" nowrap="nowrap"><span class="med">{L_VIEW}: {S_VIEW_SELECT}
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th colspan="4">{L_ATTACH_SEARCH_QUERY}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_FILENAME}:</span><br /><span class="small">{L_SEARCH_WILDCARD_EXPLAIN}</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 200px" class="post" name="search_keyword_fname" size="20" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_FILE_COMMENT}:</span><br /><span class="small">{L_SEARCH_WILDCARD_EXPLAIN}</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 200px" class="post" name="search_keyword_comment" size="20" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_SEARCH_AUTHOR}:</span><br /><span class="small">{L_SEARCH_WILDCARD_EXPLAIN}</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 200px" class="post" name="search_author" size="20" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_SIZE_SMALLER_THAN}:</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 100px" class="post" name="search_size_smaller" size="10" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_SIZE_GREATER_THAN}:</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 100px" class="post" name="search_size_greater" size="10" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_COUNT_SMALLER_THAN}:</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 100px" class="post" name="search_count_smaller" size="10" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_COUNT_GREATER_THAN}:</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 100px" class="post" name="search_count_greater" size="10" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2"><span class="gen">{L_MORE_DAYS_OLD}:</span></td>
|
||||
<td class="row2" colspan="2"><span class="med"><input type="text" style="width: 100px" class="post" name="search_days_greater" size="10" /></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">{L_SEARCH_OPTIONS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2" align="right"><span class="gen">{L_FORUM}:</span></td>
|
||||
<td class="row2" colspan="2"><select class="post" name="search_forum">{S_FORUM_OPTIONS}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="2" align="right"><span class="gen">{L_SORT_BY}: </span></td>
|
||||
<td class="row2" colspan="2">{S_SORT_OPTIONS}</td>
|
||||
<tr>
|
||||
<td class="row1" colspan="2" align="right"><span class="gen">{L_SORT}: </span></td>
|
||||
<td class="row2" colspan="2">{S_SORT_ORDER}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="catBottom" colspan="4">{S_HIDDEN_FIELDS}<input class="liteoption" type="submit" name="search" value="{L_SEARCH}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_SEARCH -->
|
||||
|
||||
<!-- IF TPL_ATTACH_USER -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<form method="post" action="{S_MODE_ACTION}">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="right" nowrap="nowrap">
|
||||
<span class="med">{L_VIEW}: {S_VIEW_SELECT} {L_SORT_BY}: {S_MODE_SELECT} {L_ORDER} {S_ORDER_SELECT}
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{L_USERNAME}</th>
|
||||
<th>{L_ATTACHMENTS}</th>
|
||||
<th>{L_SIZE_IN_KB}</th>
|
||||
</tr>
|
||||
<!-- BEGIN memberrow -->
|
||||
<tr>
|
||||
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"> {memberrow.ROW_NUMBER} </span></td>
|
||||
<td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a href="{memberrow.U_VIEW_MEMBER}" class="gen">{memberrow.USERNAME}</a></span></td>
|
||||
<td class="{memberrow.ROW_CLASS}" align="center"> <b>{memberrow.TOTAL_ATTACHMENTS}</b> </td>
|
||||
<td class="{memberrow.ROW_CLASS}" align="center"> <b>{memberrow.TOTAL_SIZE}</b> </td>
|
||||
</tr>
|
||||
<!-- END memberrow -->
|
||||
</table>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><span class="nav">{PAGE_NUMBER}</span></td>
|
||||
<td align="right"><span class="nav">{PAGINATION} </span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_USER -->
|
||||
|
||||
<!-- IF TPL_ATTACH_ATTACHMENTS -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<!-- BEGIN switch_user_based -->
|
||||
<b>{L_STATISTICS_FOR_USER}</b>
|
||||
<!-- END switch_user_based -->
|
||||
|
||||
<script type="text/javascript">
|
||||
//
|
||||
// Should really check the browser to stop this whining ...
|
||||
//
|
||||
function select_switch(status)
|
||||
{
|
||||
for (i = 0; i < document.attach_list.length; i++)
|
||||
{
|
||||
document.attach_list.elements[i].checked = status;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form method="post" name="attach_list" action="{S_MODE_ACTION}">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="right" nowrap="nowrap">
|
||||
<span class="med">{L_VIEW}: {S_VIEW_SELECT} {L_SORT_BY}: {S_MODE_SELECT} {L_ORDER} {S_ORDER_SELECT}
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{L_FILENAME}</th>
|
||||
<th>{L_FILE_COMMENT}</th>
|
||||
<th>{L_EXTENSION}</th>
|
||||
<th>{L_SIZE}</th>
|
||||
<th>{L_DOWNLOADS}</th>
|
||||
<th>{L_POST_TIME}</th>
|
||||
<th>{L_POSTED_IN_TOPIC}</th>
|
||||
<th>{L_DELETE}</th>
|
||||
</tr>
|
||||
<!-- BEGIN attachrow -->
|
||||
<tr>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"> {attachrow.ROW_NUMBER} </span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"><a href="{attachrow.U_VIEW_ATTACHMENT}" class="gen" target="_blank">{attachrow.FILENAME}</a></span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"><input type="text" size="40" maxlength="200" name="attach_comment_list[]" value="{attachrow.COMMENT}" class="post" /></span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen">{attachrow.EXTENSION}</span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"><b>{attachrow.SIZE}</b></span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"><input type="text" size="5" maxlength="10" name="attach_count_list[]" value="{attachrow.DOWNLOAD_COUNT}" class="post" /></span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="small">{attachrow.POST_TIME}</span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center"><span class="gen">{attachrow.POST_TITLE}</span></td>
|
||||
<td class="{attachrow.ROW_CLASS}" align="center">{attachrow.S_DELETE_BOX}</td>
|
||||
{attachrow.S_HIDDEN}
|
||||
</tr>
|
||||
<!-- END attachrow -->
|
||||
<tr>
|
||||
<td class="catBottom" colspan="9">
|
||||
<input type="submit" name="submit_change" value="{L_SUBMIT_CHANGES}" class="mainoption" />
|
||||
|
||||
<input type="submit" name="delete" value="{L_DELETE_MARKED}" class="liteoption" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- BEGIN switch_user_based -->
|
||||
{S_USER_HIDDEN}
|
||||
<!-- END switch_user_based -->
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="right" valign="top" nowrap="nowrap"><b><span class="small"><a href="javascript:select_switch(true);" class="small">{L_MARK_ALL}</a> :: <a href="javascript:select_switch(false);" class="small">{L_UNMARK_ALL}</a></span></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><span class="nav">{PAGE_NUMBER}</span></td>
|
||||
<td align="right"><span class="nav">{PAGINATION} </span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_ATTACHMENTS -->
|
||||
|
||||
<br />
|
|
@ -1,302 +0,0 @@
|
|||
<!-- IF TPL_ATTACH_SPECIAL_CATEGORIES -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<h1>{L_MANAGE_CATEGORIES}</h1>
|
||||
|
||||
<p>{L_MANAGE_CATEGORIES_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<form action="{S_ATTACH_ACTION}" method="post">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th colspan="2">{L_SETTINGS_CAT_IMAGES}<br />{L_ASSIGNED_GROUP}: {S_ASSIGNED_GROUP_IMAGES}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_DISPLAY_INLINED}<br /><span class="small">{L_DISPLAY_INLINED_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" name="img_display_inlined" value="1" {DISPLAY_INLINED_YES} /> {L_YES} <input type="radio" name="img_display_inlined" value="0" {DISPLAY_INLINED_NO} /> {L_NO}</td>
|
||||
</tr>
|
||||
<!-- BEGIN switch_thumbnail_support -->
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_IMAGE_CREATE_THUMBNAIL}<br /><span class="small">{L_IMAGE_CREATE_THUMBNAIL_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" name="img_create_thumbnail" value="1" {CREATE_THUMBNAIL_YES} /> {L_YES} <input type="radio" name="img_create_thumbnail" value="0" {CREATE_THUMBNAIL_NO} /> {L_NO}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_IMAGE_MIN_THUMB_FILESIZE}<br /><span class="small">{L_IMAGE_MIN_THUMB_FILESIZE_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="7" maxlength="15" name="img_min_thumb_filesize" value="{IMAGE_MIN_THUMB_FILESIZE}" class="post" /> {L_BYTES}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_USE_GD2}<br /><span class="small">{L_USE_GD2_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" name="use_gd2" value="1" {USE_GD2_YES} /> {L_YES} <input type="radio" name="use_gd2" value="0" {USE_GD2_NO} /> {L_NO}</td>
|
||||
</tr>
|
||||
<!-- END switch_thumbnail_support -->
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_IMAGE_IMAGICK_PATH}<br /><span class="small">{L_IMAGE_IMAGICK_PATH_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="20" maxlength="200" name="img_imagick" value="{IMAGE_IMAGICK_PATH}" class="post" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_MAX_IMAGE_SIZE} <br /><span class="small">{L_MAX_IMAGE_SIZE_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="3" maxlength="4" name="img_max_width" value="{IMAGE_MAX_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_max_height" value="{IMAGE_MAX_HEIGHT}" class="post" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_IMAGE_LINK_SIZE} <br /><span class="small">{L_IMAGE_LINK_SIZE_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="3" maxlength="4" name="img_link_width" value="{IMAGE_LINK_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_link_height" value="{IMAGE_LINK_HEIGHT}" class="post" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="catBottom" colspan="2">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" /> <input type="reset" value="{L_RESET}" class="liteoption" /> <input type="submit" name="search_imagick" value="{L_IMAGE_SEARCH_IMAGICK}" class="liteoption" /> <input type="submit" name="cat_settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_SPECIAL_CATEGORIES -->
|
||||
|
||||
<!-- IF TPL_ATTACH_MANAGE -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<h1>{L_ATTACH_SETTINGS}</h1>
|
||||
|
||||
<p>{L_MANAGE_ATTACHMENTS_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<form action="{S_ATTACH_ACTION}" method="post">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th colspan="2">{L_ATTACH_SETTINGS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_UPLOAD_DIRECTORY}<br /><span class="small">{L_UPLOAD_DIRECTORY_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="25" maxlength="100" name="upload_dir" class="post" value="{UPLOAD_DIR}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_ATTACH_IMG_PATH}<br /><span class="small">{L_ATTACH_IMG_PATH_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="25" maxlength="100" name="upload_img" class="post" value="{ATTACHMENT_IMG_PATH}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_ATTACH_TOPIC_ICON}<br /><span class="small">{L_ATTACH_TOPIC_ICON_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="25" maxlength="100" name="topic_icon" class="post" value="{TOPIC_ICON}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_ATTACH_DISPLAY_ORDER}<br /><span class="small">{L_ATTACH_DISPLAY_ORDER_EXPLAIN}</span></td>
|
||||
<td class="row2">
|
||||
<table class="borderless">
|
||||
<tr>
|
||||
<td><input type="radio" name="display_order" value="0" {DISPLAY_ORDER_DESC} /> {L_DESC}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="radio" name="display_order" value="1" {DISPLAY_ORDER_ASC} /> {L_ASC}</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_ATTACH_FILESIZE_SETTINGS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_MAX_FILESIZE_ATTACH}<br /><span class="small">{L_MAX_FILESIZE_ATTACH_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_ATTACH_QUOTA}<br /><span class="small">{L_ATTACH_QUOTA_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="8" maxlength="15" name="attachment_quota" class="post" value="{ATTACHMENT_QUOTA}" /> {S_FILESIZE_QUOTA}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_MAX_FILESIZE_PM}<br /><span class="small">{L_MAX_FILESIZE_PM_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize_pm" class="post" value="{MAX_FILESIZE_PM}" /> {S_FILESIZE_PM}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_DEFAULT_QUOTA_LIMIT}<br /><span class="small">{L_DEFAULT_QUOTA_LIMIT_EXPLAIN}</span></td>
|
||||
<td class="row2">
|
||||
<table class="borderless">
|
||||
<tr>
|
||||
<td nowrap="nowrap">{S_DEFAULT_UPLOAD_LIMIT}</td>
|
||||
<td nowrap="nowrap"><span class="small"> {L_UPLOAD_QUOTA} </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">{S_DEFAULT_PM_LIMIT}</td>
|
||||
<td nowrap="nowrap"><span class="small"> {L_PM_QUOTA} </span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_ATTACH_NUMBER_SETTINGS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_MAX_ATTACHMENTS}<br /><span class="small">{L_MAX_ATTACHMENTS_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments" class="post" value="{MAX_ATTACHMENTS}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_MAX_ATTACHMENTS_PM}<br /><span class="small">{L_MAX_ATTACHMENTS_PM_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments_pm" class="post" value="{MAX_ATTACHMENTS_PM}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{L_ATTACH_OPTIONS_SETTINGS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_DISABLE_MOD}<br /><span class="small">{L_DISABLE_MOD_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" name="disable_mod" value="1" {DISABLE_MOD_YES} /> {L_YES} <input type="radio" name="disable_mod" value="0" {DISABLE_MOD_NO} /> {L_NO}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="80%">{L_PM_ATTACHMENTS}<br /><span class="small">{L_PM_ATTACHMENTS_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="radio" name="allow_pm_attach" value="1" {PM_ATTACH_YES} /> {L_YES} <input type="radio" name="allow_pm_attach" value="0" {PM_ATTACH_NO} /> {L_NO}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="catBottom" colspan="2">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" /> <input type="reset" value="{L_RESET}" class="liteoption" /> <input type="submit" name="settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_MANAGE -->
|
||||
|
||||
<!-- IF TPL_ATTACH_QUOTA -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<h1>{L_MANAGE_QUOTAS}</h1>
|
||||
|
||||
<p>{L_MANAGE_QUOTAS_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<form method="post" action="{S_ATTACH_ACTION}">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<td class="catTitle" colspan="3">{L_MANAGE_QUOTAS}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{L_DESCRIPTION}</th>
|
||||
<th>{L_SIZE}</th>
|
||||
<th>{L_ADD_NEW}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center"><input type="text" size="20" maxlength="25" name="quota_description" class="post"/></td>
|
||||
<td class="row2" align="center"><input type="text" size="8" maxlength="15" name="add_max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
|
||||
<td class="row1" align="center"><input type="checkbox" name="add_quota_check" /></td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="3"> {S_HIDDEN_FIELDS} <input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{L_DESCRIPTION}</th>
|
||||
<th>{L_SIZE}</th>
|
||||
<th>{L_DELETE}</th>
|
||||
</tr>
|
||||
<!-- BEGIN limit_row -->
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<input type="hidden" name="quota_change_list[]" value="{limit_row.QUOTA_ID}" />
|
||||
<table width="100%" class="borderless">
|
||||
<tr>
|
||||
<td class="row1" align="center" width="10%" wrap="nowrap"><b><span class="small"><a href="{limit_row.U_VIEW}" class="small">{L_VIEW}</a></span></b></td>
|
||||
<td class="row1"><input type="text" size="20" maxlength="25" name="quota_desc_list[]" class="post" value="{limit_row.QUOTA_NAME}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="row2" align="center"><input type="text" size="8" maxlength="15" name="max_filesize_list[]" class="post" value="{limit_row.MAX_FILESIZE}" /> {limit_row.S_FILESIZE}</td>
|
||||
<td class="row1" align="center"><input type="checkbox" name="quota_id_list[]" value="{limit_row.QUOTA_ID}" /></td>
|
||||
</tr>
|
||||
<!-- END limit_row -->
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="3"> <input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- {QUOTA_LIMIT_SETTINGS} -->
|
||||
|
||||
<!-- BEGIN switch_quota_limit_desc -->
|
||||
<div align="center"><h1>{L_QUOTA_LIMIT_DESC}</h1></div>
|
||||
<table width="99%" align="center">
|
||||
<tr>
|
||||
<td width="49%">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th>{L_ASSIGNED_USERS} - {L_UPLOAD_QUOTA}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:99%" name="entries[]" multiple size="5">
|
||||
<!-- END switch_quota_limit_desc -->
|
||||
<!-- BEGIN users_upload_row -->
|
||||
<option value="{users_upload_row.USER_ID}">{users_upload_row.USERNAME}</option>
|
||||
<!-- END users_upload_row -->
|
||||
<!-- BEGIN switch_quota_limit_desc -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="2%">
|
||||
|
||||
</td>
|
||||
<td align="right" width="49%">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th>{L_ASSIGNED_GROUPS} - {L_UPLOAD_QUOTA}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:99%" name="entries[]" multiple size="5">
|
||||
<!-- END switch_quota_limit_desc -->
|
||||
<!-- BEGIN groups_upload_row -->
|
||||
<option value="{groups_upload_row.GROUP_ID}">{groups_upload_row.GROUPNAME}</option>
|
||||
<!-- END groups_upload_row -->
|
||||
<!-- BEGIN switch_quota_limit_desc -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="49%">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th>{L_ASSIGNED_USERS} - {L_PM_QUOTA}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:99%" name="entries[]" multiple size="5">
|
||||
<!-- END switch_quota_limit_desc -->
|
||||
<!-- BEGIN users_pm_row -->
|
||||
<option value="{users_pm_row.USER_ID}">{users_pm_row.USERNAME}</option>
|
||||
<!-- END users_pm_row -->
|
||||
<!-- BEGIN switch_quota_limit_desc -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="2%">
|
||||
|
||||
</td>
|
||||
<td align="right" width="49%">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<th>{L_ASSIGNED_GROUPS} - {L_PM_QUOTA}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:99%" name="entries[]" multiple size="5">
|
||||
<!-- END switch_quota_limit_desc -->
|
||||
<!-- BEGIN groups_pm_row -->
|
||||
<option value="{groups_pm_row.GROUP_ID}">{groups_pm_row.GROUPNAME}</option>
|
||||
<!-- END groups_pm_row -->
|
||||
<!-- BEGIN switch_quota_limit_desc -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END switch_quota_limit_desc -->
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_QUOTA -->
|
||||
|
||||
<br clear="all" />
|
|
@ -1,218 +0,0 @@
|
|||
<!-- IF TPL_ATTACH_EXTENSIONS -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<h1>{L_MANAGE_EXTENSIONS}</h1>
|
||||
|
||||
<p>{L_MANAGE_EXTENSIONS_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<form method="post" action="{S_ATTACH_ACTION}">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<td class="catTitle" colspan="4">{L_MANAGE_EXTENSIONS}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_EXPLANATION} </th>
|
||||
<th> {L_EXTENSION} </th>
|
||||
<th> {L_EXTENSION_GROUP} </th>
|
||||
<th> {L_ADD_NEW} </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center"><input type="text" size="30" maxlength="100" name="add_extension_explain" class="post" value="{ADD_EXTENSION_EXPLAIN}" /></td>
|
||||
<td class="row2" align="center"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="{ADD_EXTENSION}" /></td>
|
||||
<td class="row1" align="center">{S_ADD_GROUP_SELECT}</td>
|
||||
<td class="row2" align="center"><input type="checkbox" name="add_extension_check" /></td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="4"> {S_HIDDEN_FIELDS} <input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_EXPLANATION} </th>
|
||||
<th> {L_EXTENSION} </th>
|
||||
<th> {L_EXTENSION_GROUP} </th>
|
||||
<th> {L_DELETE} </th>
|
||||
</tr>
|
||||
<!-- BEGIN extension_row -->
|
||||
<tr>
|
||||
<input type="hidden" name="extension_change_list[]" value="{extension_row.EXT_ID}" />
|
||||
<td class="row1" align="center"><input type="text" size="30" maxlength="100" name="extension_explain_list[]" class="post" value="{extension_row.EXTENSION_EXPLAIN}" /></td>
|
||||
<td class="row2" align="center"><b><span class="gen">{extension_row.EXTENSION}</span></b></td>
|
||||
<td class="row1" align="center">{extension_row.S_GROUP_SELECT}</td>
|
||||
<td class="row2" align="center"><input type="checkbox" name="extension_id_list[]" value="{extension_row.EXT_ID}" /></td>
|
||||
</tr>
|
||||
<!-- END extension_row -->
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="4">
|
||||
<input type="submit" name="{L_CANCEL}" class="liteoption" value="{L_CANCEL}" onClick="self.location.href='{S_CANCEL_ACTION}'" />
|
||||
<input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_EXTENSIONS -->
|
||||
|
||||
<!-- IF TPL_ATTACH_EXTENSION_GROUPS -->
|
||||
<!--========================================================================-->
|
||||
|
||||
{GROUP_PERMISSIONS_BOX}
|
||||
|
||||
<h1>{L_MANAGE_EXTENSION_GROUPS}</h1>
|
||||
|
||||
<p>{L_MANAGE_EXTENSION_GROUPS_EXPLAIN}</p>
|
||||
<br />
|
||||
|
||||
<form method="post" action="{S_ATTACH_ACTION}">
|
||||
<table class="forumline">
|
||||
<tr>
|
||||
<td class="catTitle" colspan="8">{L_MANAGE_EXTENSION_GROUPS}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_EXTENSION_GROUP} </th>
|
||||
<th> {L_SPECIAL_CATEGORY} </th>
|
||||
<th> {L_ALLOWED} </th>
|
||||
<th> {L_DOWNLOAD_MODE} </th>
|
||||
<th> {L_UPLOAD_ICON} </th>
|
||||
<th> {L_MAX_FILESIZE_ATTACH} </th>
|
||||
<th> {L_ALLOWED_FORUMS} </th>
|
||||
<th> {L_ADD_NEW} </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<table width="100%" class="borderless">
|
||||
<tr>
|
||||
<td class="row1" align="center" width="10%" wrap="nowrap"> </td>
|
||||
<td class="row1"><input type="text" size="20" maxlength="100" name="add_extension_group" class="post" value="{ADD_GROUP_NAME}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="row2" align="center">{S_SELECT_CAT}</td>
|
||||
<td class="row1" align="center"><input type="checkbox" name="add_allowed" /></td>
|
||||
<td class="row2" align="center">{S_ADD_DOWNLOAD_MODE}</td>
|
||||
<td class="row1" align="center"><input type="text" size="15" maxlength="100" name="add_upload_icon" class="post" value="{UPLOAD_ICON}" /></td>
|
||||
<td class="row2" align="center"><input type="text" size="3" maxlength="15" name="add_max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
|
||||
<td class="row1" align="center"> </td>
|
||||
<td class="row2" align="center"><input type="checkbox" name="add_extension_group_check" /></td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="8"><input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_EXTENSION_GROUP} </th>
|
||||
<th> {L_SPECIAL_CATEGORY} </th>
|
||||
<th> {L_ALLOWED} </th>
|
||||
<th> {L_DOWNLOAD_MODE} </th>
|
||||
<th> {L_UPLOAD_ICON} </th>
|
||||
<th> {L_MAX_GROUPS_FILESIZE} </th>
|
||||
<th> {L_ALLOWED_FORUMS} </th>
|
||||
<th> {L_DELETE} </th>
|
||||
</tr>
|
||||
<!-- BEGIN grouprow -->
|
||||
<tr>
|
||||
<input type="hidden" name="group_change_list[]" value="{grouprow.GROUP_ID}" />
|
||||
<td class="row1" align="center">
|
||||
<table width="100%" class="borderless">
|
||||
<tr>
|
||||
<td class="row1" align="center" width="10%" wrap="nowrap"><b><span class="small"><a href="{grouprow.U_VIEWGROUP}" class="small">{grouprow.CAT_BOX}</a></span></b></td>
|
||||
<td class="row1"><input type="text" size="20" maxlength="100" name="extension_group_list[]" class="post" value="{grouprow.EXTENSION_GROUP}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="row2" align="center">{grouprow.S_SELECT_CAT}</td>
|
||||
<td class="row1" align="center"><input type="checkbox" name="allowed_list[]" value="{grouprow.GROUP_ID}" {grouprow.S_ALLOW_SELECTED} /></td>
|
||||
<td class="row2" align="center">{grouprow.S_DOWNLOAD_MODE}</td>
|
||||
<td class="row1" align="center"><input type="text" size="15" maxlength="100" name="upload_icon_list[]" class="post" value="{grouprow.UPLOAD_ICON}" /></td>
|
||||
<td class="row2" align="center"><input type="text" size="3" maxlength="15" name="max_filesize_list[]" class="post" value="{grouprow.MAX_FILESIZE}" /> {grouprow.S_FILESIZE}</td>
|
||||
<td class="row1" align="center"><span class="small"><a href="{grouprow.U_FORUM_PERMISSIONS}" class="small">{L_EXT_GROUP_PERMISSIONS}</a></span></td>
|
||||
<td class="row2" align="center"><input type="checkbox" name="group_id_list[]" value="{grouprow.GROUP_ID}" /></td>
|
||||
</tr>
|
||||
<!-- BEGIN extensionrow -->
|
||||
<tr>
|
||||
<td class="row2" align="center"><span class="small">{grouprow.extensionrow.EXTENSION}</span></td>
|
||||
<td class="row2" align="center"><span class="small">{grouprow.extensionrow.EXPLANATION}</span></td>
|
||||
<td class="row2" align="center"> </td>
|
||||
<td class="row2" align="center"> </td>
|
||||
<td class="row2" align="center"> </td>
|
||||
<td class="row2" align="center"> </td>
|
||||
<td class="row2" align="center"> </td>
|
||||
<td class="row2" align="center"> </td>
|
||||
</tr>
|
||||
|
||||
<!-- END extensionrow -->
|
||||
<!-- END grouprow -->
|
||||
|
||||
<tr align="right">
|
||||
<td class="catBottom" colspan="8">
|
||||
<input type="submit" name="{L_CANCEL}" class="liteoption" value="{L_CANCEL}" onClick="self.location.href='{S_CANCEL_ACTION}'" />
|
||||
<input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_EXTENSION_GROUPS -->
|
||||
|
||||
<!-- IF TPL_ATTACH_EXTENSION_GROUPS_PERMISSIONS -->
|
||||
<!--========================================================================-->
|
||||
|
||||
<h1>{L_GROUP_PERMISSIONS_TITLE}</h1>
|
||||
|
||||
<p>{L_GROUP_PERMISSIONS_EXPLAIN}</p>
|
||||
<br />
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<form method="post" action="{A_PERM_ACTION}">
|
||||
<table width="90%" class="forumline">
|
||||
<tr>
|
||||
<th>{L_ALLOWED_FORUMS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:560px" name="entries[]" multiple size="5">
|
||||
<!-- BEGIN allow_option_values -->
|
||||
<option value="{allow_option_values.VALUE}">{allow_option_values.OPTION}</option>
|
||||
<!-- END allow_option_values -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"> <input class="liteoption" type="submit" name="del_forum" value="{L_REMOVE_SELECTED}" /> <input class="liteoption" type="submit" name="close_perm" value="{L_CLOSE_WINDOW}" /><input type="hidden" name="e_mode" value="perm" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" action="{A_PERM_ACTION}">
|
||||
<table width="90%" class="forumline">
|
||||
<tr>
|
||||
<th>{L_ADD_FORUMS}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center">
|
||||
<select style="width:560px" name="entries[]" multiple size="5">
|
||||
<!-- BEGIN forum_option_values -->
|
||||
<option value="{forum_option_values.VALUE}">{forum_option_values.OPTION}</option>
|
||||
<!-- END forum_option_values -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"> <input type="submit" name="add_forum" value="{L_ADD_SELECTED}" class="mainoption" /> <input type="reset" value="{L_RESET}" class="liteoption" /> <input type="hidden" name="e_mode" value="perm" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!--========================================================================-->
|
||||
<!-- ENDIF / TPL_ATTACH_EXTENSION_GROUPS_PERMISSIONS -->
|
||||
|
||||
<br clear="all" />
|
|
@ -333,7 +333,6 @@ $(document).ready(function() {
|
|||
<a class="med" href="{U_TRACKER}?rid={SESSION_USER_ID}#results">{L_CUR_UPLOADS}</a>
|
||||
<a class="med" href="{U_SEARCH}?dlu={SESSION_USER_ID}&dlc=1">{L_SEARCH_DL_COMPLETE_DOWNLOADS}</a>
|
||||
<a class="med" href="{U_SEARCH}?dlu={SESSION_USER_ID}&dlw=1">{L_SEARCH_DL_WILL_DOWNLOADS}</a>
|
||||
<a class="med" href="{U_WATCHED_TOPICS}">{L_WATCHED_TOPICS}</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ELSE -->
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
<script type="text/javascript">
|
||||
ajax.in_edit_mode = false;
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#show-edit-btn a').click(function(){
|
||||
show_edit_options();
|
||||
$('#show-edit-btn').html( $('#edit-sel-topics').html() );
|
||||
return false;
|
||||
});
|
||||
|
||||
$('td.topic_id').click(function(){
|
||||
if (!ajax.in_edit_mode) {
|
||||
$('#show-edit-btn a').click();
|
||||
$(this).find('input').click();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function show_edit_options ()
|
||||
{
|
||||
$('td.topic_id').each(function(){
|
||||
var topic_id = $(this).attr('id');
|
||||
var input = '<input id="sel-'+ topic_id +'" type="checkbox" value="'+ topic_id +'" class="topic-chbox" />';
|
||||
$(this).html(input);
|
||||
});
|
||||
|
||||
$('input.topic-chbox').click(function(){
|
||||
if ($.browser.mozilla) {
|
||||
$('#tr-'+this.value+' td').toggleClass('hl-selected-row');
|
||||
} else {
|
||||
$('#tr-'+this.value).toggleClass('hl-selected-row');
|
||||
}
|
||||
});
|
||||
$('#pagination a.pg').each(function(){ this.href += '&mod=1'; });
|
||||
$('#ed-list-desc').hide();
|
||||
$('#mod-action-cell').append( $('#mod-action-content')[0] );
|
||||
$('#mod-action-row, #mod-action-content').show();
|
||||
|
||||
$('#mod-action').submit(function(){
|
||||
var $form = $(this);
|
||||
$('input[name~=topic_id_list]', $form).remove();
|
||||
$('input.topic-chbox:checked').each(function(){
|
||||
$form.append('<input type="hidden" name="topic_id_list[]" value="'+ this.value +'" />');
|
||||
$('#tr-'+this.value).remove();
|
||||
});
|
||||
});
|
||||
ajax.in_edit_mode = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
td.topic_id { cursor: pointer; }
|
||||
</style>
|
||||
|
||||
<div id="mod-action-content" style="display: none;">
|
||||
<form id="mod-action" name="watch_form" method="post" action="{S_FORM_ACTION}">
|
||||
<table class="borderless pad_0" cellpadding="0" cellspacing="0">
|
||||
<tr><td class="pad_4">
|
||||
<input type="submit" name="del_from_ut" value="{L_DEL_LIST_MY_MESSAGE}" onclick="if (!window.confirm( this.value +'?' )){ return false };" />
|
||||
</tr></table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table id="post-row" style="display: none;">
|
||||
<tr>
|
||||
<td class="row2" colspan="7">
|
||||
<div class="post_watch_wrap row1">
|
||||
<div class="post_body pad_6"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table cellpadding="2" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<h1 class="maintitle">{PAGE_TITLE}</h1>
|
||||
<div id="forums_top_links" class="nav">
|
||||
<a href="{U_INDEX}">{T_INDEX}</a> <em>·</em>
|
||||
<span id="show-edit-btn"><a href="#">{L_EDIT_MY_MESSAGE_LIST}</a></span>
|
||||
<span id="edit-sel-topics" style="display: none;"><a href="#" class="bold adm" onclick="$('input.topic-chbox').trigger('click'); return false;">{L_SELECT_INVERT}</a></span><em>·</em>
|
||||
<a href="#" class="med normal" onclick="setCookie('{COOKIE_MARK}', 'all_forums');">{L_MARK_ALL_FORUMS_READ}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="vBottom tLeft nowrap med"><b>{PAGINATION}</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" class="forumline tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="{sorter: 'text'}"></th>
|
||||
<th class="{sorter: 'text'}" width="25%"><b class="tbs-text">{L_FORUM}</b></th>
|
||||
<th class="{sorter: 'text'}" width="75%"><b class="tbs-text">{L_TOPIC}</b></th>
|
||||
<th class="{sorter: 'text'}"><b class="tbs-text">{L_AUTHOR}</b></th>
|
||||
<th width="80" class="{sorter: 'text'}"><b class="tbs-text">{L_REPLIES}</b></th>
|
||||
<th width="120" class="{sorter: 'text'} nowrap"><b class="tbs-text">{L_LASTPOST}</b></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- BEGIN watch -->
|
||||
<tr class="tCenter {watch.ROW_CLASS}" id="tr-{watch.TOPIC_ID}">
|
||||
<td id="{watch.TOPIC_ID}" class="topic_id">
|
||||
<span style="display: none;">{watch.TOPIC_ICON}</span>
|
||||
<img class="topic_icon" src="{watch.TOPIC_ICON}">
|
||||
</td>
|
||||
<td><a href="{watch.U_FORUM}" class="genmed">{watch.FORUM_TITLE}</a></td>
|
||||
<td class="tLeft nowrap">
|
||||
<a class="topictitle" title="{watch.FULL_TOPIC_TITLE}" href="{watch.U_TOPIC}">{watch.TOPIC_TITLE}</a>
|
||||
<!-- IF watch.PAGINATION --><br /><span class="topicPG"> [{ICON_GOTOPOST}{L_GOTO_SHORT} {watch.PAGINATION} ]</span><!-- ENDIF -->
|
||||
</td>
|
||||
<td>{watch.AUTHOR}</td>
|
||||
<td class="gensmall">{watch.REPLIES}</td>
|
||||
<td class="gensmall nowrap">
|
||||
{watch.LAST_POST}<!-- IF watch.IS_UNREAD --><a href="{TOPIC_URL}{watch.TOPIC_ID}{NEWEST_URL}">{ICON_NEWEST_REPLY}</a><!-- ELSE -->
|
||||
<a href="{POST_URL}{watch.LAST_POST_ID}#{watch.LAST_POST_ID}">{ICON_LATEST_REPLY}</a><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END watch -->
|
||||
<tfoot>
|
||||
<tr id="mod-action-row">
|
||||
<td colspan="6" id="mod-action-cell" class="row2">
|
||||
<span id="ed-list-desc" class="small">{L_DEL_LIST_INFO}<span class="floatR">{MATCHES}</span></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
|
@ -1,4 +1,3 @@
|
|||
<!-- IF postrow.IS_FIRST_POST -->
|
||||
<div>
|
||||
<fieldset class="attach">
|
||||
<legend>{L_DOWNLOAD}</legend>
|
||||
|
@ -10,4 +9,3 @@
|
|||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
define('BB_SCRIPT', 'terms');
|
||||
define('BB_ROOT', './');
|
||||
require __DIR__ . '/common.php';
|
||||
require INC_DIR . '/bbcode.php';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue