Skip to content

Commit

Permalink
https://github.com/WWBN/AVideo/issues/9458
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Oct 4, 2024
1 parent b1b413c commit 4d477ce
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4365,13 +4365,38 @@ function getCaptcha($uid = "", $forceCaptcha = false)
$uid = "capcha_" . uniqid();
}
$contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functiongetCaptcha.php', ['uid' => $uid, 'forceCaptcha' => $forceCaptcha]);
$parts = explode('<script>', $contents);

$result = [
'style' => '',
'html' => '',
'script' => ''
];

// Match the style block
preg_match('/<style>(.*?)<\/style>/s', $contents, $styleMatch);
if (!empty($styleMatch[1])) {
$result['style'] = trim($styleMatch[1]);
}

// Match the HTML block
preg_match('/<div.*?<\/div>/s', $contents, $htmlMatch);
if (!empty($htmlMatch[0])) {
$result['html'] = trim($htmlMatch[0]);
}

// Match the script block
preg_match('/<script>(.*?)<\/script>/s', $contents, $scriptMatch);
if (!empty($scriptMatch[1])) {
$result['script'] = trim($scriptMatch[1]);
}

return [
'content' => $contents,
'btnReloadCapcha' => "$('#btnReload{$uid}').trigger('click');",
'captchaText' => "$('#{$uid}Text').val()",
'html' => $parts[0],
'script' => str_replace('</script>', '', $parts[1])
'html' => $result['html'],
'script' => $result['script'],
'style' => $result['style']
];
}

Expand Down

0 comments on commit 4d477ce

Please sign in to comment.