Начало замены аттач-мода

Удаление файлов управления из админки, отключение системы квот для групп пользователей в админке, удаление крон-задачи на обслуживание старых аттачей.

Обновление на этот и последующие коммиты на рабочих трекерах не рекомендуется до объявления об обратном.
This commit is contained in:
Exile 2014-12-10 20:08:35 +03:00
commit 7305d1f737
13 changed files with 1 additions and 3071 deletions

View file

@ -1,556 +0,0 @@
<?php
if (!empty($setmodules))
{
$module['ATTACHMENTS']['CONTROL_PANEL'] = basename(__FILE__);
return;
}
require('./pagestart.php');
$total_attachments = 0;
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');
// Check if the language got included
if (!isset($lang['TEST_SETTINGS_SUCCESSFUL']))
{
// include_once is used within the function
include_attach_lang();
}
// 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';
}
}
else if ($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';
}
}
else if ($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') ? true : false;
// 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;
}
}
else if ($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; $i < count($view_types_text); $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; $i < count($mode_types_text); $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']) ) ? TRUE : FALSE;
$delete = ( isset($_POST['delete']) ) ? TRUE : FALSE;
$delete_id_list = get_var('delete_id_list', array(0));
$confirm = isset($_POST['confirm']);
if ($confirm && sizeof($delete_id_list) > 0)
{
$attachments = array();
delete_attachment(0, $delete_id_list);
}
else if ($delete && sizeof($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 . '" />';
for ($i = 0; $i < sizeof($delete_id_list); $i++)
{
$hidden_fields .= '<input type="hidden" name="delete_id_list[]" value="' . $delete_id_list[$i] . '" />';
}
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; $i < count($attach_change_list); $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 = '';
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'];
}
}
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']) ? TRUE : FALSE;
$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 = " . intval($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="' . intval($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 = " . intval($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[] = intval($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 (sizeof($attachments) > 0)
{
for ($i = 0; $i < sizeof($attachments); $i++)
{
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';
for ($j = 0; $j < count($delete_id_list); $j++)
{
if ($delete_id_list[$j] == $attachments[$i]['attach_id'])
{
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . intval($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 = array();
$sql = "SELECT *
FROM " . BB_ATTACHMENTS . "
WHERE attach_id = " . intval($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 = " . intval($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="' . intval($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 . DOWNLOAD_URL . $attachments[$i]['attach_id'],
));
}
}
if (!$search_based && !$user_based)
{
if ($total_attachments == 0)
{
$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 . '&amp;mode=' . $mode . '&amp;order=' . $sort_order . '&amp;uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start).'&nbsp;';
}
print_page('admin_attach_cp.tpl', 'admin');

View file

@ -1,719 +0,0 @@
<?php
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('./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');
// Check if the language got included
if (!isset($lang['TEST_SETTINGS_SUCCESSFUL']))
{
// include_once is used within the function
include_attach_lang();
}
// 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;
}
else if ($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 (preg_match('/convert/i', $imagick))
{
return true;
}
else if ($imagick != 'none')
{
if (!preg_match('/WIN/i', PHP_OS))
{
$retval = @exec('whereis convert');
$paths = explode(' ', $retval);
if (is_array($paths))
{
for ( $i=0; $i < sizeof($paths); $i++)
{
$path = basename($paths[$i]);
if ($path == 'convert')
{
$imagick = $paths[$i];
}
}
}
}
else if (preg_match('/WIN/i', PHP_OS))
{
$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', 'w')) )
{
$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')
{
$yes_no_switches = array('disable_mod', 'allow_pm_attach', 'display_order');
for ($i = 0; $i < sizeof($yes_no_switches); $i++)
{
eval("\$" . $yes_no_switches[$i] . "_yes = ( \$new_attach['" . $yes_no_switches[$i] . "'] != '0' ) ? 'checked=\"checked\"' : '';");
eval("\$" . $yes_no_switches[$i] . "_no = ( \$new_attach['" . $yes_no_switches[$i] . "'] == '0' ) ? 'checked=\"checked\"' : '';");
}
$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', intval(trim($new_attach['default_upload_quota']))),
'S_DEFAULT_PM_LIMIT' => default_quota_limit_select('default_pm_quota', intval(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' => $disable_mod_yes,
'DISABLE_MOD_NO' => $disable_mod_no,
'PM_ATTACH_YES' => $allow_pm_attach_yes,
'PM_ATTACH_NO' => $allow_pm_attach_no,
'DISPLAY_ORDER_ASC' => $display_order_yes,
'DISPLAY_ORDER_DESC' => $display_order_no,
));
}
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; $i < sizeof($row); $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)) )
{
@mkdir($upload_dir, 0755);
@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', 'w')) )
{
$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; $i < sizeof($quota_change_list); $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;
}
else if ( $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; $i < sizeof($rows); $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;
}
else if($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&amp;e_mode=view_quota&amp;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'],
));
}
else if ($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'],
));
}
else if ($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');

View file

@ -1,780 +0,0 @@
<?php
if (!empty($setmodules))
{
$filename = basename(__FILE__);
$module['ATTACHMENTS']['EXTENSION_CONTROL'] = $filename .'?mode=extensions';
$module['ATTACHMENTS']['EXTENSION_GROUP_MANAGE'] = $filename .'?mode=groups';
return;
}
require('./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');
// Check if the language got included
if (!isset($lang['TEST_SETTINGS_SUCCESSFUL']))
{
// include_once is used within the function
include_attach_lang();
}
// 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', '');
$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; $i < sizeof($extension_change_list); $i++)
{
$extensions['_' . $extension_change_list[$i]]['comment'] = $extension_explain_list[$i];
$extensions['_' . $extension_change_list[$i]]['group_id'] = intval($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; $i < sizeof($extension_row); $i++)
{
if ($extension_row[$i]['comment'] != $extensions['_' . $extension_row[$i]['ext_id']]['comment'] || intval($extension_row[$i]['group_id']) != intval($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, 'group_name', 'ASC');
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();
for ($i = 0; $i < sizeof($group_allowed_list); $i++)
{
for ($j = 0; $j < sizeof($group_change_list); $j++)
{
if ($group_allowed_list[$i] == $group_change_list[$j])
{
$allowed_list[$j] = 1;
}
}
}
for ($i = 0; $i < sizeof($group_change_list); $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;
}
else if ( $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' => ( isset($submit) ) ? @$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;
}
else if($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&amp;e_mode=perm&amp;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);
$add_forum = (isset($_POST['add_forum'])) ? TRUE : FALSE;
$delete_forum = (isset($_POST['del_forum'])) ? TRUE : FALSE;
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;
for ($i = 0; $i < sizeof($add_forums_list); $i++)
{
if ($add_forums_list[$i] == 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 = ' . intval($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
for ($i = 0; $i < sizeof($add_forums_list); $i++)
{
if (!in_array($add_forums_list[$i], $auth_p))
{
$auth_p[] = $add_forums_list[$i];
}
}
$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 = ' . intval($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
for ($i = 0; $i < sizeof($auth_p2); $i++)
{
if (!in_array($auth_p2[$i], $delete_forums_list))
{
$auth_p[] = $auth_p2[$i];
}
}
$auth_bitstream = (sizeof($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 = ' . intval($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; $i < sizeof($forum_perm); $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&amp;e_mode=perm&amp;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[intval($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 (sizeof($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');

View file

@ -12,8 +12,6 @@ require(INC_DIR .'functions_group.php');
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? intval($_REQUEST[POST_GROUPS_URL]) : 0;
$mode = isset($_REQUEST['mode']) ? strval($_REQUEST['mode']) : '';
attachment_quota_settings('group', isset($_POST['group_update']), $mode);
if (!empty($_POST['edit']) || !empty($_POST['new']))
{
if (!empty($_POST['edit']))

View file

@ -5,8 +5,6 @@ define('IN_FORUM', true);
define('IN_ADMIN', true);
require(BB_ROOT .'common.php');
require(ATTACH_DIR .'attachment_mod.php');
require(ATTACH_DIR .'includes/functions_admin.php');
require_once(INC_DIR .'functions_admin.php');
$user->session_start();

View file

@ -540,7 +540,6 @@ CREATE TABLE IF NOT EXISTS `bb_cron` (
-- ----------------------------
-- Records of bb_cron
-- ----------------------------
INSERT INTO `bb_cron` VALUES ('', '1', 'Attach maintenance', 'attach_maintenance.php', 'daily', '', '05:00:00', '40', '', '', '', '1', '', '0', '1', '0');
INSERT INTO `bb_cron` VALUES ('', '1', 'Board maintenance', 'board_maintenance.php', 'daily', '', '05:00:00', '40', '', '', '', '1', '', '0', '1', '0');
INSERT INTO `bb_cron` VALUES ('', '1', 'Prune forums', 'prune_forums.php', 'daily', '', '05:00:00', '50', '', '', '', '1', '', '0', '1', '0');
INSERT INTO `bb_cron` VALUES ('', '1', 'Prune topic moved stubs', 'prune_topic_moved.php', 'daily', '', '05:00:00', '60', '', '', '', '1', '', '0', '1', '0');

View file

@ -57,3 +57,4 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php',
// 2.1.6
DROP TABLE IF EXISTS `bb_ads`;
DELETE FROM `bb_config` WHERE `config_name` = 'active_ads';
DELETE FROM `bb_cron` WHERE `cron_script` = 'attach_maintenance.php';

View file

@ -1,224 +0,0 @@
<?php
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 = join(',', $files);
DB()->query("INSERT INTO $tmp_attach_tbl VALUES $files");
$files = array();
$f_len = 0;
}
}
if ($files = join(',', $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 = join(',', $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 = join(',', $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 = join(',', $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 = join(',', $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);

View file

@ -177,7 +177,6 @@ BBCode.prototype = {
// Available key combinations and these interpretaions for BB are
// TAB - Insert TAB char
// CTRL-TAB - Next form field (usual TAB)
// SHIFT-ALT-PAGEUP - Add an Attachment
// ALT-ENTER - Preview
// CTRL-ENTER - Submit
onKeyPress: function(e, type) {
@ -210,8 +209,6 @@ BBCode.prototype = {
// Hot keys
var form = this.textarea.form;
var submitter = null;
if (e.keyCode == this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.add_attachment_box;
if (e.keyCode == this.VK_ENTER &&!e.shiftKey && !e.ctrlKey && e.altKey)
submitter = form.preview;
if (e.keyCode == this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey)

View file

@ -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}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;
<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}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;
<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}:&nbsp;</span></td>
<td class="row2" colspan="2">{S_SORT_OPTIONS}</td>
<tr>
<td class="row1" colspan="2" align="right"><span class="gen">{L_SORT}:&nbsp;</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}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;
<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">&nbsp;{memberrow.ROW_NUMBER}&nbsp;</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">&nbsp;<b>{memberrow.TOTAL_ATTACHMENTS}</b>&nbsp;</td>
<td class="{memberrow.ROW_CLASS}" align="center">&nbsp;<b>{memberrow.TOTAL_SIZE}</b>&nbsp;</td>
</tr>
<!-- END memberrow -->
</table>
<table width="100%">
<tr>
<td><span class="nav">{PAGE_NUMBER}</span></td>
<td align="right"><span class="nav">{PAGINATION}&nbsp;</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}:&nbsp;{S_VIEW_SELECT}&nbsp;&nbsp;{L_SORT_BY}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;
<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">&nbsp;{attachrow.ROW_NUMBER}&nbsp;</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" />
&nbsp;
<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}&nbsp;</span></td>
</tr>
</table>
</form>
<!--========================================================================-->
<!-- ENDIF / TPL_ATTACH_ATTACHMENTS -->
<br />

View file

@ -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}&nbsp;&nbsp;<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}&nbsp;&nbsp;<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}&nbsp;&nbsp;<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" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="search_imagick" value="{L_IMAGE_SEARCH_IMAGICK}" class="liteoption" />&nbsp;&nbsp;<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">&nbsp;{L_UPLOAD_QUOTA}&nbsp;</span></td>
</tr>
<tr>
<td nowrap="nowrap">{S_DEFAULT_PM_LIMIT}</td>
<td nowrap="nowrap"><span class="small">&nbsp;{L_PM_QUOTA}&nbsp;</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}&nbsp;&nbsp;<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}&nbsp;&nbsp;<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" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<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="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%">
&nbsp;&nbsp;&nbsp;
</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="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">
&nbsp;&nbsp;&nbsp;
</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="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%">
&nbsp;&nbsp;&nbsp;
</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="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" />

View file

@ -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>&nbsp;{L_EXPLANATION}&nbsp;</th>
<th>&nbsp;{L_EXTENSION}&nbsp;</th>
<th>&nbsp;{L_EXTENSION_GROUP}&nbsp;</th>
<th>&nbsp;{L_ADD_NEW}&nbsp;</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>&nbsp;{L_EXPLANATION}&nbsp;</th>
<th>&nbsp;{L_EXTENSION}&nbsp;</th>
<th>&nbsp;{L_EXTENSION_GROUP}&nbsp;</th>
<th>&nbsp;{L_DELETE}&nbsp;</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>&nbsp;{L_EXTENSION_GROUP}&nbsp;</th>
<th>&nbsp;{L_SPECIAL_CATEGORY}&nbsp;</th>
<th>&nbsp;{L_ALLOWED}&nbsp;</th>
<th>&nbsp;{L_DOWNLOAD_MODE}&nbsp;</th>
<th>&nbsp;{L_UPLOAD_ICON}&nbsp;</th>
<th>&nbsp;{L_MAX_FILESIZE_ATTACH}&nbsp;</th>
<th>&nbsp;{L_ALLOWED_FORUMS}&nbsp;</th>
<th>&nbsp;{L_ADD_NEW}&nbsp;</th>
</tr>
<tr>
<td class="row1" align="center">
<table width="100%" class="borderless">
<tr>
<td class="row1" align="center" width="10%" wrap="nowrap">&nbsp;</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">&nbsp;</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>&nbsp;{L_EXTENSION_GROUP}&nbsp;</th>
<th>&nbsp;{L_SPECIAL_CATEGORY}&nbsp;</th>
<th>&nbsp;{L_ALLOWED}&nbsp;</th>
<th>&nbsp;{L_DOWNLOAD_MODE}&nbsp;</th>
<th>&nbsp;{L_UPLOAD_ICON}&nbsp;</th>
<th>&nbsp;{L_MAX_GROUPS_FILESIZE}&nbsp;</th>
<th>&nbsp;{L_ALLOWED_FORUMS}&nbsp;</th>
<th>&nbsp;{L_DELETE}&nbsp;</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">&nbsp;</td>
<td class="row2" align="center">&nbsp;</td>
<td class="row2" align="center">&nbsp;</td>
<td class="row2" align="center">&nbsp;</td>
<td class="row2" align="center">&nbsp;</td>
<td class="row2" align="center">&nbsp;</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="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}" /> &nbsp; <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="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" />&nbsp; <input type="reset" value="{L_RESET}" class="liteoption" />&nbsp; <input type="hidden" name="e_mode" value="perm" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!--========================================================================-->
<!-- ENDIF / TPL_ATTACH_EXTENSION_GROUPS_PERMISSIONS -->
<br clear="all" />

View file

@ -51,14 +51,6 @@
<td>{L_GROUP_DELETE}:</td>
<td><input type="checkbox" name="group_delete" value="1"> {L_GROUP_DELETE_CHECK}</td>
</tr>
<tr>
<td>{L_UPLOAD_QUOTA}</td>
<td>{S_SELECT_UPLOAD_QUOTA}</td>
</tr>
<tr>
<td>{L_PM_QUOTA}</td>
<td>{S_SELECT_PM_QUOTA}</td>
</tr>
<!-- END group_edit -->
<tr>
<td class="catBottom" colspan="2">