3 namespace Friendica\Module\Admin\Themes;
\r
5 use Friendica\Core\L10n;
\r
6 use Friendica\Core\Renderer;
\r
7 use Friendica\Core\System;
\r
8 use Friendica\Core\Theme;
\r
9 use Friendica\Module\BaseAdminModule;
\r
10 use Friendica\Util\Strings;
\r
12 class Embed extends BaseAdminModule
\r
14 public static function init()
\r
16 $a = self::getApp();
\r
19 // @TODO: Replace with parameter from router
\r
20 $theme = $a->argv[2];
\r
21 $theme = Strings::sanitizeFilePathItem($theme);
\r
22 if (is_file("view/theme/$theme/config.php")) {
\r
23 $a->setCurrentTheme($theme);
\r
28 public static function post()
\r
32 $a = self::getApp();
\r
35 // @TODO: Replace with parameter from router
\r
36 $theme = $a->argv[2];
\r
37 $theme = Strings::sanitizeFilePathItem($theme);
\r
38 if (is_file("view/theme/$theme/config.php")) {
\r
39 self::checkFormSecurityTokenRedirectOnError('/admin/themes/' . $theme . '/embed?mode=minimal', 'admin_theme_settings');
\r
41 require_once "view/theme/$theme/config.php";
\r
43 if (function_exists('theme_admin_post')) {
\r
44 theme_admin_post($a);
\r
48 info(L10n::t('Theme settings updated.'));
\r
54 $a->internalRedirect('admin/themes/' . $theme . '/embed?mode=minimal');
\r
58 public static function content()
\r
62 $a = self::getApp();
\r
65 // @TODO: Replace with parameter from router
\r
66 $theme = $a->argv[2];
\r
67 $theme = Strings::sanitizeFilePathItem($theme);
\r
68 if (!is_dir("view/theme/$theme")) {
\r
69 notice(L10n::t('Unknown theme.'));
\r
74 if (is_file("view/theme/$theme/config.php")) {
\r
75 require_once "view/theme/$theme/config.php";
\r
77 if (function_exists('theme_admin')) {
\r
78 $admin_form = theme_admin($a);
\r
82 $t = Renderer::getMarkupTemplate('admin/addons/embed.tpl');
\r
83 return Renderer::replaceMacros($t, [
\r
84 '$action' => '/admin/themes/' . $theme . '/embed?mode=minimal',
\r
85 '$form' => $admin_form,
\r
86 '$form_security_token' => parent::getFormSecurityToken("admin_theme_settings"),
\r