Thomas Bruederli
2012-10-17 271efe53e084779a8141228c29b5819d1acd2762
program/include/rcube_output_html.php
@@ -67,10 +67,18 @@
        $this->set_env('task', $task);
        $this->set_env('x_frame_options', $this->config->get('x_frame_options', 'sameorigin'));
        // add cookie info
        $this->set_env('cookie_domain', ini_get('session.cookie_domain'));
        $this->set_env('cookie_path', ini_get('session.cookie_path'));
        $this->set_env('cookie_secure', ini_get('session.cookie_secure'));
        // load the correct skin (in case user-defined)
        $skin = $this->config->get('skin');
        $this->set_skin($skin);
        $this->set_env('skin', $skin);
        if (!empty($_REQUEST['_extwin']))
          $this->set_env('extwin', 1);
        // add common javascripts
        $this->add_script('var '.rcmail::JS_OBJECT_NAME.' = new rcube_webmail();', 'head_top');
@@ -269,6 +277,8 @@
     */
    public function redirect($p = array(), $delay = 1)
    {
        if ($this->env['extwin'])
            $p['extwin'] = 1;
        $location = $this->app->url($p);
        header('Location: ' . $location);
        exit;
@@ -395,7 +405,7 @@
                'line' => __LINE__,
                'file' => __FILE__,
                'message' => 'Error loading template for '.$realname
                ), true, true);
                ), true, $write);
            return false;
        }
@@ -522,7 +532,7 @@
    {
        $GLOBALS['__version']   = html::quote(RCMAIL_VERSION);
        $GLOBALS['__comm_path'] = html::quote($this->app->comm_path);
        $GLOBALS['__skin_path'] = Q($this->config->get('skin_path'));
        $GLOBALS['__skin_path'] = html::quote($this->config->get('skin_path'));
        return preg_replace_callback('/\$(__[a-z0-9_\-]+)/',
            array($this, 'globals_callback'), $input);
@@ -691,6 +701,11 @@
                if ($attrib['name'] || $attrib['command']) {
                    return $this->button($attrib);
                }
                break;
            // frame
            case 'frame':
                return $this->frame($attrib);
                break;
            // show a label
@@ -964,7 +979,7 @@
            else if (in_array($attrib['command'], $a_static_commands)) {
                $attrib['href'] = $this->app->url(array('action' => $attrib['command']));
            }
            else if ($attrib['command'] == 'permaurl' && !empty($this->env['permaurl'])) {
            else if (($attrib['command'] == 'permaurl' || $attrib['command'] == 'extwin') && !empty($this->env['permaurl'])) {
              $attrib['href'] = $this->env['permaurl'];
            }
        }
@@ -1270,6 +1285,30 @@
    }
    /**
     * Returns iframe object, registers some related env variables
     *
     * @param array $attrib HTML attributes
     *
     * @return string IFRAME element
     */
    public function frame($attrib)
    {
        if (!$attrib['id']) {
            $attrib['id'] = 'rcmframe';
        }
        if (!$attrib['name']) {
            $attrib['name'] = $attrib['id'];
        }
        $this->set_env('contentframe', $attrib['id']);
        $this->set_env('blankpage', $attrib['src'] ? $this->abs_url($attrib['src']) : 'program/resources/blank.gif');
        return html::iframe($attrib);
    }
    /*  ************* common functions delivering gui objects **************  */
@@ -1285,6 +1324,10 @@
        $hiddenfield = new html_hiddenfield(array('name' => '_framed', 'value' => '1'));
        $hidden = $hiddenfield->show();
      }
      if ($this->env['extwin']) {
        $hiddenfield = new html_hiddenfield(array('name' => '_extwin', 'value' => '1'));
        $hidden = $hiddenfield->show();
      }
      if (!$content)
        $attrib['noclose'] = true;