Compare commits

..

No commits in common. "master" and "v2.4.0-rc2" have entirely different histories.

919 changed files with 16831 additions and 58654 deletions

View file

@ -1,7 +0,0 @@
9766c534bddad8e82e6d19f9bad5cf70b9887f9a
92ce77ec0ec703c08a659419087a373f76e711f7
2d53efc945c7747be1755d0b66557a86bdc12cbd
602137b65129b817811b80975a369ebde3270c6d
4eb26ae37e1f4c82a45961517ffeb54c20200408
e59adce848a9e10ee5775254045cbbd915236b8b
9e0a64108d62236ab07b3f8d10e8c78269b8e1d1

View file

@ -1,11 +1,9 @@
# Common params # Common params
TP_HOST=example.com APP_ENV=local
TP_PORT=80
APP_ENV=production
APP_CRON_ENABLED=true APP_CRON_ENABLED=true
APP_DEMO_MODE=false
# Database credentials # Database credentials
DB_CONNECTION=mysql
DB_HOST=localhost DB_HOST=localhost
DB_PORT=3306 DB_PORT=3306
DB_DATABASE=torrentpier DB_DATABASE=torrentpier

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View file

@ -1,62 +0,0 @@
name: Bug Report
description: File a bug report
title: "[Bug]"
labels: [Bug]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
The more detailed this bug report is, the faster it can be reviewed and fixed.
- type: input
id: version-torrentpier
attributes:
label: TorrentPier Version
description: TorrentPier version your using?
placeholder: 2.4.0
validations:
required: true
- type: input
id: version-php-os
attributes:
label: PHP & Platform
description: Exact PHP and Platform (OS) versions your using.
placeholder: 8.2.2 - Ubuntu 22.04 x64
validations:
required: true
- type: checkboxes
id: requirements
attributes:
label: Have you done this?
options:
- label: I am willing to share my stack trace and logs
required: true
- label: I can suggest a fix as a Pull Request
required: false
- type: textarea
id: expectation
attributes:
label: Expectation
description: Write what you expect to (correctly) happen.
placeholder: When I do this, I expect to this to happen.
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Write what (incorrectly) happens instead.
placeholder: Instead, when I do this, I receive that.
validations:
required: true
- type: textarea
id: logs
attributes:
label: Stack trace & logs
description: |
If you have a stack trace, you can copy it here. You may hide sensitive information.
Including a stack trace when reporting an error 500 is required.
placeholder: This is automatically formatted into code, no need for backticks.
render: shell
validations:
required: false

View file

@ -1,7 +0,0 @@
---
name: Feature / Enhancement request
about: Suggest an idea for TorrentPier
title: "[Feature]"
labels: [Feature, Enhancement]
assignees: ''
---

View file

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -1,80 +0,0 @@
name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-22.04
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
release:
name: Create release
needs: [ generate-changelog ]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Composer dependencies
run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader
- name: Cleanup
run: php _cleanup.php && rm _cleanup.php
- name: Create archive
id: create-zip
run: |
ZIP_NAME="torrentpier-v${{ env.RELEASE_VERSION }}.zip"
zip -r "$ZIP_NAME" . -x ".git/*"
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
- name: Publish to GitHub
if: ${{ !contains(github.ref, '-') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
overwrite: true
tag: ${{ github.ref }}
release_name: "v${{ env.RELEASE_VERSION }}"
body: "${{ needs.generate-changelog.outputs.release_body }}"
- name: Publish to GitHub (pre-release)
if: ${{ contains(github.ref, '-') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
overwrite: true
tag: ${{ github.ref }}
release_name: "v${{ env.RELEASE_VERSION }}"
body: "${{ needs.generate-changelog.outputs.release_body }}"
prerelease: true

View file

@ -1,45 +0,0 @@
name: Continuous Integration
on:
push:
branches:
- master
jobs:
nightly:
name: Nightly builds 📦
runs-on: ubuntu-22.04
steps:
- name: Checkout code 🗳
uses: actions/checkout@v4
- name: Setup PHP 🔩
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Composer dependencies 🪚
run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader
- name: Get commit hash 🔗
id: get-commit-hash
run: |
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
- name: Cleanup
run: php _cleanup.php && rm _cleanup.php
- name: Create archive 🗞
id: create-zip
run: |
ZIP_NAME="torrentpier-${{ steps.get-commit-hash.outputs.COMMIT_HASH }}.zip"
zip -r "$ZIP_NAME" . -x ".git/*"
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
- name: Upload Archive 📤
uses: actions/upload-artifact@v4
with:
name: TorrentPier-master
path: ${{ steps.create-zip.outputs.ZIP_NAME }}

View file

@ -1,41 +0,0 @@
name: Changelog generation
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
changelog:
name: Changelog generation
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
token: ${{ secrets.REPO_TOKEN }}
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: v2.4.6-alpha.4.. --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
- name: Commit changelog
run: |
git checkout master
git config --local user.name 'belomaxorka'
git config --local user.email 'roman25052006.kelesh@gmail.com'
set +e
git add CHANGELOG.md
git commit -m "changelog: Update CHANGELOG.md 📖"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master

13
.gitignore vendored
View file

@ -1,40 +1,35 @@
### IDE ### ### IDE ###
.idea .idea
.vscode
### TorrentPier ### ### TorrentPier ###
*.log
install.php_*
composer-setup.php
.env .env
.php_cs.cache .php_cs.cache
composer.phar
configs/local.php
data/avatars data/avatars
data/uploads data/torrent_files
internal_data/atom internal_data/atom
internal_data/cache internal_data/cache
internal_data/log internal_data/log
internal_data/updater.json
sitemap sitemap
internal_data/triggers internal_data/triggers
library/config.local.php library/config.local.php
vendor vendor
### Archives ### ### Archives ###
*.phar *.log
*.rar *.rar
*.tar *.tar
*.gz *.gz
*.zip *.zip
*.7z *.7z
*.torrent *.torrent
*.pak
### Windows ### ### Windows ###
Thumbs.db Thumbs.db
Desktop.ini Desktop.ini
$RECYCLE.BIN/ $RECYCLE.BIN/
*.lnk *.lnk
*.bat
### OSX ### ### OSX ###
.DS_Store .DS_Store

View file

@ -1,113 +1,881 @@
[![TorrentPier](https://raw.githubusercontent.com/torrentpier/.github/refs/heads/main/versions/Cattle.png)](https://github.com/torrentpier)
# 📖 Change Log # 📖 Change Log
## [v2.8.3](https://github.com/torrentpier/torrentpier/compare/v2.8.2..v2.8.3) (2025-07-03) ## [v2.4.0-rc2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-rc2) (2023-12-12)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-rc1...v2.4.0-rc2)
### 🚀 Features **Merged pull requests:**
- *(lang)* Added `RTL` languages support ([#2031](https://github.com/torrentpier/torrentpier/pull/2031)) - ([fd46d3d](https://github.com/torrentpier/torrentpier/commit/fd46d3d04ad3ab1453256b2ab620508e2ba33586)) - Fixed void function result used [\#1170](https://github.com/torrentpier/torrentpier/pull/1170) ([belomaxorka](https://github.com/belomaxorka))
- *(updater)* Added exceptions logging ([#2026](https://github.com/torrentpier/torrentpier/pull/2026)) - ([51f2c70](https://github.com/torrentpier/torrentpier/commit/51f2c70d81b910012cdecd111b5b92c1dfd0d6f6)) - Improved cookie management 🍪 [\#1171](https://github.com/torrentpier/torrentpier/pull/1171) ([belomaxorka](https://github.com/belomaxorka))
- Replaced strpos() with simplified realization [\#1172](https://github.com/torrentpier/torrentpier/pull/1172) ([belomaxorka](https://github.com/belomaxorka))
- Replaced some 'switch' with the 'match' expression [\#1173](https://github.com/torrentpier/torrentpier/pull/1173) ([belomaxorka](https://github.com/belomaxorka))
- Feature to ban specific torrent clients [\#1175](https://github.com/torrentpier/torrentpier/pull/1175) ([kovalensky](https://github.com/kovalensky))
- Code re-formatting [\#1176](https://github.com/torrentpier/torrentpier/pull/1176) ([kovalensky](https://github.com/kovalensky))
- Removed useless width for BBCode buttons [\#1180](https://github.com/torrentpier/torrentpier/pull/1180) ([belomaxorka](https://github.com/belomaxorka))
- Refactored memberlist.php 🎓 [\#1181](https://github.com/torrentpier/torrentpier/pull/1181) ([belomaxorka](https://github.com/belomaxorka))
- Peer ID was erased if it contained non-latin characters [\#1185](https://github.com/torrentpier/torrentpier/pull/1185) ([kovalensky](https://github.com/kovalensky))
- Removed verify_id() function [\#1187](https://github.com/torrentpier/torrentpier/pull/1187) ([belomaxorka](https://github.com/belomaxorka))
- Removed sys_getloadavg() [\#1188](https://github.com/torrentpier/torrentpier/pull/1188) ([belomaxorka](https://github.com/belomaxorka))
- RC2 timeline [\#1186](https://github.com/torrentpier/torrentpier/pull/1186) ([kovalensky](https://github.com/kovalensky))
- Get SERVER_NAME variable for cron tasks [\#1190](https://github.com/torrentpier/torrentpier/pull/1190) ([kovalensky](https://github.com/kovalensky))
- Remove unnecessary file hashes for in-forum file-listing [\#1192](https://github.com/torrentpier/torrentpier/pull/1192) ([kovalensky](https://github.com/kovalensky))
- Use one GET variable for filelisting [\#1193](https://github.com/torrentpier/torrentpier/pull/1193) ([kovalensky](https://github.com/kovalensky))
- Refactored poll.php [\#1194](https://github.com/torrentpier/torrentpier/pull/1194) ([belomaxorka](https://github.com/belomaxorka))
- Removed useless global $lang; from info.php [\#1195](https://github.com/torrentpier/torrentpier/pull/1195) ([belomaxorka](https://github.com/belomaxorka))
- Update file_list_v2.php [\#1196](https://github.com/torrentpier/torrentpier/pull/1196), [\#1197](https://github.com/torrentpier/torrentpier/pull/1197), [\#1199](https://github.com/torrentpier/torrentpier/pull/1199) ([kovalensky](https://github.com/kovalensky))
- Small code re-format for scrape.php [\#1198](https://github.com/torrentpier/torrentpier/pull/1198) ([kovalensky](https://github.com/kovalensky))
- Some reported bugfixes [\#1200](https://github.com/torrentpier/torrentpier/pull/1200) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1177](https://github.com/torrentpier/torrentpier/pull/1177), [\#1178](https://github.com/torrentpier/torrentpier/pull/1178),[\#1183](https://github.com/torrentpier/torrentpier/pull/1183), [\#1184](https://github.com/torrentpier/torrentpier/pull/1184) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1179](https://github.com/torrentpier/torrentpier/pull/1179), [\#1182](https://github.com/torrentpier/torrentpier/pull/1182), [\#1191](https://github.com/torrentpier/torrentpier/pull/1191) ([Exileum](https://github.com/Exileum))
### 🚜 Refactor ## [v2.4.0-rc1](https://github.com/torrentpier/torrentpier/tree/v2.4.0-rc1) (2023-11-25)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-beta4...v2.4.0-rc1)
- *(TorrentFileList)* Reduce duplication in root directory unset logic ([#2027](https://github.com/torrentpier/torrentpier/pull/2027)) - ([d4d8210](https://github.com/torrentpier/torrentpier/commit/d4d82101dd67c9f4cd86e0f6f909495696974354))
## [v2.8.2](https://github.com/torrentpier/torrentpier/compare/v2.8.1..v2.8.2) (2025-06-30)
### 🐛 Bug Fixes
- *(TorrentFileList)* Avoid `array_merge` reindexing for numeric folder names ([#2014](https://github.com/torrentpier/torrentpier/pull/2014)) - ([915e1d8](https://github.com/torrentpier/torrentpier/commit/915e1d817c61d2a4f0691b24ec1bc6577a9cd44b))
### 🚜 Refactor
- Use `DEFAULT_CHARSET` constant instead of hardcoded string ([#2011](https://github.com/torrentpier/torrentpier/pull/2011)) - ([7ac3359](https://github.com/torrentpier/torrentpier/commit/7ac335974baa44a8575bebb71ae2fbc0902d10e7))
## [v2.8.1](https://github.com/torrentpier/torrentpier/compare/v2.8.0..v2.8.1) (2025-06-24)
### 🐛 Bug Fixes
- *(filelist)* `Undefined property: FileTree::$length` when v2 torrent only ([#2004](https://github.com/torrentpier/torrentpier/pull/2004)) - ([7f4cc9d](https://github.com/torrentpier/torrentpier/commit/7f4cc9d3b9a5b87100f710cc60f636d6e7d5a34e))
- *(ip-api)* Add error handling and logging for freeipapi.com requests ([#2006](https://github.com/torrentpier/torrentpier/pull/2006)) - ([f1d6e74](https://github.com/torrentpier/torrentpier/commit/f1d6e74e5d4c74b6e12e9e742f60f62e71783d11))
## [v2.8.0](https://github.com/torrentpier/torrentpier/compare/v2.7.0..v2.8.0) (2025-06-21)
### 🐛 Bug Fixes
- *(template)* Handle L_ variables in template vars when not found in lang vars ([#1998](https://github.com/torrentpier/torrentpier/pull/1998)) - ([c6076c2](https://github.com/torrentpier/torrentpier/commit/c6076c2c278e9a423f3862670236b75bddeadd87))
## [v2.7.0](https://github.com/torrentpier/torrentpier/compare/v2.6.0..v2.7.0) (2025-06-21)
### 🚀 Features
- *(database)* Add visual markers for Nette Explorer queries in debug panel ([#1965](https://github.com/torrentpier/torrentpier/pull/1965)) - ([2fd3067](https://github.com/torrentpier/torrentpier/commit/2fd306704f21febee7d53f4b4531601ce0cb81ce))
- *(language)* Add new language variable for migration file and enhance template fallback logic ([#1984](https://github.com/torrentpier/torrentpier/pull/1984)) - ([a33574c](https://github.com/torrentpier/torrentpier/commit/a33574c28f2eb6267a74fa6c9d97fea86527157a))
- *(migrations)* Implement Phinx database migration system ([#1976](https://github.com/torrentpier/torrentpier/pull/1976)) - ([fbde8cd](https://github.com/torrentpier/torrentpier/commit/fbde8cd421c9048afe70ddb41d0a9ed26d3fbef5))
- *(test)* [**breaking**] Add comprehensive testing infrastructure with Pest PHP ([#1979](https://github.com/torrentpier/torrentpier/pull/1979)) - ([cc9d412](https://github.com/torrentpier/torrentpier/commit/cc9d412522938a023bd2b8eb880c4d2dd307c82a))
- [**breaking**] Implement Language singleton with shorthand functions ([#1966](https://github.com/torrentpier/torrentpier/pull/1966)) - ([49717d3](https://github.com/torrentpier/torrentpier/commit/49717d3a687b95885fe9773f2597354aed4b2b60))
### 🐛 Bug Fixes
- *(database)* Update affected rows tracking in Database class ([#1980](https://github.com/torrentpier/torrentpier/pull/1980)) - ([4f9cc9f](https://github.com/torrentpier/torrentpier/commit/4f9cc9fe0f7f4a85c90001a3f5514efdf04836da))
### 🚜 Refactor
- *(database)* Enhance error logging and various fixes ([#1978](https://github.com/torrentpier/torrentpier/pull/1978)) - ([7aed6bc](https://github.com/torrentpier/torrentpier/commit/7aed6bc7d89f4ed31e7ed6c6eeecc6e08d348c24))
- *(database)* Rename DB to Database and extract debug functionality ([#1964](https://github.com/torrentpier/torrentpier/pull/1964)) - ([6c0219d](https://github.com/torrentpier/torrentpier/commit/6c0219d53c7544b7d8a6374c0d0848945d32ae17))
- *(stats)* Improve database row fetching in tr_stats.php ([#1985](https://github.com/torrentpier/torrentpier/pull/1985)) - ([728116d](https://github.com/torrentpier/torrentpier/commit/728116d6dc9cf4476cce572ced5e8a7ef529ead8))
### ⚙️ Miscellaneous
- Update minimum `PHP` requirement to `8.2` ([#1987](https://github.com/torrentpier/torrentpier/pull/1987)) - ([9b322c7](https://github.com/torrentpier/torrentpier/commit/9b322c7093a634669e9f17a32ac42500f44f2496))
- Removed useless `composer update` from workflows & installer ([#1986](https://github.com/torrentpier/torrentpier/pull/1986)) - ([423424e](https://github.com/torrentpier/torrentpier/commit/423424e9478e0772957014fb30f5e84158067af7))
- Added --no-dev composer flag for some workflows ([#1982](https://github.com/torrentpier/torrentpier/pull/1982)) - ([e9a9e09](https://github.com/torrentpier/torrentpier/commit/e9a9e095768ba68aa5d5058a3e152ffaec916117))
- Added `--no-dev` composer flag for some workflows ([#1981](https://github.com/torrentpier/torrentpier/pull/1981)) - ([e8cba5d](https://github.com/torrentpier/torrentpier/commit/e8cba5dd3fc83b616f83c24991f79dc7258c5df3))
## [v2.6.0](https://github.com/torrentpier/torrentpier/compare/v2.5.0..v2.6.0) (2025-06-18)
### 🚀 Features
- [**breaking**] Implement unified cache system with Nette Caching ([#1963](https://github.com/torrentpier/torrentpier/pull/1963)) - ([07a06a3](https://github.com/torrentpier/torrentpier/commit/07a06a33cd97b37f68b533a87cdb5f7578f2c86f))
- Replace legacy database layer with Nette Database implementation ([#1961](https://github.com/torrentpier/torrentpier/pull/1961)) - ([f50b914](https://github.com/torrentpier/torrentpier/commit/f50b914cc18f777d92002baf2c812a635d5eed4b))
### 🐛 Bug Fixes
- *(User)* Add null and array checks before session data operations ([#1962](https://github.com/torrentpier/torrentpier/pull/1962)) - ([e458109](https://github.com/torrentpier/torrentpier/commit/e458109eefc54d86a78a1ddb3954581524852516))
## [v2.5.0](https://github.com/torrentpier/torrentpier/compare/v2.4.6-alpha.4..v2.5.0) (2025-06-18)
### 🚀 Features
- [**breaking**] Implement centralized Config class to replace global $bb_cfg array ([#1953](https://github.com/torrentpier/torrentpier/pull/1953)) - ([bf9100f](https://github.com/torrentpier/torrentpier/commit/bf9100fbfa74768edb01c62636198a44739d9923))
### 🐛 Bug Fixes
- *(installer)* Strip protocol from TP_HOST to keep only hostname ([#1952](https://github.com/torrentpier/torrentpier/pull/1952)) - ([81bf67c](https://github.com/torrentpier/torrentpier/commit/81bf67c2be85d49e988b7802ca7e9738ff580031))
- *(sql)* Resolve only_full_group_by compatibility issues in tracker cleanup ([#1951](https://github.com/torrentpier/torrentpier/pull/1951)) - ([37a0675](https://github.com/torrentpier/torrentpier/commit/37a0675adfb02014e7068f4aa82301e29f39eab6))
### 📦 Dependencies
- *(deps)* Bump filp/whoops from 2.18.2 to 2.18.3 ([#1948](https://github.com/torrentpier/torrentpier/pull/1948)) - ([b477680](https://github.com/torrentpier/torrentpier/commit/b4776804a408217229caa327c79849cf13ce2aa5))
### 🚜 Refactor
- *(censor)* [**breaking**] Migrate Censor class to singleton pattern ([#1954](https://github.com/torrentpier/torrentpier/pull/1954)) - ([74a564d](https://github.com/torrentpier/torrentpier/commit/74a564d7954c6f8745ebcffdcd9c8997e371d47a))
- *(config)* [**breaking**] Encapsulate global $bb_cfg array in Config class ([#1950](https://github.com/torrentpier/torrentpier/pull/1950)) - ([5842994](https://github.com/torrentpier/torrentpier/commit/5842994782dfa62788f8427c55045abdbfb5b8e9))
### 📚 Documentation
- Add Select class migration guide ([#1960](https://github.com/torrentpier/torrentpier/pull/1960)) - ([86abafb](https://github.com/torrentpier/torrentpier/commit/86abafb11469d14a746d12725b15cf6b7015ec44))
### ⚙️ Miscellaneous
- *(_release.php)* Finally! Removed some useless params ([#1947](https://github.com/torrentpier/torrentpier/pull/1947)) - ([9c7d270](https://github.com/torrentpier/torrentpier/commit/9c7d270598c0153fb82f4b7ad96f5b59399b2159))
- *(cliff)* Add conventional commit prefix to changelog message ([#1957](https://github.com/torrentpier/torrentpier/pull/1957)) - ([b1b2618](https://github.com/torrentpier/torrentpier/commit/b1b26187579f6981165d85c316a3c5b7199ce2ee))
**Merged pull requests:**
- Revert "Fix sql group (#128)" [1753db1](https://github.com/torrentpier/torrentpier/commit/1753db1fcef7d50eb8f8ba4b1f5a4ad7585ffaa4) ([belomaxorka](https://github.com/belomaxorka))
- Simplified gender function [\#1167](https://github.com/torrentpier/torrentpier/pull/1167) ([belomaxorka](https://github.com/belomaxorka))
- Revert "Fixed input types in some cases (#697)" [20ce8ca](https://github.com/torrentpier/torrentpier/commit/20ce8cae9cf6447f5100ab2d8f4a5299254f5412) ([belomaxorka](https://github.com/belomaxorka))
- Revert "Fixed input types in some cases (#693)" [74aa6ff](https://github.com/torrentpier/torrentpier/commit/74aa6ff29991186ffc6484980972d5f74e4d0393) ([belomaxorka](https://github.com/belomaxorka))
- Support simultaneous id & username inputs for browsing profiles [\#1166](https://github.com/torrentpier/torrentpier/pull/1166) ([kovalensky](https://github.com/kovalensky))
- Tighten registration requirements for torrent files [\#1165](https://github.com/torrentpier/torrentpier/pull/1165) ([kovalensky](https://github.com/kovalensky))
- File listing — use browser cache [\#1164](https://github.com/torrentpier/torrentpier/pull/1164) ([kovalensky](https://github.com/kovalensky))
- Legacy code comment translations [\#1163](https://github.com/torrentpier/torrentpier/pull/1163) ([kovalensky](https://github.com/kovalensky))
- Invites config re-formatting [\#1162](https://github.com/torrentpier/torrentpier/pull/1162) ([belomaxorka](https://github.com/belomaxorka))
- Use external cookie library to prevent incorrect cookie setting [\#1160](https://github.com/torrentpier/torrentpier/pull/1160), [\#1161](https://github.com/torrentpier/torrentpier/pull/1161) ([belomaxorka](https://github.com/belomaxorka))
- Some improvements in default template [\#1159](https://github.com/torrentpier/torrentpier/pull/1159) ([belomaxorka](https://github.com/belomaxorka))
- Use sent port instead of source [\#1158](https://github.com/torrentpier/torrentpier/pull/1158) ([kovalensky](https://github.com/kovalensky))
- Remove unnecessary meta tags from file listing [\#1157](https://github.com/torrentpier/torrentpier/pull/1157) ([kovalensky](https://github.com/kovalensky))
- Use different file listing url parameters for effective indexing by search engines [\#1156](https://github.com/torrentpier/torrentpier/pull/1156) ([kovalensky](https://github.com/kovalensky))
- Check topic_id existence while searching in tracker mode [\#1155](https://github.com/torrentpier/torrentpier/pull/1155) ([kovalensky](https://github.com/kovalensky))
- Some improvement [\#1151](https://github.com/torrentpier/torrentpier/pull/1151) ([kovalensky](https://github.com/kovalensky))
- Disable invites by default [\#1150](https://github.com/torrentpier/torrentpier/pull/1150) ([kovalensky](https://github.com/kovalensky))
- Event based invite system [\#1149](https://github.com/torrentpier/torrentpier/pull/1149) ([kovalensky](https://github.com/kovalensky))
- Some code quality improvements [\#1148](https://github.com/torrentpier/torrentpier/pull/1148) ([belomaxorka](https://github.com/belomaxorka))
- Vote button code improvements [\#1140](https://github.com/torrentpier/torrentpier/pull/1140), [\#1142](https://github.com/torrentpier/torrentpier/pull/1142), [\#1143](https://github.com/torrentpier/torrentpier/pull/1143), [\#1146](https://github.com/torrentpier/torrentpier/pull/1146) ([belomaxorka](https://github.com/belomaxorka))
- Vote button and v2 file list topic url display [\#1138](https://github.com/torrentpier/torrentpier/pull/1138) ([kovalensky](https://github.com/kovalensky))
- Removed topic watch useless code [\#1137](https://github.com/torrentpier/torrentpier/pull/1137) ([belomaxorka](https://github.com/belomaxorka))
- Fixed topic_watch array key name [\#1136](https://github.com/torrentpier/torrentpier/pull/1136) ([belomaxorka](https://github.com/belomaxorka))
- Fixed announce-list indexes ordering [\#1135](https://github.com/torrentpier/torrentpier/pull/1135) ([belomaxorka](https://github.com/belomaxorka))
- Fixed $bb_cfg['file_id_ext'] ordering [\#1134](https://github.com/torrentpier/torrentpier/pull/1134) ([belomaxorka](https://github.com/belomaxorka))
- Normalizing announce-list [\#1133](https://github.com/torrentpier/torrentpier/pull/1133) ([belomaxorka](https://github.com/belomaxorka))
- Fixed announcer-list issue [\#1129](https://github.com/torrentpier/torrentpier/pull/1129), [\#1130](https://github.com/torrentpier/torrentpier/pull/1130), [\#1131](https://github.com/torrentpier/torrentpier/pull/1131), [\#1132](https://github.com/torrentpier/torrentpier/pull/1132) ([belomaxorka](https://github.com/belomaxorka))
- Removed client column from bb_bt_tracker table [\#1128](https://github.com/torrentpier/torrentpier/pull/1128) ([belomaxorka](https://github.com/belomaxorka))
- Removed one-time used variables [\#1120](https://github.com/torrentpier/torrentpier/pull/1120) ([belomaxorka](https://github.com/belomaxorka))
- Don't create empty announce-list dict, if ann_urls are empty [\#1119](https://github.com/torrentpier/torrentpier/pull/1119) ([kovalensky](https://github.com/kovalensky))
- Improve code for retracker addition [\#1118](https://github.com/torrentpier/torrentpier/pull/1118) ([kovalensky](https://github.com/kovalensky))
- Don't use main announce url inside announce-list [\#1117](https://github.com/torrentpier/torrentpier/pull/1117) ([kovalensky](https://github.com/kovalensky))
- Don't check for announce-list while adding new urls [\#1116](https://github.com/torrentpier/torrentpier/pull/1116) ([kovalensky](https://github.com/kovalensky))
- Cleanup: Removed useless global variable [\#1115](https://github.com/torrentpier/torrentpier/pull/1115) ([belomaxorka](https://github.com/belomaxorka))
- Unset debug cookies if SQL_DEBUG disabled [\#1114](https://github.com/torrentpier/torrentpier/pull/1114) ([belomaxorka](https://github.com/belomaxorka))
- Announcer's code re-formatting [\#1112](https://github.com/torrentpier/torrentpier/pull/1112) ([kovalensky](https://github.com/kovalensky))
- Used new-style [] array constructions in some cases [\#1111](https://github.com/torrentpier/torrentpier/pull/1111) ([belomaxorka](https://github.com/belomaxorka))
- Use http_response_code() functions instead of old header() functions [\#1110](https://github.com/torrentpier/torrentpier/pull/1110) ([belomaxorka](https://github.com/belomaxorka))
- Fix bypassing cache if IP changed while using cache [\#1109](https://github.com/torrentpier/torrentpier/pull/1109) ([kovalensky](https://github.com/kovalensky))
- Use one variable to determine update status for hybrids [\#1108](https://github.com/torrentpier/torrentpier/pull/1108) ([kovalensky](https://github.com/kovalensky))
- Don't re-announce even if peer cache is present [\#1107](https://github.com/torrentpier/torrentpier/pull/1107) ([kovalensky](https://github.com/kovalensky))
- Used br2nl() in ajax alert messages [\#1106](https://github.com/torrentpier/torrentpier/pull/1106) ([belomaxorka](https://github.com/belomaxorka))
- Replaced some html_entity_decode to engine's built-in function [\#1105](https://github.com/torrentpier/torrentpier/pull/1105) ([belomaxorka](https://github.com/belomaxorka))
- Fix typo [\#1104](https://github.com/torrentpier/torrentpier/pull/1104), [\#1124](https://github.com/torrentpier/torrentpier/pull/1124), [\#1153](https://github.com/torrentpier/torrentpier/pull/1153), [\#1168](https://github.com/torrentpier/torrentpier/pull/1168) ([kovalensky](https://github.com/kovalensky))
- Change default engine language to en [\#1103](https://github.com/torrentpier/torrentpier/pull/1103) ([kovalensky](https://github.com/kovalensky))
- Record changed port while re-announcing [\#1102](https://github.com/torrentpier/torrentpier/pull/1102) ([kovalensky](https://github.com/kovalensky))
- Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky))
- Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky))
- Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122), [\#1123](https://github.com/torrentpier/torrentpier/pull/1123), [\#1125](https://github.com/torrentpier/torrentpier/pull/1125), [\#1141](https://github.com/torrentpier/torrentpier/pull/1141) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101), [\#1144](https://github.com/torrentpier/torrentpier/pull/1144), [\#1154](https://github.com/torrentpier/torrentpier/pull/1154) ([Exileum](https://github.com/Exileum))
## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-beta3...v2.4.0-beta4)
**Merged pull requests:**
- Use TORRENT_EXT constants for definition torrent extension [\#1096](https://github.com/torrentpier/torrentpier/pull/1096) ([belomaxorka](https://github.com/belomaxorka))
- Remove html entities for file names [\#1094](https://github.com/torrentpier/torrentpier/pull/1094) ([kovalensky](https://github.com/kovalensky))
- Fix for html entities being displayed in magnet links [\#1092](https://github.com/torrentpier/torrentpier/pull/1092) ([kovalensky](https://github.com/kovalensky))
- Calling make_jumpbox() where it needed [\#1091](https://github.com/torrentpier/torrentpier/pull/1091) ([belomaxorka](https://github.com/belomaxorka))
- Include full url for client icon displaying [\#1088](https://github.com/torrentpier/torrentpier/pull/1088) ([kovalensky](https://github.com/kovalensky))
- Fix not working code [\#1087](https://github.com/torrentpier/torrentpier/pull/1087) ([kovalensky](https://github.com/kovalensky))
- Fixed data types for seeder_last_seen [\#1086](https://github.com/torrentpier/torrentpier/pull/1086) ([belomaxorka](https://github.com/belomaxorka))
- Fix broken PM (Private messages) [\#1085](https://github.com/torrentpier/torrentpier/pull/1085) ([kovalensky](https://github.com/kovalensky))
- Fixed a bug causing inability to view file contents for some torrents [\#1084](https://github.com/torrentpier/torrentpier/pull/1084) ([kovalensky](https://github.com/kovalensky))
- Show file count while listing [\#1082](https://github.com/torrentpier/torrentpier/pull/1082) ([kovalensky](https://github.com/kovalensky))
- Simplified jumpbox 📜 [\#815](https://github.com/torrentpier/torrentpier/pull/815) ([belomaxorka](https://github.com/belomaxorka))
- Removed sorting for torrent clients in table [\#1080](https://github.com/torrentpier/torrentpier/pull/1080) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken table in tracker [\#1079](https://github.com/torrentpier/torrentpier/pull/1079) ([belomaxorka](https://github.com/belomaxorka))
- CSS improvement for file listing [\#1077](https://github.com/torrentpier/torrentpier/pull/1077), [\#1081](https://github.com/torrentpier/torrentpier/pull/1081), [\#1083](https://github.com/torrentpier/torrentpier/pull/1083) ([kovalensky](https://github.com/kovalensky))
- Minor improvements [\#1078](https://github.com/torrentpier/torrentpier/pull/1078), [\#1095](https://github.com/torrentpier/torrentpier/pull/1095) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1089](https://github.com/torrentpier/torrentpier/pull/1089), [\#1090](https://github.com/torrentpier/torrentpier/pull/1090) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-beta3](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta3) (2023-11-11)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-beta2...v2.4.0-beta3)
**Merged pull requests:**
- Use built-in delta_time for age display [\#1075](https://github.com/torrentpier/torrentpier/pull/1075) ([kovalensky](https://github.com/kovalensky))
- List with numbers in tracker stats [\#1074](https://github.com/torrentpier/torrentpier/pull/1074) ([kovalensky](https://github.com/kovalensky))
- Sort clients from higher to lower in tracker stats [\#1073](https://github.com/torrentpier/torrentpier/pull/1073) ([kovalensky](https://github.com/kovalensky))
- Use more reliable original file names for attachments [\#1070](https://github.com/torrentpier/torrentpier/pull/1070) ([kovalensky](https://github.com/kovalensky))
- Tracker client stats cache, more robust file list functions, permissions for file list access [\#1069](https://github.com/torrentpier/torrentpier/pull/1069) ([kovalensky](https://github.com/kovalensky))
- Some code improvements for file listing [\#1068](https://github.com/torrentpier/torrentpier/pull/1068) ([kovalensky](https://github.com/kovalensky))
- Update styles for file list [\#1067](https://github.com/torrentpier/torrentpier/pull/1067) ([kovalensky](https://github.com/kovalensky))
- Show client information for file list [\#1066](https://github.com/torrentpier/torrentpier/pull/1066) ([kovalensky](https://github.com/kovalensky))
- File list tables for v2 compatible torrents [\#1064](https://github.com/torrentpier/torrentpier/pull/1064) ([kovalensky](https://github.com/kovalensky))
- Show options for version debugging of user clients [\#1061](https://github.com/torrentpier/torrentpier/pull/1061) ([kovalensky](https://github.com/kovalensky))
- Fixed broken avatar ajax action for users [\#1060](https://github.com/torrentpier/torrentpier/pull/1060) ([belomaxorka](https://github.com/belomaxorka))
- Show icons for clients while in the tracker statistics [\#1057](https://github.com/torrentpier/torrentpier/pull/1057) ([kovalensky](https://github.com/kovalensky))
- Show user clients percentage in tracker statistics [\#1057](https://github.com/torrentpier/torrentpier/pull/1057) ([kovalensky](https://github.com/kovalensky))
- Fixed undefined tpl variable SHOW_GROUP_MEMBERSHIP [\#1055](https://github.com/torrentpier/torrentpier/pull/1055) ([belomaxorka](https://github.com/belomaxorka))
- Show guests for last seeders [\#1053](https://github.com/torrentpier/torrentpier/pull/1053) ([kovalensky](https://github.com/kovalensky))
- Last seeder display improvements [\#1052](https://github.com/torrentpier/torrentpier/pull/1052) ([kovalensky](https://github.com/kovalensky))
- Show the last seeder's username in topics [\#1051](https://github.com/torrentpier/torrentpier/pull/1051) ([kovalensky](https://github.com/kovalensky))
- Minor improvements for template [\#1050](https://github.com/torrentpier/torrentpier/pull/1050) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: Moderators can't see self IP addresses [\#1049](https://github.com/torrentpier/torrentpier/pull/1049) ([belomaxorka](https://github.com/belomaxorka))
- View user's profile also by it's username [\#1048](https://github.com/torrentpier/torrentpier/pull/1048) ([kovalensky](https://github.com/kovalensky))
- Scrape.php code reformatting [\#1047](https://github.com/torrentpier/torrentpier/pull/1047) ([kovalensky](https://github.com/kovalensky))
- Scraping improvements [\#1046](https://github.com/torrentpier/torrentpier/pull/1046) ([kovalensky](https://github.com/kovalensky))
- Small tracker improvements [\#1043](https://github.com/torrentpier/torrentpier/pull/1043) ([kovalensky](https://github.com/kovalensky))
- Small improvements to scraping [\#1042](https://github.com/torrentpier/torrentpier/pull/1042) ([kovalensky](https://github.com/kovalensky))
- Added v2 hash search to the scraping [\#1040](https://github.com/torrentpier/torrentpier/pull/1040) ([kovalensky](https://github.com/kovalensky))
- Update magnet icon [\#1038](https://github.com/torrentpier/torrentpier/pull/1038) ([kovalensky](https://github.com/kovalensky))
- Magnet link tweaks [\#1035](https://github.com/torrentpier/torrentpier/pull/1035) ([kovalensky](https://github.com/kovalensky))
- Use built-in binary hash feature [\#1032](https://github.com/torrentpier/torrentpier/pull/1032) ([kovalensky](https://github.com/kovalensky))
- Some v2 hashes were not found in the announcer [\#1031](https://github.com/torrentpier/torrentpier/pull/1031) ([kovalensky](https://github.com/kovalensky))
- Fix issues related to file list display and torrent registration [\#1028](https://github.com/torrentpier/torrentpier/pull/1028) ([kovalensky](https://github.com/kovalensky))
- NAT users' real port [\#1027](https://github.com/torrentpier/torrentpier/pull/1027) ([kovalensky](https://github.com/kovalensky))
- Removed time zone auto detection [\#1025](https://github.com/torrentpier/torrentpier/pull/1025) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to debug ajax_die() calls [\#1023](https://github.com/torrentpier/torrentpier/pull/1023) ([belomaxorka](https://github.com/belomaxorka))
- Fixed incorrect displaying post actions buttons [\#1021](https://github.com/torrentpier/torrentpier/pull/1021) ([belomaxorka](https://github.com/belomaxorka))
- Fixed undefined offset of $action_params [\#1020](https://github.com/torrentpier/torrentpier/pull/1020) ([belomaxorka](https://github.com/belomaxorka))
- Transfer from array to ArrayObject data type [\#1019](https://github.com/torrentpier/torrentpier/pull/1019) ([kovalensky](https://github.com/kovalensky))
- Multiple Scrape [\#1018](https://github.com/torrentpier/torrentpier/pull/1018) ([kovalensky](https://github.com/kovalensky))
- Announce IPv4 && IPv6 of peers! [\#1017](https://github.com/torrentpier/torrentpier/pull/1017) ([kovalensky](https://github.com/kovalensky))
- Bind peer_hash to auth_key to avoid double announces via IPv4 and IPv6 at the same time [\#1016](https://github.com/torrentpier/torrentpier/pull/1016) ([kovalensky](https://github.com/kovalensky))
- Increase auth_key char length [\#1014](https://github.com/torrentpier/torrentpier/pull/1014) ([kovalensky](https://github.com/kovalensky))
- More performance optimized/random string generation, removed passkey length limit from the announcer [\#1013](https://github.com/torrentpier/torrentpier/pull/1013) ([kovalensky](https://github.com/kovalensky))
- More performance optimized/random string generation, removed limit from for announce key in the announcer [\#1012](https://github.com/torrentpier/torrentpier/pull/1012) ([kovalensky](https://github.com/kovalensky))
- Fixed broken ordering in memberlist.php [\#1010](https://github.com/torrentpier/torrentpier/pull/1010) ([belomaxorka](https://github.com/belomaxorka))
- Some fixes in admin_attach_cp.php [\#1009](https://github.com/torrentpier/torrentpier/pull/1009) ([belomaxorka](https://github.com/belomaxorka))
- Fixed undefined $lang['PREVIOUS'] [\#1008](https://github.com/torrentpier/torrentpier/pull/1008) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken letter marking in memberlist.php [\#1007](https://github.com/torrentpier/torrentpier/pull/1007) ([belomaxorka](https://github.com/belomaxorka))
- Moved htmlCHR() in common.php [\#1006](https://github.com/torrentpier/torrentpier/pull/1006) ([belomaxorka](https://github.com/belomaxorka))
- Fixed error while trying to delete posts by bot [\#1004](https://github.com/torrentpier/torrentpier/pull/1004) ([belomaxorka](https://github.com/belomaxorka))
- Escape HTML characters for peer_id once to avoid load [\#1002](https://github.com/torrentpier/torrentpier/pull/1002) ([kovalensky](https://github.com/kovalensky))
- 😅💙 1000th PR Merged! 💙😅 [\#1001](https://github.com/torrentpier/torrentpier/pull/1001) ([belomaxorka](https://github.com/belomaxorka))
- Added the ability to add additional announce URLs into torrent files [\#999](https://github.com/torrentpier/torrentpier/pull/999) ([belomaxorka](https://github.com/belomaxorka))
- Expression can be replaced by '??' version [\#998](https://github.com/torrentpier/torrentpier/pull/998) ([belomaxorka](https://github.com/belomaxorka))
- Added check $bb_cfg['magnet_links_enabled'] in create_magnet() [\#996](https://github.com/torrentpier/torrentpier/pull/996) ([belomaxorka](https://github.com/belomaxorka))
- Added $lang['BT_UNREGISTERED_ALREADY'] lang key [\#994](https://github.com/torrentpier/torrentpier/pull/994) ([belomaxorka](https://github.com/belomaxorka))
- Removed useless "Subject:" from email templates [\#993](https://github.com/torrentpier/torrentpier/pull/993) ([belomaxorka](https://github.com/belomaxorka))
- SQL: Increase speed_up & speed_down type limits [\#992](https://github.com/torrentpier/torrentpier/pull/992) ([belomaxorka](https://github.com/belomaxorka))
- Use strip_tags() for message in prompt_for_confirm() [\#991](https://github.com/torrentpier/torrentpier/pull/991) ([belomaxorka](https://github.com/belomaxorka))
- Use strip_tags() for error message in ajax_die() [\#990](https://github.com/torrentpier/torrentpier/pull/990) ([belomaxorka](https://github.com/belomaxorka))
- Use lang variable $lang['BT_REG_FAIL'] instead of text [\#989](https://github.com/torrentpier/torrentpier/pull/989) ([belomaxorka](https://github.com/belomaxorka))
- Use announce messages even after using redundant cache for output [\#987](https://github.com/torrentpier/torrentpier/pull/987) ([kovalensky](https://github.com/kovalensky))
- Fix currently not working peer icons [\#986](https://github.com/torrentpier/torrentpier/pull/986) ([kovalensky](https://github.com/kovalensky))
- Variable collision fix [\#984](https://github.com/torrentpier/torrentpier/pull/984), [\#985](https://github.com/torrentpier/torrentpier/pull/985) ([kovalensky](https://github.com/kovalensky))
- Fixed percentage calculation for SQL debug [\#980](https://github.com/torrentpier/torrentpier/pull/980) ([belomaxorka](https://github.com/belomaxorka))
- Refactoring: Use isset() with multiple parameters [\#978](https://github.com/torrentpier/torrentpier/pull/978) ([belomaxorka](https://github.com/belomaxorka))
- Check $tpl_vars['QUESTION'] in print_confirmation() [\#977](https://github.com/torrentpier/torrentpier/pull/977) ([belomaxorka](https://github.com/belomaxorka))
- Peer client display support [\#968](https://github.com/torrentpier/torrentpier/pull/968) ([kovalensky](https://github.com/kovalensky))
- Fixed undefined array key group_description [\#969](https://github.com/torrentpier/torrentpier/pull/969) ([belomaxorka](https://github.com/belomaxorka))
- Added my name to the list of authors [\#963](https://github.com/torrentpier/torrentpier/pull/963) ([kovalensky](https://github.com/kovalensky))
- Better way to prioritize peers [\#962](https://github.com/torrentpier/torrentpier/pull/962) ([kovalensky](https://github.com/kovalensky))
- Prioritize returning leecher list for seeder announces [\#961](https://github.com/torrentpier/torrentpier/pull/961) ([kovalensky](https://github.com/kovalensky))
- Generate .torrent file names based on topic titles [\#958](https://github.com/torrentpier/torrentpier/pull/958) ([kovalensky](https://github.com/kovalensky))
- long2ip_extended() missing function [\#948](https://github.com/torrentpier/torrentpier/pull/948) ([kovalensky](https://github.com/kovalensky))
- Use humn_size() for AVATAR_EXPLAIN [\#943](https://github.com/torrentpier/torrentpier/pull/943) ([belomaxorka](https://github.com/belomaxorka))
- Added missing template var in group.php [\#939](https://github.com/torrentpier/torrentpier/pull/939) ([belomaxorka](https://github.com/belomaxorka))
- BEP-7 & BEP-24 & IPv6 functions [\#934](https://github.com/torrentpier/torrentpier/pull/934) ([kovalensky](https://github.com/kovalensky))
- Prevent infinity user adding into group [\#937](https://github.com/torrentpier/torrentpier/pull/937) ([belomaxorka](https://github.com/belomaxorka))
- Maked configurable email visibility for everybody [\#936](https://github.com/torrentpier/torrentpier/pull/936) ([belomaxorka](https://github.com/belomaxorka))
- Respond with loopback if peer list is empty [\#933](https://github.com/torrentpier/torrentpier/pull/933) ([kovalensky](https://github.com/kovalensky))
- Use \Arokettu\Bencode\ instead \SandFox\Bencode\ [\#932](https://github.com/torrentpier/torrentpier/pull/932) ([belomaxorka](https://github.com/belomaxorka))
- Added support for bmp images [\#931](https://github.com/torrentpier/torrentpier/pull/931) ([belomaxorka](https://github.com/belomaxorka))
- ACP: Changed extensions sorting [\#930](https://github.com/torrentpier/torrentpier/pull/930) ([belomaxorka](https://github.com/belomaxorka))
- Added missing bmp extension in SQL dump [\#929](https://github.com/torrentpier/torrentpier/pull/929) ([belomaxorka](https://github.com/belomaxorka))
- Use IMAGETYPE_* constants [\#928](https://github.com/torrentpier/torrentpier/pull/928) ([belomaxorka](https://github.com/belomaxorka))
- Small refactoring in Upload class [\#927](https://github.com/torrentpier/torrentpier/pull/927) ([belomaxorka](https://github.com/belomaxorka))
- Added support for webp avatars [\#926](https://github.com/torrentpier/torrentpier/pull/926) ([belomaxorka](https://github.com/belomaxorka))
- Added check up_allowed in Upload.php class [\#924](https://github.com/torrentpier/torrentpier/pull/924) ([belomaxorka](https://github.com/belomaxorka))
- Added support for webp images 🌆 [\#919](https://github.com/torrentpier/torrentpier/pull/919) ([belomaxorka](https://github.com/belomaxorka))
- Switched from md5 to a faster xxHash hash function [\#921](https://github.com/torrentpier/torrentpier/pull/921) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Added support 7z archives [\#923](https://github.com/torrentpier/torrentpier/pull/923) ([belomaxorka](https://github.com/belomaxorka))
- Added missing EXCLUDED_USERS in tr_stats.php [\#922](https://github.com/torrentpier/torrentpier/pull/922) ([belomaxorka](https://github.com/belomaxorka))
- Announcer support for responding to stopped events [\#918](https://github.com/torrentpier/torrentpier/pull/918) ([kovalensky](https://github.com/kovalensky))
- Added missing !defined('BB_ROOT') check [\#917](https://github.com/torrentpier/torrentpier/pull/917) ([belomaxorka](https://github.com/belomaxorka))
- Support for IDN domains [\#909](https://github.com/torrentpier/torrentpier/pull/909) ([kovalensky](https://github.com/kovalensky))
- Some cleanup [\#1003](https://github.com/torrentpier/torrentpier/pull/1003) ([belomaxorka](https://github.com/belomaxorka))
- Code formatting [\#1026](https://github.com/torrentpier/torrentpier/pull/1026), [\#1030](https://github.com/torrentpier/torrentpier/pull/1030), [\#1044](https://github.com/torrentpier/torrentpier/pull/1044), [\#1056](https://github.com/torrentpier/torrentpier/pull/1056), [\#1059](https://github.com/torrentpier/torrentpier/pull/1059), [\#1062](https://github.com/torrentpier/torrentpier/pull/1062), [\#1063](https://github.com/torrentpier/torrentpier/pull/1063), [\#1065](https://github.com/torrentpier/torrentpier/pull/1065), [\#1071](https://github.com/torrentpier/torrentpier/pull/1071), [\#1076](https://github.com/torrentpier/torrentpier/pull/1076) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Minor code changes [\#967](https://github.com/torrentpier/torrentpier/pull/967), [\#970](https://github.com/torrentpier/torrentpier/pull/970) ([kovalensky](https://github.com/kovalensky))
- Minor improvements [\#902](https://github.com/torrentpier/torrentpier/pull/902), [\#903](https://github.com/torrentpier/torrentpier/pull/903), [\#904](https://github.com/torrentpier/torrentpier/pull/904), [\#905](https://github.com/torrentpier/torrentpier/pull/905), [\#906](https://github.com/torrentpier/torrentpier/pull/906), [\#907](https://github.com/torrentpier/torrentpier/pull/907), [\#908](https://github.com/torrentpier/torrentpier/pull/908), [\#910](https://github.com/torrentpier/torrentpier/pull/910), [\#911](https://github.com/torrentpier/torrentpier/pull/911), [\#913](https://github.com/torrentpier/torrentpier/pull/913), [\#914](https://github.com/torrentpier/torrentpier/pull/914), [\#915](https://github.com/torrentpier/torrentpier/pull/915), [\#920](https://github.com/torrentpier/torrentpier/pull/920), [\#935](https://github.com/torrentpier/torrentpier/pull/935), [\#946](https://github.com/torrentpier/torrentpier/pull/946), [\#950](https://github.com/torrentpier/torrentpier/pull/950), [\#951](https://github.com/torrentpier/torrentpier/pull/951), [\#952](https://github.com/torrentpier/torrentpier/pull/952), [\#953](https://github.com/torrentpier/torrentpier/pull/953), [\#954](https://github.com/torrentpier/torrentpier/pull/954), [\#956](https://github.com/torrentpier/torrentpier/pull/956), [\#959](https://github.com/torrentpier/torrentpier/pull/959), [\#960](https://github.com/torrentpier/torrentpier/pull/960), [\#965](https://github.com/torrentpier/torrentpier/pull/965), [\#966](https://github.com/torrentpier/torrentpier/pull/966), [\#972](https://github.com/torrentpier/torrentpier/pull/972), [\#973](https://github.com/torrentpier/torrentpier/pull/973), [\#974](https://github.com/torrentpier/torrentpier/pull/974), [\#975](https://github.com/torrentpier/torrentpier/pull/975), [\#976](https://github.com/torrentpier/torrentpier/pull/976), [\#982](https://github.com/torrentpier/torrentpier/pull/982), [\#988](https://github.com/torrentpier/torrentpier/pull/988), [\#997](https://github.com/torrentpier/torrentpier/pull/997) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#912](https://github.com/torrentpier/torrentpier/pull/912), [\#916](https://github.com/torrentpier/torrentpier/pull/916), [\#925](https://github.com/torrentpier/torrentpier/pull/925), [\#947](https://github.com/torrentpier/torrentpier/pull/947), [\#957](https://github.com/torrentpier/torrentpier/pull/957), [\#971](https://github.com/torrentpier/torrentpier/pull/971), [\#979](https://github.com/torrentpier/torrentpier/pull/979), [\#995](https://github.com/torrentpier/torrentpier/pull/995), [\#1000](https://github.com/torrentpier/torrentpier/pull/1000), [\#1037](https://github.com/torrentpier/torrentpier/pull/1037), [\#1054](https://github.com/torrentpier/torrentpier/pull/1054), [\#1072](https://github.com/torrentpier/torrentpier/pull/1072) ([Exileum](https://github.com/Exileum))
- Updated deps [\#964](https://github.com/torrentpier/torrentpier/pull/964), [\#983](https://github.com/torrentpier/torrentpier/pull/983), [\#1011](https://github.com/torrentpier/torrentpier/pull/1011), [\#1015](https://github.com/torrentpier/torrentpier/pull/1015), [\#1045](https://github.com/torrentpier/torrentpier/pull/1045) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-beta2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta2) (2023-09-16)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-beta1...v2.4.0-beta2)
**Merged pull requests:**
- Tracker announce & scrape improvements 🥳 [\#901](https://github.com/torrentpier/torrentpier/pull/901) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Fixed downloaded counter [\#894](https://github.com/torrentpier/torrentpier/pull/894) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Fixed null seeders & leechers in announcer [\#891](https://github.com/torrentpier/torrentpier/pull/891) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- BitTorrent v2 support enhancements 🥳 [\#876](https://github.com/torrentpier/torrentpier/pull/876) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Added showing info_hash v2 in viewtopic.php [\#870](https://github.com/torrentpier/torrentpier/pull/870) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Added search by info_hash v2 🐯 [\#869](https://github.com/torrentpier/torrentpier/pull/869) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- BitTorrent v2 support 🐸 [\#866](https://github.com/torrentpier/torrentpier/pull/866) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Replace all double quotes with single quotes [\#888](https://github.com/torrentpier/torrentpier/pull/888) ([belomaxorka](https://github.com/belomaxorka))
- Removed unused lang variables [\#885](https://github.com/torrentpier/torrentpier/pull/885) ([belomaxorka](https://github.com/belomaxorka))
- Fixed empty $row['pm_count'] [\#880](https://github.com/torrentpier/torrentpier/pull/880) ([belomaxorka](https://github.com/belomaxorka))
- Created function get_banned_users() [\#878](https://github.com/torrentpier/torrentpier/pull/878) ([belomaxorka](https://github.com/belomaxorka))
- Moved callseed to ajax actions [\#877](https://github.com/torrentpier/torrentpier/pull/877) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to remove topic templates [\#862](https://github.com/torrentpier/torrentpier/pull/862) ([belomaxorka](https://github.com/belomaxorka))
- Added missing translation in admin_ug_auth [\#861](https://github.com/torrentpier/torrentpier/pull/861) ([belomaxorka](https://github.com/belomaxorka))
- Show renamed topic actions in log actions [\#860](https://github.com/torrentpier/torrentpier/pull/860) ([belomaxorka](https://github.com/belomaxorka))
- Show set/unset downloaded actions in log actions [\#858](https://github.com/torrentpier/torrentpier/pull/858) ([belomaxorka](https://github.com/belomaxorka))
- Show pin & unpin actions in log actions [\#857](https://github.com/torrentpier/torrentpier/pull/857) ([belomaxorka](https://github.com/belomaxorka))
- Increase post_text & privmsgs_text limits [\#848](https://github.com/torrentpier/torrentpier/pull/848) ([belomaxorka](https://github.com/belomaxorka))
- Added show password button [\#841](https://github.com/torrentpier/torrentpier/pull/841) ([belomaxorka](https://github.com/belomaxorka))
- Passkey rework 🔫 [\#839](https://github.com/torrentpier/torrentpier/pull/839) ([belomaxorka](https://github.com/belomaxorka))
- Rename passkeyExists() -> getPasskey() [\#838](https://github.com/torrentpier/torrentpier/pull/838) ([belomaxorka](https://github.com/belomaxorka))
- Added method passkeyExists() [\#837](https://github.com/torrentpier/torrentpier/pull/837) ([belomaxorka](https://github.com/belomaxorka))
- Refactored get_userdata() function [\#836](https://github.com/torrentpier/torrentpier/pull/836) ([belomaxorka](https://github.com/belomaxorka))
- Fixed $bb_cfg['pm_days_keep'] [\#834](https://github.com/torrentpier/torrentpier/pull/834) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#833](https://github.com/torrentpier/torrentpier/pull/833), [\#842](https://github.com/torrentpier/torrentpier/pull/842), [\#843](https://github.com/torrentpier/torrentpier/pull/843), [\#844](https://github.com/torrentpier/torrentpier/pull/844), [\#845](https://github.com/torrentpier/torrentpier/pull/845), [\#846](https://github.com/torrentpier/torrentpier/pull/846), [\#852](https://github.com/torrentpier/torrentpier/pull/852), [\#853](https://github.com/torrentpier/torrentpier/pull/853), [\#854](https://github.com/torrentpier/torrentpier/pull/854), [\#855](https://github.com/torrentpier/torrentpier/pull/855), [\#856](https://github.com/torrentpier/torrentpier/pull/856), [\#863](https://github.com/torrentpier/torrentpier/pull/863), [\#867](https://github.com/torrentpier/torrentpier/pull/867), [\#868](https://github.com/torrentpier/torrentpier/pull/868), [\#879](https://github.com/torrentpier/torrentpier/pull/879), [\#882](https://github.com/torrentpier/torrentpier/pull/882), [\#884](https://github.com/torrentpier/torrentpier/pull/884), [\#887](https://github.com/torrentpier/torrentpier/pull/887), [\#889](https://github.com/torrentpier/torrentpier/pull/889), [\#890](https://github.com/torrentpier/torrentpier/pull/890), [\#892](https://github.com/torrentpier/torrentpier/pull/892), [\#893](https://github.com/torrentpier/torrentpier/pull/893), [\#895](https://github.com/torrentpier/torrentpier/pull/895), [\#897](https://github.com/torrentpier/torrentpier/pull/897), [\#898](https://github.com/torrentpier/torrentpier/pull/898), [\#900](https://github.com/torrentpier/torrentpier/pull/900) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#840](https://github.com/torrentpier/torrentpier/pull/840), [\#850](https://github.com/torrentpier/torrentpier/pull/850), [\#859](https://github.com/torrentpier/torrentpier/pull/859), [\#871](https://github.com/torrentpier/torrentpier/pull/871), [\#881](https://github.com/torrentpier/torrentpier/pull/881), [\#886](https://github.com/torrentpier/torrentpier/pull/886) ([Exileum](https://github.com/Exileum), [belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#847](https://github.com/torrentpier/torrentpier/pull/847), [\#849](https://github.com/torrentpier/torrentpier/pull/849), [\#875](https://github.com/torrentpier/torrentpier/pull/875), [\#874](https://github.com/torrentpier/torrentpier/pull/874), [\#873](https://github.com/torrentpier/torrentpier/pull/873), [\#872](https://github.com/torrentpier/torrentpier/pull/872) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-beta1](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta1) (2023-07-18)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-alpha4...v2.4.0-beta1)
**Merged pull requests:**
- Fixed broken smilies replacing [\#832](https://github.com/torrentpier/torrentpier/pull/832) ([belomaxorka](https://github.com/belomaxorka))
- Fixed mailer exception exposing stack trace [\#831](https://github.com/torrentpier/torrentpier/pull/831) ([belomaxorka](https://github.com/belomaxorka), [Lange](https://torrentpier.com/members/lange.55/))
- Maked max smilies in PM configurable [\#829](https://github.com/torrentpier/torrentpier/pull/829) ([belomaxorka](https://github.com/belomaxorka))
- Fix RFC 1918 RegExp [\#828](https://github.com/torrentpier/torrentpier/pull/828) ([belomaxorka](https://github.com/belomaxorka), [MetalWarrior88](https://github.com/MetalWarrior88))
- Fixed broken reset autologin [\#825](https://github.com/torrentpier/torrentpier/pull/825) ([belomaxorka](https://github.com/belomaxorka))
- Improved debug 🐛 [\#822](https://github.com/torrentpier/torrentpier/pull/822) ([belomaxorka](https://github.com/belomaxorka))
- Redirect to viewprofile.php if profile.php hasn't arguments [\#821](https://github.com/torrentpier/torrentpier/pull/821) ([belomaxorka](https://github.com/belomaxorka))
- Show smilies in post for guests [\#817](https://github.com/torrentpier/torrentpier/pull/817) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to set MySQLi error reporting [\#813](https://github.com/torrentpier/torrentpier/pull/813) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to generate passkey after registration [\#810](https://github.com/torrentpier/torrentpier/pull/810) ([belomaxorka](https://github.com/belomaxorka))
- Added search by torrent status [\#805](https://github.com/torrentpier/torrentpier/pull/805) ([belomaxorka](https://github.com/belomaxorka))
- Fixed pagination [\#800](https://github.com/torrentpier/torrentpier/pull/800) ([belomaxorka](https://github.com/belomaxorka))
- Removed unused lang variables [\#802](https://github.com/torrentpier/torrentpier/pull/802) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#796](https://github.com/torrentpier/torrentpier/pull/796), [\#797](https://github.com/torrentpier/torrentpier/pull/797), [\#798](https://github.com/torrentpier/torrentpier/pull/798), [\#799](https://github.com/torrentpier/torrentpier/pull/799), [\#801](https://github.com/torrentpier/torrentpier/pull/801), [\#804](https://github.com/torrentpier/torrentpier/pull/804), [\#806](https://github.com/torrentpier/torrentpier/pull/806), [\#808](https://github.com/torrentpier/torrentpier/pull/808), [\#809](https://github.com/torrentpier/torrentpier/pull/809), [\#811](https://github.com/torrentpier/torrentpier/pull/811), [\#812](https://github.com/torrentpier/torrentpier/pull/812), [\#814](https://github.com/torrentpier/torrentpier/pull/814), [\#816](https://github.com/torrentpier/torrentpier/pull/816), [\#819](https://github.com/torrentpier/torrentpier/pull/819), [\#823](https://github.com/torrentpier/torrentpier/pull/823), [\#824](https://github.com/torrentpier/torrentpier/pull/824), [\#826](https://github.com/torrentpier/torrentpier/pull/826) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#803](https://github.com/torrentpier/torrentpier/pull/803), [\#807](https://github.com/torrentpier/torrentpier/pull/807) ([Exileum](https://github.com/Exileum))
- Updated deps [\#818](https://github.com/torrentpier/torrentpier/pull/818), [\#830](https://github.com/torrentpier/torrentpier/pull/830) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-alpha4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-alpha4) (2023-06-08)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-alpha3...v2.4.0-alpha4)
**Merged pull requests:**
- Maked max post length configurable [\#793](https://github.com/torrentpier/torrentpier/pull/793) ([belomaxorka](https://github.com/belomaxorka))
- Used new Bencoder library 🔩 [\#791](https://github.com/torrentpier/torrentpier/pull/791) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Added some placeholders for input fields [\#789](https://github.com/torrentpier/torrentpier/pull/789) ([belomaxorka](https://github.com/belomaxorka))
- Fixed empty user search box [\#785](https://github.com/torrentpier/torrentpier/pull/785) ([belomaxorka](https://github.com/belomaxorka))
- Fixed null $u_data if user not found [\#783](https://github.com/torrentpier/torrentpier/pull/783) ([belomaxorka](https://github.com/belomaxorka))
- Added missing properties in User class [\#782](https://github.com/torrentpier/torrentpier/pull/782) ([belomaxorka](https://github.com/belomaxorka))
- Fixed some deprecations [\#777](https://github.com/torrentpier/torrentpier/pull/777) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: preg_match(): Passing null to parameter [\#776](https://github.com/torrentpier/torrentpier/pull/776) ([belomaxorka](https://github.com/belomaxorka))
- Reformated JS [\#770](https://github.com/torrentpier/torrentpier/pull/770), [\#794](https://github.com/torrentpier/torrentpier/pull/794) ([belomaxorka](https://github.com/belomaxorka))
- Implemented password_hash API 🥳 [\#768](https://github.com/torrentpier/torrentpier/pull/768) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#763](https://github.com/torrentpier/torrentpier/pull/763) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#769](https://github.com/torrentpier/torrentpier/pull/769), [\#773](https://github.com/torrentpier/torrentpier/pull/773), [\#784](https://github.com/torrentpier/torrentpier/pull/784), [\#787](https://github.com/torrentpier/torrentpier/pull/787), [\#788](https://github.com/torrentpier/torrentpier/pull/788), [\#795](https://github.com/torrentpier/torrentpier/pull/795) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#786](https://github.com/torrentpier/torrentpier/pull/786) ([Exileum](https://github.com/Exileum))
## [v2.4.0-alpha3](https://github.com/torrentpier/torrentpier/tree/v2.4.0-alpha3) (2023-06-02)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-alpha2...v2.4.0-alpha3)
**Merged pull requests:**
- Maked jumpbox optional [\#727](https://github.com/torrentpier/torrentpier/pull/727) ([belomaxorka](https://github.com/belomaxorka))
- Code Inspection: Ternary expression can be replaced with condition [\#728](https://github.com/torrentpier/torrentpier/pull/728) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: [Deprecated] number_format(): Passing null to parameter [\#729](https://github.com/torrentpier/torrentpier/pull/729) ([belomaxorka](https://github.com/belomaxorka))
- Replaced prn_r() function with dump() [\#730](https://github.com/torrentpier/torrentpier/pull/730) ([belomaxorka](https://github.com/belomaxorka))
- Replaced bb_exit() with native [\#731](https://github.com/torrentpier/torrentpier/pull/731) ([belomaxorka](https://github.com/belomaxorka))
- Added exception if .env not found [\#734](https://github.com/torrentpier/torrentpier/pull/734) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken file_write() function [\#737](https://github.com/torrentpier/torrentpier/pull/737) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken $replace_content [\#738](https://github.com/torrentpier/torrentpier/pull/738) ([belomaxorka](https://github.com/belomaxorka))
- Moved poll functions to Poll class [\#739](https://github.com/torrentpier/torrentpier/pull/739) ([belomaxorka](https://github.com/belomaxorka))
- Replaced bb_realpath() with native [\#740](https://github.com/torrentpier/torrentpier/pull/740) ([belomaxorka](https://github.com/belomaxorka))
- Fixed methods types in Admin/Cron.php [\#743](https://github.com/torrentpier/torrentpier/pull/743) ([belomaxorka](https://github.com/belomaxorka))
- Fixed empty $_SERVER['SERVER_PROTOCOL'] in cron [\#744](https://github.com/torrentpier/torrentpier/pull/744) ([belomaxorka](https://github.com/belomaxorka))
- Moved $bb_cfg['show_board_start_date'] to admin panel [\#745](https://github.com/torrentpier/torrentpier/pull/745) ([belomaxorka](https://github.com/belomaxorka))
- Added sup & sub tags in BBCode [\#746](https://github.com/torrentpier/torrentpier/pull/746) ([belomaxorka](https://github.com/belomaxorka))
- Unified checkForm() JS [\#747](https://github.com/torrentpier/torrentpier/pull/747) ([belomaxorka](https://github.com/belomaxorka))
- [TEMP] Removed Http class [\#748](https://github.com/torrentpier/torrentpier/pull/748) ([belomaxorka](https://github.com/belomaxorka))
- Added reset button in posting editor [\#749](https://github.com/torrentpier/torrentpier/pull/749) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: Automatic conversion of false to array is deprecated [\#750](https://github.com/torrentpier/torrentpier/pull/750) ([belomaxorka](https://github.com/belomaxorka))
- Reformated JS [\#753](https://github.com/torrentpier/torrentpier/pull/753), [\#754](https://github.com/torrentpier/torrentpier/pull/754) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#700](https://github.com/torrentpier/torrentpier/pull/700) ([Exileum](https://github.com/Exileum))
- Minor improvements [\#732](https://github.com/torrentpier/torrentpier/pull/732), [\#735](https://github.com/torrentpier/torrentpier/pull/735), [\#741](https://github.com/torrentpier/torrentpier/pull/741), [\#742](https://github.com/torrentpier/torrentpier/pull/742), [\#751](https://github.com/torrentpier/torrentpier/pull/751), [\#752](https://github.com/torrentpier/torrentpier/pull/752), [\#755](https://github.com/torrentpier/torrentpier/pull/755), [\#756](https://github.com/torrentpier/torrentpier/pull/756), [\#757](https://github.com/torrentpier/torrentpier/pull/757), [\#761](https://github.com/torrentpier/torrentpier/pull/761) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#733](https://github.com/torrentpier/torrentpier/pull/733), [\#758](https://github.com/torrentpier/torrentpier/pull/758) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-alpha2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-alpha2) (2023-05-28)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-alpha1...v2.4.0-alpha2)
**Merged pull requests:**
- Show cut button in debug panel only if sql_log [\#696](https://github.com/torrentpier/torrentpier/pull/696) ([belomaxorka](https://github.com/belomaxorka))
- Fixed input types in some cases [\#697](https://github.com/torrentpier/torrentpier/pull/697) ([belomaxorka](https://github.com/belomaxorka))
- Refactored is_gold & gender_image functions [\#698](https://github.com/torrentpier/torrentpier/pull/698) ([belomaxorka](https://github.com/belomaxorka))
- Added translations for debug panel [\#699](https://github.com/torrentpier/torrentpier/pull/699) ([belomaxorka](https://github.com/belomaxorka))
- Use native __DIR__ for BB_PATH [\#702](https://github.com/torrentpier/torrentpier/pull/702) ([belomaxorka](https://github.com/belomaxorka))
- Removed APP_NAME variable [\#708](https://github.com/torrentpier/torrentpier/pull/708) ([belomaxorka](https://github.com/belomaxorka))
- Removed unused globals [\#709](https://github.com/torrentpier/torrentpier/pull/709) ([belomaxorka](https://github.com/belomaxorka))
- Fixed issue with DB_PORT not applying [\#710](https://github.com/torrentpier/torrentpier/pull/710) ([belomaxorka](https://github.com/belomaxorka))
- Simplified IPHelper [\#712](https://github.com/torrentpier/torrentpier/pull/712) ([belomaxorka](https://github.com/belomaxorka))
- Changed syntax for constants definition [\#714](https://github.com/torrentpier/torrentpier/pull/714) ([belomaxorka](https://github.com/belomaxorka))
- Improvements for SEO [\#718](https://github.com/torrentpier/torrentpier/pull/718) ([belomaxorka](https://github.com/belomaxorka))
- Added password required symbols check [\#713](https://github.com/torrentpier/torrentpier/pull/713) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: htmlspecialchars(): Passing null to parameter [\#719](https://github.com/torrentpier/torrentpier/pull/719) ([belomaxorka](https://github.com/belomaxorka))
- Added 'samesite' option for setcookie() [\#720](https://github.com/torrentpier/torrentpier/pull/720) ([belomaxorka](https://github.com/belomaxorka))
- Removed deprecated type="text/css" [\#721](https://github.com/torrentpier/torrentpier/pull/721) ([belomaxorka](https://github.com/belomaxorka))
- Added some new meta tags [\#722](https://github.com/torrentpier/torrentpier/pull/722) ([belomaxorka](https://github.com/belomaxorka))
- Fixed: Required parameter $mode follows optional parameter $submit [\#724](https://github.com/torrentpier/torrentpier/pull/724) ([belomaxorka](https://github.com/belomaxorka))
- Added show board start date on index page [\#725](https://github.com/torrentpier/torrentpier/pull/725) ([belomaxorka](https://github.com/belomaxorka))
- Use define instead of tpl variable [\#726](https://github.com/torrentpier/torrentpier/pull/726) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#704](https://github.com/torrentpier/torrentpier/pull/704), [\#705](https://github.com/torrentpier/torrentpier/pull/705) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements in admin templates [\#706](https://github.com/torrentpier/torrentpier/pull/706) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#707](https://github.com/torrentpier/torrentpier/pull/707), [\#711](https://github.com/torrentpier/torrentpier/pull/711), [\#715](https://github.com/torrentpier/torrentpier/pull/715), [\#716](https://github.com/torrentpier/torrentpier/pull/716), [\#717](https://github.com/torrentpier/torrentpier/pull/717), [\#723](https://github.com/torrentpier/torrentpier/pull/723) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0-alpha1](https://github.com/torrentpier/torrentpier/tree/v2.4.0-alpha1) (2023-05-20)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.1...v2.4.0-alpha1)
**Merged pull requests:**
- Added ability to select email type in mass email [\#624](https://github.com/torrentpier/torrentpier/pull/624) ([belomaxorka](https://github.com/belomaxorka))
- Added password method in validator [\#625](https://github.com/torrentpier/torrentpier/pull/625) ([belomaxorka](https://github.com/belomaxorka))
- Show default avatar after delete, instead of hide [\#628](https://github.com/torrentpier/torrentpier/pull/628) ([belomaxorka](https://github.com/belomaxorka))
- Switching to Symfony Mailer [\#629](https://github.com/torrentpier/torrentpier/pull/629) ([Exileum](https://github.com/Exileum))
- Added missing comments into Env class [\#633](https://github.com/torrentpier/torrentpier/pull/633) ([belomaxorka](https://github.com/belomaxorka))
- Apply fixes from StyleCI [\#634](https://github.com/torrentpier/torrentpier/pull/634), [\#635](https://github.com/torrentpier/torrentpier/pull/635) ([Exileum](https://github.com/Exileum))
- Added missing comments Emailer [\#637](https://github.com/torrentpier/torrentpier/pull/637) ([belomaxorka](https://github.com/belomaxorka))
- Various fixes after composer deps update [\#638](https://github.com/torrentpier/torrentpier/pull/638) ([belomaxorka](https://github.com/belomaxorka))
- Fixed undefined value() functions [\#640](https://github.com/torrentpier/torrentpier/pull/640) ([belomaxorka](https://github.com/belomaxorka))
- Added IPHelper implementation [\#631](https://github.com/torrentpier/torrentpier/pull/631) ([belomaxorka](https://github.com/belomaxorka))
- Fixing the .env load [\#643](https://github.com/torrentpier/torrentpier/pull/643) ([Exileum](https://github.com/Exileum))
- Added Http class implementation [\#632](https://github.com/torrentpier/torrentpier/pull/632) ([belomaxorka](https://github.com/belomaxorka))
- Refactored Validate class [\#646](https://github.com/torrentpier/torrentpier/pull/646) ([belomaxorka](https://github.com/belomaxorka))
- Added system check requirements and more [\#645](https://github.com/torrentpier/torrentpier/pull/645) ([belomaxorka](https://github.com/belomaxorka))
- Removed useless email empty check in register.php [\#647](https://github.com/torrentpier/torrentpier/pull/647) ([belomaxorka](https://github.com/belomaxorka))
- Refactored Sitemap class [\#648](https://github.com/torrentpier/torrentpier/pull/648) ([belomaxorka](https://github.com/belomaxorka))
- Refactored Dev class [\#649](https://github.com/torrentpier/torrentpier/pull/649) ([belomaxorka](https://github.com/belomaxorka))
- Refactored Ajax class [\#650](https://github.com/torrentpier/torrentpier/pull/650) ([belomaxorka](https://github.com/belomaxorka))
- Added SQLite3 installed check [Cache/Datastore] [\#652](https://github.com/torrentpier/torrentpier/pull/652) ([belomaxorka](https://github.com/belomaxorka))
- Added missing default statement in switch case [\#653](https://github.com/torrentpier/torrentpier/pull/653) ([belomaxorka](https://github.com/belomaxorka))
- Refactored Sessions class [\#656](https://github.com/torrentpier/torrentpier/pull/656) ([belomaxorka](https://github.com/belomaxorka))
- Refactored CronHelper class [\#657](https://github.com/torrentpier/torrentpier/pull/657) ([belomaxorka](https://github.com/belomaxorka))
- Minor edits to the localization [\#655](https://github.com/torrentpier/torrentpier/pull/655) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken pin first post [\#660](https://github.com/torrentpier/torrentpier/pull/660) ([belomaxorka](https://github.com/belomaxorka))
- Reworked info.php [\#664](https://github.com/torrentpier/torrentpier/pull/664) ([belomaxorka](https://github.com/belomaxorka))
- Removed useless copy actions [\#661](https://github.com/torrentpier/torrentpier/pull/661) ([belomaxorka](https://github.com/belomaxorka))
- New implementation of IPHelper [\#665](https://github.com/torrentpier/torrentpier/pull/665) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken flood control [\#666](https://github.com/torrentpier/torrentpier/pull/666) ([belomaxorka](https://github.com/belomaxorka))
- Fixed empty $auth_key after gen passkey [\#670](https://github.com/torrentpier/torrentpier/pull/670) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken predicting birthday year [\#668](https://github.com/torrentpier/torrentpier/pull/668) ([belomaxorka](https://github.com/belomaxorka))
- Prevent issue with broken deleting posts [\#673](https://github.com/torrentpier/torrentpier/pull/673) ([belomaxorka](https://github.com/belomaxorka))
- Removed isAJAX check [So buggy] [\#675](https://github.com/torrentpier/torrentpier/pull/675) ([belomaxorka](https://github.com/belomaxorka))
- Show correct info about password requirements [\#676](https://github.com/torrentpier/torrentpier/pull/676) ([belomaxorka](https://github.com/belomaxorka))
- Updated sidebar links [\#678](https://github.com/torrentpier/torrentpier/pull/678) ([belomaxorka](https://github.com/belomaxorka))
- Added theme exists check [\#679](https://github.com/torrentpier/torrentpier/pull/679) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken get gethostbyaddr [\#681](https://github.com/torrentpier/torrentpier/pull/681) ([belomaxorka](https://github.com/belomaxorka))
- Cumulative update ☕ [\#685](https://github.com/torrentpier/torrentpier/pull/685) ([belomaxorka](https://github.com/belomaxorka))
- Remove unused use statement [\#687](https://github.com/torrentpier/torrentpier/pull/687) ([belomaxorka](https://github.com/belomaxorka))
- Prevent issue with empty $disallowed_id removing [\#692](https://github.com/torrentpier/torrentpier/pull/692) ([belomaxorka](https://github.com/belomaxorka))
- Fixed input types in some cases [\#693](https://github.com/torrentpier/torrentpier/pull/693) ([belomaxorka](https://github.com/belomaxorka))
- [TEMP] Prevent issue with undefined lang variable [\#694](https://github.com/torrentpier/torrentpier/pull/694) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#626](https://github.com/torrentpier/torrentpier/pull/626), [\#695](https://github.com/torrentpier/torrentpier/pull/695) ([Exileum](https://github.com/Exileum))
- Minor adjustments [\#644](https://github.com/torrentpier/torrentpier/pull/644) ([belomaxorka](https://github.com/belomaxorka))
- Minor fixes [\#654](https://github.com/torrentpier/torrentpier/pull/654), [\#659](https://github.com/torrentpier/torrentpier/pull/659), [\#662](https://github.com/torrentpier/torrentpier/pull/662), [\#663](https://github.com/torrentpier/torrentpier/pull/663), [\#667](https://github.com/torrentpier/torrentpier/pull/667), [\#670](https://github.com/torrentpier/torrentpier/pull/670), [\#674](https://github.com/torrentpier/torrentpier/pull/674), [\#682](https://github.com/torrentpier/torrentpier/pull/682), [\#686](https://github.com/torrentpier/torrentpier/pull/686) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.1](https://github.com/torrentpier/torrentpier/tree/v2.3.1) (2023-03-18)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.1-rc1...v2.3.1)
**Merged pull requests:**
- Make activate key length configurable [\#590](https://github.com/torrentpier/torrentpier/pull/590) ([belomaxorka](https://github.com/belomaxorka))
- Minor adjustments [\#593](https://github.com/torrentpier/torrentpier/pull/593), [\#607](https://github.com/torrentpier/torrentpier/pull/607), [\#610](https://github.com/torrentpier/torrentpier/pull/610) ([belomaxorka](https://github.com/belomaxorka))
- Fixed typo in src/Cache/File.php [\#596](https://github.com/torrentpier/torrentpier/pull/596) ([belomaxorka](https://github.com/belomaxorka))
- Use APP_NAME instead lang variables [\#604](https://github.com/torrentpier/torrentpier/pull/604) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#577](https://github.com/torrentpier/torrentpier/pull/577), [\#605](https://github.com/torrentpier/torrentpier/pull/605), [\#616](https://github.com/torrentpier/torrentpier/pull/616) ([Exileum](https://github.com/Exileum))
- Use translations instead of untranslatable strings [\#606](https://github.com/torrentpier/torrentpier/pull/606) ([belomaxorka](https://github.com/belomaxorka))
- Fixed undefined $subject in register.php [\#608](https://github.com/torrentpier/torrentpier/pull/608) ([belomaxorka](https://github.com/belomaxorka))
- Removed length limits for search_id & autologin_id [\#609](https://github.com/torrentpier/torrentpier/pull/609) ([belomaxorka](https://github.com/belomaxorka))
- Small refactoring for avatar.php [AJAX] [\#611](https://github.com/torrentpier/torrentpier/pull/611), [\#612](https://github.com/torrentpier/torrentpier/pull/612) ([belomaxorka](https://github.com/belomaxorka))
- Added PM counter in title [\#613](https://github.com/torrentpier/torrentpier/pull/613) ([belomaxorka](https://github.com/belomaxorka))
- Redesigned AJAX system styles [\#614](https://github.com/torrentpier/torrentpier/pull/614) ([belomaxorka](https://github.com/belomaxorka), [Exileum](https://github.com/Exileum))
- Minor edits to the localization [\#615](https://github.com/torrentpier/torrentpier/pull/615) ([Exileum](https://github.com/Exileum))
- New cron initialization and minor edits [\#619](https://github.com/torrentpier/torrentpier/pull/619) ([Exileum](https://github.com/Exileum))
- Fixed broken avatar ajax action for users [\#618](https://github.com/torrentpier/torrentpier/pull/618) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to hide ajax loading alert [\#617](https://github.com/torrentpier/torrentpier/pull/617) ([belomaxorka](https://github.com/belomaxorka))
- Added passkey check in get_bt_userdata [\#621](https://github.com/torrentpier/torrentpier/pull/621) ([belomaxorka](https://github.com/belomaxorka))
- Miscellaneous static analysis improvements for php 7.1 [\#620](https://github.com/torrentpier/torrentpier/pull/620) ([Exileum](https://github.com/Exileum))
- Fixed getting online info from cache [\#622](https://github.com/torrentpier/torrentpier/pull/622) ([belomaxorka](https://github.com/belomaxorka), [Exileum](https://github.com/Exileum))
- Globally improved log system [\#623](https://github.com/torrentpier/torrentpier/pull/623) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.1-rc1](https://github.com/torrentpier/torrentpier/tree/v2.3.1-rc1) (2023-03-10)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0.4-beta2...v2.3.1-rc1)
**Merged pull requests:**
- Minor adjustments in sql dumps [\#560](https://github.com/torrentpier/torrentpier/pull/560), [\#561](https://github.com/torrentpier/torrentpier/pull/561) ([belomaxorka](https://github.com/belomaxorka))
- New BB_PATH implementation [\#562](https://github.com/torrentpier/torrentpier/pull/562) ([belomaxorka](https://github.com/belomaxorka))
- Use constants instead of string literals [\#563](https://github.com/torrentpier/torrentpier/pull/563), [\#573](https://github.com/torrentpier/torrentpier/pull/573) ([belomaxorka](https://github.com/belomaxorka))
- Hide feed button if feed file doesn't exist [\#564](https://github.com/torrentpier/torrentpier/pull/564) ([belomaxorka](https://github.com/belomaxorka))
- Added some new fonts in bbcode editor [\#565](https://github.com/torrentpier/torrentpier/pull/565) ([belomaxorka](https://github.com/belomaxorka))
- Added some new font sizes in bbcode editor [\#566](https://github.com/torrentpier/torrentpier/pull/566) ([belomaxorka](https://github.com/belomaxorka))
- Added optional parameter in $valid_actions [AJAX] [\#567](https://github.com/torrentpier/torrentpier/pull/567) ([belomaxorka](https://github.com/belomaxorka))
- Check if request is ajax [\#569](https://github.com/torrentpier/torrentpier/pull/569) ([belomaxorka](https://github.com/belomaxorka))
- Fixed code-style in some files [\#570](https://github.com/torrentpier/torrentpier/pull/570) ([belomaxorka](https://github.com/belomaxorka))
- Minor adjustments [\#571](https://github.com/torrentpier/torrentpier/pull/571), [\#584](https://github.com/torrentpier/torrentpier/pull/584) ([belomaxorka](https://github.com/belomaxorka))
- Added link to forum in admin_forumauth.tpl [\#574](https://github.com/torrentpier/torrentpier/pull/574) ([belomaxorka](https://github.com/belomaxorka))
- Simplified make_rand_str function [\#575](https://github.com/torrentpier/torrentpier/pull/575) ([belomaxorka](https://github.com/belomaxorka))
- Redesigned admin_ug_auth [\#576](https://github.com/torrentpier/torrentpier/pull/576) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken "user_viewonline" in admin panel [\#579](https://github.com/torrentpier/torrentpier/pull/579) ([belomaxorka](https://github.com/belomaxorka))
- Make sitemap sending configurable [\#585](https://github.com/torrentpier/torrentpier/pull/585) ([belomaxorka](https://github.com/belomaxorka))
- Fixed get_avatar method [\#586](https://github.com/torrentpier/torrentpier/pull/586) ([belomaxorka](https://github.com/belomaxorka))
- Added show avatar in memberlist [\#587](https://github.com/torrentpier/torrentpier/pull/587) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.0.4-beta2](https://github.com/torrentpier/torrentpier/tree/v2.3.0.4-beta2) (2023-03-04)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0.4-beta...v2.3.0.4-beta2)
**Merged pull requests:**
- Updated treeview up to 1.4.2 [\#549](https://github.com/torrentpier/torrentpier/pull/549) ([belomaxorka](https://github.com/belomaxorka))
- Removed ugly copyright in indexer [\#546](https://github.com/torrentpier/torrentpier/pull/546) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to print page [\#544](https://github.com/torrentpier/torrentpier/pull/544) ([belomaxorka](https://github.com/belomaxorka))
- Removed deprecated SQL_CACHE [\#554](https://github.com/torrentpier/torrentpier/pull/554) ([belomaxorka](https://github.com/belomaxorka))
- Added min required mysql / mariadb version [\#555](https://github.com/torrentpier/torrentpier/pull/555) ([belomaxorka](https://github.com/belomaxorka))
- Added needed "ORDER BY" in sql query [\#557](https://github.com/torrentpier/torrentpier/pull/557) ([belomaxorka](https://github.com/belomaxorka))
- Added missing sql query in changes.txt [\#558](https://github.com/torrentpier/torrentpier/pull/558) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.0.4-beta](https://github.com/torrentpier/torrentpier/tree/v2.3.0.4-beta) (2023-02-22)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0.3...v2.3.0.4-beta)
**Merged pull requests:**
- docs: change official forum path [\#532](https://github.com/torrentpier/torrentpier/pull/532) ([Exileum](https://github.com/Exileum))
- Fixed broken sql log selecting in debug-panel [\#533](https://github.com/torrentpier/torrentpier/pull/533) ([belomaxorka](https://github.com/belomaxorka))
- New implementation of old browser detector [\#534](https://github.com/torrentpier/torrentpier/pull/534) ([belomaxorka](https://github.com/belomaxorka))
- Fixed SQLite caching issue [\#535](https://github.com/torrentpier/torrentpier/pull/535) ([belomaxorka](https://github.com/belomaxorka))
- Extended email validation [\#536](https://github.com/torrentpier/torrentpier/pull/536) ([belomaxorka](https://github.com/belomaxorka))
- Admin panel adjustments [\#538](https://github.com/torrentpier/torrentpier/pull/538) ([belomaxorka](https://github.com/belomaxorka))
- Added user birthday icon in profile [\#539](https://github.com/torrentpier/torrentpier/pull/539) ([belomaxorka](https://github.com/belomaxorka))
- Added forum description in viewforum page [\#540](https://github.com/torrentpier/torrentpier/pull/540) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken copy log from debug-panel [\#541](https://github.com/torrentpier/torrentpier/pull/541) ([belomaxorka](https://github.com/belomaxorka))
- Added copy button in viewforum page [\#542](https://github.com/torrentpier/torrentpier/pull/542) ([belomaxorka](https://github.com/belomaxorka))
- Added current topic url copy button in viewtopic [\#543](https://github.com/torrentpier/torrentpier/pull/543) ([belomaxorka](https://github.com/belomaxorka))
- Added ``$bb_cfg['emailer']['enabled']`` check in admin_mass_email.php [\#545](https://github.com/torrentpier/torrentpier/pull/545) ([belomaxorka](https://github.com/belomaxorka))
- Updated scrollTo up to 1.4.6 [\#547](https://github.com/torrentpier/torrentpier/pull/547) ([belomaxorka](https://github.com/belomaxorka))
- Updated quicksearch up to Feb 21, 2018 commit [\#548](https://github.com/torrentpier/torrentpier/pull/548) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.0.3](https://github.com/torrentpier/torrentpier/tree/v2.3.0.3) (2023-02-18)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0.2...v2.3.0.3)
**Merged pull requests:**
- Updated copyright year [\#525](https://github.com/torrentpier/torrentpier/pull/525) ([belomaxorka](https://github.com/belomaxorka))
- Update README.md (Fixed incorrect logo path) [\#526](https://github.com/torrentpier/torrentpier/pull/526) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken getting avatars directory size [\#527](https://github.com/torrentpier/torrentpier/pull/527) ([belomaxorka](https://github.com/belomaxorka))
- Added declensions for count of downloads [\#528](https://github.com/torrentpier/torrentpier/pull/528) ([belomaxorka](https://github.com/belomaxorka))
- Use XS_TPL_PREFIX instead of 'tpl_' [\#529](https://github.com/torrentpier/torrentpier/pull/529) ([belomaxorka](https://github.com/belomaxorka))
- Removed useless .htaccess files [\#530](https://github.com/torrentpier/torrentpier/pull/530) ([belomaxorka](https://github.com/belomaxorka))
- Replaced "deny from all" with "Require all denied" [\#531](https://github.com/torrentpier/torrentpier/pull/531) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.0.2](https://github.com/torrentpier/torrentpier/tree/v2.3.0.2) (2023-01-23)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0.1...v2.3.0.2)
**Merged pull requests:**
- Fixed PHP 7.3: Deprecate FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED flags used with FILTER_VALIDATE_URL [\#507](https://github.com/torrentpier/torrentpier/pull/507) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken user search in admin_groups [\#508](https://github.com/torrentpier/torrentpier/pull/508) ([belomaxorka](https://github.com/belomaxorka))
- Fix some bugs with MySQL strict mode [\#509](https://github.com/torrentpier/torrentpier/pull/509) ([belomaxorka](https://github.com/belomaxorka))
- Fixed and improvements for SQL [\#510](https://github.com/torrentpier/torrentpier/pull/510) ([belomaxorka](https://github.com/belomaxorka))
- Added showing post number in viewtopic [\#511](https://github.com/torrentpier/torrentpier/pull/511) ([belomaxorka](https://github.com/belomaxorka))
- Updated composer dependencies [\#512](https://github.com/torrentpier/torrentpier/pull/512) ([belomaxorka](https://github.com/belomaxorka))
- Added symfony/polyfill [\#513](https://github.com/torrentpier/torrentpier/pull/513) ([belomaxorka](https://github.com/belomaxorka))
- Updated jQuery up to 1.12.4 [\#514](https://github.com/torrentpier/torrentpier/pull/514) ([belomaxorka](https://github.com/belomaxorka))
- Updated normalize css up to 8.0.1 [\#515](https://github.com/torrentpier/torrentpier/pull/515) ([belomaxorka](https://github.com/belomaxorka))
- Misc code improvements [\#516](https://github.com/torrentpier/torrentpier/pull/516) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken file_write() function [\#517](https://github.com/torrentpier/torrentpier/pull/517) ([belomaxorka](https://github.com/belomaxorka))
- Fixed array multi sorting [\#518](https://github.com/torrentpier/torrentpier/pull/518) ([belomaxorka](https://github.com/belomaxorka))
## [v2.3.0.1](https://github.com/torrentpier/torrentpier/tree/v2.3.0.1) (2018-06-27)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.3.0...v2.3.0.1)
**Merged pull requests:**
- Fix cron jobs fail without global config variable [\#471](https://github.com/torrentpier/torrentpier/pull/471) ([Exileum](https://github.com/Exileum))
- Cleanup BBCode class [\#470](https://github.com/torrentpier/torrentpier/pull/470) ([Exileum](https://github.com/Exileum))
## [v2.3.0](https://github.com/torrentpier/torrentpier/tree/v2.3.0) (2018-06-26)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.3...v2.3.0)
**Merged pull requests:**
- Release preparation. Crowdin language pack update [\#468](https://github.com/torrentpier/torrentpier/pull/468) ([Exileum](https://github.com/Exileum))
- PHP 7+ deprecations of old cache systems [\#467](https://github.com/torrentpier/torrentpier/pull/467) ([Exileum](https://github.com/Exileum))
- Fix global atom feed name [\#466](https://github.com/torrentpier/torrentpier/pull/466) ([Exileum](https://github.com/Exileum))
- Configurable download torrent url [\#465](https://github.com/torrentpier/torrentpier/pull/465) ([Exileum](https://github.com/Exileum))
- Fix some bugs with MySQL strict mode [\#464](https://github.com/torrentpier/torrentpier/pull/464) ([Exileum](https://github.com/Exileum))
- Fix release template editor [\#463](https://github.com/torrentpier/torrentpier/pull/463) ([Exileum](https://github.com/Exileum))
- Fix multiple variable cleanup in private messaging [\#462](https://github.com/torrentpier/torrentpier/pull/462) ([Exileum](https://github.com/Exileum))
- Fix magnet link passkey creation for new users [\#461](https://github.com/torrentpier/torrentpier/pull/461) ([Exileum](https://github.com/Exileum))
- Update required PHP version to 7.1.3 [\#460](https://github.com/torrentpier/torrentpier/pull/460) ([Exileum](https://github.com/Exileum))
- Split functions to the composer autoloading [\#459](https://github.com/torrentpier/torrentpier/pull/459) ([Exileum](https://github.com/Exileum))
- Update copyright to the short syntax [\#458](https://github.com/torrentpier/torrentpier/pull/458) ([Exileum](https://github.com/Exileum))
- Fix \#451. Undefined index: L\_CRON\_EDIT\_HEAD [\#457](https://github.com/torrentpier/torrentpier/pull/457) ([Exileum](https://github.com/Exileum))
- Merge head branches [\#456](https://github.com/torrentpier/torrentpier/pull/456) ([Exileum](https://github.com/Exileum))
- Default value for user\_birthday causes exception on user password change [\#449](https://github.com/torrentpier/torrentpier/pull/449) ([yukoff](https://github.com/yukoff))
- Add back roave/security-advisories [\#446](https://github.com/torrentpier/torrentpier/pull/446) ([yukoff](https://github.com/yukoff))
## [v2.2.3](https://github.com/torrentpier/torrentpier/tree/v2.2.3) (2017-08-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.2...v2.2.3)
**Merged pull requests:**
- Release 2.2.3 🔥 [\#443](https://github.com/torrentpier/torrentpier/pull/443) ([Exileum](https://github.com/Exileum))
- Release preparation. Crowdin language pack update [\#442](https://github.com/torrentpier/torrentpier/pull/442) ([Exileum](https://github.com/Exileum))
- Unique topic page title, undefined language variables fix [\#441](https://github.com/torrentpier/torrentpier/pull/441) ([Exileum](https://github.com/Exileum))
- Remove matching users with default IP from profile list [\#440](https://github.com/torrentpier/torrentpier/pull/440) ([Exileum](https://github.com/Exileum))
- Broken announcer fix, announcer debug removed [\#439](https://github.com/torrentpier/torrentpier/pull/439) ([Exileum](https://github.com/Exileum))
- Fix broken ajax [\#436](https://github.com/torrentpier/torrentpier/pull/436) ([Exileum](https://github.com/Exileum))
- Some deprecations, normalize.css, torrent file content sort fix [\#434](https://github.com/torrentpier/torrentpier/pull/434) ([Exileum](https://github.com/Exileum))
- Incorrect log file rotation regex [\#432](https://github.com/torrentpier/torrentpier/pull/432) ([Exileum](https://github.com/Exileum))
- Various bug fixes described on the forum [\#431](https://github.com/torrentpier/torrentpier/pull/431) ([Exileum](https://github.com/Exileum))
- Fixes \#412 - bug with dynamic language variables [\#430](https://github.com/torrentpier/torrentpier/pull/430) ([Exileum](https://github.com/Exileum))
- Update .htaccess for new Apache 2.4 syntax [\#429](https://github.com/torrentpier/torrentpier/pull/429) ([Exileum](https://github.com/Exileum))
- Crowdin language pack update for new project domain name [\#415](https://github.com/torrentpier/torrentpier/pull/415) ([Exileum](https://github.com/Exileum))
- Composer support section error [\#414](https://github.com/torrentpier/torrentpier/pull/414) ([Exileum](https://github.com/Exileum))
- New project domain name [\#413](https://github.com/torrentpier/torrentpier/pull/413) ([Exileum](https://github.com/Exileum))
## [v2.2.2](https://github.com/torrentpier/torrentpier/tree/v2.2.2) (2017-06-22)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.1...v2.2.2)
**Merged pull requests:**
- Release 2.2.2 🌞 [\#410](https://github.com/torrentpier/torrentpier/pull/410) ([Exileum](https://github.com/Exileum))
- Release preparation Crowdin language pack update [\#409](https://github.com/torrentpier/torrentpier/pull/409) ([Exileum](https://github.com/Exileum))
- Display source language if no user language variable [\#408](https://github.com/torrentpier/torrentpier/pull/408) ([Exileum](https://github.com/Exileum))
- Disable Bugsnag by default [\#407](https://github.com/torrentpier/torrentpier/pull/407) ([Exileum](https://github.com/Exileum))
- Fix empty birthday list [\#406](https://github.com/torrentpier/torrentpier/pull/406) ([Exileum](https://github.com/Exileum))
- Remove unused ranks functionality [\#405](https://github.com/torrentpier/torrentpier/pull/405) ([Exileum](https://github.com/Exileum))
- Complete renewal of the Ukrainian language from our toloka.to friends [\#404](https://github.com/torrentpier/torrentpier/pull/404) ([Exileum](https://github.com/Exileum))
- Some fixes, auto language removal \(so buggy\) and replenishable status [\#403](https://github.com/torrentpier/torrentpier/pull/403) ([Exileum](https://github.com/Exileum))
## [v2.2.1](https://github.com/torrentpier/torrentpier/tree/v2.2.1) (2017-06-16)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.2.0...v2.2.1)
**Merged pull requests:**
- Release 2.2.1 🐛 [\#392](https://github.com/torrentpier/torrentpier/pull/392) ([Exileum](https://github.com/Exileum))
- Partial renewal of the Ukrainian language from our toloka.to friends [\#391](https://github.com/torrentpier/torrentpier/pull/391) ([Exileum](https://github.com/Exileum))
- Create CODE\_OF\_CONDUCT.md [\#390](https://github.com/torrentpier/torrentpier/pull/390) ([Exileum](https://github.com/Exileum))
- Fix default users language in dump [\#389](https://github.com/torrentpier/torrentpier/pull/389) ([Exileum](https://github.com/Exileum))
- Tracker search forum list simplification [\#388](https://github.com/torrentpier/torrentpier/pull/388) ([Exileum](https://github.com/Exileum))
- Fix some notices in admin panel reported by BugSnag [\#387](https://github.com/torrentpier/torrentpier/pull/387) ([Exileum](https://github.com/Exileum))
- Fixed SQL. Remove limit from update [\#368](https://github.com/torrentpier/torrentpier/pull/368) ([VasyOk](https://github.com/VasyOk))
## [v2.2.0](https://github.com/torrentpier/torrentpier/tree/v2.2.0) (2017-06-12)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.5...v2.2.0)
**Merged pull requests:**
- Release 2.2.0 ☘️ [\#328](https://github.com/torrentpier/torrentpier/pull/328) ([Exileum](https://github.com/Exileum))
- Release preparation. Crowdin language pack update [\#322](https://github.com/torrentpier/torrentpier/pull/322) ([Exileum](https://github.com/Exileum))
- TorrentPier Aurochs release preparation [\#321](https://github.com/torrentpier/torrentpier/pull/321) ([Exileum](https://github.com/Exileum))
- Release preparation. Small bugfixes and readme translation [\#318](https://github.com/torrentpier/torrentpier/pull/318) ([Exileum](https://github.com/Exileum))
- Crowdin language pack update [\#314](https://github.com/torrentpier/torrentpier/pull/314) ([Exileum](https://github.com/Exileum))
- IP storage and attachment system bugfix. PHP 5.6+ [\#313](https://github.com/torrentpier/torrentpier/pull/313) ([Exileum](https://github.com/Exileum))
- Bootstrap update & beginning of the develop branch partial merge [\#303](https://github.com/torrentpier/torrentpier/pull/303) ([Exileum](https://github.com/Exileum))
- Fix avatars display bug [\#302](https://github.com/torrentpier/torrentpier/pull/302) ([Exileum](https://github.com/Exileum))
- Cron subsystem rework. Environments [\#301](https://github.com/torrentpier/torrentpier/pull/301) ([Exileum](https://github.com/Exileum))
- New logotype, favicon and css split & reformat [\#293](https://github.com/torrentpier/torrentpier/pull/293) ([Exileum](https://github.com/Exileum))
- Whoops error handler for debug users [\#291](https://github.com/torrentpier/torrentpier/pull/291) ([Exileum](https://github.com/Exileum))
- Replace sitemap to the new external component [\#252](https://github.com/torrentpier/torrentpier/pull/252) ([Exileum](https://github.com/Exileum))
- Crowdin language pack update. Removed some languages [\#250](https://github.com/torrentpier/torrentpier/pull/250) ([Exileum](https://github.com/Exileum))
- IP detect subsystem replace. Trash cleanup. Defines [\#249](https://github.com/torrentpier/torrentpier/pull/249) ([Exileum](https://github.com/Exileum))
- Old ads module removal [\#244](https://github.com/torrentpier/torrentpier/pull/244) ([Exileum](https://github.com/Exileum))
- External bencode library and some other changes [\#243](https://github.com/torrentpier/torrentpier/pull/243) ([Exileum](https://github.com/Exileum))
- Added new logo to readme [\#242](https://github.com/torrentpier/torrentpier/pull/242) ([VasyOk](https://github.com/VasyOk))
- Bugsnag integration and some bugfixes in for cycles [\#239](https://github.com/torrentpier/torrentpier/pull/239) ([Exileum](https://github.com/Exileum))
- Bug with variables replacement and Crowdin localization fix [\#238](https://github.com/torrentpier/torrentpier/pull/238) ([Exileum](https://github.com/Exileum))
- PSR-4 compatible legacy code autoloading [\#237](https://github.com/torrentpier/torrentpier/pull/237) ([Exileum](https://github.com/Exileum))
- UFT-8 autocorrection removal from standart package [\#236](https://github.com/torrentpier/torrentpier/pull/236) ([Exileum](https://github.com/Exileum))
- New localization strings and full Crowdin language pack update [\#235](https://github.com/torrentpier/torrentpier/pull/235) ([Exileum](https://github.com/Exileum))
- Replace own emailer to SwiftMailer [\#234](https://github.com/torrentpier/torrentpier/pull/234) ([Exileum](https://github.com/Exileum))
- Force email charset and Crowdin language pack update [\#232](https://github.com/torrentpier/torrentpier/pull/232) ([Exileum](https://github.com/Exileum))
- Crowdin language pack update [\#231](https://github.com/torrentpier/torrentpier/pull/231) ([Exileum](https://github.com/Exileum))
- Static code analyzer inspection, part 2 [\#230](https://github.com/torrentpier/torrentpier/pull/230) ([Exileum](https://github.com/Exileum))
- Static code analyzer cherry picked from \#228 [\#229](https://github.com/torrentpier/torrentpier/pull/229) ([VasyOk](https://github.com/VasyOk))
- Fix compare php version. [\#226](https://github.com/torrentpier/torrentpier/pull/226) ([VasyOk](https://github.com/VasyOk))
- Fixed compare version PHP [\#225](https://github.com/torrentpier/torrentpier/pull/225) ([VasyOk](https://github.com/VasyOk))
- Deprecated each\(\) function in php 7.2 [\#211](https://github.com/torrentpier/torrentpier/pull/211) ([Exileum](https://github.com/Exileum))
- Performance refactoring. Remove test code. Fix path in config [\#208](https://github.com/torrentpier/torrentpier/pull/208) ([VasyOk](https://github.com/VasyOk))
- Fix many notices in admin\_attach\_cp.php [\#183](https://github.com/torrentpier/torrentpier/pull/183) ([Exileum](https://github.com/Exileum))
- Add check lang [\#178](https://github.com/torrentpier/torrentpier/pull/178) ([VasyOk](https://github.com/VasyOk))
- Remove order from sql [\#177](https://github.com/torrentpier/torrentpier/pull/177) ([VasyOk](https://github.com/VasyOk))
- Fix path to viewtorrent.php [\#176](https://github.com/torrentpier/torrentpier/pull/176) ([VasyOk](https://github.com/VasyOk))
- New Crowdin translations [\#168](https://github.com/torrentpier/torrentpier/pull/168) ([Exileum](https://github.com/Exileum))
- Localization trash cleanup [\#167](https://github.com/torrentpier/torrentpier/pull/167) ([Exileum](https://github.com/Exileum))
- New Crowdin translations \(develop\) [\#165](https://github.com/torrentpier/torrentpier/pull/165) ([Exileum](https://github.com/Exileum))
- New Crowdin translations \(master\) [\#164](https://github.com/torrentpier/torrentpier/pull/164) ([Exileum](https://github.com/Exileum))
- Crowdin localization integration prepare and stopwords removal [\#163](https://github.com/torrentpier/torrentpier/pull/163) ([Exileum](https://github.com/Exileum))
- Crowdin localization integration [\#162](https://github.com/torrentpier/torrentpier/pull/162) ([Exileum](https://github.com/Exileum))
- New Crowdin translations \(develop\) [\#161](https://github.com/torrentpier/torrentpier/pull/161) ([Exileum](https://github.com/Exileum))
- \#157. Fix Error in GET /bt/announce.php [\#159](https://github.com/torrentpier/torrentpier/pull/159) ([VasyOk](https://github.com/VasyOk))
- Added check composer install [\#148](https://github.com/torrentpier/torrentpier/pull/148) ([VasyOk](https://github.com/VasyOk))
- Fix operators [\#147](https://github.com/torrentpier/torrentpier/pull/147) ([VasyOk](https://github.com/VasyOk))
- \#144 Files should not be executable [\#145](https://github.com/torrentpier/torrentpier/pull/145) ([VasyOk](https://github.com/VasyOk))
- Change paths to absolute pathname [\#143](https://github.com/torrentpier/torrentpier/pull/143) ([VasyOk](https://github.com/VasyOk))
- Redundant pagination, mysql 5.7+ issue, release template option [\#141](https://github.com/torrentpier/torrentpier/pull/141) ([Exileum](https://github.com/Exileum))
- Transfer announce to the php7-optimized database layer [\#140](https://github.com/torrentpier/torrentpier/pull/140) ([Exileum](https://github.com/Exileum))
- Cleanup repository from old deprecated scripts and server configs [\#139](https://github.com/torrentpier/torrentpier/pull/139) ([Exileum](https://github.com/Exileum))
- Torrent ajax file list fixes and small reformat [\#138](https://github.com/torrentpier/torrentpier/pull/138) ([Exileum](https://github.com/Exileum))
- Codacy / Scrutinizer / Code Climate / Coveralls integration, Slack hook to Travis CI [\#137](https://github.com/torrentpier/torrentpier/pull/137) ([Exileum](https://github.com/Exileum))
- Add a Codacy badge to README.md [\#136](https://github.com/torrentpier/torrentpier/pull/136) ([codacy-badger](https://github.com/codacy-badger))
- Replace Sphinx API to the composer version [\#135](https://github.com/torrentpier/torrentpier/pull/135) ([Exileum](https://github.com/Exileum))
- Incorrect case close operators \(develop\) [\#134](https://github.com/torrentpier/torrentpier/pull/134) ([Exileum](https://github.com/Exileum))
- Incorrect case close operators \(master\) [\#133](https://github.com/torrentpier/torrentpier/pull/133) ([Exileum](https://github.com/Exileum))
- Composer init, editor config, some cleanup and much more [\#132](https://github.com/torrentpier/torrentpier/pull/132) ([Exileum](https://github.com/Exileum))
- Remove eval from admin\_attachments and emailer [\#129](https://github.com/torrentpier/torrentpier/pull/129) ([VasyOk](https://github.com/VasyOk))
- Fix sql group [\#128](https://github.com/torrentpier/torrentpier/pull/128) ([VasyOk](https://github.com/VasyOk))
- Remove Zend [\#127](https://github.com/torrentpier/torrentpier/pull/127) ([VasyOk](https://github.com/VasyOk))
- Small fix to the upgrade schema [\#126](https://github.com/torrentpier/torrentpier/pull/126) ([Exileum](https://github.com/Exileum))
- Fixed id sqllog table and name select db [\#125](https://github.com/torrentpier/torrentpier/pull/125) ([VasyOk](https://github.com/VasyOk))
- New external service for look up IP address [\#122](https://github.com/torrentpier/torrentpier/pull/122) ([Exileum](https://github.com/Exileum))
- New branding and copyright [\#121](https://github.com/torrentpier/torrentpier/pull/121) ([Exileum](https://github.com/Exileum))
- Poster birthday with no birthday date fix [\#120](https://github.com/torrentpier/torrentpier/pull/120) ([Exileum](https://github.com/Exileum))
- Tidy deprecated option merge-spans remove [\#119](https://github.com/torrentpier/torrentpier/pull/119) ([Exileum](https://github.com/Exileum))
- Db logging [\#118](https://github.com/torrentpier/torrentpier/pull/118) ([leroy0](https://github.com/leroy0))
- CircleCi, CodeCoverage and composer dependencies [\#117](https://github.com/torrentpier/torrentpier/pull/117) ([Exileum](https://github.com/Exileum))
- Db exceptions, query with binding [\#116](https://github.com/torrentpier/torrentpier/pull/116) ([leroy0](https://github.com/leroy0))
- PHP 7+ requirements, Travis and other small fixes [\#115](https://github.com/torrentpier/torrentpier/pull/115) ([Exileum](https://github.com/Exileum))
- New compatible with php7 classes: Db, Config [\#114](https://github.com/torrentpier/torrentpier/pull/114) ([Exileum](https://github.com/Exileum))
- Refactoring posting\_attachments [\#112](https://github.com/torrentpier/torrentpier/pull/112) ([VasyOk](https://github.com/VasyOk))
- Update the current year in the license text [\#110](https://github.com/torrentpier/torrentpier/pull/110) ([Exileum](https://github.com/Exileum))
- Reformat master branch to PSR-2 and MIT license [\#109](https://github.com/torrentpier/torrentpier/pull/109) ([Exileum](https://github.com/Exileum))
- Master branch up to php 7 compatibility [\#107](https://github.com/torrentpier/torrentpier/pull/107) ([VasyOk](https://github.com/VasyOk))
- Removal of unused scripts and server configs [\#105](https://github.com/torrentpier/torrentpier/pull/105) ([Exileum](https://github.com/Exileum))
- New license - MIT [\#104](https://github.com/torrentpier/torrentpier/pull/104) ([Exileum](https://github.com/Exileum))
- New coding standart: PSR-2 [\#103](https://github.com/torrentpier/torrentpier/pull/103) ([Exileum](https://github.com/Exileum))
- Improvements in code and work cache [\#101](https://github.com/torrentpier/torrentpier/pull/101) ([VasyOk](https://github.com/VasyOk))
- Migration to the new config subsystem [\#100](https://github.com/torrentpier/torrentpier/pull/100) ([Exileum](https://github.com/Exileum))
- php-lang-correct removed [\#99](https://github.com/torrentpier/torrentpier/pull/99) ([Exileum](https://github.com/Exileum))
- Logical operators should be avoided [\#98](https://github.com/torrentpier/torrentpier/pull/98) ([Exileum](https://github.com/Exileum))
- Migration to the new cache subsystem [\#97](https://github.com/torrentpier/torrentpier/pull/97) ([Exileum](https://github.com/Exileum))
- Rework of feed.php and some other files [\#94](https://github.com/torrentpier/torrentpier/pull/94) ([Exileum](https://github.com/Exileum))
- Refactoring Cache [\#92](https://github.com/torrentpier/torrentpier/pull/92) ([VasyOk](https://github.com/VasyOk))
- Add new tests and refactoring [\#89](https://github.com/torrentpier/torrentpier/pull/89) ([VasyOk](https://github.com/VasyOk))
- Add tests [\#88](https://github.com/torrentpier/torrentpier/pull/88) ([VasyOk](https://github.com/VasyOk))
- Some fix after removed @ [\#87](https://github.com/torrentpier/torrentpier/pull/87) ([VasyOk](https://github.com/VasyOk))
- \#77 Add monolog [\#86](https://github.com/torrentpier/torrentpier/pull/86) ([VasyOk](https://github.com/VasyOk))
- Remove at [\#85](https://github.com/torrentpier/torrentpier/pull/85) ([VasyOk](https://github.com/VasyOk))
- Переделка файла dl.php на работу с новой базой [\#83](https://github.com/torrentpier/torrentpier/pull/83) ([Exileum](https://github.com/Exileum))
- Added use profiler and in\(de\)crement methods. [\#82](https://github.com/torrentpier/torrentpier/pull/82) ([VasyOk](https://github.com/VasyOk))
- Remove response service provider [\#80](https://github.com/torrentpier/torrentpier/pull/80) ([VasyOk](https://github.com/VasyOk))
- DI usage example [\#79](https://github.com/torrentpier/torrentpier/pull/79) ([Exileum](https://github.com/Exileum))
- Added methods to simplify the work with the database [\#75](https://github.com/torrentpier/torrentpier/pull/75) ([VasyOk](https://github.com/VasyOk))
- Captcha service provider [\#72](https://github.com/torrentpier/torrentpier/pull/72) ([Exileum](https://github.com/Exileum))
- Fixed a getting value from config through method toArray [\#71](https://github.com/torrentpier/torrentpier/pull/71) ([VasyOk](https://github.com/VasyOk))
- \#69 Fixed crypt notice [\#70](https://github.com/torrentpier/torrentpier/pull/70) ([VasyOk](https://github.com/VasyOk))
- \#58 Expansion Zend Config [\#68](https://github.com/torrentpier/torrentpier/pull/68) ([VasyOk](https://github.com/VasyOk))
- change preset to prs2 [\#61](https://github.com/torrentpier/torrentpier/pull/61) ([VasyOk](https://github.com/VasyOk))
- Applied fixes from StyleCI [\#60](https://github.com/torrentpier/torrentpier/pull/60) ([Exileum](https://github.com/Exileum))
## [v2.1.5](https://github.com/torrentpier/torrentpier/tree/v2.1.5) (2015-05-23)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.4...v2.1.5)
**Merged pull requests:**
- Add a Gitter chat badge to README.md [\#47](https://github.com/torrentpier/torrentpier/pull/47) ([gitter-badger](https://github.com/gitter-badger))
- Фикс подтверждения пароля [\#43](https://github.com/torrentpier/torrentpier/pull/43) ([dreddred](https://github.com/dreddred))
- Fix port Ocelot [\#42](https://github.com/torrentpier/torrentpier/pull/42) ([Altairko](https://github.com/Altairko))
- Develop [\#40](https://github.com/torrentpier/torrentpier/pull/40) ([Exileum](https://github.com/Exileum))
## [v2.1.4](https://github.com/torrentpier/torrentpier/tree/v2.1.4) (2014-11-26)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.3...v2.1.4)
**Merged pull requests:**
- Develop [\#39](https://github.com/torrentpier/torrentpier/pull/39) ([Exileum](https://github.com/Exileum))
## [v2.1.3](https://github.com/torrentpier/torrentpier/tree/v2.1.3) (2014-10-24)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.2...v2.1.3)
**Merged pull requests:**
- Версия 2.1.3 ALPHA-3 [\#38](https://github.com/torrentpier/torrentpier/pull/38) ([Exileum](https://github.com/Exileum))
## [v2.1.2](https://github.com/torrentpier/torrentpier/tree/v2.1.2) (2014-10-20)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.1...v2.1.2)
**Merged pull requests:**
- Версия 2.1.2 ALPHA-2 [\#37](https://github.com/torrentpier/torrentpier/pull/37) ([Exileum](https://github.com/Exileum))
## [v2.1.1](https://github.com/torrentpier/torrentpier/tree/v2.1.1) (2014-09-11)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.1.0...v2.1.1)
**Merged pull requests:**
- Версия 2.1.1 ALPHA-1 [\#34](https://github.com/torrentpier/torrentpier/pull/34) ([Exileum](https://github.com/Exileum))
## [v2.1.0](https://github.com/torrentpier/torrentpier/tree/v2.1.0) (2014-09-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.599b...v2.1.0)
**Merged pull requests:**
- Версия 2.1 \(R600\) [\#32](https://github.com/torrentpier/torrentpier/pull/32) ([Exileum](https://github.com/Exileum))
## [v2.0.599b](https://github.com/torrentpier/torrentpier/tree/v2.0.599b) (2014-08-30)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.599...v2.0.599b)
**Merged pull requests:**
- Develop [\#31](https://github.com/torrentpier/torrentpier/pull/31) ([Exileum](https://github.com/Exileum))
- Feature/terms [\#30](https://github.com/torrentpier/torrentpier/pull/30) ([Exileum](https://github.com/Exileum))
## [v2.0.599](https://github.com/torrentpier/torrentpier/tree/v2.0.599) (2014-08-29)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.598...v2.0.599)
**Merged pull requests:**
- R599 [\#29](https://github.com/torrentpier/torrentpier/pull/29) ([Exileum](https://github.com/Exileum))
## [v2.0.598](https://github.com/torrentpier/torrentpier/tree/v2.0.598) (2014-08-27)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.597...v2.0.598)
**Merged pull requests:**
- R598 [\#28](https://github.com/torrentpier/torrentpier/pull/28) ([Exileum](https://github.com/Exileum))
## [v2.0.597](https://github.com/torrentpier/torrentpier/tree/v2.0.597) (2014-08-24)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.596...v2.0.597)
**Merged pull requests:**
- R597 [\#27](https://github.com/torrentpier/torrentpier/pull/27) ([Exileum](https://github.com/Exileum))
## [v2.0.596](https://github.com/torrentpier/torrentpier/tree/v2.0.596) (2014-08-20)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.595...v2.0.596)
**Merged pull requests:**
- Develop [\#26](https://github.com/torrentpier/torrentpier/pull/26) ([Exileum](https://github.com/Exileum))
## [v2.0.595](https://github.com/torrentpier/torrentpier/tree/v2.0.595) (2014-08-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.594b...v2.0.595)
**Merged pull requests:**
- Develop [\#22](https://github.com/torrentpier/torrentpier/pull/22) ([Exileum](https://github.com/Exileum))
## [v2.0.594b](https://github.com/torrentpier/torrentpier/tree/v2.0.594b) (2014-08-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.594...v2.0.594b)
**Merged pull requests:**
- Develop [\#17](https://github.com/torrentpier/torrentpier/pull/17) ([Exileum](https://github.com/Exileum))
- Hotfix/bbcode [\#16](https://github.com/torrentpier/torrentpier/pull/16) ([Exileum](https://github.com/Exileum))
## [v2.0.594](https://github.com/torrentpier/torrentpier/tree/v2.0.594) (2014-08-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.593b...v2.0.594)
**Merged pull requests:**
- Develop [\#15](https://github.com/torrentpier/torrentpier/pull/15) ([Exileum](https://github.com/Exileum))
## [v2.0.593b](https://github.com/torrentpier/torrentpier/tree/v2.0.593b) (2014-08-05)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.593...v2.0.593b)
## [v2.0.593](https://github.com/torrentpier/torrentpier/tree/v2.0.593) (2014-08-05)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.592...v2.0.593)
**Merged pull requests:**
- Develop [\#13](https://github.com/torrentpier/torrentpier/pull/13) ([Exileum](https://github.com/Exileum))
## [v2.0.592](https://github.com/torrentpier/torrentpier/tree/v2.0.592) (2014-08-01)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.591...v2.0.592)
## [v2.0.591](https://github.com/torrentpier/torrentpier/tree/v2.0.591) (2014-07-13)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.590...v2.0.591)
## [v2.0.590](https://github.com/torrentpier/torrentpier/tree/v2.0.590) (2014-06-21)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.589...v2.0.590)
## [v2.0.589](https://github.com/torrentpier/torrentpier/tree/v2.0.589) (2014-06-19)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.588...v2.0.589)
## [v2.0.588](https://github.com/torrentpier/torrentpier/tree/v2.0.588) (2014-06-17)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.587...v2.0.588)
## [v2.0.587](https://github.com/torrentpier/torrentpier/tree/v2.0.587) (2014-06-15)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.586...v2.0.587)
## [v2.0.586](https://github.com/torrentpier/torrentpier/tree/v2.0.586) (2014-06-13)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.585...v2.0.586)
## [v2.0.585](https://github.com/torrentpier/torrentpier/tree/v2.0.585) (2014-05-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.584...v2.0.585)
## [v2.0.584](https://github.com/torrentpier/torrentpier/tree/v2.0.584) (2014-03-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.583...v2.0.584)
## [v2.0.583](https://github.com/torrentpier/torrentpier/tree/v2.0.583) (2014-02-10)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.581...v2.0.583)
## [v2.0.581](https://github.com/torrentpier/torrentpier/tree/v2.0.581) (2014-02-03)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.572...v2.0.581)
## [v2.0.572](https://github.com/torrentpier/torrentpier/tree/v2.0.572) (2014-01-28)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.564...v2.0.572)
## [v2.0.564](https://github.com/torrentpier/torrentpier/tree/v2.0.564) (2014-01-20)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.560...v2.0.564)
## [v2.0.560](https://github.com/torrentpier/torrentpier/tree/v2.0.560) (2014-01-17)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.556...v2.0.560)
## [v2.0.556](https://github.com/torrentpier/torrentpier/tree/v2.0.556) (2014-01-12)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.552...v2.0.556)
## [v2.0.552](https://github.com/torrentpier/torrentpier/tree/v2.0.552) (2013-09-05)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.506...v2.0.552)
## [v2.0.506](https://github.com/torrentpier/torrentpier/tree/v2.0.506) (2013-06-23)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.500...v2.0.506)
## [v2.0.500](https://github.com/torrentpier/torrentpier/tree/v2.0.500) (2013-05-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.491...v2.0.500)
## [v2.0.491](https://github.com/torrentpier/torrentpier/tree/v2.0.491) (2013-01-12)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.477...v2.0.491)
## [v2.0.477](https://github.com/torrentpier/torrentpier/tree/v2.0.477) (2012-11-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.463...v2.0.477)
## [v2.0.463](https://github.com/torrentpier/torrentpier/tree/v2.0.463) (2012-10-16)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.456...v2.0.463)
## [v2.0.456](https://github.com/torrentpier/torrentpier/tree/v2.0.456) (2012-09-07)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.400...v2.0.456)
## [v2.0.400](https://github.com/torrentpier/torrentpier/tree/v2.0.400) (2012-04-13)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.300...v2.0.400)
## [v2.0.300](https://github.com/torrentpier/torrentpier/tree/v2.0.300) (2011-10-14)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.261...v2.0.300)
## [v2.0.261](https://github.com/torrentpier/torrentpier/tree/v2.0.261) (2011-08-28)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.0.0...v2.0.261)
## [v2.0.0](https://github.com/torrentpier/torrentpier/tree/v2.0.0) (2011-08-08)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

144
CLAUDE.md
View file

@ -1,144 +0,0 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
TorrentPier is a BitTorrent tracker engine written in PHP, designed for hosting BitTorrent communities with forum functionality. The project is in active modernization, transitioning from legacy code to modern PHP practices while maintaining backward compatibility.
## Technology Stack & Architecture
- **PHP 8.2+** with modern features
- **MySQL/MariaDB/Percona** database
- **Nette Database** with backward-compatible wrapper
- **Composer** for dependency management
- **Custom BitTorrent tracker** implementation
## Key Directory Structure
- `/src/` - Modern PHP classes (PSR-4 autoloaded as `TorrentPier\`)
- `/library/` - Core application logic and legacy code
- `/admin/` - Administrative interface
- `/bt/` - BitTorrent tracker functionality (announce.php, scrape.php)
- `/styles/` - Templates, CSS, JS, images
- `/internal_data/` - Cache, logs, compiled templates
- `/install/` - Installation scripts and configuration examples
- `/migrations/` - Database migration files (Phinx)
## Entry Points & Key Files
- `index.php` - Main forum homepage
- `tracker.php` - Torrent search/browse interface
- `bt/announce.php` - BitTorrent announce endpoint
- `bt/scrape.php` - BitTorrent scrape endpoint
- `admin/index.php` - Administrative panel
- `cron.php` - Background task runner (CLI only)
- `install.php` - Installation script (CLI only)
## Development Commands
### Installation & Setup
```bash
# Automated installation (CLI)
php install.php
# Install dependencies
composer install
# Update dependencies
composer update
```
### Maintenance & Operations
```bash
# Run background maintenance tasks
php cron.php
```
### Code Quality
The project uses **StyleCI** with PSR-2 preset for code style enforcement. StyleCI configuration is in `.styleci.yml` targeting `src/` directory.
## Modern Architecture Components
### Database Layer (`/src/Database/`)
- **Nette Database** with full old SqlDb backward compatibility
- Singleton pattern accessible via `DB()` function
- Support for multiple database connections and debug functionality
- Migration path to ORM-style Explorer queries
### Cache System (`/src/Cache/`)
- **Unified caching** using Nette Caching internally
- 100% backward compatibility with existing `CACHE()` and $datastore calls
- Supports file, SQLite, memory, and Memcached storage
- Advanced features: memoization, cache dependencies
### Configuration Management
- Environment-based config with `.env` files
- Singleton `Config` class accessible via `config()` function
- Local overrides supported via `library/config.local.php`
## Configuration Files
- `.env` - Environment variables (copy from `.env.example`)
- `library/config.php` - Main application configuration
- `library/config.local.php` - Local configuration overrides
- `composer.json` - Dependencies and PSR-4 autoloading
## Development Workflow
### CI/CD Pipeline
- **GitHub Actions** for automated testing and deployment
- **StyleCI** for code style enforcement
- **Dependabot** for dependency updates
- **FTP deployment** to demo environment
### Installation Methods
1. **Automated**: `php install.php` (recommended)
2. **Composer**: `composer create-project torrentpier/torrentpier`
3. **Manual**: Git clone + `composer install` + database setup
## Database & Schema
- **Database migrations** managed via Phinx in `/migrations/` directory
- Initial schema: `20250619000001_initial_schema.php`
- Initial seed data: `20250619000002_seed_initial_data.php`
- UTF-8 (utf8mb4) character set required
- Multiple database alias support for different components
### Migration Commands
```bash
# Run all pending migrations
php vendor/bin/phinx migrate --configuration=phinx.php
# Check migration status
php vendor/bin/phinx status --configuration=phinx.php
# Mark migrations as applied (for existing installations)
php vendor/bin/phinx migrate --fake --configuration=phinx.php
```
## Legacy Compatibility Strategy
The codebase maintains 100% backward compatibility while introducing modern alternatives:
- **Database layer**: Existing old SqlDb calls work while new code can use Nette Database
- **Cache system**: All existing `CACHE()` and $datastore calls preserved while adding modern features
- **Configuration**: Legacy config access maintained alongside new singleton pattern
This approach allows gradual modernization without breaking existing functionality - critical for a mature application with existing deployments.
## Security & Performance
- **Environment-based secrets** management via `.env`
- **CDN/proxy support** (Cloudflare, Fastly)
- **Input sanitization** and CSRF protection
- **Advanced caching** with multiple storage backends
- **Rate limiting** and IP-based restrictions
## BitTorrent Tracker Features
- **BitTorrent v1 & v2** support
- **TorrServer integration** capability
- **Client ban system** for problematic torrent clients
- **Scrape support** for tracker statistics
When working with this codebase, prioritize understanding the legacy compatibility approach and modern architecture patterns. Always test both legacy and modern code paths when making changes to core systems.

View file

@ -41,7 +41,7 @@ include:
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or * The use of sexualized language or imagery and unwelcome sexual attention or
advances advances
* Trolling, insulting/derogatory comments, and personal or political attacks * Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment * Public or private harassment
* Publishing others' private information, such as a physical or electronic * Publishing others' private information, such as a physical or electronic
@ -89,5 +89,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at [http://contributor-covenant.org/version/1/4][version] available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org [homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/ [version]: http://contributor-covenant.org/version/1/4/

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2005-2025 TorrentPier Copyright (c) 2005-2023 TorrentPier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

190
README.md
View file

@ -2,159 +2,99 @@
<p align="center"> <p align="center">
Bull-powered BitTorrent tracker engine Bull-powered BitTorrent tracker engine
<br/> <br>
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/torrentpier/torrentpier/blob/master/LICENSE"><img src="https://img.shields.io/github/license/torrentpier/torrentpier" alt="License"></a> <a href="https://github.com/torrentpier/torrentpier/blob/master/LICENSE"><img src="https://img.shields.io/github/license/torrentpier/torrentpier" alt="License"></a>
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/stars/torrentpier/torrentpier" alt="Stars Packagist"></a> <a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/stars/torrentpier/torrentpier" alt="Stars Packagist"></a>
<a href="https://github.com/torrentpier/torrentpier/actions"><img src="https://img.shields.io/github/actions/workflow/status/torrentpier/torrentpier/phpmd.yml" alt="Build status"></a>
<a href="https://crowdin.com/project/torrentpier"><img src="https://badges.crowdin.net/torrentpier/localized.svg" alt="Crowdin"></a> <a href="https://crowdin.com/project/torrentpier"><img src="https://badges.crowdin.net/torrentpier/localized.svg" alt="Crowdin"></a>
<a href="https://nightly.link/torrentpier/torrentpier/workflows/ci/master/TorrentPier-master"><img src="https://img.shields.io/badge/Nightly%20release-gray?logo=hackthebox&logoColor=fff" alt="TorrentPier nightly"></a>
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/dt/torrentpier/torrentpier" alt="Downloads"></a> <a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/dt/torrentpier/torrentpier" alt="Downloads"></a>
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/v/torrentpier/torrentpier" alt="Version"></a> <a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/v/torrentpier/torrentpier" alt="Version"></a>
<a href="https://github.com/torrentpier/torrentpier/releases"><img src="https://img.shields.io/github/release-date/torrentpier/torrentpier" alt="Last release"></a> <a href="https://github.com/torrentpier/torrentpier/releases"><img src="https://img.shields.io/github/release-date/torrentpier/torrentpier" alt="Last release"></a>
<img src="https://img.shields.io/github/repo-size/torrentpier/torrentpier" alt="Size"> <img src="https://img.shields.io/github/repo-size/torrentpier/torrentpier" alt="Size">
<a href="https://github.com/SamKirkland/FTP-Deploy-Action"><img src="https://img.shields.io/badge/Deployed to TorrentPier Demo with-FTP DEPLOY ACTION-%3CCOLOR%3E?color=2b9348" alt="Deployed to TorrentPier Demo with FTP Deploy Action"></a>
</p> </p>
## 🐂 About TorrentPier ## 🐂 About TorrentPier
TorrentPier — bull-powered BitTorrent Public/Private tracker engine, written in PHP. High speed, simple modifications, load-balanced TorrentPier — bull-powered BitTorrent tracker engine, written in php. High speed, simple modification, high load
architecture. In addition, we have a very helpful architecture, built-in support for alternative compiled announcers (Ocelot, XBT). In addition, we have very helpful
[official support forum](https://torrentpier.com), where it's possible to get support and download modifications for the engine. [official support forum](https://torrentpier.com), where among other things it is possible to test the live
demo, get any support and download modifications for engine.
## 🌈 Current status ## 🌈 Current status
TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite the existing code to TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite existing to
modern specifications. If you want to delve deep into the code, check our [issues](https://github.com/torrentpier/torrentpier/issues) modern standards. If you want to go deep on the code, check our [issues](https://github.com/torrentpier/torrentpier/issues)
and go from there. The documentation will be translated to English in the near future, currently Russian is the main language. and go from there. The documentation will be translated into english in the near future, currently russian is the main language of it.
## ✨ Features
* Rich forum with browsing/moderation tools
* High-load capable, heavily configurable announcer
* Scrape support
* FreeLeech
* [TorrServer integration](https://github.com/YouROK/TorrServer) support
* BitTorrent v2 support
* Event-based invite system
* Bonus points
* Polling system
* PM/DM system
* Multilingual support (Russian and English are currently fully supported, with others in the future)
* Atom/RSS feeds
* ... and so MUCH MORE!
## 🖥️ Demo
* URL: https://torrentpier.duckdns.org
* Username: `admin`
* Password: `admin`
> [!NOTE]
> Demo resets every 24 hours!
## 🔧 Requirements ## 🔧 Requirements
* Apache / nginx ([example config](install/nginx.conf)) / caddy ([example config](install/Caddyfile)) * Apache / nginx
* MySQL 5.5.3 or above (including MySQL 8.0+) / MariaDB 10.0 or above / Percona * MySQL 5.5.3 or above / MariaDB 10.0 or above / Percona
* PHP: 8.2 / 8.3 / 8.4 * PHP: 8.1 / 8.2
* PHP Extensions: mbstring, gd, bcmath, intl, tidy (optional), xml, xmlwriter * PHP Extensions: mbstring, bcmath, intl, tidy (optional), xml, xmlwriter
* Crontab (Recommended)
## 💾 Installation ## 💾 Installation
For the installation, select one of the installation variants below: For installation, you need to follow a few simple steps:
### Quick (Clean install) 🚀
Check out our [autoinstall](https://github.com/torrentpier/autoinstall) repository with detailed instructions.
> [!NOTE]
> Thanks to [Sergei Solovev](https://github.com/SeAnSolovev) for this installation script ❤️
### Quick (For web-panels) ☕️
1. Select the folder where you want TorrentPier installed
```shell
cd /path/to/public_html
```
2. Download the latest version of TorrentPier
```shell
sudo git clone https://github.com/torrentpier/torrentpier.git .
```
3. After completing, execute the command below and follow the instructions
```shell
php install.php
```
4. Voila! ✨
### Manual 🔩
1. Install [Composer](https://getcomposer.org/) 1. Install [Composer](https://getcomposer.org/)
2. Run the following command to create the TorrentPier project 2. Run `composer create-project torrentpier/torrentpier`
```shell 3. After run `composer install` on the project directory
composer create-project torrentpier/torrentpier 4. Create database and import dump located at **install/sql/mysql.sql**
``` 5. Edit database configuration settings in the configuration file or a local copy (see below)
3. [Check our system requirements](#-requirements) 6. Edit domain name in the configuration file or a local copy (see below)
4. After, run this command in the project directory to install Composer dependencies 7. Edit domain ssl setting in the configuration file or a local copy (see below)
```shell 8. Edit this files:
composer install 1. **favicon.png** (change on your own)
``` 2. **robots.txt** (change the addresses in lines **Host** and **Sitemap** on your own)
5. Edit database configuration settings in the environment (`.env.example`), after, rename to `.env` 3. **opensearch_desc.xml** (change the description and address on your own)
6. Create a database and run migrations to set up the schema 4. **opensearch_desc_bt.xml** (change the description and address on your own)
```shell 9. Log in to the forum with admin/admin login/password and finish setting up via admin panel
php vendor/bin/phinx migrate --configuration=phinx.php
```
7. Provide write permissions to the specified folders:
* `data/avatars`, `data/uploads`, `data/uploads/thumbs`
* `internal_data/atom`, `internal_data/cache`, `internal_data/log`, `internal_data/triggers`
* `sitemap`
8. Voila! ✨
> [!TIP] ## 🔑 Access rights on folders and files
> You can automate steps 4-7 by running `php install.php` instead, which will guide you through the setup process interactively.
> [!IMPORTANT] You must provide write permissions to the specified folders:
> The specific settings depend on the server you are using, but in general we recommend chmod **0755** for folders, and chmod **0644** for the files in them. * `data/avatars`
* `data/torrent_files`
* `data/torrent_files/thumbs`
* `internal_data/atom`
* `internal_data/cache`
* `internal_data/log`
* `internal_data/triggers`
* `sitemap`
### Additional steps 👣 The specific settings depend on the server you are using, but in general case we recommend chmod 0755 for folders,
and chmod 0644 for files in them. If you are not sure, leave it as is.
1. Edit these files:
* `favicon.png` (change to your own)
* `robots.txt` (change the addresses in lines `Host` and `Sitemap` to your own)
2. Log in to the forum using the **admin/admin** login/password, and finish setting up via admin panel. Don't forget to change your password!
## 🔐 Security vulnerabilities
If you discover a security vulnerability within TorrentPier, please follow our [security policy](https://github.com/torrentpier/torrentpier/security/policy), so we can address it promptly.
## 🧪 Testing
TorrentPier includes a comprehensive testing suite built with **Pest PHP**. Run tests to ensure code quality and system reliability:
```shell
# Run all tests
./vendor/bin/pest
# Run with coverage
./vendor/bin/pest --coverage
```
For detailed testing documentation, see [tests/README.md](tests/README.md).
## 📌 Our recommendations ## 📌 Our recommendations
* *It's recommended to run `cron.php`.* - For significant tracker speed increase it may be required to replace the built-in cron.php with an operating system daemon. * *The recommended way to run cron.php.* - For significant tracker speed increase may be required to replace built-in cron.php by operating system daemon. For more
* *Local configuration copy.* - You can override the settings using the local configuration file `library/config.local.php`. information about that you can read [this thread](https://torrentpier.com/threads/52/) on our support forum.
* *Local configuration copy.* - You can override the settings using one of these methods: configuration file **library/config.local.php** and the environment
file **.env**. Both files are created by copying the appropriate .example templates without extension. Local configuration files
should not be available for reading to anyone by setting up access rights for your web server.
* *Ocelot installation.* - We have built-in support for alternate compiled announcer — Ocelot. The configuration is in the file **library/config.php**,
the announcer is in the repository [torrentpier/ocelot](https://github.com/torrentpier/ocelot). You can read assembly instructions
on his repository or in [this thread](https://torrentpier.com/threads/26078/) on our support forum.
* *[TMRR — Torrent Merkle Root Reader.](https://github.com/kovalensky/tmrr)* - A tool for extracting, comparing and calculating file hashes for .torrent files,
compatible with the BitTorrent v2 protocol. Useful for finding the sources of the same copies of files on different trackers & DHT indexers that support BitTorrent v2 protocol,
thus reviving dead torrents, valuable Internet artifacts.
## 📝 Official documentation
Documentation for TorrentPier can be found on the [TorrentPier docs website](https://docs.torrentpier.com).
## 💚 Contributing / Contributors ## 💚 Contributing / Contributors
Please read our [contributing policy](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) for details, and the process for Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for
submitting pull requests to us. But we are always ready to review your pull-request for compliance with submitting pull requests to us. But we are always ready to renew your pull-request for compliance with
these requirements. Just send it! these requirements. Just send it.
<a href="https://github.com/torrentpier/torrentpier/graphs/contributors"> <a href="https://github.com/torrentpier/torrentpier/graphs/contributors">
<img src="https://contrib.rocks/image?repo=torrentpier/torrentpier" alt="Contributors"/> <img src="https://contrib.rocks/image?repo=torrentpier/torrentpier" />
</a> </a>
Made with [contrib.rocks](https://contrib.rocks). Made with [contrib.rocks](https://contrib.rocks).
@ -166,22 +106,6 @@ Support this project by becoming a sponsor or a backer.
[![OpenCollective sponsors](https://opencollective.com/torrentpier/sponsors/badge.svg)](https://opencollective.com/torrentpier) [![OpenCollective sponsors](https://opencollective.com/torrentpier/sponsors/badge.svg)](https://opencollective.com/torrentpier)
[![OpenCollective backers](https://opencollective.com/torrentpier/backers/badge.svg)](https://opencollective.com/torrentpier) [![OpenCollective backers](https://opencollective.com/torrentpier/backers/badge.svg)](https://opencollective.com/torrentpier)
<details>
<summary>Monero</summary>
```
42zJE3FDvN8foP9QYgDrBjgtd7h2FipGCGmAcmG5VFQuRkJBGMbCvoLSmivepmAMEgik2E8MPWUzKaoYsGCtmhvL7ZN73jh
```
</details>
<details>
<summary>YooMoney</summary>
```
4100118022415720
```
</details>
## 📦 Versioning ## 📦 Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/torrentpier/torrentpier/tags). We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/torrentpier/torrentpier/tags).

View file

@ -1,13 +0,0 @@
# Security Policy
## Versions
Due to the nature of our project - being open source - we have decided to patch only the latest major release (currently v2.4.x) for security vulnerabilities.
## How to disclose
Please disclose security issues by mailing [admin@torrentpier.com](mailto:admin@torrentpier.com).
## What we do
Any submitted security issue will be checked thoroughly by our development team. A fix for the issue and a transparent information on GitHub about the issue existing will be released. You can view any previously identified issues on our [GitHub Security Page](https://github.com/torrentpier/torrentpier/security/advisories). New major versions of TorrentPier will also receive a security audit to verify our efforts on providing a secure application.

File diff suppressed because it is too large Load diff

View file

@ -1,57 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!defined('BB_ROOT')) {
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('BB_PATH', BB_ROOT);
}
// Check CLI mode
if (PHP_SAPI != 'cli') {
exit;
}
if (!function_exists('removeFile')) {
// Get all constants
require_once BB_ROOT . 'library/defines.php';
// Include CLI functions
require INC_DIR . '/functions_cli.php';
}
$items = [
'.github',
'.cliffignore',
'.editorconfig',
'.gitignore',
'.styleci.yml',
'_release.php',
'CHANGELOG.md',
'CLAUDE.md',
'cliff.toml',
'CODE_OF_CONDUCT.md',
'CONTRIBUTING.md',
'crowdin.yml',
'HISTORY.md',
'phpunit.xml',
'README.md',
'SECURITY.md',
'tests',
'UPGRADE_GUIDE.md'
];
foreach ($items as $item) {
$path = BB_ROOT . $item;
if (is_file($path)) {
removeFile($path);
} elseif (is_dir($path)) {
removeDir($path);
}
}

View file

@ -1,130 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('BB_PATH', BB_ROOT);
// Check CLI mode
if (PHP_SAPI != 'cli') {
die('Please run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">php ' . basename(__FILE__) . '</code> in CLI mode');
}
// Get all constants
require_once BB_ROOT . 'library/defines.php';
// Include CLI functions
require INC_DIR . '/functions_cli.php';
// Welcoming message
out("--- Release creation tool ---\n", 'info');
$configFile = BB_PATH . '/library/config.php';
if (!is_file($configFile)) {
out('- Config file ' . basename($configFile) . ' not found', 'error');
exit;
}
if (!is_readable($configFile)) {
out('- Config file ' . basename($configFile) . ' is not readable', 'error');
exit;
}
if (!is_writable($configFile)) {
out('- Config file ' . basename($configFile) . ' is not writable', 'error');
exit;
}
// Ask for version
fwrite(STDOUT, 'Enter version number (e.g, v2.4.0): ');
$version = trim(fgets(STDIN));
if (empty($version)) {
out("- Version cannot be empty. Please enter a valid version number", 'error');
exit;
} else {
// Add 'v' prefix if missing
if (!str_starts_with($version, 'v')) {
$version = 'v' . $version;
}
out("- Using version: $version", 'info');
}
// Ask for version emoji
fwrite(STDOUT, 'Enter version emoji: ');
$versionEmoji = trim(fgets(STDIN));
if (!empty($versionEmoji)) {
out("- Using version emoji: $versionEmoji", 'info');
}
// Ask for release date or use today's date
fwrite(STDOUT, "Enter release date (e.g. 25-05-2025), leave empty to use today's date: ");
$date = trim(fgets(STDIN));
if (empty($date)) {
$date = date('d-m-Y');
out("- Using current date: $date", 'info');
} else {
// Validate date format (dd-mm-yyyy)
$dateObj = DateTime::createFromFormat('d-m-Y', $date);
if (!$dateObj || $dateObj->format('d-m-Y') !== $date) {
out("- Invalid date format. Expected format: DD-MM-YYYY", 'error');
exit;
}
out("- Using date: $date", 'info');
}
// Read config file content
$content = file_get_contents($configFile);
// Update version
$content = preg_replace(
"/\\\$bb_cfg\['tp_version'\]\s*=\s*'[^']*';/",
"\$bb_cfg['tp_version'] = '$version';",
$content
);
// Update release date
$content = preg_replace(
"/\\\$bb_cfg\['tp_release_date'\]\s*=\s*'[^']*';/",
"\$bb_cfg['tp_release_date'] = '$date';",
$content
);
// Save updated config
$bytesWritten = file_put_contents($configFile, $content);
if ($bytesWritten === false) {
out("- Failed to write to config file", 'error');
exit;
}
if ($bytesWritten === 0) {
out("- Config file was not updated (0 bytes written)", 'error');
exit;
}
out("\n- Config file has been updated!", 'success');
// Update CHANGELOG.md
runProcess('npx git-cliff v2.4.6-alpha.4.. --config cliff.toml --tag "' . $version . '" > CHANGELOG.md');
// Git add & commit
runProcess('git add -A && git commit -m "release: ' . escapeshellarg($version) . (!empty($versionEmoji) ? (' ' . $versionEmoji) : '') . '"');
// Git tag
runProcess("git tag -a \"$version\" -m \"Release $version\"");
runProcess("git tag -v \"$version\"");
// Git push
runProcess("git push origin master");
runProcess("git push origin $version");
out("\n- Release $version has been successfully prepared, committed and pushed!", 'success');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -69,44 +69,44 @@ $order_by = '';
if ($view === 'username') { if ($view === 'username') {
switch ($mode) { switch ($mode) {
case 'username': case 'username':
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'attachments': case 'attachments':
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'filesize': case 'filesize':
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
default: default:
$mode = 'attachments'; $mode = 'attachments';
$sort_order = 'DESC'; $sort_order = 'DESC';
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
} }
} elseif ($view === 'attachments') { } elseif ($view === 'attachments') {
switch ($mode) { switch ($mode) {
case 'real_filename': case 'real_filename':
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'comment': case 'comment':
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'extension': case 'extension':
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'filesize': case 'filesize':
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'downloads': case 'downloads':
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
case 'post_time': case 'post_time':
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
default: default:
$mode = 'a.real_filename'; $mode = 'a.real_filename';
$sort_order = 'ASC'; $sort_order = 'ASC';
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page'); $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
break; break;
} }
} }
@ -201,7 +201,7 @@ if ($submit_change && $view === 'attachments') {
if (isset($attachments['_' . $attachrow['attach_id']])) { if (isset($attachments['_' . $attachrow['attach_id']])) {
if ($attachrow['comment'] != $attachments['_' . $attachrow['attach_id']]['comment'] || $attachrow['download_count'] != $attachments['_' . $attachrow['attach_id']]['download_count']) { if ($attachrow['comment'] != $attachments['_' . $attachrow['attach_id']]['comment'] || $attachrow['download_count'] != $attachments['_' . $attachrow['attach_id']]['download_count']) {
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . " $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . "
SET comment = '" . DB()->escape($attachments['_' . $attachrow['attach_id']]['comment']) . "', download_count = " . (int)$attachments['_' . $attachrow['attach_id']]['download_count'] . ' SET comment = '" . attach_mod_sql_escape($attachments['_' . $attachrow['attach_id']]['comment']) . "', download_count = " . (int)$attachments['_' . $attachrow['attach_id']]['download_count'] . '
WHERE attach_id = ' . (int)$attachrow['attach_id']; WHERE attach_id = ' . (int)$attachrow['attach_id'];
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -422,7 +422,11 @@ if ($view === 'attachments') {
$row = DB()->sql_fetchrow($result); $row = DB()->sql_fetchrow($result);
DB()->sql_freeresult($result); DB()->sql_freeresult($result);
$post_title = str_short($row['topic_title'], 30); $post_title = $row['topic_title'];
if (strlen($post_title) > 32) {
$post_title = str_short($post_title, 30);
}
$view_topic = BB_ROOT . POST_URL . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id']; $view_topic = BB_ROOT . POST_URL . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id'];
@ -437,7 +441,7 @@ if ($view === 'attachments') {
$hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />'; $hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
$template->assign_block_vars('attachrow', [ $template->assign_block_vars('attachrow', [
'ROW_NUMBER' => $i + (@$_GET['start'] + 1), 'ROW_NUMBER' => $i + ($_GET['start'] + 1),
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']), 'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']),
@ -470,8 +474,8 @@ if ($view === 'attachments') {
} }
// Generate Pagination // Generate Pagination
if ($do_pagination && $total_rows > config()->get('topics_per_page')) { if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
generate_pagination('admin_attach_cp.php?view=' . $view . '&amp;mode=' . $mode . '&amp;order=' . $sort_order . '&amp;uid=' . $uid, $total_rows, config()->get('topics_per_page'), $start); generate_pagination('admin_attach_cp.php?view=' . $view . '&amp;mode=' . $mode . '&amp;order=' . $sort_order . '&amp;uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start);
} }
print_page('admin_attach_cp.tpl', 'admin'); print_page('admin_attach_cp.tpl', 'admin');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -37,6 +37,7 @@ $pm_size = request_var('pm_size', '');
$submit = isset($_POST['submit']); $submit = isset($_POST['submit']);
$check_upload = isset($_POST['settings']); $check_upload = isset($_POST['settings']);
$check_image_cat = isset($_POST['cat_settings']); $check_image_cat = isset($_POST['cat_settings']);
$search_imagick = isset($_POST['search_imagick']);
// Re-evaluate the Attachment Configuration // Re-evaluate the Attachment Configuration
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG; $sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
@ -103,12 +104,12 @@ while ($row = DB()->sql_fetchrow($result)) {
} }
$sql = 'UPDATE ' . BB_ATTACH_CONFIG . " $sql = 'UPDATE ' . BB_ATTACH_CONFIG . "
SET config_value = '" . DB()->escape($new_attach[$config_name]) . "' SET config_value = '" . attach_mod_sql_escape($new_attach[$config_name]) . "'
WHERE config_name = '" . DB()->escape($config_name) . "'"; WHERE config_name = '" . attach_mod_sql_escape($config_name) . "'";
} else { } else {
$sql = 'UPDATE ' . BB_ATTACH_CONFIG . " $sql = 'UPDATE ' . BB_ATTACH_CONFIG . "
SET config_value = '" . DB()->escape($new_attach[$config_name]) . "' SET config_value = '" . attach_mod_sql_escape($new_attach[$config_name]) . "'
WHERE config_name = '" . DB()->escape($config_name) . "'"; WHERE config_name = '" . attach_mod_sql_escape($config_name) . "'";
} }
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -129,6 +130,44 @@ $select_size_mode = size_select('size', $size);
$select_quota_size_mode = size_select('quota_size', $quota_size); $select_quota_size_mode = size_select('quota_size', $quota_size);
$select_pm_size_mode = size_select('pm_size', $pm_size); $select_pm_size_mode = size_select('pm_size', $pm_size);
// Search Imagick
if ($search_imagick) {
$imagick = '';
if (false !== stripos($imagick, "convert")) {
return true;
}
if ($imagick != 'none') {
if (!false !== stripos(PHP_OS, "WIN")) {
$retval = @exec('whereis convert');
$paths = explode(' ', $retval);
if (is_array($paths)) {
foreach ($paths as $i => $iValue) {
$path = basename($paths[$i]);
if ($path == 'convert') {
$imagick = $iValue;
}
}
}
} elseif (false !== stripos(PHP_OS, "WIN")) {
$path = 'c:/imagemagick/convert.exe';
if (file_exists(amod_realpath($path))) {
$imagick = $path;
}
}
}
if (file_exists(amod_realpath(trim($imagick)))) {
$new_attach['img_imagick'] = trim($imagick);
} else {
$new_attach['img_imagick'] = '';
}
}
// Check Settings // Check Settings
if ($check_upload) { if ($check_upload) {
// Some tests... // Some tests...
@ -157,7 +196,7 @@ if ($check_upload) {
$error = false; $error = false;
// Does the target directory exist, is it a directory and writeable // Does the target directory exist, is it a directory and writeable
if (!@file_exists(realpath($upload_dir))) { if (!@file_exists(amod_realpath($upload_dir))) {
$error = true; $error = true;
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $attach_config['upload_dir']) . '<br />'; $error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $attach_config['upload_dir']) . '<br />';
} }
@ -248,8 +287,11 @@ if ($mode == 'cats') {
$create_thumbnail_yes = ($new_attach['img_create_thumbnail'] != '0') ? 'checked' : ''; $create_thumbnail_yes = ($new_attach['img_create_thumbnail'] != '0') ? 'checked' : '';
$create_thumbnail_no = ($new_attach['img_create_thumbnail'] == '0') ? 'checked' : ''; $create_thumbnail_no = ($new_attach['img_create_thumbnail'] == '0') ? 'checked' : '';
$use_gd2_yes = ($new_attach['use_gd2'] != '0') ? 'checked' : '';
$use_gd2_no = ($new_attach['use_gd2'] == '0') ? 'checked' : '';
// Check Thumbnail Support // Check Thumbnail Support
if (!extension_loaded('gd')) { if (!is_imagick() && !extension_loaded('gd')) {
$new_attach['img_create_thumbnail'] = '0'; $new_attach['img_create_thumbnail'] = '0';
} else { } else {
$template->assign_block_vars('switch_thumbnail_support', []); $template->assign_block_vars('switch_thumbnail_support', []);
@ -262,10 +304,13 @@ if ($mode == 'cats') {
'IMAGE_LINK_HEIGHT' => $new_attach['img_link_height'], 'IMAGE_LINK_HEIGHT' => $new_attach['img_link_height'],
'IMAGE_LINK_WIDTH' => $new_attach['img_link_width'], 'IMAGE_LINK_WIDTH' => $new_attach['img_link_width'],
'IMAGE_MIN_THUMB_FILESIZE' => $new_attach['img_min_thumb_filesize'], 'IMAGE_MIN_THUMB_FILESIZE' => $new_attach['img_min_thumb_filesize'],
'IMAGE_IMAGICK_PATH' => $new_attach['img_imagick'],
'DISPLAY_INLINED_YES' => $display_inlined_yes, 'DISPLAY_INLINED_YES' => $display_inlined_yes,
'DISPLAY_INLINED_NO' => $display_inlined_no, 'DISPLAY_INLINED_NO' => $display_inlined_no,
'CREATE_THUMBNAIL_YES' => $create_thumbnail_yes, 'CREATE_THUMBNAIL_YES' => $create_thumbnail_yes,
'CREATE_THUMBNAIL_NO' => $create_thumbnail_no, 'CREATE_THUMBNAIL_NO' => $create_thumbnail_no,
'USE_GD2_YES' => $use_gd2_yes,
'USE_GD2_NO' => $use_gd2_no,
'S_ASSIGNED_GROUP_IMAGES' => implode(', ', $s_assigned_group_images), 'S_ASSIGNED_GROUP_IMAGES' => implode(', ', $s_assigned_group_images),
'S_ATTACH_ACTION' => 'admin_attachments.php?mode=cats', 'S_ATTACH_ACTION' => 'admin_attachments.php?mode=cats',
)); ));
@ -301,12 +346,12 @@ if ($check_image_cat) {
$error = false; $error = false;
// Does the target directory exist, is it a directory and writeable // Does the target directory exist, is it a directory and writeable
if (!@file_exists(realpath($upload_dir))) { if (!@file_exists(amod_realpath($upload_dir))) {
if (!bb_mkdir($upload_dir) && !is_dir($upload_dir)) { if (!bb_mkdir($upload_dir) && !is_dir($upload_dir)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir)); throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
} }
if (!@file_exists(realpath($upload_dir))) { if (!@file_exists(amod_realpath($upload_dir))) {
$error = true; $error = true;
$error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />'; $error_msg = sprintf($lang['DIRECTORY_DOES_NOT_EXIST'], $upload_dir) . '<br />';
} }
@ -346,7 +391,7 @@ if ($submit && $mode == 'quota') {
$filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]); $filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]);
$sql = 'UPDATE ' . BB_QUOTA_LIMITS . " $sql = 'UPDATE ' . BB_QUOTA_LIMITS . "
SET quota_desc = '" . DB()->escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . ' SET quota_desc = '" . attach_mod_sql_escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . '
WHERE quota_limit_id = ' . (int)$quota_change_list[$i]; WHERE quota_limit_id = ' . (int)$quota_change_list[$i];
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -408,7 +453,7 @@ if ($submit && $mode == 'quota') {
$filesize = ($size_select == 'kb') ? round($filesize * 1024) : (($size_select == 'mb') ? round($filesize * 1048576) : $filesize); $filesize = ($size_select == 'kb') ? round($filesize * 1024) : (($size_select == 'mb') ? round($filesize * 1048576) : $filesize);
$sql = 'INSERT INTO ' . BB_QUOTA_LIMITS . " (quota_desc, quota_limit) $sql = 'INSERT INTO ' . BB_QUOTA_LIMITS . " (quota_desc, quota_limit)
VALUES ('" . DB()->escape($quota_desc) . "', " . (int)$filesize . ')'; VALUES ('" . attach_mod_sql_escape($quota_desc) . "', " . (int)$filesize . ')';
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
bb_die('Could not add quota limit'); bb_die('Could not add quota limit');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -61,7 +61,6 @@ switch ($mode) {
'CONFIG_MODS' => true, 'CONFIG_MODS' => true,
'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'], 'MAGNET_LINKS_ENABLED' => $new['magnet_links_enabled'],
'MAGNET_LINKS_FOR_GUESTS' => $new['magnet_links_for_guests'],
'GENDER' => $new['gender'], 'GENDER' => $new['gender'],
'CALLSEED' => $new['callseed'], 'CALLSEED' => $new['callseed'],
'TOR_STATS' => $new['tor_stats'], 'TOR_STATS' => $new['tor_stats'],
@ -136,8 +135,8 @@ switch ($mode) {
'POSTS_PER_PAGE' => $new['posts_per_page'], 'POSTS_PER_PAGE' => $new['posts_per_page'],
'HOT_TOPIC' => $new['hot_threshold'], 'HOT_TOPIC' => $new['hot_threshold'],
'DEFAULT_DATEFORMAT' => $new['default_dateformat'], 'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
'LANG_SELECT' => \TorrentPier\Legacy\Common\Select::language($new['default_lang'], 'default_lang'), 'LANG_SELECT' => \TorrentPier\Legacy\Select::language($new['default_lang'], 'default_lang'),
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Common\Select::timezone($new['board_timezone'], 'board_timezone'), 'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'], 'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'], 'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => (bool)$new['prune_enable'], 'PRUNE_ENABLE' => (bool)$new['prune_enable'],

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -26,7 +26,7 @@ $cfg = [];
* All config names with default values * All config names with default values
*/ */
$default_cfg_str = array( $default_cfg_str = array(
'bt_announce_url' => 'https://torrentpier.duckdns.org/bt/', 'bt_announce_url' => 'http://demo.torrentpier.com/bt/',
); );
$default_cfg_bool = array( $default_cfg_bool = array(

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -29,11 +29,6 @@ if ($mode == 'run' && !$job_id) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
} }
// Check for demo mode
if (IN_DEMO_MODE && ($submit || !in_array($mode, ['add', 'list']))) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
if (!IS_SUPER_ADMIN) { if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']); bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
} }
@ -84,7 +79,7 @@ switch ($mode) {
)); ));
//detect cron status //detect cron status
if (is_file(CRON_RUNNING)) { if (file_exists(CRON_RUNNING)) {
$template->assign_vars(array( $template->assign_vars(array(
'CRON_RUNNING' => true, 'CRON_RUNNING' => true,
)); ));
@ -92,7 +87,7 @@ switch ($mode) {
break; break;
case 'repair': case 'repair':
if (is_file(CRON_RUNNING)) { if (file_exists(CRON_RUNNING)) {
rename(CRON_RUNNING, CRON_ALLOWED); rename(CRON_RUNNING, CRON_ALLOWED);
} }
redirect('admin/' . basename(__FILE__) . '?mode=list'); redirect('admin/' . basename(__FILE__) . '?mode=list');
@ -164,7 +159,7 @@ switch ($mode) {
'S_MODE' => 'add', 'S_MODE' => 'add',
'SCHEDULE' => build_select('schedule', $schedule, 'select', null, null), 'SCHEDULE' => build_select('schedule', $schedule, 'select', null, null),
'RUN_DAY' => build_select('run_day', $run_day, 0, null, null), 'RUN_DAY' => build_select('run_day', $run_day, 0, null, null),
'CRON_ID' => '', 'CRON_ID' => 'none',
'CRON_ACTIVE' => 1, 'CRON_ACTIVE' => 1,
'CRON_TITLE' => '', 'CRON_TITLE' => '',
'CRON_SCRIPT' => '', 'CRON_SCRIPT' => '',
@ -188,8 +183,7 @@ switch ($mode) {
} }
if ($submit) { if ($submit) {
$mode2 = $_POST['mode'] ?? ''; if ($_POST['mode'] == 'list') {
if ($mode2 == 'list') {
if ($cron_action == 'run' && $jobs) { if ($cron_action == 'run' && $jobs) {
\TorrentPier\Legacy\Admin\Cron::run_jobs($jobs); \TorrentPier\Legacy\Admin\Cron::run_jobs($jobs);
} elseif ($cron_action == 'delete' && $jobs) { } elseif ($cron_action == 'delete' && $jobs) {
@ -199,12 +193,12 @@ if ($submit) {
} }
redirect('admin/' . basename(__FILE__) . '?mode=list'); redirect('admin/' . basename(__FILE__) . '?mode=list');
} elseif (\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST) == 1) { } elseif (\TorrentPier\Legacy\Admin\Cron::validate_cron_post($_POST) == 1) {
if ($mode2 == 'edit') { if ($_POST['mode'] == 'edit') {
\TorrentPier\Legacy\Admin\Cron::update_cron_job($_POST); \TorrentPier\Legacy\Admin\Cron::update_cron_job($_POST);
} elseif ($mode2 == 'add') { } elseif ($_POST['mode'] == 'add') {
\TorrentPier\Legacy\Admin\Cron::insert_cron_job($_POST); \TorrentPier\Legacy\Admin\Cron::insert_cron_job($_POST);
} else { } else {
bb_die("Invalid mode: $mode2"); bb_die('Mode error');
} }
redirect('admin/' . basename(__FILE__) . '?mode=list'); redirect('admin/' . basename(__FILE__) . '?mode=list');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -47,11 +47,6 @@ $add_forum = isset($_POST['add_forum']);
$delete_forum = isset($_POST['del_forum']); $delete_forum = isset($_POST['del_forum']);
$submit = isset($_POST['submit']); $submit = isset($_POST['submit']);
// Check for demo mode
if (IN_DEMO_MODE && ($submit || $add_forum || $delete_forum)) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
// Get Attachment Config // Get Attachment Config
$attach_config = []; $attach_config = [];
@ -98,7 +93,7 @@ if ($submit && $mode == 'extensions') {
'group_id' => (int)$extensions['_' . $extension_row[$i]['ext_id']]['group_id'] 'group_id' => (int)$extensions['_' . $extension_row[$i]['ext_id']]['group_id']
); );
$sql = 'UPDATE ' . BB_EXTENSIONS . ' SET ' . DB()->build_array('UPDATE', $sql_ary) . ' $sql = 'UPDATE ' . BB_EXTENSIONS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
WHERE ext_id = ' . (int)$extension_row[$i]['ext_id']; WHERE ext_id = ' . (int)$extension_row[$i]['ext_id'];
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -164,7 +159,7 @@ if ($submit && $mode == 'extensions') {
'comment' => (string)$extension_explain 'comment' => (string)$extension_explain
); );
$sql = 'INSERT INTO ' . BB_EXTENSIONS . ' ' . DB()->build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_EXTENSIONS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
bb_die('Could not add extension'); bb_die('Could not add extension');
@ -265,7 +260,7 @@ if ($submit && $mode == 'groups') {
'max_filesize' => (int)$filesize_list[$i] 'max_filesize' => (int)$filesize_list[$i]
); );
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . ' SET ' . DB()->build_array('UPDATE', $sql_ary) . ' $sql = 'UPDATE ' . BB_EXTENSION_GROUPS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
WHERE group_id = ' . (int)$group_change_list[$i]; WHERE group_id = ' . (int)$group_change_list[$i];
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -345,7 +340,7 @@ if ($submit && $mode == 'groups') {
'forum_permissions' => '' 'forum_permissions' => ''
); );
$sql = 'INSERT INTO ' . BB_EXTENSION_GROUPS . ' ' . DB()->build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_EXTENSION_GROUPS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
bb_die('Could not add extension group'); bb_die('Could not add extension group');
@ -504,7 +499,7 @@ if ($add_forum && $e_mode == 'perm' && $group) {
$auth_bitstream = auth_pack($auth_p); $auth_bitstream = auth_pack($auth_p);
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . DB()->escape($auth_bitstream) . "' WHERE group_id = " . (int)$group; $sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group;
if (!($result = DB()->sql_query($sql))) { if (!($result = DB()->sql_query($sql))) {
bb_die('Could not update permissions #2'); bb_die('Could not update permissions #2');
@ -541,7 +536,7 @@ if ($delete_forum && $e_mode == 'perm' && $group) {
$auth_bitstream = (count($auth_p) > 0) ? auth_pack($auth_p) : ''; $auth_bitstream = (count($auth_p) > 0) ? auth_pack($auth_p) : '';
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . DB()->escape($auth_bitstream) . "' WHERE group_id = " . (int)$group; $sql = 'UPDATE ' . BB_EXTENSION_GROUPS . " SET forum_permissions = '" . attach_mod_sql_escape($auth_bitstream) . "' WHERE group_id = " . (int)$group;
if (!($result = DB()->sql_query($sql))) { if (!($result = DB()->sql_query($sql))) {
bb_die('Could not update permissions #3'); bb_die('Could not update permissions #3');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -72,17 +72,10 @@ if (isset($_GET['adv'])) {
unset($adv); unset($adv);
} }
$submit = isset($_POST['submit']);
// Check for demo mode
if (IN_DEMO_MODE && $submit) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
/** /**
* Start program proper * Start program proper
*/ */
if ($submit) { if (isset($_POST['submit'])) {
$sql = ''; $sql = '';
if (!empty($forum_id)) { if (!empty($forum_id)) {
@ -123,7 +116,6 @@ if ($submit) {
} }
$datastore->update('cat_forums'); $datastore->update('cat_forums');
CACHE('bb_cache')->rm();
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="' . 'admin_forumauth.php' . '">', '</a>')); bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="' . 'admin_forumauth.php' . '">', '</a>'));
} }
@ -208,7 +200,7 @@ if (empty($forum_id)) {
} }
$adv_mode = empty($adv) ? '1' : '0'; $adv_mode = empty($adv) ? '1' : '0';
$switch_mode = "admin_forumauth.php?" . POST_FORUM_URL . "=$forum_id&amp;adv=$adv_mode"; $switch_mode = "admin_forumauth.php?f=$forum_id&amp;adv=$adv_mode";
$switch_mode_text = empty($adv) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE']; $switch_mode_text = empty($adv) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -80,17 +80,10 @@ if (isset($_GET['adv'])) {
unset($adv); unset($adv);
} }
$submit = isset($_POST['submit']); //
// Start program proper
// Check for demo mode //
if (IN_DEMO_MODE && $submit) { if (isset($_POST['submit'])) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
/**
* Start program proper
*/
if ($submit) {
$sql = ''; $sql = '';
if (!empty($forum_id)) { if (!empty($forum_id)) {
@ -153,7 +146,6 @@ if ($submit) {
} }
$datastore->update('cat_forums'); $datastore->update('cat_forums');
CACHE('bb_cache')->rm();
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', '</a>')); bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', '</a>'));
} // End of submit } // End of submit

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -53,11 +53,6 @@ if (isset($_REQUEST['addforum']) || isset($_REQUEST['addcategory'])) {
} }
} }
// Check for demo mode
if (IN_DEMO_MODE && in_array($mode, ['deletecat', 'deleteforum'])) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
$show_main_page = false; $show_main_page = false;
if ($mode) { if ($mode) {
@ -115,8 +110,8 @@ if ($mode) {
if ($parent = get_forum_data($forum_parent)) { if ($parent = get_forum_data($forum_parent)) {
$cat_id = $parent['cat_id']; $cat_id = $parent['cat_id'];
} }
} elseif (isset($_REQUEST[POST_CAT_URL])) { } elseif (isset($_REQUEST['c'])) {
$cat_id = (int)$_REQUEST[POST_CAT_URL]; $cat_id = (int)$_REQUEST['c'];
} }
$catlist = get_list('category', $cat_id, true); $catlist = get_list('category', $cat_id, true);
@ -223,7 +218,7 @@ if ($mode) {
$datastore->update('cat_forums'); $datastore->update('cat_forums');
CACHE('bb_cache')->rm(); CACHE('bb_cache')->rm();
bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?' . POST_CAT_URL . '=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); bb_die($lang['FORUMS_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
break; break;
@ -312,7 +307,7 @@ if ($mode) {
$message = $lang['FORUMS_UPDATED'] . '<br /><br />'; $message = $lang['FORUMS_UPDATED'] . '<br /><br />';
$message .= $fix ? "$fix<br /><br />" : ''; $message .= $fix ? "$fix<br /><br />" : '';
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?' . POST_CAT_URL . '=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
break; break;
@ -322,7 +317,7 @@ if ($mode) {
// Create a category in the DB // Create a category in the DB
// //
if (!$new_cat_title = trim($_POST['categoryname'])) { if (!$new_cat_title = trim($_POST['categoryname'])) {
bb_die($lang['CATEGORY_NAME_EMPTY']); bb_die('Category name is empty');
} }
check_name_dup('cat', $new_cat_title); check_name_dup('cat', $new_cat_title);
@ -347,12 +342,12 @@ if ($mode) {
// //
// Show form to edit a category // Show form to edit a category
// //
$cat_id = (int)$_GET[POST_CAT_URL]; $cat_id = (int)$_GET['c'];
$cat_info = get_info('category', $cat_id); $cat_info = get_info('category', $cat_id);
$hidden_fields = array( $hidden_fields = array(
'mode' => 'modcat', 'mode' => 'modcat',
POST_CAT_URL => $cat_id, 'c' => $cat_id,
); );
$template->assign_vars(array( $template->assign_vars(array(
@ -370,10 +365,10 @@ if ($mode) {
// Modify a category in the DB // Modify a category in the DB
// //
if (!$new_cat_title = trim($_POST['cat_title'])) { if (!$new_cat_title = trim($_POST['cat_title'])) {
bb_die($lang['CATEGORY_NAME_EMPTY']); bb_die('Category name is empty');
} }
$cat_id = (int)$_POST[POST_CAT_URL]; $cat_id = (int)$_POST['c'];
$row = get_info('category', $cat_id); $row = get_info('category', $cat_id);
$cur_cat_title = $row['cat_title']; $cur_cat_title = $row['cat_title'];
@ -401,7 +396,7 @@ if ($mode) {
// //
// Show form to delete a forum // Show form to delete a forum
// //
$forum_id = (int)$_GET[POST_FORUM_URL]; $forum_id = (int)$_GET['f'];
$move_to_options = '<option value="-1">' . $lang['DELETE_ALL_POSTS'] . '</option>'; $move_to_options = '<option value="-1">' . $lang['DELETE_ALL_POSTS'] . '</option>';
$move_to_options .= sf_get_list('forum', $forum_id, 0); $move_to_options .= sf_get_list('forum', $forum_id, 0);
@ -438,7 +433,6 @@ if ($mode) {
if ($to_id == -1) { if ($to_id == -1) {
// Delete everything from forum // Delete everything from forum
\TorrentPier\Legacy\Admin\Common::topic_delete('prune', $from_id, 0, true); \TorrentPier\Legacy\Admin\Common::topic_delete('prune', $from_id, 0, true);
$datastore->update('stats');
} else { } else {
// Move all posts // Move all posts
$sql = 'SELECT * FROM ' . BB_FORUMS . " WHERE forum_id IN($from_id, $to_id)"; $sql = 'SELECT * FROM ' . BB_FORUMS . " WHERE forum_id IN($from_id, $to_id)";
@ -486,7 +480,7 @@ if ($mode) {
case 'deletecat': case 'deletecat':
// Show form to delete a category // Show form to delete a category
$cat_id = (int)$_GET[POST_CAT_URL]; $cat_id = (int)$_GET['c'];
$catinfo = get_info('category', $cat_id); $catinfo = get_info('category', $cat_id);
$categories_count = $catinfo['number']; $categories_count = $catinfo['number'];
@ -523,11 +517,7 @@ if ($mode) {
case 'movedelcat': case 'movedelcat':
// Move or delete a category in the DB // Move or delete a category in the DB
$from_id = (int)$_POST['from_id']; $from_id = (int)$_POST['from_id'];
$to_id = (int)$_POST['to_id'] ?? -1; $to_id = (int)$_POST['to_id'];
if ($to_id === -1) {
bb_die($lang['NOWHERE_TO_MOVE']);
}
if ($from_id == $to_id || !cat_exists($from_id) || !cat_exists($to_id)) { if ($from_id == $to_id || !cat_exists($from_id) || !cat_exists($to_id)) {
bb_die('Bad input'); bb_die('Bad input');
@ -634,7 +624,7 @@ if ($mode) {
case 'cat_order': case 'cat_order':
$move = (int)$_GET['move']; $move = (int)$_GET['move'];
$cat_id = (int)$_GET[POST_CAT_URL]; $cat_id = (int)$_GET['c'];
DB()->query(' DB()->query('
UPDATE ' . BB_CATEGORIES . " SET UPDATE ' . BB_CATEGORIES . " SET
@ -650,7 +640,7 @@ if ($mode) {
break; break;
case 'forum_sync': case 'forum_sync':
\TorrentPier\Legacy\Admin\Common::sync('forum', (int)$_GET[POST_FORUM_URL]); \TorrentPier\Legacy\Admin\Common::sync('forum', (int)$_GET['f']);
$datastore->update('cat_forums'); $datastore->update('cat_forums');
CACHE('bb_cache')->rm(); CACHE('bb_cache')->rm();
@ -659,6 +649,7 @@ if ($mode) {
default: default:
bb_die($lang['NO_MODE']); bb_die($lang['NO_MODE']);
break; break;
} }
} }
@ -681,7 +672,7 @@ if (!$mode || $show_main_page) {
$where_cat_sql = $req_cat_id = ''; $where_cat_sql = $req_cat_id = '';
if ($c =& $_REQUEST[POST_CAT_URL]) { if ($c =& $_REQUEST['c']) {
if ($c !== 'all') { if ($c !== 'all') {
$req_cat_id = (int)$c; $req_cat_id = (int)$c;
$where_cat_sql = "WHERE cat_id = $req_cat_id"; $where_cat_sql = "WHERE cat_id = $req_cat_id";
@ -709,7 +700,7 @@ if (!$mode || $show_main_page) {
$bgr_class_over = 'prow3'; $bgr_class_over = 'prow3';
$template->assign_vars(array( $template->assign_vars(array(
'U_ALL_FORUMS' => 'admin_forums.php?' . POST_CAT_URL . '=all', 'U_ALL_FORUMS' => 'admin_forums.php?c=all',
'FORUMS_COUNT' => $total_forums, 'FORUMS_COUNT' => $total_forums,
)); ));
@ -723,12 +714,12 @@ if (!$mode || $show_main_page) {
'CAT_ID' => $cat_id, 'CAT_ID' => $cat_id,
'CAT_DESC' => htmlCHR($category_rows[$i]['cat_title']), 'CAT_DESC' => htmlCHR($category_rows[$i]['cat_title']),
'U_CAT_EDIT' => "admin_forums.php?mode=editcat&amp;" . POST_CAT_URL . "=$cat_id", 'U_CAT_EDIT' => "admin_forums.php?mode=editcat&amp;c=$cat_id",
'U_CAT_DELETE' => "admin_forums.php?mode=deletecat&amp;" . POST_CAT_URL . "=$cat_id", 'U_CAT_DELETE' => "admin_forums.php?mode=deletecat&amp;c=$cat_id",
'U_CAT_MOVE_UP' => "admin_forums.php?mode=cat_order&amp;move=-15&amp;" . POST_CAT_URL . "=$cat_id", 'U_CAT_MOVE_UP' => "admin_forums.php?mode=cat_order&amp;move=-15&amp;c=$cat_id",
'U_CAT_MOVE_DOWN' => "admin_forums.php?mode=cat_order&amp;move=15&amp;" . POST_CAT_URL . "=$cat_id", 'U_CAT_MOVE_DOWN' => "admin_forums.php?mode=cat_order&amp;move=15&amp;c=$cat_id",
'U_VIEWCAT' => "admin_forums.php?" . POST_CAT_URL . "=$cat_id", 'U_VIEWCAT' => "admin_forums.php?c=$cat_id",
'U_CREATE_FORUM' => "admin_forums.php?mode=addforum&amp;" . POST_CAT_URL . "=$cat_id", 'U_CREATE_FORUM' => "admin_forums.php?mode=addforum&amp;c=$cat_id",
)); ));
for ($j = 0; $j < $total_forums; $j++) { for ($j = 0; $j < $total_forums; $j++) {
@ -743,7 +734,7 @@ if (!$mode || $show_main_page) {
'FORUM_DESC' => htmlCHR($forum_rows[$j]['forum_desc']), 'FORUM_DESC' => htmlCHR($forum_rows[$j]['forum_desc']),
'NUM_TOPICS' => $forum_rows[$j]['forum_topics'], 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
'NUM_POSTS' => $forum_rows[$j]['forum_posts'], 'NUM_POSTS' => $forum_rows[$j]['forum_posts'],
'PRUNE_DAYS' => !empty($forum_rows[$j]['prune_days']) ? delta_time((TIMENOW - 86400 * $forum_rows[$j]['prune_days']), TIMENOW, 'days') : $lang['DISABLED'], 'PRUNE_DAYS' => $forum_rows[$j]['prune_days'] ?: '-',
'ORDER' => $forum_rows[$j]['forum_order'], 'ORDER' => $forum_rows[$j]['forum_order'],
'FORUM_ID' => $forum_rows[$j]['forum_id'], 'FORUM_ID' => $forum_rows[$j]['forum_id'],
@ -753,19 +744,19 @@ if (!$mode || $show_main_page) {
'FORUM_PARENT' => $forum_rows[$j]['forum_parent'], 'FORUM_PARENT' => $forum_rows[$j]['forum_parent'],
'SF_PAD' => $forum_rows[$j]['forum_parent'] ? ' style="padding-left: 20px;" ' : '', 'SF_PAD' => $forum_rows[$j]['forum_parent'] ? ' style="padding-left: 20px;" ' : '',
'FORUM_NAME_CLASS' => $forum_rows[$j]['forum_parent'] ? 'genmed' : 'gen', 'FORUM_NAME_CLASS' => $forum_rows[$j]['forum_parent'] ? 'genmed' : 'gen',
'ADD_SUB_HREF' => !$forum_rows[$j]['forum_parent'] ? "admin_forums.php?mode=addforum&amp;forum_parent={$forum_rows[$j]['forum_id']}" : '', 'ADD_SUB_HREF' => "admin_forums.php?mode=addforum&amp;forum_parent={$forum_rows[$j]['forum_id']}",
'U_VIEWFORUM' => BB_ROOT . FORUM_URL . $forum_id, 'U_VIEWFORUM' => BB_ROOT . FORUM_URL . $forum_id,
'U_FORUM_EDIT' => "admin_forums.php?mode=editforum&amp;" . POST_FORUM_URL . "=$forum_id", 'U_FORUM_EDIT' => "admin_forums.php?mode=editforum&amp;f=$forum_id",
'U_FORUM_PERM' => "admin_forumauth.php?" . POST_FORUM_URL . "=$forum_id", 'U_FORUM_PERM' => "admin_forumauth.php?f=$forum_id",
'U_FORUM_DELETE' => "admin_forums.php?mode=deleteforum&amp;" . POST_FORUM_URL . "=$forum_id", 'U_FORUM_DELETE' => "admin_forums.php?mode=deleteforum&amp;f=$forum_id",
'U_FORUM_MOVE_UP' => "admin_forums.php?mode=forum_order&amp;move=-15&amp;" . POST_FORUM_URL . "=$forum_id&amp;" . POST_CAT_URL . "=$req_cat_id", 'U_FORUM_MOVE_UP' => "admin_forums.php?mode=forum_order&amp;move=-15&amp;f=$forum_id&amp;c=$req_cat_id",
'U_FORUM_MOVE_DOWN' => "admin_forums.php?mode=forum_order&amp;move=15&amp;" . POST_FORUM_URL . "=$forum_id&amp;" . POST_CAT_URL . "=$req_cat_id", 'U_FORUM_MOVE_DOWN' => "admin_forums.php?mode=forum_order&amp;move=15&amp;f=$forum_id&amp;c=$req_cat_id",
'U_FORUM_RESYNC' => "admin_forums.php?mode=forum_sync&amp;" . POST_FORUM_URL . "=$forum_id", 'U_FORUM_RESYNC' => "admin_forums.php?mode=forum_sync&amp;f=$forum_id",
)); ));
} }// if ... forumid == catid
} } // for ... forums
} } // for ... categories
} }// if ... total_categories
} }
print_page('admin_forums.tpl', 'admin'); print_page('admin_forums.tpl', 'admin');
@ -865,7 +856,7 @@ function get_list($mode, $id, $select)
if ($row[$idfield] == $id) { if ($row[$idfield] == $id) {
$s = ' selected'; $s = ' selected';
} }
$catlist .= '<option value="' . $row[$idfield] . '"' . $s . '>&nbsp;' . str_short(htmlCHR($row[$namefield]), 60) . '</option>\n'; $catlist .= '<option value="' . $row[$idfield] . '"' . $s . '>&nbsp;' . htmlCHR(str_short($row[$namefield], 60)) . '</option>\n';
} }
return $catlist; return $catlist;
@ -1102,7 +1093,7 @@ function sf_get_list($mode, $exclude = 0, $select = 0)
$selected = ($fid == $select) ? HTML_SELECTED : ''; $selected = ($fid == $select) ? HTML_SELECTED : '';
$disabled = ($fid == $exclude && !$forum_parent) ? HTML_DISABLED : ''; $disabled = ($fid == $exclude && !$forum_parent) ? HTML_DISABLED : '';
$style = $disabled ? ' style="color: gray" ' : (($fid == $exclude) ? ' style="color: darkred" ' : ''); $style = $disabled ? ' style="color: gray" ' : (($fid == $exclude) ? ' style="color: darkred" ' : '');
$opt .= '<option value="' . $fid . '" ' . $selected . $disabled . $style . '>' . ($f['forum_parent'] ? HTML_SF_SPACER : '') . str_short(htmlCHR($f['forum_name']), 60) . "&nbsp;</option>\n"; $opt .= '<option value="' . $fid . '" ' . $selected . $disabled . $style . '>' . ($f['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR(str_short($f['forum_name'], 60)) . "&nbsp;</option>\n";
} }
$opt .= '</optgroup>'; $opt .= '</optgroup>';

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -14,10 +14,10 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
$datastore->enqueue([ $datastore->enqueue(array(
'moderators', 'moderators',
'cat_forums', 'cat_forums',
]); ));
$log_action->init(); $log_action->init();
@ -36,9 +36,9 @@ $url = basename(__FILE__);
// Key names // Key names
$type_key = 'type'; $type_key = 'type';
$forum_key = POST_FORUM_URL; $forum_key = 'f';
$topic_key = POST_TOPIC_URL; $topic_key = 't';
$user_key = POST_USERS_URL; $user_key = 'u';
$datetime_key = 'dt'; // value should be strtotime() time ("2006-06-25" etc.) $datetime_key = 'dt'; // value should be strtotime() time ("2006-06-25" etc.)
$daysback_key = 'db'; $daysback_key = 'db';
$sort_key = 'sort'; $sort_key = 'sort';
@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
$url = url_arg($url, $daysback_key, $daysback_val); $url = url_arg($url, $daysback_key, $daysback_val);
} }
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) { if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
$tz = TIMENOW + (3600 * config()->get('board_timezone')); $tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($tmp_timestamp = strtotime($var, $tz)) > 0) { if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
$datetime_val = $tmp_timestamp; $datetime_val = $tmp_timestamp;
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val)); $url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
@ -225,9 +225,6 @@ if ($log_rowset) {
case $log_type['mod_topic_unlock']: case $log_type['mod_topic_unlock']:
case $log_type['mod_topic_set_downloaded']: case $log_type['mod_topic_set_downloaded']:
case $log_type['mod_topic_unset_downloaded']: case $log_type['mod_topic_unset_downloaded']:
case $log_type['mod_topic_change_tor_status']:
case $log_type['mod_topic_change_tor_type']:
case $log_type['mod_topic_tor_unregister']:
case $log_type['mod_topic_renamed']: case $log_type['mod_topic_renamed']:
case $log_type['mod_post_delete']: case $log_type['mod_post_delete']:
case $log_type['mod_post_pin']: case $log_type['mod_post_pin']:
@ -265,7 +262,7 @@ if ($log_rowset) {
'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']),
'USER_ID' => $row['log_user_id'], 'USER_ID' => $row['log_user_id'],
'USERNAME' => profile_url($row, true), 'USERNAME' => profile_url($row),
'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']),
'USER_IP' => \TorrentPier\Helpers\IPHelper::isValid($row['log_user_ip']) ? \TorrentPier\Helpers\IPHelper::long2ip_extended($row['log_user_ip']) : '127.0.0.1', 'USER_IP' => \TorrentPier\Helpers\IPHelper::isValid($row['log_user_ip']) ? \TorrentPier\Helpers\IPHelper::long2ip_extended($row['log_user_ip']) : '127.0.0.1',
@ -313,7 +310,7 @@ if ($log_rowset) {
// Users // Users
if ($user_csv && empty($filter['users'])) { if ($user_csv && empty($filter['users'])) {
$template->assign_block_vars('users', array( $template->assign_block_vars('users', array(
'USERNAME' => profile_url($row, true), 'USERNAME' => profile_url($row),
)); ));
$filter['users'] = true; $filter['users'] = true;
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -14,7 +14,7 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
if (!config()->get('emailer.enabled')) { if (!$bb_cfg['emailer']['enabled']) {
bb_die($lang['EMAILER_DISABLED']); bb_die($lang['EMAILER_DISABLED']);
} }
@ -23,7 +23,7 @@ set_time_limit(1200);
$subject = trim(request_var('subject', '')); $subject = trim(request_var('subject', ''));
$message = (string)request_var('message', ''); $message = (string)request_var('message', '');
$group_id = (int)request_var(POST_GROUPS_URL, 0); $group_id = (int)request_var(POST_GROUPS_URL, 0);
$reply_to = (string)request_var('reply_to', config()->get('board_email')); $reply_to = (string)request_var('reply_to', $bb_cfg['board_email']);
$message_type = (string)request_var('message_type', ''); $message_type = (string)request_var('message_type', '');
$errors = $user_id_sql = []; $errors = $user_id_sql = [];
@ -40,7 +40,12 @@ if (isset($_POST['submit'])) {
} }
if (!$errors) { if (!$errors) {
$banned_users = ($get_banned_users = get_banned_users()) ? (', ' . implode(', ', $get_banned_users)) : ''; $sql = DB()->fetch_rowset('SELECT ban_userid FROM ' . BB_BANLIST . ' WHERE ban_userid != 0');
foreach ($sql as $row) {
$user_id_sql[] = ',' . $row['ban_userid'];
}
$user_id_sql = implode('', $user_id_sql);
if ($group_id != -1) { if ($group_id != -1) {
$user_list = DB()->fetch_rowset(' $user_list = DB()->fetch_rowset('
@ -50,14 +55,14 @@ if (isset($_POST['submit'])) {
AND ug.user_pending = 0 AND ug.user_pending = 0
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
AND u.user_active = 1 AND u.user_active = 1
AND u.user_id NOT IN(" . EXCLUDED_USERS . $banned_users . ') AND u.user_id NOT IN(" . EXCLUDED_USERS . $user_id_sql . ')
'); ');
} else { } else {
$user_list = DB()->fetch_rowset(' $user_list = DB()->fetch_rowset('
SELECT username, user_email, user_lang SELECT username, user_email, user_lang
FROM ' . BB_USERS . ' FROM ' . BB_USERS . '
WHERE user_active = 1 WHERE user_active = 1
AND user_id NOT IN(' . EXCLUDED_USERS . $banned_users . ') AND user_id NOT IN(' . EXCLUDED_USERS . $user_id_sql . ')
'); ');
} }

View file

@ -1,79 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!empty($setmodules)) {
if (IS_SUPER_ADMIN) {
$module['GENERAL']['MIGRATIONS_STATUS'] = basename(__FILE__);
}
return;
}
require __DIR__ . '/pagestart.php';
if (!IS_SUPER_ADMIN) {
bb_die(__('ONLY_FOR_SUPER_ADMIN'));
}
use TorrentPier\Database\MigrationStatus;
// Initialize migration status
$migrationStatus = new MigrationStatus();
$status = $migrationStatus->getMigrationStatus();
$schemaInfo = $migrationStatus->getSchemaInfo();
// Template variables
$template->assign_vars([
'PAGE_TITLE' => __('MIGRATIONS_STATUS'),
'CURRENT_TIME' => date('Y-m-d H:i:s'),
// Migration status individual fields
'MIGRATION_TABLE_EXISTS' => $status['table_exists'],
'MIGRATION_CURRENT_VERSION' => $status['current_version'],
'MIGRATION_APPLIED_COUNT' => count($status['applied_migrations']),
'MIGRATION_PENDING_COUNT' => count($status['pending_migrations']),
// Setup status fields
'SETUP_REQUIRES_SETUP' => $status['requires_setup'] ?? false,
'SETUP_TYPE' => $status['setup_status']['type'] ?? __('UNKNOWN'),
'SETUP_MESSAGE' => $status['setup_status']['message'] ?? '',
'SETUP_ACTION_REQUIRED' => $status['setup_status']['action_required'] ?? false,
'SETUP_INSTRUCTIONS' => $status['setup_status']['instructions'] ?? '',
// Schema info individual fields
'SCHEMA_DATABASE_NAME' => $schemaInfo['database_name'],
'SCHEMA_TABLE_COUNT' => $schemaInfo['table_count'],
'SCHEMA_SIZE_MB' => $schemaInfo['size_mb'],
]);
// Assign migration data for template
if (!empty($status['applied_migrations'])) {
foreach ($status['applied_migrations'] as $i => $migration) {
$template->assign_block_vars('applied_migrations', [
'VERSION' => $migration['version'],
'NAME' => $migration['migration_name'] ?? __('UNKNOWN'),
'START_TIME' => $migration['start_time'] ?? __('UNKNOWN'),
'END_TIME' => $migration['end_time'] ?? __('UNKNOWN'),
'ROW_CLASS' => ($i % 2) ? 'row1' : 'row2'
]);
}
}
if (!empty($status['pending_migrations'])) {
foreach ($status['pending_migrations'] as $i => $migration) {
$template->assign_block_vars('pending_migrations', [
'VERSION' => $migration['version'],
'NAME' => $migration['name'],
'FILENAME' => $migration['filename'],
'ROW_CLASS' => ($i % 2) ? 'row1' : 'row2'
]);
}
}
// Output template using standard admin pattern
print_page('admin_migrations.tpl', 'admin');

View file

@ -2,28 +2,17 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
if (!empty($setmodules)) { if (!empty($setmodules)) {
if (IS_SUPER_ADMIN) {
$module['GENERAL']['PHP_INFO'] = basename(__FILE__); $module['GENERAL']['PHP_INFO'] = basename(__FILE__);
}
return; return;
} }
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
// Check for demo mode
if (IN_DEMO_MODE) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
/** @noinspection ForgottenDebugOutputInspection */ /** @noinspection ForgottenDebugOutputInspection */
phpinfo(); phpinfo();

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -29,10 +29,6 @@ if (isset($_GET['mode']) || isset($_POST['mode'])) {
} }
} }
if ($mode == 'delete' && isset($_POST['cancel'])) {
$mode = '';
}
if ($mode != '') { if ($mode != '') {
if ($mode == 'edit' || $mode == 'add') { if ($mode == 'edit' || $mode == 'add') {
// //
@ -87,7 +83,7 @@ if ($mode != '') {
// The rank image has to be a jpg, gif or png // The rank image has to be a jpg, gif or png
// //
if ($rank_image != '') { if ($rank_image != '') {
if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.avif\.ico)$/is', $rank_image)) { if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.ico)$/is', $rank_image)) {
$rank_image = ''; $rank_image = '';
} }
} }
@ -127,14 +123,12 @@ if ($mode != '') {
// Ok, they want to delete their rank // Ok, they want to delete their rank
// //
$confirmed = isset($_POST['confirm']);
if (isset($_POST['id']) || isset($_GET['id'])) { if (isset($_POST['id']) || isset($_GET['id'])) {
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id']; $rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
} else { } else {
$rank_id = 0; $rank_id = 0;
} }
if ($confirmed) {
if ($rank_id) { if ($rank_id) {
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id"; $sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
@ -153,15 +147,6 @@ if ($mode != '') {
} else { } else {
bb_die($lang['MUST_SELECT_RANK']); bb_die($lang['MUST_SELECT_RANK']);
} }
} else {
$hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
print_confirmation([
'FORM_ACTION' => 'admin_ranks.php',
'HIDDEN_FIELDS' => $hidden_fields,
]);
}
} else { } else {
bb_die('Invalid mode'); bb_die('Invalid mode');
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -329,7 +329,7 @@ if ($mode == 'submit' || $mode == 'refresh') {
'TOTAL_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($total_percent, 2)), 'TOTAL_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($total_percent, 2)),
'LAST_CYCLE_TIME' => delta_time(TIMENOW), 'LAST_CYCLE_TIME' => delta_time(TIMENOW),
'SESSION_TIME' => delta_time(($last_session_data['start_time'] == 0) ? TIMENOW : $last_session_data['start_time']), 'SESSION_TIME' => delta_time($last_session_data['start_time']),
'SESSION_AVERAGE_CYCLE_TIME' => delta_time((int)$session_average_cycle_time, 0), 'SESSION_AVERAGE_CYCLE_TIME' => delta_time((int)$session_average_cycle_time, 0),
'SESSION_ESTIMATED_TIME' => delta_time((int)$session_estimated_time, 0), 'SESSION_ESTIMATED_TIME' => delta_time((int)$session_estimated_time, 0),

View file

@ -1,45 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!empty($setmodules)) {
$module['MODS']['ROBOTS_TXT_EDITOR_TITLE'] = basename(__FILE__);
return;
}
require __DIR__ . '/pagestart.php';
$robots_file = BB_ROOT . 'robots.txt';
// Обработка сохранения
if (isset($_POST['save'])) {
$robots_txt = $_POST['robots_txt'] ?? '';
if (!is_writable($robots_file) && is_file($robots_file)) {
bb_die('File robots.txt is not writable #1');
}
$bytes = file_put_contents($robots_file, $robots_txt);
if ($bytes === false) {
bb_die('Could not write robots.txt #2');
}
bb_die($lang['ROBOTS_TXT_UPDATED_SUCCESSFULLY'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_ROBOTS_TXT_CONFIG'], '<a href="admin_robots.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
$current_content = '';
if (is_file($robots_file)) {
$current_content = file_get_contents($robots_file);
}
$template->assign_vars([
'S_ACTION' => 'admin_robots.php',
'ROBOTS_TXT' => htmlCHR($current_content),
]);
print_page('admin_robots.tpl', 'admin');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -14,7 +14,7 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
$sql = "SELECT * FROM " . BB_CONFIG . " WHERE config_name IN('sitemap_time', 'static_sitemap')"; $sql = 'SELECT * FROM ' . BB_CONFIG;
if (!$result = DB()->sql_query($sql)) { if (!$result = DB()->sql_query($sql)) {
bb_die('Could not query config information in admin_sitemap'); bb_die('Could not query config information in admin_sitemap');
@ -39,8 +39,8 @@ if (!$result = DB()->sql_query($sql)) {
} }
} }
$s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], config()->get('post_date_format')) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>'; $s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
$message = is_file(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED']; $message = file_exists(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars([ $template->assign_vars([
'STATIC_SITEMAP' => $new['static_sitemap'], 'STATIC_SITEMAP' => $new['static_sitemap'],

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -22,29 +22,27 @@ if (isset($_POST['mode']) || isset($_GET['mode'])) {
$mode = ''; $mode = '';
} }
if ($mode == 'delete' && isset($_POST['cancel'])) {
$mode = '';
}
$pathToSmilesDir = BB_ROOT . config()->get('smilies_path');
$delimeter = '=+:'; $delimeter = '=+:';
$s_hidden_fields = ''; $s_hidden_fields = '';
$smiley_paks = $smiley_images = []; $smiley_paks = [];
// Read a listing of uploaded smiles // Read a listing of uploaded smilies for use in the add or edit smliey code
$smilesDirectory = new DirectoryIterator($pathToSmilesDir); $dir = opendir(BB_ROOT . $bb_cfg['smilies_path']);
foreach ($smilesDirectory as $files) { while ($file = @readdir($dir)) {
if ($files->isFile()) { if (!is_dir(realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file))) {
$extension = strtolower(pathinfo($files->getFilename(), PATHINFO_EXTENSION)); $img_size = getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
if (in_array($extension, ['png', 'gif'], true) && getimagesize($pathToSmilesDir . '/' . $files->getFilename())) {
$smiley_images[] = $files->getFilename(); if ($img_size[0] && $img_size[1]) {
} else if ($extension === 'pak') { $smiley_images[] = $file;
$smiley_paks[] = $files->getFilename(); } elseif (preg_match('/.pak$/i', $file)) {
$smiley_paks[] = $file;
} }
} }
} }
closedir($dir);
// Select main mode // Select main mode
if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) { if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$smile_pak = (string)request_var('smile_pak', ''); $smile_pak = (string)request_var('smile_pak', '');
@ -73,7 +71,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
} }
} }
$fcontents = file($pathToSmilesDir . '/' . $smile_pak); $fcontents = file(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smile_pak);
if (empty($fcontents)) { if (empty($fcontents)) {
bb_die('Could not read smiley pak file'); bb_die('Could not read smiley pak file');
@ -169,37 +167,26 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_vars([ $template->assign_vars([
'TPL_SMILE_EDIT' => true, 'TPL_SMILE_EDIT' => true,
'SMILEY_IMG' => $pathToSmilesDir . '/' . $smiley_images[0], 'SMILEY_IMG' => BB_ROOT . $bb_cfg['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' => $pathToSmilesDir 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
]); ]);
} elseif ($mode != '') { } elseif ($mode != '') {
switch ($mode) { switch ($mode) {
case 'delete': case 'delete':
$confirmed = isset($_POST['confirm']);
$smiley_id = (!empty($_POST['id'])) ? $_POST['id'] : $_GET['id']; $smiley_id = (!empty($_POST['id'])) ? $_POST['id'] : $_GET['id'];
$smiley_id = (int)$smiley_id; $smiley_id = (int)$smiley_id;
if ($confirmed) {
$sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id; $sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id;
$result = DB()->sql_query($sql); $result = DB()->sql_query($sql);
if (!$result) { if (!$result) {
bb_die('Could not delete smiley'); bb_die('Could not delete smiley');
} }
$datastore->update('smile_replacements'); $datastore->update('smile_replacements');
bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
} else {
$hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$hidden_fields .= '<input type="hidden" name="id" value="' . $smiley_id . '" />';
print_confirmation([ bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
'FORM_ACTION' => 'admin_smilies.php',
'HIDDEN_FIELDS' => $hidden_fields,
]);
}
break; break;
case 'edit': case 'edit':
@ -230,11 +217,11 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
'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' => $pathToSmilesDir . '/' . $smiley_edit_img, 'SMILEY_IMG' => BB_ROOT . $bb_cfg['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' => $pathToSmilesDir 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
]); ]);
break; break;
@ -321,7 +308,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_block_vars('smiles', [ $template->assign_block_vars('smiles', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'SMILEY_IMG' => $pathToSmilesDir . '/' . $smilies[$i]['smile_url'], 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smilies[$i]['smile_url'],
'CODE' => $smilies[$i]['code'], 'CODE' => $smilies[$i]['code'],
'EMOT' => $smilies[$i]['emoticon'], 'EMOT' => $smilies[$i]['emoticon'],

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -15,18 +15,16 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
require INC_DIR . '/bbcode.php'; require INC_DIR . '/bbcode.php';
$preview = isset($_POST['preview']); if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) {
if (isset($_POST['post']) && (config()->get('terms') !== $_POST['message'])) {
bb_update_config(['terms' => $_POST['message']]); bb_update_config(['terms' => $_POST['message']]);
bb_die($lang['TERMS_UPDATED_SUCCESSFULLY'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_TERMS_CONFIG'], '<a href="admin_terms.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); bb_die($lang['CONFIG_UPDATED']);
} }
$template->assign_vars([ $template->assign_vars([
'S_ACTION' => 'admin_terms.php', 'S_ACTION' => 'admin_terms.php',
'EXT_LINK_NW' => config()->get('ext_link_new_win'), 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
'MESSAGE' => $preview ? $_POST['message'] : config()->get('terms'), 'MESSAGE' => $bb_cfg['terms'] ?: '',
'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '', 'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '',
]); ]);
print_page('admin_terms.tpl', 'admin'); print_page('admin_terms.tpl', 'admin');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -20,17 +20,12 @@ $max_forum_name_length = 50;
$yes_sign = '&radic;'; $yes_sign = '&radic;';
$no_sign = 'x'; $no_sign = 'x';
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0; $group_id = isset($_REQUEST['g']) ? (int)$_REQUEST['g'] : 0;
$user_id = isset($_REQUEST[POST_USERS_URL]) ? (int)$_REQUEST[POST_USERS_URL] : 0; $user_id = isset($_REQUEST['u']) ? (int)$_REQUEST['u'] : 0;
$cat_id = isset($_REQUEST[POST_CAT_URL]) ? (int)$_REQUEST[POST_CAT_URL] : 0; $cat_id = isset($_REQUEST['c']) ? (int)$_REQUEST['c'] : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : ''; $mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$submit = isset($_REQUEST['submit']); $submit = isset($_REQUEST['submit']);
// Check for demo mode
if (IN_DEMO_MODE && $submit) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
$group_data = []; $group_data = [];
$forum_auth_fields = array( $forum_auth_fields = array(
@ -87,7 +82,7 @@ if ($submit && $mode == 'user') {
\TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id); \TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '<br /><br />'; $message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_USERS_URL . '=' . $user_id . '">', '</a>') . '<br /><br />'; $message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&u=' . $user_id . '">', '</a>') . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -103,7 +98,7 @@ if ($submit && $mode == 'user') {
\TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id); \TorrentPier\Legacy\Group::delete_permissions($group_id, $user_id);
$message = $lang['AUTH_UPDATED'] . '<br /><br />'; $message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_USERS_URL . '=' . $user_id . '">', '</a>') . '<br /><br />'; $message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode=' . $mode . '&u=' . $user_id . '">', '</a>') . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -131,7 +126,7 @@ if ($submit && $mode == 'user') {
$l_auth_return = ($mode == 'user') ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH']; $l_auth_return = ($mode == 'user') ? $lang['CLICK_RETURN_USERAUTH'] : $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] . '<br /><br />'; $message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_USERS_URL . '=' . $user_id . '">', '</a>') . '<br /><br />'; $message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '&u=' . $user_id . '">', '</a>') . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -159,7 +154,7 @@ elseif ($submit && $mode == 'group' && (!empty($_POST['auth']) && is_array($_POS
$l_auth_return = $lang['CLICK_RETURN_GROUPAUTH']; $l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
$message = $lang['AUTH_UPDATED'] . '<br /><br />'; $message = $lang['AUTH_UPDATED'] . '<br /><br />';
$message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '&' . POST_GROUPS_URL . '=' . $group_id . '">', '</a>') . '<br /><br />'; $message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '&g=' . $group_id . '">', '</a>') . '<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -185,7 +180,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$datastore->update('cat_forums'); $datastore->update('cat_forums');
$forums = $datastore->get('cat_forums'); $forums = $datastore->get('cat_forums');
} }
$base_url = basename(__FILE__) . "?mode=user&amp;" . POST_USERS_URL . "=$user_id"; $base_url = basename(__FILE__) . "?mode=user&amp;u=$user_id";
$ug_data = $this_userdata; $ug_data = $this_userdata;
$ug_data['session_logged_in'] = 1; $ug_data['session_logged_in'] = 1;
@ -197,10 +192,10 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$template->assign_block_vars('c', array( $template->assign_block_vars('c', array(
'CAT_ID' => $c_id, 'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id], 'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;" . POST_CAT_URL . "=$c_id", 'CAT_HREF' => "$base_url&amp;c=$c_id",
)); ));
if (!$c =& $_REQUEST[POST_CAT_URL] or !in_array($c, array('all', $c_id)) or empty($c_data['forums'])) { if (!$c =& $_REQUEST['c'] or !in_array($c, array('all', $c_id)) or empty($c_data['forums'])) {
continue; continue;
} }
@ -285,7 +280,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$template->assign_vars(array( $template->assign_vars(array(
'TPL_AUTH_UG_MAIN' => true, 'TPL_AUTH_UG_MAIN' => true,
'USER_OR_GROUPNAME' => profile_url($this_userdata, true), 'USER_OR_GROUPNAME' => profile_url($this_userdata),
'USER_LEVEL' => $lang['USER_LEVEL'] . ' : ' . $s_user_type, 'USER_LEVEL' => $lang['USER_LEVEL'] . ' : ' . $s_user_type,
'T_USER_OR_GROUPNAME' => $lang['USERNAME'], 'T_USER_OR_GROUPNAME' => $lang['USERNAME'],
'T_AUTH_TITLE' => $lang['AUTH_CONTROL_USER'], 'T_AUTH_TITLE' => $lang['AUTH_CONTROL_USER'],
@ -304,7 +299,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$datastore->update('cat_forums'); $datastore->update('cat_forums');
$forums = $datastore->get('cat_forums'); $forums = $datastore->get('cat_forums');
} }
$base_url = basename(__FILE__) . "?mode=group&amp;" . POST_GROUPS_URL . "=$group_id"; $base_url = basename(__FILE__) . "?mode=group&amp;g=$group_id";
$ug_data = array('group_id' => $group_id); $ug_data = array('group_id' => $group_id);
$u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data); $u_access = auth(AUTH_ALL, AUTH_LIST_ALL, $ug_data);
@ -313,10 +308,10 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$template->assign_block_vars('c', array( $template->assign_block_vars('c', array(
'CAT_ID' => $c_id, 'CAT_ID' => $c_id,
'CAT_TITLE' => $forums['cat_title_html'][$c_id], 'CAT_TITLE' => $forums['cat_title_html'][$c_id],
'CAT_HREF' => "$base_url&amp;" . POST_CAT_URL . "=$c_id", 'CAT_HREF' => "$base_url&amp;c=$c_id",
)); ));
if (!($c =& $_REQUEST[POST_CAT_URL]) || !in_array($c, array('all', $c_id)) || empty($c_data['forums'])) { if (!($c =& $_REQUEST['c']) || !in_array($c, array('all', $c_id)) || empty($c_data['forums'])) {
continue; continue;
} }
@ -381,7 +376,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$s_hidden_fields = ' $s_hidden_fields = '
<input type="hidden" name="mode" value="' . $mode . '" /> <input type="hidden" name="mode" value="' . $mode . '" />
<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" /> <input type="hidden" name="g" value="' . $group_id . '" />
'; ';
$template->assign_vars(array( $template->assign_vars(array(
@ -419,8 +414,8 @@ $template->assign_vars(array(
'YES_SIGN' => $yes_sign, 'YES_SIGN' => $yes_sign,
'NO_SIGN' => $no_sign, 'NO_SIGN' => $no_sign,
'S_AUTH_ACTION' => 'admin_ug_auth.php', 'S_AUTH_ACTION' => 'admin_ug_auth.php',
'SELECTED_CAT' => !empty($_REQUEST[POST_CAT_URL]) ? $_REQUEST[POST_CAT_URL] : '', 'SELECTED_CAT' => !empty($_REQUEST['c']) ? $_REQUEST['c'] : '',
'U_ALL_FORUMS' => !empty($base_url) ? "$base_url&amp;" . POST_CAT_URL . "=all" : '', 'U_ALL_FORUMS' => !empty($base_url) ? "$base_url&amp;c=all" : '',
)); ));
print_page('admin_ug_auth.tpl', 'admin'); print_page('admin_ug_auth.tpl', 'admin');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -14,32 +14,121 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
$submit = isset($_POST['submit']); if (isset($_POST['submit'])) {
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
// Check for demo mode $user_list = [];
if (IN_DEMO_MODE && $submit) {
bb_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
if ($submit) {
// Ban action
if (!empty($_POST['username'])) { if (!empty($_POST['username'])) {
if (!$this_userdata = get_userdata($_POST['username'], true)) { $this_userdata = get_userdata($_POST['username'], true);
bb_die($lang['NO_USER_ID_SPECIFIED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); if (!$this_userdata) {
bb_die($lang['NO_USER_ID_SPECIFIED']);
} }
if (!getBanInfo((int)$this_userdata['user_id'])) { $user_list[] = $this_userdata['user_id'];
$sql = 'INSERT INTO ' . BB_BANLIST . ' (ban_userid) VALUES (' . $this_userdata['user_id'] . ')'; }
$ip_list = [];
if (isset($_POST['ban_ip'])) {
$ip_list_temp = explode(',', $_POST['ban_ip']);
foreach ($ip_list_temp as $ip) {
if (\TorrentPier\Helpers\IPHelper::isValid($ip)) {
$ip_list[] = \TorrentPier\Helpers\IPHelper::ip2long($ip);
}
}
}
$email_list = [];
if (isset($_POST['ban_email'])) {
$email_list_temp = explode(',', $_POST['ban_email']);
foreach ($email_list_temp as $i => $iValue) {
if (preg_match('/^(([a-z0-9&\'\.\-_\+])|(\*))+@(([a-z0-9\-])|(\*))+\.([a-z0-9\-]+\.)*?[a-z]+$/is', trim($email_list_temp[$i]))) {
$email_list[] = trim($email_list_temp[$i]);
}
}
}
$sql = 'SELECT * FROM ' . BB_BANLIST;
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain banlist information');
}
$current_banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$kill_session_sql = '';
for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
$in_banlist = false;
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
if ($user_list[$i] == $current_banlist[$j]['ban_userid']) {
$in_banlist = true;
}
}
if (!$in_banlist) {
$kill_session_sql .= (($kill_session_sql != '') ? ' OR ' : '') . 'session_user_id = ' . $user_list[$i];
$sql = 'INSERT INTO ' . BB_BANLIST . ' (ban_userid) VALUES (' . $user_list[$i] . ')';
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
bb_die('Could not insert ban_userid info into database'); bb_die('Could not insert ban_userid info into database');
} }
} }
} }
// Unban action for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
$in_banlist = false;
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
if ($ip_list[$i] == $current_banlist[$j]['ban_ip']) {
$in_banlist = true;
}
}
if (!$in_banlist) {
if (preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.'))) {
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, '.'))) . "'";
} else {
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
}
$kill_session_sql .= (($kill_session_sql != '') ? ' OR ' : '') . $kill_ip_sql;
$sql = 'INSERT INTO ' . BB_BANLIST . " (ban_ip) VALUES ('" . $ip_list[$i] . "')";
if (!DB()->sql_query($sql)) {
bb_die('Could not insert ban_ip info into database');
}
}
}
// Now we'll delete all entries from the session table
if ($kill_session_sql != '') {
$sql = 'DELETE FROM ' . BB_SESSIONS . " WHERE $kill_session_sql";
if (!DB()->sql_query($sql)) {
bb_die('Could not delete banned sessions from database');
}
}
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
$in_banlist = false;
for ($j = 0, $jMax = count($current_banlist); $j < $jMax; $j++) {
if ($email_list[$i] == $current_banlist[$j]['ban_email']) {
$in_banlist = true;
}
}
if (!$in_banlist) {
$sql = 'INSERT INTO ' . BB_BANLIST . " (ban_email) VALUES ('" . DB()->escape($email_list[$i]) . "')";
if (!DB()->sql_query($sql)) {
bb_die('Could not insert ban_email info into database');
}
}
}
$where_sql = ''; $where_sql = '';
if (!empty($_POST['unban_user'])) { if (isset($_POST['unban_user'])) {
$user_list = $_POST['unban_user']; $user_list = $_POST['unban_user'];
for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) { for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
@ -47,6 +136,27 @@ if ($submit) {
$where_sql .= (($where_sql != '') ? ', ' : '') . (int)$user_list[$i]; $where_sql .= (($where_sql != '') ? ', ' : '') . (int)$user_list[$i];
} }
} }
}
if (isset($_POST['unban_ip'])) {
$ip_list = $_POST['unban_ip'];
for ($i = 0, $iMax = count($ip_list); $i < $iMax; $i++) {
if ($ip_list[$i] != -1) {
$where_sql .= (($where_sql != '') ? ', ' : '') . DB()->escape($ip_list[$i]);
}
}
}
if (isset($_POST['unban_email'])) {
$email_list = $_POST['unban_email'];
for ($i = 0, $iMax = count($email_list); $i < $iMax; $i++) {
if ($email_list[$i] != -1) {
$where_sql .= (($where_sql != '') ? ', ' : '') . DB()->escape($email_list[$i]);
}
}
}
if ($where_sql != '') { if ($where_sql != '') {
$sql = 'DELETE FROM ' . BB_BANLIST . " WHERE ban_id IN ($where_sql)"; $sql = 'DELETE FROM ' . BB_BANLIST . " WHERE ban_id IN ($where_sql)";
@ -54,26 +164,81 @@ if ($submit) {
bb_die('Could not delete ban info from database'); bb_die('Could not delete ban info from database');
} }
} }
}
$datastore->update('ban_list');
bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); bb_die($lang['BAN_UPDATE_SUCESSFUL'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_BANADMIN'], '<a href="admin_user_ban.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
} else { } else {
$template->assign_vars(['S_BANLIST_ACTION' => 'admin_user_ban.php']); $template->assign_vars(['S_BANLIST_ACTION' => 'admin_user_ban.php']);
$userban_count = 0;
$ipban_count = 0;
$emailban_count = 0;
$sql = 'SELECT b.ban_id, u.user_id, u.username
FROM ' . BB_BANLIST . ' b, ' . BB_USERS . ' u
WHERE u.user_id = b.ban_userid
AND b.ban_userid <> 0
AND u.user_id <> ' . GUEST_UID . '
ORDER BY u.username ASC';
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not select current user_id ban list');
}
$user_list = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_userlist = ''; $select_userlist = '';
foreach (getBanInfo() as $ban) { for ($i = 0, $iMax = count($user_list); $i < $iMax; $i++) {
$select_userlist .= '<option value="' . $ban['ban_id'] . '">' . get_username($ban['ban_userid']) . '</option>'; $select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
$userban_count++;
} }
if ($select_userlist == '') { if ($select_userlist == '') {
$select_userlist = '<option value="-1">' . $lang['NO_BANNED_USERS'] . '</option>'; $select_userlist = '<option value="-1">' . $lang['NO_BANNED_USERS'] . '</option>';
} }
$select_userlist = '<select name="unban_user[]" multiple size="5">' . $select_userlist . '</select>'; $select_userlist = '<select name="unban_user[]" multiple size="5">' . $select_userlist . '</select>';
$sql = 'SELECT ban_id, ban_ip, ban_email FROM ' . BB_BANLIST . ' ORDER BY ban_ip';
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not select current ip ban list');
}
$banlist = DB()->sql_fetchrowset($result);
DB()->sql_freeresult($result);
$select_iplist = '';
$select_emaillist = '';
for ($i = 0, $iMax = count($banlist); $i < $iMax; $i++) {
$ban_id = $banlist[$i]['ban_id'];
if (!empty($banlist[$i]['ban_ip'])) {
$ban_ip = str_replace('255', '*', \TorrentPier\Helpers\IPHelper::long2ip_extended($banlist[$i]['ban_ip']));
$select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
$ipban_count++;
} elseif (!empty($banlist[$i]['ban_email'])) {
$ban_email = $banlist[$i]['ban_email'];
$select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
$emailban_count++;
}
}
if ($select_iplist == '') {
$select_iplist = '<option value="-1">' . $lang['NO_BANNED_IP'] . '</option>';
}
if ($select_emaillist == '') {
$select_emaillist = '<option value="-1">' . $lang['NO_BANNED_EMAIL'] . '</option>';
}
$select_iplist = '<select name="unban_ip[]" multiple size="15">' . $select_iplist . '</select>';
$select_emaillist = '<select name="unban_email[]" multiple size="10">' . $select_emaillist . '</select>';
$template->assign_vars([ $template->assign_vars([
'U_SEARCH_USER' => './../search.php?mode=searchuser', 'U_SEARCH_USER' => './../search.php?mode=searchuser',
'S_UNBAN_USERLIST_SELECT' => $select_userlist, 'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
'S_BAN_ACTION' => 'admin_user_ban.php' 'S_BAN_ACTION' => 'admin_user_ban.php'
]); ]);
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -52,8 +52,8 @@ if (!isset($_REQUEST['dosearch'])) {
} }
} }
$language_list = \TorrentPier\Legacy\Common\Select::language('', 'language_type'); $language_list = \TorrentPier\Legacy\Select::language('', 'language_type');
$timezone_list = \TorrentPier\Legacy\Common\Select::timezone('', 'timezone_type'); $timezone_list = \TorrentPier\Legacy\Select::timezone('', 'timezone_type');
$sql = 'SELECT f.forum_id, f.forum_name, f.forum_parent, c.cat_id, c.cat_title $sql = 'SELECT f.forum_id, f.forum_name, f.forum_parent, c.cat_id, c.cat_title
FROM ( ' . BB_FORUMS . ' AS f INNER JOIN ' . BB_CATEGORIES . ' AS c ON c.cat_id = f.cat_id ) FROM ( ' . BB_FORUMS . ' AS f INNER JOIN ' . BB_CATEGORIES . ' AS c ON c.cat_id = f.cat_id )
@ -64,12 +64,13 @@ if (!isset($_REQUEST['dosearch'])) {
} }
$forums = []; $forums = [];
$last_cat_id = -1;
$forums_list = '';
if (DB()->num_rows($result) != 0) { if (DB()->num_rows($result) != 0) {
$template->assign_block_vars('forums_exist', []); $template->assign_block_vars('forums_exist', []);
$last_cat_id = -1;
$forums_list = '';
while ($row = DB()->sql_fetchrow($result)) { while ($row = DB()->sql_fetchrow($result)) {
if ($row['cat_id'] != $last_cat_id) { if ($row['cat_id'] != $last_cat_id) {
$forums_list .= '<optgroup label="' . htmlCHR($row['cat_title']) . '">'; $forums_list .= '<optgroup label="' . htmlCHR($row['cat_title']) . '">';
@ -84,7 +85,7 @@ if (!isset($_REQUEST['dosearch'])) {
$lastvisited_list = ''; $lastvisited_list = '';
foreach ($lastvisited as $days) { foreach ($lastvisited as $days) {
$lastvisited_list .= '<option value="' . $days . '">' . delta_time((TIMENOW - 86400 * $days), TIMENOW, 'days') . '</option>'; $lastvisited_list .= '<option value="' . $days . '">' . $days . ' ' . (($days > 1) ? $lang['DAYS'] : $lang['DAY']) . '</option>';
} }
$template->assign_vars([ $template->assign_vars([
@ -252,7 +253,8 @@ if (!isset($_REQUEST['dosearch'])) {
$text = sprintf($lang['SEARCH_FOR_USERNAME'], strip_tags(htmlspecialchars(stripslashes($username)))); $text = sprintf($lang['SEARCH_FOR_USERNAME'], strip_tags(htmlspecialchars(stripslashes($username))));
$username = str_replace('*', '%', trim(strip_tags(strtolower($username)))); $username = str_replace("\*", '%', trim(strip_tags(strtolower($username))));
if (str_contains($username, '%')) { if (str_contains($username, '%')) {
$op = 'LIKE'; $op = 'LIKE';
} else { } else {
@ -272,7 +274,8 @@ if (!isset($_REQUEST['dosearch'])) {
$text = sprintf($lang['SEARCH_FOR_EMAIL'], strip_tags(htmlspecialchars(stripslashes($email)))); $text = sprintf($lang['SEARCH_FOR_EMAIL'], strip_tags(htmlspecialchars(stripslashes($email))));
$email = str_replace('*', '%', trim(strip_tags(strtolower($email)))); $email = str_replace("\*", '%', trim(strip_tags(strtolower($email))));
if (str_contains($email, '%')) { if (str_contains($email, '%')) {
$op = 'LIKE'; $op = 'LIKE';
} else { } else {
@ -566,7 +569,8 @@ if (!isset($_REQUEST['dosearch'])) {
$text = strip_tags(htmlspecialchars(stripslashes($userfield_value))); $text = strip_tags(htmlspecialchars(stripslashes($userfield_value)));
$userfield_value = str_replace('*', '%', trim(strip_tags(strtolower($userfield_value)))); $userfield_value = str_replace("\*", '%', trim(strip_tags(strtolower($userfield_value))));
if (str_contains($userfield_value, '%')) { if (str_contains($userfield_value, '%')) {
$op = 'LIKE'; $op = 'LIKE';
} else { } else {
@ -631,7 +635,7 @@ if (!isset($_REQUEST['dosearch'])) {
switch ($lastvisited_type) { switch ($lastvisited_type) {
case 'in': case 'in':
$text = sprintf($lang['SEARCH_FOR_LASTVISITED_INTHELAST'], delta_time((TIMENOW - 86400 * $lastvisited_days), TIMENOW, 'days')); $text = sprintf($lang['SEARCH_FOR_LASTVISITED_INTHELAST'], $lastvisited_days, (($lastvisited_days > 1) ? $lang['DAYS'] : $lang['DAY']));
$total_sql .= 'SELECT COUNT(user_id) AS total $total_sql .= 'SELECT COUNT(user_id) AS total
FROM ' . BB_USERS . " FROM ' . BB_USERS . "
@ -642,7 +646,7 @@ if (!isset($_REQUEST['dosearch'])) {
AND u.user_id <> " . GUEST_UID; AND u.user_id <> " . GUEST_UID;
break; break;
case 'after': case 'after':
$text = sprintf($lang['SEARCH_FOR_LASTVISITED_AFTERTHELAST'], delta_time((TIMENOW - 86400 * $lastvisited_days), TIMENOW, 'days')); $text = sprintf($lang['SEARCH_FOR_LASTVISITED_AFTERTHELAST'], $lastvisited_days, (($lastvisited_days > 1) ? $lang['DAYS'] : $lang['DAY']));
$total_sql .= 'SELECT COUNT(user_id) AS total $total_sql .= 'SELECT COUNT(user_id) AS total
FROM ' . BB_USERS . " FROM ' . BB_USERS . "
@ -841,10 +845,10 @@ if (!isset($_REQUEST['dosearch'])) {
if ($page == 1) { if ($page == 1) {
$offset = 0; $offset = 0;
} else { } else {
$offset = (($page - 1) * config()->get('topics_per_page')); $offset = (($page - 1) * $bb_cfg['topics_per_page']);
} }
$limit = "LIMIT $offset, " . config()->get('topics_per_page'); $limit = "LIMIT $offset, " . $bb_cfg['topics_per_page'];
$select_sql .= " $limit"; $select_sql .= " $limit";
@ -859,7 +863,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']); bb_die($lang['SEARCH_NO_RESULTS']);
} }
} }
$num_pages = ceil($total_pages['total'] / config()->get('topics_per_page')); $num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
$pagination = ''; $pagination = '';
@ -919,7 +923,7 @@ if (!isset($_REQUEST['dosearch'])) {
$template->assign_block_vars('userrow', [ $template->assign_block_vars('userrow', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'USER' => profile_url($rowset[$i], true), 'USER' => profile_url($rowset[$i]),
'EMAIL' => $rowset[$i]['user_email'], 'EMAIL' => $rowset[$i]['user_email'],
'JOINDATE' => bb_date($rowset[$i]['user_regdate']), 'JOINDATE' => bb_date($rowset[$i]['user_regdate']),
'LASTVISIT' => $rowset[$i]['user_lastvisit'] ? bb_date($rowset[$i]['user_lastvisit']) : $lang['NEVER'], 'LASTVISIT' => $rowset[$i]['user_lastvisit'] ? bb_date($rowset[$i]['user_lastvisit']) : $lang['NEVER'],

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -14,8 +14,8 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
if (!config()->get('use_word_censor')) { if (!$bb_cfg['use_word_censor']) {
bb_die('Word censor disabled <br /><br /> (use_word_censor in config.php)'); bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
} }
$mode = request_var('mode', ''); $mode = request_var('mode', '');
@ -80,8 +80,7 @@ if ($mode != '') {
bb_die('Could not insert data into words table'); bb_die('Could not insert data into words table');
} }
$datastore->update('censor'); CACHE('bb_cache')->rm('censored');
censor()->reload(); // Reload the singleton instance with updated words
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -95,8 +94,7 @@ if ($mode != '') {
bb_die('Could not remove data from words table'); bb_die('Could not remove data from words table');
} }
$datastore->update('censor'); CACHE('bb_cache')->rm('censored');
censor()->reload(); // Reload the singleton instance with updated words
bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>')); bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
} else { } else {

View file

@ -2,25 +2,13 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
// Statistics
if (!$stats = $datastore->get('stats')) {
$datastore->update('stats');
$stats = $datastore->get('stats');
}
// Check for updates
if (!$update_data = $datastore->get('check_updates')) {
$datastore->update('check_updates');
$update_data = $datastore->get('check_updates');
}
// Generate relevant output // Generate relevant output
if (isset($_GET['pane']) && $_GET['pane'] == 'left') { if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$module = []; $module = [];
@ -78,28 +66,16 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') { } elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars([ $template->assign_vars([
'TPL_ADMIN_MAIN' => true, 'TPL_ADMIN_MAIN' => true,
'ADMIN_LOCK' => (bool)config()->get('board_disable'), 'ADMIN_LOCK' => (bool)$bb_cfg['board_disable'],
'ADMIN_LOCK_CRON' => is_file(BB_DISABLED), 'ADMIN_LOCK_CRON' => file_exists(BB_DISABLED),
]); ]);
// Check for updates
if (isset($update_data['available_update'])) {
$template->assign_block_vars('updater', [
'UPDATE_AVAILABLE' => $update_data['available_update'],
'NEW_VERSION_NUMBER' => $update_data['latest_version'],
'NEW_VERSION_SIZE' => $update_data['latest_version_size'],
'NEW_VERSION_DL_LINK' => $update_data['latest_version_dl_link'],
'NEW_VERSION_LINK' => $update_data['latest_version_link'],
'NEW_VERSION_HASH' => $update_data['latest_version_checksum']
]);
}
// Get forum statistics // Get forum statistics
$total_posts = $stats['postcount']; $total_posts = get_db_stat('postcount');
$total_topics = $stats['topiccount']; $total_users = get_db_stat('usercount');
$total_users = $stats['usercount']; $total_topics = get_db_stat('topiccount');
$start_date = bb_date(config()->get('board_startdate')); $start_date = bb_date($bb_cfg['board_startdate']);
$boarddays = (TIMENOW - config()->get('board_startdate')) / 86400; $boarddays = (TIMENOW - $bb_cfg['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);
@ -107,10 +83,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$avatar_dir_size = 0; $avatar_dir_size = 0;
if ($avatar_dir = opendir(config()->get('avatars.upload_path'))) { if ($avatar_dir = opendir($bb_cfg['avatars']['upload_path'])) {
while ($file = readdir($avatar_dir)) { while ($file = readdir($avatar_dir)) {
if ($file != '.' && $file != '..') { if ($file != '.' && $file != '..') {
$avatar_dir_size += @filesize(config()->get('avatars.upload_path') . $file); $avatar_dir_size += @filesize($bb_cfg['avatars']['upload_path'] . $file);
} }
} }
closedir($avatar_dir); closedir($avatar_dir);
@ -183,11 +159,11 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$template->assign_block_vars('reg_user_row', [ $template->assign_block_vars('reg_user_row', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'USER' => profile_url($onlinerow_reg[$i], true), 'USER' => profile_url($onlinerow_reg[$i]),
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'd-M-Y H:i', false), 'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'd-M-Y 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' => config()->get('whois_info') . $reg_ip, 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
]); ]);
} }
} }
@ -203,10 +179,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$template->assign_block_vars('guest_user_row', [ $template->assign_block_vars('guest_user_row', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'd-M-Y H:i', false), 'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'd-M-Y 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' => config()->get('whois_info') . $guest_ip, 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
]); ]);
} }
} }
@ -218,7 +194,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} else { } else {
// Generate frameset // Generate frameset
$template->assign_vars([ $template->assign_vars([
'CONTENT_ENCODING' => DEFAULT_CHARSET, 'CONTENT_ENCODING' => $bb_cfg['charset'],
'TPL_ADMIN_FRAMESET' => true, 'TPL_ADMIN_FRAMESET' => true,
]); ]);
send_no_cache_headers(); send_no_cache_headers();

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -20,7 +20,7 @@ if (!IS_ADMIN) {
$sql[] = 'SELECT count(*) FROM `' . BB_USERS . '` WHERE `user_lastvisit` < UNIX_TIMESTAMP()-2592000 AND user_id NOT IN (' . EXCLUDED_USERS . ')'; $sql[] = 'SELECT count(*) FROM `' . BB_USERS . '` WHERE `user_lastvisit` < UNIX_TIMESTAMP()-2592000 AND user_id NOT IN (' . EXCLUDED_USERS . ')';
$sql[] = 'SELECT count(*) FROM `' . BB_USERS . '` WHERE `user_lastvisit` < UNIX_TIMESTAMP()-7776000 AND user_id NOT IN (' . EXCLUDED_USERS . ')'; $sql[] = 'SELECT count(*) FROM `' . BB_USERS . '` WHERE `user_lastvisit` < UNIX_TIMESTAMP()-7776000 AND user_id NOT IN (' . EXCLUDED_USERS . ')';
$sql[] = 'SELECT round(avg(size)) FROM `' . BB_BT_TORRENTS . '`'; $sql[] = 'SELECT round(avg(size)/1048576) FROM `' . BB_BT_TORRENTS . '`';
$sql[] = 'SELECT count(*) FROM `' . BB_BT_TORRENTS . '`'; $sql[] = 'SELECT count(*) FROM `' . BB_BT_TORRENTS . '`';
$sql[] = 'SELECT count(distinct(topic_id)) FROM `' . BB_BT_TRACKER_SNAP . '` WHERE seeders > 0'; $sql[] = 'SELECT count(distinct(topic_id)) FROM `' . BB_BT_TRACKER_SNAP . '` WHERE seeders > 0';
$sql[] = 'SELECT count(distinct(topic_id)) FROM `' . BB_BT_TRACKER_SNAP . '` WHERE seeders > 5'; $sql[] = 'SELECT count(distinct(topic_id)) FROM `' . BB_BT_TRACKER_SNAP . '` WHERE seeders > 5';
@ -31,10 +31,8 @@ echo '<html><body><head></head>';
echo '<br /><br /><table border="1" cellspacing="0" cellpadding="6" align="center">'; echo '<br /><br /><table border="1" cellspacing="0" cellpadding="6" align="center">';
foreach ($sql as $i => $query) { foreach ($sql as $i => $query) {
$result = DB()->fetch_row($query); $row = mysqli_fetch_row(DB()->query($query));
$row = array_values($result)[0]; // Get first column value echo "<tr><td>{$lang['TR_STATS'][$i]}</td><td><b>{$row[0]}</b></td>";
$row = ($i == 2) ? humn_size($row) : $row;
echo "<tr><td>{$lang['TR_STATS'][$i]}</td><td><b>$row</b></td>";
} }
echo '</table>'; echo '</table>';

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -21,7 +21,7 @@ if (!IS_ADMIN) {
$peers_in_last_minutes = [30, 15, 5, 1]; $peers_in_last_minutes = [30, 15, 5, 1];
$peers_in_last_sec_limit = 300; $peers_in_last_sec_limit = 300;
$announce_interval = (int)config()->get('announce_interval'); $announce_interval = (int)$bb_cfg['announce_interval'];
$stat = []; $stat = [];
define('TMP_TRACKER_TABLE', 'tmp_tracker'); define('TMP_TRACKER_TABLE', 'tmp_tracker');
@ -52,7 +52,7 @@ $stat += DB()->fetch_row('SELECT COUNT(DISTINCT user_id) AS u_bt_active FROM ' .
// All bt-users // All bt-users
$stat += DB()->fetch_row('SELECT COUNT(*) AS u_bt_all FROM ' . BB_BT_USERS); $stat += DB()->fetch_row('SELECT COUNT(*) AS u_bt_all FROM ' . BB_BT_USERS);
// All bb-users // All bb-users
$stat += DB()->fetch_row('SELECT COUNT(*) AS u_bb_all FROM ' . BB_USERS . ' WHERE user_id != ' . BOT_UID); $stat += DB()->fetch_row('SELECT COUNT(*) AS u_bb_all FROM ' . BB_USERS);
// Active torrents // Active torrents
$stat += DB()->fetch_row('SELECT COUNT(DISTINCT topic_id) AS tor_active FROM ' . TMP_TRACKER_TABLE); $stat += DB()->fetch_row('SELECT COUNT(DISTINCT topic_id) AS tor_active FROM ' . TMP_TRACKER_TABLE);
// With seeder // With seeder
@ -70,7 +70,7 @@ foreach ($peers_in_last_minutes as $t) {
} }
// Last xx seconds // Last xx seconds
$peers_in_last_sec = []; $peers_in_last_sec = [];
$rowset = DB()->fetch_rowset('SELECT COUNT(*) AS peers FROM ' . TMP_TRACKER_TABLE . ' ORDER BY update_time DESC LIMIT ' . $peers_in_last_sec_limit); $rowset = DB()->fetch_rowset('SELECT COUNT(*) AS peers FROM ' . TMP_TRACKER_TABLE . ' GROUP BY update_time ORDER BY update_time DESC LIMIT ' . $peers_in_last_sec_limit);
foreach ($rowset as $cnt => $row) { foreach ($rowset as $cnt => $row) {
$peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : ''); $peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : '');
} }
@ -94,7 +94,8 @@ if ($client_full || !$stats_cache = CACHE('tr_cache')->get('tracker_clients_stat
$clientString = $client_full ? substr($row['client'], 0, $client_full) : substr($row['client'], 0, 3); $clientString = $client_full ? substr($row['client'], 0, $client_full) : substr($row['client'], 0, 3);
if (!isset($clients[$clientString])) { if (!isset($clients[$clientString])) {
$clients[$clientString] = 1; $clients[$clientString] = 1;
} else { }
else {
$clients[$clientString]++; $clients[$clientString]++;
} }
$client_count++; $client_count++;
@ -116,7 +117,7 @@ if ($client_full || !$stats_cache = CACHE('tr_cache')->get('tracker_clients_stat
$n = 1; $n = 1;
foreach (array_slice($clients_percentage, 0, $numwant) as $client => $value) { foreach (array_slice($clients_percentage, 0, $numwant) as $client => $value) {
$client_list .= ($client_full) ? ("$client => $value<br/>") : "$n. " . get_user_torrent_client($client) . " $value<br/>"; $client_list .= ($client_full) ? ("$client => $value<br>") : "$n. " . get_user_torrent_client($client) . " $value<br>";
$n++; $n++;
} }
@ -164,10 +165,10 @@ echo "\n
<td align=center> <td align=center>
$client_list $client_list
<br/> <br>
\n"; \n";
echo (count($clients_percentage) > $numwant) ? ('<a href="' . 'tracker.php?client_numwant=' . ($numwant + 100) . '">' . 'Show more' . '</a><br/>') : ''; echo (count($clients_percentage) > $numwant) ? ('<a href="' . 'tracker.php?client_numwant=' . ($numwant + 100) . '">' . 'Show more' . '</a><br>') : '';
echo $client_full ? '<br/><b>Get more length and numbers via modifying the parameters in the url<b>' : (!empty($client_list) ? '<a href="tracker.php?client_length=6&client_numwant=10">Peer_ids with more length (version debugging)</a>' : ''); echo $client_full ? '<br><b>Get more length and numbers via modifying the parameters in the url<b>' : (!empty($client_list) ? '<a href="tracker.php?client_length=6&client_numwant=10">Peer_ids with more length (version debugging)</a>': '');
echo '</td></tr>'; echo '</td></tr>';
echo '</table>'; echo '</table>';
echo !$client_full ? '<p style = "text-align:right;">Simple stats for clients are being cached for one hour.</p>' : ''; echo !$client_full ? '<p style = "text-align:right;">Simple stats for clients are being cached for one hour.</p>' : '';

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -41,5 +41,5 @@ $ajax->exec();
/** /**
* @deprecated ajax_common * @deprecated ajax_common
* Dirty class removed from here since 2.2.0 * Dirty class removed from here since 2.2.0
* To add new actions see at src/Ajax.php * To add new actions see at src/Legacy/Ajax.php
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,15 +11,15 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../'); define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php'; require dirname(__DIR__) . '/common.php';
// Check User-Agent for existence global $bb_cfg;
$userAgent = (string)$_SERVER['HTTP_USER_AGENT'];
if (empty($userAgent)) { if (empty($_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://127.0.0.1', true, 301); header('Location: http://127.0.0.1', true, 301);
die; die;
} }
$announce_interval = config()->get('announce_interval'); $announce_interval = $bb_cfg['announce_interval'];
$passkey_key = config()->get('passkey_key'); $passkey_key = $bb_cfg['passkey_key'];
// Recover info_hash // Recover info_hash
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) { if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
@ -36,6 +36,7 @@ if (!isset($_GET[$passkey_key]) || !is_string($_GET[$passkey_key])) {
} }
// Input var names // Input var names
// String // String
$input_vars_str = ['info_hash', 'peer_id', 'event', $passkey_key]; $input_vars_str = ['info_hash', 'peer_id', 'event', $passkey_key];
// Numeric // Numeric
@ -65,26 +66,10 @@ if (strlen($peer_id) !== 20) {
} }
// Check for client ban // Check for client ban
if (config()->get('client_ban.enabled')) { if ($bb_cfg['client_ban']['enabled']) {
$targetClient = []; foreach ($bb_cfg['client_ban']['clients'] as $clientId => $reason) {
foreach (config()->get('client_ban.clients') as $clientId => $banReason) {
if (str_starts_with($peer_id, $clientId)) { if (str_starts_with($peer_id, $clientId)) {
$targetClient = [ msg_die($reason);
'peer_id' => $clientId,
'ban_reason' => $banReason
];
break;
}
}
if (config()->get('client_ban.only_allow_mode')) {
if (empty($targetClient['peer_id'])) {
msg_die('Your BitTorrent client has been banned!');
}
} else {
if (!empty($targetClient['peer_id'])) {
msg_die(empty($targetClient['ban_reason']) ? 'Your BitTorrent client has been banned!' : $targetClient['ban_reason']);
} }
} }
} }
@ -94,88 +79,46 @@ if (!isset($info_hash)) {
msg_die('info_hash was not provided'); msg_die('info_hash was not provided');
} }
/**
* Verify event
*
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L275
*/
$event = strtolower((string)$event);
if (!in_array($event, ['started', 'completed', 'stopped', 'paused', ''])) {
msg_die('Invalid event: ' . $event);
}
// Store info hash in hex format // Store info hash in hex format
$info_hash_hex = bin2hex($info_hash); $info_hash_hex = bin2hex($info_hash);
// Store peer id // Store peer id
$peer_id_sql = preg_replace('/[^a-zA-Z0-9\-\_]/', '', $peer_id); $peer_id_sql = rtrim(DB()->escape(preg_replace('/[^a-zA-Z0-9\-\_]/', '', $peer_id)), ' ');
// Stopped event
$stopped = ($event === 'stopped');
// Check info_hash length // Check info_hash length
if (strlen($info_hash) !== 20) { if (strlen($info_hash) !== 20) {
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
} }
/** if (!isset($port) || $port < 0 || $port > 0xFFFF) {
* Block system-reserved ports since 99.9% of the time they're fake and thus not connectable
* Some clients will send port of 0 on 'stopped' events. Let them through as they won't receive peers anyway.
*
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L284
*/
if (
!isset($port)
|| !is_numeric($port)
|| ($port < 1024 && !$stopped)
|| $port > 0xFFFF
|| (!empty(config()->get('disallowed_ports')) && in_array($port, config()->get('disallowed_ports')))
) {
msg_die('Invalid port: ' . $port); msg_die('Invalid port: ' . $port);
} }
if (!isset($uploaded) || $uploaded < 0) {
if (!isset($uploaded) || !is_numeric($uploaded) || $uploaded < 0) {
msg_die('Invalid uploaded value: ' . $uploaded); msg_die('Invalid uploaded value: ' . $uploaded);
} }
if (!isset($downloaded) || !is_numeric($downloaded) || $downloaded < 0) { if (!isset($downloaded) || $downloaded < 0) {
msg_die('Invalid downloaded value: ' . $downloaded); msg_die('Invalid downloaded value: ' . $downloaded);
} }
if (!isset($left) || !is_numeric($left) || $left < 0) { if (!isset($left) || $left < 0) {
msg_die('Invalid left value: ' . $left); msg_die('Invalid left value: ' . $left);
} }
/**
* Check User-Agent length
*
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L177
*/
if (strlen($userAgent) > 64) {
msg_die('User-Agent must be less than 64 characters long');
}
/**
* Block Browser by checking the User-Agent
*
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L182
*/
if (preg_match('/(Mozilla|Browser|Chrome|Safari|AppleWebKit|Opera|Links|Lynx|Bot|Unknown)/i', $userAgent)) {
msg_die('Browser disallowed');
}
// IP // IP
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
// 'ip' query handling if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
if (!config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) { if (!$bb_cfg['verify_reported_ip']) {
if (!config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_GET['ip'];
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
foreach ($matches[0] as $x_ip) {
if ($x_ip === $_GET['ip']) { if ($x_ip === $_GET['ip']) {
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP); if (!$bb_cfg['allow_internal_ip'] && preg_match("#(127\.([0-9]{1,3}\.){2}[0-9]{1,3}|10\.([0-9]{1,3}\.){2}[0-9]{1,3}|172\.[123][0-9]\.[0-9]{1,3}\.[0-9]{1,3}|192\.168\.[0-9]{1,3}\.[0-9]{1,3})#", $x_ip)) {
if ($filteredIp !== false && (config()->get('allow_internal_ip') || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) { break;
$ip = $filteredIp; }
$ip = $x_ip;
break;
} }
} }
} }
@ -201,6 +144,9 @@ if ($ip_version === 'ipv6') {
// Peer unique id // Peer unique id
$peer_hash = hash('xxh128', $passkey . $info_hash_hex . $port); $peer_hash = hash('xxh128', $passkey . $info_hash_hex . $port);
// Events
$stopped = ($event === 'stopped');
// Set seeder & complete // Set seeder & complete
$complete = $seeder = ($left == 0) ? 1 : 0; $complete = $seeder = ($left == 0) ? 1 : 0;
@ -236,20 +182,17 @@ if ($lp_info) {
$hybrid_unrecord = $lp_info['hybrid_unrecord'] ?? false; $hybrid_unrecord = $lp_info['hybrid_unrecord'] ?? false;
} else { } else {
$info_hash_sql = rtrim(DB()->escape($info_hash), ' '); $info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
/** /**
* Currently torrent clients send truncated v2 hashes (the design raises questions). * Currently torrent clients send truncated v2 hashes (the design raises questions).
* @see https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343 * https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343
*/ */
$info_hash_where = "WHERE tor.info_hash = '$info_hash_sql' OR SUBSTRING(tor.info_hash_v2, 1, 20) = '$info_hash_sql'"; $info_hash_where = "WHERE tor.info_hash = '$info_hash_sql' OR SUBSTRING(tor.info_hash_v2, 1, 20) = '$info_hash_sql'";
$passkey_sql = DB()->escape($passkey); $passkey_sql = DB()->escape($passkey);
$sql = " $sql = "
SELECT tor.topic_id, tor.poster_id, tor.tor_type, tor.tor_status, tor.info_hash, tor.info_hash_v2, bt.*, u.user_level SELECT tor.topic_id, tor.poster_id, tor.tor_type, tor.info_hash, tor.info_hash_v2, u.*
FROM " . BB_BT_TORRENTS . " tor FROM " . BB_BT_TORRENTS . " tor
LEFT JOIN " . BB_BT_USERS . " bt ON bt.auth_key = '$passkey_sql' LEFT JOIN " . BB_BT_USERS . " u ON u.auth_key = '$passkey_sql'
LEFT JOIN " . BB_USERS . " u ON u.user_id = bt.user_id
$info_hash_where $info_hash_where
LIMIT 1 LIMIT 1
"; ";
@ -257,7 +200,7 @@ if ($lp_info) {
// Verify if torrent registered on tracker and user authorized // Verify if torrent registered on tracker and user authorized
if (empty($row['topic_id'])) { if (empty($row['topic_id'])) {
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); msg_die('Torrent not registered, info_hash = ' . $info_hash_hex);
} }
if (empty($row['user_id'])) { if (empty($row['user_id'])) {
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)'); msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
@ -265,47 +208,27 @@ if ($lp_info) {
// Assign variables // Assign variables
$user_id = $row['user_id']; $user_id = $row['user_id'];
define('IS_GUEST', (int)$user_id === GUEST_UID);
define('IS_ADMIN', !IS_GUEST && (int)$row['user_level'] === ADMIN);
define('IS_MOD', !IS_GUEST && (int)$row['user_level'] === MOD);
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$row['user_level'] === GROUP_MEMBER);
define('IS_USER', !IS_GUEST && (int)$row['user_level'] === USER);
define('IS_SUPER_ADMIN', IS_ADMIN && isset(config()->get('super_admins')[$user_id]));
define('IS_AM', IS_ADMIN || IS_MOD);
$topic_id = $row['topic_id']; $topic_id = $row['topic_id'];
$releaser = (int)($user_id == $row['poster_id']); $releaser = (int)($user_id == $row['poster_id']);
$tor_type = $row['tor_type']; $tor_type = $row['tor_type'];
$tor_status = $row['tor_status'];
// Check tor status
if (!IS_AM && isset(config()->get('tor_frozen')[$tor_status]) && !(isset(config()->get('tor_frozen_author_download')[$tor_status]) && $releaser)) {
msg_die('Torrent frozen and cannot be downloaded');
}
// Check hybrid status // Check hybrid status
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) { if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
$stat_protocol = match ((int)config()->get('tracker.hybrid_stat_protocol')) { if ($info_hash !== $row['info_hash']) { // Change this to substr($row['info_hash_v2'], 0, 20) in the future for updating statistics, in case of v2 torrents being prioritized.
2 => substr($row['info_hash_v2'], 0, 20),
default => $row['info_hash'] // 1
};
if ($info_hash !== $stat_protocol) {
$hybrid_unrecord = true; // This allows us to announce only for one info-hash $hybrid_unrecord = true; // This allows us to announce only for one info-hash
} }
} }
// Ratio limits // Ratio limits
if ((RATIO_ENABLED || config()->get('tracker.limit_concurrent_ips')) && !$stopped) { if ((TR_RATING_LIMITS || $bb_cfg['tracker']['limit_concurrent_ips']) && !$stopped) {
$user_ratio = get_bt_ratio($row); $user_ratio = ($row['u_down_total'] && $row['u_down_total'] > MIN_DL_FOR_RATIO) ? ($row['u_up_total'] + $row['u_up_release'] + $row['u_up_bonus']) / $row['u_down_total'] : 1;
if ($user_ratio === null) {
$user_ratio = 1;
}
$rating_msg = ''; $rating_msg = '';
if (!$seeder) { if (!$seeder) {
foreach (config()->get('rating') as $ratio => $limit) { foreach ($bb_cfg['rating'] as $ratio => $limit) {
if ($user_ratio < $ratio) { if ($user_ratio < $ratio) {
config()->set('tracker.limit_active_tor', 1); $bb_cfg['tracker']['limit_active_tor'] = 1;
config()->set('tracker.limit_leech_count', $limit); $bb_cfg['tracker']['limit_leech_count'] = $limit;
$rating_msg = " (ratio < $ratio)"; $rating_msg = " (ratio < $ratio)";
break; break;
} }
@ -313,29 +236,29 @@ if ($lp_info) {
} }
// Limit active torrents // Limit active torrents
if (!isset(config()->get('unlimited_users')[$user_id]) && config()->get('tracker.limit_active_tor') && ((config()->get('tracker.limit_seed_count') && $seeder) || (config()->get('tracker.limit_leech_count') && !$seeder))) { if (!isset($bb_cfg['unlimited_users'][$user_id]) && $bb_cfg['tracker']['limit_active_tor'] && (($bb_cfg['tracker']['limit_seed_count'] && $seeder) || ($bb_cfg['tracker']['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 . "
WHERE user_id = $user_id WHERE user_id = $user_id
AND seeder = $seeder AND seeder = $seeder
AND topic_id != $topic_id"; AND topic_id != $topic_id";
if (!$seeder && config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) { if (!$seeder && $bb_cfg['tracker']['leech_expire_factor'] && $user_ratio < 0.5) {
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor')); $sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
} }
$sql .= " GROUP BY user_id"; $sql .= " GROUP BY user_id";
if ($row = DB()->fetch_row($sql)) { if ($row = DB()->fetch_row($sql)) {
if ($seeder && config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= config()->get('tracker.limit_seed_count')) { if ($seeder && $bb_cfg['tracker']['limit_seed_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_seed_count']) {
msg_die('Only ' . config()->get('tracker.limit_seed_count') . ' torrent(s) allowed for seeding'); msg_die('Only ' . $bb_cfg['tracker']['limit_seed_count'] . ' torrent(s) allowed for seeding');
} elseif (!$seeder && config()->get('tracker.limit_leech_count') && $row['active_torrents'] >= config()->get('tracker.limit_leech_count')) { } elseif (!$seeder && $bb_cfg['tracker']['limit_leech_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_leech_count']) {
msg_die('Only ' . config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg); msg_die('Only ' . $bb_cfg['tracker']['limit_leech_count'] . ' torrent(s) allowed for leeching' . $rating_msg);
} }
} }
} }
// Limit concurrent IPs // Limit concurrent IPs
if (config()->get('tracker.limit_concurrent_ips') && ((config()->get('tracker.limit_seed_ips') && $seeder) || (config()->get('tracker.limit_leech_ips') && !$seeder))) { if ($bb_cfg['tracker']['limit_concurrent_ips'] && (($bb_cfg['tracker']['limit_seed_ips'] && $seeder) || ($bb_cfg['tracker']['limit_leech_ips'] && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT ip) AS ips $sql = "SELECT COUNT(DISTINCT ip) AS ips
FROM " . BB_BT_TRACKER . " FROM " . BB_BT_TRACKER . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
@ -343,16 +266,16 @@ if ($lp_info) {
AND seeder = $seeder AND seeder = $seeder
AND $ip_version != '$ip_sql'"; AND $ip_version != '$ip_sql'";
if (!$seeder && config()->get('tracker.leech_expire_factor')) { if (!$seeder && $bb_cfg['tracker']['leech_expire_factor']) {
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor')); $sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
} }
$sql .= " GROUP BY topic_id"; $sql .= " GROUP BY topic_id";
if ($row = DB()->fetch_row($sql)) { if ($row = DB()->fetch_row($sql)) {
if ($seeder && config()->get('tracker.limit_seed_ips') && $row['ips'] >= config()->get('tracker.limit_seed_ips')) { if ($seeder && $bb_cfg['tracker']['limit_seed_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_seed_ips']) {
msg_die('You can seed only from ' . config()->get('tracker.limit_seed_ips') . " IP's"); msg_die('You can seed only from ' . $bb_cfg['tracker']['limit_seed_ips'] . " IP's");
} elseif (!$seeder && config()->get('tracker.limit_leech_ips') && $row['ips'] >= config()->get('tracker.limit_leech_ips')) { } elseif (!$seeder && $bb_cfg['tracker']['limit_leech_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_leech_ips']) {
msg_die('You can leech only from ' . config()->get('tracker.limit_leech_ips') . " IP's"); msg_die('You can leech only from ' . $bb_cfg['tracker']['limit_leech_ips'] . " IP's");
} }
} }
} }
@ -376,7 +299,7 @@ $up_add = ($lp_info && $uploaded > $lp_info['uploaded']) ? $uploaded - $lp_info[
$down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0; $down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0;
// Gold/Silver releases // Gold/Silver releases
if (config()->get('tracker.gold_silver_enabled') && $down_add) { if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
if ($tor_type == TOR_TYPE_GOLD) { if ($tor_type == TOR_TYPE_GOLD) {
$down_add = 0; $down_add = 0;
} // Silver releases } // Silver releases
@ -386,7 +309,7 @@ if (config()->get('tracker.gold_silver_enabled') && $down_add) {
} }
// Freeleech // Freeleech
if (config()->get('tracker.freeleech') && $down_add) { if ($bb_cfg['tracker']['freeleech'] && $down_add) {
$down_add = 0; $down_add = 0;
} }
@ -426,6 +349,7 @@ if ($lp_info && empty($hybrid_unrecord)) {
} }
if ((!$lp_info || !$peer_info_updated) && !$stopped && empty($hybrid_unrecord)) { if ((!$lp_info || !$peer_info_updated) && !$stopped && empty($hybrid_unrecord)) {
$columns = "peer_hash, topic_id, user_id, $ip_version, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete, peer_id"; $columns = "peer_hash, topic_id, user_id, $ip_version, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete, peer_id";
$values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete, '$peer_id_sql'"; $values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete, '$peer_id_sql'";
@ -464,8 +388,8 @@ $output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
if (!$output) { if (!$output) {
// Retrieve peers // Retrieve peers
$numwant = (int)config()->get('tracker.numwant'); $numwant = (int)$bb_cfg['tracker']['numwant'];
$compact_mode = (config()->get('tracker.compact_mode') || !empty($compact)); $compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
$rowset = DB()->fetch_rowset(" $rowset = DB()->fetch_rowset("
SELECT ip, ipv6, port SELECT ip, ipv6, port
@ -480,6 +404,7 @@ if (!$output) {
} }
if ($compact_mode) { if ($compact_mode) {
$peers = ''; $peers = '';
$peers6 = ''; $peers6 = '';
@ -510,7 +435,7 @@ if (!$output) {
$seeders = $leechers = $client_completed = 0; $seeders = $leechers = $client_completed = 0;
if (config()->get('tracker.scrape')) { if ($bb_cfg['tracker']['scrape']) {
$row = DB()->fetch_row(" $row = DB()->fetch_row("
SELECT seeders, leechers, completed SELECT seeders, leechers, completed
FROM " . BB_BT_TRACKER_SNAP . " FROM " . BB_BT_TRACKER_SNAP . "
@ -525,6 +450,7 @@ if (!$output) {
$output = [ $output = [
'interval' => (int)$announce_interval, 'interval' => (int)$announce_interval,
'min interval' => (int)$announce_interval,
'complete' => (int)$seeders, 'complete' => (int)$seeders,
'incomplete' => (int)$leechers, 'incomplete' => (int)$leechers,
'downloaded' => (int)$client_completed, 'downloaded' => (int)$client_completed,

1
bt/includes/.htaccess Normal file
View file

@ -0,0 +1 @@
Require all denied

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,9 +11,11 @@ if (!defined('IN_TRACKER')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $bb_cfg;
// Exit if tracker is disabled // Exit if tracker is disabled
if (config()->get('tracker.bt_off')) { if ($bb_cfg['tracker']['bt_off']) {
msg_die(config()->get('tracker.bt_off_reason')); msg_die($bb_cfg['tracker']['bt_off_reason']);
} }
// //
@ -61,7 +63,6 @@ function dummy_exit($interval = 1800, $cache_dict = [])
$output = [ $output = [
'interval' => (int)$interval, 'interval' => (int)$interval,
'peers' => (string)DUMMY_PEER, 'peers' => (string)DUMMY_PEER,
'external ip' => inet_pton($_SERVER['REMOTE_ADDR']),
]; ];
if (!empty($cache_dict)) { if (!empty($cache_dict)) {

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,9 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../'); define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php'; require dirname(__DIR__) . '/common.php';
if (!config()->get('tracker.scrape')) { global $bb_cfg;
if (!$bb_cfg['tracker']['scrape']) {
msg_die('Please disable SCRAPE!'); msg_die('Please disable SCRAPE!');
} }
@ -30,18 +32,15 @@ if (!isset($info_hash)) {
// Store info hash in hex format // Store info hash in hex format
$info_hash_hex = bin2hex($info_hash); $info_hash_hex = bin2hex($info_hash);
// Check info_hash length
if (strlen($info_hash) !== 20) {
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
}
// Handle multiple hashes // Handle multiple hashes
preg_match_all('/info_hash=([^&]*)/i', $_SERVER['QUERY_STRING'], $info_hash_array); preg_match_all('/info_hash=([^&]*)/i', $_SERVER['QUERY_STRING'], $info_hash_array);
$torrents = []; $torrents = [];
$info_hashes = []; $info_hashes = [];
foreach ($info_hash_array[1] as $hash) { foreach ($info_hash_array[1] as $hash) {
$decoded_hash = urldecode($hash); $decoded_hash = urldecode($hash);
if (strlen($decoded_hash) !== 20) { if (strlen($decoded_hash) !== 20) {
@ -58,16 +57,18 @@ foreach ($info_hash_array[1] as $hash) {
$info_hash_count = count($info_hashes); $info_hash_count = count($info_hashes);
if (!empty($info_hash_count)) { if (!empty($info_hash_count)) {
if ($info_hash_count > config()->get('max_scrapes')) {
$info_hashes = array_slice($info_hashes, 0, config()->get('max_scrapes')); if ($info_hash_count > $bb_cfg['max_scrapes']) {
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
} }
$info_hashes_sql = implode('\', \'', $info_hashes); $info_hashes_sql = implode('\', \'', $info_hashes);
/** /**
* Currently torrent clients send truncated v2 hashes (the design raises questions). * Currently torrent clients send truncated v2 hashes (the design raises questions).
* @see https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343 * https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343
*/ */
$info_hash_where = "tor.info_hash IN ('$info_hashes_sql') OR SUBSTRING(tor.info_hash_v2, 1, 20) IN ('$info_hashes_sql')"; $info_hash_where = "tor.info_hash IN ('$info_hashes_sql') OR SUBSTRING(tor.info_hash_v2, 1, 20) IN ('$info_hashes_sql')";
$sql = " $sql = "
@ -95,9 +96,8 @@ if (!empty($info_hash_count)) {
} }
} }
// Verify if torrent registered on tracker
if (empty($torrents)) { if (empty($torrents)) {
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex)); msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
} }
die(\Arokettu\Bencode\Bencode::encode($torrents)); die(\Arokettu\Bencode\Bencode::encode($torrents));

View file

@ -1,126 +0,0 @@
# git-cliff ~ TorrentPier configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[remote.github]
owner = "torrentpier"
repo = "torrentpier"
[changelog]
# template for the changelog header
header = """
[![TorrentPier](https://raw.githubusercontent.com/torrentpier/.github/refs/heads/main/versions/Cattle.png)](https://github.com/torrentpier)\n
# 📖 Change Log\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{%- macro nightly_url() -%}
https://nightly.link/{{ remote.github.owner }}/{{ remote.github.repo }}/workflows/ci/master/TorrentPier-master
{%- endmacro -%}
{% macro print_commit(commit) -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endmacro -%}
{% if version %}\
{% if previous.version %}\
## [{{ version }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
## {{ version }} ({{ timestamp | date(format="%Y-%m-%d") }})
{% endif %}\
{% else %}\
## [nightly]({{ self::nightly_url() }})
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::print_commit(commit=commit) }}
{%- endfor %}
{% for commit in commits %}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor -%}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- endif %}
"""
# template for the changelog footer
footer = """
"""
# remove the leading and trailing whitespace from the templates
trim = true
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/torrentpier/torrentpier" }, # replace repository URL
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/pull/${2}))" },
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
# { pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^ignore|^release|^changelog", skip = true },
{ message = "^chore|^ci|^misc", group = "<!-- 7 -->⚙️ Miscellaneous" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
{ message = "^crowdin|^crodwin", group = "<!-- 10 -->🈳 New translations" }, # crowdin pulls supporting
{ message = "^Composer", group = "<!-- 11 -->📦 Dependencies" }, # dependabot pulls supporting
{ message = "^rem|^drop|^removed", group = "<!-- 12 -->🗑️ Removed" },
{ message = ".*", group = "<!-- 13 -->💼 Other" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9].*"
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -39,22 +39,18 @@ if (!defined('BB_SCRIPT')) {
} }
header('X-Frame-Options: SAMEORIGIN'); header('X-Frame-Options: SAMEORIGIN');
date_default_timezone_set('UTC');
// Set remote address // Cloudflare
$allowedCDNs = ['HTTP_X_FORWARDED_FOR', 'HTTP_FASTLY_CLIENT_IP', 'HTTP_CF_CONNECTING_IP']; if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
foreach ($allowedCDNs as $allowedCDN) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
if (isset($_SERVER[$allowedCDN]) && filter_var($_SERVER[$allowedCDN], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$_SERVER['REMOTE_ADDR'] = $_SERVER[$allowedCDN];
}
} }
// Get all constants // Get all constants
require_once BB_PATH . '/library/defines.php'; require_once BB_PATH . '/library/defines.php';
// Composer // Composer
if (!is_file(BB_PATH . '/vendor/autoload.php')) { if (!file_exists(BB_PATH . '/vendor/autoload.php')) {
die('🔩 Manual install: <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">Install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>.<br/>☕️ Quick install: Run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">php install.php</code> in CLI mode.'); die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
} }
require_once BB_PATH . '/vendor/autoload.php'; require_once BB_PATH . '/vendor/autoload.php';
@ -62,10 +58,10 @@ require_once BB_PATH . '/vendor/autoload.php';
* Gets the value of an environment variable. * Gets the value of an environment variable.
* *
* @param string $key * @param string $key
* @param mixed|null $default * @param mixed $default
* @return mixed * @return mixed
*/ */
function env(string $key, mixed $default = null): mixed function env(string $key, $default = null)
{ {
return \TorrentPier\Env::get($key, $default); return \TorrentPier\Env::get($key, $default);
} }
@ -75,148 +71,118 @@ try {
$dotenv = Dotenv\Dotenv::createMutable(BB_PATH); $dotenv = Dotenv\Dotenv::createMutable(BB_PATH);
$dotenv->load(); $dotenv->load();
} catch (\Dotenv\Exception\InvalidPathException $pathException) { } catch (\Dotenv\Exception\InvalidPathException $pathException) {
die('🔩 Manual install: Rename from <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">.env.example</code> to <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">.env</code>, and configure it.<br/>☕️ Quick install: Run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">php install.php</code> in CLI mode.'); die('Please rename from <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">.env.example</code> to <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">.env</code>, and configure it');
} }
// Load config // Load config
require_once BB_PATH . '/library/config.php'; require_once BB_PATH . '/library/config.php';
// Local config // Local config
if (is_file(BB_PATH . '/library/config.local.php')) { if (file_exists(BB_PATH . '/library/config.local.php')) {
require_once BB_PATH . '/library/config.local.php'; require_once BB_PATH . '/library/config.local.php';
} }
/** @noinspection PhpUndefinedVariableInspection */
// Initialize Config singleton, bb_cfg from global file config
$config = \TorrentPier\Config::init($bb_cfg);
/** /**
* Get the Config instance * Progressive error reporting
*
* @return \TorrentPier\Config
*/ */
function config(): \TorrentPier\Config \TorrentPier\Dev::initDebug();
{
return \TorrentPier\Config::getInstance();
}
/**
* Get the Censor instance
*
* @return \TorrentPier\Censor
*/
function censor(): \TorrentPier\Censor
{
return \TorrentPier\Censor::getInstance();
}
/**
* Get the Dev instance
*
* @return \TorrentPier\Dev
*/
function dev(): \TorrentPier\Dev
{
return \TorrentPier\Dev::getInstance();
}
/**
* Get the Language instance
*
* @return \TorrentPier\Language
*/
function lang(): \TorrentPier\Language
{
return \TorrentPier\Language::getInstance();
}
/**
* Get a language string (shorthand for lang()->get())
*
* @param string $key Language key, supports dot notation (e.g., 'DATETIME.TODAY')
* @param mixed $default Default value if key doesn't exist
* @return mixed Language string or default value
*/
function __(string $key, mixed $default = null): mixed
{
return \TorrentPier\Language::getInstance()->get($key, $default);
}
/**
* Echo a language string (shorthand for echo __())
*
* @param string $key Language key, supports dot notation
* @param mixed $default Default value if key doesn't exist
* @return void
*/
function _e(string $key, mixed $default = null): void
{
echo \TorrentPier\Language::getInstance()->get($key, $default);
}
/**
* Initialize debug
*/
define('APP_ENV', env('APP_ENV', 'production'));
if (APP_ENV === 'development') {
define('DBG_USER', true); // forced debug
} else {
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
}
(\TorrentPier\Dev::init());
/** /**
* Server variables initialize * Server variables initialize
*/ */
$server_protocol = config()->get('cookie_secure') ? 'https://' : 'http://'; $server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
$server_port = in_array((int)config()->get('server_port'), [80, 443], true) ? '' : ':' . config()->get('server_port'); $server_port = in_array((int)$bb_cfg['server_port'], [80, 443], true) ? '' : ':' . $bb_cfg['server_port'];
define('FORUM_PATH', config()->get('script_path')); define('FORUM_PATH', $bb_cfg['script_path']);
define('FULL_URL', $server_protocol . config()->get('server_name') . $server_port . config()->get('script_path')); define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
unset($server_protocol, $server_port); unset($server_protocol, $server_port);
// Initialize the new DB factory with database configuration // Board / tracker shared constants and functions
TorrentPier\Database\DatabaseFactory::init(config()->get('db'), config()->get('db_alias', [])); define('BB_BT_TORRENTS', 'bb_bt_torrents');
define('BB_BT_TRACKER', 'bb_bt_tracker');
define('BB_BT_TRACKER_SNAP', 'bb_bt_tracker_snap');
define('BB_BT_USERS', 'bb_bt_users');
define('BT_AUTH_KEY_LENGTH', 20);
define('DL_STATUS_RELEASER', -1);
define('DL_STATUS_DOWN', 0);
define('DL_STATUS_COMPLETE', 1);
define('DL_STATUS_CANCEL', 3);
define('DL_STATUS_WILL', 4);
define('TOR_TYPE_GOLD', 1);
define('TOR_TYPE_SILVER', 2);
define('GUEST_UID', -1);
define('BOT_UID', -746);
/** /**
* Get the Database instance * Database
*
* @param string $db_alias
* @return \TorrentPier\Database\Database
*/ */
function DB(string $db_alias = 'db'): \TorrentPier\Database\Database $DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
{
return TorrentPier\Database\DatabaseFactory::getInstance($db_alias);
}
// Initialize Unified Cache System function DB(string $db_alias = 'db')
TorrentPier\Cache\UnifiedCacheSystem::getInstance(config()->all());
/**
* Get cache manager instance (replaces legacy cache system)
*
* @param string $cache_name
* @return \TorrentPier\Cache\CacheManager
*/
function CACHE(string $cache_name): \TorrentPier\Cache\CacheManager
{ {
return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->get_cache_obj($cache_name); global $DBS;
return $DBS->get_db_obj($db_alias);
} }
/** /**
* Get datastore manager instance (replaces legacy datastore system) * Cache
*
* @return \TorrentPier\Cache\DatastoreManager
*/ */
function datastore(): \TorrentPier\Cache\DatastoreManager $CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
function CACHE(string $cache_name)
{ {
return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->getDatastore(config()->get('datastore_type', 'file')); global $CACHES;
return $CACHES->get_cache_obj($cache_name);
} }
/** /**
* Backward compatibility: Global datastore variable * Datastore
* This allows existing code to continue using global $datastore
*/ */
$datastore = datastore(); switch ($bb_cfg['datastore_type']) {
case 'memcache':
$datastore = new TorrentPier\Legacy\Datastore\Memcache($bb_cfg['cache']['memcache'], $bb_cfg['cache']['prefix']);
break;
case 'sqlite':
$default_cfg = [
'db_file_path' => $bb_cfg['cache']['db_dir'] . 'datastore.sqlite.db',
'pconnect' => true,
'con_required' => true,
];
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, $bb_cfg['cache']['prefix']);
break;
case 'redis':
$datastore = new TorrentPier\Legacy\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
break;
case 'filecache':
default:
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
}
if (CHECK_REQIREMENTS['status'] && !CACHE('bb_cache')->get('system_req')) {
// [1] Check PHP Version
if (!\TorrentPier\Helpers\IsHelper::isPHP(CHECK_REQIREMENTS['php_min_version'])) {
die("TorrentPier requires PHP version " . CHECK_REQIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION);
}
// [2] Check installed PHP Extensions on server
$data = [];
foreach (CHECK_REQIREMENTS['ext_list'] as $ext) {
if (!extension_loaded($ext)) {
$data[] = '<code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">' . $ext . '</code>';
}
}
if (!empty($data)) {
die(sprintf("TorrentPier requires %s extension(s) installed on server", implode(', ', $data)));
}
CACHE('bb_cache')->set('system_req', true);
}
// Functions // Functions
function utime() function utime()
@ -224,7 +190,7 @@ function utime()
return array_sum(explode(' ', microtime())); return array_sum(explode(' ', microtime()));
} }
function bb_log($msg, $file_name = 'logs', $return_path = false) function bb_log($msg, $file_name, $return_path = false)
{ {
if (is_array($msg)) { if (is_array($msg)) {
$msg = implode(LOG_LF, $msg); $msg = implode(LOG_LF, $msg);
@ -244,15 +210,14 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
$bytes_written = false; $bytes_written = false;
clearstatcache(); clearstatcache();
if (is_file($file) && ($max_size && (filesize($file) >= $max_size))) { if (($max_size && file_exists($file) && is_file($file)) && filesize($file) >= $max_size) {
$file_parts = pathinfo($file); $file_parts = pathinfo($file);
$new_name = ($file_parts['dirname'] . '/' . $file_parts['filename'] . '_[old]_' . date('Y-m-d_H-i-s_') . getmypid() . '.' . $file_parts['extension']); $new_name = ($file_parts['dirname'] . '/' . $file_parts['filename'] . '_[old]_' . date('Y-m-d_H-i-s_') . getmypid() . '.' . $file_parts['extension']);
clearstatcache(); clearstatcache();
if (!is_file($new_name)) { if (!file_exists($new_name) && !is_file($new_name)) {
rename($file, $new_name); rename($file, $new_name);
} }
} }
clearstatcache(); clearstatcache();
if (bb_mkdir(dirname($file))) { if (bb_mkdir(dirname($file))) {
if ($fp = fopen($file, 'ab+')) { if ($fp = fopen($file, 'ab+')) {
@ -288,11 +253,6 @@ function mkdir_rec($path, $mode): bool
return mkdir_rec(dirname($path), $mode) && mkdir($path, $mode); return mkdir_rec(dirname($path), $mode) && mkdir($path, $mode);
} }
function verify_id($id, $length): bool
{
return (is_string($id) && preg_match('#^[a-zA-Z0-9]{' . $length . '}$#', $id));
}
function clean_filename($fname) function clean_filename($fname)
{ {
static $s = ['\\', '/', ':', '*', '?', '"', '<', '>', '|', ' ']; static $s = ['\\', '/', ':', '*', '?', '"', '<', '>', '|', ' '];
@ -308,7 +268,7 @@ function clean_filename($fname)
* @param ?string $charset * @param ?string $charset
* @return string * @return string
*/ */
function htmlCHR($txt, bool $double_encode = false, int $quote_style = ENT_QUOTES, ?string $charset = DEFAULT_CHARSET): string function htmlCHR($txt, bool $double_encode = false, int $quote_style = ENT_QUOTES, ?string $charset = 'UTF-8'): string
{ {
return (string)htmlspecialchars($txt ?? '', $quote_style, $charset, $double_encode); return (string)htmlspecialchars($txt ?? '', $quote_style, $charset, $double_encode);
} }
@ -319,7 +279,7 @@ function htmlCHR($txt, bool $double_encode = false, int $quote_style = ENT_QUOTE
*/ */
function str_compact($str) function str_compact($str)
{ {
return preg_replace('/\s\s+/', ' ', trim($str ?? '')); return preg_replace('#\s+#u', ' ', trim($str ?? ''));
} }
/** /**
@ -329,7 +289,6 @@ function str_compact($str)
* *
* @param int $length * @param int $length
* @return string * @return string
* @throws Exception
*/ */
function make_rand_str(int $length = 10): string function make_rand_str(int $length = 10): string
{ {
@ -343,32 +302,8 @@ function make_rand_str(int $length = 10): string
return $randomString; return $randomString;
} }
/** function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false)
* Calculates user ratio
*
* @param array $btu
* @return float|null
*/
function get_bt_ratio(array $btu): ?float
{ {
return
(!empty($btu['u_down_total']) && $btu['u_down_total'] > MIN_DL_FOR_RATIO)
? round((($btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus']) / $btu['u_down_total']), 2)
: null;
}
function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false, $timeout = false)
{
if ($timeout) {
static $recursions = 0;
if (time() > (TIMENOW + $timeout)) {
return [
'timeout' => true,
'recs' => $recursions
];
}
$recursions++;
}
if (is_array($var)) { if (is_array($var)) {
foreach ($var as $k => $v) { foreach ($var as $k => $v) {
if (is_array($v)) { if (is_array($v)) {
@ -377,7 +312,7 @@ function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false, $
} elseif ($array_only) { } elseif ($array_only) {
$var[$k] = $fn($v); $var[$k] = $fn($v);
} else { } else {
array_deep($var[$k], $fn, timeout: $timeout); array_deep($var[$k], $fn);
} }
} elseif (!$array_only) { } elseif (!$array_only) {
$var[$k] = $fn($v); $var[$k] = $fn($v);
@ -399,12 +334,6 @@ function hide_bb_path(string $path): string
return ltrim(str_replace(BB_PATH, '', $path), '/\\'); return ltrim(str_replace(BB_PATH, '', $path), '/\\');
} }
/**
* Returns memory usage statistic
*
* @param string $param
* @return int|void
*/
function sys(string $param) function sys(string $param)
{ {
switch ($param) { switch ($param) {
@ -417,15 +346,6 @@ function sys(string $param)
} }
} }
/**
* Some shared defines
*/
// Initialize demo mode
define('IN_DEMO_MODE', env('APP_DEMO_MODE', false));
// Ratio status
define('RATIO_ENABLED', TR_RATING_LIMITS && MIN_DL_FOR_RATIO > 0);
// Initialization // Initialization
if (!defined('IN_TRACKER')) { if (!defined('IN_TRACKER')) {
// Init board // Init board
@ -433,24 +353,24 @@ if (!defined('IN_TRACKER')) {
} else { } else {
define('DUMMY_PEER', pack('Nn', \TorrentPier\Helpers\IPHelper::ip2long($_SERVER['REMOTE_ADDR']), !empty($_GET['port']) ? (int)$_GET['port'] : random_int(1000, 65000))); define('DUMMY_PEER', pack('Nn', \TorrentPier\Helpers\IPHelper::ip2long($_SERVER['REMOTE_ADDR']), !empty($_GET['port']) ? (int)$_GET['port'] : random_int(1000, 65000)));
define('PEER_HASH_EXPIRE', round(config()->get('announce_interval') * (0.85 * config()->get('tracker.expire_factor')))); define('PEER_HASH_EXPIRE', round($bb_cfg['announce_interval'] * (0.85 * $bb_cfg['tracker']['expire_factor'])));
define('PEERS_LIST_EXPIRE', round(config()->get('announce_interval') * 0.7)); define('PEERS_LIST_EXPIRE', round($bb_cfg['announce_interval'] * 0.7));
define('SCRAPE_LIST_EXPIRE', round(config()->get('scrape_interval') * 0.7)); define('SCRAPE_LIST_EXPIRE', round($bb_cfg['scrape_interval'] * 0.7));
define('PEER_HASH_PREFIX', 'peer_'); define('PEER_HASH_PREFIX', 'peer_');
define('PEERS_LIST_PREFIX', 'peers_list_'); define('PEERS_LIST_PREFIX', 'peers_list_');
define('SCRAPE_LIST_PREFIX', 'scrape_list_'); define('SCRAPE_LIST_PREFIX', 'scrape_list_');
// Init tracker
require_once BB_PATH . '/bt/includes/init_tr.php';
header('Content-Type: text/plain'); header('Content-Type: text/plain');
header('Pragma: no-cache'); header('Pragma: no-cache');
if (!defined('IN_ADMIN')) { if (!defined('IN_ADMIN')) {
// Exit if tracker is disabled via ON/OFF trigger // Exit if tracker is disabled via ON/OFF trigger
if (is_file(BB_DISABLED)) { if (file_exists(BB_DISABLED)) {
dummy_exit(random_int(60, 2400)); dummy_exit(random_int(60, 2400));
} }
} }
// Init tracker
require_once BB_PATH . '/bt/includes/init_tr.php';
} }

View file

@ -8,7 +8,7 @@
"torrent", "torrent",
"tracker" "tracker"
], ],
"homepage": "https://github.com/torrentpier", "homepage": "https://torrentpier.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -17,16 +17,6 @@
"homepage": "https://github.com/Exileum", "homepage": "https://github.com/Exileum",
"role": "Developer" "role": "Developer"
}, },
{
"name": "Diolektor",
"homepage": "https://github.com/diolektor",
"role": "Developer"
},
{
"name": "PheRum",
"homepage": "https://github.com/PheRum",
"role": "Developer"
},
{ {
"name": "belomaxorka", "name": "belomaxorka",
"email": "roman25052006.kelesh@gmail.com", "email": "roman25052006.kelesh@gmail.com",
@ -46,56 +36,34 @@
"forum": "https://torrentpier.com" "forum": "https://torrentpier.com"
}, },
"require": { "require": {
"php": ">=8.2", "php": "^8.1",
"arokettu/bencode": "^4.1.0", "arokettu/bencode": "^4.1.0",
"arokettu/monsterid": "^4.1.0",
"arokettu/random-polyfill": "1.0.2",
"arokettu/torrent-file": "^5.2.1",
"belomaxorka/captcha": "1.*",
"bugsnag/bugsnag": "^v3.29.1", "bugsnag/bugsnag": "^v3.29.1",
"claviska/simpleimage": "^4.0",
"egulias/email-validator": "^4.0.1", "egulias/email-validator": "^4.0.1",
"filp/whoops": "^2.15", "filp/whoops": "^2.15",
"gemorroj/m3u-parser": "^6.0.1",
"gigablah/sphinxphp": "2.0.8", "gigablah/sphinxphp": "2.0.8",
"google/recaptcha": "^1.3", "google/recaptcha": "^1.3",
"jacklul/monolog-telegram": "^3.1", "guzzlehttp/guzzle": "^7.8",
"guzzlehttp/psr7": "^2.6",
"josantonius/cookie": "^2.0", "josantonius/cookie": "^2.0",
"league/flysystem": "^3.28",
"longman/ip-tools": "1.2.1", "longman/ip-tools": "1.2.1",
"monolog/monolog": "^3.4", "monolog/monolog": "^3.4",
"nette/caching": "^3.3",
"nette/database": "^3.2",
"php-curl-class/php-curl-class": "^12.0.0",
"robmorgan/phinx": "^0.16.9",
"samdark/sitemap": "2.4.1", "samdark/sitemap": "2.4.1",
"symfony/mailer": "^7.3", "symfony/mailer": "^6.3",
"symfony/polyfill": "v1.32.0", "symfony/polyfill": "v1.28.0",
"vlucas/phpdotenv": "^5.5", "vlucas/phpdotenv": "^5.5"
"z4kn4fein/php-semver": "^v3.0.0"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "^1.6", "symfony/var-dumper": "^6.3"
"pestphp/pest": "^3.8",
"symfony/var-dumper": "^7.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"TorrentPier\\": "src/" "TorrentPier\\": "src/"
} }
}, },
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": { "config": {
"sort-packages": true, "sort-packages": true,
"optimize-autoloader": true, "optimize-autoloader": false
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true "prefer-stable": true

5680
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Before After
Before After

View file

@ -0,0 +1,3 @@
php_flag engine off
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
AddType text/plain .php .php .htm .html .phtml .pl .asp

74
dl.php
View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -20,28 +20,26 @@ $datastore->enqueue([
$download_id = request_var('id', 0); $download_id = request_var('id', 0);
$thumbnail = request_var('thumb', 0); $thumbnail = request_var('thumb', 0);
$m3u = isset($_GET['m3u']) && $_GET['m3u'];
// Send file to browser // Send file to browser
function send_file_to_browser($attachment, $upload_dir) function send_file_to_browser($attachment, $upload_dir)
{ {
global $lang; global $bb_cfg, $lang;
$filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];
$filename = $upload_dir . '/' . $attachment['physical_filename'];
$gotit = false; $gotit = false;
if (is_file(realpath($filename))) { if (@!file_exists(@amod_realpath($filename))) {
$gotit = true;
} else {
bb_die($lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($filename)); bb_die($lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($filename));
} else {
$gotit = true;
} }
// Correct the mime type - we force application/octet-stream for all files, except images // Correct the mime type - we force application/octet-stream for all files, except images
// Please do not change this, it is a security precaution // Please do not change this, it is a security precaution
if (!str_contains($attachment['mimetype'], 'image')) { if (!str_contains($attachment['mimetype'], 'image')) {
$attachment['mimetype'] = 'application/octet-stream'; $attachment['mimetype'] = 'application/octet-stream';
} else {
header('Cache-Control: public, max-age=3600');
} }
//bt //bt
@ -53,7 +51,7 @@ function send_file_to_browser($attachment, $upload_dir)
header('Pragma: public'); header('Pragma: public');
$real_filename = clean_filename(basename($attachment['real_filename'])); $real_filename = clean_filename(basename($attachment['real_filename']));
$mimetype = $attachment['mimetype'] . ';'; $mimetype = $attachment['mimetype'] . ';';
$charset = 'charset=' . DEFAULT_CHARSET . ';'; $charset = "charset={$bb_cfg['charset']};";
// Send out the Headers // Send out the Headers
header("Content-Type: $mimetype $charset name=\"$real_filename\""); header("Content-Type: $mimetype $charset name=\"$real_filename\"");
@ -62,7 +60,7 @@ function send_file_to_browser($attachment, $upload_dir)
// Now send the File Contents to the Browser // Now send the File Contents to the Browser
if ($gotit) { if ($gotit) {
$size = filesize($filename); $size = @filesize($filename);
if ($size) { if ($size) {
header("Content-length: $size"); header("Content-length: $size");
} }
@ -101,20 +99,6 @@ if (!($attachment = DB()->sql_fetchrow($result))) {
$attachment['physical_filename'] = basename($attachment['physical_filename']); $attachment['physical_filename'] = basename($attachment['physical_filename']);
if ($thumbnail) {
// Re-define $attachment['physical_filename'] for thumbnails
$attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename'];
} elseif ($m3u) {
// Check m3u file exist
if (!$m3uFile = (new \TorrentPier\TorrServerAPI())->getM3UPath($download_id)) {
bb_die($lang['ERROR_NO_ATTACHMENT']);
}
$attachment['physical_filename'] = $attachment['real_filename'] = basename($m3uFile);
$attachment['mimetype'] = mime_content_type($m3uFile);
$attachment['extension'] = str_replace('.', '', \TorrentPier\TorrServerAPI::M3U['extension']);
}
DB()->sql_freeresult($result); DB()->sql_freeresult($result);
// get forum_id for attachment authorization or private message authorization // get forum_id for attachment authorization or private message authorization
@ -153,15 +137,14 @@ for ($i = 0; $i < $num_auth_pages && $authorised == false; $i++) {
} }
} }
// Check the auth rights
if (!$authorised) { if (!$authorised) {
bb_die($lang['SORRY_AUTH_VIEW_ATTACH'], 403); bb_die($lang['SORRY_AUTH_VIEW_ATTACH']);
} }
$datastore->rm('cat_forums'); $datastore->rm('cat_forums');
// Check tor status // Check tor status
if (!IS_AM && ($attachment['mimetype'] === TORRENT_MIMETYPE)) { if (!IS_AM) {
$sql = 'SELECT tor_status, poster_id FROM ' . BB_BT_TORRENTS . ' WHERE attach_id = ' . (int)$attachment['attach_id']; $sql = 'SELECT tor_status, poster_id FROM ' . BB_BT_TORRENTS . ' WHERE attach_id = ' . (int)$attachment['attach_id'];
if (!($result = DB()->sql_query($sql))) { if (!($result = DB()->sql_query($sql))) {
@ -170,7 +153,7 @@ if (!IS_AM && ($attachment['mimetype'] === TORRENT_MIMETYPE)) {
$row = DB()->sql_fetchrow($result); $row = DB()->sql_fetchrow($result);
if (isset(config()->get('tor_frozen')[$row['tor_status']]) && !(isset(config()->get('tor_frozen_author_download')[$row['tor_status']]) && $userdata['user_id'] === $row['poster_id'])) { if (isset($bb_cfg['tor_frozen'][$row['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$row['tor_status']]) && $userdata['user_id'] === $row['poster_id'])) {
bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]); bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]);
} }
@ -184,27 +167,23 @@ $num_rows = count($rows);
$allowed_extensions = $download_mode = []; $allowed_extensions = $download_mode = [];
for ($i = 0; $i < $num_rows; $i++) { for ($i = 0; $i < $num_rows; $i++) {
$extension = strtolower(trim($rows[$i]['extension'])); $extension = strtolower(trim($rows[$i]['extension']));
// Get allowed extensions
if ((int)$rows[$i]['allow_group'] === 1) {
$allowed_extensions[] = $extension; $allowed_extensions[] = $extension;
}
$download_mode[$extension] = $rows[$i]['download_mode']; $download_mode[$extension] = $rows[$i]['download_mode'];
} }
// Disallowed // Disallowed
if (!in_array($attachment['extension'], $allowed_extensions) && !IS_ADMIN) { if (!in_array($attachment['extension'], $allowed_extensions)) {
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['FILENAME'] . ":&nbsp;" . $attachment['physical_filename']); bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['FILENAME'] . ":&nbsp;" . $attachment['physical_filename']);
} }
// Getting download mode by extension $download_mode = (int)$download_mode[$attachment['extension']];
if (isset($download_mode[$attachment['extension']])) {
$download_mode = (int)$download_mode[$attachment['extension']]; if ($thumbnail) {
} else { $attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename'];
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['FILENAME'] . ":&nbsp;" . $attachment['physical_filename']);
} }
// Update download count // Update download count
if (!$m3u && !$thumbnail && is_file(realpath($upload_dir . '/' . $attachment['physical_filename']))) { if (!$thumbnail) {
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET download_count = download_count + 1 WHERE attach_id = ' . (int)$attachment['attach_id']; $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET download_count = download_count + 1 WHERE attach_id = ' . (int)$attachment['attach_id'];
if (!DB()->sql_query($sql)) { if (!DB()->sql_query($sql)) {
@ -213,13 +192,13 @@ if (!$m3u && !$thumbnail && is_file(realpath($upload_dir . '/' . $attachment['ph
} }
// Determine the 'presenting'-method // Determine the 'presenting'-method
switch ($download_mode) { if ($download_mode == PHYSICAL_LINK) {
case PHYSICAL_LINK:
$url = make_url($upload_dir . '/' . $attachment['physical_filename']); $url = make_url($upload_dir . '/' . $attachment['physical_filename']);
header('Location: ' . $url); header('Location: ' . $url);
exit; exit;
case INLINE_LINK: }
if (IS_GUEST && !config()->get('captcha.disabled') && !bb_captcha('check')) {
if (IS_GUEST && !$bb_cfg['captcha']['disabled'] && !bb_captcha('check')) {
global $template; global $template;
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/'; $redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
@ -235,10 +214,7 @@ switch ($download_mode) {
require(PAGE_HEADER); require(PAGE_HEADER);
require(PAGE_FOOTER); require(PAGE_FOOTER);
}
send_file_to_browser($attachment, $upload_dir);
exit;
default:
bb_die('Incorrect download mode: ' . $download_mode);
} }
send_file_to_browser($attachment, $upload_dir);
exit;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,8 +11,8 @@ define('BB_SCRIPT', 'dl_list');
require __DIR__ . '/common.php'; require __DIR__ . '/common.php';
$forum_id = $_REQUEST[POST_FORUM_URL] ?? 0; $forum_id = isset($_REQUEST[POST_FORUM_URL]) ? (int)$_REQUEST[POST_FORUM_URL] : 0;
$topic_id = $_REQUEST[POST_TOPIC_URL] ?? 0; $topic_id = isset($_REQUEST[POST_TOPIC_URL]) ? (int)$_REQUEST[POST_TOPIC_URL] : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : ''; $mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$confirmed = isset($_POST['confirm']); $confirmed = isset($_POST['confirm']);
@ -52,7 +52,7 @@ $user->session_start();
set_die_append_msg(); set_die_append_msg();
// Check if user logged in // Check if user logged in
if (IS_GUEST) { if (!$userdata['session_logged_in']) {
redirect(LOGIN_URL . "?redirect=$redirect_type&$redirect"); redirect(LOGIN_URL . "?redirect=$redirect_type&$redirect");
} }
@ -79,7 +79,7 @@ if ($mode == 'dl_delete' && $topic_id) {
if (!$confirmed) { if (!$confirmed) {
$hidden_fields = [ $hidden_fields = [
POST_TOPIC_URL => $topic_id, 't' => $topic_id,
'mode' => 'dl_delete', 'mode' => 'dl_delete',
]; ];

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -27,6 +27,7 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
if ($type == 'f') { if ($type == 'f') {
// Check if the user has actually sent a forum ID // Check if the user has actually sent a forum ID
$sql = "SELECT allow_reg_tracker, forum_name FROM " . BB_FORUMS . " WHERE forum_id = $id LIMIT 1"; $sql = "SELECT allow_reg_tracker, forum_name FROM " . BB_FORUMS . " WHERE forum_id = $id LIMIT 1";
//DIE($sql);
if (!$forum_data = DB()->fetch_row($sql)) { if (!$forum_data = DB()->fetch_row($sql)) {
if ($id == 0) { if ($id == 0) {
$forum_data = []; $forum_data = [];
@ -34,11 +35,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
bb_simple_die($lang['ATOM_ERROR'] . ' #1'); bb_simple_die($lang['ATOM_ERROR'] . ' #1');
} }
} }
if (is_file(config()->get('atom.path') . '/f/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/f/' . $id . '.atom') > $timecheck) { if (file_exists($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
redirect(config()->get('atom.url') . '/f/' . $id . '.atom'); redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else { } else {
if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) { if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
redirect(config()->get('atom.url') . '/f/' . $id . '.atom'); redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
} else { } else {
bb_simple_die($lang['ATOM_NO_FORUM']); bb_simple_die($lang['ATOM_NO_FORUM']);
} }
@ -52,11 +53,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
if (!$username = get_username($id)) { if (!$username = get_username($id)) {
bb_simple_die($lang['ATOM_ERROR'] . ' #3'); bb_simple_die($lang['ATOM_ERROR'] . ' #3');
} }
if (is_file(config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) { if (file_exists($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom'); redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else { } else {
if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) { if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) {
redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom'); redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else { } else {
bb_simple_die($lang['ATOM_NO_USER']); bb_simple_die($lang['ATOM_NO_USER']);
} }

View file

@ -1,117 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
define('BB_SCRIPT', 'filelist');
require __DIR__ . '/common.php';
// Start session management
$user->session_start();
if (config()->get('bt_disable_dht') && IS_GUEST) {
bb_die($lang['BT_PRIVATE_TRACKER'], 403);
}
$topic_id = isset($_GET[POST_TOPIC_URL]) ? (int)$_GET[POST_TOPIC_URL] : 0;
if (!$topic_id) {
bb_die($lang['INVALID_TOPIC_ID'], 404);
}
$sql = 'SELECT t.forum_id, t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_filename
FROM ' . BB_BT_TORRENTS . ' t
LEFT JOIN ' . BB_ATTACHMENTS_DESC . ' ad
ON t.attach_id = ad.attach_id
WHERE t.topic_id = ' . $topic_id . '
LIMIT 1';
if (!$row = DB()->fetch_row($sql)) {
bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
}
// Check rights
$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);
if (!$is_auth['auth_view']) {
bb_die($lang['SORRY_AUTH_VIEW_ATTACH'], 403);
}
// Protocol meta
$meta_v1 = !empty($row['info_hash']);
$meta_v2 = !empty($row['info_hash_v2']);
// Method fields
$t_version_field = $meta_v2 ? 'v2' : 'v1';
$t_files_field = $meta_v2 ? 'getFileTree' : 'getFiles';
$t_hash_field = $meta_v2 ? 'piecesRoot' : 'sha1';
$file_path = get_attachments_dir() . '/' . $row['physical_filename'];
if (!is_file($file_path)) {
bb_die($lang['TOR_NOT_FOUND'], 410);
}
$file_contents = file_get_contents($file_path);
if (config()->get('flist_max_files')) {
$filetree_pos = $meta_v2 ? strpos($file_contents, '9:file tree') : false;
$files_pos = $meta_v1 ? strpos($file_contents, '5:files', $filetree_pos) : false;
if ($filetree_pos) {
$file_count = substr_count($file_contents, '6:length', $filetree_pos, ($files_pos ? ($files_pos - $filetree_pos) : null));
} else {
$file_count = substr_count($file_contents, '6:length', $files_pos);
}
if ($file_count > config()->get('flist_max_files')) {
bb_die(sprintf($lang['BT_FLIST_LIMIT'], config()->get('flist_max_files'), $file_count), 410);
}
}
try {
$torrent = \Arokettu\Torrent\TorrentFile::loadFromString($file_contents);
} catch (\Exception $e) {
bb_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"), 410);
}
if (IS_GUEST && $torrent->isPrivate()) {
bb_die($lang['BT_PRIVATE_TORRENT'], 403);
}
// Get torrent files
$files = $torrent->$t_version_field()->$t_files_field();
if ($meta_v2) {
$files = new \RecursiveIteratorIterator($files); // Flatten the list
}
$files_count = 0;
foreach ($files as $file) {
$files_count++;
$row_class = ($files_count % 2) ? 'row1' : 'row2';
$template->assign_block_vars('filelist', [
'ROW_NUMBER' => $files_count,
'ROW_CLASS' => $row_class,
'FILE_PATH' => clean_tor_dirname(implode('/', $file->path)),
'FILE_LENGTH' => humn_size($file->length, 2),
'FILE_HASH' => $file->$t_hash_field ?? '-'
]);
}
$torrent_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN'];
$torrent_size = humn_size($row['size'], 2);
// Output page
$template->assign_vars([
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",
'FILES_COUNT' => sprintf($lang['BT_FLIST_FILE_PATH'], declension(iterator_count($files), 'files')),
'TORRENT_CREATION_DATE' => (!empty($dt = $torrent->getCreationDate()) && is_numeric($creation_date = $dt->getTimestamp())) ? date('d-M-Y H:i (e)', $creation_date) : $lang['UNKNOWN'],
'TORRENT_CLIENT' => !empty($creator = $torrent->getCreatedBy()) ? htmlCHR($creator) : $lang['UNKNOWN'],
'TORRENT_PRIVATE' => $torrent->isPrivate() ? $lang['YES'] : $lang['NO'],
'BTMR_NOTICE' => sprintf($lang['BT_FLIST_BTMR_NOTICE'], 'https://github.com/kovalensky/tmrr'),
'U_TOPIC' => TOPIC_URL . $topic_id,
]);
print_page('filelist.tpl');

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -24,7 +24,7 @@ set_die_append_msg();
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null; $group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0; $start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
$per_page = config()->get('group_members_per_page'); $per_page = $bb_cfg['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;
@ -103,7 +103,7 @@ if (!$group_id) {
$options = ''; $options = '';
foreach ($params as $name => $data) { foreach ($params as $name => $data) {
$text = str_short(rtrim(htmlCHR($name)), HTML_SELECT_MAX_LENGTH); $text = htmlCHR(str_short(rtrim($name), HTML_SELECT_MAX_LENGTH));
$members = ($data['m']) ? $lang['MEMBERS_IN_GROUP'] . ': ' . $data['m'] : $lang['NO_GROUP_MEMBERS']; $members = ($data['m']) ? $lang['MEMBERS_IN_GROUP'] . ': ' . $data['m'] : $lang['NO_GROUP_MEMBERS'];
$candidates = ($data['c']) ? $lang['PENDING_MEMBERS'] . ': ' . $data['c'] : $lang['NO_PENDING_GROUP_MEMBERS']; $candidates = ($data['c']) ? $lang['PENDING_MEMBERS'] . ': ' . $data['c'] : $lang['NO_PENDING_GROUP_MEMBERS'];
@ -162,13 +162,13 @@ if (!$group_id) {
bb_die($lang['NO_GROUPS_EXIST']); bb_die($lang['NO_GROUPS_EXIST']);
} }
if ($row['user_id']) { if ($row['user_id']) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['ALREADY_MEMBER_GROUP']); bb_die($lang['ALREADY_MEMBER_GROUP']);
} }
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW); \TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
if (config()->get('group_send_email')) { if ($bb_cfg['group_send_email']) {
// Sending email // Sending email
$emailer = new TorrentPier\Emailer(); $emailer = new TorrentPier\Emailer();
@ -185,12 +185,12 @@ if (!$group_id) {
$emailer->send(); $emailer->send();
} }
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['GROUP_JOINED']); bb_die($lang['GROUP_JOINED']);
} elseif (!empty($_POST['unsub']) || !empty($_POST['unsubpending'])) { } elseif (!empty($_POST['unsub']) || !empty($_POST['unsubpending'])) {
\TorrentPier\Legacy\Group::delete_user_group($group_id, $userdata['user_id']); \TorrentPier\Legacy\Group::delete_user_group($group_id, $userdata['user_id']);
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['UNSUB_SUCCESS']); bb_die($lang['UNSUB_SUCCESS']);
} else { } else {
// Handle Additions, removals, approvals and denials // Handle Additions, removals, approvals and denials
@ -198,33 +198,33 @@ if (!$group_id) {
if (!empty($_POST['add']) || !empty($_POST['remove']) || !empty($_POST['approve']) || !empty($_POST['deny'])) { if (!empty($_POST['add']) || !empty($_POST['remove']) || !empty($_POST['approve']) || !empty($_POST['deny'])) {
if (!$is_moderator) { if (!$is_moderator) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['NOT_GROUP_MODERATOR']); bb_die($lang['NOT_GROUP_MODERATOR']);
} }
if (!empty($_POST['add'])) { if (!empty($_POST['add'])) {
if (isset($_POST['username']) && !($row = get_userdata($_POST['username'], true))) { if (isset($_POST['username']) && !($row = get_userdata($_POST['username'], true))) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['COULD_NOT_ADD_USER']); bb_die($lang['COULD_NOT_ADD_USER']);
} }
// Prevent adding moderator // Prevent adding moderator
if ($row['user_id'] == $group_moderator) { if ($row['user_id'] == $group_moderator) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die(sprintf($lang['USER_IS_MOD_GROUP'], profile_url($row))); bb_die(sprintf($lang['USER_IS_MOD_GROUP'], profile_url($row)));
} }
// Prevent infinity user adding into group // Prevent infinity user adding into group
if ($is_member = DB()->fetch_row("SELECT user_id FROM " . BB_USER_GROUP . " WHERE group_id = $group_id AND user_id = " . $row['user_id'] . " LIMIT 1")) { if ($is_member = DB()->fetch_row("SELECT user_id FROM " . BB_USER_GROUP . " WHERE group_id = $group_id AND user_id = " . $row['user_id'] . " LIMIT 1")) {
if ($is_member['user_id']) { if ($is_member['user_id']) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die(sprintf($lang['USER_IS_MEMBER_GROUP'], profile_url($row))); bb_die(sprintf($lang['USER_IS_MEMBER_GROUP'], profile_url($row)));
} }
} }
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']); \TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
if (config()->get('group_send_email')) { if ($bb_cfg['group_send_email']) {
// Sending email // Sending email
$emailer = new TorrentPier\Emailer(); $emailer = new TorrentPier\Emailer();
@ -248,7 +248,7 @@ if (!$group_id) {
$sql_in[] = (int)$members_id; $sql_in[] = (int)$members_id;
} }
if (!$sql_in = implode(',', $sql_in)) { if (!$sql_in = implode(',', $sql_in)) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['NONE_SELECTED']); bb_die($lang['NONE_SELECTED']);
} }
@ -273,7 +273,7 @@ if (!$group_id) {
} }
} }
// Email users when they are approved // Email users when they are approved
if (!empty($_POST['approve']) && config()->get('group_send_email')) { if (!empty($_POST['approve']) && $bb_cfg['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 . "
WHERE user_id IN($sql_in)"; WHERE user_id IN($sql_in)";
@ -385,18 +385,16 @@ if (!$group_id) {
'MOD_AVATAR' => $moderator_info['avatar'], 'MOD_AVATAR' => $moderator_info['avatar'],
'MOD_FROM' => $moderator_info['from'], 'MOD_FROM' => $moderator_info['from'],
'MOD_JOINED' => $moderator_info['joined'], 'MOD_JOINED' => $moderator_info['joined'],
'MOD_JOINED_RAW' => $moderator_info['joined_raw'],
'MOD_POSTS' => $moderator_info['posts'], 'MOD_POSTS' => $moderator_info['posts'],
'MOD_PM' => $moderator_info['pm'], 'MOD_PM' => $moderator_info['pm'],
'MOD_EMAIL' => $moderator_info['email'], 'MOD_EMAIL' => $moderator_info['email'],
'MOD_WWW' => $moderator_info['www'], 'MOD_WWW' => $moderator_info['www'],
'MOD_TIME' => !empty($group_info['mod_time']) ? sprintf('%s <span class="signature">(%s)</span>', bb_date($group_info['mod_time']), delta_time($group_info['mod_time'])) : $lang['NONE'], 'MOD_TIME' => !empty($group_info['mod_time']) ? sprintf('%s <span class="signature">(%s)</span>', bb_date($group_info['mod_time']), delta_time($group_info['mod_time'])) : $lang['NONE'],
'MOD_TIME_RAW' => !empty($group_info['mod_time']) ? $group_info['mod_time'] : '',
'U_SEARCH_USER' => 'search.php?mode=searchuser', 'U_SEARCH_USER' => 'search.php?mode=searchuser',
'U_SEARCH_RELEASES' => "tracker.php?srg=$group_id", 'U_SEARCH_RELEASES' => "tracker.php?srg=$group_id",
'U_GROUP_RELEASES' => GROUP_URL . $group_id . "&view=releases", 'U_GROUP_RELEASES' => GROUP_URL . $group_id . "&view=releases",
'U_GROUP_MEMBERS' => GROUP_URL . $group_id . "&view=members", 'U_GROUP_MEMBERS' => GROUP_URL . $group_id . "&view=members",
'U_GROUP_CONFIG' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id", 'U_GROUP_CONFIG' => "group_edit.php?g=$group_id",
'RELEASE_GROUP' => (bool)$group_info['release_group'], 'RELEASE_GROUP' => (bool)$group_info['release_group'],
'GROUP_TYPE' => $group_type, 'GROUP_TYPE' => $group_type,
@ -418,7 +416,7 @@ if (!$group_id) {
// TODO Correct SQL to posts with attach and limit them, optimization // TODO Correct SQL to posts with attach and limit them, optimization
if (!$group_info['release_group']) { if (!$group_info['release_group']) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['NOT_A_RELEASE_GROUP']); bb_die($lang['NOT_A_RELEASE_GROUP']);
} }
@ -449,7 +447,7 @@ if (!$group_id) {
"; ";
if (!$releases = DB()->fetch_rowset($sql)) { if (!$releases = DB()->fetch_rowset($sql)) {
set_die_append_msg(group_id: $group_id); set_die_append_msg(false, false, $group_id);
bb_die($lang['NO_SEARCH_MATCH']); bb_die($lang['NO_SEARCH_MATCH']);
} }
@ -520,14 +518,12 @@ if (!$group_id) {
'AVATAR_IMG' => $member_info['avatar'], 'AVATAR_IMG' => $member_info['avatar'],
'FROM' => $member_info['from'], 'FROM' => $member_info['from'],
'JOINED' => $member_info['joined'], 'JOINED' => $member_info['joined'],
'JOINED_RAW' => $member_info['joined_raw'],
'POSTS' => $member_info['posts'], 'POSTS' => $member_info['posts'],
'USER_ID' => $user_id, 'USER_ID' => $user_id,
'PM' => $member_info['pm'], 'PM' => $member_info['pm'],
'EMAIL' => $member_info['email'], 'EMAIL' => $member_info['email'],
'WWW' => $member_info['www'], 'WWW' => $member_info['www'],
'TIME' => $member_info['user_time'], 'TIME' => $member_info['user_time']
'TIME_RAW' => $member_info['user_time_raw']
]); ]);
if ($is_moderator) { if ($is_moderator) {
@ -573,10 +569,9 @@ if (!$group_id) {
$template->assign_block_vars('pending', [ $template->assign_block_vars('pending', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'AVATAR_IMG' => $pending_info['avatar'], 'AVATAR_IMG' => $pending_info['avatar'],
'USER' => profile_url($member), 'USER' => profile_url($pending_info),
'FROM' => $pending_info['from'], 'FROM' => $pending_info['from'],
'JOINED' => $pending_info['joined'], 'JOINED' => $pending_info['joined'],
'JOINED_RAW' => $pending_info['joined_raw'],
'POSTS' => $pending_info['posts'], 'POSTS' => $pending_info['posts'],
'USER_ID' => $user_id, 'USER_ID' => $user_id,
'PM' => $pending_info['pm'], 'PM' => $pending_info['pm'],

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -35,15 +35,16 @@ if ($group_id) {
if ($is_moderator) { if ($is_moderator) {
// Avatar // Avatar
if ($submit) { if ($submit) {
if (!empty($_FILES['avatar']['name']) && config()->get('group_avatars.up_allowed')) { if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
$upload = new TorrentPier\Legacy\Common\Upload(); $upload = new TorrentPier\Legacy\Common\Upload();
if ($upload->init(config()->get('group_avatars'), $_FILES['avatar']) and $upload->store('avatar', ['user_id' => GROUP_AVATAR_MASK . $group_id, 'avatar_ext_id' => $group_info['avatar_ext_id']])) { if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) and $upload->store('avatar', ['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;
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
} else { } else {
bb_die(implode($upload->errors)); bb_die(implode($upload->errors));
} }
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
} }
} }
@ -76,7 +77,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'], config()->get('group_avatars.max_width'), config()->get('group_avatars.max_height'), humn_size(config()->get('group_avatars.max_size'))), 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], humn_size($bb_cfg['group_avatars']['max_size'])),
'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']),
]); ]);

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -31,25 +31,18 @@ $datastore->enqueue([
'cat_forums' 'cat_forums'
]); ]);
if (config()->get('show_latest_news')) { if ($bb_cfg['show_latest_news']) {
$datastore->enqueue([ $datastore->enqueue('latest_news');
'latest_news'
]);
} }
if (config()->get('show_network_news')) { if ($bb_cfg['show_network_news']) {
$datastore->enqueue([ $datastore->enqueue('network_news');
'network_news'
]);
} }
// Init userdata // Init userdata
$user->session_start(); $user->session_start();
// Set meta description
$page_cfg['meta_description'] = config()->get('site_desc');
// Init main vars // Init main vars
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0; $viewcat = isset($_GET['c']) ? (int)$_GET['c'] : 0;
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
// Caching output // Caching output
@ -57,7 +50,7 @@ $req_page = 'index_page';
$req_page .= $viewcat ? "_c{$viewcat}" : ''; $req_page .= $viewcat ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page); define('REQUESTED_PAGE', $req_page);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . config()->get('default_lang')); caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
$hide_cat_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0; $hide_cat_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0;
$hide_cat_user = array_flip(explode('-', $hide_cat_opt)); $hide_cat_user = array_flip(explode('-', $hide_cat_opt));
@ -68,15 +61,13 @@ $tracking_topics = get_tracks('topic');
$tracking_forums = get_tracks('forum'); $tracking_forums = get_tracks('forum');
// Statistics // Statistics
$stats = $datastore->get('stats'); if (!$stats = $datastore->get('stats')) {
if ($stats === false) {
$datastore->update('stats'); $datastore->update('stats');
$stats = $datastore->get('stats'); $stats = $datastore->get('stats');
} }
// Forums data // Forums data
$forums = $datastore->get('cat_forums'); if (!$forums = $datastore->get('cat_forums')) {
if ($forums === false) {
$datastore->update('cat_forums'); $datastore->update('cat_forums');
$forums = $datastore->get('cat_forums'); $forums = $datastore->get('cat_forums');
} }
@ -85,7 +76,6 @@ $forum_name_html = $forums['forum_name_html'];
$anon = GUEST_UID; $anon = GUEST_UID;
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW); $excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
$excluded_forums_array = $excluded_forums_csv ? explode(',', $excluded_forums_csv) : [];
$only_new = $user->opt_js['only_new']; $only_new = $user->opt_js['only_new'];
// Validate requested category id // Validate requested category id
@ -179,8 +169,7 @@ if (!$cat_forums = CACHE('bb_cache')->get($cache_name)) {
// Obtain list of moderators // Obtain list of moderators
$moderators = []; $moderators = [];
$mod = $datastore->get('moderators'); if (!$mod = $datastore->get('moderators')) {
if ($mod === false) {
$datastore->update('moderators'); $datastore->update('moderators');
$mod = $datastore->get('moderators'); $mod = $datastore->get('moderators');
} }
@ -261,8 +250,8 @@ foreach ($cat_forums as $cid => $c) {
$template->assign_block_vars('c.f.last', [ $template->assign_block_vars('c.f.last', [
'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' => 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'], config()->get('last_post_date_format')), 'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
'LAST_POST_USER' => profile_url(['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(['username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank']]),
]); ]);
} }
@ -278,7 +267,7 @@ $template->assign_vars([
'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' => config()->get('gender') ? sprintf( 'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
$lang['USERS_TOTAL_GENDER'], $lang['USERS_TOTAL_GENDER'],
$stats['male'], $stats['male'],
$stats['female'], $stats['female'],
@ -287,22 +276,22 @@ $template->assign_vars([
'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' => config()->get('tor_stats') ? sprintf( 'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
$lang['TORRENTS_STAT'], $lang['TORRENTS_STAT'],
$stats['torrentcount'], $stats['torrentcount'],
humn_size($stats['size']) humn_size($stats['size'])
) : '', ) : '',
'PEERS_STAT' => config()->get('tor_stats') ? sprintf( 'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
$lang['PEERS_STAT'], $lang['PEERS_STAT'],
$stats['peers'], $stats['peers'],
$stats['seeders'], $stats['seeders'],
$stats['leechers'] $stats['leechers']
) : '', ) : '',
'SPEED_STAT' => config()->get('tor_stats') ? sprintf( 'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf(
$lang['SPEED_STAT'], $lang['SPEED_STAT'],
humn_size($stats['speed']) . '/s' humn_size($stats['speed']) . '/s'
) : '', ) : '',
'SHOW_MOD_INDEX' => config()->get('show_mod_index'), 'SHOW_MOD_INDEX' => $bb_cfg['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'],
@ -315,21 +304,20 @@ $template->assign_vars([
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&amp;o=1", 'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&amp;o=1",
'U_SEARCH_LATEST' => 'search.php?search_id=latest', 'U_SEARCH_LATEST' => 'search.php?search_id=latest',
'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered', 'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered',
'U_ATOM_FEED' => is_file(config()->get('atom.path') . '/f/0.atom') ? make_url(config()->get('atom.url') . '/f/0.atom') : false, 'U_ATOM_FEED' => file_exists($bb_cfg['atom']['path'] . '/f/0.atom') ? make_url($bb_cfg['atom']['url'] . '/f/0.atom') : false,
'SHOW_LAST_TOPIC' => $show_last_topic, 'SHOW_LAST_TOPIC' => $show_last_topic,
'BOARD_START' => config()->get('show_board_start_index') ? ($lang['BOARD_STARTED'] . ':&nbsp;' . '<b>' . bb_date(config()->get('board_startdate')) . '</b>') : false, 'BOARD_START' => $bb_cfg['show_board_start_index'] ? ($lang['BOARD_STARTED'] . ':&nbsp;' . '<b>' . bb_date($bb_cfg['board_startdate']) . '</b>') : false,
]); ]);
// Set tpl vars for bt_userdata // Set tpl vars for bt_userdata
if (config()->get('bt_show_dl_stat_on_index') && !IS_GUEST) { if ($bb_cfg['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 (config()->get('show_latest_news')) { if ($bb_cfg['show_latest_news']) {
$latest_news = $datastore->get('latest_news'); if (!$latest_news = $datastore->get('latest_news')) {
if ($latest_news === false) {
$datastore->update('latest_news'); $datastore->update('latest_news');
$latest_news = $datastore->get('latest_news'); $latest_news = $datastore->get('latest_news');
} }
@ -337,13 +325,9 @@ if (config()->get('show_latest_news')) {
$template->assign_vars(['SHOW_LATEST_NEWS' => true]); $template->assign_vars(['SHOW_LATEST_NEWS' => true]);
foreach ($latest_news as $news) { foreach ($latest_news as $news) {
if (in_array($news['forum_id'], $excluded_forums_array)) {
continue;
}
$template->assign_block_vars('news', [ $template->assign_block_vars('news', [
'NEWS_TOPIC_ID' => $news['topic_id'], 'NEWS_TOPIC_ID' => $news['topic_id'],
'NEWS_TITLE' => str_short(censor()->censorString($news['topic_title']), config()->get('max_news_title')), 'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['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']),
]); ]);
@ -351,9 +335,8 @@ if (config()->get('show_latest_news')) {
} }
// Network news // Network news
if (config()->get('show_network_news')) { if ($bb_cfg['show_network_news']) {
$network_news = $datastore->get('network_news'); if (!$network_news = $datastore->get('network_news')) {
if ($network_news === false) {
$datastore->update('network_news'); $datastore->update('network_news');
$network_news = $datastore->get('network_news'); $network_news = $datastore->get('network_news');
} }
@ -361,20 +344,16 @@ if (config()->get('show_network_news')) {
$template->assign_vars(['SHOW_NETWORK_NEWS' => true]); $template->assign_vars(['SHOW_NETWORK_NEWS' => true]);
foreach ($network_news as $net) { foreach ($network_news as $net) {
if (in_array($net['forum_id'], $excluded_forums_array)) {
continue;
}
$template->assign_block_vars('net', [ $template->assign_block_vars('net', [
'NEWS_TOPIC_ID' => $net['topic_id'], 'NEWS_TOPIC_ID' => $net['topic_id'],
'NEWS_TITLE' => str_short(censor()->censorString($net['topic_title']), config()->get('max_net_title')), 'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['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 (config()->get('birthday_check_day') && config()->get('birthday_enabled')) { if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$week_list = $today_list = []; $week_list = $today_list = [];
$week_all = $today_all = false; $week_all = $today_all = false;
@ -388,9 +367,9 @@ if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>'; $week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>';
} }
$week_all = $week_all ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : ''; $week_all = $week_all ? '&nbsp;<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'], config()->get('birthday_check_day'), implode(', ', $week_list)) . $week_all; $week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
} else { } else {
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day')); $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
} }
if (!empty($stats['birthday_today_list'])) { if (!empty($stats['birthday_today_list'])) {
@ -416,8 +395,8 @@ if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
// Allow cron // Allow cron
if (IS_AM) { if (IS_AM) {
if (is_file(CRON_RUNNING)) { if (file_exists(CRON_RUNNING)) {
if (is_file(CRON_ALLOWED)) { if (file_exists(CRON_ALLOWED)) {
unlink(CRON_ALLOWED); unlink(CRON_ALLOWED);
} }
rename(CRON_RUNNING, CRON_ALLOWED); rename(CRON_RUNNING, CRON_ALLOWED);

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -16,9 +16,8 @@ $user->session_start();
$info = []; $info = [];
$htmlDir = LANG_DIR . 'html/'; $htmlDir = LANG_DIR . 'html/';
$show = isset($_REQUEST['show']) ? (string)$_REQUEST['show'] : '';
switch ($show) { switch ((string)$_REQUEST['show'] ?? 'not_found') {
case 'advert': case 'advert':
$info['title'] = $lang['ADVERT']; $info['title'] = $lang['ADVERT'];
$info['src'] = 'advert.html'; $info['src'] = 'advert.html';
@ -41,10 +40,10 @@ switch ($show) {
break; break;
} }
$require = is_file($htmlDir . $info['src']) ? ($htmlDir . $info['src']) : false; $require = file_exists($htmlDir . $info['src']) ? ($htmlDir . $info['src']) : false;
$template->assign_vars([ $template->assign_vars([
'PAGE_TITLE' => mb_strtoupper($info['title'], DEFAULT_CHARSET), 'PAGE_TITLE' => mb_strtoupper($info['title'], 'UTF-8'),
'REQUIRE' => $require ? file_get_contents($require) : $lang['NOT_FOUND'], 'REQUIRE' => $require ? file_get_contents($require) : $lang['NOT_FOUND'],
]); ]);

View file

@ -1,331 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('BB_PATH', BB_ROOT);
// Check CLI mode
if (PHP_SAPI != 'cli') {
die('Please run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">php ' . basename(__FILE__) . '</code> in CLI mode');
}
// Get all constants
require_once BB_ROOT . 'library/defines.php';
// Include CLI functions
require INC_DIR . '/functions_cli.php';
/**
* System requirements
*/
const CHECK_REQUIREMENTS = [
'php_min_version' => '8.2.0',
'ext_list' => [
'json',
'curl',
'readline',
'mysqli',
'bcmath',
'mbstring',
'intl',
'xml',
'xmlwriter',
'zip',
'gd'
],
];
// Welcoming message
out("--- TorrentPier Installer ---\n", 'info');
// Checking extensions
out("- Checking installed extensions...", 'info');
// [1] Check PHP Version
if (!version_compare(PHP_VERSION, CHECK_REQUIREMENTS['php_min_version'], '>=')) {
out("- TorrentPier requires PHP version " . CHECK_REQUIREMENTS['php_min_version'] . "+ Your PHP version " . PHP_VERSION, 'warning');
}
// [2] Check installed PHP Extensions on server
foreach (CHECK_REQUIREMENTS['ext_list'] as $ext) {
if (!extension_loaded($ext)) {
out("- ext-$ext not installed. Check out php.ini file", 'error');
if (!defined('EXTENSIONS_NOT_INSTALLED')) {
define('EXTENSIONS_NOT_INSTALLED', true);
}
} else {
out("- ext-$ext installed!");
}
}
if (!defined('EXTENSIONS_NOT_INSTALLED')) {
out("- All extensions are installed!\n", 'success');
} else {
exit;
}
// Check if already installed
if (is_file(BB_ROOT . '.env')) {
out('- TorrentPier already installed', 'warning');
echo 'Are you sure want to re-install TorrentPier? [y/N]: ';
if (str_starts_with(mb_strtolower(trim(readline())), 'y')) {
out("\n- Re-install process started...", 'info');
// environment
if (is_file(BB_ROOT . '.env')) {
if (unlink(BB_ROOT . '.env')) {
out('- Environment file successfully removed!');
} else {
out('- Cannot remove environment (.env) file. Delete it manually', 'error');
exit;
}
}
// composer.phar
if (is_file(BB_ROOT . 'composer.phar')) {
if (unlink(BB_ROOT . 'composer.phar')) {
out("- composer.phar file successfully removed!");
} else {
out('- Cannot remove composer.phar file. Delete it manually', 'error');
exit;
}
}
// composer dir
if (is_dir(BB_ROOT . 'vendor')) {
removeDir(BB_ROOT . 'vendor', true);
if (!is_dir(BB_ROOT . 'vendor')) {
out("- Composer directory successfully removed!");
} else {
out('- Cannot remove Composer directory. Delete it manually', 'error');
exit;
}
}
out("- Re-install process completed!\n", 'success');
out('- Starting installation...', 'info');
} else {
exit;
}
}
// Applying permissions
out("- Applying permissions for folders...", 'info');
chmod_r(BB_ROOT . 'data', 0755, 0644);
chmod_r(BB_ROOT . 'internal_data', 0755, 0644);
chmod_r(BB_ROOT . 'sitemap', 0755, 0644);
out("- Permissions successfully applied!\n", 'success');
// Check composer installation
if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
out('- Hmm, it seems there are no Composer dependencies', 'info');
// Downloading composer
if (!is_file(BB_ROOT . 'composer.phar')) {
out('- Downloading Composer...', 'info');
if (copy('https://getcomposer.org/installer', BB_ROOT . 'composer-setup.php')) {
out("- Composer successfully downloaded!\n", 'success');
runProcess('php ' . BB_ROOT . 'composer-setup.php --install-dir=' . BB_ROOT);
} else {
out('- Cannot download Composer. Please, download it (composer.phar) manually', 'error');
exit;
}
if (is_file(BB_ROOT . 'composer-setup.php')) {
if (unlink(BB_ROOT . 'composer-setup.php')) {
out("- Composer installation file successfully removed!\n", 'success');
} else {
out('- Cannot remove Composer installation file (composer-setup.php). Please, delete it manually', 'warning');
}
}
} else {
out("- composer.phar file found!\n", 'success');
}
// Installing dependencies
if (is_file(BB_ROOT . 'composer.phar')) {
out('- Installing dependencies...', 'info');
runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi');
define('COMPOSER_COMPLETED', true);
} else {
out('- composer.phar not found. Please, download it (composer.phar) manually', 'error');
exit;
}
} else {
out('- Composer dependencies are present!', 'success');
out("- Note: Remove 'vendor' folder if you want to re-install dependencies\n");
}
// Check composer dependencies
if (defined('COMPOSER_COMPLETED')) {
if (is_file(BB_ROOT . 'vendor/autoload.php')) {
out("- Completed! Composer dependencies are installed!\n", 'success');
} else {
exit;
}
}
// Preparing ENV
if (is_file(BB_ROOT . '.env.example') && !is_file(BB_ROOT . '.env')) {
if (copy(BB_ROOT . '.env.example', BB_ROOT . '.env')) {
out("- Environment file created!\n", 'success');
} else {
out('- Cannot create environment file', 'error');
exit;
}
}
// Editing ENV file
$DB_HOST = 'localhost';
$DB_PORT = 3306;
$DB_DATABASE = '';
$DB_USERNAME = '';
$DB_PASSWORD = '';
if (is_file(BB_ROOT . '.env')) {
out("--- Configuring TorrentPier ---", 'info');
$envContent = file_get_contents(BB_ROOT . '.env');
if ($envContent === false) {
out('- Cannot open environment file', 'error');
exit;
}
$envLines = explode("\n", $envContent);
$editedLines = [];
foreach ($envLines as $line) {
if (trim($line) !== '' && !str_starts_with($line, '#')) {
$parts = explode('=', $line, 2);
$key = trim($parts[0]);
$value = (!empty($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
out("\nCurrent value of $key: $value", 'debug');
echo "Enter a new value for $key (or leave empty to not change): ";
$newValue = trim(readline());
if (!empty($newValue) || $key === 'DB_PASSWORD') {
if ($key === 'TP_HOST') {
if (!preg_match('/^https?:\/\//', $newValue)) {
$newValue = 'https://' . $newValue;
}
$newValue = parse_url($newValue, PHP_URL_HOST);
}
$line = "$key=$newValue";
$$key = $newValue;
} else {
$$key = $value;
}
}
$editedLines[] = $line;
}
$newEnvContent = implode("\n", $editedLines);
if (file_put_contents(BB_ROOT . '.env', $newEnvContent)) {
out("- TorrentPier successfully configured!\n", 'success');
} else {
out('- Cannot save environment file', 'error');
exit;
}
} else {
out('- Environment file not found', 'error');
exit;
}
if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
out("--- Checking environment settings ---\n", 'info');
// Connecting to database
out("- Trying connect to MySQL...", 'info');
// Checking mysqli extension installed
if (!extension_loaded('mysqli')) {
out('- ext-mysqli not found. Check out php.ini file', 'error');
exit;
}
// Connect to MySQL server
try {
$conn = new mysqli($DB_HOST, $DB_USERNAME, $DB_PASSWORD, port: $DB_PORT);
} catch (mysqli_sql_exception $exception) {
out("- Connection failed: {$exception->getMessage()}", 'error');
exit;
}
if (!$conn->connect_error) {
out('- Connected successfully!', 'success');
}
// Creating database if not exist
if ($conn->query("CREATE DATABASE IF NOT EXISTS $DB_DATABASE CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")) {
out('- Database created successfully!', 'success');
} else {
out("- Cannot create database: $DB_DATABASE", 'error');
exit;
}
$conn->select_db($DB_DATABASE);
// Close database connection - migrations will handle their own connections
$conn->close();
// Run database migrations
out('- Setting up database using migrations...', 'info');
// Check if phinx.php exists
if (!is_file(BB_ROOT . 'phinx.php')) {
out('- Migration configuration (phinx.php) not found', 'error');
exit;
}
// Run migrations
$migrationResult = runProcess('php vendor/bin/phinx migrate --configuration=' . BB_ROOT . 'phinx.php');
if ($migrationResult !== 0) {
out('- Database migration failed', 'error');
exit;
}
out("- Database setup completed!\n", 'success');
// Autofill host in robots.txt
$robots_txt_file = BB_ROOT . 'robots.txt';
if (isset($TP_HOST) && is_file($robots_txt_file)) {
$content = file_get_contents($robots_txt_file);
$content = str_replace('example.com', $TP_HOST, $content);
file_put_contents($robots_txt_file, $content);
}
if (isset($APP_ENV) && $APP_ENV === 'local') {
if (!is_file(BB_ROOT . 'library/config.local.php')) {
if (copy(BB_ROOT . 'library/config.php', BB_ROOT . 'library/config.local.php')) {
out('- Local configuration file created!', 'success');
} else {
out('- Cannot create library/config.local.php file. You can create it manually, just copy config.php and rename it to config.local.php', 'warning');
}
}
} else {
if (rename(__FILE__, __FILE__ . '_' . hash('xxh128', time()))) {
out("- Installation file renamed!", 'success');
} else {
out('- Cannot rename installation file (' . __FILE__ . '). Please, rename it manually for security reasons', 'warning');
}
}
// Cleanup...
if (is_file(BB_ROOT . '_cleanup.php')) {
out("\n--- Finishing installation (Cleanup) ---\n", 'info');
out('The cleanup process will remove:');
out('- Development documentation (README, CHANGELOG)', 'debug');
out('- Git configuration files', 'debug');
out('- CI/CD pipelines and code analysis tools', 'debug');
out('- Translation and contribution guidelines', 'debug');
echo 'Do you want to delete these files permanently? [y/N]: ';
if (str_starts_with(mb_strtolower(trim(readline())), 'y')) {
out("\n- Cleanup...", 'info');
require_once BB_ROOT . '_cleanup.php';
unlink(BB_ROOT . '_cleanup.php');
} else {
out('- Skipping...', 'info');
}
}
out("\n- Voila! Good luck & have fun!", 'success');
}

1
install/.htaccess Normal file
View file

@ -0,0 +1 @@
Require all denied

View file

@ -1,27 +0,0 @@
# Example Caddy configuration for TorrentPier
example.com {
root * /path/to/root
encode gzip zstd
php_fastcgi unix//run/php/php-fpm.sock
try_files {path} {path}/ /index.php?{query}
file_server
@blocked {
path /install/* /internal_data/* /library/*
path /.ht* /.en*
path /.git/*
path *.sql *.tpl *.db *.inc *.log *.md
}
respond @blocked 404
redir /sitemap.xml /sitemap/sitemap.xml
@html_css_js {
path *.html *.css *.js *.json *.xml *.txt
}
header @html_css_js Content-Type "{mime}; charset=utf-8"
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

View file

@ -1,39 +0,0 @@
# Example nginx configuration for TorrentPier
server {
listen 80; # port
server_name example.com; # your domain
root /path/to/root; # folder with TorrentPier installed
index index.php;
charset utf-8;
location / {
try_files \$uri \$uri/ /index.php?\$args;
}
location ~ \/(install|internal_data|library)\/ {
return 404;
}
location ~ /\.(ht|en) {
return 404;
}
location ~ /\.git {
return 404;
}
location ~ \.(.*sql|tpl|db|inc|log|md)$ {
return 404;
}
rewrite ^/sitemap.xml$ /sitemap/sitemap.xml;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
}

1503
install/sql/mysql.sql Normal file

File diff suppressed because it is too large Load diff

57
install/sql/ocelot.sql Normal file
View file

@ -0,0 +1,57 @@
SET SQL_MODE = "";
-- ----------------------------
-- Table structure for `bb_bt_tracker`
-- ----------------------------
DROP TABLE IF EXISTS `bb_bt_tracker`;
CREATE TABLE IF NOT EXISTS `bb_bt_tracker`
(
`peer_hash` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`peer_id` varchar(20) NOT NULL,
`user_id` mediumint(9) NOT NULL DEFAULT '0',
`ip` varchar(42) NOT NULL DEFAULT '0',
`ipv6` varchar(32) DEFAULT NULL,
`port` smallint(5) unsigned NOT NULL DEFAULT '0',
`client` varchar(51) NOT NULL DEFAULT 'Unknown',
`seeder` tinyint(1) NOT NULL DEFAULT '0',
`releaser` tinyint(1) NOT NULL DEFAULT '0',
`tor_type` tinyint(1) NOT NULL DEFAULT '0',
`uploaded` bigint(20) unsigned NOT NULL DEFAULT '0',
`downloaded` bigint(20) unsigned NOT NULL DEFAULT '0',
`remain` bigint(20) unsigned NOT NULL DEFAULT '0',
`speed_up` mediumint(8) unsigned NOT NULL DEFAULT '0',
`speed_down` mediumint(8) unsigned NOT NULL DEFAULT '0',
`up_add` bigint(20) unsigned NOT NULL DEFAULT '0',
`down_add` bigint(20) unsigned NOT NULL DEFAULT '0',
`update_time` int(11) NOT NULL DEFAULT '0',
`complete_percent` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`peer_hash`),
KEY `topic_id` (`topic_id`),
KEY `user_id` (`user_id`)
) ENGINE = MyISAM
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of bb_bt_tracker
-- ----------------------------
-- ----------------------------
-- Table structure for `bb_bt_tracker_snap`
-- ----------------------------
DROP TABLE IF EXISTS `bb_bt_tracker_snap`;
CREATE TABLE IF NOT EXISTS `bb_bt_tracker_snap`
(
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`seeders` mediumint(8) unsigned NOT NULL DEFAULT '0',
`leechers` mediumint(8) unsigned NOT NULL DEFAULT '0',
`speed_up` int(10) unsigned NOT NULL DEFAULT '0',
`speed_down` int(10) unsigned NOT NULL DEFAULT '0',
`complete` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`topic_id`)
) ENGINE = MyISAM
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of bb_bt_tracker_snap
-- ----------------------------

View file

@ -0,0 +1,3 @@
Схема изменений начиная с версии 2.4.0:
Изменения в базе:

1
internal_data/cache/.htaccess vendored Normal file
View file

@ -0,0 +1 @@
Require all denied

View file

View file

@ -0,0 +1 @@
Require all denied

View file

@ -0,0 +1 @@
Require all denied

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,13 +11,11 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $lang, $user; global $bb_cfg, $lang, $user;
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
$mode = (string)$this->request['mode'];
$user_id = (int)$this->request['user_id']; $user_id = (int)$this->request['user_id'];
if (!$user_id or !$u_data = get_userdata($user_id)) { if (!$user_id or !$u_data = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']); $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
} }
@ -35,7 +33,7 @@ switch ($mode) {
$response = get_avatar($user_id, $new_ext_id); $response = get_avatar($user_id, $new_ext_id);
break; break;
default: default:
$this->ajax_die('Invalid mode: ' . $mode); $this->ajax_die('Invalid mode');
} }
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang; global $bb_cfg, $userdata, $lang;
if (!config()->get('callseed')) { if (!$bb_cfg['callseed']) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }
@ -27,16 +27,14 @@ if (!$t_data = topic_info($topic_id)) {
$forum_id = $t_data['forum_id']; $forum_id = $t_data['forum_id'];
if ($t_data['seeders'] >= 3) { if ($t_data['seeders'] > 2) {
$this->ajax_die(sprintf($lang['CALLSEED_HAVE_SEED'], $t_data['seeders'])); $this->ajax_die(sprintf($lang['CALLSEED_HAVE_SEED'], $t_data['seeders']));
} elseif ($t_data['call_seed_time'] >= (TIMENOW - 86400)) { } elseif ($t_data['call_seed_time'] > (TIMENOW - 86400)) {
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days'); $time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
$this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left)); $this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
} elseif (isset(config()->get('tor_no_tor_act')[$t_data['tor_status']])) {
$this->ajax_die($lang['NOT_AVAILABLE']);
} }
$banned_users = ($get_banned_users = get_banned_users()) ? (', ' . implode(', ', $get_banned_users)) : ''; $get_banned_users = get_banned_users() ? (', ' . implode(', ', get_banned_users())) : '';
$user_list = DB()->fetch_rowset(" $user_list = DB()->fetch_rowset("
SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl SELECT DISTINCT dl.user_id, u.user_opt, tr.user_id as active_dl
@ -45,7 +43,7 @@ $user_list = DB()->fetch_rowset("
LEFT JOIN " . BB_BT_TRACKER . " tr ON(tr.user_id = dl.user_id) LEFT JOIN " . BB_BT_TRACKER . " tr ON(tr.user_id = dl.user_id)
WHERE dl.topic_id = $topic_id WHERE dl.topic_id = $topic_id
AND dl.user_status IN (" . DL_STATUS_COMPLETE . ", " . DL_STATUS_DOWN . ") AND dl.user_status IN (" . DL_STATUS_COMPLETE . ", " . DL_STATUS_DOWN . ")
AND dl.user_id NOT IN ({$userdata['user_id']}, " . EXCLUDED_USERS . $banned_users . ") AND dl.user_id NOT IN ({$userdata['user_id']}, " . EXCLUDED_USERS . $get_banned_users . ")
AND u.user_active = 1 AND u.user_active = 1
GROUP BY dl.user_id GROUP BY dl.user_id
"); ");
@ -75,7 +73,7 @@ function topic_info($topic_id)
$sql = " $sql = "
SELECT SELECT
tor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time, tor.tor_status, tor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time,
t.topic_title, sn.seeders t.topic_title, sn.seeders
FROM " . BB_BT_TORRENTS . " tor FROM " . BB_BT_TORRENTS . " tor
LEFT JOIN " . BB_TOPICS . " t USING(topic_id) LEFT JOIN " . BB_TOPICS . " t USING(topic_id)
@ -84,7 +82,7 @@ function topic_info($topic_id)
"; ";
if (!$torrent = DB()->fetch_row($sql)) { if (!$torrent = DB()->fetch_row($sql)) {
bb_die($lang['TOPIC_POST_NOT_EXIST'], 404); bb_die($lang['TOPIC_POST_NOT_EXIST']);
} }
return $torrent; return $torrent;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,18 +11,16 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang, $log_action; global $userdata, $bb_cfg, $lang;
if (!$attach_id = (int)$this->request['attach_id']) { if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']); $this->ajax_die($lang['EMPTY_ATTACH_ID']);
} }
if (!$mode = (string)$this->request['mode']) { $attach_id = (int)$this->request['attach_id'];
$this->ajax_die('invalid mode (empty)'); $mode = (string)$this->request['mode'];
}
$comment = false; if ($bb_cfg['tor_comment']) {
if (config()->get('tor_comment')) {
$comment = (string)$this->request['comment']; $comment = (string)$this->request['comment'];
} }
@ -44,7 +42,7 @@ switch ($mode) {
case 'status': case 'status':
$new_status = (int)$this->request['status']; $new_status = (int)$this->request['status'];
// Check status validity // Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$new_status])) { if (!isset($lang['TOR_STATUS_NAME'][$new_status])) {
$this->ajax_die($lang['TOR_STATUS_FAILED']); $this->ajax_die($lang['TOR_STATUS_FAILED']);
} }
@ -55,17 +53,17 @@ switch ($mode) {
$this->ajax_die($lang['NOT_MODERATOR']); $this->ajax_die($lang['NOT_MODERATOR']);
} }
// Error if same status // Тот же статус
if ($tor['tor_status'] == $new_status) { if ($tor['tor_status'] == $new_status) {
$this->ajax_die($lang['TOR_STATUS_DUB']); $this->ajax_die($lang['TOR_STATUS_DUB']);
} }
// Prohibition on changing/assigning CH-status by moderator // Запрет на изменение/присвоение CH-статуса модератором
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN) { if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN) {
$this->ajax_die($lang['TOR_DONT_CHANGE']); $this->ajax_die($lang['TOR_DONT_CHANGE']);
} }
// Check rights to change status // Права на изменение статуса
if ($tor['tor_status'] == TOR_CLOSED_CPHOLD) { if ($tor['tor_status'] == TOR_CLOSED_CPHOLD) {
if (!IS_ADMIN) { if (!IS_ADMIN) {
$this->verify_mod_rights($tor['forum_id']); $this->verify_mod_rights($tor['forum_id']);
@ -75,7 +73,7 @@ switch ($mode) {
$this->verify_mod_rights($tor['forum_id']); $this->verify_mod_rights($tor['forum_id']);
} }
// Confirmation of status change set by another moderator // Подтверждение изменения статуса, выставленного другим модератором
if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userdata['user_id'] && $tor['checked_time'] + 2 * 3600 > TIMENOW) { if ($tor['tor_status'] != TOR_NOT_APPROVED && $tor['checked_user_id'] != $userdata['user_id'] && $tor['checked_time'] + 2 * 3600 > TIMENOW) {
if (empty($this->request['confirmed'])) { if (empty($this->request['confirmed'])) {
$msg = $lang['TOR_STATUS_OF'] . " {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n"; $msg = $lang['TOR_STATUS_OF'] . " {$lang['TOR_STATUS_NAME'][$tor['tor_status']]}\n\n";
@ -87,24 +85,12 @@ switch ($mode) {
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status); \TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
// Log action $this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> &middot; ' . profile_url($userdata) . ' &middot; <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], config()->get('tor_icons')[$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', config()->get('tor_icons')[$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
if ($comment && $comment != $lang['COMMENT']) {
$log_msg .= "<br/>{$lang['COMMENT']}: <b>$comment</b>.";
}
$log_action->mod('mod_topic_change_tor_status', [
'forum_id' => $tor['forum_id'],
'topic_id' => $tor['topic_id'],
'topic_title' => $tor['topic_title'],
'log_msg' => $log_msg . '<br/>-------------',
]);
$this->response['status'] = config()->get('tor_icons')[$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> &middot; ' . profile_url($userdata) . ' &middot; <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 (config()->get('tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, 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 . $tor['topic_id']), config()->get('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 . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
if ($comment && $comment != $lang['COMMENT']) { if ($comment && $comment != $lang['COMMENT']) {
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment; $message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
@ -117,7 +103,7 @@ switch ($mode) {
break; break;
case 'status_reply': case 'status_reply':
if (!config()->get('tor_comment')) { if (!$bb_cfg['tor_comment']) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }
@ -131,9 +117,6 @@ switch ($mode) {
send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']); send_pm($tor['checked_user_id'], $subject, $message, $userdata['user_id']);
\TorrentPier\Sessions::cache_rm_user_sessions($tor['checked_user_id']); \TorrentPier\Sessions::cache_rm_user_sessions($tor['checked_user_id']);
break; break;
default:
$this->ajax_die('Invalid mode: ' . $mode);
} }
$this->response['attach_id'] = $attach_id; $this->response['attach_id'] = $attach_id;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang, $log_action; global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id'])) { if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']); $this->ajax_die($lang['EMPTY_ATTACH_ID']);
@ -19,11 +19,31 @@ if (!isset($this->request['attach_id'])) {
if (!isset($this->request['type'])) { if (!isset($this->request['type'])) {
$this->ajax_die('empty type'); $this->ajax_die('empty type');
} }
$attach_id = (int)$this->request['attach_id']; $attach_id = (int)$this->request['attach_id'];
$type = (string)$this->request['type']; $type = (string)$this->request['type'];
if (!$torrent = \TorrentPier\Legacy\Torrent::get_torrent_info($attach_id)) { $torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
" . BB_ATTACHMENTS . " a,
" . BB_ATTACHMENTS_DESC . " d,
" . BB_POSTS . " p,
" . BB_TOPICS . " t,
" . BB_FORUMS . " f
WHERE
a.attach_id = $attach_id
AND d.attach_id = $attach_id
AND p.post_id = a.post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
LIMIT 1
");
if (!$torrent) {
$this->ajax_die($lang['INVALID_ATTACH_ID']); $this->ajax_die($lang['INVALID_ATTACH_ID']);
} }
@ -43,25 +63,12 @@ switch ($type) {
case 'unset_silver_gold': case 'unset_silver_gold':
if ($type == 'set_silver') { if ($type == 'set_silver') {
$tor_type = TOR_TYPE_SILVER; $tor_type = TOR_TYPE_SILVER;
$tor_type_lang = $lang['SILVER'];
} elseif ($type == 'set_gold') { } elseif ($type == 'set_gold') {
$tor_type = TOR_TYPE_GOLD; $tor_type = TOR_TYPE_GOLD;
$tor_type_lang = $lang['GOLD'];
} else { } else {
$tor_type = TOR_TYPE_DEFAULT; $tor_type = 0;
$tor_type_lang = "{$lang['UNSET_GOLD_TORRENT']} / {$lang['UNSET_SILVER_TORRENT']}";
} }
\TorrentPier\Legacy\Torrent::change_tor_type($attach_id, $tor_type); \TorrentPier\Legacy\Torrent::change_tor_type($attach_id, $tor_type);
// Log action
$log_action->mod('mod_topic_change_tor_type', [
'forum_id' => $torrent['forum_id'],
'topic_id' => $torrent['topic_id'],
'topic_title' => $torrent['topic_title'],
'log_msg' => sprintf($lang['TOR_TYPE_LOG_ACTION'], $tor_type_lang),
]);
$title = $lang['CHANGE_TOR_TYPE']; $title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']); $url = make_url(TOPIC_URL . $torrent['topic_id']);
break; break;
@ -89,7 +96,7 @@ switch ($type) {
$this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']); $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
} }
\TorrentPier\Legacy\Torrent::delete_torrent($attach_id); \TorrentPier\Legacy\Torrent::delete_torrent($attach_id);
$url = make_url("modcp.php?" . POST_TOPIC_URL . "={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}"); $url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
break; break;
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -32,7 +32,7 @@ foreach ($bf['user_opt'] as $opt_name => $opt_bit) {
DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
// Remove data from cache // Удаляем данные из кеша
\TorrentPier\Sessions::cache_rm_user_sessions($user_id); \TorrentPier\Sessions::cache_rm_user_sessions($user_id);
$this->response['resp_html'] = $lang['SAVED']; $this->response['resp_html'] = $lang['SAVED'];

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -13,11 +13,7 @@ if (!defined('IN_AJAX')) {
global $datastore, $lang; global $datastore, $lang;
if (!$ranks = $datastore->get('ranks')) { $ranks = $datastore->get('ranks');
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
$rank_id = (int)$this->request['rank_id']; $rank_id = (int)$this->request['rank_id'];
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) { if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
@ -28,11 +24,11 @@ if ($rank_id != 0 && !isset($ranks[$rank_id])) {
$this->ajax_die("invalid rank_id: $rank_id"); $this->ajax_die("invalid rank_id: $rank_id");
} }
DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $user_id");
\TorrentPier\Sessions::cache_rm_user_sessions($user_id); \TorrentPier\Sessions::cache_rm_user_sessions($user_id);
$user_rank = $rank_id ? '<span class="' . $ranks[$rank_id]['rank_style'] . '">' . $ranks[$rank_id]['rank_title'] . '</span>' : ''; $user_rank = ($rank_id) ? '<span class="' . $ranks[$rank_id]['rank_style'] . '">' . $ranks[$rank_id]['rank_title'] . '</span>' : '';
$this->response['html'] = $rank_id ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK']; $this->response['html'] = ($rank_id) ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK'];
$this->response['rank_name'] = $rank_id ? $user_rank : $lang['USER']; $this->response['rank_name'] = ($rank_id) ? $user_rank : $lang['USER'];

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang; global $bb_cfg, $userdata, $lang;
if (!$group_id = (int)$this->request['group_id'] or !$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) { if (!$group_id = (int)$this->request['group_id'] or !$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']); $this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
@ -51,4 +51,4 @@ switch ($mode) {
} }
$value_sql = DB()->escape($value, true); $value_sql = DB()->escape($value, true);
DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id LIMIT 1"); DB()->query("UPDATE " . BB_GROUPS . " SET $mode = $value_sql WHERE group_id = $group_id");

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,21 +11,15 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $lang; global $bb_cfg, $lang;
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) { if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']); $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
} }
if (!$field = (string)$this->request['field']) { if (!$field = (string)$this->request['field']) {
$this->ajax_die('invalid profile field'); $this->ajax_die('invalid profile field');
} }
// Check for demo mode
if (IN_DEMO_MODE && in_array($field, ['username', 'user_email'])) {
$this->ajax_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
$table = BB_USERS; $table = BB_USERS;
$value = $this->request['value'] = (string)(isset($this->request['value'])) ? $this->request['value'] : 0; $value = $this->request['value'] = (string)(isset($this->request['value'])) ? $this->request['value'] : 0;
@ -55,17 +49,18 @@ switch ($field) {
break; break;
case 'user_gender': case 'user_gender':
if (!config()->get('gender')) { if (!$bb_cfg['gender']) {
$this->ajax_die($lang['MODULE_OFF']); $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']);
} } else {
$this->response['new_value'] = $lang['GENDER_SELECT'][$value]; $this->response['new_value'] = $lang['GENDER_SELECT'][$value];
}
break; break;
case 'user_birthday': case 'user_birthday':
if (!config()->get('birthday_enabled')) { if (!$bb_cfg['birthday_enabled']) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }
$birthday_date = date_parse($value); $birthday_date = date_parse($value);
@ -73,10 +68,10 @@ switch ($field) {
if (!empty($birthday_date['year'])) { if (!empty($birthday_date['year'])) {
if (strtotime($value) >= TIMENOW) { if (strtotime($value) >= TIMENOW) {
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']); $this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config()->get('birthday_max_age')) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config()->get('birthday_max_age'))); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config()->get('birthday_min_age')) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config()->get('birthday_min_age'))); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
} }
} }
@ -104,9 +99,20 @@ switch ($field) {
$this->response['new_value'] = $this->request['value']; $this->response['new_value'] = $this->request['value'];
break; break;
case 'user_from':
case 'user_occ': case 'user_occ':
case 'user_interests': case 'user_interests':
$this->response['new_value'] = htmlCHR($value); $value = htmlCHR($value);
$this->response['new_value'] = $value;
break;
case 'user_regdate':
case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) {
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
break; break;
case 'u_up_total': case 'u_up_total':
@ -118,11 +124,7 @@ switch ($field) {
} }
$table = BB_BT_USERS; $table = BB_BT_USERS;
$value = (int)$this->request['value']; $value = (float)str_replace(',', '.', $this->request['value']);
if ($value < 0) {
$this->ajax_die($lang['WRONG_INPUT']);
}
foreach (['KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8] as $s => $m) { foreach (['KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8] as $s => $m) {
if (stripos($this->request['value'], $s) !== false) { if (stripos($this->request['value'], $s) !== false) {
@ -130,7 +132,8 @@ switch ($field) {
break; break;
} }
} }
$this->response['new_value'] = humn_size($value, space: ' '); $value = sprintf('%.0f', $value);
$this->response['new_value'] = humn_size($value, null, null, ' ');
$btu = get_bt_userdata($user_id); $btu = get_bt_userdata($user_id);
$btu[$field] = $value; $btu[$field] = $value;
@ -141,7 +144,7 @@ switch ($field) {
case 'user_points': case 'user_points':
$value = (float)str_replace(',', '.', $this->request['value']); $value = (float)str_replace(',', '.', $this->request['value']);
$value = sprintf('%.2f', $value); $value = sprintf('%.2f', $value);
if ($value < 0.0 || strlen(strstr($value, '.', true)) > 14) { if (strlen(strstr($value, '.', true)) > 14) {
$this->ajax_die($lang['WRONG_INPUT']); $this->ajax_die($lang['WRONG_INPUT']);
} }
$this->response['new_value'] = $value; $this->response['new_value'] = $value;
@ -152,7 +155,7 @@ switch ($field) {
} }
$value_sql = DB()->escape($value, true); $value_sql = DB()->escape($value, true);
DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE $table SET $field = $value_sql WHERE user_id = $user_id");
\TorrentPier\Sessions::cache_rm_user_sessions($user_id); \TorrentPier\Sessions::cache_rm_user_sessions($user_id);

View file

@ -1,154 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $lang;
if (!config()->get('torr_server.enabled')) {
$this->ajax_die($lang['MODULE_OFF']);
}
if (config()->get('torr_server.disable_for_guest') && IS_GUEST) {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
$attach_id = $this->request['attach_id'] ?? '';
if (empty($attach_id) || !is_numeric($attach_id)) {
$this->ajax_die($lang['INVALID_ATTACH_ID']);
}
$file_index = $this->request['file_index'] ?? '';
if (empty($file_index) || !is_numeric($file_index)) {
$this->ajax_die("Invalid file index: $file_index");
}
if (!$info_hash = (string)$this->request['info_hash'] or !ctype_xdigit($info_hash)) {
$this->ajax_die("Invalid info_hash: $info_hash");
}
$isAudio = isset($this->request['is_audio']) && $this->request['is_audio'];
// Get ffprobe info from TorrServer
$ffpInfo = (new \TorrentPier\TorrServerAPI())->getFfpInfo($info_hash, $file_index, $attach_id);
$ffpInfo = $ffpInfo->{$file_index};
if (isset($ffpInfo->streams)) {
// Video codec information
$videoCodecIndex = array_search('video', array_column($ffpInfo->streams, 'codec_type'));
if (is_int($videoCodecIndex)) {
$videoCodecInfo = $ffpInfo->streams[$videoCodecIndex];
}
// Audio codec information
$audioTracks = array_filter($ffpInfo->streams, function ($e) {
return $e->codec_type === 'audio';
});
// Audio tracks information
$audioDub = array_map(function ($stream) {
global $lang;
$result = '<span class="warnColor2">' . sprintf($lang['AUDIO_TRACK'], (!isset($stream->index) || $stream->index === 0) ? 1 : $stream->index) . '</span><br/>';
if (isset($stream->tags->language)) {
if (isset($stream->tags->title)) {
$result .= '<b>' . mb_strtoupper($stream->tags->language, DEFAULT_CHARSET) . ' (' . $stream->tags->title . ')' . '</b>';
} else {
$result .= '<b>' . mb_strtoupper($stream->tags->language, DEFAULT_CHARSET) . '</b>';
}
$result .= '<br/>';
}
if (!empty($stream->codec_name)) {
$result .= sprintf($lang['AUDIO_CODEC'], $stream->codec_long_name, mb_strtoupper($stream->codec_name, DEFAULT_CHARSET)) . '<br/>';
}
if (!empty($stream->bit_rate)) {
$result .= sprintf($lang['BITRATE'], humn_bitrate((int)$stream->bit_rate)) . '<br/>';
}
if (!empty($stream->sample_rate)) {
$result .= sprintf($lang['SAMPLE_RATE'], humn_sample_rate((int)$stream->sample_rate)) . '<br/>';
}
if (!empty($stream->channels)) {
$result .= sprintf($lang['CHANNELS'], $stream->channels) . '<br/>';
}
if (!empty($stream->channel_layout)) {
$result .= sprintf($lang['CHANNELS_LAYOUT'], $stream->channel_layout);
}
return $result;
}, $audioTracks);
// Generate output data
$data = [
'filesize' => sprintf($lang['FILESIZE'] . ': <b>%s</b>', humn_size($ffpInfo->format->size)),
'resolution' => (!$isAudio && isset($videoCodecInfo)) ? sprintf($lang['RESOLUTION'], $videoCodecInfo->width . 'x' . $videoCodecInfo->height) : '',
'video_codec' => (!$isAudio && isset($videoCodecInfo->codec_name)) ? sprintf($lang['VIDEO_CODEC'], $videoCodecInfo->codec_long_name, mb_strtoupper($videoCodecInfo->codec_name, DEFAULT_CHARSET)) : '',
'audio_dub' => implode('<hr/>', $audioDub)
];
// Validate output data
$result = '<hr/>';
if (!empty($data['resolution'])) {
$result .= $data['resolution'] . '<br/>';
}
if (!empty($data['filesize'])) {
$result .= $data['filesize'] . '<br/>';
}
if (!empty($data['video_codec'])) {
$result .= $data['video_codec'];
}
if (!empty($data['audio_dub'])) {
$result .= '<hr/>' . $data['audio_dub'];
}
$this->response['ffprobe_data'] = $result;
}
/**
* Bitrate to human-readable format
*
* @param int $bitrate
* @param string $space
* @return string
*/
function humn_bitrate(int $bitrate, string $space = '&nbsp;'): string
{
if ($bitrate >= 1000000) {
$unit = 'Mbps';
$bitrate /= 1000000;
} elseif ($bitrate >= 1000) {
$unit = 'kbps';
$bitrate /= 1000;
} else {
$unit = 'bps';
}
return sprintf('%d', commify($bitrate)) . $space . $unit;
}
/**
* Sample rate to human-readable format
*
* @param int $sample_rate
* @param string $space
* @return string
*/
function humn_sample_rate(int $sample_rate, string $space = '&nbsp;'): string
{
if ($sample_rate >= 1000000) {
$unit = 'Mhz';
} elseif ($sample_rate >= 1000) {
$unit = 'kHz';
} else {
$unit = 'Hz';
}
return sprintf('%.1f', commify($sample_rate)) . $space . $unit;
}
$this->response['file_index'] = $file_index;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -38,18 +38,17 @@ switch ($mode) {
$href = GROUP_URL . $row['group_id']; $href = GROUP_URL . $row['group_id'];
if (IS_ADMIN) { if (IS_ADMIN) {
$href .= "&amp;" . POST_USERS_URL . "=$user_id"; $href .= "&amp;u=$user_id";
$link = '<a href="' . $href . '" class="' . $class . '" target="_blank">' . htmlCHR($row['group_name']) . '</a>'; $link = '<a href="' . $href . '" class="' . $class . '" target="_blank">' . htmlCHR($row['group_name']) . '</a>';
$html[] = $link; $html[] = $link;
} else { } else {
// hidden group and the user himself is not a member of it // скрытая группа и сам юзер не является ее членом
if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view']) { if ($row['group_type'] == GROUP_HIDDEN && !$row['can_view']) {
continue; continue;
} }
if ($row['group_moderator'] == $user->id) { if ($row['group_moderator'] == $user->id) {
// the user himself is the moderator of this group
$class .= ' selfMod'; $class .= ' selfMod';
$href .= "&amp;" . POST_USERS_URL . "=$user_id"; $href .= "&amp;u=$user_id"; // сам юзер модератор этой группы
} }
$link = '<a href="' . $href . '" class="' . $class . '" target="_blank">' . htmlCHR($row['group_name']) . '</a>'; $link = '<a href="' . $href . '" class="' . $class . '" target="_blank">' . htmlCHR($row['group_name']) . '</a>';
$html[] = $link; $html[] = $link;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,19 +11,17 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $lang, $userdata, $datastore; global $bb_cfg, $lang, $userdata, $datastore;
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
$mode = (string)$this->request['mode'];
$html = ''; $html = '';
switch ($mode) { switch ($mode) {
case 'birthday_week': case 'birthday_week':
$stats = $datastore->get('stats');
$datastore->enqueue([ $datastore->enqueue([
'stats' 'stats'
]); ]);
$stats = $datastore->get('stats');
$users = []; $users = [];
@ -31,17 +29,17 @@ switch ($mode) {
foreach ($stats['birthday_week_list'] as $week) { foreach ($stats['birthday_week_list'] as $week) {
$users[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>'; $users[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>';
} }
$html = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $users)); $html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $users));
} else { } else {
$html = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day')); $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
} }
break; break;
case 'birthday_today': case 'birthday_today':
$stats = $datastore->get('stats');
$datastore->enqueue([ $datastore->enqueue([
'stats' 'stats'
]); ]);
$stats = $datastore->get('stats');
$users = []; $users = [];
@ -59,7 +57,8 @@ switch ($mode) {
$forum_id = (int)$this->request['forum_id']; $forum_id = (int)$this->request['forum_id'];
$datastore->enqueue([ $datastore->enqueue([
'moderators' 'moderators',
'cat_forums'
]); ]);
$moderators = []; $moderators = [];
@ -83,80 +82,7 @@ switch ($mode) {
$datastore->rm('moderators'); $datastore->rm('moderators');
break; break;
case 'null_ratio':
if (!config()->get('ratio_null_enabled') || !RATIO_ENABLED) {
$this->ajax_die($lang['MODULE_OFF']);
}
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['BT_NULL_RATIO_ALERT']);
}
$user_id = (int)$this->request['user_id'];
if (!IS_ADMIN && $user_id != $userdata['user_id']) {
$this->ajax_die($lang['NOT_AUTHORISED']);
}
$btu = get_bt_userdata($user_id);
$ratio_nulled = (bool)$btu['ratio_nulled'];
$user_ratio = get_bt_ratio($btu);
if (($user_ratio === null) && !IS_ADMIN) {
$this->ajax_die($lang['BT_NULL_RATIO_NONE']);
}
if ($ratio_nulled && !IS_ADMIN) {
$this->ajax_die($lang['BT_NULL_RATIO_AGAIN']);
}
if (($user_ratio >= config()->get('ratio_to_null')) && !IS_ADMIN) {
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], config()->get('ratio_to_null')));
}
$ratio_nulled_sql = !IS_ADMIN ? ', ratio_nulled = 1' : '';
DB()->query("UPDATE " . BB_BT_USERS . " SET u_up_total = 0, u_down_total = 0, u_up_release = 0, u_up_bonus = 0 $ratio_nulled_sql WHERE user_id = " . $user_id);
CACHE('bb_cache')->rm('btu_' . $user_id);
$this->ajax_die($lang['BT_NULL_RATIO_SUCCESS']);
break;
case 'releaser_stats':
if (IS_GUEST) {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
$user_id = (int)$this->request['user_id'];
$sql = "
SELECT COUNT(tor.poster_id) as total_releases, SUM(tor.size) as total_size, SUM(tor.complete_count) as total_complete, SUM(ad.download_count) as total_dl_count
FROM " . BB_BT_TORRENTS . " tor
LEFT JOIN " . BB_USERS . " u ON(u.user_id = tor.poster_id)
LEFT JOIN " . BB_ATTACHMENTS_DESC . " ad ON(ad.attach_id = tor.attach_id)
LEFT JOIN " . BB_BT_USERS . " ut ON(ut.user_id = tor.poster_id)
WHERE u.user_id = $user_id
GROUP BY tor.poster_id
LIMIT 1
";
$total_releases_size = $total_releases = $total_releases_completed = $total_releases_downloaded = 0;
if ($row = DB()->fetch_row($sql)) {
$total_releases = $row['total_releases'];
$total_releases_size = $row['total_size'];
$total_releases_downloaded = $row['total_dl_count'];
$total_releases_completed = $row['total_complete'];
}
$html = '[
' . $lang['RELEASES'] . ': <span class="seed bold">' . $total_releases . '</span> |
' . $lang['RELEASER_STAT_SIZE'] . ' <span class="seed bold">' . humn_size($total_releases_size) . '</span> |
' . $lang['DOWNLOADED'] . ': <span title="' . $lang['COMPLETED'] . ':&nbsp;' . declension((int)$total_releases_completed, 'times') . '" class="seed bold">' . declension((int)$total_releases_downloaded, 'times') . '</span> ]';
break;
case 'get_traf_stats': case 'get_traf_stats':
if (!RATIO_ENABLED) {
$this->ajax_die($lang['MODULE_OFF']);
}
if (IS_GUEST) {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
$user_id = (int)$this->request['user_id']; $user_id = (int)$this->request['user_id'];
$btu = get_bt_userdata($user_id); $btu = get_bt_userdata($user_id);
$profiledata = get_userdata($user_id); $profiledata = get_userdata($user_id);
@ -172,7 +98,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 .= config()->get('seed_bonus_enabled') ? '<th>' . $lang['SEED_BONUS'] . '</th>' : ''; $html .= ($bb_cfg['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>
@ -180,23 +106,23 @@ 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 .= config()->get('seed_bonus_enabled') ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : ''; $html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
$html .= '</tr> $html .= '</tr>
<tr class="row5"> <tr class="row5">
<td colspan="1">' . $lang['MAX_SPEED'] . '</td> <td colspan="1">' . $lang['MAX_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 .= config()->get('seed_bonus_enabled') ? '<td colspan="1"></td>' : ''; $html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
$html .= '</tr>'; $html .= '</tr>';
$this->response['user_ratio'] = ' $this->response['user_ratio'] = '
<th><a href="' . config()->get('ratio_url_help') . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th> <th><a href="' . $bb_cfg['ratio_url_help'] . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
<td>' . $user_ratio . '</td> <td>' . $user_ratio . '</td>
'; ';
break; break;
default: default:
$this->ajax_die('Invalid mode: ' . $mode); $this->ajax_die('Invalid mode');
} }
$this->response['html'] = $html; $this->response['html'] = $html;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang; global $userdata, $lang, $bb_cfg;
if (!$mode = (string)$this->request['mode']) { if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)'); $this->ajax_die('invalid mode (empty)');
@ -19,12 +19,13 @@ if (!$mode = (string)$this->request['mode']) {
switch ($mode) { switch ($mode) {
case 'clear_cache': case 'clear_cache':
foreach (config()->get('cache.engines') as $cache_name => $cache_val) { foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
CACHE($cache_name)->rm(); CACHE($cache_name)->rm();
} }
$this->response['cache_html'] = '<span class="seed bold">' . $lang['ALL_CACHE_CLEARED'] . '</span>'; $this->response['cache_html'] = '<span class="seed bold">' . $lang['ALL_CACHE_CLEARED'] . '</span>';
break; break;
case 'clear_datastore': case 'clear_datastore':
global $datastore; global $datastore;
@ -32,6 +33,7 @@ switch ($mode) {
$this->response['datastore_html'] = '<span class="seed bold">' . $lang['DATASTORE_CLEARED'] . '</span>'; $this->response['datastore_html'] = '<span class="seed bold">' . $lang['DATASTORE_CLEARED'] . '</span>';
break; break;
case 'clear_template_cache': case 'clear_template_cache':
global $template; global $template;
@ -47,43 +49,53 @@ switch ($mode) {
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>'; $this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';
break; break;
case 'indexer':
exec("indexer --config " . config()->get('sphinx_config_path') . " --all --rotate", $result);
if (!is_file(config()->get('sphinx_config_path') . ".log")) { case 'indexer':
file_put_contents(config()->get('sphinx_config_path') . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND); exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
if (!is_file($bb_cfg['sphinx_config_path'] . ".log")) {
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
} }
file_put_contents(config()->get('sphinx_config_path') . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND); file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
foreach ($result as $row) { foreach ($result as $row) {
file_put_contents(config()->get('sphinx_config_path') . ".log", $row . "\r\n", FILE_APPEND); file_put_contents($bb_cfg['sphinx_config_path'] . ".log", $row . "\r\n", FILE_APPEND);
} }
file_put_contents(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(config()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND); file_put_contents($bb_cfg['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>';
break; break;
case 'update_user_level': case 'update_user_level':
\TorrentPier\Legacy\Group::update_user_level('all'); \TorrentPier\Legacy\Group::update_user_level('all');
$this->response['update_user_level_html'] = '<span class="seed bold">' . $lang['USER_LEVELS_UPDATED'] . '</span>'; $this->response['update_user_level_html'] = '<span class="seed bold">' . $lang['USER_LEVELS_UPDATED'] . '</span>';
break; break;
case 'sync_topics': case 'sync_topics':
\TorrentPier\Legacy\Admin\Common::sync('topic', 'all'); \TorrentPier\Legacy\Admin\Common::sync('topic', 'all');
\TorrentPier\Legacy\Admin\Common::sync_all_forums(); \TorrentPier\Legacy\Admin\Common::sync_all_forums();
$this->response['sync_topics_html'] = '<span class="seed bold">' . $lang['TOPICS_DATA_SYNCHRONIZED'] . '</span>'; $this->response['sync_topics_html'] = '<span class="seed bold">' . $lang['TOPICS_DATA_SYNCHRONIZED'] . '</span>';
break; break;
case 'sync_user_posts': case 'sync_user_posts':
\TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all'); \TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '<span class="seed bold">' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . '</span>'; $this->response['sync_user_posts_html'] = '<span class="seed bold">' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . '</span>';
break; break;
case 'unlock_cron': case 'unlock_cron':
\TorrentPier\Helpers\CronHelper::enableBoard(); \TorrentPier\Helpers\CronHelper::enableBoard();
$this->response['unlock_cron_html'] = '<span class="seed bold">' . $lang['ADMIN_UNLOCKED'] . '</span>'; $this->response['unlock_cron_html'] = '<span class="seed bold">' . $lang['ADMIN_UNLOCKED'] . '</span>';
break; break;
default: default:
$this->ajax_die('Invalid mode: ' . $mode); $this->ajax_die('Invalid mode');
} }
$this->response['mode'] = $mode; $this->response['mode'] = $mode;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang; global $userdata, $lang, $bb_cfg;
if (!$mode = (string)$this->request['mode']) { if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)'); $this->ajax_die('invalid mode (empty)');
@ -21,13 +21,9 @@ if (!$user_id = (int)$this->request['user_id']) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']); $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
} }
// Check for demo mode
if (IN_DEMO_MODE) {
$this->ajax_die($lang['CANT_EDIT_IN_DEMO_MODE']);
}
switch ($mode) { switch ($mode) {
case 'delete_profile': case 'delete_profile':
if ($userdata['user_id'] == $user_id) { if ($userdata['user_id'] == $user_id) {
$this->ajax_die($lang['USER_DELETE_ME']); $this->ajax_die($lang['USER_DELETE_ME']);
} }
@ -35,49 +31,71 @@ switch ($mode) {
$this->prompt_for_confirm($lang['USER_DELETE_CONFIRM']); $this->prompt_for_confirm($lang['USER_DELETE_CONFIRM']);
} }
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) { if ($user_id != BOT_UID) {
\TorrentPier\Sessions::delete_user_sessions($user_id); \TorrentPier\Sessions::delete_user_sessions($user_id);
\TorrentPier\Legacy\Admin\Common::user_delete($user_id); \TorrentPier\Legacy\Admin\Common::user_delete($user_id);
$user_id = $userdata['user_id']; // Store self user_id for redirect after successful deleting
$this->response['info'] = $lang['USER_DELETED']; $this->response['info'] = $lang['USER_DELETED'];
} else { } else {
$this->ajax_die($lang['USER_DELETE_CSV']); $this->ajax_die($lang['USER_DELETE_CSV']);
} }
break; break;
case 'delete_topics': case 'delete_topics':
if ($userdata['user_id'] == $user_id) {
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) {
$this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']); $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
} }
if (empty($this->request['confirmed'])) { if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DELETE_USER_ALL_POSTS_CONFIRM']); $this->prompt_for_confirm($lang['DELETE_USER_ALL_POSTS_CONFIRM']);
} }
if (IS_ADMIN) {
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_poster = $user_id", 'topic_id'); $user_topics = DB()->fetch_rowset("SELECT topic_id FROM " . BB_TOPICS . " WHERE topic_poster = $user_id", 'topic_id');
$deleted_topics = \TorrentPier\Legacy\Admin\Common::topic_delete($user_topics); $deleted_topics = \TorrentPier\Legacy\Admin\Common::topic_delete($user_topics);
$deleted_posts = \TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id); $deleted_posts = \TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS']; $this->response['info'] = $lang['USER_DELETED_POSTS'];
} else {
$this->ajax_die($lang['NOT_ADMIN']);
}
break; break;
case 'delete_message': case 'delete_message':
if ($userdata['user_id'] == $user_id) {
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) {
$this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']); $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
} }
if (empty($this->request['confirmed'])) { if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']); $this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
} }
if (IS_ADMIN) {
\TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id); \TorrentPier\Legacy\Admin\Common::post_delete('user', $user_id);
$this->response['info'] = $lang['USER_DELETED_POSTS']; $this->response['info'] = $lang['USER_DELETED_POSTS'];
} else {
$this->ajax_die($lang['NOT_ADMIN']);
}
break; break;
case 'user_activate': case 'user_activate':
if (empty($this->request['confirmed'])) { if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['DEACTIVATE_CONFIRM']); $this->prompt_for_confirm($lang['DEACTIVATE_CONFIRM']);
} }
DB()->query("UPDATE " . BB_USERS . " SET user_active = 1 WHERE user_id = " . $user_id); DB()->query("UPDATE " . BB_USERS . " SET user_active = '1' WHERE user_id = " . $user_id);
$this->response['info'] = $lang['USER_ACTIVATE_ON']; $this->response['info'] = $lang['USER_ACTIVATE_ON'];
break; break;
case 'user_deactivate': case 'user_deactivate':
if ($userdata['user_id'] == $user_id) { if ($userdata['user_id'] == $user_id) {
$this->ajax_die($lang['USER_DEACTIVATE_ME']); $this->ajax_die($lang['USER_DEACTIVATE_ME']);
} }
@ -85,10 +103,13 @@ switch ($mode) {
$this->prompt_for_confirm($lang['ACTIVATE_CONFIRM']); $this->prompt_for_confirm($lang['ACTIVATE_CONFIRM']);
} }
DB()->query("UPDATE " . BB_USERS . " SET user_active = 0 WHERE user_id = " . $user_id); DB()->query("UPDATE " . BB_USERS . " SET user_active = '0' WHERE user_id = " . $user_id);
\TorrentPier\Sessions::delete_user_sessions($user_id); \TorrentPier\Sessions::delete_user_sessions($user_id);
$this->response['info'] = $lang['USER_ACTIVATE_OFF']; $this->response['info'] = $lang['USER_ACTIVATE_OFF'];
break; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode');
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang, $datastore, $log_action; global $userdata, $bb_cfg, $lang, $datastore, $log_action;
if (!$mode = (string)$this->request['mode']) { if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)'); $this->ajax_die('invalid mode (empty)');
@ -22,7 +22,7 @@ switch ($mode) {
$topics = (string)$this->request['topic_ids']; $topics = (string)$this->request['topic_ids'];
$status = (int)$this->request['status']; $status = (int)$this->request['status'];
// Check status validity // Валидность статуса
if (!isset($lang['TOR_STATUS_NAME'][$status])) { if (!isset($lang['TOR_STATUS_NAME'][$status])) {
$this->ajax_die($lang['TOR_STATUS_FAILED']); $this->ajax_die($lang['TOR_STATUS_FAILED']);
} }
@ -30,29 +30,9 @@ switch ($mode) {
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($topics)", 'attach_id'); $topic_ids = DB()->fetch_rowset("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($topics)", 'attach_id');
foreach ($topic_ids as $attach_id) { foreach ($topic_ids as $attach_id) {
$tor = DB()->fetch_row("
SELECT
tor.forum_id, tor.topic_id, t.topic_title, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor
INNER JOIN " . BB_TOPICS . " t ON(t.topic_id = tor.topic_id)
WHERE tor.attach_id = $attach_id LIMIT 1");
if (!$tor) {
$this->ajax_die($lang['TORRENT_FAILED']);
}
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status); \TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], config()->get('tor_icons')[$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', config()->get('tor_icons')[$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
$log_action->mod('mod_topic_change_tor_status', [
'forum_id' => $tor['forum_id'],
'topic_id' => $tor['topic_id'],
'topic_title' => $tor['topic_title'],
'log_msg' => $log_msg . '<br/>-------------',
]);
} }
$this->response['status'] = config()->get('tor_icons')[$status]; $this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics); $this->response['topics'] = explode(',', $topics);
break; break;
@ -77,20 +57,16 @@ 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");
// Update the news cache on the index page // Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', config()->get('latest_news_forum_id'))); $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && config()->get('show_latest_news')) { if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
$datastore->enqueue([ $datastore->enqueue('latest_news');
'latest_news'
]);
$datastore->update('latest_news'); $datastore->update('latest_news');
} }
$net_forums = array_flip(explode(',', config()->get('network_news_forum_id'))); $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && config()->get('show_network_news')) { if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
$datastore->enqueue([ $datastore->enqueue('network_news');
'network_news'
]);
$datastore->update('network_news'); $datastore->update('network_news');
} }
@ -98,7 +74,6 @@ switch ($mode) {
$log_action->mod('mod_topic_renamed', [ $log_action->mod('mod_topic_renamed', [
'forum_id' => $t_data['forum_id'], 'forum_id' => $t_data['forum_id'],
'topic_id' => $topic_id, 'topic_id' => $topic_id,
'topic_id_new' => $topic_id,
'topic_title' => $old_title, 'topic_title' => $old_title,
'topic_title_new' => $new_title 'topic_title_new' => $new_title
]); ]);
@ -151,8 +126,8 @@ switch ($mode) {
} else { } else {
$user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']); $user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']);
$user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']); $user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']);
$reg_ip = '<a href="' . config()->get('whois_info') . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>'; $reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
$last_ip = '<a href="' . config()->get('whois_info') . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>'; $last_ip = '<a href="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
} }
$this->response['ip_list_html'] = ' $this->response['ip_list_html'] = '
@ -172,5 +147,5 @@ switch ($mode) {
break; break;
default: default:
$this->ajax_die('Invalid mode: ' . $mode); $this->ajax_die('Invalid mode');
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -13,19 +13,11 @@ if (!defined('IN_AJAX')) {
global $userdata, $lang; global $userdata, $lang;
if (!$mode = (string)$this->request['mode']) { $req_uid = (int)$this->request['user_id'];
$this->ajax_die('invalid mode (empty)'); $mode = (string)$this->request['mode'];
}
if (!$req_uid = (int)$this->request['user_id']) { if ($req_uid == $userdata['user_id'] || IS_ADMIN) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']); switch ($mode) {
}
if (!IS_ADMIN && $req_uid != $userdata['user_id']) {
$this->ajax_die($lang['NOT_AUTHORISED']);
}
switch ($mode) {
case 'generate': case 'generate':
if (empty($this->request['confirmed'])) { if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']); $this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
@ -36,8 +28,12 @@ switch ($mode) {
} }
\TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid); \TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey; $this->response['passkey'] = $passkey;
break; break;
default: default:
$this->ajax_die('Invalid mode: ' . $mode); $this->ajax_die('Invalid mode');
}
} else {
$this->ajax_die($lang['NOT_AUTHORISED']);
} }

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -16,7 +16,7 @@ global $lang, $userdata;
$post_id = (int)$this->request['post_id']; $post_id = (int)$this->request['post_id'];
$mc_type = (int)$this->request['mc_type']; $mc_type = (int)$this->request['mc_type'];
$mc_text = (string)$this->request['mc_text']; $mc_text = (string)$this->request['mc_text'];
if ($mc_type != 0 && !$mc_text = prepare_message($mc_text)) { if (!$mc_text = prepare_message($mc_text)) {
$this->ajax_die($lang['EMPTY_MESSAGE']); $this->ajax_die($lang['EMPTY_MESSAGE']);
} }
@ -46,13 +46,23 @@ if ($mc_type && $post['poster_id'] != $userdata['user_id']) {
\TorrentPier\Sessions::cache_rm_user_sessions($post['poster_id']); \TorrentPier\Sessions::cache_rm_user_sessions($post['poster_id']);
} }
$mc_class = match ($mc_type) { switch ($mc_type) {
1 => 'success', case 1: // Комментарий
2 => 'info', $mc_class = 'success';
3 => 'warning', break;
4 => 'danger', case 2: // Информация
default => '', $mc_class = 'info';
}; break;
case 3: // Предупреждение
$mc_class = 'warning';
break;
case 4: // Нарушение
$mc_class = 'danger';
break;
default:
$mc_class = '';
break;
}
$this->response['mc_type'] = $mc_type; $this->response['mc_type'] = $mc_type;
$this->response['post_id'] = $post_id; $this->response['post_id'] = $post_id;

View file

@ -2,7 +2,7 @@
/** /**
* TorrentPier Bull-powered BitTorrent tracker engine * TorrentPier Bull-powered BitTorrent tracker engine
* *
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com) * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository * @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $lang, $userdata; global $lang, $bb_cfg, $userdata;
if (!isset($this->request['type'])) { if (!isset($this->request['type'])) {
$this->ajax_die('empty type'); $this->ajax_die('empty type');
@ -47,6 +47,13 @@ if (isset($this->request['post_id'])) {
$is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post); $is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
} }
if (!defined('WORD_LIST_OBTAINED')) {
$orig_word = [];
$replace_word = [];
obtain_word_list($orig_word, $replace_word);
define('WORD_LIST_OBTAINED', true);
}
switch ($this->request['type']) { switch ($this->request['type']) {
case 'delete': case 'delete':
if ($post['post_id'] != $post['topic_first_post_id'] && $is_auth['auth_delete'] && ($is_auth['auth_mod'] || ($userdata['user_id'] == $post['poster_id'] && $post['topic_last_post_id'] == $post['post_id'] && $post['post_time'] + 3600 * 3 > TIMENOW))) { if ($post['post_id'] != $post['topic_first_post_id'] && $is_auth['auth_delete'] && ($is_auth['auth_mod'] || ($userdata['user_id'] == $post['poster_id'] && $post['topic_last_post_id'] == $post['post_id'] && $post['post_time'] + 3600 * 3 > TIMENOW))) {
@ -76,17 +83,19 @@ switch ($this->request['type']) {
$message = "[quote=\"" . $quote_username . "\"][qpost=" . $post['post_id'] . "]" . $post['post_text'] . "[/quote]\r"; $message = "[quote=\"" . $quote_username . "\"][qpost=" . $post['post_id'] . "]" . $post['post_text'] . "[/quote]\r";
// hide user passkey // hide user passkey
$message = preg_replace('#(?<=[\?&;]' . config()->get('passkey_key') . '=)[a-zA-Z0-9]#', 'passkey', $message); $message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message);
// hide sid // hide sid
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]#', 'sid', $message); $message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]{12}#', 'sid', $message);
$message = censor()->censorString($message); if (!empty($orig_word)) {
$message = (!empty($message)) ? preg_replace($orig_word, $replace_word, $message) : '';
}
if ($post['post_id'] == $post['topic_first_post_id']) { if ($post['post_id'] == $post['topic_first_post_id']) {
$message = "[quote]" . $post['topic_title'] . "[/quote]\r"; $message = "[quote]" . $post['topic_title'] . "[/quote]\r";
} }
if (mb_strlen($message, DEFAULT_CHARSET) > 1000) { if (mb_strlen($message, 'UTF-8') > 1000) {
$this->response['redirect'] = make_url(POSTING_URL . '?mode=quote&' . POST_POST_URL . '=' . $post_id); $this->response['redirect'] = make_url(POSTING_URL . '?mode=quote&p=' . $post_id);
} }
$this->response['quote'] = true; $this->response['quote'] = true;
@ -112,18 +121,18 @@ switch ($this->request['type']) {
if ($post['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) { if ($post['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) {
$this->ajax_die($lang['EDIT_OWN_POSTS']); $this->ajax_die($lang['EDIT_OWN_POSTS']);
} }
if ((mb_strlen($post['post_text'], DEFAULT_CHARSET) > 1000) || $post['post_attachment'] || ($post['topic_first_post_id'] == $post_id)) { if ((mb_strlen($post['post_text'], 'UTF-8') > 1000) || $post['post_attachment'] || ($post['topic_first_post_id'] == $post_id)) {
$this->response['redirect'] = make_url(POSTING_URL . '?mode=editpost&' . POST_POST_URL . '=' . $post_id); $this->response['redirect'] = make_url(POSTING_URL . '?mode=editpost&p=' . $post_id);
} elseif ($this->request['type'] == 'editor') { } elseif ($this->request['type'] == 'editor') {
$text = (string)$this->request['text']; $text = (string)$this->request['text'];
$text = prepare_message($text); $text = prepare_message($text);
if (mb_strlen($text) > 2) { if (mb_strlen($text) > 2) {
if ($text != $post['post_text']) { if ($text != $post['post_text']) {
if (config()->get('max_smilies')) { if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config()->get('smilies_path')); $count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > config()->get('max_smilies')) { if ($count_smilies > $bb_cfg['max_smilies']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies'))); $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['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");
@ -179,7 +188,7 @@ switch ($this->request['type']) {
<input title="Alt+Enter" name="preview" type="submit" value="' . $lang['PREVIEW'] . '"> <input title="Alt+Enter" name="preview" type="submit" value="' . $lang['PREVIEW'] . '">
<input type="button" onclick="edit_post(' . $post_id . ');" value="' . $lang['CANCEL'] . '"> <input type="button" onclick="edit_post(' . $post_id . ');" value="' . $lang['CANCEL'] . '">
<input type="button" onclick="edit_post(' . $post_id . ', \'editor\', $(\'#message-' . $post_id . '\').val()); return false;" class="bold" value="' . $lang['SUBMIT'] . '"> <input type="button" onclick="edit_post(' . $post_id . ', \'editor\', $(\'#message-' . $post_id . '\').val()); return false;" class="bold" value="' . $lang['SUBMIT'] . '">
</div><hr/> </div><hr>
<script type="text/javascript"> <script type="text/javascript">
var bbcode = new BBCode("message-' . $post_id . '"); var bbcode = new BBCode("message-' . $post_id . '");
var ctrl = "ctrl"; var ctrl = "ctrl";
@ -225,7 +234,7 @@ switch ($this->request['type']) {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql"; $sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
if ($row = DB()->fetch_row($sql) and $row['last_post_time']) { if ($row = DB()->fetch_row($sql) and $row['last_post_time']) {
if ($userdata['user_level'] == USER) { if ($userdata['user_level'] == USER) {
if ((TIMENOW - $row['last_post_time']) < config()->get('flood_interval')) { if ((TIMENOW - $row['last_post_time']) < $bb_cfg['flood_interval']) {
$this->ajax_die($lang['FLOOD_ERROR']); $this->ajax_die($lang['FLOOD_ERROR']);
} }
} }
@ -251,10 +260,10 @@ switch ($this->request['type']) {
} }
} }
if (config()->get('max_smilies')) { if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config()->get('smilies_path')); $count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > config()->get('max_smilies')) { if ($count_smilies > $bb_cfg['max_smilies']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies'))); $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
} }
} }
@ -272,7 +281,7 @@ switch ($this->request['type']) {
'post_text' => $message 'post_text' => $message
]); ]);
if (config()->get('topic_notify_enabled')) { if ($bb_cfg['topic_notify_enabled']) {
$notify = !empty($this->request['notify']); $notify = !empty($this->request['notify']);
\TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify); \TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
} }

Some files were not shown because too many files have changed in this diff Show more