mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Couple more updates
git-svn-id: file:///svn/phpbb/trunk@4344 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b723058fb0
commit
5ab81af82e
1 changed files with 69 additions and 41 deletions
|
@ -1094,7 +1094,7 @@ switch ($mode)
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (filemtime("{$phpbb_root_path}styles/$template_path/template/" . $row['template_filename']) > $row['template_mtime'])
|
if (@filemtime("{$phpbb_root_path}styles/$template_path/template/" . $row['template_filename']) > $row['template_mtime'])
|
||||||
{
|
{
|
||||||
$filelist['/'][] = $row['template_filename'];
|
$filelist['/'][] = $row['template_filename'];
|
||||||
}
|
}
|
||||||
|
@ -1426,30 +1426,59 @@ function viewsource(url)
|
||||||
$test_ary += $tpl_ary;
|
$test_ary += $tpl_ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dp = @opendir("{$phpbb_root_path}styles/$template_path/template");
|
|
||||||
while ($file = readdir($dp))
|
if (!$template_storedb)
|
||||||
{
|
{
|
||||||
if (!strstr($file, 'bbcode.') && strstr($file, '.html') && is_file("{$phpbb_root_path}styles/$template_path/template/$file"))
|
$dp = @opendir("{$phpbb_root_path}styles/$template_path/template");
|
||||||
|
while ($file = readdir($dp))
|
||||||
{
|
{
|
||||||
if (!in_array($file, $test_ary))
|
if (!strstr($file, 'bbcode.') && strstr($file, '.html') && is_file("{$phpbb_root_path}styles/$template_path/template/$file"))
|
||||||
{
|
{
|
||||||
$tpllist['custom'][] = $file;
|
if (!in_array($file, $test_ary))
|
||||||
|
{
|
||||||
|
// $tpllist['custom'][] = $file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir($dp);
|
||||||
|
unset($matches);
|
||||||
|
unset($test_ary);
|
||||||
|
|
||||||
|
if ($tplname)
|
||||||
|
{
|
||||||
|
if (!($fp = fopen("{$phpbb_root_path}styles/$template_path/template/$tplname", 'r')))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['NO_TEMPLATE']);
|
||||||
|
}
|
||||||
|
$tpldata = fread($fp, filesize("{$phpbb_root_path}styles/$template_path/template/$tplname"));
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . STYLES_TPLDATA_TABLE . "
|
||||||
|
WHERE template_id = $template_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if (!strstr($row['template_filename'], 'bbcode.') && !in_array($row['template_filename'], $test_ary))
|
||||||
|
{
|
||||||
|
// $tpllist['custom'][] = $row['template_filename'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['template_filename'] == $tplname)
|
||||||
|
{
|
||||||
|
$tpldata = $row['template_data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
closedir($dp);
|
|
||||||
unset($matches);
|
|
||||||
unset($test_ary);
|
|
||||||
|
|
||||||
if ($tplname)
|
if ($tplname)
|
||||||
{
|
{
|
||||||
$fp = fopen("{$phpbb_root_path}styles/$template_path/template/$tplname", 'r');// . '.html'
|
|
||||||
while ($buffer = fread($fp, 1024))
|
|
||||||
{
|
|
||||||
$tpldata .= $buffer;
|
|
||||||
}
|
|
||||||
@fclose($fp);
|
|
||||||
|
|
||||||
preg_match_all('#<!\-\- INCLUDE (.*?) \-\->#', $tpldata, $included_tpls);
|
preg_match_all('#<!\-\- INCLUDE (.*?) \-\->#', $tpldata, $included_tpls);
|
||||||
$included_tpls = $included_tpls[1];
|
$included_tpls = $included_tpls[1];
|
||||||
}
|
}
|
||||||
|
@ -1612,11 +1641,7 @@ function viewsource(url)
|
||||||
|
|
||||||
|
|
||||||
// Where is the CSS stored?
|
// Where is the CSS stored?
|
||||||
if ($css_storedb)
|
if (!$theme_storedb)
|
||||||
{
|
|
||||||
$stylesheet = &$css_data;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'rb')))
|
if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'rb')))
|
||||||
{
|
{
|
||||||
|
@ -1625,6 +1650,10 @@ function viewsource(url)
|
||||||
$stylesheet = fread($fp, filesize("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css"));
|
$stylesheet = fread($fp, filesize("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css"));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$stylesheet = &$theme_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pull out list of "custom" tags
|
// Pull out list of "custom" tags
|
||||||
|
@ -1696,14 +1725,10 @@ function viewsource(url)
|
||||||
{
|
{
|
||||||
$stylesheet = preg_replace('#^(' . $class . ' {).*?(})#m', '\1 ' . $updated_element . ' \2', $stylesheet);
|
$stylesheet = preg_replace('#^(' . $class . ' {).*?(})#m', '\1 ' . $updated_element . ' \2', $stylesheet);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$stylesheet .= '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Where is the CSS stored?
|
// Where is the CSS stored?
|
||||||
if (is_writeable("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css") && !$css_storedb)
|
if (!$storedb && is_writeable("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css"))
|
||||||
{
|
{
|
||||||
// Grab template data
|
// Grab template data
|
||||||
if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'wb')))
|
if (!($fp = fopen("{$phpbb_root_path}styles/$theme_path/theme/stylesheet.css", 'wb')))
|
||||||
|
@ -1715,11 +1740,10 @@ function viewsource(url)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We change the path to one relative to the root rather than the theme
|
// We change the path to one relative to the root rather than the theme folder
|
||||||
// folder
|
|
||||||
$sql_ary = array(
|
$sql_ary = array(
|
||||||
'css_storedb' => 1,
|
'theme_storedb' => 1,
|
||||||
'css_data' => str_replace('./', 'styles/themes/', $stylesheet),
|
'theme_data' => str_replace('./', "styles/$theme_path/theme/", $stylesheet),
|
||||||
);
|
);
|
||||||
$sql = 'UPDATE ' . STYLES_CSS_TABLE . '
|
$sql = 'UPDATE ' . STYLES_CSS_TABLE . '
|
||||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||||
|
@ -1738,7 +1762,7 @@ function viewsource(url)
|
||||||
if (!empty($_POST['preview']))
|
if (!empty($_POST['preview']))
|
||||||
{
|
{
|
||||||
// Temp, just to get this out of the way
|
// Temp, just to get this out of the way
|
||||||
theme_preview($stylesheet, $class, $css_element);
|
theme_preview($theme_path, $stylesheet, $class, $css_element);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1817,7 +1841,7 @@ function viewsource(url)
|
||||||
|
|
||||||
|
|
||||||
// Grab list of potential images for class backgrounds
|
// Grab list of potential images for class backgrounds
|
||||||
$imglist = filelist("{$phpbb_root_path}styles/themes/$theme_path");
|
$imglist = filelist("{$phpbb_root_path}styles/$theme_path/theme");
|
||||||
|
|
||||||
$bg_imglist = '';
|
$bg_imglist = '';
|
||||||
foreach ($imglist as $path => $img_ary)
|
foreach ($imglist as $path => $img_ary)
|
||||||
|
@ -2924,7 +2948,12 @@ function details($type, $mode, $action, $id)
|
||||||
if ($type == 'template' && $storedb)
|
if ($type == 'template' && $storedb)
|
||||||
{
|
{
|
||||||
$filelist = array('/template' => $filelist['']);
|
$filelist = array('/template' => $filelist['']);
|
||||||
$id = $db->sql_nextid();
|
|
||||||
|
if (!$id)
|
||||||
|
{
|
||||||
|
$id = $db->sql_nextid();
|
||||||
|
}
|
||||||
|
|
||||||
store_templates('insert', $id, $path, $filelist);
|
store_templates('insert', $id, $path, $filelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3292,12 +3321,10 @@ function export($type, $id, $name, $path, &$files, &$data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function theme_preview(&$stylesheet, &$class, &$css_element)
|
function theme_preview(&$path, &$stylesheet, &$class, &$css_element)
|
||||||
{
|
{
|
||||||
global $config, $user;
|
global $config, $user;
|
||||||
|
|
||||||
$output = '<span class="' . str_replace('.', '', $class). '">%s</span>';
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html dir="<?php echo $user->lang['LTR']; ?>">
|
<html dir="<?php echo $user->lang['LTR']; ?>">
|
||||||
|
@ -3308,15 +3335,16 @@ function theme_preview(&$stylesheet, &$class, &$css_element)
|
||||||
<!--
|
<!--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
$updated_element = implode('; ', $css_element) . ';';
|
$updated_element = implode('; ', $css_element) . ';';
|
||||||
|
|
||||||
if (preg_match('#^' . $class . ' {(.*?)}#m', $stylesheet))
|
if (preg_match('#^' . $class . ' {(.*?)}#m', $stylesheet))
|
||||||
{
|
{
|
||||||
echo $stylesheet = str_replace("url('./../", "url('./../styles/themes/", preg_replace('#^(' . $class . ' {).*?(})#m', '\1 ' . $updated_element . ' \2', $stylesheet));
|
$stylesheet = preg_replace('#^(' . $class . ' {).*?(})#m', '\1 ' . $updated_element . ' \2', $stylesheet);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo str_replace("url('./../", "url('./../styles/themes/", $stylesheet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo str_replace('styles/', '../styles/', str_replace('./', "styles/$path/theme/", $stylesheet));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
//-->
|
//-->
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Reference in a new issue