5-6-1
完成搜尋功能
您沒有觀看影片的權限
請先登入,登入後,確認您的權限後,即可觀看影片。
- 這個搜尋,指的是站內搜尋。
- 修改
xoops_version.php
//---搜尋---//
$modversion['hasSearch'] = 1;
$modversion['search'] = ['file' => 'include/search.php', 'func' => 'tad_signup_search'];
- 編輯
include\search.php
,然後開始取代即可
<?php
//搜尋程式
function tad_signup_search($queryarray, $andor, $limit, $offset, $userid)
{
global $xoopsDB;
if (get_magic_quotes_gpc()) {
foreach ($queryarray as $k => $v) {
$arr[$k] = addslashes($v);
}
$queryarray = $arr;
}
$sql = "SELECT `id`,`title`,`action_date`, `uid` FROM " . $xoopsDB->prefix("tad_signup_actions") . " WHERE 1";
if ($userid != 0) {
$sql .= " AND uid=" . $userid . " ";
}
if (is_array($queryarray) && $count = count($queryarray)) {
$sql .= " AND ((`title` LIKE '%{$queryarray[0]}%' OR `detail` LIKE '%{$queryarray[0]}%' )";
for ($i = 1; $i < $count; $i++) {
$sql .= " $andor ";
$sql .= "(`title` LIKE '%{$queryarray[$i]}%' OR `detail` LIKE '%{$queryarray[$i]}%' )";
}
$sql .= ") ";
}
$sql .= "ORDER BY `action_date` DESC";
$result = $xoopsDB->query($sql, $limit, $offset);
$ret = array();
$i = 0;
while ($myrow = $xoopsDB->fetchArray($result)) {
$ret[$i]['image'] = "images/signup.png";
$ret[$i]['link'] = "index.php?id=" . $myrow['id'];
$ret[$i]['title'] = $myrow['title'];
$ret[$i]['time'] = strtotime($myrow['action_date']);
$ret[$i]['uid'] = $myrow['uid'];
$i++;
}
return $ret;
}
- 加入小圖示(16x16)可至 https://www.flaticon.com/ 下載
- 最後更新模組即可
link to https://github.com/tadlearn/tad_signup/commit/cc3592c1295735d0e40b06c9246dec981f37d5bd \