diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..ad982577 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,547 @@ +name: Tests + +env: + EXTVENDOR: gfksx # Your extension vendor name + EXTNAME: thanksforposts # Your extension package name + SNIFF: 1 # Run code sniffer on your code? 1 or 0 + IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0 + EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0 + EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0 + PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on + +on: [push, pull_request] + +jobs: + # START Basic Checks Job (EPV, code sniffer, images check, etc.) + basic-checks: + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - php: '7.2' + db: "none" + NOTESTS: 1 + + name: PHP ${{ matrix.php }} - ${{ matrix.db }} + + steps: + - name: Checkout phpBB + uses: actions/checkout@v3 + with: + repository: phpbb/phpbb + ref: ${{ env.PHPBB_BRANCH }} + path: phpBB3 + + - name: Checkout extension + uses: actions/checkout@v3 + with: + path: phpBB3/phpBB/ext/${{ env.EXTVENDOR }}/${{ env.EXTNAME }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap + coverage: none + + - name: Setup environment for phpBB + env: + DB: ${{ matrix.db }} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: '1' + run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS + working-directory: ./phpBB3 + + - name: Setup EPV + if: ${{ env.EPV != 0 }} + run: composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs + working-directory: ./phpBB3/phpBB + + - name: Run code sniffer + if: ${{ env.SNIFF != 0 }} + env: + NOTESTS: '1' + run: .github/ext-sniff.sh $EXTVENDOR/$EXTNAME $NOTESTS + working-directory: ./phpBB3 + + - name: Check image ICC profiles + if: ${{ env.IMAGE_ICC != 0 }} + run: .github/check-image-icc-profiles.sh + working-directory: ./phpBB3 + + - name: Check executable files + if: ${{ env.EXECUTABLE_FILES != 0 }} + run: .github/ext-check-executable-files.sh ./ $EXTVENDOR/$EXTNAME + working-directory: ./phpBB3 + + - name: Run EPV + if: ${{ env.EPV != 0 }} + run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTVENDOR/$EXTNAME/" + working-directory: ./phpBB3 + # END Basic Checks Job + + # START MySQL and MariaDB Job + mysql-tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - php: '7.1' + db: "mariadb:10.1" + - php: '7.1' + db: "mariadb:10.2" + - php: '7.1' + db: "mariadb:10.3" + - php: '7.1' + db: "mariadb:10.4" + - php: '7.1' + db: "mariadb:10.5" + - php: '7.1' + db: "mysql:5.6" + db_alias: "MySQL Slow Tests" + SLOWTESTS: 1 + - php: '7.1' + db: "mysql:5.6" + db_alias: "MyISAM Tests" + MYISAM: 1 + - php: '7.1' + db: "mysql:5.6" + - php: '7.1' + db: "mysql:5.7" + - php: '7.2' + db: "mysql:5.7" + - php: '7.3' + db: "mysql:5.7" + - php: '7.4' + db: "mysql:5.7" + - php: '7.4' + db: "mysql:8.0" + - php: '8.0' + db: "mysql:5.7" + - php: '8.1' + db: "mysql:5.7" + - php: '8.2' + db: "mysql:5.7" + + name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }} + + services: + mysql: + image: ${{ matrix.db }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: phpbb_tests + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 + + steps: + - name: Checkout phpBB + uses: actions/checkout@v3 + with: + repository: phpbb/phpbb + ref: ${{ env.PHPBB_BRANCH }} + path: phpBB3 + + - name: Checkout extension + uses: actions/checkout@v3 + with: + path: phpBB3/phpBB/ext/${{ env.EXTVENDOR }}/${{ env.EXTNAME }} + + - id: database-type + env: + MATRIX_DB: ${{ matrix.db }} + run: | + db=$(echo "${MATRIX_DB%%:*}") + echo "::set-output name=db::$db" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap + coverage: none + + - name: Setup environment for phpBB + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: '0' + run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0} + working-directory: ./phpBB3 + + - name: Setup database + env: + DB: ${{steps.database-type.outputs.db}} + MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }} + run: .github/setup-database.sh $DB $MYISAM + working-directory: ./phpBB3 + + - name: Setup PHPUnit files + run: mkdir -p phpBB/ext/$EXTVENDOR/$EXTNAME/.github && cp .github/phpunit* $_ + working-directory: ./phpBB3 + + - name: Run unit tests + env: + DB: ${{steps.database-type.outputs.db}} + run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTVENDOR/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php + working-directory: ./phpBB3 + # END MySQL and MariaDB Job + + # START PostgreSQL Job + postgres-tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - php: '7.1' + db: "postgres:9.3" + - php: '7.1' + db: "postgres:9.5" + - php: '7.1' + db: "postgres:9.6" + - php: '7.1' + db: "postgres:10" + - php: '7.1' + db: "postgres:11" + - php: '7.1' + db: "postgres:12" + - php: '7.1' + db: "postgres:13" + - php: '7.2' + db: "postgres:13" + - php: '7.3' + db: "postgres:13" + - php: '7.4' + db: "postgres:13" + - php: '8.0' + db: "postgres:12" + - php: '8.0' + db: "postgres:13" + - php: '8.1' + db: "postgres:14" + - php: '8.2' + db: "postgres:14" + + name: PHP ${{ matrix.php }} - ${{ matrix.db }} + + services: + postgres: + image: ${{ matrix.db != 'postgres:9.3' && matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }} + env: + POSTGRES_HOST: localhost + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + -v /var/run/postgresql:/var/run/postgresql + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 + + steps: + - name: Checkout phpBB + uses: actions/checkout@v3 + with: + repository: phpbb/phpbb + ref: ${{ env.PHPBB_BRANCH }} + path: phpBB3 + + - name: Checkout extension + uses: actions/checkout@v3 + with: + path: phpBB3/phpBB/ext/${{ env.EXTVENDOR }}/${{ env.EXTNAME }} + + - id: database-type + env: + MATRIX_DB: ${{ matrix.db }} + run: | + db=$(echo "${MATRIX_DB%%:*}") + echo "::set-output name=db::$db" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap + coverage: none + + - name: Setup environment for phpBB + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: '0' + run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0} + working-directory: ./phpBB3 + + - name: Setup database + env: + DB: ${{steps.database-type.outputs.db}} + MYISAM: '0' + run: .github/setup-database.sh $DB $MYISAM + working-directory: ./phpBB3 + + - name: Setup PHPUnit files + run: mkdir -p phpBB/ext/$EXTVENDOR/$EXTNAME/.github && cp .github/phpunit* $_ + working-directory: ./phpBB3 + + - name: Run unit tests + env: + DB: ${{steps.database-type.outputs.db}} + run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTVENDOR/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php + working-directory: ./phpBB3 + # END PostgreSQL Job + + # START Other Tests Job (SQLite 3 and mssql) + other-tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - php: '7.3' + db: "sqlite3" + - php: '7.3' + db: "mcr.microsoft.com/mssql/server:2017-latest" + db_alias: 'MSSQL 2017' + - php: '7.3' + db: "mcr.microsoft.com/mssql/server:2019-latest" + db_alias: 'MSSQL 2019' + + name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }} + + services: + mssql: + image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-latest' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }} + env: + SA_PASSWORD: "Pssw0rd_12" + ACCEPT_EULA: "y" + ports: + - 1433:1433 + options: >- + --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Pssw0rd_12' -Q \"Use [master]; CREATE DATABASE [phpbb_tests] COLLATE Latin1_General_CI_AS\" || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + --health-start-period 10s + + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 + + steps: + - name: Checkout phpBB + uses: actions/checkout@v3 + with: + repository: phpbb/phpbb + ref: ${{ env.PHPBB_BRANCH }} + path: phpBB3 + + - name: Checkout extension + uses: actions/checkout@v3 + with: + path: phpBB3/phpBB/ext/${{ env.EXTVENDOR }}/${{ env.EXTNAME }} + + - id: database-type + env: + MATRIX_DB: ${{ matrix.db }} + run: | + if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-latest' ] + then + db='mssql' + else + db=$(echo "${MATRIX_DB%%:*}") + fi + echo "db=$db" >> $GITHUB_OUTPUT + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap + coverage: none + + - name: Setup environment for phpBB + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: '0' + run: .github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0} + working-directory: ./phpBB3 + + - name: Setup database + env: + DB: ${{steps.database-type.outputs.db}} + MYISAM: '0' + run: .github/setup-database.sh $DB $MYISAM + working-directory: ./phpBB3 + + - name: Setup PHPUnit files + run: mkdir -p phpBB/ext/$EXTVENDOR/$EXTNAME/.github && cp .github/phpunit* $_ + working-directory: ./phpBB3 + + - name: Run unit tests + env: + DB: ${{steps.database-type.outputs.db}} + run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTVENDOR/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php + working-directory: ./phpBB3 + # END Other Tests Job + + # Test with IIS & PostgreSQL on Windows + windows-tests: + runs-on: windows-latest + strategy: + matrix: + include: + - php: '7.4' + db: "postgres" + - php: '8.0' + db: "postgres" + - php: '8.1' + db: "postgres" + - php: '8.2' + db: "postgres" + + name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }} + + steps: + - name: Prepare git for Windows + run: | + git config --system core.autocrlf false + git config --system core.eol lf + + - name: Checkout phpBB + uses: actions/checkout@v3 + with: + repository: phpbb/phpbb + ref: ${{ env.PHPBB_BRANCH }} + path: phpBB3 + + - name: Checkout extension + uses: actions/checkout@v3 + with: + path: phpBB3/phpBB/ext/${{ env.EXTVENDOR }}/${{ env.EXTNAME }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, intl, gd, exif, iconv, pgsql, pdo_pgsql + ini-values: upload_tmp_dir=${{ runner.temp }}, sys_temp_dir=${{ runner.temp }} + coverage: none + + - name: Setup environment for phpBB + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: '0' + GITHUB_WORKSPACE: ${{ github.workspace }} + TEMP_DIR: ${{ runner.temp }} + run: | + Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All + Set-Service wuauserv -StartupType Manual + (Get-Content ${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config).replace("", "`n`t`n`t`t`n`t") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config + (Get-Content ${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config).replace("`t", "`t`t`n`t") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config + choco install urlrewrite -y + Import-Module WebAdministration + New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB3\phpBB" -Force + $session = Get-PSSession -Name WinPSCompatSession + $sb = {Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'}} + Invoke-Command -Scriptblock $sb -Session $session + $sb = {Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value true -location "IIS:\Sites\phpBBTest"} + Invoke-Command -Scriptblock $sb -Session $session + Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`r`n127.0.0.1`tphpbb.test" -Force + [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";%windir%\system32\inetsrv") + echo Setup FAST-CGI configuration + Add-WebConfiguration -Filter /system.webServer/fastCgi -PSPath IIS:\ -Value @{fullpath="C:\tools\php\php-cgi.exe"} + echo Setup FACT-CGI handler + New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either + iisreset + NET START W3SVC + mkdir "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\cache\test" + mkdir "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\cache\installer" + icacls "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\cache" /grant Users:F /T + icacls "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\files" /grant Users:F /T + icacls "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\store" /grant Users:F /T + icacls "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\images\avatars\upload" /grant Users:F /T + $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow") + $acl = Get-ACL "${env:TEMP_DIR}" + $acl.AddAccessRule($accessRule) + Set-ACL -Path "${env:TEMP_DIR}" -ACLObject $acl + cd ${env:GITHUB_WORKSPACE}\phpBB3\phpBB + php ..\composer.phar install + php ..\composer.phar remove phpunit/dbunit --dev --update-with-dependencies + php ..\composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 doctrine/instantiator:^1.4 --dev --update-with-all-dependencies --ignore-platform-reqs + cd .. + + - name: Setup database + env: + DB: ${{steps.database-type.outputs.db}} + MYISAM: '0' + GITHUB_WORKSPACE: ${{ github.workspace }} + run: | + $postgreSqlSvc = Get-Service "postgresql*" + Set-Service $postgreSqlSvc.Name -StartupType manual + $runningStatus = [System.ServiceProcess.ServiceControllerStatus]::Running + $maxStartTimeout = New-TimeSpan -Seconds 30 + try { + $postgreSqlSvc.Start() + $postgreSqlSvc.WaitForStatus($runningStatus, $maxStartTimeout) + } catch { + $_ | select * + } + [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}") + $env:PGPASSWORD = 'root' + psql -c 'ALTER SYSTEM SET hot_standby = on;' -U postgres + psql -c 'ALTER SYSTEM SET wal_level = minimal;' -U postgres + psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres + psql -c 'create database phpbb_tests;' -U postgres + Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender + Set-MpPreference -DisableRealtimeMonitoring $true + working-directory: ./phpBB3 + + - name: Setup PHPUnit files + env: + GITHUB_WORKSPACE: ${{ github.workspace }} + run: | + icacls "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\ext\${env:EXTVENDOR}\${env:EXTNAME}\.github" /grant Users:F /T + copy "${env:GITHUB_WORKSPACE}\phpBB3\.github\phpunit*.*" "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\ext\${env:EXTVENDOR}\${env:EXTNAME}\.github" + working-directory: ./phpBB3 + + - name: Run unit tests + env: + DB: ${{steps.database-type.outputs.db}} + run: | + phpBB/vendor/bin/phpunit --configuration phpBB/ext/${env:EXTVENDOR}/${env:EXTNAME}/.github/phpunit-psql-windows-github.xml --bootstrap ./tests/bootstrap.php + working-directory: ./phpBB3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 19c04182..00000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -# Opt into fully virtualized infrastructure -sudo: required -dist: precise - -language: php - -matrix: - include: - - php: 5.5 - env: DB=none;NOTESTS=1 - - php: 5.4 - env: DB=mysqli #myisam - - php: 5.4 - env: DB=mysql - - php: 5.4 - env: DB=mariadb - - php: 5.4 - env: DB=postgres - - php: 5.4 - env: DB=sqlite3 - - php: 5.5 - env: DB=mysqli - - php: 5.6 - env: DB=mysqli - - php: 7.0 - env: DB=mysqli - - php: 7.1 - env: DB=mysqli - - php: 7.2 - env: DB=mysqli - - php: 7.2 - env: PHPBB_BRANCH="master";DB=mysqli - - php: nightly - env: PHPBB_BRANCH="master";DB=mysqli - allow_failures: - - php: nightly - fast_finish: true - -env: - global: - - EXTNAME="gfksx/thanksforposts" # CHANGE name of the extension HERE - - SNIFF="1" # Should we run code sniffer on your code? - - IMAGE_ICC="1" # Should we run icc profile sniffer on your images? - - EPV="1" # Should we run EPV (Extension Pre Validator) on your code? - - PHPBB_BRANCH="3.2.x" - -branches: - only: - - master - - develop - - /^develop-.*$/ - - /^.*_prep$/ - - /^\d+(\.\d+)?\.x$/ - -before_install: - - sudo mkdir travis - - git clone "https://github.com/phpbb/phpbb-ext-acme-demo.git" - - sudo cp phpbb-ext-acme-demo/phpunit.xml.dist ./ - - sudo cp phpbb-ext-acme-demo/travis/prepare-phpbb.sh travis - - sudo rm -rf phpbb-ext-acme-demo - -install: - - travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH - - cd ../../phpBB3 - - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH - - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - sh -c "if [ '$EPV' = '1' -a '$NOTESTS' = '1' ]; then cd phpBB; composer remove sami/sami --update-with-dependencies --dev --no-interaction; composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs; cd ../; fi" - -before_script: - - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - -script: - - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME $NOTESTS; fi" - - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS; fi" - - sh -c "if [ '$EPV' != '0' ] && [ '$NOTESTS' = '1' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi" - - sh -c "if [ '$NOTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php; fi" diff --git a/acp/acp_thanks_info.php b/acp/acp_thanks_info.php index c8b41473..c0ab79f5 100644 --- a/acp/acp_thanks_info.php +++ b/acp/acp_thanks_info.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -14,13 +16,13 @@ class acp_thanks_info { function module() { - return array( + return [ 'filename' => '\gfksx\thanksforposts\acp\acp_thanks_module', 'title' => 'ACP_THANKS_SETTINGS', - 'version' => '1.3.4', - 'modes' => array( - 'thanks' => array('title' => 'ACP_THANKS_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')), - ), - ); + 'version' => '2.0.7', + 'modes' => [ + 'thanks' => ['title' => 'ACP_THANKS_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']], + ], + ]; } } diff --git a/acp/acp_thanks_module.php b/acp/acp_thanks_module.php index 0f969906..03aff1a3 100644 --- a/acp/acp_thanks_module.php +++ b/acp/acp_thanks_module.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -16,55 +18,71 @@ class acp_thanks_module { var $u_action; - var $new_config = array(); + var $new_config = []; function main($id, $mode) { - global $config, $request, $user, $phpbb_container, $template; + global $phpbb_container; + + /** @var \phpbb\config\config $config Config object */ + $config = $phpbb_container->get('config'); + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + /** @var \phpbb\request\request $request Request object */ + $request = $phpbb_container->get('request'); + + /** @var \phpbb\template\template $template Template object */ + $template = $phpbb_container->get('template'); + + /** @var \phpbb\user $user User object */ + $user = $phpbb_container->get('user'); $submit = $request->is_set_post('submit'); $form_key = 'acp_thanks'; add_form_key($form_key); + /** - * Validation types are: - * string, int, bool, - * script_path (absolute path in url - beginning with / and no trailing slash), - * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) - */ - $display_vars = array( + * Validation types are: + * string, int, bool, + * script_path (absolute path in url - beginning with / and no trailing slash), + * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) + */ + $display_vars = [ 'title' => 'ACP_THANKS_SETTINGS', - 'vars' => array( - 'legend' => 'GENERAL_OPTIONS', - 'remove_thanks' => array('lang' => 'REMOVE_THANKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_only_first_post' => array('lang' => 'THANKS_ONLY_FIRST_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_global_post' => array('lang' => 'THANKS_GLOBAL_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_info_page' => array('lang' => 'THANKS_INFO_PAGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_postlist_view' => array('lang' => 'THANKS_POSTLIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_number_post' => array('lang' => 'THANKS_NUMBER_POST', 'validate' => 'int:1:250', 'type' => 'text:4:6', 'explain' => true), - 'thanks_time_view' => array('lang' => 'THANKS_TIME_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_counters_view' => array('lang' => 'THANKS_COUNTERS_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_profilelist_view' => array('lang' => 'THANKS_PROFILELIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_number' => array('lang' => 'THANKS_NUMBER', 'validate' => 'int:1', 'type' => 'text:4:4', 'explain' => true), - 'thanks_top_number' => array('lang' => 'THANKS_TOP_NUMBER', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), - ) - ); + 'vars' => [ + 'legend' => 'GENERAL_OPTIONS', + 'remove_thanks' => ['lang' => 'REMOVE_THANKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_only_first_post' => ['lang' => 'THANKS_ONLY_FIRST_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_global_post' => ['lang' => 'THANKS_GLOBAL_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_info_page' => ['lang' => 'THANKS_INFO_PAGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_postlist_view' => ['lang' => 'THANKS_POSTLIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_number_post' => ['lang' => 'THANKS_NUMBER_POST', 'validate' => 'int:1:250', 'type' => 'text:4:6', 'explain' => true], + 'thanks_time_view' => ['lang' => 'THANKS_TIME_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_counters_view' => ['lang' => 'THANKS_COUNTERS_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_profilelist_view' => ['lang' => 'THANKS_PROFILELIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_number' => ['lang' => 'THANKS_NUMBER', 'validate' => 'int:1', 'type' => 'text:4:4', 'explain' => true], + 'thanks_top_number' => ['lang' => 'THANKS_TOP_NUMBER', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true], + ] + ]; if (isset($display_vars['lang'])) { - $user->add_lang($display_vars['lang']); + $language->add_lang($display_vars['lang']); } $this->new_config = $config; - $cfg_array = ($request->is_set('config')) ? $request->variable('config', array('' => ''), true) : $this->new_config; - $error = array(); + $cfg_array = ($request->is_set('config')) ? $request->variable('config', ['' => ''], true) : $this->new_config; + $error = []; // We validate the complete config if whished validate_config_vars($display_vars['vars'], $cfg_array, $error); if ($submit && !check_form_key($form_key)) { - $error[] = $user->lang('FORM_INVALID'); + $error[] = $language->lang('FORM_INVALID'); } // Do not write values if there is an error if (sizeof($error)) @@ -94,20 +112,21 @@ function main($id, $mode) $phpbb_log = $phpbb_container->get('log'); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); - trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); + trigger_error($language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); } $this->tpl_name = 'acp_thanks'; $this->page_title = $display_vars['title']; - $template->assign_vars(array( - 'L_TITLE' => $user->lang($display_vars['title']), - 'L_TITLE_EXPLAIN' => $user->lang($display_vars['title'] . '_EXPLAIN'), + $template->assign_vars([ + 'L_TITLE' => $language->lang($display_vars['title']), + 'L_TITLE_EXPLAIN' => $language->lang($display_vars['title'] . '_EXPLAIN'), 'S_ERROR' => (sizeof($error)) ? true : false, 'ERROR_MSG' => implode('
', $error), - 'U_ACTION' => $this->u_action) + 'U_ACTION' => $this->u_action, + ] ); // Output relevant page @@ -120,9 +139,10 @@ function main($id, $mode) if (strpos($config_key, 'legend') !== false) { - $template->assign_block_vars('options', array( + $template->assign_block_vars('options', [ 'S_LEGEND' => true, - 'LEGEND' => $user->lang($vars)) + 'LEGEND' => $language->lang($vars), + ] ); continue; @@ -132,11 +152,11 @@ function main($id, $mode) $l_explain = ''; if ($vars['explain'] && isset($vars['lang_explain'])) { - $l_explain = $user->lang($vars['lang_explain']); + $l_explain = $language->lang($vars['lang_explain']); } else if ($vars['explain']) { - $l_explain = $user->lang($vars['lang'] . '_EXPLAIN'); + $l_explain = $language->lang($vars['lang'] . '_EXPLAIN'); } $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); @@ -146,13 +166,13 @@ function main($id, $mode) continue; } - $template->assign_block_vars('options', array( + $template->assign_block_vars('options', [ 'KEY' => $config_key, - 'TITLE' => $user->lang($vars['lang']), + 'TITLE' => $language->lang($vars['lang']), 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content, - ) + ] ); unset($display_vars['vars'][$config_key]); diff --git a/acp/acp_thanks_refresh_info.php b/acp/acp_thanks_refresh_info.php index 09a2eaa2..3785cb82 100644 --- a/acp/acp_thanks_refresh_info.php +++ b/acp/acp_thanks_refresh_info.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -14,13 +16,13 @@ class acp_thanks_refresh_info { function module() { - return array( + return [ 'filename' => '\gfksx\thanksforposts\acp\acp_thanks_refresh_module', 'title' => 'ACP_THANKS_REFRESH', - 'version' => '1.3.4', - 'modes' => array( - 'thanks' => array('title' => 'ACP_THANKS_REFRESH', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')), - ), - ); + 'version' => '2.0.7', + 'modes' => [ + 'thanks' => ['title' => 'ACP_THANKS_REFRESH', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']], + ], + ]; } } diff --git a/acp/acp_thanks_refresh_module.php b/acp/acp_thanks_refresh_module.php index 37732987..5f2aa6bc 100644 --- a/acp/acp_thanks_refresh_module.php +++ b/acp/acp_thanks_refresh_module.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -19,18 +21,36 @@ class acp_thanks_refresh_module function main($id, $mode) { - global $db, $user, $request, $template, $cache, $config, $phpbb_container; + global $phpbb_container; + + /** @var \phpbb\cache\driver\driver_interface $cache Cache driver object */ + $cache = $phpbb_container->get('cache.driver'); + + /** @var \phpbb\config\config $config Config object */ + $config = $phpbb_container->get('config'); + + /** @var \phpbb\db\driver\driver_interface $db DBAL object */ + $db = $phpbb_container->get('dbal.conn'); + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + /** @var \phpbb\request\request $request Request object */ + $request = $phpbb_container->get('request'); + + /** @var \phpbb\template\template $template Template object */ + $template = $phpbb_container->get('template'); + + /** @var string $thanks_table _thanks database table */ + $thanks_table = $phpbb_container->getParameter('tables.thanks'); $this->tpl_name = 'acp_thanks_refresh'; $this->page_title = 'ACP_THANKS_REFRESH'; - $posts_delete_us = array(); + $posts_delete_us = []; $del_thanks = $end_thanks = $del_uthanks = $end_posts_thanks = $end_users_thanks = $thanks_update = 0; $all_users_thanks = $all_thanks = $all_posts_number = $all_posts_thanks = 0; - $thanks_table = $phpbb_container->getParameter('tables.thanks'); - - // check mode $refresh = $request->variable('refresh', false); if (!$refresh) { @@ -40,7 +60,7 @@ function main($id, $mode) $cache->destroy('_all_posts'); $cache->destroy('_all_posts_number'); - // count all posts, thanks, users + // Count all posts, thanks, users $sql = 'SELECT COUNT(DISTINCT post_id) as all_posts_thanks FROM ' . $thanks_table; $result = $db->sql_query($sql); @@ -59,21 +79,20 @@ function main($id, $mode) $all_thanks = (int) $db->sql_fetchfield('total_match_count'); $db->sql_freeresult($result); - $all_posts = array(); - $sql_ary = array( + $all_posts = []; + $sql_ary = [ 'SELECT' => 't.*', - 'FROM' => array( - $thanks_table => 't', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array(POSTS_TABLE => 'p'), + 'FROM' => [$thanks_table => 't'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [POSTS_TABLE => 'p'], 'ON' => 't.post_id = p.post_id', - ), - ), + ], + ], 'WHERE' => 'p.post_id IS NULL', - ); + ]; $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + while ($row = $db->sql_fetchrow($result)) { $all_posts[] = (int) $row['post_id']; @@ -88,24 +107,23 @@ function main($id, $mode) $cache->put('_all_posts', $all_posts); $cache->put('_all_posts_number', $all_posts_number); - $template->assign_vars(array( + $template->assign_vars([ 'S_REFRESH' => false, - 'L_WARNING' => sprintf($user->lang['WARNING']), - )); + ]); } - //update + + // Update if ($refresh) { - // check mode if (confirm_box(true)) { $all_users_thanks = (int) $cache->get('_all_users_thanks'); $all_thanks = (int) $cache->get('_all_thanks'); - $all_posts = $cache->get('_all_posts'); + $all_posts = (array) $cache->get('_all_posts'); $all_posts_number = (int) $cache->get('_all_posts_number'); $all_posts_thanks = (int) $cache->get('_all_posts_thanks'); - // update delete posts + // Update deleted posts thanks if (!empty($all_posts)) { $sql = 'DELETE FROM ' . $thanks_table ." @@ -115,20 +133,18 @@ function main($id, $mode) $end_thanks = $all_thanks - $del_thanks; } - // update delete users - $sql_ary = array( + // Update deleted users thanks + $sql_ary = [ 'SELECT' => 't.post_id', - 'FROM' => array( - $thanks_table => 't', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array(POSTS_TABLE => 'p'), + 'FROM' => [$thanks_table => 't'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [POSTS_TABLE => 'p'], 'ON' => 't.post_id = p.post_id', - ), - ), + ], + ], 'WHERE' => 'p.poster_id = '. ANONYMOUS, - ); + ]; $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); while ($row = $db->sql_fetchrow($result)) @@ -145,52 +161,52 @@ function main($id, $mode) $db->sql_query($sql); } - //update move posts /topics /forums and change posters - $sql_ary = array( + // Update moved posts /topics /forums and changed posters data + $sql_ary = [ 'SELECT' => 'p.post_id', - 'FROM' => array( - POSTS_TABLE => 'p', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array($thanks_table => 't'), + 'FROM' => [POSTS_TABLE => 'p'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$thanks_table => 't'], 'ON' => 'p.post_id = t.post_id', - ), - ), + ], + ], 'WHERE' => 'p.topic_id <> t.topic_id OR p.forum_id <> t.forum_id OR p.poster_id <> t.poster_id', - ); + ]; $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); - $thanks_update = 0; + + $thanks_updated = 0; if ($result) { while ($row = $db->sql_fetchrow($result)) { $sql = 'SELECT forum_id, topic_id, poster_id, post_id FROM ' . POSTS_TABLE . ' - WHERE post_id = ' . $row['post_id']; + WHERE post_id = ' . (int) $row['post_id']; $results = $db->sql_query($sql); $rows = $db->sql_fetchrow($results); $db->sql_freeresult($results); - $sql_ary = array( + $sql_ary = [ 'post_id' => $rows['post_id'], 'forum_id' => $rows['forum_id'], 'topic_id' => $rows['topic_id'], 'poster_id' => $rows['poster_id'], - ); + ]; $sql = 'UPDATE ' . $thanks_table . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) .' WHERE post_id = '. $sql_ary['post_id']; $db->sql_query($sql); - $thanks_update++; + $thanks_updated++; } } $db->sql_freeresult($result); $end_thanks = $end_thanks - $del_uthanks; $del_thanks = $del_thanks + $del_uthanks; - // delete thanks only first post + + // Delete topic first posts thanks if (isset($config['thanks_only_first_post']) ? $config['thanks_only_first_post'] : false) { $sql = 'SELECT topic_first_post_id @@ -212,7 +228,8 @@ function main($id, $mode) $del_thanks = $del_thanks + $del_nofirst_thanks; } } - // delete thanks global announce + + // Delete global announces thanks if (isset($config['thanks_global_post']) ? !$config['thanks_global_post'] : false) { $sql = 'SELECT topic_id @@ -235,12 +252,12 @@ function main($id, $mode) $del_thanks = $del_thanks + $del_global_thanks; } } - // delete selfthanks + + // Delete selfthanks $sql = 'DELETE FROM ' . $thanks_table .' WHERE poster_id = user_id'; - $result = $db->sql_query($sql); + $db->sql_query($sql); $del_selfthanks = $db->sql_affectedrows(); - $db->sql_freeresult($result); $del_thanks = $del_thanks + $del_selfthanks; $end_thanks = $end_thanks - $del_selfthanks; @@ -257,22 +274,22 @@ function main($id, $mode) $end_users_thanks = (int) $db->sql_fetchfield('end_users_thanks'); $db->sql_freeresult($result); - $template->assign_vars(array( + $template->assign_vars([ 'S_REFRESH' => true, - )); + ]); } else { - $s_hidden_fields = build_hidden_fields(array( + $s_hidden_fields = build_hidden_fields([ 'refresh' => true, - ) - ); - //display mode + ]); + + // Display mode confirm_box(false, 'REFRESH_THANKS', $s_hidden_fields); - trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action)); + trigger_error($language->lang('TRUNCATE_NO_THANKS') . adm_back_link($this->u_action)); } } - $template->assign_vars(array( + $template->assign_vars([ 'POSTS' => $all_posts_number, 'POSTSTHANKS' => $all_posts_thanks, @@ -285,6 +302,6 @@ function main($id, $mode) 'POSTSEND' => $end_posts_thanks, 'USERSEND' => $end_users_thanks, 'THANKSEND' => $end_thanks, - )); + ]); } } diff --git a/acp/acp_thanks_reput_info.php b/acp/acp_thanks_reput_info.php index 19b49796..e36d6f06 100644 --- a/acp/acp_thanks_reput_info.php +++ b/acp/acp_thanks_reput_info.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -14,13 +16,13 @@ class acp_thanks_reput_info { function module() { - return array( + return [ 'filename' => '\gfksx\thanksforposts\acp\acp_thanks_reput_module', 'title' => 'ACP_THANKS_REPUT_SETTINGS', - 'version' => '1.3.4', - 'modes' => array( - 'thanks' => array('title' => 'ACP_THANKS_REPUT_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')), - ), - ); + 'version' => '2.0.7', + 'modes' => [ + 'thanks' => ['title' => 'ACP_THANKS_REPUT_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']], + ], + ]; } } diff --git a/acp/acp_thanks_reput_module.php b/acp/acp_thanks_reput_module.php index d610c70f..8cb35a7b 100644 --- a/acp/acp_thanks_reput_module.php +++ b/acp/acp_thanks_reput_module.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -16,56 +18,75 @@ class acp_thanks_reput_module { var $u_action; - var $new_config = array(); + var $new_config = []; function main($id, $mode) { - global $request, $user, $template, $config, $phpbb_root_path, $phpbb_container; + global $phpbb_container; + + /** @var \phpbb\config\config $config Config object */ + $config = $phpbb_container->get('config'); + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + /** @var \phpbb\request\request $request Request object */ + $request = $phpbb_container->get('request'); + + /** @var \phpbb\template\template $template Template object */ + $template = $phpbb_container->get('template'); + + /** @var \phpbb\user $user User object */ + $user = $phpbb_container->get('user'); + + /** @var string $phpbb_root_path phpbb_root_path */ + $phpbb_root_path = $phpbb_container->getParameter('core.root_path'); $submit = $request->is_set_post('submit'); $form_key = 'acp_thanks_reput'; add_form_key($form_key); + /** - * Validation types are: - * string, int, bool, - * script_path (absolute path in url - beginning with / and no trailing slash), - * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) - */ - $display_vars = array( + * Validation types are: + * string, int, bool, + * script_path (absolute path in url - beginning with / and no trailing slash), + * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) + */ + $display_vars = [ 'title' => 'ACP_THANKS_REPUT_SETTINGS', - 'vars' => array( - 'legend' => 'GENERAL_OPTIONS', - 'thanks_post_reput_view' => array('lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_topic_reput_view' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_forum_reput_view' => array('lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_number_digits' => array('lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), - 'thanks_number_row_reput' => array('lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), - 'legend1' => 'GRAPHIC_OPTIONS', - 'thanks_reput_graphic' => array('lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'thanks_reput_height' => array('lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), - 'thanks_reput_level' => array('lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => true), - 'thanks_reput_image' => array('lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'.$user->lang['THANKS_REPUT_IMAGE'].''), - 'thanks_reput_image_back' => array('lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'.$user->lang['THANKS_REPUT_IMAGE_BACK'].''), - 'legend2' => 'GRAPHIC_DEFAULT', - ) - ); + 'vars' => [ + 'legend' => 'GENERAL_OPTIONS', + 'thanks_post_reput_view' => ['lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_topic_reput_view' => ['lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_forum_reput_view' => ['lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_number_digits' => ['lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true], + 'thanks_number_row_reput' => ['lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true], + 'legend1' => 'GRAPHIC_OPTIONS', + 'thanks_reput_graphic' => ['lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], + 'thanks_reput_height' => ['lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $language->lang('PIXEL')], + 'thanks_reput_level' => ['lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => true], + 'thanks_reput_image' => ['lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
' . $language->lang('THANKS_REPUT_IMAGE') . ''], + 'thanks_reput_image_back' => ['lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
' . $language->lang('THANKS_REPUT_IMAGE_BACK') . ''], + 'legend2' => 'GRAPHIC_DEFAULT', + ] + ]; if (isset($display_vars['lang'])) { - $user->add_lang($display_vars['lang']); + $language->add_lang($display_vars['lang']); } $this->new_config = $config; - $cfg_array = ($request->is_set('config')) ? $request->variable('config', array('' => ''), true) : $this->new_config; - $error = array(); + $cfg_array = ($request->is_set('config')) ? $request->variable('config', ['' => ''], true) : $this->new_config; + $error = []; // We validate the complete config if whished validate_config_vars($display_vars['vars'], $cfg_array, $error); if ($submit && !check_form_key($form_key)) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = $language->lang('FORM_INVALID'); } // Do not write values if there is an error @@ -75,12 +96,13 @@ function main($id, $mode) } if (!empty($cfg_array['thanks_reput_image']) && !file_exists($phpbb_root_path . $config['thanks_reput_image'])) { - $error[] = $user->lang['THANKS_REPUT_IMAGE_NOEXIST']; + $error[] = $language->lang('THANKS_REPUT_IMAGE_NOEXIST'); } if (!empty($cfg_array['thanks_reput_image_back']) && !file_exists($phpbb_root_path . $config['thanks_reput_image_back'])) { - $error[] = $user->lang['THANKS_REPUT_IMAGE_BACK_NOEXIST']; + $error[] = $language->lang('THANKS_REPUT_IMAGE_BACK_NOEXIST'); } + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) { @@ -103,24 +125,24 @@ function main($id, $mode) $phpbb_log = $phpbb_container->get('log'); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + trigger_error($language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); } $this->tpl_name = 'acp_thanks_reput'; $this->page_title = $display_vars['title']; - $template->assign_vars(array( - 'L_TITLE' => $user->lang[$display_vars['title']], - 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], - 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BLUE'], - 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_GOLD'], - 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BACK'], - 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_RED'], - 'GRAPHIC_BLOCK_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_BACK'], - 'S_ERROR' => (sizeof($error)) ? true : false, - 'ERROR_MSG' => implode('
', $error), - 'U_ACTION' => $this->u_action) - ); + $template->assign_vars([ + 'L_TITLE' => $language->lang($display_vars['title']), + 'L_TITLE_EXPLAIN' => $language->lang($display_vars['title'] . '_EXPLAIN'), + 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_BLUE'), + 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_GOLD'), + 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_BACK'), + 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_BLOCK_RED'), + 'GRAPHIC_BLOCK_BACK_EXAMPLE'=> $phpbb_root_path . $language->lang('GRAPHIC_BLOCK_BACK'), + 'S_ERROR' => (sizeof($error)) ? true : false, + 'ERROR_MSG' => implode('
', $error), + 'U_ACTION' => $this->u_action + ]); // Output relevant page foreach ($display_vars['vars'] as $config_key => $vars) @@ -132,40 +154,38 @@ function main($id, $mode) if (strpos($config_key, 'legend') !== false) { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) - ); + $template->assign_block_vars('options', [ + 'S_LEGEND' => true, + 'LEGEND' => $language->lang($vars), + ]); continue; } - $type = explode(':', $vars['type']); + $type = explode(':', $vars['type']); $l_explain = ''; if ($vars['explain'] && isset($vars['lang_explain'])) { - $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + $l_explain = $language->lang($vars['lang_explain']); } else if ($vars['explain']) { - $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + $l_explain = $language->lang($vars['lang'] . '_EXPLAIN'); } $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); - if (empty($content)) { continue; } - $template->assign_block_vars('options', array( + $template->assign_block_vars('options', [ 'KEY' => $config_key, - 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], + 'TITLE' => $language->lang($vars['lang']), 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content, - ) - ); + ]); unset($display_vars['vars'][$config_key]); } diff --git a/acp/acp_thanks_truncate_info.php b/acp/acp_thanks_truncate_info.php index fa8f7567..cc1f0750 100644 --- a/acp/acp_thanks_truncate_info.php +++ b/acp/acp_thanks_truncate_info.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -14,13 +16,13 @@ class acp_thanks_truncate_info { function module() { - return array( + return [ 'filename' => '\gfksx\thanksforposts\acp\acp_thanks_truncate_module', 'title' => 'ACP_THANKS_TRUNCATE', - 'version' => '1.3.4', - 'modes' => array( - 'thanks' => array('title' => 'ACP_THANKS_TRUNCATE', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')), - ), - ); + 'version' => '2.0.7', + 'modes' => [ + 'thanks' => ['title' => 'ACP_THANKS_TRUNCATE', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']], + ], + ]; } } diff --git a/acp/acp_thanks_truncate_module.php b/acp/acp_thanks_truncate_module.php index 4db16017..8fcab31f 100644 --- a/acp/acp_thanks_truncate_module.php +++ b/acp/acp_thanks_truncate_module.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\acp; @@ -19,13 +21,26 @@ class acp_thanks_truncate_module function main($id, $mode) { - global $db, $request, $user, $template, $phpbb_container; + global $phpbb_container; - $this->tpl_name = 'acp_thanks_truncate'; - $this->page_title = 'ACP_THANKS_TRUNCATE'; + /** @var \phpbb\db\driver\driver_interface $db DBAL object */ + $db = $phpbb_container->get('dbal.conn'); + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + /** @var \phpbb\request\request $request Request object */ + $request = $phpbb_container->get('request'); + + /** @var \phpbb\template\template $template Template object */ + $template = $phpbb_container->get('template'); + /** @var string $thanks_table _thanks database table */ $thanks_table = $phpbb_container->getParameter('tables.thanks'); + $this->tpl_name = 'acp_thanks_truncate'; + $this->page_title = 'ACP_THANKS_TRUNCATE'; + $sql = 'SELECT COUNT(post_id) as total_match_count FROM ' . $thanks_table; $result = $db->sql_query($sql); @@ -48,12 +63,10 @@ function main($id, $mode) if ($truncate) { - // check mode if (confirm_box(true)) { $sql = 'DELETE FROM ' . $thanks_table; - $result = $db->sql_query($sql); - $db->sql_freeresult($result); + $db->sql_query($sql); $sql = 'SELECT COUNT(post_id) as total_match_count FROM ' . $thanks_table; @@ -66,17 +79,17 @@ function main($id, $mode) } else { - $s_hidden_fields = build_hidden_fields(array( + $s_hidden_fields = build_hidden_fields([ 'truncate' => true, - ) - ); - //display mode + ]); + + // Display mode confirm_box(false, 'TRUNCATE_THANKS', $s_hidden_fields); - trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action)); + trigger_error($language->lang('TRUNCATE_NO_THANKS') . adm_back_link($this->u_action)); } } - $template->assign_vars(array( + $template->assign_vars([ 'ALLTHANKS' => $all_thanks, 'POSTSTHANKS' => $all_posts_thanks, 'USERSTHANKS' => $all_users_thanks, @@ -84,6 +97,6 @@ function main($id, $mode) 'USERSEND' => $end_users_thanks, 'THANKSEND' => $end_thanks, 'S_TRUNCATE' => $truncate, - )); + ]); } } diff --git a/composer.json b/composer.json index bf16f057..396252d2 100644 --- a/composer.json +++ b/composer.json @@ -3,8 +3,8 @@ "type": "phpbb-extension", "description": "Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.", "homepage": "http://www.phpbbguru.net", - "version": "2.0.6", - "license": "GPL-2.0", + "version": "2.0.7", + "license": "GPL-2.0-only", "authors": [ { "name": "Палыч", @@ -24,6 +24,11 @@ "display-name": "Thanks for posts", "soft-require": { "phpbb/phpbb": ">=3.2.0" + }, + "version-check": { + "host": "rxu.github.io", + "directory": "/versions/thanksforposts", + "filename": "version.json" } } } diff --git a/config/routing.yml b/config/routing.yml index b921dc05..5ad33290 100644 --- a/config/routing.yml +++ b/config/routing.yml @@ -1,5 +1,5 @@ gfksx_thanksforposts_thankslist_controller_user: - path: /thankslist/{mode}/{author_id}/{give}{tslash} + path: /thankslist/{mode}/{author_id}/{give} defaults: { _controller: gfksx.thanksforposts.controller.thankslist:main, top: 0, start: 0, sort_key: "a", sort_dir: "d", topic_id: 0, return_chars: 300 } requirements: mode: \w+ @@ -11,10 +11,9 @@ gfksx_thanksforposts_thankslist_controller_user: topic_id: \d+ return_chars: \d+ give: true|false - tslash : "/?" gfksx_thanksforposts_thankslist_controller: - path: /thankslist{tslash} + path: /thankslist defaults: { _controller: gfksx.thanksforposts.controller.thankslist:main, mode: "", author_id: 1, give: "", top: 0, start: 0, sort_key: "a", sort_dir: "d", topic_id: 0, return_chars: 300 } requirements: mode: \w+ @@ -26,14 +25,12 @@ gfksx_thanksforposts_thankslist_controller: topic_id: \d+ return_chars: \d+ give: true|false - tslash : "/?" gfksx_thanksforposts_toplist_controller: - path: /toplist{tslash} + path: /toplist defaults: { _controller: gfksx.thanksforposts.controller.toplist:main, mode: "", start: 0, topic_id: 0, return_chars: 300 } requirements: mode: \w+ start: \d+ topic_id: \d+ return_chars: \d+ - tslash : "/?" diff --git a/config/services.yml b/config/services.yml index 8ee98523..0ce3eaae 100644 --- a/config/services.yml +++ b/config/services.yml @@ -13,6 +13,7 @@ services: - '@cache.driver' - '@request' - '@controller.helper' + - '@language' - '%core.root_path%' - '%core.php_ext%' - '@gfksx.thanksforposts.helper' @@ -31,9 +32,10 @@ services: - '@notification_manager' - '@controller.helper' - '@dispatcher' + - '@language' + - '@user_loader' - '%core.root_path%' - '%core.php_ext%' - - '%core.table_prefix%' - '%tables.thanks%' - '%tables.users%' - '%tables.posts%' @@ -46,12 +48,16 @@ services: - '@auth' - '@template' - '@user' + - '@language' - '@cache.driver' - '@pagination' - '@profilefields.manager' - '@request' - '@controller.helper' + - '@user_loader' + - '%tables.posts%' - '%tables.thanks%' + - '%tables.sessions%' - '%tables.users%' - '%core.root_path%' - '%core.php_ext%' @@ -63,6 +69,7 @@ services: - '@auth' - '@template' - '@user' + - '@language' - '@cache.driver' - '%core.root_path%' - '%core.php_ext%' @@ -70,6 +77,8 @@ services: - '@gfksx.thanksforposts.helper' - '@request' - '@controller.helper' + - '@user_loader' + - '%tables.forums%' - '%tables.thanks%' - '%tables.users%' - '%tables.posts%' diff --git a/controller/thankslist.php b/controller/thankslist.php index f5df0863..910a89f0 100644 --- a/controller/thankslist.php +++ b/controller/thankslist.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\controller; @@ -27,6 +29,9 @@ class thankslist /** @var \phpbb\user */ protected $user; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\cache\driver\driver_interface */ protected $cache; @@ -42,6 +47,15 @@ class thankslist /** @var \phpbb\controller\helper */ protected $controller_helper; + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var string POSTS_TABLE */ + protected $posts_table; + + /** @var string SESSIONS_TABLE */ + protected $sessions_table; + /** @var string THANKS_TABLE */ protected $thanks_table; @@ -55,53 +69,75 @@ class thankslist protected $php_ext; /** - * Constructor - * - * @param \phpbb\config\config $config Config object - * @param \phpbb\db\driver\driver_interface $db DBAL object - * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object - * @param \phpbb\cache\driver\driver_interface $cache Cache driver object - * @param \phpbb\pagination $pagination Pagination object - * @param \phpbb\profilefields\manager $profilefields_manager Profile fields manager object - * @param \phpbb\request\request_interface $request Request object - * @param \phpbb\controller\helper $controller_helper Controller helper object - * @param string $thanks_table THANKS_TABLE - * @param string $users_table USERS_TABLE - * @param string $phpbb_root_path phpbb_root_path - * @param string $php_ext phpEx - * @access public - */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\pagination $pagination, \phpbb\profilefields\manager $profilefields_manager, \phpbb\request\request_interface $request, \phpbb\controller\helper $controller_helper, $thanks_table, $users_table, $phpbb_root_path, $php_ext) + * Constructor + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db DBAL object + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\language\language $language Language object + * @param \phpbb\cache\driver\driver_interface $cache Cache driver object + * @param \phpbb\pagination $pagination Pagination object + * @param \phpbb\profilefields\manager $profilefields_manager Profile fields manager object + * @param \phpbb\request\request_interface $request Request object + * @param \phpbb\controller\helper $controller_helper Controller helper object + * @param \phpbb\user_loader $user_loader User loader object + * @param string $posts_table POSTS_TABLE + * @param string $sessions_table SESSIONS_TABLE + * @param string $thanks_table THANKS_TABLE + * @param string $users_table USERS_TABLE + * @param string $phpbb_root_path phpbb_root_path + * @param string $php_ext phpEx + * @access public + */ + public function __construct( + \phpbb\config\config $config, + \phpbb\db\driver\driver_interface $db, + \phpbb\auth\auth $auth, + \phpbb\template\template $template, + \phpbb\user $user, + \phpbb\language\language $language, + \phpbb\cache\driver\driver_interface $cache, + \phpbb\pagination $pagination, + \phpbb\profilefields\manager $profilefields_manager, + \phpbb\request\request_interface $request, + \phpbb\controller\helper $controller_helper, + \phpbb\user_loader $user_loader, + $posts_table, $thanks_table, $sessions_table, $users_table, $phpbb_root_path, $php_ext + ) { $this->config = $config; $this->db = $db; $this->auth = $auth; $this->template = $template; $this->user = $user; + $this->language = $language; $this->cache = $cache; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; $this->pagination = $pagination; $this->profilefields_manager = $profilefields_manager; $this->request = $request; $this->controller_helper = $controller_helper; + $this->user_loader = $user_loader; + $this->sessions_table = $sessions_table; $this->thanks_table = $thanks_table; $this->users_table = $users_table; + $this->posts_table = $posts_table; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; } public function main($mode, $author_id, $give) { - $this->user->add_lang(array('memberlist', 'groups', 'search')); - $this->user->add_lang_ext('gfksx/thanksforposts', 'thanks_mod'); + $this->language->add_lang(['memberlist', 'groups', 'search']); + $this->language->add_lang('thanks_mod', 'gfksx/thanksforposts'); // Grab data $row_number = $total_users = 0; - $givens = $reseved = $rowsp = $rowsu = $words = $where = array(); + $givens = $reseved = $rowsp = $rowsu = $words = $where = []; $sthanks = false; $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); - $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false; + $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false; if (!$this->auth->acl_gets('u_viewthanks')) { @@ -109,8 +145,9 @@ public function main($mode, $author_id, $give) { trigger_error('NO_VIEW_USERS_THANKS'); } - login_box('', ((isset($this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $this->user->lang['LOGIN_EXPLAIN_MEMBERLIST'])); + login_box('', $this->language->lang('LOGIN_EXPLAIN_' . strtoupper($mode))); } + $top = $this->request->variable('top', 0); $start = $this->request->variable('start', 0); $default_key = 'a'; @@ -124,30 +161,29 @@ public function main($mode, $author_id, $give) { case 'givens': $per_page = $this->config['posts_per_page']; - $page_title = $this->user->lang['SEARCH']; - $template_html = 'thanks_results.html'; + $page_title = $this->language->lang('SEARCH'); + $template_html = '@gfksx_thanksforposts/thanks_results.html'; switch ($give) { case 'true': - $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'true', 'tslash' => '')); + $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $author_id, 'give' => 'true']); - $sql = 'SELECT COUNT(user_id) AS total_match_count - FROM ' . $this->thanks_table . ' - WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND user_id = ' . (int) $author_id; - $where = 'user_id'; + $sql = 'SELECT COUNT(user_id) AS total_match_count + FROM ' . $this->thanks_table . ' + WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND user_id = ' . (int) $author_id; + $where = 'user_id'; break; case 'false': - $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'false', 'tslash' => '')); + $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $author_id, 'give' => 'false']); - $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count - FROM ' . $this->thanks_table . ' - WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND poster_id = ' . (int) $author_id; - $where = 'poster_id'; + $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count + FROM ' . $this->thanks_table . ' + WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND poster_id = ' . (int) $author_id; + $where = 'poster_id'; break; } - $result = $this->db->sql_query($sql); if (!$row = $this->db->sql_fetchrow($result)) @@ -159,19 +195,21 @@ public function main($mode, $author_id, $give) $total_match_count = (int) $row['total_match_count']; $this->db->sql_freeresult($result); - $sql_array = array( + $sql_array = [ 'SELECT' => 'u.username, u.user_colour, p.poster_id, p.post_id, p.topic_id, p.forum_id, p.post_time, p.post_subject, p.post_text, p.post_username, p.bbcode_bitfield, p.bbcode_uid, p.post_attachment, p.enable_bbcode, p. enable_smilies, p.enable_magic_url', - 'FROM' => array ($this->thanks_table => 't'), - 'WHERE' => '('. $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0) AND t.' . $where . ' = ' . (int) $author_id, - ); - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array($this->users_table => 'u'), - 'ON' => 't.poster_id = u.user_id' - ); - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array(POSTS_TABLE => 'p'), - 'ON' => 't.post_id = p.post_id' - ); + 'FROM' => [$this->thanks_table => 't'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->users_table => 'u'], + 'ON' => 't.poster_id = u.user_id', + ], + [ + 'FROM' => [$this->posts_table => 'p'], + 'ON' => 't.post_id = p.post_id', + ], + ], + 'WHERE' => '(' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0) AND t.' . $where . ' = ' . (int) $author_id, + ]; $sql = $this->db->sql_build_query('SELECT_DISTINCT', $sql_array); $result = $this->db->sql_query_limit($sql, $per_page, $start); @@ -187,10 +225,11 @@ public function main($mode, $author_id, $give) // We pre-process some variables here for later usage $row['post_text'] = censor_text($row['post_text']); $text_only_message = $row['post_text']; - // make list items visible as such + + // Make list items visible as such if ($row['bbcode_uid']) { - // no BBCode in text only message + // No BBCode in text only message strip_bbcode($text_only_message, $row['bbcode_uid']); } @@ -214,8 +253,8 @@ public function main($mode, $author_id, $give) if ($row['display_text_only']) { - // limit the message length to return_chars value - $row['post_text'] = get_context($row['post_text'], array(), $return_chars); + // Limit the message length to return_chars value + $row['post_text'] = get_context($row['post_text'], [], $return_chars); $row['post_text'] = bbcode_nl2br($row['post_text']); } else @@ -224,48 +263,48 @@ public function main($mode, $author_id, $give) $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags); } - $this->template->assign_block_vars('searchresults', array ( - 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), - 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), - 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), - 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + $this->template->assign_block_vars('searchresults', [ + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR'=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_SUBJECT' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? '' : $row['post_subject']), 'POST_DATE' => (!empty($row['post_time'])) ? $this->user->format_date($row['post_time']) : '', - 'MESSAGE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']), + 'MESSAGE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : $row['post_text']), 'FORUM_ID' => $row['forum_id'], 'TOPIC_ID' => $row['topic_id'], 'POST_ID' => $row['post_id'], 'U_VIEW_TOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 't=' . $row['topic_id']), 'U_VIEW_FORUM' => append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext", 'f=' . $row['forum_id']), 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "t=" . $row['topic_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'] : '', - )); + ]); } while ($row = $this->db->sql_fetchrow($result)); - $this->db->sql_freeresult($result); } } + if ($total_match_count > 1000) { $total_match_count--; - $l_search_matches = $this->user->lang('FOUND_MORE_SEARCH_MATCHES', $total_match_count); + $l_search_matches = $this->language->lang('FOUND_MORE_SEARCH_MATCHES', $total_match_count); } else { - $l_search_matches = $this->user->lang('FOUND_SEARCH_MATCHES', $total_match_count); + $l_search_matches = $this->language->lang('FOUND_SEARCH_MATCHES', $total_match_count); } $this->pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); - $this->template->assign_vars(array( + $this->template->assign_vars([ 'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $per_page, $start), 'TOTAL_MATCHES' => $total_match_count, 'SEARCH_MATCHES' => $l_search_matches, - 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => '')), - )); + 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller'), + ]); break; default: - $page_title = $this->user->lang['THANKS_USER']; + $page_title = $this->language->lang('THANKS_USER'); $template_html = 'thankslist_body.html'; // Grab relevant data thanks @@ -274,6 +313,7 @@ public function main($mode, $author_id, $give) WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0 GROUP BY user_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $givens[$row['user_id']] = $row['tally']; @@ -285,6 +325,7 @@ public function main($mode, $author_id, $give) WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0 GROUP BY poster_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $reseved[$row['poster_id']] = $row['tally']; @@ -292,12 +333,27 @@ public function main($mode, $author_id, $give) $this->db->sql_freeresult($result); // Sorting - $sort_key_text = array('a' => $this->user->lang['SORT_USERNAME'], 'b' => $this->user->lang['SORT_LOCATION'], 'c' => $this->user->lang['SORT_JOINED'], 'd' => $this->user->lang['SORT_POST_COUNT'], 'e' => 'R_THANKS', 'f' => 'G_THANKS',); - $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'count_thanks', 'f' => 'count_thanks'); + $sort_key_text = [ + 'a' => $this->language->lang('SORT_USERNAME'), + 'b' => $this->language->lang('SORT_LOCATION'), + 'c' => $this->language->lang('SORT_JOINED'), + 'd' => $this->language->lang('SORT_POST_COUNT'), + 'e' => 'R_THANKS', + 'f' => 'G_THANKS', + ]; + + $sort_key_sql = [ + 'a' => 'u.username_clean', + 'b' => 'u.user_from', + 'c' => 'u.user_regdate', + 'd' => 'u.user_posts', + 'e' => 'count_thanks', + 'f' => 'count_thanks', + ]; if ($this->auth->acl_get('u_viewonline')) { - $sort_key_text['l'] = $this->user->lang['SORT_LAST_ACTIVE']; + $sort_key_text['l'] = $this->language->lang('SORT_LAST_ACTIVE'); $sort_key_sql['l'] = 'u.user_lastvisit'; } @@ -310,11 +366,12 @@ public function main($mode, $author_id, $give) $order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); // Build a relevant pagination_url - $params = array(); - $check_params = array( - 'sk' => array('sk', $default_key), - 'sd' => array('sd', 'a'), - ); + $params = []; + $check_params = [ + 'sk' => ['sk', $default_key], + 'sd' => ['sd', 'a'], + ]; + foreach ($check_params as $key => $call) { if (!$this->request->is_set($key)) @@ -331,7 +388,7 @@ public function main($mode, $author_id, $give) $sort_params[] = $param; } } - $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array_merge($params, array('tslash' => ''))); + $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', $params); // Grab relevant data $sql = 'SELECT DISTINCT poster_id @@ -377,17 +434,17 @@ public function main($mode, $author_id, $give) break; } - $sql_array = array( - 'SELECT' => 'u.*', - 'FROM' => array($this->users_table => 'u'), + $sql_array = [ + 'SELECT' => 'u.user_id', + 'FROM' => [$this->users_table => 'u'], 'ORDER_BY' => $order_by, - ); + ]; if ($top) { $total_users = $top; $start = 0; - $page_title = $this->user->lang['REPUT_TOPLIST']; + $page_title = $this->language->lang('REPUT_TOPLIST'); } else { @@ -396,17 +453,22 @@ public function main($mode, $author_id, $give) if ($sortparam) { - $sql_array['FROM'] = array($this->thanks_table => 't'); - $sql_array['SELECT'].= ', count(t.'.$sortparam.'_id) as count_thanks'; - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array($this->users_table => 'u'), - 'ON' => 't.'.$sortparam.'_id = u.user_id' - ); - $sql_array['GROUP_BY'] = 't.'.$sortparam.'_id'; + $sql_array = [ + 'FROM' => [$this->thanks_table => 't'], + 'SELECT' => $sql_array['SELECT'] .= ', count(t . ' . $sortparam . '_id) as count_thanks', + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->users_table => 'u'], + 'ON' => 't . ' . $sortparam . '_id = u.user_id', + ], + ], + 'ORDER_BY' => $order_by, + 'GROUP_BY' => 't.' . $sortparam.'_id, u.user_id', + ]; } $where[] = $rows[0]; - for ($i = 1, $end = sizeof($rows); $i < $end; ++$i) + for ($i = 1, $end = count($rows); $i < $end; ++$i) { $where[] = $rows[$i]; } @@ -421,27 +483,23 @@ public function main($mode, $author_id, $give) else { $sql = 'SELECT session_user_id, MAX(session_time) AS session_time - FROM ' . SESSIONS_TABLE . ' - WHERE session_time >= ' . (time() - $this->config['session_length']) . ' + FROM ' . $this->sessions_table . ' + WHERE session_time >= ' . (time() - (int) $this->config['session_length']) . ' AND ' . $this->db->sql_in_set('session_user_id', $where) . ' GROUP BY session_user_id'; $result_sessions = $this->db->sql_query($sql); - $session_times = array(); + $session_times = []; while ($session = $this->db->sql_fetchrow($result_sessions)) { $session_times[$session['session_user_id']] = $session['session_time']; } $this->db->sql_freeresult($result_sessions); - $user_list = array(); - $id_cache = array(); + $user_list = []; do { - $row['session_time'] = (!empty($session_times[$session['user_id']])) ? $session_times[$session['user_id']] : 0; - $row['last_visit'] = (!empty($session['session_time'])) ? $session['session_time'] : $session['user_lastvisit']; $user_list[] = (int) $row['user_id']; - $id_cache[$row['user_id']] = $row; } while ($row = $this->db->sql_fetchrow($result)); $this->db->sql_freeresult($result); @@ -471,43 +529,44 @@ public function main($mode, $author_id, $give) } } - //do - for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) + $this->user_loader->load_users($user_list); + for ($i = 0, $end = count($user_list); $i < $end; ++$i) { $user_id = $user_list[$i]; - $row = $id_cache[$user_id]; - $rank_title = $rank_img = $rank_img_src = ''; + $row = $this->user_loader->get_user($user_id); + $row['session_time'] = (!empty($session_times[$row['user_id']])) ? (int) $session_times[$row['user_id']] : 0; + $row['last_visit'] = (!empty($row['session_time'])) ? (int) $row['session_time'] : (int) $row['user_lastvisit']; + $sthanks = true; - if (!function_exists('get_user_rank')) + // Custom Profile Fields + $cp_row = []; + if ($this->config['load_cpf_memberlist'] && isset($profile_fields_cache[$user_id])) { - include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); + $cp_row = $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false); } - get_user_rank($row['user_rank'], (($user_id == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src); - // Custom Profile Fields - $cp_row = array(); - if ($this->config['load_cpf_memberlist']) + if (!function_exists('phpbb_show_profile')) { - $cp_row = isset($profile_fields_cache[$user_id]) ? $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array(); + include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); } - $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( + $memberrow = array_merge(phpbb_show_profile($row, false, false, false), [ 'ROW_NUMBER' => $row_number + ($start + 1), 'GIVENS' => (!isset($givens[$user_id])) ? 0 : $givens[$user_id], 'RECEIVED' => (!isset($reseved[$user_id])) ? 0 : $reseved[$user_id], - 'U_SEARCH_USER_GIVENS' => ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'true', 'tslash' => '')) : '', - 'U_SEARCH_USER_RECEIVED'=> ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'false', 'tslash' => '')) : '' - )); + 'U_SEARCH_USER_GIVENS' => ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $user_id, 'give' => 'true']) : '', + 'U_SEARCH_USER_RECEIVED'=> ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $user_id, 'give' => 'false']) : '' + ]); - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $memberrow = array_merge($memberrow, $cp_row['row']); } $this->template->assign_block_vars('memberrow', $memberrow); - if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow'])) + if (isset($cp_row['blockrow']) && count($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { @@ -517,27 +576,27 @@ public function main($mode, $author_id, $give) $row_number++; } $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $this->config['topics_per_page'], $start); - $this->template->assign_vars(array( - 'PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start), - 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'd', 'sd' => (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')), - 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'a', 'sd' => (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')), - 'U_SORT_FROM' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'b', 'sd' => (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')), - 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'c', 'sd' => (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')), - 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'e', 'sd' => (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '')), - 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'f', 'sd' => (($sort_key == 'f' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '')), - 'U_SORT_ACTIVE' => ($this->auth->acl_get('u_viewonline')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'l', 'sd' => (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')) : '', - 'S_VIEWONLINE' => $this->auth->acl_get('u_viewonline') - )); + $this->template->assign_vars([ + 'PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start), + 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'd', 'sd' => (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a')]), + 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'a', 'sd' => (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a')]), + 'U_SORT_FROM' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'b', 'sd' => (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a')]), + 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'c', 'sd' => (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a')]), + 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'e', 'sd' => (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd')]), + 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'f', 'sd' => (($sort_key == 'f' && $sort_dir == 'd') ? 'a' : 'd')]), + 'U_SORT_ACTIVE' => ($this->auth->acl_get('u_viewonline')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'l', 'sd' => (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a')]) : '', + 'S_VIEWONLINE' => $this->auth->acl_get('u_viewonline'), + ]); } break; } // Output the page - $this->template->assign_vars(array( - 'TOTAL_USERS' => $this->user->lang('LIST_USERS', $total_users), - 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => '')), + $this->template->assign_vars([ + 'TOTAL_USERS' => $this->language->lang('LIST_USERS', $total_users), + 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller'), 'S_THANKS' => $sthanks, - )); + ]); make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext")); diff --git a/controller/toplist.php b/controller/toplist.php index 868a68ee..6444127e 100644 --- a/controller/toplist.php +++ b/controller/toplist.php @@ -1,11 +1,14 @@ config = $config; $this->db = $db; $this->auth = $auth; $this->template = $template; $this->user = $user; + $this->language = $language; $this->cache = $cache; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -90,6 +121,8 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive $this->gfksx_helper = $gfksx_helper; $this->request = $request; $this->controller_helper = $controller_helper; + $this->user_loader = $user_loader; + $this->forums_table = $forums_table; $this->thanks_table = $thanks_table; $this->users_table = $users_table; $this->posts_table = $posts_table; @@ -97,8 +130,8 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive public function main() { - $this->user->add_lang(array('memberlist', 'groups', 'search')); - $this->user->add_lang_ext('gfksx/thanksforposts', 'thanks_mod'); + $this->language->add_lang(['memberlist', 'groups', 'search']); + $this->language->add_lang('thanks_mod', 'gfksx/thanksforposts'); // Grab data $mode = $this->request->variable('mode', ''); @@ -106,10 +139,10 @@ public function main() $u_search_post = $u_search_topic = $u_search_forum = ''; $topic_id = $this->request->variable('t', 0); $return_chars = $this->request->variable('ch', ($topic_id) ? -1 : 300); - $words = array(); + $rowset = $user_list = []; $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); - $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : true; - $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => $mode, 'tslash' => '')); + $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : true; + $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => $mode]); if (!$this->auth->acl_gets('u_viewtoplist')) { @@ -117,46 +150,51 @@ public function main() { trigger_error('RATING_NO_VIEW_TOPLIST'); } - login_box('', ((isset($this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $this->user->lang['RATING_LOGIN_EXPLAIN'])); + login_box('', $this->language->lang('LOGIN_EXPLAIN_' . strtoupper($mode))); } + $notoplist = true; $start = $this->request->variable('start', 0); $max_post_thanks = $this->config['thanks_post_reput_view'] ? $this->gfksx_helper->get_max_post_thanks() : 1; $max_topic_thanks = $this->config['thanks_topic_reput_view'] ? $this->gfksx_helper->get_max_topic_thanks() : 1; $max_forum_thanks = $this->config['thanks_forum_reput_view'] ? $this->gfksx_helper->get_max_forum_thanks() : 1; + switch ($mode) { case 'post': - $sql = 'SELECT COUNT(DISTINCT post_id) as total_post_count - FROM ' . $this->thanks_table .' - WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); - $result = $this->db->sql_query($sql); - $total_match_count = (int) $this->db->sql_fetchfield('total_post_count'); - $this->db->sql_freeresult($result); - $full_post_rating = true; - $notoplist = false; + $sql = 'SELECT COUNT(DISTINCT post_id) as total_post_count + FROM ' . $this->thanks_table .' + WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); + $result = $this->db->sql_query($sql); + $total_match_count = (int) $this->db->sql_fetchfield('total_post_count'); + $this->db->sql_freeresult($result); + + $full_post_rating = true; + $notoplist = false; break; case 'topic': - $sql = 'SELECT COUNT(DISTINCT topic_id) as total_topic_count - FROM ' . $this->thanks_table .' - WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); - $result = $this->db->sql_query($sql); - $total_match_count = (int) $this->db->sql_fetchfield('total_topic_count'); - $this->db->sql_freeresult($result); - $full_topic_rating = true; - $notoplist = false; + $sql = 'SELECT COUNT(DISTINCT topic_id) as total_topic_count + FROM ' . $this->thanks_table .' + WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); + $result = $this->db->sql_query($sql); + $total_match_count = (int) $this->db->sql_fetchfield('total_topic_count'); + $this->db->sql_freeresult($result); + + $full_topic_rating = true; + $notoplist = false; break; case 'forum': - $sql = 'SELECT COUNT(DISTINCT forum_id) as total_forum_count - FROM ' . $this->thanks_table .' - WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); - $result = $this->db->sql_query($sql); - $total_match_count = (int) $this->db->sql_fetchfield('total_forum_count'); - $this->db->sql_freeresult($result); - $full_forum_rating = true; - $notoplist = false; + $sql = 'SELECT COUNT(DISTINCT forum_id) as total_forum_count + FROM ' . $this->thanks_table .' + WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true); + $result = $this->db->sql_query($sql); + $total_match_count = (int) $this->db->sql_fetchfield('total_forum_count'); + $this->db->sql_freeresult($result); + + $full_forum_rating = true; + $notoplist = false; break; default: @@ -164,32 +202,35 @@ public function main() break; } - $page_title = $this->user->lang('REPUT_TOPLIST', $total_match_count); + $page_title = $this->language->lang('REPUT_TOPLIST', $total_match_count); - //post rating + // Post rating if (!$full_forum_rating && !$full_topic_rating && $this->config['thanks_post_reput_view']) { $end = ($full_post_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput']; - $sql_p_array['FROM'] = array($this->thanks_table => 't'); - $sql_p_array['SELECT'] = 'u.user_id, u.username, u.user_colour, p.post_subject, p.post_id, p.post_time, p.poster_id, p.post_username, p.topic_id, p.forum_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.post_attachment'; - $sql_p_array['SELECT'] .= ', t.post_id, COUNT(*) AS post_thanks'; - $sql_p_array['LEFT_JOIN'][] = array( - 'FROM' => array ($this->posts_table => 'p'), - 'ON' => 't.post_id = p.post_id', - ); - $sql_p_array['LEFT_JOIN'][] = array( - 'FROM' => array($this->users_table => 'u'), - 'ON' => 'p.poster_id = u.user_id' - ); - $sql_p_array['GROUP_BY'] = 't.post_id, u.user_id, p.post_subject, p.post_id'; - $sql_p_array['ORDER_BY'] = 'post_thanks DESC'; - $sql_p_array['WHERE'] = $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true); + $sql_p_array = [ + 'SELECT' => 'u.user_id, t.post_id, COUNT(*) AS post_thanks', + 'FROM' => [$this->thanks_table => 't'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->posts_table => 'p'], + 'ON' => 't.post_id = p.post_id', + ], + [ + 'FROM' => [$this->users_table => 'u'], + 'ON' => 'p.poster_id = u.user_id', + ], + ], + 'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true), + 'GROUP_BY' => 't.post_id, u.user_id', + 'ORDER_BY' => 'post_thanks DESC', + ]; $sql = $this->db->sql_build_query('SELECT',$sql_p_array); $result = $this->db->sql_query_limit($sql, $end, $start); - $u_search_post = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'post', 'tslash' => '')); + $u_search_post = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'post']); if (!$row = $this->db->sql_fetchrow($result)) { @@ -201,107 +242,116 @@ public function main() $bbcode_bitfield = $text_only_message = ''; do { - // We pre-process some variables here for later usage - $row['post_text'] = censor_text($row['post_text']); - $text_only_message = $row['post_text']; - // make list items visible as such - if ($row['bbcode_uid']) - { - $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message); - // no BBCode in text only message - strip_bbcode($text_only_message, $row['bbcode_uid']); - } - - if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) - { - $row['display_text_only'] = false; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); - - // Does this post have an attachment? If so, add it to the list - if ($row['post_attachment'] && $this->config['allow_attachments']) - { - $attach_list[$row['forum_id']][] = $row['post_id']; - } - } - else - { - $row['post_text'] = $text_only_message; - $row['display_text_only'] = true; - } - $rowset[] = $row; - unset($text_only_message); - - // Instantiate BBCode if needed - if ($bbcode_bitfield !== '' and !class_exists('bbcode')) - { - include($this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext); - $bbcode = new \bbcode(base64_encode($bbcode_bitfield)); - } - // Replace naughty words such as farty pants - $row['post_subject'] = censor_text($row['post_subject']); - - if ($row['display_text_only']) - { - $row['post_text'] = get_context($row['post_text'], $words, $return_chars); - $row['post_text'] = bbcode_nl2br($row['post_text']); - } - else - { - // Second parse bbcode here - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $row['post_text'] = bbcode_nl2br($row['post_text']); - $row['post_text'] = smiley_text($row['post_text']); - } - - $post_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $row['post_id'] . '#p' . $row['post_id']); - $this->template->assign_block_vars('toppostrow', array( - 'MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']), + $rowset[(int) $row['post_id']] = $row; + $user_list[] = $row['user_id']; + } + while ($row = $this->db->sql_fetchrow($result)); + $this->db->sql_freeresult($result); + unset($row); + + $posts_data_sql = [ + 'SELECT' => 'p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, + p.forum_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield', + 'FROM' => [$this->posts_table => 'p'], + 'WHERE' => $this->db->sql_in_set('p.post_id', array_keys($rowset)), + ]; + $sql = $this->db->sql_build_query('SELECT',$posts_data_sql); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // We pre-process some variables here for later usage + $row['post_text'] = censor_text($row['post_text']); + $text_only_message = $row['post_text']; + + // Make list items visible as such + if ($row['bbcode_uid']) + { + $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message); + + // No BBCode in text only message + strip_bbcode($text_only_message, $row['bbcode_uid']); + } + + if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) + { + $row['display_text_only'] = false; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); + } + else + { + $row['post_text'] = $text_only_message; + $row['display_text_only'] = true; + } + unset($text_only_message); + + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + + if ($row['display_text_only']) + { + $row['post_text'] = bbcode_nl2br($row['post_text']); + } + else + { + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); + } + + $rowset[(int) $row['post_id']] = array_merge($rowset[(int) $row['post_id']], $row); + } + $this->db->sql_freeresult($result); + + $this->user_loader->load_users($user_list); + + foreach ($rowset as $row) + { + $this->template->assign_block_vars('toppostrow', [ + 'MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''), 'POST_DATE' => !empty($row['post_time']) ? $this->user->format_date($row['post_time']) : '', - 'MINI_POST_IMG' => phpbb_version_compare(PHPBB_VERSION, '3.2.0', '<') ? $this->user->img('icon_post_target', 'POST') : '', - 'POST_ID' => $post_url, - 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? '' : $row['post_subject']), - 'POST_AUTHOR' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), - 'POST_REPUT' => round($row['post_thanks'] / ($max_post_thanks / 100), $this->config['thanks_number_digits']) . '%', + 'POST_ID' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $row['post_id'] . '#p' . $row['post_id']), + 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''), + 'POST_AUTHOR' => $this->user_loader->get_username((int) $row['user_id'], 'full', $row['post_username']), + 'POST_REPUT' => round($row['post_thanks'] / ($max_post_thanks / 100), (int) $this->config['thanks_number_digits']) . '%', 'POST_THANKS' => $row['post_thanks'], - 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false, - 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, + 'S_THANKS_POST_REPUT_VIEW' => (bool) $this->config['thanks_post_reput_view'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'], - 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'], - 'THANKS_REPUT_IMAGE' => isset($this->config['thanks_reput_image']) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', - 'THANKS_REPUT_IMAGE_BACK' => isset($this->config['thanks_reput_image_back']) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - )); + 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'], + 'THANKS_REPUT_IMAGE' => !empty($this->config['thanks_reput_image']) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', + 'THANKS_REPUT_IMAGE_BACK' => !empty($this->config['thanks_reput_image_back']) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', + ]); } - while ($row = $this->db->sql_fetchrow($result)); - $this->db->sql_freeresult($result); + unset($rowset, $user_list); } } - //topic rating + + // Topic rating if (!$full_forum_rating && !$full_post_rating && $this->config['thanks_topic_reput_view']) { - $end = ($full_topic_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput']; - - $sql_t_array['FROM'] = array($this->thanks_table => 'f'); - $sql_t_array['SELECT'] = 'u.user_id, u.username, u.user_colour, t.topic_title, t.topic_id, t.topic_time, t.topic_poster, t.topic_first_poster_name, t.topic_first_poster_colour, t.forum_id, t.topic_type, t.topic_status, t.poll_start'; - $sql_t_array['SELECT'] .= ', f.topic_id, COUNT(*) AS topic_thanks'; - $sql_t_array['LEFT_JOIN'][] = array( - 'FROM' => array (TOPICS_TABLE => 't'), - 'ON' => 'f.topic_id = t.topic_id', - ); - $sql_t_array['LEFT_JOIN'][] = array( - 'FROM' => array($this->users_table => 'u'), - 'ON' => 't.topic_poster = u.user_id' - ); - $sql_t_array['GROUP_BY'] = 'f.topic_id, u.user_id, t.topic_title, t.topic_id'; - $sql_t_array['ORDER_BY'] = 'topic_thanks DESC'; - $sql_t_array['WHERE'] = $this->db->sql_in_set('f.forum_id', $ex_fid_ary, true); + $end = ($full_topic_rating) ? (int) $this->config['topics_per_page'] : (int) $this->config['thanks_number_row_reput']; + + $sql_t_array = [ + 'SELECT' => 'f.topic_id, COUNT(*) AS topic_thanks', + 'FROM' => [$this->thanks_table => 'f'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [TOPICS_TABLE => 't'], + 'ON' => 'f.topic_id = t.topic_id', + ], + [ + 'FROM' => [$this->users_table => 'u'], + 'ON' => 't.topic_poster = u.user_id', + ], + ], + 'WHERE' => $this->db->sql_in_set('f.forum_id', $ex_fid_ary, true), + 'GROUP_BY' => 'f.topic_id, u.user_id, t.topic_title, t.topic_id', + 'ORDER_BY' => 'topic_thanks DESC', + ]; $sql = $this->db->sql_build_query('SELECT',$sql_t_array); $result = $this->db->sql_query_limit($sql, $end, $start); - $u_search_topic = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'topic', 'tslash' => '')); + $u_search_topic = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'topic']); + if (!$row = $this->db->sql_fetchrow($result)) { trigger_error('RATING_VIEW_TOPLIST_NO'); @@ -309,7 +359,35 @@ public function main() else { $notoplist = false; + + $rowset = $user_list = []; do + { + $rowset[(int) $row['topic_id']] = $row; + } + while ($row = $this->db->sql_fetchrow($result)); + unset($row); + $this->db->sql_freeresult($result); + + $topics_data_sql = [ + 'SELECT' => 't.topic_title, t.topic_id, t.topic_time, + t.topic_poster, t.topic_first_poster_name, t.topic_first_poster_colour, + t.forum_id, t.topic_type, t.topic_status, t.poll_start', + 'FROM' => [TOPICS_TABLE => 't'], + 'WHERE' => $this->db->sql_in_set('t.topic_id', array_keys($rowset)), + ]; + + $sql = $this->db->sql_build_query('SELECT',$topics_data_sql); + $result = $this->db->sql_query_limit($sql, $end, $start); + while ($row = $this->db->sql_fetchrow($result)) + { + $rowset[(int) $row['topic_id']] = array_merge($rowset[(int) $row['topic_id']], $row); + $user_list[] = (int) $row['topic_poster']; + } + unset($row); + $this->db->sql_freeresult($result); + + foreach ($rowset as $row) { // Get folder img, topic status/type related information $folder_img = $folder_alt = $topic_type = ''; @@ -317,48 +395,55 @@ public function main() { include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); } + topic_status($row, 0, false, $folder_img, $folder_alt, $topic_type); $view_topic_url_params = 'f=' . (($row['forum_id']) ? $row['forum_id'] : '') . '&t=' . $row['topic_id']; $view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", $view_topic_url_params); - $this->template->assign_block_vars('toptopicrow', array( + + $this->user_loader->load_users($user_list); + + $this->template->assign_block_vars('toptopicrow', [ 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG_SRC' => $row['forum_id'] ? 'topic_read' : 'announce_read', - 'TOPIC_TITLE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['topic_title'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['topic_title']), + 'TOPIC_TITLE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['topic_title'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''), 'U_VIEW_TOPIC' => $view_topic_url, - 'TOPIC_AUTHOR' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR' => $this->user_loader->get_username((int) $row['topic_poster'], 'full', $row['topic_first_poster_name']), 'TOPIC_THANKS' => $row['topic_thanks'], - 'TOPIC_REPUT' => round($row['topic_thanks'] / ($max_topic_thanks / 100), $this->config['thanks_number_digits']) . '%', - 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false, - 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, + 'TOPIC_REPUT' => round($row['topic_thanks'] / ($max_topic_thanks / 100), (int) $this->config['thanks_number_digits']) . '%', + 'S_THANKS_TOPIC_REPUT_VIEW' => (bool) $this->config['thanks_topic_reput_view'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'], - 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'], - 'THANKS_REPUT_IMAGE' => (isset($this->config['thanks_reput_image'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', - 'THANKS_REPUT_IMAGE_BACK' => (isset($this->config['thanks_reput_image_back'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - )); + 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'], + 'THANKS_REPUT_IMAGE' => !empty($this->config['thanks_reput_image']) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', + 'THANKS_REPUT_IMAGE_BACK' => !empty($this->config['thanks_reput_image_back']) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', + ]); } - while ($row = $this->db->sql_fetchrow($result)); - $this->db->sql_freeresult($result); + unset($rowset, $row, $user_list); } } - //forum rating + + // Forum rating if (!$full_topic_rating && !$full_post_rating && $this->config['thanks_forum_reput_view']) { - $end = ($full_forum_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput']; - - $sql_f_array['FROM'] = array($this->thanks_table => 't'); - $sql_f_array['SELECT'] = 'f.forum_name, f.forum_id'; - $sql_f_array['SELECT'] .= ', t.forum_id, COUNT(*) AS forum_thanks'; - $sql_f_array['LEFT_JOIN'][] = array( - 'FROM' => array (FORUMS_TABLE => 'f'), - 'ON' => 't.forum_id = f.forum_id', - ); - $sql_f_array['GROUP_BY'] = 't.forum_id, f.forum_name, f.forum_id'; - $sql_f_array['ORDER_BY'] = 'forum_thanks DESC'; - $sql_f_array['WHERE'] = $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true); + $end = ($full_forum_rating) ? (int) $this->config['topics_per_page'] : (int) $this->config['thanks_number_row_reput']; + + $sql_f_array = [ + 'SELECT' => 'f.forum_name, f.forum_id, t.forum_id, COUNT(*) AS forum_thanks', + 'FROM' => [$this->thanks_table => 't'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->forums_table => 'f'], + 'ON' => 't.forum_id = f.forum_id', + ], + ], + 'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true), + 'GROUP_BY' => 't.forum_id, f.forum_name, f.forum_id', + 'ORDER_BY' => 'forum_thanks DESC', + ]; $sql = $this->db->sql_build_query('SELECT',$sql_f_array); $result = $this->db->sql_query_limit($sql, $end, $start); - $u_search_forum = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'forum', 'tslash' => '')); + $u_search_forum = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'forum']); if (!$row = $this->db->sql_fetchrow($result)) { @@ -373,52 +458,53 @@ public function main() { $u_viewforum = append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext", 'f=' . $row['forum_id']); $folder_image = 'forum_read'; - $this->template->assign_block_vars('topforumrow', array( + $this->template->assign_block_vars('topforumrow', [ 'FORUM_FOLDER_IMG_SRC' => $this->user->img('forum_read', 'NO_NEW_POSTS', false, '', 'src'), 'FORUM_IMG_STYLE' => $folder_image, - 'FORUM_NAME' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['forum_name'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['forum_name']), + 'FORUM_NAME' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['forum_name'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''), 'U_VIEW_FORUM' => $u_viewforum, 'FORUM_THANKS' => $row['forum_thanks'], - 'FORUM_REPUT' => round($row['forum_thanks'] / ($max_forum_thanks / 100), $this->config['thanks_number_digits']) . '%', - 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false, - 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, + 'FORUM_REPUT' => round($row['forum_thanks'] / ($max_forum_thanks / 100), (int) $this->config['thanks_number_digits']) . '%', + 'S_THANKS_FORUM_REPUT_VIEW' => (bool) $this->config['thanks_forum_reput_view'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'], - 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'], - 'THANKS_REPUT_IMAGE' => (isset($this->config['thanks_reput_image'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', - 'THANKS_REPUT_IMAGE_BACK' => (isset($this->config['thanks_reput_image_back'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - )); + 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'], + 'THANKS_REPUT_IMAGE' => !empty($this->config['thanks_reput_image']) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', + 'THANKS_REPUT_IMAGE_BACK' => !empty($this->config['thanks_reput_image_back']) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', + ]); } } while ($row = $this->db->sql_fetchrow($result)); $this->db->sql_freeresult($result); } } + if ($notoplist) { trigger_error('RATING_VIEW_TOPLIST_NO'); } - $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_match_count, $this->config['topics_per_page'], $start); + $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_match_count, (int) $this->config['topics_per_page'], $start); // Output the page - $this->template->assign_vars(array( - 'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $this->config['posts_per_page'], $start), + $this->template->assign_vars([ + 'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, (int) $this->config['posts_per_page'], $start), 'PAGE_TITLE' => $page_title, 'PHPBB_VERSION' => phpbb_version_compare(PHPBB_VERSION, '3.2.0', '>=') ? '3.2' : '3.1', - 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false, - 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false, - 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false, + 'S_THANKS_FORUM_REPUT_VIEW' => (bool) $this->config['thanks_forum_reput_view'], + 'S_THANKS_TOPIC_REPUT_VIEW' => (bool) $this->config['thanks_topic_reput_view'], + 'S_THANKS_POST_REPUT_VIEW' => (bool) $this->config['thanks_post_reput_view'], 'S_FULL_POST_RATING' => $full_post_rating, 'S_FULL_TOPIC_RATING' => $full_topic_rating, 'S_FULL_FORUM_RATING' => $full_forum_rating, 'U_SEARCH_POST' => $u_search_post, 'U_SEARCH_TOPIC' => $u_search_topic, 'U_SEARCH_FORUM' => $u_search_forum, - )); + ]); make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext")); // Send all data to the template file - return $this->controller_helper->render('toplist_body.html', $page_title); + return $this->controller_helper->render('@gfksx_thanksforposts/toplist_body.html', $page_title); } } diff --git a/core/helper.php b/core/helper.php index becfe861..9caa99d7 100644 --- a/core/helper.php +++ b/core/helper.php @@ -1,31 +1,33 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\core; class helper { /** @var array thankers */ - protected $thankers = array(); + protected $thankers = []; /** @var array forum_thanks */ - protected $forum_thanks = array(); + protected $forum_thanks = []; /** @var int max_post_thanks */ - protected $max_post_thanks; + protected $max_post_thanks = 0; /** @var int max_topic_thanks */ - protected $max_topic_thanks; + protected $max_topic_thanks = 0; /** @var int max_forum_thanks */ - protected $max_forum_thanks; + protected $max_forum_thanks = 0; /** @var int poster_list_count */ protected $poster_list_count; @@ -60,15 +62,18 @@ class helper /** @var \phpbb\event\dispatcher_interface */ protected $phpbb_dispatcher; + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\user_loader */ + protected $user_loader; + /** @var string phpbb_root_path */ protected $phpbb_root_path; /** @var string phpEx */ protected $php_ext; - /** @var string table_prefix */ - protected $table_prefix; - /** @var string THANKS_TABLE */ protected $thanks_table; @@ -82,28 +87,43 @@ class helper protected $notifications_table; /** - * Constructor - * - * @param \phpbb\config\config $config Config object - * @param \phpbb\db\driver\driver_interface $db DBAL object - * @param \phpbb\auth\auth $auth User object - * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object - * @param \phpbb\cache\driver\driver_interface $cache Cache driver object - * @param \phpbb\request\request_interface $request Request object - * @param \phpbb\request\request_interface $request Request object - * @param \phpbb\controller\helper $controller_helper Controller helper object - * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object - * @param string $phpbb_root_path phpbb_root_path - * @param string $php_ext phpEx - * @param string $table_prefix Tables prefix - * @param string $thanks_table THANKS_TABLE - * @param string $users_table USERS_TABLE - * @param string $posts_table POSTS_TABLE - * @param string $notifications_table NOTIFICATIONS_TABLE - * @access public - */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\request\request_interface $request, \phpbb\notification\manager $notification_manager, \phpbb\controller\helper $controller_helper, \phpbb\event\dispatcher_interface $phpbb_dispatcher, $phpbb_root_path, $php_ext, $table_prefix, $thanks_table, $users_table, $posts_table, $notifications_table) + * Constructor + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db DBAL object + * @param \phpbb\auth\auth $auth User object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\cache\driver\driver_interface $cache Cache driver object + * @param \phpbb\request\request_interface $request Request object + * @param \phpbb\request\request_interface $request Request object + * @param \phpbb\controller\helper $controller_helper Controller helper object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + * @param \phpbb\language\language $language Language object + * @param \phpbb\user_loader $user_loader User loader object + * @param string $phpbb_root_path phpbb_root_path + * @param string $php_ext phpEx + * @param string $thanks_table THANKS_TABLE + * @param string $users_table USERS_TABLE + * @param string $posts_table POSTS_TABLE + * @param string $notifications_table NOTIFICATIONS_TABLE + * @access public + */ + public function __construct( + \phpbb\config\config $config, + \phpbb\db\driver\driver_interface $db, + \phpbb\auth\auth $auth, + \phpbb\template\template $template, + \phpbb\user $user, + \phpbb\cache\driver\driver_interface $cache, + \phpbb\request\request_interface $request, + \phpbb\notification\manager $notification_manager, + \phpbb\controller\helper $controller_helper, + \phpbb\event\dispatcher_interface $phpbb_dispatcher, + \phpbb\language\language $language, + \phpbb\user_loader $user_loader, + $phpbb_root_path, $php_ext, $thanks_table, $users_table, $posts_table, $notifications_table + ) { $this->config = $config; $this->db = $db; @@ -115,9 +135,10 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive $this->notification_manager = $notification_manager; $this->controller_helper = $controller_helper; $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->language = $language; + $this->user_loader = $user_loader; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->table_prefix = $table_prefix; $this->thanks_table = $thanks_table; $this->users_table = $users_table; $this->posts_table = $posts_table; @@ -131,7 +152,7 @@ public function get_thanks($post_id) $further_thanks_text = $return = ''; $user_list = array(); $further_thanks = $count = 0; - $maxcount = $this->config['thanks_number_post']; + $maxcount = (int) $this->config['thanks_number_post']; foreach ($this->thankers as $thanker) { @@ -158,9 +179,10 @@ public function get_thanks($post_id) if ($further_thanks > 0) { - $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks); + $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks); } $return = ($return == '') ? false : ($return . $further_thanks_text); + return $return; } @@ -182,34 +204,35 @@ public function insert_thanks($post_id, $user_id, $forum_id) $to_id = $this->request->variable('to_id', 0); $from_id = $this->request->variable('from_id', 0); $row = $this->get_post_info($post_id); + if ($this->user->data['user_type'] != USER_IGNORE && !empty($to_id)) { if ($row['poster_id'] != $user_id && $row['poster_id'] == $to_id && !$this->already_thanked($post_id, $user_id) && ($this->auth->acl_get('f_thanks', $row['forum_id']) || (!$row['forum_id'] && $this->config['thanks_global_post'])) && $from_id == $user_id) { - $thanks_data = array( - 'user_id' => (int) $this->user->data['user_id'], - 'post_id' => $post_id, - 'poster_id' => $to_id, - 'topic_id' => (int) $row['topic_id'], - 'forum_id' => (int) $row['forum_id'], + $thanks_data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'post_id' => $post_id, + 'poster_id' => $to_id, + 'topic_id' => (int) $row['topic_id'], + 'forum_id' => (int) $row['forum_id'], 'thanks_time' => time(), - ); + ]; $sql = 'INSERT INTO ' . $this->thanks_table . ' ' . $this->db->sql_build_array('INSERT', $thanks_data); $this->db->sql_query($sql); $lang_act = 'GIVE'; - $thanks_data = array_merge($thanks_data, array( - 'username' => $this->user->data['username'], - 'lang_act' => $lang_act, + $thanks_data = array_merge($thanks_data, [ + 'username' => $this->user->data['username'], + 'lang_act' => $lang_act, 'post_subject' => $row['post_subject'], - )); + ]); $this->add_notification($thanks_data); if ($this->config['thanks_info_page']) { meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id)); - trigger_error($this->user->lang['THANKS_INFO_'.$lang_act] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id) . '">', '')); + trigger_error($this->language->lang('THANKS_INFO_' . $lang_act) . '

' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id) . '">', '')); } else { @@ -218,146 +241,112 @@ public function insert_thanks($post_id, $user_id, $forum_id) } else if (!$row['forum_id'] && !$this->config['thanks_global_post']) { - trigger_error($this->user->lang['GLOBAL_INCORRECT_THANKS'] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', '')); + trigger_error($this->language->lang('GLOBAL_INCORRECT_THANKS') . '

' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', '')); } else { - trigger_error($this->user->lang['INCORRECT_THANKS'] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', '')); + trigger_error($this->language->lang('INCORRECT_THANKS') . '

' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', '')); } } - return; } - public function clear_list_thanks($object_id, $list_thanks = '') + public function clear_list_thanks($object_id, $mode = '') { - $s_hidden_fields = build_hidden_fields(array( - 'list_thanks' => $list_thanks, - ) - ); - $lang_act = $field_act = ''; - if (confirm_box(true)) + if (empty($mode) || !in_array($mode, ['give', 'receive', 'post'])) { - if (!empty($list_thanks) && $this->auth->acl_get('m_thanks')) - { - if ($list_thanks === 'give') - { - $lang_act = 'GIVE'; - $field_act = 'user_id'; - } - else if ($list_thanks === 'receive') - { - $lang_act = 'RECEIVE'; - $field_act = 'poster_id'; - } - else if ($list_thanks === 'post') - { - $lang_act = 'POST'; - $field_act = 'post_id'; - } + trigger_error($this->language->lang('INCORRECT_THANKS')); + } - if (!empty($field_act)) - { - $sql = "DELETE FROM " . $this->thanks_table . ' - WHERE ' . $field_act . ' = ' . (int) $object_id; - $result = $this->db->sql_query($sql); + if (!$this->auth->acl_get('m_thanks')) + { + trigger_error($this->language->lang('NOT_AUTHORISED')); + } - if ($result != 0) - { - if ($this->config['thanks_info_page']) - { - if ($list_thanks === 'post') - { - meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id)); - trigger_error($this->user->lang['CLEAR_LIST_THANKS_' . $lang_act] . '

' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id) . '">', '')); - } - else - { - meta_refresh (1, append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id)); - trigger_error($this->user->lang['CLEAR_LIST_THANKS_'.$lang_act] . '

' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}memberlist.$this->php_ext",'mode=viewprofile&u=' . $object_id) . '">', '')); - } - } - else - { - if ($list_thanks === 'post') - { - redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id)); - } - else - { - redirect(append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id)); - } - } - } - } - } - else + $s_hidden_fields = build_hidden_fields([ + 'list_thanks' => $mode, + ]); + + $redirect_url = append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . (string) $object_id); + + switch ($mode) + { + case 'give': + $field_act = 'user_id'; + break; + + case 'receive': + $field_act = 'poster_id'; + break; + + case 'post': + $field_act = 'post_id'; + $redirect_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . (string) $object_id . '#p' . (string) $object_id); + break; + } + + if (confirm_box(true)) + { + $sql = "DELETE FROM " . $this->thanks_table . ' + WHERE ' . $field_act . ' = ' . (int) $object_id; + + if ($this->db->sql_query($sql)) { - if ($list_thanks === 'post') + if ($this->config['thanks_info_page']) { - trigger_error($this->user->lang['INCORRECT_THANKS'] . '

' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id) . '">', '')); + meta_refresh (1, $redirect_url); + trigger_error($this->language->lang('CLEAR_LIST_THANKS_' . strtoupper($mode)) . '

' . $this->language->lang('BACK_TO_PREV', '', '')); } else { - trigger_error($this->user->lang['INCORRECT_THANKS'] . '

' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id) . '">', '')); + redirect($redirect_url); } } } else { confirm_box(false, 'CLEAR_LIST_THANKS', $s_hidden_fields); - if ($list_thanks === 'post') - { - redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id)); - } - else - { - redirect(append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id)); - } + redirect($redirect_url); } - return; } public function delete_thanks($post_id, $forum_id) { $to_id = $this->request->variable('to_id', 0); - $forum_id = ($forum_id) ?: $this->request->variable('f', 0); - $row = $this->get_post_info($post_id); - $hidden = build_hidden_fields(array( + $forum_id = ((int) $forum_id) ?: $this->request->variable('f', 0); + $row = $this->get_post_info((int) $post_id); + $redirect_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id"); + + $hidden = build_hidden_fields([ 'to_id' => $to_id, 'rthanks' => $post_id, - ) - ); + ]); /** - * This event allows to interrupt before a thanks is deleted - * - * @event gfksx.thanksforposts.delete_thanks_before - * @var int post_id The post id - * @var int forum_id The forum id - * @since 2.0.3 - */ - $vars = array( - 'post_id', - 'forum_id', - ); + * This event allows to interrupt before a thanks is deleted + * + * @event gfksx.thanksforposts.delete_thanks_before + * @var int post_id The post id + * @var int forum_id The forum id + * @since 2.0.3 + */ + $vars = ['post_id', 'forum_id']; extract($this->phpbb_dispatcher->trigger_event('gfksx.thanksforposts.delete_thanks_before', compact($vars))); if (!$this->config['remove_thanks']) { - trigger_error($this->user->lang['DISABLE_REMOVE_THANKS'] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', '')); + trigger_error($this->language->lang('DISABLE_REMOVE_THANKS') . '

' . $this->language->lang('RETURN_POST', '', '')); } if (confirm_box(true, 'REMOVE_THANKS', $hidden)) { if ($this->user->data['user_type'] != USER_IGNORE && !empty($to_id) && $this->auth->acl_get('f_thanks', $forum_id)) { - $sql = "DELETE FROM " . $this->thanks_table . ' - WHERE post_id ='. (int) $post_id ." AND user_id = " . (int) $this->user->data['user_id']; + $sql = 'DELETE FROM ' . $this->thanks_table . ' + WHERE post_id =' . (int) $post_id . ' AND user_id = ' . (int) $this->user->data['user_id']; $this->db->sql_query($sql); - $result = $this->db->sql_affectedrows(); - if ($result != 0) + + if ($this->db->sql_affectedrows()) { - $lang_act = 'REMOVE'; $thanks_data = array( 'user_id' => (int) $this->user->data['user_id'], 'post_id' => $post_id, @@ -366,82 +355,73 @@ public function delete_thanks($post_id, $forum_id) 'forum_id' => $forum_id, 'thanks_time' => time(), 'username' => $this->user->data['username'], - 'lang_act' => $lang_act, + 'lang_act' => 'REMOVE', 'post_subject' => $row['post_subject'], ); $this->add_notification($thanks_data, 'gfksx.thanksforposts.notification.type.thanks_remove'); if ($this->config['thanks_info_page']) { - meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id")); - trigger_error($this->user->lang['THANKS_INFO_' . $lang_act] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', '')); + meta_refresh (1, $redirect_url); + trigger_error($this->language->lang('THANKS_INFO_REMOVE') . '

' . $this->language->lang('RETURN_POST', '', '')); } else { - redirect (append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id")); + redirect ($redirect_url); } } else { - trigger_error($this->user->lang['INCORRECT_THANKS'] . '

' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', '')); + trigger_error($this->language->lang('INCORRECT_THANKS') . '

' . $this->language->lang('RETURN_POST', '', '')); } } } else { confirm_box(false, 'REMOVE_THANKS', $hidden); - redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id")); + redirect($redirect_url); } - return; } - // display the text/image saying either to add or remove thanks + // Display the text/image saying either to add or remove thanks public function get_thanks_text($post_id) { - if ($this->already_thanked($post_id, $this->user->data['user_id'])) - { - return array( - 'THANK_ALT' => $this->user->lang['REMOVE_THANKS'], - 'THANK_ALT_SHORT' => $this->user->lang['REMOVE_THANKS_SHORT'], - 'THANKS_IMG' => 'removethanks-icon', - ); - } - return array( - 'THANK_ALT' => $this->user->lang['THANK_POST'], - 'THANK_ALT_SHORT' => $this->user->lang['THANK_POST_SHORT'], - 'THANKS_IMG' => 'thanks-icon', - ); + $already_thanked = $this->already_thanked($post_id, $this->user->data['user_id']); + return [ + 'THANK_ALT' => $this->language->lang($already_thanked ? 'REMOVE_THANKS' : 'THANK_POST'), + 'THANK_ALT_SHORT' => $this->language->lang($already_thanked ? 'REMOVE_THANKS_SHORT' : 'THANK_POST_SHORT'), + 'THANKED' => $already_thanked, + ]; } - // change the variable sent via the link to avoid odd errors + // Change the variable sent via the link to avoid odd errors public function get_thanks_link($post_id) { - if ($this->already_thanked($post_id, $this->user->data['user_id'])) - { - return 'rthanks'; - } - return 'thanks'; + return $this->already_thanked($post_id, $this->user->data['user_id']) ? 'rthanks' : 'thanks'; } - // check if the user has already thanked that post + // Check if the user has already thanked that post public function already_thanked($post_id, $user_id) { - $thanked = false; + $already_thanked = false; foreach ($this->thankers as $thanker) { if ($thanker['post_id'] == $post_id && $thanker['user_id'] == $user_id) { - $thanked = true; + $already_thanked = true; + break; } } - return $thanked; + + return $already_thanked; } public function output_thanks_memberlist($user_id, $ex_fid_ary) { - $thankers_member = $thankered_member = array(); + $user_thankers = $user_thanked = []; $poster_limit = (int) $this->config['thanks_number']; + // Get all user's received thanks count $sql = 'SELECT poster_id, COUNT(*) AS poster_receive_count FROM ' . $this->thanks_table . ' WHERE poster_id = ' . (int) $user_id. ' AND (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) @@ -450,59 +430,48 @@ public function output_thanks_memberlist($user_id, $ex_fid_ary) $poster_receive_count = (int) $this->db->sql_fetchfield('poster_receive_count'); $this->db->sql_freeresult($result); - $sql_array = array( - 'SELECT' => 't.*, u.username, u.user_colour', - 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'), - ); - $sql_array['WHERE'] = 't.poster_id =' . (int) $user_id .' AND '; - $sql_array['WHERE'] .= 'u.user_id = t.user_id AND '; - $sql_array['WHERE'] .= '('. $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)'; - $sql_array['ORDER_BY'] = 't.post_id DESC LIMIT ' . $poster_limit; - $sql = $this->db->sql_build_query('SELECT', $sql_array); + // Get all user's given thanks count + $sql = 'SELECT user_id, COUNT(*) AS poster_give_count + FROM ' . $this->thanks_table . " + WHERE user_id = " . (int) $user_id. ' AND (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) + GROUP BY user_id'; $result = $this->db->sql_query($sql); + $poster_give_count = (int) $this->db->sql_fetchfield('poster_give_count'); + $this->db->sql_freeresult($result); + + $sql_array = [ + 'SELECT' => 't.user_id, t.post_id, u.username, u.user_colour', + 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'], + 'WHERE' => 't.poster_id =' . (int) $user_id .' AND u.user_id = t.user_id AND (' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)', + 'ORDER_BY' => 't.post_id DESC', + ]; + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, $poster_limit, 0); while ($row = $this->db->sql_fetchrow($result)) { - $thankers_member[] = array( + $user_thankers[] = [ 'user_id' => $row['user_id'], - 'poster_id' => $row['poster_id'], 'post_id' => $row['post_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], - ); + ]; } $this->db->sql_freeresult($result); - $user_list = array(); - $i=0; - foreach ($thankers_member as $key => $value) - { - if ($thankers_member[$key]['poster_id'] == $user_id) - { - $i++; - $user_list[$i] = array( - 'username' => $thankers_member[$key]['username'], - 'user_id' => $thankers_member[$key]['user_id'], - 'user_colour' => $thankers_member[$key]['user_colour'], - 'post_id' => $thankers_member[$key]['post_id'], - ); - } - } - unset ($value); - $collim = ($poster_limit > $poster_receive_count)? ceil($poster_receive_count/4) : ceil($poster_limit/4); - $thanked_row = array(); + $thanked_row = []; $i = $j = 0; - - foreach ($user_list as $value) + foreach ($user_thankers as $thanker) { $i++; if ($i <= $poster_limit) { - $thanked_row[$i]['USERNAME_FULL'] = get_username_string('full', $value['user_id'], $value['username'], $value['user_colour']); - $thanked_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $value['post_id']. '#p' . $value['post_id']); + $thanked_row[$i]['USERNAME_FULL'] = get_username_string('full', $thanker['user_id'], $thanker['username'], $thanker['user_colour']); + $thanked_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $thanker['post_id']. '#p' . $thanker['post_id']); + $j++; - if ($j > $collim or $i == $poster_receive_count or $i == $poster_limit) + if ($j > $collim || $i == $poster_receive_count || $i == $poster_limit) { $thanked_row[$i]['S_SWITCH_COLUMN'] = true; $j = 0; @@ -514,72 +483,46 @@ public function output_thanks_memberlist($user_id, $ex_fid_ary) if ($poster_receive_count > $poster_limit) { $further_thanks = $poster_receive_count - $poster_limit; - $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks); - $this->template->assign_var('FURTHER_THANKS_TEXT', $further_thanks_text); + $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks); + $this->template->assign_var('FURTHER_THANKS_TEXT_RECEIVED', $further_thanks_text); } - unset ($value); - - $sql = 'SELECT user_id, COUNT(*) AS poster_give_count - FROM ' . $this->thanks_table . " - WHERE user_id = " . (int) $user_id. ' AND (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) - GROUP BY user_id'; - $result = $this->db->sql_query($sql); - $poster_give_count = (int) $this->db->sql_fetchfield('poster_give_count'); - $this->db->sql_freeresult($result); - $sql_array = array( - 'SELECT' => 't.*, u.username, u.user_colour', - 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'), - ); - $sql_array['WHERE'] = 't.user_id =' . (int) $user_id . ' AND '; - $sql_array['WHERE'] .= 'u.user_id = t.poster_id AND '; - $sql_array['WHERE'] .= '(' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)'; - $sql_array['ORDER_BY'] = 't.post_id DESC LIMIT ' . (int) $poster_limit; + $sql_array = [ + 'SELECT' => 't.poster_id, t.post_id, u.username, u.user_colour', + 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'], + 'WHERE' => 't.user_id =' . (int) $user_id . ' AND u.user_id = t.poster_id AND (' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)', + 'ORDER_BY' => 't.post_id DESC' , + ]; $sql = $this->db->sql_build_query('SELECT', $sql_array); - $result = $this->db->sql_query($sql); + $result = $this->db->sql_query_limit($sql, $poster_limit, 0); + while ($row = $this->db->sql_fetchrow($result)) { - $thankered_member[] = array( - 'user_id' => $row['user_id'], + $user_thanked[] = array( 'poster_id' => $row['poster_id'], 'post_id' => $row['post_id'], - 'username' => $row['username'], - 'user_colour' => $row['user_colour'], + 'postername' => $row['username'], + 'poster_colour' => $row['user_colour'], ); } $this->db->sql_freeresult($result); - $post_list = array(); - $i=0; - foreach ($thankered_member as $key => $value) - { - if ($thankered_member[$key]['user_id'] == $user_id) - { - $i++; - $post_list[$i] = array( - 'postername' => $thankered_member[$key]['username'], - 'poster_id' => $thankered_member[$key]['poster_id'], - 'poster_colour' => $thankered_member[$key]['user_colour'], - 'post_id' => $thankered_member[$key]['post_id'], - ); - } - } - unset ($value); - $collim = ($poster_limit > $poster_give_count)? ceil($poster_give_count/4) : ceil($poster_limit/4); + $collim = ($poster_limit > $poster_give_count) ? ceil($poster_give_count/4) : ceil($poster_limit/4); $thanks_row = array(); $i = $j = 0; - foreach ($post_list as $value) + foreach ($user_thanked as $thanked) { $i++; if ($i <= $poster_limit) { - $thanks_row[$i]['USERNAME_FULL'] = get_username_string('full', $value['poster_id'], $value['postername'], $value['poster_colour']); - $thanks_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $value['post_id']. '#p' . $value['post_id']); + $thanks_row[$i]['USERNAME_FULL'] = get_username_string('full', $thanked['poster_id'], $thanked['postername'], $thanked['poster_colour']); + $thanks_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $thanked['post_id']. '#p' . $thanked['post_id']); + $j++; - if ($j > $collim or $i == $poster_give_count or $i == $poster_limit) + if ($j > $collim || $i == $poster_give_count || $i == $poster_limit) { $j = 0; - if ($i < $poster_limit and $i < $poster_give_count) + if ($i < $poster_limit && $i < $poster_give_count) { $thanks_row[$i]['S_SWITCH_COLUMN'] = true; } @@ -591,22 +534,21 @@ public function output_thanks_memberlist($user_id, $ex_fid_ary) if ($poster_give_count > $poster_limit) { $further_thanks = $poster_give_count - $poster_limit; - $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks); - $this->template->assign_var('FURTHER_THANKS_TEXT', $further_thanks_text); + $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks); + $this->template->assign_var('FURTHER_THANKS_TEXT_GIVEN', $further_thanks_text); } - unset ($value); - $l_poster_receive_count = ($poster_receive_count) ? $this->user->lang('THANKS', $poster_receive_count) : ''; - $l_poster_give_count = ($poster_give_count) ? $this->user->lang('THANKS', $poster_give_count) : ''; - $this->template->assign_vars(array( - 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->user->lang['CLEAR_LIST_THANKS']), + $l_poster_receive_count = ($poster_receive_count) ? $this->language->lang('THANKS', $poster_receive_count) : ''; + $l_poster_give_count = ($poster_give_count) ? $this->language->lang('THANKS', $poster_give_count) : ''; + $this->template->assign_vars([ + 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->language->lang('CLEAR_LIST_THANKS')), 'POSTER_RECEIVE_COUNT' => $l_poster_receive_count, 'POSTER_GIVE_COUNT' => $l_poster_give_count, 'THANKS_PROFILELIST_VIEW' => $this->config['thanks_profilelist_view'], 'S_MOD_THANKS' => $this->auth->acl_get('m_thanks'), 'U_CLEAR_LIST_THANKS_GIVE' => append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $user_id . '&list_thanks=give'), 'U_CLEAR_LIST_THANKS_RECEIVE' => append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $user_id . '&list_thanks=receive'), - )); + ]); } public function output_thanks($poster_id, &$postrow, $row, $topic_data, $forum_id) @@ -616,50 +558,51 @@ public function output_thanks($poster_id, &$postrow, $row, $topic_data, $forum_i $thanks_text = $this->get_thanks_text($row['post_id']); $thank_mode = $this->get_thanks_link($row['post_id']); $already_thanked = $this->already_thanked($row['post_id'], $this->user->data['user_id']); - $l_poster_receive_count = (isset($this->poster_list_count[$poster_id]['R']) && $this->poster_list_count[$poster_id]['R']) ? $this->user->lang('THANKS', (int) $this->poster_list_count[$poster_id]['R']) : ''; - $l_poster_give_count = (isset($this->poster_list_count[$poster_id]['G']) && $this->poster_list_count[$poster_id]['G']) ? $this->user->lang('THANKS', (int) $this->poster_list_count[$poster_id]['G']) : ''; + $l_poster_receive_count = (isset($this->poster_list_count[$poster_id]['R']) && $this->poster_list_count[$poster_id]['R']) ? $this->language->lang('THANKS', (int) $this->poster_list_count[$poster_id]['R']) : ''; + $l_poster_give_count = (isset($this->poster_list_count[$poster_id]['G']) && $this->poster_list_count[$poster_id]['G']) ? $this->language->lang('THANKS', (int) $this->poster_list_count[$poster_id]['G']) : ''; // Correctly form URLs - $u_receive_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $poster_id, 'give' => 'false', 'tslash' => '')); - $u_give_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $poster_id, 'give' => 'true', 'tslash' => '')); + $u_receive_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $poster_id, 'give' => 'false', 'tslash' => '']); + $u_give_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $poster_id, 'give' => 'true', 'tslash' => '']); - $postrow = array_merge($postrow, $thanks_text, array( - 'COND' => ($already_thanked) ? true : false, + $postrow = array_merge($postrow, $thanks_text, [ + 'COND' => $already_thanked, 'THANKS' => $this->get_thanks($row['post_id']), 'THANK_MODE' => $thank_mode, 'THANKS_LINK' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $row['post_id'] . '&' . $thank_mode . '=' . $row['post_id'] . '&to_id=' . $poster_id . '&from_id=' . $this->user->data['user_id']), - 'THANK_TEXT' => $this->user->lang['THANK_TEXT_1'], - 'THANK_TEXT_2' => ($this->get_thanks_number($row['post_id']) != 1) ? sprintf($this->user->lang['THANK_TEXT_2PL'], $this->get_thanks_number($row['post_id'])) : $this->user->lang['THANK_TEXT_2'], - 'THANKS_FROM' => $this->user->lang['THANK_FROM'], + 'THANK_TEXT' => $this->language->lang('THANK_TEXT_1'), + 'THANK_TEXT_2' => ($this->get_thanks_number($row['post_id']) != 1) ? $this->language->lang('THANK_TEXT_2PL', $this->get_thanks_number((int) $row['post_id'])) : $this->language->lang('THANK_TEXT_2'), + 'THANKS_FROM' => $this->language->lang('THANK_FROM'), 'POSTER_RECEIVE_COUNT' => $l_poster_receive_count, 'POSTER_GIVE_COUNT' => $l_poster_give_count, 'POSTER_RECEIVE_COUNT_LINK' => $u_receive_count_url, 'POSTER_GIVE_COUNT_LINK' => $u_give_count_url, - 'S_IS_OWN_POST' => ($this->user->data['user_id'] == $poster_id) ? true : false, - 'S_POST_ANONYMOUS' => ($poster_id == ANONYMOUS) ? true : false, - 'THANK_IMG' => ($already_thanked) ? $this->user->img('removethanks', $this->user->lang['REMOVE_THANKS']. get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : $this->user->img('thankposts', $this->user->lang['THANK_POST']. get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])), - 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->user->lang['CLEAR_LIST_THANKS']), + 'S_IS_OWN_POST' => $this->user->data['user_id'] == $poster_id, + 'S_POST_ANONYMOUS' => $poster_id == ANONYMOUS, + 'THANK_IMG' => ($already_thanked) ? $this->user->img('removethanks', $this->language->lang('REMOVE_THANKS') . get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : $this->user->img('thankposts', $this->language->lang('THANK_POST') . get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])), + 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->language->lang('CLEAR_LIST_THANKS')), 'THANKS_POSTLIST_VIEW' => $this->config['thanks_postlist_view'], 'THANKS_COUNTERS_VIEW' => $this->config['thanks_counters_view'], 'S_ALREADY_THANKED' => $already_thanked, - 'S_REMOVE_THANKS' => $this->config['remove_thanks'], - 'S_FIRST_POST_ONLY' => $this->config['thanks_only_first_post'], - 'POST_REPUT' => ($this->get_thanks_number($row['post_id']) != 0) ? round($this->get_thanks_number($row['post_id']) / ($this->max_post_thanks / 100), $this->config['thanks_number_digits']) . '%' : '', + 'S_REMOVE_THANKS' => (bool) $this->config['remove_thanks'], + 'S_FIRST_POST_ONLY' => (bool) $this->config['thanks_only_first_post'], + 'POST_REPUT' => ($this->get_thanks_number($row['post_id']) != 0) ? round($this->get_thanks_number($row['post_id']) / ($this->max_post_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '', + 'POST_THANKS_COUNT' => $this->get_thanks_number($row['post_id']) ?: '', 'S_THANKS_POST_REPUT_VIEW' => (bool) $this->config['thanks_post_reput_view'], - 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ?: false, - 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? $this->config['thanks_reput_level']*$this->config['thanks_reput_height'] : false, + 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false, 'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - 'S_GLOBAL_POST_THANKS' => ($topic_data['topic_type'] == POST_GLOBAL) ? !$this->config['thanks_global_post'] : false, + 'S_GLOBAL_POST_THANKS' => ($topic_data['topic_type'] == POST_GLOBAL) ? (bool) !$this->config['thanks_global_post'] : false, 'U_CLEAR_LIST_THANKS_POST' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $row['post_id'] . '&list_thanks=post'), 'S_MOD_THANKS' => $this->auth->acl_get('m_thanks'), - 'S_ONLY_TOPICSTART' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false, - )); + 'S_ONLY_TOPICSTART' => $topic_data['topic_first_post_id'] == $row['post_id'], + ]); } } - //refresh counts if post delete + // Refresh counts if post delete public function delete_post_thanks($post_ids) { $sql = 'DELETE FROM ' . $this->thanks_table . ' @@ -667,12 +610,12 @@ public function delete_post_thanks($post_ids) $this->db->sql_query($sql); } - // create an array of all thanks info + // Create an array of all thanks info public function array_all_thanks($post_list, $forum_id) { - $poster_list = array(); + $poster_list = []; - // max post thanks + // Max post thanks if ($this->config['thanks_post_reput_view']) { $sql = 'SELECT MAX(tally) AS max_post_thanks @@ -686,20 +629,21 @@ public function array_all_thanks($post_list, $forum_id) $this->max_post_thanks = 1; } - //array all user who say thanks on viewtopic page + // Array all user who say thanks on viewtopic page if ($this->auth->acl_get('f_thanks', $forum_id)) { - $sql_array = array( + $sql_array = [ 'SELECT' => 't.*, u.username, u.username_clean, u.user_colour', - 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'), + 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'], 'WHERE' => 'u.user_id = t.user_id AND ' . $this->db->sql_in_set('t.post_id', $post_list), 'ORDER_BY' => 't.thanks_time ASC', - ); + ]; $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { - $this->thankers[] = array( + $this->thankers[] = [ 'user_id' => $row['user_id'], 'poster_id' => $row['poster_id'], 'post_id' => $row['post_id'], @@ -707,16 +651,17 @@ public function array_all_thanks($post_list, $forum_id) 'username' => $row['username'], 'username_clean' => $row['username_clean'], 'user_colour' => $row['user_colour'], - ); + ]; } $this->db->sql_freeresult($result); } - //array thanks_count for all poster on viewtopic page + // Array thanks_count for all poster on viewtopic page if ($this->config['thanks_counters_view']) { $sql = 'SELECT DISTINCT poster_id FROM '. $this->posts_table . ' WHERE ' . $this->db->sql_in_set('post_id', $post_list); $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $poster_list[] = $row['poster_id']; @@ -725,13 +670,14 @@ public function array_all_thanks($post_list, $forum_id) $this->db->sql_freeresult($result); $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); - $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false; + $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false; $sql = 'SELECT poster_id, COUNT(poster_id) AS poster_count FROM ' . $this->thanks_table . ' WHERE ' . $this->db->sql_in_set('poster_id', $poster_list) . ' AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' GROUP BY poster_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $this->poster_list_count[$row['poster_id']]['R'] = $row['poster_count']; @@ -743,31 +689,31 @@ public function array_all_thanks($post_list, $forum_id) AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' GROUP BY user_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $this->poster_list_count[$row['user_id']]['G'] = $row['user_count']; } $this->db->sql_freeresult($result); } - return; } public function get_thanks_topic_reput($topic_id, $max_topic_thanks, $topic_thanks) { - return array( + return [ 'TOPIC_REPUT' => (isset($topic_thanks[$topic_id])) ? round((int) $topic_thanks[$topic_id] / ($max_topic_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '', 'S_THANKS_TOPIC_REPUT_VIEW' => (bool) $this->config['thanks_topic_reput_view'], - 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ?: false, - 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? $this->config['thanks_reput_level']*$this->config['thanks_reput_height'] : false, + 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false, 'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - ); + ]; } public function get_thanks_topic_number($topic_list) { - $topic_thanks = array(); + $topic_thanks = []; if ($this->config['thanks_topic_reput_view']) { $sql = 'SELECT topic_id, COUNT(*) AS topic_thanks @@ -775,16 +721,17 @@ public function get_thanks_topic_number($topic_list) WHERE " . $this->db->sql_in_set('topic_id', $topic_list) . ' GROUP BY topic_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $topic_thanks[$row['topic_id']] = $row['topic_thanks']; } $this->db->sql_freeresult($result); - return $topic_thanks; } + return $topic_thanks; } - // max topic thanks + // Max topic thanks public function get_max_topic_thanks() { if ($this->config['thanks_topic_reput_view']) @@ -794,11 +741,11 @@ public function get_max_topic_thanks() $result = $this->db->sql_query($sql); $this->max_topic_thanks = (int) $this->db->sql_fetchfield('max_topic_thanks'); $this->db->sql_freeresult($result); - return $this->max_topic_thanks; } + return $this->max_topic_thanks; } - // max post thanks for toplist + // Max post thanks for toplist public function get_max_post_thanks() { $sql = 'SELECT MAX(tally) AS max_post_thanks @@ -809,46 +756,58 @@ public function get_max_post_thanks() return $this->max_post_thanks; } - // Generate thankslist if required ... + // Generate thankslist if required public function get_toplist_index($ex_fid_ary) { - $thanks_list = ''; - $sql_ary = array( - 'SELECT' => 't.poster_id, COUNT(t.user_id) AS tally, u.user_id, u.username, u.user_colour', - 'FROM' => array( - $this->users_table => 'u', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array($this->thanks_table => 't'), + $sql_ary = [ + 'SELECT' => 't.poster_id, COUNT(t.user_id) AS tally', + 'FROM' => [$this->users_table => 'u'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->thanks_table => 't'], 'ON' => 'u.user_id = t.poster_id', - ), - ), + ], + ], 'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0', 'GROUP_BY' => 't.poster_id, u.user_id', 'ORDER_BY' => 'tally DESC', - ); - $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), (int) $this->config['thanks_top_number']); + ]; + + $cache_ttl = 86400; // Cache thanks toplist on index for 24 hours + $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), (int) $this->config['thanks_top_number'], 0, $cache_ttl); + $user_list = $thanks_list = []; while ($row = $this->db->sql_fetchrow($result)) { - $thanks_list .= (($thanks_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . ' (' . $row['tally'] . ')'; + $user_list[$row['poster_id']] = $row; } + unset($row); $this->db->sql_freeresult($result); + + $this->user_loader->load_users(array_keys($user_list)); + + foreach ($user_list as $row) + { + $thanks_list[] = [ + 'USERNAME' => $this->user_loader->get_username((int) $row['poster_id'], 'full'), + 'THANKS_COUNT' => (int) $row['tally'], + ]; + } + return $thanks_list; } public function get_thanks_forum_reput($forum_id) { - return array( - 'FORUM_REPUT' => (isset($this->forum_thanks[$forum_id])) ? round($this->forum_thanks[$forum_id] / ($this->max_forum_thanks / 100), ($this->config['thanks_number_digits'])) . '%' : '', + return [ + 'FORUM_REPUT' => (isset($this->forum_thanks[$forum_id])) ? round($this->forum_thanks[$forum_id] / ($this->max_forum_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '', 'S_THANKS_FORUM_REPUT_VIEW' => (bool) $this->config['thanks_forum_reput_view'], - 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'], + 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'], 'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ? $this->config['thanks_reput_height'] : false, - 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? $this->config['thanks_reput_level']*$this->config['thanks_reput_height'] : false, + 'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false, 'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '', - ); + ]; } public function get_thanks_forum_number() @@ -862,14 +821,15 @@ public function get_thanks_forum_number() WHERE " . $this->db->sql_in_set('forum_id', $forum_thanks_rating) . ' GROUP BY forum_id'; $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) { $this->forum_thanks[$row['forum_id']] = $row['forum_thanks']; } $this->db->sql_freeresult($result); } - return $this->forum_thanks; } + return $this->forum_thanks; } public function get_max_forum_thanks() @@ -882,8 +842,8 @@ public function get_max_forum_thanks() $result = $this->db->sql_query($sql); $this->max_forum_thanks = (int) $this->db->sql_fetchfield('max_forum_thanks'); $this->db->sql_freeresult($result); - return $this->max_forum_thanks; } + return $this->max_forum_thanks; } public function add_notification($notification_data, $notification_type_name = 'gfksx.thanksforposts.notification.type.thanks') @@ -924,17 +884,19 @@ public function get_post_info($post_id = false) { if (!$post_id) { - return array(); + return []; } - $sql_array = array( + + $sql_array = [ 'SELECT' => 'p.post_id, p.poster_id, p.topic_id, p.forum_id, p.post_subject', - 'FROM' => array ($this->posts_table => 'p'), - 'WHERE' => 'p.post_id =' . (int) $post_id); + 'FROM' => [$this->posts_table => 'p'], + 'WHERE' => 'p.post_id =' . (int) $post_id + ]; $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); - return ($row) ?: array(); + return ($row) ?: []; } } diff --git a/event/listener.php b/event/listener.php index 82295a0d..28390490 100644 --- a/event/listener.php +++ b/event/listener.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\event; @@ -18,10 +20,10 @@ class listener implements EventSubscriberInterface { /** @var array topic_thanks */ - protected $topic_thanks; + protected $topic_thanks = []; /** @var int max_topic_thanks */ - protected $max_topic_thanks; + protected $max_topic_thanks = 0; /** @var \phpbb\config\config */ protected $config; @@ -47,6 +49,9 @@ class listener implements EventSubscriberInterface /** @var \phpbb\controller\helper */ protected $controller_helper; + /** @var \phpbb\language\language */ + protected $language; + /** @var string phpbb_root_path */ protected $phpbb_root_path; @@ -57,21 +62,34 @@ class listener implements EventSubscriberInterface protected $helper; /** - * Constructor - * - * @param \phpbb\config\config $config Config object - * @param \phpbb\db\driver\driver_interface $db DBAL object - * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object - * @param \phpbb\cache\driver\driver_interface $cache Cache driver object - * @param \phpbb\request\request_interface $request Request object - * @param string $phpbb_root_path phpbb_root_path - * @param string $php_ext phpEx - * @param rxu\PostsMerging\core\helper $helper The extension helper object - * @access public - */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\request\request_interface $request, \phpbb\controller\helper $controller_helper, $phpbb_root_path, $php_ext, $helper) + * Constructor + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db DBAL object + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\cache\driver\driver_interface $cache Cache driver object + * @param \phpbb\request\request_interface $request Request object + * @param \phpbb\controller\helper $controller_helper Controller helper object + * @param \phpbb\language\language $language Language object + * @param string $phpbb_root_path phpbb_root_path + * @param string $php_ext phpEx + * @param rxu\PostsMerging\core\helper $helper The extension helper object + * @access public + */ + public function __construct( + \phpbb\config\config $config, + \phpbb\db\driver\driver_interface $db, + \phpbb\auth\auth $auth, + \phpbb\template\template $template, + \phpbb\user $user, + \phpbb\cache\driver\driver_interface $cache, + \phpbb\request\request_interface $request, + \phpbb\controller\helper $controller_helper, + \phpbb\language\language $language, + $phpbb_root_path, $php_ext, $helper + ) { $this->config = $config; $this->db = $db; @@ -81,51 +99,51 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive $this->cache = $cache; $this->request = $request; $this->controller_helper = $controller_helper; + $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->helper = $helper; - $this->topic_thanks = array(); - $this->max_topic_thanks = 0; } static public function getSubscribedEvents() { return array( - 'core.index_modify_page_title' => 'get_thanks_list', - 'core.memberlist_view_profile' => 'memberlist_viewprofile', - 'core.delete_posts_in_transaction' => 'delete_post_thanks', - 'core.viewforum_modify_topicrow' => 'viewforum_output_topics_reput', - 'core.viewforum_modify_topics_data' => 'viewforum_get_topics_reput', + 'core.index_modify_page_title' => 'get_thanks_list', + 'core.memberlist_view_profile' => 'memberlist_viewprofile', + 'core.delete_posts_in_transaction' => 'delete_post_thanks', + 'core.viewforum_modify_topicrow' => 'viewforum_output_topics_reput', + 'core.viewforum_modify_topics_data' => 'viewforum_get_topics_reput', // Set lower priority for the case another ext want to change $post_list first - 'core.viewtopic_get_post_data' => array('viewtopic_handle_thanks', -2), - 'core.viewtopic_modify_post_row' => 'viewtopic_modify_postrow', - 'core.display_forums_before' => 'forumlist_display_rating', - 'core.display_forums_modify_template_vars' => 'forumlist_modify_template_vars', - 'core.user_setup' => 'load_language_on_setup', - 'core.page_header_after' => 'add_header_quicklinks', - 'core.viewtopic_modify_page_title' => 'markread', - 'core.viewtopic_assign_template_vars_before' => 'viewtopic_check_f_thanks_auth', - 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_output_topics_reput', - 'paybas.recenttopics.modify_topics_list'=> 'recenttopics_get_topics_reput', - 'core.permissions' => 'add_permission', + 'core.viewtopic_get_post_data' => ['viewtopic_handle_thanks', -2], + 'core.viewtopic_modify_post_row' => 'viewtopic_modify_postrow', + 'core.display_forums_before' => 'forumlist_display_rating', + 'core.display_forums_modify_template_vars' => 'forumlist_modify_template_vars', + 'core.user_setup' => 'load_language_on_setup', + 'core.page_header_after' => 'add_header_quicklinks', + 'core.viewtopic_modify_page_title' => 'markread', + 'core.viewtopic_assign_template_vars_before'=> 'viewtopic_check_f_thanks_auth', + 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_output_topics_reput', + 'paybas.recenttopics.modify_topics_list' => 'recenttopics_get_topics_reput', + 'core.permissions' => 'add_permission', ); } public function get_thanks_list($event) { - // Generate thankslist if required ... - $thanks_list = ''; + // Generate thankslist if required + $thanks_list = []; $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); - $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : 0; + $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : [0]; if ($this->config['thanks_top_number']) { $thanks_list = $this->helper->get_toplist_index($ex_fid_ary); } - $this->template->assign_vars(array( - 'THANKS_LIST' => ($thanks_list != '') ? $thanks_list : false, - 'S_THANKS_LIST' => ($this->config['thanks_top_number'] && $thanks_list != '') ? true : false, - 'L_TOP_THANKS_LIST' => $this->config['thanks_top_number'] ? sprintf($this->user->lang['REPUT_TOPLIST'], (int) $this->config['thanks_top_number']) : false, - )); + $this->template->assign_vars([ + 'S_THANKS_LIST' => $this->config['thanks_top_number'] && !empty($thanks_list), + 'L_TOP_THANKS_LIST' => $this->config['thanks_top_number'] ? $this->language->lang('REPUT_TOPLIST', (int) $this->config['thanks_top_number']) : false, + ]); + + $this->template->assign_block_vars_array('toplist', $thanks_list); } public function memberlist_viewprofile($event) @@ -134,7 +152,7 @@ public function memberlist_viewprofile($event) $user_id = (int) $member['user_id']; $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); - $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false; + $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false; if ($this->request->is_set('list_thanks')) { @@ -212,7 +230,7 @@ public function forumlist_display_rating($event) { $forum_rows = $event['forum_rows']; $this->helper->get_max_forum_thanks(); - $forum_thanks_rating = array(); + $forum_thanks_rating = []; foreach ($forum_rows as $row) { $forum_thanks_rating[] = $row['forum_id']; @@ -237,25 +255,25 @@ public function forumlist_modify_template_vars($event) public function load_language_on_setup($event) { $lang_set_ext = $event['lang_set_ext']; - $lang_set_ext[] = array( + $lang_set_ext[] = [ 'ext_name' => 'gfksx/thanksforposts', 'lang_set' => 'thanks_mod', - ); + ]; $event['lang_set_ext'] = $lang_set_ext; } public function add_header_quicklinks($event) { - $u_thankslist = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => '')); - $u_toplist = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('tslash' => '')); - $this->template->assign_vars(array( - 'U_THANKS_LIST' => $u_thankslist, - 'U_REPUT_TOPLIST' => $u_toplist, + $u_thankslist = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller'); + $u_toplist = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller'); + $this->template->assign_vars([ + 'U_THANKS_LIST' => $u_thankslist, + 'U_REPUT_TOPLIST' => $u_toplist, 'S_DISPLAY_THANKSLIST' => $this->auth->acl_get('u_viewthanks'), 'S_DISPLAY_TOPLIST' => $this->auth->acl_get('u_viewtoplist') && ($this->config['thanks_post_reput_view'] || $this->config['thanks_topic_reput_view'] || $this->config['thanks_forum_reput_view']), - 'MINI_THANKS_IMG' => $this->user->img('icon_mini_thanks', $this->user->lang['GRATITUDES']), - 'MINI_TOPLIST_IMG' => $this->user->img('icon_mini_toplist', $this->user->lang['TOPLIST']), - )); + 'MINI_THANKS_IMG' => $this->user->img('icon_mini_thanks', $this->language->lang('GRATITUDES')), + 'MINI_TOPLIST_IMG' => $this->user->img('icon_mini_toplist', $this->language->lang('TOPLIST')), + ]); } public function markread($event) @@ -267,9 +285,9 @@ public function markread($event) public function viewtopic_check_f_thanks_auth($event) { $forum_id = (int) $event['forum_id']; - $this->template->assign_vars(array( + $this->template->assign_vars([ 'S_FORUM_THANKS' => (bool) ($this->auth->acl_get('f_thanks', $forum_id)), - )); + ]); } public function recenttopics_output_topics_reput($event) @@ -295,11 +313,12 @@ public function recenttopics_get_topics_reput($event) public function add_permission($event) { - $permissions = $event['permissions']; - $permissions['f_thanks'] = array('lang' => 'ACL_F_THANKS', 'cat' => 'misc'); - $permissions['m_thanks'] = array('lang' => 'ACL_M_THANKS', 'cat' => 'misc'); - $permissions['u_viewthanks'] = array('lang' => 'ACL_U_VIEWTHANKS', 'cat' => 'misc'); - $permissions['u_viewtoplist'] = array('lang' => 'ACL_U_VIEWTOPLIST', 'cat' => 'misc'); + $permissions = array_merge($event['permissions'], [ + 'f_thanks' => ['lang' => 'ACL_F_THANKS', 'cat' => 'misc'], + 'm_thanks' => ['lang' => 'ACL_M_THANKS', 'cat' => 'misc'], + 'u_viewthanks' => ['lang' => 'ACL_U_VIEWTHANKS', 'cat' => 'misc'], + 'u_viewtoplist' => ['lang' => 'ACL_U_VIEWTOPLIST', 'cat' => 'misc'], + ]); $event['permissions'] = $permissions; } } diff --git a/ext.php b/ext.php index 7b182055..1d863294 100644 --- a/ext.php +++ b/ext.php @@ -1,37 +1,39 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts; /** -* Extension class for custom enable/disable/purge actions -* -* NOTE TO EXTENSION DEVELOPERS: -* Normally it is not necessary to define any functions inside the ext class below. -* The ext class may contain special (un)installation commands in the methods -* enable_step(), disable_step() and purge_step(). As it is, these methods are defined -* in phpbb_extension_base, which this class extends, but you can overwrite them to -* give special instructions for those cases. This extension must do this because it uses -* the notifications system, which requires the methods enable_notifications(), -* disable_notifications() and purge_notifications() be run to properly manage the -* notifications created by it when enabling, disabling or deleting this extension. -*/ + * Extension class for custom enable/disable/purge actions + * + * NOTE TO EXTENSION DEVELOPERS: + * Normally it is not necessary to define any functions inside the ext class below. + * The ext class may contain special (un)installation commands in the methods + * enable_step(), disable_step() and purge_step(). As it is, these methods are defined + * in phpbb_extension_base, which this class extends, but you can overwrite them to + * give special instructions for those cases. This extension must do this because it uses + * the notifications system, which requires the methods enable_notifications(), + * disable_notifications() and purge_notifications() be run to properly manage the + * notifications created by it when enabling, disabling or deleting this extension. + */ class ext extends \phpbb\extension\base { /** - * Overwrite enable_step to enable notifications - * before any included migrations are installed. - * - * @param mixed $old_state State returned by previous call of this method - * @return mixed Returns false after last step, otherwise temporary state - */ + * Overwrite enable_step to enable notifications + * before any included migrations are installed. + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ function enable_step($old_state) { switch ($old_state) @@ -56,12 +58,12 @@ function enable_step($old_state) } /** - * Overwrite disable_step to disable notifications - * before the extension is disabled. - * - * @param mixed $old_state State returned by previous call of this method - * @return mixed Returns false after last step, otherwise temporary state - */ + * Overwrite disable_step to disable notifications + * before the extension is disabled. + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ function disable_step($old_state) { switch ($old_state) @@ -86,12 +88,12 @@ function disable_step($old_state) } /** - * Overwrite purge_step to purge notifications before - * any included and installed migrations are reverted. - * - * @param mixed $old_state State returned by previous call of this method - * @return mixed Returns false after last step, otherwise temporary state - */ + * Overwrite purge_step to purge notifications before + * any included and installed migrations are reverted. + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ function purge_step($old_state) { switch ($old_state) diff --git a/language/ca/info_acp_thanks.php b/language/ca/info_acp_thanks.php index ca0dea86..8e407d4f 100644 --- a/language/ca/info_acp_thanks.php +++ b/language/ca/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Gràcies esborrades', 'ACP_POSTS' => 'Tots els missatges', 'ACP_POSTSEND' => 'Missatges agraïts', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operació cancel·lada', 'ALLOW_THANKS_PM_ON' => 'Envia\'m un PM si s\'agraeix un missatge meu', 'ALLOW_THANKS_EMAIL_ON' => 'Envia\'m un email si s\'agraeix un missatge meu', -)); +]); diff --git a/language/ca/permissions_thanks.php b/language/ca/permissions_thanks.php index fb6bd494..250b7a74 100644 --- a/language/ca/permissions_thanks.php +++ b/language/ca/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Pot agraïr missatges', 'ACL_M_THANKS' => 'Pot esborrar la llista d\'agraïments', 'ACL_U_VIEWTHANKS' => 'Pot veure la llista de tots els agraïments', 'ACL_U_VIEWTOPLIST' => 'Pot veure la llista de més agraïts', -)); +]); diff --git a/language/ca/thanks_mod.php b/language/ca/thanks_mod.php index 3205c95e..fc28baf9 100644 --- a/language/ca/thanks_mod.php +++ b/language/ca/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Esborrar la llista d\'agraïments', 'CLEAR_LIST_THANKS_CONFIRM' => 'Realment vols esborrar la llista d\'agraïments de l\'usuari?', 'CLEAR_LIST_THANKS_GIVE' => 'S\'ha esborrat la llista d\'agraïments fets per l\'usuari.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Vés al tema', 'FOR_MESSAGE' => ' per missatge', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' i un usuari més', 2 => ' i %d usuaris més', - ), + ], 'NO_VIEW_USERS_THANKS' => 'No tens permís per veure la llista d\'agraïments.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Agraïment rebut de %1$s pel missatge:', 2 => 'Agraïments rebuts de %1$s pel missatge:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Agraïment cancel·lat de %1$s pel missatge:', 2 => 'Agraïments cancel·lats de %1$s pel missatge:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Algú ha agraït un missatge teu', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Algú ha cancel·lat un agraïment en un missatge teu', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' pel missatge (%d en total):', 'THANK_POST' => 'Agraeix l\'autor del missatge: ', 'THANK_POST_SHORT' => 'Gràcies', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d cop', 2 => '%d cops', - ), + ], 'THANKS_BACK' => 'Torna', 'THANKS_INFO_GIVE' => 'Acabes d\'agrair el missatge.', 'THANKS_INFO_REMOVE' => 'Acabes de cancel·lar el teu agraïment.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Cancel·la l\'agraïment', 'THANKS_USER' => 'Llista d\'agraïments', 'TOPLIST' => 'Llista de més agraïts', -)); +]); diff --git a/language/cs/email/user_thanks.txt b/language/cs/email/user_thanks.txt index 8e5cda0d..11bb02a5 100644 --- a/language/cs/email/user_thanks.txt +++ b/language/cs/email/user_thanks.txt @@ -1,4 +1,4 @@ -Předmět: {THANKS_SUBG} — "{POST_SUBJECT}" +Subject: {THANKS_SUBG} — "{POST_SUBJECT}" Dobrý den {POSTER_NAME}, diff --git a/language/cs/info_acp_thanks.php b/language/cs/info_acp_thanks.php index 0a432a5b..c59add77 100644 --- a/language/cs/info_acp_thanks.php +++ b/language/cs/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Vymazaná zaznamemaná poděkování', 'ACP_POSTS' => 'Celkem příspěvků', 'ACP_POSTSEND' => 'Zbývající příspěvky s poděkováními', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operace zrušena', 'ALLOW_THANKS_PM_ON' => 'Oznámit mi soukromou zprávou, pokud někdo poděkuje za můj příspěvek', 'ALLOW_THANKS_EMAIL_ON' => 'Oznámit mi e-mailem, pokud někdo poděkuje za můj příspěvek', -)); +]); diff --git a/language/cs/permissions_thanks.php b/language/cs/permissions_thanks.php index 59eaf70e..970246d3 100644 --- a/language/cs/permissions_thanks.php +++ b/language/cs/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Může děkovat za příspěvky', 'ACL_M_THANKS' => 'Může vymazat seznam poděkování', 'ACL_U_VIEWTHANKS' => 'Může zobrazit seznam poděkování', 'ACL_U_VIEWTOPLIST' => 'Může zobrazit toplist', -)); +]); diff --git a/language/cs/thanks_mod.php b/language/cs/thanks_mod.php index d2ec04dc..20686639 100644 --- a/language/cs/thanks_mod.php +++ b/language/cs/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Vymazat seznam poděkování', 'CLEAR_LIST_THANKS_CONFIRM' => 'Opravdu chcete uživatelův seznam poděkování?', 'CLEAR_LIST_THANKS_GIVE' => 'Seznam poděkování udělených uživatelem byl vymazán.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Přejdi na vlákno', 'FOR_MESSAGE' => ' za příspěvěk', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' a jeden další uživatel', 2 => ' a %d dalších uživatelů', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Nemáte oprávnění zobrazit seznam poděkování.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Obdrženo poděkování od %1$s za příspěvek:', 2 => 'Obdržena poděkování od %1$s za příspěvek:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Odebráno poděkování od %1$s za příspěvěk:', 2 => 'Odebrána poděkování od %1$s za příspěvek:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Někdo poděkoval za váš příspěvek', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Někdo odebral poděkování za váš příspěvek', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' za příspěvky (celkem %d):', 'THANK_POST' => 'Poděkujte autorovi příspěvku: ', 'THANK_POST_SHORT' => 'Poděkujte', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d poděkování', 2 => '%d poděkování', - ), + ], 'THANKS_BACK' => 'Zpět', 'THANKS_INFO_GIVE' => 'Poděkoval jste za tuto zprávu.', 'THANKS_INFO_REMOVE' => 'Odebral jste poděkování.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Odebrané poděkování za příspěvek', 'THANKS_USER' => 'Seznam poděkování', 'TOPLIST' => 'Toplist', -)); +]); diff --git a/language/da/email/user_thanks.txt b/language/da/email/user_thanks.txt new file mode 100644 index 00000000..24e83202 --- /dev/null +++ b/language/da/email/user_thanks.txt @@ -0,0 +1,10 @@ +Subject: {THANKS_SUBG} — "{POST_SUBJECT}" + +Hello {POSTER_NAME}, + +You are receiving this notification because {USERNAME} {POST_THANKS} "{POST_SUBJECT}" at "{SITENAME}". + +If you want to view the post, click the following link: +{U_POST_THANKS} + +{EMAIL_SIG} diff --git a/language/da/info_acp_thanks.php b/language/da/info_acp_thanks.php new file mode 100644 index 00000000..33b8a2f4 --- /dev/null +++ b/language/da/info_acp_thanks.php @@ -0,0 +1,137 @@ + 'Slettede gemte syntes godt om', + 'ACP_POSTS' => 'Totale indlæg', + 'ACP_POSTSEND' => 'Tilbageværende indlæg med syntes godt om', + 'ACP_POSTSTHANKS' => 'Total antal indlæg med syntes godt om', + 'ACP_THANKS' => 'Syntes godt om indlæg', + 'ACP_THANKS_MOD_VER' => 'Extension version: ', + 'ACP_THANKS_TRUNCATE' => 'Nulstil listen med syntes godt om', + 'ACP_ALLTHANKS' => 'Synten godt om der er taget hensyn til', + 'ACP_THANKSEND' => 'Tilbageværende antal syntes godt om der er taget hensyn til', + 'ACP_THANKS_REPUT' => 'Rangering Muligheder', + 'ACP_THANKS_REPUT_SETTINGS' => 'Rangering Muligheder', + 'ACP_THANKS_REPUT_SETTINGS_EXPLAIN' => 'Sæt standard indstillinger for rangering af indlæg, emner og fora, baseret på dette syntes godt om system.
Emne (imdlæg, emne eller forum) med det højeste antal syntes godt om får 100% rangering.', + 'ACP_THANKS_SETTINGS' => 'Syntes godty om Indstillinger', + 'ACP_THANKS_SETTINGS_EXPLAIN' => 'Standard syntes godt om indlægs indstillinger kan ændres her.', + 'ACP_THANKS_REFRESH' => 'Opdater tællere', + 'ACP_UPDATETHANKS' => 'Opdater gemte syntes godt om', + 'ACP_USERSEND' => 'Tilbageværende brugere som syntes godt om', + 'ACP_USERSTHANKS' => 'Total antal brugere som syntes godt om', + + 'GRAPHIC_BLOCK_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_block_back.gif', + 'GRAPHIC_BLOCK_RED' => 'ext/gfksx/thanksforposts/images/rating/reput_block_red.gif', + 'GRAPHIC_DEFAULT' => 'Billeder', + 'GRAPHIC_OPTIONS' => 'Billede Muligheder', + 'GRAPHIC_STAR_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif', + 'GRAPHIC_STAR_BLUE' => 'ext/gfksx/thanksforposts/images/rating/reput_star_blue.gif', + 'GRAPHIC_STAR_GOLD' => 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif', + + 'IMG_THANKPOSTS' => 'Til syntes godt om indlægget', + 'IMG_REMOVETHANKS' => 'Annuller syntes godt om', + + 'LOG_CONFIG_THANKS' => 'Opdaterede konfigurationen af syntes godt om udvidelsen', + + 'REFRESH' => 'Opdater', + 'REMOVE_THANKS' => 'Fjern syntes godt om', + 'REMOVE_THANKS_EXPLAIN' => 'Brugere kan fjerne syntes godt om hvis denne option er slået til.', + + 'STEPR' => ' - udført, skridt %s', + + 'THANKS_COUNTERS_VIEW' => 'Syntes godt om tællere', + 'THANKS_COUNTERS_VIEW_EXPLAIN' => 'Hvis slået til, vil informations blokken for forfatteren vise antal udstedte/modtagne antal syntes godt om.', + 'THANKS_FORUM_REPUT_VIEW' => 'Vis forum syntes godt om', + 'THANKS_GLOBAL_POST' => 'Syntes godt om i Globale Meddelelser', + 'THANKS_GLOBAL_POST_EXPLAIN' => 'Hvis slået til, vil syntes godt om være slået til i Globale Meddelelser.', + 'THANKS_FORUM_REPUT_VIEW_EXPLAIN' => 'Hvis slået til, så vil forum rangering blive vist i forum listen.', + 'THANKS_INFO_PAGE' => 'Informations beskeder', + 'THANKS_INFO_PAGE_EXPLAIN' => 'Hvis slået til, så vil informations beskeder blive vist efter syntes godt om et indlæg er givet eller fjernet.', + 'THANKS_NOTICE_ON' => 'Notifikationer er tilgængelige', + 'THANKS_NOTICE_ON_EXPLAIN' => 'Hvis slået til, så er notifikationer tilgængelige og brugeren kan konfigurere notifikationen via din profil.', + 'THANKS_NUMBER' => 'Antal syntes godt om fra listen vist i profilen', + 'THANKS_NUMBER_EXPLAIN' => 'Maximum antal syntes godt om der vises når man ser en profil.
Husk at det kan sløve forum ned hvis denne værdi sættes til mere end 250. ', + 'THANKS_NUMBER_DIGITS' => 'Antal decimaler i rangeringen', + 'THANKS_NUMBER_DIGITS_EXPLAIN' => 'Angiv antal decimaler til rangerings værdien.', + 'THANKS_NUMBER_ROW_REPUT' => 'Antal rækker i rangering topscope listen', + 'THANKS_NUMBER_ROW_REPUT_EXPLAIN' => 'Angiv antal rækker der skal vises i indlæg, emner og fora rangerings topscore liste.', + 'THANKS_NUMBER_POST' => 'Antal syntes godt om der vises i et indlæg', + 'THANKS_NUMBER_POST_EXPLAIN' => 'Maximum antal syntes godt om der vises når man læser et indlæg.
Husk at det kan sløve forum ned hvis denne værdi sættes til mere end 250. ', + 'THANKS_ONLY_FIRST_POST' => 'Kun for det første indlæg i et emne', + 'THANKS_ONLY_FIRST_POST_EXPLAIN' => 'Hvis slået til, så kan brugere kun syntes godt om det første indlæg i et emne.', + 'THANKS_POST_REPUT_VIEW' => 'Vis rangering for indlæg', + 'THANKS_POST_REPUT_VIEW_EXPLAIN' => 'Hvis slået til, vises indlægs rangering når de vises i et emne.', + 'THANKS_POSTLIST_VIEW' => 'Vis syntes godt om i indlæg', + 'THANKS_POSTLIST_VIEW_EXPLAIN' => 'Hvis slået til, vises en liste af brugere der har syntes godt om forfatteren af indlæget.
Bemærk at denne mulighed vil kun gælde hvis administratoren har slået rettigheder til at syntes godt om for indlæg i det forum.', + 'THANKS_PROFILELIST_VIEW' => 'Vis syntes godt om i profiler', + 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'Hvis slået til, så vises en komplet liste af syntes godt om inclusiv antal syntes godt om og hvilke indlæg en bruger har fået syntes godt om fra.', + 'THANKS_REFRESH' => 'Opdater syntes godt om tællere', + 'THANKS_REFRESH_EXPLAIN' => 'Herkan du opdatere syntes godt om tællere efter en bulk fjernelse af indlæg/emner/brugere, opdeling/sammenlægning af emner, opslag af eller fjernelse af globale meddelelser, slå muligheden til/fra for ’Kun det første indlæg i emnet’, ændre indlæg osv. Dette kan tage noget tid.
Vigtigt: For at det skal virke korrekt, så skal opdater tæller funktionen anvende MySQL version 4.1 eller senere!
Bemærk!
- Opdatering vil slette alle syntes godt om for gæste indlæg!
- Opdatering vil slette alle syntes godt om for globale meddelelser, hvis muligheden ’Syntes godt om i globale meddelelser’ er OFF!
- Opdatering vil slette alle syntes godt om for alle indlæg undtagen det første indlæg i et emne, hvis muligheden ’Kun for det første indlæg i et emne’ er ON!
', + 'THANKS_REFRESH_MSG' => 'Dette kan tage et par minutter at fuldføre. Alle inkorrekte poster vil blive slettet!
Handlingen kan ikke fortrydes!', + 'THANKS_REFRESHED_MSG' => 'Tøllere opdateret', + 'THANKS_REPUT_GRAPHIC' => 'Grafisk visning af rangeringen', + 'THANKS_REPUT_GRAPHIC_EXPLAIN' => 'Hvis slået til, så vil rangerings værdien vises grafisk ved anvendelse af billederne nedenfor.', + 'THANKS_REPUT_HEIGHT' => 'Grafik højde', + 'THANKS_REPUT_HEIGHT_EXPLAIN' => 'Angiv højden af skyderen til rangeringen i pixels.
Bemærk! For at kunne vises korrekt, skal du angive højden til det samme som højden af det efterfølgende billede! ', + 'THANKS_REPUT_IMAGE' => 'Hoved billedet for skyderen', + 'THANKS_REPUT_IMAGE_DEFAULT' => 'Grafisk forhåndsvisning', + 'THANKS_REPUT_IMAGE_DEFAULT_EXPLAIN' => 'Selve billedet og stien til vissedet vises her. Billede størrelsen er 15x15 pixels.
Du kan tegne dine egne billeder til forgrunden og baggrunden. Højden og bredden for billederne skal være ens for at sikre en korrekt skalering af grafikken.', + 'THANKS_REPUT_IMAGE_EXPLAIN' => 'Stien - relativ til phpBB rod folder - til grafik skala billedet.', + 'THANKS_REPUT_IMAGE_NOEXIST' => 'Hoved billedet til den grafiske skala findes ikke.', + 'THANKS_REPUT_IMAGE_BACK' => 'Baggrunds billedet til den grafiske skyder', + 'THANKS_REPUT_IMAGE_BACK_EXPLAIN' => 'Stien - relativ til phpBB installations folder - til den grafiske skala baggrunds billede.', + 'THANKS_REPUT_IMAGE_BACK_NOEXIST' => 'Baggrunds billedet til den grafiske skala findes ikke.', + 'THANKS_REPUT_LEVEL' => 'Antal billeder i den grafiske skala', + 'THANKS_REPUT_LEVEL_EXPLAIN' => 'Max antal billeder svarer til 100% af værdien af rangerings skalaen i grafikken.', + 'THANKS_TIME_VIEW' => 'Syntes godt om tid', + 'THANKS_TIME_VIEW_EXPLAIN' => 'Hvis slået til, vil indlæg vise tiden for syntes godt om.', + 'THANKS_TOP_NUMBER' => 'Antal brugere i top listen', + 'THANKS_TOP_NUMBER_EXPLAIN' => 'Angiv antal brugere der skal vises i indexets topliste. 0 - off displaying toplist.', + 'THANKS_TOPIC_REPUT_VIEW' => 'Vis emne rangering', + 'THANKS_TOPIC_REPUT_VIEW_EXPLAIN' => 'Hvis slået til, så bliver rangering vist når man kikker i et forum.', + 'TRUNCATE' => 'Nulstil', + 'TRUNCATE_THANKS' => 'Nulstil syntes godt om listen', + 'TRUNCATE_THANKS_EXPLAIN' => 'Denne procedure nulstiller alle syntes godt om tællere fuldstændigt (fjerner alle udstedte syntes godt om).
Handlingen kan ikke fortrydes!', + 'TRUNCATE_THANKS_MSG' => 'Syntes godt om tællere nulstillet.', + 'REFRESH_THANKS_CONFIRM' => 'Vil du virkelig opdatere syntes godt om tællere?', + 'TRUNCATE_THANKS_CONFIRM' => 'Vil du virkelig nulstille syntes godt om tællere?', + 'TRUNCATE_NO_THANKS' => 'Operationen afbrudt', + 'ALLOW_THANKS_PM_ON' => 'Notificer mig med et PM hvis noget syntes godt om mit indlæg', + 'ALLOW_THANKS_EMAIL_ON' => 'Notificer mig med en e-mail hvis noget syntes godt om mit indlæg', +]); diff --git a/language/da/permissions_thanks.php b/language/da/permissions_thanks.php new file mode 100644 index 00000000..f1074c87 --- /dev/null +++ b/language/da/permissions_thanks.php @@ -0,0 +1,44 @@ + 'Kan syntes godt om indlæg', + 'ACL_M_THANKS' => 'Kan nulstille syntes godt om listen', + 'ACL_U_VIEWTHANKS' => 'Kan se listen med alle syntes godt om', + 'ACL_U_VIEWTOPLIST' => 'Kan se topscore listen', +]); diff --git a/language/da/thanks_mod.php b/language/da/thanks_mod.php new file mode 100644 index 00000000..f9b3d8de --- /dev/null +++ b/language/da/thanks_mod.php @@ -0,0 +1,117 @@ + 'Nulstil syntes godt om liste', + 'CLEAR_LIST_THANKS_CONFIRM' => 'Vil du virkelig nulstille brugerens syntes godt om liste?', + 'CLEAR_LIST_THANKS_GIVE' => 'Syntes godt om listen fra brugeren blev nulstillet.', + 'CLEAR_LIST_THANKS_POST' => 'Syntes godt om listen i beskeden blev nulstillet.', + 'CLEAR_LIST_THANKS_RECEIVE' => 'Listen af syntes godt om opnået af brugeren blen nulstillet.', + + 'DISABLE_REMOVE_THANKS' => 'Sletning af syntes godt om er slået fra af administratoren', + + 'GIVEN' => 'Har syntes godt om', + 'GLOBAL_INCORRECT_THANKS' => 'Du kan ikke syntes godt om en Global Meddelelse som ikke refererer til et specifikt forum.', + 'GRATITUDES' => 'syntes godt om liste', + + 'INCORRECT_THANKS' => 'Ugyldigt syntes godt om', + + 'JUMP_TO_FORUM' => 'Gå til forum', + 'JUMP_TO_TOPIC' => 'Gå til topic', + + 'FOR_MESSAGE' => ' for indlæg', + 'FURTHER_THANKS' => [ + 1 => ' og flere brugere', + 2 => ' og %d flere brugere', + ], + + 'NO_VIEW_USERS_THANKS' => 'Du er ikke autoriseret til at se syntes godt om listen.', + + 'NOTIFICATION_THANKS_GIVE' => [ + 1 => '%1$s syntes godt om dit indlæg:', + 2 => '%1$s syntes godt om dit indlæg:', + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ + 1 => 'Fjernede syntes godt om fra %1$s for indlæget:', + 2 => 'Fjernede syntes godt om fra %1$s for indlæget:', + ], + 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Nogen syntes godt om dit indlæg', + 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Nogen fjernede en syntes godt omfra dit indlæg', + + 'RECEIVED' => 'Er blevet syntes godt om', + 'REMOVE_THANKS' => 'Fjern dit syntes godt om fra indlæg af: ', + 'REMOVE_THANKS_CONFIRM' => 'Er du sikker på at du vil fjerne dit syntes godt om?', + 'REMOVE_THANKS_SHORT' => 'Fjern syntes godt om', + 'REPUT' => 'Rangering', + 'REPUT_TOPLIST' => 'Syntes godt om topscore — %d', + 'RATING_LOGIN_EXPLAIN' => 'Du er ikke autoriseret til at se topscore.', + 'RATING_NO_VIEW_TOPLIST' => 'Du er ikke autoriseret til at se topscore.', + 'RATING_VIEW_TOPLIST_NO' => 'Topscore er slået fra af administratoren', + 'RATING_FORUM' => 'Forum', + 'RATING_POST' => 'Indlæg', + 'RATING_TOP_FORUM' => 'Ragnering forums', + 'RATING_TOP_POST' => 'Ragnering indlæg', + 'RATING_TOP_TOPIC' => 'Ragnering emner', + 'RATING_TOPIC' => 'Emne', + + 'THANK' => 'tid', + 'THANK_FROM' => 'fra', + 'THANK_TEXT_1' => 'Disse brugere syntes godt om ', + 'THANK_TEXT_2' => ''s indlæg: ', + 'THANK_TEXT_2PL' => ''s indlæg (total %d):', + 'THANK_POST' => 'Syntes godt om indlæget af: ', + 'THANK_POST_SHORT' => 'Syntes godt om', + 'THANKS' => [ + 1 => '%d gang', + 2 => '%d gange', + ], + 'THANKS_BACK' => 'Tilbage', + 'THANKS_INFO_GIVE' => 'Du har lige syntes godt om indlæget.', + 'THANKS_INFO_REMOVE' => 'Du har lige fjernet dit syntes godt om.', + 'THANKS_LIST' => 'Se/luk listen', + 'THANKS_PM_MES_GIVE' => 'syntes godt om dit indlæg', + 'THANKS_PM_MES_REMOVE' => 'har fjernet sit syntes godt om fra indlæget', + 'THANKS_PM_SUBJECT_GIVE' => 'Syntes godt om indlæget', + 'THANKS_PM_SUBJECT_REMOVE' => 'Fjernede syntes godt om indlæget', + 'THANKS_USER' => 'Syntes godt om liste', + 'TOPLIST' => 'Syntes godt om topscore', +]); diff --git a/language/de/info_acp_thanks.php b/language/de/info_acp_thanks.php index 5fe91f30..e995c4a5 100644 --- a/language/de/info_acp_thanks.php +++ b/language/de/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Entfernte Danksagungen', 'ACP_POSTS' => 'Beiträge insgesamt', 'ACP_POSTSEND' => 'Verbleibende Beiträge mit Danksagungen', @@ -99,7 +101,7 @@ 'THANKS_PROFILELIST_VIEW' => 'Danksagunsliste im Profil anzeigen', 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'Falls aktiviert, wird eine Liste aller Danksagungen, inklusive der Anzahl der Danksagungen und für welche Beiträge der Benutzer Danksagungen erhalten hat, angezeigt.', 'THANKS_REFRESH' => 'Danksagungszähler aktualisieren', - 'THANKS_REFRESH_EXPLAIN' => 'Hier kannst du die Danksagungszähler aktualisieren, falls viele Beiträge, Themen oder Benutzt gelöscht wurden, Themen geteilt oder zusammengeführt wurden, globale Ankündigungen erstellt oder gelöscht wurden, die Einstellung "Nur für den ersten Beitrag in einem Thema" geändert wurde, Autoren von Themen geändert wurden, usw. Dies kann eine Weile dauern.
Hinweis: Damit diese Funktion richtig funkntioniert, wird MySQL in der Version 4.1 oder höher benötigt!
Achtung:
- Das Aktualisieren wird alle Danksagungen in Gastbeiträgen löschen!
- Das Aktualisieren wird alle Danksagungen in globalen Ankündigungen löschen, falls die Einstellung "Danksagungen in globalen Ankündigungen aktivieren" deaktiviert ist!
- Das Aktualisieren wird alle Danksagungen, außer im ersten Beitrag eines Themas löschen, falls die Einstellung "Nur für den ersten Beitrag in einem Thema" aktiviert ist!
', + 'THANKS_REFRESH_EXPLAIN' => 'Hier kannst du die Danksagungszähler aktualisieren, falls viele Beiträge, Themen oder Benutzer gelöscht wurden, Themen geteilt oder zusammengeführt wurden, globale Ankündigungen erstellt oder gelöscht wurden, die Einstellung "Nur für den ersten Beitrag in einem Thema" geändert wurde, Autoren von Themen geändert wurden, usw. Dies kann eine Weile dauern.
Hinweis: Damit diese Funktion richtig funkntioniert, wird MySQL in der Version 4.1 oder höher benötigt!
Achtung:
- Das Aktualisieren wird alle Danksagungen in Gastbeiträgen löschen!
- Das Aktualisieren wird alle Danksagungen in globalen Ankündigungen löschen, falls die Einstellung "Danksagungen in globalen Ankündigungen aktivieren" deaktiviert ist!
- Das Aktualisieren wird alle Danksagungen, außer im ersten Beitrag eines Themas löschen, falls die Einstellung "Nur für den ersten Beitrag in einem Thema" aktiviert ist!
', 'THANKS_REFRESH_MSG' => 'Dies kann einige Minuten dauern. Alle ungültigen Danksagungen werden gelöscht!
Diese Aktion ist nicht umkehrbar!', 'THANKS_REFRESHED_MSG' => 'Danksagungszähler aktualisiert.', 'THANKS_REPUT_GRAPHIC' => 'Grafische Darstellung von Bewertungen', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Aktion wurde abgebrochen', 'ALLOW_THANKS_PM_ON' => 'Mich mittels Privater Nachricht benachrichtigen, wenn sich jemand bei mir bedankt.', 'ALLOW_THANKS_EMAIL_ON' => 'Mich mittels E-Mail benachrichtigen, wenn sich jemand bei mir bedankt.', -)); +]); diff --git a/language/de/permissions_thanks.php b/language/de/permissions_thanks.php index b0ab47c7..828eab79 100644 --- a/language/de/permissions_thanks.php +++ b/language/de/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Kann sich für Beiträge bedanken', 'ACL_M_THANKS' => 'Kann die Liste der Danksagungen löschen', 'ACL_U_VIEWTHANKS' => 'Kann die Liste aller Danksagungen sehen', 'ACL_U_VIEWTOPLIST' => 'Kann die Topliste sehen', -)); +]); diff --git a/language/de/thanks_mod.php b/language/de/thanks_mod.php index c06ac974..38dfe10f 100644 --- a/language/de/thanks_mod.php +++ b/language/de/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Die Liste der Danksagungen löschen', 'CLEAR_LIST_THANKS_CONFIRM' => 'Möchtest du wirklich die Liste der Danksagungen des Benutzers löschen?', 'CLEAR_LIST_THANKS_GIVE' => 'Die Liste der Danksagungen des Benutzers wurde gelöscht', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Zum Thema wechseln', 'FOR_MESSAGE' => ' für den Beitrag', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' und ein weiterer Benutzer', 2 => ' und %d weitere Benutzer', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Du hast keine Berechtigung, die Liste der Danksagungen zu sehen.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Danksagung erhalten von %1$s für den Beitrag:', 2 => 'Danksagungen erhalten von %1$s für den Beitrag:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Danksagung entfernt von %1$s für den Beitrag:', 2 => 'Danksagungen entfernt von %1$s für den Beitrag:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Jemand hat sich für deinen Beitrag bedankt.', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Jemand hat seine Danksagung für deinen Beitrag entfernt.', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' für den Beitrag (Insgesamt %d):', 'THANK_POST' => 'Bedanke dich beim Autor des Beitrags: ', 'THANK_POST_SHORT' => 'Danke', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d Mal', 2 => '%d Mal', - ), + ], 'THANKS_BACK' => 'Zurück', 'THANKS_INFO_GIVE' => 'Du hast dich für den Beitrag bedankt.', 'THANKS_INFO_REMOVE' => 'Du hast deine Danksagung entfernt.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Danksagung entfernt für den Beitrag', 'THANKS_USER' => 'Liste der Danksagungen', 'TOPLIST' => 'Beitragstopliste', -)); +]); diff --git a/language/de_x_sie/info_acp_thanks.php b/language/de_x_sie/info_acp_thanks.php index e4d95e70..5e70b76f 100644 --- a/language/de_x_sie/info_acp_thanks.php +++ b/language/de_x_sie/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Entfernte Danksagungen', 'ACP_POSTS' => 'Beiträge insgesamt', 'ACP_POSTSEND' => 'Verbleibende Beiträge mit Danksagungen', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Aktion wurde abgebrochen', 'ALLOW_THANKS_PM_ON' => 'Mich mittels Privater Nachricht benachrichtigen, wenn sich jemand bei mir bedankt.', 'ALLOW_THANKS_EMAIL_ON' => 'Mich mittels E-Mail benachrichtigen, wenn sich jemand bei mir bedankt.', -)); +]); diff --git a/language/de_x_sie/permissions_thanks.php b/language/de_x_sie/permissions_thanks.php index b0ab47c7..828eab79 100644 --- a/language/de_x_sie/permissions_thanks.php +++ b/language/de_x_sie/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Kann sich für Beiträge bedanken', 'ACL_M_THANKS' => 'Kann die Liste der Danksagungen löschen', 'ACL_U_VIEWTHANKS' => 'Kann die Liste aller Danksagungen sehen', 'ACL_U_VIEWTOPLIST' => 'Kann die Topliste sehen', -)); +]); diff --git a/language/de_x_sie/thanks_mod.php b/language/de_x_sie/thanks_mod.php index 44d545e0..bf30ef4b 100644 --- a/language/de_x_sie/thanks_mod.php +++ b/language/de_x_sie/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Die Liste der Danksagungen löschen', 'CLEAR_LIST_THANKS_CONFIRM' => 'Möchten Sie wirklich die Liste der Danksagungen des Benutzers löschen?', 'CLEAR_LIST_THANKS_GIVE' => 'Die Liste der Danksagungen des Benutzers wurde gelöscht', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Zum Thema wechseln', 'FOR_MESSAGE' => ' für den Beitrag', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' und ein weiterer Benutzer', 2 => ' und %d weitere Benutzer', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Sie haben keine Berechtigung, die Liste der Danksagungen zu sehen.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Danksagung erhalten von %1$s für den Beitrag:', 2 => 'Danksagungen erhalten von %1$s für den Beitrag:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Danksagung entfernt von %1$s für den Beitrag:', 2 => 'Danksagungen entfernt von %1$s für den Beitrag:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Jemand hat sich für Ihren Beitrag bedankt.', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Jemand hat seine Danksagung für Ihren Beitrag entfernt.', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' für den Beitrag (Insgesamt %d):', 'THANK_POST' => 'Bedanken Sie sich beim Autor des Beitrags: ', 'THANK_POST_SHORT' => 'Danke', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d Mal', 2 => '%d Mal', - ), + ], 'THANKS_BACK' => 'Zurück', 'THANKS_INFO_GIVE' => 'Sie haben sich für den Beitrag bedankt.', 'THANKS_INFO_REMOVE' => 'Sie haben Ihre Danksagung entfernt.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Danksagung entfernt für den Beitrag', 'THANKS_USER' => 'Liste der Danksagungen', 'TOPLIST' => 'Beitragstopliste', -)); +]); diff --git a/language/en/info_acp_thanks.php b/language/en/info_acp_thanks.php index ea532032..8e1e4b1f 100644 --- a/language/en/info_acp_thanks.php +++ b/language/en/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Deleted recorded thanks', 'ACP_POSTS' => 'Total posts', 'ACP_POSTSEND' => 'Remaining posts with thanks', @@ -99,7 +101,7 @@ 'THANKS_PROFILELIST_VIEW' => 'List thanks in profile', 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'If enabled, a complete list of thanks including number of thanks and which posts a user has been thanked for will be displayed.', 'THANKS_REFRESH' => 'Update thanks counters', - 'THANKS_REFRESH_EXPLAIN' => 'Here you can update thanks counters after a mass removal of posts/topics/users, splitting/merging of topics, setting/removing Global Announcement, enabling/disabling option "Only for the first post in the topic", changing posts owners and etc. This may take some time.
Important: To work correctly, the refresh counters function needs MySQL version 4.1 or later!
Attention!
- Refreshing will erase all thanks for the guest posts!
- Refreshing will erase all thanks for the Global Announcements, if the option `Thanks in Global Announcements` is OFF!
- Refreshing will erase all thanks for all positions excepting the first in the topic, if the option `Only for the first post in the topic` is ON!
', + 'THANKS_REFRESH_EXPLAIN' => 'Here you can update thanks counters after a mass removal of posts/topics/users, splitting/merging of topics, setting/removing Global Announcement, enabling/disabling option ’Only for the first post in the topic’, changing posts owners and etc. This may take some time.
Important: To work correctly, the refresh counters function needs MySQL version 4.1 or later!
Attention!
- Refreshing will erase all thanks for the guest posts!
- Refreshing will erase all thanks for the Global Announcements, if the option ’Thanks in Global Announcements’ is OFF!
- Refreshing will erase all thanks for all posts except the first post in the topic, if the option ’Only for the first post in the topic’ is ON!
', 'THANKS_REFRESH_MSG' => 'This can take a few minutes to complete. All incorrect thanks entries will be deleted!
Action is not reversible!', 'THANKS_REFRESHED_MSG' => 'Counters updated', 'THANKS_REPUT_GRAPHIC' => 'Graphic display of the rating', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operation canceled', 'ALLOW_THANKS_PM_ON' => 'Notify me PM if someone thanks my post', 'ALLOW_THANKS_EMAIL_ON' => 'Notify me e-mail if someone thanks my post', -)); +]); diff --git a/language/en/permissions_thanks.php b/language/en/permissions_thanks.php index 91562ef6..8c4ce2fa 100644 --- a/language/en/permissions_thanks.php +++ b/language/en/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Can thank for posts', 'ACL_M_THANKS' => 'Can clear the thanks list', 'ACL_U_VIEWTHANKS' => 'Can view list of all thanks', 'ACL_U_VIEWTOPLIST' => 'Can view toplist', -)); +]); diff --git a/language/en/thanks_mod.php b/language/en/thanks_mod.php index 9772e601..b6bed43c 100644 --- a/language/en/thanks_mod.php +++ b/language/en/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Clear Thanks List', 'CLEAR_LIST_THANKS_CONFIRM' => 'Do you really want to clear the user`s Thanks List?', 'CLEAR_LIST_THANKS_GIVE' => 'List of thanks issued by the user was cleared.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Jump to topic', 'FOR_MESSAGE' => ' for post', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' and one more user', 2 => ' and %d more users', - ), + ], 'NO_VIEW_USERS_THANKS' => 'You are not authorised to view the Thanks List.', - 'NOTIFICATION_THANKS_GIVE' => array( - 1 => 'Received thank from %1$s for the post:', - 2 => 'Received thanks from %1$s for the post:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + 'NOTIFICATION_THANKS_GIVE' => [ + 1 => '%1$s has thanked you for this post:', + 2 => '%1$s has thanked you for this post:', + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Removed thank from %1$s for the post:', 2 => 'Removed thanks from %1$s for the post:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Someone thanks you for a post', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Someone removed thanks for your post', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' for the post (total %d):', 'THANK_POST' => 'Say Thanks to the author of the post: ', 'THANK_POST_SHORT' => 'Thanks', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d time', 2 => '%d times', - ), + ], 'THANKS_BACK' => 'Return', 'THANKS_INFO_GIVE' => 'You have just thanked for the post.', 'THANKS_INFO_REMOVE' => 'You have just removed your thank.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Removed thank for the post', 'THANKS_USER' => 'List of thanks', 'TOPLIST' => 'Posts toplist', -)); +]); diff --git a/language/es/info_acp_thanks.php b/language/es/info_acp_thanks.php index 01d3749f..968da410 100644 --- a/language/es/info_acp_thanks.php +++ b/language/es/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Eliminar gracias', 'ACP_POSTS' => 'Mensajes totales', 'ACP_POSTSEND' => 'Mensajes con agradecimientos', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operación cancelada', 'ALLOW_THANKS_PM_ON' => 'Notificar por MP si se agradece cualquiera de mis mensajes', 'ALLOW_THANKS_EMAIL_ON' => 'Notificar por email si se agradece cualquiera de mis mensajes', -)); +]); diff --git a/language/es/permissions_thanks.php b/language/es/permissions_thanks.php index 1fcf714a..cdcde57f 100644 --- a/language/es/permissions_thanks.php +++ b/language/es/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Puede agradecer mensajes', 'ACL_M_THANKS' => 'Puede limpiar la lista de agradecimientos', 'ACL_U_VIEWTHANKS' => 'Puede ver la lista de todos los agradecimientos', 'ACL_U_VIEWTOPLIST' => 'Puede ver la lista TOP', -)); +]); diff --git a/language/es/thanks_mod.php b/language/es/thanks_mod.php index 619e6493..37d6edcb 100644 --- a/language/es/thanks_mod.php +++ b/language/es/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Limpiar lista de gracias', 'CLEAR_LIST_THANKS_CONFIRM' => '¿De verdad quieren limpiar la lista gracias a un usuario?', 'CLEAR_LIST_THANKS_GIVE' => 'La lista de gracias ha sido limpiada.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Ir al tema', 'FOR_MESSAGE' => ' por mensaje', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' y otro usario', 2 => ' y d% usuarios más', - ), + ], 'NO_VIEW_USERS_THANKS' => 'No está autorizado para ver la lista de gracias.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Agradecimiento recibido de %1$s por el mensaje:', 2 => 'Agradecimientos recibidos de %1$s por el mensaje:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Agradecimiento eliminado de %1$s por el mensaje:', 2 => 'Agradecimientos eliminados de %1$s por el mensaje:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguien le dio las gracias por su mensaje', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguien elimino el agradecimientos por su mensaje', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' por el mensaje (total %d):', 'THANK_POST' => 'De las gracias al autor del mensaje: ', 'THANK_POST_SHORT' => 'Gracias', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d vez', 2 => '%d veces', - ), + ], 'THANKS_BACK' => 'Volver', 'THANKS_INFO_GIVE' => 'Acaba de dar gracias por el mensaje.', 'THANKS_INFO_REMOVE' => 'Acaba de eliminar el agradecimiento.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Eliminar gracias', 'THANKS_USER' => 'Lista de gracias', 'TOPLIST' => 'Lista TOP de mensajes', -)); +]); diff --git a/language/fr/info_acp_thanks.php b/language/fr/info_acp_thanks.php index 197c1bb2..a1465559 100644 --- a/language/fr/info_acp_thanks.php +++ b/language/fr/info_acp_thanks.php @@ -1,13 +1,14 @@ 'Nombre de remerciements supprimés', 'ACP_POSTS' => 'Nombre de messages', 'ACP_POSTSEND' => 'Nombre de messages remerciés restants à prendre en compte', @@ -136,4 +137,4 @@ 'TRUNCATE_NO_THANKS' => 'L’opération a été annulée.', 'ALLOW_THANKS_PM_ON' => 'Notifier moi par message privé si quelqu’un remercie un de mes messages', 'ALLOW_THANKS_EMAIL_ON' => 'Notifier moi par e-mail si un quelqu’un remercie un de mes messages', -)); +]); diff --git a/language/fr/permissions_thanks.php b/language/fr/permissions_thanks.php index 68bb53cd..6030888f 100644 --- a/language/fr/permissions_thanks.php +++ b/language/fr/permissions_thanks.php @@ -1,13 +1,14 @@ 'Peut remercier les messages.', 'ACL_M_THANKS' => 'Peut purger la liste des remerciements.', 'ACL_U_VIEWTHANKS' => 'Peut voir la liste des remerciements.', 'ACL_U_VIEWTOPLIST' => 'Peut voir le Top du classement des remerciements.', -)); +]); diff --git a/language/fr/thanks_mod.php b/language/fr/thanks_mod.php index 8ac2f34b..cc723513 100644 --- a/language/fr/thanks_mod.php +++ b/language/fr/thanks_mod.php @@ -1,13 +1,14 @@ 'Purger la liste des remerciements', 'CLEAR_LIST_THANKS_CONFIRM' => 'Confirmer la purge de la liste des remerciements.', 'CLEAR_LIST_THANKS_GIVE' => 'La liste des remerciements de cet utilisateur a été purgée.', @@ -57,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Aller au sujet', 'FOR_MESSAGE' => ' pour le message', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' et un autre utilisateur', 2 => ' et %d autres utilisateurs', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Vous n’êtes pas autorisé à voir la liste des remerciements.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Remerciement reçu de %1$s pour le message :', 2 => 'Remerciements reçus de %1$s pour le message :', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Remerciement retiré de %1$s pour le message : ', 2 => 'Remerciements retirés de %1$s pour le message : ', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Quelqu’un vous a remercié pour votre message.', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Quelqu’un a retiré son remerciement pour votre message.', @@ -98,10 +99,10 @@ 'THANK_TEXT_2PL' => ' pour son message (%d au total) : ', 'THANK_POST' => 'Remercier l’auteur de ce message : ', 'THANK_POST_SHORT' => 'Remercier', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d fois', 2 => '%d fois', - ), + ], 'THANKS_BACK' => 'Retour', 'THANKS_INFO_GIVE' => 'Vous venez de remercier l’auteur de ce message.', 'THANKS_INFO_REMOVE' => 'Vous venez de supprimer votre remerciement pour l’auteur de ce message.', @@ -112,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Remerciement supprimé pour le message', 'THANKS_USER' => 'Liste des remerciements', 'TOPLIST' => 'Top du classement des remerciements', -)); +]); diff --git a/language/hr/info_acp_thanks.php b/language/hr/info_acp_thanks.php index b27dff36..56fc6599 100644 --- a/language/hr/info_acp_thanks.php +++ b/language/hr/info_acp_thanks.php @@ -1,12 +1,15 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + /** * DO NOT CHANGE */ @@ -14,10 +17,12 @@ { exit; } + if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } + // DEVELOPERS PLEASE NOTE // // All language files should use UTF-8 as their encoding and the files must not contain a BOM. @@ -29,7 +34,7 @@ // You do not need this where single placeholders are used, e.g. 'Message %d' is fine // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Obrisanih zapisa zahvala', 'ACP_POSTS' => 'Ukupno postova', 'ACP_POSTSEND' => 'Preostalo postova sa zahvalama', @@ -121,4 +126,4 @@ 'TRUNCATE_NO_THANKS' => 'Operacija poništena', 'ALLOW_THANKS_PM_ON' => 'Obavijesti me u PP ako mi netko zahvali na postu', 'ALLOW_THANKS_EMAIL_ON' => 'Obavijesti me na e-mail ako mi netko zahvali na postu', -)); +]); diff --git a/language/hr/permissions_thanks.php b/language/hr/permissions_thanks.php index b8f68a61..29aaa076 100644 --- a/language/hr/permissions_thanks.php +++ b/language/hr/permissions_thanks.php @@ -1,12 +1,15 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + /** * DO NOT CHANGE */ @@ -14,10 +17,12 @@ { exit; } + if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } + // DEVELOPERS PLEASE NOTE // // All language files should use UTF-8 as their encoding and the files must not contain a BOM. @@ -29,9 +34,9 @@ // You do not need this where single placeholders are used, e.g. 'Message %d' is fine // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Možeš zahvaliti na post', 'ACL_M_THANKS' => 'Možeš obrisati listu zahvala', 'ACL_U_VIEWTHANKS' => 'Možeš vidjeti listu svih zahvala', 'ACL_U_VIEWTOPLIST' => 'Možeš vidjeti toplistu', -)); +]); diff --git a/language/hr/thanks_mod.php b/language/hr/thanks_mod.php index d79a1d75..fdfcbcd6 100644 --- a/language/hr/thanks_mod.php +++ b/language/hr/thanks_mod.php @@ -1,12 +1,15 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + /** * DO NOT CHANGE */ @@ -14,10 +17,12 @@ { exit; } + if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } + // DEVELOPERS PLEASE NOTE // // All language files should use UTF-8 as their encoding and the files must not contain a BOM. @@ -33,7 +38,7 @@ // Some characters you may want to copy&paste: // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Brisanje liste zahvala', 'CLEAR_LIST_THANKS_CONFIRM' => 'Zaista želiš obrisati korisničku listu zahvala?', 'CLEAR_LIST_THANKS_GIVE' => 'Lista zahvala izdana korisnicima je obrisana.', @@ -47,22 +52,23 @@ 'JUMP_TO_FORUM' => 'Prebaci se na forum', 'JUMP_TO_TOPIC' => 'Prebaci se na temu', 'FOR_MESSAGE' => ' za post', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' i još jedan korisnik', 2 => ' i još %d korisnika', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Nemaš ovlasti vidjeti Listu zahvala.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Primljena zahvala od %1$s za post:', 2 => 'Primljene zahvale od %1$s za post:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Uklonjena zahvala od %1$s za post:', 2 => 'Uklonjene zahvale od %1$s za post:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Netko je zahvalio na tvojem postu', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Netko je uklonio zahvalu s tvojeg posta', + 'RECEIVED' => ' pohvaljen', 'REMOVE_THANKS' => 'Ukloni svoje zahvale: ', 'REMOVE_THANKS_CONFIRM' => 'Zaista želiš ukloniti svoje zahvale?', @@ -86,10 +92,10 @@ 'THANK_TEXT_2PL' => ' za post (ukupno %d):', 'THANK_POST' => 'Zahvali se autoru posta: ', 'THANK_POST_SHORT' => 'Hvala', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d put', 2 => '%d puta', - ), + ], 'THANKS_BACK' => 'Povrat', 'THANKS_INFO_GIVE' => 'Upravo si zahvalio na postu.', 'THANKS_INFO_REMOVE' => 'upravo si uklonio zahvalu.', @@ -100,4 +106,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Ukloni zahvalu s posta', 'THANKS_USER' => 'Lista zahvala', 'TOPLIST' => 'Toplista postova', -)); +]); diff --git a/language/pt/info_acp_thanks.php b/language/pt/info_acp_thanks.php index 478af8e4..f97d4476 100644 --- a/language/pt/info_acp_thanks.php +++ b/language/pt/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Registos de mensagens de agradecimento apagados', 'ACP_POSTS' => 'Total de mensagens', 'ACP_POSTSEND' => 'Restantes mensagens com agradecimentos', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operação cancelada', 'ALLOW_THANKS_PM_ON' => 'Notificar-me por Mensagem Privada dos agradecimentos às minhas mensagens', 'ALLOW_THANKS_EMAIL_ON' => 'Notificar-me por email dos agradecimentos às minhas mensagens', -)); +]); diff --git a/language/pt/permissions_thanks.php b/language/pt/permissions_thanks.php index 6fefc1a5..9788a2a5 100644 --- a/language/pt/permissions_thanks.php +++ b/language/pt/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Pode agradecer pela mensagem', 'ACL_M_THANKS' => 'Pode eliminar os agradecimentos da lista', 'ACL_U_VIEWTHANKS' => 'Pode ver a lista de todos os agradecimentos', 'ACL_U_VIEWTOPLIST' => 'Pode ver a Toplist', -)); +]); diff --git a/language/pt/thanks_mod.php b/language/pt/thanks_mod.php index acf6dff0..bc6a6987 100644 --- a/language/pt/thanks_mod.php +++ b/language/pt/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Limpar lista de agradecimentos', 'CLEAR_LIST_THANKS_CONFIRM' => 'Tem a certeza que deseja limpar a sua lista de agradecimentos?', 'CLEAR_LIST_THANKS_GIVE' => 'Lista de agradecimentos dados foi limpa.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Ir para o Tópico', 'FOR_MESSAGE' => ' pela mensagem', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' e mais um utilizador', 2 => ' em mais %d utilizadores', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Não tem autorização para ver a lista de agradecimentos.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Agradecimento recebido de %1$s pela mensagem:', 2 => 'Agradecimentos recebidos de %1$s pela mensagem:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Agradecimento eliminado de %1$s pela mensagem:', 2 => 'Agradecimentos eliminados de %1$s pela mensagem:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguém agradece pela mensagem', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguém eliminou o agradecimento da mensagem ', @@ -97,10 +99,10 @@ 'THANK_TEXT_2PL' => ' pela mensagem (total %d):', 'THANK_POST' => 'Agradecer por esta mensagem ao autor: ', 'THANK_POST_SHORT' => 'Obrigado', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d vez', 2 => '%d vezes', - ), + ], 'THANKS_BACK' => 'Voltar', 'THANKS_INFO_GIVE' => 'Agradeceu ao autor.', 'THANKS_INFO_REMOVE' => 'Retirou agradecimentos ao autor.', @@ -111,4 +113,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Retirar agradecimento', 'THANKS_USER' => 'Lista de agradecimentos', 'TOPLIST' => 'TOP lista mensagens', -)); +]); diff --git a/language/pt-br/email/user_thanks.txt b/language/pt_br/email/user_thanks.txt similarity index 100% rename from language/pt-br/email/user_thanks.txt rename to language/pt_br/email/user_thanks.txt diff --git a/language/pt-br/info_acp_thanks.php b/language/pt_br/info_acp_thanks.php similarity index 90% rename from language/pt-br/info_acp_thanks.php rename to language/pt_br/info_acp_thanks.php index 6421ed51..3b9dd1ca 100644 --- a/language/pt-br/info_acp_thanks.php +++ b/language/pt_br/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Deleted recorded thanks', 'ACP_POSTS' => 'Total posts', 'ACP_POSTSEND' => 'Remaining posts with thanks', @@ -99,7 +101,7 @@ 'THANKS_PROFILELIST_VIEW' => 'List thanks in profile', 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'If enabled, a complete list of thanks including number of thanks and which posts a user has been thanked for will be displayed.', 'THANKS_REFRESH' => 'Update thanks counters', - 'THANKS_REFRESH_EXPLAIN' => 'Here you can update thanks counters after a mass removal of posts/topics/users, splitting/merging of topics, setting/removing Global Announcement, enabling/disabling option "Only for the first post in the topic", changing posts owners and etc. This may take some time.
Important: To work correctly, the refresh counters function needs MySQL version 4.1 or later!
Attention!
- Refreshing will erase all thanks for the guest posts!
- Refreshing will erase all thanks for the Global Announcements, if the option `Thanks in Global Announcements` is OFF!
- Refreshing will erase all thanks for all positions excepting the first in the topic, if the option `Only for the first post in the topic` is ON!
', + 'THANKS_REFRESH_EXPLAIN' => 'Here you can update thanks counters after a mass removal of posts/topics/users, splitting/merging of topics, setting/removing Global Announcement, enabling/disabling option ’Only for the first post in the topic’, changing posts owners and etc. This may take some time.
Important: To work correctly, the refresh counters function needs MySQL version 4.1 or later!
Attention!
- Refreshing will erase all thanks for the guest posts!
- Refreshing will erase all thanks for the Global Announcements, if the option ’Thanks in Global Announcements’ is OFF!
- Refreshing will erase all thanks for all posts except the first post in the topic, if the option ’Only for the first post in the topic’ is ON!
', 'THANKS_REFRESH_MSG' => 'This can take a few minutes to complete. All incorrect thanks entries will be deleted!
Action is not reversible!', 'THANKS_REFRESHED_MSG' => 'Counters updated', 'THANKS_REPUT_GRAPHIC' => 'Graphic display of the rating', @@ -131,4 +133,4 @@ 'TRUNCATE_NO_THANKS' => 'Operation canceled', 'ALLOW_THANKS_PM_ON' => 'Notify me PM if someone thanks my post', 'ALLOW_THANKS_EMAIL_ON' => 'Notify me e-mail if someone thanks my post', -)); +]); diff --git a/language/pt-br/permissions_thanks.php b/language/pt_br/permissions_thanks.php similarity index 72% rename from language/pt-br/permissions_thanks.php rename to language/pt_br/permissions_thanks.php index cbc35004..524995c8 100644 --- a/language/pt-br/permissions_thanks.php +++ b/language/pt_br/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Pode agradecer por posts', 'ACL_M_THANKS' => 'Pode limpar a lista de agradecimentos', 'ACL_U_VIEWTHANKS' => 'Pode ver a lista de agradecimentos', 'ACL_U_VIEWTOPLIST' => 'Pode ver a toplist de agradecimentos', -)); +]); diff --git a/language/pt-br/thanks_mod.php b/language/pt_br/thanks_mod.php similarity index 88% rename from language/pt-br/thanks_mod.php rename to language/pt_br/thanks_mod.php index 96c90f6d..ef41feec 100644 --- a/language/pt-br/thanks_mod.php +++ b/language/pt_br/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Limpar Lista de Agradecimento', 'CLEAR_LIST_THANKS_CONFIRM' => 'Quer realmente limpar esta lista?', 'CLEAR_LIST_THANKS_GIVE' => 'Lista de agradecimentos foi limpa.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Ir ao tópico', 'FOR_MESSAGE' => ' pelo post', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' e mais um usuário', 2 => ' e mais %d usuários', - ), + ], 'NO_VIEW_USERS_THANKS' => 'Você não tem autorização para ver a lista de agradecimentos.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Recebeu agradecimento de %1$s pelo post:', 2 => 'Recebeu agradecimentos de %1$s pelo post:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Removido agradecimento de %1$s pelo post:', 2 => 'Removidos agradecimentos de %1$s pelo post:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguém agradeceu seu post', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguém removeu o agradecimento pelo seu post', @@ -98,10 +100,10 @@ 'THANK_TEXT_2PL' => ' pelo post (total %d):', 'THANK_POST' => 'Agradeça ao autor pelo post: ', 'THANK_POST_SHORT' => 'Agradeça', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d vez', 2 => '%d vezes', - ), + ], 'THANKS_BACK' => 'Voltar', 'THANKS_INFO_GIVE' => 'Você agradeceu o post.', 'THANKS_INFO_REMOVE' => 'Você removeu seu agradecimento.', @@ -112,4 +114,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Removido agradecimento pelo post', 'THANKS_USER' => 'Lista de agradecimentos', 'TOPLIST' => 'Posts toplist', -)); +]); diff --git a/language/ru/info_acp_thanks.php b/language/ru/info_acp_thanks.php index 447424ba..2a3b808d 100644 --- a/language/ru/info_acp_thanks.php +++ b/language/ru/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Удалено учтённых благодарностей', 'ACP_POSTS' => 'Всего сообщений', 'ACP_POSTSEND' => 'Осталось сообщений с благодарностями', @@ -130,4 +132,4 @@ 'TRUNCATE_NO_THANKS' => 'Действие отменено', 'ALLOW_THANKS_PM_ON' => 'Получать уведомления о благодарностях в ЛС', 'ALLOW_THANKS_EMAIL_ON' => 'Получать уведомления о благодарностях по Email', -)); +]); diff --git a/language/ru/permissions_thanks.php b/language/ru/permissions_thanks.php index b616f0d7..f727e736 100644 --- a/language/ru/permissions_thanks.php +++ b/language/ru/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Может благодарить за сообщения', 'ACL_M_THANKS' => 'Может очищать список благодарностей', 'ACL_U_VIEWTHANKS' => 'Может просматривать лист всех благодарностей', 'ACL_U_VIEWTOPLIST' => 'Может просматривать топлист', -)); +]); diff --git a/language/ru/thanks_mod.php b/language/ru/thanks_mod.php index 395618be..4dd9ee1b 100644 --- a/language/ru/thanks_mod.php +++ b/language/ru/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Очистить список благодарностей', 'CLEAR_LIST_THANKS_CONFIRM' => 'Вы действительно хотите очистить список благодарностей пользователя?', 'CLEAR_LIST_THANKS_GIVE' => 'Cписок благодарностей, выданных пользователем, очищен.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Перейти в тему', 'FOR_MESSAGE' => ' за сообщение', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' и ещё один', 2 => ' и ещё %d', - ), + ], 'NO_VIEW_USERS_THANKS' => 'У вас нет доступа к просмотру списка благодарностей.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Получена благодарность от пользователя %1$s за сообщение:', 2 => 'Получены благодарности от пользователей %1$s за сообщение:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Удалена благодарность от пользователя %1$s за сообщение:', 2 => 'Удалены благодарности от пользователей %1$s за сообщение:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Вас поблагодарили за сообщение', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Удалена благодарность за ваше сообщение', @@ -97,11 +99,11 @@ 'THANK_TEXT_1' => 'За это сообщение автора ', 'THANK_TEXT_2' => ' поблагодарил:', 'THANK_TEXT_2PL' => ' поблагодарили (всего %d):', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d раз', 2 => '%d раза', 3 => '%d раз', - ), + ], 'THANKS_BACK' => 'Вернуться к листу благодарностей', 'THANKS_INFO_GIVE' => 'Вы поблагодарили автора сообщения', 'THANKS_INFO_REMOVE' => 'Вы отменили благодарность автору', @@ -112,4 +114,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Благодарность за сообщение отменена', 'THANKS_USER' => 'Лист благодарностей', 'TOPLIST' => 'Топлист сообщений', -)); +]); diff --git a/language/sk/email/user_thanks.txt b/language/sk/email/user_thanks.txt new file mode 100644 index 00000000..b85bb703 --- /dev/null +++ b/language/sk/email/user_thanks.txt @@ -0,0 +1,10 @@ +Subject: {THANKS_SUBG} — "{POST_SUBJECT}" + +Dobry den {POSTER_NAME}, + +Obdrzali ste toto upozornenie, pretoze {USERNAME} {POST_THANKS} "{POST_SUBJECT}" na stranke "{SITENAME}". + +Pokial chcete prispevok zobrazit, kliknite na nasledujuci odkaz : +{U_POST_THANKS} + +{EMAIL_SIG} diff --git a/language/sk/info_acp_thanks.php b/language/sk/info_acp_thanks.php new file mode 100644 index 00000000..7638981f --- /dev/null +++ b/language/sk/info_acp_thanks.php @@ -0,0 +1,136 @@ + 'Vymazané zaznamenané poďakovania', + 'ACP_POSTS' => 'Celkom príspevkov', + 'ACP_POSTSEND' => 'Zostávajúce príspevky s poďakovaním', + 'ACP_POSTSTHANKS' => 'Celkom príspevkov s poďakovaním', + 'ACP_THANKS' => 'Poďakovania za príspevky', + 'ACP_THANKS_MOD_VER' => 'Verzia rozšírenia', + 'ACP_THANKS_TRUNCATE' => 'Vymazať zoznam poďakovaní', + 'ACP_ALLTHANKS' => 'Poďakovania zobraté v úvahu', + 'ACP_THANKSEND' => 'Poďakovania, ktoré zostávajú zobrať v úvahu', + 'ACP_THANKS_REPUT' => 'Voľby hodnotenia', + 'ACP_THANKS_REPUT_SETTINGS' => 'Voľby hodnotenia', + 'ACP_THANKS_REPUT_SETTINGS_EXPLAIN' => 'Tu môžete nastaviť predvolené nastavenia pre hodnotenia príspevkov, tém a fór na základe systému poďakovania.
Predmet (príspevok, téma aleboo fórum) s najväčším celkovým počtom poďakovaní bude mať 100 % hodnotenie.', + 'ACP_THANKS_SETTINGS' => 'Nastavenie poďakovaní', + 'ACP_THANKS_SETTINGS_EXPLAIN' => 'Predvolené nastavenia poďakovaní za príspevky môžu byť zmenené tu.', + 'ACP_THANKS_REFRESH' => 'Aktualizovať počítadlá', + 'ACP_UPDATETHANKS' => 'Aktualizované zaznamenané poďakovania', + 'ACP_USERSEND' => 'Zostávajuci užívatelia, ktorí poďakovali', + 'ACP_USERSTHANKS' => 'Celkom užívateľov, ktoří poďakovali', + + 'GRAPHIC_BLOCK_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_block_back.gif', + 'GRAPHIC_BLOCK_RED' => 'ext/gfksx/thanksforposts/images/rating/reput_block_red.gif', + 'GRAPHIC_DEFAULT' => 'Obrázky', + 'GRAPHIC_OPTIONS' => 'Voľby grafiky', + 'GRAPHIC_STAR_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif', + 'GRAPHIC_STAR_BLUE' => 'ext/gfksx/thanksforposts/images/rating/reput_star_blue.gif', + 'GRAPHIC_STAR_GOLD' => 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif', + + 'IMG_THANKPOSTS' => 'Poďakovanie za príspevok', + 'IMG_REMOVETHANKS' => 'Zrušenie poďakovania', + + 'LOG_CONFIG_THANKS' => 'Aktualizovaná konfigurácia rozšírenia "Ďakujeme za príspevok"', + + 'REFRESH' => 'Obnoviť', + 'REMOVE_THANKS' => 'Odobrať poďakovanie', + 'REMOVE_THANKS_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, užívatelia môžu odobrať poďakovanie.', + + 'STEPR' => ' - spustené, krok %s', + + 'THANKS_COUNTERS_VIEW' => 'Počítadlá poďakovaní', + 'THANKS_COUNTERS_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, bude sa u autora zobrazovať blok informácií s vydanými a obdržanými poďakovaniami.', + 'THANKS_FORUM_REPUT_VIEW' => 'Zobraziť hodnotenia fór', + 'THANKS_GLOBAL_POST' => 'Poďakovania v globálnych oznámeniach', + 'THANKS_GLOBAL_POST_EXPLAIN' => 'Povolí poďakovania v globálnych oznámeniach', + 'THANKS_FORUM_REPUT_VIEW_EXPLAIN' => 'Pokiaľ je táto voľba povolená, v zozname fór se bude zobrazovať hodnotenie fór.', + 'THANKS_INFO_PAGE' => 'Informatívne správy', + 'THANKS_INFO_PAGE_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, po udelení /odobratí poďakovania sa zobrazí informatívna správa.', + 'THANKS_NOTICE_ON' => 'Upozornenia sú dostupné', + 'THANKS_NOTICE_ON_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, upozornenia sú dostupné a užívateľ ich môže konfigurovať cez svoj profil.', + 'THANKS_NUMBER' => 'Počet poďakovaní zo zoznamu zobrazených v profile', + 'THANKS_NUMBER_EXPLAIN' => 'Maximálny počet poďakovaní zobrazený pri prezeraní profilu.
Pamätajte, že nastavenie hodnoty nad 250 bude znamenať spomalenie. ', + 'THANKS_NUMBER_DIGITS' => 'Počet desatinných miest pre hodnotenia', + 'THANKS_NUMBER_DIGITS_EXPLAIN' => 'Uveďte počet desatinných miest pre hodnotu hodnotení.', + 'THANKS_NUMBER_ROW_REPUT' => 'Počet riadkov hodnotení v topliste', + 'THANKS_NUMBER_ROW_REPUT_EXPLAIN' => 'Uveďte počet riadkov v zobrazení v topliste príspevkov, tém a fór.', + 'THANKS_NUMBER_POST' => 'Počet poďakovaní zobrazený v príspevku', + 'THANKS_NUMBER_POST_EXPLAIN' => 'Maximálny počet poďakovaní zobrazených pri prezeraní príspevku.
Pamätajte, že nastavenie hodnoty nad 250 bude znamenať spomalenie. ', + 'THANKS_ONLY_FIRST_POST' => 'Poďakovať iba za prvný príspevok v téme', + 'THANKS_ONLY_FIRST_POST_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, užívatelia môžu poďakovať iba za prvý príspevok v téme.', + 'THANKS_POST_REPUT_VIEW' => 'Ukazovať hodnotenie príspevku', + 'THANKS_POST_REPUT_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, pri zobrazovaní témy bude zobrazené hodnotenie príspevku.', + 'THANKS_POSTLIST_VIEW' => 'Zobraziť poďakovania v príspevku', + 'THANKS_POSTLIST_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, bude zobrazený zoznam užívateľov, ktorí poďakovali autorovi za zobrazený príspevok.
Táto voľba bude mať vplyv iba keď administrátor povolil oprávnenia k udeleniu poďakovaní za príspevok v danom fóre.', + 'THANKS_PROFILELIST_VIEW' => 'Zobraziť poďakovania v profile', + 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, bude zobrazený úplný zoznam poďakovaní vrátane počtu poďakovaní a za ktoré prispevky bolo uživateľovi paďakované.', + 'THANKS_REFRESH' => 'Obnoviť počítadlá poďakovaní', + 'THANKS_REFRESH_EXPLAIN' => 'Tu môžete aktualizovať počítadlá poďakovaní po hromadnom odstránení príspevkov / tém / užívateľov, rozdelení / spojení tém, nastavení / odstránení globálneho oznámenia, povolenie / zakázanie voľby "Iba prvý príspevok v téme", zmene vlastníkov príspevku a podobne. Toto môže nejaký čas trvať.
Dôležité : Aby funkcia obnovenia počítadiel fungovala správne, je potrebné mať verziue MySQL 4.1 alebo vyššiu!
Upozornenie !
- Obnovenie vymaže všetky poďakovania príspevkov od hostí !
- Obnovenie vymaže všetky poďakovania v globálnych oznámeniach ak je voľba `Poďakovania v globálnych oznámeniach` vypnutá !
- Obnovenie odstráni všetky poďakovania s výnimkou poďakovania za prvý príspevok ak je zapnutá volba `Poďakovať iba za prvý príspevok v téme`!
', + 'THANKS_REFRESH_MSG' => 'Toto môže trvať niekoľko minút. Všetky nesprávne poďakovania budu vymazané
Akcie je nenávratné !', + 'THANKS_REFRESHED_MSG' => 'Počítadlá aktualizované', + 'THANKS_REPUT_GRAPHIC' => 'Grafické zobrazenie hodnotení', + 'THANKS_REPUT_GRAPHIC_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, hodnotenie bude zobrazené graficky s použitím obrázkov nižšie.', + 'THANKS_REPUT_HEIGHT' => 'Výška stupnice', + 'THANKS_REPUT_HEIGHT_EXPLAIN' => 'Uveďte výšku stupnice v pixeloch.
Pozor ! Aby sa stupnica v grafike zobrazovala správne, mali by ste uviesť uvést výšku zhodnú s výškou následujúceho obrázku ! ', + 'THANKS_REPUT_IMAGE' => 'Hlavný obrázok pre stupnicu', + 'THANKS_REPUT_IMAGE_DEFAULT' => 'Náhľad grafiky', + 'THANKS_REPUT_IMAGE_DEFAULT_EXPLAIN' => 'Tu môžete vidieť samostatný obrázok a cestu k obrázku. Jeho veľkosť je 15 x 15 pixelox.
Môžete si nakresliť vlastné obrázky pre popredia a pozadie. K tomu môžete využiť súbor "reput_star_.psd" v adresary "contrib". Výška a šírka obrázku by mala byť rovnaká pre zaistenie správnej konštrukcie stupnice v grafike.', + 'THANKS_REPUT_IMAGE_EXPLAIN' => 'Cesta (relatívna ku koreňovému adresářu phpBB) k obrázku na stupnici v grafike.', + 'THANKS_REPUT_IMAGE_NOEXIST' => 'Hlavný obrázok pre stupnicu nebol nájdený.', + 'THANKS_REPUT_IMAGE_BACK' => 'Obrázok na pozadie stupnice v grafike', + 'THANKS_REPUT_IMAGE_BACK_EXPLAIN' => 'Cesta (relatívna ku koreňovému adresářu phpBB) k obrázku na pozadie stupnice v grafike.', + 'THANKS_REPUT_IMAGE_BACK_NOEXIST' => 'Obrázok na pozadie stupnice nebol nájdený.', + 'THANKS_REPUT_LEVEL' => 'Počet obrázkov v stupnici', + 'THANKS_REPUT_LEVEL_EXPLAIN' => 'Maximálny počet obrázkov zodpovedajúci 100 % hodnoty hodnotiacej stupnice v grafike', + 'THANKS_TIME_VIEW' => 'Čas poďakovania', + 'THANKS_TIME_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, bude sa u poďakovania zobrazovať čas.', + 'THANKS_TOP_NUMBER' => 'Počet užívateľov v topliste', + 'THANKS_TOP_NUMBER_EXPLAIN' => 'Uveďte počet užívateľov, ktorí sa majú zobraziť v topliste. 0 - vypnúť zobrazenie topliste.', + 'THANKS_TOPIC_REPUT_VIEW' => 'Zobraziť hodnotenie tém', + 'THANKS_TOPIC_REPUT_VIEW_EXPLAIN' => 'Pokiaľ je táto možnosť povolená, bude sa pri zobrazení fóra zobrazovať hodnotenie tém.', + 'TRUNCATE' => 'Vymazať', + 'TRUNCATE_THANKS' => 'Vymazať zoznam poďakovaní', + 'TRUNCATE_THANKS_EXPLAIN' => 'Táto procedúra úplne vymaže všetky počítadlá poďakovaní (odstráni všetky udelené poďakovania).
Akcia je nenávratná !', + 'TRUNCATE_THANKS_MSG' => 'Počítadlá poďakovaní boli vymazané.', + 'REFRESH_THANKS_CONFIRM' => 'Naozaj chcete obnoviť počítadlá poďakovaní ?', + 'TRUNCATE_THANKS_CONFIRM' => 'Naozaj chcete vymazať počítadlá poďakovaní ?', + 'TRUNCATE_NO_THANKS' => 'Operácia bola zrušená', + 'ALLOW_THANKS_PM_ON' => 'Oznámiť mi súkromnou správou, pokiaľ niekto poďakuje za môj príspevok', + 'ALLOW_THANKS_EMAIL_ON' => 'Oznámiť mi e-mailom, pokiaľ niekto poďakuje za môj príspevok', +]); diff --git a/language/sk/permissions_thanks.php b/language/sk/permissions_thanks.php new file mode 100644 index 00000000..34f851e2 --- /dev/null +++ b/language/sk/permissions_thanks.php @@ -0,0 +1,43 @@ + 'Môže poďakovať za príspevky', + 'ACL_M_THANKS' => 'Môže vymazať zoznam poďakovaní', + 'ACL_U_VIEWTHANKS' => 'Môže zobraziť zoznam poďakovaní', + 'ACL_U_VIEWTOPLIST' => 'Môže zobraziť toplist', +]); diff --git a/language/sk/thanks_mod.php b/language/sk/thanks_mod.php new file mode 100644 index 00000000..12e71490 --- /dev/null +++ b/language/sk/thanks_mod.php @@ -0,0 +1,116 @@ + 'Vymazať zoznam poďakovaní', + 'CLEAR_LIST_THANKS_CONFIRM' => 'Naozaj chcete vymazať zoznam poďakovaní užívateľa ?', + 'CLEAR_LIST_THANKS_GIVE' => 'Zoznam poďakovaní udelený používateľom bol vymazaný.', + 'CLEAR_LIST_THANKS_POST' => 'Zoznam poďakovaní v správe bol vymazaný.', + 'CLEAR_LIST_THANKS_RECEIVE' => 'Zoznam poďakovaní získaný používateľom bol vymazaný..', + + 'DISABLE_REMOVE_THANKS' => 'Odstránenie poďakovania je zakázané správcom.', + + 'GIVEN' => 'Dal poďakovanie', + 'GLOBAL_INCORRECT_THANKS' => 'Nemôžete poďakovať za globálne oznámenie, ktoré sa netýka konkrétneho fóra.', + 'GRATITUDES' => 'Poďakovanie', + + 'INCORRECT_THANKS' => 'Neplatné poďakovanie', + + 'JUMP_TO_FORUM' => 'Prejsť na fórum', + 'JUMP_TO_TOPIC' => 'Prejsť na tému', + + 'FOR_MESSAGE' => ' za príspevok', + 'FURTHER_THANKS' => [ + 1 => ' a daľší užívateľ', + 2 => ' a %d daľších užívateľov', + ], + + 'NO_VIEW_USERS_THANKS' => 'Nemáte oprávnenie zobraziť zoznam poďakovaní.', + + 'NOTIFICATION_THANKS_GIVE' => [ + 1 => 'Obdržané poďakovanie od %1$s za príspevok :', + 2 => 'Obdržané poďakovania od %1$s za príspevok :', + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ + 1 => 'Odobrané poďakovanie od %1$s za príspevok :', + 2 => 'Odobráné poďakovania od %1$s za príspevok :', + ], + 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Niekto poďakoval za váš príspevok.', + 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Niekto odobral poďakovanie za váš príspevok.', + + 'RECEIVED' => 'Dostal poďakovanie', + 'REMOVE_THANKS' => 'Odobrať poďakovanie : ', + 'REMOVE_THANKS_CONFIRM' => 'Naozaj chcete odobrať poďakovanie ?', + 'REMOVE_THANKS_SHORT' => 'Odobrať poďakovanie', + 'REPUT' => 'Hodnotenie', + 'REPUT_TOPLIST' => 'Toplist — %d', + 'RATING_LOGIN_EXPLAIN' => 'Pre zobrazenie toplistu musíte byť prihlásený.', + 'RATING_NO_VIEW_TOPLIST' => 'Nemáte oprávnenie na zobrazenie toplistu.', + 'RATING_VIEW_TOPLIST_NO' => 'Toplist je prázdny alebo zakázaný administrátorom', + 'RATING_FORUM' => 'Fórum', + 'RATING_POST' => 'Príspevok', + 'RATING_TOP_FORUM' => 'Fóra s najviac poďakovaniami', + 'RATING_TOP_POST' => 'Príspevky s najviac poďakovaniami', + 'RATING_TOP_TOPIC' => 'Témy s najviac poďakovaniami', + 'RATING_TOPIC' => 'Téma', + + 'THANK' => 'krát', + 'THANK_FROM' => 'od', + 'THANK_TEXT_1' => 'Títo uživatelia poďakovali autorovi ', + 'THANK_TEXT_2' => ' za príspevok : ', + 'THANK_TEXT_2PL' => ' za príspevky (celkom %d):', + 'THANK_POST' => 'Poďakujte autorovi príspevku : ', + 'THANK_POST_SHORT' => 'Poďakujte', + 'THANKS' => [ + 1 => '%d krát', + 2 => '%d krát', + ], + 'THANKS_BACK' => 'Späť', + 'THANKS_INFO_GIVE' => 'Poďakoval ste za túto správu.', + 'THANKS_INFO_REMOVE' => 'Odobral ste poďakovanie.', + 'THANKS_LIST' => 'Zobraz / zavri prehľad', + 'THANKS_PM_MES_GIVE' => 'vám poďakoval za príspevok', + 'THANKS_PM_MES_REMOVE' => 'odobral poďakovanie za príspevok', + 'THANKS_PM_SUBJECT_GIVE' => 'Poďakovanie za príspevok', + 'THANKS_PM_SUBJECT_REMOVE' => 'Odobrané poďakovanie za príspevok', + 'THANKS_USER' => 'Zoznam poďakovaní', + 'TOPLIST' => 'Toplist', +]); diff --git a/language/tr/email/user_thanks.txt b/language/tr/email/user_thanks.txt new file mode 100644 index 00000000..89e4599c --- /dev/null +++ b/language/tr/email/user_thanks.txt @@ -0,0 +1,10 @@ +Konu: {THANKS_SUBG} — "{POST_SUBJECT}" + +Merhaba {POSTER_NAME}, + +BU mesajı alma nedeniniz "{SITENAME}" adresinde "{POST_SUBJECT}" mesajınıza {USERNAME} tarafından {POST_THANKS} aldınız. + +Teşekkür aldığınız mesajı görmek istiyorsanız, aşağıdaki bağlantıyı tıklayın.: +{U_POST_THANKS} + +{EMAIL_SIG} diff --git a/language/tr/info_acp_thanks.php b/language/tr/info_acp_thanks.php new file mode 100644 index 00000000..81c58044 --- /dev/null +++ b/language/tr/info_acp_thanks.php @@ -0,0 +1,136 @@ + 'Kayıtlı teşekkürler silindi', + 'ACP_POSTS' => 'Toplam mesaj', + 'ACP_POSTSEND' => 'Remaining posts with thanks', + 'ACP_POSTSTHANKS' => 'Teşekkür alan toplam mesajlar', + 'ACP_THANKS' => 'Mesajlar için teşekkür', + 'ACP_THANKS_MOD_VER' => 'Versiyon: ', + 'ACP_THANKS_TRUNCATE' => 'Teşekkür listesini temizle', + 'ACP_ALLTHANKS' => 'Teşekkürler dikkate alındı', + 'ACP_THANKSEND' => 'Dikkate almak için kalan teşekkürler', + 'ACP_THANKS_REPUT' => 'Değerlendirme Seçenekleri', + 'ACP_THANKS_REPUT_SETTINGS' => 'Değerlendirme Seçenekleri', + 'ACP_THANKS_REPUT_SETTINGS_EXPLAIN' => 'Buradaki teşekkür sistemine dayanarak gönderilerin, konuların ve forumların derecelendirmesine ilişkin varsayılan ayarları yapın.
Toplam teşekkür sayısına en çok sahip olan konu (gönderim, konu veya forum) %100 puan alır.', + 'ACP_THANKS_SETTINGS' => 'Teşekkür ayarları', + 'ACP_THANKS_SETTINGS_EXPLAIN' => 'Varsayılan Mesajlar için teşekkürler ayarları buradan değiştirebilirsiniz.', + 'ACP_THANKS_REFRESH' => 'Sayaçları güncelle', + 'ACP_UPDATETHANKS' => 'Kayıtlı teşekkürler güncellendi', + 'ACP_USERSEND' => 'Teşekkür eden diğer kullanıcılar', + 'ACP_USERSTHANKS' => 'Teşekkür edern toplam kullanıcılar', + + 'GRAPHIC_BLOCK_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_block_back.gif', + 'GRAPHIC_BLOCK_RED' => 'ext/gfksx/thanksforposts/images/rating/reput_block_red.gif', + 'GRAPHIC_DEFAULT' => 'Resimler', + 'GRAPHIC_OPTIONS' => 'Grafik Seçenekleri', + 'GRAPHIC_STAR_BACK' => 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif', + 'GRAPHIC_STAR_BLUE' => 'ext/gfksx/thanksforposts/images/rating/reput_star_blue.gif', + 'GRAPHIC_STAR_GOLD' => 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif', + + 'IMG_THANKPOSTS' => 'Mesaja teşekkür et', + 'IMG_REMOVETHANKS' => 'Teşekkürü iptal et', + + 'LOG_CONFIG_THANKS' => 'Eklenti sonrası için teşekkür yapılandırması güncellendi', + + 'REFRESH' => 'Yenile', + 'REMOVE_THANKS' => 'Teşekkürleri kaldır', + 'REMOVE_THANKS_EXPLAIN' => 'Bu seçenek etkinse, kullanıcılar teşekkürlerini kaldırabilir.', + + 'STEPR' => ' - düzenle, adım %s', + + 'THANKS_COUNTERS_VIEW' => 'Teşekkür sayacı', + 'THANKS_COUNTERS_VIEW_EXPLAIN' => 'Etkinleştirilirse, yazar hakkındaki blok bilgileri, verilen/ alınan teşekkür sayısını gösterir.', + 'THANKS_FORUM_REPUT_VIEW' => 'Forum derecelendirmesini göster', + 'THANKS_GLOBAL_POST' => 'Genel duyurulara teşekkürü aç', + 'THANKS_GLOBAL_POST_EXPLAIN' => 'Etkinleştirilirse, Ggenel duyurularda teşekkür verme etkin olur.', + 'THANKS_FORUM_REPUT_VIEW_EXPLAIN' => 'Etkinleştirilirse, forum listesinde forum derecelendirmeleri görüntülenir.', + 'THANKS_INFO_PAGE' => 'Bilgilendirici mesajlar', + 'THANKS_INFO_PAGE_EXPLAIN' => 'Etkinleştirilirse, mesaj için teşekkür ettikten/ çıkardıktan sonra bilgilendirici mesajlar görüntülenir.', + 'THANKS_NOTICE_ON' => 'Mevcut bildirimler', + 'THANKS_NOTICE_ON_EXPLAIN' => 'Etkinleştirilirse, bildirim kullanılabilir ve kullanıcı bildirimi profiliniz üzerinden yapılandırabilir.', + 'THANKS_NUMBER' => 'Profilde gösterilen teşekkürlerin sayısı', + 'THANKS_NUMBER_EXPLAIN' => 'Bir profili görüntülerken görüntülenen maksimum teşekkür sayısı.
Bu değer 250\'nin üzerine ayarlanırsa yavaşlama olabileceğini unutmayın.', + 'THANKS_NUMBER_DIGITS' => 'Derecelendirme için ondalık basamak sayısı', + 'THANKS_NUMBER_DIGITS_EXPLAIN' => 'Derecelendirme değeri için ondalık basamak sayısını belirtin.', + 'THANKS_NUMBER_ROW_REPUT' => 'Değerlendirme için üst listedeki satır sayısı', + 'THANKS_NUMBER_ROW_REPUT_EXPLAIN' => 'Mesajlarda, konularda ve forumlarda en çok oy alan forumlarda gösterilecek satır sayısını belirtin.', + 'THANKS_NUMBER_POST' => 'Bir mesajda listelenen teşekkürlerin sayısı', + 'THANKS_NUMBER_POST_EXPLAIN' => 'Bir mesajı görüntülerken görüntülenen maksimum teşekkür sayısı.
Bu değer 250\'nin üzerine ayarlanırsa yavaşlama olabileceğini unutmayın.', + 'THANKS_ONLY_FIRST_POST' => 'Sadece konudaki ilk gönderi için', + 'THANKS_ONLY_FIRST_POST_EXPLAIN' => 'Etkinleştirilirse, kullanıcılar yalnızca konudaki ilk gönderim için teşekkür edebilir.', + 'THANKS_POST_REPUT_VIEW' => 'Gönderiler için derecelendirmeyi göster', + 'THANKS_POST_REPUT_VIEW_EXPLAIN' => 'Etkinleştirilirse, bir konuyu görüntülerken gönderiler derecelendirme görüntülenir.', + 'THANKS_POSTLIST_VIEW' => 'Mesajlarda teşekkür listesi', + 'THANKS_POSTLIST_VIEW_EXPLAIN' => 'Etkinleştirildiğinde, gönderim için yazara teşekkür eden kullanıcıların listesi görüntülenir.
Bu seçeneğin yalnızca yönetici bu forumdaki yayın için teşekkür izni verme izni verdiğinde etkili olacağını unutmayın.', + 'THANKS_PROFILELIST_VIEW' => 'Profilde teşekkür listesi', + 'THANKS_PROFILELIST_VIEW_EXPLAIN' => 'Etkinleştirilirse, teşekkür sayısı ve bir kullanıcının teşekkür ettiği mesajları içeren eksiksiz bir teşekkür listesi görüntülenir.', + 'THANKS_REFRESH' => 'Teşekkür sayaçlarını güncelle', + 'THANKS_REFRESH_EXPLAIN' => 'Burada, gönderilerin/ konuların/ kullanıcıların toplu olarak kaldırılması, konuların bölünmesi/ birleştirilmesi, Global Duyurunun ayarlanması/ kaldırılması, "Yalnızca bu konudaki ilk yazı için" seçeneğinin etkinleştirilmesi/ devre dışı bırakılması, yayın sahiplerinin değiştirilmesi vb. işlemlerden sonra teşekkür sayaçlarını güncelleyebilirsiniz. Bu biraz zaman alabilir.
Önemli: Düzgün çalışabilmesi için sayaç yenileme işlevinin MySQL sürüm 4.1 veya daha yüksek sürümüne ihtiyacı var!
Dikkat!
- Yenileme, konuk gönderileriniz için tüm teşekkürleri silecek!
- Global Duyurularda Teşekkürler seçeneği KAPALI ise, yenileme Genel Duyurular için tüm teşekkürleri siler!
- Yalnızca konudaki ilk yazı için seçeneği AÇIK ise, yenileme, konudaki ilk hariç tüm konumlar için tüm teşekkürleri siler!
', + 'THANKS_REFRESH_MSG' => 'Bu işlemin tamamlanması birkaç dakika sürebilir. Tüm yanlış teşekkürler girişleri silinecek!
İşlem iptal edildi!', + 'THANKS_REFRESHED_MSG' => 'Sayaçlar güncellendi', + 'THANKS_REPUT_GRAPHIC' => 'Derecelendirmenin grafik görüntüsü', + 'THANKS_REPUT_GRAPHIC_EXPLAIN' => 'Etkinleştirilirse, derecelendirme değeri aşağıdaki resimler kullanılarak grafik olarak gösterilir.', + 'THANKS_REPUT_HEIGHT' => 'Grafik yüksekliği', + 'THANKS_REPUT_HEIGHT_EXPLAIN' => 'Sıralamanın kaydırıcısının yüksekliğini piksel cinsinden belirtin.
Dikkat! Doğru görüntülemek için, aşağıdaki görüntünün yüksekliğine eşit bir yükseklik belirtmelisiniz!', + 'THANKS_REPUT_IMAGE' => 'Kaydırıcının ana görüntüsü', + 'THANKS_REPUT_IMAGE_DEFAULT' => 'Grafik Önizlemesi', + 'THANKS_REPUT_IMAGE_DEFAULT_EXPLAIN' => 'Görüntünün kendisi ve görüntünün yolu burada görülebilir. Resim boyutu 15x15 pikseldir.
Ön ve arka plan için kendi resimlerinizi çizebilirsiniz.Görüntünün yüksekliği ve genişliği, grafiksel ölçeğin doğru bir şekilde oluşturulmasını sağlamak için aynı olmalıdır.', + 'THANKS_REPUT_IMAGE_EXPLAIN' => 'Yol - phpBB\'nin kök klasörüne göre - grafik ölçeği görüntüsüne.', + 'THANKS_REPUT_IMAGE_NOEXIST' => 'Grafik skalası için ana görüntü bulunamadı.', + 'THANKS_REPUT_IMAGE_BACK' => 'Kaydırıcının arka plan resmi', + 'THANKS_REPUT_IMAGE_BACK_EXPLAIN' => 'Kök phpBB kurulum klasörüne göre yol - grafik ölçeği arka plan görüntüsüne.', + 'THANKS_REPUT_IMAGE_BACK_NOEXIST' => 'Grafik ölçeğinin arka plan görüntüsü bulunamadı.', + 'THANKS_REPUT_LEVEL' => 'Grafik ölçeğinde görüntü sayısı', + 'THANKS_REPUT_LEVEL_EXPLAIN' => 'Grafikteki derecelendirme ölçeğinin değerinin% 100\'üne karşılık gelen maksimum görüntü sayısı.', + 'THANKS_TIME_VIEW' => 'Teşekkür zamanı', + 'THANKS_TIME_VIEW_EXPLAIN' => 'Etkinleştirildiğinde, mesajda teşekkür süresini gösterir.', + 'THANKS_TOP_NUMBER' => 'toplistteki kullanıcı sayısı', + 'THANKS_TOP_NUMBER_EXPLAIN' => 'Dizin listesindeki toplistte gösterilecek kullanıcı sayısını belirtin. 0 (sıfır) toplisti kapatır.', + 'THANKS_TOPIC_REPUT_VIEW' => 'Konu derecelendirmesini göster', + 'THANKS_TOPIC_REPUT_VIEW_EXPLAIN' => 'Etkinleştirilirse, bir forumu görüntülerken konu değerlendirmesi görüntülenecektir.', + 'TRUNCATE' => 'Temizle', + 'TRUNCATE_THANKS' => 'Teşekkür elistesini temizle', + 'TRUNCATE_THANKS_EXPLAIN' => 'Bu prosedür tüm teşekkür sayaçlarını tamamen siler (verilen tüm teşekkürleri siler).
Bu eylem geri alınamaz!', + 'TRUNCATE_THANKS_MSG' => 'Teşekkür sayaçları temizlendi.', + 'REFRESH_THANKS_CONFIRM' => 'Teşekkür sayaçlarını gerçekten yenilemek istiyor musunuz?', + 'TRUNCATE_THANKS_CONFIRM' => 'Teşekkür sayaçlarını gerçekten temizlemek istiyor musunuz?', + 'TRUNCATE_NO_THANKS' => 'İşlem iptal edildi', + 'ALLOW_THANKS_PM_ON' => 'Mesajıma teşekkür edilirse ÖM ile bildir', + 'ALLOW_THANKS_EMAIL_ON' => 'Mesajıma teşekkür edilirse email ile bildir', +]); diff --git a/language/tr/permissions_thanks.php b/language/tr/permissions_thanks.php new file mode 100644 index 00000000..ff8e340f --- /dev/null +++ b/language/tr/permissions_thanks.php @@ -0,0 +1,43 @@ + 'MEsajlara teşekkür edebilir', + 'ACL_M_THANKS' => 'Teşekkür listesini temizleyebilir', + 'ACL_U_VIEWTHANKS' => 'Teşekkür listesini görüntüleyebilir', + 'ACL_U_VIEWTOPLIST' => 'Toplisti görebilir', +]); diff --git a/language/tr/thanks_mod.php b/language/tr/thanks_mod.php new file mode 100644 index 00000000..4e49c10d --- /dev/null +++ b/language/tr/thanks_mod.php @@ -0,0 +1,116 @@ + 'Teşekkür Listesini Temizle', + 'CLEAR_LIST_THANKS_CONFIRM' => 'Kullanıcı Teşekkür Listesini gerçekten silmek istiyor musunuz?', + 'CLEAR_LIST_THANKS_GIVE' => 'Kullanıcı tarafından verilen teşekkürlerin listesi temizlendi.', + 'CLEAR_LIST_THANKS_POST' => 'Mesajdaki teşekkür listesi silindi.', + 'CLEAR_LIST_THANKS_RECEIVE' => 'Kullanıcı tarafından alınan teşekkürlerin listesi temizlendi.', + + 'DISABLE_REMOVE_THANKS' => 'Teşekkürleri silme yönetici tarafından devre dışı bırakıldı', + + 'GIVEN' => 'Edilen teşekkür ', + 'GLOBAL_INCORRECT_THANKS' => 'Belirli bir foruma referansı olmayan Genel Duyuru için teşekkür edemezsiniz.', + 'GRATITUDES' => 'Teşekkür Listesi', + + 'INCORRECT_THANKS' => 'Geçersiz teşekkür', + + 'JUMP_TO_FORUM' => 'Foruma git', + 'JUMP_TO_TOPIC' => 'Konuya git', + + 'FOR_MESSAGE' => ' mesaj için', + 'FURTHER_THANKS' => [ + 1 => ' ve bir kullanıcı için', + 2 => ' ve %d kullanıcı için', + ], + + 'NO_VIEW_USERS_THANKS' => 'Teşekkürler Listesini görüntüleme izniniz yok.', + + 'NOTIFICATION_THANKS_GIVE' => [ + 1 => 'Mesaj için %1$s kişisinden teşekkür aldı:', + 2 => 'Mesaj için %1$s kişilerden teşekkür aldı:', + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ + 1 => 'Mesajdan %1$s kişisinin teşekkürü kaldırıldı:', + 2 => 'Mesajdan %1$s kişisinin teşekkürü kaldırıldı:', + ], + 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Birisi mesajınız için teşekkür ediyor', + 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Birisi mesajınızdan için teşekkürü kaldırdı', + + 'RECEIVED' => 'Alınan teşekkür ', + 'REMOVE_THANKS' => 'Teşekkürleri kaldır: ', + 'REMOVE_THANKS_CONFIRM' => 'Teşekkürlerinizi kaldırmak istediğinizden emin misiniz?', + 'REMOVE_THANKS_SHORT' => 'Teşekkürleri kaldır', + 'REPUT' => 'Değerlendirme', + 'REPUT_TOPLIST' => 'Teşekkürler Toplisti — %d', + 'RATING_LOGIN_EXPLAIN' => 'Toplisti görüntüleme yetkiniz yok.', + 'RATING_NO_VIEW_TOPLIST' => 'Toplisti görüntüleme yetkiniz yok.', + 'RATING_VIEW_TOPLIST_NO' => 'Toplist yönetici tarafından boş veya devre dışı', + 'RATING_FORUM' => 'Forum', + 'RATING_POST' => 'Mesaj', + 'RATING_TOP_FORUM' => 'Forumların reytingleri', + 'RATING_TOP_POST' => 'Mesajların reytingleri', + 'RATING_TOP_TOPIC' => 'Konuların reytingleri', + 'RATING_TOPIC' => 'Konu', + + 'THANK' => 'time', + 'THANK_FROM' => 'from', + 'THANK_TEXT_1' => 'Bu kullanıcılar yazara teşekkür etti ', + 'THANK_TEXT_2' => ' mesaj için: ', + 'THANK_TEXT_2PL' => ' mesaj için (toplam %d):', + 'THANK_POST' => 'Mesaj yazarına teşekkür et: ', + 'THANK_POST_SHORT' => 'Teşekkür et', + 'THANKS' => [ + 1 => '%d', + 2 => '%d', + ], + 'THANKS_BACK' => 'Geri dön', + 'THANKS_INFO_GIVE' => 'Mesaja teşekkür ettin.', + 'THANKS_INFO_REMOVE' => 'Mesajdan teşekkürü kaldırdın.', + 'THANKS_LIST' => 'Listeyi Görüntüle/ Kapat', + 'THANKS_PM_MES_GIVE' => 'mesajınız için teşekkür etti', + 'THANKS_PM_MES_REMOVE' => 'mesajınızdan teşekkürü kaldırdı', + 'THANKS_PM_SUBJECT_GIVE' => 'Mesaj için teşekkür', + 'THANKS_PM_SUBJECT_REMOVE' => 'Mesajdan teşekkürü kaldır', + 'THANKS_USER' => 'Teşekkür listesi', + 'TOPLIST' => 'Mesaj toplisti', +]); diff --git a/language/uk/info_acp_thanks.php b/language/uk/info_acp_thanks.php index 469ff890..e014f62f 100644 --- a/language/uk/info_acp_thanks.php +++ b/language/uk/info_acp_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,7 +35,7 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_DELTHANKS' => 'Видалено врахованих подяк', 'ACP_POSTS' => 'Всього повідомлень', 'ACP_POSTSEND' => 'Залишилося повідомлень з подяками', @@ -130,4 +132,4 @@ 'TRUNCATE_NO_THANKS' => 'Дія скасована', 'ALLOW_THANKS_PM_ON' => 'Отримувати повідомлення про подяках в ПП', 'ALLOW_THANKS_EMAIL_ON' => 'Отримувати повідомлення про подяках на Email', -)); +]); diff --git a/language/uk/permissions_thanks.php b/language/uk/permissions_thanks.php index 89b66ac5..689b6d81 100644 --- a/language/uk/permissions_thanks.php +++ b/language/uk/permissions_thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -33,9 +35,9 @@ // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACL_F_THANKS' => 'Може дякувати за повідомлення', 'ACL_M_THANKS' => 'Може очищати список подяк', 'ACL_U_VIEWTHANKS' => 'Може переглядати лист всіх подяк', 'ACL_U_VIEWTOPLIST' => 'Може переглядати топ лист', -)); +]); diff --git a/language/uk/thanks_mod.php b/language/uk/thanks_mod.php index 14289f62..9b0958cc 100644 --- a/language/uk/thanks_mod.php +++ b/language/uk/thanks_mod.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ /** * DO NOT CHANGE @@ -18,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -37,7 +39,7 @@ // ’ » “ ” … // -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'CLEAR_LIST_THANKS' => 'Очистити список подяк', 'CLEAR_LIST_THANKS_CONFIRM' => 'Ви дійсно хочете очистити список подяк користувача?', 'CLEAR_LIST_THANKS_GIVE' => 'Cписок подяк, виданих користувачем, очищений.', @@ -56,21 +58,21 @@ 'JUMP_TO_TOPIC' => 'Перейти в тему', 'FOR_MESSAGE' => ' за повідомлення', - 'FURTHER_THANKS' => array( + 'FURTHER_THANKS' => [ 1 => ' і ще один', 2 => ' і ще %d', - ), + ], 'NO_VIEW_USERS_THANKS' => 'У вас немає доступу до перегляду списку подяк.', - 'NOTIFICATION_THANKS_GIVE' => array( + 'NOTIFICATION_THANKS_GIVE' => [ 1 => 'Отримана подяка від користувача %1$s за повідомлення:', 2 => 'Отримані подяки від користувачів %1$s за повідомлення:', - ), - 'NOTIFICATION_THANKS_REMOVE'=> array( + ], + 'NOTIFICATION_THANKS_REMOVE'=> [ 1 => 'Вилучена подяка від користувача %1$s за повідомлення:', 2 => 'Вилучені подяки від користувачів %1$s за повідомлення:', - ), + ], 'NOTIFICATION_TYPE_THANKS_GIVE' => 'Вам подякували за повідомлення', 'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Вилучено подяку за ваше повідомлення', @@ -97,11 +99,11 @@ 'THANK_TEXT_1' => 'За це повідомлення автора ', 'THANK_TEXT_2' => ' подякував:', 'THANK_TEXT_2PL' => ' подякували (всього %d):', - 'THANKS' => array( + 'THANKS' => [ 1 => '%d раз', 2 => '%d рази', 3 => '%d разів', - ), + ], 'THANKS_BACK' => 'Повернутися до листу подяк', 'THANKS_INFO_GIVE' => 'Ви подякували автора повідомлення', 'THANKS_INFO_REMOVE' => 'Ви скасували подяку автору', @@ -112,4 +114,4 @@ 'THANKS_PM_SUBJECT_REMOVE' => 'Подяка за повідомлення скасована', 'THANKS_USER' => 'Лист подяк', 'TOPLIST' => 'Топ лист повідомлень', -)); +]); diff --git a/migrations/v_0_4_0.php b/migrations/v_0_4_0.php index a5a0ec70..2dd6a498 100644 --- a/migrations/v_0_4_0.php +++ b/migrations/v_0_4_0.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,25 +21,25 @@ public function effectively_installed() static public function depends_on() { - return array('\phpbb\db\migration\data\v310\dev'); + return ['\phpbb\db\migration\data\v310\dev']; } public function update_schema() { if (!$this->db_tools->sql_table_exists($this->table_prefix . 'thanks')) { - return array( - 'add_tables' => array( - $this->table_prefix . 'thanks' => array( - 'COLUMNS' => array( - 'post_id' => array('UINT', 0), - 'poster_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - ), - 'PRIMARY_KEY' => array('post_id', 'user_id'), - ), - ), - ); + return [ + 'add_tables' => [ + $this->table_prefix . 'thanks' => [ + 'COLUMNS' => [ + 'post_id' => ['UINT', 0], + 'poster_id' => ['UINT', 0], + 'user_id' => ['UINT', 0], + ], + 'PRIMARY_KEY' => ['post_id', 'user_id'], + ], + ], + ]; } // If the thanks table exists but 'poster_id' column doesn't, most likely this is an upgrade // from the 3.0 'Thank Post Mod 0.4.0' https://www.phpbb.com/community/viewtopic.php?f=434&t=543797 @@ -45,35 +47,34 @@ public function update_schema() // which is the one 'Thanks for posts MOD' by Палыч was initially based on else if (!$this->db_tools->sql_column_exists($this->table_prefix . 'thanks', 'poster_id')) { - return array( - 'add_columns' => array( - $this->table_prefix . 'thanks' => array( - 'poster_id' => array('UINT', 0), - ), - ), - 'add_primary_keys' => array( - $this->table_prefix . 'thanks' => array('post_id, user_id'), - ), - ); + return [ + 'add_columns' => [ + $this->table_prefix . 'thanks' => [ + 'poster_id' => ['UINT', 0], + ], + ], + 'add_primary_keys' => [ + $this->table_prefix . 'thanks' =>['post_id, user_id'], + ], + ]; } - return array( - ); + return []; } public function revert_schema() { - return array( - 'drop_tables' => array($this->table_prefix . 'thanks'), - ); + return [ + 'drop_tables' => [$this->table_prefix . 'thanks'], + ]; } public function revert_data() { - return array( + return [ // Remove configs - array('config.remove', array('thanks_for_posts_version')), - array('config.remove', array('thanks_mod_version')), - ); + ['config.remove', ['thanks_for_posts_version']], + ['config.remove', ['thanks_mod_version']], + ]; } } diff --git a/migrations/v_1_2_5.php b/migrations/v_1_2_5.php index 4828e5a5..569dd7f2 100644 --- a/migrations/v_1_2_5.php +++ b/migrations/v_1_2_5.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -22,29 +24,29 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_0_4_0'); + return ['\gfksx\thanksforposts\migrations\v_0_4_0']; } public function update_data() { - return array( + return [ // Add configs - array('config.add', array('remove_thanks', 1)), - array('config.add', array('thanks_postlist_view', 1)), - array('config.add', array('thanks_profilelist_view', 1)), - array('config.add', array('thanks_counters_view', 1)), - array('config.add', array('thanks_number', 100)), - array('config.add', array('thanks_info_page', 1)), - array('config.add', array('thanks_only_first_post', 0)), + ['config.add', ['remove_thanks', 1]], + ['config.add', ['thanks_postlist_view', 1]], + ['config.add', ['thanks_profilelist_view', 1]], + ['config.add', ['thanks_counters_view', 1]], + ['config.add', ['thanks_number', 100]], + ['config.add', ['thanks_info_page', 1]], + ['config.add', ['thanks_only_first_post', 0]], // Add permissions - array('permission.add', array('f_thanks', false)), - array('permission.add', array('u_viewthanks', true)), + ['permission.add', ['f_thanks', false]], + ['permission.add', ['u_viewthanks', true]], // Add permissions sets - array('permission.permission_set', array('ROLE_USER_STANDARD', 'u_viewthanks', 'role', true)), - array('permission.permission_set', array('REGISTERED', 'u_viewthanks', 'group', true)), - array('permission.permission_set', array('ROLE_FORUM_STANDARD', 'f_thanks', 'role', true)), - ); + ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_viewthanks', 'role', true]], + ['permission.permission_set', ['REGISTERED', 'u_viewthanks', 'group', true]], + ['permission.permission_set', ['ROLE_FORUM_STANDARD', 'f_thanks', 'role', true]], + ]; } } diff --git a/migrations/v_1_2_6.php b/migrations/v_1_2_6.php index 22398442..72761e5c 100644 --- a/migrations/v_1_2_6.php +++ b/migrations/v_1_2_6.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,17 +21,17 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_2_5'); + return ['\gfksx\thanksforposts\migrations\v_1_2_5']; } public function update_data() { - return array( + return [ // Add configs - array('config.add', array('thanks_number_post', 10)), + ['config.add', ['thanks_number_post', 10]], // Remove ACP module - array('module.remove', array('acp', 'ACP_MESSAGES', 'ACP_THANKS')), - ); + ['module.remove', ['acp', 'ACP_MESSAGES', 'ACP_THANKS']], + ]; } } diff --git a/migrations/v_1_2_8.php b/migrations/v_1_2_8.php index 3a997eca..5424384c 100644 --- a/migrations/v_1_2_8.php +++ b/migrations/v_1_2_8.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,62 +21,62 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_2_6'); + return ['\gfksx\thanksforposts\migrations\v_1_2_6']; } public function update_schema() { - return array( - 'add_columns' => array( - $this->table_prefix . 'thanks' => array( - 'topic_id' => array('UINT', 0), - 'forum_id' => array('UINT', 0), - 'thanks_time' => array('UINT:11', 0), - ), - ), - ); + return [ + 'add_columns' => [ + $this->table_prefix . 'thanks' => [ + 'topic_id' => ['UINT', 0], + 'forum_id' => ['UINT', 0], + 'thanks_time' => ['UINT:11', 0], + ], + ], + ]; } public function revert_schema() { - return array( - 'drop_columns' => array( - $this->table_prefix . 'thanks' => array( + return [ + 'drop_columns' => [ + $this->table_prefix . 'thanks' => [ 'topic_id', 'forum_id', 'thanks_time', - ), - ), - ); + ], + ], + ]; } public function update_data() { - return array( + return [ // Add configs - array('config.add', array('thanks_post_reput_view', 1)), - array('config.add', array('thanks_topic_reput_view', 1)), - array('config.add', array('thanks_forum_reput_view', 0)), - array('config.add', array('thanks_reput_height', 15)), - array('config.add', array('thanks_reput_level', 10)), - array('config.add', array('thanks_number_digits', 2)), - array('config.add', array('thanks_number_row_reput', 5)), - array('config.add', array('thanks_reput_graphic', 1)), - array('config.add', array('thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif')), - array('config.add', array('thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif')), - array('config.add', array('thanks_time_view', 1)), - array('config.add', array('thanks_top_number', 0)), + ['config.add', ['thanks_post_reput_view', 1]], + ['config.add', ['thanks_topic_reput_view', 1]], + ['config.add', ['thanks_forum_reput_view', 0]], + ['config.add', ['thanks_reput_height', 15]], + ['config.add', ['thanks_reput_level', 10]], + ['config.add', ['thanks_number_digits', 2]], + ['config.add', ['thanks_number_row_reput', 5]], + ['config.add', ['thanks_reput_graphic', 1]], + ['config.add', ['thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif']], + ['config.add', ['thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif']], + ['config.add', ['thanks_time_view', 1]], + ['config.add', ['thanks_top_number', 0]], // Add permissions - array('permission.add', array('u_viewtoplist', true)), + ['permission.add', ['u_viewtoplist', true]], // Add permissions sets - array('permission.permission_set', array('REGISTERED', 'u_viewtoplist', 'group', true)), - array('permission.permission_set', array('ROLE_USER_STANDARD', 'u_viewtoplist', 'role', true)), + ['permission.permission_set', ['REGISTERED', 'u_viewtoplist', 'group', true]], + ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_viewtoplist', 'role', true]], // Update thanks for posts table - array('custom', array(array($this, 'update_thanks_table'))), - ); + ['custom', [[$this, 'update_thanks_table']]], + ]; } public function update_thanks_table() @@ -101,6 +103,13 @@ public function update_thanks_table() topic_id = (SELECT p.topic_id FROM ' . POSTS_TABLE . ' p, ' . $thanks_table . ' t WHERE t.post_id = p.post_id) WHERE EXISTS (SELECT p.* FROM ' . POSTS_TABLE . ' p, ' . $thanks_table . ' t WHERE t.post_id = p.post_id)'; } + else if ($this->db->get_sql_layer() == 'mssql' || $this->db->get_sql_layer() == 'mssqlnative') + { + $sql = 'UPDATE t + SET t.forum_id = p.forum_id, t.topic_id = p.topic_id + FROM ' . POSTS_TABLE . ' p, ' . $thanks_table . ' t + WHERE t.post_id = p.post_id'; + } $this->db->sql_query($sql); } diff --git a/migrations/v_1_3_1.php b/migrations/v_1_3_1.php index 548a0a94..8a1944a9 100644 --- a/migrations/v_1_3_1.php +++ b/migrations/v_1_3_1.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -14,18 +16,18 @@ class v_1_3_1 extends \phpbb\db\migration\migration { static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_2_8'); + return ['\gfksx\thanksforposts\migrations\v_1_2_8']; } public function update_data() { - return array( + return [ // Add permissions - array('permission.add', array('m_thanks', true)), + ['permission.add', ['m_thanks', true]], // Add permissions sets - array('permission.permission_set', array('ROLE_MOD_FULL', 'm_thanks', 'role', true)), - array('permission.permission_set', array('GLOBAL_MODERATORS', 'm_thanks', 'group', true)), - ); + ['permission.permission_set', ['ROLE_MOD_FULL', 'm_thanks', 'role', true]], + ['permission.permission_set', ['GLOBAL_MODERATORS', 'm_thanks', 'group', true]], + ]; } } diff --git a/migrations/v_1_3_2.php b/migrations/v_1_3_2.php index c9b09841..50ec4a28 100644 --- a/migrations/v_1_3_2.php +++ b/migrations/v_1_3_2.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,15 +21,15 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_3_1'); + return ['\gfksx\thanksforposts\migrations\v_1_3_1']; } public function update_data() { - return array( + return [ // Add configs - array('config.add', array('thanks_forum_reput_view_column', 0)), - array('config.add', array('thanks_topic_reput_view_column', 0)), - ); + ['config.add', ['thanks_forum_reput_view_column', 0]], + ['config.add', ['thanks_topic_reput_view_column', 0]], + ]; } } diff --git a/migrations/v_1_3_3.php b/migrations/v_1_3_3.php index d11da747..40d7804a 100644 --- a/migrations/v_1_3_3.php +++ b/migrations/v_1_3_3.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -14,14 +16,14 @@ class v_1_3_3 extends \phpbb\db\migration\migration { static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_3_2'); + return ['\gfksx\thanksforposts\migrations\v_1_3_2']; } public function update_data() { - return array( + return [ // Add permissions sets - array('permission.permission_set', array('ROLE_FORUM_FULL', 'f_thanks', 'role', true)), - ); + ['permission.permission_set', ['ROLE_FORUM_FULL', 'f_thanks', 'role', true]], + ]; } } diff --git a/migrations/v_1_3_4.php b/migrations/v_1_3_4.php index ef681c78..939b9511 100644 --- a/migrations/v_1_3_4.php +++ b/migrations/v_1_3_4.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,58 +21,58 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_3_3'); + return ['\gfksx\thanksforposts\migrations\v_1_3_3']; } public function update_schema() { - return array( - 'add_index' => array( - $this->table_prefix . 'thanks' => array( - 'post_id' => array('post_id'), - 'topic_id' => array('topic_id'), - 'forum_id' => array('forum_id'), - 'user_id' => array('user_id'), - 'poster_id' => array('poster_id'), - ), - ), - ); + return [ + 'add_index' => [ + $this->table_prefix . 'thanks' => [ + 'post_id' => ['post_id'], + 'topic_id' => ['topic_id'], + 'forum_id' => ['forum_id'], + 'user_id' => ['user_id'], + 'poster_id' => ['poster_id'], + ], + ], + ]; } public function revert_schema() { - return array( - 'drop_keys' => array( - $this->table_prefix . 'thanks' => array( + return [ + 'drop_keys' => [ + $this->table_prefix . 'thanks' => [ 'post_id', 'topic_id', 'forum_id', 'user_id', 'poster_id', - ), - ), - ); + ], + ], + ]; } public function update_data() { - return array( + return [ // Add configs - array('config.add', array('thanks_global_announce', 1)), + ['config.add', ['thanks_global_announce', 1]], // Add permissions sets - array('permission.permission_set', array('ROLE_FORUM_FULL', 'f_thanks', 'role', true)), - array('permission.permission_set', array('ROLE_FORUM_POLLS', 'f_thanks', 'role', true)), - array('permission.permission_set', array('ROLE_FORUM_LIMITED', 'f_thanks', 'role', true)), - array('permission.permission_set', array('ROLE_FORUM_LIMITED_POLLS', 'f_thanks', 'role', true)), - array('permission.permission_set', array('ROLE_USER_FULL', 'u_viewtoplist', 'role', true)), - array('permission.permission_set', array('ROLE_USER_LIMITED', 'u_viewtoplist', 'role', true)), - array('permission.permission_set', array('ROLE_USER_NOPM', 'u_viewtoplist', 'role', true)), - array('permission.permission_set', array('ROLE_USER_NOAVATAR', 'u_viewtoplist', 'role', true)), - array('permission.permission_set', array('ROLE_USER_FULL', 'u_viewthanks', 'role', true)), - array('permission.permission_set', array('ROLE_USER_LIMITED', 'u_viewthanks', 'role', true)), - array('permission.permission_set', array('ROLE_USER_NOPM', 'u_viewthanks', 'role', true)), - array('permission.permission_set', array('ROLE_USER_NOAVATAR', 'u_viewthanks', 'role', true)), - ); + ['permission.permission_set', ['ROLE_FORUM_FULL', 'f_thanks', 'role', true]], + ['permission.permission_set', ['ROLE_FORUM_POLLS', 'f_thanks', 'role', true]], + ['permission.permission_set', ['ROLE_FORUM_LIMITED', 'f_thanks', 'role', true]], + ['permission.permission_set', ['ROLE_FORUM_LIMITED_POLLS', 'f_thanks', 'role', true]], + ['permission.permission_set', ['ROLE_USER_FULL', 'u_viewtoplist', 'role', true]], + ['permission.permission_set', ['ROLE_USER_LIMITED', 'u_viewtoplist', 'role', true]], + ['permission.permission_set', ['ROLE_USER_NOPM', 'u_viewtoplist', 'role', true]], + ['permission.permission_set', ['ROLE_USER_NOAVATAR', 'u_viewtoplist', 'role', true]], + ['permission.permission_set', ['ROLE_USER_FULL', 'u_viewthanks', 'role', true]], + ['permission.permission_set', ['ROLE_USER_LIMITED', 'u_viewthanks', 'role', true]], + ['permission.permission_set', ['ROLE_USER_NOPM', 'u_viewthanks', 'role', true]], + ['permission.permission_set', ['ROLE_USER_NOAVATAR', 'u_viewthanks', 'role', true]], + ]; } } diff --git a/migrations/v_2_0_0.php b/migrations/v_2_0_0.php index fad8bfca..63b3690d 100644 --- a/migrations/v_2_0_0.php +++ b/migrations/v_2_0_0.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,87 +21,87 @@ public function effectively_installed() static public function depends_on() { - return array('\gfksx\thanksforposts\migrations\v_1_3_4'); + return ['\gfksx\thanksforposts\migrations\v_1_3_4']; } public function update_data() { // Remove phpBB 3.0 Thanks for posts ACP modules - $remove_modules = array( - array('module.remove', array('acp', 'ACP_THANKS', array( + $remove_modules = [ + ['module.remove', ['acp', 'ACP_THANKS', [ 'module_basename' => 'thanks', 'module_langname' => 'ACP_THANKS_SETTINGS', 'module_mode' => 'thanks', 'module_auth' => 'acl_a_board', - ))), - array('module.remove', array('acp', 'ACP_THANKS', array( + ]]], + ['module.remove', ['acp', 'ACP_THANKS', [ 'module_basename' => 'thanks_refresh', 'module_langname' => 'ACP_THANKS_REFRESH', 'module_mode' => 'thanks', 'module_auth' => 'acl_a_board', - ))), - array('module.remove', array('acp', 'ACP_THANKS', array( + ]]], + ['module.remove', ['acp', 'ACP_THANKS', [ 'module_basename' => 'thanks_truncate', 'module_langname' => 'ACP_THANKS_TRUNCATE', 'module_mode' => 'thanks', 'module_auth' => 'acl_a_board', - ))), - ); + ]]], + ]; if (isset($this->config['thanks_mod_version']) && version_compare($this->config['thanks_mod_version'], '1.2.8', '>=')) { $remove_modules = array_merge( $remove_modules, - array( - array('module.remove', array('acp', 'ACP_THANKS', array( + [ + ['module.remove', ['acp', 'ACP_THANKS', [ 'module_basename' => 'thanks_reput', 'module_langname' => 'ACP_THANKS_REPUT_SETTINGS', 'module_mode' => 'thanks', 'module_auth' => 'acl_a_board', - ))), - ) + ]]], + ] ); } $remove_modules = array_merge( $remove_modules, - array( - array('module.remove', array('acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS')), - ) + [ + ['module.remove', ['acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS']], + ] ); // Add ACP modules - $add_modules = array( - array('module.add', array('acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS')), - array('module.add', array('acp', 'ACP_THANKS', array( + $add_modules = [ + ['module.add', ['acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS']], + ['module.add', ['acp', 'ACP_THANKS', [ 'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_module', 'module_langname' => 'ACP_THANKS_SETTINGS', 'module_mode' => 'thanks', 'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board', - ))), - array('module.add', array('acp', 'ACP_THANKS', array( + ]]], + ['module.add', ['acp', 'ACP_THANKS', [ 'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_refresh_module', 'module_langname' => 'ACP_THANKS_REFRESH', 'module_mode' => 'thanks', 'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board', - ))), - array('module.add', array('acp', 'ACP_THANKS', array( + ]]], + ['module.add', ['acp', 'ACP_THANKS', [ 'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_truncate_module', 'module_langname' => 'ACP_THANKS_TRUNCATE', 'module_mode' => 'thanks', 'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board', - ))), - array('module.add', array('acp', 'ACP_THANKS', array( + ]]], + ['module.add', ['acp', 'ACP_THANKS', [ 'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_reput_module', 'module_langname' => 'ACP_THANKS_REPUT_SETTINGS', 'module_mode' => 'thanks', 'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board', - ))), - ); + ]]], + ]; // Update config values - $update_config = array( + $update_config = [ // Remove phpBB 3.0 Thanks for posts MOD config entry - array('config.remove', array('thanks_mod_version')), - ); + ['config.remove', ['thanks_mod_version']], + ]; return (isset($this->config['thanks_mod_version']) && version_compare($this->config['thanks_mod_version'], '1.2.7', '>=')) ? array_merge($remove_modules, $add_modules, $update_config) : array_merge($add_modules, $update_config); diff --git a/migrations/v_2_0_1.php b/migrations/v_2_0_1.php index dc7aa333..1ae3fd2b 100644 --- a/migrations/v_2_0_1.php +++ b/migrations/v_2_0_1.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -20,55 +22,55 @@ public function effectively_installed() static public function depends_on() { - return array( + return [ '\gfksx\thanksforposts\migrations\v_2_0_0', '\phpbb\db\migration\data\v310\notifications_use_full_name', - ); + ]; } public function update_schema() { - return array( - 'drop_columns' => array( - $this->table_prefix . 'users' => array( + return [ + 'drop_columns' => [ + $this->table_prefix . 'users' => [ 'user_allow_thanks_email', 'user_allow_thanks_pm', - ), - ), - ); + ], + ], + ]; } public function revert_schema() { - return array( - 'add_columns' => array( - $this->table_prefix . 'users' => array( - 'user_allow_thanks_email' => array('BOOL', 0), - 'user_allow_thanks_pm' => array('BOOL', 0), - ), - ), - ); + return [ + 'add_columns' => [ + $this->table_prefix . 'users' => [ + 'user_allow_thanks_email' => ['BOOL', 0], + 'user_allow_thanks_pm' => ['BOOL', 0], + ], + ], + ]; } public function update_data() { - return array( + return [ // Update notification names - array('custom', array(array($this, 'update_notifications_name'))), - ); + ['custom', [[$this, 'update_notifications_name']]], + ]; } public function update_notifications_name() { // New notification_type_name and re-enable - $sql_ary[] = array( + $sql_ary[] = [ 'notification_type_name' => 'gfksx.thanksforposts.notification.type.thanks', 'notification_type_enabled' => 1, - ); - $sql_ary[] = array( + ]; + $sql_ary[] = [ 'notification_type_name' => 'gfksx.thanksforposts.notification.type.thanks_remove', 'notification_type_enabled' => 1, - ); + ]; foreach ($sql_ary as $sql) { @@ -76,12 +78,12 @@ public function update_notifications_name() $sql_update = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql) . " - WHERE notification_type_name = '" . $notification_type_name[1] . "'"; + WHERE notification_type_name = '" . $this->db->sql_escape($notification_type_name[1]) . "'"; $this->db->sql_query($sql_update); $sql_update = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " SET item_type = '" . $this->db->sql_escape($sql['notification_type_name']) . "' - WHERE item_type = '" . $notification_type_name[1] . "'"; + WHERE item_type = '" . $this->db->sql_escape($notification_type_name[1]) . "'"; $this->db->sql_query($sql_update); } } diff --git a/migrations/v_2_0_2.php b/migrations/v_2_0_2.php index b1dbbf1d..edc26fb3 100644 --- a/migrations/v_2_0_2.php +++ b/migrations/v_2_0_2.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -19,17 +21,15 @@ public function effectively_installed() static public function depends_on() { - return array( - '\gfksx\thanksforposts\migrations\v_2_0_1', - ); + return ['\gfksx\thanksforposts\migrations\v_2_0_1']; } public function update_data() { - return array( + return [ // This config value was missing from the original MOD ver. 1.3.4 // installation script, so fix and add that - array('config.add', array('thanks_global_post', 0)), - ); + ['config.add', ['thanks_global_post', 0]], + ]; } } diff --git a/migrations/v_2_0_3.php b/migrations/v_2_0_3.php index 64c3c559..e857ec8b 100644 --- a/migrations/v_2_0_3.php +++ b/migrations/v_2_0_3.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -20,16 +22,14 @@ public function effectively_installed() static public function depends_on() { - return array( - '\gfksx\thanksforposts\migrations\v_2_0_2', - ); + return ['\gfksx\thanksforposts\migrations\v_2_0_2']; } public function update_data() { - return array( - array('config.remove', array('thanks_topic_reput_view_column')), - array('config.remove', array('thanks_forum_reput_view_column')), - ); + return [ + ['config.remove', ['thanks_topic_reput_view_column']], + ['config.remove', ['thanks_forum_reput_view_column']], + ]; } } diff --git a/migrations/v_2_0_6.php b/migrations/v_2_0_6.php index d72a28b0..d66c51a8 100644 --- a/migrations/v_2_0_6.php +++ b/migrations/v_2_0_6.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\migrations; @@ -20,19 +22,17 @@ public function effectively_installed() static public function depends_on() { - return array( - '\gfksx\thanksforposts\migrations\v_2_0_3', - ); + return ['\gfksx\thanksforposts\migrations\v_2_0_3']; } public function update_data() { - return array( + return [ // Remove stale configs - array('config.remove', array('thanks_for_posts_version')), - array('config.remove', array('thanks_mod_version')), - array('config.update', array('thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif')), - array('config.update', array('thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif')), - ); + ['config.remove', ['thanks_for_posts_version']], + ['config.remove', ['thanks_mod_version']], + ['config.update', ['thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif']], + ['config.update', ['thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif']], + ]; } } diff --git a/migrations/v_2_0_8.php b/migrations/v_2_0_8.php new file mode 100644 index 00000000..e745e7b2 --- /dev/null +++ b/migrations/v_2_0_8.php @@ -0,0 +1,53 @@ + [ + $this->table_prefix . 'thanks' => ['poster_id'], + $this->table_prefix . 'thanks' => ['user_id'], + ], + 'add_index' => [ + $this->table_prefix . 'thanks' => [ + 'poster_id' => ['poster_id', 'forum_id'], + 'user_id' => ['user_id', 'forum_id'], + ], + ], + ]; + } + + public function revert_schema() + { + return [ + 'drop_keys' => [ + $this->table_prefix . 'thanks' => ['poster_id'], + $this->table_prefix . 'thanks' => ['user_id'], + ], + 'add_index' => [ + $this->table_prefix . 'thanks' => [ + 'poster_id' => ['poster_id'], + 'user_id' => ['poster_id'], + ], + ], + ]; + } +} diff --git a/notification/thanks.php b/notification/thanks.php index 2009d0ad..8bda2623 100644 --- a/notification/thanks.php +++ b/notification/thanks.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\notification; @@ -40,10 +42,10 @@ public function get_type() * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + public static $notification_option = [ 'lang' => 'NOTIFICATION_TYPE_THANKS_GIVE', 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', - ); + ]; /** @var string */ protected $notifications_table; @@ -97,14 +99,14 @@ public static function get_item_parent_id($thanks_data) * * @return array */ - public function find_users_for_notification($thanks_data, $options = array()) + public function find_users_for_notification($thanks_data, $options = []) { - $options = array_merge(array( - 'ignore_users' => array(), - ), $options); + $options = array_merge([ + 'ignore_users' => [], + ], $options); - $users = array((int) $thanks_data['poster_id']); - return $this->check_user_notification_options($users, $options); + $users = [(int) $thanks_data['poster_id']]; + return $this->get_authorised_recipients($users, $thanks_data['forum_id'], $options, true); } /** @@ -113,7 +115,7 @@ public function find_users_for_notification($thanks_data, $options = array()) public function get_avatar() { $thankers = $this->get_data('thankers'); - return (sizeof($thankers) == 1) ? $this->user_loader->get_avatar($thankers[0]['user_id']) : ''; + return (count($thankers) == 1) ? $this->user_loader->get_avatar($thankers[0]['user_id']) : ''; } /** @@ -124,16 +126,16 @@ public function get_avatar() public function get_title() { $thankers = $this->get_data('thankers'); - $usernames = array(); + $usernames = []; if (!is_array($thankers)) { - $thankers = array(); + $thankers = []; } - $thankers_cnt = sizeof($thankers); + $thankers_cnt = count($thankers); $thankers = $this->trim_user_ary($thankers); - $trimmed_thankers_cnt = $thankers_cnt - sizeof($thankers); + $trimmed_thankers_cnt = $thankers_cnt - count($thankers); foreach ($thankers as $thanker) { @@ -164,9 +166,9 @@ public function get_title() public function users_to_query() { $thankers = $this->get_data('thankers'); - $users = array( + $users = [ $this->get_data('user_id'), - ); + ]; if (is_array($thankers)) { @@ -229,7 +231,7 @@ public function get_reference() */ public function trim_user_ary($users) { - if (sizeof($users) > 4) + if (count($users) > 4) { array_splice($users, 3); } @@ -245,14 +247,14 @@ public function get_email_template_variables() { $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); - return array( - 'THANKS_SUBG' => htmlspecialchars_decode($this->language->lang('THANKS_PM_SUBJECT_'. $this->get_data('lang_act'))), + return [ + 'THANKS_SUBG' => htmlspecialchars_decode($this->language->lang('THANKS_PM_SUBJECT_' . $this->get_data('lang_act'))), 'USERNAME' => htmlspecialchars_decode($this->user->data['username']), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))), - 'POST_THANKS' => htmlspecialchars_decode($this->language->lang('THANKS_PM_MES_'. $this->get_data('lang_act'))), + 'POST_THANKS' => htmlspecialchars_decode($this->language->lang('THANKS_PM_MES_' . $this->get_data('lang_act'))), 'POSTER_NAME' => htmlspecialchars_decode($username), 'U_POST_THANKS' => generate_board_url() . '/viewtopic.' . $this->php_ext . "?p={$this->item_id}#p{$this->item_id}", - ); + ]; } /** @@ -264,11 +266,11 @@ public function get_email_template_variables() * * @return array Array of data ready to be inserted into the database */ - public function create_insert_array($thanks_data, $pre_create_data = array()) + public function create_insert_array($thanks_data, $pre_create_data = []) { - $thankers = (isset($thanks_data['thankers'])) ? $thanks_data['thankers'] : array(); + $thankers = (isset($thanks_data['thankers'])) ? $thanks_data['thankers'] : []; $thankers = array_merge( - array(array('user_id' => $thanks_data['user_id'])), + [['user_id' => $thanks_data['user_id']]], $thankers ); $this->set_data('thankers', $thankers); @@ -298,7 +300,7 @@ public function create_update_array($thanks_data) if ($row = $this->db->sql_fetchrow($result)) { $data = unserialize($row['notification_data']); - $thanks_data['thankers'] = (!empty($data['thankers'])) ? $data['thankers'] : array(); + $thanks_data['thankers'] = (!empty($data['thankers'])) ? $data['thankers'] : []; } $this->create_insert_array($thanks_data); diff --git a/notification/thanks_remove.php b/notification/thanks_remove.php index 1d7ad252..3b138e47 100644 --- a/notification/thanks_remove.php +++ b/notification/thanks_remove.php @@ -1,12 +1,14 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -*/ + * + * Thanks For Posts. + * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks. + * An extension for the phpBB Forum Software package. + * + * @copyright (c) 2020, rxu, https://www.phpbbguru.net + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ namespace gfksx\thanksforposts\notification; @@ -40,10 +42,10 @@ public function get_type() * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + public static $notification_option = [ 'lang' => 'NOTIFICATION_TYPE_THANKS_REMOVE', 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', - ); + ]; /** * Get the id of the parent diff --git a/styles/bb3-mobi/template/event/index_body_stat_blocks_after.html b/styles/bb3-mobi/template/event/index_body_stat_blocks_after.html index a17f8c49..ef687236 100644 --- a/styles/bb3-mobi/template/event/index_body_stat_blocks_after.html +++ b/styles/bb3-mobi/template/event/index_body_stat_blocks_after.html @@ -1,5 +1,12 @@ {% if S_THANKS_LIST %}
{{ lang('TOP_THANKS_LIST') }} -
{{ THANKS_LIST }}
+
+ {% set thankslist = [] %} + {% for user in toplist %} + {% set thankslist = thankslist|merge([user.USERNAME ~ ' (' ~ user.THANKS_COUNT ~ ')']) %} + {% endfor %} + + {{ thankslist|join(', ') }} +
{% endif %} diff --git a/styles/bb3-mobi/template/event/overall_header_head_append.html b/styles/bb3-mobi/template/event/overall_header_head_append.html deleted file mode 100644 index 2dbfbfc6..00000000 --- a/styles/bb3-mobi/template/event/overall_header_head_append.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/styles/bb3-mobi/template/event/viewtopic_body_postrow_post_notices_before.html b/styles/bb3-mobi/template/event/viewtopic_body_postrow_post_notices_before.html index 35f2a078..e2b89163 100644 --- a/styles/bb3-mobi/template/event/viewtopic_body_postrow_post_notices_before.html +++ b/styles/bb3-mobi/template/event/viewtopic_body_postrow_post_notices_before.html @@ -2,7 +2,9 @@
{{ lang('REPUT') }}{{ lang('COLON') }} {{ postrow.POST_REPUT }}
{% if postrow.S_THANKS_REPUT_GRAPHIC %} -
  +
+
+
  {% endif %}
{% endif %} diff --git a/styles/prosilver/template/event/index_body_stat_blocks_after.html b/styles/prosilver/template/event/index_body_stat_blocks_after.html index 3ab876f4..e238fdbd 100644 --- a/styles/prosilver/template/event/index_body_stat_blocks_after.html +++ b/styles/prosilver/template/event/index_body_stat_blocks_after.html @@ -1,6 +1,13 @@ {% if S_THANKS_LIST %}

{{ lang('TOP_THANKS_LIST') }}

-

{{ THANKS_LIST }}

+

+ {% set thankslist = [] %} + {% for user in toplist %} + {% set thankslist = thankslist|merge([user.USERNAME ~ ' (' ~ user.THANKS_COUNT ~ ')']) %} + {% endfor %} + + {{ thankslist|join(', ') }} +

{% endif %} diff --git a/styles/prosilver/template/event/overall_header_head_append.html b/styles/prosilver/template/event/overall_header_head_append.html deleted file mode 100644 index 68d22a8a..00000000 --- a/styles/prosilver/template/event/overall_header_head_append.html +++ /dev/null @@ -1 +0,0 @@ -{% INCLUDECSS '@gfksx_thanksforposts/thanks.css' %} diff --git a/styles/prosilver/template/event/viewtopic_body_post_buttons_after.html b/styles/prosilver/template/event/viewtopic_body_post_buttons_after.html index e295cde6..0e971f8f 100644 --- a/styles/prosilver/template/event/viewtopic_body_post_buttons_after.html +++ b/styles/prosilver/template/event/viewtopic_body_post_buttons_after.html @@ -2,7 +2,7 @@ {% if not postrow.S_GLOBAL_POST_THANKS and not postrow.S_POST_ANONYMOUS and S_FORUM_THANKS and S_USER_LOGGED_IN and not postrow.S_IS_OWN_POST and (not postrow.S_ALREADY_THANKED or postrow.S_REMOVE_THANKS) %}
  • - {{ postrow.THANK_ALT_SHORT }} + {{ postrow.THANK_ALT_SHORT }}
  • {% endif %} diff --git a/styles/prosilver/template/event/viewtopic_body_postrow_post_notices_after.html b/styles/prosilver/template/event/viewtopic_body_postrow_post_notices_after.html index 41ca34d2..893dcdf1 100644 --- a/styles/prosilver/template/event/viewtopic_body_postrow_post_notices_after.html +++ b/styles/prosilver/template/event/viewtopic_body_postrow_post_notices_after.html @@ -25,7 +25,9 @@
    {{ lang('REPUT') }}{{ lang('COLON') }} {{ postrow.POST_REPUT }}
    {% if postrow.S_THANKS_REPUT_GRAPHIC %} -
      + + +   {% endif %}
    diff --git a/styles/prosilver/template/memberlist_view_thanks.html b/styles/prosilver/template/memberlist_view_thanks.html index 89dea0d8..b081dfb6 100644 --- a/styles/prosilver/template/memberlist_view_thanks.html +++ b/styles/prosilver/template/memberlist_view_thanks.html @@ -23,7 +23,7 @@

    {{ lang('GRATITUDES') }}

      •  {{ thanks_row.USERNAME_FULL }} → {{ lang('FOR_MESSAGE') }}
    {% if thanks_row.S_SWITCH_COLUMN and not thanks_row.S_LAST_ROW %} {% endif %} {% endfor %} - {% if FURTHER_THANKS_TEXT %} {{ FURTHER_THANKS_TEXT }}{% endif %} + {% if FURTHER_THANKS_TEXT_GIVEN %} {{ FURTHER_THANKS_TEXT_GIVEN }}{% endif %} @@ -50,7 +50,7 @@

    {{ lang('GRATITUDES') }}

      •  {{ thanked_row.USERNAME_FULL }} → {{ lang('FOR_MESSAGE') }}
    {% if thanked_row.S_SWITCH_COLUMN and not thanked_row.S_LAST_ROW %} {% endif %} {% endfor %} - {% if FURTHER_THANKS_TEXT %} {{ FURTHER_THANKS_TEXT }}{% endif %} + {% if FURTHER_THANKS_TEXT_RECEIVED %} {{ FURTHER_THANKS_TEXT_RECEIVED }}{% endif %} diff --git a/styles/prosilver/template/topicrow_rating_body.html b/styles/prosilver/template/topicrow_rating_body.html index f21a5b2a..497eb89f 100644 --- a/styles/prosilver/template/topicrow_rating_body.html +++ b/styles/prosilver/template/topicrow_rating_body.html @@ -1,5 +1,5 @@ {% if rating.S_THANKS_TOPIC_REPUT_VIEW and rating.TOPIC_REPUT and not S_IS_BOT %} -
    +
    {% if rating.S_THANKS_REPUT_GRAPHIC %}   {% endif %} diff --git a/styles/prosilver/template/toplist_body.html b/styles/prosilver/template/toplist_body.html index 3a696334..1151fc93 100644 --- a/styles/prosilver/template/toplist_body.html +++ b/styles/prosilver/template/toplist_body.html @@ -32,10 +32,9 @@

    {{ lang('RATIN
    - {% if toppostrow.MINI_POST_IMG %}{{ toppostrow.MINI_POST_IMG }}{{ toppostrow.POST_DATE }} {{ toppostrow.POST_SUBJECT }}
    {{ toppostrow.MESSAGE }}{% else %} {{ toppostrow.POST_DATE }} {{ toppostrow.POST_SUBJECT }} - {{ toppostrow.POST_DATE }} {{ toppostrow.POST_SUBJECT }}
    {{ toppostrow.MESSAGE }}{% endif %} + {{ toppostrow.POST_DATE }} {{ toppostrow.POST_SUBJECT }}
    {{ toppostrow.MESSAGE }}