本文整理汇总了PHP中dsubstr函数的典型用法代码示例。如果您正苦于以下问题:PHP dsubstr函数的具体用法?PHP dsubstr怎么用?PHP dsubstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dsubstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dsubstr
function dsubstr($string, $length, $suffix = '', $start = 0)
{
if ($start) {
$tmp = dsubstr($string, $start);
$string = substr($string, strlen($tmp));
}
$strlen = strlen($string);
if ($strlen <= $length) {
return $string;
}
$string = str_replace(array('"', '<', '>'), array('"', '<', '>'), $string);
$length = $length - strlen($suffix);
$str = '';
if (strtolower(DT_CHARSET) == 'utf-8') {
$n = $tn = $noc = 0;
while ($n < $strlen) {
$t = ord($string[$n]);
if ($t == 9 || $t == 10 || 32 <= $t && $t <= 126) {
$tn = 1;
$n++;
$noc++;
} elseif (194 <= $t && $t <= 223) {
$tn = 2;
$n += 2;
$noc += 2;
} elseif (224 <= $t && $t <= 239) {
$tn = 3;
$n += 3;
$noc += 2;
} elseif (240 <= $t && $t <= 247) {
$tn = 4;
$n += 4;
$noc += 2;
} elseif (248 <= $t && $t <= 251) {
$tn = 5;
$n += 5;
$noc += 2;
} elseif ($t == 252 || $t == 253) {
$tn = 6;
$n += 6;
$noc += 2;
} else {
$n++;
}
if ($noc >= $length) {
break;
}
}
if ($noc > $length) {
$n -= $tn;
}
$str = substr($string, 0, $n);
} else {
for ($i = 0; $i < $length; $i++) {
$str .= ord($string[$i]) > 127 ? $string[$i] . $string[++$i] : $string[$i];
}
}
$str = str_replace(array('"', '<', '>'), array('"', '<', '>'), $str);
return $str == $string ? $str : $str . $suffix;
}
示例2: set
function set($post)
{
global $DT_TIME, $_username, $DT_IP, $TYPE;
$post['content'] = strip_tags($post['content']);
$post['title'] = in_array($post['type'], $TYPE) ? '[' . $post['type'] . ']' : '';
$post['title'] .= dsubstr($post['content'], 30);
$post['title'] = daddslashes($post['title']);
$post['hidden'] = isset($post['hidden']) ? 1 : 0;
if ($this->itemid) {
$post['status'] = $post['status'] == 2 ? 2 : 3;
$post['editor'] = $_username;
$post['edittime'] = $DT_TIME;
} else {
$post['username'] = $_username;
$post['addtime'] = $DT_TIME;
$post['ip'] = $DT_IP;
$post['edittime'] = 0;
$post['reply'] = '';
$post['status'] = 2;
}
$post = dhtmlspecialchars($post);
return array_map("trim", $post);
}
示例3: defined
<?php
defined('IN_DESTOON') or exit('Access Denied');
$content_table = content_table(4, $userid, is_file(DT_CACHE . '/4.part'), $DT_PRE . 'company_data');
$r = $db->get_one("SELECT content FROM {$content_table} WHERE userid={$userid}");
$COM['content'] = $r['content'];
$intro_length = isset($HOME['intro_length']) && $HOME['intro_length'] ? intval($HOME['intro_length']) : 1000;
$COM['intro'] = nl2br(dsubstr(trim(strip_tags($r['content'])), $intro_length, '...'));
$COM['thumb'] = $COM['thumb'] ? $COM['thumb'] : DT_SKIN . 'image/company.jpg';
if ($COMGROUP['main_d']) {
$_main_show = array();
foreach ($HMAIN as $k => $v) {
$_main_show[$k] = strpos(',' . $COMGROUP['main_d'] . ',', ',' . $k . ',') !== false ? 1 : 0;
}
$_main_show = implode(',', $_main_show);
} else {
$_main_show = '1,1,1,0,0,0,0';
}
$_main_order = '0,10,20,30,40,50,60,70';
$_main_num = '10,1,10,5,3,4,4,10';
$_main_file = implode(',', $IFILE);
$_main_name = implode(',', $HMAIN);
$main_show = explode(',', isset($HOME['main_show']) ? $HOME['main_show'] : $_main_show);
$main_order = explode(',', isset($HOME['main_order']) ? $HOME['main_order'] : $_main_order);
$main_num = explode(',', isset($HOME['main_num']) ? $HOME['main_num'] : $_main_num);
$main_file = explode(',', isset($HOME['main_file']) ? $HOME['main_file'] : $_main_file);
$main_name = explode(',', isset($HOME['main_name']) ? $HOME['main_name'] : $_main_name);
$_HMAIN = array();
asort($main_order);
foreach ($main_order as $k => $v) {
if ($main_show[$k] && in_array($main_file[$k], $IFILE)) {
示例4: defined
<?php
defined('IN_DESTOON') or exit('Access Denied');
if ($DT_BOT) {
dhttp(403);
}
require DT_ROOT . '/module/' . $module . '/common.inc.php';
check_group($_groupid, $MOD['group_compare']) or dalert(lang('message->without_permission'), 'goback');
$DT_URL = $DT_REF;
$itemid && is_array($itemid) or dalert($L['compare_choose'], 'goback');
$itemid = array_unique($itemid);
$item_nums = count($itemid);
$item_nums < 9 or dalert($L['compare_max'], 'goback');
$item_nums > 1 or dalert($L['compare_min'], 'goback');
$itemid = implode(',', $itemid);
$tags = array();
$result = $db->query("SELECT * FROM {$table} WHERE itemid IN ({$itemid}) ORDER BY addtime DESC");
while ($r = $db->fetch_array($result)) {
if ($r['status'] != 3) {
continue;
}
$r['editdate'] = timetodate($r['edittime'], 3);
$r['adddate'] = timetodate($r['addtime'], 3);
$r['stitle'] = dsubstr($r['title'], 30);
$r['stitle'] = set_style($r['stitle'], $r['style']);
$r['userurl'] = userurl($r['username']);
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$tags[] = $r;
}
$head_title = $L['compare_title'] . $DT['seo_delimiter'] . $MOD['name'];
include template($MOD['template_compare'] ? $MOD['template_compare'] : 'compare', $module);
示例5: implode
$t2['itemid'] = $t1[0];
$t2['s1'] = $t1[1];
$t2['s2'] = $t1[2];
$t2['s3'] = $t1[3];
$datas[$v1] = $t2;
}
}
if ($_ids) {
$itemids = implode(',', $_ids);
$result = $db->query("SELECT * FROM {$table} WHERE itemid IN ({$itemids})");
while ($r = $db->fetch_array($result)) {
if ($r['username'] == $_username || $r['status'] != 3) {
continue;
}
$r['alt'] = $r['title'];
$r['title'] = dsubstr($r['title'], 40, '..');
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$r['p1'] = get_nv($r['n1'], $r['v1']);
$r['p2'] = get_nv($r['n2'], $r['v2']);
$r['p3'] = get_nv($r['n3'], $r['v3']);
$price += $r['price'];
$total++;
$_tags[$r['itemid']] = $r;
}
foreach ($datas as $k => $v) {
if (isset($_tags[$v['itemid']])) {
$t = $_tags[$v['itemid']];
$t['key'] = $k;
$t['s1'] = $v['s1'];
$t['s2'] = $v['s2'];
$t['s3'] = $v['s3'];
示例6: listpages
$topage = $fid + $num - 1;
$total = $topage < $total ? $topage : $total;
}
for (; $page <= $total; $page++) {
$offset = ($page - 1) * $pagesize;
$pages = listpages($CAT, $items, $page, $pagesize);
$tags = array();
$result = $db->query("SELECT " . $MOD['fields'] . " FROM {$table} WHERE {$condition} ORDER BY " . $MOD['order'] . " LIMIT {$offset},{$pagesize}");
while ($r = $db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
if ($lazy && isset($r['thumb']) && $r['thumb']) {
$r['thumb'] = DT_SKIN . 'image/lazy.gif" original="' . $r['thumb'];
}
$r['alt'] = $r['title'];
$r['title'] = set_style(dsubstr($r['title'], 20, '..'), $r['style']);
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$tags[] = $r;
}
$seo_file = 'list';
include DT_ROOT . '/include/seo.inc.php';
$destoon_task = "moduleid={$moduleid}&html=list&catid={$catid}&page={$page}";
if ($EXT['wap_enable']) {
$head_mobile = $EXT['wap_url'] . 'index.php?moduleid=' . $moduleid . '&catid=' . $catid . ($page > 1 ? '&page=' . $page : '');
}
$filename = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl($CAT, $page);
ob_start();
include template($template, $module);
$data = ob_get_contents();
ob_clean();
if ($DT['pcharset']) {
示例7: tag
//.........这里部分代码省略.........
} else {
if ($areachild) {
$areaids = '';
$result = $db->query("SELECT arrchildid FROM {$db->pre}area WHERE areaid IN ({$areaid})");
while ($r = $db->fetch_array($result)) {
$areaids .= ',' . $r['arrchildid'];
}
if ($areaids) {
$areaid = substr($areaids, 1);
}
}
$condition .= " AND areaid IN ({$areaid})";
}
}
$table = isset($table) ? $prefix . $table : get_table($moduleid);
$offset or $offset = ($page - 1) * $pagesize;
$percent = dround(100 / $cols) . '%';
$num = 0;
$order = $order ? ' ORDER BY ' . $order : '';
$condition = stripslashes($condition);
$condition = str_replace('##', '%', $condition);
if ($showpage) {
$num = $db->count($table, $condition, $tag_expires ? $tag_expires : $CFG['db_expires']);
$pages = $catid ? listpages(get_cat($catid), $num, $page, $pagesize) : pages($num, $page, $pagesize);
} else {
if ($group) {
$condition .= ' GROUP BY ' . $group;
}
}
if ($page < 2 && strpos($parameter, '&page=') !== false) {
$db_cache = 'CACHE';
$tag_expires = $CFG['tag_expires'];
}
if ($template == 'null') {
$db_cache = 'CACHE';
}
$query = "SELECT " . $fields . " FROM " . $table . " WHERE " . $condition . $order . " LIMIT " . $offset . "," . $pagesize;
if ($debug) {
echo $parameter . '<br/>' . $query . '<br/>';
}
$tags = $catids = $CATS = array();
$result = $db->query($query, $db_cache, $tag_expires);
while ($r = $db->fetch_array($result)) {
if ($moduleid == 4 && isset($r['company'])) {
$r['alt'] = $r['companyname'] = $r['company'];
if ($length) {
$r['company'] = dsubstr($r['company'], $length);
}
}
if (isset($r['title'])) {
$r['title'] = str_replace('"', '"', trim($r['title']));
$r['alt'] = $r['title'];
if ($length) {
$r['title'] = dsubstr($r['title'], $length);
}
if (isset($r['style']) && $r['style']) {
$r['title'] = set_style($r['title'], $r['style']);
}
}
if ($lazy && isset($r['thumb']) && $r['thumb']) {
$r['thumb'] = DT_SKIN . 'image/lazy.gif" class="lazy" original="' . $r['thumb'];
}
if (isset($r['introduce']) && $introduce) {
$r['introduce'] = dsubstr($r['introduce'], $introduce);
}
if (isset($r['linkurl']) && $r['linkurl'] && $moduleid > 4 && strpos($r['linkurl'], '://') === false) {
$r['linkurl'] = $MODULE[$moduleid]['linkurl'] . $r['linkurl'];
}
if ($showcat && $moduleid > 4 && isset($r['catid'])) {
$catids[$r['catid']] = $r['catid'];
}
$tags[] = $r;
}
$db->free_result($result);
if ($showcat && $moduleid > 4 && $catids) {
$result = $db->query("SELECT catid,catname,linkurl FROM {$db->pre}category WHERE catid IN (" . implode(',', $catids) . ")");
while ($r = $db->fetch_array($result)) {
$CATS[$r['catid']] = $r;
}
if ($CATS) {
foreach ($tags as $k => $v) {
$tags[$k]['catname'] = $v['catid'] ? $CATS[$v['catid']]['catname'] : '';
$tags[$k]['caturl'] = $v['catid'] ? $MODULE[$moduleid]['linkurl'] . $CATS[$v['catid']]['linkurl'] : '';
}
}
}
if ($template == 'null') {
return $tags;
}
if ($tag_cache) {
ob_start();
include template($template, $dir);
$contents = ob_get_contents();
ob_clean();
file_put($TCF, '<!--' . ($DT_TIME + $tag_expires) . '-->' . $contents);
echo $contents;
} else {
include template($template, $dir);
}
}
示例8: pages
$pages = pages($items, $page, $pagesize);
if ($items) {
$order = $dorder[$order] ? " ORDER BY {$dorder[$order]}" : '';
$result = $db->query("SELECT {$fds} FROM {$table} WHERE {$condition}{$order} LIMIT {$offset},{$pagesize}", $DT['cache_search'] && $page == 1 ? 'CACHE' : '', $DT['cache_search']);
if ($kw) {
$replacef = explode(' ', $kw);
$replacet = array_map('highlight', $replacef);
}
while ($r = $db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['editdate'] = timetodate($r['edittime'], 5);
if ($lazy && isset($r['thumb']) && $r['thumb']) {
$r['thumb'] = DT_SKIN . 'image/lazy.gif" original="' . $r['thumb'];
}
$r['alt'] = $r['title'];
$r['title'] = dsubstr($r['title'], 20);
$r['title'] = set_style($r['title'], $r['style']);
if ($kw) {
$r['title'] = str_replace($replacef, $replacet, $r['title']);
}
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$tags[] = $r;
}
$db->free_result($result);
if ($page == 1 && $kw) {
keyword($kw, $items, $moduleid);
}
}
}
$showpage = 1;
$datetype = 3;
示例9: message
$item['username'] or message($L['com_not_member']);
$_username != $item['username'] or message($L['send_self']);
$app = $db->get_one("SELECT * FROM {$DT_PRE}job_apply WHERE jobid={$itemid} AND apply_username='{$_username}'");
if ($app) {
message($L['apply_again']);
}
$linkurl = $MOD['linkurl'] . $item['linkurl'];
if ($submit) {
$resumeid = intval($resumeid);
$resumeid or dheader($linkurl);
$resume = $db->get_one("SELECT * FROM {$DT_PRE}resume WHERE itemid={$resumeid} AND status=3 AND open=3 AND username='{$_username}'");
$resume or message($L['not_resume'], $linkurl);
$db->query("INSERT INTO {$DT_PRE}job_apply (jobid,resumeid,job_username,apply_username,applytime,status) VALUES ('{$itemid}','{$resumeid}','{$item['username']}','{$_username}','{$DT_TIME}','1')");
$db->query("UPDATE {$DT_PRE}job SET apply=apply+1 WHERE itemid={$itemid}");
$resumeurl = $MOD['linkurl'] . $resume['linkurl'];
send_message($item['username'], lang($L['apply_msg_title'], array(dsubstr($item['title'], 20, '...'))), lang($L['apply_msg_content'], array($resumeurl)));
message($L['apply_success'], $linkurl);
} else {
$lists = array();
$result = $db->query("SELECT * FROM {$DT_PRE}resume WHERE username='{$_username}' AND status=3 AND open=3 ORDER BY edittime DESC");
while ($r = $db->fetch_array($result)) {
$r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
$lists[] = $r;
}
if ($lists) {
$head_title = $L['apply_title'] . $DT['seo_delimiter'] . $item['title'] . $DT['seo_delimiter'] . $MOD['name'];
include template('apply', $module);
} else {
message($L['make_resume'], $MODULE[2]['linkurl'] . $DT['file_my'] . '?resume=1&action=add&mid=' . $moduleid);
}
}
示例10: userinfo
$content .= '如果您对此操作有异议,请及时与网站联系。<br/>';
$user = userinfo($td['buyer']);
if ($msg) {
send_message($user['username'], $subject, $content);
}
if ($eml) {
send_mail($user['email'], $subject, $content);
}
if ($sms) {
send_sms($user['mobile'], $subject . $DT['sms_sign']);
}
if ($wec) {
send_weixin($user['username'], $subject);
}
$result = $status == 5 ? '已经退款给买家' : '未退款给买家,交易成功';
$subject = '您的[团购订单]' . dsubstr($td['title'], 30, '...') . '(单号:' . $td['itemid'] . ')' . $result;
$content = '尊敬的会员:<br/>您的[团购订单]' . $td['title'] . '(单号:' . $td['itemid'] . ')' . $result . '!<br/>';
if ($reason) {
$content .= '操作原因:<br/>' . $reason . '<br/>';
}
$content .= '请点击下面的链接查看订单详情:<br/>';
$content .= '<a href="' . $linkurl . '" target="_blank">' . $linkurl . '</a><br/>';
$content .= '如果您对此操作有异议,请及时与网站联系。<br/>';
$user = userinfo($td['seller']);
if ($msg) {
send_message($user['username'], $subject, $content);
}
if ($eml) {
send_mail($user['email'], $subject, $content);
}
if ($sms) {
示例11: isset
$level = isset($level) ? intval($level) : 0;
in_array($level, array(0, 1, 2, 3)) or message($L['my_manage_not_level']);
$content = $level;
if ($reason == $L['my_manage_reason']) {
$reason = '';
}
$reason = dhtmlspecialchars($reason);
$message = isset($message) ? 1 : 0;
foreach ($itemid as $tid) {
$T = $db->get_one("SELECT * FROM {$table} WHERE itemid={$tid}");
if (!$T || $T['status'] != 3 || $T['gid'] != $gid || $T['level'] == $level) {
continue;
}
$db->query("UPDATE {$table} SET level={$level} WHERE itemid={$tid}");
if ($message) {
send_message($T['username'], lang($L['manage_msg_title'], array($L['my_manage_type_post'], dsubstr($T['title'], 20, '...'), $level ? $L['my_manage_type_level'] : $L['my_manage_type_level_cancel'])), lang($L['manage_msg_content'], array($MOD['linkurl'] . $T['linkurl'], nl2br($reason), $_username)));
}
$title = addslashes($T['title']);
$db->query("INSERT INTO {$table}_manage (gid,tid,username,addtime,typeid,title,content,reason,message) VALUES ('{$gid}','{$tid}','{$_username}','{$DT_TIME}','3','{$title}','{$content}','{$reason}','{$message}')");
if ($MOD['show_html']) {
tohtml('show', $module, "itemid={$tid}");
}
}
dmsg($level ? $L['post_success_level'] : $L['post_cancel_level'], $forward);
break;
case 'post':
require MD_ROOT . '/club.class.php';
$do = new club($moduleid);
$sfields = $L['my_fields_post'];
$dfields = array('keyword', 'title', 'username');
isset($fields) && isset($dfields[$fields]) or $fields = 0;
示例12: VALUES
$db->query("INSERT INTO {$table}_answer (qid,linkurl,content,username,expert,addtime,ip,status,hidden) VALUES ('{$itemid}','{$url}','{$content}','{$_username}','{$expert}','{$DT_TIME}','{$DT_IP}','{$status}','{$hidden}')");
if ($MOD['credit_answer'] && $_username && $status == 3) {
$could_credit = true;
if ($MOD['credit_maxanswer'] > 0) {
$r = $db->get_one("SELECT SUM(amount) AS total FROM {$DT_PRE}finance_credit WHERE username='{$_username}' AND addtime>{$DT_TIME}-86400 AND reason='" . $L['answer_question'] . "'");
if ($r['total'] > $MOD['credit_maxanswer']) {
$could_credit = false;
}
}
if ($could_credit) {
credit_add($_username, $MOD['credit_answer']);
credit_record($_username, $MOD['credit_answer'], 'system', $L['answer_question'], 'ID:' . $itemid);
}
}
if ($MOD['answer_message'] && $item['username']) {
send_message($item['username'], lang($L['answer_msg_title'], array(dsubstr($item['title'], 20, '...'))), lang($L['answer_msg_content'], array($item['title'], stripslashes($content), $linkurl)));
}
dalert($status == 3 ? $L['answer_success'] : $L['answer_check'], '', 'parent.window.location="' . $linkurl . '";');
} else {
$head_title = $L['answer_title'];
include template('my_' . $module, 'member');
}
exit;
}
$MG['know_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
include load($module . '.lang');
include load('my.lang');
require MD_ROOT . '/know.class.php';
$do = new know($moduleid);
if (in_array($action, array('add', 'edit'))) {
$FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php');
示例13: response
function response($openid, $from, $type, $content, $misc = array())
{
$xml = '<xml>';
$xml .= '<ToUserName><![CDATA[' . $openid . ']]></ToUserName>';
$xml .= '<FromUserName><![CDATA[' . $from . ']]></FromUserName>';
$xml .= '<CreateTime>' . $this->time . '</CreateTime>';
$xml .= '<MsgType><![CDATA[' . $type . ']]></MsgType>';
switch ($type) {
case 'text':
$xml .= '<Content><![CDATA[' . $content . ']]></Content>';
break;
case 'image':
$xml .= '<Image>';
$xml .= '<MediaId><![CDATA[' . $content . ']]></MediaId>';
$xml .= '</Image>';
break;
case 'voice':
$xml .= '<Voice>';
$xml .= '<MediaId><![CDATA[' . $content . ']]></MediaId>';
$xml .= '</Voice>';
break;
case 'video':
$xml .= '<Video>';
$xml .= '<MediaId><![CDATA[' . $content . ']]></MediaId>';
$xml .= '<Title><![CDATA[' . (isset($misc['title']) ? $misc['title'] : '') . ']]></Title>';
$xml .= '<Description><![CDATA[' . (isset($misc['description']) ? $misc['description'] : '') . ']]></Description>';
$xml .= '</Video>';
break;
case 'music':
$xml .= '<Music>';
$xml .= '<MediaId><![CDATA[' . $content . ']]></MediaId>';
$xml .= '<Title><![CDATA[' . (isset($misc['title']) ? $misc['title'] : '') . ']]></Title>';
$xml .= '<Description><![CDATA[' . (isset($misc['description']) ? $misc['description'] : '') . ']]></Description>';
$xml .= '<MusicUrl><![CDATA[' . (isset($misc['musicurl']) ? $misc['musicurl'] : '') . ']]></MusicUrl>';
$xml .= '<HQMusicUrl><![CDATA[' . (isset($misc['hqmusicurl']) ? $misc['hqmusicurl'] : '') . ']]></HQMusicUrl>';
$xml .= '<ThumbMediaId><![CDATA[' . (isset($misc['thumb_media_id']) ? $misc['thumb_media_id'] : '') . ']]></ThumbMediaId>';
$xml .= '</Music>';
break;
case 'news':
if ($misc && count($misc) < 11) {
$xml .= '<ArticleCount>' . count($misc) . '</ArticleCount>';
$xml .= '<Articles>';
foreach ($misc as $k => $v) {
$v['title'] = dsubstr($v['title'], 48);
$xml .= '<item>';
$xml .= '<Title><![CDATA[' . $v['title'] . ']]></Title>';
$xml .= '<Description><![CDATA[' . $v['description'] . ']]></Description>';
$xml .= '<PicUrl><![CDATA[' . $v['picurl'] . ']]></PicUrl>';
$xml .= '<Url><![CDATA[' . $v['url'] . ']]></Url>';
$xml .= '</item>';
}
$xml .= '</Articles>';
} else {
return false;
}
break;
default:
return false;
break;
}
$xml .= '</xml>';
echo convert($xml, DT_CHARSET, 'UTF-8');
}
示例14: COUNT
}
if ($totime) {
$condition .= " AND addtime<{$totime}";
}
if ($ip) {
$condition .= " AND ip='{$ip}'";
}
if ($robot) {
$condition .= " AND robot='{$robot}'";
}
if ($username) {
$condition .= " AND username='{$username}'";
}
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}404 WHERE {$condition}");
$items = $r['num'];
}
$pages = pages($items, $page, $pagesize);
$lists = array();
$result = $db->query("SELECT * FROM {$DT_PRE}404 WHERE {$condition} ORDER BY itemid DESC LIMIT {$offset},{$pagesize}");
while ($r = $db->fetch_array($result)) {
$tmp = parse_url($r['url']);
$r['durl'] = dsubstr(basename($r['url']), 30, '...');
$r['addtime'] = timetodate($r['addtime'], 6);
$lists[] = $r;
}
include tpl('404');
break;
}
示例15: isset
if ($pass) {
require DT_ROOT . '/module/' . $module . '/global.func.php';
$view = isset($view) ? 1 : 0;
if ($view) {
$pagesize = 30;
$offset = ($page - 1) * $pagesize;
$demo_url = userurl($username, 'file=' . $file . '&itemid=' . $itemid . '&view=1&page={destoon_page}', $domain) . '#p';
$pages = home_pages($items, $pagesize, $demo_url, $page);
$T = array();
$i = 1;
$result = $db->query("SELECT itemid,thumb,introduce FROM {$table_item} WHERE item={$itemid} ORDER BY listorder ASC,itemid ASC LIMIT {$offset},{$pagesize}");
while ($r = $db->fetch_array($result)) {
$r['number'] = $offset + $i++;
$r['linkurl'] = userurl($username, 'file=' . $file . '&itemid=' . $itemid . '&page=' . $r['number'], $domain) . '#p';
$r['thumb'] = str_replace('.thumb.', '.middle.', $r['thumb']);
$r['title'] = $r['introduce'] ? dsubstr($r['introduce'], 46, '..') : ' ';
$T[] = $r;
}
} else {
if ($page > $items) {
$page = 1;
}
$T = array();
$result = $db->query("SELECT itemid,thumb,introduce FROM {$table_item} WHERE item={$itemid} ORDER BY listorder ASC,itemid ASC");
while ($r = $db->fetch_array($result)) {
$T[] = $r;
}
$demo_url = userurl($username, "file={$file}&itemid={$itemid}&page=" . '{destoon_page}', $domain);
$next_photo = $items > 1 ? next_photo($page, $items, $demo_url) : $linkurl;
$prev_photo = $items > 1 ? prev_photo($page, $items, $demo_url) : $linkurl;
if ($T) {