aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/index.php3
-rw-r--r--phpBB/adm/style/acp_styles.html7
-rw-r--r--phpBB/develop/create_schema_files.php18
-rw-r--r--phpBB/includes/acp/acp_styles.php803
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/session.php51
-rw-r--r--phpBB/install/database_update.php11
-rw-r--r--phpBB/install/index.php3
-rw-r--r--phpBB/install/install_update.php3
-rw-r--r--phpBB/install/schemas/firebird_schema.sql18
-rw-r--r--phpBB/install/schemas/mssql_schema.sql27
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql16
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql16
-rw-r--r--phpBB/install/schemas/oracle_schema.sql21
-rw-r--r--phpBB/install/schemas/postgres_schema.sql18
-rw-r--r--phpBB/install/schemas/schema_data.sql4
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql18
-rw-r--r--phpBB/language/en/acp/common.php6
-rw-r--r--phpBB/language/en/acp/styles.php29
-rw-r--r--phpBB/style.php222
-rw-r--r--phpBB/styles/prosilver/theme/theme.cfg4
-rw-r--r--phpBB/styles/subsilver2/theme/theme.cfg3
22 files changed, 135 insertions, 1168 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 2444a1b597..4f4d9ccedd 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -56,9 +56,6 @@ $template->set_custom_template($phpbb_admin_path . 'style', 'admin');
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
-// the acp template is never stored in the database
-$user->theme['template_storedb'] = false;
-
// Instantiate new module
$module = new p_master();
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html
index d503f323e0..4076cf1ba6 100644
--- a/phpBB/adm/style/acp_styles.html
+++ b/phpBB/adm/style/acp_styles.html
@@ -362,13 +362,6 @@
<dd><!-- IF S_INSTALL --><strong id="theme_id">{THEME_NAME}</strong><!-- ELSE --><select id="theme_id" name="theme_id">{S_THEME_OPTIONS}</select><!-- ENDIF --></dd>
</dl>
<!-- ENDIF -->
- <!-- IF (S_TEMPLATE or S_THEME) and (S_LOCATION or not S_INSTALL) -->
- <dl>
- <dt><label for="store_db">{L_LOCATION}:</label><br /><span><!-- IF S_STORE_DB_DISABLED -->{L_LOCATION_DISABLED_EXPLAIN}<!-- ELSE -->{L_LOCATION_EXPLAIN}<!-- ENDIF --></span></dt>
- <dd><label><input type="radio" class="radio" name="store_db" value="0"<!-- IF not S_STORE_DB --> id="store_db" checked="checked"<!-- ENDIF --> <!-- IF S_STORE_DB_DISABLED -->disabled="disabled" <!-- ENDIF --> /> {L_STORE_FILESYSTEM}</label>
- <label><input type="radio" class="radio" name="store_db" value="1"<!-- IF S_STORE_DB --> id="store_db" checked="checked"<!-- ENDIF --> <!-- IF S_STORE_DB_DISABLED -->disabled="disabled" <!-- ENDIF -->/> {L_STORE_DATABASE}</label></dd>
- </dl>
- <!-- ENDIF -->
<!-- IF S_STYLE -->
</fieldset>
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 213354fcb9..2057d292b7 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1657,7 +1657,6 @@ function get_schema_struct()
'template_copyright' => array('VCHAR_UNI', ''),
'template_path' => array('VCHAR:100', ''),
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
- 'template_storedb' => array('BOOL', 0),
'template_inherits_id' => array('UINT:4', 0),
'template_inherit_path' => array('VCHAR', ''),
),
@@ -1667,29 +1666,12 @@ function get_schema_struct()
),
);
- $schema_data['phpbb_styles_template_data'] = array(
- 'COLUMNS' => array(
- 'template_id' => array('UINT', 0),
- 'template_filename' => array('VCHAR:100', ''),
- 'template_included' => array('TEXT', ''),
- 'template_mtime' => array('TIMESTAMP', 0),
- 'template_data' => array('MTEXT_UNI', ''),
- ),
- 'KEYS' => array(
- 'tid' => array('INDEX', 'template_id'),
- 'tfn' => array('INDEX', 'template_filename'),
- ),
- );
-
$schema_data['phpbb_styles_theme'] = array(
'COLUMNS' => array(
'theme_id' => array('UINT', NULL, 'auto_increment'),
'theme_name' => array('VCHAR_UNI:255', ''),
'theme_copyright' => array('VCHAR_UNI', ''),
'theme_path' => array('VCHAR:100', ''),
- 'theme_storedb' => array('BOOL', 0),
- 'theme_mtime' => array('TIMESTAMP', 0),
- 'theme_data' => array('MTEXT_UNI', ''),
),
'PRIMARY_KEY' => 'theme_id',
'KEYS' => array(
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 82878cfadb..fc9acbbcb8 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -207,7 +207,7 @@ version = {VERSION}
switch ($action)
{
- // Refresh template data stored in db and clear cache
+ // Clear cache
case 'refresh':
$sql = 'SELECT *
@@ -224,49 +224,13 @@ version = {VERSION}
if (confirm_box(true))
{
- $template_refreshed = '';
-
- // Only refresh database if the template is stored in the database
- if ($template_row['template_storedb'] && file_exists("{$phpbb_root_path}styles/{$template_row['template_path']}/template/"))
- {
- $filelist = array('' => array());
-
- $sql = 'SELECT template_filename, template_mtime
- FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $style_id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
-// if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime'])
-// {
- // get folder info from the filename
- if (($slash_pos = strrpos($row['template_filename'], '/')) === false)
- {
- $filelist[''][] = $row['template_filename'];
- }
- else
- {
- $filelist[substr($row['template_filename'], 0, $slash_pos + 1)][] = substr($row['template_filename'], $slash_pos + 1, strlen($row['template_filename']) - $slash_pos - 1);
- }
-// }
- }
- $db->sql_freeresult($result);
-
- $this->store_templates('update', $style_id, $template_row['template_path'], $filelist);
- unset($filelist);
-
- $template_refreshed = $user->lang['TEMPLATE_REFRESHED'] . '<br />';
- add_log('admin', 'LOG_TEMPLATE_REFRESHED', $template_row['template_name']);
- }
-
$this->clear_template_cache($template_row);
- trigger_error($template_refreshed . $user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action));
+ trigger_error($user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action));
}
else
{
- confirm_box(false, ($template_row['template_storedb']) ? $user->lang['CONFIRM_TEMPLATE_REFRESH'] : $user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array(
+ confirm_box(false, $user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'action' => $action,
@@ -281,63 +245,7 @@ version = {VERSION}
break;
case 'theme':
-
- switch ($action)
- {
- // Refresh theme data stored in the database
- case 'refresh':
-
- $sql = 'SELECT *
- FROM ' . STYLES_THEME_TABLE . "
- WHERE theme_id = $style_id";
- $result = $db->sql_query($sql);
- $theme_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (!$theme_row)
- {
- trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
- if (!$theme_row['theme_storedb'])
- {
- trigger_error($user->lang['THEME_ERR_REFRESH_FS'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
- if (confirm_box(true))
- {
- if ($theme_row['theme_storedb'] && file_exists("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"))
- {
- // Save CSS contents
- $sql_ary = array(
- 'theme_mtime' => (int) filemtime("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"),
- 'theme_data' => '',
- 'theme_storedb' => 0
- );
-
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE theme_id = $style_id";
- $db->sql_query($sql);
-
- $cache->destroy('sql', STYLES_THEME_TABLE);
-
- add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']);
- trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action));
- }
- }
- else
- {
- confirm_box(false, $user->lang['CONFIRM_THEME_REFRESH'], build_hidden_fields(array(
- 'i' => $id,
- 'mode' => $mode,
- 'action' => $action,
- 'id' => $style_id
- )));
- }
- break;
- }
-
- $this->frontend('theme', array('edit', 'details'), array('refresh', 'export', 'delete'));
+ $this->frontend('theme', array('edit', 'details'), array('export', 'delete'));
break;
}
}
@@ -526,7 +434,7 @@ version = {VERSION}
$template_file = preg_replace('#\.{2,}#', '.', $template_file);
// Retrieve some information about the template
- $sql = 'SELECT template_storedb, template_path, template_name
+ $sql = 'SELECT template_path, template_name
FROM ' . STYLES_TEMPLATE_TABLE . "
WHERE template_id = $template_id";
$result = $db->sql_query($sql);
@@ -538,6 +446,32 @@ version = {VERSION}
trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ // Get the filesystem location of the current file
+ $template_path = "{$phpbb_root_path}styles/{$template_info['template_path']}/template";
+ $file = "$template_path/$template_file";
+
+ if ($template_file)
+ {
+ $l_not_writable = sprintf($user->lang['TEMPLATE_FILE_NOT_WRITABLE'], htmlspecialchars($template_file)) . adm_back_link($this->u_action);
+
+ if ($safe_mode)
+ {
+ trigger_error($l_not_writable, E_USER_WARNING);
+ }
+
+ if (file_exists($file) && is_file($file) && is_readable($file))
+ {
+ if (!phpbb_is_writable($file))
+ {
+ trigger_error($l_not_writable, E_USER_WARNING);
+ }
+ }
+ else
+ {
+ trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ }
+
if ($save_changes && !check_form_key('acp_styles'))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
@@ -550,50 +484,14 @@ version = {VERSION}
// save changes to the template if the user submitted any
if ($save_changes && $template_file)
{
- // Get the filesystem location of the current file
- $file = "{$phpbb_root_path}styles/{$template_info['template_path']}/template/$template_file";
- $additional = '';
-
- // If the template is stored on the filesystem try to write the file else store it in the database
- if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && phpbb_is_writable($file))
+ // Try to write the file
+ if (!($fp = @fopen($file, 'wb')))
{
- if (!($fp = @fopen($file, 'wb')))
- {
- // File exists and is writeable, but still not able to be written to
- trigger_error(sprintf($user->lang['TEMPLATE_FILE_NOT_WRITABLE'], htmlspecialchars($template_file)) . adm_back_link($this->u_action), E_USER_WARNING);
- }
- fwrite($fp, $template_data);
- fclose($fp);
- }
- else
- {
- $db->sql_transaction('begin');
-
- // If it's not stored in the db yet, then update the template setting and store all template files in the db
- if (!$template_info['template_storedb'])
- {
- if ($super = $this->get_super('template', $template_id))
- {
- $this->store_in_db('template', $super['template_id']);
- }
- else
- {
- $this->store_in_db('template', $template_id);
- }
-
- add_log('admin', 'LOG_TEMPLATE_EDIT_DETAILS', $template_info['template_name']);
- $additional .= '<br />' . $user->lang['EDIT_TEMPLATE_STORED_DB'];
- }
-
- // Update the template_data table entry for this template file
- $sql = 'UPDATE ' . STYLES_TEMPLATE_DATA_TABLE . "
- SET template_data = '" . $db->sql_escape($template_data) . "', template_mtime = " . time() . "
- WHERE template_id = $template_id
- AND template_filename = '" . $db->sql_escape($template_file) . "'";
- $db->sql_query($sql);
-
- $db->sql_transaction('commit');
+ // File exists and is writeable, but still not able to be written to
+ trigger_error($l_not_writable, E_USER_WARNING);
}
+ fwrite($fp, $template_data);
+ fclose($fp);
// destroy the cached version of the template (filename without extension)
$this->clear_template_cache($template_info, array(substr($template_file, 0, -5)));
@@ -601,56 +499,22 @@ version = {VERSION}
$cache->destroy('sql', STYLES_TABLE);
add_log('admin', 'LOG_TEMPLATE_EDIT', $template_info['template_name'], $template_file);
- trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&amp;action=edit&amp;id=$template_id&amp;text_rows=$text_rows&amp;template_file=$template_file"));
+ trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . adm_back_link($this->u_action . "&amp;action=edit&amp;id=$template_id&amp;text_rows=$text_rows&amp;template_file=$template_file"));
}
// Generate a category array containing template filenames
- if (!$template_info['template_storedb'])
- {
- $template_path = "{$phpbb_root_path}styles/{$template_info['template_path']}/template";
- $filelist = filelist($template_path, '', 'html');
- $filelist[''] = array_diff($filelist[''], array('bbcode.html'));
+ $filelist = filelist($template_path, '', 'html');
+ $filelist[''] = array_diff($filelist[''], array('bbcode.html'));
- if ($template_file)
- {
- if (!file_exists($template_path . "/$template_file") || !($template_data = file_get_contents($template_path . "/$template_file")))
- {
- trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
- }
- }
- else
+ if ($template_file)
{
- $sql = 'SELECT *
- FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $template_id";
- $result = $db->sql_query($sql);
+ $template_data = file_get_contents($file);
- $filelist = array('' => array());
- while ($row = $db->sql_fetchrow($result))
+ if (!$template_data)
{
- $file_info = pathinfo($row['template_filename']);
-
- if (($file_info['basename'] != 'bbcode') && ($file_info['extension'] == 'html'))
- {
- if (($file_info['dirname'] == '.') || empty($file_info['dirname']))
- {
- $filelist[''][] = $row['template_filename'];
- }
- else
- {
- $filelist[$file_info['dirname'] . '/'][] = $file_info['basename'];
- }
- }
-
- if ($row['template_filename'] == $template_file)
- {
- $template_data = $row['template_data'];
- }
+ trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
- $db->sql_freeresult($result);
- unset($file_info);
}
if (empty($filelist['']))
@@ -821,35 +685,6 @@ version = {VERSION}
adm_page_footer();
}
- $filemtime = array();
- if ($template_row['template_storedb'])
- {
- $ids = array();
- if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id'])
- {
- $ids[] = $template_row['template_inherits_id'];
- }
- $ids[] = $template_row['template_id'];
-
- $filemtime = array();
- $file_template_db = array();
-
- foreach ($ids as $id)
- {
- $sql = 'SELECT template_filename, template_mtime
- FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $filemtime[$row['template_filename']] = $row['template_mtime'];
- $file_template_db[$row['template_filename']] = $id;
- }
- $db->sql_freeresult($result);
- }
- }
-
// Get a list of cached template files and then retrieve additional information about them
$file_ary = $this->template_cache_filelist($template_row['template_path']);
@@ -872,30 +707,10 @@ version = {VERSION}
$file_tpl = "{$phpbb_root_path}styles/{$template_row['template_path']}/template/$tpl_file.html";
$inherited = false;
- if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id'])
+ if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id'] && !file_exists($file_tpl))
{
- if (!$template_row['template_storedb'])
- {
- if (!file_exists($file_tpl))
- {
- $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_inherit_path']}/template/$tpl_file.html";
- $inherited = true;
- }
- }
- else
- {
- if ($file_template_db[$file . '.html'] == $template_row['template_inherits_id'])
- {
- $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_inherit_path']}/template/$tpl_file.html";
- $inherited = true;
- }
- }
- }
-
- // Correct the filename if it is stored in database and the file is in a subfolder.
- if ($template_row['template_storedb'])
- {
- $file = str_replace('.', '/', $file);
+ $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_inherit_path']}/template/$tpl_file.html";
+ $inherited = true;
}
$template->assign_block_vars('file', array(
@@ -905,10 +720,9 @@ version = {VERSION}
'FILENAME' => $file,
'FILENAME_PATH' => $file_tpl,
'FILESIZE' => get_formatted_filesize(filesize("{$phpbb_root_path}cache/$filename")),
- 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime($file_tpl) : $filemtime[$file . '.html']))
- );
+ 'MODIFIED' => $user->format_date(filemtime($file_tpl)),
+ ));
}
- unset($filemtime);
$template->assign_vars(array(
'S_CACHE' => true,
@@ -942,7 +756,7 @@ version = {VERSION}
$theme_file = str_replace('..', '.', $theme_file);
// Retrieve some information about the theme
- $sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data
+ $sql = 'SELECT theme_path, theme_name
FROM ' . STYLES_THEME_TABLE . "
WHERE theme_id = $theme_id";
$result = $db->sql_query($sql);
@@ -953,71 +767,62 @@ version = {VERSION}
}
$db->sql_freeresult($result);
- // save changes to the theme if the user submitted any
- if ($save_changes)
+ // Get the filesystem location of the current file
+ $theme_path = "{$phpbb_root_path}styles/{$theme_info['theme_path']}/theme";
+ $file = "$theme_path/$theme_file";
+
+ if ($theme_file)
{
- // Get the filesystem location of the current file
- $file = "{$phpbb_root_path}styles/{$theme_info['theme_path']}/theme/$theme_file";
- $additional = '';
- $message = $user->lang['THEME_UPDATED'];
+ $l_not_writable = sprintf($user->lang['THEME_FILE_NOT_WRITABLE'], htmlspecialchars($theme_file)) . adm_back_link($this->u_action);
- // If the theme is stored on the filesystem try to write the file else store it in the database
- if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && phpbb_is_writable($file))
+ if ($safe_mode)
{
- if (!($fp = @fopen($file, 'wb')))
+ trigger_error($l_not_writable, E_USER_WARNING);
+ }
+
+ if (file_exists($file) && is_file($file) && is_readable($file))
+ {
+ if (!phpbb_is_writable($file))
{
- trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($l_not_writable, E_USER_WARNING);
}
- fwrite($fp, $theme_data);
- fclose($fp);
}
else
{
- // Write stylesheet to db
- $sql_ary = array(
- 'theme_mtime' => time(),
- 'theme_storedb' => 1,
- 'theme_data' => $this->db_theme_data($theme_info, $theme_data),
- );
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE theme_id = ' . $theme_id;
- $db->sql_query($sql);
+ trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ }
- $cache->destroy('sql', STYLES_THEME_TABLE);
+ // save changes to the theme if the user submitted any
+ if ($save_changes && $theme_file)
+ {
+ $message = $user->lang['THEME_UPDATED'];
- // notify the user if the theme was not stored in the db before his modification
- if (!$theme_info['theme_storedb'])
- {
- add_log('admin', 'LOG_THEME_EDIT_DETAILS', $theme_info['theme_name']);
- $message .= '<br />' . $user->lang['EDIT_THEME_STORED_DB'];
- }
+ if (!($fp = @fopen($file, 'wb')))
+ {
+ trigger_error($l_not_writable, E_USER_WARNING);
}
+ fwrite($fp, $theme_data);
+ fclose($fp);
+
$cache->destroy('sql', STYLES_THEME_TABLE);
- add_log('admin', (!$theme_info['theme_storedb']) ? 'LOG_THEME_EDIT_FILE' : 'LOG_THEME_EDIT', $theme_info['theme_name'], (!$theme_info['theme_storedb']) ? $theme_file : '');
+ add_log('admin', 'LOG_THEME_EDIT_FILE', $theme_info['theme_name'], $theme_file);
trigger_error($message . adm_back_link($this->u_action . "&amp;action=edit&amp;id=$theme_id&amp;template_file=$theme_file&amp;text_rows=$text_rows"));
}
// Generate a category array containing theme filenames
- if (!$theme_info['theme_storedb'])
- {
- $theme_path = "{$phpbb_root_path}styles/{$theme_info['theme_path']}/theme";
+ $filelist = filelist($theme_path, '', 'css');
- $filelist = filelist($theme_path, '', 'css');
+ if ($theme_file)
+ {
+ $theme_data = file_get_contents($file);
- if ($theme_file)
+ if (!$theme_data)
{
- if (!file_exists($theme_path . "/$theme_file") || !($theme_data = file_get_contents($theme_path . "/$theme_file")))
- {
- trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+ trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
}
}
- else
- {
- $theme_data = &$theme_info['theme_data'];
- }
// Now create the categories
$filelist_cats[''] = array();
@@ -1080,7 +885,6 @@ version = {VERSION}
$template->assign_vars(array(
'S_EDIT_THEME' => true,
'S_HIDDEN_FIELDS' => build_hidden_fields(array('template_file' => $theme_file)),
- 'S_THEME_IN_DB' => $theme_info['theme_storedb'],
'S_TEMPLATES' => $tpl_options,
'U_ACTION' => $this->u_action . "&amp;action=edit&amp;id=$theme_id&amp;text_rows=$text_rows",
@@ -1098,8 +902,8 @@ version = {VERSION}
'SELECTED_TEMPLATE' => $theme_info['theme_name'],
'TEMPLATE_FILE' => $theme_file,
'TEMPLATE_DATA' => utf8_htmlspecialchars($theme_data),
- 'TEXT_ROWS' => $text_rows)
- );
+ 'TEXT_ROWS' => $text_rows,
+ ));
}
/**
@@ -1123,12 +927,12 @@ version = {VERSION}
case 'template':
$sql_from = STYLES_TEMPLATE_TABLE;
- $sql_select = 'template_id, template_name, template_path, template_storedb';
+ $sql_select = 'template_id, template_name, template_path';
break;
case 'theme':
$sql_from = STYLES_THEME_TABLE;
- $sql_select = 'theme_id, theme_name, theme_path, theme_storedb';
+ $sql_select = 'theme_id, theme_name, theme_path';
break;
}
@@ -1491,7 +1295,7 @@ version = {VERSION}
trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING);
}
- $var_ary = array('style_id', 'style_name', 'style_copyright', 'template_id', 'template_name', 'template_path', 'template_copyright', 'template_storedb', 'template_inherits_id', 'bbcode_bitfield', 'theme_id', 'theme_name', 'theme_path', 'theme_copyright', 'theme_storedb', 'theme_mtime', 'theme_data');
+ $var_ary = array('style_id', 'style_name', 'style_copyright', 'template_id', 'template_name', 'template_path', 'template_copyright', 'template_inherits_id', 'bbcode_bitfield', 'theme_id', 'theme_name', 'theme_path', 'theme_copyright');
foreach ($var_ary as $var)
{
@@ -1546,31 +1350,12 @@ version = {VERSION}
);
// This is potentially nasty memory-wise ...
- if (!$style_row['template_storedb'])
- {
- $files[] = array(
- 'src' => "styles/{$style_row['template_path']}/template/",
- 'prefix-' => "styles/{$style_row['template_path']}/",
- 'prefix+' => false,
- 'exclude' => 'template.cfg'
- );
- }
- else
- {
- $sql = 'SELECT template_filename, template_data
- FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = {$style_row['template_id']}";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $data[] = array(
- 'src' => $row['template_data'],
- 'prefix' => 'template/' . $row['template_filename']
- );
- }
- $db->sql_freeresult($result);
- }
+ $files[] = array(
+ 'src' => "styles/{$style_row['template_path']}/template/",
+ 'prefix-' => "styles/{$style_row['template_path']}/",
+ 'prefix+' => false,
+ 'exclude' => 'template.cfg'
+ );
unset($template_cfg);
}
@@ -1587,23 +1372,14 @@ version = {VERSION}
'src' => "styles/{$style_row['theme_path']}/theme/",
'prefix-' => "styles/{$style_row['theme_path']}/",
'prefix+' => false,
- 'exclude' => ($style_row['theme_storedb']) ? 'stylesheet.css,theme.cfg' : 'theme.cfg'
+ 'exclude' => 'theme.cfg',
);
$data[] = array(
'src' => $theme_cfg,
- 'prefix' => 'theme/theme.cfg'
+ 'prefix' => 'theme/theme.cfg',
);
- if ($style_row['theme_storedb'])
- {
- $style_row['theme_data'] = str_replace("styles/{$style_row['theme_path']}/theme/", './', $style_row['theme_data']);
- $data[] = array(
- 'src' => $style_row['theme_data'],
- 'prefix' => 'theme/stylesheet.css'
- );
- }
-
unset($items, $theme_cfg);
}
@@ -1772,7 +1548,6 @@ version = {VERSION}
$style_active = request_var('style_active', 0);
$style_default = request_var('style_default', 0);
- $store_db = request_var('store_db', 0);
// If the admin selected the style to be the default style, but forgot to activate it... we will do it for him
if ($style_default)
@@ -1803,23 +1578,6 @@ version = {VERSION}
$error[] = $user->lang[$l_type . '_ERR_STYLE_NAME'];
}
- if ($mode === 'theme' || $mode === 'template')
- {
- // a rather elaborate check we have to do here once to avoid trouble later
- $check = "{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . (($mode === 'theme') ? '/theme/stylesheet.css' : '/template');
- if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !phpbb_is_writable($check)))
- {
- $error[] = $user->lang['EDIT_' . strtoupper($mode) . '_STORED_DB'];
- $store_db = 1;
- }
-
- // themes which have to be parsed have to go into db
- if ($mode == 'theme')
- {
- $cfg = parse_cfg_file("{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . "/theme/theme.cfg");
- }
- }
-
if (!sizeof($error))
{
// Check length settings
@@ -1841,7 +1599,6 @@ version = {VERSION}
'template_id' => $template_id,
'theme_id' => $theme_id,
'style_active' => $style_active,
- $mode . '_storedb' => $store_db,
$mode . '_name' => $name,
$mode . '_copyright' => $copyright)
);
@@ -1867,72 +1624,9 @@ version = {VERSION}
break;
case 'theme':
-
- if ($style_row['theme_storedb'] != $store_db)
- {
- $theme_data = '';
-
- if (!$style_row['theme_storedb'])
- {
- $theme_data = $this->db_theme_data($style_row);
- }
- else if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css"))
- {
- $store_db = 1;
- $theme_data = $style_row['theme_data'];
-
- if ($fp = @fopen("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css", 'wb'))
- {
- $store_db = (@fwrite($fp, str_replace("styles/{$style_row['theme_path']}/theme/", './', $theme_data))) ? 0 : 1;
- }
- fclose($fp);
- }
-
- $sql_ary += array(
- 'theme_mtime' => ($store_db) ? filemtime("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css") : 0,
- 'theme_storedb' => $store_db,
- 'theme_data' => ($store_db) ? $theme_data : '',
- );
- }
break;
case 'template':
-
- if ($style_row['template_storedb'] != $store_db)
- {
- if ($super = $this->get_super($mode, $style_row['template_id']))
- {
- $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name']));
- $sql_ary = array();
- }
- else
- {
- if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template"))
- {
- $err = $this->store_in_fs('template', $style_row['template_id']);
- if ($err)
- {
- $error += $err;
- }
- }
- else if ($store_db)
- {
- $this->store_in_db('template', $style_row['template_id']);
- }
- else
- {
- // We no longer store within the db, but are also not able to update the file structure
- // Since the admin want to switch this, we adhere to his decision. But we also need to remove the cache
- $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $style_id";
- $db->sql_query($sql);
- }
-
- $sql_ary += array(
- 'template_storedb' => $store_db,
- );
- }
- }
break;
}
@@ -1999,8 +1693,6 @@ version = {VERSION}
'S_STYLE' => ($mode == 'style') ? true : false,
'S_TEMPLATE' => ($mode == 'template') ? true : false,
'S_THEME' => ($mode == 'theme') ? true : false,
- 'S_STORE_DB' => (isset($style_row[$mode . '_storedb'])) ? $style_row[$mode . '_storedb'] : 0,
- 'S_STORE_DB_DISABLED' => (isset($style_row[$mode . '_inherits_id'])) ? $style_row[$mode . '_inherits_id'] : 0,
'S_STYLE_ACTIVE' => (isset($style_row['style_active'])) ? $style_row['style_active'] : 0,
'S_STYLE_DEFAULT' => (isset($style_row['style_default'])) ? $style_row['style_default'] : 0,
'S_SUPERTEMPLATE' => (isset($style_row[$mode . '_inherits_id']) && $style_row[$mode . '_inherits_id']) ? $super['template_name'] : 0,
@@ -2014,8 +1706,6 @@ version = {VERSION}
'L_TITLE' => $user->lang[$this->page_title],
'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'],
'L_NAME' => $user->lang[$l_type . '_NAME'],
- 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '',
- 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '',
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'NAME' => $style_row[$mode . '_name'],
@@ -2102,84 +1792,6 @@ version = {VERSION}
}
/**
- * Store template files into db
- */
- function store_templates($mode, $style_id, $template_path, $filelist)
- {
- global $phpbb_root_path, $phpEx, $db;
-
- $template_path = $template_path . '/template/';
- $includes = array();
- foreach ($filelist as $pathfile => $file_ary)
- {
- foreach ($file_ary as $file)
- {
- if (!($fp = @fopen("{$phpbb_root_path}styles/$template_path$pathfile$file", 'r')))
- {
- trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR);
- }
-
- $filesize = filesize("{$phpbb_root_path}styles/$template_path$pathfile$file");
-
- if ($filesize)
- {
- $template_data = fread($fp, $filesize);
- }
-
- fclose($fp);
-
- if (!$filesize)
- {
- // File is empty
- continue;
- }
-
- if (preg_match_all('#<!-- INCLUDE (.*?\.html) -->#is', $template_data, $matches))
- {
- foreach ($matches[1] as $match)
- {
- $includes[trim($match)][] = $file;
- }
- }
- }
- }
-
- foreach ($filelist as $pathfile => $file_ary)
- {
- foreach ($file_ary as $file)
- {
- // Skip index.
- if (strpos($file, 'index.') === 0)
- {
- continue;
- }
-
- // We could do this using extended inserts ... but that could be one
- // heck of a lot of data ...
- $sql_ary = array(
- 'template_id' => (int) $style_id,
- 'template_filename' => "$pathfile$file",
- 'template_included' => (isset($includes[$file])) ? implode(':', $includes[$file]) . ':' : '',
- 'template_mtime' => (int) filemtime("{$phpbb_root_path}styles/$template_path$pathfile$file"),
- 'template_data' => (string) file_get_contents("{$phpbb_root_path}styles/$template_path$pathfile$file"),
- );
-
- if ($mode == 'insert')
- {
- $sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
- }
- else
- {
- $sql = 'UPDATE ' . STYLES_TEMPLATE_DATA_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE template_id = $style_id
- AND template_filename = '" . $db->sql_escape("$pathfile$file") . "'";
- }
- $db->sql_query($sql);
- }
- }
- }
-
- /**
* Returns an array containing all template filenames for one template that are currently cached.
*
* @param string $template_path contains the name of the template's folder in /styles/
@@ -2361,7 +1973,6 @@ version = {VERSION}
trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING);
}
- $style_row['store_db'] = request_var('store_db', 0);
$style_row['style_active'] = request_var('style_active', 1);
$style_row['style_default'] = request_var('style_default', 0);
@@ -2379,15 +1990,14 @@ version = {VERSION}
}
else
{
- $style_row['store_db'] = $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $install_path, $style_row[$mode . '_copyright'], $style_row['store_db']);
+ $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $install_path, $style_row[$mode . '_copyright']);
}
if (!sizeof($error))
{
$cache->destroy('sql', STYLES_TABLE);
- $message = ($style_row['store_db']) ? '_ADDED_DB' : '_ADDED';
- trigger_error($user->lang[$l_type . $message] . adm_back_link($this->u_action));
+ trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
}
}
@@ -2403,7 +2013,6 @@ version = {VERSION}
'S_SUPERTEMPLATE' => (isset($installcfg['inherit_from'])) ? $installcfg['inherit_from'] : '',
'S_THEME' => ($mode == 'theme') ? true : false,
- 'S_STORE_DB' => (isset($style_row[$mode . '_storedb'])) ? $style_row[$mode . '_storedb'] : 0,
'S_STYLE_ACTIVE' => (isset($style_row['style_active'])) ? $style_row['style_active'] : 0,
'S_STYLE_DEFAULT' => (isset($style_row['style_default'])) ? $style_row['style_default'] : 0,
@@ -2413,8 +2022,6 @@ version = {VERSION}
'L_TITLE' => $user->lang[$this->page_title],
'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'],
'L_NAME' => $user->lang[$l_type . '_NAME'],
- 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '',
- 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '',
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'NAME' => $style_row[$mode . '_name'],
@@ -2440,7 +2047,6 @@ version = {VERSION}
$mode . '_copyright' => utf8_normalize_nfc(request_var('copyright', '', true)),
'template_id' => 0,
'theme_id' => 0,
- 'store_db' => request_var('store_db', 0),
'style_active' => request_var('style_active', 1),
'style_default' => request_var('style_default', 0),
);
@@ -2512,8 +2118,7 @@ version = {VERSION}
{
$cache->destroy('sql', STYLES_TABLE);
- $message = ($style_row['store_db']) ? '_ADDED_DB' : '_ADDED';
- trigger_error($user->lang[$l_type . $message] . adm_back_link($this->u_action));
+ trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
}
}
@@ -2547,7 +2152,6 @@ version = {VERSION}
'S_THEME' => ($mode == 'theme') ? true : false,
'S_BASIS' => ($basis) ? true : false,
- 'S_STORE_DB' => (isset($style_row['storedb'])) ? $style_row['storedb'] : 0,
'S_STYLE_ACTIVE' => (isset($style_row['style_active'])) ? $style_row['style_active'] : 0,
'S_STYLE_DEFAULT' => (isset($style_row['style_default'])) ? $style_row['style_default'] : 0,
'S_TEMPLATE_OPTIONS' => ($mode == 'style') ? $template_options : '',
@@ -2559,8 +2163,6 @@ version = {VERSION}
'L_TITLE' => $user->lang[$this->page_title],
'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'],
'L_NAME' => $user->lang[$l_type . '_NAME'],
- 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '',
- 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '',
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'NAME' => $style_row[$mode . '_name'],
@@ -2731,7 +2333,7 @@ version = {VERSION}
/**
* Install/add an element, doing various checks as we go
*/
- function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright, $store_db = 0)
+ function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright)
{
global $phpbb_root_path, $db, $user;
@@ -2798,7 +2400,7 @@ version = {VERSION}
$select_bf = '';
}
- $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb $select_bf
+ $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, $select_bf
FROM $sql_from
WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
AND {$mode}_inherits_id = 0";
@@ -2814,8 +2416,6 @@ version = {VERSION}
$inherit_id = $row["{$mode}_id"];
$inherit_path = $row["{$mode}_path"];
$inherit_bf = ($mode === 'template') ? $row["bbcode_bitfield"] : false;
- $cfg_data['store_db'] = $row["{$mode}_storedb"];
- $store_db = $row["{$mode}_storedb"];
}
}
else
@@ -2853,10 +2453,6 @@ version = {VERSION}
$sql_ary['bbcode_bitfield'] = $this->template_bitfield;
}
- // We set a pre-defined bitfield here which we may use further in 3.2
- $sql_ary += array(
- 'template_storedb' => $store_db,
- );
if (isset($cfg_data['inherit_from']) && $cfg_data['inherit_from'])
{
$sql_ary += array(
@@ -2867,13 +2463,6 @@ version = {VERSION}
break;
case 'theme':
- // We are only interested in the theme configuration for now
-
- $sql_ary += array(
- 'theme_storedb' => $store_db,
- 'theme_data' => ($store_db) ? $this->db_theme_data($sql_ary, false, $root_path) : '',
- 'theme_mtime' => (int) filemtime("{$phpbb_root_path}styles/$path/theme/stylesheet.css")
- );
break;
}
@@ -2885,19 +2474,9 @@ version = {VERSION}
$id = $db->sql_nextid();
- if ($mode == 'template' && $store_db)
- {
- $filelist = filelist("{$root_path}template", '', 'html');
- $this->store_templates('insert', $id, $path, $filelist);
- }
-
$db->sql_transaction('commit');
- $log = ($store_db) ? 'LOG_' . $l_type . '_ADD_DB' : 'LOG_' . $l_type . '_ADD_FS';
- add_log('admin', $log, $name);
-
- // Return store_db in case it had to be altered
- return $store_db;
+ add_log('admin', 'LOG_' . $l_type . '_ADD_FS', $name);
}
/**
@@ -3006,180 +2585,4 @@ version = {VERSION}
return false;
}
-
- /**
- * Moves a template set and its subtemplates to the database
- *
- * @access public
- * @param string $mode The component to move - only template is supported
- * @param int $id The template id
- */
- function store_in_db($mode, $id)
- {
- global $db, $user;
-
- $error = array();
- $l_type = strtoupper($mode);
- if ($super = $this->get_super($mode, $id))
- {
- $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name']));
- return $error;
- }
-
- $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path
- FROM " . STYLES_TEMPLATE_TABLE . '
- WHERE template_id = ' . (int) $id;
-
- $result = $db->sql_query_limit($sql, 1);
- if ($row = $db->sql_fetchrow($result))
- {
- $db->sql_freeresult($result);
- $subs = $this->check_inheritance($mode, $id);
-
- $this->_store_in_db($mode, $id, $row["{$mode}_path"]);
- if ($subs && sizeof($subs))
- {
- foreach ($subs as $sub_id => $sub)
- {
- if ($err = $this->_store_in_db($mode, $sub["{$mode}_id"], $sub["{$mode}_path"]))
- {
- $error[] = $err;
- }
- }
- }
- }
- if (sizeof($error))
- {
- return $error;
- }
-
- return false;
- }
-
- /**
- * Moves a template set to the database
- *
- * @access private
- * @param string $mode The component to move - only template is supported
- * @param int $id The template id
- * @param string $path TThe path to the template files
- */
- function _store_in_db($mode, $id, $path)
- {
- global $phpbb_root_path, $db;
-
- $filelist = filelist("{$phpbb_root_path}styles/{$path}/template", '', 'html');
- $this->store_templates('insert', $id, $path, $filelist);
-
- // Okay, we do the query here -shouldn't be triggered often.
- $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . '
- SET template_storedb = 1
- WHERE template_id = ' . $id;
- $db->sql_query($sql);
- }
-
- /**
- * Moves a template set and its subtemplates to the filesystem
- *
- * @access public
- * @param string $mode The component to move - only template is supported
- * @param int $id The template id
- */
- function store_in_fs($mode, $id)
- {
- global $db, $user;
-
- $error = array();
- $l_type = strtoupper($mode);
- if ($super = $this->get_super($mode, $id))
- {
- $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name']));
- return($error);
- }
-
- $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path
- FROM " . STYLES_TEMPLATE_TABLE . '
- WHERE template_id = ' . (int) $id;
-
- $result = $db->sql_query_limit($sql, 1);
- if ($row = $db->sql_fetchrow($result))
- {
- $db->sql_freeresult($result);
- if (!sizeof($error))
- {
- $subs = $this->check_inheritance($mode, $id);
-
- $this->_store_in_fs($mode, $id, $row["{$mode}_path"]);
-
- if ($subs && sizeof($subs))
- {
- foreach ($subs as $sub_id => $sub)
- {
- $this->_store_in_fs($mode, $sub["{$mode}_id"], $sub["{$mode}_path"]);
- }
- }
- }
- if (sizeof($error))
- {
- $this->store_in_db($id, $mode);
- return $error;
- }
- }
- return false;
- }
-
- /**
- * Moves a template set to the filesystem
- *
- * @access private
- * @param string $mode The component to move - only template is supported
- * @param int $id The template id
- * @param string $path The path to the template
- */
- function _store_in_fs($mode, $id, $path)
- {
- global $phpbb_root_path, $db, $user, $safe_mode;
-
- $store_db = 0;
- $error = array();
- if (!$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$path}/template"))
- {
- $sql = 'SELECT *
- FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- if (!($fp = @fopen("{$phpbb_root_path}styles/{$path}/template/" . $row['template_filename'], 'wb')))
- {
- $store_db = 1;
- $error[] = $user->lang['EDIT_TEMPLATE_STORED_DB'];
- break;
- }
-
- fwrite($fp, $row['template_data']);
- fclose($fp);
- }
- $db->sql_freeresult($result);
-
- if (!$store_db)
- {
- $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
- WHERE template_id = $id";
- $db->sql_query($sql);
- }
- }
- if (sizeof($error))
- {
- return $error;
- }
- $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . '
- SET template_storedb = 0
- WHERE template_id = ' . $id;
- $db->sql_query($sql);
-
- return false;
- }
-
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 2fa0f89436..5ccb9edd07 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4566,7 +4566,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/",
'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/",
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
- 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&amp;lang=' . $user->lang_name),
+ 'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css',
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css',
'T_STYLESHEET_NAME' => $user->theme['theme_name'],
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 206b88a73e..bd2257c139 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1655,7 +1655,7 @@ class user extends session
$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
}
- $sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id
+ $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_id
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
WHERE s.style_id = $style
AND t.template_id = s.template_id
@@ -1674,7 +1674,7 @@ class user extends session
WHERE user_id = {$this->data['user_id']}";
$db->sql_query($sql);
- $sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id
+ $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_id
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
WHERE s.style_id = $style
AND t.template_id = s.template_id
@@ -1696,7 +1696,6 @@ class user extends session
$parsed_items = $parsed_items['theme'];
$check_for = array(
- 'parse_css_file' => (int) 0,
'pagination_sep' => (string) ', '
);
@@ -1711,52 +1710,6 @@ class user extends session
}
}
- // If the style author specified the theme needs to be cached
- // (because of the used paths and variables) than make sure it is the case.
- // For example, if the theme uses language-specific images it needs to be stored in db.
- if (!$this->theme['theme_storedb'] && $this->theme['parse_css_file'])
- {
- $this->theme['theme_storedb'] = 1;
-
- $stylesheet = file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/stylesheet.css");
- // Match CSS imports
- $matches = array();
- preg_match_all('/@import url\(["\'](.*)["\']\);/i', $stylesheet, $matches);
-
- if (sizeof($matches))
- {
- $content = '';
- foreach ($matches[0] as $idx => $match)
- {
- if ($content = @file_get_contents("{$phpbb_root_path}styles/{$this->theme['theme_path']}/theme/" . $matches[1][$idx]))
- {
- $content = trim($content);
- }
- else
- {
- $content = '';
- }
- $stylesheet = str_replace($match, $content, $stylesheet);
- }
- unset($content);
- }
-
- $stylesheet = str_replace('./', 'styles/' . $this->theme['theme_path'] . '/theme/', $stylesheet);
-
- $sql_ary = array(
- 'theme_data' => $stylesheet,
- 'theme_mtime' => time(),
- 'theme_storedb' => 1
- );
-
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE theme_id = ' . $this->theme['theme_id'];
- $db->sql_query($sql);
-
- unset($sql_ary);
- }
-
$template->set_template();
$this->img_lang = $this->lang_name;
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 7f542974d9..18741191d8 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1062,13 +1062,22 @@ function database_update_info()
),
),
'drop_columns' => array(
- STYLES_TABLE => array(
+ STYLES_TABLE => array(
'imageset_id',
),
+ STYLES_TEMPLATE_TABLE => array(
+ 'template_storedb',
+ ),
+ STYLES_THEME_TABLE => array(
+ 'theme_storedb',
+ 'theme_mtime',
+ 'theme_data',
+ ),
),
'drop_tables' => array(
STYLES_IMAGESET_TABLE,
STYLES_IMAGESET_DATA_TABLE,
+ STYLES_TEMPLATE_DATA_TABLE,
),
),
);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 059b46650c..a4ff93e701 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -205,9 +205,6 @@ $template->set_custom_template('../adm/style', 'admin');
$template->assign_var('T_ASSETS_PATH', '../assets');
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
-// the acp template is never stored in the database
-$user->theme['template_storedb'] = false;
-
$install = new module();
$install->create('install', "index.$phpEx", $mode, $sub);
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 5c3a38d237..926b7cad46 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -134,9 +134,6 @@ class install_update extends module
// Set custom template again. ;)
$template->set_custom_template('../adm/style', 'admin');
- // still, the acp template is never stored in the database
- $user->theme['template_storedb'] = false;
-
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index b5a081bce4..67e5547bb6 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -1104,7 +1104,6 @@ CREATE TABLE phpbb_styles_template (
template_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
template_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL,
bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT 'kNg=' NOT NULL,
- template_storedb INTEGER DEFAULT 0 NOT NULL,
template_inherits_id INTEGER DEFAULT 0 NOT NULL,
template_inherit_path VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL
);;
@@ -1124,27 +1123,12 @@ BEGIN
END;;
-# Table: 'phpbb_styles_template_data'
-CREATE TABLE phpbb_styles_template_data (
- template_id INTEGER DEFAULT 0 NOT NULL,
- template_filename VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL,
- template_included BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL,
- template_mtime INTEGER DEFAULT 0 NOT NULL,
- template_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
-);;
-
-CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data(template_id);;
-CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data(template_filename);;
-
# Table: 'phpbb_styles_theme'
CREATE TABLE phpbb_styles_theme (
theme_id INTEGER NOT NULL,
theme_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
theme_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
- theme_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL,
- theme_storedb INTEGER DEFAULT 0 NOT NULL,
- theme_mtime INTEGER DEFAULT 0 NOT NULL,
- theme_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
+ theme_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL
);;
ALTER TABLE phpbb_styles_theme ADD PRIMARY KEY (theme_id);;
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index d0260ce9c5..fe69670ded 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -1337,7 +1337,6 @@ CREATE TABLE [phpbb_styles_template] (
[template_copyright] [varchar] (255) DEFAULT ('') NOT NULL ,
[template_path] [varchar] (100) DEFAULT ('') NOT NULL ,
[bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL ,
- [template_storedb] [int] DEFAULT (0) NOT NULL ,
[template_inherits_id] [int] DEFAULT (0) NOT NULL ,
[template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL
) ON [PRIMARY]
@@ -1355,36 +1354,14 @@ GO
/*
- Table: 'phpbb_styles_template_data'
-*/
-CREATE TABLE [phpbb_styles_template_data] (
- [template_id] [int] DEFAULT (0) NOT NULL ,
- [template_filename] [varchar] (100) DEFAULT ('') NOT NULL ,
- [template_included] [varchar] (8000) DEFAULT ('') NOT NULL ,
- [template_mtime] [int] DEFAULT (0) NOT NULL ,
- [template_data] [text] DEFAULT ('') NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-CREATE INDEX [tid] ON [phpbb_styles_template_data]([template_id]) ON [PRIMARY]
-GO
-
-CREATE INDEX [tfn] ON [phpbb_styles_template_data]([template_filename]) ON [PRIMARY]
-GO
-
-
-/*
Table: 'phpbb_styles_theme'
*/
CREATE TABLE [phpbb_styles_theme] (
[theme_id] [int] IDENTITY (1, 1) NOT NULL ,
[theme_name] [varchar] (255) DEFAULT ('') NOT NULL ,
[theme_copyright] [varchar] (255) DEFAULT ('') NOT NULL ,
- [theme_path] [varchar] (100) DEFAULT ('') NOT NULL ,
- [theme_storedb] [int] DEFAULT (0) NOT NULL ,
- [theme_mtime] [int] DEFAULT (0) NOT NULL ,
- [theme_data] [text] DEFAULT ('') NOT NULL
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+ [theme_path] [varchar] (100) DEFAULT ('') NOT NULL
+) ON [PRIMARY]
GO
ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 276a2cb2a2..da6ce35be3 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -766,7 +766,6 @@ CREATE TABLE phpbb_styles_template (
template_copyright blob NOT NULL,
template_path varbinary(100) DEFAULT '' NOT NULL,
bbcode_bitfield varbinary(255) DEFAULT 'kNg=' NOT NULL,
- template_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
template_inherits_id int(4) UNSIGNED DEFAULT '0' NOT NULL,
template_inherit_path varbinary(255) DEFAULT '' NOT NULL,
PRIMARY KEY (template_id),
@@ -774,27 +773,12 @@ CREATE TABLE phpbb_styles_template (
);
-# Table: 'phpbb_styles_template_data'
-CREATE TABLE phpbb_styles_template_data (
- template_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- template_filename varbinary(100) DEFAULT '' NOT NULL,
- template_included blob NOT NULL,
- template_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL,
- template_data mediumblob NOT NULL,
- KEY tid (template_id),
- KEY tfn (template_filename)
-);
-
-
# Table: 'phpbb_styles_theme'
CREATE TABLE phpbb_styles_theme (
theme_id mediumint(8) UNSIGNED NOT NULL auto_increment,
theme_name blob NOT NULL,
theme_copyright blob NOT NULL,
theme_path varbinary(100) DEFAULT '' NOT NULL,
- theme_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
- theme_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL,
- theme_data mediumblob NOT NULL,
PRIMARY KEY (theme_id),
UNIQUE theme_name (theme_name(255))
);
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index b3f903e0fb..cdbe377178 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -766,7 +766,6 @@ CREATE TABLE phpbb_styles_template (
template_copyright varchar(255) DEFAULT '' NOT NULL,
template_path varchar(100) DEFAULT '' NOT NULL,
bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
- template_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
template_inherits_id int(4) UNSIGNED DEFAULT '0' NOT NULL,
template_inherit_path varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (template_id),
@@ -774,27 +773,12 @@ CREATE TABLE phpbb_styles_template (
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
-# Table: 'phpbb_styles_template_data'
-CREATE TABLE phpbb_styles_template_data (
- template_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- template_filename varchar(100) DEFAULT '' NOT NULL,
- template_included text NOT NULL,
- template_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL,
- template_data mediumtext NOT NULL,
- KEY tid (template_id),
- KEY tfn (template_filename)
-) CHARACTER SET `utf8` COLLATE `utf8_bin`;
-
-
# Table: 'phpbb_styles_theme'
CREATE TABLE phpbb_styles_theme (
theme_id mediumint(8) UNSIGNED NOT NULL auto_increment,
theme_name varchar(255) DEFAULT '' NOT NULL,
theme_copyright varchar(255) DEFAULT '' NOT NULL,
theme_path varchar(100) DEFAULT '' NOT NULL,
- theme_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
- theme_mtime int(11) UNSIGNED DEFAULT '0' NOT NULL,
- theme_data mediumtext NOT NULL,
PRIMARY KEY (theme_id),
UNIQUE theme_name (theme_name)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index be71095724..8797457e87 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1467,7 +1467,6 @@ CREATE TABLE phpbb_styles_template (
template_copyright varchar2(765) DEFAULT '' ,
template_path varchar2(100) DEFAULT '' ,
bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL,
- template_storedb number(1) DEFAULT '0' NOT NULL,
template_inherits_id number(4) DEFAULT '0' NOT NULL,
template_inherit_path varchar2(255) DEFAULT '' ,
CONSTRAINT pk_phpbb_styles_template PRIMARY KEY (template_id),
@@ -1493,23 +1492,6 @@ END;
/*
- Table: 'phpbb_styles_template_data'
-*/
-CREATE TABLE phpbb_styles_template_data (
- template_id number(8) DEFAULT '0' NOT NULL,
- template_filename varchar2(100) DEFAULT '' ,
- template_included clob DEFAULT '' ,
- template_mtime number(11) DEFAULT '0' NOT NULL,
- template_data clob DEFAULT ''
-)
-/
-
-CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id)
-/
-CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename)
-/
-
-/*
Table: 'phpbb_styles_theme'
*/
CREATE TABLE phpbb_styles_theme (
@@ -1517,9 +1499,6 @@ CREATE TABLE phpbb_styles_theme (
theme_name varchar2(765) DEFAULT '' ,
theme_copyright varchar2(765) DEFAULT '' ,
theme_path varchar2(100) DEFAULT '' ,
- theme_storedb number(1) DEFAULT '0' NOT NULL,
- theme_mtime number(11) DEFAULT '0' NOT NULL,
- theme_data clob DEFAULT '' ,
CONSTRAINT pk_phpbb_styles_theme PRIMARY KEY (theme_id),
CONSTRAINT u_phpbb_theme_name UNIQUE (theme_name)
)
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 13a00d2ebc..3c79aacd6b 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1001,7 +1001,6 @@ CREATE TABLE phpbb_styles_template (
template_copyright varchar(255) DEFAULT '' NOT NULL,
template_path varchar(100) DEFAULT '' NOT NULL,
bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL,
- template_storedb INT2 DEFAULT '0' NOT NULL CHECK (template_storedb >= 0),
template_inherits_id INT4 DEFAULT '0' NOT NULL CHECK (template_inherits_id >= 0),
template_inherit_path varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (template_id)
@@ -1010,20 +1009,6 @@ CREATE TABLE phpbb_styles_template (
CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (template_name);
/*
- Table: 'phpbb_styles_template_data'
-*/
-CREATE TABLE phpbb_styles_template_data (
- template_id INT4 DEFAULT '0' NOT NULL CHECK (template_id >= 0),
- template_filename varchar(100) DEFAULT '' NOT NULL,
- template_included varchar(8000) DEFAULT '' NOT NULL,
- template_mtime INT4 DEFAULT '0' NOT NULL CHECK (template_mtime >= 0),
- template_data TEXT DEFAULT '' NOT NULL
-);
-
-CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id);
-CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename);
-
-/*
Table: 'phpbb_styles_theme'
*/
CREATE SEQUENCE phpbb_styles_theme_seq;
@@ -1033,9 +1018,6 @@ CREATE TABLE phpbb_styles_theme (
theme_name varchar(255) DEFAULT '' NOT NULL,
theme_copyright varchar(255) DEFAULT '' NOT NULL,
theme_path varchar(100) DEFAULT '' NOT NULL,
- theme_storedb INT2 DEFAULT '0' NOT NULL CHECK (theme_storedb >= 0),
- theme_mtime INT4 DEFAULT '0' NOT NULL CHECK (theme_mtime >= 0),
- theme_data TEXT DEFAULT '' NOT NULL,
PRIMARY KEY (theme_id)
);
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 0d6409991f..5506922e17 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -437,10 +437,10 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order)
INSERT INTO phpbb_styles (style_name, style_copyright, style_active, template_id, theme_id) VALUES ('prosilver', '&copy; phpBB Group', 1, 1, 1);
# -- phpbb_styles_template
-INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path, bbcode_bitfield, template_storedb) VALUES ('prosilver', '&copy; phpBB Group', 'prosilver', 'lNg=', 0);
+INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path, bbcode_bitfield) VALUES ('prosilver', '&copy; phpBB Group', 'prosilver', 'lNg=');
# -- phpbb_styles_theme
-INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_storedb, theme_data) VALUES ('prosilver', '&copy; phpBB Group', 'prosilver', 1, '');
+INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path) VALUES ('prosilver', '&copy; phpBB Group', 'prosilver');
# -- Forums
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, '');
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index ce9bad13ce..e0631160fd 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -741,34 +741,18 @@ CREATE TABLE phpbb_styles_template (
template_copyright varchar(255) NOT NULL DEFAULT '',
template_path varchar(100) NOT NULL DEFAULT '',
bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=',
- template_storedb INTEGER UNSIGNED NOT NULL DEFAULT '0',
template_inherits_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
template_inherit_path varchar(255) NOT NULL DEFAULT ''
);
CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template (template_name);
-# Table: 'phpbb_styles_template_data'
-CREATE TABLE phpbb_styles_template_data (
- template_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
- template_filename varchar(100) NOT NULL DEFAULT '',
- template_included text(65535) NOT NULL DEFAULT '',
- template_mtime INTEGER UNSIGNED NOT NULL DEFAULT '0',
- template_data mediumtext(16777215) NOT NULL DEFAULT ''
-);
-
-CREATE INDEX phpbb_styles_template_data_tid ON phpbb_styles_template_data (template_id);
-CREATE INDEX phpbb_styles_template_data_tfn ON phpbb_styles_template_data (template_filename);
-
# Table: 'phpbb_styles_theme'
CREATE TABLE phpbb_styles_theme (
theme_id INTEGER PRIMARY KEY NOT NULL ,
theme_name varchar(255) NOT NULL DEFAULT '',
theme_copyright varchar(255) NOT NULL DEFAULT '',
- theme_path varchar(100) NOT NULL DEFAULT '',
- theme_storedb INTEGER UNSIGNED NOT NULL DEFAULT '0',
- theme_mtime INTEGER UNSIGNED NOT NULL DEFAULT '0',
- theme_data mediumtext(16777215) NOT NULL DEFAULT ''
+ theme_path varchar(100) NOT NULL DEFAULT ''
);
CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name);
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index cca928831f..0bc27b780d 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -675,22 +675,28 @@ $lang = array_merge($lang, array(
'LOG_STYLE_EDIT_DETAILS' => '<strong>Edited style</strong><br />» %s',
'LOG_STYLE_EXPORT' => '<strong>Exported style</strong><br />» %s',
+ // @deprecated 3.1
'LOG_TEMPLATE_ADD_DB' => '<strong>Added new template set to database</strong><br />» %s',
+ // @deprecated 3.1
'LOG_TEMPLATE_ADD_FS' => '<strong>Add new template set on filesystem</strong><br />» %s',
'LOG_TEMPLATE_CACHE_CLEARED' => '<strong>Deleted cached versions of template files in template set <em>%1$s</em></strong><br />» %2$s',
'LOG_TEMPLATE_DELETE' => '<strong>Deleted template set</strong><br />» %s',
'LOG_TEMPLATE_EDIT' => '<strong>Edited template set <em>%1$s</em></strong><br />» %2$s',
'LOG_TEMPLATE_EDIT_DETAILS' => '<strong>Edited template details</strong><br />» %s',
'LOG_TEMPLATE_EXPORT' => '<strong>Exported template set</strong><br />» %s',
+ // @deprecated 3.1
'LOG_TEMPLATE_REFRESHED' => '<strong>Refreshed template set</strong><br />» %s',
+ // @deprecated 3.1
'LOG_THEME_ADD_DB' => '<strong>Added new theme to database</strong><br />» %s',
+ // @deprecated 3.1
'LOG_THEME_ADD_FS' => '<strong>Add new theme on filesystem</strong><br />» %s',
'LOG_THEME_DELETE' => '<strong>Theme deleted</strong><br />» %s',
'LOG_THEME_EDIT_DETAILS' => '<strong>Edited theme details</strong><br />» %s',
'LOG_THEME_EDIT' => '<strong>Edited theme <em>%1$s</em></strong>',
'LOG_THEME_EDIT_FILE' => '<strong>Edited theme <em>%1$s</em></strong><br />» Modified file <em>%2$s</em>',
'LOG_THEME_EXPORT' => '<strong>Exported theme</strong><br />» %s',
+ // @deprecated 3.1
'LOG_THEME_REFRESHED' => '<strong>Refreshed theme</strong><br />» %s',
'LOG_UPDATE_DATABASE' => '<strong>Updated Database from version %1$s to version %2$s</strong>',
diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php
index c450dcadeb..16b499e7f0 100644
--- a/phpBB/language/en/acp/styles.php
+++ b/phpBB/language/en/acp/styles.php
@@ -60,8 +60,6 @@ $lang = array_merge($lang, array(
'CACHE_FILESIZE' => 'File size',
'CACHE_MODIFIED' => 'Modified',
'CONFIRM_TEMPLATE_CLEAR_CACHE' => 'Are you sure you wish to clear all cached versions of your template files?',
- 'CONFIRM_TEMPLATE_REFRESH' => 'Are you sure you wish to refresh all template data in the database with the contents of the template files on the filesystem? This will overwrite all modifications which have been carried out with the template editor while the template was stored in the database.',
- 'CONFIRM_THEME_REFRESH' => 'Are you sure you wish to refresh the theme data stored in the database with the contents of the theme on the filesystem? This will overwrite all modifications which have been carried out with the theme editor while the theme was stored in the database.',
'COPYRIGHT' => 'Copyright',
'CREATE_STYLE' => 'Create new style',
'CREATE_TEMPLATE' => 'Create new template set',
@@ -83,16 +81,13 @@ $lang = array_merge($lang, array(
'EDIT_DETAILS_STYLE' => 'Edit style',
'EDIT_DETAILS_STYLE_EXPLAIN' => 'Using the form below you can modify this existing style. You may alter the combination of template and theme which define the style itself. You may also make the style the default one.',
'EDIT_DETAILS_TEMPLATE' => 'Edit template details',
- 'EDIT_DETAILS_TEMPLATE_EXPLAIN' => 'Here you can edit certain template details such as its name. You may also have the option to switch storage of the stylesheet from the filesystem to the database and vice versa. This option depends on your PHP configuration and whether your template set can be written to by the web server.',
+ 'EDIT_DETAILS_TEMPLATE_EXPLAIN' => 'Here you can edit certain template details such as its name.',
'EDIT_DETAILS_THEME' => 'Edit theme details',
- 'EDIT_DETAILS_THEME_EXPLAIN' => 'Here you can edit certain theme details such as its name. You may also have the option to switch storage of the stylesheet from the filesystem to the database and vice versa. This option depends on your PHP configuration and whether your stylesheet can be written to by the web server.',
+ 'EDIT_DETAILS_THEME_EXPLAIN' => 'Here you can edit certain theme details such as its name.',
'EDIT_TEMPLATE' => 'Edit template',
- 'EDIT_TEMPLATE_EXPLAIN' => 'Here you can edit your template set directly. Please remember that these edits are permanent and cannot be undone once submitted. If PHP can write to the template files in your styles directory any changes here will be written directly to those files. If PHP cannot write to those files they will be copied into the database and all changes will only be reflected there. Please take care when editing your template set, remember to close all replacement variable terms {XXXX} and conditional statements.',
- 'EDIT_TEMPLATE_STORED_DB' => 'The template file was unwritable so the template set is now stored in the database containing the modified file.',
+ 'EDIT_TEMPLATE_EXPLAIN' => 'Here you can edit your template set directly. Please remember that these edits are permanent and cannot be undone once submitted. Please take care when editing your template set, remember to close all replacement variable terms {XXXX} and conditional statements.',
'EDIT_THEME' => 'Edit theme',
'EDIT_THEME_EXPLAIN' => 'Here you can edit the selected theme, changing colours, images, etc.',
- 'EDIT_THEME_STORED_DB' => 'The stylesheet file was unwritable so the stylesheet is now stored in the database containing your modification.',
- 'EDIT_THEME_STORE_PARSED' => 'The theme requires that its stylesheet is parsed. This is only possible if it’s stored in the database.',
'EDITOR_DISABLED' => 'The template editor is disabled.',
'EXPORT' => 'Export',
@@ -258,7 +253,6 @@ $lang = array_merge($lang, array(
'LINE_SPACING' => 'Line spacing',
'LOCALISED_IMAGES' => 'Localised',
- 'LOCATION_DISABLED_EXPLAIN' => 'This setting is inherited and cannot be changed.',
'NO_CLASS' => 'Cannot find class in stylesheet.',
'NO_IMAGE' => 'No image',
@@ -299,7 +293,6 @@ $lang = array_merge($lang, array(
'SELECTED_TEMPLATE_FILE' => 'Selected template file',
'SELECTED_THEME' => 'Selected theme',
'SELECTED_THEME_FILE' => 'Selected theme file',
- 'STORE_DATABASE' => 'Database',
'STORE_FILESYSTEM' => 'Filesystem',
'STYLE_ACTIVATE' => 'Activate',
'STYLE_ACTIVE' => 'Active',
@@ -325,15 +318,14 @@ $lang = array_merge($lang, array(
'STYLE_THEME' => 'Theme',
'STYLE_USED_BY' => 'Used by (including robots)',
- 'TEMPLATE_ADDED' => 'Template set added and stored on filesystem.',
- 'TEMPLATE_ADDED_DB' => 'Template set added and stored in database.',
+ 'TEMPLATE_ADDED' => 'Template set added.',
'TEMPLATE_CACHE' => 'Template cache',
'TEMPLATE_CACHE_EXPLAIN' => 'By default phpBB caches the compiled version of its templates. This decreases the load on the server each time a page is viewed and thus may reduce the page generation time. Here you can view the cache status of each file and delete individual files or the entire cache.',
'TEMPLATE_CACHE_CLEARED' => 'Template cache cleared successfully.',
'TEMPLATE_CACHE_EMPTY' => 'There are no cached templates.',
'TEMPLATE_DELETED' => 'Template set deleted successfully.',
'TEMPLATE_DELETE_DEPENDENT' => 'The template set cannot be deleted as there are one or more other template sets inheriting from it:',
- 'TEMPLATE_DELETED_FS' => 'Template set removed from database but some files may remain on the filesystem.',
+ 'TEMPLATE_DELETED_FS' => 'Template set removed from database but files remain on the filesystem.',
'TEMPLATE_DETAILS_UPDATED' => 'Template details successfully updated.',
'TEMPLATE_EDITOR' => 'Raw HTML template editor',
'TEMPLATE_EDITOR_HEIGHT' => 'Template editor height',
@@ -352,14 +344,10 @@ $lang = array_merge($lang, array(
'TEMPLATE_FILE' => 'Template file',
'TEMPLATE_FILE_UPDATED' => 'Template file updated successfully.',
'TEMPLATE_INHERITS' => 'This template sets inherits from %s and thus cannot have a different storage setting than its super template.',
- 'TEMPLATE_LOCATION' => 'Store templates in',
- 'TEMPLATE_LOCATION_EXPLAIN' => 'Images are always stored on the filesystem.',
'TEMPLATE_NAME' => 'Template name',
'TEMPLATE_FILE_NOT_WRITABLE'=> 'Unable to write to template file %s. Please check the permissions for the directory and the files.',
- 'TEMPLATE_REFRESHED' => 'Template refreshed successfully.',
- 'THEME_ADDED' => 'New theme added on filesystem.',
- 'THEME_ADDED_DB' => 'New theme added to database.',
+ 'THEME_ADDED' => 'New theme added.',
'THEME_CLASS_ADDED' => 'Custom class added successfully.',
'THEME_DELETED' => 'Theme deleted successfully.',
'THEME_DELETED_FS' => 'Theme removed from database but files remain on the filesystem.',
@@ -373,16 +361,13 @@ $lang = array_merge($lang, array(
'THEME_ERR_NAME_EXIST' => 'A theme with that name already exists.',
'THEME_ERR_NAME_LONG' => 'The theme name can be no longer than 30 characters.',
'THEME_ERR_NOT_THEME' => 'The archive you specified does not contain a valid theme.',
- 'THEME_ERR_REFRESH_FS' => 'This theme is stored on the filesystem so there is no need to refresh it.',
'THEME_ERR_STYLE_NAME' => 'You must supply a name for this theme.',
'THEME_FILE' => 'Theme file',
+ 'THEME_FILE_NOT_WRITABLE' => 'Unable to write to theme file %s. Please check the permissions for the directory and the files.',
'THEME_EXPORT' => 'Export Theme',
'THEME_EXPORT_EXPLAIN' => 'Here you can export a theme in the form of an archive. This archive will contain all the data necessary to install the theme on another board. You may select whether to download the file directly or to place it in your store folder for download later or via FTP.',
'THEME_EXPORTED' => 'Theme exported successfully and stored in %s.',
- 'THEME_LOCATION' => 'Store stylesheet in',
- 'THEME_LOCATION_EXPLAIN' => 'Images are always stored on the filesystem.',
'THEME_NAME' => 'Theme name',
- 'THEME_REFRESHED' => 'Theme refreshed successfully.',
'THEME_UPDATED' => 'Theme updated successfully.',
'UNDERLINE' => 'Underline',
diff --git a/phpBB/style.php b/phpBB/style.php
deleted file mode 100644
index 7f7b71d753..0000000000
--- a/phpBB/style.php
+++ /dev/null
@@ -1,222 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* @ignore
-*/
-define('IN_PHPBB', true);
-$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
-
-require($phpbb_root_path . 'includes/startup.' . $phpEx);
-require($phpbb_root_path . 'config.' . $phpEx);
-
-if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
-{
- exit;
-}
-
-// Load Extensions
-if (!empty($load_extensions) && function_exists('dl'))
-{
- $load_extensions = explode(',', $load_extensions);
-
- foreach ($load_extensions as $extension)
- {
- @dl(trim($extension));
- }
-}
-
-// no $request here because it is not loaded yet
-$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
-
-// This is a simple script to grab and output the requested CSS data stored in the DB
-// We include a session_id check to try and limit 3rd party linking ... unless they
-// happen to have a current session it will output nothing. We will also cache the
-// resulting CSS data for five minutes ... anything to reduce the load on the SQL
-// server a little
-if ($id)
-{
- // Include files
- require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
- require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
- require($phpbb_root_path . 'includes/constants.' . $phpEx);
- require($phpbb_root_path . 'includes/functions.' . $phpEx);
- require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
-
- $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
- $class_loader->register();
-
- // set up caching
- $cache_factory = new phpbb_cache_factory($acm_type);
- $cache = $cache_factory->get_service();
- $class_loader->set_cache($cache->get_driver());
-
- $request = new phpbb_request();
- $db = new $sql_db();
-
- // make sure request_var uses this request instance
- request_var('', 0, false, false, $request); // "dependency injection" for a function
-
- // Connect to DB
- if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
- {
- exit;
- }
- unset($dbpasswd);
-
- $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
- set_config(null, null, null, $config);
- set_config_count(null, null, null, $config);
-
- $user = false;
-
- // try to get a session ID from REQUEST array
- $sid = request_var('sid', '');
-
- if (!$sid)
- {
- // if that failed, then look in the cookies
- $sid = request_var($config['cookie_name'] . '_sid', '', false, true);
- }
-
- if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid))
- {
- $sid = '';
- }
-
- if ($sid)
- {
- $sql = 'SELECT u.user_id, u.user_lang
- FROM ' . SESSIONS_TABLE . ' s, ' . USERS_TABLE . " u
- WHERE s.session_id = '" . $db->sql_escape($sid) . "'
- AND s.session_user_id = u.user_id";
- $result = $db->sql_query($sql);
- $user = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
-
- $recompile = $config['load_tplcompile'];
- if (!$user)
- {
- $id = ($id) ? $id : $config['default_style'];
-// Commented out because calls do not always include the SID anymore
-// $recompile = false;
- $user = array('user_id' => ANONYMOUS);
- }
-
- $sql = 'SELECT s.style_id, c.theme_id, c.theme_data, c.theme_path, c.theme_name, c.theme_mtime, t.template_path
- FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c
- WHERE s.style_id = ' . $id . '
- AND t.template_id = s.template_id
- AND c.theme_id = s.theme_id';
- $result = $db->sql_query($sql, 300);
- $theme = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (!$theme)
- {
- exit;
- }
-
- if ($user['user_id'] == ANONYMOUS)
- {
- $user['user_lang'] = $config['default_lang'];
- }
-
- // gzip_compression
- if ($config['gzip_compress'])
- {
- // IE6 is not able to compress the style (do not ask us why!)
- $browser = strtolower($request->header('User-Agent'));
-
- if ($browser && strpos($browser, 'msie 6.0') === false && @extension_loaded('zlib') && !headers_sent())
- {
- ob_start('ob_gzhandler');
- }
- }
-
- // Expire time of seven days if not recached
- $expire_time = 7*86400;
- $recache = false;
-
- // Re-cache stylesheet data if necessary
- if ($recompile || empty($theme['theme_data']))
- {
- $recache = (empty($theme['theme_data'])) ? true : false;
- $update_time = time();
-
- // We test for stylesheet.css because it is faster and most likely the only file changed on common themes
- if (!$recache && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
- {
- $recache = true;
- $update_time = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
- }
- else if (!$recache)
- {
- $last_change = $theme['theme_mtime'];
- $dir = @opendir("{$phpbb_root_path}styles/{$theme['theme_path']}/theme");
-
- if ($dir)
- {
- while (($entry = readdir($dir)) !== false)
- {
- if (substr(strrchr($entry, '.'), 1) == 'css' && $last_change < @filemtime("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/{$entry}"))
- {
- $recache = true;
- break;
- }
- }
- closedir($dir);
- }
- }
- }
-
- if ($recache)
- {
- include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
-
- $theme['theme_data'] = acp_styles::db_theme_data($theme);
- $theme['theme_mtime'] = $update_time;
-
- // Save CSS contents
- $sql_ary = array(
- 'theme_mtime' => $theme['theme_mtime'],
- 'theme_data' => $theme['theme_data']
- );
-
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE theme_id = {$theme['theme_id']}";
- $db->sql_query($sql);
-
- $cache->destroy('sql', STYLES_THEME_TABLE);
- }
-
- // Only set the expire time if the theme changed data is older than 30 minutes - to cope with changes from the ACP
- if ($recache || $theme['theme_mtime'] > (time() - 1800))
- {
- header('Expires: 0');
- }
- else
- {
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $expire_time));
- }
-
- header('Content-type: text/css; charset=UTF-8');
-
- // Echo Theme Data
- echo $theme['theme_data'];
-
- if (!empty($cache))
- {
- $cache->unload();
- }
- $db->sql_close();
-}
diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg
index f02d5fcc05..e27ba1c3a6 100644
--- a/phpBB/styles/prosilver/theme/theme.cfg
+++ b/phpBB/styles/prosilver/theme/theme.cfg
@@ -14,12 +14,8 @@
# the value, then enclose the value with single or double quotes.
# Single and double quotes do not need to be escaped.
#
-# Available and used values:
-# parse_css_file
-#
# General Information about this theme
name = prosilver
copyright = &copy; phpBB Group, 2007
version = 3.1.0-dev
-
diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg
index 207e1b6650..c560dabae2 100644
--- a/phpBB/styles/subsilver2/theme/theme.cfg
+++ b/phpBB/styles/subsilver2/theme/theme.cfg
@@ -14,9 +14,6 @@
# the value, then enclose the value with single or double quotes.
# Single and double quotes do not need to be escaped.
#
-# Available and used values:
-# parse_css_file
-#
# General Information about this theme
name = subsilver2