summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcmail_template.inc
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-09-19 06:29:28 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-09-19 06:29:28 +0000
commitc9921fca64e04f8fd8de7eeda7fbb6b587d4c34e (patch)
tree918a271c03964b7ec4e51856d3419b28c60045ad /roundcubemail/program/include/rcmail_template.inc
parent40305a44d72a433a9d5cec42096295c5f6e0d762 (diff)
Allow vars and PHP code in templates; improved page title; fixed #1484395
git-svn-id: https://svn.roundcube.net/trunk@801 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcmail_template.inc')
-rw-r--r--roundcubemail/program/include/rcmail_template.inc66
1 files changed, 62 insertions, 4 deletions
diff --git a/roundcubemail/program/include/rcmail_template.inc b/roundcubemail/program/include/rcmail_template.inc
index 4acc717b8..734032e9e 100644
--- a/roundcubemail/program/include/rcmail_template.inc
+++ b/roundcubemail/program/include/rcmail_template.inc
@@ -322,6 +322,13 @@ class rcmail_template extends rcube_html_page
join(',', $args));
}
+ // add command to set page title
+ if ($this->ajax_call && !empty($this->pagetitle))
+ $out .= sprintf(
+ "this.set_pagetitle('%s');\n",
+ JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle)
+ );
+
return $out;
}
@@ -453,10 +460,15 @@ class rcmail_template extends rcube_html_page
// include a file
case 'include':
$path = realpath($this->config['skin_path'].$attrib['file']);
- if (filesize($path) && ($fp = @fopen($path, 'r')))
+ if (filesize($path))
{
- $incl = fread($fp, filesize($path));
- fclose($fp);
+ if ($this->config['skin_include_php'])
+ $incl = $this->include_php($path);
+ else if ($fp = @fopen($path, 'r'))
+ {
+ $incl = fread($fp, filesize($path));
+ fclose($fp);
+ }
return $this->parse_xml($incl);
}
break;
@@ -494,13 +506,59 @@ class rcmail_template extends rcube_html_page
}
break;
- }
+
+ // return variable
+ case 'var':
+ $var = explode(':', $attrib['name']);
+ $name = $var[1];
+ $value = '';
+
+ switch ($var[0])
+ {
+ case 'env':
+ $value = $this->env[$name];
+ break;
+ case 'config':
+ $value = $this->config[$name];
+ if (is_array($value) && $value[$_SESSION['imap_host']])
+ $value = $value[$_SESSION['imap_host']];
+ break;
+ case 'request':
+ $value = get_input_value($name, RCUBE_INPUT_GPC);
+ break;
+ case 'session':
+ $value = $_SESSION[$name];
+ break;
+ }
+
+ if (is_array($value))
+ $value = join(", ", $value);
+
+ return Q($value);
+ }
return '';
}
/**
+ * Include a specific file and return it's contents
+ *
+ * @param string File path
+ * @return string Contents of the processed file
+ */
+ function include_php($file)
+ {
+ ob_start();
+ @include($file);
+ $out = ob_get_contents();
+ ob_end_clean();
+
+ return $out;
+ }
+
+
+ /**
* Create and register a button
*
* @param array Button attributes