本文整理汇总了PHP中dimplode函数的典型用法代码示例。如果您正苦于以下问题:PHP dimplode函数的具体用法?PHP dimplode怎么用?PHP dimplode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dimplode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friend_check
function friend_check($touids)
{
global $_G;
if (empty($_G['uid'])) {
return false;
}
if (is_array($touids)) {
$query = DB::query("SELECT fuid FROM " . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fuid IN (" . dimplode($touids) . ")");
while ($value = DB::fetch($query)) {
$touid = $value['fuid'];
$var = "home_friend_{$_G['uid']}_{$touid}";
$fvar = "home_friend_{$touid}_{$_G['uid']}";
$_G[$var] = $_G[$fvar] = true;
}
} else {
$touid = $touids;
$var = "home_friend_{$_G['uid']}_{$touid}";
$fvar = "home_friend_{$touid}_{$_G['uid']}";
if (!isset($_G[$var])) {
$friend = DB::fetch_first("SELECT fuid FROM " . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fuid='{$touid}'");
$_G[$var] = $_G[$fvar] = $friend ? true : false;
}
return $_G[$var];
}
}
示例2: build_cache_fields_connect_register
function build_cache_fields_connect_register()
{
global $_G;
$data = array();
$fields = array();
if ($_G['setting']['connect']['register_gender']) {
$fields[] = 'gender';
}
if ($_G['setting']['connect']['register_birthday']) {
$fields[] = 'birthyear';
$fields[] = 'birthmonth';
$fields[] = 'birthday';
}
if ($fields) {
$query = DB::query("SELECT * FROM " . DB::table('common_member_profile_setting') . " WHERE fieldid IN (" . dimplode($fields) . ")");
while ($field = DB::fetch($query)) {
$choices = array();
if ($field['selective']) {
foreach (explode("\n", $field['choices']) as $item) {
list($index, $choice) = explode('=', $item);
$choices[trim($index)] = trim($choice);
}
$field['choices'] = $choices;
} else {
unset($field['choices']);
}
$field['showinregister'] = 1;
$field['available'] = 1;
$data['field_' . $field['fieldid']] = $field;
}
}
save_syscache('fields_connect_register', $data);
}
示例3: build_cache_globalstick
function build_cache_globalstick()
{
$data = array();
$query = C::t('forum_forum')->fetch_all_valid_forum();
$fuparray = $threadarray = array();
foreach ($query as $forum) {
switch ($forum['type']) {
case 'forum':
$fuparray[$forum['fid']] = $forum['fup'];
break;
case 'sub':
$fuparray[$forum['fid']] = $fuparray[$forum['fup']];
break;
}
}
foreach (C::t('forum_thread')->fetch_all_by_displayorder(array(2, 3)) as $thread) {
switch ($thread['displayorder']) {
case 2:
$threadarray[$fuparray[$thread['fid']]][] = $thread['tid'];
break;
case 3:
$threadarray['global'][] = $thread['tid'];
break;
}
}
foreach (array_unique($fuparray) as $gid) {
if (!empty($threadarray[$gid])) {
$data['categories'][$gid] = array('tids' => dimplode($threadarray[$gid]), 'count' => intval(@count($threadarray[$gid])));
}
}
$data['global'] = array('tids' => empty($threadarray['global']) ? '' : dimplode($threadarray['global']), 'count' => intval(@count($threadarray['global'])));
savecache('globalstick', $data);
}
示例4: build_cache_globalstick
function build_cache_globalstick()
{
$data = array();
$query = DB::query("SELECT fid, type, fup FROM " . DB::table('forum_forum') . " WHERE status='1' AND type IN ('forum', 'sub') ORDER BY type");
$fuparray = $threadarray = array();
while ($forum = DB::fetch($query)) {
switch ($forum['type']) {
case 'forum':
$fuparray[$forum['fid']] = $forum['fup'];
break;
case 'sub':
$fuparray[$forum['fid']] = $fuparray[$forum['fup']];
break;
}
}
$query = DB::query("SELECT tid, fid, displayorder FROM " . DB::table('forum_thread') . " WHERE fid>'0' AND displayorder IN (2, 3)");
while ($thread = DB::fetch($query)) {
switch ($thread['displayorder']) {
case 2:
$threadarray[$fuparray[$thread['fid']]][] = $thread['tid'];
break;
case 3:
$threadarray['global'][] = $thread['tid'];
break;
}
}
foreach (array_unique($fuparray) as $gid) {
if (!empty($threadarray[$gid])) {
$data['categories'][$gid] = array('tids' => dimplode($threadarray[$gid]), 'count' => intval(@count($threadarray[$gid])));
}
}
$data['global'] = array('tids' => empty($threadarray['global']) ? '' : dimplode($threadarray['global']), 'count' => intval(@count($threadarray['global'])));
save_syscache('globalstick', $data);
}
示例5: fetch_all_will_birthday_by_uid
public function fetch_all_will_birthday_by_uid($uids)
{
$birthlist = array();
if (!empty($uids)) {
$uids = explode(',', (string) $uids);
$uids = dimplode(dintval($uids, true));
list($s_month, $s_day) = explode('-', dgmdate(TIMESTAMP - 3600 * 24 * 3, 'n-j'));
list($n_month, $n_day) = explode('-', dgmdate(TIMESTAMP, 'n-j'));
list($e_month, $e_day) = explode('-', dgmdate(TIMESTAMP + 3600 * 24 * 7, 'n-j'));
if ($e_month == $s_month) {
$wheresql = "sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}' AND sf.birthday<='{$e_day}'";
} else {
$wheresql = "(sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}') OR (sf.birthmonth='{$e_month}' AND sf.birthday<='{$e_day}' AND sf.birthday>'0')";
}
$query = DB::query("SELECT sf.uid,sf.birthyear,sf.birthmonth,sf.birthday,s.username\n\t\t\t\tFROM " . DB::table('common_member_profile') . " sf\n\t\t\t\tLEFT JOIN " . DB::table('common_member') . " s USING(uid)\n\t\t\t\tWHERE (sf.uid IN ({$uids})) AND ({$wheresql})");
while ($value = DB::fetch($query)) {
$value['istoday'] = 0;
if ($value['birthmonth'] == $n_month && $value['birthday'] == $n_day) {
$value['istoday'] = 1;
}
$key = sprintf("%02d", $value['birthmonth']) . sprintf("%02d", $value['birthday']);
$birthlist[$key][] = $value;
ksort($birthlist);
}
}
return $birthlist;
}
示例6: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
$blog = magic_check_idtype($id, $idtype);
$num = 10;
$list = $ids = $note_inserts = array();
$fusername = dimplode($_POST['fusername']);
if ($fusername) {
$query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num);
$note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
foreach ($query as $value) {
$ids[] = $value['fuid'];
$value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
$list[] = $value;
$note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']);
}
}
if (empty($ids)) {
showmessage('magicuse_has_no_valid_friend');
}
foreach ($note_inserts as $note_insert) {
C::t('home_notification')->insert($note_insert);
}
C::t('common_member')->increase($ids, array('newprompt' => 1));
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
$op = 'show';
include template('home/magic_call');
}
示例7: increase
public function increase($tids, $fieldarr)
{
$tids = dintval((array) $tids, true);
$sql = array();
$num = 0;
$allowkey = array('replies', 'lastposter', 'lastpost');
foreach ($fieldarr as $key => $value) {
if (in_array($key, $allowkey)) {
if (is_array($value)) {
$sql[] = DB::field($key, $value[0]);
} else {
$value = dintval($value);
$sql[] = "`{$key}`=`{$key}`+'{$value}'";
}
} else {
unset($fieldarr[$key]);
}
}
if ($getsetarr) {
return $sql;
}
if (!empty($sql)) {
$cmd = "UPDATE ";
$num = DB::query($cmd . DB::table($this->_table) . " SET " . implode(',', $sql) . " WHERE tid IN (" . dimplode($tids) . ")", 'UNBUFFERED');
$this->increase_cache($tids, $fieldarr);
}
return $num;
}
示例8: usesubmit
function usesubmit()
{
global $_G;
$list = $uids = array();
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$limit = $num + 20;
loadcache('magics');
$mid = !empty($_G['magics']['gift']) ? intval($_G['magics']['gift']['magicid']) : 0;
if ($mid) {
$query = DB::query('SELECT * FROM ' . DB::table('common_magiclog') . " WHERE magicid = '{$mid}' AND action='2' AND uid != '{$_G['uid']}' ORDER BY dateline DESC LIMIT 0,{$limit}");
while ($value = DB::fetch($query)) {
$uids[] = intval($value['uid']);
}
}
if ($uids) {
$counter = 0;
$query = DB::query('SELECT m.username, mfh.uid, mfh.magicgift FROM ' . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_field_home') . " mfh USING(uid) WHERE m.uid IN (" . dimplode($uids) . ")");
while ($value = DB::fetch($query)) {
$info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
$value['avatar'] = addcslashes(avatar($value['uid'], 'small'), "'");
$list[$value['uid']] = $value;
$counter++;
if ($counter >= $num) {
break;
}
}
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_detector');
}
示例9: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_G['gp_id']);
$idtype = $_G['gp_idtype'];
$blog = magic_check_idtype($id, $idtype);
$num = 10;
$list = $ids = $note_inserts = array();
$fusername = dimplode($_POST['fusername']);
if ($fusername) {
$query = DB::query('SELECT * FROM ' . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fusername IN (" . $fusername . ") LIMIT {$num}");
$note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
while ($value = DB::fetch($query)) {
$ids[] = $value['fuid'];
$value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
$list[] = $value;
$note_inserts[] = "('{$value['fuid']}', '{$name}', '1', '{$_G['uid']}', '{$_G['username']}', '{$note}', '{$_G['timestamp']}')";
}
}
if (empty($ids)) {
showmessage('magicuse_has_no_valid_friend');
}
DB::query('INSERT INTO ' . DB::table('home_notification') . '(uid, type, new, authorid, author, note, dateline) VALUES ' . implode(',', $note_inserts));
DB::query('UPDATE ' . DB::table('common_member') . ' SET newprompt = newprompt + 1 WHERE uid IN (' . dimplode($ids) . ')');
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
$op = 'show';
include template('home/magic_call');
}
示例10: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
loadcache('portalcategory');
$thecatid = !empty($parameter['thecatid']) ? explode(',', $parameter['thecatid']) : array();
if (!empty($parameter['catid'])) {
$catid = $parameter['catid'];
} else {
$catid = array_keys($_G['cache']['portalcategory']);
$catid[] = '0';
}
$orderby = $parameter['orderby'] == 'articles' ? ' ORDER BY articles DESC' : ' ORDER BY displayorder';
$wheres = array();
if ($thecatid) {
$wheres[] = "catid IN (" . dimplode($thecatid) . ")";
}
if ($catid) {
$wheres[] = "upid IN (" . dimplode($catid) . ")";
}
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$list = array();
$query = DB::query('SELECT * FROM ' . DB::table('portal_category') . " WHERE {$wheresql} {$orderby}");
while ($data = DB::fetch($query)) {
$list[] = array('id' => $data['catid'], 'idtype' => 'catid', 'title' => htmlspecialchars($data['catname']), 'url' => $_G['cache']['portalcategory'][$data['catid']]['caturl'], 'pic' => '', 'picflag' => '0', 'summary' => '', 'fields' => array('dateline' => $data['dateline'], 'articles' => $data['articles']));
}
return array('html' => '', 'data' => $list);
}
示例11: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$fups = isset($parameter['fups']) && !in_array(0, (array) $parameter['fups']) ? $parameter['fups'] : '';
$orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('displayorder', 'threads', 'posts', 'todayposts')) ? $parameter['orderby'] : 'displayorder' : 'displayorder';
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$sqlban = !empty($bannedids) ? ' AND f.fid NOT IN (' . dimplode($bannedids) . ')' : '';
if (empty($fups)) {
loadcache('forums');
if (empty($_G['cache']['forums'])) {
$fups = array('0');
} else {
$fups = array_keys($_G['cache']['forums']);
}
}
$ffadd1 = ", ff.icon, ff.description";
$ffadd2 = "LEFT JOIN `" . DB::table('forum_forumfield') . "` ff ON f.`fid`=ff.`fid`";
$query = DB::query("SELECT f.* {$ffadd1}\r\n\t\t\tFROM `" . DB::table('forum_forum') . "` f {$ffadd2}\r\n\t\t\tWHERE\r\n\t\t\t" . ($fups ? "f.`fup` IN (" . dimplode($fups) . ") " : "1 ") . "\r\n\t\t\tAND f.`status`='1' AND f.`type`!='group'\r\n\t\t\t{$sqlban}\r\n\t\t\tORDER BY " . ($orderby == 'displayorder' ? "f.fup, f.`displayorder` ASC " : "f.`{$orderby}` DESC") . " LIMIT {$startrow}, {$items}");
$datalist = $list = array();
$attachurl = preg_match('/^(http|ftp|ftps|https):\\/\\//', $_G['setting']['attachurl']) ? $_G['setting']['attachurl'] : $_G['siteurl'] . $_G['setting']['attachurl'];
while ($data = DB::fetch($query)) {
if (!empty($data['icon'])) {
$data['icon'] = preg_match('/^(http|ftp|ftps|https):\\/\\//', $data['icon']) ? $data['icon'] : $attachurl . 'common/' . $data['icon'];
} else {
$data['icon'] = 'static/image/common/forum_new.gif';
}
$list[] = array('id' => $data['fid'], 'idtype' => 'fid', 'title' => cutstr($data['name'], $titlelength, ''), 'url' => 'forum.php?mod=forumdisplay&fid=' . $data['fid'], 'pic' => '', 'summary' => cutstr($data['description'], $summarylength, ''), 'fields' => array('fulltitle' => $data['name'], 'icon' => $data['icon'], 'threads' => intval($data['threads']), 'posts' => intval($data['posts']), 'todayposts' => intval($data['todayposts'])));
}
return array('html' => '', 'data' => $list);
}
示例12: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = isset($parameter['uids']) && !in_array(0, (array) $parameter['uids']) ? $parameter['uids'] : '';
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = intval($parameter['titlelength']);
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'replynum')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$datalist = $list = array();
$wheres = array();
if ($uids) {
$wheres[] = 'uid IN (' . dimplode($uids) . ')';
}
if ($bannedids) {
$wheres[] = 'doid NOT IN (' . dimplode($bannedids) . ')';
}
$wheres[] = " status = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$query = DB::query("SELECT * FROM " . DB::table('home_doing') . " WHERE {$wheresql} ORDER BY {$orderby} DESC LIMIT {$startrow},{$items}");
while ($data = DB::fetch($query)) {
$datalist = array('id' => $data['doid'], 'idtype' => 'doid', 'title' => cutstr(strip_tags($data['message']), $titlelength, ''), 'url' => 'home.php?mod=space&uid=' . $data['uid'] . '&do=doing&doid=' . $data['doid'], 'pic' => '', 'summary' => '', 'fields' => array('fulltitle' => strip_tags($data['message']), 'uid' => $data['uid'], 'username' => $data['username'], 'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']), 'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']), 'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']), 'dateline' => $data['dateline'], 'replynum' => $data['replynum']));
if ($titlelength) {
$datalist['title'] = cutstr(strip_tags($data['message']), $titlelength);
} else {
$datalist['title'] = strip_tags($data['message'], '<img>');
}
$list[] = $datalist;
}
return array('html' => '', 'data' => $list);
}
示例13: fetch_all_by_bid
public function fetch_all_by_bid($bid, $isverified = 1, $start = 0, $limit = 0, $bannedids = array(), $format = true)
{
$data = array();
if ($bid = dintval($bid, true)) {
$addsql = $bannedids = dintval($bannedids, true) ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : '';
$query = DB::query('SELECT * FROM %t WHERE ' . DB::field('bid', $bid) . ' AND isverified=%d' . $addsql . ' ORDER BY stickgrade DESC, displayorder DESC, verifiedtime DESC, dataid DESC ' . DB::limit($start, $limit), array($this->_table, $isverified));
while ($value = DB::fetch($query)) {
if ($format) {
$value['fields'] = unserialize($value['fields']);
$value['fields']['timestamp'] = $value['fields']['dateline'];
$value['fields']['dateline'] = dgmdate($value['fields']['dateline']);
$value['pic'] = $value['pic'] !== STATICURL . 'image/common/nophoto.gif' ? $value['pic'] : '';
if ($value['pic'] && $value['picflag'] == '1') {
$value['pic'] = getglobal('setting/attachurl') . $value['pic'];
} elseif ($value['picflag'] == '2') {
$value['pic'] = getglobal('setting/ftp/attachurl') . $value['pic'];
}
$value['dateline'] = dgmdate($value['dateline'], 'u');
$value['verifiedtime'] = dgmdate($value['verifiedtime'], 'u');
}
$data[$value['id']] = $value;
}
}
return $data;
}
示例14: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$aids = !empty($parameter['aids']) ? explode(',', $parameter['aids']) : array();
$catid = !empty($parameter['catid']) ? $parameter['catid'] : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'picnum', 'updatetime')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$list = array();
$wheres = array();
if ($aids) {
$wheres[] = 'albumid IN (' . dimplode($aids) . ')';
}
if ($bannedids) {
$wheres[] = 'albumid NOT IN (' . dimplode($bannedids) . ')';
}
if ($uids) {
$wheres[] = 'uid IN (' . dimplode($uids) . ')';
}
if ($catid && !in_array('0', $catid)) {
$wheres[] = 'catid IN (' . dimplode($catid) . ')';
}
$wheres[] = "friend = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$sql = "SELECT * FROM " . DB::table('home_album') . " WHERE {$wheresql} ORDER BY {$orderby} DESC";
$query = DB::query($sql . " LIMIT {$startrow},{$items};");
while ($data = DB::fetch($query)) {
$list[] = array('id' => $data['albumid'], 'idtype' => 'albumid', 'title' => cutstr($data['albumname'], $titlelength, ''), 'url' => "home.php?mod=space&uid={$data['uid']}&do=album&id={$data['albumid']}", 'pic' => 'album/' . $data['pic'], 'picflag' => $data['picflag'], 'summary' => '', 'fields' => array('fulltitle' => $data['albumname'], 'uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $data['dateline'], 'updatetime' => $data['updatetime'], 'picnum' => $data['picnum']));
}
return array('html' => '', 'data' => $list);
}
示例15: delete_by_did
public function delete_by_did($dids)
{
if (!is_array($dids)) {
$dids = array($dids);
}
return DB::delete($this->_table, "did IN (" . dimplode($dids) . ")");
}