| | |
| | | | program/include/rcube_template.php | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2010, Roundcube Dev. - Switzerland | |
| | | | Copyright (C) 2006-2010, The Roundcube Dev Team | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | */ |
| | | private function parse_conditions($input) |
| | | { |
| | | $matches = preg_split('/<roundcube:(if|elseif|else|endif)\s+([^>]+)>/is', $input, 2, PREG_SPLIT_DELIM_CAPTURE); |
| | | $matches = preg_split('/<roundcube:(if|elseif|else|endif)\s+([^>]+)>\n?/is', $input, 2, PREG_SPLIT_DELIM_CAPTURE); |
| | | if ($matches && count($matches) == 4) { |
| | | if (preg_match('/^(else|endif)$/i', $matches[1])) { |
| | | return $matches[0] . $this->parse_conditions($matches[3]); |
| | |
| | | $attrib = parse_attrib_string($matches[2]); |
| | | if (isset($attrib['condition'])) { |
| | | $condmet = $this->check_condition($attrib['condition']); |
| | | $submatches = preg_split('/<roundcube:(elseif|else|endif)\s+([^>]+)>/is', $matches[3], 2, PREG_SPLIT_DELIM_CAPTURE); |
| | | $submatches = preg_split('/<roundcube:(elseif|else|endif)\s+([^>]+)>\n?/is', $matches[3], 2, PREG_SPLIT_DELIM_CAPTURE); |
| | | if ($condmet) { |
| | | $result = $submatches[0]; |
| | | $result.= ($submatches[1] != 'endif' ? preg_replace('/.*<roundcube:endif\s+[^>]+>/Uis', '', $submatches[3], 1) : $submatches[3]); |
| | | $result.= ($submatches[1] != 'endif' ? preg_replace('/.*<roundcube:endif\s+[^>]+>\n?/Uis', '', $submatches[3], 1) : $submatches[3]); |
| | | } |
| | | else { |
| | | $result = "<roundcube:$submatches[1] $submatches[2]>" . $submatches[3]; |
| | |
| | | private function login_form($attrib) |
| | | { |
| | | $default_host = $this->config['default_host']; |
| | | $attrib['autocomplete'] = $this->config['login_autocomplete'] ? null : 'off'; |
| | | $autocomplete = (int) $this->config['login_autocomplete']; |
| | | |
| | | $_SESSION['temp'] = true; |
| | | |
| | |
| | | if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) |
| | | $url = $_SERVER['QUERY_STRING']; |
| | | |
| | | $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib); |
| | | $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib); |
| | | // set atocomplete attribute |
| | | $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off'); |
| | | $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off'); |
| | | $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off'); |
| | | |
| | | $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login')); |
| | | $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login')); |
| | | $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_')); |
| | | $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url)); |
| | | $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') |
| | | + $attrib + $user_attrib); |
| | | $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') |
| | | + $attrib + $pass_attrib); |
| | | $input_host = null; |
| | | |
| | | if (is_array($default_host) && count($default_host) > 1) { |
| | |
| | | 'name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib); |
| | | } |
| | | else if (empty($default_host)) { |
| | | $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib); |
| | | $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') |
| | | + $attrib + $host_attrib); |
| | | } |
| | | |
| | | $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
| | |
| | | $table = new html_table(array('cols' => 2)); |
| | | |
| | | $table->add('title', html::label('rcmloginuser', Q(rcube_label('username')))); |
| | | $table->add(null, $input_user->show(get_input_value('_user', RCUBE_INPUT_POST))); |
| | | $table->add(null, $input_user->show(get_input_value('_user', RCUBE_INPUT_GPC))); |
| | | |
| | | $table->add('title', html::label('rcmloginpwd', Q(rcube_label('password')))); |
| | | $table->add(null, $input_pass->show()); |
| | |
| | | // add host selection row |
| | | if (is_object($input_host) && !$hide_host) { |
| | | $table->add('title', html::label('rcmloginhost', Q(rcube_label('server')))); |
| | | $table->add(null, $input_host->show(get_input_value('_host', RCUBE_INPUT_POST))); |
| | | $table->add(null, $input_host->show(get_input_value('_host', RCUBE_INPUT_GPC))); |
| | | } |
| | | |
| | | $out = $input_action->show(); |
| | | $out = $input_task->show(); |
| | | $out .= $input_action->show(); |
| | | $out .= $input_tzone->show(); |
| | | $out .= $input_url->show(); |
| | | $out .= $table->show(); |
| | |
| | | 'UTF-8' => 'UTF-8 ('.rcube_label('unicode').')', |
| | | 'US-ASCII' => 'ASCII ('.rcube_label('english').')', |
| | | 'ISO-8859-1' => 'ISO-8859-1 ('.rcube_label('westerneuropean').')', |
| | | 'ISO-8859-2' => 'ISO-8895-2 ('.rcube_label('easterneuropean').')', |
| | | 'ISO-8859-4' => 'ISO-8895-4 ('.rcube_label('baltic').')', |
| | | 'ISO-8859-2' => 'ISO-8859-2 ('.rcube_label('easterneuropean').')', |
| | | 'ISO-8859-4' => 'ISO-8859-4 ('.rcube_label('baltic').')', |
| | | 'ISO-8859-5' => 'ISO-8859-5 ('.rcube_label('cyrillic').')', |
| | | 'ISO-8859-6' => 'ISO-8859-6 ('.rcube_label('arabic').')', |
| | | 'ISO-8859-7' => 'ISO-8859-7 ('.rcube_label('greek').')', |