Move theme selection to init() in mod/admin
This commit is contained in:
parent
af7b852d04
commit
6aa0899d67
1 changed files with 15 additions and 15 deletions
|
@ -33,6 +33,21 @@ use Friendica\Util\Network;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current theme for theme settings pages. This needs to be done before the post() or content() are called
|
||||||
|
*
|
||||||
|
* @param App $a
|
||||||
|
*/
|
||||||
|
function admin_init(App $a)
|
||||||
|
{
|
||||||
|
if ($a->argc > 2 && $a->argv[1] == 'themes') {
|
||||||
|
$theme = $a->argv[2];
|
||||||
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
|
$a->setCurrentTheme($theme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Process send data from the admin panels subpages
|
* @brief Process send data from the admin panels subpages
|
||||||
*
|
*
|
||||||
|
@ -89,15 +104,8 @@ function admin_post(App $a)
|
||||||
|
|
||||||
$theme = $a->argv[2];
|
$theme = $a->argv[2];
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
$a->setCurrentTheme($theme);
|
|
||||||
|
|
||||||
require_once "view/theme/$theme/theme.php";
|
|
||||||
require_once "view/theme/$theme/config.php";
|
require_once "view/theme/$theme/config.php";
|
||||||
|
|
||||||
$init = $theme . '_init';
|
|
||||||
if (function_exists($init)) {
|
|
||||||
$init($a);
|
|
||||||
}
|
|
||||||
if (function_exists('theme_admin_post')) {
|
if (function_exists('theme_admin_post')) {
|
||||||
theme_admin_post($a);
|
theme_admin_post($a);
|
||||||
}
|
}
|
||||||
|
@ -2306,16 +2314,8 @@ function admin_page_themes(App $a)
|
||||||
|
|
||||||
$admin_form = '';
|
$admin_form = '';
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
$a->setCurrentTheme($theme);
|
|
||||||
|
|
||||||
require_once "view/theme/$theme/theme.php";
|
|
||||||
require_once "view/theme/$theme/config.php";
|
require_once "view/theme/$theme/config.php";
|
||||||
|
|
||||||
$init = $theme . "_init";
|
|
||||||
if (function_exists($init)) {
|
|
||||||
$init($a);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function_exists('theme_admin')) {
|
if (function_exists('theme_admin')) {
|
||||||
$admin_form = theme_admin($a);
|
$admin_form = theme_admin($a);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue