本文整理汇总了PHP中get_login_role函数的典型用法代码示例。如果您正苦于以下问题:PHP get_login_role函数的具体用法?PHP get_login_role怎么用?PHP get_login_role使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_login_role函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_role_id
/**
* 根据用户uid获取角色id
* @param int $uid
* @return int
* @author 郑钟良<[email protected]>
*/
function get_role_id($uid = 0)
{
!$uid && ($uid = is_login());
if ($uid == is_login()) {
//自己
$role_id = get_login_role();
} else {
//不是自己
$role_id = query_user(array('show_role'), $uid);
$role_id = $role_id['show_role'];
}
return $role_id;
}
开发者ID:admpub,项目名称:OpenCenter,代码行数:19,代码来源:role.php
示例2: save
/**
* 保存个人换肤设置
*/
public function save()
{
$aSkin = I('post.skin', '', 'op_t');
$aSet_default = I('post.set_default', 0, 'intval');
$msg['status'] = 0;
$map = getUserConfigMap(USER_CONFIG_MARK_NAME, USER_CONFIG_MARK_MODEL);
$UserConfigModel = M('UserConfig');
$exit = $UserConfigModel->where($map)->count();
if ($aSet_default) {
//设为默认
if ($exit) {
//0为不存在了,1为存在
$result = $UserConfigModel->where($map)->delete();
} else {
$result = 1;
}
$msg['defaultSkin'] = getAddonConfig();
$msg['defaultSkin'] = $msg['defaultSkin']['defaultSkin'];
} else {
if ($aSkin == '' || $aSkin == null) {
$msg['info'] = '未选择皮肤';
$this->ajaxReturn($msg);
}
$map_change = $map;
//$map_change是判断配置信息是否修改时的查询条件
$map_change['value'] = $aSkin;
if ($exit) {
$changed = $UserConfigModel->where($map_change)->count();
if ($changed) {
//0为修改了,1为未修改
$result = 1;
} else {
$result = $UserConfigModel->where($map)->setField('value', $aSkin);
}
} else {
$result = $UserConfigModel->add($map_change);
}
}
if ($result) {
S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role(), null);
$msg['status'] = 1;
$msg['info'] = '设置成功';
} else {
$msg['info'] = '设置失败';
}
$this->ajaxReturn($msg);
}
开发者ID:admpub,项目名称:OpenCenter,代码行数:50,代码来源:SkinController.class.php
示例3: edit_expandinfo
public function edit_expandinfo($profile_group_id)
{
$field_list = $this->getRoleFieldIds();
if ($field_list) {
$map_field['id'] = array('in', $field_list);
} else {
$this->error('没有要保存的信息!');
}
$map_field['profile_group_id'] = $profile_group_id;
$map_field['status'] = 1;
$field_setting_list = D('field_setting')->where($map_field)->order('sort asc')->select();
if (!$field_setting_list) {
$this->error('没有要修改的信息!');
}
$data = null;
foreach ($field_setting_list as $key => $val) {
$data[$key]['uid'] = is_login();
$data[$key]['field_id'] = $val['id'];
switch ($val['form_type']) {
case 'input':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
if (!$val['value'] || $val['value'] == '') {
if ($val['required'] == 1) {
$this->error($val['field_name'] . '内容不能为空!');
}
} else {
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
}
$data[$key]['field_data'] = $val['value'];
break;
case 'radio':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$data[$key]['field_data'] = $val['value'];
break;
case 'checkbox':
$val['value'] = $_POST['expand_' . $val['id']];
if (!is_array($val['value']) && $val['required'] == 1) {
$this->error('请至少选择一个:' . $val['field_name']);
}
$data[$key]['field_data'] = is_array($val['value']) ? implode('|', $val['value']) : '';
break;
case 'select':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$data[$key]['field_data'] = $val['value'];
break;
case 'time':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$val['value'] = strtotime($val['value']);
$data[$key]['field_data'] = $val['value'];
break;
case 'textarea':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
if (!$val['value'] || $val['value'] == '') {
if ($val['required'] == 1) {
$this->error($val['field_name'] . '内容不能为空!');
}
} else {
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
}
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
$data[$key]['field_data'] = $val['value'];
break;
}
}
$map['uid'] = is_login();
$map['role_id'] = get_login_role();
$is_success = false;
foreach ($data as $dl) {
$dl['role_id'] = $map['role_id'];
$map['field_id'] = $dl['field_id'];
$res = D('field')->where($map)->find();
if (!$res) {
if ($dl['field_data'] != '' && $dl['field_data'] != null) {
$dl['createTime'] = $dl['changeTime'] = time();
if (!D('field')->add($dl)) {
$this->error('信息添加时出错!');
}
$is_success = true;
}
} else {
$dl['changeTime'] = time();
if (!D('field')->where('id=' . $res['id'])->save($dl)) {
$this->error('信息修改时出错!');
}
$is_success = true;
}
unset($map['field_id']);
}
clean_query_user_cache(is_login(), 'expand_info');
if ($is_success) {
$this->success('保存成功!');
//.........这里部分代码省略.........
开发者ID:smartymoon,项目名称:e-anjia,代码行数:101,代码来源:ConfigController.class.php
示例4: ucwords
</div>
</div>
</div>
<!--MENU-->
<div id="leftcolumn">
<div class="innertube">
Welcome, <?php
echo ucwords(get_username());
?>
<br />
<?php
echo date("F d, Y");
?>
<br />
<?php
echo ucwords(get_login_role()) . " - <a href=includes/logout.inc.php><font color=#FFFFFF>logout</font></a>";
?>
<?php
include "menu.php";
?>
</div>
</div>
<div id="footer"><?php
include 'footer.html';
?>
<div>
</div>
</body>
</html>
开发者ID:mover5,项目名称:imobackup,代码行数:31,代码来源:boty_results.php
示例5: registerRole
/**
* 持有新身份
* @author 郑钟良<[email protected]>
*/
public function registerRole()
{
$aRoleId = I('post.role_id', 0, 'intval');
$uid = is_login();
$data['status'] = 0;
if ($uid > 0 && $aRoleId != get_login_role()) {
$roleUser = D('UserRole')->where(array('uid' => $uid, 'role_id' => $aRoleId))->find();
if ($roleUser) {
$data['info'] = "已持有该身份!";
$this->ajaxReturn($data);
} else {
$memberModel = D('Common/Member');
$memberModel->logout();
$this->initRoleUser($aRoleId, $uid);
clean_query_user_cache($uid, array('avatar64', 'avatar128', 'avatar32', 'avatar256', 'avatar512', 'rank_link'));
$memberModel->login($uid, false, $aRoleId);
//登陆
}
} else {
$data['info'] = "非法操作!";
$this->ajaxReturn($data);
}
}
开发者ID:ccccy,项目名称:wuanlife,代码行数:27,代码来源:MemberController.class.php
示例6: getUserConfig
/**
* 获取用户插件信息
* @return mixed
* @author 郑钟良<[email protected]>
*/
function getUserConfig()
{
$UserConfig = S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role());
if (!$UserConfig) {
$map = getUserConfigMap(USER_CONFIG_MARK_NAME, USER_CONFIG_MARK_MODEL);
$skin = M('UserConfig')->where($map)->getField('value');
if (!$skin) {
$UserConfig = getAddonConfig();
$UserConfig['skin'] = $UserConfig['defaultSkin'];
} else {
$UserConfig['skin'] = $skin;
}
S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role(), $UserConfig, 600);
}
return $UserConfig;
}
开发者ID:admpub,项目名称:OpenCenter,代码行数:21,代码来源:function.php
示例7: edit_expandinfo
public function edit_expandinfo($profile_group_id)
{
$field_list = $this->getRoleFieldIds();
if ($field_list) {
$map_field['id'] = array('in', $field_list);
} else {
$this->error(L('_ERROR_INFO_SAVE_NONE_') . L('_EXCLAMATION_'));
}
$map_field['profile_group_id'] = $profile_group_id;
$map_field['status'] = 1;
$field_setting_list = M('field_setting')->where($map_field)->order('sort asc')->select();
if (!$field_setting_list) {
$this->error(L('_ERROR_INFO_CHANGE_NONE_') . L('_EXCLAMATION_'));
}
$data = null;
foreach ($field_setting_list as $key => $val) {
$data[$key]['uid'] = is_login();
$data[$key]['field_id'] = $val['id'];
switch ($val['form_type']) {
case 'input':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
if (!$val['value'] || $val['value'] == '') {
if ($val['required'] == 1) {
$this->error($val['field_name'] . L('_ERROR_CONTENT_NONE_') . L('_EXCLAMATION_'));
}
} else {
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
}
$data[$key]['field_data'] = $val['value'];
break;
case 'radio':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$data[$key]['field_data'] = $val['value'];
break;
case 'checkbox':
$val['value'] = $_POST['expand_' . $val['id']];
if (!is_array($val['value']) && $val['required'] == 1) {
$this->error(L('_ERROR_AT_LIST_ONE_') . L('_COLON_') . $val['field_name']);
}
$data[$key]['field_data'] = is_array($val['value']) ? implode('|', $val['value']) : '';
break;
case 'select':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$data[$key]['field_data'] = $val['value'];
break;
case 'time':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
$val['value'] = strtotime($val['value']);
$data[$key]['field_data'] = $val['value'];
break;
case 'textarea':
$val['value'] = op_t($_POST['expand_' . $val['id']]);
if (!$val['value'] || $val['value'] == '') {
if ($val['required'] == 1) {
$this->error($val['field_name'] . L('_ERROR_CONTENT_NONE_') . L('_EXCLAMATION_'));
}
} else {
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
}
$val['submit'] = $this->_checkInput($val);
if ($val['submit'] != null && $val['submit']['succ'] == 0) {
$this->error($val['submit']['msg']);
}
$data[$key]['field_data'] = $val['value'];
break;
}
}
$map['uid'] = is_login();
$map['role_id'] = get_login_role();
$is_success = false;
foreach ($data as $dl) {
$dl['role_id'] = $map['role_id'];
$map['field_id'] = $dl['field_id'];
$res = M('field')->where($map)->find();
if (!$res) {
if ($dl['field_data'] != '' && $dl['field_data'] != null) {
$dl['createTime'] = $dl['changeTime'] = time();
if (!M('field')->add($dl)) {
$this->error(L('_ERROR_INFO_ADD_') . L('_EXCLAMATION_'));
}
$is_success = true;
}
} else {
$dl['changeTime'] = time();
if (!M('field')->where('id=' . $res['id'])->save($dl)) {
$this->error(L('_ERROR_INFO_CHANGE_') . L('_EXCLAMATION_'));
}
$is_success = true;
}
unset($map['field_id']);
}
clean_query_user_cache(is_login(), 'expand_info');
if ($is_success) {
$this->success(L('_SUCCESS_SAVE_') . L('_EXCLAMATION_'));
//.........这里部分代码省略.........
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:101,代码来源:ConfigController.class.php
示例8: registerRole
/**
* 持有新身份
* @author 郑钟良<[email protected]>
*/
public function registerRole()
{
$aRoleId = I('post.role_id', 0, 'intval');
$uid = is_login();
$data['status'] = 0;
if ($uid > 0 && $aRoleId != get_login_role()) {
$roleUser = M('UserRole')->where(array('uid' => $uid, 'role_id' => $aRoleId))->find();
if ($roleUser) {
$data['info'] = L('_INFO_INV_ROLE_POSSESS_');
$this->ajaxReturn($data);
} else {
$memberModel = M('Common/Member');
$memberModel->logout();
UCenterMember()->initRoleUser($aRoleId, $uid);
clean_query_user_cache($uid, array('avatar64', 'avatar128', 'avatar32', 'avatar256', 'avatar512', 'rank_link'));
$memberModel->login($uid, false, $aRoleId);
//登陆
}
} else {
$data['info'] = L('_ERROR_ILLEGAL_OPERATE_');
$this->ajaxReturn($data);
}
}
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:27,代码来源:MemberController.class.php
示例9: session_start
<?php
session_start();
require_once 'includes/functions.inc.php';
require_once 'includes/connect.inc.php';
if (check_login_status() == false || get_login_role() != "admin") {
$_SESSION['error'] = "You do not have the authorization to access this page";
redirect('login.php');
} else {
$username = $_SESSION['username'];
$role = $_SESSION['role'];
$connect = connectToDB();
}
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=enrollment.csv");
header("Pragma: no-cache");
header("Expires: 0");
$date = date("Y");
$prevdate = $date - 1;
echo "BandName,BandID,{$date} Enrollment,Override\n";
$query = "SELECT School, Bands.BandID, E.IHSAEnrollment, E2.DivisionOverride FROM Bands LEFT JOIN (SELECT * FROM Enrollment WHERE Year = {$date}) E ON Bands.BandID = E.BandID LEFT JOIN (SELECT * FROM Enrollment WHERE Year = {$prevdate}) E2 ON Bands.BandID = E2.BandID ORDER BY School ASC";
$result = mysql_query($query, $connect);
while ($row = mysql_fetch_array($result)) {
echo $row['School'] . "," . $row['BandID'] . ",", $row['IHSAEnrollment'] . "," . $row['DivisionOverride'] . "\n";
}
开发者ID:mover5,项目名称:imobackup,代码行数:25,代码来源:gencsv.php
示例10: addslashes
$address = addslashes(mysql_result($result, $i, "Address"));
if (isset($_GET['highlight'])) {
foreach ($search as $value) {
$replace = "<FONT style=\"BACKGROUND-COLOR: #BBBBBB\">" . $value . "</FONT>";
$school = str_ireplace($value, $replace, $school);
$band_name = str_ireplace($value, $replace, $band_name);
$city_town = str_ireplace($value, $replace, $city_town);
$colors = str_ireplace($value, $replace, $colors);
$directors = str_ireplace($value, $replace, $directors);
$notes = str_ireplace($value, $replace, $notes);
}
}
//begin section (School info)
echo "<div><h2 style='display:inline;'>{$school}</h2>";
echo "<i> {$band_name}</i> {$city_town}, IL";
if (check_login_status() == true && (get_login_role() == "admin" || get_login_role() == "contributor")) {
echo "<div style='float: right;'>";
echo "<h3 style='display:inline;'>Admin Tasks: </h3>";
echo "<a href='console/modify_band.php?BandID={$BandID}'>Edit Band</a>, ";
echo "<a href='console/modify_show.php?modsubmit=true&BandID={$BandID}&Year={$year}'>Edit Show</a> ";
echo "</div>";
}
echo "</div>";
echo "<hr>";
//end section (School info)
//begin section (Year info)
echo "<form action=\"bands_indiv.php?BandID={$BandID}\" method=\"post\">";
echo "Select a year: <select name=\"year\" onChange=\"MM_jumpMenu('parent',this,0)\" class='form_input'>";
for ($i = date("Y"); $i > 1999; $i--) {
if ($i == $year) {
echo "<option selected='selected' value=\"bands_indiv.php?BandID={$BandID}&year=\">{$i}</option>";
开发者ID:mover5,项目名称:imobackup,代码行数:31,代码来源:bands_indiv.php
注:本文中的get_login_role函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论