diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 2c2ef708..b5234fe6 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -369,11 +369,7 @@ class UserController extends Controller
public function invite()
{
if (Order::uid()->active()->where('origin_amount', '>', 0)->doesntExist()) {
- return Response::view(
- 'auth.error',
- ['message' => trans('user.purchase_required').' '.trans('common.back').''],
- 402
- );
+ return Response::view('auth.error', ['message' => trans('user.purchase_required').' '.trans('common.back').''], 402);
}
return view('user.invite', [
@@ -511,11 +507,9 @@ class UserController extends Controller
public function charge(Request $request): ?JsonResponse
{
$validator = Validator::make($request->all(), [
- 'coupon_sn' => [
- 'required', Rule::exists('coupon', 'sn')->where(static function ($query) {
- $query->whereType(3)->whereStatus(0);
- }),
- ],
+ 'coupon_sn' => ['required', Rule::exists('coupon', 'sn')->where(static function ($query) {
+ $query->whereType(3)->whereStatus(0);
+ })],
]);
if ($validator->fails()) {
diff --git a/app/Services/ArticleService.php b/app/Services/ArticleService.php
index c1575660..f9323a84 100644
--- a/app/Services/ArticleService.php
+++ b/app/Services/ArticleService.php
@@ -33,10 +33,7 @@ class ArticleService extends BaseService
public function getContent()
{
$content = self::$article->content;
- if (! UserService::getInstance()->isActivePaying()) {
- $this->formatAccessable($content);
- }
-
+ $this->formatAccessable($content);
$this->formatValuables($content);
return $content;
@@ -44,21 +41,31 @@ class ArticleService extends BaseService
private function formatAccessable(&$body)
{
- while (strpos($body, '') !== false) {
- $accessData = $this->getInBetween($body, '', '');
- if ($accessData) {
- $body = strtr($body, [
- $accessData => '
'.__('You must have a valid subscription to view content in this area!').'
',
- ]);
+ $noAccess = ! UserService::getInstance()->isActivePaying();
+
+ if ($noAccess) {
+ while ($this->getInBetween($body, '', '', true) !== '') {
+ $accessArea = $this->getInBetween($body, '', '');
+ if ($accessArea) {
+ $body = strtr($body,
+ [$accessArea => ''.__('You must have a valid subscription to view content in this area!').'
']);
+ }
}
}
+
+ while ($this->getInBetween($body, '', '', true) !== '') {
+ $accessArea = $this->getInBetween($body, '', '');
+ $hasAccessArea = $this->getInBetween($accessArea, '', '', true);
+ $noAccessArea = $this->getInBetween($accessArea, '', '', true);
+ $body = strtr($body, [$accessArea => $accessArea && $noAccess ? $noAccessArea : $hasAccessArea]);
+ }
}
- private function getInBetween($input, $start, $end): string
+ private function getInBetween($input, $start, $end, $bodyOnly = false): string
{
- $substr = substr($input, strlen($start) + strpos($input, $start), (strlen($input) - strpos($input, $end)) * (-1));
+ $substr = substr($input, strpos($input, $start) + strlen($start), strpos($input, $end) - strlen($input));
- return $start.$substr.$end;
+ return $bodyOnly ? $substr : $start.$substr.$end;
}
private function formatValuables(&$body)
diff --git a/resources/lang/zh_CN.json b/resources/lang/zh_CN.json
index c6f84e1f..d0f0d159 100644
--- a/resources/lang/zh_CN.json
+++ b/resources/lang/zh_CN.json
@@ -23,5 +23,6 @@
"We won't ask for your password again for a few hours.": "确认完成后,接下来几个小时内您不需再输入密码。",
"You are receiving this email because we received a password reset request for your account.": "您收到此电子邮件是因为我们收到了您帐户的密码重设请求。",
"Your email address is not verified.": "您的电子邮件尚未验证通过",
- "You have not responded this ticket in :num hours, System has closed your ticket.": "超过:num小时未回复工单,系统已自动关闭了您的工单"
+ "You have not responded this ticket in :num hours, System has closed your ticket.": "超过:num小时未回复工单,系统已自动关闭了您的工单",
+ "You must have a valid subscription to view the content in this area!": "您必须拥有有效套餐才可以查看该区域的内容!"
}
diff --git a/resources/views/admin/article/info.blade.php b/resources/views/admin/article/info.blade.php
index 954ae312..ca25410e 100644
--- a/resources/views/admin/article/info.blade.php
+++ b/resources/views/admin/article/info.blade.php
@@ -118,15 +118,14 @@
tinymce.init({
selector: 'textarea', // change this value according to your HTML
- plugins: [
- 'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
- 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
- 'media', 'table', 'emoticons', 'template', 'help',
- ],
- toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | ' +
- 'bullist numlist outdent indent | link image | print preview media fullscreen | ' +
- 'forecolor backcolor emoticons | help',
- menubar: 'favs file edit view insert format tools table help',
+ plugins: 'advlist autolink code emoticons help image importcss link lists media preview quickbars searchreplace table visualblocks visualchars wordcount',
+ toolbar: 'undo redo | styles | bold italic forecolor backcolor emoticons| alignleft aligncenter alignright alignjustify | bullist numlist outdent ' +
+ 'indent | link image media',
+ menubar: 'view edit insert format table tools help',
+ link_default_target: '_blank',
+ quickbars_insert_toolbar: 'quicktable image media',
+ quickbars_selection_toolbar: 'bold italic underline | blocks | bullist numlist | blockquote quicklink',
+ extended_valid_elements: 'i[class|aria-hidden]',
language: '{{app()->getLocale()}}',
content_css: '/assets/bundle/app.min.css',
});