function login_form() { global $vars, $phpc_script; $submit_data = tag('td', attributes('colspan="2"'), create_hidden('action', 'login'), create_submit(__('Log in'))); if (!empty($vars['lasturl'])) { $submit_data->prepend(create_hidden('lasturl', escape_entities(urlencode($vars['lasturl'])))); } return tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', tag('caption', __('Log in')), tag('thead', tag('tr', tag('th', attributes('colspan="2"'), __('You must have cookies enabled to login.')))), tag('tfoot', tag('tr', $submit_data)), tag('tbody', tag('tr', tag('th', __('Username')), tag('td', create_text('username'))), tag('tr', tag('th', __('Password')), tag('td', create_password('password')))))); }
function display_form() { global $phpc_script, $phpc_token, $phpcdb; $groups = array(); foreach ($phpcdb->get_groups() as $group) { $groups[$group['gid']] = $group['name']; } $size = sizeof($groups); if ($size > 6) { $size = 6; } return tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes("class=\"phpc-container\""), tag('caption', __('Create User')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('phpc_token', $phpc_token), create_hidden('action', 'user_create'), create_hidden('submit_form', 'submit_form'), create_submit(__('Submit'))))), tag('tbody', tag('tr', tag('th', __('User Name')), tag('td', create_text('user_name'))), tag('tr', tag('th', __('Password')), tag('td', create_password('password1'))), tag('tr', tag('th', __('Confirm Password')), tag('td', create_password('password2'))), tag('tr', tag('th', __('Make Admin')), tag('td', create_checkbox('make_admin', '1', false, __('Admin')))), tag('tr', tag('th', __('Groups')), tag('td', create_select('groups[]', $groups, false, attrs('multiple', "size=\"{$size}\""))))))); }
function login_form() { global $vars, $phpc_script, $day, $year, $month; $lastaction = empty($vars['lastaction']) ? '' : $vars['lastaction']; $submit_data = tag('td', attributes('colspan="2"'), create_hidden('action', 'login'), create_submit(_('Log in'))); if (!empty($vars['lastaction'])) { $submit_data->prepend(create_hidden('lastaction', $vars['lastaction'])); } if (!empty($vars['day'])) { $submit_data->prepend(create_hidden('day', $day)); } if (!empty($vars['month'])) { $submit_data->prepend(create_hidden('month', $month)); } if (!empty($vars['year'])) { $submit_data->prepend(create_hidden('year', $year)); } return tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes('class="phpc-main"'), tag('caption', _('Log in')), tag('thead', tag('tr', tag('th', attributes('colspan="2"'), _('You must have cookies enabled to login.')))), tag('tfoot', tag('tr', $submit_data)), tag('tbody', tag('tr', tag('th', _('Username') . ':'), tag('td', create_text('username'))), tag('tr', tag('th', _('Password') . ':'), tag('td', create_password('password')))))); }
function create_config_input($element, $default = false) { $name = $element[0]; $text = $element[1]; $type = $element[2]; $value = false; if (isset($element[3])) { $value = $element[3]; } switch ($type) { case PHPC_CHECK: if ($default == false) { $default = $value; } $input = create_checkbox($name, '1', $default, $text); break; case PHPC_TEXT: if ($default == false) { $default = $value; } $input = create_text($name, $default); break; case PHPC_DROPDOWN: $input = create_select($name, $value, $default); break; case PHPC_MULTI_DROPDOWN: $input = create_multi_select($name, $value, $default); break; default: soft_error(__('Unsupported config type') . ": {$type}"); } return $input; }
function new_user_form() { global $phpc_script; return tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes('class="phpc-main"'), tag('caption', _('Create/Modify User')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('action', 'new_user_submit'), create_submit(_('Submit'))))), tag('tbody', tag('tr', tag('th', _('User Name') . ':'), tag('td', create_text('user_name'))), tag('tr', tag('th', _('Password') . ':'), tag('td', create_password('password1'))), tag('tr', tag('th', _('Confirm Password') . ':'), tag('td', create_password('password2'))), tag('tr', tag('th', _('Make Admin') . ':'), tag('td', create_checkbox('make_admin', '1')))))); }