mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-29 10:39:19 +02:00
[feature/remove-db-styles] Removing unused methods from acp_style.
These got left behind in 6854d47. PHPBB3-9741
This commit is contained in:
parent
9e4349e7fa
commit
23415170cb
@ -2684,180 +2684,4 @@ version = {VERSION}
|
|||||||
|
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user