From 325c234442c39179945faf4a1fcec4e4dd5ab576 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Mon, 4 Apr 2022 17:26:26 +0800 Subject: [PATCH] add back to top --- app/Console/Commands/BackupCronjob.php | 10 +- app/Console/Commands/ExamUpdateProgress.php | 22 +- app/Console/Commands/Test.php | 25 +- app/Console/Kernel.php | 1 + app/Models/Attendance.php | 2 + app/Models/BonusLogs.php | 11 +- app/Models/Setting.php | 39 +- app/Repositories/AttendanceRepository.php | 27 +- app/Repositories/BonusRepository.php | 18 + app/Repositories/ExamRepository.php | 8 +- app/Repositories/SearchRepository.php | 10 +- app/Repositories/ToolRepository.php | 52 +- composer.json | 2 +- composer.lock | 665 ++++++++---------- ...02_163930_create_attendance_logs_table.php | 3 +- include/cleanup.php | 15 +- include/functions.php | 42 +- include/globalfunctions.php | 35 +- lang/chs/lang_attendance.php | 2 +- lang/chs/lang_mybonus.php | 3 + lang/chs/lang_settings.php | 4 +- lang/chs/lang_staffpanel.php | 2 + lang/cht/lang_attendance.php | 5 +- lang/cht/lang_mybonus.php | 3 + lang/cht/lang_settings.php | 4 +- lang/cht/lang_staffpanel.php | 2 + lang/en/lang_attendance.php | 5 +- lang/en/lang_mybonus.php | 3 + lang/en/lang_settings.php | 6 +- nexus/Install/Update.php | 22 + nexus/Install/settings.default.php | 1 + public/amountattendancecard.php | 51 +- public/attendance.php | 12 +- public/getextinfoajax.php | 10 +- public/mybonus.php | 20 + public/settings.php | 31 +- .../jquery-goup-1.1.3/jquery.goup.min.js | 10 + resources/lang/zh_CN/bonus.php | 1 + 38 files changed, 686 insertions(+), 498 deletions(-) create mode 100644 public/vendor/jquery-goup-1.1.3/jquery.goup.min.js diff --git a/app/Console/Commands/BackupCronjob.php b/app/Console/Commands/BackupCronjob.php index 09871d4e..de6d0e82 100644 --- a/app/Console/Commands/BackupCronjob.php +++ b/app/Console/Commands/BackupCronjob.php @@ -12,14 +12,14 @@ class BackupCronjob extends Command * * @var string */ - protected $signature = 'backup:cronjob'; + protected $signature = 'backup:cronjob {--force=}'; /** * The console command description. * * @var string */ - protected $description = 'Backup all data cronjob, and upload to Google drive.'; + protected $description = 'Backup all data cronjob, and upload to Google drive. options: --force'; /** * Create a new command instance. @@ -38,11 +38,13 @@ class BackupCronjob extends Command */ public function handle(): int { + $force = $this->option('force'); + $this->info("force: $force"); $rep = new ToolRepository(); - $result = $rep->cronjobBackup(); + $result = $rep->cronjobBackup($force); $log = sprintf( '[%s], %s, result: %s', - nexus()->getRequestId(), __METHOD__, var_export($result, true) + nexus()->getRequestId(), __METHOD__, var_export($result, true) ); $this->info($log); do_log($log); diff --git a/app/Console/Commands/ExamUpdateProgress.php b/app/Console/Commands/ExamUpdateProgress.php index a24f341b..7ce9b05f 100644 --- a/app/Console/Commands/ExamUpdateProgress.php +++ b/app/Console/Commands/ExamUpdateProgress.php @@ -13,14 +13,14 @@ class ExamUpdateProgress extends Command * * @var string */ - protected $signature = 'exam:update_progress {uid}'; + protected $signature = 'exam:update_progress {--uid} {--bulk}'; /** * The console command description. * * @var string */ - protected $description = 'Update exam progress.'; + protected $description = 'Update exam progress. options: --uid, --bulk'; /** * Create a new command instance. @@ -39,10 +39,22 @@ class ExamUpdateProgress extends Command */ public function handle() { - $uid = $this->argument('uid'); + $uid = $this->option('uid'); + $bulk = $this->option('bulk'); $examRep = new ExamRepository(); - $result = $examRep->updateProgress($uid); - $this->info(nexus()->getRequestId() . ", result: " . var_export($result, true)); + $log = "uid: $uid, bulk: $bulk"; + $this->info($log); + if (is_numeric($uid) && $uid) { + $log .= ", do updateProgress"; + $result = $examRep->updateProgress($uid); + } elseif ($bulk) { + $result = $examRep->updateProgressBulk(); + $log .= ", do updateProgressBulk"; + } else { + $this->error("specific uid or bulk."); + return 0; + } + $this->info(nexus()->getRequestId() . ", $log, result: " . var_export($result, true)); return 0; } } diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index fc82bdaa..68610f06 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -70,10 +70,11 @@ class Test extends Command */ public function handle() { -// $searchRep = new SearchRepository(); -// $r = $searchRep->deleteIndex(); -// $r = $searchRep->createIndex(); -// $r = $searchRep->import(); + $searchRep = new SearchRepository(); + $r = $searchRep->deleteIndex(); + $r = $searchRep->createIndex(); + $r = $searchRep->import(); + dd($r); // // $arr = [ // 'cat' => 'category', @@ -116,12 +117,18 @@ class Test extends Command // $r = $searchRep->deleteBookmark(1); // $r = $searchRep->addBookmark(1); - $rep = new AttendanceRepository(); - $uid = 1; - $attendance = $rep->getAttendance($uid); +// $rep = new AttendanceRepository(); +// $uid = 1; +// $attendance = $rep->getAttendance($uid); // $r = $rep->migrateAttendanceLogs($uid); - $r = $rep->getContinuousDays($attendance); - dd($r); +// $r = $rep->getContinuousDays($attendance); +// $r = $rep->getContinuousPoints(30); +// $today = Carbon::today(); +// $tomorrow = Carbon::tomorrow(); +// $yesterday = Carbon::parse('+10 days'); +// dd($today->diffInDays($yesterday)); +// $r = get_smile(12); +// dd($r); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 920ef271..415febf5 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel { $schedule->command('exam:assign_cronjob')->everyMinute(); $schedule->command('exam:checkout_cronjob')->everyMinute(); + $schedule->command('exam:update_progress --bulk=1')->hourly(); $schedule->command('backup:cronjob')->everyMinute(); $schedule->command('hr:update_status')->everyMinute(); $schedule->command('hr:update_status --ignore_time=1')->hourly(); diff --git a/app/Models/Attendance.php b/app/Models/Attendance.php index 17d50c65..95730ec5 100644 --- a/app/Models/Attendance.php +++ b/app/Models/Attendance.php @@ -21,6 +21,8 @@ class Attendance extends NexusModel 30 => 1000 ]; + const MAX_RETROACTIVE_DAYS = 30; + public function logs(): \Illuminate\Database\Eloquent\Relations\HasMany { diff --git a/app/Models/BonusLogs.php b/app/Models/BonusLogs.php index 8216ecd0..f94c7f6b 100644 --- a/app/Models/BonusLogs.php +++ b/app/Models/BonusLogs.php @@ -10,13 +10,16 @@ class BonusLogs extends NexusModel protected $fillable = ['uid', 'business_type', 'old_total_value', 'value', 'new_total_value', 'comment']; const DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN = 10000; + const DEFAULT_BONUS_BUY_ATTENDANCE_CARD = 1000; const BUSINESS_TYPE_CANCEL_HIT_AND_RUN = 1; const BUSINESS_TYPE_BUY_MEDAL = 2; + const BUSINESS_TYPE_BUY_ATTENDANCE_CARD = 3; - public static $businessTypes = [ + public static array $businessTypes = [ self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'], self::BUSINESS_TYPE_BUY_MEDAL => ['text' => 'Buy medal'], + self::BUSINESS_TYPE_BUY_ATTENDANCE_CARD => ['text' => 'Buy attendance card'], ]; public static function getBonusForCancelHitAndRun() @@ -25,5 +28,11 @@ class BonusLogs extends NexusModel return $result ?? self::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN; } + public static function getBonusForBuyAttendanceCard() + { + $result = Setting::get('bonus.attendance_card'); + return $result ?? self::DEFAULT_BONUS_BUY_ATTENDANCE_CARD; + } + } diff --git a/app/Models/Setting.php b/app/Models/Setting.php index d53fa73e..99120ef0 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -3,34 +3,41 @@ namespace App\Models; use Illuminate\Support\Arr; -use Illuminate\Support\Facades\Cache; use Nexus\Database\NexusDB; class Setting extends NexusModel { protected $fillable = ['name', 'value']; - public static function get($name = null) + public static function get($name = null, $default = null) { $settings = NexusDB::remember("nexus_settings_in_laravel", 10, function () { - $rows = self::query()->get(['name', 'value']); - $result = []; - foreach ($rows as $row) { - $value = $row->value; - if (!is_null($value)) { - $arr = json_decode($value, true); - if (is_array($arr)) { - $value = $arr; - } - } - Arr::set($result, $row->name, $value); - } - return $result; + return self::getFromDb(); }); if (is_null($name)) { return $settings; } - return Arr::get($settings, $name); + return Arr::get($settings, $name, $default); + } + + public static function getFromDb($name = null, $default = null) + { + $rows = self::query()->get(['name', 'value']); + $result = []; + foreach ($rows as $row) { + $value = $row->value; + if (!is_null($value)) { + $arr = json_decode($value, true); + if (is_array($arr)) { + $value = $arr; + } + } + Arr::set($result, $row->name, $value); + } + if (is_null($name)) { + return $result; + } + return Arr::get($result, $name, $default); } } diff --git a/app/Repositories/AttendanceRepository.php b/app/Repositories/AttendanceRepository.php index 93c25282..9e18aa2b 100644 --- a/app/Repositories/AttendanceRepository.php +++ b/app/Repositories/AttendanceRepository.php @@ -86,7 +86,7 @@ class AttendanceRepository extends BaseRepository return $query->first(); } - private function getContinuousPoints($days) + public function getContinuousPoints($days) { $settings = Setting::get('bonus'); $initial = $settings['attendance_initial'] ?? Attendance::INITIAL_BONUS; @@ -96,7 +96,7 @@ class AttendanceRepository extends BaseRepository $points = min($initial + $days * $step, $max); krsort($extraAwards); foreach ($extraAwards as $key => $value) { - if ($days >= $key) { + if ($days >= $key - 1) { $points += $value; break; } @@ -224,11 +224,10 @@ class AttendanceRepository extends BaseRepository $period = new \DatePeriod($row->added->addDay(1), $interval, $row->days, \DatePeriod::EXCLUDE_START_DATE); $i = 0; foreach ($period as $periodValue) { - $insert[] = [ - 'uid' => $row->uid, - 'points' => ($i == 0 ? $row->points : 0), - 'date' => $periodValue->format('Y-m-d'), - ]; + $insert[] = sprintf( + "(%d, %d, '%s')", + $row->uid, $i == 0 ? $row->points : 0, $periodValue->format('Y-m-d') + ); $i++; } } @@ -238,9 +237,13 @@ class AttendanceRepository extends BaseRepository do_log("no data to insert...", 'info', app()->runningInConsole()); return 0; } - NexusDB::table($table)->insert($insert); + $sql = sprintf( + "insert into `%s` (`uid`, `points`, `date`) values %s on duplicate key update `points` = values(`points`)", + $table, implode(',', $insert) + ); + NexusDB::statement($sql); $insertCount = count($insert); - do_log("[MIGRATE_ATTENDANCE_LOGS] DONE! insert count: " . $insertCount, 'info', app()->runningInConsole()); + do_log("[MIGRATE_ATTENDANCE_LOGS] DONE! insert sql: " . $sql, 'info', app()->runningInConsole()); return $insertCount; } @@ -252,7 +255,7 @@ class AttendanceRepository extends BaseRepository } else { $start = $attendance->added; } - $logQuery = $attendance->logs()->where('created_at', '<=', $start)->orderBy('date', 'desc'); + $logQuery = $attendance->logs()->where('date', '<=', $start)->orderBy('date', 'desc'); $attendanceLogs = $logQuery->get(['date'])->keyBy('date'); $counts = $attendanceLogs->count(); do_log(sprintf('user: %s, log counts: %s from query: %s', $attendance->uid, $counts, last_query())); @@ -286,6 +289,10 @@ class AttendanceRepository extends BaseRepository throw new \LogicException("Haven't attendance yet"); } $date = Carbon::createFromTimestampMs($timestampMs); + $now = Carbon::now(); + if ($date->gte($now) || $now->diffInDays($date) > Attendance::MAX_RETROACTIVE_DAYS) { + throw new \LogicException(sprintf("date: %s can't be retroactive attend", $date->format('Y-m-d'))); + } return NexusDB::transaction(function () use ($user, $attendance, $date) { if (AttendanceLog::query()->where('uid', $user->id)->where('date', $date->format('Y-m-d'))->exists()) { throw new \RuntimeException("Already attendance"); diff --git a/app/Repositories/BonusRepository.php b/app/Repositories/BonusRepository.php index 654f7c21..52743a7e 100644 --- a/app/Repositories/BonusRepository.php +++ b/app/Repositories/BonusRepository.php @@ -75,6 +75,24 @@ class BonusRepository extends BaseRepository } + public function consumeToBuyAttendanceCard($uid): bool + { + $user = User::query()->findOrFail($uid); + $requireBonus = BonusLogs::getBonusForBuyAttendanceCard(); + NexusDB::transaction(function () use ($user, $requireBonus) { + $comment = nexus_trans('bonus.comment_buy_attendance_card', [ + 'bonus' => $requireBonus, + ], $user->locale); + $comment = addslashes($comment); + do_log("comment: $comment"); + $this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_ATTENDANCE_CARD, "$comment"); + User::query()->where('id', $user->id)->increment('attendance_card'); + }); + + return true; + + } + private function consumeUserBonus($user, $requireBonus, $logBusinessType, $logComment = '') { if ($user->seedbonus < $requireBonus) { diff --git a/app/Repositories/ExamRepository.php b/app/Repositories/ExamRepository.php index 7f616c26..649288a3 100644 --- a/app/Repositories/ExamRepository.php +++ b/app/Repositories/ExamRepository.php @@ -451,8 +451,12 @@ class ExamRepository extends BaseRepository return false; } if ($examUser->is_done == ExamUser::IS_DONE_YES) { - do_log("examUser: {$examUser->id} is done, won't update progress."); - return false; + /** + * continue update + * @since v1.7.0 + */ +// do_log("examUser: {$examUser->id} is done, won't update progress."); +// return false; } $exam = $examUser->exam; if (!$user instanceof User) { diff --git a/app/Repositories/SearchRepository.php b/app/Repositories/SearchRepository.php index 3628a11d..9ac06763 100644 --- a/app/Repositories/SearchRepository.php +++ b/app/Repositories/SearchRepository.php @@ -6,8 +6,8 @@ use App\Models\Setting; use App\Models\Torrent; use App\Models\TorrentTag; use App\Models\User; -use Elastic\Elasticsearch\Client; -use Elastic\Elasticsearch\ClientBuilder; +use Elasticsearch\Client; +use Elasticsearch\ClientBuilder; use Illuminate\Support\Arr; use Nexus\Database\NexusDB; @@ -126,11 +126,11 @@ class SearchRepository extends BaseRepository { if (is_null($this->es)) { $config = nexus_config('nexus.elasticsearch'); - $es = ClientBuilder::create()->setHosts($config['hosts']); + $builder = ClientBuilder::create()->setHosts($config['hosts']); if (!empty($config['ssl_verification'])) { - $es->setSSLVerification($config['ssl_verification']); + $builder->setSSLVerification($config['ssl_verification']); } - $this->es = $es; + $this->es = $builder->build(); } return $this->es; } diff --git a/app/Repositories/ToolRepository.php b/app/Repositories/ToolRepository.php index c1ab7031..cb6b928b 100644 --- a/app/Repositories/ToolRepository.php +++ b/app/Repositories/ToolRepository.php @@ -81,10 +81,10 @@ class ToolRepository extends BaseRepository * * @return array|false */ - public function cronjobBackup() + public function cronjobBackup($force = false): bool|array { $setting = Setting::get('backup'); - if ($setting['enabled'] != 'yes') { + if ($setting['enabled'] != 'yes' && !$force) { do_log("Backup not enabled."); return false; } @@ -94,23 +94,25 @@ class ToolRepository extends BaseRepository $settingMinute = (int)$setting['minute']; $nowHour = (int)$now->format('H'); $nowMinute = (int)$now->format('i'); - do_log("Backup frequency: $frequency"); - if ($frequency == 'daily') { - if ($settingHour != $nowHour) { - do_log(sprintf('Backup setting hour: %s != now hour: %s', $settingHour, $nowHour)); - return false; + do_log("Backup frequency: $frequency, force: " . strval($force)); + if (!$force) { + if ($frequency == 'daily') { + if ($settingHour != $nowHour) { + do_log(sprintf('Backup setting hour: %s != now hour: %s', $settingHour, $nowHour)); + return false; + } + if ($settingMinute != $nowMinute) { + do_log(sprintf('Backup setting minute: %s != now minute: %s', $settingMinute, $nowMinute)); + return false; + } + } elseif ($frequency == 'hourly') { + if ($settingMinute != $nowMinute) { + do_log(sprintf('Backup setting minute: %s != now minute: %s', $settingMinute, $nowMinute)); + return false; + } + } else { + throw new \RuntimeException("Unknown backup frequency: $frequency"); } - if ($settingMinute != $nowMinute) { - do_log(sprintf('Backup setting minute: %s != now minute: %s', $settingMinute, $nowMinute)); - return false; - } - } elseif ($frequency == 'hourly') { - if ($settingMinute != $nowMinute) { - do_log(sprintf('Backup setting minute: %s != now minute: %s', $settingMinute, $nowMinute)); - return false; - } - } else { - throw new \RuntimeException("Unknown backup frequency: $frequency"); } $backupResult = $this->backupAll(); do_log("Backup all result: " . json_encode($backupResult)); @@ -143,17 +145,17 @@ class ToolRepository extends BaseRepository $service = new \Google\Service\Drive($client); $adapter = new \Masbug\Flysystem\GoogleDriveAdapter($service, $folderId); - $filesystem = new \League\Flysystem\Filesystem($adapter, new \League\Flysystem\Config([\League\Flysystem\Config::OPTION_VISIBILITY => \League\Flysystem\Visibility::PRIVATE])); + $filesystem = new \League\Flysystem\Filesystem($adapter); $localAdapter = new \League\Flysystem\Local\LocalFilesystemAdapter('/'); - $localFilesystem = new \League\Flysystem\Filesystem($localAdapter, [\League\Flysystem\Config::OPTION_VISIBILITY => \League\Flysystem\Visibility::PRIVATE]); + $localFilesystem = new \League\Flysystem\Filesystem($localAdapter); $filename = $backupResult['filename']; - $time = Carbon::now(); + $start = Carbon::now(); try { - $filesystem->writeStream(basename($filename), $localFilesystem->readStream($filename), new \League\Flysystem\Config()); - $speed = !(float)$time->diffInSeconds() ? 0 :filesize($filename) / (float)$time->diffInSeconds(); - $log = 'Elapsed time: '.$time->diffForHumans(null, true); + $filesystem->writeStream(basename($filename), $localFilesystem->readStream($filename)); + $speed = !(float)$start->diffInSeconds() ? 0 :filesize($filename) / (float)$start->diffInSeconds(); + $log = 'Elapsed time: '.$start->diffForHumans(null, true); $log .= ', Speed: '. number_format($speed/1024,2) . ' KB/s'; do_log($log); $backupResult['upload_result'] = 'success: ' .$log; @@ -174,7 +176,7 @@ class ToolRepository extends BaseRepository $log = "[SEND_MAIL]"; do_log("$log, to: $to, subject: $subject, body: $body"); $factory = new EsmtpTransportFactory(); - $smtp = Setting::get('smtp'); + $smtp = Setting::getFromDb('smtp'); $encryption = null; if (isset($smtp['encryption']) && in_array($smtp['encryption'], ['ssl', 'tls'])) { $encryption = $smtp['encryption']; diff --git a/composer.json b/composer.json index b236d66b..77934720 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "ext-redis": "*", "ext-xml": "*", "doctrine/dbal": "^3.1", - "elasticsearch/elasticsearch": "^8.0", + "elasticsearch/elasticsearch": "^7.16", "fruitcake/laravel-cors": "^2.0", "geoip2/geoip2": "~2.0", "hashids/hashids": "^4.1", diff --git a/composer.lock b/composer.lock index d6c52412..c75e1d42 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f4006c3f6b3768bf7a2a6d3f0b807a35", + "content-hash": "b02476e07cdf83dfaf5a0006876a4b6d", "packages": [ { "name": "asm89/stack-cors", @@ -988,78 +988,18 @@ ], "time": "2021-10-11T09:18:27+00:00" }, - { - "name": "elastic/transport", - "version": "v8.0.1", - "source": { - "type": "git", - "url": "https://github.com/elastic/elastic-transport-php.git", - "reference": "454c5d765b656b8949715b7937f79ae50a074b97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/elastic/elastic-transport-php/zipball/454c5d765b656b8949715b7937f79ae50a074b97", - "reference": "454c5d765b656b8949715b7937f79ae50a074b97", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.4 || ^8.0", - "php-http/discovery": "^1.14", - "php-http/httplug": "^2.3", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "nyholm/psr7": "^1.5", - "php-http/mock-client": "^1.5", - "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Elastic\\Transport\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "HTTP transport PHP library for Elastic products", - "keywords": [ - "PSR_17", - "elastic", - "http", - "psr-18", - "psr-7", - "transport" - ], - "support": { - "issues": "https://github.com/elastic/elastic-transport-php/issues", - "source": "https://github.com/elastic/elastic-transport-php/tree/v8.0.1" - }, - "time": "2022-03-30T09:17:25+00:00" - }, { "name": "elasticsearch/elasticsearch", - "version": "v8.0.1", + "version": "v7.17.0", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "f1851dc169e5010e85697eb0a63dc77c17e028a0" + "reference": "1890f9d7fde076b5a3ddcf579a802af05b2e781b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/f1851dc169e5010e85697eb0a63dc77c17e028a0", - "reference": "f1851dc169e5010e85697eb0a63dc77c17e028a0", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/1890f9d7fde076b5a3ddcf579a802af05b2e781b", + "reference": "1890f9d7fde076b5a3ddcf579a802af05b2e781b", "shasum": "", "mirrors": [ { @@ -1069,45 +1009,179 @@ ] }, "require": { - "elastic/transport": "^8.0", - "guzzlehttp/guzzle": "^7.0", - "php": "^7.4 || ^8.0", - "psr/http-client": "^1.0", - "psr/http-message": "^1.0", - "psr/log": "^1 || ^2 || ^3" + "ext-json": ">=1.3.7", + "ezimuel/ringphp": "^1.1.2", + "php": "^7.3 || ^8.0", + "psr/log": "^1|^2|^3" }, "require-dev": { "ext-yaml": "*", "ext-zip": "*", - "mockery/mockery": "^1.5", - "nyholm/psr7": "^1.5", - "php-http/mock-client": "^1.5", - "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^9.5", + "mockery/mockery": "^1.2", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.4", "symfony/finder": "~4.0" }, + "suggest": { + "ext-curl": "*", + "monolog/monolog": "Allows for client-level logging and tracing" + }, "type": "library", "autoload": { + "files": [ + "src/autoload.php" + ], "psr-4": { - "Elastic\\Elasticsearch\\": "src/" + "Elasticsearch\\": "src/Elasticsearch/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "Apache-2.0", + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Zachary Tong" + }, + { + "name": "Enrico Zimuel" + } ], "description": "PHP Client for Elasticsearch", "keywords": [ "client", - "elastic", "elasticsearch", "search" ], "support": { "issues": "https://github.com/elastic/elasticsearch-php/issues", - "source": "https://github.com/elastic/elasticsearch-php/tree/v8.0.1" + "source": "https://github.com/elastic/elasticsearch-php/tree/v7.17.0" }, - "time": "2022-03-30T12:23:21+00:00" + "time": "2022-02-03T13:40:04+00:00" + }, + { + "name": "ezimuel/guzzlestreams", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/guzzlestreams.git", + "reference": "abe3791d231167f14eb80d413420d1eab91163a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8", + "reference": "abe3791d231167f14eb80d413420d1eab91163a8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "support": { + "source": "https://github.com/ezimuel/guzzlestreams/tree/3.0.1" + }, + "time": "2020-02-14T23:11:50+00:00" + }, + { + "name": "ezimuel/ringphp", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/ringphp.git", + "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74", + "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ezimuel/guzzlestreams": "^3.0.1", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "replace": { + "guzzlehttp/ringphp": "self.version" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~9.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", + "support": { + "source": "https://github.com/ezimuel/ringphp/tree/1.2.0" + }, + "time": "2021-11-16T11:51:30+00:00" }, { "name": "firebase/php-jwt", @@ -1477,16 +1551,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.238.1", + "version": "v0.242.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719" + "reference": "73d4c0ed4b241e7396699e0ee1d1cdebabac25e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a9866fd963f53e9a7d26d36f20c471f73a90a719", - "reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/73d4c0ed4b241e7396699e0ee1d1cdebabac25e8", + "reference": "73d4c0ed4b241e7396699e0ee1d1cdebabac25e8", "shasum": "", "mirrors": [ { @@ -1521,9 +1595,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.238.1" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.242.0" }, - "time": "2022-03-07T18:23:49+00:00" + "time": "2022-04-03T01:24:10+00:00" }, { "name": "google/auth", @@ -2906,16 +2980,16 @@ }, { "name": "league/flysystem", - "version": "3.0.11", + "version": "3.0.13", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "1ca148713c23cadeb9d7526973f81fb4a04090a3" + "reference": "15dc1ccb2db8daef507c4d3e501565bae42a9f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1ca148713c23cadeb9d7526973f81fb4a04090a3", - "reference": "1ca148713c23cadeb9d7526973f81fb4a04090a3", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/15dc1ccb2db8daef507c4d3e501565bae42a9f0e", + "reference": "15dc1ccb2db8daef507c4d3e501565bae42a9f0e", "shasum": "", "mirrors": [ { @@ -2982,7 +3056,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.0.11" + "source": "https://github.com/thephpleague/flysystem/tree/3.0.13" }, "funding": [ { @@ -2998,7 +3072,7 @@ "type": "tidelift" } ], - "time": "2022-03-04T16:40:17+00:00" + "time": "2022-04-02T08:55:13+00:00" }, { "name": "league/mime-type-detection", @@ -3882,211 +3956,6 @@ }, "time": "2020-10-15T08:29:30+00:00" }, - { - "name": "php-http/discovery", - "version": "1.14.1", - "source": { - "type": "git", - "url": "https://github.com/php-http/discovery.git", - "reference": "de90ab2b41d7d61609f504e031339776bc8c7223" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/de90ab2b41d7d61609f504e031339776bc8c7223", - "reference": "de90ab2b41d7d61609f504e031339776bc8c7223", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "nyholm/psr7": "<1.0" - }, - "require-dev": { - "graham-campbell/phpspec-skip-example-extension": "^5.0", - "php-http/httplug": "^1.0 || ^2.0", - "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1", - "puli/composer-plugin": "1.0.0-beta10" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Discovery\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", - "homepage": "http://php-http.org", - "keywords": [ - "adapter", - "client", - "discovery", - "factory", - "http", - "message", - "psr7" - ], - "support": { - "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.1" - }, - "time": "2021-09-18T07:57:46+00:00" - }, - { - "name": "php-http/httplug", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/httplug.git", - "reference": "f640739f80dfa1152533976e3c112477f69274eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", - "reference": "f640739f80dfa1152533976e3c112477f69274eb", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0", - "php-http/promise": "^1.1", - "psr/http-client": "^1.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eric GELOEN", - "email": "geloen.eric@gmail.com" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "HTTPlug, the HTTP client abstraction for PHP", - "homepage": "http://httplug.io", - "keywords": [ - "client", - "http" - ], - "support": { - "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.3.0" - }, - "time": "2022-02-21T09:52:22+00:00" - }, - { - "name": "php-http/promise", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/promise.git", - "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", - "reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.3.2", - "phpspec/phpspec": "^5.1.2 || ^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Joel Wurtz", - "email": "joel.wurtz@gmail.com" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Promise used for asynchronous HTTP requests", - "homepage": "http://httplug.io", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/php-http/promise/issues", - "source": "https://github.com/php-http/promise/tree/1.1.0" - }, - "time": "2020-07-07T09:29:14+00:00" - }, { "name": "phpgangsta/googleauthenticator", "version": "dev-master", @@ -4220,16 +4089,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.13", + "version": "3.0.14", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e" + "reference": "2f0b7af658cbea265cbb4a791d6c29a6613f98ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/1443ab79364eea48665fa8c09ac67f37d1025f7e", - "reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2f0b7af658cbea265cbb4a791d6c29a6613f98ef", + "reference": "2f0b7af658cbea265cbb4a791d6c29a6613f98ef", "shasum": "", "mirrors": [ { @@ -4244,9 +4113,7 @@ "php": ">=5.6.1" }, "require-dev": { - "phing/phing": "~2.7", - "phpunit/phpunit": "^5.7|^6.0|^9.4", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "*" }, "suggest": { "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", @@ -4317,7 +4184,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.13" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.14" }, "funding": [ { @@ -4333,7 +4200,7 @@ "type": "tidelift" } ], - "time": "2022-01-30T08:50:05+00:00" + "time": "2022-04-04T05:15:45+00:00" }, { "name": "psr/cache", @@ -5119,6 +4986,88 @@ ], "time": "2021-09-25T23:10:38+00:00" }, + { + "name": "react/promise", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v2.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-02-11T10:27:51+00:00" + }, { "name": "rhilip/bencode", "version": "v2.1.1", @@ -5741,16 +5690,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.0.6", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a000fcf2298a1bc79a1dcff22608792506534719" + "reference": "c816b26f03b6902dba79b352c84a17f53d815f0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a000fcf2298a1bc79a1dcff22608792506534719", - "reference": "a000fcf2298a1bc79a1dcff22608792506534719", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c816b26f03b6902dba79b352c84a17f53d815f0d", + "reference": "c816b26f03b6902dba79b352c84a17f53d815f0d", "shasum": "", "mirrors": [ { @@ -5799,7 +5748,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.0.6" + "source": "https://github.com/symfony/http-foundation/tree/v6.0.7" }, "funding": [ { @@ -5815,20 +5764,20 @@ "type": "tidelift" } ], - "time": "2022-03-05T21:04:00+00:00" + "time": "2022-03-24T14:13:59+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.0.6", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "f9e49ad9fe16895b24cd7a09dc28d3364282e21a" + "reference": "9c03dab07a6aa336ffaadc15352b1d14f4ce01f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f9e49ad9fe16895b24cd7a09dc28d3364282e21a", - "reference": "f9e49ad9fe16895b24cd7a09dc28d3364282e21a", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9c03dab07a6aa336ffaadc15352b1d14f4ce01f5", + "reference": "9c03dab07a6aa336ffaadc15352b1d14f4ce01f5", "shasum": "", "mirrors": [ { @@ -5914,7 +5863,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.0.6" + "source": "https://github.com/symfony/http-kernel/tree/v6.0.7" }, "funding": [ { @@ -5930,7 +5879,7 @@ "type": "tidelift" } ], - "time": "2022-03-05T21:19:20+00:00" + "time": "2022-04-02T06:35:11+00:00" }, { "name": "symfony/mailer", @@ -6014,16 +5963,16 @@ }, { "name": "symfony/mime", - "version": "v6.0.3", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "2cd9601efd040e56f43360daa68f3c6b0534923a" + "reference": "74266e396f812a2301536397a6360b6e6913c0d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/2cd9601efd040e56f43360daa68f3c6b0534923a", - "reference": "2cd9601efd040e56f43360daa68f3c6b0534923a", + "url": "https://api.github.com/repos/symfony/mime/zipball/74266e396f812a2301536397a6360b6e6913c0d8", + "reference": "74266e396f812a2301536397a6360b6e6913c0d8", "shasum": "", "mirrors": [ { @@ -6081,7 +6030,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.0.3" + "source": "https://github.com/symfony/mime/tree/v6.0.7" }, "funding": [ { @@ -6097,7 +6046,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2022-03-13T20:10:05+00:00" }, { "name": "symfony/polyfill-ctype", @@ -8046,16 +7995,16 @@ }, { "name": "dragon-code/support", - "version": "v5.7.3", + "version": "v5.8.1", "source": { "type": "git", "url": "https://github.com/TheDragonCode/support.git", - "reference": "9bf0ec19eb601be3296f498b88979c1813a70a9a" + "reference": "27af9d8f9ebb0c672ed76d516f524d8d58346cab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TheDragonCode/support/zipball/9bf0ec19eb601be3296f498b88979c1813a70a9a", - "reference": "9bf0ec19eb601be3296f498b88979c1813a70a9a", + "url": "https://api.github.com/repos/TheDragonCode/support/zipball/27af9d8f9ebb0c672ed76d516f524d8d58346cab", + "reference": "27af9d8f9ebb0c672ed76d516f524d8d58346cab", "shasum": "", "mirrors": [ { @@ -8130,6 +8079,10 @@ "url": "https://yoomoney.ru/to/410012608840929", "type": "custom" }, + { + "url": "https://github.com/TheDragonCode", + "type": "github" + }, { "url": "https://opencollective.com/dragon-code", "type": "open_collective" @@ -8139,7 +8092,7 @@ "type": "patreon" } ], - "time": "2022-02-08T16:16:14+00:00" + "time": "2022-04-01T17:14:16+00:00" }, { "name": "facade/ignition-contracts", @@ -9699,16 +9652,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.18", + "version": "9.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b5856028273bfd855e60a887278857d872ec67a" + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a", - "reference": "1b5856028273bfd855e60a887278857d872ec67a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", "shasum": "", "mirrors": [ { @@ -9744,7 +9697,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -9792,7 +9745,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" }, "funding": [ { @@ -9804,7 +9757,7 @@ "type": "github" } ], - "time": "2022-03-08T06:52:28+00:00" + "time": "2022-04-01T12:37:26+00:00" }, { "name": "sebastian/cli-parser", @@ -10208,16 +10161,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "", "mirrors": [ { @@ -10265,7 +10218,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -10273,7 +10226,7 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", @@ -10747,16 +10700,16 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "afad3e987736f63bc54d7c923f0c1ebf247e8618" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/afad3e987736f63bc54d7c923f0c1ebf247e8618", + "reference": "afad3e987736f63bc54d7c923f0c1ebf247e8618", "shasum": "", "mirrors": [ { @@ -10769,12 +10722,12 @@ "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -10797,7 +10750,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0" }, "funding": [ { @@ -10805,7 +10758,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-27T17:35:59+00:00" }, { "name": "sebastian/version", @@ -11083,16 +11036,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "d349854331789aba9205fd755e0c1d1934ef1463" + "reference": "ea3a5401b631e8a2ce10581c1fec10c240b8e36e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/d349854331789aba9205fd755e0c1d1934ef1463", - "reference": "d349854331789aba9205fd755e0c1d1934ef1463", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/ea3a5401b631e8a2ce10581c1fec10c240b8e36e", + "reference": "ea3a5401b631e8a2ce10581c1fec10c240b8e36e", "shasum": "", "mirrors": [ { @@ -11172,7 +11125,7 @@ "type": "github" } ], - "time": "2022-02-15T11:02:15+00:00" + "time": "2022-03-10T12:29:54+00:00" }, { "name": "theseer/tokenizer", diff --git a/database/migrations/2022_04_02_163930_create_attendance_logs_table.php b/database/migrations/2022_04_02_163930_create_attendance_logs_table.php index 3e782cf6..93448974 100644 --- a/database/migrations/2022_04_02_163930_create_attendance_logs_table.php +++ b/database/migrations/2022_04_02_163930_create_attendance_logs_table.php @@ -15,12 +15,13 @@ return new class extends Migration { Schema::create('attendance_logs', function (Blueprint $table) { $table->id(); - $table->integer('uid')->index(); + $table->integer('uid'); $table->integer('points'); $table->date('date')->index(); $table->smallInteger('is_retroactive')->default(0); $table->dateTime('created_at')->useCurrent(); $table->dateTime('updated_at')->useCurrent()->useCurrentOnUpdate(); + $table->unique(['uid', 'date']); }); } diff --git a/include/cleanup.php b/include/cleanup.php index bf23066b..d029d70b 100644 --- a/include/cleanup.php +++ b/include/cleanup.php @@ -789,13 +789,14 @@ function docleanup($forceAll = 0, $printProgress = false) { } //update exam progress - $examRep = new \App\Repositories\ExamRepository(); - $updateExamProgressResult = $examRep->updateProgressBulk(); - $log = 'update exam progress'; - do_log($log . ", result: " . json_encode($updateExamProgressResult)); - if ($printProgress) { - printProgress($log); - } + //move to cronjob from v1.7 +// $examRep = new \App\Repositories\ExamRepository(); +// $updateExamProgressResult = $examRep->updateProgressBulk(); +// $log = 'update exam progress'; +// do_log($log . ", result: " . json_encode($updateExamProgressResult)); +// if ($printProgress) { +// printProgress($log); +// } // delete torrents that have been dead for a long time if ($deldeadtorrent_torrent > 0){ diff --git a/include/functions.php b/include/functions.php index e3274b78..bed69862 100644 --- a/include/functions.php +++ b/include/functions.php @@ -352,7 +352,8 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = // $s = preg_replace("/\[em([1-9][0-9]*)\]/ie", "(\\1 < 192 ? '\"[em\\1]\"' : '[em\\1]')", $s); $s = preg_replace_callback("/\[em([1-9][0-9]*)\]/i", function ($matches) { - return $matches[1] < 192 ? '[em' . $matches[1] . ']' : '[em' . $matches[1] . ']'; + $smile = get_smile($matches[1]); + return $smile ? '[em' . $matches[1] . ']' : '[em' . $matches[1] . ']'; }, $s); reset($tempCode); $j = $i = 0; @@ -2707,6 +2708,15 @@ function stdfoot() { foreach (\Nexus\Nexus::getAppendFooters() as $value) { print($value); } + $backToTop = << + +TOTOP; + print($backToTop); print(""); //echo replacePngTags(ob_get_clean()); @@ -3208,6 +3218,8 @@ if ($smalldescription_main == 'no' || $CURUSER['showsmalldescr'] == 'no') $displaysmalldescr = false; else $displaysmalldescr = true; //while ($row = mysql_fetch_assoc($res)) +$lastcom_tooltip = []; +$torrent_tooltip = []; foreach ($rows as $row) { $id = $row["id"]; @@ -3368,8 +3380,6 @@ foreach ($rows as $row) //comments $nl = "
"; - $lastcom_tooltip = []; - $torrent_tooltip = []; if (!$row["comments"]) { print("" . $row["comments"] . ""); } else { @@ -3688,7 +3698,7 @@ function create_tooltip_container($id_content_arr, $width = 400) { if(count($id_content_arr)) { - $result = "
"; + $result = "
"; foreach($id_content_arr as $id_content_arr_each) { $result .= "
" . $id_content_arr_each['content'] . "
"; @@ -3703,12 +3713,13 @@ function getimdb($imdb_id, $cache_stamp, $mode = 'minor') global $lang_functions; global $showextinfo; $thenumbers = $imdb_id; - $movie = new imdb ($thenumbers); + $imdb = new Nexus\Imdb\Imdb(); + $movie = $imdb->getMovie($imdb_id); $movieid = $thenumbers; - $movie->setid ($movieid); +// $movie->setid ($movieid); $target = array('Title', 'Credits', 'Plot'); - switch ($movie->cachestate($target)) + switch ($imdb->getCacheStatus($imdb_id)) { case "0": //cache is not ready { @@ -3772,7 +3783,7 @@ function getimdb($imdb_id, $cache_stamp, $mode = 'minor') } case 'median': { - if (($photo_url = $movie->photo_localurl() ) != FALSE) + if (($photo_url = $movie->photo() ) != FALSE) $smallth = "\"poster\""; else $smallth = ""; $runtime = $movie->runtime (); @@ -5355,4 +5366,19 @@ function insert_torrent_tags($torrentId, $tagIdArr, $sync = false) sql_query($insertTagsSql); } +function get_smile($num) +{ + static $all; + if (is_null($all)) { + $all = []; + $prefix = getFullDirectory('public'); + foreach (glob(getFullDirectory('public/pic/smilies') . '/*') as $value) { + $subPath = substr($value, strlen($prefix)); + $basename = basename($subPath); + $all[strstr($basename, '.', true)] = $subPath; + } + } + return $all[$num] ?? null; +} + ?> diff --git a/include/globalfunctions.php b/include/globalfunctions.php index f799ba22..3b9a72a9 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -276,36 +276,37 @@ function nexus_config($key, $default = null) * * @date 2021/1/11 * @param null $name - * @return array|mixed|string + * @param null $default + * @return mixed */ -function get_setting($name = null) +function get_setting($name = null, $default = null): mixed { static $settings; if (is_null($settings)) { $settings = \Nexus\Database\NexusDB::remember("nexus_settings_in_nexus", 10, function () { //get all settings from database - $sql = "select name, value from settings"; - $result = sql_query($sql); - $final = []; - while ($row = mysql_fetch_assoc($result)) { - $value = $row['value']; - if (!is_null($value)) { - $arr = json_decode($value, true); - if (is_array($arr)) { - $value = $arr; - } - } - arr_set($final, $row['name'], $value); - } - return $final; + return \App\Models\Setting::getFromDb(); }); } if (is_null($name)) { return $settings; } - return arr_get($settings, $name); + return arr_get($settings, $name, $default); } +function get_setting_from_db($name = null, $default = null) +{ + static $final; + if (is_null($final)) { + $final = \App\Models\Setting::getFromDb(); + } + if (is_null($name)) { + return $final; + } + return arr_get($final, $name, $default); +} + + function nexus_env($key = null, $default = null) { static $env; diff --git a/lang/chs/lang_attendance.php b/lang/chs/lang_attendance.php index 97d91f6f..dd9d617b 100644 --- a/lang/chs/lang_attendance.php +++ b/lang/chs/lang_attendance.php @@ -7,7 +7,7 @@ $lang_attendance = array 'attend_info' => "这是您的第 %u 次签到,已连续签到 %u 天,本次签到获得 %u 个魔力值。", 'initial' => "首次签到获得 %u 个魔力值。", 'steps' => "每次连续签到可额外获得 %u 个魔力值,直到 %u 封顶。", - 'continuous' => "连续签到 %u 天后,每次签到额外获得 %u 魔力值(不累计)。", + 'continuous' => "连续签到第 %u 天,额外获得 %u 魔力值。", 'sorry' => "抱歉", 'already_attended' => "您今天已经签到过了,请勿重复刷新。", 'retroactive_event_text' => '补', diff --git a/lang/chs/lang_mybonus.php b/lang/chs/lang_mybonus.php index aeac7735..0b7953ed 100644 --- a/lang/chs/lang_mybonus.php +++ b/lang/chs/lang_mybonus.php @@ -127,6 +127,9 @@ $lang_mybonus = array 'text_cancel_hr_label' => '输入要消除的 H&R ID:', 'text_success_cancel_hr' => "成功消除了一个 H&R。", 'text_success_buy_medal' => '成功购买该勋章。', + 'text_attendance_card' => '购买补签卡', + 'text_attendance_card_note' => '补签一天消耗一张,补签目标日期所得魔力奖励按照正常计算,即目标日期往前推计算连续天数获得奖励。', + 'text_success_buy_attendance_card' => '成功购买了一张补签卡。', ); ?> diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index fd0b7b76..0d15a678 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -717,7 +717,7 @@ $lang_settings = array 'row_torrent_hr' => '设定种子 H&R', 'text_torrent_hr_note' => '。将种子设置为参与 H&R 考察', 'row_cancel_hr' => '消除 H&R', - 'text_cancel_hr_note' => "个魔力值,如果他需要消除一个 H&R。默认'10000'。", + 'text_cancel_hr_note' => "个魔力值,如果他需要消除一个 H&R。默认'".\App\Models\BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN."'。", 'text_attendance_get_bonus' => '签到获得魔力值', 'text_attendance_initial_reward' => '初始奖励', 'text_attendance_initial_reward_input_label' => '第一次签到获得', @@ -734,6 +734,8 @@ $lang_settings = array 'text_attendance_continuous_item_action_remove' => '删除', 'text_attendance_continuous_item_action_add' => '增加', 'text_attendance_continuous_add_rules' => '请请从小到大添加规则', + 'row_attendance_card' => '购买补签卡', + 'text_attendance_card_note' => "个魔力值,如果他需要购买一张补签卡。默认'" . \App\Models\BonusLogs::DEFAULT_BONUS_BUY_ATTENDANCE_CARD . "'。", ); ?> diff --git a/lang/chs/lang_staffpanel.php b/lang/chs/lang_staffpanel.php index 0e2fff4f..493efa96 100644 --- a/lang/chs/lang_staffpanel.php +++ b/lang/chs/lang_staffpanel.php @@ -74,4 +74,6 @@ $lang_staffpanel = [ 'Search user' => '搜索用户', 'Confirm user' => '确认用户', 'Confirm user to complete registration' => '确认用户以完成注册', + 'Add Attendance card' => '增加补签卡', + 'Add Attendance card to certain classes' => '为特定等级用户增加补签卡', ]; diff --git a/lang/cht/lang_attendance.php b/lang/cht/lang_attendance.php index a0f7408f..1b6db754 100644 --- a/lang/cht/lang_attendance.php +++ b/lang/cht/lang_attendance.php @@ -7,7 +7,10 @@ $lang_attendance = array 'attend_info' => "這是您的第 %u 次簽到,已連續簽到 %u 天,本次簽到獲得 %u 個魔力值。", 'initial' => "首次簽到獲得 %u 個魔力值。", 'steps' => "每次連續簽到可額外獲得 %u 個魔力值,直到 %u 封頂。", - 'continuous' => "連續簽到 %u 天后,每次簽到額外獲得 %u 魔力值(不累計)。", + 'continuous' => "連續簽到第 %u 天,額外獲得 %u 魔力值。", 'sorry' => "抱歉", 'already_attended' => "您今天已經簽到過了,請勿重複刷新。", + 'retroactive_event_text' => '補', + 'retroactive_confirm_tip' => '確定要補簽: ', + 'retroactive_description' => '點擊白色背景的圓點進行補簽。你目前擁有補簽卡 %d 張。', ); diff --git a/lang/cht/lang_mybonus.php b/lang/cht/lang_mybonus.php index 601a8f02..b58a8879 100644 --- a/lang/cht/lang_mybonus.php +++ b/lang/cht/lang_mybonus.php @@ -127,6 +127,9 @@ $lang_mybonus = array 'text_cancel_hr_label' => '輸入要消除的 H&R ID:', 'text_success_cancel_hr' => "成功消除了一個 H&R。", 'text_success_buy_medal' => '成功購買該勛章。', + 'text_attendance_card' => '購買補簽卡', + 'text_attendance_card_note' => '補簽一天消耗一張,補簽目標日期所得魔力獎勵按照正常計算,即目標日期往前推計算連續天數獲得獎勵。', + 'text_success_buy_attendance_card' => '成功購買了一張補簽卡。', ); ?> diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index ae974a8f..80f85888 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -716,7 +716,7 @@ $lang_settings = array 'row_torrent_hr' => '設定種子 H&R', 'text_torrent_hr_note' => '。將種子設置為參與 H&R 考察', 'row_cancel_hr' => '消除 H&R', - 'text_cancel_hr_note' => "個魔力值,如果他需要消除一個 H&R。默認'10000'。", + 'text_cancel_hr_note' => "個魔力值,如果他需要消除一個 H&R。默認'".\App\Models\BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN."''。", 'text_attendance_get_bonus' => '簽到獲得魔力值', 'text_attendance_initial_reward' => '初始獎勵', 'text_attendance_initial_reward_input_label' => '第一次簽到獲得', @@ -733,6 +733,8 @@ $lang_settings = array 'text_attendance_continuous_item_action_remove' => '刪除', 'text_attendance_continuous_item_action_add' => '增加', 'text_attendance_continuous_add_rules' => '請請從小到大添加規則', + 'row_attendance_card' => '購買補簽卡', + 'text_attendance_card_note' => "個魔力值,如果他需要購買一張補簽卡。默認'" . \App\Models\BonusLogs::DEFAULT_BONUS_BUY_ATTENDANCE_CARD . "'。", ); ?> diff --git a/lang/cht/lang_staffpanel.php b/lang/cht/lang_staffpanel.php index 7840a4dd..025e1421 100644 --- a/lang/cht/lang_staffpanel.php +++ b/lang/cht/lang_staffpanel.php @@ -73,4 +73,6 @@ $lang_staffpanel = [ 'Manage custom fields' => '管理自定義的字段', 'Search user' => '搜索用戶', 'Confirm user' => '確認用戶', + 'Add Attendance card' => '增加補簽卡', + 'Add Attendance card to certain classes' => '為特定等級用戶增加補簽卡', ]; diff --git a/lang/en/lang_attendance.php b/lang/en/lang_attendance.php index 81634b22..c3d773a1 100644 --- a/lang/en/lang_attendance.php +++ b/lang/en/lang_attendance.php @@ -7,7 +7,10 @@ $lang_attendance = array 'attend_info' => "You have already attended %u days. C %u day,this time you will get %u bonus.", 'initial' => "First attendance get %u bonus.", 'steps' => "Every continuous attendance get %u bonus,unless reach maximum %u", - 'continuous' => "Attend %u day continuous,every time will get %u bouns additional(no aggregate).", + 'continuous' => "Attend %u day continuous, will get %u bouns additional.", 'sorry' => "Sorry", 'already_attended' => "You have already attend, no refresh please.", + 'retroactive_event_text' => 'Re', + 'retroactive_confirm_tip' => 'Confirm to attend: ', + 'retroactive_description' => 'Click on the dot on the white background to do attend. You currently have a attendance card %d.', ); diff --git a/lang/en/lang_mybonus.php b/lang/en/lang_mybonus.php index 6ebbcdae..62db3d3e 100644 --- a/lang/en/lang_mybonus.php +++ b/lang/en/lang_mybonus.php @@ -127,6 +127,9 @@ where
  • A is an intermediate variable
  • Ti is the i< 'text_cancel_hr_label' => 'Type in H&R ID:', 'text_success_cancel_hr' => "Success cancel one H&R.", 'text_success_buy_medal' => 'Success buy the medal.', + 'text_attendance_card' => 'Buy attendance card', + 'text_attendance_card_note' => 'One day to make up the attendance consume one, attend of the target date of the bonus rewards in accordance with the normal calculation, that is, the target date forward to calculate the number of continuous days to obtain rewards.', + 'text_success_buy_attendance_card' => 'Success buy 1 attendance card.', ); ?> diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index acb54785..25713877 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -716,7 +716,7 @@ $lang_settings = array 'row_torrent_hr' => 'H&R', 'text_torrent_hr_note' => '.Set torrent join the H&R inspect', 'row_cancel_hr' => 'Cancel H&R', - 'text_cancel_hr_note' => "bonus points to cancel one H&R。Default '10000'。", + 'text_cancel_hr_note' => "bonus points to cancel one H&R. Default '".\App\Models\BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN."'.", 'text_attendance_get_bonus' => 'Attendance get bonus', 'text_attendance_initial_reward' => 'Initial reward', 'text_attendance_initial_reward_input_label' => 'First time you will get', @@ -733,8 +733,8 @@ $lang_settings = array 'text_attendance_continuous_item_action_remove' => 'Remove', 'text_attendance_continuous_item_action_add' => 'Add', 'text_attendance_continuous_add_rules' => 'Please add rules from lowest to highest', - - + 'row_attendance_card' => 'Buy attendance card', + 'text_attendance_card_note' => "bonus points to buy a attendance card. Default'" . \App\Models\BonusLogs::DEFAULT_BONUS_BUY_ATTENDANCE_CARD . "'.", ); ?> diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index 9215e54b..429a4f4c 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -211,6 +211,17 @@ class Update extends Install $this->doLog("[ADD_ATTENDANCE_CARD_TO_USERS], migrateAttendanceLogs: $count"); } + /** + * @since 1.7.0 + * + * add amountattendancecard.php + */ + $menus = [ + ['name' => 'Add Attendance card', 'url' => 'amountattendancecard.php', 'info' => 'Add Attendance card to certain classes'], + ]; + $table = 'sysoppanel'; + $this->addMenu($table, $menus); + } public function runExtraMigrate() @@ -235,6 +246,17 @@ class Update extends Install } + private function addMenu($table, array $menus) + { + foreach ($menus as $menu) { + $count = get_row_count($table, "where url = " . sqlesc($menu['url'])); + if ($count == 0) { + $id = NexusDB::insert($table, $menu); + $this->doLog("[ADD MENU] insert: " . json_encode($menu) . " to table: $table, id: $id"); + } + } + } + public function listVersions() { diff --git a/nexus/Install/settings.default.php b/nexus/Install/settings.default.php index 68e1981f..6d1b41e0 100644 --- a/nexus/Install/settings.default.php +++ b/nexus/Install/settings.default.php @@ -223,6 +223,7 @@ return array ( 'prolinkpoint' => '1', 'prolinktime' => '600', 'cancel_hr' => BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN, + 'attendance_card' => BonusLogs::DEFAULT_BONUS_BUY_ATTENDANCE_CARD, ), 'account' => array ( diff --git a/public/amountattendancecard.php b/public/amountattendancecard.php index f38fdf42..1b279938 100644 --- a/public/amountattendancecard.php +++ b/public/amountattendancecard.php @@ -2,8 +2,55 @@ require "../include/bittorrent.php"; dbconn(); loggedinorreturn(); -if (get_user_class() < UC_SYSOP) +if (get_user_class() < UC_SYSOP) { stderr("Sorry", "Access denied."); +} +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $sender_id = ($_POST['sender'] == 'system' ? 0 : (int)$CURUSER['id']); + $dt = date("Y-m-d H:i:s"); + $msg = trim($_POST['msg']); + $amount = $_POST['amount']; + if (!$msg || !$amount) + stderr("Error","Don't leave any fields blank."); + if(!is_numeric($amount)) + stderr("Error","amount must be numeric"); + $updateset = $_POST['clases']; + if (is_array($updateset)) { + foreach ($updateset as $class) { + if (!is_valid_id($class) && $class != 0) + stderr("Error","Invalid Class"); + } + }else{ + if (!is_valid_id($updateset) && $updateset != 0) + stderr("Error","Invalid Class"); + } + $subject = trim($_POST['subject']); + $page = 1; + $size = 10000; + while (true) { + $messages = []; + $userIdArr = []; + $users = \App\Models\User::query()->whereIn('class', $updateset)->forPage($page, $size)->get(['id']); + if ($users->isEmpty()) { + break; + } + foreach ($users as $user) { + $userIdArr[] = $user->id; + $messages[] = [ + 'sender' => $sender_id, + 'receiver' => $user->id, + 'added' => $dt, + 'subject' => $subject, + 'msg' => $msg, + ]; + } + \App\Models\User::query()->whereIn('id', $userIdArr)->increment('attendance_card', $amount); + \App\Models\Message::query()->insert($messages); + $page++; + } + header(sprintf("Refresh: 0; url=%s?sent=1", $_SERVER['PHP_SELF'])); +} + stdhead("Add Attendance card", false); $allClass = array_chunk(\App\Models\User::$classes, 4, true); ?> @@ -24,7 +71,7 @@ $allClass = array_chunk(\App\Models\User::$classes, 4, true); - Upload amount has been added and inform message has been sent. + Attendance card has been added and inform message has been sent. diff --git a/public/attendance.php b/public/attendance.php index 1bbf6e1c..d7086156 100644 --- a/public/attendance.php +++ b/public/attendance.php @@ -30,7 +30,15 @@ parked(); \Nexus\Nexus::css('vendor/fullcalendar-5.10.2/main.min.css', 'header', true); \Nexus\Nexus::js('vendor/fullcalendar-5.10.2/main.min.js', 'footer', true); -\Nexus\Nexus::js('vendor/fullcalendar-5.10.2/locales/zh-cn.js', 'footer', true); + +$lang = get_langfolder_cookie(); +$localesMap = [ + 'en' => 'en-us', + 'chs' => 'zh-cn', + 'cht' => 'zh-tw', +]; +$localeJs = $localesMap[$lang] ?? 'en-us'; +\Nexus\Nexus::js("vendor/fullcalendar-5.10.2/locales/{$localeJs}.js", 'footer', true); $today = \Carbon\Carbon::today(); $tomorrow = \Carbon\Carbon::tomorrow(); @@ -57,7 +65,7 @@ foreach ($period as $value) { if ($logValue->is_retroactive) { $events[] = array_merge($eventBase, ['title' => $lang_attendance['retroactive_event_text'], 'display' => 'list-item']); } - } else { + } elseif ($value->lte($today) && $value->diffInDays($today) <= \App\Models\Attendance::MAX_RETROACTIVE_DAYS) { $events[] = array_merge($eventBase, ['groupId' => 'to_do', 'display' => 'list-item']); } } diff --git a/public/getextinfoajax.php b/public/getextinfoajax.php index 5daf270d..f719ca16 100644 --- a/public/getextinfoajax.php +++ b/public/getextinfoajax.php @@ -1,18 +1,18 @@ new_page('imdb_id_'.$imdb_id.'_'.$mode, 1296000, true); +$Cache->new_page('imdb_id_'.$imdb_id.'_'.$mode); if (!$Cache->get_page()){ $infoblock = getimdb($imdb_id, $cache_stamp, $mode); if ($infoblock){ diff --git a/public/mybonus.php b/public/mybonus.php index f62f57ac..71231360 100644 --- a/public/mybonus.php +++ b/public/mybonus.php @@ -90,6 +90,15 @@ function bonusarray($option = 0){ $bonus['description'] = $lang_mybonus['text_no_advertisements_note']; $results[] = $bonus; + //Attendance card + $bonus = array(); + $bonus['points'] = \App\Models\BonusLogs::getBonusForBuyAttendanceCard(); + $bonus['art'] = 'attendance_card'; + $bonus['menge'] = 0; + $bonus['name'] = $lang_mybonus['text_attendance_card']; + $bonus['description'] = $lang_mybonus['text_attendance_card_note']; + $results[] = $bonus; + //Donate $bonus = array(); $bonus['points'] = 1000; @@ -254,6 +263,8 @@ if (isset($do)) { $msg = $lang_mybonus['text_success_cancel_hr']; elseif ($do == "buy_medal") $msg = $lang_mybonus['text_success_buy_medal']; + elseif ($do == "attendance_card") + $msg = $lang_mybonus['text_success_buy_attendance_card']; else $msg = ''; } @@ -643,6 +654,15 @@ if ($action == "exchange") { do_log($exception->getMessage(), 'error'); stderr('Error', "Something wrong...", false, false); } + } elseif ($art == 'attendance_card') { + try { + $bonusRep = new \App\Repositories\BonusRepository(); + $bonusRep->consumeToBuyAttendanceCard($userid); + nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=attendance_card"); + } catch (\Exception $exception) { + do_log($exception->getMessage(), 'error'); + stderr('Error', "Something wrong...", false, false); + } } } } diff --git a/public/settings.php b/public/settings.php index 3e046fca..2060523c 100644 --- a/public/settings.php +++ b/public/settings.php @@ -91,7 +91,7 @@ elseif ($action == 'savesettings_code') // save database elseif ($action == 'savesettings_bonus') // save bonus { stdhead($lang_settings['head_save_bonus_settings']); - $validConfig = array('donortimes','perseeding','maxseeding','tzero','nzero','bzero','l', 'uploadtorrent','uploadsubtitle','starttopic','makepost','addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload','tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage', 'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max', 'cancel_hr'); + $validConfig = array('donortimes','perseeding','maxseeding','tzero','nzero','bzero','l', 'uploadtorrent','uploadsubtitle','starttopic','makepost','addcomment','pollvote','offervote', 'funboxvote','saythanks','receivethanks','funboxreward','onegbupload','fivegbupload','tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage', 'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max', 'cancel_hr', 'attendance_card'); GetVar($validConfig); $BONUS = []; foreach($validConfig as $config) { @@ -263,7 +263,7 @@ elseif ($action == 'savesettings_advertisement') // save advertisement } elseif ($action == 'tweaksettings') // tweak settings { - $TWEAK = get_setting('tweak'); + $TWEAK = get_setting_from_db('tweak'); stdhead($lang_settings['head_tweak_settings']); print ($notice); print ("
    "); @@ -286,7 +286,7 @@ elseif ($action == 'tweaksettings') // tweak settings } elseif ($action == 'smtpsettings') // stmp settings { - $SMTP = get_setting('smtp'); + $SMTP = get_setting_from_db('smtp'); stdhead($lang_settings['head_smtp_settings']); print ($notice); print(""); @@ -320,7 +320,7 @@ print(""); } elseif ($action == 'securitysettings') //security settings { - $SECURITY = get_setting('security'); + $SECURITY = get_setting_from_db('security'); stdhead($lang_settings['head_security_settings']); print ($notice); print(""); @@ -384,7 +384,7 @@ elseif ($action == 'securitysettings') //security settings } elseif ($action == 'authoritysettings') //Authority settings { - $AUTHORITY = get_setting('authority'); + $AUTHORITY = get_setting_from_db('authority'); stdhead($lang_settings['head_authority_settings']); print ($notice); $maxclass = UC_SYSOP; @@ -443,7 +443,7 @@ elseif ($action == 'basicsettings') // basic settings { stdhead($lang_settings['head_basic_settings']); print ($notice); - $config = get_setting('basic'); + $config = get_setting_from_db('basic'); print (""); tr($lang_settings['row_site_name']," ".$lang_settings['text_site_name_note'], 1); tr($lang_settings['row_base_url']," ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1); @@ -462,7 +462,7 @@ elseif ($action == 'basicsettings') // basic settings } elseif ($action == 'attachmentsettings') // basic settings { - $ATTACHMENT = get_setting('attachment'); + $ATTACHMENT = get_setting_from_db('attachment'); stdhead($lang_settings['head_attachment_settings']); print ($notice); print (""); @@ -484,7 +484,7 @@ elseif ($action == 'attachmentsettings') // basic settings } elseif ($action == 'advertisementsettings') { - $ADVERTISEMENT = get_setting('advertisement'); + $ADVERTISEMENT = get_setting_from_db('advertisement'); stdhead($lang_settings['head_advertisement_settings']); print ($notice); print (""); @@ -498,7 +498,7 @@ elseif ($action == 'advertisementsettings') } elseif ($action == 'codesettings') // code settings { - $CODE = get_setting('code'); + $CODE = get_setting_from_db('code'); stdhead($lang_settings['head_code_settings']); print ($notice); print (""); @@ -510,7 +510,7 @@ elseif ($action == 'codesettings') // code settings print ("
    "); } elseif ($action == 'bonussettings'){ - $BONUS = get_setting('bonus'); + $BONUS = get_setting_from_db('bonus'); stdhead($lang_settings['head_bonus_settings']); print ($notice); print ("
    "); @@ -541,7 +541,10 @@ elseif ($action == 'bonussettings'){ yesorno($lang_settings['row_allow_giving_bonus_gift'], 'bonusgift', $BONUS["bonusgift"], $lang_settings['text_giving_bonus_gift_note']); tr($lang_settings['row_bonus_gift_tax'], $lang_settings['text_system_charges']."".$lang_settings['text_bonus_points_plus']."".$lang_settings['text_bonus_gift_tax_note'], 1); tr($lang_settings['row_cancel_hr'],$lang_settings['text_it_costs_user']."".$lang_settings['text_cancel_hr_note'], 1); - echo '' . $lang_settings['text_attendance_get_bonus'] . ''; + tr($lang_settings['row_attendance_card'],$lang_settings['text_it_costs_user']."".$lang_settings['text_attendance_card_note'], 1); + + + echo '' . $lang_settings['text_attendance_get_bonus'] . ''; tr($lang_settings['text_attendance_initial_reward'],sprintf($lang_settings['text_attendance_initial_reward_input_label'].' ' . $lang_settings['text_attendance_input_suffix'], $attendance_initial_bonus),true); tr($lang_settings['text_attendance_continuous_increment'],sprintf($lang_settings['text_attendance_continuous_increment_input_label'].' ' . $lang_settings['text_attendance_input_suffix'], $attendance_step_bonus),true); tr($lang_settings['text_attendance_reward_limit'],sprintf($lang_settings['text_attendance_reward_limit_input_label'].' ' . $lang_settings['text_attendance_input_suffix'], $attendance_max_bonus),true); @@ -564,7 +567,7 @@ elseif ($action == 'bonussettings'){ print ("
    "); } elseif ($action == 'accountsettings'){ - $ACCOUNT = get_setting('account'); + $ACCOUNT = get_setting_from_db('account'); stdhead($lang_settings['head_account_settings']); print ($notice); $maxclass = UC_VIP; @@ -618,7 +621,7 @@ elseif ($action == 'accountsettings'){ } elseif ($action == 'torrentsettings') { - $TORRENT = get_setting('torrent'); + $TORRENT = get_setting_from_db('torrent'); stdhead($lang_settings['head_torrent_settings']); print ($notice); print ("
    "); @@ -653,7 +656,7 @@ elseif ($action == 'torrentsettings') } elseif ($action == 'mainsettings') // main settings { - $MAIN = get_setting('main'); + $MAIN = get_setting_from_db('main'); stdhead($lang_settings['head_main_settings']); print ($notice); print (""); diff --git a/public/vendor/jquery-goup-1.1.3/jquery.goup.min.js b/public/vendor/jquery-goup-1.1.3/jquery.goup.min.js new file mode 100644 index 00000000..c0be402a --- /dev/null +++ b/public/vendor/jquery-goup-1.1.3/jquery.goup.min.js @@ -0,0 +1,10 @@ +/* + * + * Copyright (c) 2014-2017 Daniele Lenares (https://github.com/dnlnrs) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * Version 1.1.3 + * + */ +(function(a){'use strict';function b(d,e,f){'show'===e?'fade'===f?d.fadeIn():'slide'===f?d.slideDown():d.fadeIn():'fade'===f?d.fadeOut():'slide'===f?d.slideUp():d.fadeOut()}function c(d,e){var f=!0;d.on('click',function(){!0==f&&(f=!1,a('html, body').animate({scrollTop:0},e,function(){f=!0}))})}a.goup=function(d){var e=a.extend({location:'right',locationOffset:20,bottomOffset:10,containerSize:40,containerRadius:10,containerClass:'goup-container',arrowClass:'goup-arrow',alwaysVisible:!1,trigger:500,entryAnimation:'fade',goupSpeed:'slow',hideUnderWidth:500,containerColor:'#000',arrowColor:'#fff',title:'',titleAsText:!1,titleAsTextClass:'goup-text',zIndex:1},d);'right'!==e.location&&'left'!==e.location&&(e.location='right'),0>e.locationOffset&&(e.locationOffset=0),0>e.bottomOffset&&(e.bottomOffset=0),20>e.containerSize&&(e.containerSize=20),0>e.containerRadius&&(e.containerRadius=0),0>e.trigger&&(e.trigger=0),0>e.hideUnderWidth&&(e.hideUnderWidth=0);var f=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;f.test(e.containerColor)||(e.containerColor='#000'),f.test(e.arrowColor)||(e.arrowColor='#fff'),''===e.title&&(e.titleAsText=!1),isNaN(e.zIndex)&&(e.zIndex=1);var g=a('body'),h=a(window),i=a('
    ');i.addClass(e.containerClass);var j=a('
    ');j.addClass(e.arrowClass),i.html(j),g.append(i);var k={position:'fixed',width:e.containerSize,height:e.containerSize,background:e.containerColor,cursor:'pointer',display:'none','z-index':e.zIndex};if(k.bottom=e.bottomOffset,k[e.location]=e.locationOffset,k['border-radius']=e.containerRadius,i.css(k),!e.titleAsText)i.attr('title',e.title);else{var l=a('
    ');g.append(l),l.addClass(e.titleAsTextClass).text(e.title),l.attr('style',i.attr('style')),l.css('background','transparent').css('width',e.containerSize+40).css('height','auto').css('text-align','center').css(e.location,e.locationOffset-20);var m=parseInt(l.height())+10,n=parseInt(i.css('bottom'));i.css('bottom',m+n)}var p=0.25*e.containerSize,q={width:0,height:0,margin:'0 auto','padding-top':Math.ceil(0.325*e.containerSize),'border-style':'solid','border-width':'0 '+p+'px '+p+'px '+p+'px','border-color':'transparent transparent '+e.arrowColor+' transparent'};j.css(q);var r=!1;h.resize(function(){h.outerWidth()<=e.hideUnderWidth?(r=!0,b(i,'hide',e.entryAnimation),'undefined'!=typeof l&&b(l,'hide',e.entryAnimation)):(r=!1,h.trigger('scroll'))}),h.outerWidth()<=e.hideUnderWidth&&(r=!0,i.hide(),'undefined'!=typeof l&&l.hide()),e.alwaysVisible?(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)):h.scroll(function(){h.scrollTop()>=e.trigger&&!r&&(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)),h.scrollTop()=e.trigger&&!r&&(b(i,'show',e.entryAnimation),'undefined'!=typeof l&&b(l,'show',e.entryAnimation)),c(i,e.goupSpeed),'undefined'!=typeof l&&c(l,e.goupSpeed)}})(jQuery); \ No newline at end of file diff --git a/resources/lang/zh_CN/bonus.php b/resources/lang/zh_CN/bonus.php index 994148fc..26000772 100644 --- a/resources/lang/zh_CN/bonus.php +++ b/resources/lang/zh_CN/bonus.php @@ -2,4 +2,5 @@ return [ 'comment_buy_medal' => '花费 :bonus 魔力购买了 :medal_name', + 'comment_buy_attendance_card' => '花费 :bonus 魔力购买了 1 张补签卡', ];