| | |
| | | private $js_env = array(); |
| | | private $js_commands = array(); |
| | | private $object_handlers = array(); |
| | | private $plugin_skin_path; |
| | | |
| | | public $browser; |
| | | public $framed = false; |
| | | public $env = array(); |
| | | public $type = 'html'; |
| | | public $ajax_call = false; |
| | | |
| | | // deprecated names of templates used before 0.5 |
| | | private $deprecated_templates = array( |
| | | 'contact' => 'showcontact', |
| | | 'contactadd' => 'addcontact', |
| | | 'contactedit' => 'editcontact', |
| | | 'identityedit' => 'editidentity', |
| | | 'messageprint' => 'printmessage', |
| | | ); |
| | | |
| | | /** |
| | | * Constructor |
| | |
| | | public function template_exists($name) |
| | | { |
| | | $filename = $this->config['skin_path'] . '/templates/' . $name . '.html'; |
| | | |
| | | return (is_file($filename) && is_readable($filename)); |
| | | return (is_file($filename) && is_readable($filename)) || ($this->deprecated_templates[$name] && $this->template_exists($this->deprecated_templates[$name])); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | $skin_path = $this->config['skin_path']; |
| | | $plugin = false; |
| | | $this->plugin_skin_path = null; |
| | | |
| | | $temp = explode(".", $name, 2); |
| | | if (count($temp) > 1) { |
| | | $plugin = $temp[0]; |
| | | $name = $temp[1]; |
| | | $skin_dir = $plugin . '/skins/' . $this->config['skin']; |
| | | $skin_path = $this->app->plugins->dir . $skin_dir; |
| | | $skin_path = $this->plugin_skin_path = $this->app->plugins->dir . $skin_dir; |
| | | if (!is_dir($skin_path)) { // fallback to default skin |
| | | $skin_dir = $plugin . '/skins/default'; |
| | | $skin_path = $this->app->plugins->dir . $skin_dir; |
| | | $skin_path = $this->plugin_skin_path = $this->app->plugins->dir . $skin_dir; |
| | | } |
| | | } |
| | | |
| | | $path = "$skin_path/templates/$name.html"; |
| | | |
| | | if (!is_readable($path) && $this->deprecated_templates[$name]) { |
| | | $path = "$skin_path/templates/".$this->deprecated_templates[$name].".html"; |
| | | if (is_readable($path)) |
| | | raise_error(array('code' => 502, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Using deprecated template '".$this->deprecated_templates[$name]."' in ".$this->config['skin_path']."/templates. Please rename to '".$name."'"), |
| | | true, false); |
| | | } |
| | | |
| | | // read template file |
| | | if (($templ = @file_get_contents($path)) === false) { |
| | |
| | | |
| | | // include a file |
| | | case 'include': |
| | | $path = realpath($this->config['skin_path'].$attrib['file']); |
| | | if (!$this->plugin_skin_path || !is_file($path = realpath($this->plugin_skin_path . $attrib['file']))) |
| | | $path = realpath(($attrib['skin_path'] ? $attrib['skin_path'] : $this->config['skin_path']).$attrib['file']); |
| | | |
| | | if (is_readable($path)) { |
| | | if ($this->config['skin_include_php']) { |
| | | $incl = $this->include_php($path); |
| | |
| | | private function login_form($attrib) |
| | | { |
| | | $default_host = $this->config['default_host']; |
| | | $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_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(); |