* DATE: 12-12-2014 * DETAILS: Administers member (admin) accounts ***************************************/ ini_set('memory_limit', '128M'); ini_set('max_execution_time', '0'); $post_vars = filter_input_array(INPUT_POST); $user_name = ''; $action = isset($post_vars['action']) ? ucfirst(strtolower($post_vars['action'])) : 'Add'; if (!empty($post_vars)) { $msg = save($action); } $id = (isset($post_vars['id']) and $action != 'Add') ? $post_vars['id'] : getNextID(); $id = $id <= 0 ? getNextID() : $id; if (isset($post_vars['memberSelect'])) { $id = $post_vars['memberSelect']; $data = getMemberData($post_vars['memberSelect']); $id = $data['id']; $user_name = $data['user_name']; } $upperScripts = $template->getSection('UpperScripts'); $XmlEntities = array('&' => '&', '<' => '<', '>' => '>', ''' => '\'', '"' => '"'); $AdminsOpts = getAdminsOpts(); $membersForm = $template->getSection('MembersForm'); $members_list_form = $template->getSection('MembersListForm'); $showHelp = $template->getSection('MembersShowHelp'); $topNav = $template->getSection('TopNav'); $leftNav = $template->getSection('LeftNav'); $main = $template->getSection('Main'); $navHeader = $template->getSection('NavHeader'); $FooterInfo = getFooter(); $errMsgClass = !empty($msg) ? "ShowError" : "HideError";
<?php define('AT_INCLUDE_PATH', '../../include/'); require_once AT_INCLUDE_PATH . 'vitals.inc.php'; require_once 'lib/ACUser.php'; require_once 'lib/ACRoom.php'; require_once 'lib/lib.php'; $courseid = $_SESSION['course_id']; $member = getMemberData(); if (!$member) { $msg->addError('adobe_connect_wrong_member_sess'); } $assign = getMemberCourseAssign(); if (!$assign) { $msg->addError('adobe_connect_no_access'); } $acuser = new ACUser(); $acroom = new ACRoom(); // admin session $xsid = $acuser->getAdminSession(); if (!$xsid) { $msg->addError('adobe_connect_not_connect'); echo '<script> window.opener.location.reload(); window.close(); </script>'; } else { // room id $scoid = $acroom->checkRoom($xsid, $courseid); if (!$scoid) { // comprovar que l'usuari té accés al mòdul
ini_set('memory_limit', '128M'); ini_set('max_execution_time', '0'); $myPost = print_r($_POST, true); #$msg = "<pre>$myPost</pre><br>\n"; #if (!empty($_POST)) die ("<pre>\n Post Vars:\n$myPost\n</pre>\n"); $uname = ''; $action = isset($_POST['action']) ? ucfirst(strtolower($_POST['action'])) : 'Add'; if (!empty($_POST)) { $msg = save($action); #$action = ($action == 'editfromlist') ? 'Edit' : $action; } $id = (isset($_POST['id']) and $action != 'Add') ? $_POST['id'] : getNextID(); $id = $id <= 0 ? getNextID() : $id; if (isset($_POST['memberSelect'])) { $id = $_POST['memberSelect']; getMemberData($_POST['memberSelect']); } $upperScripts = <<<endScript <script type="text/javascript"> <!-- function showMe() { var sh = document.getElementById('showHelp'); var tf = document.getElementById('membersForm'); sh.style.display = 'block'; tf.style.display = 'none'; } function hideMe() { var sh = document.getElementById('showHelp'); var tf = document.getElementById('membersForm'); sh.style.display = 'none';
/** * This function handles submitted forms that add, modify or remove ban triggers. */ public function action_edit2() { global $context; require_once SUBSDIR . '/Bans.subs.php'; // Check with security first checkSession(); validateToken('admin-bet'); $ban_errors = Error_Context::context('ban', 1); // Adding or editing a ban group if (isset($_POST['add_ban']) || isset($_POST['modify_ban'])) { $ban_info = array(); // Let's collect all the information we need $ban_info['id'] = isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0; $ban_info['is_new'] = empty($ban_info['id']); $ban_info['expire_date'] = !empty($_POST['expire_date']) ? (int) $_POST['expire_date'] : 0; $ban_info['expiration'] = array('status' => isset($_POST['expiration']) && in_array($_POST['expiration'], array('never', 'one_day', 'expired')) ? $_POST['expiration'] : 'never', 'days' => $ban_info['expire_date']); $ban_info['db_expiration'] = $ban_info['expiration']['status'] == 'never' ? 'NULL' : ($ban_info['expiration']['status'] == 'one_day' ? time() + 24 * 60 * 60 * $ban_info['expire_date'] : 0); $ban_info['full_ban'] = empty($_POST['full_ban']) ? 0 : 1; $ban_info['reason'] = !empty($_POST['reason']) ? Util::htmlspecialchars($_POST['reason'], ENT_QUOTES) : ''; $ban_info['name'] = !empty($_POST['ban_name']) ? Util::htmlspecialchars($_POST['ban_name'], ENT_QUOTES) : ''; $ban_info['notes'] = isset($_POST['notes']) ? Util::htmlspecialchars($_POST['notes'], ENT_QUOTES) : ''; $ban_info['notes'] = str_replace(array("\r", "\n", ' '), array('', '<br />', ' '), $ban_info['notes']); $ban_info['cannot']['access'] = empty($ban_info['full_ban']) ? 0 : 1; $ban_info['cannot']['post'] = !empty($ban_info['full_ban']) || empty($_POST['cannot_post']) ? 0 : 1; $ban_info['cannot']['register'] = !empty($ban_info['full_ban']) || empty($_POST['cannot_register']) ? 0 : 1; $ban_info['cannot']['login'] = !empty($ban_info['full_ban']) || empty($_POST['cannot_login']) ? 0 : 1; // Adding a new ban group if (empty($ban_info['id'])) { $ban_group_id = insertBanGroup($ban_info); } else { $ban_group_id = updateBanGroup($ban_info); } if ($ban_group_id !== false) { $ban_info['id'] = $ban_group_id; $ban_info['is_new'] = false; } $context['ban'] = $ban_info; } // Update the triggers associated with this ban if (isset($_POST['ban_suggestions'])) { $saved_triggers = saveTriggers($_POST['ban_suggestions'], $ban_info['id'], isset($_REQUEST['u']) ? (int) $_REQUEST['u'] : 0, isset($_REQUEST['bi']) ? (int) $_REQUEST['bi'] : 0); $context['ban_suggestions']['saved_triggers'] = $saved_triggers; } // Something went wrong somewhere, ban info or triggers, ... Oh well, let's go back. if ($ban_errors->hasErrors()) { $context['ban_suggestions'] = $saved_triggers; $context['ban']['from_user'] = true; // They may have entered a name not using the member select box if (isset($_REQUEST['u'])) { $context['ban_suggestions'] = array_merge($context['ban_suggestions'], getMemberData((int) $_REQUEST['u'])); } elseif (isset($_REQUEST['user'])) { $context['ban']['from_user'] = false; $context['use_autosuggest'] = true; $context['ban_suggestions']['member']['name'] = $_REQUEST['user']; } // Not strictly necessary, but it's nice if (!empty($context['ban_suggestions']['member']['id'])) { $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); } return $this->action_edit(); } if (isset($_POST['ban_items'])) { $ban_group_id = isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0; $ban_items = array_map('intval', $_POST['ban_items']); removeBanTriggers($ban_items, $ban_group_id); } // Register the last modified date. updateSettings(array('banLastUpdated' => time())); // Update the member table to represent the new ban situation. updateBanMembers(); // Go back to an appropriate spot redirectexit('action=admin;area=ban;sa=' . (isset($_POST['add_ban']) ? 'list' : 'edit;bg=' . $ban_group_id)); }