/
usr
/
share
/
phpmyadmin
/
libraries
/
classes
/
/usr/share/phpmyadmin/libraries/classes
mkdir
upload
Name
Size
Mode
Actions
Charsets/
-
0755
rm
Command/
-
0755
rm
Config/
-
0755
rm
Controllers/
-
0755
rm
Database/
-
0755
rm
Dbal/
-
0755
rm
Display/
-
0755
rm
Engines/
-
0755
rm
Exceptions/
-
0755
rm
Export/
-
0755
rm
Gis/
-
0755
rm
Html/
-
0755
rm
Import/
-
0755
rm
Navigation/
-
0755
rm
Plugins/
-
0755
rm
Properties/
-
0755
rm
Providers/
-
0755
rm
Query/
-
0755
rm
Server/
-
0755
rm
Setup/
-
0755
rm
Table/
-
0755
rm
Twig/
-
0755
rm
Utils/
-
0755
rm
Advisor.php
12517
0644
edit
dl
rm
Bookmark.php
10944
0644
edit
dl
rm
BrowseForeigners.php
11083
0644
edit
dl
rm
Charsets.php
7267
0644
edit
dl
rm
CheckUserPrivileges.php
12230
0644
edit
dl
rm
Config.php
46456
0644
edit
dl
rm
Console.php
3460
0644
edit
dl
rm
Core.php
43344
0644
edit
dl
rm
CreateAddField.php
17993
0644
edit
dl
rm
DatabaseInterface.php
76802
0644
edit
dl
rm
DbTableExists.php
3287
0644
edit
dl
rm
Encoding.php
8715
0644
edit
dl
rm
Error.php
14304
0644
edit
dl
rm
ErrorHandler.php
17557
0644
edit
dl
rm
ErrorReport.php
9364
0644
edit
dl
rm
Export.php
47351
0644
edit
dl
rm
File.php
21786
0644
edit
dl
rm
FileListing.php
2923
0644
edit
dl
rm
Font.php
5718
0644
edit
dl
rm
Footer.php
10794
0644
edit
dl
rm
Git.php
18381
0644
edit
dl
rm
Header.php
21967
0644
edit
dl
rm
Import.php
58840
0644
edit
dl
rm
Index.php
15428
0644
edit
dl
rm
IndexColumn.php
4331
0644
edit
dl
rm
InsertEdit.php
133309
0644
edit
dl
rm
InternalRelations.php
17730
0644
edit
dl
rm
IpAllowDeny.php
9997
0644
edit
dl
rm
Language.php
4568
0644
edit
dl
rm
LanguageManager.php
24532
0644
edit
dl
rm
Linter.php
5374
0644
edit
dl
rm
ListAbstract.php
1814
0644
edit
dl
rm
ListDatabase.php
4402
0644
edit
dl
rm
Logging.php
2781
0644
edit
dl
rm
Menu.php
21812
0644
edit
dl
rm
Message.php
19547
0644
edit
dl
rm
Mime.php
916
0644
edit
dl
rm
Normalization.php
42475
0644
edit
dl
rm
OpenDocument.php
8617
0644
edit
dl
rm
Operations.php
38748
0644
edit
dl
rm
OutputBuffering.php
4074
0644
edit
dl
rm
ParseAnalyze.php
2429
0644
edit
dl
rm
Partition.php
7340
0644
edit
dl
rm
Pdf.php
4449
0644
edit
dl
rm
Plugins.php
25783
0644
edit
dl
rm
Profiling.php
2317
0644
edit
dl
rm
RecentFavoriteTable.php
12297
0644
edit
dl
rm
Relation.php
79247
0644
edit
dl
rm
RelationCleanup.php
15051
0644
edit
dl
rm
Replication.php
4843
0644
edit
dl
rm
ReplicationGui.php
22038
0644
edit
dl
rm
ReplicationInfo.php
4943
0644
edit
dl
rm
Response.php
16864
0644
edit
dl
rm
Routing.php
5845
0644
edit
dl
rm
Sanitize.php
12418
0644
edit
dl
rm
SavedSearches.php
12221
0644
edit
dl
rm
Scripts.php
3726
0644
edit
dl
rm
Session.php
8198
0644
edit
dl
rm
Sql.php
68272
0644
edit
dl
rm
SqlQueryForm.php
7286
0644
edit
dl
rm
StorageEngine.php
12828
0644
edit
dl
rm
SubPartition.php
3398
0644
edit
dl
rm
SystemDatabase.php
3748
0644
edit
dl
rm
Table.php
97961
0644
edit
dl
rm
TablePartitionDefinition.php
6664
0644
edit
dl
rm
Template.php
3962
0644
edit
dl
rm
Theme.php
8969
0644
edit
dl
rm
ThemeManager.php
9815
0644
edit
dl
rm
Tracker.php
30497
0644
edit
dl
rm
Tracking.php
38141
0644
edit
dl
rm
Transformations.php
16685
0644
edit
dl
rm
TwoFactor.php
6968
0644
edit
dl
rm
Types.php
25805
0644
edit
dl
rm
Url.php
8973
0644
edit
dl
rm
UserPassword.php
7284
0644
edit
dl
rm
UserPreferences.php
8657
0644
edit
dl
rm
Util.php
104768
0644
edit
dl
rm
Version.php
533
0644
edit
dl
rm
VersionInformation.php
7319
0644
edit
dl
rm
ZipExtension.php
11017
0644
edit
dl
rm
Edit:
/usr/share/phpmyadmin/libraries/classes/ThemeManager.php
(9815B)
<?php /** * phpMyAdmin theme manager */ declare(strict_types=1); namespace PhpMyAdmin; use const DIRECTORY_SEPARATOR; use const E_USER_ERROR; use const E_USER_WARNING; 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 function trim; /** * phpMyAdmin theme manager */ class ThemeManager { /** * ThemeManager instance * * @access private * @static * @var ThemeManager */ private static $instance; /** * @var string path to theme folder * @access protected */ private $themesPath = './themes/'; /** @var array 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 = ''; if (! $this->setThemesPath('./themes/')) { return; } $this->setThemePerServer($GLOBALS['cfg']['ThemePerServer']); $this->loadThemes(); $this->theme = new Theme(); $config_theme_exists = true; if (! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) { trigger_error( sprintf( __('Default theme %s not found!'), htmlspecialchars($GLOBALS['cfg']['ThemeDefault']) ), E_USER_ERROR ); $config_theme_exists = false; } else { $this->themeDefault = $GLOBALS['cfg']['ThemeDefault']; } // check if user have a theme cookie $cookie_theme = $this->getThemeCookie(); if ($cookie_theme && $this->setActiveTheme($cookie_theme)) { return; } if ($config_theme_exists) { // 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 path to folder containing the themes * * @param string $path path to themes folder * * @return bool success * * @access public */ public function setThemesPath($path): bool { if (! $this->checkThemeFolder($path)) { return false; } $this->themesPath = trim($path); return true; } /** * sets if there are different themes per server * * @param bool $per_server Whether to enable per server flag * * @access public */ public function setThemePerServer($per_server): void { $this->perServer = (bool) $per_server; } /** * Sets active theme * * @param string|null $theme theme name * * @return bool true on success * * @access public */ 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 * * @access public */ 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 * * @access public */ public function getThemeCookie() { global $PMA_Config; $name = $this->getThemeCookieName(); if ($PMA_Config->issetCookie($name)) { return $PMA_Config->getCookie($name); } return false; } /** * save theme in cookie * * @return true * * @access public */ public function setThemeCookie(): bool { $themeId = $this->theme !== null ? (string) $this->theme->id : ''; $GLOBALS['PMA_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['PMA_Config']->set('theme-update', $themeId); return true; } /** * Checks whether folder is valid for storing themes * * @param string $folder Folder name to test * * @access private */ private function checkThemeFolder($folder): bool { if (! is_dir($folder)) { trigger_error( sprintf( __('Theme path not found for theme %s!'), htmlspecialchars($folder) ), E_USER_ERROR ); return false; } return true; } /** * read all themes * * @access public */ public function loadThemes(): bool { $this->themes = []; $handleThemes = opendir($this->themesPath); if ($handleThemes === false) { trigger_error( 'phpMyAdmin-ERROR: cannot open themes folder: ' . $this->themesPath, E_USER_WARNING ); return false; } // check for themes directory while (($PMA_Theme = readdir($handleThemes)) !== false) { // Skip non dirs, . and .. if ($PMA_Theme === '.' || $PMA_Theme === '..' || ! @is_dir(ROOT_PATH . $this->themesPath . $PMA_Theme) ) { continue; } if (array_key_exists($PMA_Theme, $this->themes)) { continue; } $new_theme = Theme::load( $this->themesPath . $PMA_Theme, ROOT_PATH . $this->themesPath . $PMA_Theme . '/' ); if (! $new_theme) { continue; } $new_theme->setId($PMA_Theme); $this->themes[$PMA_Theme] = $new_theme; } closedir($handleThemes); ksort($this->themes); return true; } /** * checks if given theme name is a known theme * * @param string|null $theme name fo theme to check for * * @access public */ public function checkTheme(?string $theme): bool { return array_key_exists($theme ?? '', $this->themes); } /** * returns HTML selectbox * * @access public */ public function getHtmlSelectBox(): string { $select_box = ''; $select_box .= '<form name="setTheme" method="post"'; $select_box .= ' action="index.php?route=/set-theme" class="disableAjax">'; $select_box .= Url::getHiddenInputs(); $theme_preview_href = '<a href="' . Url::getFromRoute('/themes') . '" target="themes" class="themeselect">'; $select_box .= $theme_preview_href . __('Theme:') . '</a>' . "\n"; $select_box .= '<select name="set_theme" lang="en" dir="ltr"' . ' class="autosubmit">'; foreach ($this->themes as $each_theme_id => $each_theme) { $select_box .= '<option value="' . $each_theme_id . '"'; if ($this->activeTheme === $each_theme_id) { $select_box .= ' selected="selected"'; } $select_box .= '>' . htmlspecialchars($each_theme->getName()) . '</option>'; } $select_box .= '</select>'; $select_box .= '</form>'; return $select_box; } /** * Renders the previews for all themes * * @access public */ public function getPrintPreviews(): string { $retval = ''; foreach ($this->themes as $each_theme) { $retval .= $each_theme->getPrintPreview(); } return $retval; } 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' . DIRECTORY_SEPARATOR; } }
Save
cmd:
run