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'; }
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; }
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); }
function get_radls($user) { include 'config.php'; include_once 'user.php'; $user_groups = get_user_groups($user); $sql = "select rowid,* from radls where imuser = '******'"; $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; }
/** * 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; }
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'];
<?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']); }
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); } }
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; }
/** 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; } } if (!$invalid) { $path = '/' . implode('/', $path_components); if (!is_dir($CFG->datadir . $path)) { $invalid = TRUE; } } if ($invalid) { $fname = str_replace('~', '', $item['label']); $params = array('{PATH}' => htmlspecialchars($item['value'])); $error_message = sprintf('%s: %s', $fname, t('invalid_path', 'admin', $params)); ++$item['errors']; $item['error_messages'][] = $error_message; return FALSE; } if ($warning != '') { $item['warnings'] = 0; ++$item['warnings']; $item['warning_messages'] = $warning; } $item['value'] = $path; return TRUE; }
// 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();
<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 { ?>
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">
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);
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';
function user_groups($groups) { return get_user_groups($groups); }
function users_get_groups_for_select($id_user, $privilege = "IR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') { if ($id_groups === false) { $id_groups = null; } $user_groups = get_user_groups($id_user, $privilege, $returnAllGroup, $returnAllColumns); /* $user_groups_flag_si = get_user_groups ($id_user, "SI", $returnAllGroup, $returnAllColumns); if (!empty($user_groups_flag_si)) { foreach ($user_groups_flag_si as $group_flag) { array_push ($user_groups, $group_flag); } } */ if ($id_groups !== null) { $childrens = groups_get_childrens($id_groups); foreach ($childrens as $child) { unset($user_groups[$child['id_grupo']]); } unset($user_groups[$id_groups]); } if (empty($user_groups)) { $user_groups_tree = array(); } else { // First group it's needed to retrieve its parent group $repair = array_slice($user_groups, 0, 1); $first_group = reset($repair); $parent_group = $first_group['parent']; $user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group); } $fields = array(); foreach ($user_groups_tree as $group) { //$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false); $groupName = safe_output($group['nombre']); $fields[$group[$keys_field]] = str_repeat(" ", $group['deep']) . $groupName; } return $fields; }
public function get_template_side($module_id) { global $config, $template, $user, $phpbb_root_path, $phpEx, $db; $portal_config = obtain_portal_config(); // 0 = Sunday first - 1 = Monday first. ;-) if ($config['board3_sunday_first_' . $module_id]) { $this->mini_cal_fdow = 0; } else { $this->mini_cal_fdow = 1; } // get the calendar month $this->mini_cal_month = 0; if(isset($_GET['m' . $module_id]) || isset($_POST['m' . $module_id])) { $this->mini_cal_month = request_var('m' . $module_id, 0); } // initialise some variables $today_timestamp = time() + $user->timezone + $user->dst; $mini_cal_today = date('Ymd', time() + $user->timezone + $user->dst - date('Z')); $s_cal_month = ($this->mini_cal_month != 0) ? $this->mini_cal_month . ' month' : $mini_cal_today; $this->getMonth($s_cal_month); $mini_cal_count = $this->mini_cal_fdow; $mini_cal_this_year = $this->dateYYYY; $mini_cal_this_month = $this->dateMM; $mini_cal_this_day = $this->dateDD; $mini_cal_month_days = $this->daysMonth; // output our general calendar bits $down = $this->mini_cal_month - 1; $up = $this->mini_cal_month + 1; $prev_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m$module_id=$down#minical$module_id") . '"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="<<" /></a>'; $next_month = '<a href="' . append_sid("{$phpbb_root_path}portal.$phpEx", "m$module_id=$up#minical$module_id") . '"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt=">>" /></a>'; $template->assign_block_vars('minical', array( 'S_SUNDAY_FIRST' => ($config['board3_sunday_first_' . $module_id]) ? true : false, 'L_MINI_CAL_MONTH' => (($config['board3_long_month_' . $module_id]) ? $user->lang['mini_cal']['long_month'][$this->day[0][1]] : $user->lang['mini_cal']['month'][$this->day[0][1]]) . " " . $this->day[0][2], 'L_MINI_CAL_SUN' => '<span style="color: ' . $config['board3_calendar_sunday_color_' . $module_id] . ';">' . $user->lang['mini_cal']['day'][1] . '</span>', 'L_MINI_CAL_MON' => $user->lang['mini_cal']['day'][2], 'L_MINI_CAL_TUE' => $user->lang['mini_cal']['day'][3], 'L_MINI_CAL_WED' => $user->lang['mini_cal']['day'][4], 'L_MINI_CAL_THU' => $user->lang['mini_cal']['day'][5], 'L_MINI_CAL_FRI' => $user->lang['mini_cal']['day'][6], 'L_MINI_CAL_SAT' => $user->lang['mini_cal']['day'][7], 'U_PREV_MONTH' => $prev_month, 'U_NEXT_MONTH' => $next_month, 'S_DISPLAY_EVENTS' => ($config['board3_display_events_' . $module_id]) ? true : false, 'MODULE_ID' => $module_id, )); // output the days for the current month for($i = 0; $i < $mini_cal_month_days;) { // is this the first day of the week? if($mini_cal_count == $this->mini_cal_fdow) { $template->assign_block_vars('minical.mini_cal_row', array( 'MODULE_ID' => $module_id, )); } // is this a valid weekday? if($mini_cal_count == ($this->day[$i][3])) { $mini_cal_this_day = $this->day[$i][0]; $d_mini_cal_today = $mini_cal_this_year . (($mini_cal_this_month <= 9) ? '0' . $mini_cal_this_month : $mini_cal_this_month) . (($mini_cal_this_day <= 9) ? '0' . $mini_cal_this_day : $mini_cal_this_day); $mini_cal_day = ($mini_cal_today == $d_mini_cal_today) ? '<span style="font-weight: bold; color: ' . $config['board3_calendar_today_color_' . $module_id] . ';">' . $mini_cal_this_day . '</span>' : $mini_cal_this_day; $template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array( 'MINI_CAL_DAY' => ($mini_cal_count == 0) ? '<span style="color: ' . $config['board3_calendar_sunday_color_' . $module_id] . ';">' . $mini_cal_day . '</span>' : $mini_cal_day) ); $i++; } // no day else { $template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array( 'MINI_CAL_DAY' => ' ') ); } // is this the last day of the week? if ($mini_cal_count == self::DAYS_PER_WEEK) { // if so then reset the count $mini_cal_count = 0; } else { // otherwise increment the count $mini_cal_count++; } } /* * Let's start displaying the events * make sure we only display events in the future */ $events = $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]); if(!empty($events) && $config['board3_display_events_' . $module_id]) { // we sort the $events array by the start time foreach($events as $key => $cur_event) { $time_ary[$key] = $cur_event['start_time']; } array_multisort($time_ary, SORT_NUMERIC, $events); $groups_ary = get_user_groups(); foreach($events as $key => $cur_event) { if(($cur_event['start_time'] + $user->timezone + $user->dst) >= $today_timestamp || ($cur_event['end_time'] + $user->timezone + $user->dst) >= $today_timestamp || (($cur_event['start_time'] + $user->timezone + $user->dst + self::TIME_DAY) >= $today_timestamp && $cur_event['all_day'])) { $cur_permissions = explode(',', $cur_event['permission']); $permission_check = array_intersect($groups_ary, $cur_permissions); if(!empty($permission_check) || $cur_event['permission'] == '') { // check if this is an external link if (isset($cur_event['url']) && strpos($cur_event['url'], generate_board_url()) === false) { $is_external = true; } else { $is_external = false; } /** * Current events * * Events are treated as current if the following is met: * - We have an all day event and the start of that event is less than 1 day (86400 seconds) away * - We have a normal event with a start that is less then 1 day away and that hasn't ended yet */ if((($cur_event['start_time'] + $user->timezone + $user->dst - $today_timestamp) <= self::TIME_DAY && $cur_event['all_day']) || (($cur_event['start_time'] + $user->timezone + $user->dst - $today_timestamp) <= self::TIME_DAY && ($cur_event['end_time'] + $user->timezone + $user->dst) >= $today_timestamp)) { $template->assign_block_vars('minical.cur_events', array( 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url($cur_event['url']) : '', 'EVENT_TITLE' => $cur_event['title'], 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), 'END_TIME' => (!empty($cur_event['end_time'])) ? $user->format_date($cur_event['end_time'], 'j. M Y, H:i') : false, 'EVENT_DESC' => (isset($cur_event['desc']) && $cur_event['desc'] != '') ? $cur_event['desc'] : '', 'ALL_DAY' => ($cur_event['all_day']) ? true : false, 'MODULE_ID' => $module_id, 'EVENT_URL_NEW_WINDOW' => ($is_external && $config['board3_events_url_new_window_' . $module_id]) ? true : false, )); } else { $template->assign_block_vars('minical.upcoming_events', array( 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url($cur_event['url']) : '', 'EVENT_TITLE' => $cur_event['title'], 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), 'END_TIME' => (!$cur_event['all_day']) ? $user->format_date($cur_event['end_time'], 'j. M Y, H:i') : '', 'EVENT_DESC' => (isset($cur_event['desc']) && $cur_event['desc'] != '') ? $cur_event['desc'] : '', 'ALL_DAY' => (($cur_event['start_time'] - $cur_event['end_time']) == 1) ? true : false, 'MODULE_ID' => $module_id, 'EVENT_URL_NEW_WINDOW' => ($is_external && $config['board3_events_url_new_window_' . $module_id]) ? true : false, )); } } } } } return 'calendar_side.html'; }
function get_news($arguments) { global $config; if (isset($arguments['id_user'])) { $id_user = $arguments['id_user']; } else { $id_user = $config['id_user']; } if (isset($arguments['limit'])) { $limit = $arguments['limit']; } else { $limit = 99999999; } $groups = get_user_groups($id_user); if (empty($groups)) { $id_group = 0; } else { $groups = array_keys($groups); $id_group = implode(',', $groups); } $current_datetime = date('Y-m-d H:i:s', time()); $sql = sprintf("SELECT title,content,`date`,creator\n\t\t\t\tFROM tnewsboard WHERE id_group IN (%s) AND \n\t\t\t\t\t\t\t\t(expire = 0 OR (expire = 1 AND expire_timestamp > '%s'))\n\t\t\t\tORDER BY `date` DESC\n\t\t\t\tLIMIT %s", $id_group, $current_datetime, $limit); $news = get_db_all_rows_sql($sql); if (empty($news)) { $news = array(); } return $news; }
require_once 'includes/all.php'; if (!is_logged_in()) { header("Location: signin.php"); exit(0); } if (!isset($_GET['id'])) { // um header('Status: 404'); die('missing id'); } $db = connect_db(); if (!is_member($db, get_logged_in_user_id(), $_REQUEST['id'])) { header("Status: 403 Forbidden"); exit("403 Forbidden"); } $user_groups = get_user_groups($db, get_logged_in_user_id()); $group = get_group($db, $_GET['id']); $members = get_group_members($db, $_GET['id']); ?> <!DOCTYPE html> <html> <head> <title> Members Editing | Study Group Finder </title> <script src="js/jquery-1.12.1.min.js" type="text/javascript"></script> <script> function reload(id){ self.location="members_edit.php?id="+id; } </script> <?php
function api_get_groups($return_type, $user, $return_group_all) { $groups = get_user_groups($user); if (!$return_group_all) { unset($groups[1]); } $ret = ''; if ($return_type == 'xml') { $ret = "<xml>\n"; } foreach ($groups as $index => $item) { switch ($return_type) { case "xml": $ret .= "<group>\n"; $ret .= "<id>" . $index . "</id>\n"; $ret .= "<name>" . $item . "</name>\n"; $ret .= "</group>\n"; break; case "csv": $ret .= array_to_csv(array($index, $item)); break; } } if ($return_type == 'xml') { $ret .= "</xml>\n"; } return $ret; }
/** * {@inheritdoc} */ public function get_template_side($module_id) { $portal_config = obtain_portal_config(); // 0 = Sunday first - 1 = Monday first. ;-) if ($this->config['board3_sunday_first_' . $module_id]) { $this->mini_cal_fdow = 0; } else { $this->mini_cal_fdow = 1; } // get the calendar month $this->mini_cal_month = 0; if ($this->request->is_set('m' . $module_id)) { $this->mini_cal_month = $this->request->variable('m' . $module_id, 0); } // initialise some variables $this->time = $this->user->create_datetime(); $now = phpbb_gmgetdate($this->time->getTimestamp() + $this->time->getOffset()); $today_timestamp = $now[0]; $mini_cal_today = date('Ymd', $today_timestamp); $this->stamp = (int) $today_timestamp; $s_cal_month = $this->mini_cal_month != 0 ? $this->mini_cal_month . ' month' : $mini_cal_today; $this->get_month($s_cal_month); $mini_cal_count = $this->mini_cal_fdow; $mini_cal_this_year = $this->dateYYYY; $mini_cal_this_month = $this->dateMM; $mini_cal_month_days = $this->daysMonth; // output our general calendar bits $down = $this->mini_cal_month - 1; $up = $this->mini_cal_month + 1; $prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m{$module_id}={$down}#minical{$module_id}" . '" rel="nofollow"><span class="portal-arrow-left-icon" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '"></span></a>'; $next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m{$module_id}={$up}#minical{$module_id}" . '" rel="nofollow"><span class="portal-arrow-right-icon" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '"></span></a>'; $this->template->assign_block_vars('minical', array('S_SUNDAY_FIRST' => $this->config['board3_sunday_first_' . $module_id] ? true : false, 'L_MINI_CAL_MONTH' => ($this->config['board3_long_month_' . $module_id] ? $this->user->lang['mini_cal']['long_month'][$this->day[0][1]] : $this->user->lang['mini_cal']['month'][$this->day[0][1]]) . " " . $this->day[0][2], 'L_MINI_CAL_SUN' => '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $this->user->lang['mini_cal']['day'][1] . '</span>', 'L_MINI_CAL_MON' => $this->user->lang['mini_cal']['day'][2], 'L_MINI_CAL_TUE' => $this->user->lang['mini_cal']['day'][3], 'L_MINI_CAL_WED' => $this->user->lang['mini_cal']['day'][4], 'L_MINI_CAL_THU' => $this->user->lang['mini_cal']['day'][5], 'L_MINI_CAL_FRI' => $this->user->lang['mini_cal']['day'][6], 'L_MINI_CAL_SAT' => $this->user->lang['mini_cal']['day'][7], 'U_PREV_MONTH' => $prev_month, 'U_NEXT_MONTH' => $next_month, 'S_DISPLAY_EVENTS' => $this->config['board3_display_events_' . $module_id] ? true : false, 'MODULE_ID' => $module_id)); // output the days for the current month for ($i = 0; $i < $mini_cal_month_days;) { // is this the first day of the week? if ($mini_cal_count == $this->mini_cal_fdow) { $this->template->assign_block_vars('minical.mini_cal_row', array('MODULE_ID' => $module_id)); } // is this a valid weekday? if ($mini_cal_count == $this->day[$i][3]) { $mini_cal_this_day = $this->day[$i][0]; $d_mini_cal_today = $mini_cal_this_year . ($mini_cal_this_month <= 9 ? '0' . $mini_cal_this_month : $mini_cal_this_month) . ($mini_cal_this_day <= 9 ? '0' . $mini_cal_this_day : $mini_cal_this_day); $mini_cal_day = $mini_cal_today == $d_mini_cal_today ? '<span style="font-weight: bold; color: ' . $this->config['board3_calendar_today_color_' . $module_id] . ';">' . $mini_cal_this_day . '</span>' : $mini_cal_this_day; $this->template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array('MINI_CAL_DAY' => $mini_cal_count == 0 ? '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $mini_cal_day . '</span>' : $mini_cal_day)); $i++; } else { $this->template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array('MINI_CAL_DAY' => ' ')); } // is this the last day of the week? if ($mini_cal_count == self::DAYS_PER_WEEK) { // if so then reset the count $mini_cal_count = 0; } else { // otherwise increment the count $mini_cal_count++; } } // fill table with empty strings while ($mini_cal_count <= self::DAYS_PER_WEEK) { $this->template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array('MINI_CAL_DAY' => ' ')); $mini_cal_count++; } /* * Let's start displaying the events * make sure we only display events in the future */ $events = json_decode($portal_config['board3_calendar_events_' . $module_id], true); if (!empty($events) && $this->config['board3_display_events_' . $module_id]) { $time_ary = array(); // we sort the $events array by the start time foreach ($events as $key => $cur_event) { $time_ary[$key] = $cur_event['start_time']; } array_multisort($time_ary, SORT_NUMERIC, $events); $groups_ary = get_user_groups(); foreach ($events as $key => $cur_event) { if ($cur_event['start_time'] + $this->time->getOffset() >= $today_timestamp || $cur_event['end_time'] + $this->time->getOffset() >= $today_timestamp || $cur_event['start_time'] + $this->time->getOffset() + self::TIME_DAY >= $today_timestamp && $cur_event['all_day']) { $cur_permissions = explode(',', $cur_event['permission']); $permission_check = array_intersect($groups_ary, $cur_permissions); if (!empty($permission_check) || $cur_event['permission'] == '') { // check if this is an external link if (isset($cur_event['url']) && strpos($cur_event['url'], generate_board_url()) === false) { $is_external = true; } else { $is_external = false; } /** * Current events * * Events are treated as current if the following is met: * - We have an all day event and the start of that event is less than 1 day (86400 seconds) away * - We have a normal event with a start that is less then 1 day away and that hasn't ended yet */ if ($cur_event['start_time'] + $this->time->getOffset() - $today_timestamp <= self::TIME_DAY && $cur_event['all_day'] || $cur_event['start_time'] + $this->time->getOffset() - $today_timestamp <= self::TIME_DAY && $cur_event['end_time'] + $this->time->getOffset() >= $today_timestamp) { $this->template->assign_block_vars('minical.cur_events', array('EVENT_URL' => isset($cur_event['url']) && $cur_event['url'] != '' ? $this->validate_url($cur_event['url']) : '', 'EVENT_TITLE' => $cur_event['title'], 'START_TIME' => $this->user->format_date($cur_event['start_time']), 'END_TIME' => !empty($cur_event['end_time']) ? $this->user->format_date($cur_event['end_time']) : false, 'EVENT_DESC' => isset($cur_event['desc']) && $cur_event['desc'] != '' ? $cur_event['desc'] : '', 'ALL_DAY' => $cur_event['all_day'] ? true : false, 'MODULE_ID' => $module_id, 'EVENT_URL_NEW_WINDOW' => $is_external && $this->config['board3_events_url_new_window_' . $module_id] ? true : false)); } else { $this->template->assign_block_vars('minical.upcoming_events', array('EVENT_URL' => isset($cur_event['url']) && $cur_event['url'] != '' ? $this->validate_url($cur_event['url']) : '', 'EVENT_TITLE' => $cur_event['title'], 'START_TIME' => $this->user->format_date($cur_event['start_time']), 'END_TIME' => !$cur_event['all_day'] ? $this->user->format_date($cur_event['end_time']) : '', 'EVENT_DESC' => isset($cur_event['desc']) && $cur_event['desc'] != '' ? $cur_event['desc'] : '', 'ALL_DAY' => $cur_event['start_time'] - $cur_event['end_time'] == 1 ? true : false, 'MODULE_ID' => $module_id, 'EVENT_URL_NEW_WINDOW' => $is_external && $this->config['board3_events_url_new_window_' . $module_id] ? true : false)); } } } } } return 'calendar_side.html'; }
} } $count_cs = filter_incidents ($filter_search, true); $custom .="<div class='custom_search'>"; $custom .= "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_search&saved_searches=".$cs["id"]."'>".$cs["name"]." ". "(". $count_cs.")" . "</a><br>"; $custom .="</div>"; } $custom .= "<div style='clear:both;'></div>"; } $table->colspan[0][0] = 2; $table->data[0][0] = print_container('incident_custom_search', __('Custom search'), $custom); $groups = get_user_groups(); asort($groups); $search_by_group = "<table>"; // Remove group All for this filter unset($groups[1]); $count = 0; foreach ($groups as $key => $grp) { $incidents = get_incidents("id_grupo = $key AND estado <> 7", true); if (!$incidents) { continue;
/** construct a FileManager object (called from /program/main_admin.php) * * This initialises the FileManager, checks user permissions and * finally dispatches the tasks. If the specified task is not * recognised, the default task TASK_LIST_DIRECTORY is executed. * * Note that many commands act on the directory contained in the * SESSION-variable current_directory. * * @param object &$output collects the html output * @param string $job indicates the mode: filemanager, filebrowser (FCKEditor) or imagebrowser (FCKEditor) * @return void results are returned as output in $this->output * @todo a nice filter for JOB_IMAGEBROWSER and also an alternative user interface for browsing/selecting images */ function FileManager(&$output, $job = JOB_FILEMANAGER) { global $USER, $CFG; $this->output =& $output; $this->job = $job; // Prepare lists of allowed filename extensions for browsing/uploading and set show thumbnail flag switch ($this->job) { case JOB_FILEBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_files); break; case JOB_IMAGEBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_images); break; case JOB_FLASHBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_flash); break; case JOB_FILEMANAGER: $allowed_extensions_list = $CFG->filemanager_files; $this->show_thumbnails = FALSE; $this->ext_allow_upload = $this->allowed_extensions($CFG->filemanager_files); $this->ext_allow_browse = TRUE; break; default: logger(sprintf('%s.%s(): weird job \'%s\' so no allowed file extensions at all, sorry about that', __CLASS__, __FUNCTION__, $this->job)); $this->show_thumbnails = FALSE; $this->ext_allow_upload = FALSE; $this->ext_allow_browse = FALSE; break; } $this->output->set_helptopic('filemanager'); $this->areas = get_area_records(); $this->usergroups = get_user_groups($USER->user_id); $this->sort = SORTBY_FILE_ASC; // Make absolutely sure we do have a valid working directory (default to the user's 'My Files') if (!isset($_SESSION['current_directory'])) { $_SESSION['current_directory'] = '/users/' . $USER->path; } elseif (($_SESSION['current_directory'] = $this->valid_path($_SESSION['current_directory'])) === FALSE) { $_SESSION['current_directory'] = '/users/' . $USER->path; } $this->current_directory =& $_SESSION['current_directory']; $task = get_parameter_string('task', TASK_LIST_DIRECTORY); switch ($task) { case TASK_LIST_DIRECTORY: $this->task_list_directory(); break; case TASK_CHANGE_DIRECTORY: $this->task_change_directory(); break; case TASK_PREVIEW_FILE: $this->task_preview_file(); break; case TASK_REMOVE_FILE: $this->task_remove_file(); break; case TASK_REMOVE_DIRECTORY: $this->task_remove_directory(); break; case TASK_REMOVE_MULTIPLE_FILES: $this->task_remove_multiple_files(); break; case TASK_ADD_FILE: $this->task_add_file(); break; case TASK_ADD_DIRECTORY: $this->task_add_directory(); break; default: $s = utf8_strlen($task) <= 50 ? $task : utf8_substr($task, 0, 44) . ' (...)'; $message = t('task_unknown', 'admin', array('{TASK}' => htmlspecialchars($s))); $this->output->add_message($message); logger(__FUNCTION__ . '(): unknown task: ' . htmlspecialchars($s)); $this->task_list_directory(); break; } }
<th style="font-style:italic;">    Delete</th> </tr> </thead> <tbody> <?php foreach ($users as $user) { ?> <tr> <td> <?php echo $user['username']; ?> </td> <td> <?php $groups = get_user_groups($user['username']); foreach ($groups as $group) { echo $group['grpname'] . "<br>"; } ?> </td> <td> <?php if ($user['permissions']) { echo "Administrator"; } else { echo "Standard"; } ?> </td> <td>
$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')); $table->data[0][3] = print_select(get_user_groups(), 'group', $group, '', __('Any'), 0, true, 0, false, __('Group')); $table->data[0][4] = print_submit_button(__('Search'), 'search', false, 'class="sub search"', true); echo "<form name='bskd' method=post action='index.php?sec=users&sec2=godmode/usuarios/lista_usuarios'>"; print_table($table); echo "</form>"; $search = "WHERE 1=1 "; if ($search_text != "") { $search .= " AND (id_usuario LIKE '%{$search_text}%' OR comentarios LIKE '%{$search_text}%' OR nombre_real LIKE '%{$search_text}%' OR direccion LIKE '%{$search_text}%')"; } if ($disabled_user > -1) { $search .= " AND disabled = {$disabled_user}"; } if ($level > -10) { $search .= " AND nivel = {$level}"; } if ($group > 0) {