function user_list() { global $phpc_script, $phpcid, $phpcdb, $vars; $users = $phpcdb->get_users_with_permissions($phpcid); $tbody = tag('tbody'); foreach ($users as $user) { $phpc_user = new PhpcUser($user); $group_list = array(); foreach ($phpc_user->get_groups() as $group) { if ($group['cid'] == $phpcid) { $group_list[] = $group['name']; } } $groups = implode(', ', $group_list); $tbody->add(tag('tr', tag('th', $user['username'], create_hidden('uid[]', $user['uid'])), tag('td', create_checkbox("read{$user['uid']}", "1", !empty($user['read']), __('Read'))), tag('td', create_checkbox("write{$user['uid']}", "1", !empty($user['write']), __('Write'))), tag('td', create_checkbox("readonly{$user['uid']}", "1", !empty($user['readonly']), __('Read-only'))), tag('td', create_checkbox("modify{$user['uid']}", "1", !empty($user['modify']), __('Modify'))), tag('td', create_checkbox("admin{$user['uid']}", "1", !empty($user['calendar_admin']), __('Admin'))), tag('td', $groups), tag('td', create_action_link(__("Edit Groups"), "user_groups", array("uid" => $user["uid"]))))); } $hidden_div = tag('div', create_hidden('action', 'user_permissions_submit')); if (isset($vars['phpcid'])) { $hidden_div->add(create_hidden('phpcid', $vars['phpcid'])); } $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), $hidden_div, tag('table', attributes("class=\"phpc-container\""), tag('caption', __('User Permissions')), tag('tfoot', tag('tr', tag('td', attributes('colspan="8"'), create_submit(__('Submit'))))), tag('thead', tag('tr', tag('th', __('User Name')), tag('th', __('Read')), tag('th', __('Write')), tag('th', __('Can Create Read-Only')), tag('th', __('Modify')), tag('th', __('Admin')), tag('th', __('Groups')), tag('th', __('Edit Groups')))), $tbody)); return tag('div', attrs('id="phpc-users"'), $form); }
if ($phpc_user === false) { $phpc_uid = 0; $anonymous = array('uid' => 0, 'username' => 'anonymous', 'password' => '', 'admin' => false, 'password_editable' => false, 'default_cid' => NULL, 'timezone' => NULL, 'language' => NULL, 'disabled' => 0); if (isset($_COOKIE["{$phpc_prefix}tz"])) { $_tz = $_COOKIE["{$phpc_prefix}tz"]; // If we have a timezone, make sure it's valid if (in_array($_tz, timezone_identifiers_list())) { $anonymous['timezone'] = $_tz; } else { $anonymous['timezone'] = ''; } } if (isset($_COOKIE["{$phpc_prefix}lang"])) { $anonymous['language'] = $_COOKIE["{$phpc_prefix}lang"]; } $phpc_user = new PhpcUser($anonymous); } // Find an appropriate calendar id if (!empty($vars['phpcid'])) { if (!is_numeric($vars['phpcid'])) { soft_error(__("Invalid calendar ID.")); } $phpcid = $vars['phpcid']; } if (!isset($phpcid) && !empty($vars['eid'])) { if (is_array($vars['eid'])) { $eid = $vars['eid'][0]; } else { $eid = $vars['eid']; } $event = $phpcdb->get_event_by_eid($eid);
$action = $vars['action']; } if (empty($vars['contentType'])) { $vars['contentType'] = "html"; } if (!empty($_SESSION["{$phpc_prefix}uid"])) { $phpc_user = $phpcdb->get_user($_SESSION["{$phpc_prefix}uid"]); } else { $anonymous = array('uid' => 0, 'username' => 'anonymous', 'password' => '', 'admin' => false, 'password_editable' => false, 'timezone' => NULL, 'language' => NULL); if (isset($_COOKIE["{$phpc_prefix}tz"])) { $anonymous['timezone'] = $_COOKIE["{$phpc_prefix}tz"]; } if (isset($_COOKIE["{$phpc_prefix}lang"])) { $anonymous['language'] = $_COOKIE["{$phpc_prefix}lang"]; } $phpc_user = new PhpcUser($anonymous); } $phpc_user_lang = $phpc_user->get_language(); $phpc_user_tz = $phpc_user->get_timezone(); // setup translation stuff if (!empty($vars['lang'])) { $phpc_lang = $vars['lang']; } elseif (!empty($phpc_user_lang)) { $phpc_lang = $phpc_user_lang; } elseif (!empty($phpc_cal->language)) { $phpc_lang = $phpc_cal->language; } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $phpc_lang = substr(phpc_html_escape($_SERVER['HTTP_ACCEPT_LANGUAGE']), 0, 2); } else { $phpc_lang = 'en'; }