diff --git a/Web/Themes/Themepack.php b/Web/Themes/Themepack.php index 3877e1f4..9a1e61d4 100644 --- a/Web/Themes/Themepack.php +++ b/Web/Themes/Themepack.php @@ -7,13 +7,15 @@ class Themepack private $ver; private $meta; private $home; + private $enabled; - function __construct(string $id, string $ver, object $meta) + function __construct(string $id, string $ver, bool $enabled, object $meta) { - $this->id = $id; - $this->ver = $ver; - $this->meta = $meta; - $this->home = OPENVK_ROOT . "/themepacks/$id"; + $this->id = $id; + $this->ver = $ver; + $this->meta = $meta; + $this->home = OPENVK_ROOT . "/themepacks/$id"; + $this->enabled = $enabled; } function getId(): string @@ -21,6 +23,11 @@ class Themepack return $this->id; } + function isEnabled(): bool + { + return $this->enabled; + } + function getName(?string $lang = NULL): string { if(!$this->meta->name) @@ -71,6 +78,6 @@ class Themepack if($manifest->openvk_version > Themepacks::THEMPACK_ENGINE_VERSION) throw new Exceptions\IncompatibleThemeException("Theme is built for newer OVK (themeEngine" . $manifest->openvk_version . ")"); - return new static($manifest->id, $manifest->version, (object) $manifest->metadata); + return new static($manifest->id, $manifest->version, (bool) ($manifest->enabled ?? true), (object) $manifest->metadata); } } diff --git a/Web/Themes/Themepacks.php b/Web/Themes/Themepacks.php index ba880dd8..a05746c0 100644 --- a/Web/Themes/Themepacks.php +++ b/Web/Themes/Themepacks.php @@ -46,7 +46,8 @@ class Themepacks implements \ArrayAccess function getThemeList(): \Traversable { foreach($this->loadedThemepacks as $id => $theme) - yield $id => ($theme->getName(Session::i()->get("lang", "ru"))); + if($theme->isEnabled()) + yield $id => ($theme->getName(Session::i()->get("lang", "ru"))); } /* ArrayAccess */