mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Compare commits
219 commits
v2.4.5-rc.
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
144aa0558d |
||
|
6e7e3dd9ef |
||
|
423fb65dbf |
||
|
51f2c70d81 |
||
|
fd46d3d04a |
||
|
d4d82101dd |
||
|
9e3f3588f2 |
||
|
915e1d817c |
||
|
7ac335974b |
||
|
c2e3a13a04 |
||
|
f1d6e74e5d |
||
|
7f4cc9d3b9 |
||
|
a0fc2a9da9 |
||
|
c6076c2c27 |
||
|
714dd6255e |
||
|
9b322c7093 |
||
|
423424e947 |
||
|
27b5815aee | ||
|
bccbad0c57 |
||
|
728116d6dc |
||
|
a33574c28f |
||
|
e9a9e09576 |
||
|
e8cba5dd3f |
||
|
4f9cc9fe0f |
||
|
cc9d412522 |
||
|
7aed6bc7d8 |
||
|
7e723d6ad8 | ||
|
fbde8cd421 |
||
|
0d4c869f30 | ||
|
49717d3a68 |
||
|
2fd306704f |
||
|
6c0219d53c |
||
|
f2fca0de85 |
||
|
07a06a33cd |
||
|
e458109eef |
||
|
f50b914cc1 |
||
|
edda2306f2 |
||
|
86abafb114 |
||
|
74a564d795 |
||
|
b1b2618757 |
||
|
62f49beb0b | ||
|
bf9100fbfa |
||
|
37a0675adf |
||
|
81bf67c2be |
||
|
5842994782 |
||
|
8907dbf991 |
||
|
d8b1489b06 | ||
|
b4776804a4 |
||
|
633051bb99 | ||
|
224f0ffa1f | ||
|
b530268826 | ||
|
9c7d270598 |
||
|
e7d3133aa8 |
||
|
0271b21a5e |
||
|
374a74c91f |
||
|
e5811f9c66 |
||
|
b6b38adea3 | ||
|
5e6fb3ef42 |
||
|
9a529558b4 |
||
|
62ab980027 | ||
|
bcf4eb4e9b |
||
|
6f03f750ba |
||
|
a27d504c7d | ||
|
345dd1bc20 |
||
|
28e38aa781 |
||
|
1ece8ba830 | ||
|
f9db78d266 |
||
|
bf328dd69e |
||
|
74d3b76f73 | ||
|
4b16b847f5 |
||
|
dcd7002c2a |
||
|
75ef57474c |
||
|
867359a89e |
||
|
eecfc44046 | ||
|
5561e0022c |
||
|
128f917d76 | ||
|
8ecc61719a |
||
|
bef5328d1e | ||
|
6adde35849 |
||
|
c9aff2a152 | ||
|
cef041c0d1 |
||
|
212e5c5283 |
||
|
5e291f3043 | ||
|
4d0b2941e3 |
||
|
2487d130bb |
||
|
0515670bee |
||
|
f64c340563 |
||
|
5768fe7071 | ||
|
8e965fb1ce |
||
|
daeb7fe87e |
||
|
4c24cb65bf |
||
|
6d6786481e | ||
|
125366147c |
||
|
efa39767a6 | ||
|
46f29bc68a |
||
|
7b8b9a0bba |
||
|
5a60ee0193 | ||
|
03eeb08ad1 |
||
|
a3da6f5386 |
||
|
a15baef69a |
||
|
79bb13e17d |
||
|
d18f99fa1c | ||
|
f76e351b32 |
||
|
21b1eef59d | ||
|
174f44160e |
||
|
025a1944b9 | ||
|
c40aad20ad |
||
|
999ae1eff9 |
||
|
897edfc371 |
||
|
6d0499dd02 |
||
|
8a3b12c119 |
||
|
dee7b4acf9 |
||
|
1738624d04 | ||
|
cd450e67bb | ||
|
44bdd13df8 | ||
|
3cdf843a04 |
||
|
19ef9efc6a | ||
|
3a64f8595c |
||
|
4b7203f8ae |
||
|
6e0786bdee |
||
|
d3b8c38f7a | ||
|
2f026921ee |
||
|
513e3065d3 |
||
|
a4793f6ce1 |
||
|
ab7ea901ec | ||
|
781b7240c4 |
||
|
14086a0ed6 |
||
|
36d399220e |
||
|
b51820e186 |
||
|
bdd4d9322b | ||
|
8edba72f09 |
||
|
90ece5c762 |
||
|
1e5b93d2c0 |
||
|
2555ebce47 |
||
|
f5d65b8911 |
||
|
ccb122f9cb | ||
|
1db9412957 | ||
|
3a679bc253 | ||
|
75e9d5e4a8 |
||
|
071fc04b48 | ||
|
e510ebc3ba |
||
|
25224e6dfd | ||
|
7a14464d20 |
||
|
0b489a25fd | ||
|
1663e19c3f |
||
|
6bd000bc0d |
||
|
5fe770070e |
||
|
c98a4f760e | ||
|
c0cdcff488 |
||
|
04b0a477d3 | ||
|
53e944be51 | ||
|
bc1713abdd |
||
|
5c4972ec12 |
||
|
ec0efe5790 | ||
|
de8f1925ba |
||
|
9e85a00464 | ||
|
9f96090cc4 |
||
|
eeb391da6a |
||
|
1073f19013 | ||
|
cb36715583 | ||
|
e59adce848 |
||
|
1374479fa2 | ||
|
c3b40003b7 |
||
|
1dc84f666f | ||
|
41a78ddbcb |
||
|
36ff584e69 | ||
|
0f1a69e32d |
||
|
578a064303 | ||
|
f9c8160f8e |
||
|
8358aa00de |
||
|
0e72537188 | ||
|
595adbe4da |
||
|
12792e74f7 |
||
|
84e2392896 |
||
|
0a5d14fb6b | ||
|
72376532b3 |
||
|
83c03ae08e | ||
|
bd5aa2a5e7 |
||
|
ab4602e38f | ||
|
eabf851ee6 | ||
|
1b288a96e4 | ||
|
6440162187 |
||
|
de2fceabed |
||
|
1523a37fea | ||
|
83e42bc5db |
||
|
e9920ab598 |
||
|
974d3590c1 |
||
|
02b418ac34 | ||
|
2eab551bd7 |
||
|
a791d4db81 | ||
|
3ced460640 |
||
|
3a2dcab561 | ||
|
df500c4dfa |
||
|
467225e6e4 | ||
|
4f8b51febd | ||
|
9766c534bd |
||
|
3cc880eeb8 |
||
|
056bf046c1 | ||
|
7ca0582561 |
||
|
4df48751c0 | ||
|
9e0a64108d |
||
|
36430c22ce | ||
|
299d9a1f6c |
||
|
37ad07a40c |
||
|
5f7cfb455f | ||
|
0b8d8a5210 |
||
|
af2403f191 |
||
|
bd0ef063fa |
||
|
5a4fc121ba |
||
|
3af5202f7b | ||
|
37f0fb93f3 |
||
|
5ad4a7019d | ||
|
a62a61b008 | ||
|
ba19130cae |
||
|
4641b0a0d0 |
||
|
edad1785ce | ||
|
be65f7c55c |
||
|
ead48923b9 | ||
|
56d531aa5d |
341 changed files with 22628 additions and 9203 deletions
7
.cliffignore
Normal file
7
.cliffignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
9766c534bddad8e82e6d19f9bad5cf70b9887f9a
|
||||
92ce77ec0ec703c08a659419087a373f76e711f7
|
||||
2d53efc945c7747be1755d0b66557a86bdc12cbd
|
||||
602137b65129b817811b80975a369ebde3270c6d
|
||||
4eb26ae37e1f4c82a45961517ffeb54c20200408
|
||||
e59adce848a9e10ee5775254045cbbd915236b8b
|
||||
9e0a64108d62236ab07b3f8d10e8c78269b8e1d1
|
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: Bug Report
|
||||
description: File a bug report
|
||||
title: "[Bug]"
|
||||
labels: Bug
|
||||
labels: [Bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
@ -21,7 +21,7 @@ body:
|
|||
attributes:
|
||||
label: PHP & Platform
|
||||
description: Exact PHP and Platform (OS) versions your using.
|
||||
placeholder: 8.1.2 - Ubuntu 22.04 x64
|
||||
placeholder: 8.2.2 - Ubuntu 22.04 x64
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
name: Feature / Enhancement request
|
||||
about: Suggest an idea for TorrentPier
|
||||
title: "[Feature]"
|
||||
labels: Feature, Enhancement
|
||||
labels: [Feature, Enhancement]
|
||||
assignees: ''
|
||||
---
|
||||
|
|
6
.github/workflows/cd.yml
vendored
6
.github/workflows/cd.yml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
|||
uses: orhun/git-cliff-action@v4
|
||||
id: git-cliff
|
||||
with:
|
||||
config: cliff-releases.toml
|
||||
config: cliff.toml
|
||||
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
|
||||
|
||||
- name: Print the changelog
|
||||
|
@ -41,10 +41,10 @@ jobs:
|
|||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
php-version: '8.2'
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Cleanup
|
||||
run: php _cleanup.php && rm _cleanup.php
|
||||
|
|
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
|
@ -17,10 +17,10 @@ jobs:
|
|||
- name: Setup PHP 🔩
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
php-version: '8.2'
|
||||
|
||||
- name: Install Composer dependencies 🪚
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
run: composer install --no-dev --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Get commit hash 🔗
|
||||
id: get-commit-hash
|
||||
|
@ -28,44 +28,18 @@ jobs:
|
|||
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/*" ".github/*"
|
||||
zip -r "$ZIP_NAME" . -x ".git/*"
|
||||
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Archive 📤
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: TorrentPier
|
||||
name: TorrentPier-master
|
||||
path: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
||||
|
||||
deploy:
|
||||
name: 🎉 Deploy
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: 🚚 Get latest code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🔩 Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
|
||||
- name: 🖇 Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: 📂 Sync files
|
||||
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||
with:
|
||||
server: ${{ secrets.FTP_SERVER }}
|
||||
username: ${{ secrets.FTP_USERNAME }}
|
||||
password: ${{ secrets.FTP_PASSWORD }}
|
||||
server-dir: ${{ secrets.FTP_DIR }}
|
||||
protocol: ${{ secrets.FTP_PROTOCOL }}
|
||||
port: ${{ secrets.FTP_PORT }}
|
||||
exclude: |
|
||||
**/.git*
|
||||
**/.git*/**
|
||||
.env
|
||||
|
|
4
.github/workflows/schedule.yml
vendored
4
.github/workflows/schedule.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
id: git-cliff
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: v2.4.5-rc.2.. --verbose
|
||||
args: v2.4.6-alpha.4.. --verbose
|
||||
env:
|
||||
OUTPUT: CHANGELOG.md
|
||||
GITHUB_REPO: ${{ github.repository }}
|
||||
|
@ -37,5 +37,5 @@ jobs:
|
|||
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
||||
set +e
|
||||
git add CHANGELOG.md
|
||||
git commit -m "Update CHANGELOG.md 📖"
|
||||
git commit -m "changelog: Update CHANGELOG.md 📖"
|
||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,7 +4,6 @@
|
|||
|
||||
### TorrentPier ###
|
||||
*.log
|
||||
/*.txt
|
||||
install.php_*
|
||||
composer-setup.php
|
||||
.env
|
||||
|
|
210
CHANGELOG.md
210
CHANGELOG.md
|
@ -1,151 +1,113 @@
|
|||
[](https://github.com/torrentpier)
|
||||
|
||||
# 📖 Change Log
|
||||
|
||||
> [!NOTE]
|
||||
> To view changelog from **v2.0.0** to **v2.4.5-rc.2** navigate to [HISTORY.md](HISTORY.md).
|
||||
## [nightly](https://nightly.link/torrentpier/torrentpier/workflows/build/master/TorrentPier)
|
||||
## [v2.8.3](https://github.com/torrentpier/torrentpier/compare/v2.8.2..v2.8.3) (2025-07-03)
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- *(captcha)* Added `Text Captcha` provider ([#1839](https://github.com/torrentpier/torrentpier/pull/1839)) - ([74ea157](https://github.com/torrentpier/torrentpier/commit/74ea1573b298be5a935caaca0b3cc57cb1e9264a))
|
||||
- *(show post bbcode)* Added `'only_for_first_post'` param ([#1830](https://github.com/torrentpier/torrentpier/pull/1830)) - ([4dcd1fb](https://github.com/torrentpier/torrentpier/commit/4dcd1fb16e4e84acd1231ad821a2f05658b849ad))
|
||||
- *(sitemap)* Update `lastmod` when a new reply in topic ([#1737](https://github.com/torrentpier/torrentpier/pull/1737)) - ([bc95e14](https://github.com/torrentpier/torrentpier/commit/bc95e14be328303bb37e31299661b03045e37d07))
|
||||
- Added `$bb_cfg['auto_language_detection']` parametr ([#1835](https://github.com/torrentpier/torrentpier/pull/1835)) - ([b550fa5](https://github.com/torrentpier/torrentpier/commit/b550fa59f9ee96ca89e5b6db880147bc72841e93))
|
||||
- Easter egg for the 20th anniversary of the TorrentPier! ([#1831](https://github.com/torrentpier/torrentpier/pull/1831)) - ([f2e513d](https://github.com/torrentpier/torrentpier/commit/f2e513dd8b0f82f4f02474db4b83d83904a93f29))
|
||||
- Added configuration files for `nginx` & `caddy` ([#1787](https://github.com/torrentpier/torrentpier/pull/1787)) - ([f7d3946](https://github.com/torrentpier/torrentpier/commit/f7d394607e4ea5bb9b7f2b33692204a226a4d78b))
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(info.php)* Undefined array key "show" ([#1836](https://github.com/torrentpier/torrentpier/pull/1836)) - ([f8c4e8f](https://github.com/torrentpier/torrentpier/commit/f8c4e8fb14090bc7403f24e363603bad9e231351))
|
||||
- *(tr_seed_bonus.php)* Incorrect `GROUP BY` ([#1820](https://github.com/torrentpier/torrentpier/pull/1820)) - ([dfd4e5e](https://github.com/torrentpier/torrentpier/commit/dfd4e5ebc9df916868210a7844f2a6f35e7b8aca))
|
||||
|
||||
### 📦 Dependencies
|
||||
|
||||
- *(deps)* Bump bugsnag/bugsnag from 3.29.2 to 3.29.3 ([#1837](https://github.com/torrentpier/torrentpier/pull/1837)) - ([b954815](https://github.com/torrentpier/torrentpier/commit/b954815f5d0dce9520f65679e834d8bd49e571e0))
|
||||
- *(deps)* Bump php-curl-class/php-curl-class from 11.0.3 to 11.0.4 ([#1823](https://github.com/torrentpier/torrentpier/pull/1823)) - ([1c323a4](https://github.com/torrentpier/torrentpier/commit/1c323a45d777b033155da9a2becec506215bd94c))
|
||||
- *(deps)* Bump php-curl-class/php-curl-class from 11.0.1 to 11.0.3 ([#1821](https://github.com/torrentpier/torrentpier/pull/1821)) - ([dedf35b](https://github.com/torrentpier/torrentpier/commit/dedf35b794196034eb27d4125dff0798aed5f315))
|
||||
|
||||
### 🗑️ Removed
|
||||
|
||||
- *(posting.php)* Unused `'U_VIEWTOPIC` variable ([#1818](https://github.com/torrentpier/torrentpier/pull/1818)) - ([03ebbda](https://github.com/torrentpier/torrentpier/commit/03ebbda6be567d82d2a49fefe02356544fbd07cb))
|
||||
- Integrity checker 🥺🪦 ([#1827](https://github.com/torrentpier/torrentpier/pull/1827)) - ([ba3ce88](https://github.com/torrentpier/torrentpier/commit/ba3ce885c8d84ae939a0ce9c79b97877d3aaab41))
|
||||
- Redundant `.htaccess` files ([#1826](https://github.com/torrentpier/torrentpier/pull/1826)) - ([912b080](https://github.com/torrentpier/torrentpier/commit/912b080b16438b09f82fbc72a363589cc2f6209e))
|
||||
- *(lang)* Added `RTL` languages support ([#2031](https://github.com/torrentpier/torrentpier/pull/2031)) - ([fd46d3d](https://github.com/torrentpier/torrentpier/commit/fd46d3d04ad3ab1453256b2ab620508e2ba33586))
|
||||
- *(updater)* Added exceptions logging ([#2026](https://github.com/torrentpier/torrentpier/pull/2026)) - ([51f2c70](https://github.com/torrentpier/torrentpier/commit/51f2c70d81b910012cdecd111b5b92c1dfd0d6f6))
|
||||
|
||||
### 🚜 Refactor
|
||||
|
||||
- Moved classes from `Legacy` folder to `src` root ([#1828](https://github.com/torrentpier/torrentpier/pull/1828)) - ([92ce77e](https://github.com/torrentpier/torrentpier/commit/92ce77ec0ec703c08a659419087a373f76e711f7))
|
||||
- *(TorrentFileList)* Reduce duplication in root directory unset logic ([#2027](https://github.com/torrentpier/torrentpier/pull/2027)) - ([d4d8210](https://github.com/torrentpier/torrentpier/commit/d4d82101dd67c9f4cd86e0f6f909495696974354))
|
||||
|
||||
### ⚙️ Miscellaneous
|
||||
|
||||
- *(Caddyfile)* Some minor fixes ([#1822](https://github.com/torrentpier/torrentpier/pull/1822)) - ([6f641aa](https://github.com/torrentpier/torrentpier/commit/6f641aa9d8d7afb30920c054a43347393ea05cc4))
|
||||
- *(README)* Fixed all grammatical errors, sentence structure and readibility ([#1812](https://github.com/torrentpier/torrentpier/pull/1812)) - ([bea3b0b](https://github.com/torrentpier/torrentpier/commit/bea3b0bccf335970ea5826543d8fa223329ef077))
|
||||
- *(_cleanup.php)* Added CLI mode check ([#1834](https://github.com/torrentpier/torrentpier/pull/1834)) - ([5dc9a54](https://github.com/torrentpier/torrentpier/commit/5dc9a5475c051911c579ea732ef52d7feb78e8ac))
|
||||
- *(announcer)* Some minor improvements ([#1819](https://github.com/torrentpier/torrentpier/pull/1819)) - ([bdefed4](https://github.com/torrentpier/torrentpier/commit/bdefed4dab3cc65330fcb9cb9750cc8e84beda1d))
|
||||
- *(cliff)* Removed TorrentPier logo ([#1817](https://github.com/torrentpier/torrentpier/pull/1817)) - ([7794242](https://github.com/torrentpier/torrentpier/commit/7794242750b44183312a2a45c9f54c6afde12f0e))
|
||||
- *(cliff)* Synced `cliff-releases.toml` with `cliff.toml` changes ([#1815](https://github.com/torrentpier/torrentpier/pull/1815)) - ([f2aea92](https://github.com/torrentpier/torrentpier/commit/f2aea92b3d79d72254e696fde31ad9b4bec5dcd0))
|
||||
- *(cliff)* Added missing line breaks after `body` ([#1814](https://github.com/torrentpier/torrentpier/pull/1814)) - ([2593f09](https://github.com/torrentpier/torrentpier/commit/2593f093a389a9c450725290862b99d911fbef5d))
|
||||
- *(installer)* Added cleanup step (for master builds) ([#1838](https://github.com/torrentpier/torrentpier/pull/1838)) - ([dd72136](https://github.com/torrentpier/torrentpier/commit/dd721367c7dc9956861fcd33af7f9f822cf80011))
|
||||
- *(installer)* Some minor improvements ([#1825](https://github.com/torrentpier/torrentpier/pull/1825)) - ([4f89685](https://github.com/torrentpier/torrentpier/commit/4f896854d3bb67300027f7542704f41c4869837f))
|
||||
- *(installer)* Some minor improvements ([#1824](https://github.com/torrentpier/torrentpier/pull/1824)) - ([f3714f0](https://github.com/torrentpier/torrentpier/commit/f3714f02f2c8fbfaccfdafb8f25a269664c48950))
|
||||
- *(workflow)* Short `release_name` ([#1816](https://github.com/torrentpier/torrentpier/pull/1816)) - ([c57db21](https://github.com/torrentpier/torrentpier/commit/c57db2104d7b8363d0b8ce8872ce90fc7410c724))
|
||||
- *(workflow)* Added `workflow_dispatch` for `schedule.yml` ([#1813](https://github.com/torrentpier/torrentpier/pull/1813)) - ([d54c07b](https://github.com/torrentpier/torrentpier/commit/d54c07b3da00fc8bcba5413cd4ae3f3c9f6007bb))
|
||||
- *(workflow)* Some improvements ([#1811](https://github.com/torrentpier/torrentpier/pull/1811)) - ([3a9dd6a](https://github.com/torrentpier/torrentpier/commit/3a9dd6a3c931cfbd682257c283a3296c4914548f))
|
||||
- *(workflow)* Some improvements ([#1810](https://github.com/torrentpier/torrentpier/pull/1810)) - ([c168c39](https://github.com/torrentpier/torrentpier/commit/c168c3956cf77886c14133ac10ec33aa0ae5bc4e))
|
||||
- Replaced `gregwar/captcha` with my own fork ([#1840](https://github.com/torrentpier/torrentpier/pull/1840)) - ([8585560](https://github.com/torrentpier/torrentpier/commit/858556043d3e45218ea8e803786d6b6de6d485d0))
|
||||
- Created cleanup script (for releases preparation) ([#1833](https://github.com/torrentpier/torrentpier/pull/1833)) - ([68bf26d](https://github.com/torrentpier/torrentpier/commit/68bf26d0f4ab33f5394d26f425e53817f3464ac8))
|
||||
- Bring back missing `cache` & `log` directories ([#1832](https://github.com/torrentpier/torrentpier/pull/1832)) - ([249c988](https://github.com/torrentpier/torrentpier/commit/249c9889890291d56317dd703414bdb57ecaa41f))
|
||||
- Some minor improvements ([#1829](https://github.com/torrentpier/torrentpier/pull/1829)) - ([3b8ee4c](https://github.com/torrentpier/torrentpier/commit/3b8ee4c4d3ab4631425fbe44f197b6a9bd7d158c))
|
||||
|
||||
## New Contributors ❤️
|
||||
|
||||
* @xeddmc made their first contribution in [#1812](https://github.com/torrentpier/torrentpier/pull/1812)
|
||||
|
||||
## [v2.4.5-rc.3](https://github.com/torrentpier/torrentpier/compare/v2.4.5-rc.2..v2.4.5-rc.3) (2025-02-06)
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- *(announcer)* Added some disallowed ports by default ([#1767](https://github.com/torrentpier/torrentpier/pull/1767)) - ([46288ec](https://github.com/torrentpier/torrentpier/commit/46288ec19830c84aedb156e1f30d7ec8a0803e0d))
|
||||
- *(announcer)* Added `is_numeric()` checking for some fields ([#1766](https://github.com/torrentpier/torrentpier/pull/1766)) - ([096bb51](https://github.com/torrentpier/torrentpier/commit/096bb5124fa27d27c3e60031edc432d877f1c507))
|
||||
- *(announcer)* Added `event` verifying ([#1765](https://github.com/torrentpier/torrentpier/pull/1765)) - ([6a19323](https://github.com/torrentpier/torrentpier/commit/6a1932313801e55fbcfb047fdcef87266f472c33))
|
||||
- *(announcer)* Block browser by checking the `User-Agent` ([#1764](https://github.com/torrentpier/torrentpier/pull/1764)) - ([7b64b50](https://github.com/torrentpier/torrentpier/commit/7b64b508199af568472fe6ac2edf333a3e274a00))
|
||||
- *(announcer)* Block `User-Agent` strings that are too long ([#1763](https://github.com/torrentpier/torrentpier/pull/1763)) - ([a98f8f1](https://github.com/torrentpier/torrentpier/commit/a98f8f102a8253b0b22c80ef444fed1ec29177f3))
|
||||
- *(announcer)* Blocking all ports lower then `1024` ([#1762](https://github.com/torrentpier/torrentpier/pull/1762)) - ([1bc7e09](https://github.com/torrentpier/torrentpier/commit/1bc7e09ddbeaf680b86095eed9a80b8ebf6169b3))
|
||||
- *(cache)* Checking if extensions are installed ([#1759](https://github.com/torrentpier/torrentpier/pull/1759)) - ([7f31022](https://github.com/torrentpier/torrentpier/commit/7f31022cfca2acb28a5cba06961eeaf8d2c9de51))
|
||||
- *(captcha)* Added some new services 🤖 ([#1771](https://github.com/torrentpier/torrentpier/pull/1771)) - ([d413c71](https://github.com/torrentpier/torrentpier/commit/d413c717188c9bd906f715e7137955dc9a42a003))
|
||||
- *(environment)* Make configurable `TP_HOST` and `TP_PORT` ([#1780](https://github.com/torrentpier/torrentpier/pull/1780)) - ([e51e091](https://github.com/torrentpier/torrentpier/commit/e51e09159333382a77b809b5f1da5e152a713143))
|
||||
- *(installer)* Fully show non-installed extensions ([#1761](https://github.com/torrentpier/torrentpier/pull/1761)) - ([8fcc62d](https://github.com/torrentpier/torrentpier/commit/8fcc62d2a2fd41927b2f5dae215fe5bbf95f2c96))
|
||||
- *(installer)* More explanations ([#1758](https://github.com/torrentpier/torrentpier/pull/1758)) - ([48ab52a](https://github.com/torrentpier/torrentpier/commit/48ab52ac8674afcb607c8e49134316a3e117236a))
|
||||
- *(installer)* Check `Composer` dependencies after installing ([#1756](https://github.com/torrentpier/torrentpier/pull/1756)) - ([262b887](https://github.com/torrentpier/torrentpier/commit/262b8872a5b14068eb73d745adea6203c557e192))
|
||||
- *(installer)* More explanations ([#1754](https://github.com/torrentpier/torrentpier/pull/1754)) - ([fd6f1f8](https://github.com/torrentpier/torrentpier/commit/fd6f1f86a5e9216469cd648601ecb9ba875f9eb6))
|
||||
- *(installer)* Create `config.local.php` on local environment ([#1745](https://github.com/torrentpier/torrentpier/pull/1745)) - ([0d93b2c](https://github.com/torrentpier/torrentpier/commit/0d93b2c768c2965c12ac62e2f3b2886dc1ef31c2))
|
||||
- *(torrent)* Bring back old torrent file naming ([#1783](https://github.com/torrentpier/torrentpier/pull/1783)) - ([314c592](https://github.com/torrentpier/torrentpier/commit/314c592affbef4b8db48d562b9633aad27059a76))
|
||||
- *(workflow)* Automated deploy actual changes to `TorrentPier Demo` ([#1788](https://github.com/torrentpier/torrentpier/pull/1788)) - ([4333d6a](https://github.com/torrentpier/torrentpier/commit/4333d6aca4aeb8584ff8a8ef0bf76c537a3f371a))
|
||||
- Used `TORRENT_MIMETYPE` constant instead of hardcoded string ([#1757](https://github.com/torrentpier/torrentpier/pull/1757)) - ([4b0d270](https://github.com/torrentpier/torrentpier/commit/4b0d270c89ec06abed590504f6a0cb70076a9e59))
|
||||
## [v2.8.2](https://github.com/torrentpier/torrentpier/compare/v2.8.1..v2.8.2) (2025-06-30)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(announcer)* Null `event` exception ([#1784](https://github.com/torrentpier/torrentpier/pull/1784)) - ([b06e327](https://github.com/torrentpier/torrentpier/commit/b06e327cbb285a676814699eb5fb1fbc0e1f22e8))
|
||||
- *(bb_die)* HTML characters converting ([#1744](https://github.com/torrentpier/torrentpier/pull/1744)) - ([4f1c7e4](https://github.com/torrentpier/torrentpier/commit/4f1c7e40d82e52f81eba44ead501e1f01058cc4f))
|
||||
- *(debug)* Disabled `Bugsnag` reporting on local environment ([#1751](https://github.com/torrentpier/torrentpier/pull/1751)) - ([1f3b629](https://github.com/torrentpier/torrentpier/commit/1f3b629e9cea4d11fbf3cf29f575ba730bad898d))
|
||||
- *(installer)* Missing `gd` extension ([#1749](https://github.com/torrentpier/torrentpier/pull/1749)) - ([a1c519d](https://github.com/torrentpier/torrentpier/commit/a1c519d938b848edffcbf7fbbe6a3fdb9a5394f1))
|
||||
- *(youtube player)* Mixed content issue ([#1795](https://github.com/torrentpier/torrentpier/pull/1795)) - ([3c0a1d5](https://github.com/torrentpier/torrentpier/commit/3c0a1d5d0018daa87ad3914ea04078a9a6d05fc2))
|
||||
- Null `$bb_cfg['tp_instance_hash']` ([#1790](https://github.com/torrentpier/torrentpier/pull/1790)) - ([602137b](https://github.com/torrentpier/torrentpier/commit/602137b65129b817811b80975a369ebde3270c6d))
|
||||
- Incorrect peer country flag ([#1768](https://github.com/torrentpier/torrentpier/pull/1768)) - ([0f091eb](https://github.com/torrentpier/torrentpier/commit/0f091eb546e34923d9d1ab34be5faf92080ec198))
|
||||
- *(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))
|
||||
|
||||
### 📦 Dependencies
|
||||
### 🚜 Refactor
|
||||
|
||||
- *(deps)* Bump jacklul/monolog-telegram from 3.1.0 to 3.2.0 ([#1776](https://github.com/torrentpier/torrentpier/pull/1776)) - ([420c92c](https://github.com/torrentpier/torrentpier/commit/420c92c0addf4dee91f3ae872517cb3224827a1f))
|
||||
- *(deps)* Bump filp/whoops from 2.16.0 to 2.17.0 ([#1777](https://github.com/torrentpier/torrentpier/pull/1777)) - ([a71609b](https://github.com/torrentpier/torrentpier/commit/a71609ba67a89480fabb7b62de450d9be09373fa))
|
||||
- *(deps)* Bump php-curl-class/php-curl-class from 11.0.0 to 11.0.1 ([#1753](https://github.com/torrentpier/torrentpier/pull/1753)) - ([ce32031](https://github.com/torrentpier/torrentpier/commit/ce32031a0fb14cdf6c3f4ba379b530cbb52b0fea))
|
||||
- *(deps)* Bump bugsnag/bugsnag from 3.29.1 to 3.29.2 ([#1752](https://github.com/torrentpier/torrentpier/pull/1752)) - ([f63d15c](https://github.com/torrentpier/torrentpier/commit/f63d15c49e3992837413b2c7a0160d599b44f2ef))
|
||||
- Use `DEFAULT_CHARSET` constant instead of hardcoded string ([#2011](https://github.com/torrentpier/torrentpier/pull/2011)) - ([7ac3359](https://github.com/torrentpier/torrentpier/commit/7ac335974baa44a8575bebb71ae2fbc0902d10e7))
|
||||
|
||||
### 🗑️ Removed
|
||||
|
||||
- *(environment)* Extra `DB_CONNECTION` variable ([#1775](https://github.com/torrentpier/torrentpier/pull/1775)) - ([cd2786b](https://github.com/torrentpier/torrentpier/commit/cd2786bb69c74cec88a447f66750d014fc4d3612))
|
||||
- Some unused tracker config variables ([#1769](https://github.com/torrentpier/torrentpier/pull/1769)) - ([7f9df35](https://github.com/torrentpier/torrentpier/commit/7f9df35d3bd0e9d23284b8bd9c36a0f52158f5d7))
|
||||
## [v2.8.1](https://github.com/torrentpier/torrentpier/compare/v2.8.0..v2.8.1) (2025-06-24)
|
||||
|
||||
### 📚 Documentation
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Minor improvements ([#1750](https://github.com/torrentpier/torrentpier/pull/1750)) - ([3e850ac](https://github.com/torrentpier/torrentpier/commit/3e850ac724c43e813aa077b272b498e2b0477260))
|
||||
- *(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
|
||||
|
||||
- *(cd workflow)* Fixed release body creation ([#1809](https://github.com/torrentpier/torrentpier/pull/1809)) - ([7378cb3](https://github.com/torrentpier/torrentpier/commit/7378cb3af5cc56343c667a9d920038b05327e97b))
|
||||
- *(cd workflow)* Fixed release body creation ([#1807](https://github.com/torrentpier/torrentpier/pull/1807)) - ([cc679a8](https://github.com/torrentpier/torrentpier/commit/cc679a80246f3ff65136653025d826bf1458db3a))
|
||||
- *(changelog workflow)* Minor improvements ([#1802](https://github.com/torrentpier/torrentpier/pull/1802)) - ([15ca21f](https://github.com/torrentpier/torrentpier/commit/15ca21f03840281f7d4402959aa8bfb7d407b45b))
|
||||
- *(changelog workflow)* Some minor improvements ([#1801](https://github.com/torrentpier/torrentpier/pull/1801)) - ([2d53efc](https://github.com/torrentpier/torrentpier/commit/2d53efc945c7747be1755d0b66557a86bdc12cbd))
|
||||
- *(checksum workflow)* Fixed incorrect file path ([#1799](https://github.com/torrentpier/torrentpier/pull/1799)) - ([4eb5a9a](https://github.com/torrentpier/torrentpier/commit/4eb5a9adc61c4e116feb09208091efb914275da2))
|
||||
- *(cliff)* Changed emoji for dependencies ([#1755](https://github.com/torrentpier/torrentpier/pull/1755)) - ([55d4670](https://github.com/torrentpier/torrentpier/commit/55d467048370b51cd592982c8026702dca8813d5))
|
||||
- *(cliff)* Use blockquote for notice ([#1748](https://github.com/torrentpier/torrentpier/pull/1748)) - ([61e5592](https://github.com/torrentpier/torrentpier/commit/61e55925f312417bdb63c88a7c8939c3b2eb2ac5))
|
||||
- *(cliff)* Fixed typo ([#1747](https://github.com/torrentpier/torrentpier/pull/1747)) - ([4936af7](https://github.com/torrentpier/torrentpier/commit/4936af7d3d10f553d8586a14de249c32e50f3494))
|
||||
- *(cliff)* Notice about previous changelog file ([#1746](https://github.com/torrentpier/torrentpier/pull/1746)) - ([85395be](https://github.com/torrentpier/torrentpier/commit/85395be5e7c6a891c79ec72cf215894af097f819))
|
||||
- *(copyright)* Updated copyright year ([#1760](https://github.com/torrentpier/torrentpier/pull/1760)) - ([6697410](https://github.com/torrentpier/torrentpier/commit/6697410c1df6c8d9d7f511b1e984ae90d888ae0e))
|
||||
- *(database)* Use `DEFAULT ''` for `privmsgs_subject` ([#1786](https://github.com/torrentpier/torrentpier/pull/1786)) - ([387a258](https://github.com/torrentpier/torrentpier/commit/387a25870abd37b641b55ffd98e13f4aaecb73b1))
|
||||
- *(deploy action)* Specify some missing params ([#1789](https://github.com/torrentpier/torrentpier/pull/1789)) - ([6115900](https://github.com/torrentpier/torrentpier/commit/6115900b765752209a6ed1dfb83e4f0cbee2ae77))
|
||||
- *(emailer)* Use constants for email types ([#1794](https://github.com/torrentpier/torrentpier/pull/1794)) - ([c95d414](https://github.com/torrentpier/torrentpier/commit/c95d414ef63ca37118f1f660880cd58b4480c414))
|
||||
- *(integrity checker)* Disabled by default in `Demo mode` ([#1804](https://github.com/torrentpier/torrentpier/pull/1804)) - ([44be40c](https://github.com/torrentpier/torrentpier/commit/44be40c2e849c60eb4f10ca7e0bae0463791355e))
|
||||
- *(integrity checker)* Some enhancements ([#1797](https://github.com/torrentpier/torrentpier/pull/1797)) - ([09cafc2](https://github.com/torrentpier/torrentpier/commit/09cafc2285dd171cb2213ece9549993a3321527c))
|
||||
- *(issue template)* Improved `Feature request` template ([#1774](https://github.com/torrentpier/torrentpier/pull/1774)) - ([268f79d](https://github.com/torrentpier/torrentpier/commit/268f79d7259de67aa8877fcf7130ff0069469ab2))
|
||||
- *(issue template)* Improved `Bug report` template ([#1773](https://github.com/torrentpier/torrentpier/pull/1773)) - ([53ebfef](https://github.com/torrentpier/torrentpier/commit/53ebfef32c0e9016257e03b96ef96349e22d3e9b))
|
||||
- *(notify)* Hide notify checkbox in topic for guests ([#1793](https://github.com/torrentpier/torrentpier/pull/1793)) - ([8e4cd97](https://github.com/torrentpier/torrentpier/commit/8e4cd97734fc46f33459c4b00a0fe38b0597f92b))
|
||||
- *(readme)* Improved installation guide ([#1781](https://github.com/torrentpier/torrentpier/pull/1781)) - ([e579b81](https://github.com/torrentpier/torrentpier/commit/e579b816b4dc346b3242cb3d9db292ad05596c1f))
|
||||
- *(readme)* Minor improvements ([#1779](https://github.com/torrentpier/torrentpier/pull/1779)) - ([5b0ed02](https://github.com/torrentpier/torrentpier/commit/5b0ed020890a8f938df912f9215cccbda42b0317))
|
||||
- *(readme)* Added Caddy webserver ([#1778](https://github.com/torrentpier/torrentpier/pull/1778)) - ([970a028](https://github.com/torrentpier/torrentpier/commit/970a0282e3631c403029c959ffd46b21c5cad0cd))
|
||||
- *(workflow)* Refactored all workflows ([#1803](https://github.com/torrentpier/torrentpier/pull/1803)) - ([a29d57b](https://github.com/torrentpier/torrentpier/commit/a29d57b2f8673733bbfbea3fb96eebe841078d49))
|
||||
- *(workflow)* Trying combine `changelog workflow` with `checksums workflow` ([#1800](https://github.com/torrentpier/torrentpier/pull/1800)) - ([60c6057](https://github.com/torrentpier/torrentpier/commit/60c605778412335ce97d41489c3b6ee9c051454b))
|
||||
- Automated releases generation ([#1808](https://github.com/torrentpier/torrentpier/pull/1808)) - ([6c9372c](https://github.com/torrentpier/torrentpier/commit/6c9372c407327c9bb443b2ecf16eff64c0245c4b))
|
||||
- Automated releases generation ([#1806](https://github.com/torrentpier/torrentpier/pull/1806)) - ([bc74550](https://github.com/torrentpier/torrentpier/commit/bc745502940207f3f24c83057cd680fe69355961))
|
||||
- Automated releases generation ([#1805](https://github.com/torrentpier/torrentpier/pull/1805)) - ([425e2e8](https://github.com/torrentpier/torrentpier/commit/425e2e87d5a7f097b961b1a14fbafcdabb9d1666))
|
||||
- Minor improvements ([#1796](https://github.com/torrentpier/torrentpier/pull/1796)) - ([8650ad3](https://github.com/torrentpier/torrentpier/commit/8650ad30f429ab14a03f44b26d7be7701f1985f1))
|
||||
- Update `cliff.toml` - ([254dca2](https://github.com/torrentpier/torrentpier/commit/254dca2b27c2d92421d3e639c80b0adf1172202f))
|
||||
- Minor improvements ([#1743](https://github.com/torrentpier/torrentpier/pull/1743)) - ([e73d650](https://github.com/torrentpier/torrentpier/commit/e73d65011fff0a8b8e1368eef61bbfb67e87eab8))
|
||||
- Enabled `$bb_cfg['integrity_check']` by defaul ([#1742](https://github.com/torrentpier/torrentpier/pull/1742)) - ([7e3601e](https://github.com/torrentpier/torrentpier/commit/7e3601e63aff73be1428969ca37dda3da2537d9b))
|
||||
- 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))
|
||||
|
||||
### ◀️ Revert
|
||||
|
||||
- Fix: Null `$bb_cfg['tp_instance_hash']` ([#1792](https://github.com/torrentpier/torrentpier/pull/1792)) - ([4eb26ae](https://github.com/torrentpier/torrentpier/commit/4eb26ae37e1f4c82a45961517ffeb54c20200408))
|
||||
## [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))
|
||||
|
||||
## New Contributors ❤️
|
||||
|
||||
* @actions-user made their first contribution
|
||||
|
||||
<!-- generated by git-cliff -->
|
||||
|
|
144
CLAUDE.md
Normal file
144
CLAUDE.md
Normal file
|
@ -0,0 +1,144 @@
|
|||
# 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.
|
1131
HISTORY.md
1131
HISTORY.md
File diff suppressed because it is too large
Load diff
56
README.md
56
README.md
|
@ -8,9 +8,8 @@
|
|||
<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://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://nightly.link/torrentpier/torrentpier/workflows/build/master/TorrentPier"><img src="https://img.shields.io/badge/Nightly%20release-gray?logo=hackthebox&logoColor=fff" alt="TorrentPier nightly"></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/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>
|
||||
|
@ -20,29 +19,28 @@
|
|||
|
||||
## 🐂 About TorrentPier
|
||||
|
||||
TorrentPier — bull-powered BitTorrent Public/Private tracker engine, written in PHP. High speed, simple modifications, load-balanced
|
||||
architecture. In addition, we have a very helpful
|
||||
TorrentPier — bull-powered BitTorrent Public/Private tracker engine, written in PHP. High speed, simple modifications, load-balanced
|
||||
architecture. In addition, we have a very helpful
|
||||
[official support forum](https://torrentpier.com), where it's possible to get support and download modifications for the engine.
|
||||
|
||||
## 🌈 Current status
|
||||
|
||||
TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite the existing code to
|
||||
modern specifications. If you want delve deep into 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 of it.
|
||||
TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite the existing code to
|
||||
modern specifications. If you want to delve deep into 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.
|
||||
|
||||
## ✨ Features
|
||||
* Rich forum with browsing/moderation tools
|
||||
* High-load capable, heavily configurable announcer
|
||||
* Scrape support
|
||||
* FreeLeech
|
||||
* [IndexNow](https://www.indexnow.org) support
|
||||
* [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 is currently fully supported, with others in the future)
|
||||
* Multilingual support (Russian and English are currently fully supported, with others in the future)
|
||||
* Atom/RSS feeds
|
||||
* ... and so MUCH MORE!
|
||||
|
||||
|
@ -58,8 +56,8 @@ and go from there. The documentation will be translated to english in the near f
|
|||
## 🔧 Requirements
|
||||
|
||||
* Apache / nginx ([example config](install/nginx.conf)) / caddy ([example config](install/Caddyfile))
|
||||
* MySQL 5.5.3 or above / MariaDB 10.0 or above / Percona
|
||||
* PHP: 8.1 / 8.2 / 8.3 / 8.4
|
||||
* MySQL 5.5.3 or above (including MySQL 8.0+) / MariaDB 10.0 or above / Percona
|
||||
* PHP: 8.2 / 8.3 / 8.4
|
||||
* PHP Extensions: mbstring, gd, bcmath, intl, tidy (optional), xml, xmlwriter
|
||||
* Crontab (Recommended)
|
||||
|
||||
|
@ -71,7 +69,7 @@ For the installation, select one of the installation variants below:
|
|||
|
||||
Check out our [autoinstall](https://github.com/torrentpier/autoinstall) repository with detailed instructions.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> [!NOTE]
|
||||
> Thanks to [Sergei Solovev](https://github.com/SeAnSolovev) for this installation script ❤️
|
||||
|
||||
### Quick (For web-panels) ☕️
|
||||
|
@ -102,14 +100,20 @@ Check out our [autoinstall](https://github.com/torrentpier/autoinstall) reposito
|
|||
```shell
|
||||
composer install
|
||||
```
|
||||
5. Create a database and import the dump located at `install/sql/mysql.sql`
|
||||
6. Edit database configuration settings in the environment (`.env.example`), after, rename to `.env`
|
||||
5. Edit database configuration settings in the environment (`.env.example`), after, rename to `.env`
|
||||
6. Create a database and run migrations to set up the schema
|
||||
```shell
|
||||
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]
|
||||
> You can automate steps 4-7 by running `php install.php` instead, which will guide you through the setup process interactively.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 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.
|
||||
|
||||
|
@ -124,15 +128,29 @@ Check out our [autoinstall](https://github.com/torrentpier/autoinstall) reposito
|
|||
|
||||
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
|
||||
|
||||
* *It's recommended to run `cron.php`.* - For significant tracker speed increase it ay be required to replace the built-in cron.php in operating system daemon.
|
||||
* *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.
|
||||
* *Local configuration copy.* - You can override the settings using the local configuration file `library/config.local.php`.
|
||||
|
||||
## 💚 Contributing / Contributors
|
||||
|
||||
Please read our [contributing policy](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) for details, and the process for
|
||||
submitting pull requests to us. But we are always ready to renew your pull-request for compliance with
|
||||
Please read our [contributing policy](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) for details, and the process for
|
||||
submitting pull requests to us. But we are always ready to review your pull-request for compliance with
|
||||
these requirements. Just send it!
|
||||
|
||||
<a href="https://github.com/torrentpier/torrentpier/graphs/contributors">
|
||||
|
@ -143,7 +161,7 @@ Made with [contrib.rocks](https://contrib.rocks).
|
|||
|
||||
## 💞 Sponsoring
|
||||
|
||||
Support this project by becoming a sponsor or a backer.
|
||||
Support this project by becoming a sponsor or a backer.
|
||||
|
||||
[](https://opencollective.com/torrentpier)
|
||||
[](https://opencollective.com/torrentpier)
|
||||
|
@ -166,7 +184,7 @@ Support this project by becoming a sponsor or a backer.
|
|||
|
||||
## 📦 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).
|
||||
|
||||
## 📖 License
|
||||
|
||||
|
|
1261
UPGRADE_GUIDE.md
Normal file
1261
UPGRADE_GUIDE.md
Normal file
File diff suppressed because it is too large
Load diff
61
_cleanup.php
61
_cleanup.php
|
@ -9,27 +9,41 @@
|
|||
|
||||
if (!defined('BB_ROOT')) {
|
||||
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
define('BB_PATH', BB_ROOT);
|
||||
}
|
||||
|
||||
// Check CLI mode
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
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',
|
||||
'cliff-releases.toml',
|
||||
'CODE_OF_CONDUCT.md',
|
||||
'CONTRIBUTING.md',
|
||||
'crowdin.yml',
|
||||
'HISTORY.md',
|
||||
'phpunit.xml',
|
||||
'README.md',
|
||||
'SECURITY.md'
|
||||
'SECURITY.md',
|
||||
'tests',
|
||||
'UPGRADE_GUIDE.md'
|
||||
];
|
||||
|
||||
foreach ($items as $item) {
|
||||
|
@ -41,44 +55,3 @@ foreach ($items as $item) {
|
|||
removeDir($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove target file
|
||||
*
|
||||
* @param string $file Path to file
|
||||
*/
|
||||
function removeFile(string $file): void
|
||||
{
|
||||
if (unlink($file)) {
|
||||
echo "- File removed: $file" . PHP_EOL;
|
||||
} else {
|
||||
echo "- File cannot be removed: $file" . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folder (recursively)
|
||||
*
|
||||
* @param string $dir Path to folder
|
||||
*/
|
||||
function removeDir(string $dir): void
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
|
||||
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
removeDir($file->getPathname());
|
||||
} else {
|
||||
removeFile($file->getPathname());
|
||||
}
|
||||
}
|
||||
|
||||
if (rmdir($dir)) {
|
||||
echo "- Folder removed: $dir" . PHP_EOL;
|
||||
} else {
|
||||
echo "- Folder cannot be removed: $dir" . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
130
_release.php
Normal file
130
_release.php
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?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');
|
|
@ -69,44 +69,44 @@ $order_by = '';
|
|||
if ($view === 'username') {
|
||||
switch ($mode) {
|
||||
case 'username':
|
||||
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'attachments':
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'filesize':
|
||||
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
default:
|
||||
$mode = 'attachments';
|
||||
$sort_order = 'DESC';
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
}
|
||||
} elseif ($view === 'attachments') {
|
||||
switch ($mode) {
|
||||
case 'real_filename':
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'comment':
|
||||
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'extension':
|
||||
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'filesize':
|
||||
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'downloads':
|
||||
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
case 'post_time':
|
||||
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
default:
|
||||
$mode = 'a.real_filename';
|
||||
$sort_order = 'ASC';
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -470,8 +470,8 @@ if ($view === 'attachments') {
|
|||
}
|
||||
|
||||
// Generate Pagination
|
||||
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
|
||||
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start);
|
||||
if ($do_pagination && $total_rows > config()->get('topics_per_page')) {
|
||||
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, config()->get('topics_per_page'), $start);
|
||||
}
|
||||
|
||||
print_page('admin_attach_cp.tpl', 'admin');
|
||||
|
|
|
@ -136,8 +136,8 @@ switch ($mode) {
|
|||
'POSTS_PER_PAGE' => $new['posts_per_page'],
|
||||
'HOT_TOPIC' => $new['hot_threshold'],
|
||||
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
|
||||
'LANG_SELECT' => \TorrentPier\Legacy\Select::language($new['default_lang'], 'default_lang'),
|
||||
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($new['board_timezone'], 'board_timezone'),
|
||||
'LANG_SELECT' => \TorrentPier\Legacy\Common\Select::language($new['default_lang'], 'default_lang'),
|
||||
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Common\Select::timezone($new['board_timezone'], 'board_timezone'),
|
||||
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
|
||||
'LOGIN_RESET_TIME' => $new['login_reset_time'],
|
||||
'PRUNE_ENABLE' => (bool)$new['prune_enable'],
|
||||
|
|
|
@ -123,6 +123,7 @@ if ($submit) {
|
|||
}
|
||||
|
||||
$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>'));
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ if ($submit) {
|
|||
}
|
||||
|
||||
$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>'));
|
||||
} // End of submit
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
|
|||
$url = url_arg($url, $daysback_key, $daysback_val);
|
||||
}
|
||||
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
|
||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
||||
$tz = TIMENOW + (3600 * config()->get('board_timezone'));
|
||||
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
|
||||
$datetime_val = $tmp_timestamp;
|
||||
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
|
||||
|
|
|
@ -14,7 +14,7 @@ if (!empty($setmodules)) {
|
|||
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
if (!$bb_cfg['emailer']['enabled']) {
|
||||
if (!config()->get('emailer.enabled')) {
|
||||
bb_die($lang['EMAILER_DISABLED']);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ set_time_limit(1200);
|
|||
$subject = trim(request_var('subject', ''));
|
||||
$message = (string)request_var('message', '');
|
||||
$group_id = (int)request_var(POST_GROUPS_URL, 0);
|
||||
$reply_to = (string)request_var('reply_to', $bb_cfg['board_email']);
|
||||
$reply_to = (string)request_var('reply_to', config()->get('board_email'));
|
||||
$message_type = (string)request_var('message_type', '');
|
||||
|
||||
$errors = $user_id_sql = [];
|
||||
|
|
79
admin/admin_migrations.php
Normal file
79
admin/admin_migrations.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?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');
|
|
@ -29,6 +29,10 @@ if (isset($_GET['mode']) || isset($_POST['mode'])) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($mode == 'delete' && isset($_POST['cancel'])) {
|
||||
$mode = '';
|
||||
}
|
||||
|
||||
if ($mode != '') {
|
||||
if ($mode == 'edit' || $mode == 'add') {
|
||||
//
|
||||
|
@ -123,29 +127,40 @@ if ($mode != '') {
|
|||
// Ok, they want to delete their rank
|
||||
//
|
||||
|
||||
$confirmed = isset($_POST['confirm']);
|
||||
if (isset($_POST['id']) || isset($_GET['id'])) {
|
||||
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
|
||||
} else {
|
||||
$rank_id = 0;
|
||||
}
|
||||
|
||||
if ($rank_id) {
|
||||
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
|
||||
if ($confirmed) {
|
||||
if ($rank_id) {
|
||||
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not delete rank data');
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not delete rank data');
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die($lang['NO_UPDATE_RANKS']);
|
||||
}
|
||||
|
||||
$datastore->update('ranks');
|
||||
|
||||
bb_die($lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
} else {
|
||||
bb_die($lang['MUST_SELECT_RANK']);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die($lang['NO_UPDATE_RANKS']);
|
||||
}
|
||||
|
||||
$datastore->update('ranks');
|
||||
|
||||
bb_die($lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||
} else {
|
||||
bb_die($lang['MUST_SELECT_RANK']);
|
||||
$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 {
|
||||
bb_die('Invalid mode');
|
||||
|
|
45
admin/admin_robots.php
Normal file
45
admin/admin_robots.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?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');
|
|
@ -14,7 +14,7 @@ if (!empty($setmodules)) {
|
|||
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_CONFIG;
|
||||
$sql = "SELECT * FROM " . BB_CONFIG . " WHERE config_name IN('sitemap_time', 'static_sitemap')";
|
||||
|
||||
if (!$result = DB()->sql_query($sql)) {
|
||||
bb_die('Could not query config information in admin_sitemap');
|
||||
|
@ -39,7 +39,7 @@ if (!$result = DB()->sql_query($sql)) {
|
|||
}
|
||||
}
|
||||
|
||||
$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>';
|
||||
$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>';
|
||||
$message = is_file(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
|
||||
|
||||
$template->assign_vars([
|
||||
|
|
|
@ -22,7 +22,11 @@ if (isset($_POST['mode']) || isset($_GET['mode'])) {
|
|||
$mode = '';
|
||||
}
|
||||
|
||||
$pathToSmilesDir = BB_ROOT . $bb_cfg['smilies_path'];
|
||||
if ($mode == 'delete' && isset($_POST['cancel'])) {
|
||||
$mode = '';
|
||||
}
|
||||
|
||||
$pathToSmilesDir = BB_ROOT . config()->get('smilies_path');
|
||||
$delimeter = '=+:';
|
||||
$s_hidden_fields = '';
|
||||
$smiley_paks = $smiley_images = [];
|
||||
|
@ -174,17 +178,28 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
|
|||
} elseif ($mode != '') {
|
||||
switch ($mode) {
|
||||
case 'delete':
|
||||
$confirmed = isset($_POST['confirm']);
|
||||
$smiley_id = (!empty($_POST['id'])) ? $_POST['id'] : $_GET['id'];
|
||||
$smiley_id = (int)$smiley_id;
|
||||
|
||||
$sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id;
|
||||
$result = DB()->sql_query($sql);
|
||||
if (!$result) {
|
||||
bb_die('Could not delete smiley');
|
||||
}
|
||||
$datastore->update('smile_replacements');
|
||||
if ($confirmed) {
|
||||
$sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id;
|
||||
$result = DB()->sql_query($sql);
|
||||
if (!$result) {
|
||||
bb_die('Could not delete smiley');
|
||||
}
|
||||
|
||||
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>'));
|
||||
$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([
|
||||
'FORM_ACTION' => 'admin_smilies.php',
|
||||
'HIDDEN_FIELDS' => $hidden_fields,
|
||||
]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
|
|
|
@ -17,15 +17,15 @@ 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_die($lang['CONFIG_UPDATED']);
|
||||
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>'));
|
||||
}
|
||||
|
||||
$template->assign_vars([
|
||||
'S_ACTION' => 'admin_terms.php',
|
||||
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
|
||||
'MESSAGE' => $preview ? $_POST['message'] : $bb_cfg['terms'],
|
||||
'EXT_LINK_NW' => config()->get('ext_link_new_win'),
|
||||
'MESSAGE' => $preview ? $_POST['message'] : config()->get('terms'),
|
||||
'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '',
|
||||
]);
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ $max_forum_name_length = 50;
|
|||
$yes_sign = '√';
|
||||
$no_sign = 'x';
|
||||
|
||||
$group_id = isset($_REQUEST['g']) ? (int)$_REQUEST['g'] : 0;
|
||||
$user_id = isset($_REQUEST['u']) ? (int)$_REQUEST['u'] : 0;
|
||||
$cat_id = isset($_REQUEST['c']) ? (int)$_REQUEST['c'] : 0;
|
||||
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0;
|
||||
$user_id = isset($_REQUEST[POST_USERS_URL]) ? (int)$_REQUEST[POST_USERS_URL] : 0;
|
||||
$cat_id = isset($_REQUEST[POST_CAT_URL]) ? (int)$_REQUEST[POST_CAT_URL] : 0;
|
||||
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
|
||||
$submit = isset($_REQUEST['submit']);
|
||||
|
||||
|
@ -200,7 +200,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
|
|||
'CAT_HREF' => "$base_url&" . POST_CAT_URL . "=$c_id",
|
||||
));
|
||||
|
||||
if (!$c =& $_REQUEST['c'] or !in_array($c, array('all', $c_id)) or empty($c_data['forums'])) {
|
||||
if (!$c =& $_REQUEST[POST_CAT_URL] or !in_array($c, array('all', $c_id)) or empty($c_data['forums'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
|
|||
'CAT_HREF' => "$base_url&" . POST_CAT_URL . "=$c_id",
|
||||
));
|
||||
|
||||
if (!($c =& $_REQUEST['c']) || !in_array($c, array('all', $c_id)) || empty($c_data['forums'])) {
|
||||
if (!($c =& $_REQUEST[POST_CAT_URL]) || !in_array($c, array('all', $c_id)) || empty($c_data['forums'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ if (!isset($_REQUEST['dosearch'])) {
|
|||
}
|
||||
}
|
||||
|
||||
$language_list = \TorrentPier\Legacy\Select::language('', 'language_type');
|
||||
$timezone_list = \TorrentPier\Legacy\Select::timezone('', 'timezone_type');
|
||||
$language_list = \TorrentPier\Legacy\Common\Select::language('', 'language_type');
|
||||
$timezone_list = \TorrentPier\Legacy\Common\Select::timezone('', 'timezone_type');
|
||||
|
||||
$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 )
|
||||
|
@ -841,10 +841,10 @@ if (!isset($_REQUEST['dosearch'])) {
|
|||
if ($page == 1) {
|
||||
$offset = 0;
|
||||
} else {
|
||||
$offset = (($page - 1) * $bb_cfg['topics_per_page']);
|
||||
$offset = (($page - 1) * config()->get('topics_per_page'));
|
||||
}
|
||||
|
||||
$limit = "LIMIT $offset, " . $bb_cfg['topics_per_page'];
|
||||
$limit = "LIMIT $offset, " . config()->get('topics_per_page');
|
||||
|
||||
$select_sql .= " $limit";
|
||||
|
||||
|
@ -859,7 +859,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
|||
bb_die($lang['SEARCH_NO_RESULTS']);
|
||||
}
|
||||
}
|
||||
$num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
|
||||
$num_pages = ceil($total_pages['total'] / config()->get('topics_per_page'));
|
||||
|
||||
$pagination = '';
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ if (!empty($setmodules)) {
|
|||
|
||||
require __DIR__ . '/pagestart.php';
|
||||
|
||||
if (!$bb_cfg['use_word_censor']) {
|
||||
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
|
||||
if (!config()->get('use_word_censor')) {
|
||||
bb_die('Word censor disabled <br /><br /> (use_word_censor in config.php)');
|
||||
}
|
||||
|
||||
$mode = request_var('mode', '');
|
||||
|
@ -81,6 +81,7 @@ if ($mode != '') {
|
|||
}
|
||||
|
||||
$datastore->update('censor');
|
||||
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>');
|
||||
|
||||
bb_die($message);
|
||||
|
@ -95,6 +96,7 @@ if ($mode != '') {
|
|||
}
|
||||
|
||||
$datastore->update('censor');
|
||||
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>'));
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
|
||||
$template->assign_vars([
|
||||
'TPL_ADMIN_MAIN' => true,
|
||||
'ADMIN_LOCK' => (bool)$bb_cfg['board_disable'],
|
||||
'ADMIN_LOCK' => (bool)config()->get('board_disable'),
|
||||
'ADMIN_LOCK_CRON' => is_file(BB_DISABLED),
|
||||
]);
|
||||
|
||||
|
@ -90,7 +90,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
'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_MD5' => $update_data['latest_version_checksum']
|
||||
'NEW_VERSION_HASH' => $update_data['latest_version_checksum']
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
$total_posts = $stats['postcount'];
|
||||
$total_topics = $stats['topiccount'];
|
||||
$total_users = $stats['usercount'];
|
||||
$start_date = bb_date($bb_cfg['board_startdate']);
|
||||
$boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400;
|
||||
$start_date = bb_date(config()->get('board_startdate'));
|
||||
$boarddays = (TIMENOW - config()->get('board_startdate')) / 86400;
|
||||
|
||||
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
||||
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
||||
|
@ -107,10 +107,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
|
||||
$avatar_dir_size = 0;
|
||||
|
||||
if ($avatar_dir = opendir($bb_cfg['avatars']['upload_path'])) {
|
||||
if ($avatar_dir = opendir(config()->get('avatars.upload_path'))) {
|
||||
while ($file = readdir($avatar_dir)) {
|
||||
if ($file != '.' && $file != '..') {
|
||||
$avatar_dir_size += @filesize($bb_cfg['avatars']['upload_path'] . $file);
|
||||
$avatar_dir_size += @filesize(config()->get('avatars.upload_path') . $file);
|
||||
}
|
||||
}
|
||||
closedir($avatar_dir);
|
||||
|
@ -187,7 +187,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'd-M-Y H:i', false),
|
||||
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'd-M-Y H:i', false),
|
||||
'IP_ADDRESS' => $reg_ip,
|
||||
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
|
||||
'U_WHOIS_IP' => config()->get('whois_info') . $reg_ip,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'd-M-Y H:i', false),
|
||||
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'd-M-Y H:i', false),
|
||||
'IP_ADDRESS' => $guest_ip,
|
||||
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
|
||||
'U_WHOIS_IP' => config()->get('whois_info') . $guest_ip,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ echo '<html><body><head></head>';
|
|||
echo '<br /><br /><table border="1" cellspacing="0" cellpadding="6" align="center">';
|
||||
|
||||
foreach ($sql as $i => $query) {
|
||||
$row = mysqli_fetch_row(DB()->query($query))[0];
|
||||
$result = DB()->fetch_row($query);
|
||||
$row = array_values($result)[0]; // Get first column value
|
||||
$row = ($i == 2) ? humn_size($row) : $row;
|
||||
echo "<tr><td>{$lang['TR_STATS'][$i]}</td><td><b>$row</b></td>";
|
||||
}
|
||||
|
@ -39,7 +40,7 @@ foreach ($sql as $i => $query) {
|
|||
echo '</table>';
|
||||
echo '<div align="center"><pre>';
|
||||
|
||||
echo 'gen time: <b>' . sprintf('%.4f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
|
||||
echo '</pre></div>';
|
||||
echo '</body></html>';
|
||||
|
|
|
@ -21,7 +21,7 @@ if (!IS_ADMIN) {
|
|||
$peers_in_last_minutes = [30, 15, 5, 1];
|
||||
$peers_in_last_sec_limit = 300;
|
||||
|
||||
$announce_interval = (int)$bb_cfg['announce_interval'];
|
||||
$announce_interval = (int)config()->get('announce_interval');
|
||||
$stat = [];
|
||||
|
||||
define('TMP_TRACKER_TABLE', 'tmp_tracker');
|
||||
|
@ -173,7 +173,7 @@ echo '</table>';
|
|||
echo !$client_full ? '<p style = "text-align:right;">Simple stats for clients are being cached for one hour.</p>' : '';
|
||||
echo '<div align="center"><pre>';
|
||||
|
||||
echo 'gen time: <b>' . sprintf('%.4f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo '</pre></div>';
|
||||
echo '</body></html>';
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ define('IN_TRACKER', true);
|
|||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
// Check User-Agent for existence
|
||||
$userAgent = (string)$_SERVER['HTTP_USER_AGENT'];
|
||||
if (empty($userAgent)) {
|
||||
|
@ -20,8 +18,8 @@ if (empty($userAgent)) {
|
|||
die;
|
||||
}
|
||||
|
||||
$announce_interval = $bb_cfg['announce_interval'];
|
||||
$passkey_key = $bb_cfg['passkey_key'];
|
||||
$announce_interval = config()->get('announce_interval');
|
||||
$passkey_key = config()->get('passkey_key');
|
||||
|
||||
// Recover info_hash
|
||||
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
|
||||
|
@ -67,10 +65,10 @@ if (strlen($peer_id) !== 20) {
|
|||
}
|
||||
|
||||
// Check for client ban
|
||||
if ($bb_cfg['client_ban']['enabled']) {
|
||||
if (config()->get('client_ban.enabled')) {
|
||||
$targetClient = [];
|
||||
|
||||
foreach ($bb_cfg['client_ban']['clients'] as $clientId => $banReason) {
|
||||
foreach (config()->get('client_ban.clients') as $clientId => $banReason) {
|
||||
if (str_starts_with($peer_id, $clientId)) {
|
||||
$targetClient = [
|
||||
'peer_id' => $clientId,
|
||||
|
@ -80,7 +78,7 @@ if ($bb_cfg['client_ban']['enabled']) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['client_ban']['only_allow_mode']) {
|
||||
if (config()->get('client_ban.only_allow_mode')) {
|
||||
if (empty($targetClient['peer_id'])) {
|
||||
msg_die('Your BitTorrent client has been banned!');
|
||||
}
|
||||
|
@ -117,7 +115,7 @@ $stopped = ($event === 'stopped');
|
|||
|
||||
// Check info_hash length
|
||||
if (strlen($info_hash) !== 20) {
|
||||
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
|
||||
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,7 +129,7 @@ if (
|
|||
|| !is_numeric($port)
|
||||
|| ($port < 1024 && !$stopped)
|
||||
|| $port > 0xFFFF
|
||||
|| (!empty($bb_cfg['disallowed_ports']) && in_array($port, $bb_cfg['disallowed_ports']))
|
||||
|| (!empty(config()->get('disallowed_ports')) && in_array($port, config()->get('disallowed_ports')))
|
||||
) {
|
||||
msg_die('Invalid port: ' . $port);
|
||||
}
|
||||
|
@ -170,13 +168,13 @@ if (preg_match('/(Mozilla|Browser|Chrome|Safari|AppleWebKit|Opera|Links|Lynx|Bot
|
|||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// 'ip' query handling
|
||||
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
||||
if (!$bb_cfg['verify_reported_ip'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
if (!config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
||||
if (!config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
|
||||
if ($x_ip === $_GET['ip']) {
|
||||
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP);
|
||||
if ($filteredIp !== false && ($bb_cfg['allow_internal_ip'] || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
|
||||
if ($filteredIp !== false && (config()->get('allow_internal_ip') || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
|
||||
$ip = $filteredIp;
|
||||
}
|
||||
}
|
||||
|
@ -248,9 +246,10 @@ if ($lp_info) {
|
|||
$passkey_sql = DB()->escape($passkey);
|
||||
|
||||
$sql = "
|
||||
SELECT tor.topic_id, tor.poster_id, tor.tor_type, tor.info_hash, tor.info_hash_v2, u.*
|
||||
SELECT tor.topic_id, tor.poster_id, tor.tor_type, tor.tor_status, tor.info_hash, tor.info_hash_v2, bt.*, u.user_level
|
||||
FROM " . BB_BT_TORRENTS . " tor
|
||||
LEFT JOIN " . BB_BT_USERS . " u ON u.auth_key = '$passkey_sql'
|
||||
LEFT JOIN " . BB_BT_USERS . " bt ON bt.auth_key = '$passkey_sql'
|
||||
LEFT JOIN " . BB_USERS . " u ON u.user_id = bt.user_id
|
||||
$info_hash_where
|
||||
LIMIT 1
|
||||
";
|
||||
|
@ -258,7 +257,7 @@ if ($lp_info) {
|
|||
|
||||
// Verify if torrent registered on tracker and user authorized
|
||||
if (empty($row['topic_id'])) {
|
||||
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
|
||||
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
|
||||
}
|
||||
if (empty($row['user_id'])) {
|
||||
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
|
||||
|
@ -266,13 +265,26 @@ if ($lp_info) {
|
|||
|
||||
// Assign variables
|
||||
$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'];
|
||||
$releaser = (int)($user_id == $row['poster_id']);
|
||||
$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
|
||||
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
|
||||
$stat_protocol = match ((int)$bb_cfg['tracker']['hybrid_stat_protocol']) {
|
||||
$stat_protocol = match ((int)config()->get('tracker.hybrid_stat_protocol')) {
|
||||
2 => substr($row['info_hash_v2'], 0, 20),
|
||||
default => $row['info_hash'] // 1
|
||||
};
|
||||
|
@ -282,7 +294,7 @@ if ($lp_info) {
|
|||
}
|
||||
|
||||
// Ratio limits
|
||||
if ((RATIO_ENABLED || $bb_cfg['tracker']['limit_concurrent_ips']) && !$stopped) {
|
||||
if ((RATIO_ENABLED || config()->get('tracker.limit_concurrent_ips')) && !$stopped) {
|
||||
$user_ratio = get_bt_ratio($row);
|
||||
if ($user_ratio === null) {
|
||||
$user_ratio = 1;
|
||||
|
@ -290,10 +302,10 @@ if ($lp_info) {
|
|||
$rating_msg = '';
|
||||
|
||||
if (!$seeder) {
|
||||
foreach ($bb_cfg['rating'] as $ratio => $limit) {
|
||||
foreach (config()->get('rating') as $ratio => $limit) {
|
||||
if ($user_ratio < $ratio) {
|
||||
$bb_cfg['tracker']['limit_active_tor'] = 1;
|
||||
$bb_cfg['tracker']['limit_leech_count'] = $limit;
|
||||
config()->set('tracker.limit_active_tor', 1);
|
||||
config()->set('tracker.limit_leech_count', $limit);
|
||||
$rating_msg = " (ratio < $ratio)";
|
||||
break;
|
||||
}
|
||||
|
@ -301,29 +313,29 @@ if ($lp_info) {
|
|||
}
|
||||
|
||||
// Limit active torrents
|
||||
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))) {
|
||||
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))) {
|
||||
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
|
||||
FROM " . BB_BT_TRACKER . "
|
||||
WHERE user_id = $user_id
|
||||
AND seeder = $seeder
|
||||
AND topic_id != $topic_id";
|
||||
|
||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor'] && $user_ratio < 0.5) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
||||
if (!$seeder && config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||
}
|
||||
$sql .= " GROUP BY user_id";
|
||||
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
if ($seeder && $bb_cfg['tracker']['limit_seed_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_seed_count']) {
|
||||
msg_die('Only ' . $bb_cfg['tracker']['limit_seed_count'] . ' torrent(s) allowed for seeding');
|
||||
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_leech_count']) {
|
||||
msg_die('Only ' . $bb_cfg['tracker']['limit_leech_count'] . ' torrent(s) allowed for leeching' . $rating_msg);
|
||||
if ($seeder && config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= config()->get('tracker.limit_seed_count')) {
|
||||
msg_die('Only ' . config()->get('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')) {
|
||||
msg_die('Only ' . config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Limit concurrent IPs
|
||||
if ($bb_cfg['tracker']['limit_concurrent_ips'] && (($bb_cfg['tracker']['limit_seed_ips'] && $seeder) || ($bb_cfg['tracker']['limit_leech_ips'] && !$seeder))) {
|
||||
if (config()->get('tracker.limit_concurrent_ips') && ((config()->get('tracker.limit_seed_ips') && $seeder) || (config()->get('tracker.limit_leech_ips') && !$seeder))) {
|
||||
$sql = "SELECT COUNT(DISTINCT ip) AS ips
|
||||
FROM " . BB_BT_TRACKER . "
|
||||
WHERE topic_id = $topic_id
|
||||
|
@ -331,16 +343,16 @@ if ($lp_info) {
|
|||
AND seeder = $seeder
|
||||
AND $ip_version != '$ip_sql'";
|
||||
|
||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor']) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
||||
if (!$seeder && config()->get('tracker.leech_expire_factor')) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||
}
|
||||
$sql .= " GROUP BY topic_id";
|
||||
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
if ($seeder && $bb_cfg['tracker']['limit_seed_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_seed_ips']) {
|
||||
msg_die('You can seed only from ' . $bb_cfg['tracker']['limit_seed_ips'] . " IP's");
|
||||
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_leech_ips']) {
|
||||
msg_die('You can leech only from ' . $bb_cfg['tracker']['limit_leech_ips'] . " IP's");
|
||||
if ($seeder && config()->get('tracker.limit_seed_ips') && $row['ips'] >= config()->get('tracker.limit_seed_ips')) {
|
||||
msg_die('You can seed only from ' . config()->get('tracker.limit_seed_ips') . " IP's");
|
||||
} elseif (!$seeder && config()->get('tracker.limit_leech_ips') && $row['ips'] >= config()->get('tracker.limit_leech_ips')) {
|
||||
msg_die('You can leech only from ' . config()->get('tracker.limit_leech_ips') . " IP's");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +376,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;
|
||||
|
||||
// Gold/Silver releases
|
||||
if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
||||
if (config()->get('tracker.gold_silver_enabled') && $down_add) {
|
||||
if ($tor_type == TOR_TYPE_GOLD) {
|
||||
$down_add = 0;
|
||||
} // Silver releases
|
||||
|
@ -374,7 +386,7 @@ if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
|||
}
|
||||
|
||||
// Freeleech
|
||||
if ($bb_cfg['tracker']['freeleech'] && $down_add) {
|
||||
if (config()->get('tracker.freeleech') && $down_add) {
|
||||
$down_add = 0;
|
||||
}
|
||||
|
||||
|
@ -452,8 +464,8 @@ $output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
|
|||
|
||||
if (!$output) {
|
||||
// Retrieve peers
|
||||
$numwant = (int)$bb_cfg['tracker']['numwant'];
|
||||
$compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
|
||||
$numwant = (int)config()->get('tracker.numwant');
|
||||
$compact_mode = (config()->get('tracker.compact_mode') || !empty($compact));
|
||||
|
||||
$rowset = DB()->fetch_rowset("
|
||||
SELECT ip, ipv6, port
|
||||
|
@ -498,7 +510,7 @@ if (!$output) {
|
|||
|
||||
$seeders = $leechers = $client_completed = 0;
|
||||
|
||||
if ($bb_cfg['tracker']['scrape']) {
|
||||
if (config()->get('tracker.scrape')) {
|
||||
$row = DB()->fetch_row("
|
||||
SELECT seeders, leechers, completed
|
||||
FROM " . BB_BT_TRACKER_SNAP . "
|
||||
|
|
|
@ -11,11 +11,9 @@ if (!defined('IN_TRACKER')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
// Exit if tracker is disabled
|
||||
if ($bb_cfg['tracker']['bt_off']) {
|
||||
msg_die($bb_cfg['tracker']['bt_off_reason']);
|
||||
if (config()->get('tracker.bt_off')) {
|
||||
msg_die(config()->get('tracker.bt_off_reason'));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -11,9 +11,7 @@ define('IN_TRACKER', true);
|
|||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['tracker']['scrape']) {
|
||||
if (!config()->get('tracker.scrape')) {
|
||||
msg_die('Please disable SCRAPE!');
|
||||
}
|
||||
|
||||
|
@ -34,7 +32,7 @@ $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, 'UTF8') ? $info_hash : $info_hash_hex));
|
||||
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
|
||||
}
|
||||
|
||||
// Handle multiple hashes
|
||||
|
@ -60,8 +58,8 @@ foreach ($info_hash_array[1] as $hash) {
|
|||
$info_hash_count = count($info_hashes);
|
||||
|
||||
if (!empty($info_hash_count)) {
|
||||
if ($info_hash_count > $bb_cfg['max_scrapes']) {
|
||||
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
|
||||
if ($info_hash_count > config()->get('max_scrapes')) {
|
||||
$info_hashes = array_slice($info_hashes, 0, config()->get('max_scrapes'));
|
||||
}
|
||||
|
||||
$info_hashes_sql = implode('\', \'', $info_hashes);
|
||||
|
@ -99,7 +97,7 @@ if (!empty($info_hash_count)) {
|
|||
|
||||
// Verify if torrent registered on tracker
|
||||
if (empty($torrents)) {
|
||||
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
|
||||
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
|
||||
}
|
||||
|
||||
die(\Arokettu\Bencode\Bencode::encode($torrents));
|
||||
|
|
|
@ -1,125 +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 = """
|
||||
[](https://github.com/torrentpier)\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/build/master/TorrentPier
|
||||
{%- 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", skip = true },
|
||||
{ message = "^chore|^ci|^misc", group = "<!-- 7 -->⚙️ Miscellaneous" },
|
||||
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
||||
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
||||
{ message = "^crowdin", 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"
|
10
cliff.toml
10
cliff.toml
|
@ -12,9 +12,8 @@ repo = "torrentpier"
|
|||
[changelog]
|
||||
# template for the changelog header
|
||||
header = """
|
||||
[](https://github.com/torrentpier)\n
|
||||
# 📖 Change Log\n
|
||||
> [!NOTE]
|
||||
> To view changelog from **v2.0.0** to **v2.4.5-rc.2** navigate to [HISTORY.md](HISTORY.md).
|
||||
"""
|
||||
# template for the changelog body
|
||||
# https://keats.github.io/tera/docs/#introduction
|
||||
|
@ -24,7 +23,7 @@ body = """
|
|||
{%- endmacro -%}
|
||||
|
||||
{%- macro nightly_url() -%}
|
||||
https://nightly.link/{{ remote.github.owner }}/{{ remote.github.repo }}/workflows/build/master/TorrentPier
|
||||
https://nightly.link/{{ remote.github.owner }}/{{ remote.github.repo }}/workflows/ci/master/TorrentPier-master
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro print_commit(commit) -%}
|
||||
|
@ -74,7 +73,6 @@ body = """
|
|||
"""
|
||||
# template for the changelog footer
|
||||
footer = """
|
||||
<!-- generated by git-cliff -->
|
||||
"""
|
||||
# remove the leading and trailing whitespace from the templates
|
||||
trim = true
|
||||
|
@ -107,11 +105,11 @@ commit_parsers = [
|
|||
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
||||
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
||||
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
||||
{ message = "^ignore|^release", skip = true },
|
||||
{ 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", group = "<!-- 10 -->🈳 New translations" }, # crowdin pulls supporting
|
||||
{ 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" },
|
||||
|
|
149
common.php
149
common.php
|
@ -86,69 +86,138 @@ if (is_file(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
|
||||
*
|
||||
* @return \TorrentPier\Config
|
||||
*/
|
||||
function config(): \TorrentPier\Config
|
||||
{
|
||||
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 === 'local') {
|
||||
if (APP_ENV === 'development') {
|
||||
define('DBG_USER', true); // forced debug
|
||||
} else {
|
||||
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
||||
}
|
||||
(new \TorrentPier\Dev());
|
||||
(\TorrentPier\Dev::init());
|
||||
|
||||
/**
|
||||
* Server variables initialize
|
||||
*/
|
||||
$server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
|
||||
$server_port = in_array((int)$bb_cfg['server_port'], [80, 443], true) ? '' : ':' . $bb_cfg['server_port'];
|
||||
define('FORUM_PATH', $bb_cfg['script_path']);
|
||||
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
|
||||
$server_protocol = config()->get('cookie_secure') ? 'https://' : 'http://';
|
||||
$server_port = in_array((int)config()->get('server_port'), [80, 443], true) ? '' : ':' . config()->get('server_port');
|
||||
define('FORUM_PATH', config()->get('script_path'));
|
||||
define('FULL_URL', $server_protocol . config()->get('server_name') . $server_port . config()->get('script_path'));
|
||||
unset($server_protocol, $server_port);
|
||||
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
$DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
|
||||
// Initialize the new DB factory with database configuration
|
||||
TorrentPier\Database\DatabaseFactory::init(config()->get('db'), config()->get('db_alias', []));
|
||||
|
||||
function DB(string $db_alias = 'db')
|
||||
/**
|
||||
* Get the Database instance
|
||||
*
|
||||
* @param string $db_alias
|
||||
* @return \TorrentPier\Database\Database
|
||||
*/
|
||||
function DB(string $db_alias = 'db'): \TorrentPier\Database\Database
|
||||
{
|
||||
global $DBS;
|
||||
return $DBS->get_db_obj($db_alias);
|
||||
return TorrentPier\Database\DatabaseFactory::getInstance($db_alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache
|
||||
*/
|
||||
$CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
|
||||
// Initialize Unified Cache System
|
||||
TorrentPier\Cache\UnifiedCacheSystem::getInstance(config()->all());
|
||||
|
||||
function CACHE(string $cache_name)
|
||||
/**
|
||||
* Get cache manager instance (replaces legacy cache system)
|
||||
*
|
||||
* @param string $cache_name
|
||||
* @return \TorrentPier\Cache\CacheManager
|
||||
*/
|
||||
function CACHE(string $cache_name): \TorrentPier\Cache\CacheManager
|
||||
{
|
||||
global $CACHES;
|
||||
return $CACHES->get_cache_obj($cache_name);
|
||||
return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->get_cache_obj($cache_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Datastore
|
||||
* Get datastore manager instance (replaces legacy datastore system)
|
||||
*
|
||||
* @return \TorrentPier\Cache\DatastoreManager
|
||||
*/
|
||||
switch ($bb_cfg['datastore_type']) {
|
||||
case 'apcu':
|
||||
$datastore = new TorrentPier\Legacy\Datastore\APCu($bb_cfg['cache']['prefix']);
|
||||
break;
|
||||
case 'memcached':
|
||||
$datastore = new TorrentPier\Legacy\Datastore\Memcached($bb_cfg['cache']['memcached'], $bb_cfg['cache']['prefix']);
|
||||
break;
|
||||
case 'sqlite':
|
||||
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($bb_cfg['cache']['db_dir'] . 'datastore', $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']);
|
||||
function datastore(): \TorrentPier\Cache\DatastoreManager
|
||||
{
|
||||
return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->getDatastore(config()->get('datastore_type', 'file'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Backward compatibility: Global datastore variable
|
||||
* This allows existing code to continue using global $datastore
|
||||
*/
|
||||
$datastore = datastore();
|
||||
|
||||
// Functions
|
||||
function utime()
|
||||
{
|
||||
|
@ -364,9 +433,9 @@ if (!defined('IN_TRACKER')) {
|
|||
} else {
|
||||
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($bb_cfg['announce_interval'] * (0.85 * $bb_cfg['tracker']['expire_factor'])));
|
||||
define('PEERS_LIST_EXPIRE', round($bb_cfg['announce_interval'] * 0.7));
|
||||
define('SCRAPE_LIST_EXPIRE', round($bb_cfg['scrape_interval'] * 0.7));
|
||||
define('PEER_HASH_EXPIRE', round(config()->get('announce_interval') * (0.85 * config()->get('tracker.expire_factor'))));
|
||||
define('PEERS_LIST_EXPIRE', round(config()->get('announce_interval') * 0.7));
|
||||
define('SCRAPE_LIST_EXPIRE', round(config()->get('scrape_interval') * 0.7));
|
||||
|
||||
define('PEER_HASH_PREFIX', 'peer_');
|
||||
define('PEERS_LIST_PREFIX', 'peers_list_');
|
||||
|
|
|
@ -46,52 +46,57 @@
|
|||
"forum": "https://torrentpier.com"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1 | ^8.2 | ^8.3 | ^8.4",
|
||||
"arokettu/random-polyfill": "1.0.2",
|
||||
"php": ">=8.2",
|
||||
"arokettu/bencode": "^4.1.0",
|
||||
"arokettu/monsterid": "dev-master",
|
||||
"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",
|
||||
"claviska/simpleimage": "^4.0",
|
||||
"belomaxorka/captcha": "1.*",
|
||||
"egulias/email-validator": "^4.0.1",
|
||||
"filp/whoops": "^2.15",
|
||||
"z4kn4fein/php-semver": "^v3.0.0",
|
||||
"nemorize/indexnow": "^0.0.1",
|
||||
"gemorroj/m3u-parser": "^6.0.1",
|
||||
"gigablah/sphinxphp": "2.0.8",
|
||||
"google/recaptcha": "^1.3",
|
||||
"jacklul/monolog-telegram": "^3.1",
|
||||
"josantonius/cookie": "^2.0",
|
||||
"gemorroj/m3u-parser": "dev-master",
|
||||
"php-curl-class/php-curl-class": "^11.0.0",
|
||||
"league/flysystem": "^3.28",
|
||||
"longman/ip-tools": "1.2.1",
|
||||
"matthiasmullie/scrapbook": "^1.5.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",
|
||||
"symfony/finder": "^6.4",
|
||||
"symfony/filesystem": "^6.4",
|
||||
"symfony/event-dispatcher": "^6.4",
|
||||
"symfony/mime": "^6.4",
|
||||
"symfony/mailer": "^6.4",
|
||||
"symfony/polyfill": "v1.31.0",
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
"symfony/mailer": "^7.3",
|
||||
"symfony/polyfill": "v1.32.0",
|
||||
"vlucas/phpdotenv": "^5.5",
|
||||
"z4kn4fein/php-semver": "^v3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^6.4"
|
||||
"mockery/mockery": "^1.6",
|
||||
"pestphp/pest": "^3.8",
|
||||
"symfony/var-dumper": "^7.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TorrentPier\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"optimize-autoloader": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
|
4634
composer.lock
generated
4634
composer.lock
generated
File diff suppressed because it is too large
Load diff
6
dl.php
6
dl.php
|
@ -25,7 +25,7 @@ $m3u = isset($_GET['m3u']) && $_GET['m3u'];
|
|||
// Send file to browser
|
||||
function send_file_to_browser($attachment, $upload_dir)
|
||||
{
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
$filename = $upload_dir . '/' . $attachment['physical_filename'];
|
||||
$gotit = false;
|
||||
|
@ -170,7 +170,7 @@ if (!IS_AM && ($attachment['mimetype'] === TORRENT_MIMETYPE)) {
|
|||
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
|
||||
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'])) {
|
||||
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'])) {
|
||||
bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]);
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ switch ($download_mode) {
|
|||
header('Location: ' . $url);
|
||||
exit;
|
||||
case INLINE_LINK:
|
||||
if (IS_GUEST && !$bb_cfg['captcha']['disabled'] && !bb_captcha('check')) {
|
||||
if (IS_GUEST && !config()->get('captcha.disabled') && !bb_captcha('check')) {
|
||||
global $template;
|
||||
|
||||
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
|
||||
|
|
12
feed.php
12
feed.php
|
@ -34,11 +34,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
|
|||
bb_simple_die($lang['ATOM_ERROR'] . ' #1');
|
||||
}
|
||||
}
|
||||
if (is_file($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
|
||||
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
|
||||
if (is_file(config()->get('atom.path') . '/f/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/f/' . $id . '.atom') > $timecheck) {
|
||||
redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
|
||||
} else {
|
||||
if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
|
||||
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
|
||||
redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
|
||||
} else {
|
||||
bb_simple_die($lang['ATOM_NO_FORUM']);
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
|
|||
if (!$username = get_username($id)) {
|
||||
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
|
||||
}
|
||||
if (is_file($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($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
|
||||
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) {
|
||||
redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
|
||||
} else {
|
||||
if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) {
|
||||
redirect($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
|
||||
redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
|
||||
} else {
|
||||
bb_simple_die($lang['ATOM_NO_USER']);
|
||||
}
|
||||
|
|
31
filelist.php
31
filelist.php
|
@ -14,7 +14,7 @@ require __DIR__ . '/common.php';
|
|||
// Start session management
|
||||
$user->session_start();
|
||||
|
||||
if ($bb_cfg['bt_disable_dht'] && IS_GUEST) {
|
||||
if (config()->get('bt_disable_dht') && IS_GUEST) {
|
||||
bb_die($lang['BT_PRIVATE_TRACKER'], 403);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ if (!$topic_id) {
|
|||
bb_die($lang['INVALID_TOPIC_ID'], 404);
|
||||
}
|
||||
|
||||
$sql = 'SELECT t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_filename
|
||||
$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
|
||||
|
@ -34,6 +34,12 @@ 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']);
|
||||
|
@ -49,7 +55,7 @@ if (!is_file($file_path)) {
|
|||
}
|
||||
|
||||
$file_contents = file_get_contents($file_path);
|
||||
if ($bb_cfg['flist_max_files']) {
|
||||
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;
|
||||
|
||||
|
@ -59,8 +65,8 @@ if ($bb_cfg['flist_max_files']) {
|
|||
$file_count = substr_count($file_contents, '6:length', $files_pos);
|
||||
}
|
||||
|
||||
if ($file_count > $bb_cfg['flist_max_files']) {
|
||||
bb_die(sprintf($lang['BT_FLIST_LIMIT'], $bb_cfg['flist_max_files'], $file_count), 410);
|
||||
if ($file_count > config()->get('flist_max_files')) {
|
||||
bb_die(sprintf($lang['BT_FLIST_LIMIT'], config()->get('flist_max_files'), $file_count), 410);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +82,7 @@ if (IS_GUEST && $torrent->isPrivate()) {
|
|||
|
||||
// Get torrent files
|
||||
$files = $torrent->$t_version_field()->$t_files_field();
|
||||
if ($meta_v1 && $meta_v2) {
|
||||
if ($meta_v2) {
|
||||
$files = new \RecursiveIteratorIterator($files); // Flatten the list
|
||||
}
|
||||
|
||||
|
@ -96,19 +102,6 @@ foreach ($files as $file) {
|
|||
$torrent_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN'];
|
||||
$torrent_size = humn_size($row['size'], 2);
|
||||
|
||||
// Get announcers list
|
||||
$announcers_list = $torrent->getAnnounceList()->toArray();
|
||||
$announcers_count = 0;
|
||||
foreach ($announcers_list as $announcer) {
|
||||
$announcers_count++;
|
||||
$row_class = ($announcers_count % 2) ? 'row1' : 'row2';
|
||||
$template->assign_block_vars('announcers', [
|
||||
'ROW_NUMBER' => $announcers_count,
|
||||
'ROW_CLASS' => $row_class,
|
||||
'ANNOUNCER' => $announcer[0]
|
||||
]);
|
||||
}
|
||||
|
||||
// Output page
|
||||
$template->assign_vars([
|
||||
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",
|
||||
|
|
14
group.php
14
group.php
|
@ -24,7 +24,7 @@ set_die_append_msg();
|
|||
|
||||
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
|
||||
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
|
||||
$per_page = $bb_cfg['group_members_per_page'];
|
||||
$per_page = config()->get('group_members_per_page');
|
||||
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
|
||||
$rel_limit = 50;
|
||||
|
||||
|
@ -168,7 +168,7 @@ if (!$group_id) {
|
|||
|
||||
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
|
||||
|
||||
if ($bb_cfg['group_send_email']) {
|
||||
if (config()->get('group_send_email')) {
|
||||
// Sending email
|
||||
$emailer = new TorrentPier\Emailer();
|
||||
|
||||
|
@ -224,7 +224,7 @@ if (!$group_id) {
|
|||
|
||||
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
|
||||
|
||||
if ($bb_cfg['group_send_email']) {
|
||||
if (config()->get('group_send_email')) {
|
||||
// Sending email
|
||||
$emailer = new TorrentPier\Emailer();
|
||||
|
||||
|
@ -273,10 +273,10 @@ if (!$group_id) {
|
|||
}
|
||||
}
|
||||
// Email users when they are approved
|
||||
if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
|
||||
if (!empty($_POST['approve']) && config()->get('group_send_email')) {
|
||||
$sql_select = "SELECT username, user_email, user_lang
|
||||
FROM " . BB_USERS . "
|
||||
WHERE user_id IN($sql_in)";
|
||||
FROM " . BB_USERS . "
|
||||
WHERE user_id IN($sql_in)";
|
||||
|
||||
if (!$result = DB()->sql_query($sql_select)) {
|
||||
bb_die('Could not get user email information');
|
||||
|
@ -573,7 +573,7 @@ if (!$group_id) {
|
|||
$template->assign_block_vars('pending', [
|
||||
'ROW_CLASS' => $row_class,
|
||||
'AVATAR_IMG' => $pending_info['avatar'],
|
||||
'USER' => profile_url($pending_info),
|
||||
'USER' => profile_url($member),
|
||||
'FROM' => $pending_info['from'],
|
||||
'JOINED' => $pending_info['joined'],
|
||||
'JOINED_RAW' => $pending_info['joined_raw'],
|
||||
|
|
|
@ -35,10 +35,10 @@ if ($group_id) {
|
|||
if ($is_moderator) {
|
||||
// Avatar
|
||||
if ($submit) {
|
||||
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
|
||||
if (!empty($_FILES['avatar']['name']) && config()->get('group_avatars.up_allowed')) {
|
||||
$upload = new TorrentPier\Legacy\Common\Upload();
|
||||
|
||||
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']])) {
|
||||
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']])) {
|
||||
$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 {
|
||||
|
@ -76,7 +76,7 @@ if ($is_moderator) {
|
|||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
|
||||
|
||||
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], humn_size($bb_cfg['group_avatars']['max_size'])),
|
||||
'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_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
|
||||
]);
|
||||
|
||||
|
|
67
index.php
67
index.php
|
@ -31,12 +31,12 @@ $datastore->enqueue([
|
|||
'cat_forums'
|
||||
]);
|
||||
|
||||
if ($bb_cfg['show_latest_news']) {
|
||||
if (config()->get('show_latest_news')) {
|
||||
$datastore->enqueue([
|
||||
'latest_news'
|
||||
]);
|
||||
}
|
||||
if ($bb_cfg['show_network_news']) {
|
||||
if (config()->get('show_network_news')) {
|
||||
$datastore->enqueue([
|
||||
'network_news'
|
||||
]);
|
||||
|
@ -45,8 +45,11 @@ if ($bb_cfg['show_network_news']) {
|
|||
// Init userdata
|
||||
$user->session_start();
|
||||
|
||||
// Set meta description
|
||||
$page_cfg['meta_description'] = config()->get('site_desc');
|
||||
|
||||
// Init main vars
|
||||
$viewcat = isset($_GET['c']) ? (int)$_GET['c'] : 0;
|
||||
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0;
|
||||
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
|
||||
|
||||
// Caching output
|
||||
|
@ -54,7 +57,7 @@ $req_page = 'index_page';
|
|||
$req_page .= $viewcat ? "_c{$viewcat}" : '';
|
||||
|
||||
define('REQUESTED_PAGE', $req_page);
|
||||
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
|
||||
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . config()->get('default_lang'));
|
||||
|
||||
$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));
|
||||
|
@ -65,13 +68,15 @@ $tracking_topics = get_tracks('topic');
|
|||
$tracking_forums = get_tracks('forum');
|
||||
|
||||
// Statistics
|
||||
if (!$stats = $datastore->get('stats')) {
|
||||
$stats = $datastore->get('stats');
|
||||
if ($stats === false) {
|
||||
$datastore->update('stats');
|
||||
$stats = $datastore->get('stats');
|
||||
}
|
||||
|
||||
// Forums data
|
||||
if (!$forums = $datastore->get('cat_forums')) {
|
||||
$forums = $datastore->get('cat_forums');
|
||||
if ($forums === false) {
|
||||
$datastore->update('cat_forums');
|
||||
$forums = $datastore->get('cat_forums');
|
||||
}
|
||||
|
@ -80,6 +85,7 @@ $forum_name_html = $forums['forum_name_html'];
|
|||
|
||||
$anon = GUEST_UID;
|
||||
$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'];
|
||||
|
||||
// Validate requested category id
|
||||
|
@ -173,7 +179,8 @@ if (!$cat_forums = CACHE('bb_cache')->get($cache_name)) {
|
|||
|
||||
// Obtain list of moderators
|
||||
$moderators = [];
|
||||
if (!$mod = $datastore->get('moderators')) {
|
||||
$mod = $datastore->get('moderators');
|
||||
if ($mod === false) {
|
||||
$datastore->update('moderators');
|
||||
$mod = $datastore->get('moderators');
|
||||
}
|
||||
|
@ -255,7 +262,7 @@ foreach ($cat_forums as $cid => $c) {
|
|||
'LAST_TOPIC_ID' => $f['last_topic_id'],
|
||||
'LAST_TOPIC_TIP' => $f['last_topic_title'],
|
||||
'LAST_TOPIC_TITLE' => str_short($f['last_topic_title'], $last_topic_max_len),
|
||||
'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
|
||||
'LAST_POST_TIME' => bb_date($f['last_post_time'], config()->get('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']]),
|
||||
]);
|
||||
}
|
||||
|
@ -271,7 +278,7 @@ $template->assign_vars([
|
|||
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
|
||||
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
|
||||
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
|
||||
'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
|
||||
'TOTAL_GENDER' => config()->get('gender') ? sprintf(
|
||||
$lang['USERS_TOTAL_GENDER'],
|
||||
$stats['male'],
|
||||
$stats['female'],
|
||||
|
@ -280,22 +287,22 @@ $template->assign_vars([
|
|||
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
|
||||
|
||||
// Tracker stats
|
||||
'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
||||
'TORRENTS_STAT' => config()->get('tor_stats') ? sprintf(
|
||||
$lang['TORRENTS_STAT'],
|
||||
$stats['torrentcount'],
|
||||
humn_size($stats['size'])
|
||||
) : '',
|
||||
'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
||||
'PEERS_STAT' => config()->get('tor_stats') ? sprintf(
|
||||
$lang['PEERS_STAT'],
|
||||
$stats['peers'],
|
||||
$stats['seeders'],
|
||||
$stats['leechers']
|
||||
) : '',
|
||||
'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
||||
'SPEED_STAT' => config()->get('tor_stats') ? sprintf(
|
||||
$lang['SPEED_STAT'],
|
||||
humn_size($stats['speed']) . '/s'
|
||||
) : '',
|
||||
'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'],
|
||||
'SHOW_MOD_INDEX' => config()->get('show_mod_index'),
|
||||
'FORUM_IMG' => $images['forum'],
|
||||
'FORUM_NEW_IMG' => $images['forum_new'],
|
||||
'FORUM_LOCKED_IMG' => $images['forum_locked'],
|
||||
|
@ -308,20 +315,21 @@ $template->assign_vars([
|
|||
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&o=1",
|
||||
'U_SEARCH_LATEST' => 'search.php?search_id=latest',
|
||||
'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered',
|
||||
'U_ATOM_FEED' => is_file($bb_cfg['atom']['path'] . '/f/0.atom') ? make_url($bb_cfg['atom']['url'] . '/f/0.atom') : false,
|
||||
'U_ATOM_FEED' => is_file(config()->get('atom.path') . '/f/0.atom') ? make_url(config()->get('atom.url') . '/f/0.atom') : false,
|
||||
|
||||
'SHOW_LAST_TOPIC' => $show_last_topic,
|
||||
'BOARD_START' => $bb_cfg['show_board_start_index'] ? ($lang['BOARD_STARTED'] . ': ' . '<b>' . bb_date($bb_cfg['board_startdate']) . '</b>') : false,
|
||||
'BOARD_START' => config()->get('show_board_start_index') ? ($lang['BOARD_STARTED'] . ': ' . '<b>' . bb_date(config()->get('board_startdate')) . '</b>') : false,
|
||||
]);
|
||||
|
||||
// Set tpl vars for bt_userdata
|
||||
if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST) {
|
||||
if (config()->get('bt_show_dl_stat_on_index') && !IS_GUEST) {
|
||||
show_bt_userdata($userdata['user_id']);
|
||||
}
|
||||
|
||||
// Latest news
|
||||
if ($bb_cfg['show_latest_news']) {
|
||||
if (!$latest_news = $datastore->get('latest_news')) {
|
||||
if (config()->get('show_latest_news')) {
|
||||
$latest_news = $datastore->get('latest_news');
|
||||
if ($latest_news === false) {
|
||||
$datastore->update('latest_news');
|
||||
$latest_news = $datastore->get('latest_news');
|
||||
}
|
||||
|
@ -329,9 +337,13 @@ if ($bb_cfg['show_latest_news']) {
|
|||
$template->assign_vars(['SHOW_LATEST_NEWS' => true]);
|
||||
|
||||
foreach ($latest_news as $news) {
|
||||
if (in_array($news['forum_id'], $excluded_forums_array)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('news', [
|
||||
'NEWS_TOPIC_ID' => $news['topic_id'],
|
||||
'NEWS_TITLE' => str_short($wordCensor->censorString($news['topic_title']), $bb_cfg['max_news_title']),
|
||||
'NEWS_TITLE' => str_short(censor()->censorString($news['topic_title']), config()->get('max_news_title')),
|
||||
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
|
||||
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
|
||||
]);
|
||||
|
@ -339,8 +351,9 @@ if ($bb_cfg['show_latest_news']) {
|
|||
}
|
||||
|
||||
// Network news
|
||||
if ($bb_cfg['show_network_news']) {
|
||||
if (!$network_news = $datastore->get('network_news')) {
|
||||
if (config()->get('show_network_news')) {
|
||||
$network_news = $datastore->get('network_news');
|
||||
if ($network_news === false) {
|
||||
$datastore->update('network_news');
|
||||
$network_news = $datastore->get('network_news');
|
||||
}
|
||||
|
@ -348,16 +361,20 @@ if ($bb_cfg['show_network_news']) {
|
|||
$template->assign_vars(['SHOW_NETWORK_NEWS' => true]);
|
||||
|
||||
foreach ($network_news as $net) {
|
||||
if (in_array($net['forum_id'], $excluded_forums_array)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('net', [
|
||||
'NEWS_TOPIC_ID' => $net['topic_id'],
|
||||
'NEWS_TITLE' => str_short($wordCensor->censorString($net['topic_title']), $bb_cfg['max_net_title']),
|
||||
'NEWS_TITLE' => str_short(censor()->censorString($net['topic_title']), config()->get('max_net_title')),
|
||||
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
|
||||
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
||||
if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
|
||||
$week_list = $today_list = [];
|
||||
$week_all = $today_all = false;
|
||||
|
||||
|
@ -371,9 +388,9 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['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_all = $week_all ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
|
||||
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
|
||||
$week_list = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $week_list)) . $week_all;
|
||||
} else {
|
||||
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
||||
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day'));
|
||||
}
|
||||
|
||||
if (!empty($stats['birthday_today_list'])) {
|
||||
|
|
190
install.php
190
install.php
|
@ -8,17 +8,24 @@
|
|||
*/
|
||||
|
||||
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
define('BB_PATH', BB_ROOT);
|
||||
|
||||
// Check CLI mode
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
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
|
||||
*/
|
||||
define('CHECK_REQUIREMENTS', [
|
||||
'php_min_version' => '8.1.0',
|
||||
const CHECK_REQUIREMENTS = [
|
||||
'php_min_version' => '8.2.0',
|
||||
'ext_list' => [
|
||||
'json',
|
||||
'curl',
|
||||
|
@ -32,126 +39,7 @@ define('CHECK_REQUIREMENTS', [
|
|||
'zip',
|
||||
'gd'
|
||||
],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Colored console output
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $type
|
||||
* @return void
|
||||
*/
|
||||
function out(string $str, string $type = ''): void
|
||||
{
|
||||
echo match ($type) {
|
||||
'error' => "\033[31m$str \033[0m\n",
|
||||
'success' => "\033[32m$str \033[0m\n",
|
||||
'warning' => "\033[33m$str \033[0m\n",
|
||||
'info' => "\033[36m$str \033[0m\n",
|
||||
'debug' => "\033[90m$str \033[0m\n",
|
||||
default => "$str\n",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Run process with realtime output
|
||||
*
|
||||
* @param string $cmd
|
||||
* @param string|null $input
|
||||
* @return void
|
||||
*/
|
||||
function runProcess(string $cmd, string $input = null): void
|
||||
{
|
||||
$descriptorSpec = [
|
||||
0 => ['pipe', 'r'],
|
||||
1 => ['pipe', 'w'],
|
||||
2 => ['pipe', 'w'],
|
||||
];
|
||||
|
||||
$process = proc_open($cmd, $descriptorSpec, $pipes);
|
||||
|
||||
if (!is_resource($process)) {
|
||||
out('- Could not start subprocess', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Write input if provided
|
||||
if ($input !== null) {
|
||||
fwrite($pipes[0], $input);
|
||||
fclose($pipes[0]);
|
||||
}
|
||||
|
||||
// Read and print output in real-time
|
||||
while (!feof($pipes[1])) {
|
||||
echo stream_get_contents($pipes[1], 1);
|
||||
flush(); // Flush output buffer for immediate display
|
||||
}
|
||||
|
||||
// Read and print error output
|
||||
while (!feof($pipes[2])) {
|
||||
echo stream_get_contents($pipes[2], 1);
|
||||
flush();
|
||||
}
|
||||
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
proc_close($process);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove directory recursively
|
||||
*
|
||||
* @param string $dir
|
||||
* @return void
|
||||
*/
|
||||
function rmdir_rec(string $dir): void
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
|
||||
$files = new RecursiveIteratorIterator($it,
|
||||
RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
rmdir($file->getPathname());
|
||||
} else {
|
||||
unlink($file->getPathname());
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting permissions recursively
|
||||
*
|
||||
* @param string $dir
|
||||
* @param int $dirPermissions
|
||||
* @param int $filePermissions
|
||||
* @return void
|
||||
*/
|
||||
function chmod_r(string $dir, int $dirPermissions, int $filePermissions): void
|
||||
{
|
||||
$dp = opendir($dir);
|
||||
while ($file = readdir($dp)) {
|
||||
if (($file == '.') || ($file == '..')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullPath = realpath($dir . '/' . $file);
|
||||
if (is_dir($fullPath)) {
|
||||
out("- Directory: $fullPath");
|
||||
chmod($fullPath, $dirPermissions);
|
||||
chmod_r($fullPath, $dirPermissions, $filePermissions);
|
||||
} elseif (is_file($fullPath)) {
|
||||
// out("- File: $fullPath");
|
||||
chmod($fullPath, $filePermissions);
|
||||
} else {
|
||||
out("- Cannot find target path: $fullPath", 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dp);
|
||||
}
|
||||
];
|
||||
|
||||
// Welcoming message
|
||||
out("--- TorrentPier Installer ---\n", 'info');
|
||||
|
@ -207,7 +95,7 @@ if (is_file(BB_ROOT . '.env')) {
|
|||
}
|
||||
// composer dir
|
||||
if (is_dir(BB_ROOT . 'vendor')) {
|
||||
rmdir_rec(BB_ROOT . 'vendor');
|
||||
removeDir(BB_ROOT . 'vendor', true);
|
||||
if (!is_dir(BB_ROOT . 'vendor')) {
|
||||
out("- Composer directory successfully removed!");
|
||||
} else {
|
||||
|
@ -257,6 +145,7 @@ if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
|
|||
// 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 {
|
||||
|
@ -316,6 +205,12 @@ if (is_file(BB_ROOT . '.env')) {
|
|||
$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 {
|
||||
|
@ -369,35 +264,34 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
|
|||
}
|
||||
$conn->select_db($DB_DATABASE);
|
||||
|
||||
// Checking SQL dump
|
||||
$dumpPath = BB_ROOT . 'install/sql/mysql.sql';
|
||||
if (is_file($dumpPath) && is_readable($dumpPath)) {
|
||||
out('- SQL dump file found and readable!', 'success');
|
||||
} else {
|
||||
out('- SQL dump file not found / not readable', 'error');
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Inserting SQL dump
|
||||
out('- Start importing SQL dump...', 'info');
|
||||
$tempLine = '';
|
||||
foreach (file($dumpPath) as $line) {
|
||||
if (str_starts_with($line, '--') || $line == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tempLine .= $line;
|
||||
if (str_ends_with(trim($line), ';')) {
|
||||
if (!$conn->query($tempLine)) {
|
||||
out("- Error performing query: $tempLine", 'error');
|
||||
exit;
|
||||
}
|
||||
$tempLine = '';
|
||||
}
|
||||
// Run migrations
|
||||
$migrationResult = runProcess('php vendor/bin/phinx migrate --configuration=' . BB_ROOT . 'phinx.php');
|
||||
if ($migrationResult !== 0) {
|
||||
out('- Database migration failed', 'error');
|
||||
exit;
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
out("- Importing SQL dump completed!\n", 'success');
|
||||
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')) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,156 +0,0 @@
|
|||
// Changes from v2.2.0 to 2.4.5
|
||||
|
||||
// 2.2.0
|
||||
UPDATE `bb_config` SET `config_value` = 'http://whatismyipaddress.com/ip/' WHERE `config_name` = 'whois_info';
|
||||
DELETE FROM `bb_smilies` WHERE `code` = ':ad:';
|
||||
INSERT INTO `bb_smilies` (`code`, `smile_url`, `emoticon`) VALUES (':сd:', 'сd.gif', 'сd');
|
||||
DROP TABLE IF EXISTS `bb_ads`;
|
||||
DELETE FROM `bb_config` WHERE `config_name` = 'active_ads';
|
||||
ALTER TABLE `bb_log` DROP COLUMN `log_username`;
|
||||
DELETE FROM `bb_config` WHERE `config_name` = 'new_tpls';
|
||||
UPDATE `bb_posts` SET `poster_ip` = '0';
|
||||
ALTER TABLE `bb_posts` CHANGE `poster_ip` `poster_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_bt_tracker` SET `ip` = '0';
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `ip` `ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_users` SET `user_last_ip` = '0';
|
||||
ALTER TABLE `bb_users` CHANGE `user_last_ip` `user_last_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_users` SET `user_reg_ip` = '0';
|
||||
ALTER TABLE `bb_users` CHANGE `user_reg_ip` `user_reg_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_log` SET `log_user_ip` = '0';
|
||||
ALTER TABLE `bb_log` CHANGE `log_user_ip` `log_user_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_poll_users` SET `vote_ip` = '0';
|
||||
ALTER TABLE `bb_poll_users` CHANGE `vote_ip` `vote_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_privmsgs` SET `privmsgs_ip` = '0';
|
||||
ALTER TABLE `bb_privmsgs` CHANGE `privmsgs_ip` `privmsgs_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_sessions` SET `session_ip` = '0';
|
||||
ALTER TABLE `bb_sessions` CHANGE `session_ip` `session_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
UPDATE `bb_banlist` SET `ban_ip` = '0';
|
||||
ALTER TABLE `bb_banlist` CHANGE `ban_ip` `ban_ip` varchar(42) NOT NULL DEFAULT '0';
|
||||
|
||||
// 2.2.2
|
||||
ALTER TABLE `bb_ranks` DROP `rank_min`;
|
||||
ALTER TABLE `bb_ranks` DROP `rank_special`;
|
||||
|
||||
// 2.3.0
|
||||
ALTER TABLE `bb_cron` CHANGE `last_run` `last_run` DATETIME NOT NULL DEFAULT '1900-01-01 00:00:00';
|
||||
ALTER TABLE `bb_cron` CHANGE `next_run` `next_run` DATETIME NOT NULL DEFAULT '1900-01-01 00:00:00';
|
||||
ALTER TABLE `bb_users` CHANGE `user_birthday` `user_birthday` DATE NOT NULL DEFAULT '1900-01-01';
|
||||
ALTER TABLE `bb_posts` CHANGE `mc_comment` `mc_comment` TEXT NOT NULL DEFAULT '';
|
||||
|
||||
// 2.3.0.2
|
||||
ALTER TABLE `bb_users` CHANGE `user_sig` `user_sig` TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_groups` CHANGE `group_signature` `group_signature` TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_groups` CHANGE `group_description` `group_description` TEXT NOT NULL DEFAULT '';
|
||||
UPDATE `bb_smilies` SET `code` = ':cd:', `smile_url` = 'cd.gif', `emoticon` = 'cd' WHERE `code` = ':сd:' AND `smile_url` = 'сd.gif' AND `emoticon` = 'сd';
|
||||
|
||||
// 2.3.1
|
||||
ALTER TABLE `bb_search_results` CHANGE `search_id` `search_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_users` CHANGE `autologin_id` `autologin_id` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
DELETE FROM `bb_config` WHERE `config_name` = 'cron_enabled';
|
||||
|
||||
// 2.4.0-alpha1
|
||||
ALTER TABLE `bb_search_results` CHANGE `session_id` `session_id` CHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_sessions` CHANGE `session_id` `session_id` CHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_users` CHANGE `username` `username` VARCHAR(255) NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_users` CHANGE `user_password` `user_password` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_users` CHANGE `user_actkey` `user_actkey` VARCHAR(255) NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_users` CHANGE `user_newpasswd` `user_newpasswd` VARCHAR(255) NOT NULL DEFAULT '';
|
||||
|
||||
// 2.4.0-alpha3
|
||||
INSERT INTO bb_config VALUES ('show_board_start_index', '1');
|
||||
|
||||
// 2.4.0-beta2
|
||||
INSERT INTO `bb_cron` (`cron_active`, `cron_title`, `cron_script`, `schedule`, `run_day`, `run_time`, `run_order`,
|
||||
`last_run`, `next_run`, `run_interval`, `log_enabled`, `log_file`, `log_sql_queries`,
|
||||
`disable_board`, `run_counter`) VALUES ('1', 'PM cleanup', 'clean_pm.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0');
|
||||
ALTER TABLE `bb_posts_text` CHANGE `post_text` `post_text` MEDIUMTEXT NOT NULL;
|
||||
ALTER TABLE `bb_privmsgs_text` CHANGE `privmsgs_text` `privmsgs_text` MEDIUMTEXT NOT NULL;
|
||||
ALTER TABLE `bb_bt_torrents` ADD COLUMN `info_hash_v2` VARBINARY(32) NOT NULL DEFAULT '';
|
||||
ALTER TABLE `bb_bt_tracker_snap` ADD COLUMN `completed` INT(10) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `complete` `complete` TINYINT(1) NOT NULL DEFAULT '0';
|
||||
|
||||
// 2.4.0-beta3
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('1', 'webp', '');
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('2', '7z', '');
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('1', 'bmp', '');
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `speed_up` `speed_up` INT(11) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `speed_down` `speed_down` INT(11) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_tracker_snap` CHANGE `speed_up` `speed_up` INT(11) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_tracker_snap` CHANGE `speed_down` `speed_down` INT(11) UNSIGNED NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_torrents` ADD COLUMN `last_seeder_id` MEDIUMINT(8) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `buf_last_seeder` ADD COLUMN `user_id` MEDIUMINT(8) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `ip` `ip` VARCHAR(42) DEFAULT NULL;
|
||||
ALTER TABLE `bb_bt_tracker` CHANGE `ipv6` `ipv6` VARCHAR(42) DEFAULT NULL;
|
||||
ALTER TABLE `bb_bt_users` CHANGE `auth_key` `auth_key` CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
|
||||
|
||||
// 2.4.0-beta4
|
||||
DELETE FROM `bb_extensions` WHERE `extension` = 'tif';
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('4', 'tif', '');
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('4', 'tiff', '');
|
||||
DELETE FROM `bb_extensions` WHERE `extension` = 'tga';
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('4', 'tga', '');
|
||||
|
||||
// 2.4.0-rc1
|
||||
ALTER TABLE `bb_bt_tracker` DROP COLUMN `client`;
|
||||
DROP TABLE IF EXISTS `bb_thx`;
|
||||
CREATE TABLE IF NOT EXISTS `bb_thx`
|
||||
(
|
||||
`topic_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`user_id` MEDIUMINT(8) NOT NULL DEFAULT '0',
|
||||
`time` INT(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`topic_id`, `user_id`)
|
||||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
// 2.4.0
|
||||
UPDATE `bb_attachments_config` SET `config_value` = 'data/uploads' WHERE `config_name` = 'upload_dir';
|
||||
UPDATE `bb_attachments_config` SET `config_value` = '12000' WHERE `config_name` = 'img_min_thumb_filesize';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'attach_version';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'img_min_thumb_filesize';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'img_imagick';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'use_gd2';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'wma_autoplay';
|
||||
DELETE FROM `bb_attachments_config` WHERE config_name = 'flash_autoplay';
|
||||
DELETE FROM `bb_extensions` WHERE extension = 'tif';
|
||||
DELETE FROM `bb_extensions` WHERE extension = 'tiff';
|
||||
DELETE FROM `bb_extensions` WHERE extension = 'tga';
|
||||
DROP TABLE IF EXISTS `bb_banlist`;
|
||||
CREATE TABLE IF NOT EXISTS `bb_banlist`
|
||||
(
|
||||
`ban_id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`ban_userid` MEDIUMINT(8) NOT NULL DEFAULT '0',
|
||||
`ban_reason` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`ban_id`, `ban_userid`)
|
||||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
// 2.4.1
|
||||
UPDATE `bb_config` SET `config_value` = '' WHERE `config_name` = 'bt_announce_url';
|
||||
|
||||
// 2.4.2
|
||||
INSERT INTO `bb_cron` (`cron_active`, `cron_title`, `cron_script`, `schedule`, `run_day`, `run_time`, `run_order`,
|
||||
`last_run`, `next_run`, `run_interval`, `log_enabled`, `log_file`, `log_sql_queries`,
|
||||
`disable_board`, `run_counter`) VALUES ('1', 'Demo mode', 'demo_mode.php', 'daily', '', '05:00:00', '255', '', '', '', '1', 'demo_mode_cron', '1', '1', '0');
|
||||
|
||||
// 2.4.3
|
||||
UPDATE `bb_config` SET `config_value` = 'https://localhost/bt/announce.php' WHERE `config_name` = 'bt_announce_url';
|
||||
|
||||
// 2.4.4
|
||||
ALTER TABLE `bb_poll_users` CHANGE `user_id` `user_id` MEDIUMINT(8) NOT NULL;
|
||||
ALTER TABLE `bb_bt_users` ADD COLUMN `ratio_nulled` TINYINT(1) NOT NULL DEFAULT '0';
|
||||
DELETE FROM `bb_cron` WHERE `cron_script` = 'cache_gc.php';
|
||||
UPDATE `bb_cron` SET `run_interval` = '00:10:00' WHERE `cron_script` = 'tr_seed_bonus.php';
|
||||
|
||||
// 2.4.5-rc.1
|
||||
INSERT INTO `bb_extensions` (`group_id`, `extension`, `comment`) VALUES ('1', 'avif', ''), ('3', 'm3u', '');
|
||||
ALTER TABLE `bb_topics` ADD COLUMN `topic_allow_robots` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';
|
||||
|
||||
// 2.4.5-rc.2
|
||||
INSERT INTO `bb_config` VALUES ('magnet_links_for_guests', '0');
|
||||
INSERT INTO `bb_config` VALUES ('tp_instance_hash', '');
|
||||
|
||||
// 2.4.5
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $user;
|
||||
global $lang, $user;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $userdata, $lang;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$bb_cfg['callseed']) {
|
||||
if (!config()->get('callseed')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ($t_data['seeders'] >= 3) {
|
|||
} elseif ($t_data['call_seed_time'] >= (TIMENOW - 86400)) {
|
||||
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
|
||||
$this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
|
||||
} elseif (isset($bb_cfg['tor_no_tor_act'][$t_data['tor_status']])) {
|
||||
} elseif (isset(config()->get('tor_no_tor_act')[$t_data['tor_status']])) {
|
||||
$this->ajax_die($lang['NOT_AVAILABLE']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $log_action;
|
||||
global $userdata, $lang, $log_action;
|
||||
|
||||
if (!$attach_id = (int)$this->request['attach_id']) {
|
||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||
|
@ -22,7 +22,7 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
}
|
||||
|
||||
$comment = false;
|
||||
if ($bb_cfg['tor_comment']) {
|
||||
if (config()->get('tor_comment')) {
|
||||
$comment = (string)$this->request['comment'];
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ switch ($mode) {
|
|||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
|
||||
|
||||
// Log action
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
$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>.";
|
||||
}
|
||||
|
@ -99,12 +99,12 @@ switch ($mode) {
|
|||
'log_msg' => $log_msg . '<br/>-------------',
|
||||
]);
|
||||
|
||||
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> · ' . profile_url($userdata) . ' · <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
|
||||
$this->response['status'] = config()->get('tor_icons')[$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> · ' . profile_url($userdata) . ' · <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
|
||||
|
||||
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply']))) {
|
||||
if (config()->get('tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, config()->get('tor_reply')))) {
|
||||
if ($tor['poster_id'] > 0) {
|
||||
$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']), $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
|
||||
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), config()->get('tor_icons')[$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
|
||||
|
||||
if ($comment && $comment != $lang['COMMENT']) {
|
||||
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
|
||||
|
@ -117,7 +117,7 @@ switch ($mode) {
|
|||
break;
|
||||
|
||||
case 'status_reply':
|
||||
if (!$bb_cfg['tor_comment']) {
|
||||
if (!config()->get('tor_comment')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $log_action;
|
||||
global $userdata, $lang, $log_action;
|
||||
|
||||
if (!isset($this->request['attach_id'])) {
|
||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $userdata, $lang;
|
||||
global $userdata, $lang;
|
||||
|
||||
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']);
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||
|
@ -55,7 +55,7 @@ switch ($field) {
|
|||
break;
|
||||
|
||||
case 'user_gender':
|
||||
if (!$bb_cfg['gender']) {
|
||||
if (!config()->get('gender')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
if (!isset($lang['GENDER_SELECT'][$value])) {
|
||||
|
@ -65,7 +65,7 @@ switch ($field) {
|
|||
break;
|
||||
|
||||
case 'user_birthday':
|
||||
if (!$bb_cfg['birthday_enabled']) {
|
||||
if (!config()->get('birthday_enabled')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
$birthday_date = date_parse($value);
|
||||
|
@ -73,10 +73,10 @@ switch ($field) {
|
|||
if (!empty($birthday_date['year'])) {
|
||||
if (strtotime($value) >= TIMENOW) {
|
||||
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
|
||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['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'] < $bb_cfg['birthday_min_age']) {
|
||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
|
||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config()->get('birthday_max_age')) {
|
||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config()->get('birthday_max_age')));
|
||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config()->get('birthday_min_age')) {
|
||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config()->get('birthday_min_age')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
if (!$bb_cfg['torr_server']['enabled']) {
|
||||
if (!config()->get('torr_server.enabled')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
if ($bb_cfg['torr_server']['disable_for_guest'] && IS_GUEST) {
|
||||
if (config()->get('torr_server.disable_for_guest') && IS_GUEST) {
|
||||
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata, $datastore;
|
||||
global $lang, $userdata, $datastore;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -20,10 +20,10 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
$html = '';
|
||||
switch ($mode) {
|
||||
case 'birthday_week':
|
||||
$stats = $datastore->get('stats');
|
||||
$datastore->enqueue([
|
||||
'stats'
|
||||
]);
|
||||
$stats = $datastore->get('stats');
|
||||
|
||||
$users = [];
|
||||
|
||||
|
@ -31,17 +31,17 @@ switch ($mode) {
|
|||
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>';
|
||||
}
|
||||
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $users));
|
||||
$html = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $users));
|
||||
} else {
|
||||
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
||||
$html = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'birthday_today':
|
||||
$stats = $datastore->get('stats');
|
||||
$datastore->enqueue([
|
||||
'stats'
|
||||
]);
|
||||
$stats = $datastore->get('stats');
|
||||
|
||||
$users = [];
|
||||
|
||||
|
@ -59,8 +59,7 @@ switch ($mode) {
|
|||
$forum_id = (int)$this->request['forum_id'];
|
||||
|
||||
$datastore->enqueue([
|
||||
'moderators',
|
||||
'cat_forums'
|
||||
'moderators'
|
||||
]);
|
||||
|
||||
$moderators = [];
|
||||
|
@ -85,7 +84,7 @@ switch ($mode) {
|
|||
break;
|
||||
|
||||
case 'null_ratio':
|
||||
if (!$bb_cfg['ratio_null_enabled'] || !RATIO_ENABLED) {
|
||||
if (!config()->get('ratio_null_enabled') || !RATIO_ENABLED) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
if (empty($this->request['confirmed'])) {
|
||||
|
@ -107,8 +106,8 @@ switch ($mode) {
|
|||
if ($ratio_nulled && !IS_ADMIN) {
|
||||
$this->ajax_die($lang['BT_NULL_RATIO_AGAIN']);
|
||||
}
|
||||
if (($user_ratio >= $bb_cfg['ratio_to_null']) && !IS_ADMIN) {
|
||||
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], $bb_cfg['ratio_to_null']));
|
||||
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' : '';
|
||||
|
@ -173,7 +172,7 @@ switch ($mode) {
|
|||
<th>' . $lang['UPLOADED'] . '</th>
|
||||
<th>' . $lang['RELEASED'] . '</th>
|
||||
<th>' . $lang['BONUS'] . '</th>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row1">
|
||||
<td>' . $lang['TOTAL_TRAF'] . '</td>
|
||||
|
@ -181,17 +180,17 @@ switch ($mode) {
|
|||
<td id="u_up_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td>
|
||||
<td id="u_up_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>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row5">
|
||||
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
|
||||
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
|
||||
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td colspan="1"></td>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<td colspan="1"></td>' : '';
|
||||
$html .= '</tr>';
|
||||
|
||||
$this->response['user_ratio'] = '
|
||||
<th><a href="' . $bb_cfg['ratio_url_help'] . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
||||
<th><a href="' . config()->get('ratio_url_help') . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
||||
<td>' . $user_ratio . '</td>
|
||||
';
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $lang, $bb_cfg;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -19,7 +19,7 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
|
||||
switch ($mode) {
|
||||
case 'clear_cache':
|
||||
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
|
||||
foreach (config()->get('cache.engines') as $cache_name => $cache_val) {
|
||||
CACHE($cache_name)->rm();
|
||||
}
|
||||
|
||||
|
@ -48,20 +48,20 @@ switch ($mode) {
|
|||
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';
|
||||
break;
|
||||
case 'indexer':
|
||||
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
|
||||
exec("indexer --config " . config()->get('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);
|
||||
if (!is_file(config()->get('sphinx_config_path') . ".log")) {
|
||||
file_put_contents(config()->get('sphinx_config_path') . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
|
||||
file_put_contents(config()->get('sphinx_config_path') . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
|
||||
|
||||
foreach ($result as $row) {
|
||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", $row . "\r\n", FILE_APPEND);
|
||||
file_put_contents(config()->get('sphinx_config_path') . ".log", $row . "\r\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
|
||||
file_put_contents($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(config()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND);
|
||||
|
||||
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $lang, $bb_cfg;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $datastore, $log_action;
|
||||
global $userdata, $lang, $datastore, $log_action;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -44,7 +44,7 @@ switch ($mode) {
|
|||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
|
||||
|
||||
// Log action
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
$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'],
|
||||
|
@ -52,7 +52,7 @@ switch ($mode) {
|
|||
'log_msg' => $log_msg . '<br/>-------------',
|
||||
]);
|
||||
}
|
||||
$this->response['status'] = $bb_cfg['tor_icons'][$status];
|
||||
$this->response['status'] = config()->get('tor_icons')[$status];
|
||||
$this->response['topics'] = explode(',', $topics);
|
||||
break;
|
||||
|
||||
|
@ -78,16 +78,16 @@ switch ($mode) {
|
|||
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(',', $bb_cfg['latest_news_forum_id']));
|
||||
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
|
||||
$news_forums = array_flip(explode(',', config()->get('latest_news_forum_id')));
|
||||
if (isset($news_forums[$t_data['forum_id']]) && config()->get('show_latest_news')) {
|
||||
$datastore->enqueue([
|
||||
'latest_news'
|
||||
]);
|
||||
$datastore->update('latest_news');
|
||||
}
|
||||
|
||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
||||
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
|
||||
$net_forums = array_flip(explode(',', config()->get('network_news_forum_id')));
|
||||
if (isset($net_forums[$t_data['forum_id']]) && config()->get('show_network_news')) {
|
||||
$datastore->enqueue([
|
||||
'network_news'
|
||||
]);
|
||||
|
@ -151,8 +151,8 @@ switch ($mode) {
|
|||
} else {
|
||||
$user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']);
|
||||
$user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']);
|
||||
$reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
|
||||
$last_ip = '<a href="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
|
||||
$reg_ip = '<a href="' . config()->get('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>';
|
||||
}
|
||||
|
||||
$this->response['ip_list_html'] = '
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $lang, $bb_cfg, $userdata, $wordCensor;
|
||||
global $lang, $userdata;
|
||||
|
||||
if (!isset($this->request['type'])) {
|
||||
$this->ajax_die('empty type');
|
||||
|
@ -76,11 +76,11 @@ switch ($this->request['type']) {
|
|||
$message = "[quote=\"" . $quote_username . "\"][qpost=" . $post['post_id'] . "]" . $post['post_text'] . "[/quote]\r";
|
||||
|
||||
// hide user passkey
|
||||
$message = preg_replace('#(?<=[\?&;]' . $bb_cfg['passkey_key'] . '=)[a-zA-Z0-9]#', 'passkey', $message);
|
||||
$message = preg_replace('#(?<=[\?&;]' . config()->get('passkey_key') . '=)[a-zA-Z0-9]#', 'passkey', $message);
|
||||
// hide sid
|
||||
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]#', 'sid', $message);
|
||||
|
||||
$message = $wordCensor->censorString($message);
|
||||
$message = censor()->censorString($message);
|
||||
|
||||
if ($post['post_id'] == $post['topic_first_post_id']) {
|
||||
$message = "[quote]" . $post['topic_title'] . "[/quote]\r";
|
||||
|
@ -120,10 +120,10 @@ switch ($this->request['type']) {
|
|||
|
||||
if (mb_strlen($text) > 2) {
|
||||
if ($text != $post['post_text']) {
|
||||
if ($bb_cfg['max_smilies']) {
|
||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
||||
if (config()->get('max_smilies')) {
|
||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||
if ($count_smilies > config()->get('max_smilies')) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||
}
|
||||
}
|
||||
DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
|
||||
|
@ -225,7 +225,7 @@ switch ($this->request['type']) {
|
|||
$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 ($userdata['user_level'] == USER) {
|
||||
if ((TIMENOW - $row['last_post_time']) < $bb_cfg['flood_interval']) {
|
||||
if ((TIMENOW - $row['last_post_time']) < config()->get('flood_interval')) {
|
||||
$this->ajax_die($lang['FLOOD_ERROR']);
|
||||
}
|
||||
}
|
||||
|
@ -251,10 +251,10 @@ switch ($this->request['type']) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['max_smilies']) {
|
||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
||||
if (config()->get('max_smilies')) {
|
||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||
if ($count_smilies > config()->get('max_smilies')) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ switch ($this->request['type']) {
|
|||
'post_text' => $message
|
||||
]);
|
||||
|
||||
if ($bb_cfg['topic_notify_enabled']) {
|
||||
if (config()->get('topic_notify_enabled')) {
|
||||
$notify = !empty($this->request['notify']);
|
||||
\TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -24,7 +24,7 @@ switch ($mode) {
|
|||
case 'create':
|
||||
$map->createSitemap();
|
||||
if (is_file(SITEMAP_DIR . '/sitemap.xml')) {
|
||||
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
|
||||
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, config()->get('post_date_format')) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
|
||||
} else {
|
||||
$html .= $lang['SITEMAP_NOT_CREATED'];
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata;
|
||||
global $lang, $userdata;
|
||||
|
||||
if (!$bb_cfg['tor_thank']) {
|
||||
if (!config()->get('tor_thank')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ switch ($mode) {
|
|||
|
||||
// Limit voters per topic
|
||||
$thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx'];
|
||||
if ($thanks_count > (int)$bb_cfg['tor_thank_limit_per_topic']) {
|
||||
if ($thanks_count > (int)config()->get('tor_thank_limit_per_topic')) {
|
||||
DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1");
|
||||
}
|
||||
break;
|
||||
case 'get':
|
||||
if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) {
|
||||
if (IS_GUEST && !config()->get('tor_thanks_list_guests')) {
|
||||
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata;
|
||||
global $lang, $userdata;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,11 +11,11 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $user, $lang, $bb_cfg;
|
||||
global $user, $lang;
|
||||
|
||||
$post_id = isset($this->request['post_id']) ? (int)$this->request['post_id'] : null;
|
||||
$topic_id = isset($this->request['topic_id']) ? (int)$this->request['topic_id'] : null;
|
||||
$return_text = $bb_cfg['show_post_bbcode_button']['enabled'] && isset($this->request['return_text']) && (bool)$this->request['return_text'];
|
||||
$return_text = config()->get('show_post_bbcode_button.enabled') && isset($this->request['return_text']) && (bool)$this->request['return_text'];
|
||||
|
||||
if (is_null($post_id)) {
|
||||
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id');
|
||||
|
|
|
@ -25,11 +25,11 @@ if (defined('ATTACH_INSTALL')) {
|
|||
*/
|
||||
function attach_mod_get_lang($language_file)
|
||||
{
|
||||
global $attach_config, $bb_cfg;
|
||||
global $attach_config;
|
||||
|
||||
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
|
||||
$file = LANG_ROOT_DIR . '/' . config()->get('default_lang') . '/' . $language_file . '.php';
|
||||
if (file_exists($file)) {
|
||||
return $bb_cfg['default_lang'];
|
||||
return config()->get('default_lang');
|
||||
}
|
||||
|
||||
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
|
||||
|
@ -45,8 +45,6 @@ function attach_mod_get_lang($language_file)
|
|||
*/
|
||||
function get_config()
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$attach_config = [];
|
||||
|
||||
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
|
||||
|
@ -60,7 +58,7 @@ function get_config()
|
|||
}
|
||||
|
||||
// We assign the original default board language here, because it gets overwritten later with the users default language
|
||||
$attach_config['board_lang'] = trim($bb_cfg['default_lang']);
|
||||
$attach_config['board_lang'] = trim(config()->get('default_lang'));
|
||||
|
||||
return $attach_config;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
|
||||
global $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
|
||||
|
||||
$tor_status_by_for_all = true;
|
||||
$change_peers_bgr_over = true;
|
||||
|
@ -40,7 +40,7 @@ $template->assign_vars([
|
|||
]);
|
||||
|
||||
// Define show peers mode (count only || user names with complete % || full details)
|
||||
$cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
|
||||
$cfg_sp_mode = config()->get('bt_show_peers_mode');
|
||||
$get_sp_mode = $_GET['spmode'] ?? '';
|
||||
|
||||
$s_mode = 'count';
|
||||
|
@ -51,7 +51,7 @@ if ($cfg_sp_mode == SHOW_PEERS_NAMES) {
|
|||
$s_mode = 'full';
|
||||
}
|
||||
|
||||
if ($bb_cfg['bt_allow_spmode_change']) {
|
||||
if (config()->get('bt_allow_spmode_change')) {
|
||||
if ($get_sp_mode == 'names') {
|
||||
$s_mode = 'names';
|
||||
} elseif ($get_sp_mode == 'full') {
|
||||
|
@ -68,7 +68,7 @@ $tor_file_size = humn_size($attachments['_' . $post_id][$i]['filesize']);
|
|||
$tor_file_time = bb_date($attachments['_' . $post_id][$i]['filetime']);
|
||||
|
||||
$tor_reged = (bool)$tracker_status;
|
||||
$show_peers = (bool)$bb_cfg['bt_show_peers'];
|
||||
$show_peers = (bool)config()->get('bt_show_peers');
|
||||
|
||||
$locked = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED);
|
||||
$tor_auth = ($bt_user_id != GUEST_UID && (($bt_user_id == $poster_id && !$locked) || $is_auth['auth_mod']));
|
||||
|
@ -88,10 +88,10 @@ if ($tor_auth_reg || $tor_auth_del) {
|
|||
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
|
||||
}
|
||||
|
||||
if ($bb_cfg['tracker']['use_old_torrent_name_format']) {
|
||||
$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.' . TORRENT_EXT;
|
||||
if (config()->get('tracker.use_old_torrent_name_format')) {
|
||||
$display_name = '[' . config()->get('server_name') . '].t' . $bt_topic_id . '.' . TORRENT_EXT;
|
||||
} else {
|
||||
$display_name = $t_data['topic_title'] . ' [' . $bb_cfg['server_name'] . '-' . $bt_topic_id . ']' . '.' . TORRENT_EXT;
|
||||
$display_name = $t_data['topic_title'] . ' [' . config()->get('server_name') . '-' . $bt_topic_id . ']' . '.' . TORRENT_EXT;
|
||||
}
|
||||
|
||||
if (!$tor_reged) {
|
||||
|
@ -149,11 +149,11 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
// Magnet link
|
||||
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
|
||||
$tor_magnet = create_magnet($tor_info['info_hash'], $tor_info['info_hash_v2'], $user_passkey, html_ent_decode($t_data['topic_title']));
|
||||
$tor_magnet = create_magnet($tor_info['info_hash'], $tor_info['info_hash_v2'], $user_passkey, html_ent_decode($t_data['topic_title']), $tor_size);
|
||||
|
||||
// ratio limits
|
||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
||||
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
|
||||
$min_ratio_dl = config()->get('bt_min_ratio_allow_dl_tor');
|
||||
$min_ratio_warn = config()->get('bt_min_ratio_warning');
|
||||
$dl_allowed = true;
|
||||
$user_ratio = 0;
|
||||
|
||||
|
@ -182,7 +182,7 @@ if ($tor_reged && $tor_info) {
|
|||
if ((isset($user_ratio, $min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
|
||||
$template->assign_vars([
|
||||
'SHOW_RATIO_WARN' => true,
|
||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
|
||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, config()->get('ratio_url_help')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -202,12 +202,12 @@ if ($tor_reged && $tor_info) {
|
|||
'TOR_TYPE' => is_gold($tor_type),
|
||||
|
||||
// torrent status mod
|
||||
'TOR_FROZEN' => !IS_AM ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
||||
'TOR_FROZEN' => !IS_AM ? (isset(config()->get('tor_frozen')[$tor_info['tor_status']]) && !(isset(config()->get('tor_frozen_author_download')[$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_ICON' => config()->get('tor_icons')[$tor_info['tor_status']],
|
||||
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && ($is_auth['auth_mod'] || $tor_status_by_for_all)) ? ('<span title="' . bb_date($tor_info['checked_time']) . '"> · ' . profile_url($tor_info) . ' · <i>' . delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] . '</i></span>') : '',
|
||||
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
||||
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||
'TOR_STATUS_REPLY' => config()->get('tor_comment') && !IS_GUEST && in_array($tor_info['tor_status'], config()->get('tor_reply')) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||
//end torrent status mod
|
||||
|
||||
'S_UPLOAD_IMAGE' => $upload_image,
|
||||
|
@ -219,7 +219,6 @@ if ($tor_reged && $tor_info) {
|
|||
'HASH' => !empty($tor_info['info_hash']) ? strtoupper(bin2hex($tor_info['info_hash'])) : false,
|
||||
'HASH_V2' => !empty($tor_info['info_hash_v2']) ? strtoupper(bin2hex($tor_info['info_hash_v2'])) : false,
|
||||
'FILELIST_ICON' => $images['icon_tor_filelist'],
|
||||
'FILELIST_LINK' => FILELIST_URL . $tor_info['topic_id'],
|
||||
'REGED_TIME' => bb_date($tor_info['reg_time']),
|
||||
'REGED_DELTA' => delta_time($tor_info['reg_time']),
|
||||
'TORRENT_SIZE' => humn_size($tor_size, 2),
|
||||
|
@ -228,7 +227,7 @@ if ($tor_reged && $tor_info) {
|
|||
]);
|
||||
|
||||
// TorrServer integration
|
||||
if ($bb_cfg['torr_server']['enabled'] && (!IS_GUEST || !$bb_cfg['torr_server']['disable_for_guest']) && (new \TorrentPier\TorrServerAPI())->getM3UPath($attach_id)) {
|
||||
if (config()->get('torr_server.enabled') && (!IS_GUEST || !config()->get('torr_server.disable_for_guest')) && (new \TorrentPier\TorrServerAPI())->getM3UPath($attach_id)) {
|
||||
$template->assign_block_vars('postrow.attach.tor_reged.tor_server', [
|
||||
'TORR_SERVER_M3U_LINK' => PLAYBACK_M3U_URL . $bt_topic_id,
|
||||
'TORR_SERVER_M3U_ICON' => $images['icon_tor_m3u_icon'],
|
||||
|
@ -240,12 +239,12 @@ if ($tor_reged && $tor_info) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['show_tor_info_in_dl_list']) {
|
||||
if (config()->get('show_tor_info_in_dl_list')) {
|
||||
$template->assign_vars([
|
||||
'SHOW_DL_LIST' => true,
|
||||
'SHOW_DL_LIST_TOR_INFO' => true,
|
||||
|
||||
'TOR_SIZE' => humn_size($tor_size, 1),
|
||||
'TOR_SIZE' => humn_size($tor_size, 2),
|
||||
'TOR_LONGEVITY' => delta_time($tor_info['reg_time']),
|
||||
'TOR_DOWNLOAD_COUNT' => $download_count,
|
||||
'TOR_COMPLETED' => $tor_completed_count,
|
||||
|
@ -302,7 +301,7 @@ if ($tor_reged && $tor_info) {
|
|||
$sql = "SELECT
|
||||
tr.user_id, tr.ip, tr.ipv6, tr.port, tr.peer_id, tr.uploaded, tr.downloaded, tr.remain,
|
||||
tr.seeder, tr.releaser, tr.speed_up, tr.speed_down, tr.update_time,
|
||||
tr.complete_percent, u.username, u.user_rank
|
||||
tr.complete_percent, u.username, u.user_rank, u.user_opt
|
||||
FROM " . BB_BT_TRACKER . " tr
|
||||
LEFT JOIN " . BB_USERS . " u ON u.user_id = tr.user_id
|
||||
WHERE tr.topic_id = $tor_id
|
||||
|
@ -373,8 +372,8 @@ if ($tor_reged && $tor_info) {
|
|||
$peers = $tmp;
|
||||
|
||||
$template->assign_vars([
|
||||
'TOR_SPEED_UP' => ($tor_speed_up) ? humn_size($tor_speed_up, 0, 'KB') . '/s' : '0 KB/s',
|
||||
'TOR_SPEED_DOWN' => ($tor_speed_down) ? humn_size($tor_speed_down, 0, 'KB') . '/s' : '0 KB/s'
|
||||
'TOR_SPEED_UP' => ($tor_speed_up) ? humn_size($tor_speed_up, min: 'KB') . '/s' : '0 KB/s',
|
||||
'TOR_SPEED_DOWN' => ($tor_speed_down) ? humn_size($tor_speed_down, min: 'KB') . '/s' : '0 KB/s'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -384,7 +383,9 @@ if ($tor_reged && $tor_info) {
|
|||
// Full details mode
|
||||
if ($s_mode == 'full') {
|
||||
if (!empty($peer['ip']) && !empty($peer['ipv6'])) {
|
||||
$ip = bt_show_ip($peer['ipv6']) . ' (' . bt_show_ip($peer['ip']) . ')';
|
||||
if ($ip = bt_show_ip($peer['ipv6'])) {
|
||||
$ip .= ' (' . bt_show_ip($peer['ip']) . ')';
|
||||
}
|
||||
} else {
|
||||
$ip = bt_show_ip(!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']);
|
||||
}
|
||||
|
@ -407,7 +408,7 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
$template->assign_block_vars((string)$x_full, [
|
||||
'SEED_ORD_ACT' => $seed_order_action,
|
||||
'SEEDERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s'
|
||||
'SEEDERS_UP_TOT' => humn_size($sp_up_tot[$x], min: 'KB') . '/s'
|
||||
]);
|
||||
|
||||
if ($ip) {
|
||||
|
@ -429,8 +430,8 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
$template->assign_block_vars((string)$x_full, [
|
||||
'LEECH_ORD_ACT' => $leech_order_action,
|
||||
'LEECHERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s',
|
||||
'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], 0, 'KB') . '/s'
|
||||
'LEECHERS_UP_TOT' => humn_size($sp_up_tot[$x], min: 'KB') . '/s',
|
||||
'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], min: 'KB') . '/s'
|
||||
]);
|
||||
|
||||
if ($ip) {
|
||||
|
@ -444,23 +445,48 @@ if ($tor_reged && $tor_info) {
|
|||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $tor_size) : 0;
|
||||
}
|
||||
|
||||
$rel_sign = (!$guest && $peer['releaser']) ? ' <b><sup>®</sup></b>' : '';
|
||||
$name = profile_url($peer) . $rel_sign;
|
||||
$up_tot = ($p_max_up) ? humn_size($p_max_up) : '-';
|
||||
$down_tot = ($p_max_down) ? humn_size($p_max_down) : '-';
|
||||
$up_ratio = ($p_max_down) ? round(($p_max_up / $p_max_down), 2) : '';
|
||||
$sp_up = ($peer['speed_up']) ? humn_size($peer['speed_up'], 0, 'KB') . '/s' : '-';
|
||||
$sp_down = ($peer['speed_down']) ? humn_size($peer['speed_down'], 0, 'KB') . '/s' : '-';
|
||||
$sp_up = ($peer['speed_up']) ? humn_size($peer['speed_up'], min: 'KB') . '/s' : '-';
|
||||
$sp_down = ($peer['speed_down']) ? humn_size($peer['speed_down'], min: 'KB') . '/s' : '-';
|
||||
|
||||
$bgr_class = (!($tr[$x] % 2)) ? $bgr_class_1 : $bgr_class_2;
|
||||
$row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
|
||||
$tr[$x]++;
|
||||
|
||||
$peerUsername = $lang['HIDDEN_USER'];
|
||||
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_peer_username')) {
|
||||
$releaserSign = (!$guest && $peer['releaser']) ? ' <b><sup>®</sup></b>' : '';
|
||||
$peerUsername = profile_url($peer) . $releaserSign;
|
||||
$peerUsername = $peer['update_time'] ? $peerUsername : "<s>$peerUsername</s>";
|
||||
}
|
||||
|
||||
$peerTorrentClient = $lang['HIDDEN_USER'];
|
||||
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_torrent_client')) {
|
||||
if (isset($peer['peer_id'])) {
|
||||
$peerTorrentClient = get_user_torrent_client($peer['peer_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$peerCountry = $lang['HIDDEN_USER'];
|
||||
if (config()->get('ip2country_settings.enabled')) {
|
||||
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_peer_country')) {
|
||||
if ($infoByIP = infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])) {
|
||||
if (!empty($infoByIP['countryCode'])) {
|
||||
$peerCountry = render_flag($infoByIP['countryCode'], false);
|
||||
} else {
|
||||
$peerCountry = $lang['NOT_AVAILABLE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars("$x_full.$x_row", [
|
||||
'ROW_BGR' => $row_bgr,
|
||||
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
|
||||
'PEER_ID' => isset($peer['peer_id']) ? get_user_torrent_client($peer['peer_id']) : $lang['UNKNOWN'],
|
||||
'COUNTRY' => render_flag(infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])['countryCode'], false),
|
||||
'NAME' => $peerUsername,
|
||||
'PEER_ID' => $peerTorrentClient,
|
||||
'COUNTRY' => $peerCountry,
|
||||
'COMPL_PRC' => $compl_perc,
|
||||
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,
|
||||
'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "<b>$down_tot</b>" : $down_tot,
|
||||
|
@ -470,12 +496,15 @@ if ($tor_reged && $tor_info) {
|
|||
'DOWN_TOTAL_RAW' => $peer['downloaded'],
|
||||
'SPEED_UP_RAW' => $peer['speed_up'],
|
||||
'SPEED_DOWN_RAW' => $peer['speed_down'],
|
||||
'UPD_EXP_TIME' => ($peer['update_time']) ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' · ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'],
|
||||
'TOR_RATIO' => ($up_ratio) ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : ''
|
||||
'UPD_EXP_TIME' => $peer['update_time'] ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' · ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'],
|
||||
'TOR_RATIO' => $up_ratio ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : ''
|
||||
]);
|
||||
|
||||
if ($ip) {
|
||||
$template->assign_block_vars("$x_full.$x_row.ip", ['IP' => $ip]);
|
||||
$template->assign_block_vars("$x_full.$x_row.ip", [
|
||||
'U_WHOIS_IP' => config()->get('whois_info') . $ip,
|
||||
'IP' => $ip
|
||||
]);
|
||||
}
|
||||
if ($port !== false) {
|
||||
$template->assign_block_vars("$x_full.$x_row.port", ['PORT' => $port]);
|
||||
|
@ -536,7 +565,7 @@ if ($tor_reged && $tor_info) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
|
||||
if (config()->get('bt_allow_spmode_change') && $s_mode != 'full') {
|
||||
$template->assign_vars([
|
||||
'PEERS_FULL_LINK' => true,
|
||||
'SPMODE_FULL_HREF' => TOPIC_URL . "$bt_topic_id&spmode=full#seeders"
|
||||
|
@ -544,14 +573,14 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
|
|||
}
|
||||
|
||||
$template->assign_vars([
|
||||
'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL),
|
||||
'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
|
||||
'SHOW_DL_LIST_LINK' => ((config()->get('bt_show_dl_list') || config()->get('allow_dl_list_names_mode')) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL),
|
||||
'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset(config()->get('tor_no_tor_act')[$tor_info['tor_status']]) || IS_AM)),
|
||||
'S_MODE_COUNT' => ($s_mode == 'count'),
|
||||
'S_MODE_NAMES' => ($s_mode == 'names'),
|
||||
'S_MODE_FULL' => ($s_mode == 'full'),
|
||||
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
||||
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
||||
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
||||
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
|
||||
'CALL_SEED' => (!IS_GUEST && $bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
||||
'TOR_HELP_LINKS' => config()->get('tor_help_links'),
|
||||
'CALL_SEED' => (!IS_GUEST && config()->get('callseed') && $tor_reged && !isset(config()->get('tor_no_tor_act')[$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
||||
]);
|
||||
|
|
|
@ -342,7 +342,7 @@ function _set_var(&$result, $var, $type, $multibyte = false)
|
|||
* @param $var_name
|
||||
* @param $default
|
||||
* @param bool $multibyte
|
||||
* @return array
|
||||
* @return array|string
|
||||
*/
|
||||
function get_var($var_name, $default, $multibyte = false)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
|
||||
{
|
||||
global $lang, $bb_cfg;
|
||||
global $lang;
|
||||
|
||||
// Generate Array, if it's not an array
|
||||
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
|
||||
|
@ -215,7 +215,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
|
|||
}
|
||||
|
||||
// TorrServer integration
|
||||
if ($bb_cfg['torr_server']['enabled']) {
|
||||
if (config()->get('torr_server.enabled')) {
|
||||
$torrServer = new \TorrentPier\TorrServerAPI();
|
||||
$torrServer->removeM3U($attachments[$j]['attach_id']);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ $reserved_port = env('TP_PORT', 80);
|
|||
$bb_cfg = [];
|
||||
|
||||
// Version info
|
||||
$bb_cfg['tp_version'] = 'v2.4.5-rc.4';
|
||||
$bb_cfg['tp_release_date'] = '09-03-2025';
|
||||
$bb_cfg['tp_version'] = 'v2.8.3';
|
||||
$bb_cfg['tp_release_date'] = '03-07-2025';
|
||||
$bb_cfg['tp_release_codename'] = 'Cattle';
|
||||
|
||||
// Increase version number after changing JS or CSS
|
||||
|
@ -60,27 +60,22 @@ $bb_cfg['cache'] = [
|
|||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
],
|
||||
'redis' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'pconnect' => !PHP_ZTS, // Redis pconnect supported only for non-thread safe compilations of PHP
|
||||
],
|
||||
// Available cache types: filecache, memcached, sqlite, redis, apcu (filecache by default)
|
||||
// Available cache types: file, sqlite, memory, memcached (file by default)
|
||||
'engines' => [
|
||||
'bb_cache' => ['filecache'],
|
||||
'bb_config' => ['filecache'],
|
||||
'tr_cache' => ['filecache'],
|
||||
'session_cache' => ['filecache'],
|
||||
'bb_cap_sid' => ['filecache'],
|
||||
'bb_login_err' => ['filecache'],
|
||||
'bb_poll_data' => ['filecache'],
|
||||
'bb_ip2countries' => ['filecache'],
|
||||
'bb_cache' => ['file'],
|
||||
'bb_config' => ['file'],
|
||||
'tr_cache' => ['file'],
|
||||
'session_cache' => ['file'],
|
||||
'bb_cap_sid' => ['file'],
|
||||
'bb_login_err' => ['file'],
|
||||
'bb_poll_data' => ['file'],
|
||||
'bb_ip2countries' => ['file'],
|
||||
],
|
||||
];
|
||||
|
||||
// Datastore
|
||||
// Available datastore types: filecache, memcached, sqlite, redis, apcu (filecache by default)
|
||||
$bb_cfg['datastore_type'] = 'filecache';
|
||||
// Available datastore types: file, sqlite, memory, memcache (file by default)
|
||||
$bb_cfg['datastore_type'] = 'file';
|
||||
|
||||
// Server
|
||||
$bb_cfg['server_name'] = $domain_name = !empty($_SERVER['SERVER_NAME']) ? idn_to_utf8($_SERVER['SERVER_NAME']) : $reserved_name;
|
||||
|
@ -144,10 +139,12 @@ $bb_cfg['torr_server'] = [
|
|||
'disable_for_guest' => true
|
||||
];
|
||||
|
||||
// IndexNow settings
|
||||
$bb_cfg['indexnow_settings'] = [
|
||||
'enabled' => false,
|
||||
'host' => 'bing', // Available: yandex, bing, seznam, naver
|
||||
// FreeIPAPI settings
|
||||
$bb_cfg['ip2country_settings'] = [
|
||||
// Documentation: https://docs.freeipapi.com/
|
||||
'enabled' => true,
|
||||
'endpoint' => 'https://freeipapi.com/api/json/',
|
||||
'api_token' => '', // not required for basic usage
|
||||
];
|
||||
|
||||
// FAQ url help link
|
||||
|
@ -207,6 +204,7 @@ $bb_cfg['lang'] = [
|
|||
'ar' => [
|
||||
'name' => 'Arabic',
|
||||
'locale' => 'ar_SA.UTF-8',
|
||||
'rtl' => true,
|
||||
],
|
||||
'hy' => [
|
||||
'name' => 'Armenian',
|
||||
|
@ -283,6 +281,7 @@ $bb_cfg['lang'] = [
|
|||
'he' => [
|
||||
'name' => 'Hebrew',
|
||||
'locale' => 'he_IL.UTF-8',
|
||||
'rtl' => true,
|
||||
],
|
||||
'hi' => [
|
||||
'name' => 'Hindi',
|
||||
|
@ -426,7 +425,7 @@ $bb_cfg['invites_system'] = [
|
|||
// Syntax: 'invite_code' => 'validity_period'
|
||||
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
|
||||
// You can also create a permanent invite, set 'permanent' value for 'validity_period'
|
||||
// Invite link example: site_url/profile.php?mode=register&invite=new_year
|
||||
// Invite link example: site_url/profile.php?mode=register&invite=new_year2023
|
||||
'new_year2023' => '2022-12-31 00:00:01',
|
||||
'340c4bb6ea2d284c13e085b60b990a8a' => '12 April 1961',
|
||||
'tp_birthday' => '2005-04-04',
|
||||
|
@ -435,22 +434,23 @@ $bb_cfg['invites_system'] = [
|
|||
];
|
||||
$bb_cfg['password_symbols'] = [
|
||||
// What symbols should be required in the password
|
||||
'nums' => true, // Numeric
|
||||
'spec_symbols' => false, // Special symbols
|
||||
'letters' => [ // Letters
|
||||
'uppercase' => true, // Uppercase letters
|
||||
'lowercase' => true // Lowercase letters
|
||||
'nums' => true,
|
||||
'spec_symbols' => false,
|
||||
'letters' => [
|
||||
'uppercase' => false,
|
||||
'lowercase' => true
|
||||
]
|
||||
];
|
||||
$bb_cfg['password_hash_options'] = [
|
||||
// https://www.php.net/manual/ru/password.constants.php
|
||||
'algo' => PASSWORD_BCRYPT,
|
||||
'options' => []
|
||||
'options' => ['cost' => 12]
|
||||
];
|
||||
|
||||
// Email
|
||||
$bb_cfg['emailer'] = [
|
||||
'enabled' => true,
|
||||
'sendmail_command' => '/usr/sbin/sendmail -bs',
|
||||
'smtp' => [
|
||||
'enabled' => false, // send email via external SMTP server
|
||||
'host' => 'localhost', // SMTP server host
|
||||
|
|
|
@ -20,7 +20,6 @@ define('LOG_DIR', BB_PATH . '/internal_data/log');
|
|||
define('TRIGGERS_DIR', BB_PATH . '/internal_data/triggers');
|
||||
define('AJAX_DIR', BB_PATH . '/library/ajax');
|
||||
define('ATTACH_DIR', BB_PATH . '/library/attach_mod');
|
||||
define('CFG_DIR', BB_PATH . '/library/config');
|
||||
define('INC_DIR', BB_PATH . '/library/includes');
|
||||
define('UCP_DIR', BB_PATH . '/library/includes/ucp');
|
||||
define('LANG_ROOT_DIR', BB_PATH . '/library/language');
|
||||
|
@ -35,9 +34,6 @@ define('UPDATER_URL', 'https://api.github.com/repos/torrentpier/torrentpier/rele
|
|||
define('UPDATER_FILE', INT_DATA_DIR . '/updater.json');
|
||||
define('COOKIE_DBG', 'bb_dbg');
|
||||
|
||||
// TODO: Move in another section
|
||||
define('API_IP_URL', 'https://freeipapi.com/api/json/');
|
||||
|
||||
// Templates
|
||||
define('ADMIN_TPL_DIR', TEMPLATES_DIR . '/admin/');
|
||||
define('XS_USE_ISSET', '1');
|
||||
|
@ -87,11 +83,15 @@ define('CRON_RUNNING', TRIGGERS_DIR . '/cron_running');
|
|||
define('GZIP_OUTPUT_ALLOWED', extension_loaded('zlib') && !ini_get('zlib.output_compression'));
|
||||
define('UA_GZIP_SUPPORTED', isset($_SERVER['HTTP_ACCEPT_ENCODING']) && str_contains($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'));
|
||||
|
||||
// Migrations table
|
||||
define('BB_MIGRATIONS', 'bb_migrations');
|
||||
|
||||
// Tracker shared constants
|
||||
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('BB_USERS', 'bb_users');
|
||||
define('BT_AUTH_KEY_LENGTH', 20); // Passkey length
|
||||
|
||||
// Torrents (reserved: -1)
|
||||
|
@ -137,6 +137,15 @@ define('ONLY_NEW_TOPICS', 2);
|
|||
define('GUEST_UID', -1);
|
||||
define('BOT_UID', -746);
|
||||
|
||||
// User Levels
|
||||
define('DELETED', -1);
|
||||
define('USER', 0);
|
||||
define('ADMIN', 1);
|
||||
define('MOD', 2);
|
||||
define('GROUP_MEMBER', 20);
|
||||
define('CP_HOLDER', 25);
|
||||
define('EXCLUDED_USERS', implode(',', [GUEST_UID, BOT_UID]));
|
||||
|
||||
// Ratio limits
|
||||
define('TR_RATING_LIMITS', true); // ON/OFF
|
||||
define('MIN_DL_FOR_RATIO', 10737418240); // 10 GB in bytes, 0 - disable
|
||||
|
|
|
@ -83,6 +83,23 @@ HTML;
|
|||
<span class="post-hr">-</span>
|
||||
HTML;
|
||||
|
||||
// Box
|
||||
$bbcode_tpl['box_open'] = <<<HTML
|
||||
<div class="post-box-default"><div class="post-box">
|
||||
HTML;
|
||||
|
||||
$bbcode_tpl['box_open_color'] = <<<HTML
|
||||
<div class="post-box-default"><div class="post-box" style="border-color: $1; background-color: $2;">
|
||||
HTML;
|
||||
|
||||
$bbcode_tpl['box_open_color_single'] = <<<HTML
|
||||
<div class="post-box-default"><div class="post-box" style="border-color: $1;">
|
||||
HTML;
|
||||
|
||||
$bbcode_tpl['box_close'] = <<<HTML
|
||||
</div></div>
|
||||
HTML;
|
||||
|
||||
array_deep($bbcode_tpl, 'bbcode_tpl_compact');
|
||||
return $bbcode_tpl;
|
||||
}
|
||||
|
@ -106,7 +123,7 @@ function prepare_message($message)
|
|||
// Either in a window or inline
|
||||
function generate_smilies($mode)
|
||||
{
|
||||
global $bb_cfg, $template, $lang, $user, $datastore;
|
||||
global $template, $lang, $user, $datastore;
|
||||
|
||||
$inline_columns = 4;
|
||||
$inline_rows = 7;
|
||||
|
@ -118,7 +135,7 @@ function generate_smilies($mode)
|
|||
|
||||
$data = $datastore->get('smile_replacements');
|
||||
|
||||
if ($sql = $data['smile']) {
|
||||
if (isset($data['smile']) && $sql = $data['smile']) {
|
||||
$num_smilies = 0;
|
||||
$rowset = [];
|
||||
foreach ($sql as $row) {
|
||||
|
@ -143,7 +160,7 @@ function generate_smilies($mode)
|
|||
|
||||
$template->assign_block_vars('smilies_row.smilies_col', [
|
||||
'SMILEY_CODE' => $data['code'],
|
||||
'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url,
|
||||
'SMILEY_IMG' => config()->get('smilies_path') . '/' . $smile_url,
|
||||
'SMILEY_DESC' => $data['emoticon'],
|
||||
]);
|
||||
|
||||
|
@ -324,11 +341,9 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
|
|||
|
||||
function extract_search_words($text)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$max_words_count = $bb_cfg['max_search_words_per_post'];
|
||||
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
|
||||
$max_word_len = $bb_cfg['search_max_word_len'];
|
||||
$max_words_count = config()->get('max_search_words_per_post');
|
||||
$min_word_len = max(2, config()->get('search_min_word_len') - 1);
|
||||
$max_word_len = config()->get('search_max_word_len');
|
||||
|
||||
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
||||
$text = str_replace(['[', ']'], ['[', ']'], $text);
|
||||
|
@ -365,12 +380,10 @@ function extract_search_words($text)
|
|||
|
||||
function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$text = $topic_title . ' ' . $post_message;
|
||||
$words = ($text) ? extract_search_words($text) : [];
|
||||
|
||||
if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
|
||||
if ($only_return_words || config()->get('search_engine_type') == 'sphinx') {
|
||||
return implode("\n", $words);
|
||||
}
|
||||
|
||||
|
@ -388,12 +401,12 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
|
|||
|
||||
function bbcode2html($text)
|
||||
{
|
||||
global $bbcode, $wordCensor;
|
||||
global $bbcode;
|
||||
|
||||
if (!isset($bbcode)) {
|
||||
$bbcode = new TorrentPier\Legacy\BBCode();
|
||||
}
|
||||
$text = $wordCensor->censorString($text);
|
||||
$text = censor()->censorString($text);
|
||||
return $bbcode->bbcode2html($text);
|
||||
}
|
||||
|
||||
|
@ -408,22 +421,19 @@ function get_words_rate($text)
|
|||
|
||||
function hide_passkey($str)
|
||||
{
|
||||
global $bb_cfg;
|
||||
return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
|
||||
return preg_replace("#\?{config()->get('passkey_key')}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{config()->get('passkey_key')}=passkey", $str);
|
||||
}
|
||||
|
||||
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html'])) {
|
||||
if (config()->get('use_posts_cache') && !empty($postrow['post_html'])) {
|
||||
return $postrow['post_html'];
|
||||
}
|
||||
|
||||
$message = bbcode2html($postrow['post_text']);
|
||||
|
||||
// Posts cache
|
||||
if ($bb_cfg['use_posts_cache']) {
|
||||
if (config()->get('use_posts_cache')) {
|
||||
DB()->shutdown['post_html'][] = [
|
||||
'post_id' => (int)$postrow['post_id'],
|
||||
'post_html' => (string)$message
|
||||
|
|
|
@ -13,11 +13,10 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
define('IN_CRON', true);
|
||||
|
||||
// Set SESSION vars
|
||||
// Set SESSION vars (optimized for InnoDB)
|
||||
DB()->query("
|
||||
SET SESSION
|
||||
myisam_sort_buffer_size = 16*1024*1024
|
||||
, bulk_insert_buffer_size = 8*1024*1024
|
||||
bulk_insert_buffer_size = 8*1024*1024
|
||||
, join_buffer_size = 4*1024*1024
|
||||
, read_buffer_size = 4*1024*1024
|
||||
, read_rnd_buffer_size = 8*1024*1024
|
||||
|
@ -29,8 +28,7 @@ DB()->query("
|
|||
// Restore vars at shutdown
|
||||
DB()->add_shutdown_query("
|
||||
SET SESSION
|
||||
myisam_sort_buffer_size = DEFAULT
|
||||
, bulk_insert_buffer_size = DEFAULT
|
||||
bulk_insert_buffer_size = DEFAULT
|
||||
, join_buffer_size = DEFAULT
|
||||
, read_buffer_size = DEFAULT
|
||||
, read_rnd_buffer_size = DEFAULT
|
||||
|
|
|
@ -26,9 +26,9 @@ $posts_without_attach = $topics_without_attach = [];
|
|||
|
||||
DB()->query("
|
||||
CREATE TEMPORARY TABLE $tmp_attach_tbl (
|
||||
physical_filename VARCHAR(255) NOT NULL default '',
|
||||
physical_filename VARCHAR(255) NOT NULL default '' COLLATE utf8mb4_unicode_ci,
|
||||
KEY physical_filename (physical_filename(20))
|
||||
) ENGINE = MyISAM DEFAULT CHARSET = utf8
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
|
||||
");
|
||||
DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_attach_tbl");
|
||||
|
||||
|
@ -144,7 +144,7 @@ if ($check_attachments) {
|
|||
$orphan_db_attach[] = $row['attach_id'];
|
||||
}
|
||||
// Delete all orphan attachments
|
||||
if ($bb_cfg['torr_server']['enabled'] && $fix_errors) {
|
||||
if (config()->get('torr_server.enabled') && $fix_errors) {
|
||||
foreach ($orphan_db_attach as $attach_id) {
|
||||
// TorrServer integration
|
||||
$torrServer = new \TorrentPier\TorrServerAPI();
|
||||
|
|
|
@ -17,7 +17,7 @@ if (!defined('BB_ROOT')) {
|
|||
\TorrentPier\Legacy\Admin\Common::sync_all_forums();
|
||||
|
||||
// Cleaning bb_poll_users
|
||||
if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
|
||||
if ($poll_max_days = (int)config()->get('poll_max_days')) {
|
||||
$per_cycle = 20000;
|
||||
$row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS);
|
||||
$start_id = (int)$row['start_id'];
|
||||
|
@ -45,12 +45,12 @@ if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
|
|||
DB()->query("UPDATE " . BB_USERS . " SET user_newpasswd = '' WHERE user_lastvisit < " . (TIMENOW - 7 * 86400));
|
||||
|
||||
// Cleaning post cache
|
||||
if ($posts_days = (int)$bb_cfg['posts_cache_days_keep']) {
|
||||
if ($posts_days = (int)config()->get('posts_cache_days_keep')) {
|
||||
DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
|
||||
}
|
||||
|
||||
// Autofill announcer url
|
||||
if (empty($bb_cfg['bt_announce_url']) || ($bb_cfg['bt_announce_url'] === 'https://localhost/bt/announce.php')) {
|
||||
if (empty(config()->get('bt_announce_url')) || (config()->get('bt_announce_url') === 'https://localhost/bt/announce.php')) {
|
||||
bb_update_config(['bt_announce_url' => FULL_URL . 'bt/announce.php']);
|
||||
}
|
||||
|
||||
|
@ -59,19 +59,5 @@ if (IN_DEMO_MODE) {
|
|||
DB()->query("UPDATE " . BB_FORUMS . " SET allow_reg_tracker = 1 WHERE allow_reg_tracker = 0 AND forum_id = 1 LIMIT 1");
|
||||
}
|
||||
|
||||
// Create unique TorrentPier instance hash
|
||||
if (empty($bb_cfg['tp_instance_hash']) || ($bb_cfg['tp_instance_hash'] !== hash('xxh128', FULL_URL))) {
|
||||
bb_update_config(['tp_instance_hash' => hash('xxh128', FULL_URL)]);
|
||||
}
|
||||
|
||||
// Generate IndexNow key
|
||||
if ($bb_cfg['indexnow_settings']['enabled'] && !is_file(BB_ROOT . $bb_cfg['indexnow_key'] . \TorrentPier\IndexNow::$keyFileExtension)) {
|
||||
$randomIndexNowKey = empty($bb_cfg['indexnow_key']) ? make_rand_str(rand(64, 128)) : $bb_cfg['indexnow_key'];
|
||||
if ($bb_cfg['indexnow_key'] !== $randomIndexNowKey) {
|
||||
bb_update_config(['indexnow_key' => $randomIndexNowKey]);
|
||||
}
|
||||
file_write($randomIndexNowKey, (BB_ROOT . $randomIndexNowKey . \TorrentPier\IndexNow::$keyFileExtension));
|
||||
}
|
||||
|
||||
// Check for updates
|
||||
$datastore->update('check_updates');
|
||||
|
|
|
@ -13,10 +13,10 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
// Delete staled dl-status records
|
||||
$keeping_dlstat = [
|
||||
DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'],
|
||||
DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'],
|
||||
DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'],
|
||||
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep']
|
||||
DL_STATUS_WILL => (int)config()->get('dl_will_days_keep'),
|
||||
DL_STATUS_DOWN => (int)config()->get('dl_down_days_keep'),
|
||||
DL_STATUS_COMPLETE => (int)config()->get('dl_complete_days_keep'),
|
||||
DL_STATUS_CANCEL => (int)config()->get('dl_cancel_days_keep')
|
||||
];
|
||||
|
||||
$delete_dlstat_sql = [];
|
||||
|
@ -51,7 +51,7 @@ DB()->query("
|
|||
");
|
||||
|
||||
// Tor-Stats cleanup
|
||||
if ($torstat_days_keep = (int)$bb_cfg['torstat_days_keep']) {
|
||||
if ($torstat_days_keep = (int)config()->get('torstat_days_keep')) {
|
||||
DB()->query("DELETE QUICK FROM " . BB_BT_TORSTAT . " WHERE last_modified_torstat < DATE_SUB(NOW(), INTERVAL $torstat_days_keep DAY)");
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$log_days_keep = (int)$bb_cfg['log_days_keep'];
|
||||
$log_days_keep = (int)config()->get('log_days_keep');
|
||||
|
||||
if ($log_days_keep !== 0) {
|
||||
DB()->query("DELETE FROM " . BB_LOG . " WHERE log_time < " . (TIMENOW - 86400 * $log_days_keep));
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$pm_days_keep = (int)$bb_cfg['pm_days_keep'];
|
||||
$pm_days_keep = (int)config()->get('pm_days_keep');
|
||||
|
||||
if ($pm_days_keep !== 0) {
|
||||
$per_cycle = 20000;
|
||||
|
|
|
@ -1,44 +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')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
set_time_limit(600);
|
||||
|
||||
global $cron_runtime_log;
|
||||
|
||||
$dump_path = BB_ROOT . 'install/sql/mysql.sql';
|
||||
|
||||
if (!IN_DEMO_MODE || !is_file($dump_path) || !is_readable($dump_path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean cache & datastore
|
||||
$datastore->clean();
|
||||
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
|
||||
CACHE($cache_name)->rm();
|
||||
}
|
||||
|
||||
// Drop tables & Insert sql dump
|
||||
$temp_line = '';
|
||||
foreach (file($dump_path) as $line) {
|
||||
if (str_starts_with($line, '--') || $line == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$temp_line .= $line;
|
||||
if (str_ends_with(trim($line), ';')) {
|
||||
if (!DB()->query($temp_line)) {
|
||||
$cron_runtime_log[] = date('Y-m-d H:i:s') . " -- Error performing query: " . $temp_line . " | " . DB()->sql_error()['message'];
|
||||
}
|
||||
$temp_line = '';
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
if ($bb_cfg['prune_enable']) {
|
||||
if (config()->get('prune_enable')) {
|
||||
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
|
||||
|
||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||
|
|
|
@ -17,7 +17,7 @@ while (true) {
|
|||
set_time_limit(600);
|
||||
$prune_users = $not_activated_users = $not_active_users = [];
|
||||
|
||||
if ($not_activated_days = (int)$bb_cfg['user_not_activated_days_keep']) {
|
||||
if ($not_activated_days = (int)config()->get('user_not_activated_days_keep')) {
|
||||
$sql = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
|
||||
WHERE user_level = 0
|
||||
AND user_lastvisit = 0
|
||||
|
@ -31,7 +31,7 @@ while (true) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($not_active_days = (int)$bb_cfg['user_not_active_days_keep']) {
|
||||
if ($not_active_days = (int)config()->get('user_not_active_days_keep')) {
|
||||
$sql = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
|
||||
WHERE user_level = 0
|
||||
AND user_posts = 0
|
||||
|
|
|
@ -11,8 +11,8 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
if ($bb_cfg['topic_moved_days_keep']) {
|
||||
$prune_time = TIMENOW - 86400 * $bb_cfg['topic_moved_days_keep'];
|
||||
if (config()->get('topic_moved_days_keep')) {
|
||||
$prune_time = TIMENOW - 86400 * config()->get('topic_moved_days_keep');
|
||||
|
||||
DB()->query("
|
||||
DELETE FROM " . BB_TOPICS . "
|
||||
|
|
|
@ -11,10 +11,10 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
$user_session_expire_time = TIMENOW - (int)$bb_cfg['user_session_duration'];
|
||||
$admin_session_expire_time = TIMENOW - (int)$bb_cfg['admin_session_duration'];
|
||||
$user_session_expire_time = TIMENOW - (int)config()->get('user_session_duration');
|
||||
$admin_session_expire_time = TIMENOW - (int)config()->get('admin_session_duration');
|
||||
|
||||
$user_session_gc_time = $user_session_expire_time - (int)$bb_cfg['user_session_gc_ttl'];
|
||||
$user_session_gc_time = $user_session_expire_time - (int)config()->get('user_session_gc_ttl');
|
||||
$admin_session_gc_time = $admin_session_expire_time;
|
||||
|
||||
// ############################ Tables LOCKED ################################
|
||||
|
|
|
@ -27,7 +27,7 @@ DB()->query("CREATE TABLE " . NEW_BB_BT_LAST_USERSTAT . " LIKE " . BB_BT_LAST_US
|
|||
DB()->expect_slow_query(600);
|
||||
|
||||
// Update dlstat (part 1)
|
||||
if ($bb_cfg['tracker']['update_dlstat']) {
|
||||
if (config()->get('tracker.update_dlstat')) {
|
||||
// ############################ Tables LOCKED ################################
|
||||
DB()->lock([
|
||||
BB_BT_TRACKER,
|
||||
|
@ -39,7 +39,7 @@ if ($bb_cfg['tracker']['update_dlstat']) {
|
|||
INSERT INTO " . NEW_BB_BT_LAST_TORSTAT . "
|
||||
(topic_id, user_id, dl_status, up_add, down_add, release_add, speed_up, speed_down)
|
||||
SELECT
|
||||
topic_id, user_id, IF(releaser, $releaser, seeder), SUM(up_add), SUM(down_add), IF(releaser, SUM(up_add), 0), SUM(speed_up), SUM(speed_down)
|
||||
topic_id, user_id, IF(MAX(releaser), $releaser, MAX(seeder)), SUM(up_add), SUM(down_add), IF(MAX(releaser), SUM(up_add), 0), SUM(speed_up), SUM(speed_down)
|
||||
FROM " . BB_BT_TRACKER . "
|
||||
WHERE (up_add != 0 OR down_add != 0)
|
||||
GROUP BY topic_id, user_id
|
||||
|
@ -61,20 +61,19 @@ DB()->query("
|
|||
FROM " . BB_BT_TRACKER . "
|
||||
WHERE seeder = 1
|
||||
GROUP BY topic_id, user_id
|
||||
ORDER BY update_time DESC
|
||||
");
|
||||
|
||||
// Clean peers table
|
||||
if ($bb_cfg['tracker']['autoclean']) {
|
||||
$announce_interval = max((int)$bb_cfg['announce_interval'], 60);
|
||||
$expire_factor = max((float)$bb_cfg['tracker']['expire_factor'], 1);
|
||||
if (config()->get('tracker.autoclean')) {
|
||||
$announce_interval = max((int)config()->get('announce_interval'), 60);
|
||||
$expire_factor = max((float)config()->get('tracker.expire_factor'), 1);
|
||||
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
|
||||
|
||||
DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time");
|
||||
}
|
||||
|
||||
// Update dlstat (part 2)
|
||||
if ($bb_cfg['tracker']['update_dlstat']) {
|
||||
if (config()->get('tracker.update_dlstat')) {
|
||||
// Set "only 1 seeder" bonus
|
||||
DB()->query("
|
||||
UPDATE
|
||||
|
|
|
@ -11,12 +11,12 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
if (empty($bb_cfg['seeder_last_seen_days_keep']) || empty($bb_cfg['seeder_never_seen_days_keep'])) {
|
||||
if (empty(config()->get('seeder_last_seen_days_keep')) || empty(config()->get('seeder_never_seen_days_keep'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$last_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_last_seen_days_keep'];
|
||||
$never_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_never_seen_days_keep'];
|
||||
$last_seen_time = TIMENOW - 86400 * config()->get('seeder_last_seen_days_keep');
|
||||
$never_seen_time = TIMENOW - 86400 * config()->get('seeder_never_seen_days_keep');
|
||||
$limit_sql = 3000;
|
||||
|
||||
$topics_sql = $attach_sql = [];
|
||||
|
|
|
@ -11,8 +11,6 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
DB()->expect_slow_query(600);
|
||||
|
||||
//
|
||||
|
@ -81,7 +79,7 @@ DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_BB_BT
|
|||
|
||||
DB()->query("CREATE TABLE " . NEW_BB_BT_DLSTATUS_SNAP . " LIKE " . BB_BT_DLSTATUS_SNAP);
|
||||
|
||||
if ($bb_cfg['bt_show_dl_list'] && $bb_cfg['bt_dl_list_only_count']) {
|
||||
if (config()->get('bt_show_dl_list') && config()->get('bt_dl_list_only_count')) {
|
||||
DB()->query("
|
||||
INSERT INTO " . NEW_BB_BT_DLSTATUS_SNAP . "
|
||||
(topic_id, dl_status, users_count)
|
||||
|
@ -104,7 +102,7 @@ DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_BB_BT
|
|||
//
|
||||
// TORHELP
|
||||
//
|
||||
if ($bb_cfg['torhelp_enabled']) {
|
||||
if (config()->get('torhelp_enabled')) {
|
||||
$tor_min_seeders = 0; // "<="
|
||||
$tor_min_leechers = 2; // ">="
|
||||
$tor_min_completed = 10; // ">="
|
||||
|
@ -147,7 +145,7 @@ if ($bb_cfg['torhelp_enabled']) {
|
|||
WHERE
|
||||
trsn.seeders <= $tor_min_seeders
|
||||
AND trsn.leechers >= $tor_min_leechers
|
||||
AND tor.forum_id != " . (int)$bb_cfg['trash_forum_id'] . "
|
||||
AND tor.forum_id != " . (int)config()->get('trash_forum_id') . "
|
||||
AND tor.complete_count >= $tor_min_completed
|
||||
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
|
||||
AND dl.user_id IN($online_users_csv)
|
||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
DB()->expect_slow_query(600);
|
||||
|
||||
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release']) {
|
||||
if (config()->get('seed_bonus_enabled') && config()->get('seed_bonus_points') && config()->get('seed_bonus_release')) {
|
||||
DB()->query("
|
||||
CREATE TEMPORARY TABLE tmp_bonus (
|
||||
user_id INT UNSIGNED NOT NULL DEFAULT '0',
|
||||
|
@ -21,7 +21,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
|||
) ENGINE = MEMORY
|
||||
");
|
||||
|
||||
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
|
||||
$tor_size = (config()->get('seed_bonus_tor_size') * 1073741824);
|
||||
|
||||
DB()->query("INSERT INTO tmp_bonus
|
||||
SELECT bt.user_id, count(bt.seeder) AS release_count
|
||||
|
@ -32,24 +32,17 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
|
|||
GROUP BY bt.user_id
|
||||
");
|
||||
|
||||
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
||||
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
||||
|
||||
$sql = "SELECT last_run
|
||||
FROM " . BB_CRON . "
|
||||
WHERE cron_script = '" . basename(__FILE__) . "'
|
||||
LIMIT 1";
|
||||
$cron_runs = DB()->fetch_row($sql);
|
||||
$cron_job_last_run = (TIMENOW - strtotime($cron_runs['last_run']));
|
||||
$seed_bonus = unserialize(config()->get('seed_bonus_points'));
|
||||
$seed_release = unserialize(config()->get('seed_bonus_release'));
|
||||
|
||||
foreach ($seed_bonus as $i => $points) {
|
||||
if (!$points || !$seed_release[$i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_points = ($cron_job_last_run < 3600) ? round((float)$points * ($cron_job_last_run / 3600), 2) : 0;
|
||||
$user_points = ((float)$points / 4);
|
||||
$release = (int)$seed_release[$i];
|
||||
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
||||
$user_regdate = (TIMENOW - config()->get('seed_bonus_user_regdate') * 86400);
|
||||
|
||||
DB()->query("
|
||||
UPDATE " . BB_USERS . " u, " . BB_BT_USERS . " bu, tmp_bonus b
|
||||
|
|
|
@ -11,13 +11,11 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
$timecheck = TIMENOW - 600;
|
||||
$forums_data = DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM " . BB_FORUMS);
|
||||
|
||||
if (is_file($bb_cfg['atom']['path'] . '/f/0.atom')) {
|
||||
if (filemtime($bb_cfg['atom']['path'] . '/f/0.atom') <= $timecheck) {
|
||||
if (is_file(config()->get('atom.path') . '/f/0.atom')) {
|
||||
if (filemtime(config()->get('atom.path') . '/f/0.atom') <= $timecheck) {
|
||||
\TorrentPier\Legacy\Atom::update_forum_feed(0, $forums_data);
|
||||
}
|
||||
} else {
|
||||
|
@ -25,8 +23,8 @@ if (is_file($bb_cfg['atom']['path'] . '/f/0.atom')) {
|
|||
}
|
||||
|
||||
foreach ($forums_data as $forum_data) {
|
||||
if (is_file($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom')) {
|
||||
if (filemtime($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
|
||||
if (is_file(config()->get('atom.path') . '/f/' . $forum_data['forum_id'] . '.atom')) {
|
||||
if (filemtime(config()->get('atom.path') . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
|
||||
\TorrentPier\Legacy\Atom::update_forum_feed($forum_data['forum_id'], $forum_data);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bf, $bb_cfg;
|
||||
global $bf;
|
||||
|
||||
//
|
||||
// cat_forums
|
||||
|
@ -106,7 +106,7 @@ $this->store('cat_forums', $data);
|
|||
//
|
||||
// jumpbox
|
||||
//
|
||||
if ($bb_cfg['show_jumpbox']) {
|
||||
if (config()->get('show_jumpbox')) {
|
||||
$data = [
|
||||
'guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'' . FORUM_URL . '\'+this.value;"'),
|
||||
'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'' . FORUM_URL . '\'+this.value;"'),
|
||||
|
@ -125,8 +125,8 @@ $this->store('viewtopic_forum_select', $data);
|
|||
//
|
||||
// latest_news
|
||||
//
|
||||
if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum_id']) {
|
||||
$news_count = max($bb_cfg['latest_news_count'], 1);
|
||||
if (config()->get('show_latest_news') and $news_forum_ids = config()->get('latest_news_forum_id')) {
|
||||
$news_count = max(config()->get('latest_news_count'), 1);
|
||||
|
||||
$data = DB()->fetch_rowset("
|
||||
SELECT topic_id, topic_time, topic_title, forum_id
|
||||
|
@ -143,8 +143,8 @@ if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum
|
|||
//
|
||||
// Network_news
|
||||
//
|
||||
if ($bb_cfg['show_network_news'] and $net_forum_ids = $bb_cfg['network_news_forum_id']) {
|
||||
$net_count = max($bb_cfg['network_news_count'], 1);
|
||||
if (config()->get('show_network_news') and $net_forum_ids = config()->get('network_news_forum_id')) {
|
||||
$net_count = max(config()->get('network_news_count'), 1);
|
||||
|
||||
$data = DB()->fetch_rowset("
|
||||
SELECT topic_id, topic_time, topic_title, forum_id
|
||||
|
|
|
@ -11,23 +11,29 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['tp_updater_settings']['enabled']) {
|
||||
if (!config()->get('tp_updater_settings.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data[] = ['latest_check_timestamp' => TIMENOW];
|
||||
|
||||
$updaterDownloader = new \TorrentPier\Updater();
|
||||
$updaterDownloader = $updaterDownloader->getLastVersion($bb_cfg['tp_updater_settings']['allow_pre_releases']);
|
||||
try {
|
||||
$updaterDownloader = new \TorrentPier\Updater();
|
||||
$updaterDownloader = $updaterDownloader->getLastVersion(config()->get('tp_updater_settings.allow_pre_releases'));
|
||||
} catch (Exception $exception) {
|
||||
bb_log('[Updater] Exception: ' . $exception->getMessage() . LOG_LF);
|
||||
$this->store('check_updates', $data);
|
||||
return;
|
||||
}
|
||||
|
||||
$getVersion = \TorrentPier\Helpers\VersionHelper::removerPrefix($updaterDownloader['tag_name']);
|
||||
$currentVersion = \TorrentPier\Helpers\VersionHelper::removerPrefix($bb_cfg['tp_version']);
|
||||
$currentVersion = \TorrentPier\Helpers\VersionHelper::removerPrefix(config()->get('tp_version'));
|
||||
|
||||
// Has update!
|
||||
if (\z4kn4fein\SemVer\Version::greaterThan($getVersion, $currentVersion)) {
|
||||
$latestBuildFileLink = $updaterDownloader['assets'][0]['browser_download_url'];
|
||||
$SHAFileHash = $updaterDownloader['assets'][0]['digest'] ?? '';
|
||||
|
||||
// Check updater file
|
||||
$updaterFile = readUpdaterFile();
|
||||
|
@ -41,10 +47,12 @@ if (\z4kn4fein\SemVer\Version::greaterThan($getVersion, $currentVersion)) {
|
|||
]), UPDATER_FILE, replace_content: true);
|
||||
}
|
||||
|
||||
// Get MD5 checksum
|
||||
// Get MD5 / sha256 checksum
|
||||
$buildFileChecksum = '';
|
||||
if (isset($latestBuildFileLink)) {
|
||||
$buildFileChecksum = strtoupper(md5_file($latestBuildFileLink));
|
||||
if (!empty($SHAFileHash)) {
|
||||
$buildFileChecksum = $SHAFileHash;
|
||||
} else {
|
||||
$buildFileChecksum = 'MD5: ' . strtoupper(md5_file($latestBuildFileLink));
|
||||
}
|
||||
|
||||
// Build data array
|
||||
|
@ -58,5 +66,4 @@ if (\z4kn4fein\SemVer\Version::greaterThan($getVersion, $currentVersion)) {
|
|||
];
|
||||
}
|
||||
|
||||
$data[] = ['latest_check_timestamp' => TIMENOW];
|
||||
$this->store('check_updates', $data);
|
||||
|
|
|
@ -11,8 +11,6 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
$smilies = [];
|
||||
|
||||
$rowset = DB()->fetch_rowset("SELECT * FROM " . BB_SMILIES);
|
||||
|
@ -20,7 +18,7 @@ sort($rowset);
|
|||
|
||||
foreach ($rowset as $smile) {
|
||||
$smilies['orig'][] = '#(?<=^|\W)' . preg_quote($smile['code'], '#') . '(?=$|\W)#';
|
||||
$smilies['repl'][] = ' <img class="smile" src="' . $bb_cfg['smilies_path'] . '/' . $smile['smile_url'] . '" alt="' . $smile['code'] . '" title="' . $smile['emoticon'] . '" align="absmiddle" border="0" />';
|
||||
$smilies['repl'][] = ' <img class="smile" src="' . config()->get('smilies_path') . '/' . $smile['smile_url'] . '" alt="' . $smile['code'] . '" title="' . $smile['emoticon'] . '" align="absmiddle" border="0" />';
|
||||
$smilies['smile'][] = $smile;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
$data = [];
|
||||
|
||||
// usercount
|
||||
|
@ -29,7 +27,7 @@ $data['postcount'] = commify($row['postcount']);
|
|||
$data['topiccount'] = commify($row['topiccount']);
|
||||
|
||||
// Tracker stats
|
||||
if ($bb_cfg['tor_stats']) {
|
||||
if (config()->get('tor_stats')) {
|
||||
// torrents stat
|
||||
$row = DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM " . BB_BT_TORRENTS);
|
||||
$data['torrentcount'] = commify($row['torrentcount']);
|
||||
|
@ -44,7 +42,7 @@ if ($bb_cfg['tor_stats']) {
|
|||
}
|
||||
|
||||
// gender stat
|
||||
if ($bb_cfg['gender']) {
|
||||
if (config()->get('gender')) {
|
||||
$male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM " . BB_USERS . " WHERE user_gender = " . MALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
|
||||
$female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM " . BB_USERS . " WHERE user_gender = " . FEMALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
|
||||
$unselect = DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM " . BB_USERS . " WHERE user_gender = 0 AND user_id NOT IN(" . EXCLUDED_USERS . ")");
|
||||
|
@ -55,7 +53,7 @@ if ($bb_cfg['gender']) {
|
|||
}
|
||||
|
||||
// birthday stat
|
||||
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
||||
if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
|
||||
$sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
|
||||
FROM " . BB_USERS . "
|
||||
WHERE user_id NOT IN(" . EXCLUDED_USERS . ")
|
||||
|
@ -66,7 +64,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
|||
");
|
||||
|
||||
$date_today = bb_date(TIMENOW, 'md', false);
|
||||
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday_check_day'] * 86400), 'md', false);
|
||||
$date_forward = bb_date(TIMENOW + (config()->get('birthday_check_day') * 86400), 'md', false);
|
||||
|
||||
$birthday_today_list = $birthday_week_list = [];
|
||||
|
||||
|
|
|
@ -13,22 +13,19 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
|
||||
{
|
||||
global $bb_cfg;
|
||||
$ext = $bb_cfg['file_id_ext'][$ext_id] ?? '';
|
||||
$ext = config()->get('file_id_ext')[$ext_id] ?? '';
|
||||
return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : '');
|
||||
}
|
||||
|
||||
function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
global $bb_cfg;
|
||||
$base_path ??= $bb_cfg['avatars']['upload_path'];
|
||||
$base_path ??= config()->get('avatars.upload_path');
|
||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||
}
|
||||
|
||||
function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
global $bb_cfg;
|
||||
$base_path ??= $bb_cfg['attach']['upload_path'];
|
||||
$base_path ??= config()->get('attach.upload_path');
|
||||
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
|
||||
}
|
||||
|
||||
|
@ -197,6 +194,9 @@ $bf['user_opt'] = [
|
|||
'dis_post_edit' => 13, // [PROHIBITIONS] Block editing own posts / topics
|
||||
'user_dls' => 14, // [SETTINGS] Hide list of "Current downloads" in my profile
|
||||
'user_retracker' => 15, // [SETTINGS] Add my retracker into downloaded torrent files
|
||||
'user_hide_torrent_client' => 16, // [SETTINGS] Option to hide user's torrent client in peer list
|
||||
'user_hide_peer_country' => 17, // [SETTINGS] Option to hide user's country name in peer list
|
||||
'user_hide_peer_username' => 18, // [SETTINGS] Option to hide peer username in peer list
|
||||
];
|
||||
|
||||
function bit2dec($bit_num)
|
||||
|
@ -597,26 +597,31 @@ function humn_size($size, $rounder = null, $min = null, $space = ' ')
|
|||
|
||||
function bt_show_ip($ip, $port = '')
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if (IS_AM) {
|
||||
$ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($ip);
|
||||
$ip .= ($port) ? ":$port" : '';
|
||||
|
||||
if (!empty($port)) {
|
||||
if (\TorrentPier\Helpers\IPHelper::isValidv6($ip)) {
|
||||
// Wrap IPv6 address in square brackets
|
||||
$ip = "[$ip]:$port";
|
||||
} else {
|
||||
$ip = "$ip:$port";
|
||||
}
|
||||
}
|
||||
|
||||
return $ip;
|
||||
}
|
||||
|
||||
return $bb_cfg['bt_show_ip_only_moder'] ? false : \TorrentPier\Helpers\IPHelper::anonymizeIP($ip);
|
||||
return config()->get('bt_show_ip_only_moder') ? false : \TorrentPier\Helpers\IPHelper::anonymizeIP($ip);
|
||||
}
|
||||
|
||||
function bt_show_port($port)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if (IS_AM) {
|
||||
return $port;
|
||||
}
|
||||
|
||||
return $bb_cfg['bt_show_port_only_moder'] ? false : $port;
|
||||
return config()->get('bt_show_port_only_moder') ? false : $port;
|
||||
}
|
||||
|
||||
function checkbox_get_val(&$key, &$val, $default = 1, $on = 1, $off = 0)
|
||||
|
@ -790,24 +795,24 @@ function str_short($text, $max_length, $space = ' ')
|
|||
|
||||
function generate_user_info($row, bool $have_auth = IS_ADMIN): array
|
||||
{
|
||||
global $userdata, $lang, $images, $bb_cfg;
|
||||
global $userdata, $lang, $images;
|
||||
|
||||
$from = !empty($row['user_from']) ? render_flag($row['user_from'], false) : $lang['NOSELECT'];
|
||||
$joined = bb_date($row['user_regdate'], 'Y-m-d H:i', false);
|
||||
$user_time = !empty($row['user_time']) ? sprintf('%s <span class="signature">(%s)</span>', bb_date($row['user_time']), delta_time($row['user_time'])) : $lang['NOSELECT'];
|
||||
$posts = '<a href="search.php?search_author=1&uid=' . $row['user_id'] . '" target="_blank">' . $row['user_posts'] ?: 0 . '</a>';
|
||||
$pm = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . (PM_URL . "?mode=post&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&" . POST_USERS_URL . "=" . $row['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
||||
$pm = config()->get('text_buttons') ? '<a class="txtb" href="' . (PM_URL . "?mode=post&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&" . POST_USERS_URL . "=" . $row['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
|
||||
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), 50, 50);
|
||||
|
||||
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $have_auth || ($row['user_id'] == $userdata['user_id'])) {
|
||||
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
|
||||
$email_uri = (config()->get('board_email_form')) ? ("profile.php?mode=email&" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
|
||||
$email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
|
||||
} else {
|
||||
$email = $lang['HIDDEN_USER'];
|
||||
}
|
||||
|
||||
if ($row['user_website']) {
|
||||
$www = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
||||
$www = config()->get('text_buttons') ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
|
||||
} else {
|
||||
$www = $lang['NOSELECT'];
|
||||
}
|
||||
|
@ -876,8 +881,8 @@ function show_bt_userdata($user_id): void
|
|||
'YS_BONUS' => humn_size($btu['up_bonus_yesterday']),
|
||||
'YS_POINTS' => $btu['auth_key'] ? $btu['points_yesterday'] : '0.00',
|
||||
|
||||
'SPEED_UP' => humn_size($btu['speed_up'], 0, 'KB') . '/s',
|
||||
'SPEED_DOWN' => humn_size($btu['speed_down'], 0, 'KB') . '/s',
|
||||
'SPEED_UP' => humn_size($btu['speed_up'], min: 'KB') . '/s',
|
||||
'SPEED_DOWN' => humn_size($btu['speed_down'], min: 'KB') . '/s',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -898,13 +903,16 @@ function bb_get_config($table, $from_db = false, $update_cache = true)
|
|||
{
|
||||
if ($from_db or !$cfg = CACHE('bb_config')->get("config_{$table}")) {
|
||||
$cfg = [];
|
||||
|
||||
foreach (DB()->fetch_rowset("SELECT * FROM $table") as $row) {
|
||||
$cfg[$row['config_name']] = $row['config_value'];
|
||||
}
|
||||
|
||||
if ($update_cache) {
|
||||
CACHE('bb_config')->set("config_{$table}", $cfg);
|
||||
}
|
||||
}
|
||||
|
||||
return $cfg;
|
||||
}
|
||||
|
||||
|
@ -981,9 +989,9 @@ function get_userdata(int|string $u, bool $is_name = false, bool $allow_guest =
|
|||
|
||||
function make_jumpbox(): void
|
||||
{
|
||||
global $datastore, $template, $bb_cfg;
|
||||
global $datastore, $template;
|
||||
|
||||
if (!$bb_cfg['show_jumpbox']) {
|
||||
if (!config()->get('show_jumpbox')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1061,14 +1069,14 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
|
|||
|
||||
function setup_style()
|
||||
{
|
||||
global $bb_cfg, $template, $userdata;
|
||||
global $template, $userdata;
|
||||
|
||||
// AdminCP works only with default template
|
||||
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
|
||||
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
|
||||
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename(config()->get('tpl_name'));
|
||||
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename(config()->get('stylesheet'));
|
||||
|
||||
if (!IS_GUEST && !empty($userdata['tpl_name'])) {
|
||||
foreach ($bb_cfg['templates'] as $folder => $name) {
|
||||
foreach (config()->get('templates') as $folder => $name) {
|
||||
if ($userdata['tpl_name'] == $folder) {
|
||||
$tpl_dir_name = basename($userdata['tpl_name']);
|
||||
}
|
||||
|
@ -1081,7 +1089,7 @@ function setup_style()
|
|||
$template->assign_vars([
|
||||
'SPACER' => make_url('styles/images/spacer.gif'),
|
||||
'STYLESHEET' => make_url($css_dir . $stylesheet),
|
||||
'EXT_LINK_NEW_WIN' => $bb_cfg['ext_link_new_win'],
|
||||
'EXT_LINK_NEW_WIN' => config()->get('ext_link_new_win'),
|
||||
'TPL_DIR' => make_url($css_dir),
|
||||
'SITE_URL' => make_url('/')
|
||||
]);
|
||||
|
@ -1094,19 +1102,19 @@ function setup_style()
|
|||
// Create date / time with format and friendly date
|
||||
function bb_date($gmepoch, $format = false, $friendly_date = true)
|
||||
{
|
||||
global $bb_cfg, $lang, $userdata;
|
||||
global $lang, $userdata;
|
||||
|
||||
$gmepoch = (int)$gmepoch;
|
||||
|
||||
if (!$format) {
|
||||
$format = $bb_cfg['default_dateformat'];
|
||||
$format = config()->get('default_dateformat');
|
||||
}
|
||||
if (empty($lang)) {
|
||||
require_once($bb_cfg['default_lang_dir'] . 'main.php');
|
||||
lang()->initializeLanguage();
|
||||
}
|
||||
|
||||
if (!defined('IS_GUEST') || IS_GUEST) {
|
||||
$tz = $bb_cfg['board_timezone'];
|
||||
$tz = config()->get('board_timezone');
|
||||
} else {
|
||||
$tz = $userdata['user_timezone'];
|
||||
}
|
||||
|
@ -1141,7 +1149,7 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
|
|||
}
|
||||
}
|
||||
|
||||
return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
||||
return (config()->get('translate_dates')) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1152,12 +1160,11 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
|
|||
*/
|
||||
function get_user_torrent_client(string $peer_id): string
|
||||
{
|
||||
global $bb_cfg;
|
||||
static $iconExtension = '.png';
|
||||
|
||||
$bestMatch = null;
|
||||
$bestMatchLength = 0;
|
||||
foreach ($bb_cfg['tor_clients'] as $key => $clientName) {
|
||||
foreach (config()->get('tor_clients') as $key => $clientName) {
|
||||
if (str_starts_with($peer_id, $key) !== false && strlen($key) > $bestMatchLength) {
|
||||
$bestMatch = $clientName;
|
||||
$bestMatchLength = strlen($key);
|
||||
|
@ -1184,14 +1191,21 @@ function render_flag(string $code, bool $showName = true): string
|
|||
global $lang;
|
||||
static $iconExtension = '.svg';
|
||||
|
||||
$nameIgnoreList = [
|
||||
'WBW',
|
||||
'PACE',
|
||||
'LGBT'
|
||||
];
|
||||
|
||||
if (isset($lang['COUNTRIES'][$code])) {
|
||||
if ($code === '0') {
|
||||
return ''; // No selected
|
||||
} else {
|
||||
$flagIconPath = BB_ROOT . 'styles/images/flags/' . $code . $iconExtension;
|
||||
if (is_file($flagIconPath)) {
|
||||
$countryName = $showName ? ' ' . str_short($lang['COUNTRIES'][$code], 20) : '';
|
||||
return '<span title="' . $lang['COUNTRIES'][$code] . '"><img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '">' . $countryName . '</span>';
|
||||
$langName = $lang['COUNTRIES'][$code];
|
||||
$countryName = ($showName && !in_array($code, $nameIgnoreList)) ? ' ' . str_short($langName, 20) : '';
|
||||
return '<span title="' . $langName . '"><img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '">' . $countryName . '</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1201,12 +1215,11 @@ function render_flag(string $code, bool $showName = true): string
|
|||
|
||||
function birthday_age($date)
|
||||
{
|
||||
global $bb_cfg;
|
||||
if (!$date) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
||||
$tz = TIMENOW + (3600 * config()->get('board_timezone'));
|
||||
return delta_time(strtotime($date, $tz));
|
||||
}
|
||||
|
||||
|
@ -1224,11 +1237,16 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
|||
$total_pages = ceil($num_items / $per_page);
|
||||
$on_page = floor($start_item / $per_page) + 1;
|
||||
|
||||
$query_separator = '&';
|
||||
if (!str_contains($base_url, '?')) {
|
||||
$query_separator = '?';
|
||||
}
|
||||
|
||||
$page_string = '';
|
||||
if ($total_pages > ((2 * ($begin_end + $from_middle)) + 2)) {
|
||||
$init_page_max = ($total_pages > $begin_end) ? $begin_end : $total_pages;
|
||||
for ($i = 1; $i < $init_page_max + 1; $i++) {
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "{$query_separator}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
if ($i < $init_page_max) {
|
||||
$page_string .= ", ";
|
||||
}
|
||||
|
@ -1242,7 +1260,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
|||
$init_page_max = ($on_page < $total_pages - ($begin_end + $from_middle)) ? $on_page : $total_pages - ($begin_end + $from_middle);
|
||||
|
||||
for ($i = $init_page_min - $from_middle; $i < $init_page_max + ($from_middle + 1); $i++) {
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "{$query_separator}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
if ($i < $init_page_max + $from_middle) {
|
||||
$page_string .= ', ';
|
||||
}
|
||||
|
@ -1252,7 +1270,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
|||
$page_string .= ' ... ';
|
||||
}
|
||||
for ($i = $total_pages - ($begin_end - 1); $i < $total_pages + 1; $i++) {
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "{$query_separator}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
if ($i < $total_pages) {
|
||||
$page_string .= ", ";
|
||||
}
|
||||
|
@ -1260,7 +1278,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
|||
}
|
||||
} else {
|
||||
for ($i = 1; $i < $total_pages + 1; $i++) {
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "&start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . $base_url . "{$query_separator}start=" . (($i - 1) * $per_page) . '">' . $i . '</a>';
|
||||
if ($i < $total_pages) {
|
||||
$page_string .= ', ';
|
||||
}
|
||||
|
@ -1269,20 +1287,20 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
|||
|
||||
if ($add_prevnext_text) {
|
||||
if ($on_page > 1) {
|
||||
$page_string = ' <a href="' . $base_url . "&start=" . (($on_page - 2) * $per_page) . '">' . $lang['PREVIOUS_PAGE'] . '</a> ' . $page_string;
|
||||
$meta_prev_link = FULL_URL . $base_url . "&start=" . (($on_page - 2) * $per_page);
|
||||
$page_string = ' <a href="' . $base_url . "{$query_separator}start=" . (($on_page - 2) * $per_page) . '">' . $lang['PREVIOUS_PAGE'] . '</a> ' . $page_string;
|
||||
$meta_prev_link = FULL_URL . $base_url . "{$query_separator}start=" . (($on_page - 2) * $per_page);
|
||||
}
|
||||
|
||||
if ($on_page < $total_pages) {
|
||||
$page_string .= ' <a href="' . $base_url . "&start=" . ($on_page * $per_page) . '">' . $lang['NEXT_PAGE'] . '</a>';
|
||||
$meta_next_link = FULL_URL . $base_url . "&start=" . ($on_page * $per_page);
|
||||
$page_string .= ' <a href="' . $base_url . "{$query_separator}start=" . ($on_page * $per_page) . '">' . $lang['NEXT_PAGE'] . '</a>';
|
||||
$meta_next_link = FULL_URL . $base_url . "{$query_separator}start=" . ($on_page * $per_page);
|
||||
}
|
||||
}
|
||||
|
||||
$pagination = false;
|
||||
if ($page_string && $total_pages > 1) {
|
||||
$pagination = '<a class="menu-root" href="#pg-jump">' . $lang['GOTO_PAGE'] . '</a> : ' . $page_string;
|
||||
$pagination = str_replace('&start=0', '', $pagination);
|
||||
$pagination = str_replace("{$query_separator}start=0", '', $pagination);
|
||||
}
|
||||
|
||||
$template->assign_vars([
|
||||
|
@ -1312,7 +1330,7 @@ function bb_preg_quote($str, $delimiter)
|
|||
|
||||
function bb_die($msg_text, $status_code = null)
|
||||
{
|
||||
global $ajax, $bb_cfg, $lang, $template, $theme, $userdata, $user;
|
||||
global $ajax, $lang, $template, $theme, $userdata, $user;
|
||||
|
||||
if (isset($status_code)) {
|
||||
http_response_code($status_code);
|
||||
|
@ -1329,9 +1347,9 @@ function bb_die($msg_text, $status_code = null)
|
|||
define('HAS_DIED', 1);
|
||||
define('DISABLE_CACHING_OUTPUT', true);
|
||||
|
||||
// If empty lang
|
||||
// If empty lang, initialize language singleton
|
||||
if (empty($lang)) {
|
||||
require($bb_cfg['default_lang_dir'] . 'main.php');
|
||||
lang()->initializeLanguage();
|
||||
}
|
||||
|
||||
// If empty session
|
||||
|
@ -1342,7 +1360,7 @@ function bb_die($msg_text, $status_code = null)
|
|||
// If the header hasn't been output then do it
|
||||
if (!defined('PAGE_HEADER_SENT')) {
|
||||
if (empty($template)) {
|
||||
$template = new TorrentPier\Legacy\Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
|
||||
$template = new TorrentPier\Legacy\Template(BB_ROOT . "templates/" . config()->get('tpl_name'));
|
||||
}
|
||||
if (empty($theme)) {
|
||||
$theme = setup_style();
|
||||
|
@ -1370,8 +1388,6 @@ function bb_die($msg_text, $status_code = null)
|
|||
|
||||
function bb_simple_die($txt, $status_code = null)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
header('Content-Type: text/plain; charset=' . DEFAULT_CHARSET);
|
||||
|
||||
if (isset($status_code)) {
|
||||
|
@ -1399,8 +1415,6 @@ function meta_refresh($url, $time = 5)
|
|||
|
||||
function redirect($url)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if (headers_sent($filename, $linenum)) {
|
||||
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
|
||||
}
|
||||
|
@ -1410,11 +1424,11 @@ function redirect($url)
|
|||
}
|
||||
|
||||
$url = trim($url);
|
||||
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
|
||||
$server_protocol = (config()->get('cookie_secure')) ? 'https://' : 'http://';
|
||||
|
||||
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name']));
|
||||
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : '';
|
||||
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['script_path']));
|
||||
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config()->get('server_name')));
|
||||
$server_port = (config()->get('server_port') <> 80) ? ':' . trim(config()->get('server_port')) : '';
|
||||
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config()->get('script_path')));
|
||||
|
||||
if ($script_name) {
|
||||
$script_name = "/$script_name";
|
||||
|
@ -1423,6 +1437,9 @@ function redirect($url)
|
|||
|
||||
$redirect_url = $server_protocol . $server_name . $server_port . $script_name . preg_replace('#^\/?(.*?)\/?$#', '/\1', $url);
|
||||
|
||||
// Send no-cache headers to prevent browsers from caching redirects
|
||||
send_no_cache_headers();
|
||||
|
||||
// Behave as per HTTP/1.1 spec for others
|
||||
header('Location: ' . $redirect_url, response_code: 301);
|
||||
exit;
|
||||
|
@ -1522,9 +1539,9 @@ function cat_exists($cat_id): bool
|
|||
|
||||
function get_topic_icon($topic, $is_unread = null)
|
||||
{
|
||||
global $bb_cfg, $images;
|
||||
global $images;
|
||||
|
||||
$t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']);
|
||||
$t_hot = ($topic['topic_replies'] >= config()->get('hot_threshold'));
|
||||
$is_unread ??= is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']);
|
||||
|
||||
if ($topic['topic_status'] == TOPIC_MOVED) {
|
||||
|
@ -1577,7 +1594,7 @@ function build_topic_pagination($url, $replies, $per_page)
|
|||
return $pg;
|
||||
}
|
||||
|
||||
function print_confirmation($tpl_vars)
|
||||
function print_confirmation($tpl_vars): void
|
||||
{
|
||||
global $template, $lang;
|
||||
|
||||
|
@ -1657,7 +1674,7 @@ function clean_title($str, $replace_underscore = false)
|
|||
|
||||
function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
|
||||
{
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
$text = str_compact($text);
|
||||
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
|
||||
|
@ -1665,7 +1682,7 @@ function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
|
|||
|
||||
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
|
||||
|
||||
if ($bb_cfg['search_engine_type'] == 'sphinx') {
|
||||
if (config()->get('search_engine_type') == 'sphinx') {
|
||||
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
|
||||
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // valid characters (except '"' which are separate)
|
||||
$text = str_replace(['-', '*'], [' -', '* '], $text); // only at the beginning/end of a word
|
||||
|
@ -1715,7 +1732,7 @@ function log_sphinx_error($err_type, $err_msg, $query = '')
|
|||
|
||||
function get_title_match_topics($title_match_sql, array $forum_ids = [])
|
||||
{
|
||||
global $bb_cfg, $sphinx, $userdata, $title_match, $lang;
|
||||
global $sphinx, $userdata, $title_match, $lang;
|
||||
|
||||
$where_ids = [];
|
||||
if ($forum_ids) {
|
||||
|
@ -1723,12 +1740,12 @@ function get_title_match_topics($title_match_sql, array $forum_ids = [])
|
|||
}
|
||||
$title_match_sql = encode_text_match($title_match_sql);
|
||||
|
||||
if ($bb_cfg['search_engine_type'] == 'sphinx') {
|
||||
if (config()->get('search_engine_type') == 'sphinx') {
|
||||
$sphinx = init_sphinx();
|
||||
|
||||
$where = $title_match ? 'topics' : 'posts';
|
||||
|
||||
$sphinx->setServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
|
||||
$sphinx->setServer(config()->get('sphinx_topic_titles_host'), config()->get('sphinx_topic_titles_port'));
|
||||
if ($forum_ids) {
|
||||
$sphinx->setFilter('forum_id', $forum_ids, false);
|
||||
}
|
||||
|
@ -1748,9 +1765,9 @@ function get_title_match_topics($title_match_sql, array $forum_ids = [])
|
|||
if ($warning = $sphinx->getLastWarning()) {
|
||||
log_sphinx_error('wrn', $warning, $title_match_sql);
|
||||
}
|
||||
} elseif ($bb_cfg['search_engine_type'] == 'mysql') {
|
||||
} elseif (config()->get('search_engine_type') == 'mysql') {
|
||||
$where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : '';
|
||||
$search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : '';
|
||||
$search_bool_mode = (config()->get('allow_search_in_bool_mode')) ? ' IN BOOLEAN MODE' : '';
|
||||
|
||||
if ($title_match) {
|
||||
$where_id = 'topic_id';
|
||||
|
@ -1796,23 +1813,23 @@ function decode_text_match($txt)
|
|||
/**
|
||||
* Create magnet link
|
||||
*
|
||||
* @param string $infohash
|
||||
* @param string $infohash_v2
|
||||
* @param string $auth_key
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $infohash (xt=urn:btih)
|
||||
* @param string $infohash_v2 (xt=urn:btmh:1220)
|
||||
* @param string $auth_key (tr)
|
||||
* @param string $name (dn)
|
||||
* @param int|string $length (xl)
|
||||
* @return string
|
||||
*/
|
||||
function create_magnet(string $infohash, string $infohash_v2, string $auth_key, string $name): string
|
||||
function create_magnet(string $infohash, string $infohash_v2, string $auth_key, string $name, int|string $length = 0): string
|
||||
{
|
||||
global $bb_cfg, $images, $lang;
|
||||
global $images, $lang;
|
||||
|
||||
if (!$bb_cfg['magnet_links_enabled']) {
|
||||
if (!config()->get('magnet_links_enabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only for registered users
|
||||
if (!$bb_cfg['magnet_links_for_guests'] && IS_GUEST) {
|
||||
if (!config()->get('magnet_links_for_guests') && IS_GUEST) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1832,7 +1849,12 @@ function create_magnet(string $infohash, string $infohash_v2, string $auth_key,
|
|||
$magnet .= 'xt=urn:btmh:1220' . bin2hex($infohash_v2);
|
||||
}
|
||||
|
||||
return '<a title="' . ($v2_support ? $lang['MAGNET_v2'] : $lang['MAGNET']) . '" href="' . $magnet . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . ($v2_support ? $images['icon_magnet_v2'] : $images['icon_magnet']) . '" width="12" height="12" border="0" /></a>';
|
||||
$length = (int)$length;
|
||||
if ($length > 0) {
|
||||
$magnet .= '&xl=' . $length;
|
||||
}
|
||||
|
||||
return '<a title="' . ($v2_support ? $lang['MAGNET_v2'] : $lang['MAGNET']) . '" href="' . $magnet . '&tr=' . urlencode(config()->get('bt_announce_url') . "?" . config()->get('passkey_key') . "=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . ($v2_support ? $images['icon_magnet_v2'] : $images['icon_magnet']) . '" width="12" height="12" border="0" /></a>';
|
||||
}
|
||||
|
||||
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)
|
||||
|
@ -1868,7 +1890,7 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID)
|
|||
$message = DB()->escape($message);
|
||||
|
||||
if ($poster_id == BOT_UID) {
|
||||
$poster_ip = '7f000001';
|
||||
$poster_ip = '0';
|
||||
} elseif ($row = DB()->fetch_row("SELECT user_reg_ip FROM " . BB_USERS . " WHERE user_id = $poster_id")) {
|
||||
$poster_ip = $row['user_reg_ip'];
|
||||
} else {
|
||||
|
@ -1893,7 +1915,7 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID)
|
|||
*/
|
||||
function profile_url(array $data, bool $target_blank = false, bool $no_link = false): string
|
||||
{
|
||||
global $bb_cfg, $lang, $datastore;
|
||||
global $lang, $datastore;
|
||||
|
||||
if (!$ranks = $datastore->get('ranks')) {
|
||||
$datastore->update('ranks');
|
||||
|
@ -1908,7 +1930,7 @@ function profile_url(array $data, bool $target_blank = false, bool $no_link = fa
|
|||
$style = 'colorUser';
|
||||
if (isset($ranks[$user_rank])) {
|
||||
$title = $ranks[$user_rank]['rank_title'];
|
||||
if ($bb_cfg['color_nick']) {
|
||||
if (config()->get('color_nick')) {
|
||||
$style = $ranks[$user_rank]['rank_style'];
|
||||
}
|
||||
}
|
||||
|
@ -1936,18 +1958,16 @@ function profile_url(array $data, bool $target_blank = false, bool $no_link = fa
|
|||
|
||||
function get_avatar($user_id, $ext_id, $allow_avatar = true, $height = '', $width = '')
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$height = $height ? 'height="' . $height . '"' : '';
|
||||
$width = $width ? 'width="' . $width . '"' : '';
|
||||
|
||||
$user_avatar = '<img src="' . make_url($bb_cfg['avatars']['display_path'] . $bb_cfg['avatars']['no_avatar']) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
$user_avatar = '<img src="' . make_url(config()->get('avatars.display_path') . config()->get('avatars.no_avatar')) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
|
||||
if ($user_id == BOT_UID && $bb_cfg['avatars']['bot_avatar']) {
|
||||
$user_avatar = '<img src="' . make_url($bb_cfg['avatars']['display_path'] . $bb_cfg['avatars']['bot_avatar']) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
if ($user_id == BOT_UID && config()->get('avatars.bot_avatar')) {
|
||||
$user_avatar = '<img src="' . make_url(config()->get('avatars.display_path') . config()->get('avatars.bot_avatar')) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
} elseif ($allow_avatar && $ext_id) {
|
||||
if (is_file(get_avatar_path($user_id, $ext_id))) {
|
||||
$user_avatar = '<img src="' . make_url(get_avatar_path($user_id, $ext_id, $bb_cfg['avatars']['display_path'])) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
$user_avatar = '<img src="' . make_url(get_avatar_path($user_id, $ext_id, config()->get('avatars.display_path'))) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1962,9 +1982,9 @@ function get_avatar($user_id, $ext_id, $allow_avatar = true, $height = '', $widt
|
|||
*/
|
||||
function genderImage(int $gender): ?string
|
||||
{
|
||||
global $bb_cfg, $lang, $images;
|
||||
global $lang, $images;
|
||||
|
||||
if (!$bb_cfg['gender']) {
|
||||
if (!config()->get('gender')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1977,12 +1997,12 @@ function genderImage(int $gender): ?string
|
|||
|
||||
function is_gold($type): string
|
||||
{
|
||||
global $lang, $bb_cfg, $images;
|
||||
global $lang, $images;
|
||||
|
||||
$type = (int)$type;
|
||||
$is_gold = '';
|
||||
|
||||
if (!$bb_cfg['tracker']['gold_silver_enabled']) {
|
||||
if (!config()->get('tracker.gold_silver_enabled')) {
|
||||
return $is_gold;
|
||||
}
|
||||
|
||||
|
@ -2051,10 +2071,10 @@ function hash_search($hash)
|
|||
*/
|
||||
function bb_captcha(string $mode): bool|string
|
||||
{
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
$settings = $bb_cfg['captcha'];
|
||||
$settings['language'] = $bb_cfg['default_lang'];
|
||||
$settings = config()->get('captcha');
|
||||
$settings['language'] = config()->get('default_lang');
|
||||
|
||||
// Checking captcha settings
|
||||
if (!$settings['disabled'] && $settings['service'] !== 'text') {
|
||||
|
@ -2106,13 +2126,13 @@ function clean_tor_dirname($dirname)
|
|||
*/
|
||||
function user_birthday_icon($user_birthday, $user_id): string
|
||||
{
|
||||
global $bb_cfg, $images, $lang;
|
||||
global $images, $lang;
|
||||
|
||||
$current_date = bb_date(TIMENOW, 'md', false);
|
||||
$user_birthday = ($user_id != GUEST_UID && !empty($user_birthday) && $user_birthday != '1900-01-01')
|
||||
? bb_date(strtotime($user_birthday), 'md', false) : false;
|
||||
|
||||
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="' . $lang['HAPPY_BIRTHDAY'] . '" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
|
||||
return (config()->get('birthday_enabled') && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="' . $lang['HAPPY_BIRTHDAY'] . '" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2126,10 +2146,7 @@ function getBanInfo(?int $userId = null): ?array
|
|||
global $datastore;
|
||||
|
||||
// Get bans info from datastore
|
||||
if (!$bans = $datastore->get('ban_list')) {
|
||||
$datastore->update('ban_list');
|
||||
$bans = $datastore->get('ban_list');
|
||||
}
|
||||
$bans = $datastore->get('ban_list');
|
||||
|
||||
if (!isset($userId)) {
|
||||
return $bans;
|
||||
|
@ -2161,19 +2178,53 @@ function readUpdaterFile(): array|bool
|
|||
*/
|
||||
function infoByIP(string $ipAddress, int $port = 0): array
|
||||
{
|
||||
if (!$data = CACHE('bb_ip2countries')->get($ipAddress . '_' . $port)) {
|
||||
if (!config()->get('ip2country_settings.enabled')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ipAddress = \TorrentPier\Helpers\IPHelper::long2ip_extended($ipAddress);
|
||||
$cacheName = hash('xxh128', ($ipAddress . '_' . $port));
|
||||
|
||||
if (!$data = CACHE('bb_ip2countries')->get($cacheName)) {
|
||||
$data = [];
|
||||
$response = file_get_contents(API_IP_URL . $ipAddress);
|
||||
$json = json_decode($response, true);
|
||||
if (is_array($json) && !empty($json)) {
|
||||
$data = [
|
||||
'ipVersion' => $json['ipVersion'],
|
||||
'countryCode' => $json['countryCode'],
|
||||
'continent' => $json['continent'],
|
||||
'continentCode' => $json['continentCode']
|
||||
|
||||
$contextOptions = [];
|
||||
if (!empty(config()->get('ip2country_settings.api_token'))) {
|
||||
$contextOptions['http'] = [
|
||||
'header' => "Authorization: Bearer " . config()->get('ip2country_settings.api_token') . "\r\n"
|
||||
];
|
||||
CACHE('bb_ip2countries')->set($ipAddress . '_' . $port, $data, 1200);
|
||||
}
|
||||
|
||||
$context = stream_context_create($contextOptions);
|
||||
|
||||
try {
|
||||
$response = file_get_contents(config()->get('ip2country_settings.endpoint') . $ipAddress, context: $context);
|
||||
|
||||
if ($response !== false) {
|
||||
$json = json_decode($response, true);
|
||||
|
||||
if (is_array($json) && !empty($json)) {
|
||||
$data = [
|
||||
'ipVersion' => $json['ipVersion'],
|
||||
'countryCode' => $json['countryCode'],
|
||||
'continent' => $json['continent'],
|
||||
'continentCode' => $json['continentCode']
|
||||
];
|
||||
}
|
||||
} else {
|
||||
bb_log("[FreeIPAPI] Failed to get IP info for: $ipAddress" . LOG_LF);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
bb_log("[FreeIPAPI] " . $e->getMessage() . LOG_LF);
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
$data = [
|
||||
'response' => false,
|
||||
'timestamp' => TIMENOW
|
||||
];
|
||||
}
|
||||
CACHE('bb_ip2countries')->set($cacheName, $data, 1200);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
|
161
library/includes/functions_cli.php
Normal file
161
library/includes/functions_cli.php
Normal file
|
@ -0,0 +1,161 @@
|
|||
<?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')) {
|
||||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove target file
|
||||
*
|
||||
* @param string $file Path to file
|
||||
* @param bool $withoutOutput Hide output
|
||||
*/
|
||||
function removeFile(string $file, bool $withoutOutput = false): void
|
||||
{
|
||||
if (unlink($file)) {
|
||||
if ($withoutOutput === false) {
|
||||
echo "- File removed: $file" . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
if ($withoutOutput === false) {
|
||||
echo "- File cannot be removed: $file" . PHP_EOL;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folder (recursively)
|
||||
*
|
||||
* @param string $dir Path to folder
|
||||
* @param bool $withoutOutput Hide output
|
||||
*/
|
||||
function removeDir(string $dir, bool $withoutOutput = false): void
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
|
||||
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
removeDir($file->getPathname(), $withoutOutput);
|
||||
} else {
|
||||
removeFile($file->getPathname(), $withoutOutput);
|
||||
}
|
||||
}
|
||||
|
||||
if (rmdir($dir)) {
|
||||
if ($withoutOutput === false) {
|
||||
echo "- Folder removed: $dir" . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
if ($withoutOutput === false) {
|
||||
echo "- Folder cannot be removed: $dir" . PHP_EOL;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Colored console output
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $type
|
||||
* @return void
|
||||
*/
|
||||
function out(string $str, string $type = ''): void
|
||||
{
|
||||
echo match ($type) {
|
||||
'error' => "\033[31m$str \033[0m\n",
|
||||
'success' => "\033[32m$str \033[0m\n",
|
||||
'warning' => "\033[33m$str \033[0m\n",
|
||||
'info' => "\033[36m$str \033[0m\n",
|
||||
'debug' => "\033[90m$str \033[0m\n",
|
||||
default => "$str\n",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Run process with realtime output
|
||||
*
|
||||
* @param string $cmd
|
||||
* @param string|null $input
|
||||
* @return int
|
||||
*/
|
||||
function runProcess(string $cmd, ?string $input = null): int
|
||||
{
|
||||
$descriptorSpec = [
|
||||
0 => ['pipe', 'r'],
|
||||
1 => ['pipe', 'w'],
|
||||
2 => ['pipe', 'w'],
|
||||
];
|
||||
|
||||
$process = proc_open($cmd, $descriptorSpec, $pipes);
|
||||
|
||||
if (!is_resource($process)) {
|
||||
out('- Could not start subprocess', 'error');
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Write input if provided
|
||||
if ($input !== null) {
|
||||
fwrite($pipes[0], $input);
|
||||
fclose($pipes[0]);
|
||||
}
|
||||
|
||||
// Read and print output in real-time
|
||||
while (!feof($pipes[1])) {
|
||||
echo stream_get_contents($pipes[1], 1);
|
||||
flush(); // Flush output buffer for immediate display
|
||||
}
|
||||
|
||||
// Read and print error output
|
||||
while (!feof($pipes[2])) {
|
||||
echo stream_get_contents($pipes[2], 1);
|
||||
flush();
|
||||
}
|
||||
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
return proc_close($process);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting permissions recursively
|
||||
*
|
||||
* @param string $dir
|
||||
* @param int $dirPermissions
|
||||
* @param int $filePermissions
|
||||
* @return void
|
||||
*/
|
||||
function chmod_r(string $dir, int $dirPermissions, int $filePermissions): void
|
||||
{
|
||||
$dp = opendir($dir);
|
||||
while ($file = readdir($dp)) {
|
||||
if (($file == '.') || ($file == '..')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullPath = realpath($dir . '/' . $file);
|
||||
if (is_dir($fullPath)) {
|
||||
out("- Directory: $fullPath");
|
||||
chmod($fullPath, $dirPermissions);
|
||||
chmod_r($fullPath, $dirPermissions, $filePermissions);
|
||||
} elseif (is_file($fullPath)) {
|
||||
// out("- File: $fullPath");
|
||||
chmod($fullPath, $filePermissions);
|
||||
} else {
|
||||
out("- Cannot find target path: $fullPath", 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dp);
|
||||
}
|
|
@ -39,9 +39,7 @@ function send_page($contents)
|
|||
*/
|
||||
function compress_output($contents)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if ($bb_cfg['gzip_compress'] && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
|
||||
if (config()->get('gzip_compress') && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
|
||||
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000) {
|
||||
header('Content-Encoding: gzip');
|
||||
$contents = gzencode($contents, 1);
|
||||
|
@ -59,7 +57,7 @@ if (!defined('IN_AJAX')) {
|
|||
}
|
||||
|
||||
// Cookie params
|
||||
$c = $bb_cfg['cookie_prefix'];
|
||||
$c = config()->get('cookie_prefix');
|
||||
define('COOKIE_DATA', $c . 'data');
|
||||
define('COOKIE_FORUM', $c . 'f');
|
||||
define('COOKIE_MARK', $c . 'mark_read');
|
||||
|
@ -85,16 +83,14 @@ define('COOKIE_MAX_TRACKS', 90);
|
|||
*/
|
||||
function bb_setcookie(string $name, mixed $val, int $lifetime = COOKIE_PERSIST, bool $httponly = false, bool $isRaw = false): void
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
$cookie = new \Josantonius\Cookie\Cookie(
|
||||
domain: $bb_cfg['cookie_domain'],
|
||||
domain: config()->get('cookie_domain'),
|
||||
expires: $lifetime,
|
||||
httpOnly: $httponly,
|
||||
path: $bb_cfg['script_path'],
|
||||
path: config()->get('script_path'),
|
||||
raw: $isRaw,
|
||||
sameSite: $bb_cfg['cookie_same_site'],
|
||||
secure: $bb_cfg['cookie_secure']
|
||||
sameSite: config()->get('cookie_same_site'),
|
||||
secure: config()->get('cookie_secure')
|
||||
);
|
||||
|
||||
if (!empty($val)) {
|
||||
|
@ -104,15 +100,6 @@ function bb_setcookie(string $name, mixed $val, int $lifetime = COOKIE_PERSIST,
|
|||
}
|
||||
}
|
||||
|
||||
// User Levels
|
||||
define('DELETED', -1);
|
||||
define('USER', 0);
|
||||
define('ADMIN', 1);
|
||||
define('MOD', 2);
|
||||
define('GROUP_MEMBER', 20);
|
||||
define('CP_HOLDER', 25);
|
||||
define('EXCLUDED_USERS', implode(',', [GUEST_UID, BOT_UID]));
|
||||
|
||||
// User related
|
||||
define('USER_ACTIVATION_NONE', 0);
|
||||
define('USER_ACTIVATION_SELF', 1);
|
||||
|
@ -257,7 +244,6 @@ define('BB_TOPIC_TPL', 'bb_topic_tpl');
|
|||
define('BB_TOPICS', 'bb_topics');
|
||||
define('BB_TOPICS_WATCH', 'bb_topics_watch');
|
||||
define('BB_USER_GROUP', 'bb_user_group');
|
||||
define('BB_USERS', 'bb_users');
|
||||
define('BB_WORDS', 'bb_words');
|
||||
define('BB_THX', 'bb_thx');
|
||||
|
||||
|
@ -285,14 +271,14 @@ define('PAGE_HEADER', INC_DIR . '/page_header.php');
|
|||
define('PAGE_FOOTER', INC_DIR . '/page_footer.php');
|
||||
|
||||
define('CAT_URL', 'index.php?' . POST_CAT_URL . '=');
|
||||
define('DL_URL', $bb_cfg['dl_url']);
|
||||
define('DL_URL', config()->get('dl_url'));
|
||||
define('FORUM_URL', 'viewforum.php?' . POST_FORUM_URL . '=');
|
||||
define('GROUP_URL', 'group.php?' . POST_GROUPS_URL . '=');
|
||||
define('LOGIN_URL', $bb_cfg['login_url']);
|
||||
define('LOGIN_URL', config()->get('login_url'));
|
||||
define('MODCP_URL', 'modcp.php?' . POST_FORUM_URL . '=');
|
||||
define('PM_URL', $bb_cfg['pm_url']);
|
||||
define('PM_URL', config()->get('pm_url'));
|
||||
define('POST_URL', 'viewtopic.php?' . POST_POST_URL . '=');
|
||||
define('POSTING_URL', $bb_cfg['posting_url']);
|
||||
define('POSTING_URL', config()->get('posting_url'));
|
||||
define('PROFILE_URL', 'profile.php?mode=viewprofile&' . POST_USERS_URL . '=');
|
||||
define('BONUS_URL', 'profile.php?mode=bonus');
|
||||
define('TOPIC_URL', 'viewtopic.php?' . POST_TOPIC_URL . '=');
|
||||
|
@ -388,20 +374,20 @@ function make_url(string $path = ''): string
|
|||
*/
|
||||
require_once INC_DIR . '/functions.php';
|
||||
|
||||
$bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg);
|
||||
// Merge database configuration with base configuration using singleton
|
||||
// bb_cfg deprecated, but kept for compatibility with non-adapted code
|
||||
config()->merge(bb_get_config(BB_CONFIG));
|
||||
$bb_cfg = config()->all();
|
||||
|
||||
// wordCensor deprecated, but kept for compatibility with non-adapted code
|
||||
$wordCensor = censor();
|
||||
|
||||
$log_action = new TorrentPier\Legacy\LogAction();
|
||||
$wordCensor = new TorrentPier\Censor();
|
||||
$html = new TorrentPier\Legacy\Common\Html();
|
||||
$user = new TorrentPier\Legacy\Common\User();
|
||||
|
||||
$userdata =& $user->data;
|
||||
|
||||
/**
|
||||
* Some shared defines
|
||||
*/
|
||||
define('TP_INSTANCE_HASH', $bb_cfg['tp_instance_hash']);
|
||||
|
||||
/**
|
||||
* Cron
|
||||
*/
|
||||
|
@ -411,7 +397,7 @@ if (
|
|||
!is_file(CRON_RUNNING) &&
|
||||
(TorrentPier\Helpers\CronHelper::isEnabled() || defined('START_CRON'))
|
||||
) {
|
||||
if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) {
|
||||
if (TIMENOW - config()->get('cron_last_check') > config()->get('cron_check_interval')) {
|
||||
|
||||
/** Update cron_last_check */
|
||||
bb_update_config(['cron_last_check' => TIMENOW + 10]);
|
||||
|
@ -451,8 +437,8 @@ if (
|
|||
/**
|
||||
* Exit if board is disabled via trigger
|
||||
*/
|
||||
if (($bb_cfg['board_disable'] || is_file(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
|
||||
if ($bb_cfg['board_disable']) {
|
||||
if ((config()->get('board_disable') || is_file(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
|
||||
if (config()->get('board_disable')) {
|
||||
// admin lock
|
||||
send_no_cache_headers();
|
||||
bb_die('BOARD_DISABLE', 503);
|
||||
|
|
|
@ -36,11 +36,11 @@ $online = $online_short = ['userlist' => ''];
|
|||
$sql = "
|
||||
SELECT
|
||||
u.username, u.user_id, u.user_opt, u.user_rank, u.user_level,
|
||||
s.session_logged_in, s.session_ip, (s.session_time - s.session_start) AS ses_len, COUNT(s.session_id) AS sessions, COUNT(DISTINCT s.session_ip) AS ips
|
||||
MAX(s.session_logged_in) AS session_logged_in, MAX(s.session_ip) AS session_ip, MAX(s.session_time - s.session_start) AS ses_len, COUNT(s.session_id) AS sessions, COUNT(DISTINCT s.session_ip) AS ips
|
||||
FROM " . BB_SESSIONS . " s, " . BB_USERS . " u
|
||||
WHERE s.session_time > $time_online
|
||||
AND u.user_id = s.session_user_id
|
||||
GROUP BY s.session_user_id
|
||||
GROUP BY s.session_user_id, u.username, u.user_id, u.user_opt, u.user_rank, u.user_level
|
||||
ORDER BY u.username
|
||||
";
|
||||
|
||||
|
@ -116,7 +116,7 @@ if (!$online['userlist']) {
|
|||
|
||||
$total_online = $logged_online + $guests_online;
|
||||
|
||||
if ($total_online > $bb_cfg['record_online_users']) {
|
||||
if ($total_online > config()->get('record_online_users')) {
|
||||
bb_update_config([
|
||||
'record_online_users' => $total_online,
|
||||
'record_online_date' => TIMENOW
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $userdata, $template, $DBS, $lang;
|
||||
global $userdata, $template, $lang;
|
||||
|
||||
if (!empty($template)) {
|
||||
$birthday_tp = ((string)bb_date(TIMENOW, 'd.m', false) === '04.04') ? ' | 🎉🍰💚' : '';
|
||||
|
@ -29,29 +29,33 @@ if (!empty($template)) {
|
|||
|
||||
$show_dbg_info = (DBG_USER && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
|
||||
|
||||
if (!$bb_cfg['gzip_compress']) {
|
||||
if (!config()->get('gzip_compress')) {
|
||||
flush();
|
||||
}
|
||||
|
||||
if ($show_dbg_info) {
|
||||
$gen_time = utime() - TIMESTART;
|
||||
$gen_time_txt = sprintf('%.4f', $gen_time);
|
||||
$gen_time_txt = sprintf('%.3f', $gen_time);
|
||||
$gzip_text = UA_GZIP_SUPPORTED ? "{$lang['GZIP_COMPRESSION']}: " : "<s>{$lang['GZIP_COMPRESSION']}:</s> ";
|
||||
$gzip_text .= $bb_cfg['gzip_compress'] ? $lang['ON'] : $lang['OFF'];
|
||||
$gzip_text .= config()->get('gzip_compress') ? $lang['ON'] : $lang['OFF'];
|
||||
|
||||
$stat = '[ ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC'];
|
||||
|
||||
if (!empty($DBS)) {
|
||||
$sql_t = $DBS->sql_timetotal;
|
||||
$sql_time_txt = ($sql_t) ? sprintf('%.4f ' . $lang['SEC'] . ' (%d%%) · ', $sql_t, round($sql_t * 100 / $gen_time)) : '';
|
||||
$num_q = $DBS->num_queries;
|
||||
$stat .= " | {$DBS->get_db_obj()->engine}: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
|
||||
// Get database statistics from the new system
|
||||
try {
|
||||
$main_db = \TorrentPier\Database\DatabaseFactory::getInstance('db');
|
||||
$sql_t = $main_db->sql_timetotal;
|
||||
$sql_time_txt = ($sql_t) ? sprintf('%.3f ' . $lang['SEC'] . ' (%d%%) · ', $sql_t, round($sql_t * 100 / $gen_time)) : '';
|
||||
$num_q = $main_db->num_queries;
|
||||
$stat .= " | {$main_db->engine}: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
|
||||
} catch (\Exception $e) {
|
||||
// Skip database stats if not available
|
||||
}
|
||||
|
||||
$stat .= " | $gzip_text";
|
||||
|
||||
$stat .= ' | ' . $lang['MEMORY'];
|
||||
$stat .= humn_size($bb_cfg['mem_on_start'], 2) . ' / ';
|
||||
$stat .= humn_size(config()->get('mem_on_start'), 2) . ' / ';
|
||||
$stat .= humn_size(sys('mem_peak'), 2) . ' / ';
|
||||
$stat .= humn_size(sys('mem'), 2);
|
||||
|
||||
|
@ -83,7 +87,7 @@ echo '
|
|||
|
||||
if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT')) {
|
||||
if (IS_GUEST === true) {
|
||||
caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
|
||||
caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . config()->get('default_lang'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,14 +64,21 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
<?php
|
||||
if (!empty($_COOKIE['explain'])) {
|
||||
foreach ($DBS->srv as $srv_name => $db_obj) {
|
||||
if (!empty($db_obj->do_explain)) {
|
||||
$db_obj->explain('display');
|
||||
// Get all database server instances from the new DatabaseFactory
|
||||
$server_names = \TorrentPier\Database\DatabaseFactory::getServerNames();
|
||||
foreach ($server_names as $srv_name) {
|
||||
try {
|
||||
$db_obj = \TorrentPier\Database\DatabaseFactory::getInstance($srv_name);
|
||||
if (!empty($db_obj->do_explain)) {
|
||||
$db_obj->explain('display');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Skip if server not available
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql_log = !empty($_COOKIE['sql_log']) ? \TorrentPier\Dev::getSqlLog() : false;
|
||||
$sql_log = !empty($_COOKIE['sql_log']) ? dev()->getSqlDebugLog() : false;
|
||||
|
||||
if ($sql_log) {
|
||||
echo '<div class="sqlLog" id="sqlLog">' . $sql_log . '</div><!-- / sqlLog --><br clear="all" />';
|
||||
|
|
|
@ -16,7 +16,7 @@ if (defined('PAGE_HEADER_SENT')) {
|
|||
}
|
||||
|
||||
// Parse and show the overall page header
|
||||
global $page_cfg, $userdata, $user, $ads, $bb_cfg, $template, $lang, $images;
|
||||
global $page_cfg, $userdata, $user, $ads, $template, $lang, $images;
|
||||
|
||||
$logged_in = (int)!empty($userdata['session_logged_in']);
|
||||
|
||||
|
@ -52,7 +52,7 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
|
|||
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
|
||||
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
|
||||
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'],
|
||||
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], $bb_cfg['record_online_users'], bb_date($bb_cfg['record_online_date'])),
|
||||
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], config()->get('record_online_users'), bb_date(config()->get('record_online_date'))),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -117,16 +117,18 @@ $template->assign_vars([
|
|||
'USER_HIDE_CAT' => (BB_SCRIPT == 'index'),
|
||||
|
||||
'USER_LANG' => $userdata['user_lang'],
|
||||
'USER_LANG_DIRECTION' => (isset($bb_cfg['lang'][$userdata['user_lang']]['rtl']) && $bb_cfg['lang'][$userdata['user_lang']]['rtl'] === true) ? 'rtl' : 'ltr',
|
||||
|
||||
'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']),
|
||||
'USER_OPTIONS_JS' => IS_GUEST ? '{}' : json_encode($user->opt_js, JSON_THROW_ON_ERROR),
|
||||
|
||||
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
|
||||
'ALLOW_ROBOTS' => !$bb_cfg['board_disable'] && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
||||
'ALLOW_ROBOTS' => !config()->get('board_disable') && (!isset($page_cfg['allow_robots']) || $page_cfg['allow_robots'] === true),
|
||||
'META_DESCRIPTION' => !empty($page_cfg['meta_description']) ? trim(htmlCHR($page_cfg['meta_description'])) : '',
|
||||
|
||||
'SITENAME' => $bb_cfg['sitename'],
|
||||
'SITENAME' => config()->get('sitename'),
|
||||
'U_INDEX' => BB_ROOT . 'index.php',
|
||||
'T_INDEX' => sprintf($lang['FORUM_INDEX'], $bb_cfg['sitename']),
|
||||
'T_INDEX' => sprintf($lang['FORUM_INDEX'], config()->get('sitename')),
|
||||
|
||||
'IS_GUEST' => IS_GUEST,
|
||||
'IS_USER' => IS_USER,
|
||||
|
@ -137,9 +139,9 @@ $template->assign_vars([
|
|||
'FORUM_PATH' => FORUM_PATH,
|
||||
'FULL_URL' => FULL_URL,
|
||||
|
||||
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)),
|
||||
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)$bb_cfg['board_timezone'])])),
|
||||
'BOARD_TIMEZONE' => $bb_cfg['board_timezone'],
|
||||
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, config()->get('last_visit_date_format'), false)),
|
||||
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)config()->get('board_timezone'))])),
|
||||
'BOARD_TIMEZONE' => config()->get('board_timezone'),
|
||||
|
||||
'PM_INFO' => $pm_info,
|
||||
'PRIVMSG_IMG' => $icon_pm,
|
||||
|
@ -150,7 +152,7 @@ $template->assign_vars([
|
|||
'THIS_USER' => profile_url($userdata),
|
||||
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')),
|
||||
'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
|
||||
'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'],
|
||||
'AUTOLOGIN_DISABLED' => !config()->get('allow_autologin'),
|
||||
'S_LOGIN_ACTION' => LOGIN_URL,
|
||||
|
||||
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
|
||||
|
@ -166,11 +168,11 @@ $template->assign_vars([
|
|||
'U_REGISTER' => 'profile.php?mode=register',
|
||||
'U_SEARCH' => 'search.php',
|
||||
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword",
|
||||
'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
|
||||
'U_TERMS' => config()->get('terms_and_conditions_url'),
|
||||
'U_TRACKER' => 'tracker.php',
|
||||
|
||||
'SHOW_SIDEBAR1' => !empty($bb_cfg['page']['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page'],
|
||||
'SHOW_SIDEBAR2' => !empty($bb_cfg['page']['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page'],
|
||||
'SHOW_SIDEBAR1' => !empty(config()->get('page.show_sidebar1')[BB_SCRIPT]) || config()->get('show_sidebar1_on_every_page'),
|
||||
'SHOW_SIDEBAR2' => !empty(config()->get('page.show_sidebar2')[BB_SCRIPT]) || config()->get('show_sidebar2_on_every_page'),
|
||||
|
||||
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
|
||||
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
|
||||
|
@ -184,11 +186,11 @@ $template->assign_vars([
|
|||
'DOWNLOAD_URL' => BB_ROOT . DL_URL,
|
||||
'FORUM_URL' => BB_ROOT . FORUM_URL,
|
||||
'GROUP_URL' => BB_ROOT . GROUP_URL,
|
||||
'LOGIN_URL' => $bb_cfg['login_url'],
|
||||
'LOGIN_URL' => config()->get('login_url'),
|
||||
'NEWEST_URL' => '&view=newest#newest',
|
||||
'PM_URL' => $bb_cfg['pm_url'],
|
||||
'PM_URL' => config()->get('pm_url'),
|
||||
'POST_URL' => BB_ROOT . POST_URL,
|
||||
'POSTING_URL' => $bb_cfg['posting_url'],
|
||||
'POSTING_URL' => config()->get('posting_url'),
|
||||
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
|
||||
'BONUS_URL' => BB_ROOT . BONUS_URL,
|
||||
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
|
||||
|
@ -207,7 +209,7 @@ $template->assign_vars([
|
|||
'U_WATCHED_TOPICS' => 'profile.php?mode=watch'
|
||||
]);
|
||||
|
||||
if (!empty($bb_cfg['page']['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])) {
|
||||
if (!empty(config()->get('page.show_torhelp')[BB_SCRIPT]) && !empty($userdata['torhelp'])) {
|
||||
$ignore_time = !empty($_COOKIE['torhelp']) ? (int)$_COOKIE['torhelp'] : 0;
|
||||
|
||||
if (TIMENOW > $ignore_time) {
|
||||
|
@ -248,6 +250,6 @@ $template->pparse('page_header');
|
|||
|
||||
define('PAGE_HEADER_SENT', true);
|
||||
|
||||
if (!$bb_cfg['gzip_compress']) {
|
||||
if (!config()->get('gzip_compress')) {
|
||||
flush();
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ $dl_users_div_style_overflow = "padding: 6px; height: $dl_users_overflow_div_hei
|
|||
|
||||
$template->assign_vars(['DL_BUTTONS' => false]);
|
||||
|
||||
$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !(@$_GET['dl'] === 'names'));
|
||||
$count_mode = (config()->get('bt_dl_list_only_count') && !(@$_GET['dl'] === 'names'));
|
||||
|
||||
$have_dl_buttons_enabled = ($bb_cfg['bt_show_dl_but_will'] || $bb_cfg['bt_show_dl_but_down'] || $bb_cfg['bt_show_dl_but_compl'] || $bb_cfg['bt_show_dl_but_cancel']);
|
||||
$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
|
||||
$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && @$_GET['dl'] === 'names')));
|
||||
$show_dl_buttons = (!IS_GUEST && $dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
|
||||
$have_dl_buttons_enabled = (config()->get('bt_show_dl_but_will') || config()->get('bt_show_dl_but_down') || config()->get('bt_show_dl_but_compl') || config()->get('bt_show_dl_but_cancel'));
|
||||
$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !(config()->get('bt_dl_list_only_1st_page') && $start));
|
||||
$show_dl_list = ($dl_topic && (config()->get('bt_show_dl_list') || (config()->get('allow_dl_list_names_mode') && @$_GET['dl'] === 'names')));
|
||||
$show_dl_buttons = (!IS_GUEST && $dl_topic && config()->get('bt_show_dl_list_buttons'));
|
||||
|
||||
// link to clear DL-List
|
||||
$template->assign_vars(['S_DL_DELETE' => false]);
|
||||
|
@ -99,7 +99,7 @@ if ($show_dl_list) {
|
|||
]);
|
||||
}
|
||||
}
|
||||
} elseif ($bb_cfg['bt_show_dl_list_buttons'] && $have_dl_buttons_enabled) {
|
||||
} elseif (config()->get('bt_show_dl_list_buttons') && $have_dl_buttons_enabled) {
|
||||
$template->assign_block_vars('dl_list_none', []);
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ if ($show_dl_list) {
|
|||
if ($show_dl_buttons) {
|
||||
$template->assign_vars([
|
||||
'DL_BUTTONS' => true,
|
||||
'DL_BUT_WILL' => $bb_cfg['bt_show_dl_but_will'],
|
||||
'DL_BUT_DOWN' => $bb_cfg['bt_show_dl_but_down'],
|
||||
'DL_BUT_COMPL' => $bb_cfg['bt_show_dl_but_compl'],
|
||||
'DL_BUT_CANCEL' => $bb_cfg['bt_show_dl_but_cancel']
|
||||
'DL_BUT_WILL' => config()->get('bt_show_dl_but_will'),
|
||||
'DL_BUT_DOWN' => config()->get('bt_show_dl_but_down'),
|
||||
'DL_BUT_COMPL' => config()->get('bt_show_dl_but_compl'),
|
||||
'DL_BUT_CANCEL' => config()->get('bt_show_dl_but_cancel')
|
||||
]);
|
||||
|
||||
$dl_hidden_fields = '
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue