mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Compare commits
288 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 |
||
|
4e6aadac8c | ||
|
aa54b3c9ad | ||
|
858556043d |
||
|
01c2f3763f | ||
|
74ea1573b2 |
||
|
8ad080ff2f | ||
|
dd721367c7 |
||
|
b954815f5d |
||
|
492a6d105a | ||
|
f8c4e8fb14 |
||
|
b4624aec5a | ||
|
b550fa59f9 |
||
|
bb022e9a57 | ||
|
5dc9a5475c |
||
|
68bf26d0f4 |
||
|
bc95e14be3 |
||
|
249c988989 |
||
|
f2e513dd8b |
||
|
4dcd1fb16e |
||
|
3b8ee4c4d3 |
||
|
380c94ff07 | ||
|
680bd77920 | ||
|
92ce77ec0e |
||
|
ba3ce885c8 |
||
|
912b080b16 |
||
|
1418d2173a | ||
|
652708952d | ||
|
cef5c7c2a6 | ||
|
4f896854d3 |
||
|
f3714f02f2 |
||
|
0cfb34ce58 | ||
|
5b3d5333d5 | ||
|
1c323a45d7 |
||
|
5340f301e4 | ||
|
023d912f24 | ||
|
6f641aa9d8 |
||
|
dedf35b794 |
||
|
34c429e9e6 | ||
|
75bf819391 | ||
|
dfd4e5ebc9 |
||
|
bdefed4dab |
||
|
61253b6c94 | ||
|
0b04d71ea0 | ||
|
f7d394607e |
||
|
fd98854977 | ||
|
0dc788ea05 | ||
|
03ebbda6be |
||
|
6c6b7ad194 | ||
|
7df3e4c617 | ||
|
7794242750 |
||
|
7fc26743a7 | ||
|
f723588d43 | ||
|
c57db2104d |
||
|
f2aea92b3d |
||
|
6640d9eb5a | ||
|
5b3e948da4 | ||
|
2593f093a3 |
||
|
b4e177b6f2 | ||
|
cdd22df66a | ||
|
d54c07b3da |
||
|
aa866d19e6 | ||
|
7973c85962 | ||
|
bea3b0bccf |
||
|
3a9dd6a3c9 |
||
|
b286e35638 | ||
|
401263001e | ||
|
c168c3956c |
||
|
1b751c72a7 | ||
|
ad5d20cf87 |
359 changed files with 23048 additions and 11825 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
|
name: Bug Report
|
||||||
description: File a bug report
|
description: File a bug report
|
||||||
title: "[Bug]"
|
title: "[Bug]"
|
||||||
labels: Bug
|
labels: [Bug]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -21,7 +21,7 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: PHP & Platform
|
label: PHP & Platform
|
||||||
description: Exact PHP and Platform (OS) versions your using.
|
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:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
name: Feature / Enhancement request
|
name: Feature / Enhancement request
|
||||||
about: Suggest an idea for TorrentPier
|
about: Suggest an idea for TorrentPier
|
||||||
title: "[Feature]"
|
title: "[Feature]"
|
||||||
labels: Feature, Enhancement
|
labels: [Feature, Enhancement]
|
||||||
assignees: ''
|
assignees: ''
|
||||||
---
|
---
|
||||||
|
|
84
.github/workflows/cd.yml
vendored
84
.github/workflows/cd.yml
vendored
|
@ -6,8 +6,9 @@ on:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
generate-changelog:
|
||||||
runs-on: ubuntu-latest
|
name: Generate changelog
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
outputs:
|
outputs:
|
||||||
release_body: ${{ steps.git-cliff.outputs.content }}
|
release_body: ${{ steps.git-cliff.outputs.content }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -15,72 +16,24 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.REPO_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate a changelog
|
- name: Generate a changelog
|
||||||
uses: orhun/git-cliff-action@v4
|
uses: orhun/git-cliff-action@v4
|
||||||
id: git-cliff
|
id: git-cliff
|
||||||
with:
|
with:
|
||||||
config: cliff.toml
|
config: cliff.toml
|
||||||
args: v2.4.5-rc.2.. --verbose
|
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
|
||||||
env:
|
|
||||||
OUTPUT: CHANGELOG.md
|
|
||||||
GITHUB_REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Print the changelog
|
- name: Print the changelog
|
||||||
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
||||||
|
|
||||||
- name: Commit changelog
|
|
||||||
run: |
|
|
||||||
git checkout master
|
|
||||||
git config --local user.name 'belomaxorka'
|
|
||||||
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
|
||||||
set +e
|
|
||||||
git add CHANGELOG.md
|
|
||||||
git commit -m "release(preparing): Update CHANGELOG.md 📖"
|
|
||||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
|
||||||
|
|
||||||
checksums:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- changelog
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: master
|
|
||||||
token: ${{ secrets.REPO_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate checksums.md5 file
|
|
||||||
run: |
|
|
||||||
find . -type f -not -path "./.git/*" -exec md5sum {} \; > internal_data/checksums.md5
|
|
||||||
|
|
||||||
- name: Commit and push checksums.md5 if changed
|
|
||||||
run: |
|
|
||||||
git checkout master
|
|
||||||
git config --local user.name 'belomaxorka'
|
|
||||||
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
|
||||||
|
|
||||||
if git diff --quiet internal_data/checksums.md5; then
|
|
||||||
echo "No changes in internal_data/checksums.md5"
|
|
||||||
else
|
|
||||||
set +e
|
|
||||||
git add internal_data/checksums.md5
|
|
||||||
git commit -m "release(preparing): Update checksums.md5 📄"
|
|
||||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
|
||||||
fi
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create release
|
name: Create release
|
||||||
needs:
|
needs: [ generate-changelog ]
|
||||||
- checksums
|
runs-on: ubuntu-22.04
|
||||||
- changelog
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set the release version
|
- name: Set the release version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
||||||
|
@ -88,16 +41,19 @@ jobs:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.2'
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- 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
|
||||||
|
|
||||||
- name: Create archive
|
- name: Create archive
|
||||||
id: create_zip
|
id: create-zip
|
||||||
run: |
|
run: |
|
||||||
ZIP_NAME="torrentpier-v${{ env.RELEASE_VERSION }}.zip"
|
ZIP_NAME="torrentpier-v${{ env.RELEASE_VERSION }}.zip"
|
||||||
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*"
|
zip -r "$ZIP_NAME" . -x ".git/*"
|
||||||
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Publish to GitHub
|
- name: Publish to GitHub
|
||||||
|
@ -105,22 +61,20 @@ jobs:
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
overwrite: true
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
release_name: "v${{ env.RELEASE_VERSION }}"
|
||||||
body: "${{ needs.changelog.outputs.release_body }}"
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
||||||
|
|
||||||
- name: Publish to GitHub (pre-release)
|
- name: Publish to GitHub (pre-release)
|
||||||
if: ${{ contains(github.ref, '-') }}
|
if: ${{ contains(github.ref, '-') }}
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
overwrite: true
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
release_name: "v${{ env.RELEASE_VERSION }}"
|
||||||
body: "${{ needs.changelog.outputs.release_body }}"
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
63
.github/workflows/ci.yml
vendored
63
.github/workflows/ci.yml
vendored
|
@ -7,64 +7,39 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nightly:
|
nightly:
|
||||||
runs-on: ubuntu-latest
|
name: Nightly builds 📦
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code 🗳
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP 🔩
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.2'
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- 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
|
- name: Get commit hash 🔗
|
||||||
id: get_commit_hash
|
id: get-commit-hash
|
||||||
run: |
|
run: |
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create archive
|
- name: Cleanup
|
||||||
id: create_zip
|
run: php _cleanup.php && rm _cleanup.php
|
||||||
|
|
||||||
|
- name: Create archive 🗞
|
||||||
|
id: create-zip
|
||||||
run: |
|
run: |
|
||||||
ZIP_NAME="torrentpier-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}.zip"
|
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
|
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Upload Archive
|
- name: Upload Archive 📤
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: TorrentPier
|
name: TorrentPier-master
|
||||||
path: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
path: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
||||||
|
|
||||||
deploy:
|
|
||||||
name: 🎉 Deploy
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
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
|
|
||||||
|
|
41
.github/workflows/schedule.yml
vendored
Normal file
41
.github/workflows/schedule.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: Changelog generation
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
name: Changelog generation
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
token: ${{ secrets.REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate a changelog
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
id: git-cliff
|
||||||
|
with:
|
||||||
|
config: cliff.toml
|
||||||
|
args: v2.4.6-alpha.4.. --verbose
|
||||||
|
env:
|
||||||
|
OUTPUT: CHANGELOG.md
|
||||||
|
GITHUB_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Print the changelog
|
||||||
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
||||||
|
|
||||||
|
- name: Commit changelog
|
||||||
|
run: |
|
||||||
|
git checkout master
|
||||||
|
git config --local user.name 'belomaxorka'
|
||||||
|
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
||||||
|
set +e
|
||||||
|
git add CHANGELOG.md
|
||||||
|
git commit -m "changelog: Update CHANGELOG.md 📖"
|
||||||
|
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
### TorrentPier ###
|
### TorrentPier ###
|
||||||
*.log
|
*.log
|
||||||
/*.txt
|
|
||||||
*.integrity
|
|
||||||
install.php_*
|
install.php_*
|
||||||
composer-setup.php
|
composer-setup.php
|
||||||
.env
|
.env
|
||||||
|
|
160
CHANGELOG.md
160
CHANGELOG.md
|
@ -2,92 +2,112 @@
|
||||||
|
|
||||||
# 📖 Change Log
|
# 📖 Change Log
|
||||||
|
|
||||||
> [!NOTE]
|
## [v2.8.3](https://github.com/torrentpier/torrentpier/compare/v2.8.2..v2.8.3) (2025-07-03)
|
||||||
> To view changelog from **v2.0.0** to **v2.4.5-rc.2** navigate to [HISTORY.md](HISTORY.md).
|
|
||||||
## [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
|
### 🚀 Features
|
||||||
|
|
||||||
- *(announcer)* Added some disallowed ports by default ([#1767](https://github.com/torrentpier/torrentpier/pull/1767)) - ([46288ec](https://github.com/torrentpier/torrentpier/commit/46288ec19830c84aedb156e1f30d7ec8a0803e0d))
|
- *(lang)* Added `RTL` languages support ([#2031](https://github.com/torrentpier/torrentpier/pull/2031)) - ([fd46d3d](https://github.com/torrentpier/torrentpier/commit/fd46d3d04ad3ab1453256b2ab620508e2ba33586))
|
||||||
- *(announcer)* Added `is_numeric()` checking for some fields ([#1766](https://github.com/torrentpier/torrentpier/pull/1766)) - ([096bb51](https://github.com/torrentpier/torrentpier/commit/096bb5124fa27d27c3e60031edc432d877f1c507))
|
- *(updater)* Added exceptions logging ([#2026](https://github.com/torrentpier/torrentpier/pull/2026)) - ([51f2c70](https://github.com/torrentpier/torrentpier/commit/51f2c70d81b910012cdecd111b5b92c1dfd0d6f6))
|
||||||
- *(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))
|
### 🚜 Refactor
|
||||||
- *(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))
|
- *(TorrentFileList)* Reduce duplication in root directory unset logic ([#2027](https://github.com/torrentpier/torrentpier/pull/2027)) - ([d4d8210](https://github.com/torrentpier/torrentpier/commit/d4d82101dd67c9f4cd86e0f6f909495696974354))
|
||||||
- *(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))
|
## [v2.8.2](https://github.com/torrentpier/torrentpier/compare/v2.8.1..v2.8.2) (2025-06-30)
|
||||||
- *(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))
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- *(announcer)* Null `event` exception ([#1784](https://github.com/torrentpier/torrentpier/pull/1784)) - ([b06e327](https://github.com/torrentpier/torrentpier/commit/b06e327cbb285a676814699eb5fb1fbc0e1f22e8))
|
- *(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))
|
||||||
- *(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))
|
|
||||||
|
|
||||||
### 📦 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))
|
- Use `DEFAULT_CHARSET` constant instead of hardcoded string ([#2011](https://github.com/torrentpier/torrentpier/pull/2011)) - ([7ac3359](https://github.com/torrentpier/torrentpier/commit/7ac335974baa44a8575bebb71ae2fbc0902d10e7))
|
||||||
- *(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))
|
|
||||||
|
|
||||||
### 🗑️ Removed
|
|
||||||
|
|
||||||
- *(environment)* Extra `DB_CONNECTION` variable ([#1775](https://github.com/torrentpier/torrentpier/pull/1775)) - ([cd2786b](https://github.com/torrentpier/torrentpier/commit/cd2786bb69c74cec88a447f66750d014fc4d3612))
|
## [v2.8.1](https://github.com/torrentpier/torrentpier/compare/v2.8.0..v2.8.1) (2025-06-24)
|
||||||
- Some unused tracker config variables ([#1769](https://github.com/torrentpier/torrentpier/pull/1769)) - ([7f9df35](https://github.com/torrentpier/torrentpier/commit/7f9df35d3bd0e9d23284b8bd9c36a0f52158f5d7))
|
|
||||||
|
|
||||||
### 📚 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
|
### ⚙️ Miscellaneous
|
||||||
|
|
||||||
- *(cd workflow)* Fixed release body creation ([#1807](https://github.com/torrentpier/torrentpier/pull/1807)) - ([cc679a8](https://github.com/torrentpier/torrentpier/commit/cc679a80246f3ff65136653025d826bf1458db3a))
|
- Update minimum `PHP` requirement to `8.2` ([#1987](https://github.com/torrentpier/torrentpier/pull/1987)) - ([9b322c7](https://github.com/torrentpier/torrentpier/commit/9b322c7093a634669e9f17a32ac42500f44f2496))
|
||||||
- *(changelog workflow)* Minor improvements ([#1802](https://github.com/torrentpier/torrentpier/pull/1802)) - ([15ca21f](https://github.com/torrentpier/torrentpier/commit/15ca21f03840281f7d4402959aa8bfb7d407b45b))
|
- Removed useless `composer update` from workflows & installer ([#1986](https://github.com/torrentpier/torrentpier/pull/1986)) - ([423424e](https://github.com/torrentpier/torrentpier/commit/423424e9478e0772957014fb30f5e84158067af7))
|
||||||
- *(changelog workflow)* Some minor improvements ([#1801](https://github.com/torrentpier/torrentpier/pull/1801)) - ([2d53efc](https://github.com/torrentpier/torrentpier/commit/2d53efc945c7747be1755d0b66557a86bdc12cbd))
|
- Added --no-dev composer flag for some workflows ([#1982](https://github.com/torrentpier/torrentpier/pull/1982)) - ([e9a9e09](https://github.com/torrentpier/torrentpier/commit/e9a9e095768ba68aa5d5058a3e152ffaec916117))
|
||||||
- *(checksum workflow)* Fixed incorrect file path ([#1799](https://github.com/torrentpier/torrentpier/pull/1799)) - ([4eb5a9a](https://github.com/torrentpier/torrentpier/commit/4eb5a9adc61c4e116feb09208091efb914275da2))
|
- Added `--no-dev` composer flag for some workflows ([#1981](https://github.com/torrentpier/torrentpier/pull/1981)) - ([e8cba5d](https://github.com/torrentpier/torrentpier/commit/e8cba5dd3fc83b616f83c24991f79dc7258c5df3))
|
||||||
- *(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))
|
|
||||||
|
|
||||||
### ◀️ 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](https://github.com/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
91
README.md
91
README.md
|
@ -8,9 +8,8 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/torrentpier/torrentpier/blob/master/LICENSE"><img src="https://img.shields.io/github/license/torrentpier/torrentpier" alt="License"></a>
|
<a href="https://github.com/torrentpier/torrentpier/blob/master/LICENSE"><img src="https://img.shields.io/github/license/torrentpier/torrentpier" alt="License"></a>
|
||||||
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/stars/torrentpier/torrentpier" alt="Stars Packagist"></a>
|
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/stars/torrentpier/torrentpier" alt="Stars Packagist"></a>
|
||||||
<a href="https://github.com/torrentpier/torrentpier/actions"><img src="https://img.shields.io/github/actions/workflow/status/torrentpier/torrentpier/phpmd.yml" alt="Build status"></a>
|
|
||||||
<a href="https://crowdin.com/project/torrentpier"><img src="https://badges.crowdin.net/torrentpier/localized.svg" alt="Crowdin"></a>
|
<a href="https://crowdin.com/project/torrentpier"><img src="https://badges.crowdin.net/torrentpier/localized.svg" alt="Crowdin"></a>
|
||||||
<a href="https://nightly.link/torrentpier/torrentpier/workflows/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/dt/torrentpier/torrentpier" alt="Downloads"></a>
|
||||||
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/v/torrentpier/torrentpier" alt="Version"></a>
|
<a href="https://packagist.org/packages/torrentpier/torrentpier"><img src="https://img.shields.io/packagist/v/torrentpier/torrentpier" alt="Version"></a>
|
||||||
<a href="https://github.com/torrentpier/torrentpier/releases"><img src="https://img.shields.io/github/release-date/torrentpier/torrentpier" alt="Last release"></a>
|
<a href="https://github.com/torrentpier/torrentpier/releases"><img src="https://img.shields.io/github/release-date/torrentpier/torrentpier" alt="Last release"></a>
|
||||||
|
@ -20,18 +19,18 @@
|
||||||
|
|
||||||
## 🐂 About TorrentPier
|
## 🐂 About TorrentPier
|
||||||
|
|
||||||
TorrentPier — bull-powered BitTorrent Public/Private tracker engine, written in php. High speed, simple modification, high load
|
TorrentPier — bull-powered BitTorrent Public/Private tracker engine, written in PHP. High speed, simple modifications, load-balanced
|
||||||
architecture. In addition, we have very helpful
|
architecture. In addition, we have a very helpful
|
||||||
[official support forum](https://torrentpier.com), where it's possible to get any support and download modifications for engine.
|
[official support forum](https://torrentpier.com), where it's possible to get support and download modifications for the engine.
|
||||||
|
|
||||||
## 🌈 Current status
|
## 🌈 Current status
|
||||||
|
|
||||||
TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite existing to
|
TorrentPier is currently in active development. The goal is to remove all legacy code and rewrite the existing code to
|
||||||
modern standards. If you want to go deep on the code, check our [issues](https://github.com/torrentpier/torrentpier/issues)
|
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 into english in the near future, currently russian is the main language of it.
|
and go from there. The documentation will be translated to English in the near future, currently Russian is the main language.
|
||||||
|
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
* Rich forum browsing/moderation tools
|
* Rich forum with browsing/moderation tools
|
||||||
* High-load capable, heavily configurable announcer
|
* High-load capable, heavily configurable announcer
|
||||||
* Scrape support
|
* Scrape support
|
||||||
* FreeLeech
|
* FreeLeech
|
||||||
|
@ -39,11 +38,11 @@ and go from there. The documentation will be translated into english in the near
|
||||||
* BitTorrent v2 support
|
* BitTorrent v2 support
|
||||||
* Event-based invite system
|
* Event-based invite system
|
||||||
* Bonus points
|
* Bonus points
|
||||||
* Polls system
|
* Polling system
|
||||||
* PM system
|
* PM/DM system
|
||||||
* Multilingual support (Fully supported for now only Russia and English languages)
|
* Multilingual support (Russian and English are currently fully supported, with others in the future)
|
||||||
* Atom feeds
|
* Atom/RSS feeds
|
||||||
* ... and MUCH MORE!
|
* ... and so MUCH MORE!
|
||||||
|
|
||||||
## 🖥️ Demo
|
## 🖥️ Demo
|
||||||
|
|
||||||
|
@ -52,38 +51,38 @@ and go from there. The documentation will be translated into english in the near
|
||||||
* Password: `admin`
|
* Password: `admin`
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Demo is resetting every 24 hours!
|
> Demo resets every 24 hours!
|
||||||
|
|
||||||
## 🔧 Requirements
|
## 🔧 Requirements
|
||||||
|
|
||||||
* Apache / nginx / caddy
|
* Apache / nginx ([example config](install/nginx.conf)) / caddy ([example config](install/Caddyfile))
|
||||||
* MySQL 5.5.3 or above / MariaDB 10.0 or above / Percona
|
* MySQL 5.5.3 or above (including MySQL 8.0+) / MariaDB 10.0 or above / Percona
|
||||||
* PHP: 8.1 / 8.2 / 8.3
|
* PHP: 8.2 / 8.3 / 8.4
|
||||||
* PHP Extensions: mbstring, gd, bcmath, intl, tidy (optional), xml, xmlwriter
|
* PHP Extensions: mbstring, gd, bcmath, intl, tidy (optional), xml, xmlwriter
|
||||||
* Crontab (Recommended)
|
* Crontab (Recommended)
|
||||||
|
|
||||||
## 💾 Installation
|
## 💾 Installation
|
||||||
|
|
||||||
For installation, select one of installation variants below.
|
For the installation, select one of the installation variants below:
|
||||||
|
|
||||||
### Quick (Clean install) 🚀
|
### Quick (Clean install) 🚀
|
||||||
|
|
||||||
Check out our [autoinstall](https://github.com/torrentpier/autoinstall) repository with detailed instructions.
|
Check out our [autoinstall](https://github.com/torrentpier/autoinstall) repository with detailed instructions.
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!NOTE]
|
||||||
> Thanks to [Sergei Solovev](https://github.com/SeAnSolovev) for installation script ❤️
|
> Thanks to [Sergei Solovev](https://github.com/SeAnSolovev) for this installation script ❤️
|
||||||
|
|
||||||
### Quick (For web-panels) ☕️
|
### Quick (For web-panels) ☕️
|
||||||
|
|
||||||
1. Select the folder where you want to install TorrentPier
|
1. Select the folder where you want TorrentPier installed
|
||||||
```shell
|
```shell
|
||||||
cd /path/to/public_html
|
cd /path/to/public_html
|
||||||
```
|
```
|
||||||
2. Download latest version of TorrentPier
|
2. Download the latest version of TorrentPier
|
||||||
```shell
|
```shell
|
||||||
sudo git clone https://github.com/torrentpier/torrentpier.git .
|
sudo git clone https://github.com/torrentpier/torrentpier.git .
|
||||||
```
|
```
|
||||||
3. After, run command below and follow the given steps
|
3. After completing, execute the command below and follow the instructions
|
||||||
```shell
|
```shell
|
||||||
php install.php
|
php install.php
|
||||||
```
|
```
|
||||||
|
@ -92,46 +91,66 @@ Check out our [autoinstall](https://github.com/torrentpier/autoinstall) reposito
|
||||||
### Manual 🔩
|
### Manual 🔩
|
||||||
|
|
||||||
1. Install [Composer](https://getcomposer.org/)
|
1. Install [Composer](https://getcomposer.org/)
|
||||||
2. Run command below to create TorrentPier project
|
2. Run the following command to create the TorrentPier project
|
||||||
```shell
|
```shell
|
||||||
composer create-project torrentpier/torrentpier
|
composer create-project torrentpier/torrentpier
|
||||||
```
|
```
|
||||||
3. [Check our system requirements](#-requirements)
|
3. [Check our system requirements](#-requirements)
|
||||||
4. After, run command below on the project directory, to install Composer dependencies
|
4. After, run this command in the project directory to install Composer dependencies
|
||||||
```shell
|
```shell
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
5. Create database and import dump located at `install/sql/mysql.sql`
|
5. Edit database configuration settings in the environment (`.env.example`), after, rename to `.env`
|
||||||
6. 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:
|
7. Provide write permissions to the specified folders:
|
||||||
* `data/avatars`, `data/uploads`, `data/uploads/thumbs`
|
* `data/avatars`, `data/uploads`, `data/uploads/thumbs`
|
||||||
* `internal_data/atom`, `internal_data/cache`, `internal_data/log`, `internal_data/triggers`
|
* `internal_data/atom`, `internal_data/cache`, `internal_data/log`, `internal_data/triggers`
|
||||||
* `sitemap`
|
* `sitemap`
|
||||||
8. Voila! ✨
|
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]
|
> [!IMPORTANT]
|
||||||
> The specific settings depend on the server you are using, but in general case we recommend chmod **0755** for folders, and chmod **0644** for files in them.
|
> 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.
|
||||||
|
|
||||||
### Additional steps 👣
|
### Additional steps 👣
|
||||||
|
|
||||||
1. Edit this files:
|
1. Edit these files:
|
||||||
* `favicon.png` (change on your own)
|
* `favicon.png` (change to your own)
|
||||||
* `robots.txt` (change the addresses in lines `Host` and `Sitemap` on your own)
|
* `robots.txt` (change the addresses in lines `Host` and `Sitemap` to your own)
|
||||||
2. Log in to the forum with **admin/admin** login/password and finish setting up via admin panel
|
2. Log in to the forum using the **admin/admin** login/password, and finish setting up via admin panel. Don't forget to change your password!
|
||||||
|
|
||||||
## 🔐 Security vulnerabilities
|
## 🔐 Security vulnerabilities
|
||||||
|
|
||||||
If you discover a security vulnerability within TorrentPier, please follow our [security policy](https://github.com/torrentpier/torrentpier/security/policy), so we can address it promptly.
|
If you discover a security vulnerability within TorrentPier, please follow our [security policy](https://github.com/torrentpier/torrentpier/security/policy), so we can address it promptly.
|
||||||
|
|
||||||
|
## 🧪 Testing
|
||||||
|
|
||||||
|
TorrentPier includes a comprehensive testing suite built with **Pest PHP**. Run tests to ensure code quality and system reliability:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Run all tests
|
||||||
|
./vendor/bin/pest
|
||||||
|
|
||||||
|
# Run with coverage
|
||||||
|
./vendor/bin/pest --coverage
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed testing documentation, see [tests/README.md](tests/README.md).
|
||||||
|
|
||||||
## 📌 Our recommendations
|
## 📌 Our recommendations
|
||||||
|
|
||||||
* *The recommended way to run `cron.php`.* - For significant tracker speed increase may be required to replace built-in cron.php by operating system daemon.
|
* *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 local configuration file `library/config.local.php`.
|
* *Local configuration copy.* - You can override the settings using the local configuration file `library/config.local.php`.
|
||||||
|
|
||||||
## 💚 Contributing / Contributors
|
## 💚 Contributing / Contributors
|
||||||
|
|
||||||
Please read our [contributing policy](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) for details, and the process for
|
Please read 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
|
submitting pull requests to us. But we are always ready to review your pull-request for compliance with
|
||||||
these requirements. Just send it!
|
these requirements. Just send it!
|
||||||
|
|
||||||
<a href="https://github.com/torrentpier/torrentpier/graphs/contributors">
|
<a href="https://github.com/torrentpier/torrentpier/graphs/contributors">
|
||||||
|
|
1261
UPGRADE_GUIDE.md
Normal file
1261
UPGRADE_GUIDE.md
Normal file
File diff suppressed because it is too large
Load diff
57
_cleanup.php
Normal file
57
_cleanup.php
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2005-2025 TorrentPier (https://torrentpier.com)
|
||||||
|
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||||
|
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('BB_ROOT')) {
|
||||||
|
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
|
||||||
|
define('BB_PATH', BB_ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check CLI mode
|
||||||
|
if (PHP_SAPI != 'cli') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('removeFile')) {
|
||||||
|
// Get all constants
|
||||||
|
require_once BB_ROOT . 'library/defines.php';
|
||||||
|
|
||||||
|
// Include CLI functions
|
||||||
|
require INC_DIR . '/functions_cli.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = [
|
||||||
|
'.github',
|
||||||
|
'.cliffignore',
|
||||||
|
'.editorconfig',
|
||||||
|
'.gitignore',
|
||||||
|
'.styleci.yml',
|
||||||
|
'_release.php',
|
||||||
|
'CHANGELOG.md',
|
||||||
|
'CLAUDE.md',
|
||||||
|
'cliff.toml',
|
||||||
|
'CODE_OF_CONDUCT.md',
|
||||||
|
'CONTRIBUTING.md',
|
||||||
|
'crowdin.yml',
|
||||||
|
'HISTORY.md',
|
||||||
|
'phpunit.xml',
|
||||||
|
'README.md',
|
||||||
|
'SECURITY.md',
|
||||||
|
'tests',
|
||||||
|
'UPGRADE_GUIDE.md'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$path = BB_ROOT . $item;
|
||||||
|
|
||||||
|
if (is_file($path)) {
|
||||||
|
removeFile($path);
|
||||||
|
} elseif (is_dir($path)) {
|
||||||
|
removeDir($path);
|
||||||
|
}
|
||||||
|
}
|
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') {
|
if ($view === 'username') {
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'username':
|
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;
|
break;
|
||||||
case 'attachments':
|
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;
|
break;
|
||||||
case 'filesize':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
$mode = 'attachments';
|
$mode = 'attachments';
|
||||||
$sort_order = 'DESC';
|
$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;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($view === 'attachments') {
|
} elseif ($view === 'attachments') {
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'real_filename':
|
case 'real_filename':
|
||||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
case 'comment':
|
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;
|
break;
|
||||||
case 'extension':
|
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;
|
break;
|
||||||
case 'filesize':
|
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;
|
break;
|
||||||
case 'downloads':
|
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;
|
break;
|
||||||
case 'post_time':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
$mode = 'a.real_filename';
|
$mode = 'a.real_filename';
|
||||||
$sort_order = 'ASC';
|
$sort_order = 'ASC';
|
||||||
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
|
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,8 +470,8 @@ if ($view === 'attachments') {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Pagination
|
// Generate Pagination
|
||||||
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
|
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, $bb_cfg['topics_per_page'], $start);
|
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');
|
print_page('admin_attach_cp.tpl', 'admin');
|
||||||
|
|
|
@ -136,8 +136,8 @@ switch ($mode) {
|
||||||
'POSTS_PER_PAGE' => $new['posts_per_page'],
|
'POSTS_PER_PAGE' => $new['posts_per_page'],
|
||||||
'HOT_TOPIC' => $new['hot_threshold'],
|
'HOT_TOPIC' => $new['hot_threshold'],
|
||||||
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
|
'DEFAULT_DATEFORMAT' => $new['default_dateformat'],
|
||||||
'LANG_SELECT' => \TorrentPier\Legacy\Select::language($new['default_lang'], 'default_lang'),
|
'LANG_SELECT' => \TorrentPier\Legacy\Common\Select::language($new['default_lang'], 'default_lang'),
|
||||||
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($new['board_timezone'], 'board_timezone'),
|
'TIMEZONE_SELECT' => \TorrentPier\Legacy\Common\Select::timezone($new['board_timezone'], 'board_timezone'),
|
||||||
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
|
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
|
||||||
'LOGIN_RESET_TIME' => $new['login_reset_time'],
|
'LOGIN_RESET_TIME' => $new['login_reset_time'],
|
||||||
'PRUNE_ENABLE' => (bool)$new['prune_enable'],
|
'PRUNE_ENABLE' => (bool)$new['prune_enable'],
|
||||||
|
|
|
@ -123,6 +123,7 @@ if ($submit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
|
CACHE('bb_cache')->rm();
|
||||||
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="' . 'admin_forumauth.php' . '">', '</a>'));
|
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="' . 'admin_forumauth.php' . '">', '</a>'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ if ($submit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
|
CACHE('bb_cache')->rm();
|
||||||
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', '</a>'));
|
bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="admin_forumauth_list.php">', '</a>'));
|
||||||
} // End of submit
|
} // End of submit
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
|
||||||
$url = url_arg($url, $daysback_key, $daysback_val);
|
$url = url_arg($url, $daysback_key, $daysback_val);
|
||||||
}
|
}
|
||||||
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
|
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
|
||||||
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
|
$tz = TIMENOW + (3600 * config()->get('board_timezone'));
|
||||||
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
|
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
|
||||||
$datetime_val = $tmp_timestamp;
|
$datetime_val = $tmp_timestamp;
|
||||||
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
|
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
|
||||||
|
|
|
@ -14,7 +14,7 @@ if (!empty($setmodules)) {
|
||||||
|
|
||||||
require __DIR__ . '/pagestart.php';
|
require __DIR__ . '/pagestart.php';
|
||||||
|
|
||||||
if (!$bb_cfg['emailer']['enabled']) {
|
if (!config()->get('emailer.enabled')) {
|
||||||
bb_die($lang['EMAILER_DISABLED']);
|
bb_die($lang['EMAILER_DISABLED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ set_time_limit(1200);
|
||||||
$subject = trim(request_var('subject', ''));
|
$subject = trim(request_var('subject', ''));
|
||||||
$message = (string)request_var('message', '');
|
$message = (string)request_var('message', '');
|
||||||
$group_id = (int)request_var(POST_GROUPS_URL, 0);
|
$group_id = (int)request_var(POST_GROUPS_URL, 0);
|
||||||
$reply_to = (string)request_var('reply_to', $bb_cfg['board_email']);
|
$reply_to = (string)request_var('reply_to', config()->get('board_email'));
|
||||||
$message_type = (string)request_var('message_type', '');
|
$message_type = (string)request_var('message_type', '');
|
||||||
|
|
||||||
$errors = $user_id_sql = [];
|
$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 != '') {
|
||||||
if ($mode == 'edit' || $mode == 'add') {
|
if ($mode == 'edit' || $mode == 'add') {
|
||||||
//
|
//
|
||||||
|
@ -123,12 +127,14 @@ if ($mode != '') {
|
||||||
// Ok, they want to delete their rank
|
// Ok, they want to delete their rank
|
||||||
//
|
//
|
||||||
|
|
||||||
|
$confirmed = isset($_POST['confirm']);
|
||||||
if (isset($_POST['id']) || isset($_GET['id'])) {
|
if (isset($_POST['id']) || isset($_GET['id'])) {
|
||||||
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
|
$rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
|
||||||
} else {
|
} else {
|
||||||
$rank_id = 0;
|
$rank_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($confirmed) {
|
||||||
if ($rank_id) {
|
if ($rank_id) {
|
||||||
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
|
$sql = 'DELETE FROM ' . BB_RANKS . " WHERE rank_id = $rank_id";
|
||||||
|
|
||||||
|
@ -147,6 +153,15 @@ if ($mode != '') {
|
||||||
} else {
|
} else {
|
||||||
bb_die($lang['MUST_SELECT_RANK']);
|
bb_die($lang['MUST_SELECT_RANK']);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
||||||
|
$hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
|
||||||
|
|
||||||
|
print_confirmation([
|
||||||
|
'FORM_ACTION' => 'admin_ranks.php',
|
||||||
|
'HIDDEN_FIELDS' => $hidden_fields,
|
||||||
|
]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bb_die('Invalid mode');
|
bb_die('Invalid mode');
|
||||||
}
|
}
|
||||||
|
|
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';
|
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)) {
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
bb_die('Could not query config information in admin_sitemap');
|
bb_die('Could not query config information in admin_sitemap');
|
||||||
|
@ -39,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'];
|
$message = is_file(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
|
||||||
|
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
|
|
|
@ -22,7 +22,11 @@ if (isset($_POST['mode']) || isset($_GET['mode'])) {
|
||||||
$mode = '';
|
$mode = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$pathToSmilesDir = BB_ROOT . $bb_cfg['smilies_path'];
|
if ($mode == 'delete' && isset($_POST['cancel'])) {
|
||||||
|
$mode = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$pathToSmilesDir = BB_ROOT . config()->get('smilies_path');
|
||||||
$delimeter = '=+:';
|
$delimeter = '=+:';
|
||||||
$s_hidden_fields = '';
|
$s_hidden_fields = '';
|
||||||
$smiley_paks = $smiley_images = [];
|
$smiley_paks = $smiley_images = [];
|
||||||
|
@ -174,17 +178,28 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
|
||||||
} elseif ($mode != '') {
|
} elseif ($mode != '') {
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
$confirmed = isset($_POST['confirm']);
|
||||||
$smiley_id = (!empty($_POST['id'])) ? $_POST['id'] : $_GET['id'];
|
$smiley_id = (!empty($_POST['id'])) ? $_POST['id'] : $_GET['id'];
|
||||||
$smiley_id = (int)$smiley_id;
|
$smiley_id = (int)$smiley_id;
|
||||||
|
|
||||||
|
if ($confirmed) {
|
||||||
$sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id;
|
$sql = 'DELETE FROM ' . BB_SMILIES . ' WHERE smilies_id = ' . $smiley_id;
|
||||||
$result = DB()->sql_query($sql);
|
$result = DB()->sql_query($sql);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
bb_die('Could not delete smiley');
|
bb_die('Could not delete smiley');
|
||||||
}
|
}
|
||||||
$datastore->update('smile_replacements');
|
|
||||||
|
|
||||||
|
$datastore->update('smile_replacements');
|
||||||
bb_die($lang['SMILEY_DEL_SUCCESS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
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;
|
break;
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
|
|
|
@ -17,15 +17,15 @@ require INC_DIR . '/bbcode.php';
|
||||||
|
|
||||||
$preview = isset($_POST['preview']);
|
$preview = isset($_POST['preview']);
|
||||||
|
|
||||||
if (isset($_POST['post']) && ($bb_cfg['terms'] !== $_POST['message'])) {
|
if (isset($_POST['post']) && (config()->get('terms') !== $_POST['message'])) {
|
||||||
bb_update_config(['terms' => $_POST['message']]);
|
bb_update_config(['terms' => $_POST['message']]);
|
||||||
bb_die($lang['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([
|
$template->assign_vars([
|
||||||
'S_ACTION' => 'admin_terms.php',
|
'S_ACTION' => 'admin_terms.php',
|
||||||
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
|
'EXT_LINK_NW' => config()->get('ext_link_new_win'),
|
||||||
'MESSAGE' => $preview ? $_POST['message'] : $bb_cfg['terms'],
|
'MESSAGE' => $preview ? $_POST['message'] : config()->get('terms'),
|
||||||
'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '',
|
'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ $max_forum_name_length = 50;
|
||||||
$yes_sign = '√';
|
$yes_sign = '√';
|
||||||
$no_sign = 'x';
|
$no_sign = 'x';
|
||||||
|
|
||||||
$group_id = isset($_REQUEST['g']) ? (int)$_REQUEST['g'] : 0;
|
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0;
|
||||||
$user_id = isset($_REQUEST['u']) ? (int)$_REQUEST['u'] : 0;
|
$user_id = isset($_REQUEST[POST_USERS_URL]) ? (int)$_REQUEST[POST_USERS_URL] : 0;
|
||||||
$cat_id = isset($_REQUEST['c']) ? (int)$_REQUEST['c'] : 0;
|
$cat_id = isset($_REQUEST[POST_CAT_URL]) ? (int)$_REQUEST[POST_CAT_URL] : 0;
|
||||||
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
|
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
|
||||||
$submit = isset($_REQUEST['submit']);
|
$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",
|
'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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
|
||||||
'CAT_HREF' => "$base_url&" . POST_CAT_URL . "=$c_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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$language_list = \TorrentPier\Legacy\Select::language('', 'language_type');
|
$language_list = \TorrentPier\Legacy\Common\Select::language('', 'language_type');
|
||||||
$timezone_list = \TorrentPier\Legacy\Select::timezone('', 'timezone_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
|
$sql = 'SELECT f.forum_id, f.forum_name, f.forum_parent, c.cat_id, c.cat_title
|
||||||
FROM ( ' . BB_FORUMS . ' AS f INNER JOIN ' . BB_CATEGORIES . ' AS c ON c.cat_id = f.cat_id )
|
FROM ( ' . BB_FORUMS . ' AS f INNER JOIN ' . BB_CATEGORIES . ' AS c ON c.cat_id = f.cat_id )
|
||||||
|
@ -841,10 +841,10 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
if ($page == 1) {
|
if ($page == 1) {
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
} else {
|
} 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";
|
$select_sql .= " $limit";
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ if (!isset($_REQUEST['dosearch'])) {
|
||||||
bb_die($lang['SEARCH_NO_RESULTS']);
|
bb_die($lang['SEARCH_NO_RESULTS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
|
$num_pages = ceil($total_pages['total'] / config()->get('topics_per_page'));
|
||||||
|
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ if (!empty($setmodules)) {
|
||||||
|
|
||||||
require __DIR__ . '/pagestart.php';
|
require __DIR__ . '/pagestart.php';
|
||||||
|
|
||||||
if (!$bb_cfg['use_word_censor']) {
|
if (!config()->get('use_word_censor')) {
|
||||||
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
|
bb_die('Word censor disabled <br /><br /> (use_word_censor in config.php)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
|
@ -81,6 +81,7 @@ if ($mode != '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('censor');
|
$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>');
|
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
|
||||||
|
|
||||||
bb_die($message);
|
bb_die($message);
|
||||||
|
@ -95,6 +96,7 @@ if ($mode != '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
$datastore->update('censor');
|
$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>'));
|
bb_die($lang['WORD_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_WORDADMIN'], '<a href="admin_words.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,12 +15,6 @@ if (!$stats = $datastore->get('stats')) {
|
||||||
$stats = $datastore->get('stats');
|
$stats = $datastore->get('stats');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Files integrity check
|
|
||||||
if (!$files_integrity_data = $datastore->get('files_integrity')) {
|
|
||||||
$datastore->update('files_integrity');
|
|
||||||
$files_integrity_data = $datastore->get('files_integrity');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for updates
|
// Check for updates
|
||||||
if (!$update_data = $datastore->get('check_updates')) {
|
if (!$update_data = $datastore->get('check_updates')) {
|
||||||
$datastore->update('check_updates');
|
$datastore->update('check_updates');
|
||||||
|
@ -84,20 +78,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
|
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
'TPL_ADMIN_MAIN' => true,
|
'TPL_ADMIN_MAIN' => true,
|
||||||
'ADMIN_LOCK' => (bool)$bb_cfg['board_disable'],
|
'ADMIN_LOCK' => (bool)config()->get('board_disable'),
|
||||||
'ADMIN_LOCK_CRON' => is_file(BB_DISABLED),
|
'ADMIN_LOCK_CRON' => is_file(BB_DISABLED),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Files integrity check results
|
|
||||||
if (!empty($files_integrity_data)) {
|
|
||||||
$template->assign_block_vars('integrity_check', [
|
|
||||||
'INTEGRITY_SUCCESS' => (bool)$files_integrity_data['success'],
|
|
||||||
'INTEGRITY_WRONG_FILES_LIST' => implode("\n</li>\n<li>\n", $files_integrity_data['wrong_files']),
|
|
||||||
'INTEGRITY_LAST_CHECK_TIME' => sprintf($lang['INTEGRITY_LAST_CHECK'], bb_date($files_integrity_data['timestamp'])),
|
|
||||||
'INTEGRITY_CHECKED_FILES' => sprintf($lang['INTEGRITY_CHECKED'], $files_integrity_data['total_num'], ($files_integrity_data['total_num'] - $files_integrity_data['wrong_files_num'])),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for updates
|
// Check for updates
|
||||||
if (isset($update_data['available_update'])) {
|
if (isset($update_data['available_update'])) {
|
||||||
$template->assign_block_vars('updater', [
|
$template->assign_block_vars('updater', [
|
||||||
|
@ -106,7 +90,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
'NEW_VERSION_SIZE' => $update_data['latest_version_size'],
|
'NEW_VERSION_SIZE' => $update_data['latest_version_size'],
|
||||||
'NEW_VERSION_DL_LINK' => $update_data['latest_version_dl_link'],
|
'NEW_VERSION_DL_LINK' => $update_data['latest_version_dl_link'],
|
||||||
'NEW_VERSION_LINK' => $update_data['latest_version_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']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +98,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
$total_posts = $stats['postcount'];
|
$total_posts = $stats['postcount'];
|
||||||
$total_topics = $stats['topiccount'];
|
$total_topics = $stats['topiccount'];
|
||||||
$total_users = $stats['usercount'];
|
$total_users = $stats['usercount'];
|
||||||
$start_date = bb_date($bb_cfg['board_startdate']);
|
$start_date = bb_date(config()->get('board_startdate'));
|
||||||
$boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400;
|
$boarddays = (TIMENOW - config()->get('board_startdate')) / 86400;
|
||||||
|
|
||||||
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
||||||
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
||||||
|
@ -123,10 +107,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
|
|
||||||
$avatar_dir_size = 0;
|
$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)) {
|
while ($file = readdir($avatar_dir)) {
|
||||||
if ($file != '.' && $file != '..') {
|
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);
|
closedir($avatar_dir);
|
||||||
|
@ -203,7 +187,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'd-M-Y H:i', false),
|
'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),
|
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'd-M-Y H:i', false),
|
||||||
'IP_ADDRESS' => $reg_ip,
|
'IP_ADDRESS' => $reg_ip,
|
||||||
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
|
'U_WHOIS_IP' => config()->get('whois_info') . $reg_ip,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +206,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
||||||
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'd-M-Y H:i', false),
|
'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),
|
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'd-M-Y H:i', false),
|
||||||
'IP_ADDRESS' => $guest_ip,
|
'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">';
|
echo '<br /><br /><table border="1" cellspacing="0" cellpadding="6" align="center">';
|
||||||
|
|
||||||
foreach ($sql as $i => $query) {
|
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;
|
$row = ($i == 2) ? humn_size($row) : $row;
|
||||||
echo "<tr><td>{$lang['TR_STATS'][$i]}</td><td><b>$row</b></td>";
|
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 '</table>';
|
||||||
echo '<div align="center"><pre>';
|
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 '</pre></div>';
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!IS_ADMIN) {
|
||||||
$peers_in_last_minutes = [30, 15, 5, 1];
|
$peers_in_last_minutes = [30, 15, 5, 1];
|
||||||
$peers_in_last_sec_limit = 300;
|
$peers_in_last_sec_limit = 300;
|
||||||
|
|
||||||
$announce_interval = (int)$bb_cfg['announce_interval'];
|
$announce_interval = (int)config()->get('announce_interval');
|
||||||
$stat = [];
|
$stat = [];
|
||||||
|
|
||||||
define('TMP_TRACKER_TABLE', 'tmp_tracker');
|
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 !$client_full ? '<p style = "text-align:right;">Simple stats for clients are being cached for one hour.</p>' : '';
|
||||||
echo '<div align="center"><pre>';
|
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 '</pre></div>';
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
|
|
||||||
|
|
2
ajax.php
2
ajax.php
|
@ -41,5 +41,5 @@ $ajax->exec();
|
||||||
/**
|
/**
|
||||||
* @deprecated ajax_common
|
* @deprecated ajax_common
|
||||||
* Dirty class removed from here since 2.2.0
|
* Dirty class removed from here since 2.2.0
|
||||||
* To add new actions see at src/Legacy/Ajax.php
|
* To add new actions see at src/Ajax.php
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,15 +11,15 @@ define('IN_TRACKER', true);
|
||||||
define('BB_ROOT', './../');
|
define('BB_ROOT', './../');
|
||||||
require dirname(__DIR__) . '/common.php';
|
require dirname(__DIR__) . '/common.php';
|
||||||
|
|
||||||
global $bb_cfg;
|
// Check User-Agent for existence
|
||||||
|
$userAgent = (string)$_SERVER['HTTP_USER_AGENT'];
|
||||||
if (empty($_SERVER['HTTP_USER_AGENT'])) {
|
if (empty($userAgent)) {
|
||||||
header('Location: http://127.0.0.1', true, 301);
|
header('Location: http://127.0.0.1', true, 301);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
$announce_interval = $bb_cfg['announce_interval'];
|
$announce_interval = config()->get('announce_interval');
|
||||||
$passkey_key = $bb_cfg['passkey_key'];
|
$passkey_key = config()->get('passkey_key');
|
||||||
|
|
||||||
// Recover info_hash
|
// Recover info_hash
|
||||||
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
|
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
|
||||||
|
@ -65,10 +65,10 @@ if (strlen($peer_id) !== 20) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for client ban
|
// Check for client ban
|
||||||
if ($bb_cfg['client_ban']['enabled']) {
|
if (config()->get('client_ban.enabled')) {
|
||||||
$targetClient = [];
|
$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)) {
|
if (str_starts_with($peer_id, $clientId)) {
|
||||||
$targetClient = [
|
$targetClient = [
|
||||||
'peer_id' => $clientId,
|
'peer_id' => $clientId,
|
||||||
|
@ -78,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'])) {
|
if (empty($targetClient['peer_id'])) {
|
||||||
msg_die('Your BitTorrent client has been banned!');
|
msg_die('Your BitTorrent client has been banned!');
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ $stopped = ($event === 'stopped');
|
||||||
|
|
||||||
// Check info_hash length
|
// Check info_hash length
|
||||||
if (strlen($info_hash) !== 20) {
|
if (strlen($info_hash) !== 20) {
|
||||||
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, 'UTF8') ? $info_hash : $info_hash_hex));
|
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, DEFAULT_CHARSET) ? $info_hash : $info_hash_hex));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +129,7 @@ if (
|
||||||
|| !is_numeric($port)
|
|| !is_numeric($port)
|
||||||
|| ($port < 1024 && !$stopped)
|
|| ($port < 1024 && !$stopped)
|
||||||
|| $port > 0xFFFF
|
|| $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);
|
msg_die('Invalid port: ' . $port);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,6 @@ if (!isset($left) || !is_numeric($left) || $left < 0) {
|
||||||
*
|
*
|
||||||
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L177
|
* @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L177
|
||||||
*/
|
*/
|
||||||
$userAgent = (string)$_SERVER['HTTP_USER_AGENT'];
|
|
||||||
if (strlen($userAgent) > 64) {
|
if (strlen($userAgent) > 64) {
|
||||||
msg_die('User-Agent must be less than 64 characters long');
|
msg_die('User-Agent must be less than 64 characters long');
|
||||||
}
|
}
|
||||||
|
@ -169,13 +168,13 @@ if (preg_match('/(Mozilla|Browser|Chrome|Safari|AppleWebKit|Opera|Links|Lynx|Bot
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
// 'ip' query handling
|
// 'ip' query handling
|
||||||
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
if (!config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
||||||
if (!$bb_cfg['verify_reported_ip'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
if (!config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
|
||||||
if ($x_ip === $_GET['ip']) {
|
if ($x_ip === $_GET['ip']) {
|
||||||
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_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;
|
$ip = $filteredIp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,9 +246,10 @@ if ($lp_info) {
|
||||||
$passkey_sql = DB()->escape($passkey);
|
$passkey_sql = DB()->escape($passkey);
|
||||||
|
|
||||||
$sql = "
|
$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
|
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
|
$info_hash_where
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
";
|
";
|
||||||
|
@ -257,7 +257,7 @@ if ($lp_info) {
|
||||||
|
|
||||||
// Verify if torrent registered on tracker and user authorized
|
// Verify if torrent registered on tracker and user authorized
|
||||||
if (empty($row['topic_id'])) {
|
if (empty($row['topic_id'])) {
|
||||||
msg_die('Torrent not registered, info_hash = ' . (mb_check_encoding($info_hash, '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'])) {
|
if (empty($row['user_id'])) {
|
||||||
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
|
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
|
||||||
|
@ -265,13 +265,26 @@ if ($lp_info) {
|
||||||
|
|
||||||
// Assign variables
|
// Assign variables
|
||||||
$user_id = $row['user_id'];
|
$user_id = $row['user_id'];
|
||||||
|
define('IS_GUEST', (int)$user_id === GUEST_UID);
|
||||||
|
define('IS_ADMIN', !IS_GUEST && (int)$row['user_level'] === ADMIN);
|
||||||
|
define('IS_MOD', !IS_GUEST && (int)$row['user_level'] === MOD);
|
||||||
|
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$row['user_level'] === GROUP_MEMBER);
|
||||||
|
define('IS_USER', !IS_GUEST && (int)$row['user_level'] === USER);
|
||||||
|
define('IS_SUPER_ADMIN', IS_ADMIN && isset(config()->get('super_admins')[$user_id]));
|
||||||
|
define('IS_AM', IS_ADMIN || IS_MOD);
|
||||||
$topic_id = $row['topic_id'];
|
$topic_id = $row['topic_id'];
|
||||||
$releaser = (int)($user_id == $row['poster_id']);
|
$releaser = (int)($user_id == $row['poster_id']);
|
||||||
$tor_type = $row['tor_type'];
|
$tor_type = $row['tor_type'];
|
||||||
|
$tor_status = $row['tor_status'];
|
||||||
|
|
||||||
|
// Check tor status
|
||||||
|
if (!IS_AM && isset(config()->get('tor_frozen')[$tor_status]) && !(isset(config()->get('tor_frozen_author_download')[$tor_status]) && $releaser)) {
|
||||||
|
msg_die('Torrent frozen and cannot be downloaded');
|
||||||
|
}
|
||||||
|
|
||||||
// Check hybrid status
|
// Check hybrid status
|
||||||
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
|
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
|
||||||
$stat_protocol = match ((int)$bb_cfg['tracker']['hybrid_stat_protocol']) {
|
$stat_protocol = match ((int)config()->get('tracker.hybrid_stat_protocol')) {
|
||||||
2 => substr($row['info_hash_v2'], 0, 20),
|
2 => substr($row['info_hash_v2'], 0, 20),
|
||||||
default => $row['info_hash'] // 1
|
default => $row['info_hash'] // 1
|
||||||
};
|
};
|
||||||
|
@ -281,7 +294,7 @@ if ($lp_info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ratio limits
|
// 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);
|
$user_ratio = get_bt_ratio($row);
|
||||||
if ($user_ratio === null) {
|
if ($user_ratio === null) {
|
||||||
$user_ratio = 1;
|
$user_ratio = 1;
|
||||||
|
@ -289,10 +302,10 @@ if ($lp_info) {
|
||||||
$rating_msg = '';
|
$rating_msg = '';
|
||||||
|
|
||||||
if (!$seeder) {
|
if (!$seeder) {
|
||||||
foreach ($bb_cfg['rating'] as $ratio => $limit) {
|
foreach (config()->get('rating') as $ratio => $limit) {
|
||||||
if ($user_ratio < $ratio) {
|
if ($user_ratio < $ratio) {
|
||||||
$bb_cfg['tracker']['limit_active_tor'] = 1;
|
config()->set('tracker.limit_active_tor', 1);
|
||||||
$bb_cfg['tracker']['limit_leech_count'] = $limit;
|
config()->set('tracker.limit_leech_count', $limit);
|
||||||
$rating_msg = " (ratio < $ratio)";
|
$rating_msg = " (ratio < $ratio)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -300,29 +313,29 @@ if ($lp_info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit active torrents
|
// 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
|
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
|
||||||
FROM " . BB_BT_TRACKER . "
|
FROM " . BB_BT_TRACKER . "
|
||||||
WHERE user_id = $user_id
|
WHERE user_id = $user_id
|
||||||
AND seeder = $seeder
|
AND seeder = $seeder
|
||||||
AND topic_id != $topic_id";
|
AND topic_id != $topic_id";
|
||||||
|
|
||||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor'] && $user_ratio < 0.5) {
|
if (!$seeder && config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
|
||||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY user_id";
|
$sql .= " GROUP BY user_id";
|
||||||
|
|
||||||
if ($row = DB()->fetch_row($sql)) {
|
if ($row = DB()->fetch_row($sql)) {
|
||||||
if ($seeder && $bb_cfg['tracker']['limit_seed_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_seed_count']) {
|
if ($seeder && config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= config()->get('tracker.limit_seed_count')) {
|
||||||
msg_die('Only ' . $bb_cfg['tracker']['limit_seed_count'] . ' torrent(s) allowed for seeding');
|
msg_die('Only ' . config()->get('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']) {
|
} elseif (!$seeder && config()->get('tracker.limit_leech_count') && $row['active_torrents'] >= config()->get('tracker.limit_leech_count')) {
|
||||||
msg_die('Only ' . $bb_cfg['tracker']['limit_leech_count'] . ' torrent(s) allowed for leeching' . $rating_msg);
|
msg_die('Only ' . config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit concurrent IPs
|
// 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
|
$sql = "SELECT COUNT(DISTINCT ip) AS ips
|
||||||
FROM " . BB_BT_TRACKER . "
|
FROM " . BB_BT_TRACKER . "
|
||||||
WHERE topic_id = $topic_id
|
WHERE topic_id = $topic_id
|
||||||
|
@ -330,16 +343,16 @@ if ($lp_info) {
|
||||||
AND seeder = $seeder
|
AND seeder = $seeder
|
||||||
AND $ip_version != '$ip_sql'";
|
AND $ip_version != '$ip_sql'";
|
||||||
|
|
||||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor']) {
|
if (!$seeder && config()->get('tracker.leech_expire_factor')) {
|
||||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY topic_id";
|
$sql .= " GROUP BY topic_id";
|
||||||
|
|
||||||
if ($row = DB()->fetch_row($sql)) {
|
if ($row = DB()->fetch_row($sql)) {
|
||||||
if ($seeder && $bb_cfg['tracker']['limit_seed_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_seed_ips']) {
|
if ($seeder && config()->get('tracker.limit_seed_ips') && $row['ips'] >= config()->get('tracker.limit_seed_ips')) {
|
||||||
msg_die('You can seed only from ' . $bb_cfg['tracker']['limit_seed_ips'] . " IP's");
|
msg_die('You can seed only from ' . config()->get('tracker.limit_seed_ips') . " IP's");
|
||||||
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_leech_ips']) {
|
} elseif (!$seeder && config()->get('tracker.limit_leech_ips') && $row['ips'] >= config()->get('tracker.limit_leech_ips')) {
|
||||||
msg_die('You can leech only from ' . $bb_cfg['tracker']['limit_leech_ips'] . " IP's");
|
msg_die('You can leech only from ' . config()->get('tracker.limit_leech_ips') . " IP's");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,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;
|
$down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0;
|
||||||
|
|
||||||
// Gold/Silver releases
|
// 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) {
|
if ($tor_type == TOR_TYPE_GOLD) {
|
||||||
$down_add = 0;
|
$down_add = 0;
|
||||||
} // Silver releases
|
} // Silver releases
|
||||||
|
@ -373,7 +386,7 @@ if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Freeleech
|
// Freeleech
|
||||||
if ($bb_cfg['tracker']['freeleech'] && $down_add) {
|
if (config()->get('tracker.freeleech') && $down_add) {
|
||||||
$down_add = 0;
|
$down_add = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,8 +464,8 @@ $output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
|
||||||
|
|
||||||
if (!$output) {
|
if (!$output) {
|
||||||
// Retrieve peers
|
// Retrieve peers
|
||||||
$numwant = (int)$bb_cfg['tracker']['numwant'];
|
$numwant = (int)config()->get('tracker.numwant');
|
||||||
$compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
|
$compact_mode = (config()->get('tracker.compact_mode') || !empty($compact));
|
||||||
|
|
||||||
$rowset = DB()->fetch_rowset("
|
$rowset = DB()->fetch_rowset("
|
||||||
SELECT ip, ipv6, port
|
SELECT ip, ipv6, port
|
||||||
|
@ -497,7 +510,7 @@ if (!$output) {
|
||||||
|
|
||||||
$seeders = $leechers = $client_completed = 0;
|
$seeders = $leechers = $client_completed = 0;
|
||||||
|
|
||||||
if ($bb_cfg['tracker']['scrape']) {
|
if (config()->get('tracker.scrape')) {
|
||||||
$row = DB()->fetch_row("
|
$row = DB()->fetch_row("
|
||||||
SELECT seeders, leechers, completed
|
SELECT seeders, leechers, completed
|
||||||
FROM " . BB_BT_TRACKER_SNAP . "
|
FROM " . BB_BT_TRACKER_SNAP . "
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
|
@ -11,11 +11,9 @@ if (!defined('IN_TRACKER')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
// Exit if tracker is disabled
|
// Exit if tracker is disabled
|
||||||
if ($bb_cfg['tracker']['bt_off']) {
|
if (config()->get('tracker.bt_off')) {
|
||||||
msg_die($bb_cfg['tracker']['bt_off_reason']);
|
msg_die(config()->get('tracker.bt_off_reason'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -11,9 +11,7 @@ define('IN_TRACKER', true);
|
||||||
define('BB_ROOT', './../');
|
define('BB_ROOT', './../');
|
||||||
require dirname(__DIR__) . '/common.php';
|
require dirname(__DIR__) . '/common.php';
|
||||||
|
|
||||||
global $bb_cfg;
|
if (!config()->get('tracker.scrape')) {
|
||||||
|
|
||||||
if (!$bb_cfg['tracker']['scrape']) {
|
|
||||||
msg_die('Please disable SCRAPE!');
|
msg_die('Please disable SCRAPE!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +32,7 @@ $info_hash_hex = bin2hex($info_hash);
|
||||||
|
|
||||||
// Check info_hash length
|
// Check info_hash length
|
||||||
if (strlen($info_hash) !== 20) {
|
if (strlen($info_hash) !== 20) {
|
||||||
msg_die('Invalid info_hash: ' . (mb_check_encoding($info_hash, '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
|
// Handle multiple hashes
|
||||||
|
@ -60,8 +58,8 @@ foreach ($info_hash_array[1] as $hash) {
|
||||||
$info_hash_count = count($info_hashes);
|
$info_hash_count = count($info_hashes);
|
||||||
|
|
||||||
if (!empty($info_hash_count)) {
|
if (!empty($info_hash_count)) {
|
||||||
if ($info_hash_count > $bb_cfg['max_scrapes']) {
|
if ($info_hash_count > config()->get('max_scrapes')) {
|
||||||
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
|
$info_hashes = array_slice($info_hashes, 0, config()->get('max_scrapes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$info_hashes_sql = implode('\', \'', $info_hashes);
|
$info_hashes_sql = implode('\', \'', $info_hashes);
|
||||||
|
@ -99,7 +97,7 @@ if (!empty($info_hash_count)) {
|
||||||
|
|
||||||
// Verify if torrent registered on tracker
|
// Verify if torrent registered on tracker
|
||||||
if (empty($torrents)) {
|
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));
|
die(\Arokettu\Bencode\Bencode::encode($torrents));
|
||||||
|
|
13
cliff.toml
13
cliff.toml
|
@ -14,8 +14,6 @@ repo = "torrentpier"
|
||||||
header = """
|
header = """
|
||||||
[](https://github.com/torrentpier)\n
|
[](https://github.com/torrentpier)\n
|
||||||
# 📖 Change Log\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
|
# template for the changelog body
|
||||||
# https://keats.github.io/tera/docs/#introduction
|
# https://keats.github.io/tera/docs/#introduction
|
||||||
|
@ -25,7 +23,7 @@ body = """
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro nightly_url() -%}
|
{%- 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 -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{% macro print_commit(commit) -%}
|
{% macro print_commit(commit) -%}
|
||||||
|
@ -64,16 +62,17 @@ body = """
|
||||||
## New Contributors ❤️
|
## New Contributors ❤️
|
||||||
{% endif %}\
|
{% endif %}\
|
||||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
||||||
* [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) made their first contribution
|
* @{{ contributor.username }} made their first contribution
|
||||||
{%- if contributor.pr_number %} in \
|
{%- if contributor.pr_number %} in \
|
||||||
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
|
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# template for the changelog footer
|
# template for the changelog footer
|
||||||
footer = """
|
footer = """
|
||||||
<!-- generated by git-cliff -->
|
|
||||||
"""
|
"""
|
||||||
# remove the leading and trailing whitespace from the templates
|
# remove the leading and trailing whitespace from the templates
|
||||||
trim = true
|
trim = true
|
||||||
|
@ -106,11 +105,11 @@ commit_parsers = [
|
||||||
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
||||||
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
||||||
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
||||||
{ message = "^ignore|^release", skip = true },
|
{ message = "^ignore|^release|^changelog", skip = true },
|
||||||
{ message = "^chore|^ci|^misc", group = "<!-- 7 -->⚙️ Miscellaneous" },
|
{ message = "^chore|^ci|^misc", group = "<!-- 7 -->⚙️ Miscellaneous" },
|
||||||
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
||||||
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
{ 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 = "^Composer", group = "<!-- 11 -->📦 Dependencies" }, # dependabot pulls supporting
|
||||||
{ message = "^rem|^drop|^removed", group = "<!-- 12 -->🗑️ Removed" },
|
{ message = "^rem|^drop|^removed", group = "<!-- 12 -->🗑️ Removed" },
|
||||||
{ message = ".*", group = "<!-- 13 -->💼 Other" },
|
{ 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';
|
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
|
* Initialize debug
|
||||||
*/
|
*/
|
||||||
define('APP_ENV', env('APP_ENV', 'production'));
|
define('APP_ENV', env('APP_ENV', 'production'));
|
||||||
if (APP_ENV === 'local') {
|
if (APP_ENV === 'development') {
|
||||||
define('DBG_USER', true); // forced debug
|
define('DBG_USER', true); // forced debug
|
||||||
} else {
|
} else {
|
||||||
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
||||||
}
|
}
|
||||||
(new \TorrentPier\Dev());
|
(\TorrentPier\Dev::init());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server variables initialize
|
* Server variables initialize
|
||||||
*/
|
*/
|
||||||
$server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
|
$server_protocol = config()->get('cookie_secure') ? 'https://' : 'http://';
|
||||||
$server_port = in_array((int)$bb_cfg['server_port'], [80, 443], true) ? '' : ':' . $bb_cfg['server_port'];
|
$server_port = in_array((int)config()->get('server_port'), [80, 443], true) ? '' : ':' . config()->get('server_port');
|
||||||
define('FORUM_PATH', $bb_cfg['script_path']);
|
define('FORUM_PATH', config()->get('script_path'));
|
||||||
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
|
define('FULL_URL', $server_protocol . config()->get('server_name') . $server_port . config()->get('script_path'));
|
||||||
unset($server_protocol, $server_port);
|
unset($server_protocol, $server_port);
|
||||||
|
|
||||||
/**
|
// Initialize the new DB factory with database configuration
|
||||||
* Database
|
TorrentPier\Database\DatabaseFactory::init(config()->get('db'), config()->get('db_alias', []));
|
||||||
*/
|
|
||||||
$DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
|
|
||||||
|
|
||||||
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 TorrentPier\Database\DatabaseFactory::getInstance($db_alias);
|
||||||
return $DBS->get_db_obj($db_alias);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Initialize Unified Cache System
|
||||||
* Cache
|
TorrentPier\Cache\UnifiedCacheSystem::getInstance(config()->all());
|
||||||
*/
|
|
||||||
$CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
|
|
||||||
|
|
||||||
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 TorrentPier\Cache\UnifiedCacheSystem::getInstance()->get_cache_obj($cache_name);
|
||||||
return $CACHES->get_cache_obj($cache_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Datastore
|
* Get datastore manager instance (replaces legacy datastore system)
|
||||||
|
*
|
||||||
|
* @return \TorrentPier\Cache\DatastoreManager
|
||||||
*/
|
*/
|
||||||
switch ($bb_cfg['datastore_type']) {
|
function datastore(): \TorrentPier\Cache\DatastoreManager
|
||||||
case 'apcu':
|
{
|
||||||
$datastore = new TorrentPier\Legacy\Datastore\APCu($bb_cfg['cache']['prefix']);
|
return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->getDatastore(config()->get('datastore_type', 'file'));
|
||||||
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']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backward compatibility: Global datastore variable
|
||||||
|
* This allows existing code to continue using global $datastore
|
||||||
|
*/
|
||||||
|
$datastore = datastore();
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
function utime()
|
function utime()
|
||||||
{
|
{
|
||||||
|
@ -364,9 +433,9 @@ if (!defined('IN_TRACKER')) {
|
||||||
} else {
|
} else {
|
||||||
define('DUMMY_PEER', pack('Nn', \TorrentPier\Helpers\IPHelper::ip2long($_SERVER['REMOTE_ADDR']), !empty($_GET['port']) ? (int)$_GET['port'] : random_int(1000, 65000)));
|
define('DUMMY_PEER', pack('Nn', \TorrentPier\Helpers\IPHelper::ip2long($_SERVER['REMOTE_ADDR']), !empty($_GET['port']) ? (int)$_GET['port'] : random_int(1000, 65000)));
|
||||||
|
|
||||||
define('PEER_HASH_EXPIRE', round($bb_cfg['announce_interval'] * (0.85 * $bb_cfg['tracker']['expire_factor'])));
|
define('PEER_HASH_EXPIRE', round(config()->get('announce_interval') * (0.85 * config()->get('tracker.expire_factor'))));
|
||||||
define('PEERS_LIST_EXPIRE', round($bb_cfg['announce_interval'] * 0.7));
|
define('PEERS_LIST_EXPIRE', round(config()->get('announce_interval') * 0.7));
|
||||||
define('SCRAPE_LIST_EXPIRE', round($bb_cfg['scrape_interval'] * 0.7));
|
define('SCRAPE_LIST_EXPIRE', round(config()->get('scrape_interval') * 0.7));
|
||||||
|
|
||||||
define('PEER_HASH_PREFIX', 'peer_');
|
define('PEER_HASH_PREFIX', 'peer_');
|
||||||
define('PEERS_LIST_PREFIX', 'peers_list_');
|
define('PEERS_LIST_PREFIX', 'peers_list_');
|
||||||
|
|
|
@ -46,51 +46,57 @@
|
||||||
"forum": "https://torrentpier.com"
|
"forum": "https://torrentpier.com"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1 | ^8.2 | ^8.3 | ^8.4",
|
"php": ">=8.2",
|
||||||
"arokettu/random-polyfill": "1.0.2",
|
|
||||||
"arokettu/bencode": "^4.1.0",
|
"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",
|
"arokettu/torrent-file": "^5.2.1",
|
||||||
|
"belomaxorka/captcha": "1.*",
|
||||||
"bugsnag/bugsnag": "^v3.29.1",
|
"bugsnag/bugsnag": "^v3.29.1",
|
||||||
"claviska/simpleimage": "^4.0",
|
"claviska/simpleimage": "^4.0",
|
||||||
"egulias/email-validator": "^4.0.1",
|
"egulias/email-validator": "^4.0.1",
|
||||||
"filp/whoops": "^2.15",
|
"filp/whoops": "^2.15",
|
||||||
"z4kn4fein/php-semver": "^v3.0.0",
|
"gemorroj/m3u-parser": "^6.0.1",
|
||||||
"nemorize/indexnow": "^0.0.1",
|
|
||||||
"gigablah/sphinxphp": "2.0.8",
|
"gigablah/sphinxphp": "2.0.8",
|
||||||
"google/recaptcha": "^1.3",
|
"google/recaptcha": "^1.3",
|
||||||
"jacklul/monolog-telegram": "^3.1",
|
"jacklul/monolog-telegram": "^3.1",
|
||||||
"josantonius/cookie": "^2.0",
|
"josantonius/cookie": "^2.0",
|
||||||
"gemorroj/m3u-parser": "dev-master",
|
|
||||||
"php-curl-class/php-curl-class": "^11.0.0",
|
|
||||||
"league/flysystem": "^3.28",
|
"league/flysystem": "^3.28",
|
||||||
"longman/ip-tools": "1.2.1",
|
"longman/ip-tools": "1.2.1",
|
||||||
"matthiasmullie/scrapbook": "^1.5.4",
|
|
||||||
"monolog/monolog": "^3.4",
|
"monolog/monolog": "^3.4",
|
||||||
|
"nette/caching": "^3.3",
|
||||||
|
"nette/database": "^3.2",
|
||||||
|
"php-curl-class/php-curl-class": "^12.0.0",
|
||||||
|
"robmorgan/phinx": "^0.16.9",
|
||||||
"samdark/sitemap": "2.4.1",
|
"samdark/sitemap": "2.4.1",
|
||||||
"symfony/finder": "^6.4",
|
"symfony/mailer": "^7.3",
|
||||||
"symfony/filesystem": "^6.4",
|
"symfony/polyfill": "v1.32.0",
|
||||||
"symfony/event-dispatcher": "^6.4",
|
"vlucas/phpdotenv": "^5.5",
|
||||||
"symfony/mime": "^6.4",
|
"z4kn4fein/php-semver": "^v3.0.0"
|
||||||
"symfony/mailer": "^6.4",
|
|
||||||
"symfony/polyfill": "v1.31.0",
|
|
||||||
"vlucas/phpdotenv": "^5.5"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/var-dumper": "^6.4"
|
"mockery/mockery": "^1.6",
|
||||||
|
"pestphp/pest": "^3.8",
|
||||||
|
"symfony/var-dumper": "^7.3"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"TorrentPier\\": "src/"
|
"TorrentPier\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"sort-packages": true,
|
"sort-packages": true,
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
"php-http/discovery": true
|
"php-http/discovery": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "stable",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
}
|
}
|
||||||
|
|
4710
composer.lock
generated
4710
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,3 +0,0 @@
|
||||||
php_flag engine off
|
|
||||||
RemoveHandler .php .php5 .php4 .php3 .phtml .pl .asp
|
|
||||||
AddType text/plain .php .php .htm .html .phtml .pl .asp
|
|
6
dl.php
6
dl.php
|
@ -25,7 +25,7 @@ $m3u = isset($_GET['m3u']) && $_GET['m3u'];
|
||||||
// Send file to browser
|
// Send file to browser
|
||||||
function send_file_to_browser($attachment, $upload_dir)
|
function send_file_to_browser($attachment, $upload_dir)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
$filename = $upload_dir . '/' . $attachment['physical_filename'];
|
$filename = $upload_dir . '/' . $attachment['physical_filename'];
|
||||||
$gotit = false;
|
$gotit = false;
|
||||||
|
@ -170,7 +170,7 @@ if (!IS_AM && ($attachment['mimetype'] === TORRENT_MIMETYPE)) {
|
||||||
|
|
||||||
$row = DB()->sql_fetchrow($result);
|
$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']]);
|
bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ switch ($download_mode) {
|
||||||
header('Location: ' . $url);
|
header('Location: ' . $url);
|
||||||
exit;
|
exit;
|
||||||
case INLINE_LINK:
|
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;
|
global $template;
|
||||||
|
|
||||||
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
|
$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');
|
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) {
|
if (is_file(config()->get('atom.path') . '/f/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/f/' . $id . '.atom') > $timecheck) {
|
||||||
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
|
redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
|
||||||
} else {
|
} else {
|
||||||
if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
|
if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
|
||||||
redirect($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
|
redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
|
||||||
} else {
|
} else {
|
||||||
bb_simple_die($lang['ATOM_NO_FORUM']);
|
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)) {
|
if (!$username = get_username($id)) {
|
||||||
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
|
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) {
|
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($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 {
|
} else {
|
||||||
if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) {
|
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 {
|
} else {
|
||||||
bb_simple_die($lang['ATOM_NO_USER']);
|
bb_simple_die($lang['ATOM_NO_USER']);
|
||||||
}
|
}
|
||||||
|
|
31
filelist.php
31
filelist.php
|
@ -14,7 +14,7 @@ require __DIR__ . '/common.php';
|
||||||
// Start session management
|
// Start session management
|
||||||
$user->session_start();
|
$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);
|
bb_die($lang['BT_PRIVATE_TRACKER'], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ if (!$topic_id) {
|
||||||
bb_die($lang['INVALID_TOPIC_ID'], 404);
|
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
|
FROM ' . BB_BT_TORRENTS . ' t
|
||||||
LEFT JOIN ' . BB_ATTACHMENTS_DESC . ' ad
|
LEFT JOIN ' . BB_ATTACHMENTS_DESC . ' ad
|
||||||
ON t.attach_id = ad.attach_id
|
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);
|
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
|
// Protocol meta
|
||||||
$meta_v1 = !empty($row['info_hash']);
|
$meta_v1 = !empty($row['info_hash']);
|
||||||
$meta_v2 = !empty($row['info_hash_v2']);
|
$meta_v2 = !empty($row['info_hash_v2']);
|
||||||
|
@ -49,7 +55,7 @@ if (!is_file($file_path)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_contents = file_get_contents($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;
|
$filetree_pos = $meta_v2 ? strpos($file_contents, '9:file tree') : false;
|
||||||
$files_pos = $meta_v1 ? strpos($file_contents, '5:files', $filetree_pos) : 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);
|
$file_count = substr_count($file_contents, '6:length', $files_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($file_count > $bb_cfg['flist_max_files']) {
|
if ($file_count > config()->get('flist_max_files')) {
|
||||||
bb_die(sprintf($lang['BT_FLIST_LIMIT'], $bb_cfg['flist_max_files'], $file_count), 410);
|
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
|
// Get torrent files
|
||||||
$files = $torrent->$t_version_field()->$t_files_field();
|
$files = $torrent->$t_version_field()->$t_files_field();
|
||||||
if ($meta_v1 && $meta_v2) {
|
if ($meta_v2) {
|
||||||
$files = new \RecursiveIteratorIterator($files); // Flatten the list
|
$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_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN'];
|
||||||
$torrent_size = humn_size($row['size'], 2);
|
$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
|
// Output page
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",
|
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",
|
||||||
|
|
10
group.php
10
group.php
|
@ -24,7 +24,7 @@ set_die_append_msg();
|
||||||
|
|
||||||
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
|
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
|
||||||
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
|
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
|
||||||
$per_page = $bb_cfg['group_members_per_page'];
|
$per_page = config()->get('group_members_per_page');
|
||||||
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
|
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
|
||||||
$rel_limit = 50;
|
$rel_limit = 50;
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ if (!$group_id) {
|
||||||
|
|
||||||
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
|
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
|
||||||
|
|
||||||
if ($bb_cfg['group_send_email']) {
|
if (config()->get('group_send_email')) {
|
||||||
// Sending email
|
// Sending email
|
||||||
$emailer = new TorrentPier\Emailer();
|
$emailer = new TorrentPier\Emailer();
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ if (!$group_id) {
|
||||||
|
|
||||||
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
|
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
|
||||||
|
|
||||||
if ($bb_cfg['group_send_email']) {
|
if (config()->get('group_send_email')) {
|
||||||
// Sending email
|
// Sending email
|
||||||
$emailer = new TorrentPier\Emailer();
|
$emailer = new TorrentPier\Emailer();
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ if (!$group_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Email users when they are approved
|
// Email users when they are approved
|
||||||
if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
|
if (!empty($_POST['approve']) && config()->get('group_send_email')) {
|
||||||
$sql_select = "SELECT username, user_email, user_lang
|
$sql_select = "SELECT username, user_email, user_lang
|
||||||
FROM " . BB_USERS . "
|
FROM " . BB_USERS . "
|
||||||
WHERE user_id IN($sql_in)";
|
WHERE user_id IN($sql_in)";
|
||||||
|
@ -573,7 +573,7 @@ if (!$group_id) {
|
||||||
$template->assign_block_vars('pending', [
|
$template->assign_block_vars('pending', [
|
||||||
'ROW_CLASS' => $row_class,
|
'ROW_CLASS' => $row_class,
|
||||||
'AVATAR_IMG' => $pending_info['avatar'],
|
'AVATAR_IMG' => $pending_info['avatar'],
|
||||||
'USER' => profile_url($pending_info),
|
'USER' => profile_url($member),
|
||||||
'FROM' => $pending_info['from'],
|
'FROM' => $pending_info['from'],
|
||||||
'JOINED' => $pending_info['joined'],
|
'JOINED' => $pending_info['joined'],
|
||||||
'JOINED_RAW' => $pending_info['joined_raw'],
|
'JOINED_RAW' => $pending_info['joined_raw'],
|
||||||
|
|
|
@ -35,10 +35,10 @@ if ($group_id) {
|
||||||
if ($is_moderator) {
|
if ($is_moderator) {
|
||||||
// Avatar
|
// Avatar
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
|
if (!empty($_FILES['avatar']['name']) && config()->get('group_avatars.up_allowed')) {
|
||||||
$upload = new TorrentPier\Legacy\Common\Upload();
|
$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;
|
$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");
|
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ if ($is_moderator) {
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||||
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
|
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
|
||||||
|
|
||||||
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], 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']),
|
'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'
|
'cat_forums'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($bb_cfg['show_latest_news']) {
|
if (config()->get('show_latest_news')) {
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'latest_news'
|
'latest_news'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($bb_cfg['show_network_news']) {
|
if (config()->get('show_network_news')) {
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'network_news'
|
'network_news'
|
||||||
]);
|
]);
|
||||||
|
@ -45,8 +45,11 @@ if ($bb_cfg['show_network_news']) {
|
||||||
// Init userdata
|
// Init userdata
|
||||||
$user->session_start();
|
$user->session_start();
|
||||||
|
|
||||||
|
// Set meta description
|
||||||
|
$page_cfg['meta_description'] = config()->get('site_desc');
|
||||||
|
|
||||||
// Init main vars
|
// Init main vars
|
||||||
$viewcat = isset($_GET['c']) ? (int)$_GET['c'] : 0;
|
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0;
|
||||||
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
|
$lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
|
||||||
|
|
||||||
// Caching output
|
// Caching output
|
||||||
|
@ -54,7 +57,7 @@ $req_page = 'index_page';
|
||||||
$req_page .= $viewcat ? "_c{$viewcat}" : '';
|
$req_page .= $viewcat ? "_c{$viewcat}" : '';
|
||||||
|
|
||||||
define('REQUESTED_PAGE', $req_page);
|
define('REQUESTED_PAGE', $req_page);
|
||||||
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $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_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0;
|
||||||
$hide_cat_user = array_flip(explode('-', $hide_cat_opt));
|
$hide_cat_user = array_flip(explode('-', $hide_cat_opt));
|
||||||
|
@ -65,13 +68,15 @@ $tracking_topics = get_tracks('topic');
|
||||||
$tracking_forums = get_tracks('forum');
|
$tracking_forums = get_tracks('forum');
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
if (!$stats = $datastore->get('stats')) {
|
$stats = $datastore->get('stats');
|
||||||
|
if ($stats === false) {
|
||||||
$datastore->update('stats');
|
$datastore->update('stats');
|
||||||
$stats = $datastore->get('stats');
|
$stats = $datastore->get('stats');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forums data
|
// Forums data
|
||||||
if (!$forums = $datastore->get('cat_forums')) {
|
$forums = $datastore->get('cat_forums');
|
||||||
|
if ($forums === false) {
|
||||||
$datastore->update('cat_forums');
|
$datastore->update('cat_forums');
|
||||||
$forums = $datastore->get('cat_forums');
|
$forums = $datastore->get('cat_forums');
|
||||||
}
|
}
|
||||||
|
@ -80,6 +85,7 @@ $forum_name_html = $forums['forum_name_html'];
|
||||||
|
|
||||||
$anon = GUEST_UID;
|
$anon = GUEST_UID;
|
||||||
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
||||||
|
$excluded_forums_array = $excluded_forums_csv ? explode(',', $excluded_forums_csv) : [];
|
||||||
$only_new = $user->opt_js['only_new'];
|
$only_new = $user->opt_js['only_new'];
|
||||||
|
|
||||||
// Validate requested category id
|
// Validate requested category id
|
||||||
|
@ -173,7 +179,8 @@ if (!$cat_forums = CACHE('bb_cache')->get($cache_name)) {
|
||||||
|
|
||||||
// Obtain list of moderators
|
// Obtain list of moderators
|
||||||
$moderators = [];
|
$moderators = [];
|
||||||
if (!$mod = $datastore->get('moderators')) {
|
$mod = $datastore->get('moderators');
|
||||||
|
if ($mod === false) {
|
||||||
$datastore->update('moderators');
|
$datastore->update('moderators');
|
||||||
$mod = $datastore->get('moderators');
|
$mod = $datastore->get('moderators');
|
||||||
}
|
}
|
||||||
|
@ -255,7 +262,7 @@ foreach ($cat_forums as $cid => $c) {
|
||||||
'LAST_TOPIC_ID' => $f['last_topic_id'],
|
'LAST_TOPIC_ID' => $f['last_topic_id'],
|
||||||
'LAST_TOPIC_TIP' => $f['last_topic_title'],
|
'LAST_TOPIC_TIP' => $f['last_topic_title'],
|
||||||
'LAST_TOPIC_TITLE' => str_short($f['last_topic_title'], $last_topic_max_len),
|
'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']]),
|
'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_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
|
||||||
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
|
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
|
||||||
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
|
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
|
||||||
'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
|
'TOTAL_GENDER' => config()->get('gender') ? sprintf(
|
||||||
$lang['USERS_TOTAL_GENDER'],
|
$lang['USERS_TOTAL_GENDER'],
|
||||||
$stats['male'],
|
$stats['male'],
|
||||||
$stats['female'],
|
$stats['female'],
|
||||||
|
@ -280,22 +287,22 @@ $template->assign_vars([
|
||||||
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
|
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
|
||||||
|
|
||||||
// Tracker stats
|
// Tracker stats
|
||||||
'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
'TORRENTS_STAT' => config()->get('tor_stats') ? sprintf(
|
||||||
$lang['TORRENTS_STAT'],
|
$lang['TORRENTS_STAT'],
|
||||||
$stats['torrentcount'],
|
$stats['torrentcount'],
|
||||||
humn_size($stats['size'])
|
humn_size($stats['size'])
|
||||||
) : '',
|
) : '',
|
||||||
'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
'PEERS_STAT' => config()->get('tor_stats') ? sprintf(
|
||||||
$lang['PEERS_STAT'],
|
$lang['PEERS_STAT'],
|
||||||
$stats['peers'],
|
$stats['peers'],
|
||||||
$stats['seeders'],
|
$stats['seeders'],
|
||||||
$stats['leechers']
|
$stats['leechers']
|
||||||
) : '',
|
) : '',
|
||||||
'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf(
|
'SPEED_STAT' => config()->get('tor_stats') ? sprintf(
|
||||||
$lang['SPEED_STAT'],
|
$lang['SPEED_STAT'],
|
||||||
humn_size($stats['speed']) . '/s'
|
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_IMG' => $images['forum'],
|
||||||
'FORUM_NEW_IMG' => $images['forum_new'],
|
'FORUM_NEW_IMG' => $images['forum_new'],
|
||||||
'FORUM_LOCKED_IMG' => $images['forum_locked'],
|
'FORUM_LOCKED_IMG' => $images['forum_locked'],
|
||||||
|
@ -308,20 +315,21 @@ $template->assign_vars([
|
||||||
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&o=1",
|
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&o=1",
|
||||||
'U_SEARCH_LATEST' => 'search.php?search_id=latest',
|
'U_SEARCH_LATEST' => 'search.php?search_id=latest',
|
||||||
'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered',
|
'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered',
|
||||||
'U_ATOM_FEED' => is_file($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,
|
'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
|
// 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']);
|
show_bt_userdata($userdata['user_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Latest news
|
// Latest news
|
||||||
if ($bb_cfg['show_latest_news']) {
|
if (config()->get('show_latest_news')) {
|
||||||
if (!$latest_news = $datastore->get('latest_news')) {
|
$latest_news = $datastore->get('latest_news');
|
||||||
|
if ($latest_news === false) {
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
$latest_news = $datastore->get('latest_news');
|
$latest_news = $datastore->get('latest_news');
|
||||||
}
|
}
|
||||||
|
@ -329,9 +337,13 @@ if ($bb_cfg['show_latest_news']) {
|
||||||
$template->assign_vars(['SHOW_LATEST_NEWS' => true]);
|
$template->assign_vars(['SHOW_LATEST_NEWS' => true]);
|
||||||
|
|
||||||
foreach ($latest_news as $news) {
|
foreach ($latest_news as $news) {
|
||||||
|
if (in_array($news['forum_id'], $excluded_forums_array)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('news', [
|
$template->assign_block_vars('news', [
|
||||||
'NEWS_TOPIC_ID' => $news['topic_id'],
|
'NEWS_TOPIC_ID' => $news['topic_id'],
|
||||||
'NEWS_TITLE' => str_short($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_TIME' => bb_date($news['topic_time'], 'd-M', false),
|
||||||
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
|
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
|
||||||
]);
|
]);
|
||||||
|
@ -339,8 +351,9 @@ if ($bb_cfg['show_latest_news']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network news
|
// Network news
|
||||||
if ($bb_cfg['show_network_news']) {
|
if (config()->get('show_network_news')) {
|
||||||
if (!$network_news = $datastore->get('network_news')) {
|
$network_news = $datastore->get('network_news');
|
||||||
|
if ($network_news === false) {
|
||||||
$datastore->update('network_news');
|
$datastore->update('network_news');
|
||||||
$network_news = $datastore->get('network_news');
|
$network_news = $datastore->get('network_news');
|
||||||
}
|
}
|
||||||
|
@ -348,16 +361,20 @@ if ($bb_cfg['show_network_news']) {
|
||||||
$template->assign_vars(['SHOW_NETWORK_NEWS' => true]);
|
$template->assign_vars(['SHOW_NETWORK_NEWS' => true]);
|
||||||
|
|
||||||
foreach ($network_news as $net) {
|
foreach ($network_news as $net) {
|
||||||
|
if (in_array($net['forum_id'], $excluded_forums_array)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('net', [
|
$template->assign_block_vars('net', [
|
||||||
'NEWS_TOPIC_ID' => $net['topic_id'],
|
'NEWS_TOPIC_ID' => $net['topic_id'],
|
||||||
'NEWS_TITLE' => str_short($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_TIME' => bb_date($net['topic_time'], 'd-M', false),
|
||||||
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
|
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
|
||||||
$week_list = $today_list = [];
|
$week_list = $today_list = [];
|
||||||
$week_all = $today_all = false;
|
$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_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_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 {
|
} 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'])) {
|
if (!empty($stats['birthday_today_list'])) {
|
||||||
|
|
3
info.php
3
info.php
|
@ -16,8 +16,9 @@ $user->session_start();
|
||||||
|
|
||||||
$info = [];
|
$info = [];
|
||||||
$htmlDir = LANG_DIR . 'html/';
|
$htmlDir = LANG_DIR . 'html/';
|
||||||
|
$show = isset($_REQUEST['show']) ? (string)$_REQUEST['show'] : '';
|
||||||
|
|
||||||
switch ((string)$_REQUEST['show'] ?? 'not_found') {
|
switch ($show) {
|
||||||
case 'advert':
|
case 'advert':
|
||||||
$info['title'] = $lang['ADVERT'];
|
$info['title'] = $lang['ADVERT'];
|
||||||
$info['src'] = 'advert.html';
|
$info['src'] = 'advert.html';
|
||||||
|
|
231
install.php
231
install.php
|
@ -7,18 +7,25 @@
|
||||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('BB_ROOT', __DIR__ . '/');
|
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
|
||||||
|
define('BB_PATH', BB_ROOT);
|
||||||
|
|
||||||
// Check CLI mode
|
// 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');
|
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
|
* System requirements
|
||||||
*/
|
*/
|
||||||
define('CHECK_REQUIREMENTS', [
|
const CHECK_REQUIREMENTS = [
|
||||||
'php_min_version' => '8.1.0',
|
'php_min_version' => '8.2.0',
|
||||||
'ext_list' => [
|
'ext_list' => [
|
||||||
'json',
|
'json',
|
||||||
'curl',
|
'curl',
|
||||||
|
@ -32,127 +39,8 @@ define('CHECK_REQUIREMENTS', [
|
||||||
'zip',
|
'zip',
|
||||||
'gd'
|
'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
|
// Welcoming message
|
||||||
out("--- TorrentPier Installer ---\n", 'info');
|
out("--- TorrentPier Installer ---\n", 'info');
|
||||||
|
|
||||||
|
@ -185,7 +73,7 @@ if (!defined('EXTENSIONS_NOT_INSTALLED')) {
|
||||||
if (is_file(BB_ROOT . '.env')) {
|
if (is_file(BB_ROOT . '.env')) {
|
||||||
out('- TorrentPier already installed', 'warning');
|
out('- TorrentPier already installed', 'warning');
|
||||||
echo 'Are you sure want to re-install TorrentPier? [y/N]: ';
|
echo 'Are you sure want to re-install TorrentPier? [y/N]: ';
|
||||||
if (str_starts_with(mb_strtolower(readline()), 'y')) {
|
if (str_starts_with(mb_strtolower(trim(readline())), 'y')) {
|
||||||
out("\n- Re-install process started...", 'info');
|
out("\n- Re-install process started...", 'info');
|
||||||
// environment
|
// environment
|
||||||
if (is_file(BB_ROOT . '.env')) {
|
if (is_file(BB_ROOT . '.env')) {
|
||||||
|
@ -207,7 +95,7 @@ if (is_file(BB_ROOT . '.env')) {
|
||||||
}
|
}
|
||||||
// composer dir
|
// composer dir
|
||||||
if (is_dir(BB_ROOT . 'vendor')) {
|
if (is_dir(BB_ROOT . 'vendor')) {
|
||||||
rmdir_rec(BB_ROOT . 'vendor');
|
removeDir(BB_ROOT . 'vendor', true);
|
||||||
if (!is_dir(BB_ROOT . 'vendor')) {
|
if (!is_dir(BB_ROOT . 'vendor')) {
|
||||||
out("- Composer directory successfully removed!");
|
out("- Composer directory successfully removed!");
|
||||||
} else {
|
} else {
|
||||||
|
@ -257,6 +145,7 @@ if (!is_file(BB_ROOT . 'vendor/autoload.php')) {
|
||||||
// Installing dependencies
|
// Installing dependencies
|
||||||
if (is_file(BB_ROOT . 'composer.phar')) {
|
if (is_file(BB_ROOT . 'composer.phar')) {
|
||||||
out('- Installing dependencies...', 'info');
|
out('- Installing dependencies...', 'info');
|
||||||
|
|
||||||
runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi');
|
runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi');
|
||||||
define('COMPOSER_COMPLETED', true);
|
define('COMPOSER_COMPLETED', true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,7 +177,7 @@ if (is_file(BB_ROOT . '.env.example') && !is_file(BB_ROOT . '.env')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editing ENV file
|
// Editing ENV file
|
||||||
$DB_HOST = '';
|
$DB_HOST = 'localhost';
|
||||||
$DB_PORT = 3306;
|
$DB_PORT = 3306;
|
||||||
$DB_DATABASE = '';
|
$DB_DATABASE = '';
|
||||||
$DB_USERNAME = '';
|
$DB_USERNAME = '';
|
||||||
|
@ -309,20 +198,23 @@ if (is_file(BB_ROOT . '.env')) {
|
||||||
if (trim($line) !== '' && !str_starts_with($line, '#')) {
|
if (trim($line) !== '' && !str_starts_with($line, '#')) {
|
||||||
$parts = explode('=', $line, 2);
|
$parts = explode('=', $line, 2);
|
||||||
$key = trim($parts[0]);
|
$key = trim($parts[0]);
|
||||||
$value = (isset($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
|
$value = (!empty($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
|
||||||
|
|
||||||
// Database default values
|
|
||||||
if (in_array($key, ['DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD'])) {
|
|
||||||
$$key = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
out("\nCurrent value of $key: $value", 'debug');
|
out("\nCurrent value of $key: $value", 'debug');
|
||||||
echo "Enter a new value for $key (or leave empty to not change): ";
|
echo "Enter a new value for $key (or leave empty to not change): ";
|
||||||
$newValue = readline();
|
$newValue = trim(readline());
|
||||||
|
|
||||||
if (!empty($newValue) || $key === 'DB_PASSWORD') {
|
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";
|
$line = "$key=$newValue";
|
||||||
$$key = $newValue;
|
$$key = $newValue;
|
||||||
|
} else {
|
||||||
|
$$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,35 +264,34 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
|
||||||
}
|
}
|
||||||
$conn->select_db($DB_DATABASE);
|
$conn->select_db($DB_DATABASE);
|
||||||
|
|
||||||
// Checking SQL dump
|
// Close database connection - migrations will handle their own connections
|
||||||
$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');
|
|
||||||
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 = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn->close();
|
$conn->close();
|
||||||
out("- Importing SQL dump completed!\n", 'success');
|
|
||||||
|
// Run database migrations
|
||||||
|
out('- Setting up database using migrations...', 'info');
|
||||||
|
|
||||||
|
// Check if phinx.php exists
|
||||||
|
if (!is_file(BB_ROOT . 'phinx.php')) {
|
||||||
|
out('- Migration configuration (phinx.php) not found', 'error');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run migrations
|
||||||
|
$migrationResult = runProcess('php vendor/bin/phinx migrate --configuration=' . BB_ROOT . 'phinx.php');
|
||||||
|
if ($migrationResult !== 0) {
|
||||||
|
out('- Database migration failed', 'error');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
out("- Database setup completed!\n", 'success');
|
||||||
|
|
||||||
|
// Autofill host in robots.txt
|
||||||
|
$robots_txt_file = BB_ROOT . 'robots.txt';
|
||||||
|
if (isset($TP_HOST) && is_file($robots_txt_file)) {
|
||||||
|
$content = file_get_contents($robots_txt_file);
|
||||||
|
$content = str_replace('example.com', $TP_HOST, $content);
|
||||||
|
file_put_contents($robots_txt_file, $content);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($APP_ENV) && $APP_ENV === 'local') {
|
if (isset($APP_ENV) && $APP_ENV === 'local') {
|
||||||
if (!is_file(BB_ROOT . 'library/config.local.php')) {
|
if (!is_file(BB_ROOT . 'library/config.local.php')) {
|
||||||
|
@ -418,5 +309,23 @@ if (!empty($DB_HOST) && !empty($DB_DATABASE) && !empty($DB_USERNAME)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup...
|
||||||
|
if (is_file(BB_ROOT . '_cleanup.php')) {
|
||||||
|
out("\n--- Finishing installation (Cleanup) ---\n", 'info');
|
||||||
|
out('The cleanup process will remove:');
|
||||||
|
out('- Development documentation (README, CHANGELOG)', 'debug');
|
||||||
|
out('- Git configuration files', 'debug');
|
||||||
|
out('- CI/CD pipelines and code analysis tools', 'debug');
|
||||||
|
out('- Translation and contribution guidelines', 'debug');
|
||||||
|
echo 'Do you want to delete these files permanently? [y/N]: ';
|
||||||
|
if (str_starts_with(mb_strtolower(trim(readline())), 'y')) {
|
||||||
|
out("\n- Cleanup...", 'info');
|
||||||
|
require_once BB_ROOT . '_cleanup.php';
|
||||||
|
unlink(BB_ROOT . '_cleanup.php');
|
||||||
|
} else {
|
||||||
|
out('- Skipping...', 'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
out("\n- Voila! Good luck & have fun!", 'success');
|
out("\n- Voila! Good luck & have fun!", 'success');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
27
install/Caddyfile
Normal file
27
install/Caddyfile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Example Caddy configuration for TorrentPier
|
||||||
|
|
||||||
|
example.com {
|
||||||
|
root * /path/to/root
|
||||||
|
encode gzip zstd
|
||||||
|
php_fastcgi unix//run/php/php-fpm.sock
|
||||||
|
try_files {path} {path}/ /index.php?{query}
|
||||||
|
file_server
|
||||||
|
|
||||||
|
@blocked {
|
||||||
|
path /install/* /internal_data/* /library/*
|
||||||
|
path /.ht* /.en*
|
||||||
|
path /.git/*
|
||||||
|
path *.sql *.tpl *.db *.inc *.log *.md
|
||||||
|
}
|
||||||
|
respond @blocked 404
|
||||||
|
|
||||||
|
redir /sitemap.xml /sitemap/sitemap.xml
|
||||||
|
|
||||||
|
@html_css_js {
|
||||||
|
path *.html *.css *.js *.json *.xml *.txt
|
||||||
|
}
|
||||||
|
header @html_css_js Content-Type "{mime}; charset=utf-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Refer to the Caddy docs for more information:
|
||||||
|
# https://caddyserver.com/docs/caddyfile
|
39
install/nginx.conf
Normal file
39
install/nginx.conf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Example nginx configuration for TorrentPier
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80; # port
|
||||||
|
server_name example.com; # your domain
|
||||||
|
root /path/to/root; # folder with TorrentPier installed
|
||||||
|
index index.php;
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files \$uri \$uri/ /index.php?\$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \/(install|internal_data|library)\/ {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(ht|en) {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.git {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.(.*sql|tpl|db|inc|log|md)$ {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewrite ^/sitemap.xml$ /sitemap/sitemap.xml;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass unix:/run/php/php-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
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
|
|
1
internal_data/cache/.htaccess
vendored
1
internal_data/cache/.htaccess
vendored
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
0
internal_data/cache/.keep
vendored
Normal file
0
internal_data/cache/.keep
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
0
internal_data/log/.keep
Normal file
0
internal_data/log/.keep
Normal file
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $lang, $user;
|
global $lang, $user;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
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']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ if ($t_data['seeders'] >= 3) {
|
||||||
} elseif ($t_data['call_seed_time'] >= (TIMENOW - 86400)) {
|
} elseif ($t_data['call_seed_time'] >= (TIMENOW - 86400)) {
|
||||||
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
|
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
|
||||||
$this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
|
$this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
|
||||||
} elseif (isset($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']);
|
$this->ajax_die($lang['NOT_AVAILABLE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang, $log_action;
|
global $userdata, $lang, $log_action;
|
||||||
|
|
||||||
if (!$attach_id = (int)$this->request['attach_id']) {
|
if (!$attach_id = (int)$this->request['attach_id']) {
|
||||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||||
|
@ -22,7 +22,7 @@ if (!$mode = (string)$this->request['mode']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment = false;
|
$comment = false;
|
||||||
if ($bb_cfg['tor_comment']) {
|
if (config()->get('tor_comment')) {
|
||||||
$comment = (string)$this->request['comment'];
|
$comment = (string)$this->request['comment'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ switch ($mode) {
|
||||||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
|
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
|
||||||
|
|
||||||
// Log action
|
// 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']) {
|
if ($comment && $comment != $lang['COMMENT']) {
|
||||||
$log_msg .= "<br/>{$lang['COMMENT']}: <b>$comment</b>.";
|
$log_msg .= "<br/>{$lang['COMMENT']}: <b>$comment</b>.";
|
||||||
}
|
}
|
||||||
|
@ -99,12 +99,12 @@ switch ($mode) {
|
||||||
'log_msg' => $log_msg . '<br/>-------------',
|
'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) {
|
if ($tor['poster_id'] > 0) {
|
||||||
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
|
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
|
||||||
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $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']) {
|
if ($comment && $comment != $lang['COMMENT']) {
|
||||||
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
|
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
|
||||||
|
@ -117,7 +117,7 @@ switch ($mode) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'status_reply':
|
case 'status_reply':
|
||||||
if (!$bb_cfg['tor_comment']) {
|
if (!config()->get('tor_comment')) {
|
||||||
$this->ajax_die($lang['MODULE_OFF']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang, $log_action;
|
global $userdata, $lang, $log_action;
|
||||||
|
|
||||||
if (!isset($this->request['attach_id'])) {
|
if (!isset($this->request['attach_id'])) {
|
||||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
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)) {
|
if (!$group_id = (int)$this->request['group_id'] or !$group_info = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
|
||||||
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
|
||||||
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
|
||||||
|
@ -55,7 +55,7 @@ switch ($field) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user_gender':
|
case 'user_gender':
|
||||||
if (!$bb_cfg['gender']) {
|
if (!config()->get('gender')) {
|
||||||
$this->ajax_die($lang['MODULE_OFF']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
if (!isset($lang['GENDER_SELECT'][$value])) {
|
if (!isset($lang['GENDER_SELECT'][$value])) {
|
||||||
|
@ -65,7 +65,7 @@ switch ($field) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user_birthday':
|
case 'user_birthday':
|
||||||
if (!$bb_cfg['birthday_enabled']) {
|
if (!config()->get('birthday_enabled')) {
|
||||||
$this->ajax_die($lang['MODULE_OFF']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
$birthday_date = date_parse($value);
|
$birthday_date = date_parse($value);
|
||||||
|
@ -73,10 +73,10 @@ switch ($field) {
|
||||||
if (!empty($birthday_date['year'])) {
|
if (!empty($birthday_date['year'])) {
|
||||||
if (strtotime($value) >= TIMENOW) {
|
if (strtotime($value) >= TIMENOW) {
|
||||||
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
|
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
|
||||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
|
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config()->get('birthday_max_age')) {
|
||||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
|
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config()->get('birthday_max_age')));
|
||||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
|
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config()->get('birthday_min_age')) {
|
||||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
|
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config()->get('birthday_min_age')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
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']);
|
$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']);
|
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $lang, $userdata, $datastore;
|
global $lang, $userdata, $datastore;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
@ -20,10 +20,10 @@ if (!$mode = (string)$this->request['mode']) {
|
||||||
$html = '';
|
$html = '';
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'birthday_week':
|
case 'birthday_week':
|
||||||
$stats = $datastore->get('stats');
|
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'stats'
|
'stats'
|
||||||
]);
|
]);
|
||||||
|
$stats = $datastore->get('stats');
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
|
@ -31,17 +31,17 @@ switch ($mode) {
|
||||||
foreach ($stats['birthday_week_list'] as $week) {
|
foreach ($stats['birthday_week_list'] as $week) {
|
||||||
$users[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>';
|
$users[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>';
|
||||||
}
|
}
|
||||||
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $users));
|
$html = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $users));
|
||||||
} else {
|
} else {
|
||||||
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
$html = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'birthday_today':
|
case 'birthday_today':
|
||||||
$stats = $datastore->get('stats');
|
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'stats'
|
'stats'
|
||||||
]);
|
]);
|
||||||
|
$stats = $datastore->get('stats');
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
|
@ -59,8 +59,7 @@ switch ($mode) {
|
||||||
$forum_id = (int)$this->request['forum_id'];
|
$forum_id = (int)$this->request['forum_id'];
|
||||||
|
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'moderators',
|
'moderators'
|
||||||
'cat_forums'
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$moderators = [];
|
$moderators = [];
|
||||||
|
@ -85,7 +84,7 @@ switch ($mode) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'null_ratio':
|
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']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
if (empty($this->request['confirmed'])) {
|
if (empty($this->request['confirmed'])) {
|
||||||
|
@ -107,8 +106,8 @@ switch ($mode) {
|
||||||
if ($ratio_nulled && !IS_ADMIN) {
|
if ($ratio_nulled && !IS_ADMIN) {
|
||||||
$this->ajax_die($lang['BT_NULL_RATIO_AGAIN']);
|
$this->ajax_die($lang['BT_NULL_RATIO_AGAIN']);
|
||||||
}
|
}
|
||||||
if (($user_ratio >= $bb_cfg['ratio_to_null']) && !IS_ADMIN) {
|
if (($user_ratio >= config()->get('ratio_to_null')) && !IS_ADMIN) {
|
||||||
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], $bb_cfg['ratio_to_null']));
|
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], config()->get('ratio_to_null')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$ratio_nulled_sql = !IS_ADMIN ? ', ratio_nulled = 1' : '';
|
$ratio_nulled_sql = !IS_ADMIN ? ', ratio_nulled = 1' : '';
|
||||||
|
@ -173,7 +172,7 @@ switch ($mode) {
|
||||||
<th>' . $lang['UPLOADED'] . '</th>
|
<th>' . $lang['UPLOADED'] . '</th>
|
||||||
<th>' . $lang['RELEASED'] . '</th>
|
<th>' . $lang['RELEASED'] . '</th>
|
||||||
<th>' . $lang['BONUS'] . '</th>';
|
<th>' . $lang['BONUS'] . '</th>';
|
||||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
$html .= config()->get('seed_bonus_enabled') ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||||
$html .= '</tr>
|
$html .= '</tr>
|
||||||
<tr class="row1">
|
<tr class="row1">
|
||||||
<td>' . $lang['TOTAL_TRAF'] . '</td>
|
<td>' . $lang['TOTAL_TRAF'] . '</td>
|
||||||
|
@ -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_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td>
|
||||||
<td id="u_up_release"><span class="editable bold seedmed">' . humn_size($btu['u_up_release']) . '</span></td>
|
<td id="u_up_release"><span class="editable bold seedmed">' . humn_size($btu['u_up_release']) . '</span></td>
|
||||||
<td id="u_up_bonus"><span class="editable bold seedmed">' . humn_size($btu['u_up_bonus']) . '</span></td>';
|
<td id="u_up_bonus"><span class="editable bold seedmed">' . humn_size($btu['u_up_bonus']) . '</span></td>';
|
||||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
$html .= config()->get('seed_bonus_enabled') ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||||
$html .= '</tr>
|
$html .= '</tr>
|
||||||
<tr class="row5">
|
<tr class="row5">
|
||||||
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
|
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
|
||||||
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
|
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
|
||||||
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
|
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
|
||||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td colspan="1"></td>' : '';
|
$html .= config()->get('seed_bonus_enabled') ? '<td colspan="1"></td>' : '';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
|
|
||||||
$this->response['user_ratio'] = '
|
$this->response['user_ratio'] = '
|
||||||
<th><a href="' . $bb_cfg['ratio_url_help'] . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
<th><a href="' . config()->get('ratio_url_help') . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
||||||
<td>' . $user_ratio . '</td>
|
<td>' . $user_ratio . '</td>
|
||||||
';
|
';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $userdata, $lang, $bb_cfg;
|
global $userdata, $lang;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
@ -19,7 +19,7 @@ if (!$mode = (string)$this->request['mode']) {
|
||||||
|
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'clear_cache':
|
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();
|
CACHE($cache_name)->rm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,20 +48,20 @@ switch ($mode) {
|
||||||
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';
|
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';
|
||||||
break;
|
break;
|
||||||
case 'indexer':
|
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")) {
|
if (!is_file(config()->get('sphinx_config_path') . ".log")) {
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
file_put_contents(config()->get('sphinx_config_path') . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\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) {
|
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(config()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND);
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
|
file_put_contents(config()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND);
|
||||||
|
|
||||||
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';
|
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';
|
||||||
break;
|
break;
|
||||||
|
@ -82,10 +82,6 @@ switch ($mode) {
|
||||||
\TorrentPier\Helpers\CronHelper::enableBoard();
|
\TorrentPier\Helpers\CronHelper::enableBoard();
|
||||||
$this->response['unlock_cron_html'] = '<span class="seed bold">' . $lang['ADMIN_UNLOCKED'] . '</span>';
|
$this->response['unlock_cron_html'] = '<span class="seed bold">' . $lang['ADMIN_UNLOCKED'] . '</span>';
|
||||||
break;
|
break;
|
||||||
case 'restore_corrupt_files':
|
|
||||||
file_write('', RESTORE_CORRUPT_CONFIRM_FILE, replace_content: true);
|
|
||||||
$this->response['restore_corrupt_files_html'] = '<span class="seed bold">' . $lang['INTEGRITY_RESTORE_CONFIRM_OK'] . '</span>';
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->ajax_die('Invalid mode: ' . $mode);
|
$this->ajax_die('Invalid mode: ' . $mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $userdata, $lang, $bb_cfg;
|
global $userdata, $lang;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $userdata, $bb_cfg, $lang, $datastore, $log_action;
|
global $userdata, $lang, $datastore, $log_action;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
@ -44,7 +44,7 @@ switch ($mode) {
|
||||||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
|
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
|
||||||
|
|
||||||
// Log action
|
// 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', [
|
$log_action->mod('mod_topic_change_tor_status', [
|
||||||
'forum_id' => $tor['forum_id'],
|
'forum_id' => $tor['forum_id'],
|
||||||
'topic_id' => $tor['topic_id'],
|
'topic_id' => $tor['topic_id'],
|
||||||
|
@ -52,7 +52,7 @@ switch ($mode) {
|
||||||
'log_msg' => $log_msg . '<br/>-------------',
|
'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);
|
$this->response['topics'] = explode(',', $topics);
|
||||||
break;
|
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");
|
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
|
// Update the news cache on the index page
|
||||||
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
|
$news_forums = array_flip(explode(',', config()->get('latest_news_forum_id')));
|
||||||
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
|
if (isset($news_forums[$t_data['forum_id']]) && config()->get('show_latest_news')) {
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'latest_news'
|
'latest_news'
|
||||||
]);
|
]);
|
||||||
$datastore->update('latest_news');
|
$datastore->update('latest_news');
|
||||||
}
|
}
|
||||||
|
|
||||||
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
|
$net_forums = array_flip(explode(',', config()->get('network_news_forum_id')));
|
||||||
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
|
if (isset($net_forums[$t_data['forum_id']]) && config()->get('show_network_news')) {
|
||||||
$datastore->enqueue([
|
$datastore->enqueue([
|
||||||
'network_news'
|
'network_news'
|
||||||
]);
|
]);
|
||||||
|
@ -151,8 +151,8 @@ switch ($mode) {
|
||||||
} else {
|
} else {
|
||||||
$user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']);
|
$user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']);
|
||||||
$user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']);
|
$user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']);
|
||||||
$reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_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="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_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'] = '
|
$this->response['ip_list_html'] = '
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $lang, $bb_cfg, $userdata, $wordCensor;
|
global $lang, $userdata;
|
||||||
|
|
||||||
if (!isset($this->request['type'])) {
|
if (!isset($this->request['type'])) {
|
||||||
$this->ajax_die('empty 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";
|
$message = "[quote=\"" . $quote_username . "\"][qpost=" . $post['post_id'] . "]" . $post['post_text'] . "[/quote]\r";
|
||||||
|
|
||||||
// hide user passkey
|
// 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
|
// hide sid
|
||||||
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]#', 'sid', $message);
|
$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']) {
|
if ($post['post_id'] == $post['topic_first_post_id']) {
|
||||||
$message = "[quote]" . $post['topic_title'] . "[/quote]\r";
|
$message = "[quote]" . $post['topic_title'] . "[/quote]\r";
|
||||||
|
@ -120,10 +120,10 @@ switch ($this->request['type']) {
|
||||||
|
|
||||||
if (mb_strlen($text) > 2) {
|
if (mb_strlen($text) > 2) {
|
||||||
if ($text != $post['post_text']) {
|
if ($text != $post['post_text']) {
|
||||||
if ($bb_cfg['max_smilies']) {
|
if (config()->get('max_smilies')) {
|
||||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
if ($count_smilies > config()->get('max_smilies')) {
|
||||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
|
DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
|
||||||
|
@ -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";
|
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
|
||||||
if ($row = DB()->fetch_row($sql) and $row['last_post_time']) {
|
if ($row = DB()->fetch_row($sql) and $row['last_post_time']) {
|
||||||
if ($userdata['user_level'] == USER) {
|
if ($userdata['user_level'] == USER) {
|
||||||
if ((TIMENOW - $row['last_post_time']) < $bb_cfg['flood_interval']) {
|
if ((TIMENOW - $row['last_post_time']) < config()->get('flood_interval')) {
|
||||||
$this->ajax_die($lang['FLOOD_ERROR']);
|
$this->ajax_die($lang['FLOOD_ERROR']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,10 +251,10 @@ switch ($this->request['type']) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['max_smilies']) {
|
if (config()->get('max_smilies')) {
|
||||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
if ($count_smilies > config()->get('max_smilies')) {
|
||||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ switch ($this->request['type']) {
|
||||||
'post_text' => $message
|
'post_text' => $message
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($bb_cfg['topic_notify_enabled']) {
|
if (config()->get('topic_notify_enabled')) {
|
||||||
$notify = !empty($this->request['notify']);
|
$notify = !empty($this->request['notify']);
|
||||||
\TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
\TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $lang;
|
global $lang;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
@ -24,7 +24,7 @@ switch ($mode) {
|
||||||
case 'create':
|
case 'create':
|
||||||
$map->createSitemap();
|
$map->createSitemap();
|
||||||
if (is_file(SITEMAP_DIR . '/sitemap.xml')) {
|
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 {
|
} else {
|
||||||
$html .= $lang['SITEMAP_NOT_CREATED'];
|
$html .= $lang['SITEMAP_NOT_CREATED'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
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']);
|
$this->ajax_die($lang['MODULE_OFF']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,12 +49,12 @@ switch ($mode) {
|
||||||
|
|
||||||
// Limit voters per topic
|
// Limit voters per topic
|
||||||
$thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx'];
|
$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");
|
DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'get':
|
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']);
|
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $lang, $userdata;
|
||||||
|
|
||||||
if (!$mode = (string)$this->request['mode']) {
|
if (!$mode = (string)$this->request['mode']) {
|
||||||
$this->ajax_die('invalid mode (empty)');
|
$this->ajax_die('invalid mode (empty)');
|
||||||
|
|
|
@ -11,11 +11,11 @@ if (!defined('IN_AJAX')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $user, $lang, $bb_cfg;
|
global $user, $lang;
|
||||||
|
|
||||||
$post_id = isset($this->request['post_id']) ? (int)$this->request['post_id'] : null;
|
$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;
|
$topic_id = isset($this->request['topic_id']) ? (int)$this->request['topic_id'] : null;
|
||||||
$return_text = $bb_cfg['show_post_bbcode_button'] && 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)) {
|
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');
|
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id');
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
|
@ -25,11 +25,11 @@ if (defined('ATTACH_INSTALL')) {
|
||||||
*/
|
*/
|
||||||
function attach_mod_get_lang($language_file)
|
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)) {
|
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';
|
$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()
|
function get_config()
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
$attach_config = [];
|
$attach_config = [];
|
||||||
|
|
||||||
$sql = 'SELECT * FROM ' . BB_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
|
// 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;
|
return $attach_config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
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;
|
$tor_status_by_for_all = true;
|
||||||
$change_peers_bgr_over = 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)
|
// 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'] ?? '';
|
$get_sp_mode = $_GET['spmode'] ?? '';
|
||||||
|
|
||||||
$s_mode = 'count';
|
$s_mode = 'count';
|
||||||
|
@ -51,7 +51,7 @@ if ($cfg_sp_mode == SHOW_PEERS_NAMES) {
|
||||||
$s_mode = 'full';
|
$s_mode = 'full';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['bt_allow_spmode_change']) {
|
if (config()->get('bt_allow_spmode_change')) {
|
||||||
if ($get_sp_mode == 'names') {
|
if ($get_sp_mode == 'names') {
|
||||||
$s_mode = 'names';
|
$s_mode = 'names';
|
||||||
} elseif ($get_sp_mode == 'full') {
|
} 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_file_time = bb_date($attachments['_' . $post_id][$i]['filetime']);
|
||||||
|
|
||||||
$tor_reged = (bool)$tracker_status;
|
$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);
|
$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']));
|
$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;
|
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['tracker']['use_old_torrent_name_format']) {
|
if (config()->get('tracker.use_old_torrent_name_format')) {
|
||||||
$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.' . TORRENT_EXT;
|
$display_name = '[' . config()->get('server_name') . '].t' . $bt_topic_id . '.' . TORRENT_EXT;
|
||||||
} else {
|
} 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) {
|
if (!$tor_reged) {
|
||||||
|
@ -149,11 +149,11 @@ if ($tor_reged && $tor_info) {
|
||||||
|
|
||||||
// Magnet link
|
// Magnet link
|
||||||
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
|
$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
|
// ratio limits
|
||||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
$min_ratio_dl = config()->get('bt_min_ratio_allow_dl_tor');
|
||||||
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
|
$min_ratio_warn = config()->get('bt_min_ratio_warning');
|
||||||
$dl_allowed = true;
|
$dl_allowed = true;
|
||||||
$user_ratio = 0;
|
$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)) {
|
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([
|
$template->assign_vars([
|
||||||
'SHOW_RATIO_WARN' => true,
|
'SHOW_RATIO_WARN' => true,
|
||||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
|
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, config()->get('ratio_url_help')),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,12 +202,12 @@ if ($tor_reged && $tor_info) {
|
||||||
'TOR_TYPE' => is_gold($tor_type),
|
'TOR_TYPE' => is_gold($tor_type),
|
||||||
|
|
||||||
// torrent status mod
|
// 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_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_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_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
|
//end torrent status mod
|
||||||
|
|
||||||
'S_UPLOAD_IMAGE' => $upload_image,
|
'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' => !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,
|
'HASH_V2' => !empty($tor_info['info_hash_v2']) ? strtoupper(bin2hex($tor_info['info_hash_v2'])) : false,
|
||||||
'FILELIST_ICON' => $images['icon_tor_filelist'],
|
'FILELIST_ICON' => $images['icon_tor_filelist'],
|
||||||
'FILELIST_LINK' => FILELIST_URL . $tor_info['topic_id'],
|
|
||||||
'REGED_TIME' => bb_date($tor_info['reg_time']),
|
'REGED_TIME' => bb_date($tor_info['reg_time']),
|
||||||
'REGED_DELTA' => delta_time($tor_info['reg_time']),
|
'REGED_DELTA' => delta_time($tor_info['reg_time']),
|
||||||
'TORRENT_SIZE' => humn_size($tor_size, 2),
|
'TORRENT_SIZE' => humn_size($tor_size, 2),
|
||||||
|
@ -228,7 +227,7 @@ if ($tor_reged && $tor_info) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// TorrServer integration
|
// 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', [
|
$template->assign_block_vars('postrow.attach.tor_reged.tor_server', [
|
||||||
'TORR_SERVER_M3U_LINK' => PLAYBACK_M3U_URL . $bt_topic_id,
|
'TORR_SERVER_M3U_LINK' => PLAYBACK_M3U_URL . $bt_topic_id,
|
||||||
'TORR_SERVER_M3U_ICON' => $images['icon_tor_m3u_icon'],
|
'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([
|
$template->assign_vars([
|
||||||
'SHOW_DL_LIST' => true,
|
'SHOW_DL_LIST' => true,
|
||||||
'SHOW_DL_LIST_TOR_INFO' => 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_LONGEVITY' => delta_time($tor_info['reg_time']),
|
||||||
'TOR_DOWNLOAD_COUNT' => $download_count,
|
'TOR_DOWNLOAD_COUNT' => $download_count,
|
||||||
'TOR_COMPLETED' => $tor_completed_count,
|
'TOR_COMPLETED' => $tor_completed_count,
|
||||||
|
@ -302,7 +301,7 @@ if ($tor_reged && $tor_info) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
tr.user_id, tr.ip, tr.ipv6, tr.port, tr.peer_id, tr.uploaded, tr.downloaded, tr.remain,
|
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.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
|
FROM " . BB_BT_TRACKER . " tr
|
||||||
LEFT JOIN " . BB_USERS . " u ON u.user_id = tr.user_id
|
LEFT JOIN " . BB_USERS . " u ON u.user_id = tr.user_id
|
||||||
WHERE tr.topic_id = $tor_id
|
WHERE tr.topic_id = $tor_id
|
||||||
|
@ -373,8 +372,8 @@ if ($tor_reged && $tor_info) {
|
||||||
$peers = $tmp;
|
$peers = $tmp;
|
||||||
|
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
'TOR_SPEED_UP' => ($tor_speed_up) ? humn_size($tor_speed_up, 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, 0, '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
|
// Full details mode
|
||||||
if ($s_mode == 'full') {
|
if ($s_mode == 'full') {
|
||||||
if (!empty($peer['ip']) && !empty($peer['ipv6'])) {
|
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 {
|
} else {
|
||||||
$ip = bt_show_ip(!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']);
|
$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, [
|
$template->assign_block_vars((string)$x_full, [
|
||||||
'SEED_ORD_ACT' => $seed_order_action,
|
'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) {
|
if ($ip) {
|
||||||
|
@ -429,8 +430,8 @@ if ($tor_reged && $tor_info) {
|
||||||
|
|
||||||
$template->assign_block_vars((string)$x_full, [
|
$template->assign_block_vars((string)$x_full, [
|
||||||
'LEECH_ORD_ACT' => $leech_order_action,
|
'LEECH_ORD_ACT' => $leech_order_action,
|
||||||
'LEECHERS_UP_TOT' => humn_size($sp_up_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], 0, 'KB') . '/s'
|
'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], min: 'KB') . '/s'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($ip) {
|
if ($ip) {
|
||||||
|
@ -444,23 +445,48 @@ if ($tor_reged && $tor_info) {
|
||||||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $tor_size) : 0;
|
$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) : '-';
|
$up_tot = ($p_max_up) ? humn_size($p_max_up) : '-';
|
||||||
$down_tot = ($p_max_down) ? humn_size($p_max_down) : '-';
|
$down_tot = ($p_max_down) ? humn_size($p_max_down) : '-';
|
||||||
$up_ratio = ($p_max_down) ? round(($p_max_up / $p_max_down), 2) : '';
|
$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_up = ($peer['speed_up']) ? humn_size($peer['speed_up'], min: 'KB') . '/s' : '-';
|
||||||
$sp_down = ($peer['speed_down']) ? humn_size($peer['speed_down'], 0, '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;
|
$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';\"" : '';
|
$row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
|
||||||
$tr[$x]++;
|
$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", [
|
$template->assign_block_vars("$x_full.$x_row", [
|
||||||
'ROW_BGR' => $row_bgr,
|
'ROW_BGR' => $row_bgr,
|
||||||
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
|
'NAME' => $peerUsername,
|
||||||
'PEER_ID' => isset($peer['peer_id']) ? get_user_torrent_client($peer['peer_id']) : $lang['UNKNOWN'],
|
'PEER_ID' => $peerTorrentClient,
|
||||||
'COUNTRY' => render_flag(infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])['countryCode'], false),
|
'COUNTRY' => $peerCountry,
|
||||||
'COMPL_PRC' => $compl_perc,
|
'COMPL_PRC' => $compl_perc,
|
||||||
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,
|
'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,
|
'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'],
|
'DOWN_TOTAL_RAW' => $peer['downloaded'],
|
||||||
'SPEED_UP_RAW' => $peer['speed_up'],
|
'SPEED_UP_RAW' => $peer['speed_up'],
|
||||||
'SPEED_DOWN_RAW' => $peer['speed_down'],
|
'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'],
|
'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" : ''
|
'TOR_RATIO' => $up_ratio ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : ''
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($ip) {
|
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) {
|
if ($port !== false) {
|
||||||
$template->assign_block_vars("$x_full.$x_row.port", ['PORT' => $port]);
|
$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([
|
$template->assign_vars([
|
||||||
'PEERS_FULL_LINK' => true,
|
'PEERS_FULL_LINK' => true,
|
||||||
'SPMODE_FULL_HREF' => TOPIC_URL . "$bt_topic_id&spmode=full#seeders"
|
'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([
|
$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_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($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
|
'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_COUNT' => ($s_mode == 'count'),
|
||||||
'S_MODE_NAMES' => ($s_mode == 'names'),
|
'S_MODE_NAMES' => ($s_mode == 'names'),
|
||||||
'S_MODE_FULL' => ($s_mode == 'full'),
|
'S_MODE_FULL' => ($s_mode == 'full'),
|
||||||
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
||||||
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
||||||
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
||||||
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
|
'TOR_HELP_LINKS' => config()->get('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)),
|
'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 $var_name
|
||||||
* @param $default
|
* @param $default
|
||||||
* @param bool $multibyte
|
* @param bool $multibyte
|
||||||
* @return array
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
function get_var($var_name, $default, $multibyte = false)
|
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)
|
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
|
// Generate Array, if it's not an array
|
||||||
if ($post_id_array === 0 && $attach_id_array === 0 && $page === 0) {
|
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
|
// TorrServer integration
|
||||||
if ($bb_cfg['torr_server']['enabled']) {
|
if (config()->get('torr_server.enabled')) {
|
||||||
$torrServer = new \TorrentPier\TorrServerAPI();
|
$torrServer = new \TorrentPier\TorrServerAPI();
|
||||||
$torrServer->removeM3U($attachments[$j]['attach_id']);
|
$torrServer->removeM3U($attachments[$j]['attach_id']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ $reserved_port = env('TP_PORT', 80);
|
||||||
$bb_cfg = [];
|
$bb_cfg = [];
|
||||||
|
|
||||||
// Version info
|
// Version info
|
||||||
$bb_cfg['tp_version'] = 'v2.4.5';
|
$bb_cfg['tp_version'] = 'v2.8.3';
|
||||||
$bb_cfg['tp_release_date'] = '06-02-2025';
|
$bb_cfg['tp_release_date'] = '03-07-2025';
|
||||||
$bb_cfg['tp_release_codename'] = 'Cattle';
|
$bb_cfg['tp_release_codename'] = 'Cattle';
|
||||||
|
|
||||||
// Increase version number after changing JS or CSS
|
// Increase version number after changing JS or CSS
|
||||||
|
@ -60,27 +60,22 @@ $bb_cfg['cache'] = [
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 11211,
|
'port' => 11211,
|
||||||
],
|
],
|
||||||
'redis' => [
|
// Available cache types: file, sqlite, memory, memcached (file by default)
|
||||||
'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)
|
|
||||||
'engines' => [
|
'engines' => [
|
||||||
'bb_cache' => ['filecache'],
|
'bb_cache' => ['file'],
|
||||||
'bb_config' => ['filecache'],
|
'bb_config' => ['file'],
|
||||||
'tr_cache' => ['filecache'],
|
'tr_cache' => ['file'],
|
||||||
'session_cache' => ['filecache'],
|
'session_cache' => ['file'],
|
||||||
'bb_cap_sid' => ['filecache'],
|
'bb_cap_sid' => ['file'],
|
||||||
'bb_login_err' => ['filecache'],
|
'bb_login_err' => ['file'],
|
||||||
'bb_poll_data' => ['filecache'],
|
'bb_poll_data' => ['file'],
|
||||||
'bb_ip2countries' => ['filecache'],
|
'bb_ip2countries' => ['file'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// Datastore
|
// Datastore
|
||||||
// Available datastore types: filecache, memcached, sqlite, redis, apcu (filecache by default)
|
// Available datastore types: file, sqlite, memory, memcache (file by default)
|
||||||
$bb_cfg['datastore_type'] = 'filecache';
|
$bb_cfg['datastore_type'] = 'file';
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
$bb_cfg['server_name'] = $domain_name = !empty($_SERVER['SERVER_NAME']) ? idn_to_utf8($_SERVER['SERVER_NAME']) : $reserved_name;
|
$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
|
'disable_for_guest' => true
|
||||||
];
|
];
|
||||||
|
|
||||||
// IndexNow settings
|
// FreeIPAPI settings
|
||||||
$bb_cfg['indexnow_settings'] = [
|
$bb_cfg['ip2country_settings'] = [
|
||||||
'enabled' => false,
|
// Documentation: https://docs.freeipapi.com/
|
||||||
'host' => 'bing', // Available: yandex, bing, seznam, naver
|
'enabled' => true,
|
||||||
|
'endpoint' => 'https://freeipapi.com/api/json/',
|
||||||
|
'api_token' => '', // not required for basic usage
|
||||||
];
|
];
|
||||||
|
|
||||||
// FAQ url help link
|
// FAQ url help link
|
||||||
|
@ -193,6 +190,7 @@ $bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
|
||||||
$bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php"
|
$bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php"
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
|
$bb_cfg['auto_language_detection'] = true; // Use browser language (auto-detect) as default language for guests
|
||||||
$bb_cfg['lang'] = [
|
$bb_cfg['lang'] = [
|
||||||
// Languages available for selecting
|
// Languages available for selecting
|
||||||
'af' => [
|
'af' => [
|
||||||
|
@ -206,6 +204,7 @@ $bb_cfg['lang'] = [
|
||||||
'ar' => [
|
'ar' => [
|
||||||
'name' => 'Arabic',
|
'name' => 'Arabic',
|
||||||
'locale' => 'ar_SA.UTF-8',
|
'locale' => 'ar_SA.UTF-8',
|
||||||
|
'rtl' => true,
|
||||||
],
|
],
|
||||||
'hy' => [
|
'hy' => [
|
||||||
'name' => 'Armenian',
|
'name' => 'Armenian',
|
||||||
|
@ -282,6 +281,7 @@ $bb_cfg['lang'] = [
|
||||||
'he' => [
|
'he' => [
|
||||||
'name' => 'Hebrew',
|
'name' => 'Hebrew',
|
||||||
'locale' => 'he_IL.UTF-8',
|
'locale' => 'he_IL.UTF-8',
|
||||||
|
'rtl' => true,
|
||||||
],
|
],
|
||||||
'hi' => [
|
'hi' => [
|
||||||
'name' => 'Hindi',
|
'name' => 'Hindi',
|
||||||
|
@ -425,7 +425,7 @@ $bb_cfg['invites_system'] = [
|
||||||
// Syntax: 'invite_code' => 'validity_period'
|
// Syntax: 'invite_code' => 'validity_period'
|
||||||
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
|
// 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'
|
// 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',
|
'new_year2023' => '2022-12-31 00:00:01',
|
||||||
'340c4bb6ea2d284c13e085b60b990a8a' => '12 April 1961',
|
'340c4bb6ea2d284c13e085b60b990a8a' => '12 April 1961',
|
||||||
'tp_birthday' => '2005-04-04',
|
'tp_birthday' => '2005-04-04',
|
||||||
|
@ -434,22 +434,23 @@ $bb_cfg['invites_system'] = [
|
||||||
];
|
];
|
||||||
$bb_cfg['password_symbols'] = [
|
$bb_cfg['password_symbols'] = [
|
||||||
// What symbols should be required in the password
|
// What symbols should be required in the password
|
||||||
'nums' => true, // Numeric
|
'nums' => true,
|
||||||
'spec_symbols' => false, // Special symbols
|
'spec_symbols' => false,
|
||||||
'letters' => [ // Letters
|
'letters' => [
|
||||||
'uppercase' => true, // Uppercase letters
|
'uppercase' => false,
|
||||||
'lowercase' => true // Lowercase letters
|
'lowercase' => true
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$bb_cfg['password_hash_options'] = [
|
$bb_cfg['password_hash_options'] = [
|
||||||
// https://www.php.net/manual/ru/password.constants.php
|
// https://www.php.net/manual/ru/password.constants.php
|
||||||
'algo' => PASSWORD_BCRYPT,
|
'algo' => PASSWORD_BCRYPT,
|
||||||
'options' => []
|
'options' => ['cost' => 12]
|
||||||
];
|
];
|
||||||
|
|
||||||
// Email
|
// Email
|
||||||
$bb_cfg['emailer'] = [
|
$bb_cfg['emailer'] = [
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
'sendmail_command' => '/usr/sbin/sendmail -bs',
|
||||||
'smtp' => [
|
'smtp' => [
|
||||||
'enabled' => false, // send email via external SMTP server
|
'enabled' => false, // send email via external SMTP server
|
||||||
'host' => 'localhost', // SMTP server host
|
'host' => 'localhost', // SMTP server host
|
||||||
|
@ -521,7 +522,10 @@ $bb_cfg['sf_on_first_page_only'] = true; // Show subforums only on the first pag
|
||||||
$bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Allowed number of topics per page
|
$bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Allowed number of topics per page
|
||||||
|
|
||||||
// Topics
|
// Topics
|
||||||
$bb_cfg['show_post_bbcode_button'] = true; // Show "Code" button in topic to display BBCode of topic
|
$bb_cfg['show_post_bbcode_button'] = [ // Show "Code" button in topic to display BBCode of topic
|
||||||
|
'enabled' => true,
|
||||||
|
'only_for_first_post' => true,
|
||||||
|
];
|
||||||
$bb_cfg['show_quick_reply'] = true; // Show quick reply forim
|
$bb_cfg['show_quick_reply'] = true; // Show quick reply forim
|
||||||
$bb_cfg['show_rank_text'] = false; // Show user rank name in topics
|
$bb_cfg['show_rank_text'] = false; // Show user rank name in topics
|
||||||
$bb_cfg['show_rank_image'] = true; // Show user rank image in topics
|
$bb_cfg['show_rank_image'] = true; // Show user rank image in topics
|
||||||
|
@ -602,7 +606,6 @@ $bb_cfg['flist_max_files'] = 0; // Max allowed number of files to process for gi
|
||||||
$bb_cfg['last_visit_date_format'] = 'd-M H:i';
|
$bb_cfg['last_visit_date_format'] = 'd-M H:i';
|
||||||
$bb_cfg['last_post_date_format'] = 'd-M-y H:i';
|
$bb_cfg['last_post_date_format'] = 'd-M-y H:i';
|
||||||
$bb_cfg['poll_max_days'] = 180; // How many days will the poll be active
|
$bb_cfg['poll_max_days'] = 180; // How many days will the poll be active
|
||||||
$bb_cfg['integrity_check'] = true; // TorrentPier files integrity check
|
|
||||||
|
|
||||||
$bb_cfg['allow_change'] = [
|
$bb_cfg['allow_change'] = [
|
||||||
'language' => true, // Allow user to change language
|
'language' => true, // Allow user to change language
|
||||||
|
@ -672,7 +675,7 @@ $bb_cfg['group_avatars'] = [
|
||||||
// Captcha
|
// Captcha
|
||||||
$bb_cfg['captcha'] = [
|
$bb_cfg['captcha'] = [
|
||||||
'disabled' => true,
|
'disabled' => true,
|
||||||
'service' => 'googleV3', // Available services: googleV2, googleV3, hCaptcha, yandex, cloudflare
|
'service' => 'googleV3', // Available services: text, googleV2, googleV3, hCaptcha, yandex, cloudflare
|
||||||
'public_key' => '',
|
'public_key' => '',
|
||||||
'secret_key' => '',
|
'secret_key' => '',
|
||||||
'theme' => 'light', // theming (available: light, dark) (working only if supported by captcha service)
|
'theme' => 'light', // theming (available: light, dark) (working only if supported by captcha service)
|
||||||
|
|
|
@ -20,7 +20,6 @@ define('LOG_DIR', BB_PATH . '/internal_data/log');
|
||||||
define('TRIGGERS_DIR', BB_PATH . '/internal_data/triggers');
|
define('TRIGGERS_DIR', BB_PATH . '/internal_data/triggers');
|
||||||
define('AJAX_DIR', BB_PATH . '/library/ajax');
|
define('AJAX_DIR', BB_PATH . '/library/ajax');
|
||||||
define('ATTACH_DIR', BB_PATH . '/library/attach_mod');
|
define('ATTACH_DIR', BB_PATH . '/library/attach_mod');
|
||||||
define('CFG_DIR', BB_PATH . '/library/config');
|
|
||||||
define('INC_DIR', BB_PATH . '/library/includes');
|
define('INC_DIR', BB_PATH . '/library/includes');
|
||||||
define('UCP_DIR', BB_PATH . '/library/includes/ucp');
|
define('UCP_DIR', BB_PATH . '/library/includes/ucp');
|
||||||
define('LANG_ROOT_DIR', BB_PATH . '/library/language');
|
define('LANG_ROOT_DIR', BB_PATH . '/library/language');
|
||||||
|
@ -33,13 +32,8 @@ define('APP_NAME', 'TorrentPier');
|
||||||
define('DEFAULT_CHARSET', 'UTF-8');
|
define('DEFAULT_CHARSET', 'UTF-8');
|
||||||
define('UPDATER_URL', 'https://api.github.com/repos/torrentpier/torrentpier/releases');
|
define('UPDATER_URL', 'https://api.github.com/repos/torrentpier/torrentpier/releases');
|
||||||
define('UPDATER_FILE', INT_DATA_DIR . '/updater.json');
|
define('UPDATER_FILE', INT_DATA_DIR . '/updater.json');
|
||||||
define('CHECKSUMS_FILE', INT_DATA_DIR . '/checksums.md5');
|
|
||||||
define('RESTORE_CORRUPT_CONFIRM_FILE', INT_DATA_DIR . '/rescorrupt.integrity');
|
|
||||||
define('COOKIE_DBG', 'bb_dbg');
|
define('COOKIE_DBG', 'bb_dbg');
|
||||||
|
|
||||||
// TODO: Move in another section
|
|
||||||
define('API_IP_URL', 'https://freeipapi.com/api/json/');
|
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
define('ADMIN_TPL_DIR', TEMPLATES_DIR . '/admin/');
|
define('ADMIN_TPL_DIR', TEMPLATES_DIR . '/admin/');
|
||||||
define('XS_USE_ISSET', '1');
|
define('XS_USE_ISSET', '1');
|
||||||
|
@ -89,11 +83,15 @@ define('CRON_RUNNING', TRIGGERS_DIR . '/cron_running');
|
||||||
define('GZIP_OUTPUT_ALLOWED', extension_loaded('zlib') && !ini_get('zlib.output_compression'));
|
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'));
|
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
|
// Tracker shared constants
|
||||||
define('BB_BT_TORRENTS', 'bb_bt_torrents');
|
define('BB_BT_TORRENTS', 'bb_bt_torrents');
|
||||||
define('BB_BT_TRACKER', 'bb_bt_tracker');
|
define('BB_BT_TRACKER', 'bb_bt_tracker');
|
||||||
define('BB_BT_TRACKER_SNAP', 'bb_bt_tracker_snap');
|
define('BB_BT_TRACKER_SNAP', 'bb_bt_tracker_snap');
|
||||||
define('BB_BT_USERS', 'bb_bt_users');
|
define('BB_BT_USERS', 'bb_bt_users');
|
||||||
|
define('BB_USERS', 'bb_users');
|
||||||
define('BT_AUTH_KEY_LENGTH', 20); // Passkey length
|
define('BT_AUTH_KEY_LENGTH', 20); // Passkey length
|
||||||
|
|
||||||
// Torrents (reserved: -1)
|
// Torrents (reserved: -1)
|
||||||
|
@ -139,6 +137,15 @@ define('ONLY_NEW_TOPICS', 2);
|
||||||
define('GUEST_UID', -1);
|
define('GUEST_UID', -1);
|
||||||
define('BOT_UID', -746);
|
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
|
// Ratio limits
|
||||||
define('TR_RATING_LIMITS', true); // ON/OFF
|
define('TR_RATING_LIMITS', true); // ON/OFF
|
||||||
define('MIN_DL_FOR_RATIO', 10737418240); // 10 GB in bytes, 0 - disable
|
define('MIN_DL_FOR_RATIO', 10737418240); // 10 GB in bytes, 0 - disable
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Require all denied
|
|
|
@ -83,6 +83,23 @@ HTML;
|
||||||
<span class="post-hr">-</span>
|
<span class="post-hr">-</span>
|
||||||
HTML;
|
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');
|
array_deep($bbcode_tpl, 'bbcode_tpl_compact');
|
||||||
return $bbcode_tpl;
|
return $bbcode_tpl;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +123,7 @@ function prepare_message($message)
|
||||||
// Either in a window or inline
|
// Either in a window or inline
|
||||||
function generate_smilies($mode)
|
function generate_smilies($mode)
|
||||||
{
|
{
|
||||||
global $bb_cfg, $template, $lang, $user, $datastore;
|
global $template, $lang, $user, $datastore;
|
||||||
|
|
||||||
$inline_columns = 4;
|
$inline_columns = 4;
|
||||||
$inline_rows = 7;
|
$inline_rows = 7;
|
||||||
|
@ -118,7 +135,7 @@ function generate_smilies($mode)
|
||||||
|
|
||||||
$data = $datastore->get('smile_replacements');
|
$data = $datastore->get('smile_replacements');
|
||||||
|
|
||||||
if ($sql = $data['smile']) {
|
if (isset($data['smile']) && $sql = $data['smile']) {
|
||||||
$num_smilies = 0;
|
$num_smilies = 0;
|
||||||
$rowset = [];
|
$rowset = [];
|
||||||
foreach ($sql as $row) {
|
foreach ($sql as $row) {
|
||||||
|
@ -143,7 +160,7 @@ function generate_smilies($mode)
|
||||||
|
|
||||||
$template->assign_block_vars('smilies_row.smilies_col', [
|
$template->assign_block_vars('smilies_row.smilies_col', [
|
||||||
'SMILEY_CODE' => $data['code'],
|
'SMILEY_CODE' => $data['code'],
|
||||||
'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url,
|
'SMILEY_IMG' => config()->get('smilies_path') . '/' . $smile_url,
|
||||||
'SMILEY_DESC' => $data['emoticon'],
|
'SMILEY_DESC' => $data['emoticon'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -324,11 +341,9 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
|
||||||
|
|
||||||
function extract_search_words($text)
|
function extract_search_words($text)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
$max_words_count = config()->get('max_search_words_per_post');
|
||||||
|
$min_word_len = max(2, config()->get('search_min_word_len') - 1);
|
||||||
$max_words_count = $bb_cfg['max_search_words_per_post'];
|
$max_word_len = config()->get('search_max_word_len');
|
||||||
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
|
|
||||||
$max_word_len = $bb_cfg['search_max_word_len'];
|
|
||||||
|
|
||||||
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
||||||
$text = str_replace(['[', ']'], ['[', ']'], $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)
|
function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
$text = $topic_title . ' ' . $post_message;
|
$text = $topic_title . ' ' . $post_message;
|
||||||
$words = ($text) ? extract_search_words($text) : [];
|
$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);
|
return implode("\n", $words);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,12 +401,12 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
|
||||||
|
|
||||||
function bbcode2html($text)
|
function bbcode2html($text)
|
||||||
{
|
{
|
||||||
global $bbcode, $wordCensor;
|
global $bbcode;
|
||||||
|
|
||||||
if (!isset($bbcode)) {
|
if (!isset($bbcode)) {
|
||||||
$bbcode = new TorrentPier\Legacy\BBCode();
|
$bbcode = new TorrentPier\Legacy\BBCode();
|
||||||
}
|
}
|
||||||
$text = $wordCensor->censorString($text);
|
$text = censor()->censorString($text);
|
||||||
return $bbcode->bbcode2html($text);
|
return $bbcode->bbcode2html($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,22 +421,19 @@ function get_words_rate($text)
|
||||||
|
|
||||||
function hide_passkey($str)
|
function hide_passkey($str)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
return preg_replace("#\?{config()->get('passkey_key')}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{config()->get('passkey_key')}=passkey", $str);
|
||||||
return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
|
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
if (config()->get('use_posts_cache') && !empty($postrow['post_html'])) {
|
||||||
|
|
||||||
if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html'])) {
|
|
||||||
return $postrow['post_html'];
|
return $postrow['post_html'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = bbcode2html($postrow['post_text']);
|
$message = bbcode2html($postrow['post_text']);
|
||||||
|
|
||||||
// Posts cache
|
// Posts cache
|
||||||
if ($bb_cfg['use_posts_cache']) {
|
if (config()->get('use_posts_cache')) {
|
||||||
DB()->shutdown['post_html'][] = [
|
DB()->shutdown['post_html'][] = [
|
||||||
'post_id' => (int)$postrow['post_id'],
|
'post_id' => (int)$postrow['post_id'],
|
||||||
'post_html' => (string)$message
|
'post_html' => (string)$message
|
||||||
|
|
|
@ -13,11 +13,10 @@ if (!defined('BB_ROOT')) {
|
||||||
|
|
||||||
define('IN_CRON', true);
|
define('IN_CRON', true);
|
||||||
|
|
||||||
// Set SESSION vars
|
// Set SESSION vars (optimized for InnoDB)
|
||||||
DB()->query("
|
DB()->query("
|
||||||
SET SESSION
|
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
|
, join_buffer_size = 4*1024*1024
|
||||||
, read_buffer_size = 4*1024*1024
|
, read_buffer_size = 4*1024*1024
|
||||||
, read_rnd_buffer_size = 8*1024*1024
|
, read_rnd_buffer_size = 8*1024*1024
|
||||||
|
@ -29,8 +28,7 @@ DB()->query("
|
||||||
// Restore vars at shutdown
|
// Restore vars at shutdown
|
||||||
DB()->add_shutdown_query("
|
DB()->add_shutdown_query("
|
||||||
SET SESSION
|
SET SESSION
|
||||||
myisam_sort_buffer_size = DEFAULT
|
bulk_insert_buffer_size = DEFAULT
|
||||||
, bulk_insert_buffer_size = DEFAULT
|
|
||||||
, join_buffer_size = DEFAULT
|
, join_buffer_size = DEFAULT
|
||||||
, read_buffer_size = DEFAULT
|
, read_buffer_size = DEFAULT
|
||||||
, read_rnd_buffer_size = DEFAULT
|
, read_rnd_buffer_size = DEFAULT
|
||||||
|
|
|
@ -26,9 +26,9 @@ $posts_without_attach = $topics_without_attach = [];
|
||||||
|
|
||||||
DB()->query("
|
DB()->query("
|
||||||
CREATE TEMPORARY TABLE $tmp_attach_tbl (
|
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))
|
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");
|
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'];
|
$orphan_db_attach[] = $row['attach_id'];
|
||||||
}
|
}
|
||||||
// Delete all orphan attachments
|
// 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) {
|
foreach ($orphan_db_attach as $attach_id) {
|
||||||
// TorrServer integration
|
// TorrServer integration
|
||||||
$torrServer = new \TorrentPier\TorrServerAPI();
|
$torrServer = new \TorrentPier\TorrServerAPI();
|
||||||
|
|
|
@ -17,7 +17,7 @@ if (!defined('BB_ROOT')) {
|
||||||
\TorrentPier\Legacy\Admin\Common::sync_all_forums();
|
\TorrentPier\Legacy\Admin\Common::sync_all_forums();
|
||||||
|
|
||||||
// Cleaning bb_poll_users
|
// 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;
|
$per_cycle = 20000;
|
||||||
$row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS);
|
$row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS);
|
||||||
$start_id = (int)$row['start_id'];
|
$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));
|
DB()->query("UPDATE " . BB_USERS . " SET user_newpasswd = '' WHERE user_lastvisit < " . (TIMENOW - 7 * 86400));
|
||||||
|
|
||||||
// Cleaning post cache
|
// 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)");
|
DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autofill announcer url
|
// 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']);
|
bb_update_config(['bt_announce_url' => FULL_URL . 'bt/announce.php']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,22 +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");
|
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
|
// Check for updates
|
||||||
$datastore->update('check_updates');
|
$datastore->update('check_updates');
|
||||||
|
|
||||||
// Integrity check
|
|
||||||
$datastore->update('files_integrity');
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ if (!defined('BB_ROOT')) {
|
||||||
|
|
||||||
// Delete staled dl-status records
|
// Delete staled dl-status records
|
||||||
$keeping_dlstat = [
|
$keeping_dlstat = [
|
||||||
DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'],
|
DL_STATUS_WILL => (int)config()->get('dl_will_days_keep'),
|
||||||
DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'],
|
DL_STATUS_DOWN => (int)config()->get('dl_down_days_keep'),
|
||||||
DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'],
|
DL_STATUS_COMPLETE => (int)config()->get('dl_complete_days_keep'),
|
||||||
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep']
|
DL_STATUS_CANCEL => (int)config()->get('dl_cancel_days_keep')
|
||||||
];
|
];
|
||||||
|
|
||||||
$delete_dlstat_sql = [];
|
$delete_dlstat_sql = [];
|
||||||
|
@ -51,7 +51,7 @@ DB()->query("
|
||||||
");
|
");
|
||||||
|
|
||||||
// Tor-Stats cleanup
|
// 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)");
|
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__));
|
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) {
|
if ($log_days_keep !== 0) {
|
||||||
DB()->query("DELETE FROM " . BB_LOG . " WHERE log_time < " . (TIMENOW - 86400 * $log_days_keep));
|
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__));
|
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) {
|
if ($pm_days_keep !== 0) {
|
||||||
$per_cycle = 20000;
|
$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__));
|
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";
|
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
|
||||||
|
|
||||||
foreach (DB()->fetch_rowset($sql) as $row) {
|
foreach (DB()->fetch_rowset($sql) as $row) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ while (true) {
|
||||||
set_time_limit(600);
|
set_time_limit(600);
|
||||||
$prune_users = $not_activated_users = $not_active_users = [];
|
$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 . "
|
$sql = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
|
||||||
WHERE user_level = 0
|
WHERE user_level = 0
|
||||||
AND user_lastvisit = 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 . "
|
$sql = DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
|
||||||
WHERE user_level = 0
|
WHERE user_level = 0
|
||||||
AND user_posts = 0
|
AND user_posts = 0
|
||||||
|
|
|
@ -11,8 +11,8 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['topic_moved_days_keep']) {
|
if (config()->get('topic_moved_days_keep')) {
|
||||||
$prune_time = TIMENOW - 86400 * $bb_cfg['topic_moved_days_keep'];
|
$prune_time = TIMENOW - 86400 * config()->get('topic_moved_days_keep');
|
||||||
|
|
||||||
DB()->query("
|
DB()->query("
|
||||||
DELETE FROM " . BB_TOPICS . "
|
DELETE FROM " . BB_TOPICS . "
|
||||||
|
|
|
@ -11,10 +11,10 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_session_expire_time = TIMENOW - (int)$bb_cfg['user_session_duration'];
|
$user_session_expire_time = TIMENOW - (int)config()->get('user_session_duration');
|
||||||
$admin_session_expire_time = TIMENOW - (int)$bb_cfg['admin_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;
|
$admin_session_gc_time = $admin_session_expire_time;
|
||||||
|
|
||||||
// ############################ Tables LOCKED ################################
|
// ############################ 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);
|
DB()->expect_slow_query(600);
|
||||||
|
|
||||||
// Update dlstat (part 1)
|
// Update dlstat (part 1)
|
||||||
if ($bb_cfg['tracker']['update_dlstat']) {
|
if (config()->get('tracker.update_dlstat')) {
|
||||||
// ############################ Tables LOCKED ################################
|
// ############################ Tables LOCKED ################################
|
||||||
DB()->lock([
|
DB()->lock([
|
||||||
BB_BT_TRACKER,
|
BB_BT_TRACKER,
|
||||||
|
@ -39,7 +39,7 @@ if ($bb_cfg['tracker']['update_dlstat']) {
|
||||||
INSERT INTO " . NEW_BB_BT_LAST_TORSTAT . "
|
INSERT INTO " . NEW_BB_BT_LAST_TORSTAT . "
|
||||||
(topic_id, user_id, dl_status, up_add, down_add, release_add, speed_up, speed_down)
|
(topic_id, user_id, dl_status, up_add, down_add, release_add, speed_up, speed_down)
|
||||||
SELECT
|
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 . "
|
FROM " . BB_BT_TRACKER . "
|
||||||
WHERE (up_add != 0 OR down_add != 0)
|
WHERE (up_add != 0 OR down_add != 0)
|
||||||
GROUP BY topic_id, user_id
|
GROUP BY topic_id, user_id
|
||||||
|
@ -61,20 +61,19 @@ DB()->query("
|
||||||
FROM " . BB_BT_TRACKER . "
|
FROM " . BB_BT_TRACKER . "
|
||||||
WHERE seeder = 1
|
WHERE seeder = 1
|
||||||
GROUP BY topic_id, user_id
|
GROUP BY topic_id, user_id
|
||||||
ORDER BY update_time DESC
|
|
||||||
");
|
");
|
||||||
|
|
||||||
// Clean peers table
|
// Clean peers table
|
||||||
if ($bb_cfg['tracker']['autoclean']) {
|
if (config()->get('tracker.autoclean')) {
|
||||||
$announce_interval = max((int)$bb_cfg['announce_interval'], 60);
|
$announce_interval = max((int)config()->get('announce_interval'), 60);
|
||||||
$expire_factor = max((float)$bb_cfg['tracker']['expire_factor'], 1);
|
$expire_factor = max((float)config()->get('tracker.expire_factor'), 1);
|
||||||
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
|
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
|
||||||
|
|
||||||
DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time");
|
DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update dlstat (part 2)
|
// Update dlstat (part 2)
|
||||||
if ($bb_cfg['tracker']['update_dlstat']) {
|
if (config()->get('tracker.update_dlstat')) {
|
||||||
// Set "only 1 seeder" bonus
|
// Set "only 1 seeder" bonus
|
||||||
DB()->query("
|
DB()->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|
|
@ -11,12 +11,12 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_last_seen_days_keep'];
|
$last_seen_time = TIMENOW - 86400 * config()->get('seeder_last_seen_days_keep');
|
||||||
$never_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_never_seen_days_keep'];
|
$never_seen_time = TIMENOW - 86400 * config()->get('seeder_never_seen_days_keep');
|
||||||
$limit_sql = 3000;
|
$limit_sql = 3000;
|
||||||
|
|
||||||
$topics_sql = $attach_sql = [];
|
$topics_sql = $attach_sql = [];
|
||||||
|
|
|
@ -11,8 +11,6 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg;
|
|
||||||
|
|
||||||
DB()->expect_slow_query(600);
|
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);
|
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("
|
DB()->query("
|
||||||
INSERT INTO " . NEW_BB_BT_DLSTATUS_SNAP . "
|
INSERT INTO " . NEW_BB_BT_DLSTATUS_SNAP . "
|
||||||
(topic_id, dl_status, users_count)
|
(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
|
// TORHELP
|
||||||
//
|
//
|
||||||
if ($bb_cfg['torhelp_enabled']) {
|
if (config()->get('torhelp_enabled')) {
|
||||||
$tor_min_seeders = 0; // "<="
|
$tor_min_seeders = 0; // "<="
|
||||||
$tor_min_leechers = 2; // ">="
|
$tor_min_leechers = 2; // ">="
|
||||||
$tor_min_completed = 10; // ">="
|
$tor_min_completed = 10; // ">="
|
||||||
|
@ -147,7 +145,7 @@ if ($bb_cfg['torhelp_enabled']) {
|
||||||
WHERE
|
WHERE
|
||||||
trsn.seeders <= $tor_min_seeders
|
trsn.seeders <= $tor_min_seeders
|
||||||
AND trsn.leechers >= $tor_min_leechers
|
AND trsn.leechers >= $tor_min_leechers
|
||||||
AND tor.forum_id != " . (int)$bb_cfg['trash_forum_id'] . "
|
AND tor.forum_id != " . (int)config()->get('trash_forum_id') . "
|
||||||
AND tor.complete_count >= $tor_min_completed
|
AND tor.complete_count >= $tor_min_completed
|
||||||
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
|
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
|
||||||
AND dl.user_id IN($online_users_csv)
|
AND dl.user_id IN($online_users_csv)
|
||||||
|
|
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