@@ -227,7 +227,11 @@ else if ($dopost == "checkArchives") { | |||
while ($row = $dsql->GetArray('ckall')) { | |||
$aid = $row['id']; | |||
$maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0' WHERE id='$aid' "); | |||
$indexedsql = ""; | |||
if (TableHasField("#@__arctiny", "indexed")) { | |||
$indexedsql = ", `indexed`=2 "; | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0'{$indexedsql} WHERE id='$aid' "); | |||
if ($row['issystem'] == -1) { | |||
$dsql->ExecuteNoneQuery("UPDATE `".trim($row['addtable'])."` SET arcrank='0' WHERE aid='$aid' "); | |||
} else { | |||
@@ -235,6 +239,7 @@ else if ($dopost == "checkArchives") { | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' "); | |||
$pageurl = MakeArt($aid, false); | |||
DedeSearchDo("add", array("id" => $aid)); | |||
} | |||
ShowMsg("成功审核指定文档", $ENV_GOBACK_URL); | |||
exit(); | |||
@@ -319,6 +324,7 @@ else if ($dopost == "checkArchives") { | |||
//更新网页 | |||
foreach ($okids as $aid) { | |||
$arc = new Archives($aid); | |||
DedeSearchDo("update", array("id" => $aid)); | |||
$arc->MakeHtml(); | |||
} | |||
ShowMsg("成功移动".$j."个文档", $ENV_GOBACK_URL); | |||
@@ -340,6 +346,7 @@ else if ($dopost == 'return') { | |||
foreach ($qstrs as $aid) { | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank='-1',ismake='0' WHERE id='$aid'"); | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET `arcrank` = '-1' WHERE id = '$aid';"); | |||
DedeSearchDo("add", array("id" => $aid)); | |||
} | |||
ShowMsg("成功还原指定文档", "recycling.php"); | |||
exit(); | |||
@@ -97,6 +97,9 @@ function DelArc($aid, $type = 'ON', $onlyfile = FALSE, $recycle = 0) | |||
$intime = time(); | |||
$insql = "INSERT INTO `#@__search_sync` (`aid`, `add_at`) VALUES ({$aid}, $intime)"; | |||
$dsql->ExecuteNoneQuery($insql); | |||
if (DEDEBIZSEARCH) { | |||
DedeSearchDo("delete",array('id'=>$aid)); | |||
} | |||
} | |||
if (empty($arcRow['money'])) $arcRow['money'] = 0; | |||
if (empty($arcRow['ismake'])) $arcRow['ismake'] = 1; | |||
@@ -19,7 +19,7 @@ $del = new DedeHttpDown(); | |||
$del->OpenUrl($fileHashURL); | |||
$filelist = $del->GetJSON(); | |||
$offFiles = array(); | |||
foreach ($filelist as $key => $ff) { | |||
foreach ((array)$filelist as $key => $ff) { | |||
$offFiles[$ff->filename] = $ff->hash; | |||
} | |||
$alter = ''; | |||
@@ -55,10 +55,10 @@ | |||
<tr> | |||
<td width="160">变量说明</td> | |||
<td width="370"><input type="text" name="varmsg" id="varmsg" class="admin-input-lg"></td> | |||
<td width="160">变量值</td> | |||
<td width="370"><input type="text" name="nvarvalue" id="nvarvalue" class="admin-input-lg"></td> | |||
<td width="160">变量名称</td> | |||
<td><input type="text" name="nvarname" id="nvarname" class="admin-input-lg"></td> | |||
<td width="160">变量值</td> | |||
<td width="370"><input type="text" name="nvarvalue" id="nvarvalue" class="admin-input-lg"></td> | |||
</tr> | |||
<tr> | |||
<td>变量类型</td> | |||
@@ -67,6 +67,7 @@ | |||
<label><input type="radio" name="vartype" value="number"> 数字</label> | |||
<label><input type="radio" name="vartype" value="bool"> 布尔(Y/N)</label> | |||
<label><input type="radio" name="vartype" value="bstring"> 多行文本</label> | |||
<label><input type="radio" name="vartype" value="img"> 图片</label> | |||
</td> | |||
<td>变量所属</td> | |||
<td colspan="4"> | |||
@@ -139,6 +140,13 @@ | |||
echo "<textarea name='edit___{$row['varname']}' id='edit___{$row['varname']}' class='admin-textarea-xl'>".dede_htmlspecialchars($row['value'])."</textarea>"; | |||
} else if ($row['type']=='number') { | |||
echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' class='w-65'>"; | |||
} else if ($row['type']=='img') { | |||
echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' class='w-50'> <input type='button' name='set9' class='btn btn-success btn-sm' onclick="."SelectImage('form1.edit___{$row['varname']}','','idd_{$row['varname']}');"." value='选择'>"; | |||
if ($row['value']) { | |||
echo " <img src=".$row['value']." id='idd_{$row['varname']}' class='thumbnail-md'>"; | |||
} else { | |||
echo " <img src='/static/web/img/thumbnail.jpg' id='idd_{$row['varname']}' class='thumbnail-md'>"; | |||
} | |||
} else { | |||
$addstr=''; | |||
if ($row['varname']=='cfg_cookie_encode') { | |||
@@ -607,6 +607,99 @@ function GetMimeTypeOrExtension($str, $t = 0) { | |||
return "dedebiz"; | |||
} | |||
} | |||
// 用于实际请求接口并返回处理结果 | |||
function DedeSearchDo($action, $parms=array()) { | |||
if ($action === 'update') { | |||
DedeSearchDo('delete', $parms); | |||
return DedeSearchDo('add', $parms); | |||
} | |||
// 生成完整请求 URL | |||
$url = DedeSearchAPIURL($action, $parms); | |||
// 初始化 cURL | |||
$ch = curl_init(); | |||
curl_setopt($ch, CURLOPT_URL, $url); // 设置请求 URL | |||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回结果而不是直接输出 | |||
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 设置超时时间(秒) | |||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // 设置连接超时(秒) | |||
curl_setopt($ch, CURLOPT_USERAGENT, 'DedeSearchAPI/1.0'); // 设置 User-Agent | |||
// 执行请求 | |||
$response = curl_exec($ch); | |||
// 获取 HTTP 状态码和错误信息 | |||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |||
$curlError = curl_error($ch); | |||
// 关闭 cURL 资源 | |||
curl_close($ch); | |||
// 处理 HTTP 错误 | |||
if ($response === false || $httpCode !== 200) { | |||
return array( | |||
'code' => -1, | |||
'message' => $curlError ?: "HTTP Error: $httpCode", | |||
'data' => null, | |||
); | |||
} | |||
// 解析返回的 JSON 数据 | |||
$result = json_decode($response, true); | |||
if (json_last_error() !== JSON_ERROR_NONE) { | |||
return array( | |||
'code' => -2, | |||
'message' => 'Invalid JSON response', | |||
'data' => null, | |||
); | |||
} | |||
// 检查返回的业务逻辑中的 code | |||
if (!isset($result['code']) || $result['code'] !== 0) { | |||
return array( | |||
'code' => $result['code'] ?? -3, | |||
'message' => $result['message'] ?? 'Unknown error', | |||
'data' => null, | |||
); | |||
} | |||
// 返回成功结果 | |||
return array( | |||
'code' => 0, | |||
'message' => 'Success', | |||
'data' => $result['data'] ?? null, | |||
); | |||
} | |||
// 获取接口地址 | |||
function DedeSearchAPIURL($action, $parms=array()) | |||
{ | |||
$baseUrl = DEDEBIZSEARCHHOST."/api/$action"; // 替换为实际的 API 地址 | |||
// 添加公共参数 | |||
$timestamp = time(); // 当前时间戳 | |||
$parms['timestamp'] = $timestamp; | |||
$parms['pageSize'] = isset($parms['pageSize'])? $parms['pageSize']:10; | |||
$parms['page'] = isset($parms['page'])? $parms['page']:1; | |||
$parms['q'] = isset($parms['q'])? $parms['q']:""; | |||
if ($action == "delete" || $action == "add") { | |||
$parms['pageSize'] = 0; | |||
$parms['page'] = 0; | |||
$parms['q'] = isset($parms['id'])? $parms['id']:""; | |||
} | |||
// 生成签名字符串 | |||
$signBaseString = "key=" . DEDEBIZSEARCHKEY . "&q=".$parms['q']. "&pageSize=".$parms['pageSize']. "&page=".$parms['page']. "×tamp=".$parms['timestamp']; | |||
$parms['sign'] = md5($signBaseString); // 使用 MD5 生成签名 | |||
if ($action == "delete" || $action == "add") { | |||
unset($parms['q']); | |||
unset($parms['pageSize']); | |||
unset($parms['page']); | |||
} | |||
// 拼接完整 URL | |||
$finalQueryString = http_build_query($parms); | |||
$finalUrl = $baseUrl . '?' . $finalQueryString; | |||
return $finalUrl; | |||
} | |||
//自定义函数接口 | |||
if (file_exists(DEDEINC.'/extend.func.php')) { | |||
require_once(DEDEINC.'/extend.func.php'); | |||
@@ -51,6 +51,9 @@ PwIDAQAB | |||
-----END PUBLIC KEY----- | |||
');//DedeBIZ系统公钥 | |||
define('DEDECDNURL', 'https://cdn.dedebiz.com');//默认静态资源地址 | |||
define('DEDEBIZSEARCH', FALSE);//是否启用DedeBIZ全文检索服务 | |||
define('DEDEBIZSEARCHHOST', 'http://127.0.0.1:8818');//搜索服务地址 | |||
define('DEDEBIZSEARCHKEY', '设置DedeSearch密钥');//用于进行加密验签 | |||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) { | |||
if (!function_exists('session_register')) { | |||
function session_register() | |||
@@ -169,12 +169,23 @@ if (!function_exists('UpIndexKey')) { | |||
global $dsql, $typeid2; | |||
if (empty($typeid2)) $typeid2 = 0; | |||
$indexedsql = ''; | |||
//商业全文检索组件索引 | |||
if (TableHasField("#@__arctiny", "indexed")) { | |||
$indexedsql = ",`indexed`=2 "; | |||
if ($arcrank == -1) { | |||
//如果内容被改为待审核状态,删除索引 | |||
if ($dsql->IsTable('#@__search_sync')) { | |||
$intime = time(); | |||
$insql = "INSERT INTO `#@__search_sync` (`aid`, `add_at`) VALUES ({$id}, $intime)"; | |||
$dsql->ExecuteNoneQuery($insql); | |||
DedeSearchDo("delete", array("id" => $id)); | |||
} | |||
} else { | |||
//商业全文检索组件索引,更新索引信息 | |||
if (TableHasField("#@__arctiny", "indexed")) { | |||
$indexedsql = ",`indexed`=2 "; | |||
} | |||
$query = "UPDATE `#@__arctiny` SET `arcrank`='$arcrank', `typeid`='$typeid', `typeid2`='$typeid2', `sortrank`='$sortrank'{$indexedsql} WHERE id = '$id' "; | |||
DedeSearchDo("add", array("id" => $id)); | |||
$dsql->ExecuteNoneQuery($query); | |||
} | |||
$query = "UPDATE `#@__arctiny` SET `arcrank`='$arcrank', `typeid`='$typeid', `typeid2`='$typeid2', `sortrank`='$sortrank'{$indexedsql} WHERE id = '$id' "; | |||
$dsql->ExecuteNoneQuery($query); | |||
//处理修改后的tag | |||
if ($tags != '') { | |||
$oldtags = GetTagsArray($id); | |||