r592
В связи с необходимостью срочного исправления уязвимости, внедрение чата и некоторые другие вещи отложены до ревизии 593. Новая система нумерации версия движка. Ревизия 600 согласно новой терминологии будет версией 2.1. Изменения в данной ревизии: - добавлена единая функция для вывода ошибок - bb_die, переделаны все вхождения данной функции; - добавлена функция для вывода визуального изображения пола пользователя + изображение для не указавшего; - добавлена поддержка CloudFlare; - исправление критической уязвимости с доступом к системны файлам движка; - исправлена работа функции bb_date, переделаны все вхождения данной функции; - исправлена структура папок для полной поддержки git; - исправлена структура папок с локализованными изображениями шаблона; - исправления в локализации - перевод сообщения об отключении форума и некоторые другие вещи; - удаление уязвимых копонентов текущего аттач-мода (загрузка по ftp; прикрепление swf); - удаление php-дебаггера кода, из-за несовместимости с актуальной версией php; - удаление файла donate.php и соответствующего шаблона; - удаление большей части костылей для поддержки устаревших браузеров; - удаление части неиспользуемого кода, мусора из папок, некоторы� неиспользуемых изображений; - другие множественные исправления.
|
@ -128,7 +128,7 @@ http {
|
||||||
# allow YOUR_IP;
|
# allow YOUR_IP;
|
||||||
}
|
}
|
||||||
# Deny folder (Sec. lvl1)
|
# Deny folder (Sec. lvl1)
|
||||||
location ~ \/(cache|log|attach_mod|cache|config|includes|language|triggers)\/ {
|
location ~ \/(cache|log|attach_mod|config|includes|language|triggers)\/ {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,16 +125,9 @@ INSERT INTO `bb_attachments_config` VALUES ('max_attachments', '1');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('max_attachments_pm', '1');
|
INSERT INTO `bb_attachments_config` VALUES ('max_attachments_pm', '1');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('disable_mod', '0');
|
INSERT INTO `bb_attachments_config` VALUES ('disable_mod', '0');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('allow_pm_attach', '1');
|
INSERT INTO `bb_attachments_config` VALUES ('allow_pm_attach', '1');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('allow_ftp_upload', '0');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('attach_version', '2.3.14');
|
INSERT INTO `bb_attachments_config` VALUES ('attach_version', '2.3.14');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('default_upload_quota', '0');
|
INSERT INTO `bb_attachments_config` VALUES ('default_upload_quota', '0');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('default_pm_quota', '0');
|
INSERT INTO `bb_attachments_config` VALUES ('default_pm_quota', '0');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('ftp_server', '');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('ftp_path', '');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('download_path', '');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('ftp_user', '');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('ftp_pass', '');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('ftp_pasv_mode', '1');
|
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('img_display_inlined', '1');
|
INSERT INTO `bb_attachments_config` VALUES ('img_display_inlined', '1');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('img_max_width', '200');
|
INSERT INTO `bb_attachments_config` VALUES ('img_max_width', '200');
|
||||||
INSERT INTO `bb_attachments_config` VALUES ('img_max_height', '200');
|
INSERT INTO `bb_attachments_config` VALUES ('img_max_height', '200');
|
||||||
|
@ -706,9 +699,7 @@ INSERT INTO `bb_extensions` VALUES (23, 4, 'ai', '');
|
||||||
INSERT INTO `bb_extensions` VALUES (24, 4, 'ps', '');
|
INSERT INTO `bb_extensions` VALUES (24, 4, 'ps', '');
|
||||||
INSERT INTO `bb_extensions` VALUES (25, 4, 'ppt', '');
|
INSERT INTO `bb_extensions` VALUES (25, 4, 'ppt', '');
|
||||||
INSERT INTO `bb_extensions` VALUES (26, 5, 'rm', '');
|
INSERT INTO `bb_extensions` VALUES (26, 5, 'rm', '');
|
||||||
INSERT INTO `bb_extensions` VALUES (27, 6, 'wma', '');
|
INSERT INTO `bb_extensions` VALUES (29, 6, 'torrent', '');
|
||||||
INSERT INTO `bb_extensions` VALUES (28, 7, 'swf', '');
|
|
||||||
INSERT INTO `bb_extensions` VALUES (29, 8, 'torrent', '');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -734,12 +725,10 @@ CREATE TABLE IF NOT EXISTS `bb_extension_groups` (
|
||||||
|
|
||||||
INSERT INTO `bb_extension_groups` VALUES (1, 'Images', 1, 1, 1, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (1, 'Images', 1, 1, 1, '', 262144, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (2, 'Archives', 0, 1, 1, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (2, 'Archives', 0, 1, 1, '', 262144, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (3, 'Plain Text', 0, 0, 1, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (3, 'Plain text', 0, 0, 1, '', 262144, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (4, 'Documents', 0, 0, 1, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (4, 'Documents', 0, 0, 1, '', 262144, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (5, 'Real Media', 0, 0, 2, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (5, 'Real media', 0, 0, 2, '', 262144, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (6, 'Streams', 2, 0, 1, '', 262144, '');
|
INSERT INTO `bb_extension_groups` VALUES (6, 'Torrent', 0, 1, 1, '', 122880, '');
|
||||||
INSERT INTO `bb_extension_groups` VALUES (7, 'Flash Files', 3, 0, 1, '', 262144, '');
|
|
||||||
INSERT INTO `bb_extension_groups` VALUES (8, 'Torrent', 0, 1, 1, '', 122880, '');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,4 @@ Quick guide:
|
||||||
'for_tbdev/announce.php'
|
'for_tbdev/announce.php'
|
||||||
|
|
||||||
Cheers, RoadTrain.
|
Cheers, RoadTrain.
|
||||||
http://torrentpier.info/
|
http://torrentpier.me/
|
|
@ -1,10 +1,9 @@
|
||||||
## Set charset server
|
## Set charset server
|
||||||
AddDefaultCharset UTF-8
|
AddDefaultCharset UTF-8
|
||||||
|
|
||||||
#RewriteEngine On
|
|
||||||
|
|
||||||
## Access control
|
## Access control
|
||||||
|
Options All -Indexes
|
||||||
|
|
||||||
<FilesMatch "\.(.*sql|tpl|inc|db|log)|(config|common).php$">
|
<FilesMatch "\.(.*sql|tpl|inc|db|log)|(config|common).php$">
|
||||||
deny from all
|
deny from all
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
php_value allow_call_time_pass_reference On
|
|
|
@ -1,8 +0,0 @@
|
||||||
AddDefaultCharset UTF-8
|
|
||||||
#order allow deny
|
|
||||||
#deny from all
|
|
||||||
#allow from 127.0.0.1
|
|
||||||
|
|
||||||
<FilesMatch "xs_config.php">
|
|
||||||
allow from all
|
|
||||||
</FilesMatch>
|
|
|
@ -11,8 +11,6 @@ require('./pagestart.php');
|
||||||
|
|
||||||
$total_attachments = 0;
|
$total_attachments = 0;
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
||||||
{
|
{
|
||||||
$upload_dir = $attach_config['upload_dir'];
|
$upload_dir = $attach_config['upload_dir'];
|
||||||
|
@ -21,11 +19,6 @@ if (!intval($attach_config['allow_ftp_upload']))
|
||||||
{
|
{
|
||||||
$upload_dir = '../' . $attach_config['upload_dir'];
|
$upload_dir = '../' . $attach_config['upload_dir'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['download_path'];
|
|
||||||
}
|
|
||||||
|
|
||||||
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
||||||
|
|
||||||
|
@ -211,8 +204,8 @@ else if ($delete && sizeof($delete_id_list) > 0)
|
||||||
// Assign Default Template Vars
|
// Assign Default Template Vars
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_VIEW_SELECT' => $select_view,
|
'S_VIEW_SELECT' => $select_view,
|
||||||
'S_MODE_ACTION' => 'admin_attach_cp.php')
|
'S_MODE_ACTION' => 'admin_attach_cp.php',
|
||||||
);
|
));
|
||||||
|
|
||||||
if ($submit_change && $view == 'attachments')
|
if ($submit_change && $view == 'attachments')
|
||||||
{
|
{
|
||||||
|
@ -235,7 +228,7 @@ if ($submit_change && $view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t get Attachment informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get attachment informations');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( $attachrow = DB()->sql_fetchrow($result) )
|
while ( $attachrow = DB()->sql_fetchrow($result) )
|
||||||
|
@ -250,7 +243,7 @@ if ($submit_change && $view == 'attachments')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update Attachments Informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update attachments informations');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,15 +280,14 @@ if ($view == 'stats')
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_STATISTICS' => true,
|
'TPL_ATTACH_STATISTICS' => true,
|
||||||
|
|
||||||
'TOTAL_FILESIZE' => $upload_dir_size,
|
'TOTAL_FILESIZE' => $upload_dir_size,
|
||||||
'ATTACH_QUOTA' => $attachment_quota,
|
'ATTACH_QUOTA' => $attachment_quota,
|
||||||
'NUMBER_OF_ATTACHMENTS' => $number_of_attachments,
|
'NUMBER_OF_ATTACHMENTS' => $number_of_attachments,
|
||||||
'NUMBER_OF_POSTS' => $number_of_posts,
|
'NUMBER_OF_POSTS' => $number_of_posts,
|
||||||
'NUMBER_OF_PMS' => $number_of_pms,
|
'NUMBER_OF_PMS' => $number_of_pms,
|
||||||
'NUMBER_OF_TOPICS' => $number_of_topics,
|
'NUMBER_OF_TOPICS' => $number_of_topics,
|
||||||
'NUMBER_OF_USERS' => $number_of_users)
|
'NUMBER_OF_USERS' => $number_of_users,
|
||||||
);
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +303,7 @@ if ($view == 'search')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain forum_name/forum_id', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain forum_name / forum_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$s_forums = '';
|
$s_forums = '';
|
||||||
|
@ -339,17 +331,16 @@ if ($view == 'search')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_SEARCHABLE_FORUMS']);
|
bb_die($lang['NO_SEARCHABLE_FORUMS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_SEARCH' => true,
|
'TPL_ATTACH_SEARCH' => true,
|
||||||
|
|
||||||
'S_FORUM_OPTIONS' => $s_forums,
|
'S_FORUM_OPTIONS' => $s_forums,
|
||||||
'S_CATEGORY_OPTIONS' => $s_categories,
|
'S_CATEGORY_OPTIONS' => $s_categories,
|
||||||
'S_SORT_OPTIONS' => $select_sort_mode,
|
'S_SORT_OPTIONS' => $select_sort_mode,
|
||||||
'S_SORT_ORDER' => $select_sort_order)
|
'S_SORT_ORDER' => $select_sort_order,
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Username
|
// Username
|
||||||
|
@ -357,10 +348,9 @@ if ($view == 'username')
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_USER' => true,
|
'TPL_ATTACH_USER' => true,
|
||||||
|
|
||||||
'S_MODE_SELECT' => $select_sort_mode,
|
'S_MODE_SELECT' => $select_sort_mode,
|
||||||
'S_ORDER_SELECT' => $select_sort_order)
|
'S_ORDER_SELECT' => $select_sort_order,
|
||||||
);
|
));
|
||||||
$total_rows = 0;
|
$total_rows = 0;
|
||||||
bb_die('removed');
|
bb_die('removed');
|
||||||
}
|
}
|
||||||
|
@ -375,23 +365,20 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_ATTACHMENTS' => true,
|
'TPL_ATTACH_ATTACHMENTS' => true,
|
||||||
|
|
||||||
'S_MODE_SELECT' => $select_sort_mode,
|
'S_MODE_SELECT' => $select_sort_mode,
|
||||||
'S_ORDER_SELECT' => $select_sort_order)
|
'S_ORDER_SELECT' => $select_sort_order,
|
||||||
);
|
));
|
||||||
|
|
||||||
$total_rows = 0;
|
$total_rows = 0;
|
||||||
|
|
||||||
// Are we called from Username ?
|
// Are we called from Username ?
|
||||||
if ($user_based)
|
if ($user_based)
|
||||||
{
|
{
|
||||||
$sql = "SELECT username
|
$sql = "SELECT username FROM " . BB_USERS . " WHERE user_id = " . intval($uid);
|
||||||
FROM " . BB_USERS . "
|
|
||||||
WHERE user_id = " . intval($uid);
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error getting username', '', __LINE__, __FILE__, $sql);
|
bb_die('Error getting username');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -404,8 +391,8 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_USER_HIDDEN' => $s_hidden,
|
'S_USER_HIDDEN' => $s_hidden,
|
||||||
'L_STATISTICS_FOR_USER' => sprintf($lang['STATISTICS_FOR_USER'], $username))
|
'L_STATISTICS_FOR_USER' => sprintf($lang['STATISTICS_FOR_USER'], $username),
|
||||||
);
|
));
|
||||||
|
|
||||||
$sql = "SELECT attach_id
|
$sql = "SELECT attach_id
|
||||||
FROM " . BB_ATTACHMENTS . "
|
FROM " . BB_ATTACHMENTS . "
|
||||||
|
@ -414,7 +401,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_ids = DB()->sql_fetchrowset($result);
|
$attach_ids = DB()->sql_fetchrowset($result);
|
||||||
|
@ -423,7 +410,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if ($num_attach_ids == 0)
|
if ($num_attach_ids == 0)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, 'For some reason no Attachments are assigned to the User "' . $username . '".');
|
bb_die('For some reason no attachments are assigned to the user ' . $username);
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_rows = $num_attach_ids;
|
$total_rows = $num_attach_ids;
|
||||||
|
@ -442,7 +429,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachments = DB()->sql_fetchrowset($result);
|
$attachments = DB()->sql_fetchrowset($result);
|
||||||
|
@ -482,7 +469,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids = DB()->sql_fetchrowset($result);
|
$ids = DB()->sql_fetchrowset($result);
|
||||||
|
@ -500,7 +487,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query topic', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query topic');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -533,15 +520,15 @@ if ($view == 'attachments')
|
||||||
'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']),
|
'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']),
|
||||||
'COMMENT' => htmlspecialchars($attachments[$i]['comment']),
|
'COMMENT' => htmlspecialchars($attachments[$i]['comment']),
|
||||||
'EXTENSION' => $attachments[$i]['extension'],
|
'EXTENSION' => $attachments[$i]['extension'],
|
||||||
'SIZE' => round(($attachments[$i]['filesize'] / MEGABYTE), 2),
|
'SIZE' => round(($attachments[$i]['filesize'] / 1024), 2),
|
||||||
'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
|
'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
|
||||||
'POST_TIME' => bb_date($attachments[$i]['filetime']),
|
'POST_TIME' => bb_date($attachments[$i]['filetime']),
|
||||||
'POST_TITLE' => $post_titles,
|
'POST_TITLE' => $post_titles,
|
||||||
|
|
||||||
'S_DELETE_BOX' => $delete_box,
|
'S_DELETE_BOX' => $delete_box,
|
||||||
'S_HIDDEN' => $hidden_field,
|
'S_HIDDEN' => $hidden_field,
|
||||||
'U_VIEW_ATTACHMENT' => BB_ROOT . 'download.php?id=' . $attachments[$i]['attach_id'])
|
'U_VIEW_ATTACHMENT' => BB_ROOT . 'download.php?id=' . $attachments[$i]['attach_id'],
|
||||||
);
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +541,7 @@ if ($view == 'attachments')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Attachment Description Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachment description table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_rows = DB()->num_rows($result);
|
$total_rows = DB()->num_rows($result);
|
||||||
|
|
|
@ -14,8 +14,6 @@ require('./pagestart.php');
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
||||||
{
|
{
|
||||||
$upload_dir = $attach_config['upload_dir'];
|
$upload_dir = $attach_config['upload_dir'];
|
||||||
|
@ -24,11 +22,6 @@ if (!intval($attach_config['allow_ftp_upload']))
|
||||||
{
|
{
|
||||||
$upload_dir = '../' . $attach_config['upload_dir'];
|
$upload_dir = '../' . $attach_config['upload_dir'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['download_path'];
|
|
||||||
}
|
|
||||||
|
|
||||||
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
||||||
|
|
||||||
|
@ -52,12 +45,11 @@ $check_image_cat = (isset($_POST['cat_settings'])) ? TRUE : FALSE;
|
||||||
$search_imagick = (isset($_POST['search_imagick'])) ? TRUE : FALSE;
|
$search_imagick = (isset($_POST['search_imagick'])) ? TRUE : FALSE;
|
||||||
|
|
||||||
// Re-evaluate the Attachment Configuration
|
// Re-evaluate the Attachment Configuration
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||||
FROM ' . BB_ATTACH_CONFIG;
|
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not find Attachment Config Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not find attachment config table #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -114,20 +106,6 @@ while ($row = DB()->sql_fetchrow($result))
|
||||||
$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] );
|
$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 == 'ftp_server' || $config_name == 'ftp_path' || $config_name == 'download_path')
|
|
||||||
{
|
|
||||||
$value = trim($new_attach[$config_name]);
|
|
||||||
|
|
||||||
if (strlen($value) && substr($value, -1) == '/')
|
|
||||||
{
|
|
||||||
if(strlen($value)) $value = substr($value, 0, strlen($value)-1);
|
|
||||||
else $value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$new_attach[$config_name] = trim($value);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($config_name == 'max_filesize')
|
if ($config_name == 'max_filesize')
|
||||||
{
|
{
|
||||||
$old_size = $attach_config[$config_name];
|
$old_size = $attach_config[$config_name];
|
||||||
|
@ -142,7 +120,7 @@ while ($row = DB()->sql_fetchrow($result))
|
||||||
|
|
||||||
if (!($result_2 = DB()->sql_query($sql)))
|
if (!($result_2 = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update Extension Group informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update extension group information');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,7 +138,7 @@ while ($row = DB()->sql_fetchrow($result))
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Failed to update attachment configuration for ' . $config_name, '', __LINE__, __FILE__, $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')
|
if ($config_name == 'max_filesize' || $config_name == 'attachment_quota' || $config_name == 'max_filesize_pm')
|
||||||
|
@ -234,12 +212,11 @@ if ($check_upload)
|
||||||
// Some tests...
|
// Some tests...
|
||||||
$attach_config = array();
|
$attach_config = array();
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||||
FROM ' . BB_ATTACH_CONFIG;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not find Attachment Config Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not find attachment config table #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -262,9 +239,7 @@ if ($check_upload)
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
|
// Does the target directory exist, is it a directory and writeable
|
||||||
if (intval($attach_config['allow_ftp_upload']) == 0)
|
|
||||||
{
|
|
||||||
if ( !@file_exists(@amod_realpath($upload_dir)) )
|
if ( !@file_exists(@amod_realpath($upload_dir)) )
|
||||||
{
|
{
|
||||||
$error = true;
|
$error = true;
|
||||||
|
@ -290,84 +265,10 @@ if ($check_upload)
|
||||||
unlink_attach($upload_dir . '/0_000000.000');
|
unlink_attach($upload_dir . '/0_000000.000');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check FTP Settings
|
|
||||||
$server = ( empty($attach_config['ftp_server']) ) ? 'localhost' : $attach_config['ftp_server'];
|
|
||||||
|
|
||||||
$conn_id = @ftp_connect($server);
|
|
||||||
|
|
||||||
if (!$conn_id)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_CONNECT'], $server) . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
$login_result = @ftp_login($conn_id, $attach_config['ftp_user'], $attach_config['ftp_pass']);
|
|
||||||
|
|
||||||
if ( (!$login_result) && (!$error) )
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_LOGIN'], $attach_config['ftp_user']) . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = $lang['FTP_ERROR_PASV_MODE'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Check Upload
|
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>'));
|
||||||
$tmpfname = @tempnam('/tmp', 't0000');
|
|
||||||
|
|
||||||
@unlink($tmpfname); // unlink for safety on php4.0.3+
|
|
||||||
|
|
||||||
$fp = @fopen($tmpfname, 'w');
|
|
||||||
|
|
||||||
@fwrite($fp, 'test');
|
|
||||||
|
|
||||||
@fclose($fp);
|
|
||||||
|
|
||||||
$result = @ftp_chdir($conn_id, $attach_config['ftp_path']);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_PATH'], $attach_config['ftp_path']) . '<br />';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$res = @ftp_put($conn_id, 't0000', $tmpfname, FTP_ASCII);
|
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_UPLOAD'], $attach_config['ftp_path']) . '<br />';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$res = @ftp_delete($conn_id, 't0000');
|
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_DELETE'], $attach_config['ftp_path']) . '<br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
@unlink($tmpfname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $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>'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,13 +277,13 @@ if ($submit && $mode == 'manage')
|
||||||
{
|
{
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $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>'));
|
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')
|
if ($mode == 'manage')
|
||||||
{
|
{
|
||||||
$yes_no_switches = array('disable_mod', 'allow_pm_attach', 'allow_ftp_upload', 'display_order', 'ftp_pasv_mode');
|
$yes_no_switches = array('disable_mod', 'allow_pm_attach', 'display_order');
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($yes_no_switches); $i++)
|
for ($i = 0; $i < sizeof($yes_no_switches); $i++)
|
||||||
{
|
{
|
||||||
|
@ -390,15 +291,6 @@ if ($mode == 'manage')
|
||||||
eval("\$" . $yes_no_switches[$i] . "_no = ( \$new_attach['" . $yes_no_switches[$i] . "'] == '0' ) ? 'checked=\"checked\"' : '';");
|
eval("\$" . $yes_no_switches[$i] . "_no = ( \$new_attach['" . $yes_no_switches[$i] . "'] == '0' ) ? 'checked=\"checked\"' : '';");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('ftp_connect'))
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_no_ftp', array());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_ftp', array());
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_MANAGE' => true,
|
'TPL_ATTACH_MANAGE' => true,
|
||||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=manage',
|
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=manage',
|
||||||
|
@ -416,19 +308,10 @@ if ($mode == 'manage')
|
||||||
'MAX_FILESIZE_PM' => $new_attach['max_filesize_pm'],
|
'MAX_FILESIZE_PM' => $new_attach['max_filesize_pm'],
|
||||||
'MAX_ATTACHMENTS' => $new_attach['max_attachments'],
|
'MAX_ATTACHMENTS' => $new_attach['max_attachments'],
|
||||||
'MAX_ATTACHMENTS_PM' => $new_attach['max_attachments_pm'],
|
'MAX_ATTACHMENTS_PM' => $new_attach['max_attachments_pm'],
|
||||||
'FTP_SERVER' => $new_attach['ftp_server'],
|
|
||||||
'FTP_PATH' => $new_attach['ftp_path'],
|
|
||||||
'FTP_USER' => $new_attach['ftp_user'],
|
|
||||||
'FTP_PASS' => $new_attach['ftp_pass'],
|
|
||||||
'DOWNLOAD_PATH' => $new_attach['download_path'],
|
|
||||||
'DISABLE_MOD_YES' => $disable_mod_yes,
|
'DISABLE_MOD_YES' => $disable_mod_yes,
|
||||||
'DISABLE_MOD_NO' => $disable_mod_no,
|
'DISABLE_MOD_NO' => $disable_mod_no,
|
||||||
'PM_ATTACH_YES' => $allow_pm_attach_yes,
|
'PM_ATTACH_YES' => $allow_pm_attach_yes,
|
||||||
'PM_ATTACH_NO' => $allow_pm_attach_no,
|
'PM_ATTACH_NO' => $allow_pm_attach_no,
|
||||||
'FTP_UPLOAD_YES' => $allow_ftp_upload_yes,
|
|
||||||
'FTP_UPLOAD_NO' => $allow_ftp_upload_no,
|
|
||||||
'FTP_PASV_MODE_YES' => $ftp_pasv_mode_yes,
|
|
||||||
'FTP_PASV_MODE_NO' => $ftp_pasv_mode_no,
|
|
||||||
'DISPLAY_ORDER_ASC' => $display_order_yes,
|
'DISPLAY_ORDER_ASC' => $display_order_yes,
|
||||||
'DISPLAY_ORDER_DESC' => $display_order_no,
|
'DISPLAY_ORDER_DESC' => $display_order_no,
|
||||||
));
|
));
|
||||||
|
@ -438,28 +321,21 @@ if ($submit && $mode == 'cats')
|
||||||
{
|
{
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $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>'));
|
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')
|
if ($mode == 'cats')
|
||||||
{
|
{
|
||||||
$s_assigned_group_images = $lang['NONE'];
|
$s_assigned_group_images = $lang['NONE'];
|
||||||
$s_assigned_group_streams = $lang['NONE'];
|
|
||||||
$s_assigned_group_flash = $lang['NONE'];
|
|
||||||
|
|
||||||
$sql = 'SELECT group_name, cat_id
|
$sql = 'SELECT group_name, cat_id FROM ' . BB_EXTENSION_GROUPS . ' WHERE cat_id > 0 ORDER BY cat_id';
|
||||||
FROM ' . BB_EXTENSION_GROUPS . '
|
|
||||||
WHERE cat_id > 0
|
|
||||||
ORDER BY cat_id';
|
|
||||||
|
|
||||||
$s_assigned_group_images = array();
|
$s_assigned_group_images = array();
|
||||||
$s_assigned_group_streams = array();
|
|
||||||
$s_assigned_group_flash = array();
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Group Names from ' . BB_EXTENSION_GROUPS, '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get group names from ' . BB_EXTENSION_GROUPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -471,14 +347,6 @@ if ($mode == 'cats')
|
||||||
{
|
{
|
||||||
$s_assigned_group_images[] = $row[$i]['group_name'];
|
$s_assigned_group_images[] = $row[$i]['group_name'];
|
||||||
}
|
}
|
||||||
else if ($row[$i]['cat_id'] == STREAM_CAT)
|
|
||||||
{
|
|
||||||
$s_assigned_group_streams[] = $row[$i]['group_name'];
|
|
||||||
}
|
|
||||||
else if ($row[$i]['cat_id'] == SWF_CAT)
|
|
||||||
{
|
|
||||||
$s_assigned_group_flash[] = $row[$i]['group_name'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$display_inlined_yes = ( $new_attach['img_display_inlined'] != '0' ) ? 'checked="checked"' : '';
|
$display_inlined_yes = ( $new_attach['img_display_inlined'] != '0' ) ? 'checked="checked"' : '';
|
||||||
|
@ -515,8 +383,8 @@ if ($mode == 'cats')
|
||||||
'USE_GD2_YES' => $use_gd2_yes,
|
'USE_GD2_YES' => $use_gd2_yes,
|
||||||
'USE_GD2_NO' => $use_gd2_no,
|
'USE_GD2_NO' => $use_gd2_no,
|
||||||
'S_ASSIGNED_GROUP_IMAGES' => implode(', ', $s_assigned_group_images),
|
'S_ASSIGNED_GROUP_IMAGES' => implode(', ', $s_assigned_group_images),
|
||||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=cats')
|
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=cats',
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Cat Settings
|
// Check Cat Settings
|
||||||
|
@ -525,12 +393,11 @@ if ($check_image_cat)
|
||||||
// Some tests...
|
// Some tests...
|
||||||
$attach_config = array();
|
$attach_config = array();
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||||
FROM ' . BB_ATTACH_CONFIG;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not find Attachment Config Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not find attachment config table #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -555,9 +422,7 @@ if ($check_image_cat)
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
|
// Does the target directory exist, is it a directory and writeable
|
||||||
if (intval($attach_config['allow_ftp_upload']) == 0 && intval($attach_config['img_create_thumbnail']) == 1)
|
|
||||||
{
|
|
||||||
if ( !@file_exists(@amod_realpath($upload_dir)) )
|
if ( !@file_exists(@amod_realpath($upload_dir)) )
|
||||||
{
|
{
|
||||||
@mkdir($upload_dir, 0755);
|
@mkdir($upload_dir, 0755);
|
||||||
|
@ -568,7 +433,6 @@ if ($check_image_cat)
|
||||||
$error = TRUE;
|
$error = TRUE;
|
||||||
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />';
|
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !is_dir($upload_dir))
|
if (!$error && !is_dir($upload_dir))
|
||||||
|
@ -590,92 +454,10 @@ if ($check_image_cat)
|
||||||
@unlink($upload_dir . '/0_000000.000');
|
@unlink($upload_dir . '/0_000000.000');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (intval($attach_config['allow_ftp_upload']) && intval($attach_config['img_create_thumbnail']))
|
|
||||||
{
|
|
||||||
// Check FTP Settings
|
|
||||||
$server = ( empty($attach_config['ftp_server']) ) ? 'localhost' : $attach_config['ftp_server'];
|
|
||||||
|
|
||||||
$conn_id = @ftp_connect($server);
|
|
||||||
|
|
||||||
if (!$conn_id)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_CONNECT'], $server) . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
$login_result = @ftp_login($conn_id, $attach_config['ftp_user'], $attach_config['ftp_pass']);
|
|
||||||
|
|
||||||
if (!$login_result && !$error)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_LOGIN'], $attach_config['ftp_user']) . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = $lang['FTP_ERROR_PASV_MODE'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Check Upload
|
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>'));
|
||||||
$tmpfname = @tempnam('/tmp', 't0000');
|
|
||||||
|
|
||||||
@unlink($tmpfname); // unlink for safety on php4.0.3+
|
|
||||||
|
|
||||||
$fp = @fopen($tmpfname, 'w');
|
|
||||||
|
|
||||||
@fwrite($fp, 'test');
|
|
||||||
|
|
||||||
@fclose($fp);
|
|
||||||
|
|
||||||
$result = @ftp_chdir($conn_id, $attach_config['ftp_path'] . '/' . THUMB_DIR);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
@ftp_mkdir($conn_id, $attach_config['ftp_path'] . '/' . THUMB_DIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = @ftp_chdir($conn_id, $attach_config['ftp_path'] . '/' . THUMB_DIR);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_PATH'], $attach_config['ftp_path'] . '/' . THUMB_DIR) . '<br />';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$res = @ftp_put($conn_id, 't0000', $tmpfname, FTP_ASCII);
|
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_UPLOAD'], $attach_config['ftp_path'] . '/' . THUMB_DIR) . '<br />';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$res = @ftp_delete($conn_id, 't0000');
|
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
$error = TRUE;
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_DELETE'], $attach_config['ftp_path'] . '/' . THUMB_DIR) . '<br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
@unlink($tmpfname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $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>'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +482,7 @@ if ($submit && $mode == 'quota')
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update Quota Limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update quota limits');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,23 +493,19 @@ if ($submit && $mode == 'quota')
|
||||||
|
|
||||||
if ($quota_id_sql != '')
|
if ($quota_id_sql != '')
|
||||||
{
|
{
|
||||||
$sql = 'DELETE
|
$sql = 'DELETE FROM ' . BB_QUOTA_LIMITS . ' WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
||||||
FROM ' . BB_QUOTA_LIMITS . '
|
|
||||||
WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete Quota Limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete quota limits');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Quotas linked to this setting
|
// Delete Quotas linked to this setting
|
||||||
$sql = 'DELETE
|
$sql = 'DELETE FROM ' . BB_QUOTA . ' WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
||||||
FROM ' . BB_QUOTA . '
|
|
||||||
WHERE quota_limit_id IN (' . $quota_id_sql . ')';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete Quotas', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete quotas');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,12 +518,11 @@ if ($submit && $mode == 'quota')
|
||||||
if ($quota_desc != '' && $add)
|
if ($quota_desc != '' && $add)
|
||||||
{
|
{
|
||||||
// check Quota Description
|
// check Quota Description
|
||||||
$sql = 'SELECT quota_desc
|
$sql = 'SELECT quota_desc FROM ' . BB_QUOTA_LIMITS;
|
||||||
FROM ' . BB_QUOTA_LIMITS;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Quota Limits Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query quota limits table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -777,7 +554,7 @@ if ($submit && $mode == 'quota')
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not add Quota Limit', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not add quota limit');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,9 +562,7 @@ if ($submit && $mode == 'quota')
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$message = $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>');
|
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>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -810,14 +585,14 @@ if ($mode == 'quota')
|
||||||
'TPL_ATTACH_QUOTA' => true,
|
'TPL_ATTACH_QUOTA' => true,
|
||||||
'MAX_FILESIZE' => $max_add_filesize,
|
'MAX_FILESIZE' => $max_add_filesize,
|
||||||
'S_FILESIZE' => size_select('add_size_select', $size),
|
'S_FILESIZE' => size_select('add_size_select', $size),
|
||||||
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=quota')
|
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=quota',
|
||||||
);
|
));
|
||||||
|
|
||||||
$sql = "SELECT * FROM " . BB_QUOTA_LIMITS . " ORDER BY quota_limit DESC";
|
$sql = "SELECT * FROM " . BB_QUOTA_LIMITS . " ORDER BY quota_limit DESC";
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get quota limits #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -841,8 +616,8 @@ if ($mode == 'quota')
|
||||||
'QUOTA_ID' => $rows[$i]['quota_limit_id'],
|
'QUOTA_ID' => $rows[$i]['quota_limit_id'],
|
||||||
'S_FILESIZE' => size_select('size_select_list[]', $size_format),
|
'S_FILESIZE' => size_select('size_select_list[]', $size_format),
|
||||||
'U_VIEW' => "admin_attachments.php?mode=$mode&e_mode=view_quota&quota_id=" . $rows[$i]['quota_limit_id'],
|
'U_VIEW' => "admin_attachments.php?mode=$mode&e_mode=view_quota&quota_id=" . $rows[$i]['quota_limit_id'],
|
||||||
'MAX_FILESIZE' => $rows[$i]['quota_limit'])
|
'MAX_FILESIZE' => $rows[$i]['quota_limit'],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +627,7 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
|
|
||||||
if (!$quota_id)
|
if (!$quota_id)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, 'Invalid Call');
|
bb_die('Invalid call');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('switch_quota_limit_desc', array());
|
$template->assign_block_vars('switch_quota_limit_desc', array());
|
||||||
|
@ -861,7 +636,7 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get quota limits #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -879,7 +654,7 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get quota limits #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -892,15 +667,15 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('users_upload_row', array(
|
$template->assign_block_vars('users_upload_row', array(
|
||||||
'USER_ID' => $rows[$i]['user_id'],
|
'USER_ID' => $rows[$i]['user_id'],
|
||||||
'USERNAME' => $rows[$i]['username'])
|
'USERNAME' => $rows[$i]['username'],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
|
else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('users_pm_row', array(
|
$template->assign_block_vars('users_pm_row', array(
|
||||||
'USER_ID' => $rows[$i]['user_id'],
|
'USER_ID' => $rows[$i]['user_id'],
|
||||||
'USERNAME' => $rows[$i]['username'])
|
'USERNAME' => $rows[$i]['username'],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,7 +687,7 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get quota limits #4');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -925,15 +700,15 @@ if ($mode == 'quota' && $e_mode == 'view_quota')
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('groups_upload_row', array(
|
$template->assign_block_vars('groups_upload_row', array(
|
||||||
'GROUP_ID' => $rows[$i]['group_id'],
|
'GROUP_ID' => $rows[$i]['group_id'],
|
||||||
'GROUPNAME' => $rows[$i]['group_name'])
|
'GROUPNAME' => $rows[$i]['group_name'],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
|
else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('groups_pm_row', array(
|
$template->assign_block_vars('groups_pm_row', array(
|
||||||
'GROUP_ID' => $rows[$i]['group_id'],
|
'GROUP_ID' => $rows[$i]['group_id'],
|
||||||
'GROUPNAME' => $rows[$i]['group_name'])
|
'GROUPNAME' => $rows[$i]['group_name'],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ $return_links = array(
|
||||||
$sql = "SELECT * FROM " . BB_CONFIG;
|
$sql = "SELECT * FROM " . BB_CONFIG;
|
||||||
if(!$result = DB()->sql_query($sql))
|
if(!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query config information in admin_board');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -49,14 +49,7 @@ else
|
||||||
|
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
if ($mode == 'config')
|
bb_die($lang['CONFIG_UPDATED'] . $return_links[$mode] . $return_links['index']);
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['CONFIG_UPDATED'] . $return_links['config'] . $return_links['index']);
|
|
||||||
}
|
|
||||||
elseif ($mode == 'config_mods')
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['CONFIG_UPDATED'] . $return_links['config_mods'] . $return_links['index']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,7 @@ if ($submit && $confirm)
|
||||||
|
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
|
|
||||||
$message = $lang['CONFIG_UPD'] .'<br /><br />'. sprintf($lang['RETURN_CONFIG'], '<a href="admin_bt_forum_cfg.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['CONFIG_UPD'] .'<br /><br />'. sprintf($lang['RETURN_CONFIG'], '<a href="admin_bt_forum_cfg.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set template vars
|
// Set template vars
|
||||||
|
@ -103,7 +102,7 @@ $sql = "SELECT f.*
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain forum names', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain forum names');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowset = DB()->sql_fetchrowset($result);
|
$rowset = DB()->sql_fetchrowset($result);
|
||||||
|
|
|
@ -20,7 +20,7 @@ $confirmed = isset($_POST['confirm']);
|
||||||
// All config names with default values
|
// All config names with default values
|
||||||
$default_cfg_str = array(
|
$default_cfg_str = array(
|
||||||
'off_reason' => 'Tracker is disabled',
|
'off_reason' => 'Tracker is disabled',
|
||||||
'browser_redirect_url' => 'http://yourdomain.com/',
|
'browser_redirect_url' => 'http://demo.torrentpier.me/',
|
||||||
);
|
);
|
||||||
|
|
||||||
$default_cfg_bool = array(
|
$default_cfg_bool = array(
|
||||||
|
@ -60,7 +60,7 @@ $template->assign_vars(array(
|
||||||
'DISABLE_SUBMIT' => true,
|
'DISABLE_SUBMIT' => true,
|
||||||
|
|
||||||
'S_HIDDEN_FIELDS' => '',
|
'S_HIDDEN_FIELDS' => '',
|
||||||
'S_CONFIG_ACTION' => "admin_bt_tracker_cfg.php",
|
'S_CONFIG_ACTION' => 'admin_bt_tracker_cfg.php',
|
||||||
));
|
));
|
||||||
|
|
||||||
print_page('admin_bt_tracker_cfg.tpl', 'admin');
|
print_page('admin_bt_tracker_cfg.tpl', 'admin');
|
|
@ -188,8 +188,7 @@ switch($mode)
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
delete_jobs($job_id);
|
delete_jobs($job_id);
|
||||||
$message = $lang['JOB_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_JOBS'], '<a href="admin_cron.php?mode=list">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['JOB_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_JOBS'], '<a href="admin_cron.php?mode=list">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,14 +220,13 @@ if ($submit)
|
||||||
{
|
{
|
||||||
insert_cron_job($_POST);
|
insert_cron_job($_POST);
|
||||||
}
|
}
|
||||||
else bb_die();
|
else bb_die('Mode error');
|
||||||
|
|
||||||
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = validate_cron_post($_POST);
|
bb_die(validate_cron_post($_POST));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ if( isset($_POST['add_name']) )
|
||||||
|
|
||||||
if ($disallowed_user == '')
|
if ($disallowed_user == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['FIELDS_EMPTY']);
|
bb_die($lang['FIELDS_EMPTY']);
|
||||||
}
|
}
|
||||||
if( !validate_username($disallowed_user) )
|
if( !validate_username($disallowed_user) )
|
||||||
{
|
{
|
||||||
|
@ -27,19 +27,18 @@ if( isset($_POST['add_name']) )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO " . BB_DISALLOW . " (disallow_username)
|
$sql = "INSERT INTO " . BB_DISALLOW . " (disallow_username) VALUES('" . DB()->escape($disallowed_user) . "')";
|
||||||
VALUES('" . DB()->escape($disallowed_user) . "')";
|
|
||||||
$result = DB()->sql_query( $sql );
|
$result = DB()->sql_query( $sql );
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not add disallowed user.", '',__LINE__, __FILE__, $sql);
|
bb_die('Could not add disallowed user');
|
||||||
}
|
}
|
||||||
$message = $lang['DISALLOW_SUCCESSFUL'];
|
$message = $lang['DISALLOW_SUCCESSFUL'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= '<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') . '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= '<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') . '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
}
|
}
|
||||||
elseif (isset($_POST['delete_name']))
|
elseif (isset($_POST['delete_name']))
|
||||||
{
|
{
|
||||||
|
@ -49,12 +48,12 @@ elseif (isset($_POST['delete_name']))
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't removed disallowed user.", '',__LINE__, __FILE__, $sql);
|
bb_die('Could not removed disallowed user');
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= $lang['DISALLOWED_DELETED'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= $lang['DISALLOWED_DELETED'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') .'<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ $sql = "SELECT * FROM " . BB_DISALLOW;
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get disallowed users.", '', __LINE__, __FILE__, $sql );
|
bb_die('Could not get disallowed users');
|
||||||
}
|
}
|
||||||
|
|
||||||
$disallowed = DB()->sql_fetchrowset($result);
|
$disallowed = DB()->sql_fetchrowset($result);
|
||||||
|
@ -92,7 +91,7 @@ $disallow_select .= '</select>';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISALLOW_SELECT' => $disallow_select,
|
'S_DISALLOW_SELECT' => $disallow_select,
|
||||||
'S_FORM_ACTION' => "admin_disallow.php",
|
'S_FORM_ACTION' => 'admin_disallow.php',
|
||||||
));
|
));
|
||||||
|
|
||||||
print_page('admin_disallow.tpl', 'admin');
|
print_page('admin_disallow.tpl', 'admin');
|
|
@ -17,8 +17,6 @@ register_shutdown_function('update_attach_extensions');
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
// ACP Header - END
|
// ACP Header - END
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
|
||||||
{
|
{
|
||||||
$upload_dir = $attach_config['upload_dir'];
|
$upload_dir = $attach_config['upload_dir'];
|
||||||
|
@ -27,11 +25,6 @@ if (!intval($attach_config['allow_ftp_upload']))
|
||||||
{
|
{
|
||||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['download_path'];
|
|
||||||
}
|
|
||||||
|
|
||||||
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
||||||
|
|
||||||
|
@ -46,8 +39,8 @@ if (!isset($lang['TEST_SETTINGS_SUCCESSFUL']))
|
||||||
$types_download = array(INLINE_LINK, PHYSICAL_LINK);
|
$types_download = array(INLINE_LINK, PHYSICAL_LINK);
|
||||||
$modes_download = array('inline', 'physical');
|
$modes_download = array('inline', 'physical');
|
||||||
|
|
||||||
$types_category = array(IMAGE_CAT, STREAM_CAT, SWF_CAT);
|
$types_category = array(IMAGE_CAT);
|
||||||
$modes_category = array($lang['CATEGORY_IMAGES'], $lang['CATEGORY_STREAM_FILES'], $lang['CATEGORY_SWF_FILES']);
|
$modes_category = array($lang['CATEGORY_IMAGES']);
|
||||||
|
|
||||||
$size = get_var('size', '');
|
$size = get_var('size', '');
|
||||||
$mode = get_var('mode', '');
|
$mode = get_var('mode', '');
|
||||||
|
@ -62,7 +55,7 @@ $sql = 'SELECT * FROM '. BB_ATTACH_CONFIG;
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query attachment information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachment information');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -91,7 +84,7 @@ if ($submit && $mode == 'extensions')
|
||||||
$sql = 'SELECT * FROM ' . BB_EXTENSIONS . ' ORDER BY ext_id';
|
$sql = 'SELECT * FROM ' . BB_EXTENSIONS . ' ORDER BY ext_id';
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t get Extension Informations.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get extension informations #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
|
@ -114,7 +107,7 @@ if ($submit && $mode == 'extensions')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update Extension Informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update extension informations');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,13 +120,11 @@ if ($submit && $mode == 'extensions')
|
||||||
|
|
||||||
if ($extension_id_sql != '')
|
if ($extension_id_sql != '')
|
||||||
{
|
{
|
||||||
$sql = 'DELETE
|
$sql = 'DELETE FROM ' . BB_EXTENSIONS . ' WHERE ext_id IN (' . $extension_id_sql . ')';
|
||||||
FROM ' . BB_EXTENSIONS . '
|
|
||||||
WHERE ext_id IN (' . $extension_id_sql . ')';
|
|
||||||
|
|
||||||
if( !$result = DB()->sql_query($sql) )
|
if( !$result = DB()->sql_query($sql) )
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete Extensions', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete extensions');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,18 +138,17 @@ if ($submit && $mode == 'extensions')
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'ADD_EXTENSION' => $extension,
|
'ADD_EXTENSION' => $extension,
|
||||||
'ADD_EXTENSION_EXPLAIN' => $extension_explain)
|
'ADD_EXTENSION_EXPLAIN' => $extension_explain,
|
||||||
);
|
));
|
||||||
|
|
||||||
if (!@$error)
|
if (!@$error)
|
||||||
{
|
{
|
||||||
// check extension
|
// check extension
|
||||||
$sql = 'SELECT extension
|
$sql = 'SELECT extension FROM ' . BB_EXTENSIONS;
|
||||||
FROM ' . BB_EXTENSIONS;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Extensions', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query extensions');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -193,7 +183,7 @@ if ($submit && $mode == 'extensions')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not add Extension', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not add extension');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -202,9 +192,7 @@ if ($submit && $mode == 'extensions')
|
||||||
|
|
||||||
if (!@$error)
|
if (!@$error)
|
||||||
{
|
{
|
||||||
$message = $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>');
|
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>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,9 +201,9 @@ if ($mode == 'extensions')
|
||||||
// Extensions
|
// Extensions
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ATTACH_EXTENSIONS' => true,
|
'TPL_ATTACH_EXTENSIONS' => true,
|
||||||
'S_CANCEL_ACTION' => "admin_extensions.php?mode=extensions",
|
'S_CANCEL_ACTION' => 'admin_extensions.php?mode=extensions',
|
||||||
'S_ATTACH_ACTION' => "admin_extensions.php?mode=extensions")
|
'S_ATTACH_ACTION' => 'admin_extensions.php?mode=extensions',
|
||||||
);
|
));
|
||||||
|
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
|
@ -230,13 +218,11 @@ if ($mode == 'extensions')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_EXTENSIONS . ' ORDER BY group_id';
|
||||||
FROM ' . BB_EXTENSIONS . '
|
|
||||||
ORDER BY group_id';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t get Extension informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get extension informations #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension_row = DB()->sql_fetchrowset($result);
|
$extension_row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -318,7 +304,7 @@ if ($submit && $mode == 'groups')
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update Extension Groups Informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update extension groups informations');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +321,7 @@ if ($submit && $mode == 'groups')
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete Extension Groups', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete extension groups');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set corresponding Extensions to a pending Group
|
// Set corresponding Extensions to a pending Group
|
||||||
|
@ -345,7 +331,7 @@ if ($submit && $mode == 'groups')
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not assign Extensions to Pending Group.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not assign extensions to pending group');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,12 +349,11 @@ if ($submit && $mode == 'groups')
|
||||||
if ($extension_group != '' && $add)
|
if ($extension_group != '' && $add)
|
||||||
{
|
{
|
||||||
// check Extension Group
|
// check Extension Group
|
||||||
$sql = 'SELECT group_name
|
$sql = 'SELECT group_name FROM ' . BB_EXTENSION_GROUPS;
|
||||||
FROM ' . BB_EXTENSION_GROUPS;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Extension Groups Table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query extension groups table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrowset($result);
|
$row = DB()->sql_fetchrowset($result);
|
||||||
|
@ -409,7 +394,7 @@ if ($submit && $mode == 'groups')
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not add Extension Group', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not add extension group');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,9 +402,7 @@ if ($submit && $mode == 'groups')
|
||||||
|
|
||||||
if (!@$error)
|
if (!@$error)
|
||||||
{
|
{
|
||||||
$message = $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>');
|
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>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,12 +438,11 @@ if ($mode == 'groups')
|
||||||
'S_ATTACH_ACTION' => "admin_extensions.php?mode=groups")
|
'S_ATTACH_ACTION' => "admin_extensions.php?mode=groups")
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_EXTENSION_GROUPS;
|
||||||
FROM ' . BB_EXTENSION_GROUPS;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t get Extension Group informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get extension group informations');
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension_group = DB()->sql_fetchrowset($result);
|
$extension_group = DB()->sql_fetchrowset($result);
|
||||||
|
@ -506,13 +488,11 @@ if ($mode == 'groups')
|
||||||
|
|
||||||
if ($viewgroup && $viewgroup == $extension_group[$i]['group_id'])
|
if ($viewgroup && $viewgroup == $extension_group[$i]['group_id'])
|
||||||
{
|
{
|
||||||
$sql = 'SELECT comment, extension
|
$sql = 'SELECT comment, extension FROM ' . BB_EXTENSIONS . ' WHERE group_id = ' . (int) $viewgroup;
|
||||||
FROM ' . BB_EXTENSIONS . '
|
|
||||||
WHERE group_id = ' . (int) $viewgroup;
|
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t get Extension informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get extension informations #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = DB()->sql_fetchrowset($result);
|
$extension = DB()->sql_fetchrowset($result);
|
||||||
|
@ -551,7 +531,7 @@ if (@$add_forum && $e_mode == 'perm' && $group)
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($add_forums_list); $i++)
|
for ($i = 0; $i < sizeof($add_forums_list); $i++)
|
||||||
{
|
{
|
||||||
if ($add_forums_list[$i] == GPERM_ALL)
|
if ($add_forums_list[$i] == 0)
|
||||||
{
|
{
|
||||||
$add_all_forums = TRUE;
|
$add_all_forums = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +543,7 @@ if (@$add_forum && $e_mode == 'perm' && $group)
|
||||||
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '' WHERE group_id = " . (int) $group;
|
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '' WHERE group_id = " . (int) $group;
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update Permissions', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update permissions #1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +557,7 @@ if (@$add_forum && $e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Group Permissions from ' . BB_EXTENSION_GROUPS, '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get group permissions from ' . BB_EXTENSION_GROUPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -607,7 +587,7 @@ if (@$add_forum && $e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update Permissions', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update permissions #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +606,7 @@ if (@$delete_forum && $e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Group Permissions from ' . BB_EXTENSION_GROUPS, '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get group permissions from ' . BB_EXTENSION_GROUPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -650,7 +630,7 @@ if (@$delete_forum && $e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update Permissions', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update permissions #3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,7 +644,7 @@ if ($e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Group Name from ' . BB_EXTENSION_GROUPS, '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get group name from ' . BB_EXTENSION_GROUPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -688,7 +668,7 @@ if ($e_mode == 'perm' && $group)
|
||||||
$sql = "SELECT forum_id, forum_name FROM " . BB_FORUMS . " WHERE forum_id IN (" . implode(', ', $forum_p) . ")";
|
$sql = "SELECT forum_id, forum_name FROM " . BB_FORUMS . " WHERE forum_id IN (" . implode(', ', $forum_p) . ")";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Forum Names', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get forum names');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -713,13 +693,13 @@ if ($e_mode == 'perm' && $group)
|
||||||
'A_PERM_ACTION' => "admin_extensions.php?mode=groups&e_mode=perm&e_group=$group")
|
'A_PERM_ACTION' => "admin_extensions.php?mode=groups&e_mode=perm&e_group=$group")
|
||||||
);
|
);
|
||||||
|
|
||||||
$forum_option_values = array(GPERM_ALL => $lang['PERM_ALL_FORUMS']);
|
$forum_option_values = array(0 => $lang['PERM_ALL_FORUMS']);
|
||||||
|
|
||||||
$sql = "SELECT forum_id, forum_name FROM " . BB_FORUMS;
|
$sql = "SELECT forum_id, forum_name FROM " . BB_FORUMS;
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Forums', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get forums #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -742,7 +722,7 @@ if ($e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($f_result = DB()->sql_query($sql)))
|
if (!($f_result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Forums.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get forums #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($f_result))
|
while ($row = DB()->sql_fetchrow($f_result))
|
||||||
|
@ -756,7 +736,7 @@ if ($e_mode == 'perm' && $group)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Extension Groups.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query extension groups');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
|
|
@ -14,20 +14,15 @@ $all_forums = -1;
|
||||||
$pruned_total = 0;
|
$pruned_total = 0;
|
||||||
$prune_performed = false;
|
$prune_performed = false;
|
||||||
|
|
||||||
function return_msg_prune ($status_msg)
|
|
||||||
{
|
|
||||||
return $status_msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_REQUEST['submit']))
|
if (isset($_REQUEST['submit']))
|
||||||
{
|
{
|
||||||
if (!$var =& $_REQUEST['f'] OR !$f_selected = get_id_ary($var))
|
if (!$var =& $_REQUEST['f'] OR !$f_selected = get_id_ary($var))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, return_msg_prune('Forum not selected'));
|
bb_die('Forum not selected');
|
||||||
}
|
}
|
||||||
if (!$var =& $_REQUEST['prunedays'] OR !$prunedays = abs(intval($var)))
|
if (!$var =& $_REQUEST['prunedays'] OR !$prunedays = abs(intval($var)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, return_msg_prune($lang['NOT_DAYS']));
|
bb_die($lang['NOT_DAYS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$prunetime = TIMENOW - 86400*$prunedays;
|
$prunetime = TIMENOW - 86400*$prunedays;
|
||||||
|
@ -51,11 +46,11 @@ if (isset($_REQUEST['submit']))
|
||||||
}
|
}
|
||||||
if (!$prune_performed)
|
if (!$prune_performed)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, return_msg_prune($lang['NONE_SELECTED']));
|
bb_die($lang['NONE_SELECTED']);
|
||||||
}
|
}
|
||||||
if (!$pruned_total)
|
if (!$pruned_total)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, return_msg_prune($lang['NO_SEARCH_MATCH']));
|
bb_die($lang['NO_SEARCH_MATCH']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ if( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update auth table');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +130,7 @@ if( isset($_POST['submit']) )
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
$message = $lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="'."admin_forumauth.php".'">', "</a>");
|
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="'."admin_forumauth.php".'">', "</a>"));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
} // End of submit
|
} // End of submit
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ if( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update auth table #1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ if( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update auth table #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +171,7 @@ if( isset($_POST['submit']) )
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
$message = $lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', "</a>");
|
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', "</a>"));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
} // End of submit
|
} // End of submit
|
||||||
|
|
||||||
|
@ -188,7 +187,7 @@ $sql = "SELECT f.*
|
||||||
ORDER BY c.cat_order ASC, f.forum_order ASC";
|
ORDER BY c.cat_order ASC, f.forum_order ASC";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain forum list');
|
||||||
}
|
}
|
||||||
|
|
||||||
$forum_rows = DB()->sql_fetchrowset($result);
|
$forum_rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -208,8 +207,8 @@ if( empty($forum_id) && empty($cat_id) )
|
||||||
for ($i = 0; $i<count($forum_auth_fields); $i++)
|
for ($i = 0; $i<count($forum_auth_fields); $i++)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('forum_auth_titles', array(
|
$template->assign_block_vars('forum_auth_titles', array(
|
||||||
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]])
|
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the category list
|
// Obtain the category list
|
||||||
|
@ -218,7 +217,7 @@ if( empty($forum_id) && empty($cat_id) )
|
||||||
ORDER BY c.cat_order";
|
ORDER BY c.cat_order";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query categories list #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$category_rows = DB()->sql_fetchrowset($result);
|
$category_rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -277,8 +276,8 @@ else
|
||||||
for ($i = 0; $i<count($forum_auth_fields); $i++)
|
for ($i = 0; $i<count($forum_auth_fields); $i++)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('forum_auth_titles', array(
|
$template->assign_block_vars('forum_auth_titles', array(
|
||||||
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]])
|
'CELL_TITLE' => $field_names[$forum_auth_fields[$i]],
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// obtain the category list
|
// obtain the category list
|
||||||
|
@ -288,7 +287,7 @@ else
|
||||||
ORDER BY c.cat_order";
|
ORDER BY c.cat_order";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query categories list #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$category_rows = DB()->sql_fetchrowset($result);
|
$category_rows = DB()->sql_fetchrowset($result);
|
||||||
|
|
|
@ -192,14 +192,14 @@ if ($mode)
|
||||||
|
|
||||||
if (!$forum_name)
|
if (!$forum_name)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Can't create a forum without a name");
|
bb_die('Can not create a forum without a name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forum_parent)
|
if ($forum_parent)
|
||||||
{
|
{
|
||||||
if (!$parent = get_forum_data($forum_parent))
|
if (!$parent = get_forum_data($forum_parent))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Parent forum with <b>id=$forum_parent</b> not found");
|
bb_die('Parent forum with id <b>'. $forum_parent .'</b> not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cat_id = $parent['cat_id'];
|
$cat_id = $parent['cat_id'];
|
||||||
|
@ -233,8 +233,7 @@ if ($mode)
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
CACHE('bb_cache')->rm();
|
CACHE('bb_cache')->rm();
|
||||||
|
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c='. $cat_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c='. $cat_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -265,14 +264,14 @@ if ($mode)
|
||||||
|
|
||||||
if (!$forum_name)
|
if (!$forum_name)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Can't modify a forum without a name");
|
bb_die('Can not modify a forum without a name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forum_parent)
|
if ($forum_parent)
|
||||||
{
|
{
|
||||||
if (!$parent = get_forum_data($forum_parent))
|
if (!$parent = get_forum_data($forum_parent))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Parent forum with <b>id=$forum_parent</b> not found");
|
bb_die('Parent forum with id <b>'. $forum_parent .'</b> not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cat_id = $parent['cat_id'];
|
$cat_id = $parent['cat_id'];
|
||||||
|
@ -281,7 +280,7 @@ if ($mode)
|
||||||
|
|
||||||
if ($forum_id == $forum_parent)
|
if ($forum_id == $forum_parent)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Ambiguous forum ID's. Please select other parent forum", '', __LINE__, __FILE__);
|
bb_die('Ambiguous forum ID. Please select other parent forum');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($cat_id != $old_cat_id)
|
else if ($cat_id != $old_cat_id)
|
||||||
|
@ -333,7 +332,7 @@ if ($mode)
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />';
|
$message = $lang['FORUMS_UPDATED'] . '<br /><br />';
|
||||||
$message .= ($fix) ? "$fix<br /><br />" : '';
|
$message .= ($fix) ? "$fix<br /><br />" : '';
|
||||||
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c='. $cat_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c='. $cat_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -360,8 +359,7 @@ if ($mode)
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
CACHE('bb_cache')->rm();
|
CACHE('bb_cache')->rm();
|
||||||
|
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -417,8 +415,7 @@ if ($mode)
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
CACHE('bb_cache')->rm();
|
CACHE('bb_cache')->rm();
|
||||||
|
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -473,7 +470,7 @@ if ($mode)
|
||||||
|
|
||||||
if (DB()->num_rows($result) != 2)
|
if (DB()->num_rows($result) != 2)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
|
bb_die('Ambiguous forum ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
DB()->query("UPDATE ". BB_TOPICS ." SET forum_id = $to_id WHERE forum_id = $from_id");
|
DB()->query("UPDATE ". BB_TOPICS ." SET forum_id = $to_id WHERE forum_id = $from_id");
|
||||||
|
@ -510,15 +507,12 @@ if ($mode)
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
CACHE('bb_cache')->rm();
|
CACHE('bb_cache')->rm();
|
||||||
|
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'deletecat':
|
case 'deletecat':
|
||||||
//
|
|
||||||
// Show form to delete a category
|
// Show form to delete a category
|
||||||
//
|
|
||||||
$cat_id = (int) $_GET['c'];
|
$cat_id = (int) $_GET['c'];
|
||||||
$catinfo = get_info('category', $cat_id);
|
$catinfo = get_info('category', $cat_id);
|
||||||
$categories_count = $catinfo['number'];
|
$categories_count = $catinfo['number'];
|
||||||
|
@ -529,7 +523,7 @@ if ($mode)
|
||||||
|
|
||||||
if ($row['forums_count'] > 0)
|
if ($row['forums_count'] > 0)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['MUST_DELETE_FORUMS']);
|
bb_die($lang['MUST_DELETE_FORUMS']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -558,9 +552,7 @@ if ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'movedelcat':
|
case 'movedelcat':
|
||||||
//
|
|
||||||
// Move or delete a category in the DB
|
// Move or delete a category in the DB
|
||||||
//
|
|
||||||
$from_id = (int) $_POST['from_id'];
|
$from_id = (int) $_POST['from_id'];
|
||||||
$to_id = (int) $_POST['to_id'];
|
$to_id = (int) $_POST['to_id'];
|
||||||
|
|
||||||
|
@ -589,14 +581,12 @@ if ($mode)
|
||||||
$message = $lang['FORUMS_UPDATED'] . '<br /><br />';
|
$message = $lang['FORUMS_UPDATED'] . '<br /><br />';
|
||||||
$message .= ($fix) ? "$fix<br /><br />" : '';
|
$message .= ($fix) ? "$fix<br /><br />" : '';
|
||||||
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'forum_order':
|
case 'forum_order':
|
||||||
//
|
|
||||||
// Change order of forums
|
// Change order of forums
|
||||||
//
|
|
||||||
$move = intval($_GET['move']);
|
$move = intval($_GET['move']);
|
||||||
$forum_id = intval($_GET[POST_FORUM_URL]);
|
$forum_id = intval($_GET[POST_FORUM_URL]);
|
||||||
|
|
||||||
|
@ -706,7 +696,7 @@ if ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_MODE']);
|
bb_die($lang['NO_MODE']);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -717,16 +707,14 @@ if (!$mode || $show_main_page)
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_FORUMS_LIST' => true,
|
'TPL_FORUMS_LIST' => true,
|
||||||
|
|
||||||
'S_FORUM_ACTION' => "admin_forums.php",
|
'S_FORUM_ACTION' => 'admin_forums.php',
|
||||||
'L_FORUM_TITLE' => $lang['FORUM_ADMIN_MAIN']
|
'L_FORUM_TITLE' => $lang['FORUM_ADMIN_MAIN'],
|
||||||
));
|
));
|
||||||
|
|
||||||
$sql = "SELECT cat_id, cat_title, cat_order
|
$sql = "SELECT cat_id, cat_title, cat_order FROM " . BB_CATEGORIES . " ORDER BY cat_order";
|
||||||
FROM " . BB_CATEGORIES . "
|
|
||||||
ORDER BY cat_order";
|
|
||||||
if (!$q_categories = DB()->sql_query($sql))
|
if (!$q_categories = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query categories list');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_categories = DB()->num_rows($q_categories))
|
if ($total_categories = DB()->num_rows($q_categories))
|
||||||
|
@ -752,13 +740,10 @@ if (!$mode || $show_main_page)
|
||||||
$where_cat_sql = "WHERE cat_id = '-1'";
|
$where_cat_sql = "WHERE cat_id = '-1'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM ". BB_FORUMS ." $where_cat_sql ORDER BY cat_id, forum_order";
|
||||||
FROM ". BB_FORUMS ."
|
|
||||||
$where_cat_sql
|
|
||||||
ORDER BY cat_id, forum_order";
|
|
||||||
if (!$q_forums = DB()->sql_query($sql))
|
if (!$q_forums = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not query forums information", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query forums information');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_forums = DB()->num_rows($q_forums))
|
if ($total_forums = DB()->num_rows($q_forums))
|
||||||
|
@ -766,9 +751,7 @@ if (!$mode || $show_main_page)
|
||||||
$forum_rows = DB()->sql_fetchrowset($q_forums);
|
$forum_rows = DB()->sql_fetchrowset($q_forums);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Okay, let's build the index
|
// Okay, let's build the index
|
||||||
//
|
|
||||||
$gen_cat = array();
|
$gen_cat = array();
|
||||||
|
|
||||||
$bgr_class_1 = 'prow1';
|
$bgr_class_1 = 'prow1';
|
||||||
|
@ -776,7 +759,7 @@ if (!$mode || $show_main_page)
|
||||||
$bgr_class_over = 'prow3';
|
$bgr_class_over = 'prow3';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'U_ALL_FORUMS' => "admin_forums.php?c=all",
|
'U_ALL_FORUMS' => 'admin_forums.php?c=all',
|
||||||
'FORUMS_COUNT' => $total_forums,
|
'FORUMS_COUNT' => $total_forums,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -842,9 +825,7 @@ if (!$mode || $show_main_page)
|
||||||
|
|
||||||
print_page('admin_forums.tpl', 'admin');
|
print_page('admin_forums.tpl', 'admin');
|
||||||
|
|
||||||
//
|
|
||||||
// Functions
|
// Functions
|
||||||
//
|
|
||||||
function get_info ($mode, $id)
|
function get_info ($mode, $id)
|
||||||
{
|
{
|
||||||
switch($mode)
|
switch($mode)
|
||||||
|
@ -862,13 +843,13 @@ function get_info($mode, $id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_ERROR, "Wrong mode for generating select list", '', __LINE__, __FILE__);
|
bb_die('Wrong mode for generating select list #1');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$sql = "SELECT count(*) as total FROM $table";
|
$sql = "SELECT count(*) as total FROM $table";
|
||||||
if( !$result = DB()->sql_query($sql) )
|
if( !$result = DB()->sql_query($sql) )
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get forum / category information #1');
|
||||||
}
|
}
|
||||||
$count = DB()->sql_fetchrow($result);
|
$count = DB()->sql_fetchrow($result);
|
||||||
$count = $count['total'];
|
$count = $count['total'];
|
||||||
|
@ -877,12 +858,12 @@ function get_info($mode, $id)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get forum / category information #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) != 1)
|
if (DB()->num_rows($result) != 1)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", '', __LINE__, __FILE__);
|
bb_die('Forum / category does not exist or multiple forums / categories with ID '. $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = DB()->sql_fetchrow($result);
|
$return = DB()->sql_fetchrow($result);
|
||||||
|
@ -909,7 +890,7 @@ function get_list($mode, $id, $select)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_ERROR, "Wrong mode for generating select list", '', __LINE__, __FILE__);
|
bb_die('Wrong mode for generating select list #2');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -922,7 +903,7 @@ function get_list($mode, $id, $select)
|
||||||
|
|
||||||
if( !$result = DB()->sql_query($sql) )
|
if( !$result = DB()->sql_query($sql) )
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get list of categories / forums #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$catlist = '';
|
$catlist = '';
|
||||||
|
@ -959,7 +940,7 @@ function renumber_order($mode, $cat = 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_ERROR, "Wrong mode for generating select list", '', __LINE__, __FILE__);
|
bb_die('Wrong mode for generating select list #3');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +954,7 @@ function renumber_order($mode, $cat = 0)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get list of Categories", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get list of categories / forums #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 10;
|
$i = 10;
|
||||||
|
@ -983,14 +964,14 @@ function renumber_order($mode, $cat = 0)
|
||||||
$sql = "UPDATE $table SET $orderfield = $i WHERE $idfield = " . $row[$idfield];
|
$sql = "UPDATE $table SET $orderfield = $i WHERE $idfield = " . $row[$idfield];
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't update order fields", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update order fields');
|
||||||
}
|
}
|
||||||
$i += 10;
|
$i += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get list of Categories", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get list of categories / forums #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +994,7 @@ function get_cat_forums ($cat_id = FALSE)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get list of Categories", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get list of categories / forums #4');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rowset = DB()->sql_fetchrowset($result))
|
if ($rowset = DB()->sql_fetchrowset($result))
|
||||||
|
@ -1123,14 +1104,11 @@ function fix_orphan_sf ($orphan_sf_sql = '', $show_mess = FALSE)
|
||||||
|
|
||||||
if ($orphan_sf_sql)
|
if ($orphan_sf_sql)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ". BB_FORUMS ." SET
|
$sql = "UPDATE ". BB_FORUMS ." SET forum_parent = 0, show_on_index = 1 WHERE forum_id IN($orphan_sf_sql)";
|
||||||
forum_parent = 0,
|
|
||||||
show_on_index = 1
|
|
||||||
WHERE forum_id IN($orphan_sf_sql)";
|
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't change subforums data", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not change subforums data');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($affectedrows = DB()->affected_rows())
|
if ($affectedrows = DB()->affected_rows())
|
||||||
|
@ -1143,7 +1121,7 @@ function fix_orphan_sf ($orphan_sf_sql = '', $show_mess = FALSE)
|
||||||
$message = $done_mess .'<br /><br />';
|
$message = $done_mess .'<br /><br />';
|
||||||
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') .'<br /><br />';
|
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') .'<br /><br />';
|
||||||
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,12 +1190,12 @@ function check_name_dup ($mode, $name, $die_on_error = true)
|
||||||
|
|
||||||
if ($mode == 'cat')
|
if ($mode == 'cat')
|
||||||
{
|
{
|
||||||
$what_checked = 'Category';
|
$what_checked = 'category';
|
||||||
$sql = "SELECT cat_id FROM ". BB_CATEGORIES ." WHERE cat_title = '$name_sql'";
|
$sql = "SELECT cat_id FROM ". BB_CATEGORIES ." WHERE cat_title = '$name_sql'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$what_checked = 'Forum';
|
$what_checked = 'forum';
|
||||||
$sql = "SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_name = '$name_sql'";
|
$sql = "SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_name = '$name_sql'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1225,7 +1203,7 @@ function check_name_dup ($mode, $name, $die_on_error = true)
|
||||||
|
|
||||||
if ($name_is_dup && $die_on_error)
|
if ($name_is_dup && $die_on_error)
|
||||||
{
|
{
|
||||||
bb_die("This $what_checked name taken, please choose something else");
|
bb_die('This '. $what_checked .' name taken, please choose something else');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name_is_dup;
|
return $name_is_dup;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// ACP Header - START
|
// ACP Header - START
|
||||||
if (!empty($setmodules))
|
if (!empty($setmodules))
|
||||||
{
|
{
|
||||||
$module['General']['PHP Info'] = basename(__FILE__);
|
$module['General']['Php_info'] = basename(__FILE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
|
@ -52,13 +52,13 @@ if ($mode != '')
|
||||||
{
|
{
|
||||||
if (empty($rank_id))
|
if (empty($rank_id))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']);
|
bb_die($lang['MUST_SELECT_RANK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
|
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain rank data", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain ranks data #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rank_info = DB()->sql_fetchrow($result);
|
$rank_info = DB()->sql_fetchrow($result);
|
||||||
|
@ -104,7 +104,7 @@ if ($mode != '')
|
||||||
|
|
||||||
if ($rank_title == '')
|
if ($rank_title == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']);
|
bb_die($lang['MUST_SELECT_RANK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($special_rank == 1)
|
if ($special_rank == 1)
|
||||||
|
@ -131,7 +131,7 @@ if ($mode != '')
|
||||||
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['NO_UPDATE_RANKS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql = "UPDATE " . BB_RANKS . "
|
$sql = "UPDATE " . BB_RANKS . "
|
||||||
|
@ -154,15 +154,14 @@ if ($mode != '')
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't update/insert into ranks table", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update / insert into ranks table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
|
|
||||||
$datastore->update('ranks');
|
$datastore->update('ranks');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($mode == 'delete')
|
elseif ($mode == 'delete')
|
||||||
{
|
{
|
||||||
|
@ -185,29 +184,27 @@ if ($mode != '')
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete rank data", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete rank data');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['NO_UPDATE_RANKS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
|
||||||
|
|
||||||
$datastore->update('ranks');
|
$datastore->update('ranks');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']);
|
bb_die($lang['MUST_SELECT_RANK']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, 'Invalid mode');
|
bb_die('Invalid mode');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -218,10 +215,9 @@ else
|
||||||
$sql = "SELECT * FROM " . BB_RANKS . " ORDER BY rank_min, rank_title";
|
$sql = "SELECT * FROM " . BB_RANKS . " ORDER BY rank_min, rank_title";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain ranks data #2');
|
||||||
}
|
}
|
||||||
$rank_count = DB()->num_rows($result);
|
$rank_count = DB()->num_rows($result);
|
||||||
|
|
||||||
$rank_rows = DB()->sql_fetchrowset($result);
|
$rank_rows = DB()->sql_fetchrowset($result);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
|
|
@ -45,8 +45,7 @@ if (isset($_REQUEST['cancel_button']))
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf($lang['REBUILD_SEARCH_ABORTED'], $last_session_data['end_post_id']) .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>');
|
bb_die(sprintf($lang['REBUILD_SEARCH_ABORTED'], $last_session_data['end_post_id']) .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// from which post to start processing
|
// from which post to start processing
|
||||||
|
@ -137,17 +136,12 @@ $refresh_rate = isset($_REQUEST['refresh_rate']) ? (int) $_REQUEST['refresh_rate
|
||||||
// check if the user gave wrong input
|
// check if the user gave wrong input
|
||||||
if ($mode == 'submit')
|
if ($mode == 'submit')
|
||||||
{
|
{
|
||||||
if ($session_posts_processing <= 0 || $post_limit <= 0 || $refresh_rate <= 0 || $time_limit <=0)
|
if (($session_posts_processing || $post_limit || $refresh_rate || $time_limit) <= 0)
|
||||||
{
|
{
|
||||||
$message = $lang['WRONG_INPUT'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>');
|
bb_die($lang['WRONG_INPUT'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>'));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
// Main code starts from here
|
|
||||||
//
|
|
||||||
|
|
||||||
// Increase maximum execution time in case of a lot of posts, but don't complain about it if it isn't allowed.
|
// Increase maximum execution time in case of a lot of posts, but don't complain about it if it isn't allowed.
|
||||||
@set_time_limit($time_limit + 20);
|
@set_time_limit($time_limit + 20);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ if ($mode == 'config')
|
||||||
bb_update_config($config_update);
|
bb_update_config($config_update);
|
||||||
report_modules_cache_clean();
|
report_modules_cache_clean();
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_CONFIG_UPDATED'] . $return_links['config'] . $return_links['index']);
|
bb_die($lang['REPORT_CONFIG_UPDATED'] . $return_links['config'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
|
|
||||||
if (!$report_module = report_modules('id', $module_id))
|
if (!$report_module = report_modules('id', $module_id))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@ -107,7 +107,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
|
|
||||||
report_module_edit($module_id, $module_notify, $module_prune, $auth_write, $auth_view, $auth_notify, $auth_delete);
|
report_module_edit($module_id, $module_notify, $module_prune, $auth_write, $auth_view, $auth_notify, $auth_delete);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_EDITED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_EDITED'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
|
|
||||||
report_reason_edit($reason_id, $module_id, $reason_desc);
|
report_reason_edit($reason_id, $module_id, $reason_desc);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_REASON_EDITED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_REASON_EDITED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
|
@ -203,7 +203,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
|
|
||||||
if (!$report_reason = report_reason_obtain($reason_id))
|
if (!$report_reason = report_reason_obtain($reason_id))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_REASON_NOT_EXISTS'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_REASON_NOT_EXISTS'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($reason_desc))
|
if (isset($reason_desc))
|
||||||
|
@ -240,7 +240,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
{
|
{
|
||||||
report_reason_delete($reason_id);
|
report_reason_delete($reason_id);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_REASON_DELETED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_REASON_DELETED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
|
@ -259,7 +259,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
|
|
||||||
report_reason_insert($module_id, $reason_desc);
|
report_reason_insert($module_id, $reason_desc);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_REASON_ADDED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_REASON_ADDED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
|
@ -354,7 +354,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['reasons'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,12 +376,12 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
case 'sync':
|
case 'sync':
|
||||||
if (!method_exists($report_module, 'sync'))
|
if (!method_exists($report_module, 'sync'))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_module->sync();
|
$report_module->sync();
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_SYNCED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_SYNCED'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -392,7 +392,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
{
|
{
|
||||||
report_module_uninstall($module_id);
|
report_module_uninstall($module_id);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_UNINSTALLED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_UNINSTALLED'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
|
@ -410,7 +410,7 @@ else if (isset($_POST[POST_CAT_URL]) || isset($_GET[POST_CAT_URL]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ else if (isset($_POST['module']) || isset($_GET['module']))
|
||||||
|
|
||||||
if (!$report_module = report_modules_inactive('name', $module_name))
|
if (!$report_module = report_modules_inactive('name', $module_name))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_NOT_EXISTS'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@ -441,7 +441,7 @@ else if (isset($_POST['module']) || isset($_GET['module']))
|
||||||
|
|
||||||
report_module_install($module_notify, $module_prune, $module_name, $auth_write, $auth_view, $auth_notify, $auth_delete, false);
|
report_module_install($module_notify, $module_prune, $module_name, $auth_write, $auth_view, $auth_notify, $auth_delete, false);
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_MODULE_INSTALLED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_MODULE_INSTALLED'] . $return_links['admin'] . $return_links['index']);
|
||||||
}
|
}
|
||||||
else if (isset($_POST['cancel']))
|
else if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,7 @@ else if (isset($_POST['module']) || isset($_GET['module']))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(GENERAL_MESSAGE, $lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
bb_die($lang['REPORT_NOT_SUPPORTED'] . $return_links['admin'] . $return_links['index']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,9 +10,7 @@ if (!empty($setmodules))
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
// ACP Header - END
|
// ACP Header - END
|
||||||
|
|
||||||
//
|
// Check to see what mode we should operate in
|
||||||
// Check to see what mode we should operate in.
|
|
||||||
//
|
|
||||||
if( isset($_POST['mode']) || isset($_GET['mode']) )
|
if( isset($_POST['mode']) || isset($_GET['mode']) )
|
||||||
{
|
{
|
||||||
$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
|
$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
|
||||||
|
@ -25,9 +23,7 @@ else
|
||||||
|
|
||||||
$delimeter = '=+:';
|
$delimeter = '=+:';
|
||||||
|
|
||||||
//
|
// Read a listing of uploaded smilies for use in the add or edit smliey code
|
||||||
// Read a listing of uploaded smilies for use in the add or edit smliey code...
|
|
||||||
//
|
|
||||||
$dir = @opendir(BB_ROOT . $bb_cfg['smilies_path']);
|
$dir = @opendir(BB_ROOT . $bb_cfg['smilies_path']);
|
||||||
|
|
||||||
while ($file = @readdir($dir))
|
while ($file = @readdir($dir))
|
||||||
|
@ -49,40 +45,31 @@ while($file = @readdir($dir))
|
||||||
|
|
||||||
@closedir($dir);
|
@closedir($dir);
|
||||||
|
|
||||||
//
|
|
||||||
// Select main mode
|
// Select main mode
|
||||||
//
|
|
||||||
if (isset($_GET['import_pack']) || isset($_POST['import_pack']))
|
if (isset($_GET['import_pack']) || isset($_POST['import_pack']))
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Import a list a "Smiley Pack"
|
|
||||||
//
|
|
||||||
$smile_pak = (string) request_var('smile_pak', '');
|
$smile_pak = (string) request_var('smile_pak', '');
|
||||||
$clear_current = (int) request_var('clear_current', '');
|
$clear_current = (int) request_var('clear_current', '');
|
||||||
$replace_existing = (int) request_var('replace', '');
|
$replace_existing = (int) request_var('replace', '');
|
||||||
|
|
||||||
if (!empty($smile_pak))
|
if (!empty($smile_pak))
|
||||||
{
|
{
|
||||||
//
|
// The user has already selected a smile_pak file.. Import it
|
||||||
// The user has already selected a smile_pak file.. Import it.
|
|
||||||
//
|
|
||||||
if (!empty($clear_current))
|
if (!empty($clear_current))
|
||||||
{
|
{
|
||||||
$sql = "DELETE
|
$sql = "DELETE FROM " . BB_SMILIES;
|
||||||
FROM " . BB_SMILIES;
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete current smilies", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete current smilies');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
$datastore->update('smile_replacements');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "SELECT code
|
$sql = "SELECT code FROM ". BB_SMILIES;
|
||||||
FROM ". BB_SMILIES;
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't get current smilies", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get current smilies');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cur_smilies = DB()->sql_fetchrowset($result);
|
$cur_smilies = DB()->sql_fetchrowset($result);
|
||||||
|
@ -98,7 +85,7 @@ if( isset($_GET['import_pack']) || isset($_POST['import_pack']) )
|
||||||
|
|
||||||
if (empty($fcontents))
|
if (empty($fcontents))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't read smiley pak file", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not read smiley pak file');
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < count($fcontents); $i++)
|
for ($i = 0; $i < count($fcontents); $i++)
|
||||||
|
@ -107,9 +94,7 @@ if( isset($_GET['import_pack']) || isset($_POST['import_pack']) )
|
||||||
|
|
||||||
for ($j = 2; $j < count($smile_data); $j++)
|
for ($j = 2; $j < count($smile_data); $j++)
|
||||||
{
|
{
|
||||||
//
|
// Replace > and < with the proper html_entities for matching
|
||||||
// Replace > and < with the proper html_entities for matching.
|
|
||||||
//
|
|
||||||
$smile_data[$j] = str_replace('<', '<', $smile_data[$j]);
|
$smile_data[$j] = str_replace('<', '<', $smile_data[$j]);
|
||||||
$smile_data[$j] = str_replace('>', '>', $smile_data[$j]);
|
$smile_data[$j] = str_replace('>', '>', $smile_data[$j]);
|
||||||
$k = $smile_data[$j];
|
$k = $smile_data[$j];
|
||||||
|
@ -138,22 +123,18 @@ if( isset($_GET['import_pack']) || isset($_POST['import_pack']) )
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't update smilies!", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update smilies #1');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
$datastore->update('smile_replacements');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $lang['SMILEY_IMPORT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['SMILEY_IMPORT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
// Display the script to get the smile_pak cfg file
|
||||||
// Display the script to get the smile_pak cfg file...
|
|
||||||
//
|
|
||||||
$smile_paks_select = '<select name="smile_pak"><option value="">' . $lang['SELECT_PAK'] . '</option>';
|
$smile_paks_select = '<select name="smile_pak"><option value="">' . $lang['SELECT_PAK'] . '</option>';
|
||||||
while (list($key, $value) = @each($smiley_paks))
|
while (list($key, $value) = @each($smiley_paks))
|
||||||
{
|
{
|
||||||
|
@ -169,26 +150,22 @@ if( isset($_GET['import_pack']) || isset($_POST['import_pack']) )
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_SMILE_IMPORT' => true,
|
'TPL_SMILE_IMPORT' => true,
|
||||||
|
|
||||||
'S_SMILEY_ACTION' => "admin_smilies.php",
|
'S_SMILEY_ACTION' => 'admin_smilies.php',
|
||||||
'S_SMILE_SELECT' => $smile_paks_select,
|
'S_SMILE_SELECT' => $smile_paks_select,
|
||||||
'S_HIDDEN_FIELDS' => $hidden_vars)
|
'S_HIDDEN_FIELDS' => $hidden_vars,
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isset($_POST['export_pack']) || isset($_GET['export_pack']))
|
else if (isset($_POST['export_pack']) || isset($_GET['export_pack']))
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Export our smiley config as a smiley pak...
|
|
||||||
//
|
|
||||||
$export_pack = (string) request_var('export_pack', '');
|
$export_pack = (string) request_var('export_pack', '');
|
||||||
|
|
||||||
if ($export_pack == 'send')
|
if ($export_pack == 'send')
|
||||||
{
|
{
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM " . BB_SMILIES;
|
||||||
FROM " . BB_SMILIES;
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not get smiley list", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get smiley list');
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultset = DB()->sql_fetchrowset($result);
|
$resultset = DB()->sql_fetchrowset($result);
|
||||||
|
@ -209,16 +186,10 @@ else if( isset($_POST['export_pack']) || isset($_GET['export_pack']) )
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf($lang['EXPORT_SMILES'], '<a href="admin_smilies.php?export_pack=send">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die(sprintf($lang['EXPORT_SMILES'], '<a href="admin_smilies.php?export_pack=send">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (isset($_POST['add']) || isset($_GET['add']))
|
else if (isset($_POST['add']) || isset($_GET['add']))
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Admin has selected to add a smiley.
|
|
||||||
//
|
|
||||||
$filename_list = '';
|
$filename_list = '';
|
||||||
for ($i = 0; $i < count($smiley_images); $i++)
|
for ($i = 0; $i < count($smiley_images); $i++)
|
||||||
{
|
{
|
||||||
|
@ -241,42 +212,29 @@ else if ( $mode != '' )
|
||||||
switch( $mode )
|
switch( $mode )
|
||||||
{
|
{
|
||||||
case 'delete':
|
case 'delete':
|
||||||
//
|
|
||||||
// Admin has selected to delete a smiley.
|
|
||||||
//
|
|
||||||
|
|
||||||
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
|
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
|
||||||
$smiley_id = intval($smiley_id);
|
$smiley_id = intval($smiley_id);
|
||||||
|
|
||||||
$sql = "DELETE FROM " . BB_SMILIES . "
|
$sql = "DELETE FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
|
||||||
WHERE smilies_id = " . $smiley_id;
|
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete smiley", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete smiley');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
$datastore->update('smile_replacements');
|
||||||
|
|
||||||
$message = $lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
//
|
|
||||||
// Admin has selected to edit a smiley.
|
|
||||||
//
|
|
||||||
|
|
||||||
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
|
$smiley_id = ( !empty($_POST['id']) ) ? $_POST['id'] : $_GET['id'];
|
||||||
$smiley_id = intval($smiley_id);
|
$smiley_id = intval($smiley_id);
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM " . BB_SMILIES . " WHERE smilies_id = " . $smiley_id;
|
||||||
FROM " . BB_SMILIES . "
|
|
||||||
WHERE smilies_id = " . $smiley_id;
|
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain emoticon information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain emoticon information');
|
||||||
}
|
}
|
||||||
$smile_data = DB()->sql_fetchrow($result);
|
$smile_data = DB()->sql_fetchrow($result);
|
||||||
|
|
||||||
|
@ -292,7 +250,6 @@ else if ( $mode != '' )
|
||||||
{
|
{
|
||||||
$smiley_selected = '';
|
$smiley_selected = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
|
$filename_list .= '<option value="' . $smiley_images[$i] . '"' . $smiley_selected . '>' . $smiley_images[$i] . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,58 +269,36 @@ else if ( $mode != '' )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'save':
|
case 'save':
|
||||||
//
|
|
||||||
// Admin has submitted changes while editing a smiley.
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get the submitted data, being careful to ensure that we only
|
|
||||||
// accept the data we are looking for.
|
|
||||||
//
|
|
||||||
$smile_code = ( isset($_POST['smile_code']) ) ? trim($_POST['smile_code']) : trim($_GET['smile_code']);
|
$smile_code = ( isset($_POST['smile_code']) ) ? trim($_POST['smile_code']) : trim($_GET['smile_code']);
|
||||||
$smile_url = ( isset($_POST['smile_url']) ) ? trim($_POST['smile_url']) : trim($_GET['smile_url']);
|
$smile_url = ( isset($_POST['smile_url']) ) ? trim($_POST['smile_url']) : trim($_GET['smile_url']);
|
||||||
$smile_url = bb_ltrim(basename($smile_url), "'");
|
$smile_url = bb_ltrim(basename($smile_url), "'");
|
||||||
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? trim($_POST['smile_emotion']) : trim($_GET['smile_emotion']);
|
$smile_emotion = ( isset($_POST['smile_emotion']) ) ? trim($_POST['smile_emotion']) : trim($_GET['smile_emotion']);
|
||||||
$smile_id = ( isset($_POST['smile_id']) ) ? intval($_POST['smile_id']) : intval($_GET['smile_id']);
|
$smile_id = ( isset($_POST['smile_id']) ) ? intval($_POST['smile_id']) : intval($_GET['smile_id']);
|
||||||
|
|
||||||
// If no code was entered complain ...
|
// If no code was entered complain
|
||||||
if ($smile_code == '' || $smile_url == '')
|
if ($smile_code == '' || $smile_url == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['FIELDS_EMPTY']);
|
bb_die($lang['FIELDS_EMPTY']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Convert < and > to proper htmlentities for parsing
|
||||||
// Convert < and > to proper htmlentities for parsing.
|
|
||||||
//
|
|
||||||
$smile_code = str_replace('<', '<', $smile_code);
|
$smile_code = str_replace('<', '<', $smile_code);
|
||||||
$smile_code = str_replace('>', '>', $smile_code);
|
$smile_code = str_replace('>', '>', $smile_code);
|
||||||
|
|
||||||
//
|
// Proceed with updating the smiley table
|
||||||
// Proceed with updating the smiley table.
|
|
||||||
//
|
|
||||||
$sql = "UPDATE " . BB_SMILIES . "
|
$sql = "UPDATE " . BB_SMILIES . "
|
||||||
SET code = '" . DB()->escape($smile_code) . "', smile_url = '" . DB()->escape($smile_url) . "', emoticon = '" . DB()->escape($smile_emotion) . "'
|
SET code = '" . DB()->escape($smile_code) . "', smile_url = '" . DB()->escape($smile_url) . "', emoticon = '" . DB()->escape($smile_emotion) . "'
|
||||||
WHERE smilies_id = $smile_id";
|
WHERE smilies_id = $smile_id";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't update smilies info", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update smilies #2');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
$datastore->update('smile_replacements');
|
||||||
|
|
||||||
$message = $lang['SMILEY_EDIT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['SMILEY_EDIT_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'savenew':
|
case 'savenew':
|
||||||
//
|
|
||||||
// Admin has submitted changes while adding a new smiley.
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get the submitted data being careful to ensure the the data
|
|
||||||
// we recieve and process is only the data we are looking for.
|
|
||||||
//
|
|
||||||
$smile_code = ( isset($_POST['smile_code']) ) ? $_POST['smile_code'] : $_GET['smile_code'];
|
$smile_code = ( isset($_POST['smile_code']) ) ? $_POST['smile_code'] : $_GET['smile_code'];
|
||||||
$smile_url = ( isset($_POST['smile_url']) ) ? $_POST['smile_url'] : $_GET['smile_url'];
|
$smile_url = ( isset($_POST['smile_url']) ) ? $_POST['smile_url'] : $_GET['smile_url'];
|
||||||
$smile_url = bb_ltrim(basename($smile_url), "'");
|
$smile_url = bb_ltrim(basename($smile_url), "'");
|
||||||
|
@ -372,49 +307,37 @@ else if ( $mode != '' )
|
||||||
$smile_url = trim($smile_url);
|
$smile_url = trim($smile_url);
|
||||||
$smile_emotion = trim($smile_emotion);
|
$smile_emotion = trim($smile_emotion);
|
||||||
|
|
||||||
// If no code was entered complain ...
|
// If no code was entered complain
|
||||||
if ($smile_code == '' || $smile_url == '')
|
if ($smile_code == '' || $smile_url == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['FIELDS_EMPTY']);
|
bb_die($lang['FIELDS_EMPTY']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Convert < and > to proper htmlentities for parsing
|
||||||
// Convert < and > to proper htmlentities for parsing.
|
|
||||||
//
|
|
||||||
$smile_code = str_replace('<', '<', $smile_code);
|
$smile_code = str_replace('<', '<', $smile_code);
|
||||||
$smile_code = str_replace('>', '>', $smile_code);
|
$smile_code = str_replace('>', '>', $smile_code);
|
||||||
|
|
||||||
//
|
// Save the data to the smiley table
|
||||||
// Save the data to the smiley table.
|
|
||||||
//
|
|
||||||
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
|
$sql = "INSERT INTO " . BB_SMILIES . " (code, smile_url, emoticon)
|
||||||
VALUES ('" . DB()->escape($smile_code) . "', '" . DB()->escape($smile_url) . "', '" . DB()->escape($smile_emotion) . "')";
|
VALUES ('" . DB()->escape($smile_code) . "', '" . DB()->escape($smile_url) . "', '" . DB()->escape($smile_emotion) . "')";
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't insert new smiley", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert new smiley');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
$datastore->update('smile_replacements');
|
||||||
|
|
||||||
$message = $lang['SMILEY_ADD_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['SMILEY_ADD_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$sql = "SELECT * FROM " . BB_SMILIES;
|
||||||
//
|
|
||||||
// This is the main display of the page before the admin has selected
|
|
||||||
// any options.
|
|
||||||
//
|
|
||||||
$sql = "SELECT *
|
|
||||||
FROM " . BB_SMILIES;
|
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain smileys from database", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain smileys from database');
|
||||||
}
|
}
|
||||||
|
|
||||||
$smilies = DB()->sql_fetchrowset($result);
|
$smilies = DB()->sql_fetchrowset($result);
|
||||||
|
@ -422,17 +345,13 @@ else
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_SMILE_MAIN' => true,
|
'TPL_SMILE_MAIN' => true,
|
||||||
'S_HIDDEN_FIELDS' => @$s_hidden_fields,
|
'S_HIDDEN_FIELDS' => @$s_hidden_fields,
|
||||||
'S_SMILEY_ACTION' => "admin_smilies.php",
|
'S_SMILEY_ACTION' => 'admin_smilies.php',
|
||||||
));
|
));
|
||||||
|
|
||||||
//
|
// Loop throuh the rows of smilies setting block vars for the template
|
||||||
// Loop throuh the rows of smilies setting block vars for the template.
|
|
||||||
//
|
|
||||||
for ($i = 0; $i < count($smilies); $i++)
|
for ($i = 0; $i < count($smilies); $i++)
|
||||||
{
|
{
|
||||||
//
|
// Replace htmlentites for < and > with actual character
|
||||||
// Replace htmlentites for < and > with actual character.
|
|
||||||
//
|
|
||||||
$smilies[$i]['code'] = str_replace('<', '<', $smilies[$i]['code']);
|
$smilies[$i]['code'] = str_replace('<', '<', $smilies[$i]['code']);
|
||||||
$smilies[$i]['code'] = str_replace('>', '>', $smilies[$i]['code']);
|
$smilies[$i]['code'] = str_replace('>', '>', $smilies[$i]['code']);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ if ($submit && $mode == 'user')
|
||||||
{
|
{
|
||||||
if ($userdata['user_id'] == $user_id || $user_id == GUEST_UID || $user_id == BOT_UID)
|
if ($userdata['user_id'] == $user_id || $user_id == GUEST_UID || $user_id == BOT_UID)
|
||||||
{
|
{
|
||||||
bb_die("Couldn't update admin status");
|
bb_die("Could not update admin status");
|
||||||
}
|
}
|
||||||
|
|
||||||
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". ADMIN ." WHERE user_id = $user_id LIMIT 1");
|
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". ADMIN ." WHERE user_id = $user_id LIMIT 1");
|
||||||
|
@ -97,7 +97,7 @@ if ($submit && $mode == 'user')
|
||||||
// ignore if you're trying to change yourself from an admin to user!
|
// ignore if you're trying to change yourself from an admin to user!
|
||||||
if ($userdata['user_id'] == $user_id)
|
if ($userdata['user_id'] == $user_id)
|
||||||
{
|
{
|
||||||
bb_die("Couldn't update admin status<br /><br />Couldn't change yourself from an admin to user");
|
bb_die("Could not update admin status<br /><br />Could not change yourself from an admin to user");
|
||||||
}
|
}
|
||||||
// Update users level, reset to USER
|
// Update users level, reset to USER
|
||||||
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". USER ." WHERE user_id = $user_id LIMIT 1");
|
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". USER ." WHERE user_id = $user_id LIMIT 1");
|
||||||
|
|
|
@ -9,9 +9,6 @@ if (!empty($setmodules))
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
// ACP Header - END
|
// ACP Header - END
|
||||||
|
|
||||||
//
|
|
||||||
// Start program
|
|
||||||
//
|
|
||||||
if ( isset($_POST['submit']) )
|
if ( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
$user_bansql = '';
|
$user_bansql = '';
|
||||||
|
@ -24,7 +21,7 @@ if ( isset($_POST['submit']) )
|
||||||
$this_userdata = get_userdata($_POST['username'], true);
|
$this_userdata = get_userdata($_POST['username'], true);
|
||||||
if (!$this_userdata)
|
if (!$this_userdata)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_USER_ID_SPECIFIED'] );
|
bb_die($lang['NO_USER_ID_SPECIFIED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_list[] = $this_userdata['user_id'];
|
$user_list[] = $this_userdata['user_id'];
|
||||||
|
@ -39,9 +36,6 @@ if ( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode))
|
if (preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode))
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Don't ask about all this, just don't ask ... !
|
|
||||||
//
|
|
||||||
$ip_1_counter = $ip_range_explode[1];
|
$ip_1_counter = $ip_range_explode[1];
|
||||||
$ip_1_end = $ip_range_explode[5];
|
$ip_1_end = $ip_range_explode[5];
|
||||||
|
|
||||||
|
@ -122,11 +116,6 @@ if ( isset($_POST['submit']) )
|
||||||
|
|
||||||
for ($i = 0; $i < count($email_list_temp); $i++)
|
for ($i = 0; $i < count($email_list_temp); $i++)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// This ereg match is based on one by php@unreelpro.com
|
|
||||||
// contained in the annotated php manual at php.com (ereg
|
|
||||||
// section)
|
|
||||||
//
|
|
||||||
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
|
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i])))
|
||||||
{
|
{
|
||||||
$email_list[] = trim($email_list_temp[$i]);
|
$email_list[] = trim($email_list_temp[$i]);
|
||||||
|
@ -134,11 +123,10 @@ if ( isset($_POST['submit']) )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM " . BB_BANLIST;
|
||||||
FROM " . BB_BANLIST;
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain banlist information');
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_banlist = DB()->sql_fetchrowset($result);
|
$current_banlist = DB()->sql_fetchrowset($result);
|
||||||
|
@ -160,11 +148,10 @@ if ( isset($_POST['submit']) )
|
||||||
{
|
{
|
||||||
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
|
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
|
||||||
|
|
||||||
$sql = "INSERT INTO " . BB_BANLIST . " (ban_userid)
|
$sql = "INSERT INTO " . BB_BANLIST . " (ban_userid) VALUES (" . $user_list[$i] . ")";
|
||||||
VALUES (" . $user_list[$i] . ")";
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not insert ban_userid info into database');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,27 +180,21 @@ if ( isset($_POST['submit']) )
|
||||||
|
|
||||||
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
|
$kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
|
||||||
|
|
||||||
$sql = "INSERT INTO " . BB_BANLIST . " (ban_ip)
|
$sql = "INSERT INTO " . BB_BANLIST . " (ban_ip) VALUES ('" . $ip_list[$i] . "')";
|
||||||
VALUES ('" . $ip_list[$i] . "')";
|
|
||||||
if ( !DB()->sql_query($sql) )
|
if ( !DB()->sql_query($sql) )
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert ban_ip info into database');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Now we'll delete all entries from the session table
|
||||||
// Now we'll delete all entries from the session table with any of the banned
|
|
||||||
// user or IP info just entered into the ban table ... this will force a session
|
|
||||||
// initialisation resulting in an instant ban
|
|
||||||
//
|
|
||||||
if ($kill_session_sql != '')
|
if ($kill_session_sql != '')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . BB_SESSIONS . "
|
$sql = "DELETE FROM " . BB_SESSIONS . " WHERE $kill_session_sql";
|
||||||
WHERE $kill_session_sql";
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete banned sessions from database');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,11 +211,10 @@ if ( isset($_POST['submit']) )
|
||||||
|
|
||||||
if (!$in_banlist)
|
if (!$in_banlist)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO " . BB_BANLIST . " (ban_email)
|
$sql = "INSERT INTO " . BB_BANLIST . " (ban_email) VALUES ('" . DB()->escape($email_list[$i]) . "')";
|
||||||
VALUES ('" . DB()->escape($email_list[$i]) . "')";
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't insert ban_email info into database", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert ban_email info into database');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,23 +262,19 @@ if ( isset($_POST['submit']) )
|
||||||
|
|
||||||
if ($where_sql != '')
|
if ($where_sql != '')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . BB_BANLIST . "
|
$sql = "DELETE FROM " . BB_BANLIST . " WHERE ban_id IN ($where_sql)";
|
||||||
WHERE ban_id IN ($where_sql)";
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't delete ban info from database", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete ban info from database');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_BANLIST_ACTION' => "admin_user_ban.php",
|
'S_BANLIST_ACTION' => 'admin_user_ban.php',
|
||||||
));
|
));
|
||||||
|
|
||||||
$userban_count = 0;
|
$userban_count = 0;
|
||||||
|
@ -313,7 +289,7 @@ else
|
||||||
ORDER BY u.username ASC";
|
ORDER BY u.username ASC";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select current user_id ban list');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_list = DB()->sql_fetchrowset($result);
|
$user_list = DB()->sql_fetchrowset($result);
|
||||||
|
@ -333,14 +309,10 @@ else
|
||||||
|
|
||||||
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
|
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
|
||||||
|
|
||||||
$sql = "
|
$sql = "SELECT ban_id, ban_ip, ban_email FROM ". BB_BANLIST ." ORDER BY ban_ip";
|
||||||
SELECT ban_id, ban_ip, ban_email
|
|
||||||
FROM ". BB_BANLIST ."
|
|
||||||
ORDER BY ban_ip
|
|
||||||
";
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select current ip ban list');
|
||||||
}
|
}
|
||||||
|
|
||||||
$banlist = DB()->sql_fetchrowset($result);
|
$banlist = DB()->sql_fetchrowset($result);
|
||||||
|
@ -381,11 +353,11 @@ else
|
||||||
$select_emaillist = '<select name="unban_email[]" multiple="multiple" size="10">' . $select_emaillist . '</select>';
|
$select_emaillist = '<select name="unban_email[]" multiple="multiple" size="10">' . $select_emaillist . '</select>';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'U_SEARCH_USER' => "./../search.php?mode=searchuser",
|
'U_SEARCH_USER' => './../search.php?mode=searchuser',
|
||||||
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
|
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
|
||||||
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
|
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
|
||||||
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
|
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
|
||||||
'S_BAN_ACTION' => "admin_user_ban.php",
|
'S_BAN_ACTION' => 'admin_user_ban.php',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,12 @@ require('./pagestart.php');
|
||||||
|
|
||||||
if (!$bb_cfg['use_word_censor'])
|
if (!$bb_cfg['use_word_censor'])
|
||||||
{
|
{
|
||||||
bb_die('Word Censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
|
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
$mode = htmlspecialchars($mode);
|
$mode = htmlspecialchars($mode);
|
||||||
//
|
|
||||||
// These could be entered via a form button
|
|
||||||
//
|
|
||||||
if (isset($_POST['add']))
|
if (isset($_POST['add']))
|
||||||
{
|
{
|
||||||
$mode = 'add';
|
$mode = 'add';
|
||||||
|
@ -40,12 +38,10 @@ if( $mode != '' )
|
||||||
{
|
{
|
||||||
if ($word_id)
|
if ($word_id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM " . BB_WORDS . " WHERE word_id = $word_id";
|
||||||
FROM " . BB_WORDS . "
|
|
||||||
WHERE word_id = $word_id";
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not query words table", $lang['ERROR'], __LINE__, __FILE__, $sql);
|
bb_die('Could not query words table #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$word_info = DB()->sql_fetchrow($result);
|
$word_info = DB()->sql_fetchrow($result);
|
||||||
|
@ -55,17 +51,15 @@ if( $mode != '' )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_WORD_SELECTED']);
|
bb_die($lang['NO_WORD_SELECTED']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ADMIN_WORDS_EDIT' => true,
|
'TPL_ADMIN_WORDS_EDIT' => true,
|
||||||
|
|
||||||
'WORD' => $word,
|
'WORD' => $word,
|
||||||
'REPLACEMENT' => $replacement,
|
'REPLACEMENT' => $replacement,
|
||||||
|
'S_WORDS_ACTION' => 'admin_words.php',
|
||||||
'S_WORDS_ACTION' => "admin_words.php",
|
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +71,7 @@ if( $mode != '' )
|
||||||
|
|
||||||
if ($word == '' || $replacement == '')
|
if ($word == '' || $replacement == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['MUST_ENTER_WORD']);
|
bb_die($lang['MUST_ENTER_WORD']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($word_id)
|
if ($word_id)
|
||||||
|
@ -96,13 +90,13 @@ if( $mode != '' )
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not insert data into words table", $lang['ERROR'], __LINE__, __FILE__, $sql);
|
bb_die('Could not insert data into words table');
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHE('bb_cache')->rm('censored');
|
CACHE('bb_cache')->rm('censored');
|
||||||
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
}
|
}
|
||||||
else if ($mode == 'delete')
|
else if ($mode == 'delete')
|
||||||
{
|
{
|
||||||
|
@ -110,34 +104,29 @@ if( $mode != '' )
|
||||||
|
|
||||||
if ($word_id)
|
if ($word_id)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . BB_WORDS . "
|
$sql = "DELETE FROM " . BB_WORDS . " WHERE word_id = $word_id";
|
||||||
WHERE word_id = $word_id";
|
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not remove data from words table", $lang['ERROR'], __LINE__, __FILE__, $sql);
|
bb_die('Could not remove data from words table');
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHE('bb_cache')->rm('censored');
|
CACHE('bb_cache')->rm('censored');
|
||||||
|
|
||||||
$message = $lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_WORD_SELECTED']);
|
bb_die($lang['NO_WORD_SELECTED']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "SELECT *
|
$sql = "SELECT * FROM " . BB_WORDS . " ORDER BY word";
|
||||||
FROM " . BB_WORDS . "
|
|
||||||
ORDER BY word";
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not query words table", $lang['ERROR'], __LINE__, __FILE__, $sql);
|
bb_die('Could not query words table #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$word_rows = DB()->sql_fetchrowset($result);
|
$word_rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -145,8 +134,7 @@ else
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ADMIN_WORDS_LIST' => true,
|
'TPL_ADMIN_WORDS_LIST' => true,
|
||||||
|
'S_WORDS_ACTION' => 'admin_words.php',
|
||||||
'S_WORDS_ACTION' => "admin_words.php",
|
|
||||||
'S_HIDDEN_FIELDS' => '',
|
'S_HIDDEN_FIELDS' => '',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -162,7 +150,6 @@ else
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'WORD' => $word,
|
'WORD' => $word,
|
||||||
'REPLACEMENT' => $replacement,
|
'REPLACEMENT' => $replacement,
|
||||||
|
|
||||||
'U_WORD_EDIT' => "admin_words.php?mode=edit&id=$word_id",
|
'U_WORD_EDIT' => "admin_words.php?mode=edit&id=$word_id",
|
||||||
'U_WORD_DELETE' => "admin_words.php?mode=delete&id=$word_id",
|
'U_WORD_DELETE' => "admin_words.php?mode=delete&id=$word_id",
|
||||||
));
|
));
|
||||||
|
|
|
@ -175,7 +175,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
ORDER BY s.session_ip ASC, s.session_time DESC";
|
ORDER BY s.session_ip ASC, s.session_time DESC";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain reged user / online information');
|
||||||
}
|
}
|
||||||
$onlinerow_reg = DB()->sql_fetchrowset($result);
|
$onlinerow_reg = DB()->sql_fetchrowset($result);
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
ORDER BY session_ip ASC, session_time DESC";
|
ORDER BY session_ip ASC, session_time DESC";
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain guest user / online information');
|
||||||
}
|
}
|
||||||
$onlinerow_guest = DB()->sql_fetchrowset($result);
|
$onlinerow_guest = DB()->sql_fetchrowset($result);
|
||||||
|
|
||||||
|
@ -222,8 +222,8 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
$template->assign_block_vars('reg_user_row', array(
|
$template->assign_block_vars('reg_user_row', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'USER' => profile_url($onlinerow_reg[$i]),
|
'USER' => profile_url($onlinerow_reg[$i]),
|
||||||
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', 'false'),
|
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false),
|
||||||
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', 'false'),
|
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false),
|
||||||
'IP_ADDRESS' => $reg_ip,
|
'IP_ADDRESS' => $reg_ip,
|
||||||
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
|
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
|
||||||
));
|
));
|
||||||
|
@ -247,8 +247,8 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
|
|
||||||
$template->assign_block_vars('guest_user_row', array(
|
$template->assign_block_vars('guest_user_row', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', 'false'),
|
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false),
|
||||||
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i' , 'false'),
|
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i' , false),
|
||||||
'IP_ADDRESS' => $guest_ip,
|
'IP_ADDRESS' => $guest_ip,
|
||||||
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
|
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
|
||||||
));
|
));
|
||||||
|
|
|
@ -18,7 +18,7 @@ if (IS_GUEST)
|
||||||
|
|
||||||
if (!IS_ADMIN)
|
if (!IS_ADMIN)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NOT_ADMIN']);
|
bb_die($lang['NOT_ADMIN']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$userdata['session_admin'])
|
if (!$userdata['session_admin'])
|
||||||
|
|
|
@ -12,7 +12,7 @@ $ajax->init();
|
||||||
// Handle "board disabled via ON/OFF trigger"
|
// Handle "board disabled via ON/OFF trigger"
|
||||||
if (file_exists(BB_DISABLED) || $bb_cfg['board_disable'])
|
if (file_exists(BB_DISABLED) || $bb_cfg['board_disable'])
|
||||||
{
|
{
|
||||||
$ajax->ajax_die($bb_cfg['board_disabled_msg']);
|
$ajax->ajax_die($lang['BOARD_DISABLE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load actions required modules
|
// Load actions required modules
|
||||||
|
@ -22,6 +22,7 @@ switch ($ajax->action)
|
||||||
require(INC_DIR . 'bbcode.php');
|
require(INC_DIR . 'bbcode.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'chat':
|
||||||
case 'posts':
|
case 'posts':
|
||||||
case 'post_mod_comment':
|
case 'post_mod_comment':
|
||||||
require(INC_DIR . 'bbcode.php');
|
require(INC_DIR . 'bbcode.php');
|
||||||
|
@ -84,6 +85,7 @@ class ajax_common
|
||||||
'post_mod_comment' => array('mod'),
|
'post_mod_comment' => array('mod'),
|
||||||
|
|
||||||
'avatar' => array('user'),
|
'avatar' => array('user'),
|
||||||
|
'chat' => array('user'),
|
||||||
'gen_passkey' => array('user'),
|
'gen_passkey' => array('user'),
|
||||||
'change_torrent' => array('user'),
|
'change_torrent' => array('user'),
|
||||||
'change_tor_status' => array('user'),
|
'change_tor_status' => array('user'),
|
||||||
|
@ -399,4 +401,9 @@ class ajax_common
|
||||||
{
|
{
|
||||||
require(AJAX_DIR . 'avatar.php');
|
require(AJAX_DIR . 'avatar.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function chat()
|
||||||
|
{
|
||||||
|
require(AJAX_DIR . 'chat.php');
|
||||||
|
}
|
||||||
}
|
}
|
2
upload/ajax/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
order allow,deny
|
||||||
|
deny from all
|
|
@ -41,16 +41,23 @@ if (!$torrent) $this->ajax_die($lang['INVALID_ATTACH_ID']);
|
||||||
if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
|
if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
|
||||||
{
|
{
|
||||||
if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
|
if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
|
||||||
{
true;
}
|
{
|
||||||
|
true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
}
|
$this->ajax_die($lang['ONLY_FOR_MOD']);
|
||||||
|
}
|
||||||
|
}
|
||||||
elseif (!IS_AM)
|
elseif (!IS_AM)
|
||||||
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
|
{
|
||||||
|
$this->ajax_die($lang['ONLY_FOR_MOD']);
|
||||||
|
}
|
||||||
|
|
||||||
$title = $url = '';
|
$title = $url = '';
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
case 'set_gold';
|
{
|
||||||
|
case 'set_gold';
|
||||||
case 'set_silver';
|
case 'set_silver';
|
||||||
case 'unset_silver_gold';
|
case 'unset_silver_gold';
|
||||||
if ($type == 'set_silver')
|
if ($type == 'set_silver')
|
||||||
|
@ -90,7 +97,8 @@ switch($type)
|
||||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
|
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
|
||||||
delete_torrent($attach_id);
|
delete_torrent($attach_id);
|
||||||
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
|
$url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
|
||||||
break;
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$this->response['url'] = $url;
|
$this->response['url'] = $url;
|
||||||
$this->response['title'] = $title;
|
$this->response['title'] = $title;
|
5
upload/ajax/chat.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
// TODO 593
|
|
@ -116,7 +116,7 @@ switch ($field)
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
||||||
}
|
}
|
||||||
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', 'false');
|
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u_up_total':
|
case 'u_up_total':
|
||||||
|
|
|
@ -190,7 +190,7 @@ switch($this->request['type'])
|
||||||
<input type="button" value="'. $lang['CODE'] .'" name="codeCode" title="'. $lang['CODE_TITLE'] .'" style="width: 43px;" />
|
<input type="button" value="'. $lang['CODE'] .'" name="codeCode" title="'. $lang['CODE_TITLE'] .'" style="width: 43px;" />
|
||||||
<input type="button" value="'. $lang['LIST'] .'" name="codeList" title="'. $lang['LIST_TITLE'] .'" style="width: 60px;" />
|
<input type="button" value="'. $lang['LIST'] .'" name="codeList" title="'. $lang['LIST_TITLE'] .'" style="width: 60px;" />
|
||||||
<input type="button" value="1." name="codeOpt" title="'. $lang['LIST_ITEM'] .'" style="width: 30px;" />
|
<input type="button" value="1." name="codeOpt" title="'. $lang['LIST_ITEM'] .'" style="width: 30px;" />
|
||||||
<input type="button" value="'. $lang['QUOTE_SEL'] .'" name="quoteselected" title="'. $lang['QUOTE_SELECTED'] .'" onmouseout="bbcode.refreshSelection(false);" onmouseover="bbcode.refreshSelection(true);" onclick="bbcode.onclickQuoteSel();" />
|
<input type="button" value="'. $lang['QUOTE_SEL'] .'" name="quoteselected" title="'. $lang['QUOTE_SELECTED'] .'" onclick="bbcode.onclickQuoteSel();" />
|
||||||
</div>
|
</div>
|
||||||
<textarea id="message-'. $post_id .'" class="editor mrg_4" name="message" rows="18" cols="92">'. $post['post_text'] .'</textarea>
|
<textarea id="message-'. $post_id .'" class="editor mrg_4" name="message" rows="18" cols="92">'. $post['post_text'] .'</textarea>
|
||||||
<div class="mrg_4 tCenter">
|
<div class="mrg_4 tCenter">
|
||||||
|
|
|
@ -27,7 +27,7 @@ function attach_mod_get_lang($language_file)
|
||||||
|
|
||||||
if (!file_exists(LANG_ROOT_DIR ."$language/$language_file.php"))
|
if (!file_exists(LANG_ROOT_DIR ."$language/$language_file.php"))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, 'Attachment Mod language file does not exist: language/' . $language . '/' . $language_file . '.php');
|
bb_die('Attachment mod language file does not exist: language/' . $language . '/' . $language_file . '.php');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ function get_config()
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query attachment information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachment information');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -79,11 +79,4 @@ if (!($attach_config = CACHE('bb_cache')->get('attach_config')))
|
||||||
include(BB_ROOT .'attach_mod/displaying.php');
|
include(BB_ROOT .'attach_mod/displaying.php');
|
||||||
include(BB_ROOT .'attach_mod/posting_attachments.php');
|
include(BB_ROOT .'attach_mod/posting_attachments.php');
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['upload_dir'];
|
$upload_dir = $attach_config['upload_dir'];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['download_path'];
|
|
||||||
}
|
|
|
@ -157,7 +157,7 @@ function init_display_post_attachments($switch_attachment)
|
||||||
{
|
{
|
||||||
if (defined('TORRENT_POST'))
|
if (defined('TORRENT_POST'))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Multiple registered torrents in one topic<br /><br />first torrent found in post_id = '. TORRENT_POST .'<br />current post_id = '. $rows[$i]['post_id'] .'<br /><br />attachments info:<br /><pre style="text-align: left;">'. print_r($rows, TRUE) .'</pre>');
|
bb_die('Multiple registered torrents in one topic<br /><br />first torrent found in post_id = '. TORRENT_POST .'<br />current post_id = '. $rows[$i]['post_id'] .'<br /><br />attachments info:<br /><pre style="text-align: left;">'. print_r($rows, TRUE) .'</pre>');
|
||||||
}
|
}
|
||||||
define('TORRENT_POST', $rows[$i]['post_id']);
|
define('TORRENT_POST', $rows[$i]['post_id']);
|
||||||
}
|
}
|
||||||
|
@ -167,11 +167,6 @@ function init_display_post_attachments($switch_attachment)
|
||||||
init_display_template('body', '{postrow.ATTACHMENTS}');
|
init_display_template('body', '{postrow.ATTACHMENTS}');
|
||||||
|
|
||||||
init_complete_extensions_data();
|
init_complete_extensions_data();
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'L_POSTED_ATTACHMENTS' => $lang['POSTED_ATTACHMENTS'],
|
|
||||||
'L_KILOBYTE' => $lang['KB'])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,20 +230,10 @@ function display_attachments($post_id)
|
||||||
{
|
{
|
||||||
// define category
|
// define category
|
||||||
$image = FALSE;
|
$image = FALSE;
|
||||||
$stream = FALSE;
|
|
||||||
$swf = FALSE;
|
|
||||||
$thumbnail = FALSE;
|
$thumbnail = FALSE;
|
||||||
$link = FALSE;
|
$link = FALSE;
|
||||||
|
|
||||||
if (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == STREAM_CAT)
|
if (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT && intval($attach_config['img_display_inlined']))
|
||||||
{
|
|
||||||
$stream = TRUE;
|
|
||||||
}
|
|
||||||
else if (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == SWF_CAT)
|
|
||||||
{
|
|
||||||
$swf = TRUE;
|
|
||||||
}
|
|
||||||
else if (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT && intval($attach_config['img_display_inlined']))
|
|
||||||
{
|
{
|
||||||
if (intval($attach_config['img_link_width']) != 0 || intval($attach_config['img_link_height']) != 0)
|
if (intval($attach_config['img_link_width']) != 0 || intval($attach_config['img_link_height']) != 0)
|
||||||
{
|
{
|
||||||
|
@ -278,7 +263,7 @@ function display_attachments($post_id)
|
||||||
$image = FALSE;
|
$image = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$image && !$stream && !$swf && !$thumbnail)
|
if (!$image && !$thumbnail)
|
||||||
{
|
{
|
||||||
$link = TRUE;
|
$link = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -290,15 +275,6 @@ function display_attachments($post_id)
|
||||||
// Section between BEGIN and END with (Without the // of course):
|
// Section between BEGIN and END with (Without the // of course):
|
||||||
// $img_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'];
|
// $img_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'];
|
||||||
// $download_link = TRUE;
|
// $download_link = TRUE;
|
||||||
//
|
|
||||||
//
|
|
||||||
if (intval($attach_config['allow_ftp_upload']) && trim($attach_config['download_path']) == '')
|
|
||||||
{
|
|
||||||
$img_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'];
|
|
||||||
$download_link = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check if we can reach the file or if it is stored outside of the webroot
|
// Check if we can reach the file or if it is stored outside of the webroot
|
||||||
if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
||||||
{
|
{
|
||||||
|
@ -312,7 +288,6 @@ function display_attachments($post_id)
|
||||||
$download_link = FALSE;
|
$download_link = FALSE;
|
||||||
// END
|
// END
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('postrow.attach.cat_images', array(
|
$template->assign_block_vars('postrow.attach.cat_images', array(
|
||||||
'DOWNLOAD_NAME' => $display_name,
|
'DOWNLOAD_NAME' => $display_name,
|
||||||
|
@ -332,7 +307,7 @@ function display_attachments($post_id)
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update attachment download count');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,13 +318,6 @@ function display_attachments($post_id)
|
||||||
// NOTE: If you want to use the download.php everytime an thumnmail is displayed inlined, replace the
|
// NOTE: If you want to use the download.php everytime an thumnmail is displayed inlined, replace the
|
||||||
// Section between BEGIN and END with (Without the // of course):
|
// Section between BEGIN and END with (Without the // of course):
|
||||||
// $thumb_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1';
|
// $thumb_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1';
|
||||||
//
|
|
||||||
if (intval($attach_config['allow_ftp_upload']) && trim($attach_config['download_path']) == '')
|
|
||||||
{
|
|
||||||
$thumb_source = BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check if we can reach the file or if it is stored outside of the webroot
|
// Check if we can reach the file or if it is stored outside of the webroot
|
||||||
if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
if ($attach_config['upload_dir'][0] == '/' || ( $attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
||||||
{
|
{
|
||||||
|
@ -361,7 +329,6 @@ function display_attachments($post_id)
|
||||||
$thumb_source = $thumbnail_filename;
|
$thumb_source = $thumbnail_filename;
|
||||||
// END
|
// END
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
|
$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
|
||||||
'DOWNLOAD_NAME' => $display_name,
|
'DOWNLOAD_NAME' => $display_name,
|
||||||
|
@ -374,65 +341,12 @@ function display_attachments($post_id)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stream)
|
|
||||||
{
|
|
||||||
// Streams
|
|
||||||
$template->assign_block_vars('postrow.attach.cat_stream', array(
|
|
||||||
'U_DOWNLOAD_LINK' => $filename,
|
|
||||||
'S_UPLOAD_IMAGE' => $upload_image,
|
|
||||||
|
|
||||||
'DOWNLOAD_NAME' => $display_name,
|
|
||||||
'FILESIZE' => $filesize,
|
|
||||||
'COMMENT' => $comment,
|
|
||||||
'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], $attachments['_' . $post_id][$i]['download_count']))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Viewed/Heared File ... update the download count (download.php is not called here)
|
|
||||||
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . '
|
|
||||||
SET download_count = download_count + 1
|
|
||||||
WHERE attach_id = ' . (int) $attachments['_' . $post_id][$i]['attach_id'];
|
|
||||||
|
|
||||||
if ( !(DB()->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($swf)
|
|
||||||
{
|
|
||||||
// Macromedia Flash Files
|
|
||||||
list($width, $height) = swf_getdimension($filename);
|
|
||||||
|
|
||||||
$template->assign_block_vars('postrow.attach.cat_swf', array(
|
|
||||||
'U_DOWNLOAD_LINK' => $filename,
|
|
||||||
'S_UPLOAD_IMAGE' => $upload_image,
|
|
||||||
|
|
||||||
'DOWNLOAD_NAME' => $display_name,
|
|
||||||
'FILESIZE' => $filesize,
|
|
||||||
'COMMENT' => $comment,
|
|
||||||
'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], $attachments['_' . $post_id][$i]['download_count']),
|
|
||||||
'WIDTH' => $width,
|
|
||||||
'HEIGHT' => $height)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Viewed/Heared File ... update the download count (download.php is not called here)
|
|
||||||
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . '
|
|
||||||
SET download_count = download_count + 1
|
|
||||||
WHERE attach_id = ' . (int) $attachments['_' . $post_id][$i]['attach_id'];
|
|
||||||
|
|
||||||
if ( !(DB()->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bt
|
// bt
|
||||||
if ($link && ($attachments['_'. $post_id][$i]['extension'] === TORRENT_EXT))
|
if ($link && ($attachments['_'. $post_id][$i]['extension'] === TORRENT_EXT))
|
||||||
{
|
{
|
||||||
include(BB_ROOT .'attach_mod/displaying_torrent.php');
|
include(BB_ROOT .'attach_mod/displaying_torrent.php');
|
||||||
}
|
}
|
||||||
else if ($link)
|
else if ($link)
|
||||||
//bt end
|
|
||||||
{
|
{
|
||||||
$target_blank = ( (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) ) ? 'target="_blank"' : '';
|
$target_blank = ( (@intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) ) ? 'target="_blank"' : '';
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ else
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain torrent information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain torrent information');
|
||||||
}
|
}
|
||||||
$tor_info = DB()->sql_fetchrow($result);
|
$tor_info = DB()->sql_fetchrow($result);
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
|
|
@ -31,7 +31,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||||
|
|
||||||
if( !($result = DB()->sql_query($sql)) )
|
if( !($result = DB()->sql_query($sql)) )
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Entry', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get entry #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) == 0)
|
if (DB()->num_rows($result) == 0)
|
||||||
|
@ -57,7 +57,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update quota Settings', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update quota settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to delete quota Settings', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to delete quota settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -84,7 +84,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Entry', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get entry #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) == 0)
|
if (DB()->num_rows($result) == 0)
|
||||||
|
@ -100,7 +100,7 @@ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = 0)
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update quota Settings', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update quota settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,8 +168,6 @@ function get_formatted_dirsize()
|
||||||
|
|
||||||
$upload_dir_size = 0;
|
$upload_dir_size = 0;
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ($dirname = @opendir($upload_dir))
|
if ($dirname = @opendir($upload_dir))
|
||||||
{
|
{
|
||||||
while ($file = @readdir($dirname))
|
while ($file = @readdir($dirname))
|
||||||
|
@ -186,43 +184,6 @@ function get_formatted_dirsize()
|
||||||
$upload_dir_size = $lang['NOT_AVAILABLE'];
|
$upload_dir_size = $lang['NOT_AVAILABLE'];
|
||||||
return $upload_dir_size;
|
return $upload_dir_size;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$conn_id = attach_init_ftp();
|
|
||||||
|
|
||||||
$file_listing = array();
|
|
||||||
|
|
||||||
$file_listing = @ftp_rawlist($conn_id, '');
|
|
||||||
|
|
||||||
if (!$file_listing)
|
|
||||||
{
|
|
||||||
$upload_dir_size = $lang['NOT_AVAILABLE'];
|
|
||||||
return $upload_dir_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($file_listing); $i++)
|
|
||||||
{
|
|
||||||
if (preg_match("/([-d])[rwxst-]{9}.* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)/", $file_listing[$i], $regs))
|
|
||||||
{
|
|
||||||
if ($regs[1] == 'd')
|
|
||||||
{
|
|
||||||
$dirinfo[0] = 1; // Directory == 1
|
|
||||||
}
|
|
||||||
$dirinfo[1] = $regs[2]; // Size
|
|
||||||
$dirinfo[2] = $regs[3]; // Date
|
|
||||||
$dirinfo[3] = $regs[4]; // Filename
|
|
||||||
$dirinfo[4] = $regs[5]; // Time
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dirinfo[0] != 1 && $dirinfo[4] != 'index.php' && $dirinfo[4] != '.htaccess')
|
|
||||||
{
|
|
||||||
$upload_dir_size += $dirinfo[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return humn_size($upload_dir_size);
|
return humn_size($upload_dir_size);
|
||||||
}
|
}
|
||||||
|
@ -255,13 +216,11 @@ function search_attachments($order_by, &$total_rows)
|
||||||
$search_author = str_replace('*', '%', attach_mod_sql_escape($search_author));
|
$search_author = str_replace('*', '%', attach_mod_sql_escape($search_author));
|
||||||
|
|
||||||
// We need the post_id's, because we want to query the Attachment Table
|
// We need the post_id's, because we want to query the Attachment Table
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id FROM ' . BB_USERS . " WHERE username LIKE '$search_author'";
|
||||||
FROM ' . BB_USERS . "
|
|
||||||
WHERE username LIKE '$search_author'";
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t obtain list of matching users (searching for: ' . $search_author . ')', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain list of matching users (searching for: ' . $search_author . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
$matching_userids = '';
|
$matching_userids = '';
|
||||||
|
@ -277,7 +236,7 @@ function search_attachments($order_by, &$total_rows)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_ATTACH_SEARCH_MATCH']);
|
bb_die($lang['NO_ATTACH_SEARCH_MATCH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$where_sql[] = ' (t.user_id_1 IN (' . $matching_userids . ')) ';
|
$where_sql[] = ' (t.user_id_1 IN (' . $matching_userids . ')) ';
|
||||||
|
@ -352,7 +311,7 @@ function search_attachments($order_by, &$total_rows)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachments = DB()->sql_fetchrowset($result);
|
$attachments = DB()->sql_fetchrowset($result);
|
||||||
|
@ -361,12 +320,12 @@ function search_attachments($order_by, &$total_rows)
|
||||||
|
|
||||||
if ($num_attach == 0)
|
if ($num_attach == 0)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_ATTACH_SEARCH_MATCH']);
|
bb_die($lang['NO_ATTACH_SEARCH_MATCH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($total_rows_sql)))
|
if (!($result = DB()->sql_query($total_rows_sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_rows = DB()->num_rows($result);
|
$total_rows = DB()->num_rows($result);
|
||||||
|
|
|
@ -179,46 +179,6 @@ function is_forum_authed($auth_cache, $check_forum_id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Init FTP Session
|
|
||||||
*/
|
|
||||||
function attach_init_ftp($mode = false)
|
|
||||||
{
|
|
||||||
global $lang, $attach_config;
|
|
||||||
|
|
||||||
$server = (trim($attach_config['ftp_server']) == '') ? 'localhost' : trim($attach_config['ftp_server']);
|
|
||||||
|
|
||||||
$ftp_path = ($mode == MODE_THUMBNAIL) ? trim($attach_config['ftp_path']) . '/' . THUMB_DIR : trim($attach_config['ftp_path']);
|
|
||||||
|
|
||||||
$conn_id = @ftp_connect($server);
|
|
||||||
|
|
||||||
if (!$conn_id)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, sprintf($lang['FTP_ERROR_CONNECT'], $server));
|
|
||||||
}
|
|
||||||
|
|
||||||
$login_result = @ftp_login($conn_id, $attach_config['ftp_user'], $attach_config['ftp_pass']);
|
|
||||||
|
|
||||||
if (!$login_result)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, sprintf($lang['FTP_ERROR_LOGIN'], $attach_config['ftp_user']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, $lang['FTP_ERROR_PASV_MODE']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = @ftp_chdir($conn_id, $ftp_path);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, sprintf($lang['FTP_ERROR_PATH'], $ftp_path));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $conn_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an Attachment
|
* Deletes an Attachment
|
||||||
*/
|
*/
|
||||||
|
@ -228,8 +188,6 @@ function unlink_attach($filename, $mode = false)
|
||||||
|
|
||||||
$filename = basename($filename);
|
$filename = basename($filename);
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ($mode == MODE_THUMBNAIL)
|
if ($mode == MODE_THUMBNAIL)
|
||||||
{
|
{
|
||||||
$filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $filename;
|
$filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $filename;
|
||||||
|
@ -241,70 +199,9 @@ function unlink_attach($filename, $mode = false)
|
||||||
|
|
||||||
$deleted = @unlink($filename);
|
$deleted = @unlink($filename);
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$conn_id = attach_init_ftp($mode);
|
|
||||||
|
|
||||||
if ($mode == MODE_THUMBNAIL)
|
|
||||||
{
|
|
||||||
$filename = 't_' . $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = @ftp_delete($conn_id, $filename);
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
return $deleted;
|
return $deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
$deleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $deleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FTP File to Location
|
|
||||||
*/
|
|
||||||
function ftp_file($source_file, $dest_file, $mimetype, $disable_error_mode = false)
|
|
||||||
{
|
|
||||||
global $attach_config, $lang, $error, $error_msg;
|
|
||||||
|
|
||||||
$conn_id = attach_init_ftp();
|
|
||||||
|
|
||||||
// Binary or Ascii ?
|
|
||||||
$mode = FTP_BINARY;
|
|
||||||
if (preg_match("/text/i", $mimetype) || preg_match("/html/i", $mimetype))
|
|
||||||
{
|
|
||||||
$mode = FTP_ASCII;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = @ftp_put($conn_id, $dest_file, $source_file, $mode);
|
|
||||||
|
|
||||||
if (!$res && !$disable_error_mode)
|
|
||||||
{
|
|
||||||
$error = true;
|
|
||||||
if (!empty($error_msg))
|
|
||||||
{
|
|
||||||
$error_msg .= '<br />';
|
|
||||||
}
|
|
||||||
$error_msg = sprintf($lang['FTP_ERROR_UPLOAD'], $attach_config['ftp_path']) . '<br />';
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_site($conn_id, 'CHMOD 0644 ' . $dest_file);
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Attachment exist
|
* Check if Attachment exist
|
||||||
*/
|
*/
|
||||||
|
@ -314,8 +211,6 @@ function attachment_exists($filename)
|
||||||
|
|
||||||
$filename = basename($filename);
|
$filename = basename($filename);
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if (!@file_exists(@amod_realpath($upload_dir . '/' . $filename)))
|
if (!@file_exists(@amod_realpath($upload_dir . '/' . $filename)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -325,41 +220,6 @@ function attachment_exists($filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$found = false;
|
|
||||||
|
|
||||||
$conn_id = attach_init_ftp();
|
|
||||||
|
|
||||||
$file_listing = array();
|
|
||||||
|
|
||||||
$file_listing = @ftp_rawlist($conn_id, $filename);
|
|
||||||
|
|
||||||
for ($i = 0, $size = sizeof($file_listing); $i < $size; $i++)
|
|
||||||
{
|
|
||||||
if (preg_match("/([-d])[rwxst-]{9}.* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)/", $file_listing[$i], $regs))
|
|
||||||
{
|
|
||||||
if ($regs[1] == 'd')
|
|
||||||
{
|
|
||||||
$dirinfo[0] = 1; // Directory == 1
|
|
||||||
}
|
|
||||||
$dirinfo[1] = $regs[2]; // Size
|
|
||||||
$dirinfo[2] = $regs[3]; // Date
|
|
||||||
$dirinfo[3] = $regs[4]; // Filename
|
|
||||||
$dirinfo[4] = $regs[5]; // Time
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dirinfo[0] != 1 && $dirinfo[4] == $filename)
|
|
||||||
{
|
|
||||||
$found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
return $found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Thumbnail exist
|
* Check if Thumbnail exist
|
||||||
|
@ -370,8 +230,6 @@ function thumbnail_exists($filename)
|
||||||
|
|
||||||
$filename = basename($filename);
|
$filename = basename($filename);
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if (!@file_exists(@amod_realpath($upload_dir . '/' . THUMB_DIR . '/t_' . $filename)))
|
if (!@file_exists(@amod_realpath($upload_dir . '/' . THUMB_DIR . '/t_' . $filename)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -381,42 +239,6 @@ function thumbnail_exists($filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$found = false;
|
|
||||||
|
|
||||||
$conn_id = attach_init_ftp(MODE_THUMBNAIL);
|
|
||||||
|
|
||||||
$file_listing = array();
|
|
||||||
|
|
||||||
$filename = 't_' . $filename;
|
|
||||||
$file_listing = @ftp_rawlist($conn_id, $filename);
|
|
||||||
|
|
||||||
for ($i = 0, $size = sizeof($file_listing); $i < $size; $i++)
|
|
||||||
{
|
|
||||||
if (preg_match("/([-d])[rwxst-]{9}.* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)/", $file_listing[$i], $regs))
|
|
||||||
{
|
|
||||||
if ($regs[1] == 'd')
|
|
||||||
{
|
|
||||||
$dirinfo[0] = 1; // Directory == 1
|
|
||||||
}
|
|
||||||
$dirinfo[1] = $regs[2]; // Size
|
|
||||||
$dirinfo[2] = $regs[3]; // Date
|
|
||||||
$dirinfo[3] = $regs[4]; // Filename
|
|
||||||
$dirinfo[4] = $regs[5]; // Time
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dirinfo[0] != 1 && $dirinfo[4] == $filename)
|
|
||||||
{
|
|
||||||
$found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
return $found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Physical Filename stored already ?
|
* Physical Filename stored already ?
|
||||||
|
@ -437,7 +259,7 @@ function physical_filename_already_stored($filename)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get attachment information for filename: ' . htmlspecialchars($filename), '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get attachment information for filename: ' . htmlspecialchars($filename));
|
||||||
}
|
}
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
@ -484,7 +306,7 @@ function get_attachments_from_post($post_id_array)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Attachment Informations for post number ' . $post_id_array, '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get attachment informations for post number ' . $post_id_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
|
@ -516,13 +338,11 @@ function get_total_attach_filesize($attach_ids)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT filesize
|
$sql = 'SELECT filesize FROM ' . BB_ATTACHMENTS_DESC . " WHERE attach_id IN ($attach_ids)";
|
||||||
FROM ' . BB_ATTACHMENTS_DESC . "
|
|
||||||
WHERE attach_id IN ($attach_ids)";
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Total Filesize', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query total filesize');
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_filesize = 0;
|
$total_filesize = 0;
|
||||||
|
@ -659,7 +479,7 @@ function user_in_group($user_id, $group_id)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get User Group', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get user group');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
|
|
|
@ -49,7 +49,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not select ids', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select ids');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_post_list = DB()->num_rows($result);
|
$num_post_list = DB()->num_rows($result);
|
||||||
|
@ -110,7 +110,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not select Attachment Ids', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select attachment id #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_attach_list = DB()->num_rows($result);
|
$num_attach_list = DB()->num_rows($result);
|
||||||
|
@ -162,19 +162,17 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_DELETED_ATTACHMENTS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//bt
|
//bt
|
||||||
if ($sql_id == 'post_id')
|
if ($sql_id == 'post_id')
|
||||||
{
|
{
|
||||||
$sql = "SELECT topic_id
|
$sql = "SELECT topic_id FROM ". BB_BT_TORRENTS ." WHERE attach_id IN(". implode(',', $attach_id_array) .")";
|
||||||
FROM ". BB_BT_TORRENTS ."
|
|
||||||
WHERE attach_id IN(". implode(',', $attach_id_array) .")";
|
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_DELETED_ATTACHMENTS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$torrents_sql = array();
|
$torrents_sql = array();
|
||||||
|
@ -192,7 +190,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete peers', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete peers');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete torrents
|
// Delete torrents
|
||||||
|
@ -201,7 +199,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_DELETED_ATTACHMENTS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//bt end
|
//bt end
|
||||||
|
@ -214,7 +212,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not select Attachment Ids', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select Attachment id #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
|
@ -228,7 +226,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attach description table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attach description table');
|
||||||
}
|
}
|
||||||
$num_rows = DB()->num_rows($result);
|
$num_rows = DB()->num_rows($result);
|
||||||
|
|
||||||
|
@ -248,12 +246,11 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
unlink_attach($attachments[$j]['physical_filename'], MODE_THUMBNAIL);
|
unlink_attach($attachments[$j]['physical_filename'], MODE_THUMBNAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . BB_ATTACHMENTS_DESC . '
|
$sql = 'DELETE FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int) $attachments[$j]['attach_id'];
|
||||||
WHERE attach_id = ' . (int) $attachments[$j]['attach_id'];
|
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_DELETED_ATTACHMENTS'], '', __LINE__, __FILE__, $sql);
|
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +272,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t select Topic ID', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not select topic id');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
|
|
@ -291,112 +291,3 @@ function image_getdimension($file)
|
||||||
|
|
||||||
return $size;
|
return $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Flash MX Support
|
|
||||||
* Routines and Methods are from PhpAdsNew (www.sourceforge.net/projects/phpadsnew)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
define('swf_tag_compressed', chr(0x43).chr(0x57).chr(0x53));
|
|
||||||
define('swf_tag_identify', chr(0x46).chr(0x57).chr(0x53));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get flash bits
|
|
||||||
*/
|
|
||||||
function swf_bits($buffer, $pos, $count)
|
|
||||||
{
|
|
||||||
$result = 0;
|
|
||||||
|
|
||||||
for ($loop = $pos; $loop < $pos + $count; $loop++)
|
|
||||||
{
|
|
||||||
$result = $result + ((((ord($buffer[(int)($loop / 8)])) >> (7 - ($loop % 8))) & 0x01) << ($count - ($loop - $pos) - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* decompress flash contents
|
|
||||||
*/
|
|
||||||
function swf_decompress($buffer)
|
|
||||||
{
|
|
||||||
if ((function_exists('gzuncompress')) && (substr($buffer, 0, 3) == swf_tag_compressed) && (ord(substr($buffer, 3, 1)) >= 6) )
|
|
||||||
{
|
|
||||||
// Only decompress relevant Informations
|
|
||||||
$output = 'F';
|
|
||||||
$output .= substr ($buffer, 1, 7);
|
|
||||||
$output .= gzuncompress (substr ($buffer, 8));
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get flash dimension
|
|
||||||
*/
|
|
||||||
function swf_getdimension($file)
|
|
||||||
{
|
|
||||||
$size = @getimagesize($file);
|
|
||||||
|
|
||||||
if ($size[0] != 0 || $size[1] != 0)
|
|
||||||
{
|
|
||||||
return $size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to get the Dimension manually
|
|
||||||
$fp = @fopen($file, 'rb');
|
|
||||||
if (!$fp)
|
|
||||||
{
|
|
||||||
return $size;
|
|
||||||
}
|
|
||||||
|
|
||||||
$error = false;
|
|
||||||
|
|
||||||
// SWF - FLASH FILE
|
|
||||||
$fp = @fopen($file, 'rb');
|
|
||||||
|
|
||||||
// Decompress if file is a Flash MX compressed file
|
|
||||||
$buffer = fread($fp, 1024);
|
|
||||||
|
|
||||||
if (substr($buffer, 0, 3) == swf_tag_identify || substr($buffer, 0, 3) == swf_tag_compressed)
|
|
||||||
{
|
|
||||||
if (substr($buffer, 0, 3) == swf_tag_compressed)
|
|
||||||
{
|
|
||||||
fclose($fp);
|
|
||||||
$fp = @fopen($file, 'rb');
|
|
||||||
$buffer = fread($fp, filesize($file));
|
|
||||||
$buffer = swf_decompress($buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get size of rect structure
|
|
||||||
$bits = swf_bits ($buffer, 64, 5);
|
|
||||||
|
|
||||||
// Get rect
|
|
||||||
$width = (int)(swf_bits ($buffer, 69 + $bits, $bits) - swf_bits ($buffer, 69, $bits)) / 20;
|
|
||||||
$height = (int)(swf_bits ($buffer, 69 + (3 * $bits), $bits) - swf_bits ($buffer, 69 + (2 * $bits), $bits)) / 20;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
fclose($fp);
|
|
||||||
return array(
|
|
||||||
$width,
|
|
||||||
$height,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
return $size;
|
|
||||||
}
|
|
|
@ -40,8 +40,6 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
{
|
{
|
||||||
global $template, $lang, $attach_config;
|
global $template, $lang, $attach_config;
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
if ($attach_config['upload_dir'][0] == '/' || ($attach_config['upload_dir'][0] != '/' && $attach_config['upload_dir'][1] == ':'))
|
||||||
{
|
{
|
||||||
$upload_dir = $attach_config['upload_dir'];
|
$upload_dir = $attach_config['upload_dir'];
|
||||||
|
@ -50,11 +48,6 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
{
|
{
|
||||||
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
$upload_dir = BB_ROOT . $attach_config['upload_dir'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_dir = $attach_config['download_path'];
|
|
||||||
}
|
|
||||||
|
|
||||||
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
include(BB_ROOT .'attach_mod/includes/functions_selects.php');
|
||||||
if (!function_exists("process_quota_settings"))
|
if (!function_exists("process_quota_settings"))
|
||||||
|
@ -74,7 +67,7 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
|
|
||||||
if (!$user_id && !$u_name)
|
if (!$user_id && !$u_name)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_USER_ID_SPECIFIED'] );
|
bb_die($lang['NO_USER_ID_SPECIFIED'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_id)
|
if ($user_id)
|
||||||
|
@ -95,7 +88,7 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
|
|
||||||
if (!$user_id)
|
if (!$user_id)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_USER_ID_SPECIFIED'] );
|
bb_die($lang['NO_USER_ID_SPECIFIED'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,12 +96,11 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
if ($admin_mode == 'user' && !$submit && $mode != 'save')
|
if ($admin_mode == 'user' && !$submit && $mode != 'save')
|
||||||
{
|
{
|
||||||
// Show the contents
|
// Show the contents
|
||||||
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . '
|
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE user_id = ' . (int) $user_id;
|
||||||
WHERE user_id = ' . (int) $user_id;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to get Quota Settings', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to get quota settings #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pm_quota = $upload_quota = 0;
|
$pm_quota = $upload_quota = 0;
|
||||||
|
@ -169,12 +161,11 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
|
||||||
$group_id = get_var(POST_GROUPS_URL, 0);
|
$group_id = get_var(POST_GROUPS_URL, 0);
|
||||||
|
|
||||||
// Show the contents
|
// Show the contents
|
||||||
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . '
|
$sql = 'SELECT quota_limit_id, quota_type FROM ' . BB_QUOTA . ' WHERE group_id = ' . (int) $group_id;
|
||||||
WHERE group_id = ' . (int) $group_id;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to get Quota Settings', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to get quota settings #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pm_quota = $upload_quota = 0;
|
$pm_quota = $upload_quota = 0;
|
||||||
|
|
|
@ -11,13 +11,11 @@ function group_select($select_name, $default_group = 0)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
$sql = 'SELECT group_id, group_name
|
$sql = 'SELECT group_id, group_name FROM ' . BB_EXTENSION_GROUPS . ' ORDER BY group_name';
|
||||||
FROM ' . BB_EXTENSION_GROUPS . '
|
|
||||||
ORDER BY group_name';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't query Extension Groups Table", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query extension groups table #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$group_select = '<select name="' . $select_name . '">';
|
$group_select = '<select name="' . $select_name . '">';
|
||||||
|
@ -66,7 +64,7 @@ function download_select($select_name, $group_id = 0)
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't query Extension Groups Table", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query extension groups table #2');
|
||||||
}
|
}
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
@ -107,12 +105,11 @@ function category_select($select_name, $group_id = 0)
|
||||||
{
|
{
|
||||||
global $types_category, $modes_category;
|
global $types_category, $modes_category;
|
||||||
|
|
||||||
$sql = 'SELECT group_id, cat_id
|
$sql = 'SELECT group_id, cat_id FROM ' . BB_EXTENSION_GROUPS;
|
||||||
FROM ' . BB_EXTENSION_GROUPS;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't select Category", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not select category');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -192,13 +189,11 @@ function quota_limit_select($select_name, $default_quota = 0)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
$sql = 'SELECT quota_limit_id, quota_desc
|
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
|
||||||
FROM ' . BB_QUOTA_LIMITS . '
|
|
||||||
ORDER BY quota_limit ASC';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't query Quota Limits Table", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query quota limits table #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$quota_select = '<select name="' . $select_name . '">';
|
$quota_select = '<select name="' . $select_name . '">';
|
||||||
|
@ -228,13 +223,11 @@ function default_quota_limit_select($select_name, $default_quota = 0)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
$sql = 'SELECT quota_limit_id, quota_desc
|
$sql = 'SELECT quota_limit_id, quota_desc FROM ' . BB_QUOTA_LIMITS . ' ORDER BY quota_limit ASC';
|
||||||
FROM ' . BB_QUOTA_LIMITS . '
|
|
||||||
ORDER BY quota_limit ASC';
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't query Quota Limits Table", "", __LINE__, __FILE__, $sql);
|
bb_die('Could not query quota limits table #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$quota_select = '<select name="' . $select_name . '">';
|
$quota_select = '<select name="' . $select_name . '">';
|
||||||
|
|
|
@ -114,33 +114,6 @@ function create_thumbnail($source, $new_file, $mimetype)
|
||||||
|
|
||||||
$tmp_path = $old_file = '';
|
$tmp_path = $old_file = '';
|
||||||
|
|
||||||
if (intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
$old_file = $new_file;
|
|
||||||
|
|
||||||
$tmp_path = explode('/', $source);
|
|
||||||
$tmp_path[count($tmp_path)-1] = '';
|
|
||||||
$tmp_path = implode('/', $tmp_path);
|
|
||||||
|
|
||||||
if ($tmp_path == '')
|
|
||||||
{
|
|
||||||
$tmp_path = '/tmp';
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = trim($tmp_path);
|
|
||||||
|
|
||||||
if ($value[strlen($value)-1] == '/')
|
|
||||||
{
|
|
||||||
$value[strlen($value)-1] = ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
$new_file = tempnam(trim($value), 't00000');
|
|
||||||
|
|
||||||
// We remove it now because it gets created again later
|
|
||||||
@unlink($new_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
$used_imagick = false;
|
$used_imagick = false;
|
||||||
|
|
||||||
if (is_imagick())
|
if (is_imagick())
|
||||||
|
@ -210,20 +183,7 @@ function create_thumbnail($source, $new_file, $mimetype)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
$result = ftp_file($new_file, $old_file, $mimetype, true); // True for disable error-mode
|
|
||||||
@unlink($new_file);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@chmod($new_file, 0664);
|
@chmod($new_file, 0664);
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -94,7 +94,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get User Group', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get user group');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -121,7 +121,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Group Quota', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get group quota');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) > 0)
|
if (DB()->num_rows($result) > 0)
|
||||||
|
@ -147,7 +147,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get User Quota', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get user quota');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) > 0)
|
if (DB()->num_rows($result) > 0)
|
||||||
|
@ -178,7 +178,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get Default Quota Limit', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get default quota limit');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) > 0)
|
if (DB()->num_rows($result) > 0)
|
||||||
|
@ -425,13 +425,11 @@ class attach_parent
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . '
|
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET thumbnail = 0 WHERE attach_id = ' . (int) $actual_id_list[$i];
|
||||||
SET thumbnail = 0
|
|
||||||
WHERE attach_id = ' . (int) $actual_id_list[$i];
|
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update ' . BB_ATTACHMENTS_DESC . ' Table.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update ' . BB_ATTACHMENTS_DESC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,7 +488,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to select old Attachment Entry.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to select old attachment entry');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->num_rows($result) != 1)
|
if (DB()->num_rows($result) != 1)
|
||||||
|
@ -525,7 +523,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update the Attachment.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update the attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the Old Attachment
|
// Delete the Old Attachment
|
||||||
|
@ -637,7 +635,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update the File Comment.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update the file comment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -663,7 +661,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t store Attachment.<br />Your ' . $message_type . ' has been stored.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not store Attachment.<br />Your '. $message_type .' has been stored');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_id = DB()->sql_nextid();
|
$attach_id = DB()->sql_nextid();
|
||||||
|
@ -685,7 +683,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t store Attachment.<br />Your ' . $message_type . ' has been stored.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not store Attachment.<br />Your '. $message_type .' has been stored');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,7 +712,7 @@ class attach_parent
|
||||||
// Inform the user that his post has been created, but nothing is attached
|
// Inform the user that his post has been created, but nothing is attached
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t store Attachment.<br />Your ' . $message_type . ' has been stored.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not store Attachment.<br />Your '. $message_type .' has been stored');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_id = DB()->sql_nextid();
|
$attach_id = DB()->sql_nextid();
|
||||||
|
@ -729,7 +727,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t store Attachment.<br />Your ' . $message_type . ' has been stored.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not store Attachment.<br />Your '. $message_type .' has been stored');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,18 +846,15 @@ class attach_parent
|
||||||
|
|
||||||
if ($this->post_attach)
|
if ($this->post_attach)
|
||||||
{
|
{
|
||||||
// $r_file = trim(basename(htmlspecialchars($this->filename)));
|
|
||||||
$r_file = trim(basename($this->filename));
|
$r_file = trim(basename($this->filename));
|
||||||
$file = $_FILES['fileupload']['tmp_name'];
|
$file = $_FILES['fileupload']['tmp_name'];
|
||||||
$this->type = $_FILES['fileupload']['type'];
|
$this->type = $_FILES['fileupload']['type'];
|
||||||
|
|
||||||
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] == 0)
|
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] == 0)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Tried to upload empty file');
|
bb_die('Tried to upload empty file');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opera add the name to the mime type
|
|
||||||
$this->type = (strstr($this->type, '; name')) ? str_replace(strstr($this->type, '; name'), '', $this->type) : $this->type;
|
|
||||||
$this->type = strtolower($this->type);
|
$this->type = strtolower($this->type);
|
||||||
$this->extension = strtolower(get_extension($this->filename));
|
$this->extension = strtolower(get_extension($this->filename));
|
||||||
|
|
||||||
|
@ -874,7 +869,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query Extensions.', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query extensions');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -903,7 +898,7 @@ class attach_parent
|
||||||
{
|
{
|
||||||
$error_msg .= '<br />';
|
$error_msg .= '<br />';
|
||||||
}
|
}
|
||||||
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
|
$ini_val = 'ini_get';
|
||||||
|
|
||||||
$max_size = @$ini_val('upload_max_filesize');
|
$max_size = @$ini_val('upload_max_filesize');
|
||||||
|
|
||||||
|
@ -1008,7 +1003,7 @@ class attach_parent
|
||||||
}
|
}
|
||||||
if ($i == $max_try)
|
if ($i == $max_try)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not create filename for attachment', '', __LINE__, __FILE__);
|
bb_die('Could not create filename for attachment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attach_filename = $new_physical_filename;
|
$this->attach_filename = $new_physical_filename;
|
||||||
|
@ -1028,25 +1023,16 @@ class attach_parent
|
||||||
|
|
||||||
// Upload Attachment
|
// Upload Attachment
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
|
||||||
if (!(intval($attach_config['allow_ftp_upload'])))
|
|
||||||
{
|
{
|
||||||
// Descide the Upload method
|
// Descide the Upload method
|
||||||
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
|
$ini_val = 'ini_get';
|
||||||
|
|
||||||
$safe_mode = @$ini_val('safe_mode');
|
$safe_mode = @$ini_val('safe_mode');
|
||||||
|
|
||||||
if (@$ini_val('open_basedir'))
|
if (@$ini_val('open_basedir'))
|
||||||
{
|
|
||||||
if ( @phpversion() < '4.0.3' )
|
|
||||||
{
|
|
||||||
$upload_mode = 'copy';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$upload_mode = 'move';
|
$upload_mode = 'move';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if ( @$ini_val('safe_mode') )
|
else if ( @$ini_val('safe_mode') )
|
||||||
{
|
{
|
||||||
$upload_mode = 'move';
|
$upload_mode = 'move';
|
||||||
|
@ -1055,11 +1041,6 @@ class attach_parent
|
||||||
{
|
{
|
||||||
$upload_mode = 'copy';
|
$upload_mode = 'copy';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$upload_mode = 'ftp';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ok, upload the Attachment
|
// Ok, upload the Attachment
|
||||||
if (!$error)
|
if (!$error)
|
||||||
|
@ -1071,7 +1052,7 @@ class attach_parent
|
||||||
// Now, check filesize parameters
|
// Now, check filesize parameters
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if ($upload_mode != 'ftp' && !$this->filesize)
|
if (!$this->filesize)
|
||||||
{
|
{
|
||||||
$this->filesize = intval(@filesize($upload_dir . '/' . $this->attach_filename));
|
$this->filesize = intval(@filesize($upload_dir . '/' . $this->attach_filename));
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1097,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query total filesize', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query total filesize #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -1148,7 +1129,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachments');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_ids = DB()->sql_fetchrowset($result);
|
$attach_ids = DB()->sql_fetchrowset($result);
|
||||||
|
@ -1171,7 +1152,7 @@ class attach_parent
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query total filesize', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query total filesize #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -1215,14 +1196,14 @@ class attach_parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the temporary attachment to the right location (copy, move_uploaded_file or ftp)
|
// Copy the temporary attachment to the right location (copy, move_uploaded_file)
|
||||||
function move_uploaded_attachment($upload_mode, $file)
|
function move_uploaded_attachment($upload_mode, $file)
|
||||||
{
|
{
|
||||||
global $error, $error_msg, $lang, $upload_dir;
|
global $error, $error_msg, $lang, $upload_dir;
|
||||||
|
|
||||||
if (!is_uploaded_file($file))
|
if (!is_uploaded_file($file))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to upload file. The given source has not been uploaded.', __LINE__, __FILE__);
|
bb_die('Unable to upload file. The given source has not been uploaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($upload_mode)
|
switch ($upload_mode)
|
||||||
|
@ -1264,25 +1245,13 @@ class attach_parent
|
||||||
@chmod($upload_dir . '/' . $this->attach_filename, 0666);
|
@chmod($upload_dir . '/' . $this->attach_filename, 0666);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ftp':
|
|
||||||
ftp_file($file, basename($this->attach_filename), $this->type);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && $this->thumbnail == 1)
|
if (!$error && $this->thumbnail == 1)
|
||||||
{
|
|
||||||
if ($upload_mode == 'ftp')
|
|
||||||
{
|
|
||||||
$source = $file;
|
|
||||||
$dest_file = THUMB_DIR . '/t_' . basename($this->attach_filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$source = $upload_dir . '/' . basename($this->attach_filename);
|
$source = $upload_dir . '/' . basename($this->attach_filename);
|
||||||
$dest_file = amod_realpath($upload_dir);
|
$dest_file = amod_realpath($upload_dir);
|
||||||
$dest_file .= '/' . THUMB_DIR . '/t_' . basename($this->attach_filename);
|
$dest_file .= '/' . THUMB_DIR . '/t_' . basename($this->attach_filename);
|
||||||
}
|
|
||||||
|
|
||||||
if (!create_thumbnail($source, $dest_file, $this->type))
|
if (!create_thumbnail($source, $dest_file, $this->type))
|
||||||
{
|
{
|
||||||
|
@ -1325,34 +1294,28 @@ class attach_posting extends attach_parent
|
||||||
|
|
||||||
if ((sizeof($this->attachment_list) > 0 || $this->post_attach) && !isset($_POST['update_attachment']))
|
if ((sizeof($this->attachment_list) > 0 || $this->post_attach) && !isset($_POST['update_attachment']))
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . BB_POSTS . '
|
$sql = 'UPDATE ' . BB_POSTS . ' SET post_attachment = 1 WHERE post_id = ' . (int) $post_id;
|
||||||
SET post_attachment = 1
|
|
||||||
WHERE post_id = ' . (int) $post_id;
|
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update Posts Table.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update posts table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT topic_id
|
$sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int) $post_id;
|
||||||
FROM ' . BB_POSTS . '
|
|
||||||
WHERE post_id = ' . (int) $post_id;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to select Posts Table.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to select posts table');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . BB_TOPICS . '
|
$sql = 'UPDATE ' . BB_TOPICS . ' SET topic_attachment = 1 WHERE topic_id = ' . (int) $row['topic_id'];
|
||||||
SET topic_attachment = 1
|
|
||||||
WHERE topic_id = ' . (int) $row['topic_id'];
|
|
||||||
|
|
||||||
if (!(DB()->sql_query($sql)))
|
if (!(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Unable to update Topics Table.', '', __LINE__, __FILE__, $sql);
|
bb_die('Unable to update topics table');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
Order Deny,Allow
|
order allow,deny
|
||||||
Deny from all
|
deny from all
|
||||||
Allow from local.
|
|
|
@ -12,7 +12,7 @@ function tracker_exit ()
|
||||||
{
|
{
|
||||||
global $DBS;
|
global $DBS;
|
||||||
|
|
||||||
if (DBG_LOG && DBG_LOG_GENTIME)
|
if (DBG_LOG && DBG_TRACKER)
|
||||||
{
|
{
|
||||||
if ($gen_time = utime() - TIMESTART)
|
if ($gen_time = utime() - TIMESTART)
|
||||||
{
|
{
|
||||||
|
@ -44,10 +44,7 @@ function error_exit ($msg = '')
|
||||||
{
|
{
|
||||||
if (DBG_LOG) dbg_log(' ', '!err-'. clean_filename($msg));
|
if (DBG_LOG) dbg_log(' ', '!err-'. clean_filename($msg));
|
||||||
|
|
||||||
if (!DEBUG)
|
|
||||||
{
|
|
||||||
silent_exit();
|
silent_exit();
|
||||||
}
|
|
||||||
|
|
||||||
echo bencode(array('failure reason' => str_compact($msg)));
|
echo bencode(array('failure reason' => str_compact($msg)));
|
||||||
|
|
||||||
|
@ -430,7 +427,7 @@ class sql_db
|
||||||
{
|
{
|
||||||
if (!$msg) $msg = 'DB Error';
|
if (!$msg) $msg = 'DB Error';
|
||||||
|
|
||||||
if (DEBUG === true)
|
if (DBG_TRACKER === true)
|
||||||
{
|
{
|
||||||
$err = $this->sql_error();
|
$err = $this->sql_error();
|
||||||
$msg .= trim(sprintf(' #%06d %s', $err['code'], $err['message']));
|
$msg .= trim(sprintf(' #%06d %s', $err['code'], $err['message']));
|
||||||
|
|
|
@ -3,3 +3,6 @@ Disallow: /bt/
|
||||||
|
|
||||||
User-agent: Yandex
|
User-agent: Yandex
|
||||||
Disallow: /bt/
|
Disallow: /bt/
|
||||||
|
|
||||||
|
User-agent: YandexBot
|
||||||
|
Disallow: /bt/
|
2
upload/cache/.htaccess
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
order allow,deny
|
||||||
|
deny from all
|
2
upload/cache/filecache/.htaccess
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
order allow,deny
|
||||||
|
deny from all
|
|
@ -87,7 +87,7 @@ function topic_info ($topic_id)
|
||||||
|
|
||||||
if (!$torrent = DB()->fetch_row($sql))
|
if (!$torrent = DB()->fetch_row($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['TOPIC_POST_NOT_EXIST']);
|
bb_die($lang['TOPIC_POST_NOT_EXIST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $torrent;
|
return $torrent;
|
||||||
|
|
|
@ -26,7 +26,7 @@ define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $b
|
||||||
unset($server_protocol, $server_port);
|
unset($server_protocol, $server_port);
|
||||||
|
|
||||||
// Debug options
|
// Debug options
|
||||||
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG]) || DEBUG === true));
|
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG])));
|
||||||
|
|
||||||
// Board/Tracker shared constants and functions
|
// Board/Tracker shared constants and functions
|
||||||
define('BB_BT_TORRENTS', 'bb_bt_torrents');
|
define('BB_BT_TORRENTS', 'bb_bt_torrents');
|
||||||
|
@ -2065,7 +2065,7 @@ function make_rand_str ($len = 10)
|
||||||
return substr($str, 0, $len);
|
return substr($str, 0, $len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bencode: based on OpenTracker [http://whitsoftdev.com/opentracker]
|
// bencode: based on OpenTracker
|
||||||
function bencode ($var)
|
function bencode ($var)
|
||||||
{
|
{
|
||||||
if (is_string($var))
|
if (is_string($var))
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Domain name
|
||||||
|
* Version info
|
||||||
* Database
|
* Database
|
||||||
|
- Charset
|
||||||
|
- Config
|
||||||
|
- Aliases
|
||||||
* Cache
|
* Cache
|
||||||
- Tracker Cache
|
- Config
|
||||||
- Forum Cache
|
|
||||||
- Session Cache
|
|
||||||
- Datastore
|
- Datastore
|
||||||
|
* Server
|
||||||
|
- Cloudflare
|
||||||
|
- Script versions
|
||||||
|
- Backup script
|
||||||
|
- GZip
|
||||||
* Tracker
|
* Tracker
|
||||||
|
* FAQ url
|
||||||
* Torrents
|
* Torrents
|
||||||
- Ratio limits
|
- Ratio limits
|
||||||
- Seeding torrents limit
|
- Seeding torrents limit
|
||||||
|
@ -15,12 +24,10 @@
|
||||||
- Tor-Stats (days to keep)
|
- Tor-Stats (days to keep)
|
||||||
- Tor-Help
|
- Tor-Help
|
||||||
* Path
|
* Path
|
||||||
|
* URL's
|
||||||
* Language
|
* Language
|
||||||
* Templates
|
* Templates
|
||||||
* Cookie
|
* Cookie
|
||||||
* Server
|
|
||||||
- Backup
|
|
||||||
- GZip
|
|
||||||
* Sessions
|
* Sessions
|
||||||
* Registration
|
* Registration
|
||||||
* Email
|
* Email
|
||||||
|
@ -29,20 +36,26 @@
|
||||||
* Special users (dbg_users, unlimited_users, super_admins)
|
* Special users (dbg_users, unlimited_users, super_admins)
|
||||||
* LOG
|
* LOG
|
||||||
* Error reporting
|
* Error reporting
|
||||||
|
* Triggers
|
||||||
|
* Date format
|
||||||
|
|
||||||
* Subforums
|
* Subforums
|
||||||
* Forums
|
* Forums
|
||||||
* Topics
|
* Topics
|
||||||
* Posts
|
* Posts
|
||||||
* Search
|
* Search
|
||||||
|
* Posting
|
||||||
|
* PM
|
||||||
* Actions log
|
* Actions log
|
||||||
* Users
|
* Users
|
||||||
* GroupCP
|
* GroupCP
|
||||||
|
|
||||||
|
* Tidy
|
||||||
* Ads
|
* Ads
|
||||||
|
* Attachments
|
||||||
|
* Avatars
|
||||||
* Misc
|
* Misc
|
||||||
* Captcha
|
* Captcha
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
@ -50,13 +63,13 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
$bb_cfg = $tr_cfg = $page_cfg = array();
|
$bb_cfg = $tr_cfg = $page_cfg = array();
|
||||||
|
|
||||||
// Primary domain name
|
// Primary domain name
|
||||||
$domain_name = 'torrentpier.me'; // Enter here your primary domain name of your site
|
$domain_name = 'torrentpier.me'; // enter here your primary domain name of your site
|
||||||
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
|
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Version info
|
||||||
$bb_cfg['tp_version'] = '2.6 (RC)';
|
$bb_cfg['tp_version'] = '2.0.9 (RC)';
|
||||||
$bb_cfg['tp_release_date'] = '13-07-2014';
|
$bb_cfg['tp_release_date'] = '30-07-2014';
|
||||||
$bb_cfg['tp_release_state'] = 'R591';
|
$bb_cfg['tp_release_state'] = 'R592';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
@ -88,7 +101,7 @@ $bb_cfg['db_alias'] = array(
|
||||||
// Cache
|
// Cache
|
||||||
$bb_cfg['cache']['pconnect'] = true;
|
$bb_cfg['cache']['pconnect'] = true;
|
||||||
$bb_cfg['cache']['db_dir'] = realpath(BB_ROOT) .'/cache/filecache/';
|
$bb_cfg['cache']['db_dir'] = realpath(BB_ROOT) .'/cache/filecache/';
|
||||||
$bb_cfg['cache']['prefix'] = ''; // Префикс кеша 'tp_2'
|
$bb_cfg['cache']['prefix'] = 'tp_'; // Префикс кеша 'tp_2'
|
||||||
$bb_cfg['cache']['memcache'] = array(
|
$bb_cfg['cache']['memcache'] = array(
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 11211,
|
'port' => 11211,
|
||||||
|
@ -120,13 +133,16 @@ $bb_cfg['server_name'] = $domain_name;
|
||||||
$bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on
|
$bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on
|
||||||
$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name
|
$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name
|
||||||
|
|
||||||
|
// Cloudflare
|
||||||
|
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
|
||||||
|
{
|
||||||
|
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||||
|
}
|
||||||
|
|
||||||
// Increase number after changing js or css
|
// Increase number after changing js or css
|
||||||
$bb_cfg['js_ver'] = 1;
|
$bb_cfg['js_ver'] = 1;
|
||||||
$bb_cfg['css_ver'] = 1;
|
$bb_cfg['css_ver'] = 1;
|
||||||
|
|
||||||
// Information messages
|
|
||||||
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
|
|
||||||
|
|
||||||
// Backup
|
// Backup
|
||||||
$bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&1'
|
$bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&1'
|
||||||
$bb_cfg['site_backup_shell_cmd'] = '';
|
$bb_cfg['site_backup_shell_cmd'] = '';
|
||||||
|
@ -141,12 +157,13 @@ $bb_cfg['ignore_reported_ip'] = false; // Ignore IP reported by clie
|
||||||
$bb_cfg['verify_reported_ip'] = true; // Verify IP reported by client against $_SERVER['HTTP_X_FORWARDED_FOR']
|
$bb_cfg['verify_reported_ip'] = true; // Verify IP reported by client against $_SERVER['HTTP_X_FORWARDED_FOR']
|
||||||
$bb_cfg['allow_internal_ip'] = false; // Allow internal IP (10.xx.. etc.)
|
$bb_cfg['allow_internal_ip'] = false; // Allow internal IP (10.xx.. etc.)
|
||||||
|
|
||||||
// FAQ URL help link
|
// FAQ url help link
|
||||||
$bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // Как скачивать?
|
$bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // Как скачивать?
|
||||||
$bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // Что такое торрент?
|
$bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // Что такое торрент?
|
||||||
$bb_cfg['ratio_url_help'] = 'viewtopic.php?t=3'; // Рейтинг и ограничения
|
$bb_cfg['ratio_url_help'] = 'viewtopic.php?t=3'; // Рейтинг и ограничения
|
||||||
$bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Помощь по поиску
|
$bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Помощь по поиску
|
||||||
|
|
||||||
|
// Torrents
|
||||||
$bb_cfg['bt_min_ratio_allow_dl_tor'] = 0.3; // 0 - disable
|
$bb_cfg['bt_min_ratio_allow_dl_tor'] = 0.3; // 0 - disable
|
||||||
$bb_cfg['bt_min_ratio_warning'] = 0.6; // 0 - disable
|
$bb_cfg['bt_min_ratio_warning'] = 0.6; // 0 - disable
|
||||||
$bb_cfg['bt_min_ratio_dl_button'] = 0.5; // 0 - disable
|
$bb_cfg['bt_min_ratio_dl_button'] = 0.5; // 0 - disable
|
||||||
|
@ -179,7 +196,6 @@ $bb_cfg['show_dl_status_in_forum'] = true;
|
||||||
$bb_cfg['show_tor_info_in_dl_list'] = true;
|
$bb_cfg['show_tor_info_in_dl_list'] = true;
|
||||||
$bb_cfg['allow_dl_list_names_mode'] = true;
|
$bb_cfg['allow_dl_list_names_mode'] = true;
|
||||||
|
|
||||||
// Torrents
|
|
||||||
$bb_cfg['torrent_name_style'] = true; // use torrent name style [yoursite.com].txxx.torrent
|
$bb_cfg['torrent_name_style'] = true; // use torrent name style [yoursite.com].txxx.torrent
|
||||||
$bb_cfg['tor_help_links'] = '';
|
$bb_cfg['tor_help_links'] = '';
|
||||||
|
|
||||||
|
@ -227,7 +243,6 @@ define('BB_PATH', realpath(BB_ROOT) ); // absolute pathname to the fo
|
||||||
define('ADMIN_DIR', BB_PATH .'/admin/' );
|
define('ADMIN_DIR', BB_PATH .'/admin/' );
|
||||||
define('CACHE_DIR', BB_PATH .'/cache/' );
|
define('CACHE_DIR', BB_PATH .'/cache/' );
|
||||||
define('CFG_DIR', BB_PATH .'/config/' );
|
define('CFG_DIR', BB_PATH .'/config/' );
|
||||||
define('DEV_DIR', BB_PATH .'/develop/' );
|
|
||||||
define('INC_DIR', BB_PATH .'/includes/' );
|
define('INC_DIR', BB_PATH .'/includes/' );
|
||||||
define('LANG_ROOT_DIR', BB_PATH .'/language/' );
|
define('LANG_ROOT_DIR', BB_PATH .'/language/' );
|
||||||
define('LOG_DIR', BB_PATH .'/log/' );
|
define('LOG_DIR', BB_PATH .'/log/' );
|
||||||
|
@ -235,7 +250,7 @@ define('TEMPLATES_DIR', BB_PATH .'/templates/');
|
||||||
define('TRIGGERS_DIR', BB_PATH .'/triggers/' );
|
define('TRIGGERS_DIR', BB_PATH .'/triggers/' );
|
||||||
define('LOCKS_DIR', BB_PATH .'/locks/' );
|
define('LOCKS_DIR', BB_PATH .'/locks/' );
|
||||||
|
|
||||||
// URLs
|
// URL's
|
||||||
$bb_cfg['ajax_url'] = 'ajax.php'; # "http://{$_SERVER['SERVER_NAME']}/ajax.php"
|
$bb_cfg['ajax_url'] = 'ajax.php'; # "http://{$_SERVER['SERVER_NAME']}/ajax.php"
|
||||||
$bb_cfg['login_url'] = 'login.php'; # "http://{$domain_name}/login.php"
|
$bb_cfg['login_url'] = 'login.php'; # "http://{$domain_name}/login.php"
|
||||||
$bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
|
$bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
|
||||||
|
@ -302,10 +317,8 @@ $page_cfg['show_sidebar2'] = array(
|
||||||
|
|
||||||
// Cookie
|
// Cookie
|
||||||
$bb_cfg['cookie_domain'] = in_array($domain_name, array(getenv('SERVER_ADDR'), 'localhost')) ? '' : ".$domain_name";
|
$bb_cfg['cookie_domain'] = in_array($domain_name, array(getenv('SERVER_ADDR'), 'localhost')) ? '' : ".$domain_name";
|
||||||
$bb_cfg['cookie_secure'] = (!empty($_SERVER['HTTPS']) ? 1 : 0); # 0
|
$bb_cfg['cookie_secure'] = (!empty($_SERVER['HTTPS']) ? 1 : 0);
|
||||||
$bb_cfg['cookie_prefix'] = 'bb_'; # 'bb_'
|
$bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_'
|
||||||
|
|
||||||
define('COOKIE_DBG', 'bb_dbg'); // debug cookie name
|
|
||||||
|
|
||||||
// Sessions
|
// Sessions
|
||||||
$bb_cfg['session_update_intrv'] = 180; // sec
|
$bb_cfg['session_update_intrv'] = 180; // sec
|
||||||
|
@ -350,19 +363,15 @@ define('AJAX_HTML_DIR', BB_ROOT .'ajax/html/');
|
||||||
define('AJAX_DIR', BB_ROOT .'ajax/');
|
define('AJAX_DIR', BB_ROOT .'ajax/');
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
define('DEBUG', false); // !!! "DEBUG" should be ALWAYS DISABLED on production environment !!!
|
define('DBG_LOG', false); // enable forum debug (off on production)
|
||||||
define('DBG_LOG', false);
|
define('DBG_TRACKER', false); // enable tracker debug (off on production)
|
||||||
define('DBG_TIME', true); // false, true или рабочая секудна (при 3 - запись в лог будет только если текущее время кратно 3)
|
define('COOKIE_DBG', 'bb_dbg'); // debug cookie name
|
||||||
define('DBG_LOG_GENTIME', true);
|
define('SQL_DEBUG', true); // enable forum sql & cache debug
|
||||||
define('DBG_LOG_ERRORS', true);
|
|
||||||
define('PROFILER', false); // Profiler extension name, or FALSE to disable (supported: 'dbg')
|
|
||||||
|
|
||||||
define('SQL_DEBUG', true);
|
|
||||||
define('SQL_LOG_ERRORS', true); // all SQL_xxx options enabled only if SQL_DEBUG == TRUE
|
define('SQL_LOG_ERRORS', true); // all SQL_xxx options enabled only if SQL_DEBUG == TRUE
|
||||||
define('SQL_CALC_QUERY_TIME', true); // for stats
|
define('SQL_CALC_QUERY_TIME', true); // for stats
|
||||||
define('SQL_LOG_SLOW_QUERIES', true);
|
define('SQL_LOG_SLOW_QUERIES', true); // log sql slow queries
|
||||||
define('SQL_SLOW_QUERY_TIME', 10); // sec
|
define('SQL_SLOW_QUERY_TIME', 10); // slow query in seconds
|
||||||
define('SQL_PREPEND_SRC_COMM', false); // prepend source file(line) comment to sql query
|
define('SQL_PREPEND_SRC_COMM', false); // prepend source file comment to sql query
|
||||||
|
|
||||||
// Special users
|
// Special users
|
||||||
$bb_cfg['dbg_users'] = array(
|
$bb_cfg['dbg_users'] = array(
|
||||||
|
@ -403,18 +412,9 @@ $log_ip_resp = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Error reporting
|
// Error reporting
|
||||||
if (DEBUG)
|
ini_set('error_reporting', E_ALL);
|
||||||
{
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('log_errors', 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error_reporting(E_ALL); # E_ALL & ~E_NOTICE
|
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
}
|
|
||||||
ini_set('error_log', LOG_DIR .'php_err.log');
|
ini_set('error_log', LOG_DIR .'php_err.log');
|
||||||
|
|
||||||
// Check some variable
|
// Check some variable
|
||||||
|
@ -429,7 +429,7 @@ define('BB_DISABLED', TRIGGERS_DIR .'$off');
|
||||||
define('CRON_ALLOWED', TRIGGERS_DIR .'cron_allowed');
|
define('CRON_ALLOWED', TRIGGERS_DIR .'cron_allowed');
|
||||||
define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
|
define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
|
||||||
|
|
||||||
//Формат даты
|
// Date format
|
||||||
$bb_cfg['date_format'] = 'Y-m-d';
|
$bb_cfg['date_format'] = 'Y-m-d';
|
||||||
|
|
||||||
// Subforums
|
// Subforums
|
||||||
|
|
|
@ -1,357 +0,0 @@
|
||||||
<?php
|
|
||||||
//
|
|
||||||
// +------------------------------------------------------------------------+
|
|
||||||
// | PEAR :: Benchmark |
|
|
||||||
// +------------------------------------------------------------------------+
|
|
||||||
// | Copyright (c) 2001-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
|
|
||||||
// +------------------------------------------------------------------------+
|
|
||||||
// | This source file is subject to the New BSD license, That is bundled |
|
|
||||||
// | with this package in the file LICENSE, and is available through |
|
|
||||||
// | the world-wide-web at |
|
|
||||||
// | http://www.opensource.org/licenses/bsd-license.php |
|
|
||||||
// | If you did not receive a copy of the new BSDlicense and are unable |
|
|
||||||
// | to obtain it through the world-wide-web, please send a note to |
|
|
||||||
// | license@php.net so we can mail you a copy immediately. |
|
|
||||||
// +------------------------------------------------------------------------+
|
|
||||||
//
|
|
||||||
// $Id: Timer.php,v 1.16 2006/03/01 13:41:39 matthias Exp $
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides timing and profiling information.
|
|
||||||
*
|
|
||||||
* Example 1: Automatic profiling start, stop, and output.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* <?php
|
|
||||||
* require_once 'Benchmark/Timer.php';
|
|
||||||
*
|
|
||||||
* $timer = new Benchmark_Timer(TRUE);
|
|
||||||
* $timer->setMarker('Marker 1');
|
|
||||||
* ?>
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* Example 2: Manual profiling start, stop, and output.
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* <?php
|
|
||||||
* require_once 'Benchmark/Timer.php';
|
|
||||||
*
|
|
||||||
* $timer = new Benchmark_Timer();
|
|
||||||
* $timer->start();
|
|
||||||
* $timer->setMarker('Marker 1');
|
|
||||||
* $timer->stop();
|
|
||||||
*
|
|
||||||
* $timer->display(); // to output html formated
|
|
||||||
* // AND/OR :
|
|
||||||
* $profiling = $timer->getProfiling(); // get the profiler info as an associative array
|
|
||||||
* ?>
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
||||||
* @author Ludovico Magnocavallo <ludo@sumatrasolutions.com>
|
|
||||||
* @copyright Copyright © 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
||||||
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
|
|
||||||
* @category Benchmarking
|
|
||||||
* @package Benchmark
|
|
||||||
*/
|
|
||||||
class Benchmark_Timer {
|
|
||||||
/**
|
|
||||||
* Contains the markers.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
var $markers = array();
|
|
||||||
var $memory = array();
|
|
||||||
|
|
||||||
var $name_counter = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-start and stop timer.
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
var $auto = FALSE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Max marker name length for non-html output.
|
|
||||||
*
|
|
||||||
* @var integer
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
var $maxStringLength = 0;
|
|
||||||
|
|
||||||
var $startTime = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param boolean $auto
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function Benchmark_Timer($auto = FALSE) {
|
|
||||||
$this->auto = $auto;
|
|
||||||
$this->startTime = $this->_getMicrotime();
|
|
||||||
|
|
||||||
if ($this->auto) {
|
|
||||||
$this->start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _Benchmark_Timer() {
|
|
||||||
if ($this->auto) {
|
|
||||||
$this->stop();
|
|
||||||
$this->display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set "Start" marker.
|
|
||||||
*
|
|
||||||
* @see setMarker(), stop()
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function start() {
|
|
||||||
$this->setMarker('Start');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set "Stop" marker.
|
|
||||||
*
|
|
||||||
* @see setMarker(), start()
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function stop() {
|
|
||||||
$this->setMarker('Stop');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set marker.
|
|
||||||
*
|
|
||||||
* @param string $name Name of the marker to be set.
|
|
||||||
* @see start(), stop()
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function setMarker($name = '') {
|
|
||||||
if (!$name) {
|
|
||||||
$trace = debug_backtrace();
|
|
||||||
$name = $GLOBALS['timer_markers'] .': '. hide_bb_path($trace[0]['file']) .'('. $trace[0]['line'] .')';
|
|
||||||
}
|
|
||||||
if ($name != 'Start' && $name != 'Stop') {
|
|
||||||
$GLOBALS['timer_markers']++;
|
|
||||||
}
|
|
||||||
if (isset($this->markers[$name])) {
|
|
||||||
$name .= ' ['. @++$this->name_counter[$name] .']';
|
|
||||||
}
|
|
||||||
$this->markers[$name] = $this->_getMicrotime();
|
|
||||||
$this->memory[$name] = sys('mem');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the time elapsed betweens two markers.
|
|
||||||
*
|
|
||||||
* @param string $start start marker, defaults to "Start"
|
|
||||||
* @param string $end end marker, defaults to "Stop"
|
|
||||||
* @return double $time_elapsed time elapsed between $start and $end
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function timeElapsed($start = 'Start', $end = 'Stop') {
|
|
||||||
if ($end == 'Stop' && !isset($this->markers['Stop'])) {
|
|
||||||
$this->markers['Stop'] = $this->_getMicrotime();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (extension_loaded('bcmath')) {
|
|
||||||
return bcsub($this->markers[$end], $this->markers[$start], 6);
|
|
||||||
} else {
|
|
||||||
return $this->markers[$end] - $this->markers[$start];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns profiling information.
|
|
||||||
*
|
|
||||||
* $profiling[x]['name'] = name of marker x
|
|
||||||
* $profiling[x]['time'] = time index of marker x
|
|
||||||
* $profiling[x]['diff'] = execution time from marker x-1 to this marker x
|
|
||||||
* $profiling[x]['total'] = total execution time up to marker x
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function getProfiling() {
|
|
||||||
$i = $total = 0;
|
|
||||||
$result = array();
|
|
||||||
$temp = reset($this->markers);
|
|
||||||
$mem_before = 0;
|
|
||||||
$this->maxStringLength = 0;
|
|
||||||
|
|
||||||
foreach ($this->markers as $marker => $time) {
|
|
||||||
if (extension_loaded('bcmath')) {
|
|
||||||
$diff = bcsub($time, $temp, 6);
|
|
||||||
$total = bcadd($total, $diff, 6);
|
|
||||||
} else {
|
|
||||||
$diff = $time - $temp;
|
|
||||||
$total = $total + $diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result[$i]['name'] = $marker;
|
|
||||||
$result[$i]['time'] = $time;
|
|
||||||
$result[$i]['diff'] = $diff;
|
|
||||||
$result[$i]['total'] = $total;
|
|
||||||
$result[$i]['mem'] = $this->memory[$marker];
|
|
||||||
$result[$i]['mem_diff'] = $this->memory[$marker] - $mem_before;
|
|
||||||
|
|
||||||
$this->maxStringLength = (strlen($marker) > $this->maxStringLength ? strlen($marker) + 1 : $this->maxStringLength);
|
|
||||||
|
|
||||||
$temp = $time;
|
|
||||||
$mem_before = $this->memory[$marker];
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result[0]['diff'] = '-';
|
|
||||||
$result[0]['total'] = '-';
|
|
||||||
$this->maxStringLength = (strlen('total') > $this->maxStringLength ? strlen('total') : $this->maxStringLength);
|
|
||||||
$this->maxStringLength += 2;
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return formatted profiling information.
|
|
||||||
*
|
|
||||||
* @param boolean $showTotal Optionnaly includes total in output, default no
|
|
||||||
* @param string $format output format (auto, plain or html), default auto
|
|
||||||
* @return string
|
|
||||||
* @see getProfiling()
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function getOutput($showTotal = FALSE, $format = 'auto') {
|
|
||||||
if ($format == 'auto') {
|
|
||||||
$format = isset($_SERVER['SERVER_PROTOCOL']) ? 'html' : 'plain';
|
|
||||||
}
|
|
||||||
|
|
||||||
$total = $this->TimeElapsed();
|
|
||||||
$result = $this->getProfiling();
|
|
||||||
$dashes = '';
|
|
||||||
|
|
||||||
if ($format == 'html') {
|
|
||||||
$out = '
|
|
||||||
<br /><br />
|
|
||||||
<style type="text/css"><!-- td { font-size : 11px; font-family: Verdana; } --></style>
|
|
||||||
<table border="1" cellspacing="0" cellpadding="4" align="center">
|
|
||||||
'."\n";
|
|
||||||
$out .= '
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
<td align="center"><b>time idx</b></td>
|
|
||||||
<td align="center"><b>ex time</b></td>
|
|
||||||
<td align="center"><b>%</b></td>
|
|
||||||
<td align="center"><b>mem</b></td>
|
|
||||||
<td align="center"><b>mem +-</b></td>
|
|
||||||
'. ($showTotal ? '
|
|
||||||
<td align="center"><b>elapsed</b></td>
|
|
||||||
<td align="center"><b>%</b></td>
|
|
||||||
' : '')
|
|
||||||
."</tr>\n";
|
|
||||||
} else {
|
|
||||||
$dashes = $out = str_pad("\n",
|
|
||||||
$this->maxStringLength + ($showTotal ? 70 : 45), '-', STR_PAD_LEFT);
|
|
||||||
$out .= str_pad('marker', $this->maxStringLength) .
|
|
||||||
str_pad("time index", 22) .
|
|
||||||
str_pad("ex time", 16) .
|
|
||||||
str_pad("perct ", 8) .
|
|
||||||
($showTotal ? ' '.str_pad("elapsed", 16)."perct" : '')."\n" .
|
|
||||||
$dashes;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($result as $k => $v) {
|
|
||||||
$perc = (($v['diff'] * 100) / $total);
|
|
||||||
$tperc = (($v['total'] * 100) / $total);
|
|
||||||
|
|
||||||
if ($format == 'html') {
|
|
||||||
$out .= '
|
|
||||||
<tr>
|
|
||||||
<td><b>'. $v['name'] .'</b></td>
|
|
||||||
<td>'. number_format($v['time'] - $this->startTime, 6) .'</td>
|
|
||||||
<td><b>'. number_format($v['diff'], 6) .'</b></td>
|
|
||||||
<td align="right">'. number_format($perc, 2) .'%</td>
|
|
||||||
<td align=right>'. humn_size($v['mem'], 2, '', ' ') .'</td>
|
|
||||||
<td align=right>'. (($v['mem_diff'] > 0) ? '+' : '-') . humn_size(abs($v['mem_diff']), 2, '', ' ') .'</td>
|
|
||||||
'. ($showTotal ? '
|
|
||||||
<td>'. number_format($v['total'], 6) .'</td>
|
|
||||||
<td align="right">'. number_format($tperc, 2, '.', '') .'%</td>
|
|
||||||
' : '')
|
|
||||||
."</tr>\n";
|
|
||||||
} else {
|
|
||||||
$out .= str_pad($v['name'], $this->maxStringLength, ' ') .
|
|
||||||
str_pad($v['time'], 22) .
|
|
||||||
str_pad($v['diff'], 14) .
|
|
||||||
str_pad(number_format($perc, 2, '.', '')."%",8, ' ', STR_PAD_LEFT) .
|
|
||||||
($showTotal ? ' '.
|
|
||||||
str_pad($v['total'], 14) .
|
|
||||||
str_pad(number_format($tperc, 2, '.', '')."%",
|
|
||||||
8, ' ', STR_PAD_LEFT) : '').
|
|
||||||
"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$out .= $dashes;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($format == 'html') {
|
|
||||||
$out .= "
|
|
||||||
<tr style='background: silver;'>
|
|
||||||
<td><b>total</b></td>
|
|
||||||
<td>-</td>
|
|
||||||
<td>". number_format($total, 6) ."</td>
|
|
||||||
<td>100.00%</td>
|
|
||||||
<td>". humn_size(sys('mem_peak'), 2, '', ' ') ."</td>
|
|
||||||
<td>-</td>
|
|
||||||
". ($showTotal ? "
|
|
||||||
<td>-</td>
|
|
||||||
<td>-</td>
|
|
||||||
" : '')
|
|
||||||
."
|
|
||||||
</tr>\n";
|
|
||||||
$out .= "</table><br /><br />\n";
|
|
||||||
} else {
|
|
||||||
$out .= str_pad('total', $this->maxStringLength);
|
|
||||||
$out .= str_pad('-', 22);
|
|
||||||
$out .= str_pad($total, 15);
|
|
||||||
$out .= "100.00%\n";
|
|
||||||
$out .= $dashes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints the information returned by getOutput().
|
|
||||||
*
|
|
||||||
* @param boolean $showTotal Optionnaly includes total in output, default no
|
|
||||||
* @param string $format output format (auto, plain or html), default auto
|
|
||||||
* @see getOutput()
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function display($showTotal = FALSE, $format = 'html') {
|
|
||||||
print $this->getOutput($showTotal, $format);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for microtime().
|
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
* @access private
|
|
||||||
* @since 1.3.0
|
|
||||||
*/
|
|
||||||
function _getMicrotime() {
|
|
||||||
$microtime = explode(' ', microtime());
|
|
||||||
return $microtime[1] . substr($microtime[0], 1);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Open file in Editor
|
|
||||||
$bb_cfg['dbg']['interpreter'] = 'cmd.exe /c START';
|
|
||||||
$bb_cfg['dbg']['editor_path'] = 'D:\Programs\TextPad\TextPad.exe';
|
|
||||||
$bb_cfg['dbg']['editor_args'] = '%s(%s)'; // %s - file_to_open path, %s - line number
|
|
|
@ -1,81 +0,0 @@
|
||||||
<style type="text/css">
|
|
||||||
<!--
|
|
||||||
.lineTD, .codeTD {
|
|
||||||
vertical-align: top;
|
|
||||||
background-color: #FFFFCC;
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 12px;
|
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lineTD {
|
|
||||||
text-align: right;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.codeTD {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lineNum {
|
|
||||||
border-bottom: 1px solid #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lineErr {
|
|
||||||
background-color: red;
|
|
||||||
color: white;
|
|
||||||
border-bottom-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.codeLine {
|
|
||||||
border-bottom: 1px solid #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.codeErr {
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #E4EFEE;
|
|
||||||
border-bottom-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errTABLE {
|
|
||||||
border: 2px groove #FF4500;
|
|
||||||
margin: 10px;
|
|
||||||
background: #FFF5EE;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errRepTD {
|
|
||||||
font-size:12px;
|
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errType {
|
|
||||||
font-weight: bold;
|
|
||||||
padding-left: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errInfo {
|
|
||||||
font-size:13px;
|
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
padding-right: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errTip {
|
|
||||||
font-size:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errFile {
|
|
||||||
color:#696969;
|
|
||||||
}
|
|
||||||
|
|
||||||
.errFileCritical {
|
|
||||||
color: #FF4500;
|
|
||||||
font-weight:bold;
|
|
||||||
letter-spacing:1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.traceBody {
|
|
||||||
font-size:13px;
|
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
}
|
|
||||||
-->
|
|
||||||
</style>
|
|
|
@ -1,106 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
class bb_error_handler
|
|
||||||
{
|
|
||||||
var $errType = array (
|
|
||||||
E_NOTICE => 'Notice',
|
|
||||||
E_RECOVERABLE_ERROR => 'Recoverable Error',
|
|
||||||
E_STRICT => 'Strict',
|
|
||||||
E_USER_ERROR => 'Error',
|
|
||||||
E_USER_NOTICE => 'Notice',
|
|
||||||
E_USER_WARNING => 'Warning',
|
|
||||||
E_WARNING => 'Warning',
|
|
||||||
);
|
|
||||||
|
|
||||||
var $err_Stack = array();
|
|
||||||
var $err_HtmlOut = '';
|
|
||||||
|
|
||||||
function bb_error_handler ($errNo = null, $errMsg = null, $file = null, $line = null, $context = null)
|
|
||||||
{
|
|
||||||
if (!($errNo & error_reporting())) return;
|
|
||||||
|
|
||||||
$critical_error = ($errNo & E_USER_ERROR);
|
|
||||||
# $critical_error = true;
|
|
||||||
|
|
||||||
if ($critical_error)
|
|
||||||
{
|
|
||||||
$info = array();
|
|
||||||
if (is_array($arr = @unserialize($errMsg)))
|
|
||||||
{
|
|
||||||
foreach ($arr as $k => $v)
|
|
||||||
{
|
|
||||||
$info[$k] = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$trace = $full_trace = debug_backtrace();
|
|
||||||
array_shift($trace);
|
|
||||||
|
|
||||||
if (isset($trace[1]['function']) && $trace[1]['function'] === 'sql_trigger_error')
|
|
||||||
{
|
|
||||||
array_shift($trace);
|
|
||||||
array_shift($trace);
|
|
||||||
}
|
|
||||||
$file = $trace[0]['file'];
|
|
||||||
$line = $trace[0]['line'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = md5($file . $errNo . $errMsg);
|
|
||||||
if (!isset($this->errStack[$id]))
|
|
||||||
{
|
|
||||||
$this->errStack[$id] = array(
|
|
||||||
'file' => $file,
|
|
||||||
'line' => $line,
|
|
||||||
'errNo' => $errNo,
|
|
||||||
'errMsg' => $errMsg,
|
|
||||||
);
|
|
||||||
if (preg_match('#(.*)\((\d+)\).*eval.*#', $file, $m))
|
|
||||||
{
|
|
||||||
$src_file = $m[1];
|
|
||||||
$src_line = $m[2];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$src_file = $file;
|
|
||||||
$src_line = $line;
|
|
||||||
}
|
|
||||||
$this->err_HtmlOut .= ''
|
|
||||||
."<tr>\n"
|
|
||||||
.'<td nowrap="nowrap" valign="top" class="errRepTD errType">'
|
|
||||||
. $this->errType[$errNo] .':'
|
|
||||||
."</td>\n"
|
|
||||||
.'<td class="errRepTD errInfo" style="cursor: pointer" ondblclick="'. make_OpenInEditor_js($src_file, $src_line) .'">'
|
|
||||||
. htmlCHR($errMsg)
|
|
||||||
. (($critical_error) ? "<br /><div class='errFile errFileCritical'>\n\n" : "<div class=errFile>\n")
|
|
||||||
. str_replace(BB_PATH . DIRECTORY_SEPARATOR, '', $file) ."($line)"
|
|
||||||
."</td>\n"
|
|
||||||
."</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($critical_error)
|
|
||||||
{
|
|
||||||
require(DEV_DIR .'error_report.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_errors ()
|
|
||||||
{
|
|
||||||
if ($this->err_HtmlOut)
|
|
||||||
{
|
|
||||||
return "<table class=errTABLE align=center>\n". $this->err_HtmlOut ."</table><div class=errTip>doubleClick the filename to open in Editor</div>\n";
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_clean_errors ()
|
|
||||||
{
|
|
||||||
$ret = $this->get_errors();
|
|
||||||
$this->err_HtmlOut = '';
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$errHandler = new bb_error_handler;
|
|
||||||
set_error_handler(array(&$errHandler, 'bb_error_handler'));
|
|
|
@ -1,234 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* based on mygosuLib ErrorHandler ver 2.0.1 by Cezary Tomczak (http://gosu.pl)
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
#while (@ob_end_clean());
|
|
||||||
|
|
||||||
$c['default'] = '#000000';
|
|
||||||
$c['keyword'] = '#0000A0';
|
|
||||||
$c['number'] = '#800080';
|
|
||||||
$c['string'] = '#404040';
|
|
||||||
$c['comment'] = '#808080';
|
|
||||||
|
|
||||||
require(DEV_DIR .'dbg_header.php');
|
|
||||||
echo $this->get_clean_errors();
|
|
||||||
|
|
||||||
$showSourceUri = BB_ROOT .'develop/show_source.php';
|
|
||||||
$showSourcePrev = 15;
|
|
||||||
$showSourceNext = 15;
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function showParam(i) {
|
|
||||||
currentParam = i;
|
|
||||||
document.getElementById('paramHide').style.display = '';
|
|
||||||
document.getElementById('paramSpace').style.display = '';
|
|
||||||
document.getElementById('param').style.display = '';
|
|
||||||
document.getElementById('param').innerHTML = '<pre>' + document.getElementById('param' + i).innerHTML + '</pre>';
|
|
||||||
}
|
|
||||||
function hideParam() {
|
|
||||||
currentParam = -1;
|
|
||||||
document.getElementById('paramHide').style.display = 'none';
|
|
||||||
document.getElementById('paramSpace').style.display = 'none';
|
|
||||||
document.getElementById('param').style.display = 'none';
|
|
||||||
}
|
|
||||||
function showOrHideParam(i) {
|
|
||||||
if (currentParam == i) {
|
|
||||||
hideParam()
|
|
||||||
} else {
|
|
||||||
showParam(i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function showFile(id) {
|
|
||||||
eval('display = document.getElementById("file' + id + '").style.display')
|
|
||||||
eval('if (display == "none") { document.getElementById("file' + id + '").style.display = "" } else { document.getElementById("file' + id + '").style.display = "none" } ');
|
|
||||||
}
|
|
||||||
function showDetails(cnt) {
|
|
||||||
for (i = 0; i < cnt; ++i) {
|
|
||||||
eval('document.getElementById("file' + i + '").style.display = ""')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function hideDetails(cnt) {
|
|
||||||
for (i = 0; i < cnt; ++i) {
|
|
||||||
eval('document.getElementById("file' + i + '").style.display = "none"')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var currentParam = -1;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="traceBody">
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<b><?php echo $this->errType[$errNo]; ?></b>: <?php
|
|
||||||
|
|
||||||
function fontStart($color)
|
|
||||||
{
|
|
||||||
return '<font color="' . $color . '">';
|
|
||||||
}
|
|
||||||
function fontEnd()
|
|
||||||
{
|
|
||||||
return '</font>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($info))
|
|
||||||
{
|
|
||||||
foreach ($info as $k => $v)
|
|
||||||
{
|
|
||||||
echo "<b>$k:</b> $v <br />\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "$errMsg <br />\n";
|
|
||||||
}
|
|
||||||
echo "<br />\n";
|
|
||||||
|
|
||||||
if (count($trace))
|
|
||||||
{
|
|
||||||
echo '<span style="font-family: monospaced; font-size: 12px;">Trace: ' . count($trace) . "</span> ";
|
|
||||||
echo '<span style="font-family: monospaced; font-size: 11px; cursor: pointer;" onclick="showDetails('.count($trace).')">[show details]</span> ';
|
|
||||||
echo '<span style="font-family: monospaced; font-size: 11px; cursor: pointer;" onclick="hideDetails('.count($trace).')">[hide details]</span>';
|
|
||||||
|
|
||||||
echo "<br />\n";
|
|
||||||
echo "<br />\n";
|
|
||||||
|
|
||||||
echo '<ul>';
|
|
||||||
$currentParam = -1;
|
|
||||||
|
|
||||||
foreach ($trace as $k => $v)
|
|
||||||
{
|
|
||||||
$currentParam++;
|
|
||||||
|
|
||||||
echo '<li style="list-style-type: square;">';
|
|
||||||
|
|
||||||
if (isset($v['class']))
|
|
||||||
{
|
|
||||||
echo '<span onmouseover="this.style.color=\'#0000ff\'" onmouseout="this.style.color=\''.$c['keyword'].'\'" style="color: '.$c['keyword'].'; cursor: pointer;" onclick="showFile('.$k.')">';
|
|
||||||
echo $v['class'];
|
|
||||||
echo ".";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<span onmouseover="this.style.color=\'#0000ff\'" onmouseout="this.style.color=\''.$c['keyword'].'\'" style="color: '.$c['keyword'].'; cursor: pointer;" onclick="showFile('.$k.')">';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $v['function'];
|
|
||||||
echo '</span>';
|
|
||||||
echo " (";
|
|
||||||
|
|
||||||
$sep = '';
|
|
||||||
$v['args'] = (array) @$v['args'];
|
|
||||||
foreach ($v['args'] as $arg) {
|
|
||||||
|
|
||||||
$currentParam++;
|
|
||||||
|
|
||||||
echo $sep;
|
|
||||||
$sep = ', ';
|
|
||||||
$color = '#404040';
|
|
||||||
|
|
||||||
switch (true) {
|
|
||||||
|
|
||||||
case is_bool($arg):
|
|
||||||
$param = 'TRUE';
|
|
||||||
$string = $param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_int($arg):
|
|
||||||
case is_float($arg):
|
|
||||||
$param = $arg;
|
|
||||||
$string = $arg;
|
|
||||||
$color = $c['number'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_null($arg):
|
|
||||||
$param = 'NULL';
|
|
||||||
$string = $param;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_string($arg):
|
|
||||||
$param = $arg;
|
|
||||||
$string = 'string[' . strlen($arg) . ']';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_array($arg):
|
|
||||||
ob_start();
|
|
||||||
print_r($arg);
|
|
||||||
$param = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
$string = 'array[' . count($arg) . ']';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_object($arg):
|
|
||||||
ob_start();
|
|
||||||
print_r($arg);
|
|
||||||
$param = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
$string = 'object: ' . get_class($arg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case is_resource($arg):
|
|
||||||
$param = 'resource: ' . get_resource_type($arg);
|
|
||||||
$string = 'resource';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$param = 'unknown';
|
|
||||||
$string = $param;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span style="cursor: pointer; color: '.$color.';" onclick="showOrHideParam('.$currentParam.')" onmouseout="this.style.color=\''.$color.'\'" onmouseover="this.style.color=\'#dd0000\'">';
|
|
||||||
echo $string;
|
|
||||||
echo '</span>';
|
|
||||||
echo '<span id="param'.$currentParam.'" style="display: none;"><pre>' . $param . '</pre></span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo ")";
|
|
||||||
echo "<br />\n";
|
|
||||||
|
|
||||||
if (!isset($v['file'])) {
|
|
||||||
$v['file'] = 'unknown';
|
|
||||||
}
|
|
||||||
if (!isset($v['line'])) {
|
|
||||||
$v['line'] = 'unknown';
|
|
||||||
}
|
|
||||||
|
|
||||||
$v['line'] = @$v['line'];
|
|
||||||
echo '<span id="file'.$k.'" style="display: none; color: gray;">';
|
|
||||||
if ($v['file'] && $v['line']) {
|
|
||||||
echo 'FILE: <a onmouseout="this.style.color=\'#007700\'" onmouseover="this.style.color=\'#FF6600\'" style="color: #007700; text-decoration: none;" target="_blank" href="'.$showSourceUri.'?file='.urlencode($v['file']).'&line='.$v['line'].'&prev='.$showSourcePrev.'&next='.$showSourceNext.'">'.basename($v['file']).'</a>';
|
|
||||||
} else {
|
|
||||||
echo 'FILE: ' . fontStart('#007700') . basename($v['file']) . fontEnd();
|
|
||||||
}
|
|
||||||
echo "<br />\n";
|
|
||||||
echo 'LINE: ' . fontStart('#007700') . $v['line'] . fontEnd() . "<br />\n";
|
|
||||||
echo 'DIR: ' . fontStart('#007700') . dirname($v['file']) . fontEnd();
|
|
||||||
echo '</span>';
|
|
||||||
|
|
||||||
echo '</li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</ul>';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
echo '<b>File:</b> ';
|
|
||||||
echo basename($file);
|
|
||||||
echo ' (' . $line . ') ';
|
|
||||||
echo dirname($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php echo '<span id="paramHide" style="display: none; font-family: monospaced; font-size: 11px; cursor: pointer;" onclick="hideParam()">[hide param]</span>'; ?>
|
|
||||||
<span id="paramSpace" style="display: none;">
|
|
||||||
|
|
||||||
</span><div id="param" perm="0" style="background-color: #FFFFE1; padding: 2px; display: none;"></div><hr />
|
|
||||||
|
|
||||||
Trick: click on a function's argument to see it fully<br />
|
|
||||||
Trick: click on a function to see the file & line<br />
|
|
||||||
Trick: click on the file name to see the source code<br />
|
|
||||||
|
|
||||||
</div>
|
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Some parts of code based on mygosuLib ErrorHandler ver 2.0.1 by Cezary Tomczak (http://gosu.pl)
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
function make_OpenInEditor_js ($file, $line)
|
|
||||||
{
|
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
$editor_path_js = addslashes($bb_cfg['dbg']['editor_path']);
|
|
||||||
$file_js = addslashes($file);
|
|
||||||
|
|
||||||
$url = BB_ROOT .'develop/open_editor.php';
|
|
||||||
$url .= "?prog=$editor_path_js";
|
|
||||||
$url .= '&args='. sprintf($bb_cfg['dbg']['editor_args'], $file_js, $line);
|
|
||||||
$onClick = 'window.open(' . "'$url','','height=1,width=1,left=1,top=1,resizable=yes,scrollbars=no,toolbar=no'" . '); return false;';
|
|
||||||
|
|
||||||
return $onClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show source part of the file
|
|
||||||
* @param string $file Filename
|
|
||||||
* @param int $line Line to read
|
|
||||||
* @param int $prev How many lines before main line to read
|
|
||||||
* @param int $next How many lines after main line to read
|
|
||||||
* @param bool $add_view_full_link
|
|
||||||
* @return string
|
|
||||||
* @access public
|
|
||||||
* @package ErrorHandler
|
|
||||||
*/
|
|
||||||
function showSource ($file, $line, $prev = 10, $next = 10, $add_view_full_link = true)
|
|
||||||
{
|
|
||||||
if (!(file_exists($file) && is_file($file)))
|
|
||||||
{
|
|
||||||
return trigger_error("showSource() failed, file does not exist `$file`", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
//read code
|
|
||||||
$data = highlight_file($file, true);
|
|
||||||
$data = str_replace(array("\r", "\n"), '', $data);
|
|
||||||
|
|
||||||
//seperate lines
|
|
||||||
$data = explode('<br />', $data);
|
|
||||||
$count = count($data);
|
|
||||||
|
|
||||||
//count which lines to display
|
|
||||||
$start = $line - $prev;
|
|
||||||
if ($start < 1)
|
|
||||||
{
|
|
||||||
$start = 0;
|
|
||||||
}
|
|
||||||
$end = $line + $next;
|
|
||||||
if ($end > $count)
|
|
||||||
{
|
|
||||||
$end = $count + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//color for numbering lines
|
|
||||||
$highlight_default = ini_get('highlight.default');
|
|
||||||
|
|
||||||
echo '<div style="margin: 2px 50px; padding: 4px; border: 1px solid #A5AFB4; max-height: 200px; overflow: auto;"><table cellspacing="0" cellpadding="0" border="0"><tr>';
|
|
||||||
echo '<td class="lineTD">';
|
|
||||||
|
|
||||||
for ($x = $start+1; $x <= $end+1; $x++)
|
|
||||||
{
|
|
||||||
$class = ($line == $x) ? 'lineNum lineErr' : 'lineNum';
|
|
||||||
echo "<div class=\"$class\"> ";
|
|
||||||
echo '<a name="'.($x).'"></a>';
|
|
||||||
echo ($x);
|
|
||||||
echo ' ';
|
|
||||||
echo "</div>\n";
|
|
||||||
}
|
|
||||||
echo '</td><td width="100%" class="codeTD" nowrap="nowrap">';
|
|
||||||
|
|
||||||
while ($start <= $end)
|
|
||||||
{
|
|
||||||
if ($line == $start+1)
|
|
||||||
{
|
|
||||||
echo '<div class="codeLine codeErr" ondblclick="'. make_OpenInEditor_js($file, $line) .'"> ';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '<div class="codeLine"> ';
|
|
||||||
}
|
|
||||||
echo @$data[$start];
|
|
||||||
echo "</div>\n";
|
|
||||||
$start++;
|
|
||||||
}
|
|
||||||
echo '</td>';
|
|
||||||
echo '</tr></table></div>';
|
|
||||||
|
|
||||||
if ($add_view_full_link && ($prev != 10000 || $next != 10000))
|
|
||||||
{
|
|
||||||
echo '<br>';
|
|
||||||
echo '<a style="font-family: tahoma; font-size: 12px;" href="'. BB_ROOT .'develop/show_source.php?file='.urlencode($file).'&line='.$line.'&prev=10000&next=10000#'.($line - 15).'">View Full Source</a>';
|
|
||||||
}
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
require(DEV_DIR .'dbg_config.php');
|
|
||||||
require(DEV_DIR .'functions_debug.php');
|
|
||||||
|
|
||||||
//
|
|
||||||
// Timer
|
|
||||||
//
|
|
||||||
require(DEV_DIR .'benchmark/timer.php');
|
|
||||||
$timer_markers = 0;
|
|
||||||
$timer = new Benchmark_Timer();
|
|
||||||
$GLOBALS['timer']->start();
|
|
||||||
# $GLOBALS['timer']->setMarker(); // empty setMarker() will point to "source(line)"
|
|
||||||
# $GLOBALS['timer']->setMarker('Marker 1');
|
|
||||||
# $GLOBALS['timer']->setMarker('Marker 1 End');
|
|
||||||
# $GLOBALS['timer']->stop();
|
|
||||||
# $GLOBALS['timer']->display(); die;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Error handler
|
|
||||||
//
|
|
||||||
require(DEV_DIR .'error_handler.php');
|
|
||||||
|
|
||||||
//
|
|
||||||
// OB conveyer
|
|
||||||
//
|
|
||||||
function prepend_debug_info ($contents)
|
|
||||||
{
|
|
||||||
global $errHandler;
|
|
||||||
|
|
||||||
if ($errors = $errHandler->get_clean_errors())
|
|
||||||
{
|
|
||||||
$contents = file_get_contents(DEV_DIR .'dbg_header.php') . $errors . $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_start('prepend_debug_info');
|
|
|
@ -1,154 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
|
||||||
|
|
||||||
class Memcached {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Libmemcached behavior options.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const OPT_HASH = null;
|
|
||||||
|
|
||||||
const OPT_HASH_DEFAULT = null;
|
|
||||||
|
|
||||||
const OPT_HASH_MD5 = null;
|
|
||||||
|
|
||||||
const OPT_HASH_CRC = null;
|
|
||||||
|
|
||||||
const OPT_HASH_FNV1_64 = null;
|
|
||||||
|
|
||||||
const OPT_HASH_FNV1A_64 = null;
|
|
||||||
|
|
||||||
const OPT_HASH_FNV1_32 = null;
|
|
||||||
|
|
||||||
const OPT_HASH_FNV1A_32 = null;
|
|
||||||
|
|
||||||
const OPT_HASH_HSIEH = null;
|
|
||||||
|
|
||||||
const OPT_HASH_MURMUR = null;
|
|
||||||
|
|
||||||
const OPT_DISTRIBUTION = null;
|
|
||||||
|
|
||||||
const OPT_DISTRIBUTION_MODULA = null;
|
|
||||||
|
|
||||||
const OPT_DISTRIBUTION_CONSISTENT = null;
|
|
||||||
|
|
||||||
const OPT_LIBKETAMA_COMPATIBLE = null;
|
|
||||||
|
|
||||||
const OPT_BUFFER_REQUESTS = null;
|
|
||||||
|
|
||||||
const OPT_BINARY_PROTOCOL = null;
|
|
||||||
|
|
||||||
const OPT_NO_BLOCK = null;
|
|
||||||
|
|
||||||
const OPT_TCP_NODELAY = null;
|
|
||||||
|
|
||||||
const OPT_SOCKET_SEND_SIZE = null;
|
|
||||||
|
|
||||||
const OPT_SOCKET_RECV_SIZE = null;
|
|
||||||
|
|
||||||
const OPT_CONNECT_TIMEOUT = null;
|
|
||||||
|
|
||||||
const OPT_RETRY_TIMEOUT = null;
|
|
||||||
|
|
||||||
const OPT_SND_TIMEOUT = null;
|
|
||||||
|
|
||||||
const OPT_RCV_TIMEOUT = null;
|
|
||||||
|
|
||||||
const OPT_POLL_TIMEOUT = null;
|
|
||||||
|
|
||||||
const OPT_SERVER_FAILURE_LIMIT = null;
|
|
||||||
|
|
||||||
const OPT_CACHE_LOOKUPS = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class options.
|
|
||||||
*/
|
|
||||||
const OPT_COMPRESSION = null;
|
|
||||||
|
|
||||||
const OPT_PREFIX_KEY = null;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct( $persistent_id = '' ) {}
|
|
||||||
|
|
||||||
public function get( $key, $cache_cb = null, &$cas_token = null ) {}
|
|
||||||
|
|
||||||
public function getByKey( $server_key, $key, $cache_cb = null, &$cas_token = null ) {}
|
|
||||||
|
|
||||||
public function getMulti( array $keys, &$cas_tokens = null, $flags = 0 ) {}
|
|
||||||
|
|
||||||
public function getMultiByKey( $server_key, array $keys, &$cas_tokens = null, $flags = 0 ) {}
|
|
||||||
|
|
||||||
public function getDelayed( array $keys, $with_cas = null, $value_cb = null ) {}
|
|
||||||
|
|
||||||
public function getDelayedByKey( $server_key, array $keys, $with_cas = null, $value_cb = null ) {}
|
|
||||||
|
|
||||||
public function fetch( ) {}
|
|
||||||
|
|
||||||
public function fetchAll( ) {}
|
|
||||||
|
|
||||||
public function set( $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function setByKey( $server_key, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function setMulti( array $items, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function setMultiByKey( $server_key, array $items, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function cas( $token, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function casByKey( $token, $server_key, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function add( $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function addByKey( $server_key, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function append( $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function appendByKey( $server_ke, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function prepend( $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function prependByKey( $server_key, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function replace( $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function replaceByKey( $serve_key, $key, $value, $expiration = 0 ) {}
|
|
||||||
|
|
||||||
public function delete( $key, $time = 0 ) {}
|
|
||||||
|
|
||||||
public function deleteByKey( $key, $time = 0 ) {}
|
|
||||||
|
|
||||||
public function increment( $key, $offset = 1) {}
|
|
||||||
|
|
||||||
public function decrement( $key, $offset = 1) {}
|
|
||||||
|
|
||||||
public function getOption( $option ) {}
|
|
||||||
|
|
||||||
public function setOption( $option, $value ) {}
|
|
||||||
|
|
||||||
public function addServer( $host, $port, $weight = 0 ) {}
|
|
||||||
|
|
||||||
public function addServers( array $servers ) {}
|
|
||||||
|
|
||||||
public function getServerList( ) {}
|
|
||||||
|
|
||||||
public function getServerByKey( $server_key ) {}
|
|
||||||
|
|
||||||
public function flush( $delay = 0 ) {}
|
|
||||||
|
|
||||||
public function getStats( ) {}
|
|
||||||
|
|
||||||
public function getResultCode( ) {}
|
|
||||||
|
|
||||||
public function getResultMessage( ) {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class MemcachedException extends Exception {
|
|
||||||
|
|
||||||
function __construct( $errmsg = "", $errcode = 0 ) {}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Comment the following line to enable
|
|
||||||
die('Please REMOVE THIS FILE from your production environment!<br /><br />'. basename(__FILE__));
|
|
||||||
|
|
||||||
require('./dbg_config.php');
|
|
||||||
|
|
||||||
$interpreter = $bb_cfg['dbg']['interpreter'];
|
|
||||||
$prog_path = $_GET['prog'];
|
|
||||||
$prog_args = $_GET['args'];
|
|
||||||
|
|
||||||
$command = "$interpreter $prog_path $prog_args";
|
|
||||||
exec($command);
|
|
||||||
echo '<HTML><BODY onload="javascript:self.close()"></BODY></HTML>';
|
|
||||||
exit;
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
require('profiler/profiler.php');
|
|
||||||
$profiler = profiler::init('dbg');
|
|
||||||
$min_time = !empty($_COOKIE['prof_min_time']) ? $_COOKIE['prof_min_time'] : '0.1%';
|
|
||||||
$profiler->print_profile_data($min_time);
|
|
||||||
?>
|
|
||||||
|
|
||||||
$min_time - â ñåêóíäàõ èëè ïðîöåíòàõ ("0.01" - ñåêóíäû, "0.01%" - ïðîöåíòû)
|
|
||||||
|
|
|
@ -1,119 +0,0 @@
|
||||||
#profContainer {
|
|
||||||
background-color: #F5F5F5;
|
|
||||||
}
|
|
||||||
.profTable {
|
|
||||||
background: #D3D3D3;
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
.profHead {
|
|
||||||
color: #000000;
|
|
||||||
background: #F5F5F5;
|
|
||||||
font-size: 11px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.profFile {
|
|
||||||
color: #F5F5F5;
|
|
||||||
background: #71869F;
|
|
||||||
font-size: 13px;
|
|
||||||
text-align: left;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
padding: 3px 4px 4px 12px;
|
|
||||||
}
|
|
||||||
.profFunc {
|
|
||||||
color: #2C2C2C;
|
|
||||||
font-size: 13px;
|
|
||||||
background: #ECECEA;
|
|
||||||
padding: 1px 4px 1px 3px;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-family: "Courier New", Courier, monospace;
|
|
||||||
}
|
|
||||||
.funcTime {
|
|
||||||
padding: 1px 3px 1px 3px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.funcName {
|
|
||||||
padding: 1px 4px 1px 6px;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.profFoot {
|
|
||||||
color: #000000;
|
|
||||||
background: #D1D7DC;
|
|
||||||
font-size: 11px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.profTD {
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.profRow1 {
|
|
||||||
background: #F4F4F4;
|
|
||||||
}
|
|
||||||
.profRow2 {
|
|
||||||
background: #F4F4F4;
|
|
||||||
}
|
|
||||||
.perc {
|
|
||||||
padding: 2px 4px 2px 6px;
|
|
||||||
text-align: right;
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
.high1 {
|
|
||||||
color: #BB0000;
|
|
||||||
}
|
|
||||||
.high3 {
|
|
||||||
font-size: 11px;
|
|
||||||
color: #EA0000;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.high5 {
|
|
||||||
font-size: 11px;
|
|
||||||
color: #FF0000;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.time {
|
|
||||||
padding: 2px 4px 2px 4px;
|
|
||||||
text-align: center;
|
|
||||||
color: #285C30;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.avg {
|
|
||||||
padding: 2px 2px 2px 4px;
|
|
||||||
font-size: 10px;
|
|
||||||
font-style: normal;
|
|
||||||
text-align: center;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
color: #336633;
|
|
||||||
}
|
|
||||||
.hits {
|
|
||||||
font-size: 10px;
|
|
||||||
padding: 2px 4px 2px 4px;
|
|
||||||
text-align: center;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
.line {
|
|
||||||
font-size: 10px;
|
|
||||||
padding: 2px 4px 2px 6px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.scr {
|
|
||||||
padding: 2px 4px 2px 4px;
|
|
||||||
font-size: 11px;
|
|
||||||
text-align: left;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.srcOpen .srcOpen:link, .srcOpen:visited {
|
|
||||||
color: #000099;
|
|
||||||
}
|
|
||||||
font {
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.warningBox1 {
|
|
||||||
color: darkred;
|
|
||||||
border: 1px solid #B22222;
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
.files {
|
|
||||||
font-size: 12px;
|
|
||||||
background: #FBFBFB;
|
|
||||||
font-family: Courier, monospace;
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class profiler
|
|
||||||
{
|
|
||||||
static function &init ($extension_name)
|
|
||||||
{
|
|
||||||
echo "\n".'
|
|
||||||
<style type="text/css">
|
|
||||||
'. file_get_contents(dirname(__FILE__) .'/profiler.css') .'
|
|
||||||
</style>
|
|
||||||
'."\n";
|
|
||||||
|
|
||||||
if (!extension_loaded($extension_name))
|
|
||||||
{
|
|
||||||
echo '
|
|
||||||
<div class="warningBox1">
|
|
||||||
Cannot load <b>'. $extension_name .'</b> extension. Please check your PHP configuration.
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
$profiler_module_name = dirname(__FILE__) .'/profiler_'. basename($extension_name) .'.php';
|
|
||||||
|
|
||||||
if (include($profiler_module_name))
|
|
||||||
{
|
|
||||||
$profiler_class_name = "profiler_{$extension_name}";
|
|
||||||
$profiler_obj = new $profiler_class_name();
|
|
||||||
return $profiler_obj;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error("Unsupported profiler extension: $extension_name", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,373 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
Original from http://forum.dklab.ru/php/advises/ProfaylerForScriptsOnPhp.html
|
|
||||||
completely rewritten by Meithar
|
|
||||||
|
|
||||||
Usage of profiler script:
|
|
||||||
1. Setup 'php_dbg' [http://dd.cron.ru/dbg/] module on your php.ini
|
|
||||||
2. Run DBG Listener
|
|
||||||
3. Include this file at the end of you script
|
|
||||||
4. To enable profiling use you script with parameters: ?DBGSESSID=1@clienthost:7869;p=1
|
|
||||||
P.S.: see parameters bellow
|
|
||||||
5. To disable profiling use you script with parameters: ?DBGSESSID=-1
|
|
||||||
|
|
||||||
P.S. All DBGSESSID parameters stored in cookie. You must run in once to enable, and
|
|
||||||
once to disable.
|
|
||||||
|
|
||||||
|
|
||||||
*****************************************************************************
|
|
||||||
DBGSESSID Usage:
|
|
||||||
*****************************************************************************
|
|
||||||
|
|
||||||
DBGSESSID=nnn[@host][:port][;{flags}]
|
|
||||||
|
|
||||||
where
|
|
||||||
|
|
||||||
nnn - is session ID (any positive number or zero)
|
|
||||||
NOTE: negative values prohibit debug session to run and drops cookie
|
|
||||||
|
|
||||||
host - is host name or IP address of the host where your run PHPED IDE.
|
|
||||||
You may set clienthost which is a keyword, in this case debugger looks for
|
|
||||||
proper client IP address automatically.
|
|
||||||
|
|
||||||
flags - set of the following flags delimited with commas:
|
|
||||||
s=skip - skip number of HTTP requests before actual session should run
|
|
||||||
d={0|1} - start debug session
|
|
||||||
p={0|1} - start profiler session
|
|
||||||
|
|
||||||
For example:
|
|
||||||
DBGSESSID=1@clienthost:7869;d=1,p=1
|
|
||||||
DBGSESSID=1;d=1,p=0
|
|
||||||
DBGSESSID=1:7869;d=1,p=0,s=5
|
|
||||||
|
|
||||||
On/Off:
|
|
||||||
javascript: document.cookie = 'DBGSESSID=' + escape('1;d=1,p=0') + '; path=/'; document.execCommand('refresh');
|
|
||||||
javascript: document.cookie = 'DBGSESSID=' + escape('1;d=0,p=0') + '; path=/'; document.execCommand('refresh');
|
|
||||||
|
|
||||||
javascript:location.href=location.protocol+'//'+location.hostname+location.pathname+'?DBGSESSID=1;d=1,p=0'
|
|
||||||
javascript:location.href=location.protocol+'//'+location.hostname+location.pathname+'?DBGSESSID=-1
|
|
||||||
|
|
||||||
*****************************************************************************
|
|
||||||
PHP_DBG Module functions
|
|
||||||
*****************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get all profiler results
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_profiler_results(array &$results);
|
|
||||||
|
|
||||||
return int: count of $results
|
|
||||||
|
|
||||||
$results = array(
|
|
||||||
'mod_no' => array(),
|
|
||||||
'line_no' => array(),
|
|
||||||
'hit_count' => array(),
|
|
||||||
'tm_max' => array(),
|
|
||||||
'tm_min' => array(),
|
|
||||||
'tm_sum' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get all modules name
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_all_module_names(array &$results);
|
|
||||||
|
|
||||||
return int: count of $results
|
|
||||||
|
|
||||||
$results = array(
|
|
||||||
'mod_no' => array(),
|
|
||||||
'mod_name' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get module name
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_module_name(int $mod_no, string &$results);
|
|
||||||
|
|
||||||
return int: 0 - error
|
|
||||||
1 - success
|
|
||||||
|
|
||||||
$results = module name
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get all context (function name) for given module
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_all_contexts(int $mod_no, array &$results);
|
|
||||||
|
|
||||||
if $mod_no = 0 it returns all contexts
|
|
||||||
|
|
||||||
return int: count of $results
|
|
||||||
|
|
||||||
$results = array(
|
|
||||||
'ctx_no' => array(),
|
|
||||||
'mod_no' => array(),
|
|
||||||
'ctx_name' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get context name
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_context_name(int $ctx_no, string &$function_name);
|
|
||||||
|
|
||||||
return int: 0 - error
|
|
||||||
1 - success
|
|
||||||
|
|
||||||
$function_name = function name
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get all source lines for given module
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_all_source_lines(int $mod_no, array &$results);
|
|
||||||
|
|
||||||
if $mod_no = 0 it returns all source lines for all contexts
|
|
||||||
|
|
||||||
return int: count of $results
|
|
||||||
|
|
||||||
$results = array(
|
|
||||||
'ctx_no' => array(),
|
|
||||||
'mod_no' => array(),
|
|
||||||
'line_no' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
|
||||||
get context id for given module and line
|
|
||||||
---------------------------------------------------
|
|
||||||
int dbg_get_source_context(int $mod_no, int $line_no, int &$ctx_no);
|
|
||||||
|
|
||||||
return int: 0 - error
|
|
||||||
1 - success
|
|
||||||
|
|
||||||
$ctx_no = function name
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
class profiler_dbg extends profiler
|
|
||||||
{
|
|
||||||
var $min_time = 0;
|
|
||||||
var $total_time = 0;
|
|
||||||
|
|
||||||
// $min_time - минимальное время выполнения для вывода в подробной построковой информации (в секундах или %)
|
|
||||||
//
|
|
||||||
function print_profile_data ($min_time = 0)
|
|
||||||
{
|
|
||||||
// Get all profiling data
|
|
||||||
dbg_get_profiler_results (&$results); # prn($results);
|
|
||||||
dbg_get_all_module_names (&$modules);
|
|
||||||
dbg_get_all_contexts (0, &$context);
|
|
||||||
dbg_get_all_source_lines (0, &$lines);
|
|
||||||
|
|
||||||
$this->total_time = array_sum($results['tm_sum']);
|
|
||||||
$this->min_time = strpos($min_time, '%') ? $this->total_time * floatval($min_time)/100 : floatval($min_time);
|
|
||||||
$percent = ($this->total_time) ? 100/$this->total_time : 0;
|
|
||||||
|
|
||||||
$module_names = $context_names = $context_lines = $profile = array();
|
|
||||||
|
|
||||||
// Module names
|
|
||||||
foreach ($modules['mod_no'] as $id => $module_no)
|
|
||||||
{
|
|
||||||
$module_names[$module_no] = $modules['mod_name'][$id];
|
|
||||||
|
|
||||||
$profile[$module_no]['time'] = 0;
|
|
||||||
$profile[$module_no]['.'] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Context names
|
|
||||||
foreach ($context['mod_no'] as $id => $context_no)
|
|
||||||
{
|
|
||||||
$module_no = $context['ctx_no'][$id];
|
|
||||||
$ctx_name = $context['ctx_name'][$id];
|
|
||||||
|
|
||||||
$context_names[$context_no] = ($ctx_name) ? "$ctx_name()" : 'GLOBAL';
|
|
||||||
|
|
||||||
$profile[$module_no]['.'][$context_no]['time'] = 0;
|
|
||||||
$profile[$module_no]['.'][$context_no]['.'] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Context lines
|
|
||||||
foreach ($lines['line_no'] as $id => $line_no)
|
|
||||||
{
|
|
||||||
$module_no = $lines['mod_no'][$id];
|
|
||||||
|
|
||||||
$context_lines[$module_no][$line_no] = $lines['ctx_no'][$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build profiling data
|
|
||||||
foreach ($results['line_no'] as $id => $line_no)
|
|
||||||
{
|
|
||||||
$module_no = $results['mod_no'][$id];
|
|
||||||
$context_no = $context_lines[$module_no][$line_no];
|
|
||||||
|
|
||||||
$profile[$module_no]['time'] += $results['tm_sum'][$id];
|
|
||||||
$profile[$module_no]['.'][$context_no]['time'] += $results['tm_sum'][$id];
|
|
||||||
|
|
||||||
if ($results['tm_sum'][$id] < $this->min_time)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile[$module_no]['.'][$context_no]['.'][$line_no] = array(
|
|
||||||
'time' => $results['tm_sum'][$id],
|
|
||||||
'hits' => $results['hit_count'][$id],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort profiling data: modules, contexts and lines
|
|
||||||
uasort($profile, array(__CLASS__, 'sort_by_time_desc'));
|
|
||||||
|
|
||||||
foreach ($profile as $module_no => $context)
|
|
||||||
{
|
|
||||||
uasort($profile[$module_no]['.'], array(__CLASS__, 'sort_by_time_desc'));
|
|
||||||
|
|
||||||
foreach ($context['.'] as $context_no => $lines)
|
|
||||||
{
|
|
||||||
uasort($profile[$module_no]['.'][$context_no]['.'], array(__CLASS__, 'sort_by_time_desc'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display profiling data
|
|
||||||
$colspan = 6;
|
|
||||||
$row_class = 'profRow1';
|
|
||||||
|
|
||||||
// Replacements for cleaning highlighted code
|
|
||||||
$highlight_replacements = array(
|
|
||||||
'<code>' => '',
|
|
||||||
'</code>' => '',
|
|
||||||
' ' => ' ',
|
|
||||||
'><?php' => '>',
|
|
||||||
'?><' => '<',
|
|
||||||
'><?<' => '><',
|
|
||||||
'>php ' => '>',
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div id="profContainer">
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
';
|
|
||||||
// Modules
|
|
||||||
foreach ($profile as $module_no => $context)
|
|
||||||
{
|
|
||||||
$module_path = $module_names[$module_no];
|
|
||||||
$module_name = basename($module_path);
|
|
||||||
$module_src = is_file($module_path) ? file($module_path) : array();
|
|
||||||
$module_time = sprintf('%.4f', $context['time']);
|
|
||||||
$module_perc = sprintf('%.1f', $context['time']*$percent);
|
|
||||||
|
|
||||||
if ($module_time < $this->min_time)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table cellspacing="1" cellpadding="2" border="0" class="profTable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td colspan="'. $colspan .'" class="profFile">' . "[ <b>$module_perc%</b>, $module_time sec. ] :: <b>$module_name</b> " . '</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="profHead"> % </td>
|
|
||||||
<td class="profHead"> time </td>
|
|
||||||
<td class="profHead"> avg </td>
|
|
||||||
<td class="profHead"> hits </td>
|
|
||||||
<td class="profHead"> line </td>
|
|
||||||
<td class="profHead" width="100%" style="text-align: left;"> source </td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
'."\n";
|
|
||||||
|
|
||||||
// Context
|
|
||||||
foreach ($context['.'] as $context_no => $lines)
|
|
||||||
{
|
|
||||||
$context_name = $context_names[$context_no];
|
|
||||||
$context_time = $this->get_ms($lines['time']);
|
|
||||||
$context_perc = sprintf('%.2f', $lines['time']*$percent);
|
|
||||||
$row_class = ($row_class == 'profRow1') ? 'profRow2' : 'profRow1';
|
|
||||||
|
|
||||||
if ($lines['time'] < $this->min_time)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" class="profFunc funcTime">'. "<b>$context_perc%</b>" .'</td>
|
|
||||||
<td colspan="2" class="profFunc funcTime">'. "<b>$context_time</b> ms" .'</td>
|
|
||||||
<td colspan="'. ($colspan-4) .'" class="profFunc funcName">'. $context_name .'</td>
|
|
||||||
</tr>
|
|
||||||
';
|
|
||||||
|
|
||||||
// Lines
|
|
||||||
foreach ($lines['.'] as $line_no => $data)
|
|
||||||
{
|
|
||||||
$line_perc = $data['time']*$percent;
|
|
||||||
$line_perc = ($line_perc > 0.05) ? sprintf('%.1f', $line_perc) : '';
|
|
||||||
$line_hits = ($data['hits'] != 1) ? $data['hits'] : '';
|
|
||||||
$line_link = '<a class="srcOpen" href="#" onClick="OpenInEditor(\''. addslashes($module_path) ."', $line_no); return false;\">". $line_no .'</a>';
|
|
||||||
$line_time_sum = $this->get_ms($data['time']);
|
|
||||||
$line_time_avg = ($line_hits) ? $this->get_ms($data['time']/$line_hits, 3) : '';
|
|
||||||
|
|
||||||
$perc_class = 'perc';
|
|
||||||
if ($line_perc > 5) $perc_class .= ' high5';
|
|
||||||
elseif ($line_perc > 3) $perc_class .= ' high3';
|
|
||||||
elseif ($line_perc > 1) $perc_class .= ' high1';
|
|
||||||
|
|
||||||
if ($line_src =& $module_src[$line_no-1])
|
|
||||||
{
|
|
||||||
$line_src = preg_replace('#\s+#', ' ', trim($line_src));
|
|
||||||
$line_src = highlight_string("<?php $line_src", true);
|
|
||||||
$line_src = strtr($line_src, $highlight_replacements);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr class="'. $row_class .'">
|
|
||||||
<td class="profTD '. $perc_class .'">'. $line_perc .'</td>
|
|
||||||
<td class="profTD time">'. $line_time_sum .'</td>
|
|
||||||
<td class="profTD avg">'. $line_time_avg .'</td>
|
|
||||||
<td class="profTD hits">'. $line_hits .'</td>
|
|
||||||
<td class="profTD line">'. $line_link .'</td>
|
|
||||||
<td class="profTD scr" nowrap="nowrap">'. $line_src .'</td>
|
|
||||||
</tr>
|
|
||||||
'."\n";
|
|
||||||
} // Lines
|
|
||||||
} // Context
|
|
||||||
} // Modules
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</tbody></table>
|
|
||||||
<table cellspacing="1" cellpadding="2" border="0" class="profTable">
|
|
||||||
<tr>
|
|
||||||
<td class="files">
|
|
||||||
<div><b>[ '. count($modules['mod_name']) .' files, '. sprintf('%.3f', $this->total_time) .' sec. ]</b></div>
|
|
||||||
<div>'. join('<br />', $modules['mod_name']) .'</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<br clear="all" />
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_ms ($time, $precision = 2)
|
|
||||||
{
|
|
||||||
return ($time < 0.001) ? round($time*1000, $precision) : round($time*1000, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function sort_by_time_desc ($a, $b)
|
|
||||||
{
|
|
||||||
if ($a['time'] == $b['time']) return 0;
|
|
||||||
return ($a['time'] > $b['time']) ? -1 : 1;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Comment the following line to enable
|
|
||||||
die('Please REMOVE THIS FILE from your production environment!<br /><br />'. basename(__FILE__));
|
|
||||||
|
|
||||||
define('IN_FORUM', true);
|
|
||||||
define('BB_ROOT', './../');
|
|
||||||
|
|
||||||
require('./dbg_config.php');
|
|
||||||
require('./functions_debug.php');
|
|
||||||
|
|
||||||
$file = @$_GET['file'];
|
|
||||||
$line = @$_GET['line'];
|
|
||||||
$prev = @$_GET['prev'] ? $_GET['prev'] : 15;
|
|
||||||
$next = @$_GET['next'] ? $_GET['next'] : 15;
|
|
||||||
|
|
||||||
require('./dbg_header.php');
|
|
||||||
echo showSource($file, $line, $prev, $next);
|
|
|
@ -36,7 +36,7 @@ if ($mode == 'set_dl_status' || $mode == 'set_topics_dl_status')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Invalid download status');
|
bb_die('Invalid download status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,28 +80,23 @@ if (@$_POST['cancel'])
|
||||||
redirect("$redirect_type?$redirect");
|
redirect("$redirect_type?$redirect");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Delete DL-list
|
// Delete DL-list
|
||||||
//
|
|
||||||
if ($mode == 'dl_delete' && $topic_id)
|
if ($mode == 'dl_delete' && $topic_id)
|
||||||
{
|
{
|
||||||
if (!IS_ADMIN)
|
if (!IS_ADMIN)
|
||||||
{
|
{
|
||||||
$sql = "SELECT forum_id
|
$sql = "SELECT forum_id FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1";
|
||||||
FROM ". BB_TOPICS ."
|
|
||||||
WHERE topic_id = $topic_id
|
|
||||||
LIMIT 1";
|
|
||||||
|
|
||||||
if (!$row = DB()->sql_fetchrow(DB()->sql_query($sql)))
|
if (!$row = DB()->sql_fetchrow(DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain forum_id for this topic', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain forum_id for this topic');
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);
|
$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);
|
||||||
|
|
||||||
if (!$is_auth['auth_mod'])
|
if (!$is_auth['auth_mod'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NOT_MODERATOR'], $lang['NOT_AUTHORISED']);
|
bb_die($lang['NOT_MODERATOR']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +118,7 @@ if ($mode == 'dl_delete' && $topic_id)
|
||||||
redirect("$redirect_type?$redirect");
|
redirect("$redirect_type?$redirect");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Update DL status
|
// Update DL status
|
||||||
//
|
|
||||||
|
|
||||||
$req_topics_ary = $topics_ary = array();
|
$req_topics_ary = $topics_ary = array();
|
||||||
|
|
||||||
// Get topics selected by user
|
// Get topics selected by user
|
||||||
|
@ -134,7 +126,7 @@ if ($mode == 'set_topics_dl_status')
|
||||||
{
|
{
|
||||||
if (!isset($_POST['dl_topics_id_list']) || !is_array($_POST['dl_topics_id_list']))
|
if (!isset($_POST['dl_topics_id_list']) || !is_array($_POST['dl_topics_id_list']))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NONE_SELECTED']);
|
bb_die($lang['NONE_SELECTED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($_POST['dl_topics_id_list'] as $topic_id)
|
foreach ($_POST['dl_topics_id_list'] as $topic_id)
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
define('IN_FORUM', true);
|
|
||||||
define('BB_SCRIPT', 'donate');
|
|
||||||
define('BB_ROOT', './');
|
|
||||||
require(BB_ROOT ."common.php");
|
|
||||||
|
|
||||||
// Start session management
|
|
||||||
$user->session_start();
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'PAGE_TITLE' => $lang['DONATION'],
|
|
||||||
));
|
|
||||||
|
|
||||||
print_page('donate.tpl');
|
|
|
@ -24,17 +24,14 @@ function send_file_to_browser($attachment, $upload_dir)
|
||||||
|
|
||||||
$gotit = false;
|
$gotit = false;
|
||||||
|
|
||||||
if (!intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if (@!file_exists(@amod_realpath($filename)))
|
if (@!file_exists(@amod_realpath($filename)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename. "<br /><br />" .$lang['TOR_NOT_FOUND']);
|
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename. "<br /><br />" .$lang['TOR_NOT_FOUND']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$gotit = true;
|
$gotit = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the Browser the User is using, because of some nasty incompatibilities.
|
// Determine the Browser the User is using, because of some nasty incompatibilities.
|
||||||
|
@ -49,47 +46,11 @@ function send_file_to_browser($attachment, $upload_dir)
|
||||||
$HTTP_USER_AGENT = '';
|
$HTTP_USER_AGENT = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/Opera(\/| )([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
|
// Correct the mime type - we force application/octet-stream for all files, except images
|
||||||
{
|
|
||||||
$browser_version = $log_version[2];
|
|
||||||
$browser_agent = 'opera';
|
|
||||||
}
|
|
||||||
elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
|
|
||||||
{
|
|
||||||
$browser_version = $log_version[1];
|
|
||||||
$browser_agent = 'ie';
|
|
||||||
}
|
|
||||||
elseif (preg_match('/OmniWeb\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
|
|
||||||
{
|
|
||||||
$browser_version = $log_version[1];
|
|
||||||
$browser_agent = 'omniweb';
|
|
||||||
}
|
|
||||||
elseif (preg_match('/Netscape([0-9]{1})/', $HTTP_USER_AGENT, $log_version))
|
|
||||||
{
|
|
||||||
$browser_version = $log_version[1];
|
|
||||||
$browser_agent = 'netscape';
|
|
||||||
}
|
|
||||||
elseif (preg_match('/Mozilla\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
|
|
||||||
{
|
|
||||||
$browser_version = $log_version[1];
|
|
||||||
$browser_agent = 'mozilla';
|
|
||||||
}
|
|
||||||
elseif (preg_match('/Konqueror\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
|
|
||||||
{
|
|
||||||
$browser_version = $log_version[1];
|
|
||||||
$browser_agent = 'konqueror';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$browser_version = 0;
|
|
||||||
$browser_agent = 'other';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Correct the mime type - we force application/octetstream for all files, except images
|
|
||||||
// Please do not change this, it is a security precaution
|
// Please do not change this, it is a security precaution
|
||||||
if (!strstr($attachment['mimetype'], 'image'))
|
if (!strstr($attachment['mimetype'], 'image'))
|
||||||
{
|
{
|
||||||
$attachment['mimetype'] = ($browser_agent == 'ie' || $browser_agent == 'opera') ? 'application/octetstream' : 'application/octet-stream';
|
$attachment['mimetype'] = 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
//bt
|
//bt
|
||||||
|
@ -120,43 +81,9 @@ function send_file_to_browser($attachment, $upload_dir)
|
||||||
}
|
}
|
||||||
readfile($filename);
|
readfile($filename);
|
||||||
}
|
}
|
||||||
elseif (!$gotit && intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
$conn_id = attach_init_ftp();
|
|
||||||
|
|
||||||
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
|
|
||||||
|
|
||||||
$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : $upload_dir;
|
|
||||||
$tmp_filename = @tempnam($tmp_path, 't0000');
|
|
||||||
|
|
||||||
@unlink($tmp_filename);
|
|
||||||
|
|
||||||
$mode = FTP_BINARY;
|
|
||||||
if ( (preg_match("/text/i", $attachment['mimetype'])) || (preg_match("/html/i", $attachment['mimetype'])) )
|
|
||||||
{
|
|
||||||
$mode = FTP_ASCII;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = @ftp_get($conn_id, $tmp_filename, $filename, $mode);
|
|
||||||
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename. "<br /><br />" .$lang['TOR_NOT_FOUND']);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ftp_quit($conn_id);
|
|
||||||
|
|
||||||
$size = @filesize($tmp_filename);
|
|
||||||
if ($size)
|
|
||||||
{
|
|
||||||
header("Content-length: $size");
|
|
||||||
}
|
|
||||||
readfile($tmp_filename);
|
|
||||||
@unlink($tmp_filename);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename. "<br /><br />" .$lang['TOR_NOT_FOUND']);
|
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename. "<br /><br />" .$lang['TOR_NOT_FOUND']);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
@ -171,26 +98,24 @@ set_die_append_msg();
|
||||||
|
|
||||||
if (!$download_id)
|
if (!$download_id)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['NO_ATTACHMENT_SELECTED']);
|
bb_die($lang['NO_ATTACHMENT_SELECTED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($attach_config['disable_mod'] && !IS_ADMIN)
|
if ($attach_config['disable_mod'] && !IS_ADMIN)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['ATTACHMENT_FEATURE_DISABLED']);
|
bb_die($lang['ATTACHMENT_FEATURE_DISABLED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int) $download_id;
|
||||||
FROM ' . BB_ATTACHMENTS_DESC . '
|
|
||||||
WHERE attach_id = ' . (int) $download_id;
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachment information #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($attachment = DB()->sql_fetchrow($result)))
|
if (!($attachment = DB()->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['ERROR_NO_ATTACHMENT']);
|
bb_die($lang['ERROR_NO_ATTACHMENT']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachment['physical_filename'] = basename($attachment['physical_filename']);
|
$attachment['physical_filename'] = basename($attachment['physical_filename']);
|
||||||
|
@ -200,13 +125,11 @@ DB()->sql_freeresult($result);
|
||||||
// get forum_id for attachment authorization or private message authorization
|
// get forum_id for attachment authorization or private message authorization
|
||||||
$authorised = false;
|
$authorised = false;
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT * FROM ' . BB_ATTACHMENTS . ' WHERE attach_id = ' . (int) $attachment['attach_id'];
|
||||||
FROM ' . BB_ATTACHMENTS . '
|
|
||||||
WHERE attach_id = ' . (int) $attachment['attach_id'];
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query attachment informations', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query attachment information #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_pages = DB()->sql_fetchrowset($result);
|
$auth_pages = DB()->sql_fetchrowset($result);
|
||||||
|
@ -218,13 +141,11 @@ for ($i = 0; $i < $num_auth_pages && $authorised == false; $i++)
|
||||||
|
|
||||||
if ($auth_pages[$i]['post_id'] != 0)
|
if ($auth_pages[$i]['post_id'] != 0)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT forum_id, topic_id
|
$sql = 'SELECT forum_id, topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int) $auth_pages[$i]['post_id'];
|
||||||
FROM ' . BB_POSTS . '
|
|
||||||
WHERE post_id = ' . (int) $auth_pages[$i]['post_id'];
|
|
||||||
|
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query post information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query post information');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -246,7 +167,7 @@ for ($i = 0; $i < $num_auth_pages && $authorised == false; $i++)
|
||||||
|
|
||||||
if (!$authorised)
|
if (!$authorised)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['SORRY_AUTH_VIEW_ATTACH']);
|
bb_die($lang['SORRY_AUTH_VIEW_ATTACH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->rm('cat_forums');
|
$datastore->rm('cat_forums');
|
||||||
|
@ -264,10 +185,10 @@ for ($i = 0; $i < $num_rows; $i++)
|
||||||
$download_mode[$extension] = $rows[$i]['download_mode'];
|
$download_mode[$extension] = $rows[$i]['download_mode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// disallowed ?
|
// Disallowed
|
||||||
if (!in_array($attachment['extension'], $allowed_extensions) && !IS_ADMIN)
|
if (!in_array($attachment['extension'], $allowed_extensions) && !IS_ADMIN)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']));
|
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$download_mode = intval($download_mode[$attachment['extension']]);
|
$download_mode = intval($download_mode[$attachment['extension']]);
|
||||||
|
@ -284,28 +205,14 @@ if (!$thumbnail)
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update attachment download count');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the 'presenting'-method
|
// Determine the 'presenting'-method
|
||||||
if ($download_mode == PHYSICAL_LINK)
|
if ($download_mode == PHYSICAL_LINK)
|
||||||
{
|
|
||||||
if (intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
if (trim($attach_config['download_path']) == '')
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Physical Download not possible with the current Attachment Setting');
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = make_url($attach_config['download_path']) . '/' . $attachment['physical_filename'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$url = make_url($upload_dir . '/' . $attachment['physical_filename']);
|
$url = make_url($upload_dir . '/' . $attachment['physical_filename']);
|
||||||
}
|
|
||||||
|
|
||||||
// Behave as per HTTP/1.1 spec for others
|
|
||||||
header('Location: ' . $url);
|
header('Location: ' . $url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -332,15 +239,6 @@ else
|
||||||
require(PAGE_FOOTER);
|
require(PAGE_FOOTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($attach_config['allow_ftp_upload']))
|
|
||||||
{
|
|
||||||
// We do not need a download path, we are not downloading physically
|
|
||||||
send_file_to_browser($attachment, '');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
send_file_to_browser($attachment, $upload_dir);
|
send_file_to_browser($attachment, $upload_dir);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 1.3 KiB |
|
@ -1,5 +1,3 @@
|
||||||
php_flag engine off
|
php_flag engine off
|
||||||
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
|
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
|
||||||
AddType text/plain .php .php .htm .html .phtml .pl .asp
|
AddType text/plain .php .php .htm .html .phtml .pl .asp
|
||||||
Options -Indexes
|
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ if (!$group_id)
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SELECT_GROUP' => true,
|
'SELECT_GROUP' => true,
|
||||||
'PAGE_TITLE' => $lang['GROUP_CONTROL_PANEL'],
|
'PAGE_TITLE' => $lang['GROUP_CONTROL_PANEL'],
|
||||||
'S_USERGROUP_ACTION' => "groupcp.php",
|
'S_USERGROUP_ACTION' => 'groupcp.php',
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ else
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql_select))
|
if (!$result = DB()->sql_query($sql_select))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql_select);
|
bb_die('Could not get user email information');
|
||||||
}
|
}
|
||||||
|
|
||||||
require(INC_DIR .'emailer.class.php');
|
require(INC_DIR .'emailer.class.php');
|
||||||
|
@ -534,7 +534,6 @@ else
|
||||||
'ROW_NUMBER' => $i + ($start + 1),
|
'ROW_NUMBER' => $i + ($start + 1),
|
||||||
'GROUP_INFO' => true,
|
'GROUP_INFO' => true,
|
||||||
'PAGE_TITLE' => $lang['GROUP_CONTROL_PANEL'],
|
'PAGE_TITLE' => $lang['GROUP_CONTROL_PANEL'],
|
||||||
|
|
||||||
'GROUP_NAME' => htmlCHR($group_info['group_name']),
|
'GROUP_NAME' => htmlCHR($group_info['group_name']),
|
||||||
'GROUP_DESCRIPTION' => $group_info['group_description'],
|
'GROUP_DESCRIPTION' => $group_info['group_description'],
|
||||||
'GROUP_DETAILS' => $group_details,
|
'GROUP_DETAILS' => $group_details,
|
||||||
|
|
Before Width: | Height: | Size: 906 B |
Before Width: | Height: | Size: 313 B |
BIN
upload/images/icon_external.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 25 KiB |
|
@ -1,56 +0,0 @@
|
||||||
aa.gif=+:aa=+::aa:
|
|
||||||
ab.gif=+:ab=+::ab:
|
|
||||||
ac.gif=+:ac=+::ac:
|
|
||||||
ad.gif=+:ad=+::ad:
|
|
||||||
ae.gif=+:ae=+::ae:
|
|
||||||
af.gif=+:af=+::af:
|
|
||||||
ag.gif=+:ag=+::ag:
|
|
||||||
ah.gif=+:ah=+::ah:
|
|
||||||
ai.gif=+:ai=+::ai:
|
|
||||||
aj.gif=+:aj=+::aj:
|
|
||||||
ak.gif=+:ak=+::ak:
|
|
||||||
al.gif=+:al=+::al:
|
|
||||||
am.gif=+:am=+::am:
|
|
||||||
an.gif=+:an=+::an:
|
|
||||||
ao.gif=+:ao=+::ao:
|
|
||||||
ap.gif=+:ap=+::ap:
|
|
||||||
aq.gif=+:aq=+::aq:
|
|
||||||
ar.gif=+:ar=+::ar:
|
|
||||||
as.gif=+:as=+::as:
|
|
||||||
at.gif=+:at=+::at:
|
|
||||||
au.gif=+:au=+::au:
|
|
||||||
av.gif=+:av=+::av:
|
|
||||||
aw.gif=+:aw=+::aw:
|
|
||||||
ax.gif=+:ax=+::ax:
|
|
||||||
ay.gif=+:ay=+::ay:
|
|
||||||
az.gif=+:az=+::az:
|
|
||||||
ba.gif=+:ba=+::ba:
|
|
||||||
bb.gif=+:bb=+::bb:
|
|
||||||
bc.gif=+:bc=+::bc:
|
|
||||||
bd.gif=+:bd=+::bd:
|
|
||||||
be.gif=+:be=+::be:
|
|
||||||
bf.gif=+:bf=+::bf:
|
|
||||||
bg.gif=+:bg=+::bg:
|
|
||||||
bh.gif=+:bh=+::bh:
|
|
||||||
bi.gif=+:bi=+::bi:
|
|
||||||
bj.gif=+:bj=+::bj:
|
|
||||||
bk.gif=+:bk=+::bk:
|
|
||||||
bl.gif=+:bl=+::bl:
|
|
||||||
bm.gif=+:bm=+::bm:
|
|
||||||
bn.gif=+:bn=+::bn:
|
|
||||||
bo.gif=+:bo=+::bo:
|
|
||||||
bp.gif=+:bp=+::bp:
|
|
||||||
bq.gif=+:bq=+::bq:
|
|
||||||
br.gif=+:br=+::br:
|
|
||||||
bs.gif=+:bs=+::bs:
|
|
||||||
bt.gif=+:bt=+::bt:
|
|
||||||
bu.gif=+:bu=+::bu:
|
|
||||||
bv.gif=+:bv=+::bv:
|
|
||||||
bw.gif=+:bw=+::bw:
|
|
||||||
bx.gif=+:bx=+::bx:
|
|
||||||
by.gif=+:by=+::by:
|
|
||||||
bz.gif=+:bz=+::bz:
|
|
||||||
ca.gif=+:ca=+::ca:
|
|
||||||
cb.gif=+:cb=+::cb:
|
|
||||||
cc.gif=+:cc=+::cc:
|
|
||||||
cd.gif=+:cd=+::cd:
|
|
2
upload/includes/captcha/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
order allow,deny
|
||||||
|
deny from all
|
|
@ -123,7 +123,7 @@ foreach ($cron_jobs as $job)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cron_err_msg = "Can't run \"{$job['cron_title']}\" : file \"$job_script\" not found". LOG_LF;
|
$cron_err_msg = "Can not run \"{$job['cron_title']}\" : file \"$job_script\" not found". LOG_LF;
|
||||||
bb_log($cron_err_msg, 'cron_error');
|
bb_log($cron_err_msg, 'cron_error');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -58,8 +58,8 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
||||||
ORDER BY user_level DESC, username
|
ORDER BY user_level DESC, username
|
||||||
");
|
");
|
||||||
|
|
||||||
$date_today = bb_date(TIMENOW, 'md', 'false');
|
$date_today = bb_date(TIMENOW, 'md', false);
|
||||||
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday_check_day']*86400), 'md', 'false');
|
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday_check_day']*86400), 'md', false);
|
||||||
|
|
||||||
$birthday_today_list = $birthday_week_list = array();
|
$birthday_today_list = $birthday_week_list = array();
|
||||||
|
|
||||||
|
|
|
@ -791,7 +791,7 @@ class sql_db
|
||||||
{
|
{
|
||||||
if (error_reporting())
|
if (error_reporting())
|
||||||
{
|
{
|
||||||
if (DEBUG === true)
|
if (DBG_LOG === true)
|
||||||
{
|
{
|
||||||
$err = $this->sql_error();
|
$err = $this->sql_error();
|
||||||
$msg .= "\n". trim(sprintf('#%06d %s', $err['code'], $err['message']));
|
$msg .= "\n". trim(sprintf('#%06d %s', $err['code'], $err['message']));
|
||||||
|
@ -940,19 +940,16 @@ class sql_db
|
||||||
$id = $this->dbg_id-1;
|
$id = $this->dbg_id-1;
|
||||||
$htid = 'expl-'. intval($this->link) .'-'. $id;
|
$htid = 'expl-'. intval($this->link) .'-'. $id;
|
||||||
$dbg = $this->dbg[$id];
|
$dbg = $this->dbg[$id];
|
||||||
$file = addslashes($dbg['file']);
|
|
||||||
$line = $dbg['line'];
|
|
||||||
$edit = (DEBUG === true) ? "OpenInEditor('$file', $line);" : '';
|
|
||||||
|
|
||||||
$this->explain_out .= '
|
$this->explain_out .= '
|
||||||
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0px;">
|
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0px;">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="height: 22px; cursor: pointer;" align="left" title="Open in editor (double click)" ondblclick="'. $edit .'"> '. $dbg['src'] .' ['. sprintf('%.4f', $dbg['time']) .' s] <i>'. $dbg['info'] .'</i></th>
|
<th style="height: 22px; cursor: pointer;" align="left"> '. $dbg['src'] .' ['. sprintf('%.4f', $dbg['time']) .' s] <i>'. $dbg['info'] .'</i></th>
|
||||||
<th style="height: 22px; cursor: pointer;" align="right" title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#'. $htid .'\').text() );">'. "$this->db_server.$this->selected_db" .' :: Query #'. ($this->num_queries+1) .' </th>
|
<th style="height: 22px; cursor: pointer;" align="right" title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#'. $htid .'\').text() );">'. "$this->db_server.$this->selected_db" .' :: Query #'. ($this->num_queries+1) .' </th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="2">'. $this->explain_hold .'</td></tr>
|
<tr><td colspan="2">'. $this->explain_hold .'</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="sqlLog"><div id="'. $htid .'" class="sqlLogRow sqlExplain" style="padding: 0px;">'. short_query($dbg['sql'], true) .' '. (UA_IE ? '<br /><br />' : '') .'</div></div>
|
<div class="sqlLog"><div id="'. $htid .'" class="sqlLogRow sqlExplain" style="padding: 0px;">'. short_query($dbg['sql'], true) .' </div></div>
|
||||||
<br />';
|
<br />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class emailer
|
||||||
|
|
||||||
if (trim($template_file) == '')
|
if (trim($template_file) == '')
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
|
bb_die('No template file set');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($template_lang) == '')
|
if (trim($template_lang) == '')
|
||||||
|
@ -106,13 +106,13 @@ class emailer
|
||||||
|
|
||||||
if (!@file_exists(@bb_realpath($tpl_file)))
|
if (!@file_exists(@bb_realpath($tpl_file)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file, '', __LINE__, __FILE__);
|
bb_die('Could not find email template file :: ' . $template_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($fd = @fopen($tpl_file, 'r')))
|
if (!($fd = @fopen($tpl_file, 'r')))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file, '', __LINE__, __FILE__);
|
bb_die('Failed opening template file :: ' . $tpl_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file));
|
$this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file));
|
||||||
|
@ -219,7 +219,7 @@ class emailer
|
||||||
// Did it work?
|
// Did it work?
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__);
|
bb_die('Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1267,8 +1267,6 @@ function get_attachments_dir ($cfg = null)
|
||||||
$cfg = bb_get_config(BB_ATTACH_CONFIG, true, false);
|
$cfg = bb_get_config(BB_ATTACH_CONFIG, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cfg['allow_ftp_upload'])
|
|
||||||
{
|
|
||||||
if ($cfg['upload_dir'][0] == '/' || ($cfg['upload_dir'][0] != '/' && $cfg['upload_dir'][1] == ':'))
|
if ($cfg['upload_dir'][0] == '/' || ($cfg['upload_dir'][0] != '/' && $cfg['upload_dir'][1] == ':'))
|
||||||
{
|
{
|
||||||
return $cfg['upload_dir'];
|
return $cfg['upload_dir'];
|
||||||
|
@ -1278,11 +1276,6 @@ function get_attachments_dir ($cfg = null)
|
||||||
return BB_ROOT . $cfg['upload_dir'];
|
return BB_ROOT . $cfg['upload_dir'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return $cfg['download_path'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function bb_get_config ($table, $from_db = false, $update_cache = true)
|
function bb_get_config ($table, $from_db = false, $update_cache = true)
|
||||||
{
|
{
|
||||||
|
@ -1563,55 +1556,54 @@ function setup_style ()
|
||||||
return $theme;
|
return $theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create date/time from format and timezone
|
// Create date / time with format and friendly date
|
||||||
function bb_date ($gmepoch, $format = false, $tz = null)
|
function bb_date ($gmepoch, $format = false, $friendly_date = true)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $bb_cfg, $lang, $userdata;
|
||||||
|
|
||||||
if (!$format) $format = $bb_cfg['default_dateformat'];
|
if (!$format) $format = $bb_cfg['default_dateformat'];
|
||||||
if (empty($lang)) require_once($bb_cfg['default_lang_dir'] .'main.php');
|
if (empty($lang)) require_once($bb_cfg['default_lang_dir'] .'main.php');
|
||||||
|
|
||||||
if (is_null($tz) || $tz == 'false')
|
|
||||||
{
|
|
||||||
if (empty($userdata['session_logged_in']))
|
if (empty($userdata['session_logged_in']))
|
||||||
{
|
{
|
||||||
$tz2 = $bb_cfg['board_timezone'];
|
$tz = $bb_cfg['board_timezone'];
|
||||||
}
|
}
|
||||||
else $tz2 = $userdata['user_timezone'];
|
else
|
||||||
}
|
|
||||||
elseif (is_numeric($tz)) $tz2 = $tz;
|
|
||||||
|
|
||||||
$date = gmdate($format, $gmepoch + (3600 * $tz2));
|
|
||||||
|
|
||||||
if ($tz != 'false')
|
|
||||||
{
|
{
|
||||||
$time_format = " H:i";
|
$tz = $userdata['user_timezone'];
|
||||||
|
}
|
||||||
|
|
||||||
$today = gmdate("d", TIMENOW + (3600 * $tz2));
|
$date = gmdate($format, $gmepoch + (3600 * $tz));
|
||||||
$month = gmdate("m", TIMENOW + (3600 * $tz2));
|
|
||||||
$year = gmdate("Y", TIMENOW + (3600 * $tz2));
|
|
||||||
|
|
||||||
$date_today = gmdate("d", $gmepoch + (3600 * $tz2));
|
if ($friendly_date)
|
||||||
$date_month = gmdate("m", $gmepoch + (3600 * $tz2));
|
{
|
||||||
$date_year = gmdate("Y", $gmepoch + (3600 * $tz2));
|
$time_format = ' H:i';
|
||||||
|
|
||||||
|
$today = gmdate('d', TIMENOW + (3600 * $tz));
|
||||||
|
$month = gmdate('m', TIMENOW + (3600 * $tz));
|
||||||
|
$year = gmdate('Y', TIMENOW + (3600 * $tz));
|
||||||
|
|
||||||
|
$date_today = gmdate('d', $gmepoch + (3600 * $tz));
|
||||||
|
$date_month = gmdate('m', $gmepoch + (3600 * $tz));
|
||||||
|
$date_year = gmdate('Y', $gmepoch + (3600 * $tz));
|
||||||
|
|
||||||
if ($date_today == $today && $date_month == $month && $date_year == $year)
|
if ($date_today == $today && $date_month == $month && $date_year == $year)
|
||||||
{
|
{
|
||||||
$date = 'today' . gmdate($time_format, $gmepoch + (3600 * $tz2));
|
$date = 'today' . gmdate($time_format, $gmepoch + (3600 * $tz));
|
||||||
}
|
}
|
||||||
elseif ($today != 1 && $date_today == ($today-1) && $date_month == $month && $date_year == $year)
|
elseif ($today != 1 && $date_today == ($today-1) && $date_month == $month && $date_year == $year)
|
||||||
{
|
{
|
||||||
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz2));
|
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
|
||||||
}
|
}
|
||||||
elseif ($today == 1 && $month != 1)
|
elseif ($today == 1 && $month != 1)
|
||||||
{
|
{
|
||||||
$yesterday = date ("t", mktime(0, 0, 0, ($month-1), 1, $year));
|
$yesterday = date ('t', mktime(0, 0, 0, ($month-1), 1, $year));
|
||||||
if ($date_today == $yesterday && $date_month == ($month-1) && $date_year == $year)
|
if ($date_today == $yesterday && $date_month == ($month-1) && $date_year == $year)
|
||||||
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz2));
|
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
|
||||||
}
|
}
|
||||||
elseif ($today == 1 && $month == 1)
|
elseif ($today == 1 && $month == 1)
|
||||||
{
|
{
|
||||||
$yesterday = date ("t", mktime(0, 0, 0, 12, 1, ($year -1)));
|
$yesterday = date ('t', mktime(0, 0, 0, 12, 1, ($year -1)));
|
||||||
if ($date_today == $yesterday && $date_month == 12 && $date_year == ($year-1))
|
if ($date_today == $yesterday && $date_month == 12 && $date_year == ($year-1))
|
||||||
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
|
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
|
||||||
}
|
}
|
||||||
|
@ -1802,55 +1794,35 @@ function smiley_sort ($a, $b)
|
||||||
|
|
||||||
function bb_die ($msg_text)
|
function bb_die ($msg_text)
|
||||||
{
|
{
|
||||||
|
global $ajax, $bb_cfg, $lang, $template, $theme, $userdata;
|
||||||
|
|
||||||
if (defined('IN_AJAX'))
|
if (defined('IN_AJAX'))
|
||||||
{
|
{
|
||||||
$GLOBALS['ajax']->ajax_die($msg_text);
|
$ajax->ajax_die($msg_text);
|
||||||
}
|
|
||||||
message_die(GENERAL_MESSAGE, $msg_text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
|
// Check
|
||||||
{
|
|
||||||
global $DBS, $template, $bb_cfg, $theme, $lang, $userdata;
|
|
||||||
|
|
||||||
if (defined('HAS_DIED'))
|
if (defined('HAS_DIED'))
|
||||||
{
|
{
|
||||||
trigger_error(__FUNCTION__ .' was called multiple times', E_USER_ERROR);
|
trigger_error(__FUNCTION__ .' was called multiple times', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
define('HAS_DIED', 1);
|
define('HAS_DIED', 1);
|
||||||
define('DISABLE_CACHING_OUTPUT', true);
|
define('DISABLE_CACHING_OUTPUT', true);
|
||||||
$sql_store = $sql;
|
|
||||||
$debug_text = '';
|
|
||||||
|
|
||||||
// Get SQL error if we are debugging. Do this as soon as possible to prevent
|
|
||||||
// subsequent queries from overwriting the status of sql_error()
|
|
||||||
if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR))
|
|
||||||
{
|
|
||||||
if (!empty($DBS) && $sql_store)
|
|
||||||
{
|
|
||||||
$sql_error = $DBS->sql_error();
|
|
||||||
$debug_text .= "<br /><br />SQL Error : {$sql_error['code']}<br /><br />{$sql_error['message']}";
|
|
||||||
}
|
|
||||||
if ($sql_store)
|
|
||||||
{
|
|
||||||
$debug_text .= "<br /><br />$sql_store";
|
|
||||||
}
|
|
||||||
if ($sql_store && $err_line && $err_file)
|
|
||||||
{
|
|
||||||
$debug_text .= "</br /><br />Line : {$err_line}<br />File : ". basename($err_file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// If empty lang
|
||||||
if (empty($lang))
|
if (empty($lang))
|
||||||
{
|
{
|
||||||
require($bb_cfg['default_lang_dir'] .'main.php');
|
require($bb_cfg['default_lang_dir'] .'main.php');
|
||||||
}
|
}
|
||||||
if (empty($userdata) && ($msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR))
|
|
||||||
|
// If empty session
|
||||||
|
if (empty($userdata))
|
||||||
{
|
{
|
||||||
$userdata = session_pagestart();
|
$userdata = session_pagestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the header hasn't been output then do it
|
// If the header hasn't been output then do it
|
||||||
if (!defined('PAGE_HEADER_SENT') && $msg_code != CRITICAL_ERROR)
|
if (!defined('PAGE_HEADER_SENT'))
|
||||||
{
|
{
|
||||||
if (empty($template))
|
if (empty($template))
|
||||||
{
|
{
|
||||||
|
@ -1863,58 +1835,16 @@ function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = ''
|
||||||
require(PAGE_HEADER);
|
require(PAGE_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($msg_code)
|
|
||||||
{
|
|
||||||
case GENERAL_MESSAGE:
|
|
||||||
if (!$msg_title) $msg_title = $lang['INFORMATION'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GENERAL_ERROR:
|
|
||||||
if (!$msg_text) $msg_text = $lang['AN_ERROR_OCCURED'];
|
|
||||||
if (!$msg_title) $msg_title = $lang['GENERAL_ERROR'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CRITICAL_ERROR:
|
|
||||||
// Critical errors mean we cannot rely on _ANY_ DB information being
|
|
||||||
// available so we're going to dump out a simple echo'd statement
|
|
||||||
if (!$msg_text) $msg_text = $lang['A_CRITICAL_ERROR'];
|
|
||||||
if (!$msg_title) $msg_title = 'BB : <b>Critical Error</b>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Add on DEBUG info if we've enabled debug mode and this is an error. This
|
|
||||||
// prevents debug info being output for general messages should DEBUG be
|
|
||||||
// set TRUE by accident (preventing confusion for the end user!)
|
|
||||||
if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR))
|
|
||||||
{
|
|
||||||
if ($debug_text)
|
|
||||||
{
|
|
||||||
$msg_text .= '<br /><br /><b><u>DEBUG MODE</u></b>'. $debug_text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($msg_code != CRITICAL_ERROR)
|
|
||||||
{
|
|
||||||
if (!empty($lang[$msg_text]))
|
|
||||||
{
|
|
||||||
$msg_text = $lang[$msg_text];
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_GENERAL_MESSAGE' => true,
|
'TPL_BB_DIE' => true,
|
||||||
|
|
||||||
'MESSAGE_TITLE' => $msg_title,
|
|
||||||
'MESSAGE_TEXT' => $msg_text,
|
'MESSAGE_TEXT' => $msg_text,
|
||||||
));
|
));
|
||||||
|
|
||||||
$template->set_filenames(array('message_die' => 'common.tpl'));
|
$template->set_filenames(array('bb_die' => 'common.tpl'));
|
||||||
$template->pparse('message_die');
|
$template->pparse('bb_die');
|
||||||
|
|
||||||
require(PAGE_FOOTER);
|
require(PAGE_FOOTER);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<html>\n<body>\n". $msg_title ."\n<br /><br />\n". $msg_text ."</body>\n</html>";
|
|
||||||
}
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1961,7 +1891,7 @@ function redirect ($url)
|
||||||
|
|
||||||
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url'))
|
if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url'))
|
||||||
{
|
{
|
||||||
message_die(CRITICAL_ERROR, 'Tried to redirect to potentially insecure url.');
|
bb_die('Tried to redirect to potentially insecure url');
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = trim($url);
|
$url = trim($url);
|
||||||
|
@ -2868,3 +2798,31 @@ function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $hei
|
||||||
|
|
||||||
return $user_avatar;
|
return $user_avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gender_image ($gender)
|
||||||
|
{
|
||||||
|
global $bb_cfg, $lang, $images;
|
||||||
|
|
||||||
|
if (!$bb_cfg['gender'])
|
||||||
|
{
|
||||||
|
$user_gender = '';
|
||||||
|
return $user_gender;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch ($gender)
|
||||||
|
{
|
||||||
|
case MALE:
|
||||||
|
$user_gender = '<img src="'. $images['icon_male'] .'" alt="'. $lang['GENDER_SELECT'][1] .'" title="'. $lang['GENDER_SELECT'][1] .'" border="0" />';
|
||||||
|
break;
|
||||||
|
case FEMALE:
|
||||||
|
$user_gender = '<img src="'. $images['icon_female'] .'" alt="'. $lang['GENDER_SELECT'][1] .'" title="'. $lang['GENDER_SELECT'][2] .'" border="0" />';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$user_gender = '<img src="'. $images['icon_nogender'] .'" alt="'. $lang['GENDER_SELECT'][0] .'" title="'. $lang['GENDER_SELECT'][0] .'" border="0" />';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $user_gender;
|
||||||
|
}
|
|
@ -6,12 +6,10 @@ function run_jobs($jobs)
|
||||||
|
|
||||||
define('IN_CRON', true);
|
define('IN_CRON', true);
|
||||||
|
|
||||||
$sql = "SELECT cron_script
|
$sql = "SELECT cron_script FROM " . BB_CRON ." WHERE cron_id IN ($jobs)";
|
||||||
FROM " . BB_CRON ."
|
|
||||||
WHERE cron_id IN ($jobs)";
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain cron script', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain cron script');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result))
|
while ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -96,7 +94,7 @@ function insert_cron_job($cron_arr)
|
||||||
|
|
||||||
$message = $langmode . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "<a href=\"javascript:history.back(-1)\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS'], "<a href=\"admin_cron.php?mode=list\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"index.php?pane=right\">", "</a>");
|
$message = $langmode . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS_ADDED'], "<a href=\"javascript:history.back(-1)\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_JOBS'], "<a href=\"admin_cron.php?mode=list\">", "</a>") . "<br /><br />" . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], "<a href=\"index.php?pane=right\">", "</a>");
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
bb_die($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cron_active = $cron_arr['cron_active'];
|
$cron_active = $cron_arr['cron_active'];
|
||||||
|
|
|
@ -11,7 +11,7 @@ function update_table_bool ($table_name, $key, $field_name, $field_def_val)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not update $table_name", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update '. $table_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST[$field_name]))
|
if (isset($_POST[$field_name]))
|
||||||
|
@ -33,7 +33,7 @@ function update_table_bool ($table_name, $key, $field_name, $field_def_val)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Could not update $table_name", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update '. $table_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,9 @@ function get_sql_log_html ($db_obj, $log_name)
|
||||||
$time = sprintf('%.4f', $dbg['time']);
|
$time = sprintf('%.4f', $dbg['time']);
|
||||||
$perc = @sprintf('[%2d]', $dbg['time']*100/$db_obj->sql_timetotal);
|
$perc = @sprintf('[%2d]', $dbg['time']*100/$db_obj->sql_timetotal);
|
||||||
$info = !empty($dbg['info']) ? $dbg['info'] .' ['. $dbg['src'] .']' : $dbg['src'];
|
$info = !empty($dbg['info']) ? $dbg['info'] .' ['. $dbg['src'] .']' : $dbg['src'];
|
||||||
$file = addslashes($dbg['file']);
|
|
||||||
$line = $dbg['line'];
|
|
||||||
$edit = (DEBUG === true) ? "OpenInEditor('$file', $line);" : '';
|
|
||||||
|
|
||||||
$log .= ''
|
$log .= ''
|
||||||
. '<div class="sqlLogRow" title="'. $info .'" ondblclick="'. $edit .'">'
|
. '<div class="sqlLogRow" title="'. $info .'">'
|
||||||
. '<span style="letter-spacing: -1px;">'. $time .' </span>'
|
. '<span style="letter-spacing: -1px;">'. $time .' </span>'
|
||||||
. '<span title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#'. $id .'\').text() );" style="color: gray; letter-spacing: -1px;">'. $perc .'</span>'
|
. '<span title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#'. $id .'\').text() );" style="color: gray; letter-spacing: -1px;">'. $perc .'</span>'
|
||||||
. ' '
|
. ' '
|
||||||
|
|
|
@ -89,7 +89,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
{
|
{
|
||||||
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval'])
|
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['FLOOD_ERROR']);
|
bb_die($lang['FLOOD_ERROR']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
|
|
||||||
if ($last_msg == $post_message)
|
if ($last_msg == $post_message)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['DOUBLE_POST_ERROR']);
|
bb_die($lang['DOUBLE_POST_ERROR']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'newtopic')
|
if ($mode == 'newtopic')
|
||||||
|
@ -166,7 +166,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."')" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . " WHERE post_id = $post_id";
|
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."')" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . " WHERE post_id = $post_id";
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode != 'editpost')
|
if ($mode != 'editpost')
|
||||||
|
@ -177,7 +177,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
$sql = ($mode != 'editpost') ? "INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_text) VALUES ($post_id, '$post_message')" : "UPDATE " . BB_POSTS_TEXT . " SET post_text = '$post_message' WHERE post_id = $post_id";
|
$sql = ($mode != 'editpost') ? "INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_text) VALUES ($post_id, '$post_message')" : "UPDATE " . BB_POSTS_TEXT . " SET post_text = '$post_message' WHERE post_id = $post_id";
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($userdata['user_id'] != BOT_UID)
|
if ($userdata['user_id'] != BOT_UID)
|
||||||
|
@ -245,7 +245,7 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
|
||||||
WHERE topic_id = $topic_id";
|
WHERE topic_id = $topic_id";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in deleting post #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -261,7 +261,7 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
|
||||||
WHERE forum_id = $forum_id";
|
WHERE forum_id = $forum_id";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in deleting post #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -275,7 +275,7 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
|
||||||
$sql = "SELECT MIN(post_id) AS first_post_id FROM " . BB_POSTS . " WHERE topic_id = $topic_id";
|
$sql = "SELECT MIN(post_id) AS first_post_id FROM " . BB_POSTS . " WHERE topic_id = $topic_id";
|
||||||
if (!($result = DB()->sql_query($sql)))
|
if (!($result = DB()->sql_query($sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in deleting post #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result))
|
||||||
|
@ -297,7 +297,7 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
|
||||||
$sql = "UPDATE " . BB_FORUMS . " SET $forum_update_sql WHERE forum_id = $forum_id";
|
$sql = "UPDATE " . BB_FORUMS . " SET $forum_update_sql WHERE forum_id = $forum_id";
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #4');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($topic_update_sql != '')
|
if ($topic_update_sql != '')
|
||||||
|
@ -305,14 +305,14 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
|
||||||
$sql = "UPDATE " . BB_TOPICS . " SET $topic_update_sql WHERE topic_id = $topic_id";
|
$sql = "UPDATE " . BB_TOPICS . " SET $topic_update_sql WHERE topic_id = $topic_id";
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE " . BB_USERS . " SET user_posts = user_posts $sign WHERE user_id = $user_id";
|
$sql = "UPDATE " . BB_USERS . " SET user_posts = user_posts $sign WHERE user_id = $user_id";
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
bb_die('Error in posting #6');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ function report_modules_obtain()
|
||||||
FROM ' . BB_REPORTS_MODULES . '
|
FROM ' . BB_REPORTS_MODULES . '
|
||||||
ORDER BY report_module_order';
|
ORDER BY report_module_order';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report modules', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report modules');
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules = DB()->sql_fetchrowset($result);
|
$modules = DB()->sql_fetchrowset($result);
|
||||||
|
@ -284,7 +284,7 @@ function report_notify($mode)
|
||||||
if ($report['report_reason_id']) {
|
if ($report['report_reason_id']) {
|
||||||
$sql = 'SELECT report_reason_desc FROM ' . BB_REPORTS_REASONS . ' WHERE report_reason_id = ' . $report['report_reason_id'];
|
$sql = 'SELECT report_reason_desc FROM ' . BB_REPORTS_REASONS . ' WHERE report_reason_id = ' . $report['report_reason_id'];
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report reason desc', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report reason desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -303,7 +303,7 @@ function report_notify($mode)
|
||||||
AND user_level ' . $user_level_sql . '
|
AND user_level ' . $user_level_sql . '
|
||||||
AND user_id <> ' . $userdata['user_id'];
|
AND user_id <> ' . $userdata['user_id'];
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain administrators and moderators', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain administrators and moderators #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$notify_users[$report['report_id']] = array();
|
$notify_users[$report['report_id']] = array();
|
||||||
|
@ -349,7 +349,7 @@ function report_notify($mode)
|
||||||
ON u.user_id = rc.user_id
|
ON u.user_id = rc.user_id
|
||||||
WHERE r.report_id IN(' . implode(', ', $report_ids) . ')';
|
WHERE r.report_id IN(' . implode(', ', $report_ids) . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report information');
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_check_array = array();
|
$auth_check_array = array();
|
||||||
|
@ -376,7 +376,7 @@ function report_notify($mode)
|
||||||
AND user_level ' . $user_level_sql . '
|
AND user_level ' . $user_level_sql . '
|
||||||
AND user_id <> ' . $userdata['user_id'];
|
AND user_id <> ' . $userdata['user_id'];
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain administrators and moderators', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain administrators and moderators #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_options = array('auth_view', 'auth_notify');
|
$auth_options = array('auth_view', 'auth_notify');
|
||||||
|
@ -530,7 +530,7 @@ function report_count_obtain()
|
||||||
if (!CACHE('bb_cache')->get('report_count_obtain_exp') || (CACHE('bb_cache')->get('report_count_obtain_exp') + 300) < TIMENOW) {
|
if (!CACHE('bb_cache')->get('report_count_obtain_exp') || (CACHE('bb_cache')->get('report_count_obtain_exp') + 300) < TIMENOW) {
|
||||||
$sql = 'SELECT COUNT(report_id) AS report_count FROM ' . BB_REPORTS . ' WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
|
$sql = 'SELECT COUNT(report_id) AS report_count FROM ' . BB_REPORTS . ' WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report count', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report count #1');
|
||||||
}
|
}
|
||||||
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
@ -548,7 +548,7 @@ function report_count_obtain()
|
||||||
WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')
|
WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')
|
||||||
AND rm.auth_view <= ' . REPORT_AUTH_MOD;
|
AND rm.auth_view <= ' . REPORT_AUTH_MOD;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report count', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report count #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
||||||
|
@ -558,7 +558,7 @@ function report_count_obtain()
|
||||||
FROM ' . BB_REPORTS . '
|
FROM ' . BB_REPORTS . '
|
||||||
WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
|
WHERE report_status IN(' . REPORT_NEW . ', ' . REPORT_OPEN . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not check report auth', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not check report auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = DB()->sql_fetchrowset($result);
|
$reports = DB()->sql_fetchrowset($result);
|
||||||
|
@ -598,7 +598,7 @@ function reports_obtain($module_id = null, $auth_check = true)
|
||||||
$where_sql
|
$where_sql
|
||||||
ORDER BY r.report_status ASC, r.report_time DESC";
|
ORDER BY r.report_status ASC, r.report_time DESC";
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain reports #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = DB()->sql_fetchrowset($result);
|
$rows = DB()->sql_fetchrowset($result);
|
||||||
|
@ -648,7 +648,7 @@ function reports_open_obtain($module_id, $report_subject, $auth_check = true)
|
||||||
AND r.report_subject = ' . (int)$report_subject . '
|
AND r.report_subject = ' . (int)$report_subject . '
|
||||||
ORDER BY r.report_status ASC, r.report_time DESC';
|
ORDER BY r.report_status ASC, r.report_time DESC';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain open reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain open reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = DB()->sql_fetchrowset($result);
|
$reports = DB()->sql_fetchrowset($result);
|
||||||
|
@ -686,7 +686,7 @@ function reports_deleted_obtain($auth_check = true)
|
||||||
WHERE r.report_status = ' . REPORT_DELETE . '
|
WHERE r.report_status = ' . REPORT_DELETE . '
|
||||||
ORDER BY r.report_time DESC';
|
ORDER BY r.report_time DESC';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain deleted reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain deleted reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = DB()->sql_fetchrowset($result);
|
$reports = DB()->sql_fetchrowset($result);
|
||||||
|
@ -727,7 +727,7 @@ function report_obtain($report_id, $auth_check = true)
|
||||||
ON u.user_id = r.user_id
|
ON u.user_id = r.user_id
|
||||||
WHERE r.report_id = ' . (int)$report_id;
|
WHERE r.report_id = ' . (int)$report_id;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain reports #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report = DB()->sql_fetchrow($result);
|
$report = DB()->sql_fetchrow($result);
|
||||||
|
@ -771,7 +771,7 @@ function report_changes_obtain($report_id)
|
||||||
WHERE rc.report_id = ' . (int)$report_id . '
|
WHERE rc.report_id = ' . (int)$report_id . '
|
||||||
ORDER BY rc.report_change_time';
|
ORDER BY rc.report_change_time';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report changes', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report changes');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_changes = DB()->sql_fetchrowset($result);
|
$report_changes = DB()->sql_fetchrowset($result);
|
||||||
|
@ -795,7 +795,7 @@ function report_duplicate_check($module_id, $report_subject)
|
||||||
AND report_subject = ' . (int)$report_subject . '
|
AND report_subject = ' . (int)$report_subject . '
|
||||||
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')';
|
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not check for duplicate reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not check for duplicate reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = DB()->sql_fetchfield('count', 0, $result);
|
$count = DB()->sql_fetchfield('count', 0, $result);
|
||||||
|
@ -820,7 +820,7 @@ function report_prune($module_id, $prune_time)
|
||||||
AND r.report_status IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
AND r.report_status IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
||||||
AND rc.report_change_time < ' . (TIMENOW - (int)$prune_time);
|
AND rc.report_change_time < ' . (TIMENOW - (int)$prune_time);
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain old reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain old reports #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = $report_ids = array();
|
$reports = $report_ids = array();
|
||||||
|
@ -839,7 +839,7 @@ function report_prune($module_id, $prune_time)
|
||||||
// Set last prune date
|
// Set last prune date
|
||||||
$sql = 'UPDATE ' . BB_REPORTS_MODULES . ' SET report_module_last_prune = ' . TIMENOW . ' WHERE report_module_id = ' . (int)$module_id;
|
$sql = 'UPDATE ' . BB_REPORTS_MODULES . ' SET report_module_last_prune = ' . TIMENOW . ' WHERE report_module_id = ' . (int)$module_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete old reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete old reports #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +880,7 @@ function report_insert($module_id, $report_subject, $report_reason, $report_titl
|
||||||
' . (int)$report_subject . ", $report_subject_data_sql, '" . DB()->escape($report_title) . "',
|
' . (int)$report_subject . ", $report_subject_data_sql, '" . DB()->escape($report_title) . "',
|
||||||
'" . DB()->escape($report_desc) . "')";
|
'" . DB()->escape($report_desc) . "')";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not insert report', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert report');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_id = DB()->sql_nextid();
|
$report_id = DB()->sql_nextid();
|
||||||
|
@ -913,7 +913,7 @@ function report_insert($module_id, $report_subject, $report_reason, $report_titl
|
||||||
if (isset($bb_cfg['report_hack_count'])) {
|
if (isset($bb_cfg['report_hack_count'])) {
|
||||||
$sql = 'UPDATE ' . BB_CONFIG . " SET config_value = config_value + 1 WHERE config_name = 'report_hack_count'";
|
$sql = 'UPDATE ' . BB_CONFIG . " SET config_value = config_value + 1 WHERE config_name = 'report_hack_count'";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update report hack count', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update report hack count');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,7 +943,7 @@ function reports_update_status($report_ids, $report_status, $comment = '', $auth
|
||||||
FROM ' . BB_REPORTS . '
|
FROM ' . BB_REPORTS . '
|
||||||
WHERE report_id IN(' . implode(', ', $report_ids) . ')';
|
WHERE report_id IN(' . implode(', ', $report_ids) . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain reports #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = DB()->sql_fetchrowset($result);
|
$reports = DB()->sql_fetchrowset($result);
|
||||||
|
@ -969,7 +969,7 @@ function reports_update_status($report_ids, $report_status, $comment = '', $auth
|
||||||
$sql = 'INSERT INTO ' . BB_REPORTS_CHANGES . " (report_id, user_id, report_change_time, report_status, report_change_comment)
|
$sql = 'INSERT INTO ' . BB_REPORTS_CHANGES . " (report_id, user_id, report_change_time, report_status, report_change_comment)
|
||||||
VALUES($report_id, " . $userdata['user_id'] . ', ' . TIMENOW . ", $report_status, '$comment')";
|
VALUES($report_id, " . $userdata['user_id'] . ', ' . TIMENOW . ", $report_status, '$comment')";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not insert report change', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert report change');
|
||||||
}
|
}
|
||||||
|
|
||||||
$change_id = DB()->sql_nextid();
|
$change_id = DB()->sql_nextid();
|
||||||
|
@ -981,7 +981,7 @@ function reports_update_status($report_ids, $report_status, $comment = '', $auth
|
||||||
report_last_change = " . (int)$change_id . "
|
report_last_change = " . (int)$change_id . "
|
||||||
WHERE report_id = $report_id";
|
WHERE report_id = $report_id";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update reports status', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update reports status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,7 +1016,7 @@ function reports_delete($report_ids, $auth_check = true, $module_action = true)
|
||||||
FROM ' . BB_REPORTS . '
|
FROM ' . BB_REPORTS . '
|
||||||
WHERE report_id IN(' . implode(', ', $report_ids) . ')';
|
WHERE report_id IN(' . implode(', ', $report_ids) . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain reports #4');
|
||||||
}
|
}
|
||||||
|
|
||||||
$reports = DB()->sql_fetchrowset($result);
|
$reports = DB()->sql_fetchrowset($result);
|
||||||
|
@ -1055,13 +1055,13 @@ function reports_delete($report_ids, $auth_check = true, $module_action = true)
|
||||||
// Delete reports
|
// Delete reports
|
||||||
$sql = 'DELETE FROM ' . BB_REPORTS . " WHERE report_id IN($reports_sql)";
|
$sql = 'DELETE FROM ' . BB_REPORTS . " WHERE report_id IN($reports_sql)";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete report status changes
|
// Delete report status changes
|
||||||
$sql = 'DELETE FROM ' . BB_REPORTS_CHANGES . " WHERE report_id IN($reports_sql)";
|
$sql = 'DELETE FROM ' . BB_REPORTS_CHANGES . " WHERE report_id IN($reports_sql)";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete reports changes', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete reports changes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute module action
|
// Execute module action
|
||||||
|
@ -1089,7 +1089,7 @@ function report_statistics($mode)
|
||||||
$sql = 'SELECT COUNT(report_id) AS report_count
|
$sql = 'SELECT COUNT(report_id) AS report_count
|
||||||
FROM ' . BB_REPORTS;
|
FROM ' . BB_REPORTS;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report statistics', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report statistics');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
$report_count = DB()->sql_fetchfield('report_count', 0, $result);
|
||||||
|
@ -1130,7 +1130,7 @@ function user_moderated_forums($user_id)
|
||||||
AND aa.forum_perm = 8
|
AND aa.forum_perm = 8
|
||||||
GROUP BY aa.forum_id';
|
GROUP BY aa.forum_id';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain moderated forums', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain moderated forums');
|
||||||
}
|
}
|
||||||
|
|
||||||
$moderators[$user_id] = array();
|
$moderators[$user_id] = array();
|
||||||
|
|
|
@ -15,7 +15,7 @@ function report_counts_obtain()
|
||||||
ON r.report_module_id = rm.report_module_id
|
ON r.report_module_id = rm.report_module_id
|
||||||
GROUP BY rm.report_module_id';
|
GROUP BY rm.report_module_id';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report counts', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report counts');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_counts = array();
|
$report_counts = array();
|
||||||
|
@ -38,7 +38,7 @@ function report_reason_counts_obtain()
|
||||||
ON rr.report_module_id = rm.report_module_id
|
ON rr.report_module_id = rm.report_module_id
|
||||||
GROUP BY rm.report_module_id';
|
GROUP BY rm.report_module_id';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report reason counts', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report reason counts');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_reason_counts = array();
|
$report_reason_counts = array();
|
||||||
|
@ -166,7 +166,7 @@ function report_module_install($module_notify, $module_prune, $module_name, $aut
|
||||||
$sql = 'SELECT MAX(report_module_order) AS max_order
|
$sql = 'SELECT MAX(report_module_order) AS max_order
|
||||||
FROM ' . BB_REPORTS_MODULES;
|
FROM ' . BB_REPORTS_MODULES;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain max order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain max order #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$max_order = DB()->sql_fetchfield('max_order', 0, $result);
|
$max_order = DB()->sql_fetchfield('max_order', 0, $result);
|
||||||
|
@ -181,7 +181,7 @@ function report_module_install($module_notify, $module_prune, $module_name, $aut
|
||||||
'" . DB()->escape($module_name) . "', " . (int)$auth_write . ', ' . (int)$auth_view . ',
|
'" . DB()->escape($module_name) . "', " . (int)$auth_write . ', ' . (int)$auth_view . ',
|
||||||
' . (int)$auth_notify . ', ' . (int)$auth_delete . ')';
|
' . (int)$auth_notify . ', ' . (int)$auth_delete . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not install report module', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not install report module');
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_id = DB()->sql_nextid();
|
$module_id = DB()->sql_nextid();
|
||||||
|
@ -213,7 +213,7 @@ function report_module_edit($module_id, $module_notify, $module_prune, $auth_wri
|
||||||
auth_delete = ' . (int)$auth_delete . '
|
auth_delete = ' . (int)$auth_delete . '
|
||||||
WHERE report_module_id = ' . (int)$module_id;
|
WHERE report_module_id = ' . (int)$module_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not edit report module', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not edit report module');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -256,7 +256,7 @@ function report_module_move($mode, $module_id, $steps = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update module order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update module order #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->affected_rows()) {
|
if (DB()->affected_rows()) {
|
||||||
|
@ -265,7 +265,7 @@ function report_module_move($mode, $module_id, $steps = 1)
|
||||||
SET report_module_order = report_module_order $op 1
|
SET report_module_order = report_module_order $op 1
|
||||||
WHERE report_module_id = " . (int)$module_id;
|
WHERE report_module_id = " . (int)$module_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update module order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update module order #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ function report_module_uninstall($module_id)
|
||||||
FROM ' . BB_REPORTS . '
|
FROM ' . BB_REPORTS . '
|
||||||
WHERE report_module_id = ' . (int)$module_id;
|
WHERE report_module_id = ' . (int)$module_id;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report ids', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report ids');
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_ids = array();
|
$report_ids = array();
|
||||||
|
@ -322,7 +322,7 @@ function report_module_uninstall($module_id)
|
||||||
SET report_module_order = report_module_order - 1
|
SET report_module_order = report_module_order - 1
|
||||||
WHERE report_module_order > ' . $report_module->data['report_module_order'];
|
WHERE report_module_order > ' . $report_module->data['report_module_order'];
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update module order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update module order #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -331,7 +331,7 @@ function report_module_uninstall($module_id)
|
||||||
$sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
|
$sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
|
||||||
WHERE report_module_id = ' . (int)$module_id;
|
WHERE report_module_id = ' . (int)$module_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete report reasons', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete report reason #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -340,7 +340,7 @@ function report_module_uninstall($module_id)
|
||||||
$sql = 'DELETE FROM ' . BB_REPORTS_MODULES . '
|
$sql = 'DELETE FROM ' . BB_REPORTS_MODULES . '
|
||||||
WHERE report_module_id = ' . (int)$module_id;
|
WHERE report_module_id = ' . (int)$module_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete report module', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete report module');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -360,7 +360,7 @@ function report_reason_obtain($reason_id)
|
||||||
FROM ' . BB_REPORTS_REASONS . '
|
FROM ' . BB_REPORTS_REASONS . '
|
||||||
WHERE report_reason_id = ' . (int)$reason_id;
|
WHERE report_reason_id = ' . (int)$reason_id;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report reason', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report reason #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -380,7 +380,7 @@ function report_reason_insert($module_id, $reason_desc)
|
||||||
$sql = 'SELECT MAX(report_reason_order) AS max_order
|
$sql = 'SELECT MAX(report_reason_order) AS max_order
|
||||||
FROM ' . BB_REPORTS_REASONS;
|
FROM ' . BB_REPORTS_REASONS;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain max order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain max order #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
$max_order = DB()->sql_fetchfield('max_order', 0, $result);
|
$max_order = DB()->sql_fetchfield('max_order', 0, $result);
|
||||||
|
@ -392,7 +392,7 @@ function report_reason_insert($module_id, $reason_desc)
|
||||||
$sql = 'INSERT INTO ' . BB_REPORTS_REASONS . ' (report_module_id, report_reason_order, report_reason_desc)
|
$sql = 'INSERT INTO ' . BB_REPORTS_REASONS . ' (report_module_id, report_reason_order, report_reason_desc)
|
||||||
VALUES(' . (int)$module_id . ', ' . ($max_order + 1) . ", '" . DB()->escape($reason_desc) . "')";
|
VALUES(' . (int)$module_id . ', ' . ($max_order + 1) . ", '" . DB()->escape($reason_desc) . "')";
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not insert report reason', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not insert report reason');
|
||||||
}
|
}
|
||||||
|
|
||||||
return DB()->sql_nextid();
|
return DB()->sql_nextid();
|
||||||
|
@ -409,7 +409,7 @@ function report_reason_edit($reason_id, $module_id, $reason_desc)
|
||||||
report_reason_desc = '" . DB()->escape($reason_desc) . "'
|
report_reason_desc = '" . DB()->escape($reason_desc) . "'
|
||||||
WHERE report_reason_id = " . (int)$reason_id;
|
WHERE report_reason_id = " . (int)$reason_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update report reason', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update report reason');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ function report_reason_move($mode, $reason_id, $steps = 1)
|
||||||
FROM ' . BB_REPORTS_REASONS . '
|
FROM ' . BB_REPORTS_REASONS . '
|
||||||
WHERE report_reason_id = ' . (int)$reason_id;
|
WHERE report_reason_id = ' . (int)$reason_id;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report reason order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report reason #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -458,7 +458,7 @@ function report_reason_move($mode, $reason_id, $steps = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update report reason order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update report reason order #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB()->affected_rows()) {
|
if (DB()->affected_rows()) {
|
||||||
|
@ -467,7 +467,7 @@ function report_reason_move($mode, $reason_id, $steps = 1)
|
||||||
SET report_reason_order = report_reason_order $op 1
|
SET report_reason_order = report_reason_order $op 1
|
||||||
WHERE report_reason_id = " . (int)$reason_id;
|
WHERE report_reason_id = " . (int)$reason_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update report reason order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update report reason order #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ function report_reason_delete($reason_id)
|
||||||
FROM ' . BB_REPORTS_REASONS . '
|
FROM ' . BB_REPORTS_REASONS . '
|
||||||
WHERE report_reason_id = ' . (int)$reason_id;
|
WHERE report_reason_id = ' . (int)$reason_id;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report reason', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report reason #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -506,7 +506,7 @@ function report_reason_delete($reason_id)
|
||||||
WHERE report_module_id = ' . $row['report_module_id'] . '
|
WHERE report_module_id = ' . $row['report_module_id'] . '
|
||||||
AND report_reason_order > ' . $row['report_reason_order'];
|
AND report_reason_order > ' . $row['report_reason_order'];
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update report reason order', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update report reason order #3');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -515,6 +515,6 @@ function report_reason_delete($reason_id)
|
||||||
$sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
|
$sql = 'DELETE FROM ' . BB_REPORTS_REASONS . '
|
||||||
WHERE report_reason_id = ' . (int)$reason_id;
|
WHERE report_reason_id = ' . (int)$reason_id;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not delete report reason', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete report reason #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ function get_torrent_info ($attach_id)
|
||||||
|
|
||||||
if (!$torrent = DB()->fetch_row($sql))
|
if (!$torrent = DB()->fetch_row($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['INVALID_ATTACH_ID']);
|
bb_die($lang['INVALID_ATTACH_ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $torrent;
|
return $torrent;
|
||||||
|
@ -47,12 +47,11 @@ function torrent_auth_check ($forum_id, $poster_id)
|
||||||
|
|
||||||
if ($poster_id != $userdata['user_id'] && !$is_auth['auth_mod'])
|
if ($poster_id != $userdata['user_id'] && !$is_auth['auth_mod'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NOT_MODERATOR'], $lang['NOT_AUTHORISED']);
|
bb_die($lang['NOT_MODERATOR']);
|
||||||
}
|
}
|
||||||
else if (!$is_auth['auth_view'] || !$is_auth['auth_attachments'] || $attach_config['disable_mod'])
|
else if (!$is_auth['auth_view'] || !$is_auth['auth_attachments'] || $attach_config['disable_mod'])
|
||||||
{
|
{
|
||||||
$message = sprintf($lang['SORRY_AUTH_READ'], $is_auth['auth_read_type']);
|
bb_die(sprintf($lang['SORRY_AUTH_READ'], $is_auth['auth_read_type']));
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
|
||||||
}
|
}
|
||||||
return $is_auth;
|
return $is_auth;
|
||||||
}
|
}
|
||||||
|
@ -76,11 +75,11 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
{
|
{
|
||||||
if (!$torrent)
|
if (!$torrent)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['TOR_NOT_FOUND']);
|
bb_die($lang['TOR_NOT_FOUND']);
|
||||||
}
|
}
|
||||||
if (!$torrent['tracker_status'])
|
if (!$torrent['tracker_status'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Torrent already unregistered');
|
bb_die('Torrent already unregistered');
|
||||||
}
|
}
|
||||||
torrent_auth_check($forum_id, $torrent['poster_id']);
|
torrent_auth_check($forum_id, $torrent['poster_id']);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +90,7 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query torrent information', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query torrent information');
|
||||||
}
|
}
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -106,7 +105,7 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update topics table #1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete peers', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete peers');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete torrent
|
// Delete torrent
|
||||||
|
@ -123,7 +122,7 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not delete torrent from torrents table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not delete torrent from torrents table');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update tracker_status
|
// Update tracker_status
|
||||||
|
@ -131,7 +130,7 @@ function tracker_unregister ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update torrent status', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update torrent status #1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'request')
|
if ($mode == 'request')
|
||||||
|
@ -150,7 +149,7 @@ function delete_torrent ($attach_id, $mode = '')
|
||||||
|
|
||||||
if (!$torrent = get_torrent_info($attach_id))
|
if (!$torrent = get_torrent_info($attach_id))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['TOR_NOT_FOUND']);
|
bb_die($lang['TOR_NOT_FOUND']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic_id = $torrent['topic_id'];
|
$topic_id = $torrent['topic_id'];
|
||||||
|
@ -159,7 +158,7 @@ function delete_torrent ($attach_id, $mode = '')
|
||||||
|
|
||||||
if ($torrent['extension'] !== TORRENT_EXT)
|
if ($torrent['extension'] !== TORRENT_EXT)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['NOT_TORRENT']);
|
bb_die($lang['NOT_TORRENT']);
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent_auth_check($forum_id, $poster_id);
|
torrent_auth_check($forum_id, $poster_id);
|
||||||
|
@ -316,7 +315,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
|
||||||
{
|
{
|
||||||
return torrent_error_exit($lang['BT_REG_FAIL_SAME_HASH']);
|
return torrent_error_exit($lang['BT_REG_FAIL_SAME_HASH']);
|
||||||
}
|
}
|
||||||
message_die(GENERAL_ERROR, 'Could not register torrent on tracker', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not register torrent on tracker');
|
||||||
}
|
}
|
||||||
|
|
||||||
// update tracker status for this attachment
|
// update tracker status for this attachment
|
||||||
|
@ -324,7 +323,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
|
||||||
|
|
||||||
if (!DB()->sql_query($sql))
|
if (!DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update torrent status', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update torrent status #2');
|
||||||
}
|
}
|
||||||
|
|
||||||
// set DL-Type for topic
|
// set DL-Type for topic
|
||||||
|
@ -334,7 +333,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update topics table #2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +367,7 @@ function send_torrent_with_passkey ($filename)
|
||||||
|
|
||||||
if (!$passkey_key = $bb_cfg['passkey_key'])
|
if (!$passkey_key = $bb_cfg['passkey_key'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])');
|
bb_die('Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get $post_id & $poster_id
|
// Get $post_id & $poster_id
|
||||||
|
@ -386,19 +385,19 @@ function send_torrent_with_passkey ($filename)
|
||||||
$topic_id_sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int) $post_id;
|
$topic_id_sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int) $post_id;
|
||||||
if (!($topic_id_result = DB()->sql_query($topic_id_sql)))
|
if (!($topic_id_result = DB()->sql_query($topic_id_sql)))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query post information', '', __LINE__, __FILE__, $topic_id_sql);
|
bb_die('Could not query post information');
|
||||||
}
|
}
|
||||||
$topic_id_row = DB()->sql_fetchrow($topic_id_result);
|
$topic_id_row = DB()->sql_fetchrow($topic_id_result);
|
||||||
$topic_id = $topic_id_row['topic_id'];
|
$topic_id = $topic_id_row['topic_id'];
|
||||||
|
|
||||||
if (!$attachment['tracker_status'])
|
if (!$attachment['tracker_status'])
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, $lang['PASSKEY_ERR_TOR_NOT_REG']);
|
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bf($userdata['user_opt'], 'user_opt', 'dis_passkey') && !IS_GUEST)
|
if (bf($userdata['user_opt'], 'user_opt', 'dis_passkey') && !IS_GUEST)
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not add passkey');
|
bb_die('Could not add passkey');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bt_userdata = get_bt_userdata($user_id))
|
if ($bt_userdata = get_bt_userdata($user_id))
|
||||||
|
@ -431,8 +430,7 @@ function send_torrent_with_passkey ($filename)
|
||||||
|
|
||||||
if (!isset($dl['user_status']) || $dl['user_status'] != DL_STATUS_COMPLETE)
|
if (!isset($dl['user_status']) || $dl['user_status'] != DL_STATUS_COMPLETE)
|
||||||
{
|
{
|
||||||
$mess = sprintf($lang['BT_LOW_RATIO_FOR_DL'], round($user_ratio, 2), "search.php?dlu=$user_id&dlc=1");
|
bb_die(sprintf($lang['BT_LOW_RATIO_FOR_DL'], round($user_ratio, 2), "search.php?dlu=$user_id&dlc=1"));
|
||||||
message_die(GENERAL_ERROR, $mess);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +440,7 @@ function send_torrent_with_passkey ($filename)
|
||||||
|
|
||||||
if (!$tor = bdecode_file($filename))
|
if (!$tor = bdecode_file($filename))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'This is not a bencoded file');
|
bb_die('This is not a bencoded file');
|
||||||
}
|
}
|
||||||
|
|
||||||
$announce = strval($ann_url . "?$passkey_key=$passkey_val");
|
$announce = strval($ann_url . "?$passkey_key=$passkey_val");
|
||||||
|
@ -507,13 +505,13 @@ function generate_passkey ($user_id, $force_generate = false)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query userdata for passkey', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query userdata for passkey');
|
||||||
}
|
}
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (bf($row['user_opt'], 'user_opt', 'dis_passkey'))
|
if (bf($row['user_opt'], 'user_opt', 'dis_passkey'))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, $lang['NOT_AUTHORISED']);
|
bb_die($lang['NOT_AUTHORISED']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,7 +556,7 @@ function get_registered_torrents ($id, $mode)
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, 'Could not query torrent id', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not query torrent id');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rowset = @DB()->sql_fetchrowset($result))
|
if ($rowset = @DB()->sql_fetchrowset($result))
|
||||||
|
@ -589,7 +587,7 @@ function torrent_error_exit ($message)
|
||||||
bb_die($msg . $message);
|
bb_die($msg . $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bdecode: based on OpenTracker [http://whitsoftdev.com/opentracker]
|
// bdecode: based on OpenTracker
|
||||||
function bdecode_file ($filename)
|
function bdecode_file ($filename)
|
||||||
{
|
{
|
||||||
$file_contents = file_get_contents($filename);
|
$file_contents = file_get_contents($filename);
|
||||||
|
|
|
@ -119,7 +119,7 @@ function bb_setcookie ($name, $val, $lifetime = COOKIE_PERSIST, $httponly = fals
|
||||||
// Debug options
|
// Debug options
|
||||||
if (DBG_USER)
|
if (DBG_USER)
|
||||||
{
|
{
|
||||||
error_reporting(E_ALL);
|
ini_set('error_reporting', E_ALL);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -127,11 +127,6 @@ else
|
||||||
unset($_COOKIE['explain']);
|
unset($_COOKIE['explain']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG === true)
|
|
||||||
{
|
|
||||||
require(DEV_DIR .'init_debug.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
define('DELETED', -1);
|
define('DELETED', -1);
|
||||||
|
|
||||||
// User Levels
|
// User Levels
|
||||||
|
@ -177,11 +172,7 @@ define('POST_ANNOUNCE', 2);
|
||||||
define('SEARCH_TYPE_POST', 0);
|
define('SEARCH_TYPE_POST', 0);
|
||||||
define('SEARCH_TYPE_TRACKER', 1);
|
define('SEARCH_TYPE_TRACKER', 1);
|
||||||
|
|
||||||
// Error codes
|
// Ajax error codes
|
||||||
define('GENERAL_MESSAGE', 200);
|
|
||||||
define('GENERAL_ERROR', 202);
|
|
||||||
define('CRITICAL_ERROR', 204);
|
|
||||||
|
|
||||||
define('E_AJAX_GENERAL_ERROR', 1000);
|
define('E_AJAX_GENERAL_ERROR', 1000);
|
||||||
define('E_AJAX_NEED_LOGIN', 1001);
|
define('E_AJAX_NEED_LOGIN', 1001);
|
||||||
|
|
||||||
|
@ -212,18 +203,12 @@ define('PHYSICAL_LINK', 2);
|
||||||
// Categories
|
// Categories
|
||||||
define('NONE_CAT', 0);
|
define('NONE_CAT', 0);
|
||||||
define('IMAGE_CAT', 1);
|
define('IMAGE_CAT', 1);
|
||||||
define('STREAM_CAT', 2);
|
|
||||||
define('SWF_CAT', 3);
|
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
define('MEGABYTE', 1024);
|
|
||||||
define('ADMIN_MAX_ATTACHMENTS', 50);
|
define('ADMIN_MAX_ATTACHMENTS', 50);
|
||||||
define('THUMB_DIR', 'thumbs');
|
define('THUMB_DIR', 'thumbs');
|
||||||
define('MODE_THUMBNAIL', 1);
|
define('MODE_THUMBNAIL', 1);
|
||||||
|
|
||||||
// Forum Extension Group Permissions
|
|
||||||
define('GPERM_ALL', 0); // ALL FORUMS
|
|
||||||
|
|
||||||
// Quota Types
|
// Quota Types
|
||||||
define('QUOTA_UPLOAD_LIMIT', 1);
|
define('QUOTA_UPLOAD_LIMIT', 1);
|
||||||
define('QUOTA_PM_LIMIT', 2);
|
define('QUOTA_PM_LIMIT', 2);
|
||||||
|
@ -314,6 +299,7 @@ $bb_cfg['tor_cannot_edit'] = array(
|
||||||
TOR_CONSUMED => true,
|
TOR_CONSUMED => true,
|
||||||
TOR_DUP => true,
|
TOR_DUP => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
|
// Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
|
||||||
$bb_cfg['tor_cannot_new'] = array(TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL);
|
$bb_cfg['tor_cannot_new'] = array(TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL);
|
||||||
|
|
||||||
|
@ -346,6 +332,7 @@ define('BB_BT_TORHELP', 'bb_bt_torhelp');
|
||||||
define('BB_BT_TORSTAT', 'bb_bt_torstat');
|
define('BB_BT_TORSTAT', 'bb_bt_torstat');
|
||||||
define('BB_CATEGORIES', 'bb_categories');
|
define('BB_CATEGORIES', 'bb_categories');
|
||||||
define('BB_CAPTCHA', 'bb_captcha');
|
define('BB_CAPTCHA', 'bb_captcha');
|
||||||
|
define('BB_CHAT', 'bb_chat');
|
||||||
define('BB_CONFIG', 'bb_config');
|
define('BB_CONFIG', 'bb_config');
|
||||||
define('BB_CRON', 'bb_cron');
|
define('BB_CRON', 'bb_cron');
|
||||||
define('BB_DISALLOW', 'bb_disallow');
|
define('BB_DISALLOW', 'bb_disallow');
|
||||||
|
@ -412,8 +399,6 @@ define('BONUS_URL', 'profile.php?mode=bonus');
|
||||||
define('TOPIC_URL', 'viewtopic.php?t=');
|
define('TOPIC_URL', 'viewtopic.php?t=');
|
||||||
|
|
||||||
define('USER_AGENT', strtolower($_SERVER['HTTP_USER_AGENT']));
|
define('USER_AGENT', strtolower($_SERVER['HTTP_USER_AGENT']));
|
||||||
define('UA_OPERA', strpos(USER_AGENT, 'pera'));
|
|
||||||
define('UA_IE', strpos(USER_AGENT, 'msie'));
|
|
||||||
|
|
||||||
define('HTML_SELECT_MAX_LENGTH', 60);
|
define('HTML_SELECT_MAX_LENGTH', 60);
|
||||||
define('HTML_WBR_LENGTH', 12);
|
define('HTML_WBR_LENGTH', 12);
|
||||||
|
@ -590,5 +575,5 @@ $dl_status_css = array(
|
||||||
// Show 'Board is disabled' message if needed
|
// Show 'Board is disabled' message if needed
|
||||||
if ($bb_cfg['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') && !defined('IN_AJAX'))
|
if ($bb_cfg['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') && !defined('IN_AJAX'))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_MESSAGE, 'BOARD_DISABLE');
|
bb_die($lang['BOARD_DISABLE']);
|
||||||
}
|
}
|
|
@ -11,7 +11,6 @@ if (!empty($template))
|
||||||
'POWERED' => base64_decode($lang['POWERED']),
|
'POWERED' => base64_decode($lang['POWERED']),
|
||||||
'SHOW_ADMIN_LINK' => (IS_ADMIN && !defined('IN_ADMIN')),
|
'SHOW_ADMIN_LINK' => (IS_ADMIN && !defined('IN_ADMIN')),
|
||||||
'ADMIN_LINK_HREF' => "admin/index.php",
|
'ADMIN_LINK_HREF' => "admin/index.php",
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
$template->set_filenames(array('page_footer' => 'page_footer.tpl'));
|
$template->set_filenames(array('page_footer' => 'page_footer.tpl'));
|
||||||
|
@ -31,7 +30,6 @@ if ($show_dbg_info)
|
||||||
$gen_time_txt = sprintf('%.3f', $gen_time);
|
$gen_time_txt = sprintf('%.3f', $gen_time);
|
||||||
$gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> ';
|
$gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> ';
|
||||||
$gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'];
|
$gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'];
|
||||||
$debug_text = (DEBUG) ? 'Debug ON' : 'Debug OFF';
|
|
||||||
|
|
||||||
$stat = '[ '. $lang['EXECUTION_TIME'] ." $gen_time_txt ". $lang['SEC'];
|
$stat = '[ '. $lang['EXECUTION_TIME'] ." $gen_time_txt ". $lang['SEC'];
|
||||||
|
|
||||||
|
@ -75,7 +73,7 @@ echo '
|
||||||
</div><!--/body_container-->
|
</div><!--/body_container-->
|
||||||
';
|
';
|
||||||
|
|
||||||
if (DBG_USER && (SQL_DEBUG || PROFILER) && !(isset($_GET['pane']) && $_GET['pane'] == 'left'))
|
if (DBG_USER && SQL_DEBUG && !(isset($_GET['pane']) && $_GET['pane'] == 'left'))
|
||||||
{
|
{
|
||||||
require(INC_DIR . 'page_footer_dev.php');
|
require(INC_DIR . 'page_footer_dev.php');
|
||||||
}
|
}
|
||||||
|
@ -91,12 +89,6 @@ if (isset($log_ip_resp[USER_IP]) || isset($log_ip_resp[CLIENT_IP]))
|
||||||
}
|
}
|
||||||
### LOG END ###
|
### LOG END ###
|
||||||
|
|
||||||
if (DBG_USER && !empty($GLOBALS['timer_markers']))
|
|
||||||
{
|
|
||||||
$GLOBALS['timer']->stop();
|
|
||||||
$GLOBALS['timer']->display();
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -89,76 +89,14 @@ function fixSqlLog() {
|
||||||
</script>
|
</script>
|
||||||
<div class="sqlLogHead">
|
<div class="sqlLogHead">
|
||||||
';
|
';
|
||||||
if (PROFILER) {
|
|
||||||
echo '
|
|
||||||
<fieldset class="med" style="padding: 2px 4px 4px;">
|
|
||||||
<legend>Profiling</legend>
|
|
||||||
min time:
|
|
||||||
<input style="width: 60px;" id="prof_min_time" type="text" value="'. (!empty($_COOKIE['prof_min_time']) ? $_COOKIE['prof_min_time'] : '0.1%') .'" />
|
|
||||||
<input type="button" value="go" onclick="setProfMinTime(); window.location.reload();" />
|
|
||||||
<label><input type="checkbox" onclick="setCookie(\'prof_enabled\', this.checked ? 1 : 0, \'SESSION\'); setProfMinTime(); setProfCookie(this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['prof_enabled']) ? HTML_CHECKED : '') .' />enable </label>
|
|
||||||
</fieldset>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
if (DEBUG) {
|
|
||||||
echo '
|
|
||||||
<fieldset class="med" style="padding: 2px 4px 4px;">
|
|
||||||
<legend>Debug</legend>
|
|
||||||
<label><input type="checkbox" onclick="setCookie(\'debug_enabled\', this.checked ? 1 : 0, \'SESSION\'); setDebugCookie(this.checked ? 1 : 0); window.location.reload();" '. (!empty($_COOKIE['debug_enabled']) ? HTML_CHECKED : '') .' />enable </label>
|
|
||||||
</fieldset>
|
|
||||||
';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div><!-- / sqlLogHead -->';
|
echo '</div><!-- / sqlLogHead -->';
|
||||||
|
|
||||||
if ($sql_log)
|
if ($sql_log)
|
||||||
{
|
{
|
||||||
echo '<div class="sqlLog" id="sqlLog">
|
echo '<div class="sqlLog" id="sqlLog">'. ($sql_log ? $sql_log : '') .'</div><!-- / sqlLog --><br clear="all" />';
|
||||||
'. ($sql_log ? $sql_log : '') .'
|
|
||||||
'. (UA_IE ? '<br />' : '') .'
|
|
||||||
</div><!-- / sqlLog -->
|
|
||||||
|
|
||||||
<br clear="all" />
|
|
||||||
';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PROFILER && !empty($_COOKIE['prof_enabled']))
|
|
||||||
{
|
|
||||||
require(DEV_DIR .'profiler/profiler.php');
|
|
||||||
$profiler = profiler::init(PROFILER);
|
|
||||||
|
|
||||||
$min_time = !empty($_COOKIE['prof_min_time']) ? $_COOKIE['prof_min_time'] : '0.1%';
|
|
||||||
$profiler->print_profile_data($min_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(fixSqlLog);
|
$(document).ready(fixSqlLog);
|
||||||
|
|
||||||
function setProfMinTime ()
|
|
||||||
{
|
|
||||||
var minTime = $p('prof_min_time').value;
|
|
||||||
setCookie('prof_min_time', (minTime ? minTime : '0.1%'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setProfCookie (val)
|
|
||||||
{
|
|
||||||
// http://support.nusphere.com/viewtopic.php?t=586
|
|
||||||
if (!val) {
|
|
||||||
deleteCookie('DBGSESSID', '/');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// СЛОМАНО!! профайлер работает только по нажатию кнопки на тулбаре phpEd, после чего кука сбрасывается
|
|
||||||
setCookie('DBGSESSID', '1@clienthost:7869;d=1,p=1', 'SESSION', '/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function setDebugCookie (val)
|
|
||||||
{
|
|
||||||
if (!val) {
|
|
||||||
deleteCookie('DBGSESSID', '/');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setCookie('DBGSESSID', '1@clienthost:7869;d=1,p=0,c=1', 'SESSION', '/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
|
@ -190,8 +190,7 @@ $template->assign_vars(array(
|
||||||
'FORUM_PATH' => FORUM_PATH,
|
'FORUM_PATH' => FORUM_PATH,
|
||||||
'FULL_URL' => FULL_URL,
|
'FULL_URL' => FULL_URL,
|
||||||
|
|
||||||
'LAST_VISIT_DATE' => ($logged_in) ? sprintf($lang['YOU_LAST_VISIT'], bb_date($userdata['user_lastvisit'], $bb_cfg['last_visit_date_format'])) : '',
|
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)),
|
||||||
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'])),
|
|
||||||
'S_TIMEZONE' => sprintf($lang['ALL_TIMES'], $lang[''.str_replace(',', '.', floatval($bb_cfg['board_timezone'])).'']),
|
'S_TIMEZONE' => sprintf($lang['ALL_TIMES'], $lang[''.str_replace(',', '.', floatval($bb_cfg['board_timezone'])).'']),
|
||||||
|
|
||||||
'PM_INFO' => $pm_info,
|
'PM_INFO' => $pm_info,
|
||||||
|
@ -256,7 +255,6 @@ $template->assign_vars(array(
|
||||||
'ONLY_NEW_TOPICS' => ONLY_NEW_TOPICS,
|
'ONLY_NEW_TOPICS' => ONLY_NEW_TOPICS,
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
'DEBUG' => DEBUG,
|
|
||||||
'BOT_UID' => BOT_UID,
|
'BOT_UID' => BOT_UID,
|
||||||
'COOKIE_MARK' => COOKIE_MARK,
|
'COOKIE_MARK' => COOKIE_MARK,
|
||||||
'SID' => $userdata['session_id'],
|
'SID' => $userdata['session_id'],
|
||||||
|
@ -301,15 +299,6 @@ if (!empty($page_cfg['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBG_USER)
|
|
||||||
{
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'INCLUDE_DEVELOP_JS' => true,
|
|
||||||
'EDITOR_PATH' => @addslashes($bb_cfg['dbg']['editor_path']),
|
|
||||||
'EDITOR_ARGS' => @addslashes($bb_cfg['dbg']['editor_args']),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ads
|
// Ads
|
||||||
if ($user->show_ads)
|
if ($user->show_ads)
|
||||||
{
|
{
|
||||||
|
@ -328,18 +317,12 @@ if ($user->show_ads)
|
||||||
$in_out = ($logged_in) ? 'in' : 'out';
|
$in_out = ($logged_in) ? 'in' : 'out';
|
||||||
$template->assign_block_vars("switch_user_logged_{$in_out}", array());
|
$template->assign_block_vars("switch_user_logged_{$in_out}", array());
|
||||||
|
|
||||||
// Work around for "current" Apache 2 + PHP module which seems to not
|
if (!IS_GUEST)
|
||||||
// cope with private cache control setting
|
|
||||||
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
|
|
||||||
{
|
|
||||||
header('Cache-Control: no-cache, pre-check=0, post-check=0');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
|
header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
|
||||||
}
|
|
||||||
header('Expires: 0');
|
header('Expires: 0');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
|
}
|
||||||
|
|
||||||
$template->set_filenames(array('page_header' => 'page_header.tpl'));
|
$template->set_filenames(array('page_header' => 'page_header.tpl'));
|
||||||
$template->pparse('page_header');
|
$template->pparse('page_header');
|
||||||
|
|
|
@ -24,7 +24,7 @@ class report_post extends report_module
|
||||||
$sql = 'UPDATE ' . BB_POSTS . '
|
$sql = 'UPDATE ' . BB_POSTS . '
|
||||||
SET post_reported = 0';
|
SET post_reported = 0';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not reset post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not reset post reported flag');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$uninstall) {
|
if (!$uninstall) {
|
||||||
|
@ -34,7 +34,7 @@ class report_post extends report_module
|
||||||
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
||||||
GROUP BY report_subject';
|
GROUP BY report_subject';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain open reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain open reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$open_ids = array();
|
$open_ids = array();
|
||||||
|
@ -48,7 +48,7 @@ class report_post extends report_module
|
||||||
SET post_reported = 1
|
SET post_reported = 1
|
||||||
WHERE post_id IN(' . implode(', ', $open_ids) . ')';
|
WHERE post_id IN(' . implode(', ', $open_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not sync post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not sync post reported flag');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class report_post extends report_module
|
||||||
SET post_reported = 1
|
SET post_reported = 1
|
||||||
WHERE post_id = ' . (int)$report_subject;
|
WHERE post_id = ' . (int)$report_subject;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update post reported flag #1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class report_post extends report_module
|
||||||
SET post_reported = 1
|
SET post_reported = 1
|
||||||
WHERE post_id IN(' . implode(', ', $report_subjects) . ')';
|
WHERE post_id IN(' . implode(', ', $report_subjects) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update post reported flag #2');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class report_post extends report_module
|
||||||
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
||||||
GROUP BY report_subject';
|
GROUP BY report_subject';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not get open reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get open reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$open_ids = array();
|
$open_ids = array();
|
||||||
|
@ -120,7 +120,7 @@ class report_post extends report_module
|
||||||
SET post_reported = 1
|
SET post_reported = 1
|
||||||
WHERE post_id IN(' . implode(', ', $open_ids) . ')';
|
WHERE post_id IN(' . implode(', ', $open_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update post reported flag #3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class report_post extends report_module
|
||||||
SET post_reported = 0
|
SET post_reported = 0
|
||||||
WHERE post_id IN(' . implode(', ', $clear_ids) . ')';
|
WHERE post_id IN(' . implode(', ', $clear_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update post reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update post reported flag #4');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ class report_post extends report_module
|
||||||
ON t.topic_id = p.topic_id
|
ON t.topic_id = p.topic_id
|
||||||
WHERE p.post_id = ' . (int)$report_subject;
|
WHERE p.post_id = ' . (int)$report_subject;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report subject', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report subject');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -192,7 +192,7 @@ class report_post extends report_module
|
||||||
FROM ' . BB_POSTS . '
|
FROM ' . BB_POSTS . '
|
||||||
WHERE post_id = ' . (int)$report_subject;
|
WHERE post_id = ' . (int)$report_subject;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report subject data', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report subject data');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -231,7 +231,7 @@ class report_post extends report_module
|
||||||
FROM ' . BB_POSTS . '
|
FROM ' . BB_POSTS . '
|
||||||
WHERE post_id IN(' . implode(', ', $check_posts) . ')';
|
WHERE post_id IN(' . implode(', ', $check_posts) . ')';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain current forum ids', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain current forum ids');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($row = DB()->sql_fetchrow($result)) {
|
while ($row = DB()->sql_fetchrow($result)) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class report_privmsg extends report_module
|
||||||
$sql = 'UPDATE ' . BB_PRIVMSGS . '
|
$sql = 'UPDATE ' . BB_PRIVMSGS . '
|
||||||
SET privmsgs_reported = 0';
|
SET privmsgs_reported = 0';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not reset privmsgs reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not reset privmsgs reported flag');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$uninstall) {
|
if (!$uninstall) {
|
||||||
|
@ -33,7 +33,7 @@ class report_privmsg extends report_module
|
||||||
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
||||||
GROUP BY report_subject';
|
GROUP BY report_subject';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain open reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain open reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$open_ids = array();
|
$open_ids = array();
|
||||||
|
@ -47,7 +47,7 @@ class report_privmsg extends report_module
|
||||||
SET privmsgs_reported = 1
|
SET privmsgs_reported = 1
|
||||||
WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
|
WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not sync privmsgs reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not sync privmsgs reported flag');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class report_privmsg extends report_module
|
||||||
SET privmsgs_reported = 1
|
SET privmsgs_reported = 1
|
||||||
WHERE privmsgs_id = ' . (int)$report_subject;
|
WHERE privmsgs_id = ' . (int)$report_subject;
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update privmsgs reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update privmsgs reported flag #1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class report_privmsg extends report_module
|
||||||
SET privmsgs_reported = 1
|
SET privmsgs_reported = 1
|
||||||
WHERE privmsgs_id IN(' . implode(', ', $report_subjects) . ')';
|
WHERE privmsgs_id IN(' . implode(', ', $report_subjects) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update privmsgs reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update privmsgs reported flag #2');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class report_privmsg extends report_module
|
||||||
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
AND report_status NOT IN(' . REPORT_CLEARED . ', ' . REPORT_DELETE . ')
|
||||||
GROUP BY report_subject';
|
GROUP BY report_subject';
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not get open reports', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not get open reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
$open_ids = array();
|
$open_ids = array();
|
||||||
|
@ -119,7 +119,7 @@ class report_privmsg extends report_module
|
||||||
SET privmsgs_reported = 1
|
SET privmsgs_reported = 1
|
||||||
WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
|
WHERE privmsgs_id IN(' . implode(', ', $open_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update topic reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update privmsgs reported flag #3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class report_privmsg extends report_module
|
||||||
SET privmsgs_reported = 0
|
SET privmsgs_reported = 0
|
||||||
WHERE privmsgs_id IN(' . implode(', ', $clear_ids) . ')';
|
WHERE privmsgs_id IN(' . implode(', ', $clear_ids) . ')';
|
||||||
if (!DB()->sql_query($sql)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not update topic reported flag', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not update privmsgs reported flag #4');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ class report_privmsg extends report_module
|
||||||
WHERE privmsgs_to_userid = ' . $userdata['user_id'] . '
|
WHERE privmsgs_to_userid = ' . $userdata['user_id'] . '
|
||||||
AND privmsgs_id = ' . (int)$report_subject;
|
AND privmsgs_id = ' . (int)$report_subject;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain report subject', '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report subject');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
@ -183,7 +183,7 @@ class report_privmsg extends report_module
|
||||||
ON u.user_id = p.privmsgs_from_userid
|
ON u.user_id = p.privmsgs_from_userid
|
||||||
WHERE privmsgs_id = ' . (int)$report_subject;
|
WHERE privmsgs_id = ' . (int)$report_subject;
|
||||||
if (!$result = DB()->sql_query($sql)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
message_die(GENERAL_ERROR, "Could not obtain report subject details", '', __LINE__, __FILE__, $sql);
|
bb_die('Could not obtain report subject details');
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$row = DB()->sql_fetchrow($result);
|
||||||
|
|