本文整理汇总了PHP中get_user_groups函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_groups函数的具体用法?PHP get_user_groups怎么用?PHP get_user_groups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_groups函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_template_side
public function get_template_side($module_id)
{
global $config, $template, $phpEx, $phpbb_root_path, $user, $db;
$links = array();
$portal_config = obtain_portal_config();
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
// get user's groups
$groups_ary = get_user_groups();
for ($i = 0; $i < sizeof($links); $i++)
{
if($links[$i]['type'] == self::LINK_CAT)
{
$template->assign_block_vars('portalmenu', array(
'CAT_TITLE' => (isset($user->lang[$links[$i]['title']])) ? $user->lang[$links[$i]['title']] : $links[$i]['title'],
'MODULE_ID' => $module_id,
));
}
else
{
if($links[$i]['type'] == self::LINK_INT)
{
$links[$i]['url'] = str_replace('&', '&', $links[$i]['url']); // we need to do this in order to prevent XHTML validation errors
$cur_url = append_sid($phpbb_root_path . $links[$i]['url']); // the user should know what kind of file it is
}
else
{
$cur_url = $links[$i]['url'];
}
$cur_permissions = explode(',', $links[$i]['permission']);
$permission_check = array_intersect($groups_ary, $cur_permissions);
if(!empty($permission_check) || $links[$i]['permission'] == '')
{
$template->assign_block_vars('portalmenu.links', array(
'LINK_TITLE' => (isset($user->lang[$links[$i]['title']])) ? $user->lang[$links[$i]['title']] : $links[$i]['title'],
'LINK_URL' => $cur_url,
'NEW_WINDOW' => ($links[$i]['type'] != self::LINK_INT && $config['board3_menu_url_new_window_' . $module_id]) ? true : false,
));
}
}
}
return 'main_menu_side.html';
}
示例2: combo_groups_visible_for_me
function combo_groups_visible_for_me($id_user, $form_name = "group_form", $any = 0, $perm = '', $id_group = 0, $return = false, $label = 1)
{
$output = '';
$values = array();
$groups = get_user_groups($id_user, $perm);
if ($any) {
$groups[1] = __('Any');
} else {
unset($groups[1]);
}
if ($label == 1) {
$output .= print_select($groups, $form_name, $id_group, '', '', 0, true, false, false, __('Group'));
} else {
$output .= print_select($groups, $form_name, $id_group, '', '', 0, true, false, false, '');
}
if ($return) {
return $output;
}
echo $output;
return;
}
示例3: __construct
function __construct () {
$system = System::getInstance();
$this->id_incident = (int) $system->getRequest('id_incident', 0);
$this->title = (string) $system->getRequest('title', "");
$this->description = (string) $system->getRequest('description', "");
$this->group_id = (int) $system->getRequest('group_id', -1);
if ($this->group_id == -1) {
// GET THE FIRST KNOWN GROUP OF THE USER
$user_groups = get_user_groups($system->getConfig('id_user'));
$group_id = reset(array_keys($user_groups));
$this->group_id = $group_id;
unset($group_id);
}
$this->id_creator = (string) $system->getRequest('id_creator', $system->getConfig('id_user'));
$this->id_owner = (string) $system->getRequest('id_owner', "");
$this->status = (int) $system->getRequest('status', 1);
$this->priority = (int) $system->getRequest('priority', 2);
$this->resolution = (int) $system->getRequest('resolution', 0);
$this->id_task = (int) $system->getRequest('id_task', 0);
$this->sla_disabled = (int) $system->getRequest('sla_disabled', 0);
$this->id_incident_type = (int) $system->getRequest('id_incident_type', 0);
$this->email_copy = (string) $system->getRequest('email_copy', "");
$this->email_notify = (int) $system->getRequest('email_notify', -1);
if ($this->email_notify == -1) {
$this->email_notify = (int) get_db_value ("forced_email", "tgrupo", "id_grupo", $this->group_id);
}
$this->id_parent = (int) $system->getRequest('id_parent', 0);
$this->epilog = (string) $system->getRequest('epilog', "");
// insert, update, delete, view or ""
$this->operation = (string) $system->getRequest('operation', "");
// view, files or ""
$this->tab = (string) $system->getRequest('tab', "view");
// ACL
$this->permission = $this->checkPermission ($system->getConfig('id_user'), $this->acl, $this->operation, $this->id_incident);
}
示例4: get_radls
function get_radls($user)
{
include 'config.php';
include_once 'user.php';
$user_groups = get_user_groups($user);
$sql = "select rowid,* from radls where imuser = '" . $user . "'";
$sql = $sql . " or other_r = '1'";
if (count($user_groups) > 0) {
$sql = $sql . " or (group_r = '1' and (";
for ($i = 0; $i < count($user_groups); $i++) {
$group = $user_groups[$i];
if ($i > 0) {
$sql = $sql . " or ";
}
$sql = $sql . "grpname = '" . $group['grpname'] . "'";
}
$sql = $sql . "))";
}
$db = new IMDB();
$res = $db->direct_query($sql);
$db->close();
return $res;
}
示例5: get_user_groups_for_sql
/**
* This will return a list between ( ) for use in SQL
*
* @param id_user User id
* @param permission Permission to have in the group (IR by default)
*
* @return A string ready to be used in the SQL
*/
function get_user_groups_for_sql($id_user, $access_profile = "VR")
{
global $config;
$groups = get_user_groups($config["id_user"], $access_profile);
$filter = "";
foreach ($groups as $group => $group_name) {
$filter .= $group . " , ";
}
$filter = $filter . " 1 ";
// Always 1... is "all"
$filter = "( {$filter} )";
return $filter;
}
示例6: get_parameter
if (! user_visible_for_me ($config["id_user"], $id_user)) {
audit_db ($config["id_user"], $config["REMOTE_ADDR"], "ACL Forbidden", "User ".$config["id_user"]." tried to access to user detail of '$id_user'");
no_permission ();
}
echo '<h2>'.__('User details').'</h2>';
echo '<h4>'.$id_user.'</h4>';
$upload_avatar = (bool) get_parameter ('upload_avatar');
$update_user = (bool) get_parameter ('update_user');
$has_permission = false;
if ($id_user == $config['id_user']) {
$has_permission = true;
} else {
$groups = get_user_groups ($id_user);
foreach ($groups as $group) {
if (give_acl ($config['id_user'], $group['id'], 'UM')) {
$has_permission = true;
break;
}
}
}
/* Get fields for user */
$email = $user['direccion'];
$phone = $user['telefono'];
$real_name = $user['nombre_real'];
$avatar = $user['avatar'];
$comments = $user['comentarios'];
$lang = $user['lang'];
示例7: header
<?php
require_once 'includes/all.php';
if (!is_logged_in()) {
header("Location: signin.php");
exit(0);
}
$db = connect_db();
$user_id = get_logged_in_user_id();
$user_groups = get_user_groups($db, $user_id);
if (!isset($_GET['id'])) {
if (empty($user_groups)) {
header("Location: form.php");
exit(0);
} else {
$group = get_group($db, $user_groups[0]['id']);
}
} else {
$group = get_group($db, $_GET['id']);
}
$user_email = get_user($db, $user_id)['email'];
if (!$group) {
header('Status: 404');
die('no such group');
}
$course = get_course($db, $group['course_id']);
$users = get_group_members($db, $group['id']);
$is_member = is_member($db, $user_id, $group['id']);
if ($is_member) {
$posts = get_group_posts($db, $group['id']);
}
示例8: array
echo "</ul></div>";
echo "</h4>";
}
echo $result_msg;
$table = new stdClass;
$table->width = '100%';
$table->class = 'search-table-button';
$table->data = array ();
$table->colspan = array ();
$table->colspan[1][0] = 2;
$table->colspan[2][0] = 2;
$table->data[0][0] = print_input_text ('name', $name, '', 40, 255, true, __('Name'));
$groups = get_user_groups ($config['id_user'], "VR");
$groups[0] = __('None');
$table->data[0][1] = print_select ($groups, "id_group", $id_group, '', '', 0, true, false, false, __('Group'));
$table->data[1][0] = print_textarea ('sql', 10, 100, $sql, '', true, __('Report SQL sentence'));
if (dame_admin ($config['id_user'])) {
if ($id) {
$button = print_input_hidden ('update_report', 1, true);
$button .= print_input_hidden ('id', $id, true);
$button .= print_submit_button (__('Update'), 'update', false, 'class="sub upd"', true);
} else {
$button = print_input_hidden ('create_report', 1, true);
$button .= print_submit_button (__('Create'), 'create', false, 'class="sub create"', true);
}
}
示例9: form_search_users
function form_search_users($return = false, $filter = false)
{
include_once "functions_user.php";
global $config;
$output = '';
if (!$filter) {
$offset = get_parameter("offset", 0);
$search_text = get_parameter("search_text", "");
$disabled_user = get_parameter("disabled_user", -1);
$level = get_parameter("level", -10);
$group = get_parameter("group", 0);
} else {
$offset = (int) $filter['offset'];
$search_text = (string) $filter['search_text'];
$disabled_user = (int) $filter['disabled_user'];
$level = (int) $filter['level'];
$group = (int) $filter['group'];
}
$table->id = "table-user_search";
$table->width = "99%";
$table->class = "search-table";
$table->size = array();
$table->style = array();
$table->data = array();
$table->data[0][0] = print_input_text("search_text", $search_text, '', 15, 0, true, __('Search text'));
$user_status = array();
$user_status[0] = __('Enabled');
$user_status[1] = __('Disabled');
$table->data[0][1] = print_select($user_status, 'disabled_user', $disabled_user, '', __('Any'), -1, true, 0, false, __('User status'));
$global_profile = array();
$global_profile[-1] = __('External');
$global_profile[0] = __('Standard');
$global_profile[1] = __('Administrator');
$table->data[0][2] = print_select($global_profile, 'level', $level, '', __('Any'), -10, true, 0, false, __('Global profile'));
$group_name = get_user_groups();
$group_name[-1] = __('Groupless');
$table->data[0][3] = print_select($group_name, 'group', $group, '', __('Any'), 0, true, 0, false, __('Group'));
$table->data[0][4] = print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
$output .= '<form name="bskd" method=post id="saved-user-form" action="index.php?sec=users&sec2=godmode/usuarios/lista_usuarios">';
$output .= print_table($table, true);
$output .= '</form>';
if ($return) {
return $output;
}
echo $output;
}
示例10: snapshots_check_path
/** validate and massage the user-supplied data path
*
* this checks the directory path the user entered,
* returns TRUE if the tests are passed.
*
* There three places from which snapshots can be retrieved:
* - /areas/aaa
* - /users/uuu
* - /groups/ggg
*
* That is: the path should at least contain 2 levels (and possibly more).
* In other words: a bare '/' is not enough and neither are bare '/areas',
* '/users' or '/groups'. And of course the directory should already exist
* in the file systen under $CFG->datadir.
*
* Various tests are done:
* - the selected area directory must be active
* - if the selected area is private,
* $USER must have intranet access for this area, OR
* the selected area must be the same as the area in which $node_id resides
* - the selected user directory must be the $USER's, OR
* the $USER has access to the account manager (able to manipulate ALL users' directories)
* - the selected group directory must be from a group the $USER is a member of, OR
* the $USER has access to the account manager (able to manipulate ALL groups' directories)
*
* If all tests succeed, we may want to warn the user in the case that the
* file location is in a different (and public) area than the node holding the snapshots module.
* However, this is a warning only.
*
* Finally, we reconstruct the path in such a way that it starts with a slash
* and does NOT end with a slash. This is done by changing the content of the $item parameter.
*
* @param array &$item holds the field definition from the $dialogdef for the snapshots_path
* @param int $area_id the area in which we are editing a snapshot module configuration
* @param int $node_id the node to which the snapshot module is connected (unused)
* @return bool TRUE if valid path, otherwise FALSE + messages in dialogdef
* @todo should the user / group really be active here? If not, the images will fail in file.php
* but that may leak information about inactive users. Hmmm...
* @todo we should use a different error message as soon as it is available in was.php,
* eg. 'validate_bad_directory' (much like 'validate_bad_filename').
*/
function snapshots_check_path(&$item, $area_id, $node_id)
{
global $USER, $CFG;
$warning = '';
$invalid = FALSE;
$path_components = explode('/', trim(strtr($item['value'], '\\', '/'), '/'));
if (sizeof($path_components) < 2 || in_array('..', $path_components)) {
$invalid = TRUE;
} else {
switch ($path_components[0]) {
case 'areas':
$fields = array('area_id', 'is_private', 'title');
$where = array('is_active' => TRUE, 'path' => $path_components[1]);
$table = 'areas';
if (($record = db_select_single_record($table, $fields, $where)) === FALSE) {
// area doesn't exist or is inactive
$invalid = TRUE;
} elseif (db_bool_is(TRUE, $record['is_private'])) {
// specified area is private
if (intval($record['area_id']) != $area_id || !$USER->has_intranet_permissions(ACL_ROLE_INTRANET_ACCESS, $record['area_id'])) {
// this private area is NOT the one where $node_id resides OR this user is denied access
$invalid = TRUE;
}
} else {
// specified area is public
if (intval($record['area_id']) != $area_id) {
// but it is not the same as the one where $node_id resides: go warn user eventually!
$params = array('{AREANAME}' => htmlspecialchars($record['title']));
$warning = t('warning_different_area', 'm_snapshots', $params);
}
}
break;
case 'users':
if (!$USER->has_job_permissions(JOB_PERMISSION_ACCOUNTMANAGER) && $path_components[1] != $USER->path) {
$invalid = TRUE;
}
if ($path_components[1] == $USER->path) {
$warning = t('warning_personal_directory', 'm_snapshots');
}
break;
case 'groups':
if (!$USER->has_job_permissions(JOB_PERMISSION_ACCOUNTMANAGER)) {
$usergroups = get_user_groups($USER->user_id);
$is_member = FALSE;
foreach ($usergroups as $group_id => $usergroup) {
if ($usergroup['path'] == $path_components[1]) {
$is_member = TRUE;
break;
}
}
if (!$is_member) {
$invalid = TRUE;
}
}
break;
default:
$invalid = TRUE;
break;
}
//.........这里部分代码省略.........
示例11: check_login
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// LOAD GLOBAL VARS
global $config;
// CHECK LOGIN AND ACLs
check_login();
if (!give_acl($config['id_user'], 0, "IR")) {
audit_db($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access ticket viewer");
require "general/noaccess.php";
exit;
}
// GET THE FIRST KNOWN GROUP OF THE USER
$user_groups = get_user_groups($config['id_user']);
$group_id = reset(array_keys($user_groups));
// GET PRIORITIES
$priorities = get_priorities();
// GET INCIDENT TYPES
$types = get_incident_types();
echo "<h1>" . __('CREATE TICKET') . "</h1>";
echo "<div id=msg-str></div>";
// NEW INCIDENT FORM
echo "<div id='form_file'>";
$table->width = '98%';
$table->class = 'search-table';
$table->id = "incident-editor";
$table->style = array();
$table->data = array();
$table->colspan = array();
示例12: array
<div id="main">
<?php
$password = "";
$permissions = 0;
$user_groups = array(array('grpname' => 'users'));
if (isset($username)) {
$user = get_user($username);
$password = $user['password'];
$permissions = $user['permissions'];
$user_groups = get_user_groups($username);
?>
<br>
<div class='h1'>:: Edit User ::</div>
<div id="caja_form_users">
<form action="userinfo.php" method="post" onsubmit="javascript:set_users()">
<input type="hidden" name="op" value="edit"/>
<input type="hidden" name="id" value="<?php
echo $username;
?>
"/>
<?php
} else {
?>
示例13: session_start
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!isset($_SESSION)) {
session_start();
}
include 'user.php';
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
$user = $_SESSION['user'];
$user_groups = get_user_groups($user);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" >
<title>Infrastructure Manager | GRyCAP | UPV</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
<link rel="stylesheet" href="css/style_login2.css">
<link rel="stylesheet" href="css/style_intro2.css">
<link rel="stylesheet" href="css/style_menu2.css">
<link rel="stylesheet" href="css/style_menutab.css">
示例14: __
echo '<td>' . $user['nombre_real'] . '</td>';
echo '<td>' . $user['comentarios'] . '</td>';
echo '</tr>';
$total_users++;
}
if ($total_users == 0) {
echo '<tr colspan="4">' . __('No users found') . '</tr>';
}
if (defined('AJAX')) {
return;
}
}
$table->data = array();
$table->width = '90%';
$table->data[0][0] = print_select_from_sql('SELECT id,name FROM trole ORDER BY 2', 'user_profile_search', $id_profile, '', __('Any'), 0, true, false, false, __('Role'));
$table->data[0][1] = print_select(get_user_groups(), 'user_group_search', $id_group, '', __('Any'), -1, true, false, false, __('Group'));
$table->data[2][0] = print_input_text('search_string', '', '', 20, 255, true, __('Name'));
$table->data[2][1] = print_submit_button(__('Search'), 'search_button', false, 'class="sub search"', true);
echo '<form id="user_search_form" method="post">';
print_table($table);
print_input_hidden('search', 1);
echo '</form>';
unset($table);
$table->class = 'hide result_table listing';
$table->width = '90%';
$table->id = 'user_search_result_table';
$table->head = array();
$table->head[0] = __('Username');
$table->head[1] = __('Real name');
$table->head[2] = __('Comments');
print_table($table);
示例15: combo_project_user
echo "<tr class='hide_first_fields_formulary'><td>";
combo_project_user ($id_project, $config["id_user"], 0, false, true, $start_date, $end_date, $user_id);
echo "<td>";
echo combo_task_user_participant_full_report ($config["id_user"], false, $id_task, true, __('Task'), false, true, false, '',
false, false, $start_date, $end_date, $user_id);
echo "<tr class='hide_second_fields_formulary'><td>";
echo print_select (get_user_groups (), 'search_id_group', $id_group, '', __('All'), 1, true, false, false, __('Group'));
echo "<td>";
echo combo_incident_resolution ($resolution, false, true);
echo "<td>";
echo print_select (get_user_groups (), 'id_group_creator', $id_group_creator, '', __('All'), 1, true, false, false, __('Creator group'));
echo "<tr class='hide_second_fields_formulary'><td>";
$params_creator['input_id'] = 'text-user_id2';
$params_creator['input_name'] = 'author';
$params_creator["input_value"] = $author;
$params_creator["title"] = __("Ticket creator");
$params_creator['return'] = false;
$params_creator['return_help'] = true;
user_print_autocomplete_input($params_creator);
echo "<td>";
$params_editor['input_id'] = 'text-user_id3';