3 namespace Friendica\Module\Admin\Themes;
\r
5 use Friendica\Core\L10n;
\r
6 use Friendica\Core\Renderer;
\r
7 use Friendica\Module\BaseAdminModule;
\r
8 use Friendica\Util\Strings;
\r
10 class Embed extends BaseAdminModule
\r
12 public static function init()
\r
14 $a = self::getApp();
\r
17 // @TODO: Replace with parameter from router
\r
18 $theme = $a->argv[2];
\r
19 $theme = Strings::sanitizeFilePathItem($theme);
\r
20 if (is_file("view/theme/$theme/config.php")) {
\r
21 $a->setCurrentTheme($theme);
\r
26 public static function post()
\r
30 $a = self::getApp();
\r
33 // @TODO: Replace with parameter from router
\r
34 $theme = $a->argv[2];
\r
35 $theme = Strings::sanitizeFilePathItem($theme);
\r
36 if (is_file("view/theme/$theme/config.php")) {
\r
37 self::checkFormSecurityTokenRedirectOnError('/admin/themes/' . $theme . '/embed?mode=minimal', 'admin_theme_settings');
\r
39 require_once "view/theme/$theme/config.php";
\r
41 if (function_exists('theme_admin_post')) {
\r
42 theme_admin_post($a);
\r
46 info(L10n::t('Theme settings updated.'));
\r
52 $a->internalRedirect('admin/themes/' . $theme . '/embed?mode=minimal');
\r
56 public static function content()
\r
60 $a = self::getApp();
\r
63 // @TODO: Replace with parameter from router
\r
64 $theme = $a->argv[2];
\r
65 $theme = Strings::sanitizeFilePathItem($theme);
\r
66 if (!is_dir("view/theme/$theme")) {
\r
67 notice(L10n::t('Unknown theme.'));
\r
72 if (is_file("view/theme/$theme/config.php")) {
\r
73 require_once "view/theme/$theme/config.php";
\r
75 if (function_exists('theme_admin')) {
\r
76 $admin_form = theme_admin($a);
\r
80 $t = Renderer::getMarkupTemplate('admin/addons/embed.tpl');
\r
81 return Renderer::replaceMacros($t, [
\r
82 '$action' => '/admin/themes/' . $theme . '/embed?mode=minimal',
\r
83 '$form' => $admin_form,
\r
84 '$form_security_token' => parent::getFormSecurityToken("admin_theme_settings"),
\r