From: Alexander Ebert Date: Wed, 2 Jan 2013 18:09:53 +0000 (+0100) Subject: Hide style chooser unless two or more styles are given X-Git-Tag: 2.0.0_Beta_1~606^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=100859d88f5804b2e6d42939fe25d4b6fa941fe0;p=GitHub%2FWoltLab%2FWCF.git Hide style chooser unless two or more styles are given Fixes #895 --- diff --git a/com.woltlab.wcf/template/headInclude.tpl b/com.woltlab.wcf/template/headInclude.tpl index e241e6119d..da33326f6f 100644 --- a/com.woltlab.wcf/template/headInclude.tpl +++ b/com.woltlab.wcf/template/headInclude.tpl @@ -101,7 +101,7 @@ new WCF.Effect.SmoothScroll(); new WCF.Effect.BalloonTooltip(); new WCF.Sitemap(); - new WCF.Style.Chooser(); + {if $__wcf->getStyleHandler()->countStyles() > 1}new WCF.Style.Chooser();{/if} WCF.Dropdown.init(); WCF.System.PageNavigation.init('.pageNavigation'); WCF.Date.Picker.init(); diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index 7863312002..ff1fd379e0 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -207,6 +207,23 @@ class Package extends DatabaseObject { } } + /** + * Returns true, if package identified by $package is already installed. + * + * @param string $package + * @return boolean + */ + public static function isAlreadyInstalled($package) { + $sql = "SELECT COUNT(*) AS count + FROM wcf".WCF_N."_package + WHERE package = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($package)); + $row = $statement->fetchArray(); + + return ($row['count'] ? true : false); + } + /** * Checks if a package name is valid. * diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index 74221c7b54..5a9a6befba 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -147,6 +147,15 @@ class StyleHandler extends SingletonFactory { } } + /** + * Returns number of available styles. + * + * @return integer + */ + public function countStyles() { + return count($this->getAvailableStyles()); + } + /** * Resets all stylesheets. */