function wechat_all($availableOnly = true) { global $_W; if($availableOnly) { $condition = $_W['isfounder'] ? '' : "uid = '{$_W['uid']}'"; } return wechat_search($condition); }
$member = pdo_fetch("SELECT * FROM " . tablename('members') . " WHERE uid = :uid", array(':uid' => $owner)); $do = $_GPC['do']; $dos = array('account', 'module', 'template'); $do = in_array($do, $dos) ? $do : 'account'; if ($do == 'account') { require model('wechat'); $condition = ''; $params = array(); if (!empty($_GPC['keyword'])) { $condition = '`name` LIKE :name'; $params[':name'] = "%{$_GPC['keyword']}%"; } $pindex = max(1, intval($_GPC['page'])); $psize = 5; $total = 0; $wechats = wechat_search($condition, $params, $pindex, $psize, $total); $owner = $_GPC['owner']; foreach ($wechats as &$wechat) { $member = member_single(array('uid' => $wechat['uid'])); $wechat['member'] = $member; if ($wechat['uid'] == $owner) { $wechat['owner'] = true; } } $pager = pagination($total, $pindex, $psize, '', array('ajaxcallback' => 'null')); template('member/select'); } if ($do == 'module') { $sql = "SELECT resourceid AS `mid` FROM " . tablename('members_permission') . " WHERE `uid`=:uid AND type = '1'"; $mids = pdo_fetchall($sql, array(':uid' => $owner)); $qMids = array();
$nMember['uid'] = $uid; $nMember['password'] = $_GPC['password']; $nMember['salt'] = $member['salt']; if(!empty($nMember['password']) && istrlen($nMember['password']) < 8) { message('必须输入密码,且密码长度不得低于8位。'); } $nMember['lastip'] = $_GPC['lastip']; $nMember['lastvisit'] = $_GPC['lastvisit']; $nMember['remark'] = $_GPC['remark']; if(member_update($nMember) !== false) { message('保存用户资料成功!', 'refresh'); } message('保存用户资料失败,请稍候重试或联系网站管理员解决!'); } require model('wechat'); $wechats = wechat_search("`uid`='{$uid}'"); $sql = "SELECT `mid` FROM " . tablename('members_modules') . ' WHERE `uid`=:uid'; $mids = pdo_fetchall($sql, array(':uid' => $uid)); $sql = 'SELECT * FROM ' . tablename('modules') . " WHERE `issystem`=1"; if(!empty($mids)) { $qMids = array(); foreach($mids as $row) { array_push($qMids, $row['mid']); } $mids = implode(',', $qMids); $sql .= " OR `mid` IN ({$mids})"; } $modules = pdo_fetchall($sql); template('member/edit'); }