if ($kw) { $head_title = $kw . $DT['seo_delimiter'] . $head_title; } $condition = "status>2"; if ($keyword) { $condition .= " AND keyword LIKE '%{$keyword}%'"; } if ($catid) { $condition .= $CAT ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}"; } if ($areaid) { $condition .= $ARE['child'] ? " AND areaid IN (" . $ARE['arrchildid'] . ")" : " AND areaid={$areaid}"; } $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$condition}", 'CACHE'); $items = $r['num']; $pages = wap_pages($items, $page, $pagesize); $lists = array(); if ($items) { $order = $MOD['order']; $time = strpos($MOD['order'], 'add') !== false ? 'addtime' : 'edittime'; $result = $db->query("SELECT " . $MOD['fields'] . " FROM {$table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}"); while ($r = $db->fetch_array($result)) { $r['stitle'] = dsubstr($r['title'], $len); $r['date'] = timetodate($r[$time], 5); $lists[] = $r; } $db->free_result($result); } if ($TP == 'touch') { if ($catid) { $head_link = 'index.php?moduleid=' . $moduleid . '&catid=' . $catid;
} $adddate = timetodate($addtime, 5); $head_title = $title . $DT['seo_delimiter'] . $L['message_title'] . $DT['seo_delimiter'] . $head_title; } else { $TYPE = $L['message_type']; $head_title = $L['message_title'] . $DT['seo_delimiter'] . $head_title; $typeid = isset($typeid) ? intval($typeid) : -1; $condition = "touser='******' AND status=3"; if ($typeid != -1) { $condition .= " AND typeid={$typeid}"; } if ($keyword) { $condition .= " AND title LIKE '%{$keyword}%'"; } $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}message WHERE {$condition}"); $pages = wap_pages($r['num'], $page, $pagesize); $lists = array(); $result = $db->query("SELECT * FROM {$DT_PRE}message WHERE {$condition} ORDER BY itemid DESC LIMIT {$offset},{$pagesize}"); while ($r = $db->fetch_array($result)) { $r['adddate'] = timetodate($r['addtime'], 'm/d H:i'); $r['type'] = $TYPE[$r['typeid']]; $lists[] = $r; } if ($TP == 'touch') { $back_link = 'index.php?moduleid=' . $moduleid; } } include template('message', $TP); break; default: if ($TP == 'touch') {
$_item = $item['item']; unset($item['item']); extract($item); if ($TP == 'touch') { $head_link = 'index.php?action=' . $action; $head_name = $L['wap_about']; $back_link = 'javascript:Dback(\'' . $head_link . '\');'; $pages = ''; } else { $content = strip_tags($content); $content = preg_replace("/\\&([^;]+);/i", '', $content); $contentlength = strlen($content); if ($contentlength > $maxlength) { $start = ($page - 1) * $maxlength; $content = dsubstr($content, $maxlength, '', $start); $pages = wap_pages($contentlength, $page, $maxlength); } $content = nl2br($content); } $editdate = timetodate($edittime, 5); $db->query("UPDATE {$table} SET hits=hits+1 WHERE itemid={$itemid}"); $head_title = $title . $DT['seo_delimiter'] . $L['wap_about'] . $DT['seo_delimiter'] . $head_title; } else { $head_title = $L['wap_about'] . $DT['seo_delimiter'] . $head_title; $lists = array(); $result = $db->query("SELECT * FROM {$table} WHERE item=1 ORDER BY listorder desc,itemid desc"); while ($r = $db->fetch_array($result)) { $r['stitle'] = dsubstr($r['title'], $len); $lists[] = $r; } $db->free_result($result);