本文整理汇总了PHP中pwLimit函数的典型用法代码示例。如果您正苦于以下问题:PHP pwLimit函数的具体用法?PHP pwLimit怎么用?PHP pwLimit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwLimit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReplaysByUser
/**
* @param $uid 用户ID
* @param $page 当前页数
* @return unknown_type 返回类型
*/
function getReplaysByUser($uid, $page = 1)
{
global $db_ptable;
$uid = (int) $uid;
if (!$uid) {
return array();
}
$pw_posts = GetPtable($db_ptable);
(int) $page < 1 && ($page = 1);
$start = ($page - 1) * $this->perPage;
$limit = pwLimit($start, $this->perPage);
$sql = "SELECT p.pid,p.postdate,t.tid,t.fid,t.subject,t.authorid,t.author,t.replies,t.hits,t.topped,t.digest,t.ifupload\r\n\t\t\t FROM {$pw_posts} p LEFT JOIN pw_threads t USING(tid) WHERE p.fid != 0 AND p.authorid= " . pwEscape($uid) . " \r\n\t\t\t AND p.fid != '0' ORDER BY p.postdate DESC {$limit}";
return $this->_query($sql, $start, 're');
}
示例2: viewReply
function viewReply($tid, $page, $replies, $per, $max, $ptable, $order)
{
global $db, $db_shield;
$page == 'e' && ($page = 65535);
(int) $page < 1 && ($page = 1);
$total = ceil($replies / $per);
$total == 0 ? $page = 1 : ($page > $total ? $page = $total : '');
$satrt = ($page - 1) * $per;
$id = $satrt;
$limit = pwLimit($satrt, $per);
$posts = '';
$pw_posts = GetPtable($ptable);
$sql = "SELECT p.aid,p.pid,p.subject,p.author,p.authorid,p.content,p.postdate,p.anonymous,p.ifshield,m.groupid \n\t\t\tFROM {$pw_posts} p LEFT JOIN pw_members m ON m.uid = p.authorid\n\t\t\tWHERE tid=" . pwEscape($tid) . " \n\t\t\tAND ifcheck=1 ORDER BY postdate {$limit}";
if ($order == 2) {
$sql = "SELECT p.aid,p.pid,p.subject,p.author,p.authorid,p.content,p.postdate,p.anonymous,p.ifshield,m.groupid \n\t\t\t\tFROM {$pw_posts} p LEFT JOIN pw_members m ON m.uid = p.authorid\n\t\t\t\tWHERE tid=" . pwEscape($tid) . " \n\t\t\t\tAND ifcheck=1 ORDER BY postdate desc {$limit}";
}
$query = $db->query($sql);
while ($ct = $db->fetch_array($query)) {
if ($ct['content']) {
$id++;
if ($ct['ifshield'] || $ct['groupid'] == 6 && $db_shield) {
if ($ct['ifshield'] == 2) {
$ct['content'] = shield('shield_del_article');
$ct['subject'] = '';
$tpc_shield = 1;
} else {
$ct['content'] = shield($ct['ifshield'] ? 'shield_article' : 'ban_article');
$ct['subject'] = '';
$tpc_shield = 1;
}
}
$ct['subject'] = str_replace(' ', '', wap_cv($ct['subject']));
$ct['content'] = replySubject($ct['content']);
list(, $ct['postdate']) = getLastDate($ct['postdate']);
$ct['id'] = $id;
if ($order == 2) {
$ct['id'] = $replies - $id + 1;
}
if ($ct['anonymous'] && $ct['authorid'] != $winduid) {
$ct['author'] = $db_anonymousname;
$ct['authorid'] = 0;
}
$ct['author'] = wap_cv($ct['author']);
$postdb[] = $ct;
}
}
return $postdb;
}
示例3: getRecommendByType
/**
* @param $type
* @param $page
* @return unknown_type
*/
function getRecommendByType($type, $page = 1)
{
$result = array();
$where = " WHERE (t.fid != 0 OR t.fid IS NULL) ";
if ($type) {
$where .= " AND p.typeid = " . pwEscape($type);
}
(int) $page < 1 && ($page = 1);
$start = ($page - 1) * $this->perPage;
$limit = pwLimit($start, $this->perPage);
$query = $this->db->query("SELECT p.*,t.replies,t.hits,t.author,t.authorid,t.lastposter,t.lastpost FROM pw_wappush p LEFT JOIN pw_threads t ON p.tid = t.tid \r\n\t\t\t\t\t{$where} ORDER BY p.id DESC {$limit}");
while ($rt = $this->db->fetch_array($query)) {
$rt['index'] = ++$start;
list(, $lastDate) = getLastDate($rt['lastpost']);
$rt['lastpost'] = $lastDate;
$result[] = $rt;
}
return $result;
}
示例4: get
function get($appid, $uid, $num, $start = 0)
{
if ($num == 'all') {
$num = 500;
} elseif (!is_numeric($num) || $num < 1) {
$num = 20;
} elseif ($num > 500) {
$num = 500;
}
(!is_numeric($start) || $start < 0) && ($start = 0);
$users = array();
$query = $this->db->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . pwEscape($uid) . pwLimit($start, $num));
while ($rt = $this->db->fetch_array($query)) {
$app = $this->db->get_one("SELECT * FROM pw_userapp WHERE uid=" . pwEscape($rt['friendid']) . " AND appid=" . pwEscape($appid));
if (empty($app)) {
$users[] = $rt['friendid'];
}
}
return new ApiResponse($users);
}
示例5: threadrelated
function threadrelated($relatedcon)
{
global $db, $db_iftag, $db_threadrelated, $forumset, $fid, $read, $tid, $db_modes, $db_dopen, $db_phopen, $db_share_open, $db_groups_open, $groupid, $timestamp;
$relatedb = array();
if (in_array($relatedcon, array('allpost', 'alldigest', 'allhits', 'allreply', 'forumpost', 'forumdigest', 'forumhits', 'forumreply'))) {
//require_once(R_P.'require/element.class.php');
//$element = new Element($forumset['relatednums']);
$element = L::loadClass('element');
$element->setDefaultNum($forumset['relatednums']);
switch ($relatedcon) {
case 'allpost':
$relatedb = $element->newSubject();
break;
case 'alldigest':
$relatedb = $element->digestSubject();
break;
case 'allhits':
$relatedb = $element->hitSort();
break;
case 'allreply':
$relatedb = $element->replySort();
break;
case 'forumpost':
$relatedb = $element->newSubject($fid);
break;
case 'forumdigest':
$relatedb = $element->digestSubject($fid);
break;
case 'forumhits':
$relatedb = $element->hitSort($fid);
break;
case 'forumreply':
$relatedb = $element->replySort($fid);
break;
}
} elseif ($relatedcon == 'oinfo') {
//继续改进
if ($db_modes['o']['ifopen']) {
require_once "require/app_core.php";
$addwhere = '';
if (!$db_dopen) {
$addwhere .= " AND type!='diary'";
}
if (!$db_phopen) {
$addwhere .= " AND type!='photo'";
}
if (!$db_share_open) {
$addwhere .= " AND type!='share'";
}
if (!$db_groups_open) {
$addwhere .= " AND type!='colony'";
}
$query = $db->query("SELECT type,descrip FROM pw_feed WHERE uid=" . pwEscape($read['authorid']) . $addwhere . " ORDER BY timestamp DESC " . pwLimit(0, $forumset['relatednums']));
while ($rt = $db->fetch_array($query)) {
$rt['title'] = parseFeedRead($rt['descrip']);
$rt['url'] = "u.php?uid={$read['authorid']}";
unset($rt['type']);
$relatedb[] = $rt;
}
}
} elseif (in_array($relatedcon, array('pictags', 'hottags'))) {
$tagid = $tagdbs = array();
$endtime = $timestamp - 30 * 24 * 3600;
$sql = 'WHERE t.ifcheck=1 AND t.tid !=' . pwEscape($tid) . ' AND t.postdate >=' . pwEscape($endtime);
$fidout = array('0');
$query = $db->query("SELECT fid,allowvisit,password FROM pw_forums WHERE type<>'category'");
while ($rt = $db->fetch_array($query)) {
$allowvisit = !$rt['allowvisit'] || $rt['allowvisit'] != str_replace(",{$groupid},", '', $rt['allowvisit']) ? true : false;
if ($rt['password'] || !$allowvisit) {
$fidout[] = $rt['fid'];
}
}
$fidout = pwImplode($fidout);
$fidout && ($sql .= " AND fid NOT IN ({$fidout})");
if ($db_iftag) {
if ($read['tags'] && $relatedcon == 'pictags') {
list($tagdb, $tpc_tag) = explode("\t", $read['tags']);
$tagdbs = explode(' ', $tagdb);
} elseif ($relatedcon == 'hottags') {
@(include_once D_P . 'data/bbscache/tagdb.php');
$j = 0;
foreach ($tagdb as $key => $val) {
$j++;
if ($j > 5) {
break;
}
$tagdbs[] = $key;
}
unset($tagdb);
}
if ($tagdbs) {
$query = $db->query("SELECT tagid FROM pw_tags WHERE tagname IN(" . pwImplode($tagdbs) . ')');
while ($rt = $db->fetch_array($query)) {
$tagid[] = $rt['tagid'];
}
}
if ($tagid) {
$query = $db->query("SELECT t.tid,t.subject FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) {$sql} AND tg.tagid IN(" . pwImplode($tagid) . ") GROUP BY tid ORDER BY postdate DESC " . pwLimit(0, $forumset['relatednums']));
while ($rt = $db->fetch_array($query)) {
$rt['title'] = $rt['subject'];
//.........这里部分代码省略.........
示例6: forum_creditcheck
$metaKeywords = $pw_seoset->getPageMetakeyword($foruminfo['keywords'], $foruminfo['name']);
if ($groupid != 3 && !$foruminfo['allowvisit'] && !admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid)) {
forum_creditcheck();
}
if ($groupid != 3 && $foruminfo['forumsell'] && !admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid)) {
forum_sell($fid);
}
$db_perpage = 100;
$db_maxpage && $page > $db_maxpage && ($page = $db_maxpage);
(!is_numeric($page) || $page < 1) && ($page = 1);
if ($page > 1) {
$start_limit = ($page - 1) * $db_perpage;
} else {
$start_limit = 0;
$page = 1;
}
$startid = $start_limit + 1;
$count = $foruminfo['topic'];
$numofpage = ceil($count / $db_perpage);
if ($numofpage && $page > $numofpage) {
$page = $numofpage;
}
$pages = PageDiv($count, $page, $numofpage, "{$DIR}f{$fid}", $db_maxpage);
$threaddb = array();
$query = $db->query("SELECT * FROM pw_threads WHERE fid=" . pwEscape($fid) . " AND topped<=3 AND ifcheck='1' ORDER BY topped DESC, lastpost DESC" . pwLimit($start_limit, $db_perpage));
while ($thread = $db->fetch_array($query)) {
$threaddb[] = $thread;
}
$db->free_result($query);
require_once PrintEot('simple_header');
require_once PrintEot('simple_thread');
示例7: PostCheck
//exit;
}
} else {
//require_once(R_P.'require/postfunc.php');
PostCheck(1, $o_photos_gdcheck, $o_photos_qcheck);
InitGP(array('pintro'), 'P');
empty($pintro) && ($pintro = array());
require_once R_P . 'require/bbscode.php';
$wordsfb = L::loadClass('FilterUtil');
foreach ($pintro as $k => $v) {
if (($banword = $wordsfb->comprise($v)) !== false) {
Showmsg('content_wordsfb');
}
}
if (!$aid) {
$albumcheck = $db->get_one("SELECT aid FROM pw_cnalbum WHERE atype='0' AND ownerid=" . pwEscape($winduid) . pwLimit(1));
if ($albumcheck) {
Showmsg('colony_albumclass');
} else {
$db->update("INSERT INTO pw_cnalbum SET " . pwSqlSingle(array('aname' => getLangInfo('app', 'defaultalbum'), 'atype' => 0, 'ownerid' => $winduid, 'owner' => $windid, 'lasttime' => $timestamp, 'crtime' => $timestamp)));
$aid = $db->insert_id();
}
}
!$aid && Showmsg('colony_albumclass');
$rt = $db->get_one("SELECT aname,photonum,ownerid,private,lastphoto FROM pw_cnalbum WHERE atype='0' AND aid=" . pwEscape($aid));
if (empty($rt)) {
Showmsg('undefined_action');
} elseif ($winduid != $rt['ownerid']) {
Showmsg('colony_phototype');
}
$o_maxphotonum && $rt['photonum'] >= $o_maxphotonum && Showmsg('colony_photofull');
示例8: PostCheck
$pwServer['REQUEST_METHOD'] != 'POST' && PostCheck($verify);
InitGP(array('step', 'by', 'sendto', 'touser', 'subject', 'atc_content', 'present', 'percount', 'count'));
$cache_file = D_P . "data/bbscache/" . substr($admin_pwd, 10, 10) . ".txt";
if (!$step) {
writeover($cache_file, $atc_content);
} else {
$atc_content = readover($cache_file);
}
if (empty($subject) || empty($atc_content)) {
adminmsg('sendmsg_empty');
}
$sendmessage = $atc_content;
!$percount && ($percount = 100);
empty($step) && ($step = 1);
$start = ($step - 1) * $percount;
$limit = pwLimit($start, $percount);
$creditlist = '';
$sendmessage .= '<br /><br /><b>' . getLangInfo('other', 'affect') . '</b>';
foreach ($present as $key => $val) {
if (empty($val)) {
continue;
}
if (is_numeric($val)) {
$creditlist .= "&present[{$key}]={$val}";
$sendmessage .= $credit->cType[$key] . "<font color=#FA891B>(+{$val})</font> ";
} else {
adminmsg('credit_isnum');
}
}
if ($by == 0) {
!$sendto && adminmsg('operate_error');
示例9: array_diff
$sendGroup[] = $rs['gid'];
}
$sendGroup = array_diff($sendGroup, array('-1'));
}
$subject = S::escapeChar($subject);
$sendmessage = S::escapeChar($atc_content);
$messageInfo = array('create_uid' => $winduid, 'create_username' => $windid, 'title' => $subject, 'content' => $sendmessage);
$messageServer->createMessageTasks($sendGroup, $messageInfo);
$count = $db->get_value("SELECT COUNT(*) AS sum FROM pw_members WHERE groupid IN(" . S::sqlImplode($sendto) . ')');
} else {
S::gp(array('count'));
}
$perpage = 10000;
$havesend = $step * $perpage;
$tmpArray = $sendto + array(0);
$db->query("CREATE TEMPORARY TABLE tmp_datastate SELECT uid FROM pw_members WHERE groupid IN(" . S::sqlImplode($tmpArray) . ')' . pwLimit(($step - 1) * $perpage, $perpage));
$db->update("INSERT INTO pw_ms_configs (uid) SELECT a.uid FROM tmp_datastate a LEFT JOIN pw_ms_configs b ON a.uid=b.uid WHERE b.uid IS NULL");
$db->update("UPDATE tmp_datastate a LEFT JOIN pw_members m ON a.uid=m.uid LEFT JOIN pw_ms_configs c ON a.uid=c.uid SET m.newpm=m.newpm+1,c.notice_num=c.notice_num+1");
//* 清除pw_members缓存 start
$_num = $db->get_value("SELECT count(*) FROM tmp_datastate");
if ($_num > 1500) {
$_cacheService = L::loadClass('cacheservice', 'utility');
$_cacheService->flush(PW_CACHE_MEMCACHE);
} else {
$_query = $db->query("SELECT uid FROM tmp_datastate");
$_uids = array();
while ($rt = $db->fetch_array($_query)) {
$_uids[] = $rt['uid'];
}
Perf::gatherInfo('changeMembersWithUserIds', array('uid' => $_uids));
}
示例10: IN
if (count($newtiddb) > 0) {
$db->update("DELETE FROM {$pcvaluetable} WHERE tid IN(" . pwImplode($newtiddb) . ") AND ifrecycle=0");
}
is_array($threadb) && ($alltids = implode(',', $threadb));
$count = $db->get_value("SELECT COUNT(tid) as count FROM {$pcvaluetable} WHERE ifrecycle=0");
}
if ($count > 0) {
$page < 1 && ($page = 1);
$numofpage = ceil($count / $db_perpage);
if ($numofpage && $page > $numofpage) {
$page = $numofpage;
}
$pages = numofpage($count, $page, $numofpage, "{$admin_file}?adminjob=postcate&action=postcate&pcid={$pcid}&newfield={$newfield}&step={$step}&");
if ($step != 'search') {
$start = ($page - 1) * $db_perpage;
$limit = pwLimit($start, $db_perpage);
}
$catedb = array();
$query = $db->query("SELECT pv.tid,t.fid,t.subject,t.author,t.authorid,t.postdate FROM {$pcvaluetable} pv LEFT JOIN pw_threads t ON pv.tid=t.tid WHERE 1 AND ifrecycle=0 {$sql} ORDER BY t.postdate DESC {$limit}");
while ($rt = $db->fetch_array($query)) {
$rt['postdate'] = get_date($rt['postdate']);
$catedb[] = $rt;
}
}
include PrintEot('postcate');
exit;
} elseif ($_POST['sendmsg'] || $action == 'sendmsg') {
InitGP(array('step', 'nexto'));
if (empty($step)) {
InitGP(array('selid', 'alltids'));
if ($selid) {
示例11: bakupdata
function bakupdata($tabledb, $start = 0)
{
global $db, $sizelimit, $tableid, $start, $stop, $rows;
$tableid = $tableid ? $tableid - 1 : 0;
$stop = 0;
$t_count = count($tabledb);
for ($i = $tableid; $i < $t_count; $i++) {
$ts = $db->get_one("SHOW TABLE STATUS LIKE " . pwEscape($tabledb[$i]));
$rows = $ts['Rows'];
$flag = true;
while ($flag) {
$limitadd = pwLimit($start, 100000);
$query = $db->query("SELECT * FROM {$tabledb[$i]} {$limitadd}");
$num_F = $db->num_fields($query);
while ($datadb = $db->fetch_array($query, MYSQL_NUM)) {
$start++;
$bakupdata .= "INSERT INTO {$tabledb[$i]} VALUES(" . "'" . $db->escape_string($datadb[0]) . "'";
$tempdb = '';
for ($j = 1; $j < $num_F; $j++) {
$tempdb .= ",'" . $db->escape_string($datadb[$j]) . "'";
}
$bakupdata .= $tempdb . ");\n";
if ($sizelimit && strlen($bakupdata) > $sizelimit * 1000) {
$flag = false;
break;
}
}
$db->free_result($query);
if ($start >= $rows) {
$flag = false;
$start = 0;
}
}
$bakupdata .= "\n";
if ($sizelimit && strlen($bakupdata) > $sizelimit * 1000) {
$stop = 1;
break;
}
}
if ($stop == 1) {
$tableid = ++$i;
}
return $bakupdata;
}
示例12: Showmsg
if (!$ifadmin && (!$colony['ifcyer'] || $colony['ifadmin'] == '-1')) {
Showmsg('colony_cnmenber');
}
InitGP(array('aid', 'selaid'));
$album = $db->get_one("SELECT aname,ownerid,photonum FROM pw_cnalbum WHERE atype='0' AND aid=" . pwEscape($aid));
if (empty($album) || $album['ownerid'] != $winduid) {
Showmsg('data_error');
}
if (empty($_POST['step'])) {
$options = '';
$query = $db->query("SELECT aid,aname FROM pw_cnalbum WHERE atype='1' AND ownerid=" . pwEscape($cyid) . ' ORDER BY aid DESC');
while ($rt = $db->fetch_array($query)) {
$options .= "<option value=\"{$rt['aid']}\"" . ($rt['aid'] == $selaid ? ' selected' : '') . ">{$rt['aname']}</option>";
}
$cnpho = array();
$query = $db->query("SELECT pid,path,ifthumb FROM pw_cnphoto WHERE aid=" . pwEscape($aid) . ' ORDER BY pid ' . pwLimit(0, $o_maxphotonum));
while ($rt = $db->fetch_array($query)) {
$rt['path'] = getphotourl($rt['path'], $rt['ifthumb']);
$cnpho[] = $rt;
}
list($isheader, $isfooter, $tplname, $isleft) = array(true, true, "m_galbum", true);
} else {
InitGP(array('selid'));
if (!$selid || !is_array($selid)) {
Showmsg('colony_select_photo');
}
if (empty($selaid)) {
Showmsg('colony_albumclass');
}
$selalbum = $db->get_one("SELECT aname,photonum,ownerid,lastphoto FROM pw_cnalbum WHERE atype='1' AND aid=" . pwEscape($selaid));
if (empty($selalbum)) {
示例13: array
$tpcdb = array();
if ($tiddb) {
$query = $db->query("SELECT * FROM pw_threads WHERE tid IN (" . pwImplode($tiddb) . ") {$pcsqladd} ORDER BY {$orderway} {$asc}");
while ($thread = $db->fetch_array($query)) {
$tpcdb[] = $thread;
}
$db->free_result($query);
}
} elseif ($limit2) {
if (empty($urladd) && strtolower($db_datastore) == 'memcache' && !$R && $offset < 980) {
$threadlist = L::loadClass("threadlist");
$tmpTpcdb = $threadlist->getThreads($fid, $offset, $limit2);
$tpcdb = array_merge((array) $tpcdb, (array) $tmpTpcdb);
} else {
//$topadd .= $R ? 'topped ASC,' : 'topped DESC,';
$query = $db->query("SELECT * FROM pw_threads WHERE {$sql} {$searchadd} ORDER BY {$topadd} {$orderway} {$asc} " . pwLimit($offset, $limit2));
while ($thread = $db->fetch_array($query)) {
$tpcdb[] = $thread;
}
$db->free_result($query);
$R && ($tpcdb = array_reverse($tpcdb));
}
}
//Start Here pwcache
if ($db_ifpwcache & 112 && pwFilemtime(D_P . 'data/bbscache/hitsort_judge.php') < $timestamp - 600) {
include_once D_P . 'data/bbscache/hitsort_judge.php';
$updatelist = $updatetype = array();
foreach ($tpcdb as $thread) {
if ($db_ifpwcache & 16) {
if ($thread['hits'] > $hitsort_judge['hitsort'][$fid] && $thread['fid'] == $fid) {
$updatelist[] = array('hitsort', $fid, $thread['tid'], $thread['hits'], '', 0);
示例14: IN
$pwSQL = "WHERE groupid IN(" . pwImplode($pwSendmail['info']) . ")";
} elseif ($pwSendmail['by'] == 1) {
require_once R_P . 'require/getonlineuser.php';
$onlineuser = GetOnlineUser();
$uids = array();
foreach ($onlineuser as $key => $value) {
is_numeric($key) && ($uids[] = $key);
}
$pwSQL = "WHERE uid IN(" . pwImplode($uids) . ")";
} elseif ($pwSendmail['by'] == 2) {
//TODO Efficiency problems
$pwSQL = "WHERE regdate BETWEEN" . pwEscape($pwSendmail['info']['stime']) . "AND" . pwEscape($pwSendmail['info']['etime']);
} else {
adminmsg('operate_error');
}
$limit = pwLimit($pwSendmail['step'] * $pwSendmail['num'], $pwSendmail['num']);
$query = $db->query("SELECT uid,username,email FROM pw_members {$pwSQL} {$limit}");
while ($rt = $db->fetch_array($query)) {
if (!$rt['email'] || !preg_match("/^[-a-zA-Z0-9_\\.]+@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$/", $rt['email'])) {
continue;
}
$sendsubject = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['subject']);
$sendcontent = str_replace(array('$winduid', '$windid', '$email'), array($rt['uid'], $rt['username'], $rt['email']), $pwSendmail['content']);
sendemail($rt['email'], $sendsubject, $sendcontent, 'email_additional');
}
$pwSendmail['step']++;
$havesend = $pwSendmail['sent'] = $pwSendmail['step'] * $pwSendmail['num'];
$count = $pwSendmail['count'];
if ($pwSendmail['count'] > $pwSendmail['sent']) {
writeover($tmpCachefile, "<?php\r\ndie();\r\n?>\r\n" . serialize($pwSendmail));
$j_url = "{$basename}&action={$action}";
示例15: getSearchvalue
function getSearchvalue($field, $type, $alltidtype = false, $backtype = false)
{
/*获取搜索结果*/
global $db_perpage, $page, $modelid, $fid, $basename;
$field = unserialize(StrCode($field, 'DECODE'));
$sqladd = '';
$fid && ($sqladd .= " fid=" . pwEscape($fid));
$fielddb = postTopic::getFieldData($modelid, $type);
foreach ($field as $key => $value) {
if ($value) {
if (in_array($fielddb[$key]['type'], array('number', 'radio', 'select'))) {
$sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . "=" . pwEscape($value) : $fielddb[$key]['fieldname'] . "=" . pwEscape($value);
} elseif ($fielddb[$key]['type'] == 'checkbox') {
$checkboxs = '';
foreach ($value as $cv) {
$checkboxs .= $checkboxs ? ',' . $cv : $cv;
}
$value = '%,' . $checkboxs . ',%';
$sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . " LIKE(" . pwEscape($value) . ")" : $fielddb[$key]['fieldname'] . " LIKE(" . pwEscape($value) . ")";
} elseif ($fielddb[$key]['type'] == 'calendar' && ($value['start'] || $value['end'])) {
$value['start'] && ($value['start'] = PwStrtoTime($value['start']));
$value['end'] && ($value['end'] = PwStrtoTime($value['end']));
if ($value['start'] > $value['end'] && $value['start'] && $value['end']) {
Showmsg('calendar_error');
}
$sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . ">=" . pwEscape($value['start']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . pwEscape($value['end']) : $fielddb[$key]['fieldname'] . ">=" . pwEscape($value['start']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . pwEscape($value['end']);
} elseif (in_array($fielddb[$key]['type'], array('text', 'url', 'email', 'textarea'))) {
$value = '%' . $value . '%';
$sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . " LIKE(" . pwEscape($value) . ")" : $fielddb[$key]['fieldname'] . " LIKE(" . pwEscape($value) . ")";
} elseif ($fielddb[$key]['type'] == 'range' && $value['min'] && $value['max']) {
$sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . ">=" . pwEscape($value['min']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . pwEscape($value['max']) : $fielddb[$key]['fieldname'] . ">=" . pwEscape($value['min']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . pwEscape($value['max']);
} else {
$sqladd .= '';
}
}
}
if ($sqladd) {
!$page && ($page = 1);
$start = ($page - 1) * $db_perpage;
$limit = pwLimit($start, $db_perpage);
$tablename = GetTopcitable($modelid);
$sqladd .= $sqladd ? " AND ifrecycle=0" : " ifrecycle=0";
$count = $this->db->get_value("SELECT COUNT(*) as count FROM {$tablename} WHERE {$sqladd}");
$query = $this->db->query("SELECT tid FROM {$tablename} WHERE {$sqladd} {$limit}");
while ($rt = $this->db->fetch_array($query)) {
$tiddb[] = $rt['tid'];
}
if ($alltidtype) {
$query = $this->db->query("SELECT tid FROM {$tablename} WHERE {$sqladd}");
while ($rt = $this->db->fetch_array($query)) {
$alltiddb[] = $rt['tid'];
}
}
!$count && ($count = -1);
} else {
if ($backtype) {
adminmsg('topic_search_none', "{$basename}&action=topic&modelid={$modelid}");
}
Showmsg('topic_search_none');
}
return array($count, $tiddb, $alltiddb);
}