本文整理汇总了PHP中multi函数的典型用法代码示例。如果您正苦于以下问题:PHP multi函数的具体用法?PHP multi怎么用?PHP multi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了multi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: multi
function multi($n, $m)
{
if ($m == 1) {
return $n;
}
return $n + multi($n, $m - 1);
}
示例2: main
function main()
{
global $_G;
if ($_GET['onsubmit'] && check()) {
foreach ($_GET[ids] as $k => $v) {
$id = intval($v);
if ($_GET[del][$k] == 0) {
continue;
}
if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
DB::delete(__CLASS__, "id=" . intval($id));
}
}
cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
return false;
}
$size = 30;
$start = ($_G['page'] - 1) * $size;
$url = '';
$and = '';
if ($_GET['uid']) {
$uid = intval($_GET[uid]);
$and .= " AND uid =" . $uid;
$url .= "&uid=" . $uid;
}
if ($_GET['username']) {
$username = urldecode_utf8(trim($_GET[username]));
$and .= " AND username ='" . $username . "'";
$url .= "&username=" . urlencode_utf8($username);
}
if ($_GET['ip']) {
$ip = trim($_GET[ip]);
$and .= " AND ip ='" . $ip . "'";
$url .= "&ip=" . $ip;
}
if ($_GET['jf_down']) {
$jf_down = intval($_GET[jf_down]);
$and .= " AND org_jf >='" . $jf_down . "'";
$url .= "&jf_down=" . $jf_down;
}
if ($_GET['jf_up']) {
$jf_up = intval($_GET[jf_up]);
$and .= " AND org_jf <='" . $jf_up . "'";
$url .= "&jf_up=" . $jf_up;
}
if ($_GET[type] && array_key_exists($_GET[type], $_G['setting']['jf_type'])) {
$type = addslashes(trim($_GET[type]));
$and .= " AND type='{$type}'";
$url .= "&type=" . $type;
}
$sign_list = DB::fetch_all("SELECT * FROM " . DB::table(__CLASS__) . " where 1 {$and} ORDER BY id DESC LIMIT {$start},{$size}");
$count = getcount(__CLASS__, $and);
$showpage = multi($count, $size, $_G[page], URL . "m=sign&a=main" . $url);
foreach ($sign_list as $k => $v) {
$sign_list[$k][username_url] = urlencode_utf8($v[username]);
$sign_list[$k][dateline] = dgmdate($v[dateline], 'u');
}
$this->add(array('count' => $count, 'sign_list' => $sign_list, 'showpage' => $showpage));
$this->show('sign/main');
}
示例3: viewthread_sidetop_output
function viewthread_sidetop_output()
{
global $_G, $postlist;
$aid = $_G['forum_thread']['authorid'];
$return = array();
$tid = $_G['tid'];
if ($postlist && $aid) {
foreach ($postlist as $value) {
if ($value['first']) {
$amu_query = DB::fetch_first("SELECT SUM(recommends),SUM(recommend_add),SUM(recommend_sub) FROM " . DB::table('forum_thread') . " WHERE authorid='{$aid}'");
$amu_recommends = $amu_query['SUM(recommends)'];
$amu_recommend_add = $amu_query['SUM(recommend_add)'];
$amu_recommend_sub = $amu_query['SUM(recommend_sub)'];
if ($amu_recommend_add || $amu_recommend_sub) {
$amu_hpl = round($amu_recommend_add * 100 / ($amu_recommend_add + $amu_recommend_sub), 1);
}
for ($k = 0; $k < count($this->amu_ranks, 0); $k++) {
if ($amu_recommends >= $this->amu_ranks[$k][3] && ($amu_recommends <= $this->amu_ranks[$k][4] || $this->amu_ranks[$k][4] == 0)) {
$return[0] = '<dl class="pil">';
if ($this->amu_ranks[$k][4] && $this->vars['showmod'] == 2) {
$bilv = '|' . round($amu_recommends * 100 / ($this->amu_ranks[$k][4] + 1), 1) . '%';
$return[0] .= '<dt>' . $this->vars['txt'] . '</dt><dd id="amurecommend_add" onmouseover="showMenu({\'ctrlid\':this.id, \'pos\':\'12\'});">' . $this->amu_ranks[$k][2] . $bilv . '</dd>';
}
if ($amu_hpl) {
$return[0] .= '<dt>' . $this->vars['txt2'] . '</dt><dd>' . $amu_hpl . '% <span id="amuassess" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'43\'})"><IMG SRC="source/plugin/dsu_amuassess/images/more_' . $this->vars['icon'] . '.png"></span></dd>';
}
$return[0] .= '</dl>';
}
}
}
}
}
$return[0] .= '<div id="amurecommend_add_menu" class="g_up" style="display:none"><div class="crly">帮我升级就点 : <a id="recommend_add2" href="forum.php?mod=misc&action=recommend&do=add&tid=' . $tid . '" onclick="ajaxmenu(this, 3000, 1, 0, \'43\', \'recommendupdate(1)\');return false;">' . $_G['setting']['recommendthread']['addtext'] . '</a> </div><div class="mncr"></div></div>';
$ggprint = array();
$fromfid = (array) unserialize($this->vars['fromfid']);
if (count($fromfid, 0) == 1 && $fromfid[0] == '') {
$where = '';
} else {
$fromfid = array_diff($fromfid, array(null));
$where = ' AND fid IN (' . implode(",", array_unique($fromfid)) . ')';
}
if ($aid) {
$num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE authorid = '" . $aid . "' AND recommends > 0" . $where);
$page = max(1, intval($_G['gp_page']));
$start_limit = ($page - 1) * 10;
$multipage = multi($num, 10, $page, "plugin.php?id=dsu_amuassess:hook&authorid=" . $aid);
$sql = "SELECT * FROM " . DB::table('forum_thread') . " WHERE authorid = '" . $aid . "' AND recommends > 0" . $where . " ORDER BY recommends DESC LIMIT " . $start_limit . " , 10";
$querygg = DB::query($sql);
$return[0] .= '<div id="amuassess_menu" style="display:none;width:340px;"><div class="crly bm_c"><ol class="xl xl1">';
while ($value = DB::fetch($querygg)) {
$return[0] .= '<li><a href="forum.php?mod=viewthread&tid=' . $value['tid'] . '" target="_blank" style="color:#3083C7; white-space:nowrap;">' . cnsubstr($value['subject'], 30) . '</a><em style="position:absolute; width:90px; color:#B7B7B7; text-align:right; height:12px;left:240px;">' . $value['replies'] . '/' . $value['views'] . '</em></li>';
}
$return[0] .= '</ol></div></div>';
}
return $return;
}
示例4: block_sql
function block_sql($paramarr, $multicachekey = '', $returncount = 0)
{
global $_G, $_SGLOBAL, $_GET, $_SERVER;
if (!empty($paramarr['sql'])) {
require_once B_ROOT . './source/function/block_sql.func.php';
if ($returncount > 0) {
return runsql($paramarr, '', 1);
}
list($sqlstring, $listcount) = runsql($paramarr, '', 0, $multicachekey);
if (!empty($paramarr['perpage'])) {
if ($listcount) {
$urlarr = $_GET;
foreach ($urlarr as $key => $value) {
if (empty($value)) {
unset($urlarr[$key]);
} else {
$urlarr[$key] = rawurlencode($urlarr[$key]);
}
}
unset($urlarr['page']);
$phpurl = arraytostring($urlarr, '=', '&');
$phpurl = $phpurl ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $phpurl : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_GET['page'], rawurldecode($phpurl), 1);
$theblockarr['listcount'] = $listcount;
}
}
}
//查詢數據
if ($listcount) {
//查詢
$query = DB::query($sqlstring);
while ($value = DB::fetch($query)) {
if (isset($value['subjectimage'])) {
$value['thumb'] = getattachurl($value['subjectimage'], 1);
$value['subjectimage'] = getattachurl($value['subjectimage']);
}
$theblockarr[] = $value;
}
}
return $theblockarr;
}
示例5: get_menu_foot
function get_menu_foot($brandresult)
{
global $_G;
$bid = $brandresult['bid'];
$tid = $brandresult['tid'];
$perpage = 5;
$page = intval($_G[sr_page]);
$page = max(1, intval($page));
$start = ($page - 1) * $perpage;
$start = max(0, $start);
require_once libfile('function/discuzcode');
$count = C::t('#sanree_brand#forum_post')->count_by_tid_post(0, $tid);
if ($count > 0) {
$postthread = C::t('#sanree_brand#forum_post')->fetch_all_by_tid(0, $tid, true, ' desc', ($page - 1) * $perpage, $perpage, 0, 0);
foreach ($postthread as $key => $val) {
$postthread[$key]['message'] = discuzcode($val['message'], 0, 0, 0, 1);
$postthread[$key]['satisfaction'] = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($val['authorid'], $tid) * 20;
$postthread[$key]['dateline'] = dgmdate($val['dateline']);
$postthread[$key]['img'] = avatar($val['authorid'], 'middle', 1);
}
$murl = $_G['item_detail'] == 'item' ? $is_rewrite ? getburl($brandresult) . '?t' . $extra : getburl($brandresult) . $extra : ($is_rewrite ? getdetailurl($brandresult) . '?t' . $extra : getdetailurl($brandresult) . $extra);
$multi = multi($count, $perpage, $page, $murl);
}
$satisfaction = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($_G['uid'], $tid) * 20;
$seditor = array('fastpost', array('bold', 'color', 'link', 'quote', 'smilies'));
$selfimg = avatar($_G['uid'], 'middle', 1);
$wx_prefix = $_G['setting']['attachurl'] . 'category/';
$appVer = $_G['setting']['version'];
$dzv = array('X3.2', 'X3.1');
if (in_array($appVer, $dzv)) {
list($seccodecheck) = seccheck('publish');
$dzvflag = true;
$sectpl = '<div class="rfm"><table><tr><th><sec>: </th><td><span id="sec<hash>" onclick="showMenu({\'ctrlid\':\'sec<hash>\',\'pos\':\'*\'})"><sec></span><br /><div id="sec<hash>_menu" class="p_pop p_opt" style="display:none"><sec></div></td></tr></table></div>';
} else {
$seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
$secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
$dzvflag = false;
}
include templateEx($this->_identifier . ':' . $this->_template . '/srfoot');
$GLOBALS['srfoot'] = $srfoot;
}
示例6: str_replace
$orderadd = "ORDER BY gender DESC";
break;
case 'username':
$orderadd = "ORDER BY username DESC";
break;
default:
$orderadd = 'ORDER BY uid';
$order = 'uid';
break;
}
$sql = !empty($srchmem) ? " WHERE username LIKE '" . str_replace(array('_', '%'), array('\\_', '\\%'), $srchmem) . "%'" : '';
$num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}members {$sql}");
}
$page = $membermaxpages && $page > $membermaxpages ? 1 : $page;
$start_limit = ($page - 1) * $memberperpage;
$multipage = multi($num, $memberperpage, $page, "member.php?action=list&listgid={$listgid}&srchmem=" . rawurlencode($srchmem) . "&order={$order}&type={$type}", $membermaxpages);
$memberlist = array();
$query = $db->query("SELECT m.uid, m.username, m.gender, m.email, m.regdate, m.lastvisit, m.posts, m.credits,\r\n\t\tm.showemail{$birthdayadd} FROM {$tablepre}members m\r\n\t\t{$sql} {$orderadd} LIMIT {$start_limit}, {$memberperpage}");
while ($member = $db->fetch_array($query)) {
$member['usernameenc'] = rawurlencode($member['username']);
$member['regdate'] = gmdate($dateformat, $member['regdate'] + $timeoffset * 3600);
$member['lastvisit'] = dgmdate("{$dateformat} {$timeformat}", $member['lastvisit'] + $timeoffset * 3600);
$memberlist[] = $member;
}
include template('memberlist');
} elseif ($action == 'markread') {
if ($discuz_user) {
$db->query("UPDATE {$tablepre}members SET lastvisit='{$timestamp}' WHERE uid='{$discuz_uid}'");
}
showmessage('mark_read_succeed', $indexname);
} elseif ($action == 'regverify' && $regverify == 2 && $groupid == 8 && submitcheck('verifysubmit')) {
示例7: loadcache
}
if ($count) {
loadcache('forums');
$tids = array();
require_once libfile('function/misc');
while ($value = DB::fetch($query)) {
if (empty($value['author']) && $value['authorid'] != $_G['uid']) {
$hiddennum++;
continue;
}
$tids[$value['tid']] = $value['tid'];
$list[$value['tid']] = procthread($value);
}
if ($tids) {
$query = DB::query("SELECT * FROM " . DB::table('forum_poll') . " WHERE tid IN(" . dimplode($tids) . ")");
while ($value = DB::fetch($query)) {
$value['pollpreview'] = explode("\t", trim($value['pollpreview']));
$list[$value['tid']]['poll'] = $value;
}
}
$multi = multi($count, $perpage, $page, $theurl);
}
if ($_G['uid']) {
$_G['gp_view'] = !$_G['gp_view'] ? 'we' : $_G['gp_view'];
$navtitle = lang('core', 'title_' . $_G['gp_view'] . '_poll');
} else {
$_G['gp_order'] = !$_G['gp_order'] ? 'dateline' : $_G['gp_order'];
$navtitle = lang('core', 'title_' . $_G['gp_order'] . '_poll');
}
$actives = array($_GET['view'] => ' class="a"');
include_once template("diy:home/space_poll");
示例8: array
$contents[] = $value;
}
if (empty($contents)) {
C::t('portal_article_content')->update($aid, array('showinnernav' => '0'));
}
}
require_once libfile('function/blog');
$content['content'] = blog_bbcode($content['content']);
if (!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade']) {
$_caturl = $_G['cache']['portalcategory'][$cat['topid']]['domain'] ? $_G['cache']['portalcategory'][$cat['topid']]['caturl'] : '';
$viewurl = $_caturl . $article['htmldir'] . $article['htmlname'] . '{page}.' . $_G['setting']['makehtml']['extendname'];
unset($_caturl);
} else {
$viewurl = "portal.php?mod=view&aid={$aid}";
}
$multi = multi($article['contents'], 1, $page, $viewurl);
$org = array();
if ($article['idtype'] == 'tid' || $content['idtype'] == 'pid') {
$thread = $firstpost = array();
require_once libfile('function/discuzcode');
require_once libfile('function/forum');
$thread = get_thread_by_tid($article[id]);
if (!empty($thread)) {
if ($content['idtype'] == 'pid') {
$firstpost = C::t('forum_post')->fetch($thread['posttableid'], $content['id']);
} else {
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']);
}
if ($firstpost && $firstpost['tid'] == $article['id']) {
$firstpost['uid'] = $firstpost['authorid'];
$firstpost['username'] = $firstpost['author'];
示例9: showmessage
DB::query("UPDATE " . DB::table('common_report') . " SET opuid='{$_G['uid']}', opname='{$_G['username']}', optime='" . TIMESTAMP . "', opresult='{$opresult}' WHERE id='{$reportid}'");
}
}
showmessage('modcp_report_success', "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}");
}
}
$rewardlist = '';
$report_reward = unserialize($_G['setting']['report_reward']);
$offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
if ($report_reward['max'] > $report_reward['min']) {
for ($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) {
if ($vote != 0) {
$rewardlist .= $vote ? '<option value="' . $vote . '">' . ($vote > 0 ? '+' . $vote : $vote) . '</option>' : '';
} else {
$rewardlist .= '<option value="0" selected>' . lang('forum/misc', 'report_noreward') . '</option>';
}
}
}
$reportlist = array();
$lpp = empty($_G['gp_lpp']) ? 20 : intval($_G['gp_lpp']);
$lpp = min(200, max(5, $lpp));
$page = max(1, intval($_G['page']));
$start = ($page - 1) * $lpp;
$reportcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_report') . " WHERE opuid=0 AND fid='{$_G['fid']}'");
$query = DB::query("SELECT * FROM " . DB::table('common_report') . " WHERE opuid=0 AND fid='{$_G['fid']}' ORDER BY num DESC, dateline DESC LIMIT {$start}, {$lpp}");
while ($row = DB::fetch($query)) {
$row['dateline'] = dgmdate($row['dateline']);
$reportlist[] = $row;
}
$multipage = multi($reportcount, $lpp, $page, "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}");
}
示例10: intval
$error = 'share_mod_range_illegal';
}
if (!$error) {
if ($detail) {
$_G['gp_perpage'] = intval($_G['gp_perpage']) < 1 ? 20 : intval($_G['gp_perpage']);
$perpage = $_G['gp_pp'] ? $_G['gp_pp'] : $_G['gp_perpage'];
$query = DB::query("SELECT * FROM " . DB::table('home_share') . " s WHERE 1 {$sql} ORDER BY s.dateline DESC LIMIT " . ($page - 1) * $perpage . ",{$perpage}");
$shares = '';
require_once libfile('function/share');
while ($share = DB::fetch($query)) {
$share['dateline'] = dgmdate($share['dateline']);
$share = mkshare($share);
$shares .= showtablerow('', '', array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$share['sid']}\" />", "<a href=\"home.php?mod=space&uid={$share['uid']}\" target=\"_blank\">" . $share['username'] . "</a>", $share['title_template'], $share['body_template'], $share['type'], $share['dateline']), TRUE);
}
$sharecount = DB::result_first("SELECT count(*) FROM " . DB::table('home_share') . " s WHERE 1 {$sql}");
$multi = multi($sharecount, $perpage, $page, ADMINSCRIPT . "?action=share");
$multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=share&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='" . ADMINSCRIPT . "?action=share&page='+this.value", "page(this.value)", $multi);
} else {
$sharecount = 0;
$query = DB::query("SELECT s.sid FROM " . DB::table('home_share') . " s WHERE 1 {$sql}");
while ($share = DB::fetch($query)) {
$sids .= ',' . $share['sid'];
$sharecount++;
}
$multi = '';
}
if (!$sharecount) {
$error = 'share_post_nonexistence';
}
}
示例11: array
}
$wheresql = "albumid='{$albumid}'";
$count = $albumlist[$albumid]['picnum'];
} else {
$wheresql = "albumid='0' AND uid='{$space['uid']}'";
}
$list = array();
if ($count) {
$query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE {$wheresql} ORDER BY dateline DESC LIMIT {$start},{$perpage}");
while ($value = DB::fetch($query)) {
$value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$list[] = $value;
}
}
$_G['gp_ajaxtarget'] = empty($_G['gp_ajaxtarget']) ? 'diyimages' : $_G['gp_ajaxtarget'];
$multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=index&op=image&albumid={$albumid}");
} elseif ($op == 'getblock') {
$blockname = getstr($_GET['blockname'], 15);
$blockhtml = '';
if (check_ban_block($name, $space)) {
space_merge($space, 'field_home');
$data = getuserdiydata($space);
$blockhtml = getblockhtml($blockname, $data['parameters'][$blockname]);
}
} elseif ($op == 'edit') {
$blockname = getstr($_GET['blockname'], 15);
$blockdata = lang('space', 'blockdata');
if (!empty($blockdata[$blockname]) && check_ban_block($blockname, $space)) {
space_merge($space, 'field_home');
$userdiy = getuserdiydata($space);
$para = $userdiy['parameters'][$blockname];
示例12: block_getdiyurl
} else {
$tplinfo = block_getdiyurl($value['targettplname']);
if ($tplinfo['url']) {
$value['url'] = lang('portal/template', 'block_view_link', array('url' => $tplinfo['url']));
} else {
$value['url'] = lang('portal/template', 'block_unused');
}
}
$value['name'] = empty($value['name']) ? '#' . $value['bid'] : trim($value['name']);
$theclass = block_getclass($value['blockclass']);
$value['datasrc'] = $theclass['script'][$value['script']];
$value['allowdata'] = checkperm('allowdiy') || $permission[$value['bid']]['allowdata'] ? true : false;
$value['allowsetting'] = checkperm('allowdiy') || $permission[$value['bid']]['allowsetting'] ? true : false;
$blocks[] = $value;
}
$multi = multi($count, $perpage, $page, "portal.php?mod=portalcp&ac=portalblock");
}
$language = lang('portal/template');
$navtitle = $language['block_management'] . ' - ' . $language['portal_management'];
include_once template("portal/portalcp_portalblock");
function getallowblock($uid)
{
if (empty($uid)) {
return false;
}
$uid = max(0, intval($uid));
$query = DB::query('SELECT * FROM ' . DB::table('common_block_permission') . " WHERE uid='{$uid}'");
$permission = array();
while ($value = DB::fetch($query)) {
if ($value['allowdata'] || $value['allowsetting']) {
$permission[$value['bid']] = $value;
示例13: IN
$joins[$value['uid']] = $value['uid'];
}
//是否邀请
$query = $_SGLOBAL['db']->query("SELECT uid FROM ".tname('mtaginvite')." WHERE tagid='$tagid' AND uid IN (".simplode($fuids).")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$joins[$value['uid']] = $value['uid'];
}
realname_get();
//用户组
$groups = getfriendgroup();
$groupselect = array($_GET['group'] => ' selected');
$multi = multi($count, $perpage, $page, "cp.php?ac=mtag&op=manage&tagid=$mtag[tagid]&subop=invite&group=$_GET[group]&key=$_GET[key]");
} else {
//显示
include_once(S_ROOT.'./source/function_bbcode.php');
$mtag['announcement'] = html2bbcode($mtag['announcement']);
$joinperms = array($mtag['joinperm'] => ' selected');
$viewperms = array($mtag['viewperm'] => ' selected');
$threadperms = array($mtag['threadperm'] => ' selected');
$postperms = array($mtag['postperm'] => ' selected');
$closeapply = array($mtag['closeapply'] => ' checked');
}
$actives = array($_GET['subop'] => ' class="active"');
示例14: showmessage
showmessage('attachmenttype_update_success', $newurl);
}
}
//GET METHOD
$addclass = $viewclass = '';
if (empty($_GET['op'])) {
//LIST VIEW
$wheresqlarr = array();
$wheresqlstr = getwheresql($wheresqlarr);
$query = $_SGLOBAL['db']->query('SELECT COUNT(*) FROM ' . tname('attachmenttypes') . ' WHERE ' . $wheresqlstr);
$listcount = $_SGLOBAL['db']->result($query, 0);
$multipage = '';
if ($listcount) {
$plussql = 'LIMIT ' . $start . ',' . $perpage;
$listarr = selecttable('attachmenttypes', array(), $wheresqlarr, $plussql);
$multipage = multi($listcount, $perpage, $page, $theurl);
}
$viewclass = ' class="active"';
} elseif ($_GET['op'] == 'edit') {
//ONE VIEW FOR UPDATE
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('attachmenttypes') . ' WHERE id=\'' . $_GET['id'] . '\'');
if ($thevalue = $_SGLOBAL['db']->fetch_array($query)) {
$thevalue['maxsize'] = $thevalue['maxsize'] / 1024;
}
} elseif ($_GET['op'] == 'add') {
//ONE ADD
$thevalue = array('id' => 0, 'fileext' => '', 'maxsize' => '512');
$addclass = ' class="active"';
} elseif ($_GET['op'] == 'delete') {
//ONE DELETE
$_GET['id'] = intval($_GET['id']);
示例15: block_uchspace
function block_uchspace($paramarr)
{
global $_SGLOBAL, $_SC, $_SGET;
dbconnect(2);
if (empty($paramarr['sql'])) {
$sql = array();
$sql['select'] = 'SELECT s.*';
$sql['from'] = 'FROM ' . tname('space', '2') . ' s';
if (!empty($paramarr['showdetail'])) {
$sql['select'] = 'SELECT sf.*, s.*';
$sql['from'] .= ' LEFT JOIN ' . tname('spacefield', '2') . ' sf ON sf.uid=s.uid';
}
$wherearr = array();
//where
if (!empty($paramarr['uid'])) {
$paramarr['uid'] = getdotstring($paramarr['uid'], 'int');
if ($paramarr['uid']) {
$wherearr[] = 's.uid IN (' . $paramarr['uid'] . ')';
}
} else {
if (!empty($paramarr['avatar'])) {
if ($paramarr['avatar'] == 1) {
$wherearr[] = 's.avatar = 0';
} else {
$wherearr[] = 's.avatar = 1';
}
}
$scopequery = getscopequery('s', 'viewnum', $paramarr);
if (!empty($scopequery)) {
$wherearr[] = $scopequery;
}
$scopequery = getscopequery('s', 'friendnum', $paramarr);
if (!empty($scopequery)) {
$wherearr[] = $scopequery;
}
}
$sql['where'] = '';
if (!empty($wherearr)) {
$sql['where'] = 'WHERE ' . implode(' AND ', $wherearr);
}
//order
if (!empty($paramarr['order'])) {
$sql['order'] = 'ORDER BY ' . $paramarr['order'];
}
//limit
if (!empty($paramarr['perpage'])) {
$paramarr['perpage'] = intval($paramarr['perpage']);
if (empty($paramarr['perpage'])) {
$paramarr['perpage'] = 20;
}
if (empty($_SGET['page'])) {
$_SGET['page'] = 1;
}
$_SGET['page'] = intval($_SGET['page']);
if ($_SGET['page'] < 1) {
$_SGET['page'] = 1;
}
$start = ($_SGET['page'] - 1) * $paramarr['perpage'];
$sql['limit'] = 'LIMIT ' . $start . ',' . $paramarr['perpage'];
} else {
if (empty($paramarr['limit'])) {
$sql['limit'] = 'LIMIT 0,1';
} else {
$paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false);
if ($paramarr['limit']) {
$sql['limit'] = 'LIMIT ' . $paramarr['limit'];
} else {
$sql['limit'] = 'LIMIT 0,1';
}
}
}
//query
$sqlstring = implode(' ', $sql);
//multi
$listcount = 1;
if (!empty($paramarr['perpage'])) {
$listcount = $_SGLOBAL['db_uch']->result($_SGLOBAL['db_uch']->query('SELECT COUNT(*) FROM ' . tname('space', '2') . ' ' . $sql['where']), 0);
if ($listcount) {
$urlarr = $_SGET;
unset($urlarr['page']);
$theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
}
}
} else {
$uchdb = $_SGLOBAL['db_uch'];
include_once S_ROOT . './function/block_sql.func.php';
list($sqlstring, $listcount) = runsql($paramarr, $uchdb);
if (!empty($paramarr['perpage'])) {
if ($listcount) {
$urlarr = $_SGET;
unset($urlarr['page']);
$theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0);
}
}
}
//查询数据
if ($listcount) {
//预处理
include_once S_ROOT . './uc_client/client.php';
//查询
//.........这里部分代码省略.........