diff --git a/.gitignore b/.gitignore index eff46f4db..244880992 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,3 @@ $RECYCLE.BIN/ *.orig *.rej -### TEMP ### -data/old_files/ -data/torrent_files/ diff --git a/README.md b/README.md index d797e4e54..433117f88 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,7 @@ TorrentPier - движок торрент-трекера, написанный Исходя из настроек вашего сервера, устанавливаем рекомендуемые права доступа (chmod) на указанные папки **777**, а на файлы внутри этих папок (кроме файлов **.htaccess** и **.keep**) **666**: - data/avatars -- data/old_files -- data/torrent_files +- data/files - internal_data/ajax_html - internal_data/atom - internal_data/cache @@ -47,7 +46,7 @@ TorrentPier - движок торрент-трекера, написанный ## Необходимые модули php - php5-tidy + php5-tidy php5-filter Начиная с версии 2.0.9 (ревизия 592 в старой нумерации) данный модуль не является обязательным, но его установка крайне рекомендуется для повышения качества обработки html-кода тем и сообщений пользователей. ## Рекомендуемый способ запуска cron.php diff --git a/data/old_files/.htaccess b/data/old_files/.htaccess deleted file mode 100644 index 6c4686a91..000000000 --- a/data/old_files/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -php_flag engine off -RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp -AddType text/plain .php .php .htm .html .phtml .pl .asp \ No newline at end of file diff --git a/data/torrent_files/.htaccess b/data/torrent_files/.htaccess deleted file mode 100644 index 6c4686a91..000000000 --- a/data/torrent_files/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -php_flag engine off -RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp -AddType text/plain .php .php .htm .html .phtml .pl .asp \ No newline at end of file diff --git a/install/upgrade/r600-stable.php b/install/upgrade/r600-stable.php index 8788e74c3..3245f8a25 100644 --- a/install/upgrade/r600-stable.php +++ b/install/upgrade/r600-stable.php @@ -136,7 +136,7 @@ INSERT INTO `bb_cron` VALUES (22, 1, 'Sitemap update', 'sitemap.php', 'daily', N // добавлено 593 ↑ INSERT INTO `bb_cron` VALUES (23, 1, 'Update forums atom', 'update_forums_atom.php', 'interval', NULL, NULL, 255, '', '', '00:15:00', 0, '', 0, 0, 0); // добавлено 595 ↑ -UPDATE `bb_attachments_config` SET `config_value` = 'old_files' WHERE `config_name` = 'upload_dir'; +UPDATE `bb_attachments_config` SET `config_value` = 'files' WHERE `config_name` = 'upload_dir'; // изменено 595 ↑ DELETE FROM `bb_smilies` WHERE `code` = ':cd:'; // удалено 596 ALTER TABLE `bb_groups` CHANGE `group_description` `group_description` text NOT NULL DEFAULT ''; diff --git a/library/TorrentPier/Upload.php b/library/TorrentPier/Upload.php index 4eceb6612..1e8d2303d 100644 --- a/library/TorrentPier/Upload.php +++ b/library/TorrentPier/Upload.php @@ -167,7 +167,7 @@ class Upload return false; } - $this->file_ext_id = @$this->ext_ids[$this->file_ext]; + $this->file_ext_id = $this->ext_ids[$this->file_ext]; return true; } @@ -189,7 +189,7 @@ class Upload } else if ($mode == 'attach') { - $file_path = get_attach_path($params['topic_id']); + $file_path = get_attach_path($params['topic_id'], $params['attach_ext_id']); return $this->_move($file_path); } diff --git a/library/config.php b/library/config.php index cc5b8819f..41d32c40d 100644 --- a/library/config.php +++ b/library/config.php @@ -61,7 +61,7 @@ if (!defined('BB_ROOT')) die(basename(__FILE__)); -$bb_cfg = $tr_cfg = $page_cfg = array(); +$bb_cfg = $tr_cfg = $page_cfg = []; // Increase number after changing js or css $bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1; @@ -81,13 +81,13 @@ $pconnect = false; // Настройка баз данных ['db']['srv_name'] => (array) srv_cfg; // порядок параметров srv_cfg (хост, название базы, пользователь, пароль, charset, pconnect); -$bb_cfg['db'] = array( - 'db1' => array('localhost', 'tp_216', 'user', 'pass', $charset, $pconnect), +$bb_cfg['db'] = [ + 'db1' => ['localhost', 'tp_216', 'user', 'pass', $charset, $pconnect], //'db2' => array('localhost2', 'dbase2', 'user2', 'pass2', $charset, $pconnect), //'db3' => array('localhost3', 'dbase3', 'user2', 'pass3', $charset, $pconnect), -); +]; -$bb_cfg['db_alias'] = array( +$bb_cfg['db_alias'] = [ // 'alias' => 'srv_name' # db1 'log' => 'db1', // BB_LOG @@ -101,36 +101,34 @@ $bb_cfg['db_alias'] = array( # db3 'pm' => 'db1', // BB_PRIVMSGS, BB_PRIVMSGS_TEXT 'pt' => 'db1', // BB_POSTS_TEXT -); +]; // Cache $bb_cfg['cache']['pconnect'] = true; $bb_cfg['cache']['db_dir'] = realpath(BB_ROOT) .'/internal_data/cache/filecache/'; $bb_cfg['cache']['prefix'] = 'tp_'; // Префикс кеша ('tp_') -$bb_cfg['cache']['memcache'] = array( +$bb_cfg['cache']['memcache'] = [ 'host' => '127.0.0.1', 'port' => 11211, 'pconnect' => true, 'con_required' => true, -); -$bb_cfg['cache']['redis'] = array( +]; +$bb_cfg['cache']['redis'] = [ 'host' => '127.0.0.1', 'port' => 6379, 'con_required' => true, -); +]; // Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache) # name => array( (string) type, (array) cfg ) -$bb_cfg['cache']['engines'] = array( - 'bb_cache' => array('filecache', array()), - 'bb_config' => array('filecache', array()), - 'tr_cache' => array('filecache', array()), - 'bb_session' => array('filecache', array()), - 'bb_login_err' => array('filecache', array()), - 'bb_poll_data' => array('filecache', array()), -); -// Datastore -// Available datastore types: memcache, sqlite, redis, apc, xcache (default filecache) +$bb_cfg['cache']['engines'] = [ + 'bb_cache' => ['filecache', []], + 'bb_config' => ['filecache', []], + 'tr_cache' => ['filecache', []], + 'bb_session' => ['filecache', []], + 'bb_login_err' => ['filecache', []], + 'bb_poll_data' => ['filecache', []], +]; $bb_cfg['datastore_type'] = 'filecache'; // Server @@ -155,14 +153,14 @@ $bb_cfg['verify_reported_ip'] = true; // Verify IP reported by clie $bb_cfg['allow_internal_ip'] = false; // Allow internal IP (10.xx.. etc.) // Ocelot -$bb_cfg['ocelot'] = array( +$bb_cfg['ocelot'] = [ 'enabled' => false, 'host' => $domain_name, 'port' => 2710, 'url' => "http://$domain_name:2710/", // with '/' 'secret' => 'some_10_chars', // 10 chars 'stats' => 'some_10_chars', // 10 chars -); +]; // FAQ url help link $bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // Как скачивать? @@ -174,7 +172,7 @@ $bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Помощь по $bb_cfg['bt_min_ratio_allow_dl_tor'] = 0.3; // 0 - disable $bb_cfg['bt_min_ratio_warning'] = 0.6; // 0 - disable -$tr_cfg = array( +$tr_cfg = [ 'autoclean' => true, 'off' => false, 'off_reason' => 'temporarily disabled', @@ -197,7 +195,7 @@ $tr_cfg = array( 'retracker' => true, 'retracker_host' => 'http://retracker.local/announce', 'freeleech' => false, -); +]; $bb_cfg['show_dl_status_in_search'] = true; $bb_cfg['show_dl_status_in_forum'] = true; @@ -205,7 +203,6 @@ $bb_cfg['show_dl_status_in_forum'] = true; $bb_cfg['show_tor_info_in_dl_list'] = true; $bb_cfg['allow_dl_list_names_mode'] = true; -$bb_cfg['torrent_name_style'] = true; // use torrent name style [yoursite.com].txxx.torrent $bb_cfg['tor_help_links'] = 'terms.php'; // Сколько дней сохранять торрент зарегистрированным / Days to keep torrent registered, if: @@ -221,11 +218,11 @@ define('MIN_DL_FOR_RATIO', 10737418240); // 10 GB in bytes, 0 - disable // rating < 0.5 -- only 2 // rating < 0.6 -- only 3 // rating > 0.6 -- depend on your tracker config limits (in "ACP - Tracker Config - Limits") -$rating_limits = array( +$rating_limits = [ '0.4' => 1, '0.5' => 2, '0.6' => 3, -); +]; // DL-Status (days to keep user's dlstatus records) $bb_cfg['dl_will_days_keep'] = 360; @@ -239,11 +236,11 @@ $bb_cfg['torstat_days_keep'] = 60; // days to keep user's per-torrent sta // Tor-Help $bb_cfg['torhelp_enabled'] = false; // find dead torrents (without seeder) that user might help seeding -$page_cfg['show_torhelp'] = array( +$page_cfg['show_torhelp'] = [ # BB_SCRIPT => true 'index' => true, 'tracker' => true, -); +]; // Path (trailing slash '/' at the end: XX_PATH - without, XX_DIR - with) define('BB_PATH', realpath(BB_ROOT) ); @@ -303,31 +300,31 @@ else } } -$bb_cfg['lang'] = array( - 'ru' => array( +$bb_cfg['lang'] = [ + 'ru' => [ 'name' => 'Русский', 'locale' => 'ru_RU.UTF-8', 'encoding' => 'UTF-8', 'captcha' => 'ru', - ), - 'uk' => array( + ], + 'uk' => [ 'name' => 'Український', 'locale' => 'uk_UA.UTF-8', 'encoding' => 'UTF-8', 'captcha' => 'uk', - ), - 'en' => array( + ], + 'en' => [ 'name' => 'English', 'locale' => 'en_US.UTF-8', 'encoding' => 'UTF-8', 'captcha' => 'en', - ), -); + ], +]; -$bb_cfg['templates'] = array( +$bb_cfg['templates'] = [ // 'folder' => 'Name', 'default' => 'Стандартный', -); +]; $bb_cfg['tpl_name'] = 'default'; $bb_cfg['stylesheet'] = 'main.css'; @@ -335,17 +332,17 @@ $bb_cfg['stylesheet'] = 'main.css'; $bb_cfg['show_sidebar1_on_every_page'] = false; $bb_cfg['show_sidebar2_on_every_page'] = false; -$page_cfg['show_sidebar1'] = array( +$page_cfg['show_sidebar1'] = [ # BB_SCRIPT => true 'index' => true, -); -$page_cfg['show_sidebar2'] = array( +]; +$page_cfg['show_sidebar2'] = [ # BB_SCRIPT => true 'index' => true, -); +]; // Cookie -$bb_cfg['cookie_domain'] = in_array($domain_name, array(getenv('SERVER_ADDR'), 'localhost')) ? '' : ".$domain_name"; +$bb_cfg['cookie_domain'] = in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost']) ? '' : ".$domain_name"; $bb_cfg['cookie_secure'] = (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ? 1 : 0; $bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_' @@ -375,17 +372,17 @@ $bb_cfg['smtp_port'] = 25; // SMTP server port $bb_cfg['smtp_username'] = ''; // enter a username if your SMTP server requires it $bb_cfg['smtp_password'] = ''; // enter a password if your SMTP server requires it -$bb_cfg['smtp'] = array( +$bb_cfg['smtp'] = [ 'name' => 'yandex.ru', 'host' => 'smtp.yandex.ru', 'port' => 465, 'connection_class' => 'login', - 'connection_config' => array( + 'connection_config' => [ 'username' => '', 'password' => '', 'ssl' => 'ssl', - ), -); + ], +]; $bb_cfg['board_email'] = "noreply@$domain_name"; // admin email address $bb_cfg['board_email_form'] = false; // can users send email to each other via board @@ -413,20 +410,20 @@ define('SQL_SLOW_QUERY_TIME', 10); // slow query in seconds define('SQL_PREPEND_SRC_COMM', false); // prepend source file comment to sql query // Special users -$bb_cfg['dbg_users'] = array( +$bb_cfg['dbg_users'] = [ # user_id => 'name', 2 => 'admin', -); +]; -$bb_cfg['unlimited_users'] = array( +$bb_cfg['unlimited_users'] = [ # user_id => 'name', 2 => 'admin', -); +]; -$bb_cfg['super_admins'] = array( +$bb_cfg['super_admins'] = [ # user_id => 'name', 2 => 'admin', -); +]; // Log options define('LOG_EXT', 'log'); @@ -453,7 +450,7 @@ $bb_cfg['date_format'] = 'Y-m-d'; $bb_cfg['sf_on_first_page_only'] = true; // Forums -$bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300); +$bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Topics $bb_cfg['show_quick_reply'] = true; @@ -470,7 +467,7 @@ $bb_cfg['ext_link_new_win'] = true; // open external links in new $bb_cfg['topic_moved_days_keep'] = 7; // remove topic moved links after xx days (or FALSE to disable) -$bb_cfg['allowed_posts_per_page'] = array(15, 30, 50, 100); +$bb_cfg['allowed_posts_per_page'] = [15, 30, 50, 100]; $bb_cfg['user_signature_start'] = '