本文整理汇总了PHP中UserSession::getUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP UserSession::getUserName方法的具体用法?PHP UserSession::getUserName怎么用?PHP UserSession::getUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserSession
的用法示例。
在下文中一共展示了UserSession::getUserName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract
<?php
require '../include/init.inc.php';
$module_id = $module_name = $module_sort = $module_url = $module_desc = $module_icon = $online = '';
extract($_REQUEST, EXTR_IF_EXISTS);
Common::checkParam($module_id);
$module = Module::getModuleById($module_id);
if (empty($module)) {
Common::exitWithError(ErrorMessage::MODULE_NOT_EXIST, "panel/modules.php");
}
if (Common::isPost()) {
if ($module_name == "" || $module_url == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$update_data = array('module_name' => $module_name, 'module_desc' => $module_desc, 'module_icon' => $module_icon, 'module_url' => $module_url, 'module_sort' => $module_sort);
if ($module_id > 1) {
$update_data['online'] = $online;
}
$result = Module::updateModuleInfo($module_id, $update_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'Module', $module_id, json_encode($update_data));
Common::exitWithSuccess('更新完成', 'panel/modules.php');
} else {
OSAdmin::alert("error");
}
}
}
$module_online_optioins = array("1" => "在线", "0" => "下线");
Template::assign('module', $module);
Template::assign('module_online_optioins', $module_online_optioins);
Template::display('panel/module_modify.tpl');
示例2: extract
$group_id = $method = $user_ids = $user_group = '';
extract($_REQUEST, EXTR_IF_EXISTS);
Common::checkParam($group_id);
$group = UserGroup::getGroupById($group_id);
if (empty($group)) {
Common::exitWithError(ErrorMessage::GROUP_NOT_EXIST, "panel/groups.php");
}
if (Common::isPost()) {
if (empty($user_ids) || empty($user_group)) {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
if (in_array(1, $user_ids)) {
Common::exitWithError('不可更改初始管理员的账号组', 'panel/groups.php');
}
$user_ids = implode(',', $user_ids);
$update_data = array('user_group' => $user_group);
$result = User::batchUpdateUsers($user_ids, $update_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $user_ids, json_encode($update_data));
Common::exitWithSuccess('更新完成', 'panel/groups.php');
} else {
OSAdmin::alert("error");
}
}
}
$user_infos = User::getUsersByGroup($group_id);
$groupOptions = UserGroup::getGroupForOptions();
Template::assign('group', $group);
Template::assign('user_infos', $user_infos);
Template::assign('groupOptions', $groupOptions);
Template::display('panel/group.tpl');
示例3: extract
<?php
require '../include/init.inc.php';
$module_name = $module_desc = $module_sort = $module_url = $module_icon = '';
$_POST['module_sort'] = 1;
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
$exist = Module::getModuleByName($module_name);
if ($exist) {
OSAdmin::alert("error", ErrorMessage::NAME_CONFLICT);
} else {
if ($module_name == "" || $module_url == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$input_data = array('module_name' => $module_name, 'module_desc' => $module_desc, 'module_url' => $module_url, 'module_sort' => $module_sort, 'module_icon' => $module_icon);
$module_id = Module::addModule($input_data);
if ($module_id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'Module', $module_id, json_encode($input_data));
Common::exitWithSuccess('模块添加成功', 'panel/modules.php');
}
}
}
}
Template::assign("_POST", $_POST);
Template::display('panel/module_add.tpl');
示例4:
<?php
require '../include/init.inc.php';
if (array_key_exists(UserSession::SESSION_NAME, $_SESSION)) {
SysLog::addLog(UserSession::getUserName(), 'LOGOUT', 'User', UserSession::getUserId());
}
User::logout();
Common::exitWithSuccess("您已安全登出!", "panel/login.php");
示例5: extract
<?php
require '../include/init.inc.php';
$method = $group_id = '';
extract($_GET, EXTR_IF_EXISTS);
if ($method == 'del' && !empty($group_id)) {
$users = UserGroup::getGroupUsers($group_id);
if (sizeof($users) > 0) {
OSAdmin::alert("error", ErrorMessage::HAVE_USER);
} else {
if (intval($group_id) === 1) {
OSAdmin::alert("error", ErrorMessage::CAN_NOT_DO_FOR_SUPER_GROUP);
} else {
$group = UserGroup::getGroupById($group_id);
$result = UserGroup::delGroup($group_id);
if ($result > 0) {
SysLog::addLog(UserSession::getUserName(), 'DELETE', 'UserGroup', $group_id, json_encode($group));
Common::exitWithSuccess('已将账号组删除', 'panel/groups.php');
} else {
OSAdmin::alert("error");
}
}
}
}
$groups = UserGroup::getAllGroup();
$confirm_html = OSAdmin::renderJsConfirm("icon-remove");
Template::assign('osadmin_action_confirm', $confirm_html);
Template::assign('groups', $groups);
Template::display('panel/groups.tpl');
示例6: extract
<?php
require '../include/init.inc.php';
$note_content = '';
extract($_POST, EXTR_IF_EXISTS);
$note_content = Common::filterText($note_content);
if (Common::isPost()) {
if ($note_content == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$note_content = htmlspecialchars($note_content);
$input_data = array('note_content' => $note_content, 'owner_id' => UserSession::getUserId());
$note_id = QuickNote::addNote($input_data);
if ($note_id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'QuickNote', $note_id, json_encode($input_data));
Common::exitWithSuccess('便签添加成功', 'panel/quicknote_add.php');
}
}
}
Template::assign("_POST", $_POST);
Template::display('panel/quicknote_add.tpl');
示例7: foreach
foreach ($group_role_array as $group_role) {
//系统预留菜单id为100以内
if ($group_role > 100) {
$temp[] = $group_role;
}
}
$admin_role = array_diff($group_role_array, $temp);
$menu_ids = array_merge($admin_role, $menu_ids);
$menu_ids = array_unique($menu_ids);
asort($menu_ids);
}
$group_role = join(',', $menu_ids);
$group_data = array('group_role' => $group_role, 'province_id' => $province_id);
$result = UserGroup::updateGroupInfo($group_id, $group_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'UserGroup', $group_id, json_encode($group_data));
UserSession::reload();
Common::exitWithSuccess(ErrorMessage::SUCCESS_NEED_LOGIN, 'complaint/manage.php');
} else {
OSAdmin::alert("error");
}
}
$province_id = $group_info['province_id'];
$data['province'] = Info::getProvince(false);
Template::assign('data', $data);
Template::assign('province_id', $province_id);
Template::assign('role_list', $role_list);
Template::assign('group_id', $group_id);
Template::assign('group_option_list', $group_option_list);
Template::assign('group_role', $group_role_array);
Template::display('complaint/manage.tpl');
示例8: extract
<?php
require '../include/init.inc.php';
$user_name = $real_name = $mobile = $password = $email = $user_desc = $user_group = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
$exist = User::getUserByName($user_name);
if ($exist) {
OSAdmin::alert("error", ErrorMessage::NAME_CONFLICT);
} else {
if ($password == "" || $real_name == "" || $mobile == "" || $email == "" || $user_group <= 0) {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$input_data = array('user_name' => $user_name, 'password' => md5($password), 'real_name' => $real_name, 'mobile' => $mobile, 'email' => $email, 'user_desc' => $user_desc, 'user_group' => $user_group);
$user_id = User::addUser($input_data);
if ($user_id) {
$input_data['password'] = "";
SysLog::addLog(UserSession::getUserName(), 'ADD', 'User', $user_id, json_encode($input_data));
Common::exitWithSuccess('账号添加成功', 'complaint/user.php');
} else {
OSAdmin::alert("error");
}
}
}
}
$group_options = UserGroup::getGroupForOptions();
unset($group_options[1]);
Template::assign("_POST", $_POST);
Template::assign('group_options', $group_options);
Template::display('complaint/user_add.tpl');
示例9: extract
extract($_REQUEST, EXTR_IF_EXISTS);
Common::checkParam($note_id);
$quicknote = QuickNote::getNoteById($note_id);
if (empty($quicknote)) {
Common::exitWithError(ErrorMessage::QUICKNOTE_NOT_EXIST, "panel/quicknotes.php");
}
if (Common::isPost()) {
$note_content = Common::filterText($note_content);
if ($note_content == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$current_user_info = UserSession::getSessionInfo();
$user_group = $current_user_info['user_group'];
$current_user_id = $current_user_info['user_id'];
if ($user_group == 1 || $quicknote['owner_id'] == $current_user_id) {
$note_content = htmlspecialchars($note_content);
$update_data = array('note_content' => $note_content);
$result = QuickNote::updateNote($note_id, $update_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'QuickNote', $note_id, json_encode($update_data));
Common::exitWithSuccess('更新完成', 'panel/quicknotes.php');
} else {
OSAdmin::alert("error");
}
} else {
OSAdmin::alert("error", ErrorMessage::QUICKNOTE_NOT_OWNER);
}
}
}
Template::assign('quicknote', $quicknote);
Template::display('panel/quicknote_modify.tpl');
示例10: json_encode
} else {
OSAdmin::alert("error");
}
}
if ($method == 'del' && !empty($user_id)) {
if ($user_id == UserSession::getUserId()) {
OSAdmin::alert("error", ErrorMessage::CAN_NOT_DO_SELF);
} else {
if ($user_id == 1) {
Common::exitWithSuccess('不能删除初始管理员', 'complaint/user.php');
}
$user = User::getUserById($user_id);
$result = User::delUser($user_id);
if ($result >= 0) {
$user['password'] = null;
SysLog::addLog(UserSession::getUserName(), 'DELETE', 'User', $user_id, json_encode($user));
Common::exitWithSuccess('已删除', 'complaint/user.php');
} else {
OSAdmin::alert("error");
}
}
}
//START 数据库查询及分页数据
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
if ($search) {
$row_count = User::countSearch($user_group, $user_name) - 1;
$total_page = $row_count % $page_size == 0 ? $row_count / $page_size : ceil($row_count / $page_size);
$total_page = $total_page < 1 ? 1 : $total_page;
$page_no = $page_no > $total_page ? $total_page : $page_no;
$start = ($page_no - 1) * $page_size;
示例11: extract
<?php
require '../include/init.inc.php';
$method = $module_id = '';
extract($_GET, EXTR_IF_EXISTS);
if ($method == 'del' && !empty($module_id)) {
$menus = Module::getModuleMenu($module_id);
if (sizeof($menus) > 0) {
OSAdmin::alert("error", ErrorMessage::HAVE_FUNC);
} else {
if (intval($module_id) === 1) {
OSAdmin::alert("error", ErrorMessage::CAN_NOT_DELETE_SYSTEM_MODULE);
} else {
$module = Module::getModuleById($module_id);
$result = Module::delModule($module_id);
if ($result) {
SysLog::addLog(UserSession::getUserName(), 'DELETE', 'Module', $module_id, json_encode($module));
Common::exitWithSuccess('模块删除成功', 'panel/modules.php');
}
}
}
}
$modules = Module::getAllModules();
$confirm_html = OSAdmin::renderJsConfirm("icon-remove");
Template::assign('modules', $modules);
Template::assign('osadmin_action_confirm', $confirm_html);
Template::display('panel/modules.tpl');
示例12: extract
<?php
require '../include/init.inc.php';
$method = $id = $keywords = '';
extract($_REQUEST, EXTR_IF_EXISTS);
if ($method == 'update' && $id > 0) {
$complaints_type = Complaint::getComplaintsTypeById($id);
if (empty($complaints_type)) {
echo -1;
exit;
}
if (Common::isPost()) {
$update_data = array('keywords' => $keywords, 'update_time' => date('Y-m-d H:i:s', time()));
$result = Complaint::updateComplaintsTypeKeywords($id, $update_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'ComplaintsTypeKeywords', $id, json_encode($update_data));
echo 1;
exit;
//Common::exitWithSuccess ( '投诉分级关键词修改完成','complaints/complaints_type_manage.php' );
} else {
echo -2;
exit;
}
}
}
$complaints_types = Complaint::getAllComplaintsType();
Template::assign('complaints_types', $complaints_types);
Template::display('complaint/complaints_type_manage.tpl');
示例13: count
}
}
$error = '需要导入' . count($excel_array) . '条,已经存在' . $existnum . '条,成功' . $successnum . '条!';
} else {
$error = "导入文件有问题!";
}
}
}
if ($method == 'addUnicomBusinessSp') {
if ($company_name == "" || $sp_company_code == "" || $sp_access_number == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$input_data = array('sp_company_code' => $sp_company_code, 'company_name' => $company_name, 'sp_access_number' => $sp_access_number, 'create_time' => date("Y-m-d H:i:s"), 'update_time' => date("Y-m-d H:i:s"), 'del_flag' => 0);
$id = Complaint::addUnicomBusinessSp($input_data);
if ($id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'UnicomBusiness', $id, json_encode($input_data));
Common::exitWithSuccess('sp名单添加成功', '/complaint/unicom_business_sp_list.php');
} else {
OSAdmin::alert("error");
}
}
}
$http_query = '';
foreach ($arr as $key => $value) {
$http_query .= $value . '=' . ${$value} . '&';
if (${$value}) {
$param[$value] = ${$value};
}
}
$page_size = PAGE_SIZE;
$page_no = !isset($_GET['page_no']) || intval($_GET['page_no']) < 1 ? 1 : intval($_GET['page_no']);
示例14: ceil
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$total_page = $row_count % $page_size == 0 ? $row_count / $page_size : ceil($row_count / $page_size);
$total_page = $total_page < 1 ? 1 : $total_page;
$page_no = $page_no > $total_page ? $total_page : $page_no;
$start = ($page_no - 1) * $page_size;
$current_user_info = UserSession::getSessionInfo();
$user_group = $current_user_info['user_group'];
$current_user_id = $current_user_info['user_id'];
if ($method == 'del' && !empty($note_id)) {
$note = QuickNote::getNoteById($note_id);
//是超级管理员组的成员或者是quicknote的主人
if ($user_group == 1 || $note['owner_id'] == $current_user_id) {
$result = QuickNote::delNote($note_id);
if ($result > 0) {
SysLog::addLog(UserSession::getUserName(), 'DELETE', 'QuickNote', $note_id, json_encode($note));
Common::exitWithSuccess('便签删除成功', 'panel/quicknotes.php');
} else {
OSAdmin::alert("error");
}
} else {
OSAdmin::alert("error", ErrorMessage::QUICKNOTE_NOT_OWNER);
}
}
$quicknotes = QuickNote::getNotes($start, $page_size);
$confirm_html = OSAdmin::renderJsConfirm("icon-remove");
$page_html = Pagination::showPager("", $page_no, PAGE_SIZE, $row_count);
Template::assign('page_no', $page_no);
Template::assign('page_size', PAGE_SIZE);
Template::assign('row_count', $row_count);
Template::assign('page_html', $page_html);
示例15: extract
<?php
require '../include/init.inc.php';
$group_name = $group_desc = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
$exist = UserGroup::getGroupByName($group_name);
if ($exist) {
OSAdmin::alert("error", ErrorMessage::NAME_CONFLICT);
} else {
if ($group_name == "") {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
$input_data = array('group_name' => $group_name, 'group_desc' => $group_desc, 'group_role' => "1,5,17,18,22,23,24,25", 'owner_id' => UserSession::getUserId());
$group_id = UserGroup::addGroup($input_data);
if ($group_id) {
SysLog::addLog(UserSession::getUserName(), 'ADD', 'UserGroup', $group_id, json_encode($input_data));
Common::exitWithSuccess('账号组添加完成', 'complaint/group.php');
}
}
}
}
Template::assign("_POST", $_POST);
Template::display('complaint/group_add.tpl');