diff options
Diffstat (limited to 'phpBB/includes/functions_template.php')
-rw-r--r-- | phpBB/includes/functions_template.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 4e5b46c3f7..f37148658b 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -54,7 +54,7 @@ class template_compile * Load template source from file * @access private */ - function _tpl_load_file($handle) + function _tpl_load_file($handle, $store_in_db = false) { // Try and open template for read if (!file_exists($this->template->files[$handle])) @@ -66,6 +66,23 @@ class template_compile // Actually compile the code now. $this->compile_write($handle, $this->template->compiled_code[$handle]); + + // Store in database if required... + if ($store_in_db) + { + global $db, $user; + + $sql_ary = array( + 'template_id' => $user->theme['template_id'], + 'template_filename' => $this->template->filename[$handle], + 'template_included' => '', + 'template_mtime' => time(), + 'template_data' => trim(@file_get_contents($this->template->files[$handle])), + ); + + $sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + } } /** |