Skip to content

Commit

Permalink
fix: support php 74, not 73
Browse files Browse the repository at this point in the history
  • Loading branch information
thatsgolden committed Jul 14, 2024
1 parent 1615a6b commit 0446bed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion js/src/forum/components/extendAuthModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import GeeTest from '@/common/components/GeeTest';
import GeeTestCaptchaStates from '@/common/states/GeeTestCaptchaStates';
import SignUpModal from 'flarum/forum/components/SignUpModal';
import ForgotPasswordModal from 'flarum/forum/components/ForgotPasswordModal';
import ChangePasswordModal from 'flarum/forum/components/ChangePasswordModal';
import { EnumContextEvent } from '@/common/enums/EnumContextEvent';
import translate from '@/common/utils/translate';

type BindSuccessEvent = SubmitEvent & { __isBindSuccess: boolean };

export const addCaptchaToAuthModal = <T extends typeof LogInModal | typeof SignUpModal | typeof ForgotPasswordModal>({
export const addCaptchaToAuthModal = <T extends typeof LogInModal | typeof SignUpModal | typeof ForgotPasswordModal | typeof ChangePasswordModal>({
modal,
contextEvent,
dataMethod,
Expand Down Expand Up @@ -102,4 +103,5 @@ export default () => {
addCaptchaToAuthModal({ modal: LogInModal, contextEvent: EnumContextEvent.LOGIN, dataMethod: 'loginParams' });
addCaptchaToAuthModal({ modal: SignUpModal, contextEvent: EnumContextEvent.SIGNUP, dataMethod: 'submitData' });
addCaptchaToAuthModal({ modal: ForgotPasswordModal, contextEvent: EnumContextEvent.FORGOT, dataMethod: 'requestParams' });
addCaptchaToAuthModal({ modal: ChangePasswordModal, contextEvent: EnumContextEvent.FORGOT, dataMethod: 'requestBody' });
};
2 changes: 1 addition & 1 deletion src/Requests/GeeTestRequestMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ private function httpPost($url, $params, $headers = [])
curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge(['Content-type' => 'application/x-www-form-urlencoded'], $headers));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if (strcmp($httpCode, '200') != 0) {
$res = false;
Expand Down
12 changes: 10 additions & 2 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ public static function isEnabled(SettingsRepositoryInterface $settings, string $
return $settings->get(self::getSettingPath($contextEvent), '') === '1';
}

public static function logError(string $message, mixed $details = null)
/**
* @param string $message
* @param mixed $details
*/
public static function logError(string $message, $details = null)
{
resolve('log')->error('[FFans\GeeTest] ' . $message);
$details && resolve('log')->error(var_export($details, true));
}

public static function logInfo(string $message, mixed $details = null)
/**
* @param string $message
* @param mixed $details
*/
public static function logInfo(string $message, $details = null)
{
resolve('log')->info('[FFans\GeeTest] ' . $message);
$details && resolve('log')->info(var_export($details, true));
Expand Down

0 comments on commit 0446bed

Please sign in to comment.