| @@ -19,7 +19,7 @@ if (empty($action)) { | |||||
| if (!empty($tag)) $where = " WHERE tag like '%$tag%'"; | if (!empty($tag)) $where = " WHERE tag like '%$tag%'"; | ||||
| else $where = ''; | else $where = ''; | ||||
| $neworderway = ($orderway == 'desc' ? 'asc' : 'desc'); | $neworderway = ($orderway == 'desc' ? 'asc' : 'desc'); | ||||
| $query = "SELECT * FROM `#@__tagindex` $where ORDER BY $orderby $orderway"; | |||||
| $query = "SELECT T.*,TI.* FROM `#@__tagindex` T LEFT JOIN `#@__tagindex_infos` TI ON TI.tagid=T.id $where ORDER BY $orderby $orderway"; | |||||
| $dlist = new DataListCP(); | $dlist = new DataListCP(); | ||||
| $tag = stripslashes($tag); | $tag = stripslashes($tag); | ||||
| $dlist->SetParameter("tag", $tag); | $dlist->SetParameter("tag", $tag); | ||||
| @@ -40,8 +40,15 @@ if (empty($action)) { | |||||
| if (empty($tid)) { | if (empty($tid)) { | ||||
| die('请选择需要更新的标签'); | die('请选择需要更新的标签'); | ||||
| } | } | ||||
| $query = "UPDATE `#@__tagindex` SET `count`='$count',`litpic`='$litpic',`title`='$title',`keywords`='$keywords',`description`='$description' WHERE id='$tid' "; | |||||
| $query = "UPDATE `#@__tagindex` SET `count`='$count',`title`='$title',`keywords`='$keywords',`description`='$description' WHERE id='$tid' "; | |||||
| $dsql->ExecuteNoneQuery($query); | $dsql->ExecuteNoneQuery($query); | ||||
| $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__tagindex_infos` WHERE tagid = $tid"); | |||||
| if ($row['dd'] > 0) { | |||||
| $dsql->ExecuteNoneQuery("UPDATE `#@__tagindex_infos` SET `litpic`=='$litpic'"); | |||||
| } else { | |||||
| $dsql->ExecuteNoneQuery("INSERT INTO `#@__tagindex_infos` (`tagid`,`litpic`) VALUES ('$tid','$litpic')"); | |||||
| } | |||||
| echo "success"; | echo "success"; | ||||
| exit(); | exit(); | ||||
| } else if ($action == 'delete') { | } else if ($action == 'delete') { | ||||
| @@ -57,24 +64,12 @@ if (empty($action)) { | |||||
| if ($dsql->ExecuteNoneQuery($query)) { | if ($dsql->ExecuteNoneQuery($query)) { | ||||
| $query = "DELETE FROM `#@__taglist` WHERE tid IN ($stringids)"; | $query = "DELETE FROM `#@__taglist` WHERE tid IN ($stringids)"; | ||||
| $dsql->ExecuteNoneQuery($query); | $dsql->ExecuteNoneQuery($query); | ||||
| $dsql->ExecuteNoneQuery("DELETE FROM `#@__tagindex_infos` WHERE tagid IN ($stringids)"); | |||||
| ShowMsg("删除[$stringids]标签成功", 'tags_main.php'); | ShowMsg("删除[$stringids]标签成功", 'tags_main.php'); | ||||
| } else { | } else { | ||||
| ShowMsg("删除[$stringids]标签失败", 'tags_main.php'); | ShowMsg("删除[$stringids]标签失败", 'tags_main.php'); | ||||
| } | } | ||||
| exit(); | exit(); | ||||
| } else if ($action == 'get_one') { | |||||
| $tid = (empty($tid) ? 0 : intval($tid)); | |||||
| $row = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id = $tid"); | |||||
| echo json_encode($row); | |||||
| exit; | |||||
| } else if ($action == 'set_one') { | |||||
| $tid = (empty($tid) ? 0 : intval($tid)); | |||||
| $title = empty($title) ? "" : HtmlReplace($title, 0); | |||||
| $kw = empty($kw) ? "" : HtmlReplace($kw, 0); | |||||
| $des = empty($des) ? "" : HtmlReplace($des, 0); | |||||
| $now = time(); | |||||
| $dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET title='{$title}',keywords='{$kw}',`description`='{$des}',`uptime`='{$now}' WHERE id = {$tid}"); | |||||
| echo json_encode(array('code' => 200, 'result' => true)); | |||||
| } else if ($action == 'fetch') { | } else if ($action == 'fetch') { | ||||
| $wheresql = ''; | $wheresql = ''; | ||||
| $start = isset($start) && is_numeric($start) ? $start : 0; | $start = isset($start) && is_numeric($start) ? $start : 0; | ||||
| @@ -28,11 +28,11 @@ | |||||
| <tbody> | <tbody> | ||||
| <tr> | <tr> | ||||
| <td width="260">名称</td> | <td width="260">名称</td> | ||||
| <td><input type="text" name="title" id="title" value="" class="admin-input-lg" required></td> | |||||
| <td><input type="text" name="title" id="title" value="" class="admin-input-lg" placeholder="模型名称,例如:deepseek" required></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>描述</td> | <td>描述</td> | ||||
| <td><textarea name="description" id="description" class="admin-textarea-sm"></textarea></td> | |||||
| <td><textarea name="description" id="description" class="admin-textarea-sm" placeholder="模型介绍信息"></textarea></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>公司名称</td> | <td>公司名称</td> | ||||
| @@ -44,7 +44,7 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>API Key</td> | <td>API Key</td> | ||||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" required></td> | |||||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" placeholder="模型通信密钥" required><a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="text-success">(获取密钥)</a></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>接口地址</td> | <td>接口地址</td> | ||||
| @@ -54,6 +54,7 @@ | |||||
| <td colspan="2" align="center"> | <td colspan="2" align="center"> | ||||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | <button type="submit" class="btn btn-success btn-sm">保存</button> | ||||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | ||||
| <a href="ai_main.php" class="btn btn-outline-success btn-sm">返回</a> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| </tbody> | </tbody> | ||||
| @@ -45,7 +45,7 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>API Key</td> | <td>API Key</td> | ||||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" value="<?php echo $myAI['apikey']?>" required></td> | |||||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" value="<?php echo $myAI['apikey']?>" required><a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="text-success">(获取密钥)</a></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>接口地址</td> | <td>接口地址</td> | ||||
| @@ -88,6 +88,7 @@ | |||||
| <td colspan="2" align="center"> | <td colspan="2" align="center"> | ||||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | <button type="submit" class="btn btn-success btn-sm">保存</button> | ||||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | ||||
| <a href="ai_main.php" class="btn btn-outline-success btn-sm">返回</a> | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| </tbody> | </tbody> | ||||
| @@ -22,6 +22,7 @@ | |||||
| <div class="card-body"> | <div class="card-body"> | ||||
| <a href="ai_add.php" class="btn btn-success btn-sm">添加AI模型</a> | <a href="ai_add.php" class="btn btn-success btn-sm">添加AI模型</a> | ||||
| <a href="ai_model_main.php" class="btn btn-success btn-sm">模型版本</a> | <a href="ai_model_main.php" class="btn btn-success btn-sm">模型版本</a> | ||||
| <a href="https://www.dedebiz.com/help/ai.md" target="_blank" class="btn btn-primary btn-sm">操作说明</a> | |||||
| <a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="btn btn-primary btn-sm">模型优选</a> | <a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="btn btn-primary btn-sm">模型优选</a> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -48,11 +48,11 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td width="260">Model</td> | <td width="260">Model</td> | ||||
| <td><input type="text" name="model" id="model" value="" class="admin-input-lg" required></td> | |||||
| <td><input type="text" name="model" id="model" value="" class="admin-input-lg" placeholder="模型版本名称,例如:deepseek-chat" required><a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="text-success">(获取Model)</a></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>名称</td> | <td>名称</td> | ||||
| <td><input type="text" name="title" id="title" class="admin-input-lg" required></td> | |||||
| <td><input type="text" name="title" id="title" class="admin-input-lg" placeholder="名称,方便显示查看" required></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>排序</td> | <td>排序</td> | ||||
| @@ -35,7 +35,7 @@ | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td width="260">Model</td> | <td width="260">Model</td> | ||||
| <td><input type="text" name="model" id="model" value="<?php echo $myModel['model']?>" class="admin-input-lg" required></td> | |||||
| <td><input type="text" name="model" id="model" value="<?php echo $myModel['model']?>" class="admin-input-lg" required><a href="https://www.dedebiz.com/ai?from=dedebiz#models" target="_blank" class="text-success">(获取Model)</a></td> | |||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>名称</td> | <td>名称</td> | ||||
| @@ -120,7 +120,7 @@ | |||||
| <div class="card-header">自由列表管理</div> | <div class="card-header">自由列表管理</div> | ||||
| <div class="card-body"> | <div class="card-body"> | ||||
| <div id="rslist"><?php GetTagList($dsql,$pageno,$pagesize,$orderby);?></div> | <div id="rslist"><?php GetTagList($dsql,$pageno,$pagesize,$orderby);?></div> | ||||
| <div id="pagelist"></div> | |||||
| <div id="pagelist" class="d-flex justify-content-end"></div> | |||||
| <script>ReloadPageNum(1);</script> | <script>ReloadPageNum(1);</script> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -154,7 +154,7 @@ | |||||
| $addstr='<a href="javascript:resetCookieEncode();" class="btn btn-success btn-sm">更新</a>'; | $addstr='<a href="javascript:resetCookieEncode();" class="btn btn-success btn-sm">更新</a>'; | ||||
| } | } | ||||
| if ($row['varname']=='cfg_ai_server') { | if ($row['varname']=='cfg_ai_server') { | ||||
| $addstr='<a href="javascript:pingAIServer();" class="btn btn-success btn-sm">检测</a>'; | |||||
| $addstr='<a href="javascript:pingAIServer();" class="btn btn-success btn-sm">检测</a><a href="https://www.dedebiz.com/help/ai.md" target="_blank" class="btn btn-outline-success btn-sm"><i class="fa fa-question-circle"></i></a>'; | |||||
| } | } | ||||
| if ($row['varname']=='cfg_ai_apikey') { | if ($row['varname']=='cfg_ai_apikey') { | ||||
| $addstr='<a href="javascript:resetAPIKey();" class="btn btn-success btn-sm">更新</a>'; | $addstr='<a href="javascript:resetAPIKey();" class="btn btn-success btn-sm">更新</a>'; | ||||
| @@ -56,7 +56,7 @@ if (empty($typeid)) { | |||||
| $typeid = intval($typeid); | $typeid = intval($typeid); | ||||
| $keyword = addslashes(cn_substr($keyword, 30)); | $keyword = addslashes(cn_substr($keyword, 30)); | ||||
| $typeid = intval($typeid); | $typeid = intval($typeid); | ||||
| if ($cfg_notallowstr != '' && preg_match("#".$cfg_notallowstr."#i", $keyword)) { | |||||
| if ($keyword != '' && ($cfg_notallowstr != '' && preg_match("#".$cfg_notallowstr."#i", $keyword))) { | |||||
| ShowMsg("关键词中存在非法文档,被系统禁止", "-1"); | ShowMsg("关键词中存在非法文档,被系统禁止", "-1"); | ||||
| exit(); | exit(); | ||||
| } | } | ||||
| @@ -64,10 +64,6 @@ if (($keyword != '' && strlen($keyword) < 2) && empty($typeid)) { | |||||
| ShowMsg('您输入关键词太少了,请重新填写', '-1'); | ShowMsg('您输入关键词太少了,请重新填写', '-1'); | ||||
| exit(); | exit(); | ||||
| } | } | ||||
| if (!preg_match('/^[\x{4e00}-\x{9fa5}]+$/u', $keyword)) { | |||||
| showMsg('您输入关键词不符合,仅支持全中文字符,请重新填写', '-1'); | |||||
| exit(); | |||||
| } | |||||
| //检查搜索间隔时间 | //检查搜索间隔时间 | ||||
| $ip = GetIP(); | $ip = GetIP(); | ||||
| $now = time(); | $now = time(); | ||||
| @@ -968,7 +968,6 @@ CREATE TABLE `#@__tagindex` ( | |||||
| `id` int(10) NOT NULL AUTO_INCREMENT, | `id` int(10) NOT NULL AUTO_INCREMENT, | ||||
| `tag` varchar(255) NOT NULL DEFAULT '', | `tag` varchar(255) NOT NULL DEFAULT '', | ||||
| `title` varchar(255) DEFAULT NULL, | `title` varchar(255) DEFAULT NULL, | ||||
| `litpic` varchar(255) DEFAULT NULL, | |||||
| `keywords` varchar(255) DEFAULT NULL, | `keywords` varchar(255) DEFAULT NULL, | ||||
| `description` varchar(255) DEFAULT NULL, | `description` varchar(255) DEFAULT NULL, | ||||
| `typeid` smallint(5) UNSIGNED NOT NULL DEFAULT '0', | `typeid` smallint(5) UNSIGNED NOT NULL DEFAULT '0', | ||||
| @@ -984,6 +983,14 @@ CREATE TABLE `#@__tagindex` ( | |||||
| PRIMARY KEY (`id`) | PRIMARY KEY (`id`) | ||||
| ) TYPE=MyISAM; | ) TYPE=MyISAM; | ||||
| DROP TABLE IF EXISTS `#@__tagindex_infos`; | |||||
| CREATE TABLE `#@__tagindex_infos` ( | |||||
| `tagid` int NOT NULL, | |||||
| `litpic` varchar(255) DEFAULT NULL, | |||||
| `body` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci, | |||||
| PRIMARY KEY (`tagid`) | |||||
| ) TYPE=MyISAM; | |||||
| DROP TABLE IF EXISTS `#@__taglist`; | DROP TABLE IF EXISTS `#@__taglist`; | ||||
| CREATE TABLE `#@__taglist` ( | CREATE TABLE `#@__taglist` ( | ||||
| `tid` int(10) unsigned NOT NULL default '0', | `tid` int(10) unsigned NOT NULL default '0', | ||||
| @@ -637,6 +637,10 @@ body.menu-show .admin-content { | |||||
| max-width:80px; | max-width:80px; | ||||
| max-height:80px | max-height:80px | ||||
| } | } | ||||
| .thumbnail-mini { | |||||
| max-width:32px; | |||||
| max-height:32px | |||||
| } | |||||
| .admin-win { | .admin-win { | ||||
| background:var(--bg); | background:var(--bg); | ||||
| border:1px solid var(--gray-300)!important | border:1px solid var(--gray-300)!important | ||||
| @@ -655,6 +659,10 @@ body.menu-show .admin-content { | |||||
| width:100%; | width:100%; | ||||
| height:90px!important | height:90px!important | ||||
| } | } | ||||
| .admin-textarea-mini { | |||||
| width:190px; | |||||
| height:40px | |||||
| } | |||||
| .admin-textarea-sm { | .admin-textarea-sm { | ||||
| width:350px; | width:350px; | ||||
| height:60px | height:60px | ||||
| @@ -65,9 +65,10 @@ class TagList | |||||
| exit(); | exit(); | ||||
| } | } | ||||
| $this->Fields['title'] = empty($this->TagInfos['title']) ? $this->TagInfos['tag'] : $this->TagInfos['title']; | $this->Fields['title'] = empty($this->TagInfos['title']) ? $this->TagInfos['tag'] : $this->TagInfos['title']; | ||||
| $this->Fields['litpic'] = empty($this->TagInfos['litpic']) ? $this->TagInfos['litpic'] : $this->TagInfos['litpic']; | |||||
| $this->Fields['keywords'] = empty($this->TagInfos['keywords']) ? $this->Fields['keywords'] : $this->TagInfos['keywords']; | $this->Fields['keywords'] = empty($this->TagInfos['keywords']) ? $this->Fields['keywords'] : $this->TagInfos['keywords']; | ||||
| $this->Fields['description'] = empty($this->TagInfos['description']) ? $this->Fields['description'] : $this->TagInfos['description']; | $this->Fields['description'] = empty($this->TagInfos['description']) ? $this->Fields['description'] : $this->TagInfos['description']; | ||||
| $addInfos = $this->dsql->GetOne("SELECT * FROM `#@__tagindex_infos` WHERE tagid='{$this->Tag}' "); | |||||
| $this->Fields['litpic'] = empty($addInfos['litpic']) ? $addInfos['litpic'] : $addInfos['litpic']; | |||||
| } | } | ||||
| //初始化模板 | //初始化模板 | ||||
| $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style'].'/'.$this->Templet; | $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style'].'/'.$this->Templet; | ||||
| @@ -105,6 +105,10 @@ class DataListCP | |||||
| } | } | ||||
| $this->pageNO = $pageno; | $this->pageNO = $pageno; | ||||
| $this->totalResult = $totalresult; | $this->totalResult = $totalresult; | ||||
| if (isset($GLOBALS['pagesize'])) { | |||||
| $this->pagesize = $GLOBALS['pagesize']; | |||||
| $this->SetParameter('pagesize', $this->pagesize); | |||||
| } | |||||
| if (isset($this->tpl->tpCfgs['pagesize'])) { | if (isset($this->tpl->tpCfgs['pagesize'])) { | ||||
| $this->pagesize = $this->tpl->tpCfgs['pagesize']; | $this->pagesize = $this->tpl->tpCfgs['pagesize']; | ||||
| } | } | ||||
| @@ -178,19 +182,19 @@ class DataListCP | |||||
| $prepagenum = $this->pageNO - 1; | $prepagenum = $this->pageNO - 1; | ||||
| $nextpagenum = $this->pageNO + 1; | $nextpagenum = $this->pageNO + 1; | ||||
| if (!isset($atts['listsize']) || preg_match("#[^0-9]#", $atts['listsize'])) { | if (!isset($atts['listsize']) || preg_match("#[^0-9]#", $atts['listsize'])) { | ||||
| $atts['listsize'] = 5; | |||||
| $atts['listsize'] = 6; | |||||
| } | } | ||||
| if (!isset($atts['listitem'])) { | if (!isset($atts['listitem'])) { | ||||
| $atts['listitem'] = "info,index,end,pre,next,pageno"; | |||||
| $atts['listitem'] = "pagesize,info,index,end,pre,next,pageno,form"; | |||||
| } | } | ||||
| $totalpage = ceil($this->totalResult / $this->pagesize); | $totalpage = ceil($this->totalResult / $this->pagesize); | ||||
| //echo " {$totalpage}=={$this->totalResult}=={$this->pagesize}"; | //echo " {$totalpage}=={$this->totalResult}=={$this->pagesize}"; | ||||
| //无结果或只有一页的情况 | //无结果或只有一页的情况 | ||||
| if ($totalpage <= 1 && $this->totalResult > 0) { | if ($totalpage <= 1 && $this->totalResult > 0) { | ||||
| return "<ul class='pagination justify-content-center'><li class='page-item disabled'><span class='page-link'>1{$lang_page}".$this->totalResult.$lang_record_number."</span></li></ul>"; | |||||
| return "<ul class='pagination justify-content-end'><li class='page-item disabled'><span class='page-link'>1{$lang_page}".$this->totalResult.$lang_record_number."</span></li></ul>"; | |||||
| } | } | ||||
| if ($this->totalResult == 0) { | if ($this->totalResult == 0) { | ||||
| return "<ul class='pagination justify-content-center'><li class='page-item disabled'><span class='page-link'>0{$lang_page}".$this->totalResult.$lang_record_number."</span></li></ul>"; | |||||
| return "<ul class='pagination justify-content-end'><li class='page-item disabled'><span class='page-link'>0{$lang_page}".$this->totalResult.$lang_record_number."</span></li></ul>"; | |||||
| } | } | ||||
| $infos = "<li class='page-item disabled'><span class='page-link'>{$totalpage}{$lang_page}/{$this->totalResult}{$lang_record_number}</span></li>"; | $infos = "<li class='page-item disabled'><span class='page-link'>{$totalpage}{$lang_page}/{$this->totalResult}{$lang_record_number}</span></li>"; | ||||
| if ($this->totalResult != 0) { | if ($this->totalResult != 0) { | ||||
| @@ -200,22 +204,22 @@ class DataListCP | |||||
| foreach ($this->getValues as $key => $value) { | foreach ($this->getValues as $key => $value) { | ||||
| $value = urlencode($value); | $value = urlencode($value); | ||||
| $geturl .= "$key=$value"."&"; | $geturl .= "$key=$value"."&"; | ||||
| $hidenform .= "<input type='hidden' name='$key' value='$value' />\n"; | |||||
| $hidenform .= "<input type='hidden' name='$key' value='$value'>\r\n"; | |||||
| } | } | ||||
| } | } | ||||
| $purl .= "?".$geturl; | $purl .= "?".$geturl; | ||||
| //获得上页和下页的链接 | //获得上页和下页的链接 | ||||
| if ($this->pageNO != 1) { | if ($this->pageNO != 1) { | ||||
| $prepage .= "<li class='page-item'><a class='page-link' href='".$purl."pageno=$prepagenum'>$lang_pre_page</a></li> \n"; | |||||
| $indexpage = "<li class='page-item'><a class='page-link' href='".$purl."pageno=1'>$lang_index_page</a></li> \n"; | |||||
| $prepage .= "<li class='page-item'><a class='page-link' href='".$purl."pageno=$prepagenum'>$lang_pre_page</a></li>\r\n"; | |||||
| $indexpage = "<li class='page-item'><a class='page-link' href='".$purl."pageno=1'>$lang_index_page</a></li>\r\n"; | |||||
| } else { | } else { | ||||
| $indexpage = "<li class='page-item disabled'><span class='page-link'>"."$lang_index_page \n"."</span></li>"; | $indexpage = "<li class='page-item disabled'><span class='page-link'>"."$lang_index_page \n"."</span></li>"; | ||||
| } | } | ||||
| if ($this->pageNO != $totalpage && $totalpage > 1) { | if ($this->pageNO != $totalpage && $totalpage > 1) { | ||||
| $nextpage .= "<li class='page-item'><a class='page-link' href='".$purl."pageno=$nextpagenum'>$lang_next_page</a></li> \n"; | |||||
| $endpage = "<li class='page-item'><a class='page-link' href='".$purl."pageno=$totalpage'>$lang_end_page</a></li> \n"; | |||||
| $nextpage .= "<li class='page-item'><a class='page-link' href='".$purl."pageno=$nextpagenum'>$lang_next_page</a></li>\r\n"; | |||||
| $endpage = "<li class='page-item'><a class='page-link' href='".$purl."pageno=$totalpage'>$lang_end_page</a></li>\r\n"; | |||||
| } else { | } else { | ||||
| $endpage = " <li class='page-item disabled'><span class='page-link'>$lang_end_page</span></li> \n"; | |||||
| $endpage = " <li class='page-item disabled'><span class='page-link'>$lang_end_page</span></li>\r\n"; | |||||
| } | } | ||||
| //获得数字链接 | //获得数字链接 | ||||
| $listdd = ''; | $listdd = ''; | ||||
| @@ -233,10 +237,19 @@ class DataListCP | |||||
| } | } | ||||
| } | } | ||||
| for ($j; $j <= $total_list; $j++) { | for ($j; $j <= $total_list; $j++) { | ||||
| $listdd .= $j == $this->pageNO ? "<li class='page-item'><span class='page-link'>$j</span></li>\r\n" : "<li class='page-item'><a class='page-link' href='".$purl."pageno=$j'>".$j."</a></li>\n"; | |||||
| $listdd .= $j == $this->pageNO ? "<li class='page-item'><span class='page-link'>$j</span></li>\r\n" : "<li class='page-item'><a class='page-link' href='".$purl."pageno=$j'>".$j."</a></li>\r\n"; | |||||
| } | |||||
| $plist = "<div class='d-flex justify-content-end'>\r\n"; | |||||
| $sizesel = "<select name='pagesize' id='dedepagesize' class='form-control mr-2' style='width:100px'>\r\n"; | |||||
| $sizesel .= "<option value='30' ".($this->pagesize == 30 ? "selected='selected'" : "").">30条/页</option>\r\n"; | |||||
| $sizesel .= "<option value='50' ".($this->pagesize == 50 ? "selected='selected'" : "").">50条/页</option>\r\n"; | |||||
| $sizesel .= "<option value='100' ".($this->pagesize == 100 ? "selected='selected'" : "").">100条/页</option>\r\n"; | |||||
| $sizesel .= "<option value='500' ".($this->pagesize == 500 ? "selected='selected'" : "").">500条/页</option>\r\n"; | |||||
| $sizesel .= "<option value='1000' ".($this->pagesize == 1000 ? "selected='selected'" : "").">1000条/页</option>\r\n"; | |||||
| $sizesel .= "</select><script>document.addEventListener('DOMContentLoaded', function() {var selectElement = document.getElementById('dedepagesize');selectElement.addEventListener('change', function() {var selectedSize = this.value;var url = new URL(window.location.href);url.searchParams.set('pagesize', selectedSize);window.location.href = url.toString();});});</script><ul class='pagination'>\r\n"; | |||||
| if (preg_match("#pagesize#i", $atts['listitem'])) { | |||||
| $plist .= $sizesel; | |||||
| } | } | ||||
| $plist = "<ul class='pagination justify-content-center'>\n"; | |||||
| //info,index,end,pre,next,pageno,form | |||||
| if (preg_match("#info#i", $atts['listitem'])) { | if (preg_match("#info#i", $atts['listitem'])) { | ||||
| $plist .= $infos; | $plist .= $infos; | ||||
| } | } | ||||
| @@ -256,14 +269,14 @@ class DataListCP | |||||
| $plist .= $endpage; | $plist .= $endpage; | ||||
| } | } | ||||
| if (preg_match("#form#i", $atts['listitem'])) { | if (preg_match("#form#i", $atts['listitem'])) { | ||||
| $plist .= " <form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform"; | |||||
| $plist .= "</ul><form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform"; | |||||
| if ($totalpage > $total_list) { | if ($totalpage > $total_list) { | ||||
| $plist .= "<input type='text' name='pageno'>\r\n"; | |||||
| $plist .= "<input type='submit' name='plistgo' value='GO'>\r\n"; | |||||
| $plist .= "<input type='text' name='pageno' class='form-control admin-input-xs ml-2' placeholder='页数'>\r\n"; | |||||
| $plist .= "<button type='submit' name='plistgo' class='btn btn-success btn-sm'>跳转</button>\r\n"; | |||||
| } | } | ||||
| $plist .= "</form>\n"; | |||||
| $plist .= "</form>\r\n"; | |||||
| } | } | ||||
| $plist .= "</ul>\n"; | |||||
| $plist .= "</div>\r\n"; | |||||
| return $plist; | return $plist; | ||||
| } | } | ||||
| //获得当前网址 | //获得当前网址 | ||||