/usr/share/phpmyadmin/libraries/classes
NameSizeModeActions
Charsets/-0755rm
Command/-0755rm
Config/-0755rm
Controllers/-0755rm
Database/-0755rm
Dbal/-0755rm
Display/-0755rm
Engines/-0755rm
Exceptions/-0755rm
Export/-0755rm
Gis/-0755rm
Html/-0755rm
Import/-0755rm
Navigation/-0755rm
Plugins/-0755rm
Properties/-0755rm
Providers/-0755rm
Query/-0755rm
Server/-0755rm
Setup/-0755rm
Table/-0755rm
Twig/-0755rm
Utils/-0755rm
Advisor.php125170644editdlrm
Bookmark.php109440644editdlrm
BrowseForeigners.php110830644editdlrm
Charsets.php72670644editdlrm
CheckUserPrivileges.php122300644editdlrm
Config.php464560644editdlrm
Console.php34600644editdlrm
Core.php433440644editdlrm
CreateAddField.php179930644editdlrm
DatabaseInterface.php768020644editdlrm
DbTableExists.php32870644editdlrm
Encoding.php87150644editdlrm
Error.php143040644editdlrm
ErrorHandler.php175570644editdlrm
ErrorReport.php93640644editdlrm
Export.php473510644editdlrm
File.php217860644editdlrm
FileListing.php29230644editdlrm
Font.php57180644editdlrm
Footer.php107940644editdlrm
Git.php183810644editdlrm
Header.php219670644editdlrm
Import.php588400644editdlrm
Index.php154280644editdlrm
IndexColumn.php43310644editdlrm
InsertEdit.php1333090644editdlrm
InternalRelations.php177300644editdlrm
IpAllowDeny.php99970644editdlrm
Language.php45680644editdlrm
LanguageManager.php245320644editdlrm
Linter.php53740644editdlrm
ListAbstract.php18140644editdlrm
ListDatabase.php44020644editdlrm
Logging.php27810644editdlrm
Menu.php218120644editdlrm
Message.php195470644editdlrm
Mime.php9160644editdlrm
Normalization.php424750644editdlrm
OpenDocument.php86170644editdlrm
Operations.php387480644editdlrm
OutputBuffering.php40740644editdlrm
ParseAnalyze.php24290644editdlrm
Partition.php73400644editdlrm
Pdf.php44490644editdlrm
Plugins.php257830644editdlrm
Profiling.php23170644editdlrm
RecentFavoriteTable.php122970644editdlrm
Relation.php792470644editdlrm
RelationCleanup.php150510644editdlrm
Replication.php48430644editdlrm
ReplicationGui.php220380644editdlrm
ReplicationInfo.php49430644editdlrm
Response.php168640644editdlrm
Routing.php58450644editdlrm
Sanitize.php124180644editdlrm
SavedSearches.php122210644editdlrm
Scripts.php37260644editdlrm
Session.php81980644editdlrm
Sql.php682720644editdlrm
SqlQueryForm.php72860644editdlrm
StorageEngine.php128280644editdlrm
SubPartition.php33980644editdlrm
SystemDatabase.php37480644editdlrm
Table.php979610644editdlrm
TablePartitionDefinition.php66640644editdlrm
Template.php39620644editdlrm
Theme.php89690644editdlrm
ThemeManager.php98150644editdlrm
Tracker.php304970644editdlrm
Tracking.php381410644editdlrm
Transformations.php166850644editdlrm
TwoFactor.php69680644editdlrm
Types.php258050644editdlrm
Url.php89730644editdlrm
UserPassword.php72840644editdlrm
UserPreferences.php86570644editdlrm
Util.php1047680644editdlrm
Version.php5330644editdlrm
VersionInformation.php73190644editdlrm
ZipExtension.php110170644editdlrm
Edit: /usr/share/phpmyadmin/libraries/classes/ThemeManager.php (9815B)
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 .= '
'; $select_box .= $theme_preview_href . __('Theme:') . '' . "\n"; $select_box .= ''; $select_box .= '
'; 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; } }