mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-23 06:35:45 -07:00
Merge pull request #100 from Exile37/new-configuration
Migration to the new config subsystem
This commit is contained in:
commit
58ff3fafb7
126 changed files with 1249 additions and 975 deletions
19
.editorconfig
Normal file
19
.editorconfig
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.{diff,md}]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.php]
|
||||||
|
indent_size = 4
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
||||||
### TorrentPier ###
|
### TorrentPier ###
|
||||||
.idea/
|
.idea
|
||||||
|
bower_components
|
||||||
composer.phar
|
composer.phar
|
||||||
composer.lock
|
composer.lock
|
||||||
|
configs/local.php
|
||||||
data/avatars
|
data/avatars
|
||||||
data/torrent_files
|
data/torrent_files
|
||||||
internal_data/ajax_html
|
internal_data/ajax_html
|
||||||
|
@ -11,6 +13,7 @@ internal_data/log
|
||||||
internal_data/sitemap
|
internal_data/sitemap
|
||||||
internal_data/triggers
|
internal_data/triggers
|
||||||
library/config.local.php
|
library/config.local.php
|
||||||
|
node_modules
|
||||||
vendor
|
vendor
|
||||||
|
|
||||||
### Archives ###
|
### Archives ###
|
||||||
|
|
32
.scrutinizer.yml
Normal file
32
.scrutinizer.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
build:
|
||||||
|
environment:
|
||||||
|
php:
|
||||||
|
version: 5.6
|
||||||
|
|
||||||
|
filter:
|
||||||
|
excluded_paths:
|
||||||
|
- 'tests/*'
|
||||||
|
|
||||||
|
checks:
|
||||||
|
php:
|
||||||
|
one_class_per_file: false
|
||||||
|
side_effects_or_types: false
|
||||||
|
no_mixed_inline_html: false
|
||||||
|
require_braces_around_control_structures: false
|
||||||
|
php5_style_constructor: false
|
||||||
|
no_global_keyword: false
|
||||||
|
avoid_usage_of_logical_operators: false
|
||||||
|
no_underscore_prefix_in_properties: false
|
||||||
|
no_underscore_prefix_in_methods: false
|
||||||
|
single_namespace_per_use: false
|
||||||
|
avoid_superglobals: false
|
||||||
|
no_exit: false
|
||||||
|
|
||||||
|
coding_style:
|
||||||
|
php:
|
||||||
|
indentation:
|
||||||
|
general:
|
||||||
|
use_tabs: true
|
||||||
|
spaces:
|
||||||
|
around_operators:
|
||||||
|
concatenation: true
|
|
@ -7,6 +7,9 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
|
if (!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
|
||||||
|
|
||||||
require(INC_DIR .'functions_admin_torrent.php');
|
require(INC_DIR .'functions_admin_torrent.php');
|
||||||
|
@ -51,9 +54,9 @@ set_tpl_vars ($default_cfg_num, $tr_cfg);
|
||||||
set_tpl_vars_lang ($default_cfg_num);
|
set_tpl_vars_lang ($default_cfg_num);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'],
|
'IGNORE_REPORTED_IP' => $di->config->get('ignore_reported_ip'),
|
||||||
'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'],
|
'ANNOUNCE_INTERVAL' => $di->config->get('announce_interval'),
|
||||||
'PASSKEY_KEY' => $bb_cfg['passkey_key'],
|
'PASSKEY_KEY' => $di->config->get('passkey_key'),
|
||||||
'GOLD_SILVER_ENABLED' => $tr_cfg['gold_silver_enabled'],
|
'GOLD_SILVER_ENABLED' => $tr_cfg['gold_silver_enabled'],
|
||||||
'DISABLE_SUBMIT' => true,
|
'DISABLE_SUBMIT' => true,
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$datastore->enqueue(array(
|
$datastore->enqueue(array(
|
||||||
'moderators',
|
'moderators',
|
||||||
));
|
));
|
||||||
|
@ -155,7 +158,7 @@ if (($var =& $_REQUEST[$daysback_key]) && ($var != $def_days))
|
||||||
}
|
}
|
||||||
if (($var =& $_REQUEST[$datetime_key]) && ($var != $def_datetime))
|
if (($var =& $_REQUEST[$datetime_key]) && ($var != $def_datetime))
|
||||||
{
|
{
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * $di->config->get('board_timezone'));
|
||||||
if (($tmp_timestamp = strtotime($var, $tz)) > 0)
|
if (($tmp_timestamp = strtotime($var, $tz)) > 0)
|
||||||
{
|
{
|
||||||
$datetime_val = $tmp_timestamp;
|
$datetime_val = $tmp_timestamp;
|
||||||
|
|
|
@ -7,6 +7,9 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
set_time_limit(1200);
|
set_time_limit(1200);
|
||||||
|
|
||||||
$subject = (string) trim(request_var('subject', ''));
|
$subject = (string) trim(request_var('subject', ''));
|
||||||
|
@ -57,9 +60,9 @@ if (isset($_POST['submit']))
|
||||||
|
|
||||||
foreach ($user_list as $i => $row)
|
foreach ($user_list as $i => $row)
|
||||||
{
|
{
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
||||||
$emailer->use_template('admin_send_email');
|
$emailer->use_template('admin_send_email');
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ if (request_var('submit', '')) {
|
||||||
bb_die('<a href="admin_sitemap.php">' . $lang['GO_BACK'] . '</a>');
|
bb_die('<a href="admin_sitemap.php">' . $lang['GO_BACK'] . '</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$s_mess = $lang['SITEMAP_CREATED'].': <b>'. bb_date($bb_cfg['sitemap_time'], $bb_cfg['post_date_format']) .'</b> '. $lang['SITEMAP_AVAILABLE'] .': <a href="'. make_url('sitemap.xml') .'" target="_blank">'. make_url('sitemap.xml') .'</a>';
|
$s_mess = $lang['SITEMAP_CREATED'].': <b>'. bb_date($di->config->get('sitemap_time'), $di->config->get('post_date_format')) .'</b> '. $lang['SITEMAP_AVAILABLE'] .': <a href="'. make_url('sitemap.xml') .'" target="_blank">'. make_url('sitemap.xml') .'</a>';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'STATIC_SITEMAP' => $bb_cfg['static_sitemap'],
|
'STATIC_SITEMAP' => $di->config->get('static_sitemap'),
|
||||||
'MESSAGE' => (file_exists(INT_DATA_DIR ."sitemap/sitemap.xml")) ? $s_mess : $lang['SITEMAP_NOT_CREATED'],
|
'MESSAGE' => (file_exists(INT_DATA_DIR ."sitemap/sitemap.xml")) ? $s_mess : $lang['SITEMAP_NOT_CREATED'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// 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']))
|
||||||
{
|
{
|
||||||
|
@ -21,13 +24,13 @@ 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 . $di->config->get('smilies_path'));
|
||||||
|
|
||||||
while ($file = readdir($dir))
|
while ($file = readdir($dir))
|
||||||
{
|
{
|
||||||
if (!is_dir(bb_realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file)))
|
if (!is_dir(bb_realpath(BB_ROOT . $di->config->get('smilies_path') . '/' . $file)))
|
||||||
{
|
{
|
||||||
$img_size = getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
|
$img_size = getimagesize(BB_ROOT . $di->config->get('smilies_path') . '/' . $file);
|
||||||
|
|
||||||
if ($img_size[0] && $img_size[1])
|
if ($img_size[0] && $img_size[1])
|
||||||
{
|
{
|
||||||
|
@ -78,7 +81,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack']))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fcontents = file(BB_ROOT . $bb_cfg['smilies_path'] . '/'. $smile_pak);
|
$fcontents = file(BB_ROOT . $di->config->get('smilies_path') . '/'. $smile_pak);
|
||||||
|
|
||||||
if (empty($fcontents))
|
if (empty($fcontents))
|
||||||
{
|
{
|
||||||
|
@ -197,11 +200,11 @@ else if (isset($_POST['add']) || isset($_GET['add']))
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_SMILE_EDIT' => true,
|
'TPL_SMILE_EDIT' => true,
|
||||||
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_images[0],
|
'SMILEY_IMG' => BB_ROOT . $di->config->get('smilies_path') . '/' . $smiley_images[0],
|
||||||
'S_SMILEY_ACTION' => "admin_smilies.php",
|
'S_SMILEY_ACTION' => "admin_smilies.php",
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_FILENAME_OPTIONS' => $filename_list,
|
'S_FILENAME_OPTIONS' => $filename_list,
|
||||||
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
|
'S_SMILEY_BASEDIR' => BB_ROOT . $di->config->get('smilies_path')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else if ( $mode != '' )
|
else if ( $mode != '' )
|
||||||
|
@ -256,11 +259,11 @@ else if ( $mode != '' )
|
||||||
'TPL_SMILE_EDIT' => true,
|
'TPL_SMILE_EDIT' => true,
|
||||||
'SMILEY_CODE' => $smile_data['code'],
|
'SMILEY_CODE' => $smile_data['code'],
|
||||||
'SMILEY_EMOTICON' => $smile_data['emoticon'],
|
'SMILEY_EMOTICON' => $smile_data['emoticon'],
|
||||||
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
|
'SMILEY_IMG' => BB_ROOT . $di->config->get('smilies_path') . '/' . $smiley_edit_img,
|
||||||
'S_SMILEY_ACTION' => "admin_smilies.php",
|
'S_SMILEY_ACTION' => "admin_smilies.php",
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_FILENAME_OPTIONS' => $filename_list,
|
'S_FILENAME_OPTIONS' => $filename_list,
|
||||||
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
|
'S_SMILEY_BASEDIR' => BB_ROOT . $di->config->get('smilies_path'),
|
||||||
));
|
));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -357,7 +360,7 @@ else
|
||||||
$template->assign_block_vars('smiles', array(
|
$template->assign_block_vars('smiles', array(
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
|
|
||||||
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] .'/'. $smilies[$i]['smile_url'],
|
'SMILEY_IMG' => BB_ROOT . $di->config->get('smilies_path') .'/'. $smilies[$i]['smile_url'],
|
||||||
'CODE' => $smilies[$i]['code'],
|
'CODE' => $smilies[$i]['code'],
|
||||||
'EMOT' => $smilies[$i]['emoticon'],
|
'EMOT' => $smilies[$i]['emoticon'],
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require(INC_DIR .'bbcode.php');
|
require(INC_DIR .'bbcode.php');
|
||||||
|
|
||||||
if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message'])
|
if (isset($_POST['post']) && $di->config->get('terms') != $_POST['message'])
|
||||||
{
|
{
|
||||||
bb_update_config(array('terms' => $_POST['message']));
|
bb_update_config(array('terms' => $_POST['message']));
|
||||||
bb_die($lang['CONFIG_UPDATED']);
|
bb_die($lang['CONFIG_UPDATED']);
|
||||||
|
@ -17,8 +20,8 @@ if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message'])
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_ACTION' => 'admin_terms.php',
|
'S_ACTION' => 'admin_terms.php',
|
||||||
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
|
'EXT_LINK_NW' => $di->config->get('ext_link_new_win'),
|
||||||
'MESSAGE' => ($bb_cfg['terms']) ? $bb_cfg['terms'] : '',
|
'MESSAGE' => ($di->config->get('terms')) ? $di->config->get('terms') : '',
|
||||||
'PREVIEW_HTML' => (isset($_REQUEST['preview'])) ? bbcode2html($_POST['message']) : '',
|
'PREVIEW_HTML' => (isset($_REQUEST['preview'])) ? bbcode2html($_POST['message']) : '',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ if (!empty($setmodules))
|
||||||
}
|
}
|
||||||
require('./pagestart.php');
|
require('./pagestart.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
array_deep($_POST, 'trim');
|
array_deep($_POST, 'trim');
|
||||||
|
|
||||||
require(INC_DIR .'functions_selects.php');
|
require(INC_DIR .'functions_selects.php');
|
||||||
|
@ -945,10 +948,10 @@ else
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$offset = ( ($page - 1) * $bb_cfg['topics_per_page']);
|
$offset = ( ($page - 1) * $di->config->get('topics_per_page'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = "LIMIT $offset, ".$bb_cfg['topics_per_page'];
|
$limit = "LIMIT $offset, ".$di->config->get('topics_per_page');
|
||||||
|
|
||||||
$select_sql .= " $limit";
|
$select_sql .= " $limit";
|
||||||
|
|
||||||
|
@ -966,7 +969,7 @@ else
|
||||||
bb_die($lang['SEARCH_NO_RESULTS']);
|
bb_die($lang['SEARCH_NO_RESULTS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$num_pages = ceil( ( $total_pages['total'] / $bb_cfg['topics_per_page'] ) );
|
$num_pages = ceil( ( $total_pages['total'] / $di->config->get('topics_per_page') ) );
|
||||||
|
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ $di = \TorrentPier\Di::getInstance();
|
||||||
/** @var \TorrentPier\Cache\Adapter $cache */
|
/** @var \TorrentPier\Cache\Adapter $cache */
|
||||||
$cache = $di->cache;
|
$cache = $di->cache;
|
||||||
|
|
||||||
if (!$bb_cfg['use_word_censor'])
|
if (!$di->config->get('use_word_censor'))
|
||||||
{
|
{
|
||||||
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
|
bb_die('Word censor disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
|
|
|
@ -65,7 +65,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TPL_ADMIN_MAIN' => true,
|
'TPL_ADMIN_MAIN' => true,
|
||||||
'ADMIN_LOCK' => ($bb_cfg['board_disable']) ? true : false,
|
'ADMIN_LOCK' => ($di->config->get('board_disable')) ? true : false,
|
||||||
'ADMIN_LOCK_CRON' => (file_exists(BB_DISABLED)) ? true :false,
|
'ADMIN_LOCK_CRON' => (file_exists(BB_DISABLED)) ? true :false,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
$total_posts = get_db_stat('postcount');
|
$total_posts = get_db_stat('postcount');
|
||||||
$total_users = get_db_stat('usercount');
|
$total_users = get_db_stat('usercount');
|
||||||
$total_topics = get_db_stat('topiccount');
|
$total_topics = get_db_stat('topiccount');
|
||||||
$start_date = bb_date($bb_cfg['board_startdate']);
|
$start_date = bb_date($di->config->get('board_startdate'));
|
||||||
$boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400;
|
$boarddays = (TIMENOW - $di->config->get('board_startdate')) / 86400;
|
||||||
|
|
||||||
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
||||||
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
||||||
|
@ -82,13 +82,13 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
|
|
||||||
$avatar_dir_size = 0;
|
$avatar_dir_size = 0;
|
||||||
|
|
||||||
if ($avatar_dir = opendir(BB_ROOT . $bb_cfg['avatar_path']))
|
if ($avatar_dir = opendir(BB_ROOT . $di->config->get('avatar_path')))
|
||||||
{
|
{
|
||||||
while( $file = readdir($avatar_dir) )
|
while( $file = readdir($avatar_dir) )
|
||||||
{
|
{
|
||||||
if( $file != '.' && $file != '..' )
|
if( $file != '.' && $file != '..' )
|
||||||
{
|
{
|
||||||
$avatar_dir_size += filesize(BB_ROOT . $bb_cfg['avatar_path'] . '/' . $file);
|
$avatar_dir_size += filesize(BB_ROOT . $di->config->get('avatar_path') . '/' . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($avatar_dir);
|
closedir($avatar_dir);
|
||||||
|
@ -125,7 +125,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
if (preg_match('/^(3\.23|4\.|5\.|10\.)/', $version))
|
if (preg_match('/^(3\.23|4\.|5\.|10\.)/', $version))
|
||||||
{
|
{
|
||||||
$dblist = array();
|
$dblist = array();
|
||||||
foreach ($bb_cfg['db'] as $name => $row)
|
foreach ($di->config->get('db') as $name => $row)
|
||||||
{
|
{
|
||||||
$sql = "SHOW TABLE STATUS FROM {$row[1]}";
|
$sql = "SHOW TABLE STATUS FROM {$row[1]}";
|
||||||
if ($result = DB()->sql_query($sql))
|
if ($result = DB()->sql_query($sql))
|
||||||
|
@ -165,9 +165,9 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
'USERS_PER_DAY' => $users_per_day,
|
'USERS_PER_DAY' => $users_per_day,
|
||||||
'AVATAR_DIR_SIZE' => $avatar_dir_size,
|
'AVATAR_DIR_SIZE' => $avatar_dir_size,
|
||||||
'DB_SIZE' => $dbsize,
|
'DB_SIZE' => $dbsize,
|
||||||
'GZIP_COMPRESSION' => ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'],
|
'GZIP_COMPRESSION' => ($di->config->get('gzip_compress')) ? $lang['ON'] : $lang['OFF'],
|
||||||
'TP_VERSION' => $bb_cfg['tp_version'] . (!empty($bb_cfg['tp_release_state']) ? ' :: ' . $bb_cfg['tp_release_state'] : ''),
|
'TP_VERSION' => $di->config->get('tp_version') . (!empty($di->config->get('tp_release_state')) ? ' :: ' . $di->config->get('tp_release_state') : ''),
|
||||||
'TP_RELEASE_DATE' => $bb_cfg['tp_release_date'],
|
'TP_RELEASE_DATE' => $di->config->get('tp_release_date'),
|
||||||
'ZF_VERSION' => Zend\Version\Version::VERSION,
|
'ZF_VERSION' => Zend\Version\Version::VERSION,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
'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' => $di->config->get('whois_info') . $reg_ip,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
'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' => $di->config->get('whois_info') . $guest_ip,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ else
|
||||||
{
|
{
|
||||||
// Generate frameset
|
// Generate frameset
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'],
|
'CONTENT_ENCODING' => $di->config->get('lang.' . $userdata['user_lang'] . '.encoding'),
|
||||||
'TPL_ADMIN_FRAMESET' => true,
|
'TPL_ADMIN_FRAMESET' => true,
|
||||||
));
|
));
|
||||||
send_no_cache_headers();
|
send_no_cache_headers();
|
||||||
|
|
|
@ -4,6 +4,9 @@ define('IN_ADMIN', true);
|
||||||
define('BB_ROOT', './../../');
|
define('BB_ROOT', './../../');
|
||||||
require(BB_ROOT .'common.php');
|
require(BB_ROOT .'common.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$user->session_start();
|
$user->session_start();
|
||||||
|
|
||||||
if (!IS_ADMIN) bb_die($lang['NOT_AUTHORISED']);
|
if (!IS_ADMIN) bb_die($lang['NOT_AUTHORISED']);
|
||||||
|
@ -11,7 +14,7 @@ if (!IS_ADMIN) bb_die($lang['NOT_AUTHORISED']);
|
||||||
$peers_in_last_minutes = array(30, 15, 5, 1);
|
$peers_in_last_minutes = array(30, 15, 5, 1);
|
||||||
$peers_in_last_sec_limit = 300;
|
$peers_in_last_sec_limit = 300;
|
||||||
|
|
||||||
$announce_interval = intval($bb_cfg['announce_interval']);
|
$announce_interval = intval($di->config->get('announce_interval'));
|
||||||
$stat = array();
|
$stat = array();
|
||||||
|
|
||||||
define('TMP_TRACKER_TABLE', 'tmp_tracker');
|
define('TMP_TRACKER_TABLE', 'tmp_tracker');
|
||||||
|
|
5
app.php
5
app.php
|
@ -7,17 +7,12 @@ $view = $di->view;
|
||||||
/** @var \TorrentPier\Db\Adapter $db */
|
/** @var \TorrentPier\Db\Adapter $db */
|
||||||
$db = $di->db;
|
$db = $di->db;
|
||||||
|
|
||||||
|
|
||||||
$view->addGlobal('title', 'Title Page Simple');
|
$view->addGlobal('title', 'Title Page Simple');
|
||||||
|
|
||||||
|
|
||||||
$categories = $db->select('bb_categories', function (\Zend\Db\Sql\Select $query) {
|
$categories = $db->select('bb_categories', function (\Zend\Db\Sql\Select $query) {
|
||||||
$query->join('bb_forums', 'bb_categories.cat_id = bb_forums.cat_id');
|
$query->join('bb_forums', 'bb_categories.cat_id = bb_forums.cat_id');
|
||||||
})->all();
|
})->all();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo $view->make('app', [
|
echo $view->make('app', [
|
||||||
'data' => 'Hello world',
|
'data' => 'Hello world',
|
||||||
'categories' => $categories
|
'categories' => $categories
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
use TorrentPier\Di,
|
use TorrentPier\Di;
|
||||||
TorrentPier\ServiceProviders;
|
use TorrentPier\ServiceProviders;
|
||||||
|
|
||||||
$di = new Di();
|
$di = new Di();
|
||||||
|
|
||||||
|
|
24
bower.json
Normal file
24
bower.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "torrentpier",
|
||||||
|
"description": "TorrentPier. Bittorrent-tracker engine",
|
||||||
|
"main": "build/index.js",
|
||||||
|
"authors": [
|
||||||
|
"Exile <admin@torrentpier.me>"
|
||||||
|
],
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"homepage": "https://torrentpier.me/",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"bootstrap": "^3.3.7",
|
||||||
|
"jquery": "^3.1.0",
|
||||||
|
"moment": "^2.14.1",
|
||||||
|
"font-awesome": "fontawesome#^4.6.3",
|
||||||
|
"jquery.quicksearch": "quicksearch#^2.3.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,8 +23,8 @@ if (isset($_GET['event']) && $_GET['event'] === 'completed')
|
||||||
dummy_exit(mt_rand(600, 1200));
|
dummy_exit(mt_rand(600, 1200));
|
||||||
}
|
}
|
||||||
|
|
||||||
$announce_interval = $bb_cfg['announce_interval'];
|
$announce_interval = $di->config->get('announce_interval');
|
||||||
$passkey_key = $bb_cfg['passkey_key'];
|
$passkey_key = $di->config->get('passkey_key');
|
||||||
$max_left_val = 536870912000; // 500 GB
|
$max_left_val = 536870912000; // 500 GB
|
||||||
$max_up_down_val = 5497558138880; // 5 TB
|
$max_up_down_val = 5497558138880; // 5 TB
|
||||||
$max_up_add_val = 85899345920; // 80 GB
|
$max_up_add_val = 85899345920; // 80 GB
|
||||||
|
@ -112,9 +112,9 @@ if (!verify_id($passkey, BT_AUTH_KEY_LENGTH))
|
||||||
// IP
|
// IP
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip'])
|
if (!$di->config->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip'])
|
||||||
{
|
{
|
||||||
if (!$bb_cfg['verify_reported_ip'])
|
if (!$di->config->get('verify_reported_ip'))
|
||||||
{
|
{
|
||||||
$ip = $_GET['ip'];
|
$ip = $_GET['ip'];
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip'])
|
||||||
{
|
{
|
||||||
if ($x_ip === $_GET['ip'])
|
if ($x_ip === $_GET['ip'])
|
||||||
{
|
{
|
||||||
if (!$bb_cfg['allow_internal_ip'] && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip))
|
if (!$di->config->get('allow_internal_ip') && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit active torrents
|
// Limit active torrents
|
||||||
if (!isset($bb_cfg['unlimited_users'][$user_id]) && $tr_cfg['limit_active_tor'] && (($tr_cfg['limit_seed_count'] && $seeder) || ($tr_cfg['limit_leech_count'] && !$seeder)))
|
if (!$di->config->get('unlimited_users.' . $user_id) && $tr_cfg['limit_active_tor'] && (($tr_cfg['limit_seed_count'] && $seeder) || ($tr_cfg['limit_leech_count'] && !$seeder)))
|
||||||
{
|
{
|
||||||
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
|
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
|
||||||
FROM ". BB_BT_TRACKER ."
|
FROM ". BB_BT_TRACKER ."
|
||||||
|
|
31
common.php
31
common.php
|
@ -52,7 +52,6 @@ $di->register(new \TorrentPier\ServiceProviders\TranslationServiceProvider());
|
||||||
$di->register(new \TorrentPier\ServiceProviders\TwigServiceProvider());
|
$di->register(new \TorrentPier\ServiceProviders\TwigServiceProvider());
|
||||||
$di->register(new \TorrentPier\ServiceProviders\CaptchaServiceProvider());
|
$di->register(new \TorrentPier\ServiceProviders\CaptchaServiceProvider());
|
||||||
|
|
||||||
$bb_cfg = $di->config->toArray();
|
|
||||||
$page_cfg = $di->config->page->toArray();
|
$page_cfg = $di->config->page->toArray();
|
||||||
$tr_cfg = $di->config->tracker->toArray();
|
$tr_cfg = $di->config->tracker->toArray();
|
||||||
$rating_limits = $di->config->rating->toArray();
|
$rating_limits = $di->config->rating->toArray();
|
||||||
|
@ -63,10 +62,10 @@ use Zend\Loader\StandardAutoloader;
|
||||||
$loader = new StandardAutoloader(array('autoregister_zf' => true));
|
$loader = new StandardAutoloader(array('autoregister_zf' => true));
|
||||||
$loader->register();
|
$loader->register();
|
||||||
|
|
||||||
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
$server_protocol = ($di->config->get('cookie_secure')) ? 'https://' : 'http://';
|
||||||
$server_port = (in_array($bb_cfg['server_port'], array(80, 443))) ? '' : ':' . $bb_cfg['server_port'];
|
$server_port = (in_array($di->config->get('server_port'), array(80, 443))) ? '' : ':' . $di->config->get('server_port');
|
||||||
define('FORUM_PATH', $bb_cfg['script_path']);
|
define('FORUM_PATH', $di->config->get('script_path'));
|
||||||
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
|
define('FULL_URL', $server_protocol . $di->config->get('server_name') . $server_port . $di->config->get('script_path'));
|
||||||
unset($server_protocol, $server_port);
|
unset($server_protocol, $server_port);
|
||||||
|
|
||||||
// Debug options
|
// Debug options
|
||||||
|
@ -82,8 +81,8 @@ define('BT_AUTH_KEY_LENGTH', 10);
|
||||||
|
|
||||||
define('PEER_HASH_PREFIX', 'peer_');
|
define('PEER_HASH_PREFIX', 'peer_');
|
||||||
define('PEERS_LIST_PREFIX', 'peers_list_');
|
define('PEERS_LIST_PREFIX', 'peers_list_');
|
||||||
define('PEER_HASH_EXPIRE', round($bb_cfg['announce_interval'] * (0.85 * $tr_cfg['expire_factor']))); // sec
|
define('PEER_HASH_EXPIRE', round($di->config->get('announce_interval') * (0.85 * $tr_cfg['expire_factor']))); // sec
|
||||||
define('PEERS_LIST_EXPIRE', round($bb_cfg['announce_interval'] * 0.7)); // sec
|
define('PEERS_LIST_EXPIRE', round($di->config->get('announce_interval') * 0.7)); // sec
|
||||||
|
|
||||||
define('DL_STATUS_RELEASER', -1);
|
define('DL_STATUS_RELEASER', -1);
|
||||||
define('DL_STATUS_DOWN', 0);
|
define('DL_STATUS_DOWN', 0);
|
||||||
|
@ -115,7 +114,7 @@ $DBS = new DBS([
|
||||||
false
|
false
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'db_alias' => $bb_cfg['db_alias']
|
'db_alias' => $di->config->get('db_alias')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,35 +139,35 @@ require(INC_DIR . 'datastore/xcache.php');
|
||||||
require(INC_DIR . 'datastore/file.php');
|
require(INC_DIR . 'datastore/file.php');
|
||||||
|
|
||||||
// Initialize datastore
|
// Initialize datastore
|
||||||
switch ($bb_cfg['datastore_type'])
|
switch ($di->config->get('datastore_type'))
|
||||||
{
|
{
|
||||||
case 'memcache':
|
case 'memcache':
|
||||||
$datastore = new datastore_memcache($bb_cfg['cache']['memcache'], $bb_cfg['cache']['prefix']);
|
$datastore = new datastore_memcache($di->config->get('cache.memcache'), $di->config->get('cache.prefix'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sqlite':
|
case 'sqlite':
|
||||||
$default_cfg = array(
|
$default_cfg = array(
|
||||||
'db_file_path' => $bb_cfg['cache']['db_dir'] .'datastore.sqlite.db',
|
'db_file_path' => $di->config->get('cache.db_dir') .'datastore.sqlite.db',
|
||||||
'pconnect' => true,
|
'pconnect' => true,
|
||||||
'con_required' => true,
|
'con_required' => true,
|
||||||
);
|
);
|
||||||
$datastore = new datastore_sqlite($default_cfg, $bb_cfg['cache']['prefix']);
|
$datastore = new datastore_sqlite($default_cfg, $di->config->get('cache.prefix'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'redis':
|
case 'redis':
|
||||||
$datastore = new datastore_redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
|
$datastore = new datastore_redis($di->config->get('cache.redis'), $di->config->get('cache.prefix'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'apc':
|
case 'apc':
|
||||||
$datastore = new datastore_apc($bb_cfg['cache']['prefix']);
|
$datastore = new datastore_apc($di->config->get('cache.prefix'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'xcache':
|
case 'xcache':
|
||||||
$datastore = new datastore_xcache($bb_cfg['cache']['prefix']);
|
$datastore = new datastore_xcache($di->config->get('cache.prefix'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'filecache':
|
case 'filecache':
|
||||||
default: $datastore = new datastore_file($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
|
default: $datastore = new datastore_file($di->config->get('cache.db_dir') . 'datastore/', $di->config->get('cache.prefix'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_dbg_enabled ()
|
function sql_dbg_enabled ()
|
||||||
|
|
|
@ -15,14 +15,12 @@
|
||||||
"support": {
|
"support": {
|
||||||
"email": "support@torrentpier.me",
|
"email": "support@torrentpier.me",
|
||||||
"issues" : "https://github.com/torrentpier/torrentpier/issues",
|
"issues" : "https://github.com/torrentpier/torrentpier/issues",
|
||||||
"forum": "https://torrentpier.me/",
|
"forum": "https://torrentpier.me/forum/",
|
||||||
"get": "http://get.torrentpier.me/",
|
"get": "https://get.torrentpier.me/",
|
||||||
"docs": "http://faq.torrentpier.me/"
|
"docs": "https://faq.torrentpier.me/"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^5.5 || ^7.0",
|
"php": "^5.5 || ^7.0",
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-mbstring": "*",
|
|
||||||
"google/recaptcha": "^1.0",
|
"google/recaptcha": "^1.0",
|
||||||
"monolog/monolog": "^1.18",
|
"monolog/monolog": "^1.18",
|
||||||
"pimple/pimple": "^3.0",
|
"pimple/pimple": "^3.0",
|
||||||
|
|
46
group.php
46
group.php
|
@ -6,6 +6,9 @@ require(BB_ROOT .'common.php');
|
||||||
require(INC_DIR .'bbcode.php');
|
require(INC_DIR .'bbcode.php');
|
||||||
require(INC_DIR .'functions_group.php');
|
require(INC_DIR .'functions_group.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$page_cfg['use_tablesorter'] = true;
|
$page_cfg['use_tablesorter'] = true;
|
||||||
|
|
||||||
$s_member_groups = $s_pending_groups = $s_member_groups_opt = $s_pending_groups_opt = '';
|
$s_member_groups = $s_pending_groups = $s_member_groups_opt = $s_pending_groups_opt = '';
|
||||||
|
@ -13,25 +16,28 @@ $select_sort_mode = $select_sort_order = '';
|
||||||
|
|
||||||
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$pm, &$email, &$www, &$user_time, &$avatar)
|
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$pm, &$email, &$www, &$user_time, &$avatar)
|
||||||
{
|
{
|
||||||
global $lang, $images, $bb_cfg;
|
global $lang, $images;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$from = (!empty($row['user_from'])) ? $row['user_from'] : '';
|
$from = (!empty($row['user_from'])) ? $row['user_from'] : '';
|
||||||
$joined = bb_date($row['user_regdate']);
|
$joined = bb_date($row['user_regdate']);
|
||||||
$user_time = (!empty($row['user_time'])) ? bb_date($row['user_time']) : $lang['NONE'];
|
$user_time = (!empty($row['user_time'])) ? bb_date($row['user_time']) : $lang['NONE'];
|
||||||
$posts = ($row['user_posts']) ? $row['user_posts'] : 0;
|
$posts = ($row['user_posts']) ? $row['user_posts'] : 0;
|
||||||
$pm = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="'. (PM_URL . "?mode=post&". POST_USERS_URL ."=".$row['user_id']) .'">'. $lang['SEND_PM_TXTB'] .'</a>' : '<a href="' . (PM_URL . "?mode=post&". POST_USERS_URL ."=".$row['user_id']) .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
$pm = ($di->config->get('text_buttons')) ? '<a class="txtb" href="'. (PM_URL . "?mode=post&". POST_USERS_URL ."=".$row['user_id']) .'">'. $lang['SEND_PM_TXTB'] .'</a>' : '<a href="' . (PM_URL . "?mode=post&". POST_USERS_URL ."=".$row['user_id']) .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
||||||
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
|
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
|
||||||
|
|
||||||
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod)
|
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod)
|
||||||
{
|
{
|
||||||
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&". POST_USERS_URL ."=".$row['user_id']) : 'mailto:'. $row['user_email'];
|
$email_uri = ($di->config->get('board_email_form')) ? ("profile.php?mode=email&". POST_USERS_URL ."=".$row['user_id']) : 'mailto:'. $row['user_email'];
|
||||||
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
|
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
|
||||||
}
|
}
|
||||||
else $email = '';
|
else $email = '';
|
||||||
|
|
||||||
if ($row['user_website'])
|
if ($row['user_website'])
|
||||||
{
|
{
|
||||||
$www = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww">'. $lang['VISIT_WEBSITE_TXTB'] .'</a>' : '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
$www = ($di->config->get('text_buttons')) ? '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww">'. $lang['VISIT_WEBSITE_TXTB'] .'</a>' : '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
||||||
}
|
}
|
||||||
else $www = '';
|
else $www = '';
|
||||||
|
|
||||||
|
@ -44,7 +50,7 @@ set_die_append_msg();
|
||||||
|
|
||||||
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? intval($_REQUEST[POST_GROUPS_URL]) : null;
|
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? intval($_REQUEST[POST_GROUPS_URL]) : null;
|
||||||
$start = isset($_REQUEST['start']) ? abs(intval($_REQUEST['start'])) : 0;
|
$start = isset($_REQUEST['start']) ? abs(intval($_REQUEST['start'])) : 0;
|
||||||
$per_page = $bb_cfg['group_members_per_page'];
|
$per_page = $di->config->get('group_members_per_page');
|
||||||
$view_mode = isset($_REQUEST['view']) ? (string) $_REQUEST['view'] : null;
|
$view_mode = isset($_REQUEST['view']) ? (string) $_REQUEST['view'] : null;
|
||||||
$rel_limit = 50;
|
$rel_limit = 50;
|
||||||
|
|
||||||
|
@ -217,19 +223,19 @@ else if (isset($_POST['joingroup']) && $_POST['joingroup'])
|
||||||
|
|
||||||
add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
|
add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
|
||||||
|
|
||||||
if ($bb_cfg['group_send_email'])
|
if ($di->config->get('group_send_email'))
|
||||||
{
|
{
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($moderator['username'] ." <{$moderator['user_email']}>");
|
$emailer->email_address($moderator['username'] ." <{$moderator['user_email']}>");
|
||||||
|
|
||||||
$emailer->use_template('group_request', $moderator['user_lang']);
|
$emailer->use_template('group_request', $moderator['user_lang']);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'USER' => $userdata['username'],
|
'USER' => $userdata['username'],
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'GROUP_MODERATOR' => $moderator['username'],
|
'GROUP_MODERATOR' => $moderator['username'],
|
||||||
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
||||||
));
|
));
|
||||||
|
@ -269,18 +275,18 @@ else
|
||||||
|
|
||||||
add_user_into_group($group_id, $row['user_id']);
|
add_user_into_group($group_id, $row['user_id']);
|
||||||
|
|
||||||
if ($bb_cfg['group_send_email'])
|
if ($di->config->get('group_send_email'))
|
||||||
{
|
{
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
||||||
|
|
||||||
$emailer->use_template('group_added', $row['user_lang']);
|
$emailer->use_template('group_added', $row['user_lang']);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'GROUP_NAME' => $group_info['group_name'],
|
'GROUP_NAME' => $group_info['group_name'],
|
||||||
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
||||||
));
|
));
|
||||||
|
@ -330,7 +336,7 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Email users when they are approved
|
// Email users when they are approved
|
||||||
if (!empty($_POST['approve']) && $bb_cfg['group_send_email'])
|
if (!empty($_POST['approve']) && $di->config->get('group_send_email'))
|
||||||
{
|
{
|
||||||
$sql_select = "SELECT username, user_email, user_lang
|
$sql_select = "SELECT username, user_email, user_lang
|
||||||
FROM ". BB_USERS ."
|
FROM ". BB_USERS ."
|
||||||
|
@ -342,9 +348,9 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
|
|
||||||
foreach (DB()->fetch_rowset($sql_select) as $row)
|
foreach (DB()->fetch_rowset($sql_select) as $row)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +359,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'GROUP_NAME' => $group_info['group_name'],
|
'GROUP_NAME' => $group_info['group_name'],
|
||||||
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
'U_GROUP' => make_url(GROUP_URL . $group_id),
|
||||||
));
|
));
|
||||||
|
@ -438,7 +444,7 @@ else
|
||||||
$username = $group_moderator['username'];
|
$username = $group_moderator['username'];
|
||||||
$user_id = $group_moderator['user_id'];
|
$user_id = $group_moderator['user_id'];
|
||||||
|
|
||||||
generate_user_info($group_moderator, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
generate_user_info($group_moderator, $di->config->get('default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
||||||
|
|
||||||
$group_type = '';
|
$group_type = '';
|
||||||
if ($group_info['group_type'] == GROUP_OPEN)
|
if ($group_info['group_type'] == GROUP_OPEN)
|
||||||
|
@ -597,7 +603,7 @@ else
|
||||||
{
|
{
|
||||||
$user_id = $member['user_id'];
|
$user_id = $member['user_id'];
|
||||||
|
|
||||||
generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
generate_user_info($member, $di->config->get('default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
||||||
|
|
||||||
if ($group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator)
|
if ($group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator)
|
||||||
{
|
{
|
||||||
|
@ -658,7 +664,7 @@ else
|
||||||
{
|
{
|
||||||
$user_id = $member['user_id'];
|
$user_id = $member['user_id'];
|
||||||
|
|
||||||
generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
generate_user_info($member, $di->config->get('default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
|
||||||
|
|
||||||
$row_class = !($i % 2) ? 'row1' : 'row2';
|
$row_class = !($i % 2) ? 'row1' : 'row2';
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@ define('BB_ROOT', './');
|
||||||
require(BB_ROOT .'common.php');
|
require(BB_ROOT .'common.php');
|
||||||
require(INC_DIR .'functions_group.php');
|
require(INC_DIR .'functions_group.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$page_cfg['include_bbcode_js'] = true;
|
$page_cfg['include_bbcode_js'] = true;
|
||||||
|
|
||||||
// Start session management
|
// Start session management
|
||||||
|
@ -34,12 +37,12 @@ if ($is_moderator)
|
||||||
// Avatar
|
// Avatar
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed'])
|
if (!empty($_FILES['avatar']['name']) && $di->config->get('group_avatars.up_allowed'))
|
||||||
{
|
{
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) && $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id'])))
|
if ($upload->init($di->config->get('group_avatars'), $_FILES['avatar']) && $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id'])))
|
||||||
{
|
{
|
||||||
$avatar_ext_id = (int) $upload->file_ext_id;
|
$avatar_ext_id = (int) $upload->file_ext_id;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +89,7 @@ if ($is_moderator)
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
|
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
|
||||||
|
|
||||||
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], (round($bb_cfg['group_avatars']['max_size'] / 1024))),
|
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $di->config->get('group_avatars.max_width'), $di->config->get('group_avatars.max_height'), (round($di->config->get('group_avatars.max_size') / 1024))),
|
||||||
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
|
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
32
index.php
32
index.php
|
@ -23,11 +23,11 @@ $datastore->enqueue(array(
|
||||||
'stats',
|
'stats',
|
||||||
'moderators',
|
'moderators',
|
||||||
));
|
));
|
||||||
if ($bb_cfg['show_latest_news'])
|
if ($di->config->get('show_latest_news'))
|
||||||
{
|
{
|
||||||
$datastore->enqueue('latest_news');
|
$datastore->enqueue('latest_news');
|
||||||
}
|
}
|
||||||
if ($bb_cfg['show_network_news'])
|
if ($di->config->get('show_network_news'))
|
||||||
{
|
{
|
||||||
$datastore->enqueue('network_news');
|
$datastore->enqueue('network_news');
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ foreach ($cat_forums as $cid => $c)
|
||||||
'LAST_TOPIC_ID' => $f['last_topic_id'],
|
'LAST_TOPIC_ID' => $f['last_topic_id'],
|
||||||
'LAST_TOPIC_TIP' => $f['last_topic_title'],
|
'LAST_TOPIC_TIP' => $f['last_topic_title'],
|
||||||
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),
|
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),
|
||||||
'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
|
'LAST_POST_TIME' => bb_date($f['last_post_time'], $di->config->get('last_post_date_format')),
|
||||||
'LAST_POST_USER' => profile_url(array('username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank'])),
|
'LAST_POST_USER' => profile_url(array('username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank'])),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -285,14 +285,14 @@ $template->assign_vars(array(
|
||||||
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
|
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
|
||||||
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
|
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
|
||||||
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
|
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
|
||||||
'TOTAL_GENDER' => ($bb_cfg['gender']) ? sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']) : '',
|
'TOTAL_GENDER' => ($di->config->get('gender')) ? sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']) : '',
|
||||||
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
|
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
|
||||||
|
|
||||||
// Tracker stats
|
// Tracker stats
|
||||||
'TORRENTS_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['TORRENTS_STAT'], $stats['torrentcount'], humn_size($stats['size'])) : '',
|
'TORRENTS_STAT' => ($di->config->get('tor_stats')) ? sprintf($lang['TORRENTS_STAT'], $stats['torrentcount'], humn_size($stats['size'])) : '',
|
||||||
'PEERS_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['PEERS_STAT'], $stats['peers'], $stats['seeders'], $stats['leechers']) : '',
|
'PEERS_STAT' => ($di->config->get('tor_stats')) ? sprintf($lang['PEERS_STAT'], $stats['peers'], $stats['seeders'], $stats['leechers']) : '',
|
||||||
'SPEED_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['SPEED_STAT'], humn_size($stats['speed']) .'/s') : '',
|
'SPEED_STAT' => ($di->config->get('tor_stats')) ? sprintf($lang['SPEED_STAT'], humn_size($stats['speed']) .'/s') : '',
|
||||||
'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'],
|
'SHOW_MOD_INDEX' => $di->config->get('show_mod_index'),
|
||||||
'FORUM_IMG' => $images['forum'],
|
'FORUM_IMG' => $images['forum'],
|
||||||
'FORUM_NEW_IMG' => $images['forum_new'],
|
'FORUM_NEW_IMG' => $images['forum_new'],
|
||||||
'FORUM_LOCKED_IMG' => $images['forum_locked'],
|
'FORUM_LOCKED_IMG' => $images['forum_locked'],
|
||||||
|
@ -310,13 +310,13 @@ $template->assign_vars(array(
|
||||||
));
|
));
|
||||||
|
|
||||||
// Set tpl vars for bt_userdata
|
// Set tpl vars for bt_userdata
|
||||||
if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST)
|
if ($di->config->get('bt_show_dl_stat_on_index') && !IS_GUEST)
|
||||||
{
|
{
|
||||||
show_bt_userdata($userdata['user_id']);
|
show_bt_userdata($userdata['user_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Latest news
|
// Latest news
|
||||||
if ($bb_cfg['show_latest_news'])
|
if ($di->config->get('show_latest_news'))
|
||||||
{
|
{
|
||||||
if (!$latest_news = $datastore->get('latest_news'))
|
if (!$latest_news = $datastore->get('latest_news'))
|
||||||
{
|
{
|
||||||
|
@ -332,7 +332,7 @@ if ($bb_cfg['show_latest_news'])
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('news', array(
|
$template->assign_block_vars('news', array(
|
||||||
'NEWS_TOPIC_ID' => $news['topic_id'],
|
'NEWS_TOPIC_ID' => $news['topic_id'],
|
||||||
'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']),
|
'NEWS_TITLE' => str_short($news['topic_title'], $di->config->get('max_news_title')),
|
||||||
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
|
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
|
||||||
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
|
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
|
||||||
));
|
));
|
||||||
|
@ -340,7 +340,7 @@ if ($bb_cfg['show_latest_news'])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network news
|
// Network news
|
||||||
if ($bb_cfg['show_network_news'])
|
if ($di->config->get('show_network_news'))
|
||||||
{
|
{
|
||||||
if (!$network_news = $datastore->get('network_news'))
|
if (!$network_news = $datastore->get('network_news'))
|
||||||
{
|
{
|
||||||
|
@ -356,14 +356,14 @@ if ($bb_cfg['show_network_news'])
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('net', array(
|
$template->assign_block_vars('net', array(
|
||||||
'NEWS_TOPIC_ID' => $net['topic_id'],
|
'NEWS_TOPIC_ID' => $net['topic_id'],
|
||||||
'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']),
|
'NEWS_TITLE' => str_short($net['topic_title'], $di->config->get('max_net_title')),
|
||||||
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
|
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
|
||||||
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
|
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
if ($di->config->get('birthday_check_day') && $di->config->get('birthday_enabled'))
|
||||||
{
|
{
|
||||||
$week_list = $today_list = array();
|
$week_list = $today_list = array();
|
||||||
$week_all = $today_all = false;
|
$week_all = $today_all = false;
|
||||||
|
@ -381,9 +381,9 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
||||||
$week_list[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']-1) .')</span>';
|
$week_list[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']-1) .')</span>';
|
||||||
}
|
}
|
||||||
$week_all = ($week_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
|
$week_all = ($week_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
|
||||||
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $week_list)) . $week_all;
|
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $di->config->get('birthday_check_day'), join(', ', $week_list)) . $week_all;
|
||||||
}
|
}
|
||||||
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $di->config->get('birthday_check_day'));
|
||||||
|
|
||||||
if ($stats['birthday_today_list'])
|
if ($stats['birthday_today_list'])
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
require(INC_DIR . 'functions_upload.php');
|
require(INC_DIR . 'functions_upload.php');
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: @deprecated
|
||||||
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT . 'common.php');
|
require(BB_ROOT . 'common.php');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang, $user;
|
global $lang, $user;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
$user_id = (int) $this->request['user_id'];
|
$user_id = (int) $this->request['user_id'];
|
||||||
|
@ -22,7 +25,7 @@ switch ($mode)
|
||||||
case 'delete':
|
case 'delete':
|
||||||
delete_avatar($user_id, $u_data['avatar_ext_id']);
|
delete_avatar($user_id, $u_data['avatar_ext_id']);
|
||||||
$new_ext_id = 0;
|
$new_ext_id = 0;
|
||||||
$response = '<img src="'. $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] .'" alt="'. $user_id .'" />';
|
$response = '<img src="'. $di->config->get('avatars.upload_path') . $di->config->get('avatars.no_avatar') .'" alt="'. $user_id .'" />';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->ajax_die('Invalid mode');
|
$this->ajax_die('Invalid mode');
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang;
|
global $userdata, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!isset($this->request['topic_id'])) $this->ajax_die('Invalid topic_id');
|
if (!isset($this->request['topic_id'])) $this->ajax_die('Invalid topic_id');
|
||||||
|
|
||||||
$topic_id = (int) $this->request['topic_id'];
|
$topic_id = (int) $this->request['topic_id'];
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
|
|
||||||
if ($bb_cfg['tor_comment'])
|
if ($di->config->get('tor_comment'))
|
||||||
{
|
{
|
||||||
$comment = (string) $this->request['comment'];
|
$comment = (string) $this->request['comment'];
|
||||||
}
|
}
|
||||||
|
@ -73,14 +76,14 @@ switch ($mode)
|
||||||
|
|
||||||
change_tor_status($topic_id, $new_status);
|
change_tor_status($topic_id, $new_status);
|
||||||
|
|
||||||
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> · '. profile_url($userdata) .' · <i>'. delta_time(TIMENOW) . $lang['TOR_BACK']. '</i>';
|
$this->response['status'] = $di->config->get('tor_icons.' . $new_status) .' <b> '. $lang['TOR_STATUS_NAME'][$new_status]. '</b> · '. profile_url($userdata) .' · <i>'. delta_time(TIMENOW) . $lang['TOR_BACK']. '</i>';
|
||||||
|
|
||||||
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply'])))
|
if ($di->config->get('tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $di->config->get('tor_reply'))))
|
||||||
{
|
{
|
||||||
if ($tor['poster_id'] > 0)
|
if ($tor['poster_id'] > 0)
|
||||||
{
|
{
|
||||||
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
|
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
|
||||||
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $topic_id), $bb_cfg['tor_icons'][$new_status] .' '.$lang['TOR_STATUS_NAME'][$new_status]);
|
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $topic_id), $di->config->get('tor_icons.' . $new_status) .' '.$lang['TOR_STATUS_NAME'][$new_status]);
|
||||||
|
|
||||||
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
|
if ($comment && $comment != $lang['COMMENT']) $message .= "\n\n[b]". $lang['COMMENT'] .'[/b]: '. $comment;
|
||||||
|
|
||||||
|
@ -91,7 +94,7 @@ switch ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'status_reply':
|
case 'status_reply':
|
||||||
if (!$bb_cfg['tor_comment']) $this->ajax_die($lang['MODULE_OFF']);
|
if (!$di->config->get('tor_comment')) $this->ajax_die($lang['MODULE_OFF']);
|
||||||
|
|
||||||
$subject = sprintf($lang['TOR_AUTH_TITLE'], $tor['topic_title']);
|
$subject = sprintf($lang['TOR_AUTH_TITLE'], $tor['topic_title']);
|
||||||
$message = sprintf($lang['TOR_AUTH_MSG'], get_username($tor['checked_user_id']), make_url(TOPIC_URL . $topic_id), $tor['topic_title']);
|
$message = sprintf($lang['TOR_AUTH_MSG'], get_username($tor['checked_user_id']), make_url(TOPIC_URL . $topic_id), $tor['topic_title']);
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $userdata, $lang;
|
global $userdata, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!($group_id = intval($this->request['group_id'])) || !($group_info = get_group_data($group_id)))
|
if (!($group_id = intval($this->request['group_id'])) || !($group_info = get_group_data($group_id)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!($user_id = intval($this->request['user_id'])) || !($profiledata = get_userdata($user_id)))
|
if (!($user_id = intval($this->request['user_id'])) || !($profiledata = get_userdata($user_id)))
|
||||||
{
|
{
|
||||||
|
@ -47,7 +50,7 @@ switch ($field)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user_gender':
|
case 'user_gender':
|
||||||
if (!$bb_cfg['gender']) $this->ajax_die($lang['MODULE_OFF']);
|
if (!$di->config->get('gender')) $this->ajax_die($lang['MODULE_OFF']);
|
||||||
if (!isset($lang['GENDER_SELECT'][$value]))
|
if (!isset($lang['GENDER_SELECT'][$value]))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['ERROR']);
|
$this->ajax_die($lang['ERROR']);
|
||||||
|
@ -56,7 +59,7 @@ switch ($field)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user_birthday':
|
case 'user_birthday':
|
||||||
if (!$bb_cfg['birthday_enabled']) $this->ajax_die($lang['MODULE_OFF']);
|
if (!$di->config->get('birthday_enabled')) $this->ajax_die($lang['MODULE_OFF']);
|
||||||
$birthday_date = date_parse($value);
|
$birthday_date = date_parse($value);
|
||||||
|
|
||||||
if (!empty($birthday_date['year']))
|
if (!empty($birthday_date['year']))
|
||||||
|
@ -65,13 +68,13 @@ switch ($field)
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
|
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
|
||||||
}
|
}
|
||||||
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age'])
|
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $di->config->get('birthday_max_age'))
|
||||||
{
|
{
|
||||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
|
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $di->config->get('birthday_max_age')));
|
||||||
}
|
}
|
||||||
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age'])
|
elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $di->config->get('birthday_min_age'))
|
||||||
{
|
{
|
||||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
|
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $di->config->get('birthday_min_age')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +114,8 @@ switch ($field)
|
||||||
|
|
||||||
case 'user_regdate':
|
case 'user_regdate':
|
||||||
case 'user_lastvisit':
|
case 'user_lastvisit':
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * $di->config->get('board_timezone'));
|
||||||
if ((($value = strtotime($value, $tz)) < $bb_cfg['board_startdate']) || ($value > TIMENOW))
|
if ((($value = strtotime($value, $tz)) < $di->config->get('board_startdate')) || ($value > TIMENOW))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang, $userdata, $datastore;
|
global $lang, $userdata, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
$html = '';
|
$html = '';
|
||||||
|
@ -21,9 +24,9 @@ switch($mode)
|
||||||
{
|
{
|
||||||
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']) .')</span>';
|
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['user_birthday']) .')</span>';
|
||||||
}
|
}
|
||||||
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], join(', ', $html));
|
$html = sprintf($lang['BIRTHDAY_WEEK'], $di->config->get('birthday_check_day'), join(', ', $html));
|
||||||
}
|
}
|
||||||
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $di->config->get('birthday_check_day'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'birthday_today':
|
case 'birthday_today':
|
||||||
|
@ -79,13 +82,8 @@ switch($mode)
|
||||||
$tz = (int) $this->request['tz'];
|
$tz = (int) $this->request['tz'];
|
||||||
if ($tz < -12) $tz = -12;
|
if ($tz < -12) $tz = -12;
|
||||||
if ($tz > 13) $tz = 13;
|
if ($tz > 13) $tz = 13;
|
||||||
if ($tz != $bb_cfg['board_timezone'])
|
DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id'] . " LIMIT 1");
|
||||||
{
|
cache_rm_user_sessions($userdata['user_id']);
|
||||||
// Set current user timezone
|
|
||||||
DB()->query("UPDATE ". BB_USERS ." SET user_timezone = $tz WHERE user_id = ". $userdata['user_id'] ." LIMIT 1");
|
|
||||||
$bb_cfg['board_timezone'] = $tz;
|
|
||||||
cache_rm_user_sessions ($userdata['user_id']);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'get_traf_stats':
|
case 'get_traf_stats':
|
||||||
|
@ -104,7 +102,7 @@ switch($mode)
|
||||||
<th>'. $lang['UPLOADED'] .'</th>
|
<th>'. $lang['UPLOADED'] .'</th>
|
||||||
<th>'. $lang['RELEASED'] .'</th>
|
<th>'. $lang['RELEASED'] .'</th>
|
||||||
<th>'. $lang['BONUS'] .'</th>';
|
<th>'. $lang['BONUS'] .'</th>';
|
||||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>'. $lang['SEED_BONUS'] .'</th>' : '';
|
$html .= ($di->config->get('seed_bonus_enabled')) ? '<th>'. $lang['SEED_BONUS'] .'</th>' : '';
|
||||||
$html .= '</tr>
|
$html .= '</tr>
|
||||||
<tr class="row1">
|
<tr class="row1">
|
||||||
<td>'. $lang['TOTAL_TRAF'] .'</td>
|
<td>'. $lang['TOTAL_TRAF'] .'</td>
|
||||||
|
@ -112,17 +110,17 @@ switch($mode)
|
||||||
<td id="u_up_total"><span class="editable bold seedmed">' .humn_size($btu['u_up_total']) .'</span></td>
|
<td id="u_up_total"><span class="editable bold seedmed">' .humn_size($btu['u_up_total']) .'</span></td>
|
||||||
<td id="u_up_release"><span class="editable bold seedmed">'. humn_size($btu['u_up_release']) .'</span></td>
|
<td id="u_up_release"><span class="editable bold seedmed">'. humn_size($btu['u_up_release']) .'</span></td>
|
||||||
<td id="u_up_bonus"><span class="editable bold seedmed">'. humn_size($btu['u_up_bonus']) .'</span></td>';
|
<td id="u_up_bonus"><span class="editable bold seedmed">'. humn_size($btu['u_up_bonus']) .'</span></td>';
|
||||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">'. $profiledata['user_points'] .'</b></td>' : '';
|
$html .= ($di->config->get('seed_bonus_enabled')) ? '<td id="user_points"><span class="editable bold points">'. $profiledata['user_points'] .'</b></td>' : '';
|
||||||
$html .= '</tr>
|
$html .= '</tr>
|
||||||
<tr class="row5">
|
<tr class="row5">
|
||||||
<td colspan="1">'. $lang['SPEED'] .'</td>
|
<td colspan="1">'. $lang['SPEED'] .'</td>
|
||||||
<td colspan="2">'. $lang['DL_DL_SPEED'] .': '. $speed_down .'</span></td>
|
<td colspan="2">'. $lang['DL_DL_SPEED'] .': '. $speed_down .'</span></td>
|
||||||
<td colspan="2">'. $lang['DL_UL_SPEED'] .': '. $speed_up .'</span></td>';
|
<td colspan="2">'. $lang['DL_UL_SPEED'] .': '. $speed_up .'</span></td>';
|
||||||
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
|
$html .= ($di->config->get('seed_bonus_enabled')) ? '<td colspan="1"></td>' : '';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
|
|
||||||
$this->response['user_ratio'] = '
|
$this->response['user_ratio'] = '
|
||||||
<th><a href="'. $bb_cfg['ratio_url_help'] .'" class="bold">'. $lang['USER_RATIO'] .'</a>:</th>
|
<th><a href="'. $di->config->get('ratio_url_help') .'" class="bold">'. $lang['USER_RATIO'] .'</a>:</th>
|
||||||
<td>'. $user_ratio .'</td>
|
<td>'. $user_ratio .'</td>
|
||||||
';
|
';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $userdata, $lang, $bb_cfg;
|
global $userdata, $lang;
|
||||||
|
|
||||||
/** @var \TorrentPier\Di $di */
|
/** @var \TorrentPier\Di $di */
|
||||||
$di = \TorrentPier\Di::getInstance();
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
@ -55,22 +55,22 @@ switch ($mode)
|
||||||
|
|
||||||
case 'indexer':
|
case 'indexer':
|
||||||
|
|
||||||
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
|
exec("indexer --config {$di->config->get('sphinx_config_path')} --all --rotate", $result);
|
||||||
|
|
||||||
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
|
if (!is_file($di->config->get('sphinx_config_path').".log"))
|
||||||
{
|
{
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
file_put_contents($di->config->get('sphinx_config_path').".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
|
file_put_contents($di->config->get('sphinx_config_path').".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
|
||||||
|
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", $row."\r\n", FILE_APPEND);
|
file_put_contents($di->config->get('sphinx_config_path').".log", $row."\r\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
|
file_put_contents($di->config->get('sphinx_config_path').".log", "\r\n", FILE_APPEND);
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "\r\n", FILE_APPEND);
|
file_put_contents($di->config->get('sphinx_config_path').".log", "\r\n", FILE_APPEND);
|
||||||
|
|
||||||
$this->response['indexer_html'] = '<span class="seed bold">'. $lang['INDEXER'] .'</span>';
|
$this->response['indexer_html'] = '<span class="seed bold">'. $lang['INDEXER'] .'</span>';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $userdata, $lang, $bb_cfg;
|
global $userdata, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
$user_id = $this->request['user_id'];
|
$user_id = $this->request['user_id'];
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang, $datastore;
|
global $userdata, $lang, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
|
|
||||||
|
@ -25,7 +28,7 @@ switch ($mode)
|
||||||
change_tor_status($topic_id, $status);
|
change_tor_status($topic_id, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response['status'] = $bb_cfg['tor_icons'][$status];
|
$this->response['status'] = $di->config->get('tor_icons.' . $status);
|
||||||
$this->response['topics'] = $topic_ids;
|
$this->response['topics'] = $topic_ids;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -48,15 +51,15 @@ switch ($mode)
|
||||||
DB()->query("UPDATE ". BB_TOPICS ." SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
|
DB()->query("UPDATE ". BB_TOPICS ." SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
|
||||||
|
|
||||||
// Обновление кеша новостей на главной
|
// Обновление кеша новостей на главной
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', $di->config->get('latest_news_forum_id')));
|
||||||
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news'])
|
if (isset($news_forums[$t_data['forum_id']]) && $di->config->get('show_latest_news'))
|
||||||
{
|
{
|
||||||
$datastore->enqueue('latest_news');
|
$datastore->enqueue('latest_news');
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
}
|
}
|
||||||
|
|
||||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
$net_forums = array_flip(explode(',', $di->config->get('network_news_forum_id')));
|
||||||
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news'])
|
if (isset($net_forums[$t_data['forum_id']]) && $di->config->get('show_network_news'))
|
||||||
{
|
{
|
||||||
$datastore->enqueue('network_news');
|
$datastore->enqueue('network_news');
|
||||||
$datastore->update('network_news');
|
$datastore->update('network_news');
|
||||||
|
@ -109,8 +112,8 @@ switch ($mode)
|
||||||
{
|
{
|
||||||
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
|
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
|
||||||
$user_last_ip = decode_ip($profiledata['user_last_ip']);
|
$user_last_ip = decode_ip($profiledata['user_last_ip']);
|
||||||
$reg_ip = '<a href="'. $bb_cfg['whois_info'] . $user_reg_ip .'" class="gen" target="_blank">'. $user_reg_ip .'</a>';
|
$reg_ip = '<a href="'. $di->config->get('whois_info') . $user_reg_ip .'" class="gen" target="_blank">'. $user_reg_ip .'</a>';
|
||||||
$last_ip = '<a href="'. $bb_cfg['whois_info'] . $user_last_ip .'" class="gen" target="_blank">'. $user_last_ip .'</a>';
|
$last_ip = '<a href="'. $di->config->get('whois_info') . $user_last_ip .'" class="gen" target="_blank">'. $user_last_ip .'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response['ip_list_html'] = '
|
$this->response['ip_list_html'] = '
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $lang, $bb_cfg, $userdata;
|
global $lang, $userdata;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!isset($this->request['type']))
|
if (!isset($this->request['type']))
|
||||||
{
|
{
|
||||||
|
@ -138,12 +141,12 @@ switch($this->request['type'])
|
||||||
{
|
{
|
||||||
if ($text != $post['post_text'])
|
if ($text != $post['post_text'])
|
||||||
{
|
{
|
||||||
if ($bb_cfg['max_smilies'])
|
if ($di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="'. $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="'. $di->config->get('smilies_path'));
|
||||||
if ($count_smilies > $bb_cfg['max_smilies'])
|
if ($count_smilies > $di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $di->config->get('max_smilies')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1");
|
DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1");
|
||||||
|
@ -257,7 +260,7 @@ switch($this->request['type'])
|
||||||
{
|
{
|
||||||
if ($userdata['user_level'] == USER)
|
if ($userdata['user_level'] == USER)
|
||||||
{
|
{
|
||||||
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval'])
|
if (TIMENOW - $row['last_post_time'] < $di->config->get('flood_interval'))
|
||||||
{
|
{
|
||||||
$this->ajax_die($lang['FLOOD_ERROR']);
|
$this->ajax_die($lang['FLOOD_ERROR']);
|
||||||
}
|
}
|
||||||
|
@ -287,12 +290,12 @@ switch($this->request['type'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['max_smilies'])
|
if ($di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $di->config->get('smilies_path'));
|
||||||
if ($count_smilies > $bb_cfg['max_smilies'])
|
if ($count_smilies > $di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $di->config->get('max_smilies')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +313,7 @@ switch($this->request['type'])
|
||||||
'post_text' => $message,
|
'post_text' => $message,
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($bb_cfg['topic_notify_enabled'])
|
if ($di->config->get('topic_notify_enabled'))
|
||||||
{
|
{
|
||||||
$notify = !empty($this->request['notify']);
|
$notify = !empty($this->request['notify']);
|
||||||
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
$map = new sitemap();
|
$map = new sitemap();
|
||||||
|
@ -14,7 +17,7 @@ switch ($mode)
|
||||||
$map->create();
|
$map->create();
|
||||||
if (file_exists(SITEMAP_DIR. 'sitemap.xml'))
|
if (file_exists(SITEMAP_DIR. 'sitemap.xml'))
|
||||||
{
|
{
|
||||||
$html .= $lang['SITEMAP_CREATED'].': <b>'.bb_date(TIMENOW, $bb_cfg['post_date_format']).'</b> '.$lang['SITEMAP_AVAILABLE'].': <a href="'.make_url('sitemap.xml').'" target="_blank">'.make_url('sitemap.xml').'</a>';
|
$html .= $lang['SITEMAP_CREATED'].': <b>'.bb_date(TIMENOW, $di->config->get('post_date_format')).'</b> '.$lang['SITEMAP_AVAILABLE'].': <a href="'.make_url('sitemap.xml').'" target="_blank">'.make_url('sitemap.xml').'</a>';
|
||||||
} else {
|
} else {
|
||||||
$html .= $lang['SITEMAP_NOT_CREATED'];
|
$html .= $lang['SITEMAP_NOT_CREATED'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
if (!defined('IN_AJAX')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $lang, $userdata;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$mode = (string) $this->request['mode'];
|
$mode = (string) $this->request['mode'];
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,14 @@ class torrent
|
||||||
|
|
||||||
function build_file_item ($name, $length)
|
function build_file_item ($name, $length)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $images, $lang;
|
global $images, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$magnet_name = $magnet_ext = '';
|
$magnet_name = $magnet_ext = '';
|
||||||
|
|
||||||
if ($bb_cfg['magnet_links_enabled'])
|
if ($di->config->get('magnet_links_enabled'))
|
||||||
{
|
{
|
||||||
$magnet_name = '<a title="'.$lang['DC_MAGNET'].'" href="dchub:magnet:?kt='.$name.'&xl='.$length.'"><img src="'. $images['icon_dc_magnet'] .'" width="10" height="10" border="0" /></a>';
|
$magnet_name = '<a title="'.$lang['DC_MAGNET'].'" href="dchub:magnet:?kt='.$name.'&xl='.$length.'"><img src="'. $images['icon_dc_magnet'] .'" width="10" height="10" border="0" /></a>';
|
||||||
$magnet_ext = '<a title="'.$lang['DC_MAGNET_EXT'].'" href="dchub:magnet:?kt=.'.substr(strrchr($name, '.'), 1).'&xl='.$length.'"><img src="'. $images['icon_dc_magnet_ext'] .'" width="10" height="10" border="0" /></a>';
|
$magnet_ext = '<a title="'.$lang['DC_MAGNET_EXT'].'" href="dchub:magnet:?kt=.'.substr(strrchr($name, '.'), 1).'&xl='.$length.'"><img src="'. $images['icon_dc_magnet_ext'] .'" width="10" height="10" border="0" /></a>';
|
||||||
|
|
|
@ -110,7 +110,6 @@ $config = [
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'pconnect' => true,
|
|
||||||
'db_dir' => realpath(BB_ROOT) .'/internal_data/cache/filecache/',
|
'db_dir' => realpath(BB_ROOT) .'/internal_data/cache/filecache/',
|
||||||
'prefix' => 'tp_', // Префикс кеша ('tp_')
|
'prefix' => 'tp_', // Префикс кеша ('tp_')
|
||||||
'memcache' => [
|
'memcache' => [
|
||||||
|
@ -123,16 +122,6 @@ $config = [
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 6379,
|
'port' => 6379,
|
||||||
'con_required' => true,
|
'con_required' => true,
|
||||||
],
|
|
||||||
'engines' => [
|
|
||||||
// Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache)
|
|
||||||
# name => array( (string) type, (array) cfg )
|
|
||||||
'bb_cache' => ['filecache', []],
|
|
||||||
'bb_config' => ['filecache', []],
|
|
||||||
'tr_cache' => ['filecache', []],
|
|
||||||
'session_cache' => ['filecache', []],
|
|
||||||
'bb_login_err' => ['filecache', []],
|
|
||||||
'bb_poll_data' => ['filecache', []],
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -205,7 +194,6 @@ $config = [
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
'charset' => 'utf8', // page charset
|
'charset' => 'utf8', // page charset
|
||||||
'auto_language' => true, // select user-preferred language automatically
|
|
||||||
'lang' => [
|
'lang' => [
|
||||||
'ru' => [
|
'ru' => [
|
||||||
'name' => 'Русский',
|
'name' => 'Русский',
|
||||||
|
@ -361,9 +349,9 @@ $config = [
|
||||||
// PM
|
// PM
|
||||||
'privmsg_disable' => false, // отключить систему личных сообщений на форуме
|
'privmsg_disable' => false, // отключить систему личных сообщений на форуме
|
||||||
'max_outgoing_pm_cnt' => 10, // ограничение на кол. одновременных исходящих лс (для замедления рассылки спама)
|
'max_outgoing_pm_cnt' => 10, // ограничение на кол. одновременных исходящих лс (для замедления рассылки спама)
|
||||||
'max_inbox_privmsgs' => 200, // максимальное число сообщений в папке входящие
|
'max_inbox_privmsgs' => 500, // максимальное число сообщений в папке входящие (удалить)
|
||||||
'max_savebox_privmsgs' => 25, // максимальное число сообщений в папке сохраненные
|
'max_savebox_privmsgs' => 500, // максимальное число сообщений в папке сохраненные (удалить)
|
||||||
'max_sentbox_privmsgs' => 50, // максимальное число сообщений в папке отправленные
|
'max_sentbox_privmsgs' => 500, // максимальное число сообщений в папке отправленные (удалить)
|
||||||
'pm_days_keep' => 180, // время хранения ЛС
|
'pm_days_keep' => 180, // время хранения ЛС
|
||||||
|
|
||||||
// Actions log
|
// Actions log
|
||||||
|
@ -523,33 +511,72 @@ $config = [
|
||||||
'0.4' => 1,
|
'0.4' => 1,
|
||||||
'0.5' => 2,
|
'0.5' => 2,
|
||||||
'0.6' => 3,
|
'0.6' => 3,
|
||||||
]
|
],
|
||||||
|
|
||||||
|
// Иконки статусов раздач
|
||||||
|
'tor_icons' => [
|
||||||
|
TOR_NOT_APPROVED => '<span class="tor-icon tor-not-approved">*</span>',
|
||||||
|
TOR_CLOSED => '<span class="tor-icon tor-closed">x</span>',
|
||||||
|
TOR_APPROVED => '<span class="tor-icon tor-approved">√</span>',
|
||||||
|
TOR_NEED_EDIT => '<span class="tor-icon tor-need-edit">?</span>',
|
||||||
|
TOR_NO_DESC => '<span class="tor-icon tor-no-desc">!</span>',
|
||||||
|
TOR_DUP => '<span class="tor-icon tor-dup">D</span>',
|
||||||
|
TOR_CLOSED_CPHOLD => '<span class="tor-icon tor-closed-cp">©</span>',
|
||||||
|
TOR_CONSUMED => '<span class="tor-icon tor-consumed">∑</span>',
|
||||||
|
TOR_DOUBTFUL => '<span class="tor-icon tor-approved">#</span>',
|
||||||
|
TOR_CHECKING => '<span class="tor-icon tor-checking">%</span>',
|
||||||
|
TOR_TMP => '<span class="tor-icon tor-dup">T</span>',
|
||||||
|
TOR_PREMOD => '<span class="tor-icon tor-dup">∏</span>',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Запрет на скачивание
|
||||||
|
'tor_frozen' => [
|
||||||
|
TOR_CHECKING => true,
|
||||||
|
TOR_CLOSED => true,
|
||||||
|
TOR_CLOSED_CPHOLD => true,
|
||||||
|
TOR_CONSUMED => true,
|
||||||
|
TOR_DUP => true,
|
||||||
|
TOR_NO_DESC => true,
|
||||||
|
TOR_PREMOD => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
// Разрешение на скачку автором, если закрыто на скачивание.
|
||||||
|
'tor_frozen_author_download' => [
|
||||||
|
TOR_CHECKING => true,
|
||||||
|
TOR_NO_DESC => true,
|
||||||
|
TOR_PREMOD => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
// Запрет на редактирование головного сообщения
|
||||||
|
'tor_cannot_edit' => [
|
||||||
|
TOR_CHECKING => true,
|
||||||
|
TOR_CLOSED => true,
|
||||||
|
TOR_CONSUMED => true,
|
||||||
|
TOR_DUP => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
// Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
|
||||||
|
'tor_cannot_new' => [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL],
|
||||||
|
|
||||||
|
// Разрешение на ответ релизера, если раздача исправлена.
|
||||||
|
'tor_reply' => [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL],
|
||||||
|
|
||||||
|
// Если такой статус у релиза, то статистика раздачи будет скрыта
|
||||||
|
'tor_no_tor_act' => [
|
||||||
|
TOR_CLOSED => true,
|
||||||
|
TOR_DUP => true,
|
||||||
|
TOR_CLOSED_CPHOLD => true,
|
||||||
|
TOR_CONSUMED => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
// Vote graphic length defines the maximum length of a vote result graphic, ie. 100% = this length
|
||||||
|
'vote_graphic_length' => 205,
|
||||||
|
'privmsg_graphic_length' => 175,
|
||||||
|
'topic_left_column_witdh' => 150,
|
||||||
|
|
||||||
|
// Images auto-resize
|
||||||
|
'post_img_width_decr' => 52,
|
||||||
|
'attach_img_width_decr' => 130,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && $config['auto_language'])
|
|
||||||
{
|
|
||||||
$user_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
|
||||||
if (file_exists(LANG_ROOT_DIR . $user_lang .'/'))
|
|
||||||
{
|
|
||||||
$config['default_lang_dir'] = LANG_ROOT_DIR . $user_lang .'/';
|
|
||||||
$config['default_lang'] = $user_lang;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$config['default_lang_dir'] = LANG_ROOT_DIR .'en/';
|
|
||||||
$config['default_lang'] = 'en';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isset($config['default_lang']) && file_exists(LANG_ROOT_DIR . $config['default_lang'] .'/'))
|
|
||||||
{
|
|
||||||
$config['default_lang_dir'] = LANG_ROOT_DIR . $config['default_lang'] .'/';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$config['default_lang_dir'] = LANG_ROOT_DIR .'en/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|
|
@ -61,4 +61,20 @@ define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
|
||||||
// Misc
|
// Misc
|
||||||
define('MEM_USAGE', function_exists('memory_get_usage'));
|
define('MEM_USAGE', function_exists('memory_get_usage'));
|
||||||
|
|
||||||
|
// Gzip
|
||||||
define('GZIP_OUTPUT_ALLOWED', (extension_loaded('zlib') && !ini_get('zlib.output_compression')));
|
define('GZIP_OUTPUT_ALLOWED', (extension_loaded('zlib') && !ini_get('zlib.output_compression')));
|
||||||
|
|
||||||
|
// TODO: temporary, move to another place
|
||||||
|
// Torrents (reserved: -1)
|
||||||
|
define('TOR_NOT_APPROVED', 0); // не проверено
|
||||||
|
define('TOR_CLOSED', 1); // закрыто
|
||||||
|
define('TOR_APPROVED', 2); // проверено
|
||||||
|
define('TOR_NEED_EDIT', 3); // недооформлено
|
||||||
|
define('TOR_NO_DESC', 4); // неоформлено
|
||||||
|
define('TOR_DUP', 5); // повтор
|
||||||
|
define('TOR_CLOSED_CPHOLD', 6); // закрыто правообладателем
|
||||||
|
define('TOR_CONSUMED', 7); // поглощено
|
||||||
|
define('TOR_DOUBTFUL', 8); // сомнительно
|
||||||
|
define('TOR_CHECKING', 9); // проверяется
|
||||||
|
define('TOR_TMP', 10); // временная
|
||||||
|
define('TOR_PREMOD', 11); // премодерация
|
|
@ -96,7 +96,10 @@ function prepare_message ($message)
|
||||||
// Either in a window or inline
|
// Either in a window or inline
|
||||||
function generate_smilies($mode)
|
function generate_smilies($mode)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $template, $lang, $datastore;
|
global $template, $lang, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$inline_columns = 4;
|
$inline_columns = 4;
|
||||||
$inline_rows = 7;
|
$inline_rows = 7;
|
||||||
|
@ -120,7 +123,6 @@ function generate_smilies($mode)
|
||||||
|
|
||||||
if ($num_smilies)
|
if ($num_smilies)
|
||||||
{
|
{
|
||||||
$smilies_count = ($mode == 'inline') ? min(19, $num_smilies) : $num_smilies;
|
|
||||||
$smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1;
|
$smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1;
|
||||||
|
|
||||||
$s_colspan = 0;
|
$s_colspan = 0;
|
||||||
|
@ -136,7 +138,7 @@ function generate_smilies($mode)
|
||||||
|
|
||||||
$template->assign_block_vars('smilies_row.smilies_col', array(
|
$template->assign_block_vars('smilies_row.smilies_col', array(
|
||||||
'SMILEY_CODE' => $data['code'],
|
'SMILEY_CODE' => $data['code'],
|
||||||
'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url,
|
'SMILEY_IMG' => $di->config->get('smilies_path') . '/' . $smile_url,
|
||||||
'SMILEY_DESC' => $data['emoticon'],
|
'SMILEY_DESC' => $data['emoticon'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -347,11 +349,12 @@ function strip_bbcode ($message, $stripquotes = true, $fast_and_dirty = false, $
|
||||||
|
|
||||||
function extract_search_words ($text)
|
function extract_search_words ($text)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$max_words_count = $bb_cfg['max_search_words_per_post'];
|
$max_words_count = $di->config->get('max_search_words_per_post');
|
||||||
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
|
$min_word_len = max(2, $di->config->get('search_min_word_len') - 1);
|
||||||
$max_word_len = $bb_cfg['search_max_word_len'];
|
$max_word_len = $di->config->get('search_max_word_len');
|
||||||
|
|
||||||
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
||||||
$text = str_replace(array('[', ']'), array('[', ']'), $text);
|
$text = str_replace(array('[', ']'), array('[', ']'), $text);
|
||||||
|
@ -415,12 +418,13 @@ function replace_synonyms ($text)
|
||||||
|
|
||||||
function add_search_words ($post_id, $post_message, $topic_title = '', $only_return_words = false)
|
function add_search_words ($post_id, $post_message, $topic_title = '', $only_return_words = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$text = $topic_title .' '. $post_message;
|
$text = $topic_title .' '. $post_message;
|
||||||
$words = ($text) ? extract_search_words($text) : array();
|
$words = ($text) ? extract_search_words($text) : array();
|
||||||
|
|
||||||
if ($only_return_words || $bb_cfg['sphinx_enabled'])
|
if ($only_return_words || $di->config->get('sphinx_enabled'))
|
||||||
{
|
{
|
||||||
return join("\n", $words);
|
return join("\n", $words);
|
||||||
}
|
}
|
||||||
|
@ -557,7 +561,8 @@ class bbcode
|
||||||
*/
|
*/
|
||||||
function bbcode2html ($text)
|
function bbcode2html ($text)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$text = " $text ";
|
$text = " $text ";
|
||||||
$text = $this->clean_up($text);
|
$text = $this->clean_up($text);
|
||||||
|
@ -594,7 +599,7 @@ class bbcode
|
||||||
$text = $this->new_line2html($text);
|
$text = $this->new_line2html($text);
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
|
|
||||||
if ($bb_cfg['tidy_post'])
|
if ($di->config->get('tidy_post'))
|
||||||
{
|
{
|
||||||
$text = $this->tidy($text);
|
$text = $this->tidy($text);
|
||||||
}
|
}
|
||||||
|
@ -627,7 +632,9 @@ class bbcode
|
||||||
*/
|
*/
|
||||||
private function spam_filter ($text)
|
private function spam_filter ($text)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
static $spam_words = null;
|
static $spam_words = null;
|
||||||
static $spam_replace = ' СПАМ';
|
static $spam_replace = ' СПАМ';
|
||||||
|
|
||||||
|
@ -637,21 +644,19 @@ class bbcode
|
||||||
}
|
}
|
||||||
|
|
||||||
// set $spam_words and $spam_replace
|
// set $spam_words and $spam_replace
|
||||||
if (!$bb_cfg['spam_filter_file_path'])
|
if (!$di->config->get('spam_filter_file_path'))
|
||||||
{
|
{
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
if (is_null($spam_words))
|
if (is_null($spam_words))
|
||||||
{
|
{
|
||||||
$spam_words = file_get_contents($bb_cfg['spam_filter_file_path']);
|
$spam_words = file_get_contents($di->config->get('spam_filter_file_path'));
|
||||||
$spam_words = strtolower($spam_words);
|
$spam_words = strtolower($spam_words);
|
||||||
$spam_words = explode("\n", $spam_words);
|
$spam_words = explode("\n", $spam_words);
|
||||||
}
|
}
|
||||||
|
|
||||||
$found_spam = array();
|
$found_spam = array();
|
||||||
|
|
||||||
$tm_start = utime();
|
|
||||||
|
|
||||||
$msg_decoded = $text;
|
$msg_decoded = $text;
|
||||||
$msg_decoded = html_entity_decode($msg_decoded);
|
$msg_decoded = html_entity_decode($msg_decoded);
|
||||||
$msg_decoded = urldecode($msg_decoded);
|
$msg_decoded = urldecode($msg_decoded);
|
||||||
|
@ -681,7 +686,6 @@ class bbcode
|
||||||
|
|
||||||
$text = preg_replace("/($spam_exp)(\S*)/i", $spam_replace, $msg_decoded);
|
$text = preg_replace("/($spam_exp)(\S*)/i", $spam_replace, $msg_decoded);
|
||||||
$text = htmlCHR($text, false, ENT_NOQUOTES);
|
$text = htmlCHR($text, false, ENT_NOQUOTES);
|
||||||
# bb_log(date("H:i:s") ." | ". sprintf('%.4f', (utime() - $tm_start)) ." | ". sprintf('%-6s', strlen($text)) ." | ". join(' ** ', $found_spam) ."\n", 'spam_filter');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
@ -713,14 +717,15 @@ class bbcode
|
||||||
*/
|
*/
|
||||||
function url_callback ($m)
|
function url_callback ($m)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$url = trim($m[1]);
|
$url = trim($m[1]);
|
||||||
$url_name = (isset($m[2])) ? trim($m[2]) : $url;
|
$url_name = (isset($m[2])) ? trim($m[2]) : $url;
|
||||||
|
|
||||||
if (!preg_match("#^https?://#isu", $url) && !preg_match("/^#/", $url)) $url = 'http://' . $url;
|
if (!preg_match("#^https?://#isu", $url) && !preg_match("/^#/", $url)) $url = 'http://' . $url;
|
||||||
|
|
||||||
if (in_array(parse_url($url, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled'])
|
if (in_array(parse_url($url, PHP_URL_HOST), $di->config->get('nofollow.allowed_url')) || $di->config->get('nofollow.disabled'))
|
||||||
{
|
{
|
||||||
$link = "<a href=\"$url\" class=\"postLink\">$url_name</a>";
|
$link = "<a href=\"$url\" class=\"postLink\">$url_name</a>";
|
||||||
}
|
}
|
||||||
|
@ -791,13 +796,14 @@ class bbcode
|
||||||
*/
|
*/
|
||||||
function make_url_clickable_callback ($m)
|
function make_url_clickable_callback ($m)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$max_len = 70;
|
$max_len = 70;
|
||||||
$href = $m[1];
|
$href = $m[1];
|
||||||
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) .'...'. mb_substr($href, -16) : $href;
|
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) .'...'. mb_substr($href, -16) : $href;
|
||||||
|
|
||||||
if (in_array(parse_url($href, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled'])
|
if (in_array(parse_url($href, PHP_URL_HOST), $di->config->get('nofollow.allowed_url')) || $di->config->get('nofollow.disabled'))
|
||||||
{
|
{
|
||||||
$link = "<a href=\"$href\" class=\"postLink\">$name</a>";
|
$link = "<a href=\"$href\" class=\"postLink\">$name</a>";
|
||||||
}
|
}
|
||||||
|
@ -972,15 +978,18 @@ function get_words_rate ($text)
|
||||||
|
|
||||||
function hide_passkey ($str)
|
function hide_passkey ($str)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{". BT_AUTH_KEY_LENGTH ."}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
return preg_replace("#\?{$di->config->get('passkey_key')}=[a-zA-Z0-9]{". BT_AUTH_KEY_LENGTH ."}#", "?{$di->config->get('passkey_key')}=passkey", $str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600)
|
function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html']))
|
if ($di->config->get('use_posts_cache') && !empty($postrow['post_html']))
|
||||||
{
|
{
|
||||||
return $postrow['post_html'];
|
return $postrow['post_html'];
|
||||||
}
|
}
|
||||||
|
@ -988,7 +997,7 @@ function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600)
|
||||||
$message = bbcode2html($postrow['post_text']);
|
$message = bbcode2html($postrow['post_text']);
|
||||||
|
|
||||||
// Posts cache
|
// Posts cache
|
||||||
if ($bb_cfg['use_posts_cache'])
|
if ($di->config->get('use_posts_cache'))
|
||||||
{
|
{
|
||||||
DB()->shutdown['post_html'][] = array(
|
DB()->shutdown['post_html'][] = array(
|
||||||
'post_id' => (int) $postrow['post_id'],
|
'post_id' => (int) $postrow['post_id'],
|
||||||
|
|
|
@ -15,26 +15,24 @@ class emailer
|
||||||
|
|
||||||
function emailer ($use_smtp/*$tpl_name, $sbj, $to_address*/)
|
function emailer ($use_smtp/*$tpl_name, $sbj, $to_address*/)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->from = $bb_cfg['board_email'];
|
$this->from = $di->config->get('board_email');
|
||||||
$this->reply_to = $bb_cfg['board_email'];
|
$this->reply_to = $di->config->get('board_email');
|
||||||
$this->use_smtp = $use_smtp; /*!empty($bb_cfg['smtp_host']);
|
$this->use_smtp = $use_smtp;
|
||||||
|
|
||||||
$this->use_template($tpl_name);
|
|
||||||
$this->set_subject($sbj);
|
|
||||||
$this->email_address($to_address);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_default_vars ()
|
function set_default_vars ()
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$this->vars = array(
|
$this->vars = array(
|
||||||
'BOARD_EMAIL' => $bb_cfg['board_email'],
|
'BOARD_EMAIL' => $di->config->get('board_email'),
|
||||||
'SITENAME' => $bb_cfg['board_email_sitename'],
|
'SITENAME' => $di->config->get('board_email_sitename'),
|
||||||
'EMAIL_SIG' => !empty($bb_cfg['board_email_sig']) ? "-- \n{$bb_cfg['board_email_sig']}" : '',
|
'EMAIL_SIG' => !empty($di->config->get('board_email_sig')) ? "-- \n{$di->config->get('board_email_sig')}" : '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +84,8 @@ class emailer
|
||||||
|
|
||||||
function use_template ($template_file, $template_lang = '')
|
function use_template ($template_file, $template_lang = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (trim($template_file) == '')
|
if (trim($template_file) == '')
|
||||||
{
|
{
|
||||||
|
@ -95,7 +94,7 @@ class emailer
|
||||||
|
|
||||||
if (trim($template_lang) == '')
|
if (trim($template_lang) == '')
|
||||||
{
|
{
|
||||||
$template_lang = $bb_cfg['default_lang'];
|
$template_lang = $di->config->get('default_lang');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->tpl_msg[$template_lang . $template_file]))
|
if (empty($this->tpl_msg[$template_lang . $template_file]))
|
||||||
|
@ -104,7 +103,7 @@ class emailer
|
||||||
|
|
||||||
if (!file_exists(bb_realpath($tpl_file)))
|
if (!file_exists(bb_realpath($tpl_file)))
|
||||||
{
|
{
|
||||||
$tpl_file = LANG_ROOT_DIR ."{$bb_cfg['default_lang']}/email/$template_file.html";
|
$tpl_file = LANG_ROOT_DIR ."{$di->config->get('default_lang')}/email/$template_file.html";
|
||||||
|
|
||||||
if (!file_exists(bb_realpath($tpl_file)))
|
if (!file_exists(bb_realpath($tpl_file)))
|
||||||
{
|
{
|
||||||
|
@ -135,9 +134,12 @@ class emailer
|
||||||
// Send the mail out to the recipients set previously in var $this->address
|
// Send the mail out to the recipients set previously in var $this->address
|
||||||
function send ($email_format = 'text')
|
function send ($email_format = 'text')
|
||||||
{
|
{
|
||||||
global $bb_cfg, $userdata;
|
global $userdata;
|
||||||
|
|
||||||
if ($bb_cfg['emailer_disabled'])
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if ($di->config->get('emailer_disabled'))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,12 +180,12 @@ class emailer
|
||||||
|
|
||||||
if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match))
|
if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match))
|
||||||
{
|
{
|
||||||
$this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']);
|
$this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($di->config->get('lang.' . $userdata['user_lang'] . '.encoding'));
|
||||||
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
|
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->encoding = trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']);
|
$this->encoding = trim($di->config->get('lang.' . $userdata['user_lang'] . '.encoding'));
|
||||||
}
|
}
|
||||||
$this->subject = $this->encode($this->subject);
|
$this->subject = $this->encode($this->subject);
|
||||||
|
|
||||||
|
@ -199,7 +201,7 @@ class emailer
|
||||||
|
|
||||||
// Build header
|
// Build header
|
||||||
$type = ($email_format == 'html') ? 'html' : 'plain';
|
$type = ($email_format == 'html') ? 'html' : 'plain';
|
||||||
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $bb_cfg['board_email'] . "\n") . "Return-Path: " . $bb_cfg['board_email'] . "\nMessage-ID: <" . md5(uniqid(TIMENOW)) . "@" . $bb_cfg['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/$type; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', TIMENOW) . "\nX-Priority: 0\nX-MSMail-Priority: Normal\nX-Mailer: Microsoft Office Outlook, Build 11.0.5510\nX-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441\nX-Sender: " . $bb_cfg['board_email'] . "\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : '');
|
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $di->config->get('board_email') . "\n") . "Return-Path: " . $di->config->get('board_email') . "\nMessage-ID: <" . md5(uniqid(TIMENOW)) . "@" . $di->config->get('server_name') . ">\nMIME-Version: 1.0\nContent-type: text/$type; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', TIMENOW) . "\nX-Priority: 0\nX-MSMail-Priority: Normal\nX-Mailer: Microsoft Office Outlook, Build 11.0.5510\nX-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441\nX-Sender: " . $di->config->get('board_email') . "\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : '');
|
||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
if ($this->use_smtp)
|
if ($this->use_smtp)
|
||||||
|
|
|
@ -120,14 +120,15 @@ class sitemap
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_static () {
|
function get_static () {
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$xml = '';
|
$xml = '';
|
||||||
$lm = date('c');
|
$lm = date('c');
|
||||||
$this->priority = $this->stat_priority;
|
$this->priority = $this->stat_priority;
|
||||||
|
|
||||||
if (isset($bb_cfg['static_sitemap'])) {
|
if ($di->config->get('static_sitemap')) {
|
||||||
$static_url = preg_replace("/\s/", '', $bb_cfg['static_sitemap']); //вырезаем переносы строк
|
$static_url = preg_replace("/\s/", '', $di->config->get('static_sitemap')); //вырезаем переносы строк
|
||||||
preg_match_all('#(https?://[\w-]+[\.\w-]+/((?!https?://)[\w- ./?%&=])+)#', $static_url, $out);
|
preg_match_all('#(https?://[\w-]+[\.\w-]+/((?!https?://)[\w- ./?%&=])+)#', $static_url, $out);
|
||||||
|
|
||||||
$static_url = count($out['0']);
|
$static_url = count($out['0']);
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require_once(INC_DIR .'functions_admin.php');
|
require_once(INC_DIR .'functions_admin.php');
|
||||||
|
|
||||||
// Синхронизация
|
// Синхронизация
|
||||||
|
@ -10,7 +13,7 @@ sync('user_posts', 'all');
|
||||||
sync_all_forums();
|
sync_all_forums();
|
||||||
|
|
||||||
// Чистка bb_poll_users
|
// Чистка bb_poll_users
|
||||||
if ($poll_max_days = (int) $bb_cfg['poll_max_days'])
|
if ($poll_max_days = (int) $di->config->get('poll_max_days'))
|
||||||
{
|
{
|
||||||
$per_cycle = 20000;
|
$per_cycle = 20000;
|
||||||
$row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM ". BB_POLL_USERS);
|
$row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM ". BB_POLL_USERS);
|
||||||
|
@ -43,7 +46,7 @@ if ($poll_max_days = (int) $bb_cfg['poll_max_days'])
|
||||||
DB()->query("UPDATE ". BB_USERS ." SET user_newpasswd = '' WHERE user_lastvisit < ". (TIMENOW - 7*86400));
|
DB()->query("UPDATE ". BB_USERS ." SET user_newpasswd = '' WHERE user_lastvisit < ". (TIMENOW - 7*86400));
|
||||||
|
|
||||||
// Чистка кеша постов
|
// Чистка кеша постов
|
||||||
if ($posts_days = intval($bb_cfg['posts_cache_days_keep']))
|
if ($posts_days = intval($di->config->get('posts_cache_days_keep')))
|
||||||
{
|
{
|
||||||
DB()->query("DELETE FROM ". BB_POSTS_HTML ." WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
|
DB()->query("DELETE FROM ". BB_POSTS_HTML ." WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
|
||||||
}
|
}
|
|
@ -2,12 +2,15 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// Delete staled dl-status records
|
// Delete staled dl-status records
|
||||||
$keeping_dlstat = array(
|
$keeping_dlstat = array(
|
||||||
DL_STATUS_WILL => (int) $bb_cfg['dl_will_days_keep'],
|
DL_STATUS_WILL => (int) $di->config->get('dl_will_days_keep'),
|
||||||
DL_STATUS_DOWN => (int) $bb_cfg['dl_down_days_keep'],
|
DL_STATUS_DOWN => (int) $di->config->get('dl_down_days_keep'),
|
||||||
DL_STATUS_COMPLETE => (int) $bb_cfg['dl_complete_days_keep'],
|
DL_STATUS_COMPLETE => (int) $di->config->get('dl_complete_days_keep'),
|
||||||
DL_STATUS_CANCEL => (int) $bb_cfg['dl_cancel_days_keep'],
|
DL_STATUS_CANCEL => (int) $di->config->get('dl_cancel_days_keep'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$delete_dlstat_sql = array();
|
$delete_dlstat_sql = array();
|
||||||
|
@ -45,7 +48,7 @@ DB()->query("
|
||||||
");
|
");
|
||||||
|
|
||||||
// Tor-Stats cleanup
|
// Tor-Stats cleanup
|
||||||
if ($torstat_days_keep = intval($bb_cfg['torstat_days_keep']))
|
if ($torstat_days_keep = intval($di->config->get('torstat_days_keep')))
|
||||||
{
|
{
|
||||||
DB()->query("DELETE QUICK FROM ". BB_BT_TORSTAT ." WHERE last_modified_torstat < DATE_SUB(NOW(), INTERVAL $torstat_days_keep DAY)");
|
DB()->query("DELETE QUICK FROM ". BB_BT_TORSTAT ." WHERE last_modified_torstat < DATE_SUB(NOW(), INTERVAL $torstat_days_keep DAY)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
$log_days_keep = (int) $bb_cfg['log_days_keep'];
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$log_days_keep = (int) $di->config->get('log_days_keep');
|
||||||
|
|
||||||
DB()->query("
|
DB()->query("
|
||||||
DELETE FROM ". BB_LOG ."
|
DELETE FROM ". BB_LOG ."
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require_once(INC_DIR .'functions_admin.php');
|
require_once(INC_DIR .'functions_admin.php');
|
||||||
|
|
||||||
if ($bb_cfg['prune_enable'])
|
if ($di->config->get('prune_enable'))
|
||||||
{
|
{
|
||||||
$sql = "SELECT forum_id, prune_days FROM ". BB_FORUMS ." WHERE prune_days != 0";
|
$sql = "SELECT forum_id, prune_days FROM ". BB_FORUMS ." WHERE prune_days != 0";
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require_once(INC_DIR .'functions_admin.php');
|
require_once(INC_DIR .'functions_admin.php');
|
||||||
|
|
||||||
$users_per_cycle = 1000;
|
$users_per_cycle = 1000;
|
||||||
|
@ -12,7 +15,7 @@ while (true)
|
||||||
|
|
||||||
$prune_users = $not_activated_users = $not_active_users = array();
|
$prune_users = $not_activated_users = $not_active_users = array();
|
||||||
|
|
||||||
if ($not_activated_days = intval($bb_cfg['user_not_activated_days_keep']))
|
if ($not_activated_days = intval($di->config->get('user_not_activated_days_keep')))
|
||||||
{
|
{
|
||||||
$sql = DB()->fetch_rowset("SELECT user_id FROM ". BB_USERS ."
|
$sql = DB()->fetch_rowset("SELECT user_id FROM ". BB_USERS ."
|
||||||
WHERE user_level = 0
|
WHERE user_level = 0
|
||||||
|
@ -28,7 +31,7 @@ while (true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($not_active_days = intval($bb_cfg['user_not_active_days_keep']))
|
if ($not_active_days = intval($di->config->get('user_not_active_days_keep')))
|
||||||
{
|
{
|
||||||
$sql = DB()->fetch_rowset("SELECT user_id FROM ". BB_USERS ."
|
$sql = DB()->fetch_rowset("SELECT user_id FROM ". BB_USERS ."
|
||||||
WHERE user_level = 0
|
WHERE user_level = 0
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
if ($bb_cfg['topic_moved_days_keep'])
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if ($di->config->get('topic_moved_days_keep'))
|
||||||
{
|
{
|
||||||
$prune_time = TIMENOW - 86400*$bb_cfg['topic_moved_days_keep'];
|
$prune_time = TIMENOW - 86400*$di->config->get('topic_moved_days_keep');
|
||||||
|
|
||||||
DB()->query("
|
DB()->query("
|
||||||
DELETE FROM ". BB_TOPICS ."
|
DELETE FROM ". BB_TOPICS ."
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
$user_session_expire_time = TIMENOW - intval($bb_cfg['user_session_duration']);
|
/** @var \TorrentPier\Di $di */
|
||||||
$admin_session_expire_time = TIMENOW - intval($bb_cfg['admin_session_duration']);
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$user_session_gc_time = $user_session_expire_time - intval($bb_cfg['user_session_gc_ttl']);
|
$user_session_expire_time = TIMENOW - intval($di->config->get('user_session_duration'));
|
||||||
|
$admin_session_expire_time = TIMENOW - intval($di->config->get('admin_session_duration'));
|
||||||
|
|
||||||
|
$user_session_gc_time = $user_session_expire_time - intval($di->config->get('user_session_gc_ttl'));
|
||||||
$admin_session_gc_time = $admin_session_expire_time;
|
$admin_session_gc_time = $admin_session_expire_time;
|
||||||
|
|
||||||
// ############################ Tables LOCKED ################################
|
// ############################ Tables LOCKED ################################
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$releaser = DL_STATUS_RELEASER;
|
$releaser = DL_STATUS_RELEASER;
|
||||||
|
|
||||||
define('NEW_BB_BT_LAST_TORSTAT', 'new_bt_last_torstat');
|
define('NEW_BB_BT_LAST_TORSTAT', 'new_bt_last_torstat');
|
||||||
|
@ -58,7 +61,7 @@ DB()->query("
|
||||||
// Clean peers table
|
// Clean peers table
|
||||||
if ($tr_cfg['autoclean'])
|
if ($tr_cfg['autoclean'])
|
||||||
{
|
{
|
||||||
$announce_interval = max(intval($bb_cfg['announce_interval']), 60);
|
$announce_interval = max(intval($di->config->get('announce_interval')), 60);
|
||||||
$expire_factor = max(floatval($tr_cfg['expire_factor']), 1);
|
$expire_factor = max(floatval($tr_cfg['expire_factor']), 1);
|
||||||
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
|
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
|
||||||
|
|
||||||
|
@ -94,7 +97,7 @@ if ($tr_cfg['update_dlstat'])
|
||||||
|
|
||||||
// Update TOTAL user's dlstat
|
// Update TOTAL user's dlstat
|
||||||
// This is not needed if Ocelot enabled. It's important.
|
// This is not needed if Ocelot enabled. It's important.
|
||||||
if (!$bb_cfg['ocelot']['enabled'])
|
if (!$di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
// Update TORRENT "completed" counters
|
// Update TORRENT "completed" counters
|
||||||
DB()->query("
|
DB()->query("
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
if (empty($bb_cfg['seeder_last_seen_days_keep']) || empty($bb_cfg['seeder_never_seen_days_keep']))
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if (empty($di->config->get('seeder_last_seen_days_keep')) || empty($di->config->get('seeder_never_seen_days_keep')))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_seen_time = TIMENOW - 86400*$bb_cfg['seeder_last_seen_days_keep'];
|
$last_seen_time = TIMENOW - 86400*$di->config->get('seeder_last_seen_days_keep');
|
||||||
$never_seen_time = TIMENOW - 86400*$bb_cfg['seeder_never_seen_days_keep'];
|
$never_seen_time = TIMENOW - 86400*$di->config->get('seeder_never_seen_days_keep');
|
||||||
$limit_sql = 3000;
|
$limit_sql = 3000;
|
||||||
|
|
||||||
$topics_sql = [];
|
$topics_sql = [];
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
DB()->expect_slow_query(600);
|
DB()->expect_slow_query(600);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make tracker snapshot
|
// Make tracker snapshot
|
||||||
//
|
//
|
||||||
if (!$bb_cfg['ocelot']['enabled'])
|
if (!$di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
define('NEW_BB_BT_TRACKER_SNAP', 'new_tracker_snap');
|
define('NEW_BB_BT_TRACKER_SNAP', 'new_tracker_snap');
|
||||||
define('OLD_BB_BT_TRACKER_SNAP', 'old_tracker_snap');
|
define('OLD_BB_BT_TRACKER_SNAP', 'old_tracker_snap');
|
||||||
|
@ -30,7 +31,7 @@ while (true)
|
||||||
|
|
||||||
$val = array();
|
$val = array();
|
||||||
|
|
||||||
if (!$bb_cfg['ocelot']['enabled'])
|
if (!$di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -59,7 +60,7 @@ while (true)
|
||||||
|
|
||||||
if ($val)
|
if ($val)
|
||||||
{
|
{
|
||||||
if (!$bb_cfg['ocelot']['enabled'])
|
if (!$di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
REPLACE INTO " . NEW_BB_BT_TRACKER_SNAP . "
|
REPLACE INTO " . NEW_BB_BT_TRACKER_SNAP . "
|
||||||
|
@ -91,7 +92,7 @@ while (true)
|
||||||
$start_id += $per_cycle;
|
$start_id += $per_cycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$bb_cfg['ocelot']['enabled'])
|
if (!$di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
RENAME TABLE
|
RENAME TABLE
|
||||||
|
@ -112,7 +113,7 @@ DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_DLSTATUS_SNAP .", ". OLD_BB_BT_DL
|
||||||
|
|
||||||
DB()->query("CREATE TABLE ". NEW_BB_BT_DLSTATUS_SNAP ." LIKE ". BB_BT_DLSTATUS_SNAP);
|
DB()->query("CREATE TABLE ". NEW_BB_BT_DLSTATUS_SNAP ." LIKE ". BB_BT_DLSTATUS_SNAP);
|
||||||
|
|
||||||
if ($bb_cfg['bt_show_dl_list'] && $bb_cfg['bt_dl_list_only_count'])
|
if ($di->config->get('bt_show_dl_list') && $di->config->get('bt_dl_list_only_count'))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
INSERT INTO ". NEW_BB_BT_DLSTATUS_SNAP ."
|
INSERT INTO ". NEW_BB_BT_DLSTATUS_SNAP ."
|
||||||
|
@ -136,7 +137,7 @@ DB()->query("DROP TABLE IF EXISTS ". NEW_BB_BT_DLSTATUS_SNAP .", ". OLD_BB_BT_DL
|
||||||
//
|
//
|
||||||
// TORHELP
|
// TORHELP
|
||||||
//
|
//
|
||||||
if ($bb_cfg['torhelp_enabled'])
|
if ($di->config->get('torhelp_enabled'))
|
||||||
{
|
{
|
||||||
$tor_min_seeders = 0; // "<="
|
$tor_min_seeders = 0; // "<="
|
||||||
$tor_min_leechers = 2; // ">="
|
$tor_min_leechers = 2; // ">="
|
||||||
|
@ -182,7 +183,7 @@ if ($bb_cfg['torhelp_enabled'])
|
||||||
WHERE
|
WHERE
|
||||||
trsn.seeders <= $tor_min_seeders
|
trsn.seeders <= $tor_min_seeders
|
||||||
AND trsn.leechers >= $tor_min_leechers
|
AND trsn.leechers >= $tor_min_leechers
|
||||||
AND tor.forum_id != ". (int) $bb_cfg['trash_forum_id'] ."
|
AND tor.forum_id != ". (int) $di->config->get('trash_forum_id') ."
|
||||||
AND tor.complete_count >= $tor_min_completed
|
AND tor.complete_count >= $tor_min_completed
|
||||||
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
|
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
|
||||||
AND dl.user_id IN($online_users_csv)
|
AND dl.user_id IN($online_users_csv)
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
DB()->expect_slow_query(600);
|
DB()->expect_slow_query(600);
|
||||||
|
|
||||||
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release'])
|
if ($di->config->get('seed_bonus_enabled') && $di->config->get('seed_bonus_points') && $di->config->get('seed_bonus_release'))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
CREATE TEMPORARY TABLE tmp_bonus (
|
CREATE TEMPORARY TABLE tmp_bonus (
|
||||||
|
@ -13,7 +16,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
||||||
) ENGINE = MEMORY
|
) ENGINE = MEMORY
|
||||||
");
|
");
|
||||||
|
|
||||||
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
|
$tor_size = ($di->config->get('seed_bonus_tor_size') * 1073741824);
|
||||||
|
|
||||||
DB()->query("INSERT INTO tmp_bonus
|
DB()->query("INSERT INTO tmp_bonus
|
||||||
SELECT bt.user_id, count(bt.seeder) AS release_count
|
SELECT bt.user_id, count(bt.seeder) AS release_count
|
||||||
|
@ -24,8 +27,8 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
||||||
GROUP BY user_id
|
GROUP BY user_id
|
||||||
");
|
");
|
||||||
|
|
||||||
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
$seed_bonus = unserialize($di->config->get('seed_bonus_points'));
|
||||||
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
$seed_release = unserialize($di->config->get('seed_bonus_release'));
|
||||||
|
|
||||||
foreach($seed_bonus as $i => $points)
|
foreach($seed_bonus as $i => $points)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +36,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
||||||
|
|
||||||
$user_points = ((float) $points / 4);
|
$user_points = ((float) $points / 4);
|
||||||
$release = (int) $seed_release[$i];
|
$release = (int) $seed_release[$i];
|
||||||
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
$user_regdate = (TIMENOW - $di->config->get('seed_bonus_user_regdate') * 86400);
|
||||||
|
|
||||||
DB()->query("
|
DB()->query("
|
||||||
UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b
|
UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require_once(INC_DIR .'functions_atom.php');
|
require_once(INC_DIR .'functions_atom.php');
|
||||||
|
|
||||||
$timecheck = TIMENOW - 600;
|
$timecheck = TIMENOW - 600;
|
||||||
$forums_data = DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM ". BB_FORUMS);
|
$forums_data = DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM ". BB_FORUMS);
|
||||||
|
|
||||||
if (file_exists($bb_cfg['atom']['path'] .'/f/0.atom'))
|
if (file_exists($di->config->get('atom.path') .'/f/0.atom'))
|
||||||
{
|
{
|
||||||
if (filemtime($bb_cfg['atom']['path'] .'/f/0.atom') <= $timecheck) update_forum_feed(0, $forums_data);
|
if (filemtime($di->config->get('atom.path') .'/f/0.atom') <= $timecheck) update_forum_feed(0, $forums_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -20,9 +21,9 @@ else
|
||||||
|
|
||||||
foreach ($forums_data as $forum_data)
|
foreach ($forums_data as $forum_data)
|
||||||
{
|
{
|
||||||
if (file_exists($bb_cfg['atom']['path'] .'/f/'. $forum_data['forum_id'] .'.atom'))
|
if (file_exists($di->config->get('atom.path') .'/f/'. $forum_data['forum_id'] .'.atom'))
|
||||||
{
|
{
|
||||||
if (filemtime($bb_cfg['atom']['path'] .'/f/'. $forum_data['forum_id'] .'.atom') <= $timecheck) update_forum_feed($forum_data['forum_id'], $forum_data);
|
if (filemtime($di->config->get('atom.path') .'/f/'. $forum_data['forum_id'] .'.atom') <= $timecheck) update_forum_feed($forum_data['forum_id'], $forum_data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bf, $bb_cfg;
|
global $bf;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
//
|
//
|
||||||
// cat_forums
|
// cat_forums
|
||||||
|
@ -128,9 +131,9 @@ $this->store('viewtopic_forum_select', $data);
|
||||||
//
|
//
|
||||||
// latest_news
|
// latest_news
|
||||||
//
|
//
|
||||||
if ($bb_cfg['show_latest_news'] && ($news_forum_ids = $bb_cfg['latest_news_forum_id']))
|
if ($di->config->get('show_latest_news') && ($news_forum_ids = $di->config->get('latest_news_forum_id')))
|
||||||
{
|
{
|
||||||
$news_count = max($bb_cfg['latest_news_count'], 1);
|
$news_count = max($di->config->get('latest_news_count'), 1);
|
||||||
|
|
||||||
$data = DB()->fetch_rowset("
|
$data = DB()->fetch_rowset("
|
||||||
SELECT topic_id, topic_time, topic_title, forum_id
|
SELECT topic_id, topic_time, topic_title, forum_id
|
||||||
|
@ -147,9 +150,9 @@ if ($bb_cfg['show_latest_news'] && ($news_forum_ids = $bb_cfg['latest_news_forum
|
||||||
//
|
//
|
||||||
// Network_news
|
// Network_news
|
||||||
//
|
//
|
||||||
if ($bb_cfg['show_network_news'] && ($net_forum_ids = $bb_cfg['network_news_forum_id']))
|
if ($di->config->get('show_network_news') && ($net_forum_ids = $di->config->get('network_news_forum_id')))
|
||||||
{
|
{
|
||||||
$net_count = max($bb_cfg['network_news_count'], 1);
|
$net_count = max($di->config->get('network_news_count'), 1);
|
||||||
|
|
||||||
$data = DB()->fetch_rowset("
|
$data = DB()->fetch_rowset("
|
||||||
SELECT topic_id, topic_time, topic_title, forum_id
|
SELECT topic_id, topic_time, topic_title, forum_id
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$smilies = array();
|
$smilies = [];
|
||||||
|
|
||||||
$rowset = DB()->fetch_rowset("SELECT * FROM ". BB_SMILIES);
|
$rowset = DB()->fetch_rowset("SELECT * FROM ". BB_SMILIES);
|
||||||
sort($rowset);
|
sort($rowset);
|
||||||
|
@ -12,7 +13,7 @@ sort($rowset);
|
||||||
foreach ($rowset as $smile)
|
foreach ($rowset as $smile)
|
||||||
{
|
{
|
||||||
$smilies['orig'][] = '#(?<=^|\W)'. preg_quote($smile['code'], '#') .'(?=$|\W)#';
|
$smilies['orig'][] = '#(?<=^|\W)'. preg_quote($smile['code'], '#') .'(?=$|\W)#';
|
||||||
$smilies['repl'][] = ' <img class="smile" src="'. $bb_cfg['smilies_path'] .'/'. $smile['smile_url'] .'" alt="'. $smile['emoticon'] .'" align="absmiddle" border="0" />';
|
$smilies['repl'][] = ' <img class="smile" src="'. $di->config->get('smilies_path') .'/'. $smile['smile_url'] .'" alt="'. $smile['emoticon'] .'" align="absmiddle" border="0" />';
|
||||||
$smilies['smile'][] = $smile;
|
$smilies['smile'][] = $smile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$data = array();
|
$data = [];
|
||||||
|
|
||||||
// usercount
|
// usercount
|
||||||
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS .")");
|
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS .")");
|
||||||
|
@ -20,7 +21,7 @@ $data['postcount'] = commify($row['postcount']);
|
||||||
$data['topiccount'] = commify($row['topiccount']);
|
$data['topiccount'] = commify($row['topiccount']);
|
||||||
|
|
||||||
// Tracker stats
|
// Tracker stats
|
||||||
if ($bb_cfg['tor_stats'])
|
if ($di->config->get('tor_stats'))
|
||||||
{
|
{
|
||||||
// torrents stat
|
// torrents stat
|
||||||
$row = DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM ". BB_BT_TORRENTS);
|
$row = DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM ". BB_BT_TORRENTS);
|
||||||
|
@ -36,7 +37,7 @@ if ($bb_cfg['tor_stats'])
|
||||||
}
|
}
|
||||||
|
|
||||||
// gender stat
|
// gender stat
|
||||||
if ($bb_cfg['gender'])
|
if ($di->config->get('gender'))
|
||||||
{
|
{
|
||||||
$male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM ". BB_USERS ." WHERE user_gender = ". MALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
$male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM ". BB_USERS ." WHERE user_gender = ". MALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
||||||
$female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM ". BB_USERS ." WHERE user_gender = ". FEMALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
$female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM ". BB_USERS ." WHERE user_gender = ". FEMALE ." AND user_id NOT IN(". EXCLUDED_USERS .")");
|
||||||
|
@ -48,7 +49,7 @@ if ($bb_cfg['gender'])
|
||||||
}
|
}
|
||||||
|
|
||||||
// birthday stat
|
// birthday stat
|
||||||
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
if ($di->config->get('birthday_check_day') && $di->config->get('birthday_enabled'))
|
||||||
{
|
{
|
||||||
$sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
|
$sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
|
||||||
FROM ". BB_USERS ."
|
FROM ". BB_USERS ."
|
||||||
|
@ -59,7 +60,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
|
||||||
");
|
");
|
||||||
|
|
||||||
$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 + ($di->config->get('birthday_check_day')*86400), 'md', false);
|
||||||
|
|
||||||
$birthday_today_list = $birthday_week_list = array();
|
$birthday_today_list = $birthday_week_list = array();
|
||||||
|
|
||||||
|
|
|
@ -4,22 +4,31 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div)
|
function get_path_from_id ($id, $ext_id, $base_path, $first_div, $sec_div)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$ext = isset($bb_cfg['file_id_ext'][$ext_id]) ? $bb_cfg['file_id_ext'][$ext_id] : '';
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$ext = $di->config->get('file_id_ext.' . $ext_id) ? $di->config->get('file_id_ext.' . $ext_id) : '';
|
||||||
|
|
||||||
return ($base_path ? "$base_path/" : '') . floor($id/$first_div) .'/'. ($id % $sec_div) .'/'. $id . ($ext ? ".$ext" : '');
|
return ($base_path ? "$base_path/" : '') . floor($id/$first_div) .'/'. ($id % $sec_div) .'/'. $id . ($ext ? ".$ext" : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_avatar_path ($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
|
function get_avatar_path ($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$base_path = isset($base_path) ? $base_path : $bb_cfg['avatars']['upload_path'];
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$base_path = isset($base_path) ? $base_path : $di->config->get('avatars.upload_path');
|
||||||
|
|
||||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_attach_path ($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
|
function get_attach_path ($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$base_path = isset($base_path) ? $base_path : $bb_cfg['attach']['upload_path'];
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$base_path = isset($base_path) ? $base_path : $di->config->get('attach.upload_path');
|
||||||
|
|
||||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,16 +715,6 @@ class html_common
|
||||||
|
|
||||||
return '<label><input type="checkbox" '. $id . $name . $value . $checked . $disabled .' /> '. $title .' </label>';
|
return '<label><input type="checkbox" '. $id . $name . $value . $checked . $disabled .' /> '. $title .' </label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
# function build_option ($opt_name, $opt_val, $selected = null, $max_length = false)
|
|
||||||
# {
|
|
||||||
# return "\t\t<option value=\"". htmlCHR($opt_val) .'"'. (($selected) ? ' selected="selected"' : '') .'>'. htmlCHR(str_short($opt_name, $max_length)) ."</option>\n";
|
|
||||||
# }
|
|
||||||
|
|
||||||
# function build_optgroup ($label, $contents, $max_length = false)
|
|
||||||
# {
|
|
||||||
# return "\t<optgroup label=\" ". htmlCHR(str_short($label, $max_length)) ."\">\n". $contents ."\t</optgroup>\n";
|
|
||||||
# }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_select ($name, $params, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '')
|
function build_select ($name, $params, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '')
|
||||||
|
@ -897,7 +896,8 @@ function humn_size ($size, $rounder = null, $min = null, $space = ' ')
|
||||||
|
|
||||||
function bt_show_ip ($ip, $port = '')
|
function bt_show_ip ($ip, $port = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (IS_AM)
|
if (IS_AM)
|
||||||
{
|
{
|
||||||
|
@ -907,13 +907,14 @@ function bt_show_ip ($ip, $port = '')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ($bb_cfg['bt_show_ip_only_moder']) ? false : decode_ip_xx($ip);
|
return ($di->config->get('bt_show_ip_only_moder')) ? false : decode_ip_xx($ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bt_show_port ($port)
|
function bt_show_port ($port)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (IS_AM)
|
if (IS_AM)
|
||||||
{
|
{
|
||||||
|
@ -921,7 +922,7 @@ function bt_show_port ($port)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ($bb_cfg['bt_show_port_only_moder']) ? false : $port;
|
return ($di->config->get('bt_show_port_only_moder')) ? false : $port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1479,15 +1480,18 @@ function get_forum_select ($mode = 'guest', $name = POST_FORUM_URL, $selected =
|
||||||
|
|
||||||
function setup_style ()
|
function setup_style ()
|
||||||
{
|
{
|
||||||
global $bb_cfg, $template, $userdata;
|
global $template, $userdata;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// AdminCP works only with default template
|
// AdminCP works only with default template
|
||||||
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
|
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($di->config->get('tpl_name'));
|
||||||
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
|
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($di->config->get('stylesheet'));
|
||||||
|
|
||||||
if (!IS_GUEST && !empty($userdata['tpl_name']))
|
if (!IS_GUEST && !empty($userdata['tpl_name']))
|
||||||
{
|
{
|
||||||
foreach ($bb_cfg['templates'] as $folder => $name)
|
foreach ($di->config->get('templates') as $folder => $name)
|
||||||
{
|
{
|
||||||
if ($userdata['tpl_name'] == $folder) $tpl_dir_name = basename($userdata['tpl_name']);
|
if ($userdata['tpl_name'] == $folder) $tpl_dir_name = basename($userdata['tpl_name']);
|
||||||
}
|
}
|
||||||
|
@ -1500,7 +1504,7 @@ function setup_style ()
|
||||||
'BB_ROOT' => BB_ROOT,
|
'BB_ROOT' => BB_ROOT,
|
||||||
'SPACER' => make_url('styles/images/spacer.gif'),
|
'SPACER' => make_url('styles/images/spacer.gif'),
|
||||||
'STYLESHEET' => make_url($css_dir . $stylesheet),
|
'STYLESHEET' => make_url($css_dir . $stylesheet),
|
||||||
'EXT_LINK_NEW_WIN' => $bb_cfg['ext_link_new_win'],
|
'EXT_LINK_NEW_WIN' => $di->config->get('ext_link_new_win'),
|
||||||
'TPL_DIR' => make_url($css_dir),
|
'TPL_DIR' => make_url($css_dir),
|
||||||
'SITE_URL' => make_url('/'),
|
'SITE_URL' => make_url('/'),
|
||||||
));
|
));
|
||||||
|
@ -1515,14 +1519,17 @@ function setup_style ()
|
||||||
// Create date / time with format and friendly date
|
// Create date / time with format and friendly date
|
||||||
function bb_date ($gmepoch, $format = false, $friendly_date = true)
|
function bb_date ($gmepoch, $format = false, $friendly_date = true)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $lang, $userdata;
|
||||||
|
|
||||||
if (!$format) $format = $bb_cfg['default_dateformat'];
|
/** @var \TorrentPier\Di $di */
|
||||||
if (empty($lang)) require_once($bb_cfg['default_lang_dir'] .'main.php');
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if (!$format) $format = $di->config->get('default_dateformat');
|
||||||
|
if (empty($lang)) require_once($di->config->get('default_lang_dir') .'main.php');
|
||||||
|
|
||||||
if (empty($userdata['session_logged_in']))
|
if (empty($userdata['session_logged_in']))
|
||||||
{
|
{
|
||||||
$tz = $bb_cfg['board_timezone'];
|
$tz = $di->config->get('board_timezone');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1565,15 +1572,18 @@ function bb_date ($gmepoch, $format = false, $friendly_date = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
return ($di->config->get('translate_dates')) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
function birthday_age ($date)
|
function birthday_age ($date)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!$date) return false;
|
if (!$date) return false;
|
||||||
|
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * $di->config->get('board_timezone'));
|
||||||
|
|
||||||
return delta_time(strtotime($date, $tz));
|
return delta_time(strtotime($date, $tz));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,15 +1715,13 @@ function generate_pagination ($base_url, $num_items, $per_page, $start_item, $ad
|
||||||
//
|
//
|
||||||
function obtain_word_list (&$orig_word, &$replacement_word)
|
function obtain_word_list (&$orig_word, &$replacement_word)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
/** @var \TorrentPier\Di $di */
|
/** @var \TorrentPier\Di $di */
|
||||||
$di = \TorrentPier\Di::getInstance();
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
/** @var \TorrentPier\Cache\Adapter $cache */
|
/** @var \TorrentPier\Cache\Adapter $cache */
|
||||||
$cache = $di->cache;
|
$cache = $di->cache;
|
||||||
|
|
||||||
if (!$bb_cfg['use_word_censor']) return false;
|
if (!$di->config->get('use_word_censor')) return false;
|
||||||
|
|
||||||
if (!$cache->has('censored')) {
|
if (!$cache->has('censored')) {
|
||||||
$sql = DB()->fetch_rowset("SELECT word, replacement FROM " . BB_WORDS);
|
$sql = DB()->fetch_rowset("SELECT word, replacement FROM " . BB_WORDS);
|
||||||
|
@ -1733,7 +1741,10 @@ function obtain_word_list (&$orig_word, &$replacement_word)
|
||||||
|
|
||||||
function bb_die ($msg_text)
|
function bb_die ($msg_text)
|
||||||
{
|
{
|
||||||
global $ajax, $bb_cfg, $lang, $template, $theme, $user;
|
global $ajax, $lang, $template, $theme, $user;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (defined('IN_AJAX'))
|
if (defined('IN_AJAX'))
|
||||||
{
|
{
|
||||||
|
@ -1751,7 +1762,7 @@ function bb_die ($msg_text)
|
||||||
// If empty lang
|
// If empty lang
|
||||||
if (empty($lang))
|
if (empty($lang))
|
||||||
{
|
{
|
||||||
require($bb_cfg['default_lang_dir'] .'main.php');
|
require($di->config->get('default_lang_dir') .'main.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If empty session
|
// If empty session
|
||||||
|
@ -1765,7 +1776,7 @@ function bb_die ($msg_text)
|
||||||
{
|
{
|
||||||
if (empty($template))
|
if (empty($template))
|
||||||
{
|
{
|
||||||
$template = new Template(BB_ROOT ."templates/{$bb_cfg['tpl_name']}");
|
$template = new Template(BB_ROOT ."templates/{$di->config->get('tpl_name')}");
|
||||||
}
|
}
|
||||||
if (empty($theme))
|
if (empty($theme))
|
||||||
{
|
{
|
||||||
|
@ -1795,14 +1806,15 @@ function bb_die ($msg_text)
|
||||||
|
|
||||||
function bb_simple_die ($txt)
|
function bb_simple_die ($txt)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!empty($_COOKIE['explain']))
|
if (!empty($_COOKIE['explain']))
|
||||||
{
|
{
|
||||||
bb_die("bb_simple_die:<br /><br />$txt");
|
bb_die("bb_simple_die:<br /><br />$txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Type: text/plain; charset='. $bb_cfg['charset']);
|
header('Content-Type: text/plain; charset='. $di->config->get('charset'));
|
||||||
die($txt);
|
die($txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1825,7 +1837,8 @@ function meta_refresh ($url, $time = 5)
|
||||||
|
|
||||||
function redirect ($url)
|
function redirect ($url)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (headers_sent($filename, $linenum))
|
if (headers_sent($filename, $linenum))
|
||||||
{
|
{
|
||||||
|
@ -1838,11 +1851,11 @@ function redirect ($url)
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = trim($url);
|
$url = trim($url);
|
||||||
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
$server_protocol = ($di->config->get('cookie_secure')) ? 'https://' : 'http://';
|
||||||
|
|
||||||
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name']));
|
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($di->config->get('server_name')));
|
||||||
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : '';
|
$server_port = ($di->config->get('server_port') <> 80) ? ':' . trim($di->config->get('server_port')) : '';
|
||||||
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['script_path']));
|
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($di->config->get('script_path')));
|
||||||
|
|
||||||
if ($script_name)
|
if ($script_name)
|
||||||
{
|
{
|
||||||
|
@ -1969,7 +1982,7 @@ class log_action
|
||||||
|
|
||||||
function init ()
|
function init ()
|
||||||
{
|
{
|
||||||
global $lang, $bb_cfg;
|
global $lang;
|
||||||
|
|
||||||
foreach ($lang['LOG_ACTION']['LOG_TYPE'] as $log_type => $log_desc)
|
foreach ($lang['LOG_ACTION']['LOG_TYPE'] as $log_type => $log_desc)
|
||||||
{
|
{
|
||||||
|
@ -2029,9 +2042,12 @@ class log_action
|
||||||
|
|
||||||
function get_topic_icon ($topic, $is_unread = null)
|
function get_topic_icon ($topic, $is_unread = null)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $images;
|
global $images;
|
||||||
|
|
||||||
$t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']);
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$t_hot = ($topic['topic_replies'] >= $di->config->get('hot_threshold'));
|
||||||
$is_unread = is_null($is_unread) ? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']) : $is_unread;
|
$is_unread = is_null($is_unread) ? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']) : $is_unread;
|
||||||
|
|
||||||
if ($topic['topic_status'] == TOPIC_MOVED)
|
if ($topic['topic_status'] == TOPIC_MOVED)
|
||||||
|
@ -2142,8 +2158,10 @@ function get_poll_data_items_js ($topic_id)
|
||||||
|
|
||||||
function poll_is_active ($t_data)
|
function poll_is_active ($t_data)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days'] * 86400);
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $di->config->get('poll_max_days') * 86400);
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_confirmation ($tpl_vars)
|
function print_confirmation ($tpl_vars)
|
||||||
|
@ -2210,7 +2228,10 @@ function clean_title ($str, $replace_underscore = false)
|
||||||
|
|
||||||
function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false, $die_if_empty = false)
|
function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false, $die_if_empty = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$text = str_compact($text);
|
$text = str_compact($text);
|
||||||
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
||||||
|
@ -2223,7 +2244,7 @@ function clean_text_match ($text, $ltrim_star = true, $remove_stopwords = false,
|
||||||
$text = remove_stopwords($text);
|
$text = remove_stopwords($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['sphinx_enabled'])
|
if ($di->config->get('sphinx_enabled'))
|
||||||
{
|
{
|
||||||
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
|
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
|
||||||
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно)
|
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно)
|
||||||
|
@ -2279,19 +2300,22 @@ function log_sphinx_error ($err_type, $err_msg, $query = '')
|
||||||
|
|
||||||
function get_title_match_topics($search)
|
function get_title_match_topics($search)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $sphinx, $userdata, $lang;
|
global $sphinx, $userdata, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$where_ids = array();
|
$where_ids = array();
|
||||||
$forum_ids = (isset($search['ids']) && is_array($search['ids'])) ? array_diff($search['ids'], array(0 => 0)) : '';
|
$forum_ids = (isset($search['ids']) && is_array($search['ids'])) ? array_diff($search['ids'], array(0 => 0)) : '';
|
||||||
$title_match_sql = encode_text_match($search['query']);
|
$title_match_sql = encode_text_match($search['query']);
|
||||||
|
|
||||||
if ($bb_cfg['sphinx_enabled'])
|
if ($di->config->get('sphinx_enabled'))
|
||||||
{
|
{
|
||||||
init_sphinx();
|
init_sphinx();
|
||||||
|
|
||||||
$where = (isset($search['topic_match'])) ? 'topics' : 'posts';
|
$where = (isset($search['topic_match'])) ? 'topics' : 'posts';
|
||||||
|
|
||||||
$sphinx->SetServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
|
$sphinx->SetServer($di->config->get('sphinx_topic_titles_host'), $di->config->get('sphinx_topic_titles_port'));
|
||||||
if ($forum_ids)
|
if ($forum_ids)
|
||||||
{
|
{
|
||||||
$sphinx->SetFilter('forum_id', $forum_ids, false);
|
$sphinx->SetFilter('forum_id', $forum_ids, false);
|
||||||
|
@ -2323,7 +2347,7 @@ function get_title_match_topics($search)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$where_forum = ($forum_ids) ? "AND forum_id IN(" . join(',', $forum_ids) . ")" : '';
|
$where_forum = ($forum_ids) ? "AND forum_id IN(" . join(',', $forum_ids) . ")" : '';
|
||||||
$search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : '';
|
$search_bool_mode = ($di->config->get('allow_search_in_bool_mode')) ? ' IN BOOLEAN MODE' : '';
|
||||||
|
|
||||||
if (isset($search['topic_match']))
|
if (isset($search['topic_match']))
|
||||||
{
|
{
|
||||||
|
@ -2381,17 +2405,20 @@ function pad_with_space ($str)
|
||||||
|
|
||||||
function create_magnet ($infohash, $auth_key, $logged_in)
|
function create_magnet ($infohash, $auth_key, $logged_in)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $_GET, $images;
|
global $images;
|
||||||
|
|
||||||
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $di->config->get('bt_tor_browse_only_reg')) ? '' : "?{$di->config->get('passkey_key')}=$auth_key";
|
||||||
|
|
||||||
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['ocelot']['url'] .$auth_key. "/announce") .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
|
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($di->config->get('ocelot.url') .$auth_key. "/announce") .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['bt_announce_url'] . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
|
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($di->config->get('bt_announce_url') . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2450,7 +2477,10 @@ function send_pm ($user_id, $subject, $message, $poster_id = BOT_UID)
|
||||||
|
|
||||||
function profile_url ($data)
|
function profile_url ($data)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $datastore;
|
global $lang, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!$ranks = $datastore->get('ranks'))
|
if (!$ranks = $datastore->get('ranks'))
|
||||||
{
|
{
|
||||||
|
@ -2468,7 +2498,7 @@ function profile_url ($data)
|
||||||
if (empty($title)) $title = $lang['USER'];
|
if (empty($title)) $title = $lang['USER'];
|
||||||
if (empty($style)) $style = 'colorUser';
|
if (empty($style)) $style = 'colorUser';
|
||||||
|
|
||||||
if (!$bb_cfg['color_nick']) $style = '';
|
if (!$di->config->get('color_nick')) $style = '';
|
||||||
|
|
||||||
$username = !empty($data['username']) ? $data['username'] : $lang['GUEST'];
|
$username = !empty($data['username']) ? $data['username'] : $lang['GUEST'];
|
||||||
$user_id = (!empty($data['user_id']) && $username != $lang['GUEST']) ? $data['user_id'] : GUEST_UID;
|
$user_id = (!empty($data['user_id']) && $username != $lang['GUEST']) ? $data['user_id'] : GUEST_UID;
|
||||||
|
@ -2485,7 +2515,8 @@ function profile_url ($data)
|
||||||
|
|
||||||
function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $height = '', $width = '')
|
function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $height = '', $width = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($size)
|
if ($size)
|
||||||
{
|
{
|
||||||
|
@ -2495,11 +2526,11 @@ function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $hei
|
||||||
$height = ($height != '') ? 'height="'. $height .'"' : '';
|
$height = ($height != '') ? 'height="'. $height .'"' : '';
|
||||||
$width = ($width != '') ? 'width="'. $width .'"' : '';
|
$width = ($width != '') ? 'width="'. $width .'"' : '';
|
||||||
|
|
||||||
$user_avatar = '<img src="'. make_url($bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar']) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
$user_avatar = '<img src="'. make_url($di->config->get('avatars.upload_path') . $di->config->get('avatars.no_avatar')) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||||
|
|
||||||
if ($user_id == BOT_UID && $bb_cfg['avatars']['bot_avatar'])
|
if ($user_id == BOT_UID && $di->config->get('avatars.bot_avatar'))
|
||||||
{
|
{
|
||||||
$user_avatar = '<img src="'. make_url($bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['bot_avatar']) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
$user_avatar = '<img src="'. make_url($di->config->get('avatars.upload_path') . $di->config->get('avatars.bot_avatar')) .'" alt="'. $user_id .'" '. $height .' '. $width .' />';
|
||||||
}
|
}
|
||||||
else if ($allow_avatar && $ext_id)
|
else if ($allow_avatar && $ext_id)
|
||||||
{
|
{
|
||||||
|
@ -2514,9 +2545,12 @@ function get_avatar ($user_id, $ext_id, $allow_avatar = true, $size = true, $hei
|
||||||
|
|
||||||
function gender_image ($gender)
|
function gender_image ($gender)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $images;
|
global $lang, $images;
|
||||||
|
|
||||||
if (!$bb_cfg['gender'])
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if (!$di->config->get('gender'))
|
||||||
{
|
{
|
||||||
$user_gender = '';
|
$user_gender = '';
|
||||||
return $user_gender;
|
return $user_gender;
|
||||||
|
|
|
@ -714,7 +714,10 @@ function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
|
||||||
|
|
||||||
function user_delete ($user_id, $delete_posts = false)
|
function user_delete ($user_id, $delete_posts = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $log_action;
|
global $log_action;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!$user_csv = get_id_csv($user_id))
|
if (!$user_csv = get_id_csv($user_id))
|
||||||
{
|
{
|
||||||
|
@ -801,7 +804,7 @@ function user_delete ($user_id, $delete_posts = false)
|
||||||
// Delete user feed
|
// Delete user feed
|
||||||
foreach (explode(',', $user_csv) as $user_id)
|
foreach (explode(',', $user_csv) as $user_id)
|
||||||
{
|
{
|
||||||
$file_path = $bb_cfg['atom']['path'] .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
$file_path = $di->config->get('atom.path') .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
||||||
unlink($file_path);
|
unlink($file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
function run_jobs($jobs)
|
function run_jobs($jobs)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $tr_cfg, $datastore;
|
global $tr_cfg, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
define('IN_CRON', true);
|
define('IN_CRON', true);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,10 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
function update_forum_feed ($forum_id, $forum_data)
|
function update_forum_feed ($forum_id, $forum_data)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$file_path = $bb_cfg['atom']['path'] .'/f/'. $forum_id .'.atom';
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$file_path = $di->config->get('atom.path') .'/f/'. $forum_id .'.atom';
|
||||||
$select_tor_sql = $join_tor_sql = '';
|
$select_tor_sql = $join_tor_sql = '';
|
||||||
if ($forum_id == 0) $forum_data['atom_forum_name'] = 'Общая по всем разделам';
|
if ($forum_id == 0) $forum_data['atom_forum_name'] = 'Общая по всем разделам';
|
||||||
if ($forum_id > 0 && $forum_data['atom_tr_allowed'])
|
if ($forum_id > 0 && $forum_data['atom_tr_allowed'])
|
||||||
|
@ -63,7 +65,7 @@ function update_forum_feed ($forum_id, $forum_data)
|
||||||
}
|
}
|
||||||
if (isset($topic['tor_status']))
|
if (isset($topic['tor_status']))
|
||||||
{
|
{
|
||||||
if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) continue;
|
if ($di->config->get('tor_frozen.' . $topic['tor_status'])) continue;
|
||||||
}
|
}
|
||||||
$topics[] = $topic;
|
$topics[] = $topic;
|
||||||
}
|
}
|
||||||
|
@ -78,8 +80,10 @@ function update_forum_feed ($forum_id, $forum_data)
|
||||||
|
|
||||||
function update_user_feed ($user_id, $username)
|
function update_user_feed ($user_id, $username)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$file_path = $bb_cfg['atom']['path'] .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$file_path = $di->config->get('atom.path') .'/u/'. floor($user_id/5000) .'/'. ($user_id % 100) .'/'. $user_id .'.atom';
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
t.topic_id, t.topic_title, t.topic_status,
|
t.topic_id, t.topic_title, t.topic_status,
|
||||||
|
@ -106,7 +110,7 @@ function update_user_feed ($user_id, $username)
|
||||||
}
|
}
|
||||||
if (isset($topic['tor_status']))
|
if (isset($topic['tor_status']))
|
||||||
{
|
{
|
||||||
if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) continue;
|
if ($di->config->get('tor_frozen.' . $topic['tor_status'])) continue;
|
||||||
}
|
}
|
||||||
$topics[] = $topic;
|
$topics[] = $topic;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +125,9 @@ function update_user_feed ($user_id, $username)
|
||||||
|
|
||||||
function create_atom ($file_path, $mode, $id, $title, $topics)
|
function create_atom ($file_path, $mode, $id, $title, $topics)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$dir = dirname($file_path);
|
$dir = dirname($file_path);
|
||||||
if (!file_exists($dir))
|
if (!file_exists($dir))
|
||||||
{
|
{
|
||||||
|
@ -137,11 +143,11 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
|
||||||
}
|
}
|
||||||
$atom = "";
|
$atom = "";
|
||||||
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
|
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
|
||||||
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://". $bb_cfg['server_name'] . $bb_cfg['script_path'] ."\">\n";
|
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://". $di->config->get('server_name') . $di->config->get('script_path') ."\">\n";
|
||||||
$atom .= "<title>$title</title>\n";
|
$atom .= "<title>$title</title>\n";
|
||||||
$atom .= "<updated>". $date ."T$time+00:00</updated>\n";
|
$atom .= "<updated>". $date ."T$time+00:00</updated>\n";
|
||||||
$atom .= "<id>tag:rto.feed,2000:/$mode/$id</id>\n";
|
$atom .= "<id>tag:rto.feed,2000:/$mode/$id</id>\n";
|
||||||
$atom .= "<link href=\"http://". $bb_cfg['server_name'] . $bb_cfg['script_path'] ."\" />\n";
|
$atom .= "<link href=\"http://". $di->config->get('server_name') . $di->config->get('script_path') ."\" />\n";
|
||||||
foreach ($topics as $topic)
|
foreach ($topics as $topic)
|
||||||
{
|
{
|
||||||
$topic_id = $topic['topic_id'];
|
$topic_id = $topic['topic_id'];
|
||||||
|
|
|
@ -7,7 +7,10 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
//
|
//
|
||||||
function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message)
|
function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $user, $userdata, $lang;
|
global $user, $userdata, $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// Check username
|
// Check username
|
||||||
if (!empty($username))
|
if (!empty($username))
|
||||||
|
@ -50,12 +53,12 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check smilies limit
|
// Check smilies limit
|
||||||
if ($bb_cfg['max_smilies'])
|
if ($di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $di->config->get('smilies_path'));
|
||||||
if ($count_smilies > $bb_cfg['max_smilies'])
|
if ($count_smilies > $di->config->get('max_smilies'))
|
||||||
{
|
{
|
||||||
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']);
|
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $di->config->get('max_smilies'));
|
||||||
$error_msg .= (!empty($error_msg)) ? '<br />'. $to_many_smilies : $to_many_smilies;
|
$error_msg .= (!empty($error_msg)) ? '<br />'. $to_many_smilies : $to_many_smilies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +74,10 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
|
||||||
//
|
//
|
||||||
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_rg_sig)
|
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_rg_sig)
|
||||||
{
|
{
|
||||||
global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore;
|
global $userdata, $post_info, $is_auth, $lang, $datastore;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$current_time = TIMENOW;
|
$current_time = TIMENOW;
|
||||||
|
|
||||||
|
@ -87,7 +93,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
{
|
{
|
||||||
if ($userdata['user_level'] == USER)
|
if ($userdata['user_level'] == USER)
|
||||||
{
|
{
|
||||||
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval'])
|
if (TIMENOW - $row['last_post_time'] < $di->config->get('flood_interval'))
|
||||||
{
|
{
|
||||||
bb_die($lang['FLOOD_ERROR']);
|
bb_die($lang['FLOOD_ERROR']);
|
||||||
}
|
}
|
||||||
|
@ -193,20 +199,20 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||||
));
|
));
|
||||||
|
|
||||||
//Обновление кеша новостей на главной
|
//Обновление кеша новостей на главной
|
||||||
if($bb_cfg['show_latest_news'])
|
if($di->config->get('show_latest_news'))
|
||||||
{
|
{
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', $di->config->get('latest_news_forum_id')));
|
||||||
if(isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $mode == 'newtopic')
|
if(isset($news_forums[$forum_id]) && $di->config->get('show_latest_news') && $mode == 'newtopic')
|
||||||
{
|
{
|
||||||
$datastore->enqueue('latest_news');
|
$datastore->enqueue('latest_news');
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bb_cfg['show_network_news'])
|
if($di->config->get('show_network_news'))
|
||||||
{
|
{
|
||||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
$net_forums = array_flip(explode(',', $di->config->get('network_news_forum_id')));
|
||||||
if(isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $mode == 'newtopic')
|
if(isset($net_forums[$forum_id]) && $di->config->get('show_network_news') && $mode == 'newtopic')
|
||||||
{
|
{
|
||||||
$datastore->enqueue('network_news');
|
$datastore->enqueue('network_news');
|
||||||
$datastore->update('network_news');
|
$datastore->update('network_news');
|
||||||
|
@ -334,9 +340,12 @@ function delete_post($mode, $post_data, &$message, &$meta, $forum_id, $topic_id,
|
||||||
//
|
//
|
||||||
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user)
|
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $lang, $userdata;
|
||||||
|
|
||||||
if (!$bb_cfg['topic_notify_enabled'])
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if (!$di->config->get('topic_notify_enabled'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +377,7 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
|
||||||
if ($watch_list)
|
if ($watch_list)
|
||||||
{
|
{
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$orig_word = $replacement_word = array();
|
$orig_word = $replacement_word = array();
|
||||||
obtain_word_list($orig_word, $replacement_word);
|
obtain_word_list($orig_word, $replacement_word);
|
||||||
|
@ -383,13 +392,13 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
|
||||||
|
|
||||||
foreach ($watch_list as $row)
|
foreach ($watch_list as $row)
|
||||||
{
|
{
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
$emailer->email_address($row['username'] ." <{$row['user_email']}>");
|
||||||
$emailer->use_template('topic_notify', $row['user_lang']);
|
$emailer->use_template('topic_notify', $row['user_lang']);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'TOPIC_TITLE' => html_entity_decode($topic_title),
|
'TOPIC_TITLE' => html_entity_decode($topic_title),
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'USERNAME' => $row['username'],
|
'USERNAME' => $row['username'],
|
||||||
'U_TOPIC' => $u_topic,
|
'U_TOPIC' => $u_topic,
|
||||||
'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
|
'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
|
||||||
|
|
|
@ -2,42 +2,36 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
//
|
|
||||||
// Languages
|
// Languages
|
||||||
//
|
function language_select($default_lang, $select_name = 'language')
|
||||||
function language_select ($default_lang, $select_name = 'language')
|
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$lang_select = '<select name="'. $select_name .'">';
|
$lang_select = '<select name="' . $select_name . '">';
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($bb_cfg['lang'] as $key => $data)
|
foreach ($di->config->get('lang') as $key => $data) {
|
||||||
{
|
|
||||||
$selected = '';
|
$selected = '';
|
||||||
if ($key == $default_lang) $selected = ' selected="selected"';
|
if ($key == $default_lang) $selected = ' selected="selected"';
|
||||||
$lang_select .= '<option value="'. $key .'"'. $selected .'>'. $data['name'] .'</option>';
|
$lang_select .= '<option value="' . $key . '"' . $selected . '>' . $data['name'] . '</option>';
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
$lang_select .= '</select>';
|
$lang_select .= '</select>';
|
||||||
return ($x > 1) ? $lang_select : reset($bb_cfg['lang'])['name'];
|
return ($x > 1) ? $lang_select : $di->config->get('lang')->ru;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Pick a timezone
|
// Pick a timezone
|
||||||
//
|
function tz_select($default, $select_name = 'timezone')
|
||||||
function tz_select ($default, $select_name = 'timezone')
|
|
||||||
{
|
{
|
||||||
global $sys_timezone, $lang;
|
global $sys_timezone, $lang;
|
||||||
|
|
||||||
if (!isset($default))
|
if (!isset($default)) {
|
||||||
{
|
$default = $sys_timezone;
|
||||||
$default == $sys_timezone;
|
|
||||||
}
|
}
|
||||||
$tz_select = '<select name="' . $select_name . '">';
|
$tz_select = '<select name="' . $select_name . '">';
|
||||||
|
|
||||||
while( list($offset, $zone) = each($lang['TZ']) )
|
while (list($offset, $zone) = each($lang['TZ'])) {
|
||||||
{
|
$selected = ($offset == $default) ? ' selected="selected"' : '';
|
||||||
$selected = ( $offset == $default ) ? ' selected="selected"' : '';
|
|
||||||
$tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
|
$tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
|
||||||
}
|
}
|
||||||
$tz_select .= '</select>';
|
$tz_select .= '</select>';
|
||||||
|
@ -45,22 +39,20 @@ function tz_select ($default, $select_name = 'timezone')
|
||||||
return $tz_select;
|
return $tz_select;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Templates
|
// Templates
|
||||||
//
|
function templates_select($default_style, $select_name = 'tpl_name')
|
||||||
function templates_select ($default_style, $select_name = 'tpl_name')
|
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$templates_select = '<select name="'. $select_name .'">';
|
$templates_select = '<select name="' . $select_name . '">';
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($bb_cfg['templates'] as $folder => $name)
|
foreach ($di->config->get('templates') as $folder => $name) {
|
||||||
{
|
|
||||||
$selected = '';
|
$selected = '';
|
||||||
if ($folder == $default_style) $selected = ' selected="selected"';
|
if ($folder == $default_style) $selected = ' selected="selected"';
|
||||||
$templates_select .= '<option value="'. $folder .'"'. $selected .'>'. $name .'</option>';
|
$templates_select .= '<option value="' . $folder . '"' . $selected . '>' . $name . '</option>';
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
$templates_select .= '</select>';
|
$templates_select .= '</select>';
|
||||||
return ($x > 1) ? $templates_select : reset($bb_cfg['templates']);
|
return ($x > 1) ? $templates_select : $di->config->get('templates')->default;
|
||||||
}
|
}
|
|
@ -22,7 +22,10 @@ function torrent_auth_check ($forum_id, $poster_id)
|
||||||
|
|
||||||
function tracker_unregister ($topic_id, $redirect_url = '')
|
function tracker_unregister ($topic_id, $redirect_url = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $log_action;
|
global $lang, $log_action;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$tor = DB()->fetch_row("
|
$tor = DB()->fetch_row("
|
||||||
SELECT forum_id, tor_status FROM ". BB_BT_TORRENTS ." WHERE topic_id = ". intval($topic_id) ." LIMIT 1
|
SELECT forum_id, tor_status FROM ". BB_BT_TORRENTS ." WHERE topic_id = ". intval($topic_id) ." LIMIT 1
|
||||||
|
@ -64,13 +67,13 @@ function tracker_unregister ($topic_id, $redirect_url = '')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset DL-type for topic
|
// Unset DL-type for topic
|
||||||
if ($bb_cfg['bt_unset_dltype_on_tor_unreg'] && $topic_id)
|
if ($di->config->get('bt_unset_dltype_on_tor_unreg') && $topic_id)
|
||||||
{
|
{
|
||||||
DB()->query("UPDATE ". BB_TOPICS ." SET tracker_status = 0 WHERE topic_id = $topic_id LIMIT 1");
|
DB()->query("UPDATE ". BB_TOPICS ." SET tracker_status = 0 WHERE topic_id = $topic_id LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ocelot
|
// Ocelot
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
if ($row = DB()->fetch_row("SELECT info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1"))
|
if ($row = DB()->fetch_row("SELECT info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1"))
|
||||||
{
|
{
|
||||||
|
@ -122,7 +125,10 @@ function torrent_cp_close ($topic_id, $forum_id)
|
||||||
|
|
||||||
function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED, $reg_time = TIMENOW)
|
function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED, $reg_time = TIMENOW)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $reg_mode;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$reg_mode = $mode;
|
$reg_mode = $mode;
|
||||||
|
|
||||||
|
@ -163,7 +169,7 @@ function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED
|
||||||
return torrent_error_exit($lang['TORFILE_INVALID']);
|
return torrent_error_exit($lang['TORFILE_INVALID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['bt_disable_dht'])
|
if ($di->config->get('bt_disable_dht'))
|
||||||
{
|
{
|
||||||
$tor_decoded['info']['private'] = (int) 1;
|
$tor_decoded['info']['private'] = (int) 1;
|
||||||
$fp = fopen($filename, 'w+');
|
$fp = fopen($filename, 'w+');
|
||||||
|
@ -183,7 +189,7 @@ function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED
|
||||||
$info_hash_md5 = md5($info_hash);
|
$info_hash_md5 = md5($info_hash);
|
||||||
|
|
||||||
// Ocelot
|
// Ocelot
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
ocelot_update_tracker('add_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0));
|
ocelot_update_tracker('add_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0));
|
||||||
}
|
}
|
||||||
|
@ -279,7 +285,10 @@ function change_tor_status ($topic_id, $tor_status)
|
||||||
// Set gold / silver type for torrent
|
// Set gold / silver type for torrent
|
||||||
function change_tor_type ($topic_id, $tor_status_gold)
|
function change_tor_type ($topic_id, $tor_status_gold)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (!IS_AM) bb_die($lang['ONLY_FOR_MOD']);
|
if (!IS_AM) bb_die($lang['ONLY_FOR_MOD']);
|
||||||
|
|
||||||
|
@ -289,7 +298,7 @@ function change_tor_type ($topic_id, $tor_status_gold)
|
||||||
DB()->query("UPDATE ". BB_BT_TORRENTS ." SET tor_type = $tor_status_gold WHERE topic_id = $topic_id LIMIT 1");
|
DB()->query("UPDATE ". BB_BT_TORRENTS ." SET tor_type = $tor_status_gold WHERE topic_id = $topic_id LIMIT 1");
|
||||||
|
|
||||||
// Ocelot
|
// Ocelot
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
if ($row = DB()->fetch_row("SELECT info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1"))
|
if ($row = DB()->fetch_row("SELECT info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1"))
|
||||||
{
|
{
|
||||||
|
@ -301,7 +310,10 @@ function change_tor_type ($topic_id, $tor_status_gold)
|
||||||
|
|
||||||
function send_torrent_with_passkey ($t_data)
|
function send_torrent_with_passkey ($t_data)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $tr_cfg, $userdata;
|
global $lang, $tr_cfg, $userdata;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$topic_id = $t_data['topic_id'];
|
$topic_id = $t_data['topic_id'];
|
||||||
$poster_id = $t_data['topic_poster'];
|
$poster_id = $t_data['topic_poster'];
|
||||||
|
@ -314,7 +326,7 @@ function send_torrent_with_passkey ($t_data)
|
||||||
{
|
{
|
||||||
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
|
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
|
||||||
}
|
}
|
||||||
else if (isset($bb_cfg['tor_frozen'][$row['tor_status']]))
|
elseif ($di->config->get('tor_frozen.' . $row['tor_status']))
|
||||||
{
|
{
|
||||||
if (!IS_AM) bb_die("Раздача имеет статус: <b>{$lang['TOR_STATUS_NAME'][$row['tor_status']]}</b><br /><br />Скачивание запрещено"); //TODO: перевести
|
if (!IS_AM) bb_die("Раздача имеет статус: <b>{$lang['TOR_STATUS_NAME'][$row['tor_status']]}</b><br /><br />Скачивание запрещено"); //TODO: перевести
|
||||||
}
|
}
|
||||||
|
@ -332,7 +344,7 @@ function send_torrent_with_passkey ($t_data)
|
||||||
{
|
{
|
||||||
bb_simple_die('Could not generate passkey');
|
bb_simple_die('Could not generate passkey');
|
||||||
}
|
}
|
||||||
elseif ($bb_cfg['ocelot']['enabled'])
|
elseif ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
ocelot_update_tracker('add_user', array('id' => $user_id ,'passkey' => $passkey_val));
|
ocelot_update_tracker('add_user', array('id' => $user_id ,'passkey' => $passkey_val));
|
||||||
}
|
}
|
||||||
|
@ -340,7 +352,7 @@ function send_torrent_with_passkey ($t_data)
|
||||||
|
|
||||||
// Ratio limit for torrents dl
|
// Ratio limit for torrents dl
|
||||||
$user_ratio = get_bt_ratio($bt_userdata);
|
$user_ratio = get_bt_ratio($bt_userdata);
|
||||||
$min_ratio = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
$min_ratio = $di->config->get('bt_min_ratio_allow_dl_tor');
|
||||||
|
|
||||||
if ($min_ratio && $user_id != $poster_id && !is_null($user_ratio))
|
if ($min_ratio && $user_id != $poster_id && !is_null($user_ratio))
|
||||||
{
|
{
|
||||||
|
@ -417,16 +429,16 @@ function send_torrent_with_passkey ($t_data)
|
||||||
unset($tor['nodes']);
|
unset($tor['nodes']);
|
||||||
|
|
||||||
// Announce URL
|
// Announce URL
|
||||||
$announce = $bb_cfg['ocelot']['enabled'] ? strval($bb_cfg['ocelot']['url'] .$passkey_val. "/announce") : strval($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$passkey_val");
|
$announce = $di->config->get('ocelot.enabled') ? strval($di->config->get('ocelot.url') .$passkey_val. "/announce") : strval($di->config->get('bt_announce_url') . "?{$di->config->get('passkey_key')}=$passkey_val");
|
||||||
|
|
||||||
// Replace original announce url with tracker default
|
// Replace original announce url with tracker default
|
||||||
if ($bb_cfg['bt_replace_ann_url'] || !isset($tor['announce']))
|
if ($di->config->get('bt_replace_ann_url') || !isset($tor['announce']))
|
||||||
{
|
{
|
||||||
$tor['announce'] = $announce;
|
$tor['announce'] = $announce;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all additional urls
|
// Delete all additional urls
|
||||||
if ($bb_cfg['bt_del_addit_ann_urls'] || $bb_cfg['bt_disable_dht'])
|
if ($di->config->get('bt_del_addit_ann_urls') || $di->config->get('bt_disable_dht'))
|
||||||
{
|
{
|
||||||
unset($tor['announce-list']);
|
unset($tor['announce-list']);
|
||||||
}
|
}
|
||||||
|
@ -455,7 +467,7 @@ function send_torrent_with_passkey ($t_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add publisher & topic url
|
// Add publisher & topic url
|
||||||
$publisher_name = $bb_cfg['server_name'];
|
$publisher_name = $di->config->get('server_name');
|
||||||
$publisher_url = make_url(TOPIC_URL . $topic_id);
|
$publisher_url = make_url(TOPIC_URL . $topic_id);
|
||||||
|
|
||||||
$tor['publisher'] = strval($publisher_name);
|
$tor['publisher'] = strval($publisher_name);
|
||||||
|
@ -469,7 +481,7 @@ function send_torrent_with_passkey ($t_data)
|
||||||
|
|
||||||
// Send torrent
|
// Send torrent
|
||||||
$output = \Rych\Bencode\Bencode::encode($tor);
|
$output = \Rych\Bencode\Bencode::encode($tor);
|
||||||
$dl_fname = '['.$bb_cfg['server_name'].'].t' . $topic_id . '.torrent';
|
$dl_fname = '['.$di->config->get('server_name').'].t' . $topic_id . '.torrent';
|
||||||
|
|
||||||
if (!empty($_COOKIE['explain']))
|
if (!empty($_COOKIE['explain']))
|
||||||
{
|
{
|
||||||
|
@ -487,7 +499,10 @@ function send_torrent_with_passkey ($t_data)
|
||||||
|
|
||||||
function generate_passkey ($user_id, $force_generate = false)
|
function generate_passkey ($user_id, $force_generate = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$user_id = (int) $user_id;
|
$user_id = (int) $user_id;
|
||||||
|
|
||||||
|
@ -535,7 +550,7 @@ function generate_passkey ($user_id, $force_generate = false)
|
||||||
if (DB()->affected_rows() == 1)
|
if (DB()->affected_rows() == 1)
|
||||||
{
|
{
|
||||||
// Ocelot
|
// Ocelot
|
||||||
if ($bb_cfg['ocelot']['enabled'])
|
if ($di->config->get('ocelot.enabled'))
|
||||||
{
|
{
|
||||||
ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey,'newpasskey' => $passkey_val));
|
ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey,'newpasskey' => $passkey_val));
|
||||||
}
|
}
|
||||||
|
@ -580,9 +595,10 @@ function tracker_rm_user ($user_id)
|
||||||
|
|
||||||
function ocelot_update_tracker ($action, $updates)
|
function ocelot_update_tracker ($action, $updates)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$get = $bb_cfg['ocelot']['secret'] . "/update?action=$action";
|
$get = $di->config->get('ocelot.secret') . "/update?action=$action";
|
||||||
|
|
||||||
foreach ($updates as $key => $value)
|
foreach ($updates as $key => $value)
|
||||||
{
|
{
|
||||||
|
@ -602,7 +618,8 @@ function ocelot_update_tracker ($action, $updates)
|
||||||
|
|
||||||
function ocelot_send_request ($get, $max_attempts = 1, &$err = false)
|
function ocelot_send_request ($get, $max_attempts = 1, &$err = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$header = "GET /$get HTTP/1.1\r\nConnection: Close\r\n\r\n";
|
$header = "GET /$get HTTP/1.1\r\nConnection: Close\r\n\r\n";
|
||||||
$attempts = $sleep = $success = $response = 0;
|
$attempts = $sleep = $success = $response = 0;
|
||||||
|
@ -616,7 +633,7 @@ function ocelot_send_request ($get, $max_attempts = 1, &$err = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send request
|
// Send request
|
||||||
$file = fsockopen($bb_cfg['ocelot']['host'], $bb_cfg['ocelot']['port'], $error_num, $error_string);
|
$file = fsockopen($di->config->get('ocelot.host'), $di->config->get('ocelot.port'), $error_num, $error_string);
|
||||||
if ($file)
|
if ($file)
|
||||||
{
|
{
|
||||||
if (fwrite($file, $header) === false)
|
if (fwrite($file, $header) === false)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class upload_common
|
||||||
var $file_ext = '';
|
var $file_ext = '';
|
||||||
var $file_ext_id = '';
|
var $file_ext_id = '';
|
||||||
var $file_size = '';
|
var $file_size = '';
|
||||||
var $ext_ids = array(); // array_flip($bb_cfg['file_id_ext'])
|
var $ext_ids = array(); // array_flip($di->config->get('file_id_ext'))
|
||||||
var $errors = array();
|
var $errors = array();
|
||||||
var $img_types = array(
|
var $img_types = array(
|
||||||
1 => 'gif',
|
1 => 'gif',
|
||||||
|
@ -36,7 +36,10 @@ class upload_common
|
||||||
|
|
||||||
function init ($cfg = array(), $post_params = array(), $uploaded_only = true)
|
function init ($cfg = array(), $post_params = array(), $uploaded_only = true)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$this->cfg = array_merge($this->cfg, $cfg);
|
$this->cfg = array_merge($this->cfg, $cfg);
|
||||||
$this->file = $post_params;
|
$this->file = $post_params;
|
||||||
|
@ -73,7 +76,7 @@ class upload_common
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// get ext
|
// get ext
|
||||||
$this->ext_ids = array_flip($bb_cfg['file_id_ext']);
|
$this->ext_ids = array_flip($di->config->get('file_id_ext'));
|
||||||
$file_name_ary = explode('.', $this->file['name']);
|
$file_name_ary = explode('.', $this->file['name']);
|
||||||
$this->file_ext = strtolower(end($file_name_ary));
|
$this->file_ext = strtolower(end($file_name_ary));
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ if (!defined('BB_CFG_LOADED')) trigger_error('File config.php not loaded', E_USE
|
||||||
|
|
||||||
if (PHP_VERSION < '5.5') die('TorrentPier requires PHP version 5.5 and above (ZF requirement). Your PHP version is '. PHP_VERSION);
|
if (PHP_VERSION < '5.5') die('TorrentPier requires PHP version 5.5 and above (ZF requirement). Your PHP version is '. PHP_VERSION);
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// Define some basic configuration arrays
|
// Define some basic configuration arrays
|
||||||
unset($stopwords, $synonyms_match, $synonyms_replace);
|
unset($stopwords, $synonyms_match, $synonyms_replace);
|
||||||
$userdata = $theme = $images = $lang = $nav_links = $bf = [];
|
$userdata = $theme = $images = $lang = $nav_links = $bf = [];
|
||||||
|
@ -27,9 +30,10 @@ define('UA_GZIP_SUPPORTED', (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($
|
||||||
|
|
||||||
function compress_output ($contents)
|
function compress_output ($contents)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($bb_cfg['gzip_compress'] && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
|
if ($di->config->get('gzip_compress') && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
|
||||||
{
|
{
|
||||||
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000)
|
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +52,7 @@ if (!defined('IN_AJAX'))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cookie params
|
// Cookie params
|
||||||
$c = $bb_cfg['cookie_prefix'];
|
$c = $di->config->get('cookie_prefix');
|
||||||
define('COOKIE_DATA', $c .'data');
|
define('COOKIE_DATA', $c .'data');
|
||||||
define('COOKIE_FORUM', $c .'f');
|
define('COOKIE_FORUM', $c .'f');
|
||||||
define('COOKIE_MARK', $c .'mark_read');
|
define('COOKIE_MARK', $c .'mark_read');
|
||||||
|
@ -64,8 +68,10 @@ define('COOKIE_MAX_TRACKS', 90);
|
||||||
|
|
||||||
function bb_setcookie ($name, $val, $lifetime = COOKIE_PERSIST, $httponly = false)
|
function bb_setcookie ($name, $val, $lifetime = COOKIE_PERSIST, $httponly = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
return setcookie($name, $val, $lifetime, $bb_cfg['script_path'], $bb_cfg['cookie_domain'], $bb_cfg['cookie_secure'], $httponly);
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
return setcookie($name, $val, $lifetime, $di->config->get('script_path'), $di->config->get('cookie_domain'), $di->config->get('cookie_secure'), $httponly);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug options
|
// Debug options
|
||||||
|
@ -163,75 +169,6 @@ define('POLL_FINISHED', 2);
|
||||||
// Group avatars
|
// Group avatars
|
||||||
define('GROUP_AVATAR_MASK', 999000);
|
define('GROUP_AVATAR_MASK', 999000);
|
||||||
|
|
||||||
// Torrents (reserved: -1)
|
|
||||||
define('TOR_NOT_APPROVED', 0); // не проверено
|
|
||||||
define('TOR_CLOSED', 1); // закрыто
|
|
||||||
define('TOR_APPROVED', 2); // проверено
|
|
||||||
define('TOR_NEED_EDIT', 3); // недооформлено
|
|
||||||
define('TOR_NO_DESC', 4); // неоформлено
|
|
||||||
define('TOR_DUP', 5); // повтор
|
|
||||||
define('TOR_CLOSED_CPHOLD', 6); // закрыто правообладателем
|
|
||||||
define('TOR_CONSUMED', 7); // поглощено
|
|
||||||
define('TOR_DOUBTFUL', 8); // сомнительно
|
|
||||||
define('TOR_CHECKING', 9); // проверяется
|
|
||||||
define('TOR_TMP', 10); // временная
|
|
||||||
define('TOR_PREMOD', 11); // премодерация
|
|
||||||
|
|
||||||
$bb_cfg['tor_icons'] = array(
|
|
||||||
TOR_NOT_APPROVED => '<span class="tor-icon tor-not-approved">*</span>',
|
|
||||||
TOR_CLOSED => '<span class="tor-icon tor-closed">x</span>',
|
|
||||||
TOR_APPROVED => '<span class="tor-icon tor-approved">√</span>',
|
|
||||||
TOR_NEED_EDIT => '<span class="tor-icon tor-need-edit">?</span>',
|
|
||||||
TOR_NO_DESC => '<span class="tor-icon tor-no-desc">!</span>',
|
|
||||||
TOR_DUP => '<span class="tor-icon tor-dup">D</span>',
|
|
||||||
TOR_CLOSED_CPHOLD => '<span class="tor-icon tor-closed-cp">©</span>',
|
|
||||||
TOR_CONSUMED => '<span class="tor-icon tor-consumed">∑</span>',
|
|
||||||
TOR_DOUBTFUL => '<span class="tor-icon tor-approved">#</span>',
|
|
||||||
TOR_CHECKING => '<span class="tor-icon tor-checking">%</span>',
|
|
||||||
TOR_TMP => '<span class="tor-icon tor-dup">T</span>',
|
|
||||||
TOR_PREMOD => '<span class="tor-icon tor-dup">∏</span>',
|
|
||||||
);
|
|
||||||
|
|
||||||
// Запрет на скачивание
|
|
||||||
$bb_cfg['tor_frozen'] = array(
|
|
||||||
TOR_CHECKING => true,
|
|
||||||
TOR_CLOSED => true,
|
|
||||||
TOR_CLOSED_CPHOLD => true,
|
|
||||||
TOR_CONSUMED => true,
|
|
||||||
TOR_DUP => true,
|
|
||||||
TOR_NO_DESC => true,
|
|
||||||
TOR_PREMOD => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Разрешение на скачку автором, если закрыто на скачивание.
|
|
||||||
$bb_cfg['tor_frozen_author_download'] = array(
|
|
||||||
TOR_CHECKING => true,
|
|
||||||
TOR_NO_DESC => true,
|
|
||||||
TOR_PREMOD => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Запрет на редактирование головного сообщения
|
|
||||||
$bb_cfg['tor_cannot_edit'] = array(
|
|
||||||
TOR_CHECKING => true,
|
|
||||||
TOR_CLOSED => true,
|
|
||||||
TOR_CONSUMED => true,
|
|
||||||
TOR_DUP => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
|
|
||||||
$bb_cfg['tor_cannot_new'] = array(TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL);
|
|
||||||
|
|
||||||
// Разрешение на ответ релизера, если раздача исправлена.
|
|
||||||
$bb_cfg['tor_reply'] = array(TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL);
|
|
||||||
|
|
||||||
// Если такой статус у релиза, то статистика раздачи будет скрыта
|
|
||||||
$bb_cfg['tor_no_tor_act'] = array(
|
|
||||||
TOR_CLOSED => true,
|
|
||||||
TOR_DUP => true,
|
|
||||||
TOR_CLOSED_CPHOLD => true,
|
|
||||||
TOR_CONSUMED => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Table names
|
// Table names
|
||||||
define('BUF_TOPIC_VIEW', 'buf_topic_view');
|
define('BUF_TOPIC_VIEW', 'buf_topic_view');
|
||||||
define('BUF_LAST_SEEDER', 'buf_last_seeder');
|
define('BUF_LAST_SEEDER', 'buf_last_seeder');
|
||||||
|
@ -288,11 +225,11 @@ define('CAT_URL', 'index.php?c=');
|
||||||
define('DOWNLOAD_URL', 'dl.php?t=');
|
define('DOWNLOAD_URL', 'dl.php?t=');
|
||||||
define('FORUM_URL', 'viewforum.php?f=');
|
define('FORUM_URL', 'viewforum.php?f=');
|
||||||
define('GROUP_URL', 'group.php?g=');
|
define('GROUP_URL', 'group.php?g=');
|
||||||
define('LOGIN_URL', $bb_cfg['login_url']);
|
define('LOGIN_URL', $di->config->get('login_url'));
|
||||||
define('MODCP_URL', 'modcp.php?f=');
|
define('MODCP_URL', 'modcp.php?f=');
|
||||||
define('PM_URL', $bb_cfg['pm_url']);
|
define('PM_URL', $di->config->get('pm_url'));
|
||||||
define('POST_URL', 'viewtopic.php?p=');
|
define('POST_URL', 'viewtopic.php?p=');
|
||||||
define('POSTING_URL', $bb_cfg['posting_url']);
|
define('POSTING_URL', $di->config->get('posting_url'));
|
||||||
define('PROFILE_URL', 'profile.php?mode=viewprofile&u=');
|
define('PROFILE_URL', 'profile.php?mode=viewprofile&u=');
|
||||||
define('BONUS_URL', 'profile.php?mode=bonus');
|
define('BONUS_URL', 'profile.php?mode=bonus');
|
||||||
define('TOPIC_URL', 'viewtopic.php?t=');
|
define('TOPIC_URL', 'viewtopic.php?t=');
|
||||||
|
@ -356,31 +293,6 @@ function bb_exit ($output = '')
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prn_r ($var, $title = '', $print = true)
|
|
||||||
{
|
|
||||||
$r = '<pre>'. (($title) ? "<b>$title</b>\n\n" : '') . htmlspecialchars(print_r($var, true)) .'</pre>';
|
|
||||||
if ($print) echo $r;
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pre ($var, $title = '', $print = true)
|
|
||||||
{
|
|
||||||
prn_r($var, $title, $print);
|
|
||||||
}
|
|
||||||
|
|
||||||
function prn ()
|
|
||||||
{
|
|
||||||
if (!DBG_USER) return;
|
|
||||||
foreach (func_get_args() as $var) prn_r($var);
|
|
||||||
}
|
|
||||||
|
|
||||||
function vdump ($var, $title = '')
|
|
||||||
{
|
|
||||||
echo '<pre>'. (($title) ? "<b>$title</b>\n\n" : '');
|
|
||||||
var_dump($var);
|
|
||||||
echo '</pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function htmlCHR ($txt, $double_encode = false, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
|
function htmlCHR ($txt, $double_encode = false, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
|
||||||
{
|
{
|
||||||
return (string) htmlspecialchars($txt, $quote_style, $charset, $double_encode);
|
return (string) htmlspecialchars($txt, $quote_style, $charset, $double_encode);
|
||||||
|
@ -401,8 +313,6 @@ require(INC_DIR .'sessions.php');
|
||||||
require(INC_DIR .'template.php');
|
require(INC_DIR .'template.php');
|
||||||
require(CORE_DIR .'mysql.php');
|
require(CORE_DIR .'mysql.php');
|
||||||
|
|
||||||
$bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg);
|
|
||||||
|
|
||||||
$user = new user_common();
|
$user = new user_common();
|
||||||
$userdata =& $user->data;
|
$userdata =& $user->data;
|
||||||
|
|
||||||
|
@ -415,16 +325,16 @@ $log_action = new log_action();
|
||||||
$datastore->enqueue(array('cat_forums'));
|
$datastore->enqueue(array('cat_forums'));
|
||||||
|
|
||||||
// Дата старта вашего проекта
|
// Дата старта вашего проекта
|
||||||
if (!$bb_cfg['board_startdate'])
|
if (!$di->config->get('board_startdate'))
|
||||||
{
|
{
|
||||||
bb_update_config(array('board_startdate' => TIMENOW));
|
bb_update_config(array('board_startdate' => TIMENOW));
|
||||||
DB()->query("UPDATE ". BB_USERS ." SET user_regdate = ". TIMENOW ." WHERE user_id IN(2, ". EXCLUDED_USERS .")");
|
DB()->query("UPDATE ". BB_USERS ." SET user_regdate = ". TIMENOW ." WHERE user_id IN(2, ". EXCLUDED_USERS .")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cron
|
// Cron
|
||||||
if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON'))) || defined('FORCE_CRON'))
|
if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($di->config->get('cron_enabled') || defined('START_CRON'))) || defined('FORCE_CRON'))
|
||||||
{
|
{
|
||||||
if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval'])
|
if (TIMENOW - $di->config->get('cron_last_check') > $di->config->get('cron_check_interval'))
|
||||||
{
|
{
|
||||||
// Update cron_last_check
|
// Update cron_last_check
|
||||||
bb_update_config(array('cron_last_check' => (TIMENOW + 10)));
|
bb_update_config(array('cron_last_check' => (TIMENOW + 10)));
|
||||||
|
@ -452,10 +362,10 @@ if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exist
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit if board is disabled via ON/OFF trigger or by admin
|
// Exit if board is disabled via ON/OFF trigger or by admin
|
||||||
if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN'))
|
if (($di->config->get('board_disable') || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN'))
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
if ($bb_cfg['board_disable'])
|
if ($di->config->get('board_disable'))
|
||||||
{
|
{
|
||||||
// admin lock
|
// admin lock
|
||||||
send_no_cache_headers();
|
send_no_cache_headers();
|
||||||
|
@ -485,7 +395,7 @@ function cron_release_deadlock ()
|
||||||
|
|
||||||
function cron_release_file_lock ()
|
function cron_release_file_lock ()
|
||||||
{
|
{
|
||||||
$lock_released = rename(CRON_RUNNING, CRON_ALLOWED);
|
rename(CRON_RUNNING, CRON_ALLOWED);
|
||||||
cron_touch_lock_file(CRON_ALLOWED);
|
cron_touch_lock_file(CRON_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ else if (isset($_REQUEST['f']))
|
||||||
|
|
||||||
$total_online = $logged_online + $guests_online;
|
$total_online = $logged_online + $guests_online;
|
||||||
|
|
||||||
if ($total_online > $bb_cfg['record_online_users'])
|
if ($total_online > $di->config->get('record_online_users'))
|
||||||
{
|
{
|
||||||
bb_update_config(array(
|
bb_update_config(array(
|
||||||
'record_online_users' => $total_online,
|
'record_online_users' => $total_online,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $userdata, $template, $DBS, $lang;
|
global $userdata, $template, $DBS, $lang;
|
||||||
|
|
||||||
/** @var \TorrentPier\Di $di */
|
/** @var \TorrentPier\Di $di */
|
||||||
$di = \TorrentPier\Di::getInstance();
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
@ -25,7 +25,7 @@ if (!empty($template))
|
||||||
|
|
||||||
$show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
|
$show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
|
||||||
|
|
||||||
if(!$bb_cfg['gzip_compress'])
|
if(!$di->config->get('gzip_compress'))
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ if ($show_dbg_info)
|
||||||
$gen_time = utime() - TIMESTART;
|
$gen_time = utime() - TIMESTART;
|
||||||
$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 .= ($di->config->get('gzip_compress')) ? $lang['ON'] : $lang['OFF'];
|
||||||
|
|
||||||
$stat = '[ '. $lang['EXECUTION_TIME'] ." $gen_time_txt ". $lang['SEC'];
|
$stat = '[ '. $lang['EXECUTION_TIME'] ." $gen_time_txt ". $lang['SEC'];
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ if ($show_dbg_info)
|
||||||
$stat .= " | $gzip_text";
|
$stat .= " | $gzip_text";
|
||||||
|
|
||||||
$stat .= ' | '.$lang['MEMORY'];
|
$stat .= ' | '.$lang['MEMORY'];
|
||||||
$stat .= humn_size($bb_cfg['mem_on_start'], 2) .' / ';
|
$stat .= humn_size($di->config->get('mem_on_start'), 2) .' / ';
|
||||||
$stat .= humn_size(sys('mem_peak'), 2) .' / ';
|
$stat .= humn_size(sys('mem_peak'), 2) .' / ';
|
||||||
$stat .= humn_size(sys('mem'), 2);
|
$stat .= humn_size(sys('mem'), 2);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ if (defined('PAGE_HEADER_SENT')) return;
|
||||||
|
|
||||||
// Parse and show the overall page header
|
// Parse and show the overall page header
|
||||||
|
|
||||||
global $page_cfg, $userdata, $user, $bb_cfg, $template, $lang, $images;
|
global $page_cfg, $userdata, $user, $template, $lang, $images;
|
||||||
|
|
||||||
/** @var \TorrentPier\Di $di */
|
/** @var \TorrentPier\Di $di */
|
||||||
$di = \TorrentPier\Di::getInstance();
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
@ -48,7 +48,7 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE)
|
||||||
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
|
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
|
||||||
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
|
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
|
||||||
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'],
|
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'],
|
||||||
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], $bb_cfg['record_online_users'], bb_date($bb_cfg['record_online_date'])),
|
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], $di->config->get('record_online_users'), bb_date($di->config->get('record_online_date'))),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ $template->assign_vars(array(
|
||||||
// The following assigns all _common_ variables that may be used at any point in a template
|
// The following assigns all _common_ variables that may be used at any point in a template
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SIMPLE_HEADER' => !empty($gen_simple_header),
|
'SIMPLE_HEADER' => !empty($gen_simple_header),
|
||||||
'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'],
|
'CONTENT_ENCODING' => $di->config->get('lang.' . $userdata['user_lang'] . '.encoding'),
|
||||||
|
|
||||||
'IN_ADMIN' => defined('IN_ADMIN'),
|
'IN_ADMIN' => defined('IN_ADMIN'),
|
||||||
'USER_HIDE_CAT' => (BB_SCRIPT == 'index'),
|
'USER_HIDE_CAT' => (BB_SCRIPT == 'index'),
|
||||||
|
@ -125,9 +125,9 @@ $template->assign_vars(array(
|
||||||
|
|
||||||
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
||||||
|
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'U_INDEX' => BB_ROOT ."index.php",
|
'U_INDEX' => BB_ROOT ."index.php",
|
||||||
'T_INDEX' => sprintf($lang['FORUM_INDEX'], $bb_cfg['sitename']),
|
'T_INDEX' => sprintf($lang['FORUM_INDEX'], $di->config->get('sitename')),
|
||||||
|
|
||||||
'IS_GUEST' => IS_GUEST,
|
'IS_GUEST' => IS_GUEST,
|
||||||
'IS_USER' => IS_USER,
|
'IS_USER' => IS_USER,
|
||||||
|
@ -138,9 +138,9 @@ $template->assign_vars(array(
|
||||||
'FORUM_PATH' => FORUM_PATH,
|
'FORUM_PATH' => FORUM_PATH,
|
||||||
'FULL_URL' => FULL_URL,
|
'FULL_URL' => FULL_URL,
|
||||||
|
|
||||||
'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, $di->config->get('last_visit_date_format'), false)),
|
||||||
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', floatval($bb_cfg['board_timezone']))])),
|
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', floatval($di->config->get('board_timezone')))])),
|
||||||
'BOARD_TIMEZONE' => $bb_cfg['board_timezone'],
|
'BOARD_TIMEZONE' => $di->config->get('board_timezone'),
|
||||||
|
|
||||||
'PM_INFO' => $pm_info,
|
'PM_INFO' => $pm_info,
|
||||||
'PRIVMSG_IMG' => $icon_pm,
|
'PRIVMSG_IMG' => $icon_pm,
|
||||||
|
@ -151,7 +151,7 @@ $template->assign_vars(array(
|
||||||
'THIS_USER' => profile_url($userdata),
|
'THIS_USER' => profile_url($userdata),
|
||||||
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')),
|
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')),
|
||||||
'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
|
'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
|
||||||
'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'],
|
'AUTOLOGIN_DISABLED' => !$di->config->get('allow_autologin'),
|
||||||
'S_LOGIN_ACTION' => LOGIN_URL,
|
'S_LOGIN_ACTION' => LOGIN_URL,
|
||||||
|
|
||||||
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
|
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
|
||||||
|
@ -167,11 +167,11 @@ $template->assign_vars(array(
|
||||||
'U_REGISTER' => "profile.php?mode=register",
|
'U_REGISTER' => "profile.php?mode=register",
|
||||||
'U_SEARCH' => "search.php",
|
'U_SEARCH' => "search.php",
|
||||||
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword",
|
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword",
|
||||||
'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
|
'U_TERMS' => $di->config->get('terms_and_conditions_url'),
|
||||||
'U_TRACKER' => "tracker.php",
|
'U_TRACKER' => "tracker.php",
|
||||||
|
|
||||||
'SHOW_SIDEBAR1' => (!empty($page_cfg['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page']),
|
'SHOW_SIDEBAR1' => (!empty($page_cfg['show_sidebar1'][BB_SCRIPT]) || $di->config->get('show_sidebar1_on_every_page')),
|
||||||
'SHOW_SIDEBAR2' => (!empty($page_cfg['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page']),
|
'SHOW_SIDEBAR2' => (!empty($page_cfg['show_sidebar2'][BB_SCRIPT]) || $di->config->get('show_sidebar2_on_every_page')),
|
||||||
|
|
||||||
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
|
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
|
||||||
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
|
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
|
||||||
|
@ -185,11 +185,11 @@ $template->assign_vars(array(
|
||||||
'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL,
|
'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL,
|
||||||
'FORUM_URL' => BB_ROOT . FORUM_URL,
|
'FORUM_URL' => BB_ROOT . FORUM_URL,
|
||||||
'GROUP_URL' => BB_ROOT . GROUP_URL,
|
'GROUP_URL' => BB_ROOT . GROUP_URL,
|
||||||
'LOGIN_URL' => $bb_cfg['login_url'],
|
'LOGIN_URL' => $di->config->get('login_url'),
|
||||||
'NEWEST_URL' => '&view=newest#newest',
|
'NEWEST_URL' => '&view=newest#newest',
|
||||||
'PM_URL' => $bb_cfg['pm_url'],
|
'PM_URL' => $di->config->get('pm_url'),
|
||||||
'POST_URL' => BB_ROOT . POST_URL,
|
'POST_URL' => BB_ROOT . POST_URL,
|
||||||
'POSTING_URL' => $bb_cfg['posting_url'],
|
'POSTING_URL' => $di->config->get('posting_url'),
|
||||||
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
|
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
|
||||||
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
|
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ $template->pparse('page_header');
|
||||||
|
|
||||||
define('PAGE_HEADER_SENT', true);
|
define('PAGE_HEADER_SENT', true);
|
||||||
|
|
||||||
if (!$bb_cfg['gzip_compress'])
|
if (!$di->config->get('gzip_compress'))
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
|
@ -79,7 +79,8 @@ class user_common
|
||||||
*/
|
*/
|
||||||
function session_start ($cfg = array())
|
function session_start ($cfg = array())
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$update_sessions_table = false;
|
$update_sessions_table = false;
|
||||||
$this->cfg = array_merge($this->cfg, $cfg);
|
$this->cfg = array_merge($this->cfg, $cfg);
|
||||||
|
@ -100,7 +101,7 @@ class user_common
|
||||||
{
|
{
|
||||||
$SQL['WHERE'][] = "s.session_id = '$session_id'";
|
$SQL['WHERE'][] = "s.session_id = '$session_id'";
|
||||||
|
|
||||||
if ($bb_cfg['torhelp_enabled'])
|
if ($di->config->get('torhelp_enabled'))
|
||||||
{
|
{
|
||||||
$SQL['SELECT'][] = "th.topic_id_csv AS torhelp";
|
$SQL['SELECT'][] = "th.topic_id_csv AS torhelp";
|
||||||
$SQL['LEFT JOIN'][] = BB_BT_TORHELP ." th ON(u.user_id = th.user_id)";
|
$SQL['LEFT JOIN'][] = BB_BT_TORHELP ." th ON(u.user_id = th.user_id)";
|
||||||
|
@ -120,7 +121,7 @@ class user_common
|
||||||
{
|
{
|
||||||
$this->data = DB()->fetch_row($SQL);
|
$this->data = DB()->fetch_row($SQL);
|
||||||
|
|
||||||
if ($this->data && (TIMENOW - $this->data['session_time']) > $bb_cfg['session_update_intrv'])
|
if ($this->data && (TIMENOW - $this->data['session_time']) > $di->config->get('session_update_intrv'))
|
||||||
{
|
{
|
||||||
$this->data['session_time'] = TIMENOW;
|
$this->data['session_time'] = TIMENOW;
|
||||||
$update_sessions_table = true;
|
$update_sessions_table = true;
|
||||||
|
@ -169,7 +170,7 @@ class user_common
|
||||||
if (!$this->data)
|
if (!$this->data)
|
||||||
{
|
{
|
||||||
$login = false;
|
$login = false;
|
||||||
$user_id = ($bb_cfg['allow_autologin'] && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
|
$user_id = ($di->config->get('allow_autologin') && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
|
||||||
|
|
||||||
if ($userdata = get_userdata(intval($user_id), false, true))
|
if ($userdata = get_userdata(intval($user_id), false, true))
|
||||||
{
|
{
|
||||||
|
@ -195,7 +196,7 @@ class user_common
|
||||||
define('IS_CP_HOLDER', (!IS_GUEST && $this->data['user_level'] == CP_HOLDER));
|
define('IS_CP_HOLDER', (!IS_GUEST && $this->data['user_level'] == CP_HOLDER));
|
||||||
define('IS_GROUP_MEMBER', (!IS_GUEST && $this->data['user_level'] == GROUP_MEMBER));
|
define('IS_GROUP_MEMBER', (!IS_GUEST && $this->data['user_level'] == GROUP_MEMBER));
|
||||||
define('IS_USER', (!IS_GUEST && $this->data['user_level'] == USER));
|
define('IS_USER', (!IS_GUEST && $this->data['user_level'] == USER));
|
||||||
define('IS_SUPER_ADMIN', (IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']])));
|
define('IS_SUPER_ADMIN', (IS_ADMIN && $di->config->get('super_admins.' . $this->data['user_id'])));
|
||||||
define('IS_AM', (IS_ADMIN || IS_MOD));
|
define('IS_AM', (IS_ADMIN || IS_MOD));
|
||||||
|
|
||||||
$this->set_shortcuts();
|
$this->set_shortcuts();
|
||||||
|
@ -221,7 +222,8 @@ class user_common
|
||||||
*/
|
*/
|
||||||
function session_create ($userdata, $auto_created = false)
|
function session_create ($userdata, $auto_created = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$this->data = $userdata;
|
$this->data = $userdata;
|
||||||
$session_id = $this->sessiondata['sid'];
|
$session_id = $this->sessiondata['sid'];
|
||||||
|
@ -282,9 +284,9 @@ class user_common
|
||||||
$last_visit = TIMENOW;
|
$last_visit = TIMENOW;
|
||||||
define('FIRST_LOGON', true);
|
define('FIRST_LOGON', true);
|
||||||
}
|
}
|
||||||
else if ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv']))
|
else if ($session_time < (TIMENOW - $di->config->get('last_visit_update_intrv')))
|
||||||
{
|
{
|
||||||
$last_visit = max($session_time, (TIMENOW - 86400*$bb_cfg['max_last_visit_days']));
|
$last_visit = max($session_time, (TIMENOW - 86400*$di->config->get('max_last_visit_days')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($last_visit != $this->data['user_lastvisit'])
|
if ($last_visit != $this->data['user_lastvisit'])
|
||||||
|
@ -304,7 +306,7 @@ class user_common
|
||||||
|
|
||||||
$this->data['user_lastvisit'] = $last_visit;
|
$this->data['user_lastvisit'] = $last_visit;
|
||||||
}
|
}
|
||||||
if (!empty($_POST['autologin']) && $bb_cfg['allow_autologin'])
|
if (!empty($_POST['autologin']) && $di->config->get('allow_autologin'))
|
||||||
{
|
{
|
||||||
if (!$auto_created)
|
if (!$auto_created)
|
||||||
{
|
{
|
||||||
|
@ -481,7 +483,8 @@ class user_common
|
||||||
*/
|
*/
|
||||||
function set_session_cookies ($user_id)
|
function set_session_cookies ($user_id)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if ($user_id == GUEST_UID)
|
if ($user_id == GUEST_UID)
|
||||||
{
|
{
|
||||||
|
@ -511,7 +514,7 @@ class user_common
|
||||||
{
|
{
|
||||||
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
|
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
|
||||||
}
|
}
|
||||||
if (isset($bb_cfg['dbg_users'][$this->data['user_id']]) && !isset($_COOKIE[COOKIE_DBG]))
|
if ($di->config->get('dbg_users.' . $this->data['user_id']) && !isset($_COOKIE[COOKIE_DBG]))
|
||||||
{
|
{
|
||||||
bb_setcookie(COOKIE_DBG, 1, COOKIE_SESSION);
|
bb_setcookie(COOKIE_DBG, 1, COOKIE_SESSION);
|
||||||
}
|
}
|
||||||
|
@ -529,7 +532,8 @@ class user_common
|
||||||
*/
|
*/
|
||||||
function verify_autologin_id ($userdata, $expire_check = false, $create_new = true)
|
function verify_autologin_id ($userdata, $expire_check = false, $create_new = true)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$autologin_id = $userdata['autologin_id'];
|
$autologin_id = $userdata['autologin_id'];
|
||||||
|
|
||||||
|
@ -539,9 +543,9 @@ class user_common
|
||||||
{
|
{
|
||||||
return $this->create_autologin_id($userdata);
|
return $this->create_autologin_id($userdata);
|
||||||
}
|
}
|
||||||
else if ($autologin_id && $userdata['user_session_time'] && $bb_cfg['max_autologin_time'])
|
else if ($autologin_id && $userdata['user_session_time'] && $di->config->get('max_autologin_time'))
|
||||||
{
|
{
|
||||||
if (TIMENOW - $userdata['user_session_time'] > $bb_cfg['max_autologin_time']*86400)
|
if (TIMENOW - $userdata['user_session_time'] > $di->config->get('max_autologin_time')*86400)
|
||||||
{
|
{
|
||||||
return $this->create_autologin_id($userdata, $create_new);
|
return $this->create_autologin_id($userdata, $create_new);
|
||||||
}
|
}
|
||||||
|
@ -594,34 +598,31 @@ class user_common
|
||||||
*/
|
*/
|
||||||
function init_userprefs ()
|
function init_userprefs ()
|
||||||
{
|
{
|
||||||
global $bb_cfg, $theme, $lang, $DeltaTime;
|
global $theme, $lang, $DeltaTime;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (defined('LANG_DIR')) return; // prevent multiple calling
|
if (defined('LANG_DIR')) return; // prevent multiple calling
|
||||||
|
|
||||||
define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . $bb_cfg['default_lang'] .'/');
|
define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . $di->config->get('default_lang') .'/');
|
||||||
define('ENGLISH_LANG_DIR', LANG_ROOT_DIR .'en/');
|
define('ENGLISH_LANG_DIR', LANG_ROOT_DIR .'en/');
|
||||||
|
|
||||||
if ($this->data['user_id'] != GUEST_UID)
|
if ($this->data['user_id'] != GUEST_UID)
|
||||||
{
|
{
|
||||||
if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang'])
|
if ($this->data['user_lang'] && $this->data['user_lang'] != $di->config->get('default_lang'))
|
||||||
{
|
{
|
||||||
$bb_cfg['default_lang'] = basename($this->data['user_lang']);
|
define('LANG_DIR', LANG_ROOT_DIR . basename($this->data['user_lang']) .'/');
|
||||||
define('LANG_DIR', LANG_ROOT_DIR . $bb_cfg['default_lang'] .'/');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->data['user_timezone']))
|
|
||||||
{
|
|
||||||
$bb_cfg['board_timezone'] = $this->data['user_timezone'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data['user_lang'] = $bb_cfg['default_lang'];
|
$this->data['user_lang'] = $di->config->get('default_lang');
|
||||||
$this->data['user_timezone'] = $bb_cfg['board_timezone'];
|
$this->data['user_timezone'] = $di->config->get('board_timezone');
|
||||||
|
|
||||||
if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR);
|
if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR);
|
||||||
|
|
||||||
require(LANG_DIR .'main.php');
|
require(LANG_DIR .'main.php');
|
||||||
setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale']);
|
setlocale(LC_ALL, $di->config->get('lang.' . $this->data['user_lang'] . '.locale'));
|
||||||
|
|
||||||
$theme = setup_style();
|
$theme = setup_style();
|
||||||
$DeltaTime = new Date_Delta();
|
$DeltaTime = new Date_Delta();
|
||||||
|
|
|
@ -24,7 +24,8 @@ function server_parse($socket, $response, $line = __LINE__)
|
||||||
// Replacement or substitute for PHP's mail command
|
// Replacement or substitute for PHP's mail command
|
||||||
function smtpmail($mail_to, $subject, $message, $headers = '')
|
function smtpmail($mail_to, $subject, $message, $headers = '')
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// Fix any bare linefeeds in the message to make it RFC821 Compliant.
|
// Fix any bare linefeeds in the message to make it RFC821 Compliant.
|
||||||
$message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);
|
$message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);
|
||||||
|
@ -84,8 +85,8 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok we have error checked as much as we can to this point let's get on it already
|
// Ok we have error checked as much as we can to this point let's get on it already
|
||||||
$ssl = ($bb_cfg['smtp_ssl']) ? 'ssl://' : '';
|
$ssl = ($di->config->get('smtp_ssl')) ? 'ssl://' : '';
|
||||||
if( !$socket = fsockopen($ssl . $bb_cfg['smtp_host'], $bb_cfg['smtp_port'], $errno, $errstr, 20) )
|
if( !$socket = fsockopen($ssl . $di->config->get('smtp_host'), $di->config->get('smtp_port'), $errno, $errstr, 20) )
|
||||||
{
|
{
|
||||||
bb_die('Could not connect to smtp host : '. $errno .' : '. $errstr);
|
bb_die('Could not connect to smtp host : '. $errno .' : '. $errstr);
|
||||||
}
|
}
|
||||||
|
@ -95,29 +96,29 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
|
||||||
|
|
||||||
// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
|
// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
|
||||||
// This improved as provided by SirSir to accomodate
|
// This improved as provided by SirSir to accomodate
|
||||||
if( !empty($bb_cfg['smtp_username']) && !empty($bb_cfg['smtp_password']) )
|
if( !empty($di->config->get('smtp_username')) && !empty($di->config->get('smtp_password')) )
|
||||||
{
|
{
|
||||||
fputs($socket, "EHLO " . $bb_cfg['smtp_host'] . "\r\n");
|
fputs($socket, "EHLO " . $di->config->get('smtp_host') . "\r\n");
|
||||||
server_parse($socket, "250", __LINE__);
|
server_parse($socket, "250", __LINE__);
|
||||||
|
|
||||||
fputs($socket, "AUTH LOGIN\r\n");
|
fputs($socket, "AUTH LOGIN\r\n");
|
||||||
server_parse($socket, "334", __LINE__);
|
server_parse($socket, "334", __LINE__);
|
||||||
|
|
||||||
fputs($socket, base64_encode($bb_cfg['smtp_username']) . "\r\n");
|
fputs($socket, base64_encode($di->config->get('smtp_username')) . "\r\n");
|
||||||
server_parse($socket, "334", __LINE__);
|
server_parse($socket, "334", __LINE__);
|
||||||
|
|
||||||
fputs($socket, base64_encode($bb_cfg['smtp_password']) . "\r\n");
|
fputs($socket, base64_encode($di->config->get('smtp_password')) . "\r\n");
|
||||||
server_parse($socket, "235", __LINE__);
|
server_parse($socket, "235", __LINE__);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fputs($socket, "HELO " . $bb_cfg['smtp_host'] . "\r\n");
|
fputs($socket, "HELO " . $di->config->get('smtp_host') . "\r\n");
|
||||||
server_parse($socket, "250", __LINE__);
|
server_parse($socket, "250", __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// From this point onward most server response codes should be 250
|
// From this point onward most server response codes should be 250
|
||||||
// Specify who the mail is from....
|
// Specify who the mail is from....
|
||||||
fputs($socket, "MAIL FROM: <" . $bb_cfg['board_email'] . ">\r\n");
|
fputs($socket, "MAIL FROM: <" . $di->config->get('board_email') . ">\r\n");
|
||||||
server_parse($socket, "250", __LINE__);
|
server_parse($socket, "250", __LINE__);
|
||||||
|
|
||||||
// Add an additional bit of error checking to the To field.
|
// Add an additional bit of error checking to the To field.
|
||||||
|
|
|
@ -93,7 +93,10 @@ class Template
|
||||||
*/
|
*/
|
||||||
function Template($root = '.')
|
function Template($root = '.')
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// setting pointer "vars"
|
// setting pointer "vars"
|
||||||
$this->vars = &$this->_tpldata['.'][0];
|
$this->vars = &$this->_tpldata['.'][0];
|
||||||
|
@ -102,7 +105,7 @@ class Template
|
||||||
$this->root = $root;
|
$this->root = $root;
|
||||||
$this->tpl = basename($root);
|
$this->tpl = basename($root);
|
||||||
$this->lang =& $lang;
|
$this->lang =& $lang;
|
||||||
$this->use_cache = $bb_cfg['xs_use_cache'];
|
$this->use_cache = $di->config->get('xs_use_cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,7 +230,10 @@ class Template
|
||||||
{
|
{
|
||||||
$this->cur_tpl = $filename;
|
$this->cur_tpl = $filename;
|
||||||
|
|
||||||
global $lang, $bb_cfg, $user, $tr_cfg;
|
global $lang, $user, $tr_cfg;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$L =& $lang;
|
$L =& $lang;
|
||||||
$V =& $this->vars;
|
$V =& $this->vars;
|
||||||
|
@ -1063,12 +1069,13 @@ class Template
|
||||||
|
|
||||||
function xs_startup()
|
function xs_startup()
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
if (empty($this->xs_started)) {
|
if (empty($this->xs_started)) {
|
||||||
$this->xs_started = 1;
|
$this->xs_started = 1;
|
||||||
// Adding language variable
|
// Adding language variable
|
||||||
$this->vars['LANG'] = isset($this->vars['LANG']) ? $this->vars['LANG'] : $bb_cfg['default_lang'];
|
$this->vars['LANG'] = isset($this->vars['LANG']) ? $this->vars['LANG'] : $di->config->get('default_lang');
|
||||||
// Adding current template
|
// Adding current template
|
||||||
$tpl = $this->root . '/';
|
$tpl = $this->root . '/';
|
||||||
if (substr($tpl, 0, 2) === './') {
|
if (substr($tpl, 0, 2) === './') {
|
||||||
|
|
|
@ -15,11 +15,11 @@ $dl_users_div_style_overflow = "padding: 6px; height: $dl_users_overflow_div_he
|
||||||
|
|
||||||
$template->assign_vars(array('DL_BUTTONS' => false));
|
$template->assign_vars(array('DL_BUTTONS' => false));
|
||||||
|
|
||||||
$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !($di->request->get('dl') === 'names'));
|
$count_mode = ($di->config->get('bt_dl_list_only_count') && !($di->request->get('dl') === 'names'));
|
||||||
|
|
||||||
$dl_topic = (isset($t_data['tracker_status']) && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
|
$dl_topic = (isset($t_data['tracker_status']) && !($di->config->get('bt_dl_list_only_1st_page') && $start));
|
||||||
$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && $di->request->get('dl') === 'names')));
|
$show_dl_list = ($dl_topic && ($di->config->get('bt_show_dl_list') || ($di->config->get('allow_dl_list_names_mode') && $di->request->get('dl') === 'names')));
|
||||||
$show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
|
$show_dl_buttons = ($dl_topic && $di->config->get('bt_show_dl_list_buttons'));
|
||||||
|
|
||||||
// link to clear DL-List
|
// link to clear DL-List
|
||||||
$template->assign_vars(array('S_DL_DELETE' => false));
|
$template->assign_vars(array('S_DL_DELETE' => false));
|
||||||
|
@ -122,10 +122,10 @@ if ($show_dl_buttons)
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'DL_BUTTONS' => true,
|
'DL_BUTTONS' => true,
|
||||||
'DL_BUT_WILL' => $bb_cfg['bt_show_dl_but_will'],
|
'DL_BUT_WILL' => $di->config->get('bt_show_dl_but_will'),
|
||||||
'DL_BUT_DOWN' => $bb_cfg['bt_show_dl_but_down'],
|
'DL_BUT_DOWN' => $di->config->get('bt_show_dl_but_down'),
|
||||||
'DL_BUT_COMPL' => $bb_cfg['bt_show_dl_but_compl'],
|
'DL_BUT_COMPL' => $di->config->get('bt_show_dl_but_compl'),
|
||||||
'DL_BUT_CANCEL' => $bb_cfg['bt_show_dl_but_cancel'],
|
'DL_BUT_CANCEL' => $di->config->get('bt_show_dl_but_cancel'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$dl_hidden_fields = '
|
$dl_hidden_fields = '
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$user_id = $userdata['user_id'];
|
$user_id = $userdata['user_id'];
|
||||||
$user_points = $userdata['user_points'];
|
$user_points = $userdata['user_points'];
|
||||||
|
|
||||||
if($bb_cfg['seed_bonus_enabled'] && $bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price'])
|
if($di->config->get('seed_bonus_enabled') && $di->config->get('bonus_upload') && $di->config->get('bonus_upload_price'))
|
||||||
{
|
{
|
||||||
$upload_row = unserialize($bb_cfg['bonus_upload']);
|
$upload_row = unserialize($di->config->get('bonus_upload'));
|
||||||
$price_row = unserialize($bb_cfg['bonus_upload_price']);
|
$price_row = unserialize($di->config->get('bonus_upload_price'));
|
||||||
}
|
}
|
||||||
else bb_die($lang['EXCHANGE_NOT']);
|
else bb_die($lang['EXCHANGE_NOT']);
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
// Is send through board enabled? No, return to index
|
// Is send through board enabled? No, return to index
|
||||||
if (!$bb_cfg['board_email_form'])
|
if (!$di->config->get('board_email_form'))
|
||||||
{
|
{
|
||||||
redirect("index.php");
|
redirect("index.php");
|
||||||
}
|
}
|
||||||
|
@ -50,7 +53,7 @@ if ($row = DB()->fetch_row($sql))
|
||||||
if (!$errors)
|
if (!$errors)
|
||||||
{
|
{
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($userdata['username'] ." <{$userdata['user_email']}>");
|
$emailer->from($userdata['username'] ." <{$userdata['user_email']}>");
|
||||||
$emailer->email_address($username ." <$user_email>");
|
$emailer->email_address($username ." <$user_email>");
|
||||||
|
@ -59,7 +62,7 @@ if ($row = DB()->fetch_row($sql))
|
||||||
$emailer->set_subject($subject);
|
$emailer->set_subject($subject);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'FROM_USERNAME' => $userdata['username'],
|
'FROM_USERNAME' => $userdata['username'],
|
||||||
'TO_USERNAME' => $username,
|
'TO_USERNAME' => $username,
|
||||||
'MESSAGE' => $message,
|
'MESSAGE' => $message,
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
array_deep($_POST, 'trim');
|
array_deep($_POST, 'trim');
|
||||||
|
|
||||||
set_die_append_msg();
|
set_die_append_msg();
|
||||||
|
|
||||||
if (IS_ADMIN)
|
if (IS_ADMIN)
|
||||||
{
|
{
|
||||||
$bb_cfg['reg_email_activation'] = false;
|
|
||||||
|
|
||||||
$new_user = (int) request_var('admin', '');
|
$new_user = (int) request_var('admin', '');
|
||||||
if ($new_user) $gen_simple_header = true;
|
if ($new_user) $gen_simple_header = true;
|
||||||
|
|
||||||
|
@ -18,19 +19,21 @@ if (IS_ADMIN)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$req_email_activation = (IS_ADMIN) ? false : $di->config->get('reg_email_activation');
|
||||||
|
|
||||||
$can_register = (IS_GUEST || IS_ADMIN);
|
$can_register = (IS_GUEST || IS_ADMIN);
|
||||||
|
|
||||||
$submit = !empty($_POST['submit']);
|
$submit = !empty($_POST['submit']);
|
||||||
$errors = array();
|
$errors = [];
|
||||||
$adm_edit = false; // редактирование админом чужого профиля
|
$adm_edit = false; // редактирование админом чужого профиля
|
||||||
|
|
||||||
require(INC_DIR .'bbcode.php');
|
require(INC_DIR .'bbcode.php');
|
||||||
require(INC_DIR .'functions_validate.php');
|
require(INC_DIR .'functions_validate.php');
|
||||||
require(INC_DIR .'functions_selects.php');
|
require(INC_DIR .'functions_selects.php');
|
||||||
|
|
||||||
$pr_data = array(); // данные редактируемого либо регистрационного профиля
|
$pr_data = []; // данные редактируемого либо регистрационного профиля
|
||||||
$db_data = array(); // данные для базы: регистрационные либо измененные данные юзера
|
$db_data = []; // данные для базы: регистрационные либо измененные данные юзера
|
||||||
$tp_data = array(); // данные для tpl
|
$tp_data = []; // данные для tpl
|
||||||
|
|
||||||
// Данные профиля
|
// Данные профиля
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@ -44,20 +47,20 @@ switch ($mode)
|
||||||
if (!IS_ADMIN)
|
if (!IS_ADMIN)
|
||||||
{
|
{
|
||||||
// Ограничение по ip
|
// Ограничение по ip
|
||||||
if($bb_cfg['unique_ip'])
|
if($di->config->get('unique_ip'))
|
||||||
{
|
{
|
||||||
if($users = DB()->fetch_row("SELECT user_id, username FROM ". BB_USERS ." WHERE user_reg_ip = '". USER_IP ."' LIMIT 1"))
|
if($users = DB()->fetch_row("SELECT user_id, username FROM ". BB_USERS ." WHERE user_reg_ip = '". USER_IP ."' LIMIT 1"))
|
||||||
{
|
{
|
||||||
bb_die(sprintf($lang['ALREADY_REG_IP'], '<a href="'. PROFILE_URL . $users['user_id'] .'"><b>'. $users['username'] .'</b></a>', $bb_cfg['tech_admin_email']));
|
bb_die(sprintf($lang['ALREADY_REG_IP'], '<a href="'. PROFILE_URL . $users['user_id'] .'"><b>'. $users['username'] .'</b></a>', $di->config->get('tech_admin_email')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Отключение регистрации
|
// Отключение регистрации
|
||||||
if ($bb_cfg['new_user_reg_disabled'] || ($bb_cfg['reg_email_activation'] && $bb_cfg['emailer_disabled']))
|
if ($di->config->get('new_user_reg_disabled') || ($req_email_activation && $di->config->get('emailer_disabled')))
|
||||||
{
|
{
|
||||||
bb_die($lang['NEW_USER_REG_DISABLED']);
|
bb_die($lang['NEW_USER_REG_DISABLED']);
|
||||||
}
|
}
|
||||||
// Ограничение по времени
|
// Ограничение по времени
|
||||||
else if ($bb_cfg['new_user_reg_restricted'])
|
else if ($di->config->get('new_user_reg_restricted'))
|
||||||
{
|
{
|
||||||
if (in_array(date('G'), array(0,/*1,2,3,4,5,6,7,8,11,12,13,14,15,16,*/17,18,19,20,21,22,23)))
|
if (in_array(date('G'), array(0,/*1,2,3,4,5,6,7,8,11,12,13,14,15,16,*/17,18,19,20,21,22,23)))
|
||||||
{
|
{
|
||||||
|
@ -81,8 +84,8 @@ switch ($mode)
|
||||||
'username' => '',
|
'username' => '',
|
||||||
'user_password' => '',
|
'user_password' => '',
|
||||||
'user_email' => '',
|
'user_email' => '',
|
||||||
'user_timezone' => $bb_cfg['board_timezone'],
|
'user_timezone' => $di->config->get('board_timezone'),
|
||||||
'user_lang' => $bb_cfg['default_lang'],
|
'user_lang' => $di->config->get('default_lang'),
|
||||||
'user_opt' => 0,
|
'user_opt' => 0,
|
||||||
'avatar_ext_id' => 0,
|
'avatar_ext_id' => 0,
|
||||||
);
|
);
|
||||||
|
@ -97,7 +100,7 @@ switch ($mode)
|
||||||
// field => can_edit
|
// field => can_edit
|
||||||
$profile_fields = array(
|
$profile_fields = array(
|
||||||
'user_active' => IS_ADMIN,
|
'user_active' => IS_ADMIN,
|
||||||
'username' => (IS_ADMIN || $bb_cfg['allow_namechange']),
|
'username' => (IS_ADMIN || $di->config->get('allow_namechange')),
|
||||||
'user_password' => true,
|
'user_password' => true,
|
||||||
'user_email' => true, // должен быть после user_password
|
'user_email' => true, // должен быть после user_password
|
||||||
'user_lang' => true,
|
'user_lang' => true,
|
||||||
|
@ -149,7 +152,7 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Captcha
|
// Captcha
|
||||||
$need_captcha = ($mode == 'register' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
|
$need_captcha = ($mode == 'register' && !IS_ADMIN && !$di->config->get('captcha.disabled'));
|
||||||
|
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +282,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
{
|
{
|
||||||
$errors[] = $err;
|
$errors[] = $err;
|
||||||
}
|
}
|
||||||
if ($bb_cfg['reg_email_activation'])
|
if ($req_email_activation)
|
||||||
{
|
{
|
||||||
$pr_data['user_active'] = 0;
|
$pr_data['user_active'] = 0;
|
||||||
$db_data['user_active'] = 0;
|
$db_data['user_active'] = 0;
|
||||||
|
@ -346,13 +349,13 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
{
|
{
|
||||||
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
|
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
|
||||||
}
|
}
|
||||||
elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age'])
|
elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $di->config->get('birthday_max_age'))
|
||||||
{
|
{
|
||||||
$errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']);
|
$errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $di->config->get('birthday_max_age'));
|
||||||
}
|
}
|
||||||
elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age'])
|
elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $di->config->get('birthday_min_age'))
|
||||||
{
|
{
|
||||||
$errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']);
|
$errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $di->config->get('birthday_min_age'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,12 +412,12 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
$pr_data['avatar_ext_id'] = 0;
|
$pr_data['avatar_ext_id'] = 0;
|
||||||
$db_data['avatar_ext_id'] = 0;
|
$db_data['avatar_ext_id'] = 0;
|
||||||
}
|
}
|
||||||
else if (!empty($_FILES['avatar']['name']) && $bb_cfg['avatars']['up_allowed'])
|
elseif (!empty($_FILES['avatar']['name']) && $di->config->get('avatars.up_allowed'))
|
||||||
{
|
{
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['avatars'], $_FILES['avatar']) && $upload->store('avatar', $pr_data))
|
if ($upload->init($di->config->get('avatars'), $_FILES['avatar']) && $upload->store('avatar', $pr_data))
|
||||||
{
|
{
|
||||||
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
|
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
|
||||||
$db_data['avatar_ext_id'] = (int) $upload->file_ext_id;
|
$db_data['avatar_ext_id'] = (int) $upload->file_ext_id;
|
||||||
|
@ -425,7 +428,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tp_data['AVATARS_MAX_SIZE'] = humn_size($bb_cfg['avatars']['max_size']);
|
$tp_data['AVATARS_MAX_SIZE'] = humn_size($di->config->get('avatars.max_size'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -494,7 +497,7 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
{
|
{
|
||||||
$sig = prepare_message($sig);
|
$sig = prepare_message($sig);
|
||||||
|
|
||||||
if (mb_strlen($sig, 'UTF-8') > $bb_cfg['max_sig_chars'])
|
if (mb_strlen($sig, 'UTF-8') > $di->config->get('max_sig_chars'))
|
||||||
{
|
{
|
||||||
$errors[] = $lang['SIGNATURE_TOO_LONG'];
|
$errors[] = $lang['SIGNATURE_TOO_LONG'];
|
||||||
}
|
}
|
||||||
|
@ -579,9 +582,9 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
$templates = htmlCHR($templates);
|
$templates = htmlCHR($templates);
|
||||||
if ($submit && $templates != $pr_data['tpl_name'])
|
if ($submit && $templates != $pr_data['tpl_name'])
|
||||||
{
|
{
|
||||||
$pr_data['tpl_name'] = $bb_cfg['tpl_name'];
|
$pr_data['tpl_name'] = $di->config->get('tpl_name');
|
||||||
$db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
|
$db_data['tpl_name'] = (string) $di->config->get('tpl_name');
|
||||||
foreach ($bb_cfg['templates'] as $folder => $name)
|
foreach ($di->config->get('templates') as $folder => $name)
|
||||||
{
|
{
|
||||||
if ($templates == $folder)
|
if ($templates == $folder)
|
||||||
{
|
{
|
||||||
|
@ -609,7 +612,7 @@ if ($submit && !$errors)
|
||||||
*/
|
*/
|
||||||
if ($mode == 'register')
|
if ($mode == 'register')
|
||||||
{
|
{
|
||||||
if ($bb_cfg['reg_email_activation'])
|
if ($req_email_activation)
|
||||||
{
|
{
|
||||||
$user_actkey = make_rand_str(12);
|
$user_actkey = make_rand_str(12);
|
||||||
$db_data['user_active'] = 0;
|
$db_data['user_active'] = 0;
|
||||||
|
@ -624,7 +627,7 @@ if ($submit && !$errors)
|
||||||
|
|
||||||
if (!IS_ADMIN) $db_data['user_reg_ip'] = USER_IP;
|
if (!IS_ADMIN) $db_data['user_reg_ip'] = USER_IP;
|
||||||
|
|
||||||
if (!isset($db_data['tpl_name'])) $db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
|
if (!isset($db_data['tpl_name'])) $db_data['tpl_name'] = (string) $di->config->get('tpl_name');
|
||||||
|
|
||||||
$sql_args = DB()->build_array('INSERT', $db_data);
|
$sql_args = DB()->build_array('INSERT', $db_data);
|
||||||
|
|
||||||
|
@ -638,7 +641,7 @@ if ($submit && !$errors)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($bb_cfg['reg_email_activation'])
|
if ($req_email_activation)
|
||||||
{
|
{
|
||||||
$message = $lang['ACCOUNT_INACTIVE'];
|
$message = $lang['ACCOUNT_INACTIVE'];
|
||||||
$email_template = 'user_welcome_inactive';
|
$email_template = 'user_welcome_inactive';
|
||||||
|
@ -650,15 +653,15 @@ if ($submit && !$errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($username ." <{$email}>");
|
$emailer->email_address($username ." <{$email}>");
|
||||||
$emailer->use_template($email_template, $user_lang);
|
$emailer->use_template($email_template, $user_lang);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
|
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $di->config->get('sitename')),
|
||||||
'USERNAME' => html_entity_decode($username),
|
'USERNAME' => html_entity_decode($username),
|
||||||
'PASSWORD' => $new_pass,
|
'PASSWORD' => $new_pass,
|
||||||
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
|
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
|
||||||
|
@ -687,14 +690,14 @@ if ($submit && !$errors)
|
||||||
$db_data['user_actkey'] = $user_actkey;
|
$db_data['user_actkey'] = $user_actkey;
|
||||||
|
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address($username ." <{$email}>");
|
$emailer->email_address($username ." <{$email}>");
|
||||||
$emailer->use_template('user_activate', $pr_data['user_lang']);
|
$emailer->use_template('user_activate', $pr_data['user_lang']);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'USERNAME' => html_entity_decode($username),
|
'USERNAME' => html_entity_decode($username),
|
||||||
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"),
|
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"),
|
||||||
));
|
));
|
||||||
|
@ -761,12 +764,12 @@ $template->assign_vars(array(
|
||||||
'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
|
'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
|
||||||
'USER_TIMEZONE' => $pr_data['user_timezone'],
|
'USER_TIMEZONE' => $pr_data['user_timezone'],
|
||||||
|
|
||||||
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], (round($bb_cfg['avatars']['max_size'] / 1024))),
|
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $di->config->get('avatars.max_width'), $di->config->get('avatars.max_height'), (round($di->config->get('avatars.max_size') / 1024))),
|
||||||
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
|
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
|
||||||
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']),
|
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $di->config->get('terms_and_conditions_url')),
|
||||||
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),
|
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),
|
||||||
|
|
||||||
'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $bb_cfg['max_sig_chars']),
|
'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $di->config->get('max_sig_chars')),
|
||||||
'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
|
'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
|
||||||
|
|
||||||
'PR_USER_ID' => $pr_data['user_id'],
|
'PR_USER_ID' => $pr_data['user_id'],
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
set_die_append_msg();
|
set_die_append_msg();
|
||||||
|
|
||||||
if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']);
|
if ($di->config->get('emailer_disabled')) bb_die($lang['EMAILER_DISABLED']);
|
||||||
|
|
||||||
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
|
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$di->config->get('captcha.disabled'));
|
||||||
|
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
|
@ -41,15 +44,15 @@ if (isset($_POST['submit']))
|
||||||
}
|
}
|
||||||
|
|
||||||
require(CLASS_DIR .'emailer.php');
|
require(CLASS_DIR .'emailer.php');
|
||||||
$emailer = new emailer($bb_cfg['smtp_delivery']);
|
$emailer = new emailer($di->config->get('smtp_delivery'));
|
||||||
|
|
||||||
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
|
$emailer->from($di->config->get('sitename') ." <{$di->config->get('board_email')}>");
|
||||||
$emailer->email_address("$username <{$row['user_email']}>");
|
$emailer->email_address("$username <{$row['user_email']}>");
|
||||||
|
|
||||||
$emailer->use_template('user_activate_passwd', $row['user_lang']);
|
$emailer->use_template('user_activate_passwd', $row['user_lang']);
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
$emailer->assign_vars(array(
|
||||||
'SITENAME' => $bb_cfg['sitename'],
|
'SITENAME' => $di->config->get('sitename'),
|
||||||
'USERNAME' => $username,
|
'USERNAME' => $username,
|
||||||
'PASSWORD' => $user_password,
|
'PASSWORD' => $user_password,
|
||||||
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
|
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (empty($bb_cfg['topic_notify_enabled']))
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
if (empty($di->config->get('topic_notify_enabled')))
|
||||||
{
|
{
|
||||||
bb_die($lang['DISABLED']);
|
bb_die($lang['DISABLED']);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +14,7 @@ $tracking_topics = get_tracks('topic');
|
||||||
|
|
||||||
$user_id = $userdata['user_id'];
|
$user_id = $userdata['user_id'];
|
||||||
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
|
$start = isset($_GET['start']) ? abs(intval($_GET['start'])) : 0;
|
||||||
$per_page = $bb_cfg['topics_per_page'];
|
$per_page = $di->config->get('topics_per_page');
|
||||||
|
|
||||||
if (isset($_POST['topic_id_list']))
|
if (isset($_POST['topic_id_list']))
|
||||||
{
|
{
|
||||||
|
@ -77,7 +80,7 @@ if ($watch_count > 0)
|
||||||
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
|
||||||
'IS_UNREAD' => $is_unread,
|
'IS_UNREAD' => $is_unread,
|
||||||
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
|
||||||
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
|
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $di->config->get('posts_per_page')),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
require(INC_DIR .'bbcode.php');
|
require(INC_DIR .'bbcode.php');
|
||||||
|
|
||||||
$datastore->enqueue(array(
|
$datastore->enqueue(array(
|
||||||
|
@ -47,7 +50,7 @@ if (IS_ADMIN)
|
||||||
|
|
||||||
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM)
|
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM)
|
||||||
{
|
{
|
||||||
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&'. POST_USERS_URL .'='. $profiledata['user_id'] : 'mailto:'. $profiledata['user_email'];
|
$email_uri = ($di->config->get('board_email_form')) ? 'profile.php?mode=email&'. POST_USERS_URL .'='. $profiledata['user_id'] : 'mailto:'. $profiledata['user_email'];
|
||||||
$email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
|
$email = '<a class="editable" href="'. $email_uri .'">'. $profiledata['user_email'] .'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -61,7 +64,7 @@ else
|
||||||
|
|
||||||
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
|
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
|
||||||
|
|
||||||
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
|
$signature = ($di->config->get('allow_sig') && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
|
||||||
|
|
||||||
if(bf($profiledata['user_opt'], 'user_opt', 'dis_sig'))
|
if(bf($profiledata['user_opt'], 'user_opt', 'dis_sig'))
|
||||||
{
|
{
|
||||||
|
@ -103,9 +106,9 @@ $template->assign_vars(array(
|
||||||
'SKYPE' => $profiledata['user_skype'],
|
'SKYPE' => $profiledata['user_skype'],
|
||||||
'TWITTER' => $profiledata['user_twitter'],
|
'TWITTER' => $profiledata['user_twitter'],
|
||||||
'USER_POINTS' => $profiledata['user_points'],
|
'USER_POINTS' => $profiledata['user_points'],
|
||||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
'GENDER' => ($di->config->get('gender')) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
'BIRTHDAY' => ($di->config->get('birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
||||||
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
'AGE' => ($di->config->get('birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
||||||
|
|
||||||
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||||
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||||
|
|
||||||
global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $userdata;
|
global $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $userdata;
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$show_peers_limit = 300;
|
$show_peers_limit = 300;
|
||||||
$max_peers_before_overflow = 20;
|
$max_peers_before_overflow = 20;
|
||||||
|
@ -88,8 +91,8 @@ if ($tor_reged)
|
||||||
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
|
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
|
||||||
|
|
||||||
// ratio limits
|
// ratio limits
|
||||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
$min_ratio_dl = $di->config->get('bt_min_ratio_allow_dl_tor');
|
||||||
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
|
$min_ratio_warn = $di->config->get('bt_min_ratio_warning');
|
||||||
$dl_allowed = true;
|
$dl_allowed = true;
|
||||||
$user_ratio = 0;
|
$user_ratio = 0;
|
||||||
|
|
||||||
|
@ -125,7 +128,7 @@ if ($tor_reged)
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SHOW_RATIO_WARN' => true,
|
'SHOW_RATIO_WARN' => true,
|
||||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
|
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $di->config->get('ratio_url_help')),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,15 +143,15 @@ if ($tor_reged)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'DOWNLOAD_NAME' => '['.$bb_cfg['server_name'].'].t' . $topic_id . '.torrent',
|
'DOWNLOAD_NAME' => '[' . $di->config->get('server_name') . '].t' . $topic_id . '.torrent',
|
||||||
'TOR_SILVER_GOLD' => $tor_info['tor_type'],
|
'TOR_SILVER_GOLD' => $tor_info['tor_type'],
|
||||||
|
|
||||||
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
'TOR_FROZEN' => (!IS_AM) ? ($di->config->get('tor_frozen.' . $tor_info['tor_status']) && !($di->config->get('tor_frozen_author_download.' . $tor_info['tor_status'])) && $userdata['user_id'] == $tor_info['poster_id']) ? true : '' : '',
|
||||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
||||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
'TOR_STATUS_ICON' => $di->config->get('tor_icons.' . $tor_info['tor_status']),
|
||||||
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time']) .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] .'</i></span>') : '',
|
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time']) .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] .'</i></span>') : '',
|
||||||
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
||||||
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
'TOR_STATUS_REPLY' => $di->config->get('tor_comment') && !IS_GUEST && in_array($tor_info['tor_status'], $di->config->get('tor_reply')) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||||
|
|
||||||
'DL_LINK_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed',
|
'DL_LINK_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed',
|
||||||
'DL_TITLE_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_status_css[$bt_userdata['user_status']] : 'gen',
|
'DL_TITLE_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_status_css[$bt_userdata['user_status']] : 'gen',
|
||||||
|
@ -499,7 +502,7 @@ if ($tor_reged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full')
|
if ($di->config->get('bt_allow_spmode_change') && $s_mode != 'full')
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PEERS_FULL_LINK' => true,
|
'PEERS_FULL_LINK' => true,
|
||||||
|
@ -508,13 +511,13 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full')
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['tracker_status']),
|
'SHOW_DL_LIST_LINK' => (($di->config->get('bt_show_dl_list') || $di->config->get('allow_dl_list_names_mode')) && $t_data['tracker_status']),
|
||||||
'SHOW_TOR_ACT' => ($tor_reged && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
|
'SHOW_TOR_ACT' => ($tor_reged && (!$di->config->get('tor_no_tor_act.' . $tor_info['tor_status']) || IS_AM)),
|
||||||
'S_MODE_COUNT' => ($s_mode == 'count'),
|
'S_MODE_COUNT' => ($s_mode == 'count'),
|
||||||
'S_MODE_FULL' => ($s_mode == 'full'),
|
'S_MODE_FULL' => ($s_mode == 'full'),
|
||||||
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
||||||
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
||||||
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
||||||
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
|
'TOR_HELP_LINKS' => $di->config->get('tor_help_links'),
|
||||||
'CALL_SEED' => ($bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
'CALL_SEED' => ($di->config->get('callseed') && $tor_reged && !$di->config->get('tor_no_tor_act.' . $tor_info['tor_status']) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
||||||
));
|
));
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="infobox-body">
|
<div id="infobox-body">
|
||||||
<h2 class="bold">Advertising on <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
|
<h2 class="bold">Advertising on <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a></h2>
|
||||||
<p>For advertising please contact: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
|
<p>For advertising please contact: <strong><a href="mailto:<?php echo $di->config->get('adv_email'); ?>" class="gen"><?php echo $di->config->get('adv_email'); ?></a></strong></p>
|
||||||
</div><!--/infobox-body-->
|
</div><!--/infobox-body-->
|
|
@ -22,11 +22,11 @@ which indicated to us the following information:</p>
|
||||||
|
|
||||||
<p>After that in 48 hours, we will remove interesting you links from the site.</p>
|
<p>After that in 48 hours, we will remove interesting you links from the site.</p>
|
||||||
|
|
||||||
<p class="bold">Our email: <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p class="bold">Our email: <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>WARNING!</p>
|
<p>WARNING!</p>
|
||||||
|
|
||||||
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>b) We have no control over the actions of users who may be re-post links to information, which is the object of your copyright. Any information the forum, place automatically, without any control from any quarter whatsoever, which corresponds to the generally accepted international practice of placing information on the Internet. However, in any case, we consider all your queries regarding the reference to the information that violates your rights.</p>
|
<p>b) We have no control over the actions of users who may be re-post links to information, which is the object of your copyright. Any information the forum, place automatically, without any control from any quarter whatsoever, which corresponds to the generally accepted international practice of placing information on the Internet. However, in any case, we consider all your queries regarding the reference to the information that violates your rights.</p>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<p><h3>ABOUT SITE</h3></p>
|
<p><h3>ABOUT SITE</h3></p>
|
||||||
|
|
||||||
<p>Internet - resource (website) <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a> (hereinafter - Resource) is an internet site that allows users to share information with each other via bit-torrent, as well as in free form, and provides a means to monitor the integrity of information transmitted (via hash-files).</p>
|
<p>Internet - resource (website) <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a> (hereinafter - Resource) is an internet site that allows users to share information with each other via bit-torrent, as well as in free form, and provides a means to monitor the integrity of information transmitted (via hash-files).</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="infobox-body">
|
<div id="infobox-body">
|
||||||
<h2 class="bold">Размещение рекламы на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
|
<h2 class="bold">Размещение рекламы на <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a></h2>
|
||||||
<p>По вопросам размещения рекламы обращайтесь по адресу: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
|
<p>По вопросам размещения рекламы обращайтесь по адресу: <strong><a href="mailto:<?php echo $di->config->get('adv_email'); ?>" class="gen"><?php echo $di->config->get('adv_email'); ?></a></strong></p>
|
||||||
</div><!--/infobox-body-->
|
</div><!--/infobox-body-->
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
<p>После этого, в течении 48 часов, мы удалим интересующие Вас ссылки с сайта.</p>
|
<p>После этого, в течении 48 часов, мы удалим интересующие Вас ссылки с сайта.</p>
|
||||||
|
|
||||||
<p class="bold">Наш email: <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p class="bold">Наш email: <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>ВНИМАНИЕ!</p>
|
<p>ВНИМАНИЕ!</p>
|
||||||
|
|
||||||
<p>а) Мы оставляем за собой право публикации на сайте любой информации присланной нам по почте <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p>а) Мы оставляем за собой право публикации на сайте любой информации присланной нам по почте <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>б) Мы не осуществляем контроль за действиями пользователей, которые могут повторно размещать ссылки на информацию, являющуюся объектом вашего авторского права. Любая информация на форуме, размещается автоматически, без какого либо контроля с чьей либо стороны, что соответствует общепринятой мировой практике размещения информации в сети интернет. Однако, мы в любом случае рассмотрим все Ваши запросы, относительно ссылок на информацию, нарушающую Ваши права.</p>
|
<p>б) Мы не осуществляем контроль за действиями пользователей, которые могут повторно размещать ссылки на информацию, являющуюся объектом вашего авторского права. Любая информация на форуме, размещается автоматически, без какого либо контроля с чьей либо стороны, что соответствует общепринятой мировой практике размещения информации в сети интернет. Однако, мы в любом случае рассмотрим все Ваши запросы, относительно ссылок на информацию, нарушающую Ваши права.</p>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<p><h3>О САЙТЕ</h3></p>
|
<p><h3>О САЙТЕ</h3></p>
|
||||||
|
|
||||||
<p>Интернет - ресурс (сайт) <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a> (в дальнейшем - Ресурс) является интернет-сайтом, позволяющим пользователям обмениваться друг с другом информацией по протоколу бит-торрент, а также в свободной форме, и предоставляющим средства для контроля целостности передаваемой информации (посредством hash-файлов).</p>
|
<p>Интернет - ресурс (сайт) <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a> (в дальнейшем - Ресурс) является интернет-сайтом, позволяющим пользователям обмениваться друг с другом информацией по протоколу бит-торрент, а также в свободной форме, и предоставляющим средства для контроля целостности передаваемой информации (посредством hash-файлов).</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="infobox-body">
|
<div id="infobox-body">
|
||||||
<h2 class="bold">Розміщення реклами на <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a></h2>
|
<h2 class="bold">Розміщення реклами на <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a></h2>
|
||||||
<p>З питань розміщення реклами звертайтесь за адресою: <strong><a href="mailto:<?php echo $bb_cfg['adv_email']; ?>" class="gen"><?php echo $bb_cfg['adv_email']; ?></a></strong></p>
|
<p>З питань розміщення реклами звертайтесь за адресою: <strong><a href="mailto:<?php echo $di->config->get('adv_email'); ?>" class="gen"><?php echo $di->config->get('adv_email'); ?></a></strong></p>
|
||||||
</div><!--/infobox-body-->
|
</div><!--/infobox-body-->
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
<p>Після цього, протягом 48 годин, ми видалимо ці посилання з сайту.</p>
|
<p>Після цього, протягом 48 годин, ми видалимо ці посилання з сайту.</p>
|
||||||
|
|
||||||
<p class="bold">Наш email: <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p class="bold">Наш email: <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>УВАГА!</p>
|
<p>УВАГА!</p>
|
||||||
|
|
||||||
<p>а) Ми залишаємо за собою право публікації на сайті будь-якої інформації присланої нам по пошті <strong><a href="mailto:<?php echo $bb_cfg['abuse_email']; ?>" class="gen"><?php echo $bb_cfg['abuse_email']; ?></a></strong></p>
|
<p>а) Ми залишаємо за собою право публікації на сайті будь-якої інформації присланої нам по пошті <strong><a href="mailto:<?php echo $di->config->get('abuse_email'); ?>" class="gen"><?php echo $di->config->get('abuse_email'); ?></a></strong></p>
|
||||||
|
|
||||||
<p>б) Ми не здійснюємо контроль за діями користувачів, які можуть повторно розміщувати посилання на інформацію, що є об'єктом вашого авторського права. Будь-яка інформація на форумі, розміщується автоматично, без якого контролю з будь якої сторони, що відповідає загальноприйнятій світовій практиці розміщення інформації в мережі інтернет. Проте, ми у будь-якому випадку розглянемо всі Ваші запити, щодо посилань на інформацію, що порушує Ваші права.</p>
|
<p>б) Ми не здійснюємо контроль за діями користувачів, які можуть повторно розміщувати посилання на інформацію, що є об'єктом вашого авторського права. Будь-яка інформація на форумі, розміщується автоматично, без якого контролю з будь якої сторони, що відповідає загальноприйнятій світовій практиці розміщення інформації в мережі інтернет. Проте, ми у будь-якому випадку розглянемо всі Ваші запити, щодо посилань на інформацію, що порушує Ваші права.</p>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<p><h3>ПРО САЙТ</h3></p>
|
<p><h3>ПРО САЙТ</h3></p>
|
||||||
|
|
||||||
<p>Інтернет - ресурс (сайт) <a href="http://<?php echo ($bb_cfg['server_port'] != 80) ? "{$bb_cfg['server_name']}:{$bb_cfg['server_port']}" : $bb_cfg['server_name']; ?>"><?php echo $bb_cfg['sitename']?></a> (надалі - Ресурс) є інтернет-сайтом, що дозволяє користувачам обмінюватися один з одним інформацією по протоколу біт-торрент, а також у вільній формі, що надає засоби для контролю цілісності інформації, що передається (за допомогою hash-файлів).</p>
|
<p>Інтернет - ресурс (сайт) <a href="http://<?php echo ($di->config->get('server_port') != 80) ? "{$di->config->get('server_name')}:{$di->config->get('server_port')}" : $di->config->get('server_name'); ?>"><?php echo $di->config->get('sitename')?></a> (надалі - Ресурс) є інтернет-сайтом, що дозволяє користувачам обмінюватися один з одним інформацією по протоколу біт-торрент, а також у вільній формі, що надає засоби для контролю цілісності інформації, що передається (за допомогою hash-файлів).</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
|
|
10
login.php
10
login.php
|
@ -70,7 +70,7 @@ $need_captcha = false;
|
||||||
if (!$mod_admin_login)
|
if (!$mod_admin_login)
|
||||||
{
|
{
|
||||||
$need_captcha = $cache->has('l_err_'. USER_IP);
|
$need_captcha = $cache->has('l_err_'. USER_IP);
|
||||||
if ($need_captcha < $bb_cfg['invalid_logins']) $need_captcha = false;
|
if ($need_captcha < $di->config->get('invalid_logins')) $need_captcha = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// login
|
// login
|
||||||
|
@ -89,7 +89,7 @@ if (isset($_POST['login']))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Captcha
|
// Captcha
|
||||||
if ($need_captcha && !bb_captcha('check') && !$bb_cfg['captcha']['disabled'])
|
if ($need_captcha && !bb_captcha('check') && !$di->config->get('captcha.disabled'))
|
||||||
{
|
{
|
||||||
$login_errors[] = $lang['CAPTCHA_WRONG'];
|
$login_errors[] = $lang['CAPTCHA_WRONG'];
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ if (isset($_POST['login']))
|
||||||
{
|
{
|
||||||
if ($user->login($_POST, $mod_admin_login))
|
if ($user->login($_POST, $mod_admin_login))
|
||||||
{
|
{
|
||||||
$redirect_url = (defined('FIRST_LOGON')) ? $bb_cfg['first_logon_redirect_url'] : $redirect_url;
|
$redirect_url = (defined('FIRST_LOGON')) ? $di->config->get('first_logon_redirect_url') : $redirect_url;
|
||||||
// Удаление при введении правильной комбинации логин/пароль
|
// Удаление при введении правильной комбинации логин/пароль
|
||||||
$cache->delete('l_err_'. USER_IP);
|
$cache->delete('l_err_'. USER_IP);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ if (isset($_POST['login']))
|
||||||
|
|
||||||
if (!$mod_admin_login) {
|
if (!$mod_admin_login) {
|
||||||
$login_err = $cache->get('l_err_' . USER_IP);
|
$login_err = $cache->get('l_err_' . USER_IP);
|
||||||
if ($login_err > $bb_cfg['invalid_logins']) $need_captcha = true;
|
if ($login_err > $di->config->get('invalid_logins')) $need_captcha = true;
|
||||||
$cache->set('l_err_' . USER_IP, ($login_err + 1), 3600);
|
$cache->set('l_err_' . USER_IP, ($login_err + 1), 3600);
|
||||||
} else {
|
} else {
|
||||||
$need_captcha = false;
|
$need_captcha = false;
|
||||||
|
@ -127,7 +127,7 @@ if (IS_GUEST || $mod_admin_login)
|
||||||
'ERROR_MESSAGE' => join('<br />', $login_errors),
|
'ERROR_MESSAGE' => join('<br />', $login_errors),
|
||||||
'ADMIN_LOGIN' => $mod_admin_login,
|
'ADMIN_LOGIN' => $mod_admin_login,
|
||||||
'REDIRECT_URL' => htmlCHR($redirect_url),
|
'REDIRECT_URL' => htmlCHR($redirect_url),
|
||||||
'CAPTCHA_HTML' => ($need_captcha && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : '',
|
'CAPTCHA_HTML' => ($need_captcha && !$di->config->get('captcha.disabled')) ? bb_captcha('get') : '',
|
||||||
'PAGE_TITLE' => $lang['LOGIN'],
|
'PAGE_TITLE' => $lang['LOGIN'],
|
||||||
'S_LOGIN_ACTION' => LOGIN_URL,
|
'S_LOGIN_ACTION' => LOGIN_URL,
|
||||||
));
|
));
|
||||||
|
|
|
@ -4,6 +4,9 @@ define('BB_SCRIPT', 'memberlist');
|
||||||
define('BB_ROOT', './');
|
define('BB_ROOT', './');
|
||||||
require(BB_ROOT .'common.php');
|
require(BB_ROOT .'common.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
$page_cfg['use_tablesorter'] = true;
|
$page_cfg['use_tablesorter'] = true;
|
||||||
|
|
||||||
$user->session_start(array('req_login' => true));
|
$user->session_start(array('req_login' => true));
|
||||||
|
@ -73,28 +76,28 @@ $template->assign_vars(array(
|
||||||
switch( $mode )
|
switch( $mode )
|
||||||
{
|
{
|
||||||
case 'joined':
|
case 'joined':
|
||||||
$order_by = "user_id $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_id $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'username':
|
case 'username':
|
||||||
$order_by = "username $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "username $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'location':
|
case 'location':
|
||||||
$order_by = "user_from $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_from $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'posts':
|
case 'posts':
|
||||||
$order_by = "user_posts $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_posts $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'email':
|
case 'email':
|
||||||
$order_by = "user_email $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_email $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'website':
|
case 'website':
|
||||||
$order_by = "user_website $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_website $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'topten':
|
case 'topten':
|
||||||
$order_by = "user_posts $sort_order LIMIT 10";
|
$order_by = "user_posts $sort_order LIMIT 10";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$order_by = "user_regdate $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
|
$order_by = "user_regdate $sort_order LIMIT $start, " . $di->config->get('topics_per_page');
|
||||||
$mode = 'joined';
|
$mode = 'joined';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -166,13 +169,13 @@ if ($result = DB()->fetch_rowset($sql))
|
||||||
{
|
{
|
||||||
$user_id = $row['user_id'];
|
$user_id = $row['user_id'];
|
||||||
$from = $row['user_from'];
|
$from = $row['user_from'];
|
||||||
$joined = bb_date($row['user_regdate'], $bb_cfg['date_format']);
|
$joined = bb_date($row['user_regdate'], $di->config->get('date_format'));
|
||||||
$posts = $row['user_posts'];
|
$posts = $row['user_posts'];
|
||||||
$pm = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="'. (PM_URL . "?mode=post&". POST_USERS_URL ."=$user_id") .'">'. $lang['SEND_PM_TXTB'] .'</a>' : '<a href="' . (PM_URL . "?mode=post&". POST_USERS_URL ."=$user_id") .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
$pm = ($di->config->get('text_buttons')) ? '<a class="txtb" href="'. (PM_URL . "?mode=post&". POST_USERS_URL ."=$user_id") .'">'. $lang['SEND_PM_TXTB'] .'</a>' : '<a href="' . (PM_URL . "?mode=post&". POST_USERS_URL ."=$user_id") .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
||||||
|
|
||||||
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN)
|
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN)
|
||||||
{
|
{
|
||||||
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email'];
|
$email_uri = ($di->config->get('board_email_form')) ? ("profile.php?mode=email&". POST_USERS_URL ."=$user_id") : 'mailto:'. $row['user_email'];
|
||||||
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
|
$email = '<a class="editable" href="'. $email_uri .'">'. $row['user_email'] .'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -182,7 +185,7 @@ if ($result = DB()->fetch_rowset($sql))
|
||||||
|
|
||||||
if ($row['user_website'])
|
if ($row['user_website'])
|
||||||
{
|
{
|
||||||
$www = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww">'. $lang['VISIT_WEBSITE_TXTB'] .'</a>' : '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
$www = ($di->config->get('text_buttons')) ? '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww">'. $lang['VISIT_WEBSITE_TXTB'] .'</a>' : '<a class="txtb" href="'. $row['user_website'] .'" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -214,7 +217,7 @@ else
|
||||||
|
|
||||||
$paginationurl = "memberlist.php?mode=$mode&order=$sort_order&letter=$by_letter";
|
$paginationurl = "memberlist.php?mode=$mode&order=$sort_order&letter=$by_letter";
|
||||||
if ($paginationusername) $paginationurl .= "&username=$paginationusername";
|
if ($paginationusername) $paginationurl .= "&username=$paginationusername";
|
||||||
if ( $mode != 'topten' || $bb_cfg['topics_per_page'] < 10 )
|
if ( $mode != 'topten' || $di->config->get('topics_per_page') < 10 )
|
||||||
{
|
{
|
||||||
$sql = "SELECT COUNT(*) AS total FROM ". BB_USERS;
|
$sql = "SELECT COUNT(*) AS total FROM ". BB_USERS;
|
||||||
$sql .= ($letter_sql) ? " WHERE $letter_sql" : '';
|
$sql .= ($letter_sql) ? " WHERE $letter_sql" : '';
|
||||||
|
@ -225,7 +228,7 @@ if ( $mode != 'topten' || $bb_cfg['topics_per_page'] < 10 )
|
||||||
if ($total = DB()->sql_fetchrow($result))
|
if ($total = DB()->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$total_members = $total['total'];
|
$total_members = $total['total'];
|
||||||
generate_pagination($paginationurl, $total_members, $bb_cfg['topics_per_page'], $start). ' ';
|
generate_pagination($paginationurl, $total_members, $di->config->get('topics_per_page'), $start). ' ';
|
||||||
}
|
}
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ return [
|
||||||
'File not found: %location%' => 'File not found: %location%',
|
'File not found: %location%' => 'File not found: %location%',
|
||||||
'Invalid request: not specified %data%' => 'Invalid request: not specified %data%',
|
'Invalid request: not specified %data%' => 'Invalid request: not specified %data%',
|
||||||
|
|
||||||
// Feed
|
// Feed (feed.php)
|
||||||
'Feed' => 'Feed',
|
'Feed' => 'Feed',
|
||||||
'Do not specify a mode for the feed' => 'Do not specify a mode for the feed',
|
'Do not specify a mode for the feed' => 'Do not specify a mode for the feed',
|
||||||
'This forum does not have a feed' => 'This forum does not have a feed',
|
'This forum does not have a feed' => 'This forum does not have a feed',
|
||||||
|
|
19
modcp.php
19
modcp.php
|
@ -7,6 +7,9 @@ require(INC_DIR .'bbcode.php');
|
||||||
require(INC_DIR .'functions_post.php');
|
require(INC_DIR .'functions_post.php');
|
||||||
require_once(INC_DIR .'functions_admin.php');
|
require_once(INC_DIR .'functions_admin.php');
|
||||||
|
|
||||||
|
/** @var \TorrentPier\Di $di */
|
||||||
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions
|
// Functions
|
||||||
//
|
//
|
||||||
|
@ -260,15 +263,15 @@ switch ($mode)
|
||||||
$result = topic_delete($req_topics, $forum_id);
|
$result = topic_delete($req_topics, $forum_id);
|
||||||
|
|
||||||
//Обновление кеша новостей на главной
|
//Обновление кеша новостей на главной
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', $di->config->get('latest_news_forum_id')));
|
||||||
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result)
|
if (isset($news_forums[$forum_id]) && $di->config->get('show_latest_news') && $result)
|
||||||
{
|
{
|
||||||
$datastore->enqueue('latest_news');
|
$datastore->enqueue('latest_news');
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
}
|
}
|
||||||
|
|
||||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
$net_forums = array_flip(explode(',', $di->config->get('network_news_forum_id')));
|
||||||
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result)
|
if (isset($net_forums[$forum_id]) && $di->config->get('show_network_news') && $result)
|
||||||
{
|
{
|
||||||
$datastore->enqueue('network_news');
|
$datastore->enqueue('network_news');
|
||||||
$datastore->update('network_news');
|
$datastore->update('network_news');
|
||||||
|
@ -296,15 +299,15 @@ switch ($mode)
|
||||||
$result = topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']));
|
$result = topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']));
|
||||||
|
|
||||||
//Обновление кеша новостей на главной
|
//Обновление кеша новостей на главной
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', $di->config->get('latest_news_forum_id')));
|
||||||
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result)
|
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $di->config->get('show_latest_news') && $result)
|
||||||
{
|
{
|
||||||
$datastore->enqueue('latest_news');
|
$datastore->enqueue('latest_news');
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
}
|
}
|
||||||
|
|
||||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
$net_forums = array_flip(explode(',', $di->config->get('network_news_forum_id')));
|
||||||
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result)
|
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $di->config->get('show_network_news') && $result)
|
||||||
{
|
{
|
||||||
$datastore->enqueue('network_news');
|
$datastore->enqueue('network_news');
|
||||||
$datastore->update('network_news');
|
$datastore->update('network_news');
|
||||||
|
|
25
package.json
Normal file
25
package.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "torrentpier",
|
||||||
|
"version": "2.1.0",
|
||||||
|
"description": "TorrentPier. Bittorrent-tracker engine",
|
||||||
|
"main": "build/index.js",
|
||||||
|
"directories": {
|
||||||
|
"test": "tests"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/torrentpier/torrentpier.git"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/torrentpier/torrentpier/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://torrentpier.me/",
|
||||||
|
"devDependencies": {
|
||||||
|
"gulp": "^3.9.1"
|
||||||
|
}
|
||||||
|
}
|
10
poll.php
10
poll.php
|
@ -46,9 +46,9 @@ if ($mode != 'poll_vote')
|
||||||
// проверка на возможность вносить изменения
|
// проверка на возможность вносить изменения
|
||||||
if ($mode == 'poll_delete')
|
if ($mode == 'poll_delete')
|
||||||
{
|
{
|
||||||
if ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days'] * 86400)
|
if ($t_data['topic_time'] < TIMENOW - $di->config->get('poll_max_days') * 86400)
|
||||||
{
|
{
|
||||||
bb_die(sprintf($lang['NEW_POLL_DAYS'], $bb_cfg['poll_max_days']));
|
bb_die(sprintf($lang['NEW_POLL_DAYS'], $di->config->get('poll_max_days')));
|
||||||
}
|
}
|
||||||
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED))
|
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED))
|
||||||
{
|
{
|
||||||
|
@ -174,8 +174,10 @@ class bb_poll
|
||||||
|
|
||||||
function bb_poll ()
|
function bb_poll ()
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
/** @var \TorrentPier\Di $di */
|
||||||
$this->max_votes = $bb_cfg['max_poll_options'];
|
$di = \TorrentPier\Di::getInstance();
|
||||||
|
|
||||||
|
$this->max_votes = $di->config->get('max_poll_options');
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_poll_data ($posted_data)
|
function build_poll_data ($posted_data)
|
||||||
|
|
21
posting.php
21
posting.php
|
@ -207,7 +207,7 @@ else
|
||||||
bb_die($lang['NO_SUCH_POST']);
|
bb_die($lang['NO_SUCH_POST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bb_cfg['attach']['allowed_ext'] = ($post_info['allow_reg_tracker']) ? $bb_cfg['tor_forums_allowed_ext'] : $bb_cfg['gen_forums_allowed_ext'];
|
$attach_allowed_ext = ($post_info['allow_reg_tracker']) ? $di->config->get('tor_forums_allowed_ext') : $di->config->get('gen_forums_allowed_ext');
|
||||||
|
|
||||||
if (!$is_auth[$is_auth_type])
|
if (!$is_auth[$is_auth_type])
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ if (!$is_auth[$is_auth_type])
|
||||||
|
|
||||||
if ($mode == 'new_rel')
|
if ($mode == 'new_rel')
|
||||||
{
|
{
|
||||||
if ($tor_status = join(',', $bb_cfg['tor_cannot_new']))
|
if ($tor_status = join(',', $di->config->get('tor_cannot_new')))
|
||||||
{
|
{
|
||||||
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
|
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
|
||||||
FROM ". BB_BT_TORRENTS ." tor, ". BB_TOPICS ." t
|
FROM ". BB_BT_TORRENTS ." tor, ". BB_TOPICS ." t
|
||||||
|
@ -250,9 +250,8 @@ if ($mode == 'new_rel')
|
||||||
");
|
");
|
||||||
|
|
||||||
$topics = '';
|
$topics = '';
|
||||||
foreach($sql as $row)
|
foreach ($sql as $row) {
|
||||||
{
|
$topics .= $di->config->get('tor_icons.' . $row['tor_status']) . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
|
||||||
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] .'<a href="'. TOPIC_URL . $row['topic_id'] .'">'. $row['topic_title'] .'</a><div class="spacer_12"></div>';
|
|
||||||
}
|
}
|
||||||
if ($topics) bb_die($topics . $lang['UNEXECUTED_RELEASE']);
|
if ($topics) bb_die($topics . $lang['UNEXECUTED_RELEASE']);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +290,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
|
||||||
AND pt.post_id = p.post_id
|
AND pt.post_id = p.post_id
|
||||||
AND p.post_time > $topic_last_read
|
AND p.post_time > $topic_last_read
|
||||||
ORDER BY p.post_time
|
ORDER BY p.post_time
|
||||||
LIMIT ". $bb_cfg['posts_per_page'];
|
LIMIT ". $di->config->get('posts_per_page');
|
||||||
|
|
||||||
if ($rowset = DB()->fetch_rowset($sql))
|
if ($rowset = DB()->fetch_rowset($sql))
|
||||||
{
|
{
|
||||||
|
@ -303,7 +302,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
|
||||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||||
'POSTER' => profile_url($row),
|
'POSTER' => profile_url($row),
|
||||||
'POSTER_NAME_JS' => addslashes($row['username']),
|
'POSTER_NAME_JS' => addslashes($row['username']),
|
||||||
'POST_DATE' => bb_date($row['post_time'], $bb_cfg['post_date_format']),
|
'POST_DATE' => bb_date($row['post_time'], $di->config->get('post_date_format')),
|
||||||
'MESSAGE' => get_parsed_post($row),
|
'MESSAGE' => get_parsed_post($row),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -402,7 +401,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
require(INC_DIR .'functions_upload.php');
|
require(INC_DIR .'functions_upload.php');
|
||||||
$upload = new upload_common();
|
$upload = new upload_common();
|
||||||
|
|
||||||
if ($upload->init($bb_cfg['attach'], $_FILES['attach']) && $upload->store('attach', array('topic_id' => $topic_id)))
|
if ($upload->init($di->config->get('attach'), $_FILES['attach']) && $upload->store('attach', array('topic_id' => $topic_id)))
|
||||||
{
|
{
|
||||||
DB()->query("
|
DB()->query("
|
||||||
UPDATE ". BB_TOPICS ." SET
|
UPDATE ". BB_TOPICS ." SET
|
||||||
|
@ -414,7 +413,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
if ($upload->file_ext_id == 8)
|
if ($upload->file_ext_id == 8)
|
||||||
{
|
{
|
||||||
require_once(INC_DIR .'functions_torrent.php');
|
require_once(INC_DIR .'functions_torrent.php');
|
||||||
if ($bb_cfg['premod'])
|
if ($di->config->get('premod'))
|
||||||
{
|
{
|
||||||
// Получение списка id форумов начиная с parent
|
// Получение списка id форумов начиная с parent
|
||||||
$forum_parent = $forum_id;
|
$forum_parent = $forum_id;
|
||||||
|
@ -669,14 +668,14 @@ $template->assign_vars(array(
|
||||||
if ($mode == 'newtopic' || $post_data['first_post'])
|
if ($mode == 'newtopic' || $post_data['first_post'])
|
||||||
{
|
{
|
||||||
$file_attached = !empty($post_info['attach_ext_id']);
|
$file_attached = !empty($post_info['attach_ext_id']);
|
||||||
$allowed_ext = $bb_cfg['attach']['allowed_ext'];
|
$allowed_ext = $attach_allowed_ext;
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'POSTING_SUBJECT' => true,
|
'POSTING_SUBJECT' => true,
|
||||||
'SHOW_ATTACH' => ($file_attached || $allowed_ext),
|
'SHOW_ATTACH' => ($file_attached || $allowed_ext),
|
||||||
'S_FORM_ENCTYPE' => 'enctype="multipart/form-data"',
|
'S_FORM_ENCTYPE' => 'enctype="multipart/form-data"',
|
||||||
'FILE_ATTACHED' => $file_attached,
|
'FILE_ATTACHED' => $file_attached,
|
||||||
'ATTACH_MAX_SIZE' => humn_size($bb_cfg['attach']['max_size']),
|
'ATTACH_MAX_SIZE' => humn_size($di->config->get('attach.max_size')),
|
||||||
'ALLOWED_EXT' => ($allowed_ext) ? '*.' . join(', *.', $allowed_ext) : 'прикреплять запрещено', // TODO: перевести
|
'ALLOWED_EXT' => ($allowed_ext) ? '*.' . join(', *.', $allowed_ext) : 'прикреплять запрещено', // TODO: перевести
|
||||||
'TOR_REQUIRED' => !empty($_POST['tor_required']),
|
'TOR_REQUIRED' => !empty($_POST['tor_required']),
|
||||||
'POLL_TIP' => ($mode == 'newtopic') ? 'Вы сможете добавить опрос после создания темы' : 'Вы можете добавить опрос со страницы просмотра темы', // TODO: перевести
|
'POLL_TIP' => ($mode == 'newtopic') ? 'Вы сможете добавить опрос после создания темы' : 'Вы можете добавить опрос со страницы просмотра темы', // TODO: перевести
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue