Replaces count calls with semantically correct empty calls
authorMatthias Schmidt <gravatronics@live.com>
Fri, 2 Nov 2012 00:04:14 +0000 (01:04 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 2 Nov 2012 00:04:14 +0000 (01:04 +0100)
86 files changed:
wcfsetup/install.php
wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php
wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php
wcfsetup/install/files/lib/acp/form/LoginForm.class.php
wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php
wcfsetup/install/files/lib/acp/form/OptionForm.class.php
wcfsetup/install/files/lib/acp/form/PackageStartInstallForm.class.php
wcfsetup/install/files/lib/acp/form/PackageUpdateForm.class.php
wcfsetup/install/files/lib/acp/form/PackageUpdateSearchForm.class.php
wcfsetup/install/files/lib/acp/form/UpdateServerEditForm.class.php
wcfsetup/install/files/lib/acp/form/UserAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserEditForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php
wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php
wcfsetup/install/files/lib/acp/form/UsersMassProcessingForm.class.php
wcfsetup/install/files/lib/acp/page/PackageAutoUpdateListPage.class.php
wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php
wcfsetup/install/files/lib/acp/page/UserListPage.class.php
wcfsetup/install/files/lib/action/AbstractAction.class.php
wcfsetup/install/files/lib/action/ClipboardProxyAction.class.php
wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php
wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php
wcfsetup/install/files/lib/data/DatabaseObjectList.class.php
wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php
wcfsetup/install/files/lib/data/category/CategoryAction.class.php
wcfsetup/install/files/lib/data/language/LanguageAction.class.php
wcfsetup/install/files/lib/data/language/LanguageEditor.class.php
wcfsetup/install/files/lib/data/language/SetupLanguage.class.php
wcfsetup/install/files/lib/data/option/Option.class.php
wcfsetup/install/files/lib/data/package/Package.class.php
wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php
wcfsetup/install/files/lib/data/template/Template.class.php
wcfsetup/install/files/lib/data/user/UserAction.class.php
wcfsetup/install/files/lib/data/user/UserEditor.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php
wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php
wcfsetup/install/files/lib/data/user/group/UserGroupEditor.class.php
wcfsetup/install/files/lib/form/AbstractForm.class.php
wcfsetup/install/files/lib/page/AbstractPage.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/WCFSetup.class.php
wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php
wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php
wcfsetup/install/files/lib/system/cache/builder/PageMenuCacheBuilder.class.php
wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php
wcfsetup/install/files/lib/system/cache/source/MemcacheCacheSource.class.php
wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php
wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php
wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php
wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php
wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php
wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php
wcfsetup/install/files/lib/system/event/EventHandler.class.php
wcfsetup/install/files/lib/system/io/File.class.php
wcfsetup/install/files/lib/system/io/TarWriter.class.php
wcfsetup/install/files/lib/system/language/I18nHandler.class.php
wcfsetup/install/files/lib/system/language/LanguageFactory.class.php
wcfsetup/install/files/lib/system/language/LanguageServerProcessor.class.php
wcfsetup/install/files/lib/system/mail/Mail.class.php
wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php
wcfsetup/install/files/lib/system/menu/TreeMenu.class.php
wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php
wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php
wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php
wcfsetup/install/files/lib/system/package/ACPTemplatesFileHandler.class.php
wcfsetup/install/files/lib/system/package/FilesFileHandler.class.php
wcfsetup/install/files/lib/system/package/PackageArchive.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php
wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php
wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/session/SessionHandler.class.php
wcfsetup/install/files/lib/system/setup/Installer.class.php
wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php
wcfsetup/install/files/lib/util/XML.class.php

index 94a3d92bfd64d9d790c8abc46cdc628f9cc490ef..6d778d8984f35ed517b944e5be2541ee7070aac0 100644 (file)
@@ -760,7 +760,7 @@ if (!file_exists(TMP_DIR . 'install/files/lib/system/WCFSetup.class.php')) {
        // try to unzip all setup files into temp folder
        $tar = new Tar(SETUP_FILE);
        $contentList = $tar->getContentList();
-       if (!count($contentList)) {
+       if (empty($contentList)) {
                throw new SystemException("Can not unpack 'WCFSetup.tar.gz'. File is probably broken.");
        }
        
index ebbe6c98104cc8e0862fe0558a7dfdc13baeaf2e..1c33c9f6e3cc8a1b45729c8ae4df266c6a5f0f01 100755 (executable)
@@ -98,7 +98,7 @@ abstract class AbstractOptionListForm extends AbstractForm {
                
                $this->errorType = array_merge($this->optionHandler->validate(), $this->errorType);
                
-               if (count($this->errorType) > 0) {
+               if (!empty($this->errorType)) {
                        throw new UserInputException('options', $this->errorType);
                }
        }
@@ -109,7 +109,7 @@ abstract class AbstractOptionListForm extends AbstractForm {
        public function readData() {
                parent::readData();
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        $this->optionHandler->readData();
                }
        }
index dc11acedb2cadf74806c8ff89f2cc3e520886429..db972ab3dbf04abbe6ab362ad5d25fd5f87420ac 100755 (executable)
@@ -87,7 +87,7 @@ class CronjobEditForm extends CronjobAddForm {
        public function readData() {
                parent::readData();
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        $this->className = $this->cronjob->className;
                        $this->description = $this->cronjob->description;
                        $this->startMinute = $this->cronjob->startMinute;
index d2bcda310575846dc4dfea45836751a610e152a8..1a40dbcfdbc89705f6a0e50be73f36717c12bcad 100755 (executable)
@@ -154,7 +154,7 @@ class LoginForm extends AbstractForm {
                parent::readData();
                
                // get preferred username
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        if (isset($_COOKIE[COOKIE_PREFIX.'userID'])) {
                                $user = new User(intval($_COOKIE[COOKIE_PREFIX.'userID']));
                                if ($user->userID) $this->username = $user->username;
index 2166ff036d9a22a4f2537eb5dc777c1e9c931488..6269dce74f2e9e9de0ea59e14618edd9a701198b 100755 (executable)
@@ -91,7 +91,7 @@ class MasterPasswordForm extends ACPForm {
        public function readData() {
                parent::readData();
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        $this->url = WCF::getSession()->requestURI;
                }
        }
index e4f3775b307d291bbabec479cf375e7ab7be85c6..250fd8718d05046184ef37143259e3118768e1b8 100644 (file)
@@ -89,7 +89,7 @@ class OptionForm extends AbstractOptionListForm {
                // load option tree
                $this->optionTree = $this->optionHandler->getOptionTree($this->category->categoryName);
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        // not a valid top (level 1 or 2) category
                        if (!isset($this->optionTree[0])) {
                                throw new IllegalLinkException();
index 4878e8dd239f33283523a039a4379e6acbdcfe7b..2ba840d204478fe436247d5407844bf3e220965e 100755 (executable)
@@ -178,7 +178,7 @@ class PackageStartInstallForm extends ACPForm {
                
                // validate php requirements
                $errors = PackageInstallationDispatcher::validatePHPRequirements($this->archive->getPhpRequirements());
-               if (count($errors)) {
+               if (!empty($errors)) {
                        WCF::getTPL()->assign('phpRequirements', $errors);
                        throw new UserInputException($type, 'phpRequirements');
                }
index 78472cec62aa9b53a54f88e980da51631b3f6f18..5bdbcfeb2582e996267102716e508cd49fd75179 100755 (executable)
@@ -68,7 +68,7 @@ class PackageUpdateForm extends ACPForm {
        public function validate() {
                parent::validate();
                
-               if (!count($this->updates)) {
+               if (empty($this->updates)) {
                        throw new UserInputException('updates');
                }
                
@@ -77,7 +77,7 @@ class PackageUpdateForm extends ACPForm {
                try {
                        $this->packageUpdate->buildPackageInstallationStack();
                        $this->excludedPackages = $this->packageUpdate->getExcludedPackages();
-                       if (count($this->excludedPackages)) {
+                       if (!empty($this->excludedPackages)) {
                                throw new UserInputException('excludedPackages');
                        }
                }
index 705cca8425cc8142bd1d46a63d9534f50541019a..1b17dbcdb1bc34b03d06337b71f2c2ea8ec2d44b 100644 (file)
@@ -115,14 +115,18 @@ class PackageUpdateSearchForm extends ACPForm {
         */
        public function validate() {
                parent::validate();
-
+               
                // refresh package database
                PackageUpdateDispatcher::refreshPackageDatabase($this->packageUpdateServerIDs);
                
                // build conditions
                $conditions = new PreparedStatementConditionBuilder();
+               
                // update servers
-               if (count($this->packageUpdateServerIDs)) $conditions->add("packageUpdateServerID IN (?)", array($this->packageUpdateServerIDs));
+               if (!empty($this->packageUpdateServerIDs)) {
+                       $conditions->add("packageUpdateServerID IN (?)", array($this->packageUpdateServerIDs));
+               }
+               
                // name
                if (!empty($this->packageName)) {
                        $condition = "packageName LIKE ?";
@@ -207,7 +211,7 @@ class PackageUpdateSearchForm extends ACPForm {
                        $packages[$row['package']][$row['packageUpdateID']][] = $row['packageVersion'];
                }
                
-               foreach ($packages as $identifier => $packageUpdates) {
+               foreach ($packages as $packageUpdates) {
                        if (count($packageUpdates) > 1) {
                                foreach ($packageUpdates as $packageUpdateID => $versions) {
                                        usort($versions, array('wcf\data\package\Package', 'compareVersion'));
index 4619916d3bb3ee7be0b6bea1cb4de87834a1f1ae..8f901df853b8996817d9c61a614a4c12103b162b 100755 (executable)
@@ -72,7 +72,7 @@ class UpdateServerEditForm extends UpdateServerAddForm {
        public function readData() {
                parent::readData();
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        $this->serverURL = $this->updateServer->serverURL;
                        $this->loginUsername = $this->updateServer->loginUsername;
                        $this->loginPassword = $this->updateServer->loginPassword;
index 6eed598a2fa174219dc02ac31a3eaa1a91eeff0a..493ee71cea9e41b3f8f0354f098c4920f910b43a 100644 (file)
@@ -140,7 +140,7 @@ class UserAddForm extends UserOptionListForm {
                }
                
                // validate user groups
-               if (count($this->groupIDs) > 0) {
+               if (!empty($this->groupIDs)) {
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("groupID IN (?)", array($this->groupIDs));
                        $conditions->add("groupType NOT IN (?)", array(array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS)));
@@ -172,7 +172,7 @@ class UserAddForm extends UserOptionListForm {
                                unset($this->visibleLanguages[$key]);
                        }
                }
-               if (!count($this->visibleLanguages) && ($language = LanguageFactory::getInstance()->getLanguage($this->languageID)) && $language->hasContent) {
+               if (empty($this->visibleLanguages) && ($language = LanguageFactory::getInstance()->getLanguage($this->languageID)) && $language->hasContent) {
                        $this->visibleLanguages[] = $this->languageID;
                }
                
index 336ac3c23c3cd1b43582771e821954412a707339..3be8e48b42184f5bd097b685b3959e957e0d5fae 100755 (executable)
@@ -84,7 +84,7 @@ class UserEditForm extends UserAddForm {
         * @see wcf\page\IPage::readData()
         */
        public function readData() {
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        // get visible languages
                        $this->readVisibleLanguages();
                        
index 4bded886d64b4c348a7c90571941d9e24dd73b74..7788c4ab20475d0c689cd92ea632d18671327372 100755 (executable)
@@ -107,9 +107,9 @@ class UserGroupAddForm extends AbstractOptionListForm {
                        $this->errorType[$e->getField()] = $e->getType();
                }
                
-               if (count($this->errorType) > 0) {
+               if (!empty($this->errorType)) {
                        throw new UserInputException('groupName', $this->errorType);
-               }               
+               }
        }
        
        /**
@@ -171,7 +171,7 @@ class UserGroupAddForm extends AbstractOptionListForm {
                parent::readData();
                
                $this->optionTree = $this->optionHandler->getOptionTree();
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        $this->activeTabMenuItem = $this->optionTree[0]['object']->categoryName;
                }
        }
index b19ca92caa4a8e30b810f28ca653f2e3b90c556b..b9a15a31cbe43feedeb661756ab484451f8e56cb 100755 (executable)
@@ -66,7 +66,7 @@ class UserGroupEditForm extends UserGroupAddForm {
         * @see wcf\page\IPage::readData()
         */
        public function readData() {
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        I18nHandler::getInstance()->setOptions('groupName', 1, $this->group->groupName, 'wcf.acp.group.group\d+');
                        $this->groupName = $this->group->groupName;
                        $options = $this->optionHandler->getCategoryOptions();
@@ -99,8 +99,7 @@ class UserGroupEditForm extends UserGroupAddForm {
        public function assignVariables() {
                parent::assignVariables();
                
-               $useRequestData = (count($_POST)) ? true : false;
-               I18nHandler::getInstance()->assignVariables($useRequestData);
+               I18nHandler::getInstance()->assignVariables(!empty($_POST));
                
                WCF::getTPL()->assign(array(
                        'groupID' => $this->group->groupID,
index 01ea4ea3f26e7e3ea81bf95a412fd2c10129ff68..657f91503b1d00a900b6ddbe15d2c97e1c4f720b 100755 (executable)
@@ -235,7 +235,7 @@ class UserSearchForm extends UserOptionListForm {
                // do search
                $this->search();
                
-               if (count($this->matches) == 0) {
+               if (empty($this->matches)) {
                        throw new UserInputException('search', 'noMatches');
                }
        }
@@ -283,10 +283,10 @@ class UserSearchForm extends UserOptionListForm {
                if (!empty($this->email)) {
                        $this->conditions->add("user_table.email LIKE ?", array('%'.addcslashes($this->email, '_%').'%'));
                }
-               if (count($this->groupIDs)) {
+               if (!empty($this->groupIDs)) {
                        $this->conditions->add("user_table.userID ".($this->invertGroupIDs == 1 ? 'NOT ' : '')."IN (SELECT userID FROM wcf".WCF_N."_user_to_group WHERE groupID IN (?))", array($this->groupIDs));
                }
-               if (count($this->languageIDs)) {
+               if (!empty($this->languageIDs)) {
                        $this->conditions->add("user_table.languageID IN (?)", array($this->languageIDs));
                }
        }
index ef8332aa72d6e06bb5cae408ffe0f1ebbea55e9b..7dffb6a51813bf47ba9ae349152d79df0df5eb9c 100644 (file)
@@ -133,7 +133,7 @@ class UsersMassProcessingForm extends UserOptionListForm {
                
                // assign to group
                if ($this->action == 'assignToGroup') {
-                       if (!count($this->assignToGroupIDArray)) {
+                       if (empty($this->assignToGroupIDArray)) {
                                throw new UserInputException('assignToGroupIDArray');
                        }
                }
@@ -162,6 +162,7 @@ class UsersMassProcessingForm extends UserOptionListForm {
                
                // build conditions
                $this->conditions = new PreparedStatementConditionBuilder();
+               
                // static fields
                if (!empty($this->username)) {
                        $this->conditions->add("user.username LIKE ?", array('%'.addcslashes($this->username, '_%').'%'));
@@ -169,10 +170,10 @@ class UsersMassProcessingForm extends UserOptionListForm {
                if (!empty($this->email)) {
                        $this->conditions->add("user.email LIKE ?", array('%'.addcslashes($this->email, '_%').'%'));
                }
-               if (count($this->groupIDArray) > 0) {
+               if (!empty($this->groupIDArray)) {
                        $this->conditions->add("user.userID ".($this->invertGroupIDs == 1 ? 'NOT ' : '')."IN (SELECT userID FROM wcf".WCF_N."_user_to_group WHERE groupID IN (?))", array($this->groupIDArray));
                }
-               if (count($this->languageIDArray) > 0) {
+               if (!empty($this->languageIDArray)) {
                        $this->conditions->add("user.languageID IN (?)", array($this->languageIDArray));
                }
                
@@ -356,9 +357,13 @@ class UsersMassProcessingForm extends UserOptionListForm {
        public function readData() {
                parent::readData();
                
-               if (!count($_POST)) {
-                       if (MAIL_USE_FORMATTED_ADDRESS) $this->from = MAIL_FROM_NAME . ' <' . MAIL_FROM_ADDRESS . '>';
-                       else $this->from = MAIL_FROM_ADDRESS;
+               if (empty($_POST)) {
+                       if (MAIL_USE_FORMATTED_ADDRESS) {
+                               $this->from = MAIL_FROM_NAME.' <'.MAIL_FROM_ADDRESS.'>';
+                       }
+                       else {
+                               $this->from = MAIL_FROM_ADDRESS;
+                       }
                }
                
                $this->availableGroups = $this->getAvailableGroups();
index 6bb53234490b48cc1927503abde5e8678d68cc30..d49bf0b5401b63caa9f522ad15372a6e58fefef0 100755 (executable)
@@ -34,7 +34,7 @@ class PackageAutoUpdateListPage extends AbstractPage {
        public function readParameters() {
                parent::readParameters();
                
-               if (!count($_POST)) {
+               if (empty($_POST)) {
                        // refresh package database
                        PackageUpdateDispatcher::refreshPackageDatabase();
                }
index 9f4de1b4daf33a59cd748b020d17b5c0fdbb46ea..8aa42d121e42347c95a7cfcf9349b9ced383d5c9 100755 (executable)
@@ -141,7 +141,7 @@ class PackageUpdateSearchResultPage extends SortablePage {
                                        $row['packageVersions'][] = $row2['packageVersion'];
                                }
                                
-                               if (count($row['packageVersions'])) {
+                               if (!empty($row['packageVersions'])) {
                                        // remove duplicates
                                        $row['packageVersions'] = array_unique($row['packageVersions']);
                                        // sort versions
@@ -149,7 +149,7 @@ class PackageUpdateSearchResultPage extends SortablePage {
                                        // take lastest version
                                        $row['packageVersion'] = end($row['packageVersions']);
                                }
-                                       
+                               
                                // get installed instances
                                $sql = "SELECT  package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
                                        FROM    wcf".WCF_N."_package package
index e63c76d793f07ecdba7fbe71808afc5e95d64fe3..6e22413245703210ad794b981b9a80f63d7f2ebc 100755 (executable)
@@ -77,7 +77,7 @@ class UserListPage extends SortablePage {
                if (!empty($_REQUEST['id'])) {
                        $this->searchID = intval($_REQUEST['id']);
                        if ($this->searchID) $this->readSearchResult();
-                       if (!count($this->userIDs)) {
+                       if (empty($this->userIDs)) {
                                throw new IllegalLinkException();
                        }
                        $this->conditions->add("user_table.userID IN (?)", array($this->userIDs));
@@ -177,7 +177,7 @@ class UserListPage extends SortablePage {
                }
                
                // get user data
-               if (count($userIDs)) {
+               if (!empty($userIDs)) {
                        $userToGroups = array();
                        
                        // get group ids
index 16b6c495c4020f2e7df4c86ea2c5d58798eb9454..a2db84beda8e15fe29322e6b5864f1af54c65d61 100644 (file)
@@ -67,14 +67,14 @@ abstract class AbstractAction implements IAction {
                }
                
                // check modules
-               if (count($this->neededModules)) {
+               if (!empty($this->neededModules)) {
                        foreach ($this->neededModules as $module) {
                                if (!defined($module) || !constant($module)) throw new IllegalLinkException();
                        }
                }
                
                // check permission
-               if (count($this->neededPermissions)) {
+               if (!empty($this->neededPermissions)) {
                        WCF::getSession()->checkPermissions($this->neededPermissions);
                }
                
index 189aa71452f7559a383600b54dc00c79c4a7d786..bfbf91821c3902164d785bbad473f3ac15d719bf 100644 (file)
@@ -99,7 +99,7 @@ class ClipboardProxyAction extends AbstractSecureAction {
                }
                
                $objects = ClipboardHandler::getInstance()->getMarkedItems($typeID);
-               if (!count($objects) || !isset($objects[$this->typeName]) || !count($objects[$this->typeName])) {
+               if (empty($objects) || !isset($objects[$this->typeName]) || empty($objects[$this->typeName])) {
                        return null;
                }
                
index 298ecf0d9bb0e38442d5023e51c0a6d78535b44f..ad198d4b03dcdf5ce0f00fed9290d5e8fcc24f6a 100644 (file)
@@ -218,7 +218,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         */
        public function validateCreate() {
                // validate permissions
-               if (is_array($this->permissionsCreate) && count($this->permissionsCreate)) {
+               if (is_array($this->permissionsCreate) && !empty($this->permissionsCreate)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsCreate);
                        }
@@ -236,7 +236,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         */
        public function validateDelete() {
                // validate permissions
-               if (is_array($this->permissionsDelete) && count($this->permissionsDelete)) {
+               if (is_array($this->permissionsDelete) && !empty($this->permissionsDelete)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsDelete);
                        }
@@ -249,12 +249,12 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
                }
                
                // read objects
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
-               }
-               
-               if (!count($this->objects)) {
-                       throw new ValidateActionException('Invalid object id');
+                       
+                       if (empty($this->objects)) {
+                               throw new ValidateActionException('Invalid object id');
+                       }
                }
        }
        
@@ -263,7 +263,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         */
        public function validateUpdate() {
                // validate permissions
-               if (is_array($this->permissionsUpdate) && count($this->permissionsUpdate)) {
+               if (is_array($this->permissionsUpdate) && !empty($this->permissionsUpdate)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsUpdate);
                        }
@@ -276,12 +276,12 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
                }
                
                // read objects
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
-               }
-               
-               if (!count($this->objects)) {
-                       throw new ValidateActionException('Invalid object id');
+
+                       if (empty($this->objects)) {
+                               throw new ValidateActionException('Invalid object id');
+                       }
                }
        }
        
@@ -298,7 +298,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         * @see wcf\data\IDeleteAction::delete()
         */
        public function delete() {
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
                }
                
@@ -319,7 +319,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         * Updates data.
         */
        public function update() {
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
                }
                
@@ -334,7 +334,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         * Reads data by data id.
         */
        protected function readObjects() {
-               if (!count($this->objectIDs)) {
+               if (empty($this->objectIDs)) {
                        return;
                }
                
index 51c8cbcbd939e12a117d66ae6e15276044e1e383..e0a0c9fc435c7bf5d863f3841fed36ed8db7e0f1 100644 (file)
@@ -51,7 +51,7 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I
         * @see wcf\data\IEditableObject::update()
         */
        public function update(array $parameters = array()) {
-               if (!count($parameters)) return;
+               if (empty($parameters)) return;
                
                // check whether any value changed or not
                $update = false;
@@ -85,7 +85,7 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I
         * @see wcf\data\IEditableObject::updateCounters()
         */
        public function updateCounters(array $counters = array()) {
-               if (!count($counters)) return;
+               if (empty($counters)) return;
                
                $updateSQL = '';
                $statementParameters = array();
index 5fe958f85003c8e6a5eeb869d1f40ade35862526..9d8b8e102b73a8d8486c294c9fc7c70ff1d4af3e 100644 (file)
@@ -154,7 +154,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject {
         */
        public function readObjects() {
                if ($this->objectIDs !== null) {
-                       if (!count($this->objectIDs)) {
+                       if (empty($this->objectIDs)) {
                                return;
                        }
                        $sql = "SELECT  ".(!empty($this->sqlSelects) ? $this->sqlSelects.($this->useQualifiedShorthand ? ',' : '') : '')."
index d42b0450eca380afd9b6dcb36dbbf837ed462023..60614836814961c533e27cce10fb33ef2a8fbd98 100644 (file)
@@ -55,7 +55,9 @@ class ACPSessionEditor extends DatabaseObjectEditor {
         */
        public static function deleteUserSessions(array $userIDs = array()) {
                $conditionBuilder = new PreparedStatementConditionBuilder();
-               if (count($userIDs)) $conditionBuilder->add('userID IN (?)', array($userIDs));
+               if (!empty($userIDs)) {
+                       $conditionBuilder->add('userID IN (?)', array($userIDs));
+               }
                
                $sql = "DELETE FROM     ".call_user_func(array(static::$baseClass, 'getDatabaseTableName'))."
                        ".$conditionBuilder;
index 8fe18a12662118aa2645886770b3974c397a4ebd..f415d68302dc8a95f3eb7064fa69f523dc085572 100644 (file)
@@ -101,7 +101,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
         */
        public function validateCreate() {
                // validate permissions
-               if (count($this->permissionsCreate)) {
+               if (!empty($this->permissionsCreate)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsCreate);
                        }
@@ -128,7 +128,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
         */
        public function validateDelete() {
                // validate permissions
-               if (count($this->permissionsDelete)) {
+               if (!empty($this->permissionsDelete)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsDelete);
                        }
@@ -138,12 +138,12 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
                }
                
                // read objects
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
-               }
-               
-               if (!count($this->objects)) {
-                       throw new ValidateActionException('Invalid object id');
+                       
+                       if (empty($this->objects)) {
+                               throw new ValidateActionException('Invalid object id');
+                       }
                }
                
                foreach ($this->objects as $categoryEditor) {
@@ -172,7 +172,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
         */
        public function validateUpdate() {
                // validate permissions
-               if (count($this->permissionsUpdate)) {
+               if (!empty($this->permissionsUpdate)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsUpdate);
                        }
@@ -182,11 +182,11 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
                }
                
                // read objects
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
                }
                
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        throw new ValidateActionException('Invalid object id');
                }
                
@@ -202,7 +202,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibl
         */
        public function validateUpdatePosition() {
                // validate permissions
-               if (count($this->permissionsUpdate)) {
+               if (!empty($this->permissionsUpdate)) {
                        try {
                                WCF::getSession()->checkPermissions($this->permissionsUpdate);
                        }
index f5bea5a2f46d8a6da1be33560d8b8527024315c6..16cea5684393447c748d2ffabc65d3f8462a1079 100644 (file)
@@ -47,11 +47,13 @@ class LanguageAction extends AbstractDatabaseObjectAction {
                        throw new ValidateActionException('Insufficient permissions');
                }
                
-               // read data
-               $this->readObjects();
-               
-               if (!count($this->objects)) {
-                       throw new ValidateActionException('Invalid object id');
+               // read objects
+               if (empty($this->objects)) {
+                       $this->readObjects();
+                       
+                       if (empty($this->objects)) {
+                               throw new ValidateActionException('Invalid object id');
+                       }
                }
        }
        
index 74cbe3c1554e08b2418b661ba425845499777493..fe250c460fbad22cfb79782ebe4a5a1675b14646 100644 (file)
@@ -50,7 +50,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
         * @param       array           $packageIDs
         */
        public function updateCategory(array $categoryIDs = array(), array $packageIDs = array()) {
-               if (!count($categoryIDs)) {
+               if (empty($categoryIDs)) {
                        // get all categories
                        $sql = "SELECT  languageCategoryID
                                FROM    wcf".WCF_N."_language_category";
@@ -159,7 +159,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                
                // get items
                $items = array();
-               if (count($packageIDArray)) {
+               if (!empty($packageIDArray)) {
                        // sql conditions
                        $conditions->add("language_item.packageID IN (?)", array($packageIDArray));
                        $conditions->add("language_item.languageID = ?", array($this->languageID));
@@ -231,7 +231,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                        $usedCategories[$category->getAttribute('name')] = 0;
                }
                
-               if (!count($usedCategories)) return;
+               if (empty($usedCategories)) return;
                
                // select existing categories
                $conditions = new PreparedStatementConditionBuilder();
@@ -276,7 +276,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                        }
                }
                
-               if (count($items)) {
+               if (!empty($items)) {
                        $existingItems = $statementParameters = array();
                        
                        // find existing items
@@ -307,7 +307,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                                }
                        }
                        
-                       if (count($statementParameters)) {
+                       if (!empty($statementParameters)) {
                                if ($packageID) {
                                        $sql = "INSERT INTO     wcf".WCF_N."_language_item
                                                                (languageID, languageItem, languageItemValue, languageCategoryID, packageID)
@@ -498,7 +498,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
         * @param       array           $useCustom
         */
        public function updateItems(array $items, LanguageCategory $category, $packageID = PACKAGE_ID, array $useCustom = array()) {
-               if (!count($items)) return;
+               if (empty($items)) return;
                
                // find existing language items
                $languageItemList = new LanguageItemList();
@@ -522,7 +522,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                }
                
                // create remaining items
-               if (count($items)) {
+               if (!empty($items)) {
                        // bypass LanguageItemEditor::create() for performance reasons
                        $sql = "INSERT INTO     wcf".WCF_N."_language_item
                                (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
@@ -659,7 +659,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                }
                
                // save updates
-               if (count($updatedItems) > 0) {
+               if (!empty($updatedItems)) {
                        foreach ($updatedItems as $languageID => $categories) {
                                $language = new LanguageEditor($languageID);
                                
@@ -689,7 +689,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array(0));
                
-               if (count($languageIDs)) {
+               if (!empty($languageIDs)) {
                        $sql = '';
                        $statementParameters = array();
                        foreach ($languageIDs as $languageID) {
index 6b02192d9a4bdd83cdc7ddaaccdae2032d59073b..3b67bc672cd8610493e1b110372185f8f1d6f3e4 100644 (file)
@@ -56,7 +56,7 @@ class SetupLanguage extends Language {
                        }
                        
                        // update language files here
-                       if (count($categoriesToCache) > 0) {
+                       if (!empty($categoriesToCache)) {
                                $file = new File($filename);
                                $file->write("<?php\n/**\n* WoltLab Community Framework\n* language: ".$this->languageCode."\n* encoding: UTF-8\n* category: WCF Setup\n* generated at ".gmdate("r")."\n* \n* DO NOT EDIT THIS FILE\n*/\n");
                                foreach ($categoriesToCache as $name) {
index 94c594e0b2f0d1f98a9c6f3ff8f9f385e1a4d52c..367b46a1b8b72edad21b18e0e19a74d675edcd8e 100644 (file)
@@ -69,7 +69,7 @@ class Option extends DatabaseObject {
                }
                
                $options = array();
-               if (count($optionIDs)) {
+               if (!empty($optionIDs)) {
                        // get needed options
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("optionID IN (?)", array($optionIDs));
index 19f8cba493764645bcfaefbe4fc843a276338940..1403e8f1f6e73d070e60a0ba40575754c381f483 100644 (file)
@@ -315,7 +315,7 @@ class Package extends DatabaseObject {
                }
                
                // insert requirements of requirements
-               if (count($requirements) > 0) {
+               if (!empty($requirements)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_requirement_map
                                                (packageID, requirement, level)
                                VALUES          (?, ?, ?)";
@@ -329,7 +329,9 @@ class Package extends DatabaseObject {
                $directRequirements = array();
                $conditions = new PreparedStatementConditionBuilder($sql);
                $conditions->add("packageID = ?", array($packageID));
-               if (count($requirements)) $conditions->add("requirement NOT IN (?)", array(array_keys($requirements)));
+               if (!empty($requirements)) {
+                       $conditions->add("requirement NOT IN (?)", array(array_keys($requirements)));
+               }
                
                $sql = "SELECT  requirement, 
                                (
@@ -347,7 +349,7 @@ class Package extends DatabaseObject {
                }
                
                // insert requirements
-               if (count($directRequirements) > 0) {
+               if (!empty($directRequirements)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_requirement_map
                                                (packageID, requirement, level)
                                VALUES          (?, ?, ?)";
index 5c02492c6596980ab642344cf8a6fb53d6919766..7cfdb89d141c019f3cfb0c5c53d1b3380a6d900a 100644 (file)
@@ -34,7 +34,7 @@ class PackageUpdateServer extends DatabaseObject {
                $list = new PackageUpdateServerList();
                $list->sqlLimit = 0;
                $list->getConditionBuilder()->add("disabled = ?", array(0));
-               if (count($packageUpdateServerIDs)) {
+               if (!empty($packageUpdateServerIDs)) {
                        $list->getConditionBuilder()->add("packageUpdateServerID IN (?)", array($packageUpdateServerIDs));
                }
                $list->readObjects();
index 0a2aec35d067110927ece9f5200302e5ee3e88a0..ef486ac44e528369ad309b9b1070434f57c2645e 100644 (file)
@@ -104,7 +104,7 @@ class Template extends DatabaseObject {
                }
                
                // get templates
-               if (!count($availableTemplateIDs)) return $results;
+               if (empty($availableTemplateIDs)) return $results;
                
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add("template.templateID IN (?)", array($availableTemplateIDs));
index c17bfeb7a3ea67a49204a0585b11ce7a5c124657..ffcb44d5ecf1fba145c6dbb3099f0987543de516 100644 (file)
@@ -98,12 +98,12 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
         */
        public function validateUpdate() {
                // read objects
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
-               }
-               
-               if (!count($this->objects)) {
-                       throw new ValidateActionException('Invalid object id');
+                       
+                       if (empty($this->objects)) {
+                               throw new ValidateActionException('Invalid object id');
+                       }
                }
                
                try {
@@ -168,7 +168,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
                        }
                }
                else {
-                       if (!count($this->objects)) {
+                       if (empty($this->objects)) {
                                $this->readObjects();
                        }
                }
@@ -244,7 +244,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
                
                $conditionBuilder = new PreparedStatementConditionBuilder();
                $conditionBuilder->add("username LIKE ?", array($searchString.'%'));
-               if (count($excludedSearchValues)) {
+               if (!empty($excludedSearchValues)) {
                        $conditionBuilder->add("username NOT IN (?)", array($excludedSearchValues));
                }
                
index 53240e19378dba8ce8a3e2dd00ae35ee56099562..543ecedf016b0e375014860628191e5ac05f7ea2 100644 (file)
@@ -159,7 +159,7 @@ class UserEditor extends DatabaseObjectEditor implements IEditableCachedObject {
                }
                
                // insert new groups
-               if (count($groupIDs) > 0) {
+               if (!empty($groupIDs)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_user_to_group
                                                (userID, groupID)
                                VALUES          (?, ?)";
index 522a5ef8ff799cca21136ffd90267f526aab379e..c44e861665f36e0f4ff7875a8338c8de7cdfca03 100644 (file)
@@ -100,7 +100,7 @@ class UserGroup extends DatabaseObject {
                self::getCache();
                
                // get all groups
-               if (!count($types)) return self::$cache['groups'];
+               if (empty($types)) return self::$cache['groups'];
                
                // get groups by type
                $groupIDs = self::getGroupIDsByType($types);
@@ -170,7 +170,7 @@ class UserGroup extends DatabaseObject {
                        self::$accessibleGroups = explode(',', WCF::getSession()->getPermission('admin.user.accessibleGroups'));
                }
                
-               if (count($groupIDs) == 0) return false;
+               if (empty($groupIDs)) return false;
                
                foreach ($groupIDs as $groupID) {
                        if (!in_array($groupID, self::$accessibleGroups)) {
@@ -191,7 +191,7 @@ class UserGroup extends DatabaseObject {
        public static function getAccessibleGroups(array $groupTypes = array(), array $invalidGroupTypes = array()) {
                $groups = self::getGroupsByType($groupTypes);
                
-               if (count($invalidGroupTypes) > 0) {
+               if (!empty($invalidGroupTypes)) {
                        $invalidGroups = self::getGroupsByType($invalidGroupTypes);
                        foreach ($invalidGroups as $groupID => $group) {
                                unset($groups[$groupID]);
@@ -322,7 +322,7 @@ class UserGroup extends DatabaseObject {
                                $groupOptionIDs[$row['optionName']] = $row['optionID'];
                        }
                        
-                       if (count($groupOptionIDs)) {
+                       if (!empty($groupOptionIDs)) {
                                $conditions = new PreparedStatementConditionBuilder();
                                $conditions->add("option_value.groupID = ?", array($this->groupID));
                                $conditions->add("option_value.optionID IN (?)", array($groupOptionIDs));
index 482913cc53686c4aba6b5a4ec969936e6b4dabd2..9974f6c494daa0e4aebdd4816762dbe86233d315 100644 (file)
@@ -49,7 +49,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction {
         * @see wcf\data\AbstractDatabaseObjectAction::update()
         */
        public function update() {
-               if (!count($this->objects)) {
+               if (empty($this->objects)) {
                        $this->readObjects();
                }
                
index 2470f0ce9e24d777b2c884019cc6035d362a6706..7ec120eac11a16777da9b33993a22ce75240d1f7 100644 (file)
@@ -60,7 +60,7 @@ class UserGroupEditor extends DatabaseObjectEditor implements IEditableCachedObj
         * @param       array           $groupIDs
         */
        protected static function removeGroupAssignments(array $groupIDs) {
-               if (!count($groupIDs)) return;
+               if (empty($groupIDs)) return;
                
                $sql = "DELETE FROM     wcf".WCF_N."_user_to_group
                        WHERE           groupID = ?";
@@ -76,7 +76,7 @@ class UserGroupEditor extends DatabaseObjectEditor implements IEditableCachedObj
         * @param       array           $groupIDs
         */
        protected static function removeOptionValues(array $groupIDs) {
-               if (!count($groupIDs)) return;
+               if (empty($groupIDs)) return;
                
                $sql = "DELETE FROM     wcf".WCF_N."_user_group_option_value
                        WHERE           groupID = ?";
@@ -162,7 +162,7 @@ class UserGroupEditor extends DatabaseObjectEditor implements IEditableCachedObj
                $optionID = $row['optionID'];
                
                // update optionValue from groups which got all existing groups as value
-               if (count($updateGroupIDs)) {
+               if (!empty($updateGroupIDs)) {
                        $conditionBuilder = new PreparedStatementConditionBuilder();
                        $conditionBuilder->add('groupID IN (?)', array($updateGroupIDs));
                        $conditionBuilder->add('optionID = ?', array($optionID));
index 6e75ca42938ad5f107e0fbaac59c6b3fa55c97b0..1c88c38213ddf921594acade79c08d47cc220f11 100644 (file)
@@ -100,7 +100,7 @@ abstract class AbstractForm extends AbstractPage implements IForm {
         * @see wcf\page\IPage::readData()
         */
        public function readData() {
-               if (count($_POST) || count($_FILES)) {
+               if (!empty($_POST) || !empty($_FILES)) {
                        $this->submit();
                }
                
index 8c5b4145e67e582927894da9dedd42dedabe9f40..b07e3fb86d2e7dcdde3eb73055af1824dc5e7d3e 100644 (file)
@@ -114,11 +114,9 @@ abstract class AbstractPage implements IPage, ITrackablePage {
                EventHandler::getInstance()->fireAction($this, 'checkModules');
                
                // check modules
-               if (count($this->neededModules)) {
-                       foreach ($this->neededModules as $module) {
-                               if (!defined($module) || !constant($module)) {
-                                       throw new IllegalLinkException();
-                               }
+               foreach ($this->neededModules as $module) {
+                       if (!defined($module) || !constant($module)) {
+                               throw new IllegalLinkException();
                        }
                }
        }
index 66fa36581fa16fa6a525f28187a1682c47772e4b..f254ecd5479c78c22a50b9b371d9f04ed6e28811 100644 (file)
@@ -154,19 +154,19 @@ class WCF {
        protected function initMagicQuotes() {
                if (function_exists('get_magic_quotes_gpc')) {
                        if (@get_magic_quotes_gpc()) {
-                               if (count($_REQUEST)) {
+                               if (!empty($_REQUEST)) {
                                        $_REQUEST = util\ArrayUtil::stripslashes($_REQUEST);
                                }
-                               if (count($_POST)) {
+                               if (!empty($_POST)) {
                                        $_POST = util\ArrayUtil::stripslashes($_POST);
                                }
-                               if (count($_GET)) {
+                               if (!empty($_GET)) {
                                        $_GET = util\ArrayUtil::stripslashes($_GET);
                                }
-                               if (count($_COOKIE)) {
+                               if (!empty($_COOKIE)) {
                                        $_COOKIE = util\ArrayUtil::stripslashes($_COOKIE);
                                }
-                               if (count($_FILES)) {
+                               if (!empty($_FILES)) {
                                        foreach ($_FILES as $name => $attributes) {
                                                foreach ($attributes as $key => $value) {
                                                        if ($key != 'tmp_name') {
index e027ba09e0f49c37d8b7ca15ee3763fa5fda0b6a..ee8f057392b1792bcdaeba4de4b6dfdb182111e5 100644 (file)
@@ -373,7 +373,7 @@ class WCFSetup extends WCF {
                
                // sql
                $system['sql']['value'] = array_keys(self::getAvailableDBClasses());
-               $system['sql']['result'] = count($system['sql']['value']) > 0;
+               $system['sql']['result'] = !empty($system['sql']['value']);
                
                // upload_max_filesize
                $system['uploadMaxFilesize']['value'] = ini_get('upload_max_filesize');
@@ -493,7 +493,7 @@ class WCFSetup extends WCF {
                if (isset($_POST['send'])) {
                        try {
                                // no languages selected
-                               if (count(self::$selectedLanguages) == 0) {
+                               if (empty(self::$selectedLanguages)) {
                                        throw new UserInputException('selectedLanguages');
                                }
                                
@@ -696,7 +696,7 @@ class WCFSetup extends WCF {
                // log sql queries
                preg_match_all("~CREATE\s+TABLE\s+(\w+)~i", $sql, $matches);
                
-               if (count($matches[1])) {
+               if (!empty($matches[1])) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_installation_sql_log
                                                (sqlTable)
                                VALUES          (?)";
@@ -829,7 +829,7 @@ class WCFSetup extends WCF {
                        $languages[] = $row['languageID'];
                }
                
-               if (count($languages) > 0) {
+               if (!empty($languages)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_language_to_package
                                                (languageID)
                                VALUES          (?)";
index 6fe33e3757b7b6927a630ea5f0e25d219fd5adf5..08477cdf64abeb141774b3589335d22c84cb9445 100644 (file)
@@ -38,7 +38,7 @@ class ACPMenuCacheBuilder implements ICacheBuilder {
                        $itemIDs[$row['menuItem']] = $row['menuItemID'];
                }
                
-               if (count($itemIDs) > 0) {
+               if (!empty($itemIDs)) {
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("menuItemID IN (?)", array($itemIDs));
                        
@@ -63,7 +63,7 @@ class ACPMenuCacheBuilder implements ICacheBuilder {
                
                // get top option categories
                $optionCategories = $this->getTopOptionCategories($packageID);
-               if (count($optionCategories) > 0) {
+               if (!empty($optionCategories)) {
                        if (!isset($data['wcf.acp.menu.link.option.category'])) {
                                $data['wcf.acp.menu.link.option.category'] = array();
                        }
index caec5d048260d0619dbb9bab1ad08830a9126e4b..cf76d1852cf50a734dbc0a743be3e18cc1388807 100644 (file)
@@ -60,7 +60,7 @@ class OptionCacheBuilder implements ICacheBuilder {
                        $optionCategories[$row['categoryName']] = $row['categoryID'];
                }
                
-               if (count($optionCategories) > 0) {
+               if (!empty($optionCategories) > 0) {
                        // get needed option categories
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("categoryID IN (?)", array($optionCategories));
@@ -98,7 +98,7 @@ class OptionCacheBuilder implements ICacheBuilder {
                        $optionIDs[$row['optionName']] = $row['optionID'];
                }
                
-               if (count($optionIDs) > 0) {
+               if (!empty($optionIDs)) {
                        // get option class from type
                        $className = 'wcf\data\option\Option';
                        if (!empty($type)) {
index 21cc619781a04b61db111cc9e4fc5f51af86097b..ae1936c3a15c1a359545397c5d8789ee3e436102 100644 (file)
@@ -36,7 +36,7 @@ class PageMenuCacheBuilder implements ICacheBuilder {
                        $itemIDs[$row['menuItem']] = $row['menuItemID'];
                }
                
-               if (count($itemIDs) > 0) {
+               if (!empty($itemIDs)) {
                        // get needed menu items and build item tree
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("menu_item.menuItemID IN (?)", array($itemIDs));
index 55291229a4e9f95cbf233f2e010de283173dd30c..ac6d4db0e502723c9347c88046b4bedd9299e415 100644 (file)
@@ -55,7 +55,7 @@ class UserGroupPermissionCacheBuilder implements ICacheBuilder {
                        $options[$row['optionName']] = $row['optionID'];
                }
                
-               if (count($options) > 0) {
+               if (!empty($options)) {
                        // get needed options
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs)));
index 3c60ecc3963e82a5fea1d45b8da35b2248b9feb2..77dd2f0a303923871ff8b01740d430de1a4c63b4 100644 (file)
@@ -75,7 +75,7 @@ class MemcacheCacheSource implements ICacheSource {
         * Saves modifications of the cache log.
         */
        protected function updateLog() {
-               if (count($this->newLogEntries)) {
+               if (!empty($this->newLogEntries)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_cache_resource
                                WHERE           cacheResource = ?";
                        $statement = WCF::getDB()->prepareStatement($sql);
@@ -92,7 +92,8 @@ class MemcacheCacheSource implements ICacheSource {
                        }
                        
                }
-               if (count($this->obsoleteLogEntries)) {
+               
+               if (!empty($this->obsoleteLogEntries)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_cache_resource
                                WHERE           cacheResource = ?";
                        $statement = WCF::getDB()->prepareStatement($sql);
index 1e5a88a6c63e2ff4530b55ed93c7799f331589fe..9177758a3fbe18b9897b88b7462367003c67aea0 100644 (file)
@@ -87,7 +87,7 @@ class CleanupHandler {
                                $objectIDs[] = $row['objectID'];
                        }
                        
-                       if (count($objectIDs)) {
+                       if (!empty($objectIDs)) {
                                $this->executeAdapters($adapters, $objectIDs);
                        }
                }
index 1f93e17ed288498e7160b58d28060012835fe217..8f9e7499b4ad5645801e33f0804038090a5d80d5 100644 (file)
@@ -227,7 +227,7 @@ class ClipboardHandler extends SingletonFactory {
                
                // get objects
                $this->loadMarkedItems();
-               if (!count($this->markedItems)) return null;
+               if (empty($this->markedItems)) return null;
                
                // fetch action ids
                $this->loadActionCache();
index a99734a75ff84c4a98c87ceb0196549b9ec3f6bc..1057060b851ea75c91800ce8c1e9d31935ac15da 100644 (file)
@@ -40,7 +40,7 @@ class UserClipboardAction implements IClipboardAction {
                        
                        case 'delete':
                                $userIDs = $this->validateDelete($objects);
-                               if (!count($userIDs)) {
+                               if (empty($userIDs)) {
                                        return null;
                                }
                                
@@ -98,7 +98,7 @@ class UserClipboardAction implements IClipboardAction {
                }
                
                // no valid users found
-               if (!count($userIDs)) return array();
+               if (empty($userIDs)) return array();
                
                // fetch user to group associations
                $conditions = new PreparedStatementConditionBuilder();
index 464fbd364f05230f75679df888d838f406544c48..59523acb653f8d22d021e5d23fe7689b176d823c 100644 (file)
@@ -31,9 +31,9 @@ class RefreshSearchRobotsCronjob implements ICronjob {
                $xpath = $xml->xpath();
                
                // fetch spiders
-               $spiders = $xpath->query('/spiderlist/spider');         
+               $spiders = $xpath->query('/spiderlist/spider');
                
-               if (count($spiders)) {
+               if (!empty($spiders)) {
                        // delete old entries
                        $sql = "DELETE FROM wcf".WCF_N."_spider";
                        $statement = WCF::getDB()->prepareStatement($sql);
index 38f7f647de6e8cf8bdc855d9c4baeabc80a43375..d84959fb37973eb4b434ebfb38f735ebcdce089b 100644 (file)
@@ -88,7 +88,7 @@ class PreparedStatement {
                try {
                        if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start($this->query, Benchmark::TYPE_SQL_QUERY);
                        
-                       if (!count($parameters)) $this->pdoStatement->execute();
+                       if (empty($parameters)) $this->pdoStatement->execute();
                        else $this->pdoStatement->execute($parameters);
                        
                        if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
@@ -113,7 +113,7 @@ class PreparedStatement {
                try {
                        if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start($this->query, Benchmark::TYPE_SQL_QUERY);
                        
-                       if (!count($parameters)) $this->pdoStatement->execute();
+                       if (empty($parameters)) $this->pdoStatement->execute();
                        else $this->pdoStatement->execute($parameters);
                        
                        if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
index b3b79c3dc702414ae3b4359bdbd82ec794075ae6..13a38352b59b739325c693ffb05ee600abbc6455 100644 (file)
@@ -32,9 +32,9 @@ class PreparedStatementConditionBuilder extends ConditionBuilder {
                                if (!array_key_exists($count, $parameters)) {
                                        throw new SystemException("missing parameter for token number " . ($count + 1) . " in condition '".$condition."'");
                                }
-
+                               
                                $result = '?';
-                               if (is_array($parameters[$count]) && count($parameters[$count])) {
+                               if (is_array($parameters[$count]) && !empty($parameters[$count])) {
                                        $result .= str_repeat(',?', count($parameters[$count]) - 1);
                                }
                                
index ba5732a701b1be1edae851162dce5391d7d9619d..f699ea3c136613961df816d3be2b9ea81b1319ca 100644 (file)
@@ -99,7 +99,7 @@ class EventHandler extends SingletonFactory {
                        foreach ($familyTree as $member) {
                                if (isset($this->inheritedActions[$member])) {
                                        $actions = $this->inheritedActions[$member];
-                                       if (isset($actions[$eventName]) && count($actions[$eventName]) > 0) {
+                                       if (isset($actions[$eventName]) && !empty($actions[$eventName])) {
                                                foreach ($actions[$eventName] as $action) {
                                                        if (isset($this->inheritedActionsObjects[$name][$action['listenerClassName']])) continue;
                                                        
@@ -154,7 +154,7 @@ class EventHandler extends SingletonFactory {
                $name = self::generateKey($className, $eventName);
                
                // execute inherited actions first
-               if (count($this->inheritedActions) > 0) {
+               if (!empty($this->inheritedActions)) {
                        $this->executeInheritedActions($eventObj, $eventName, $className, $name);
                }
                
index 325badc4703c0e78b289876bea0eb23ec78cbc48..ff2d823ac3dc51d87692fd00994c6f5152b37a6c 100644 (file)
@@ -45,7 +45,7 @@ class File {
         */
        public function __construct($filename, $mode = 'wb', $options = array()) {
                $this->filename = $filename;
-               if (count($options)) {
+               if (!empty($options)) {
                        $context = stream_context_create($options);
                        $this->resource = fopen($filename, $mode, false, $context);
                }
index edd053b3fd34989dd644fed05dccf4fe34f24b34..773f61782ec440f5e4bf8fce67c55bebd7a75b42 100644 (file)
@@ -88,7 +88,7 @@ class TarWriter extends Tar {
         */
        public function add($files, $addDir = '', $removeDir = '') {
                if (!is_array($files)) $files = array($files);
-               if (!count($files)) return false;
+               if (empty($files)) return false;
                
                $result = true;
                
index 826a0f1a89f9478cd1d9b3f5d27b7503cdfb4c3e..07f61d82ef5dea547957f7dc7ff2cfc80c815be4 100644 (file)
@@ -196,7 +196,7 @@ class I18nHandler extends SingletonFactory {
         * @throws  SystemException if $i18nValues doesn't have any elements
         */
        public function setValues($elementID, array $i18nValues) {
-               if (!count($i18nValues)) {
+               if (empty($i18nValues)) {
                        throw new SystemException('Invalid argument for parameter $i18nValues', 0, 'Expected filled array as second argument. Empty array given.');
                }
                if (!$this->isPlainValue($elementID)) {
@@ -293,7 +293,7 @@ class I18nHandler extends SingletonFactory {
                }
                
                // insert language items
-               if (count($insertLanguageIDs)) {
+               if (!empty($insertLanguageIDs)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_language_item
                                                (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
                                VALUES          (?, ?, ?, ?, ?, ?)";
@@ -312,7 +312,7 @@ class I18nHandler extends SingletonFactory {
                }
                
                // update language items
-               if (count($updateLanguageIDs)) {
+               if (!empty($updateLanguageIDs)) {
                        $sql = "UPDATE  wcf".WCF_N."_language_item
                                SET     languageItemValue = ?
                                WHERE   languageItemID = ?";
index e1ab76055b65842cc0d804b7466949dc01afdf2e..2980add9858e303afcca5a65c8b246b051b383a9 100644 (file)
@@ -87,7 +87,7 @@ class LanguageFactory extends SingletonFactory {
         */
        public function getLanguageByCode($languageCode) {
                // called within WCFSetup
-               if ($this->cache === false || !count($this->cache['codes'])) {
+               if ($this->cache === false || empty($this->cache['codes'])) {
                        $sql = "SELECT  languageID
                                FROM    wcf".WCF_N."_language
                                WHERE   languageCode = ?";
index 7c8a75c141b687036afbd425b5faa5b4ef015e95..65fa2a5df179fe92da940e3643ab961f2776ab21 100644 (file)
@@ -32,7 +32,7 @@ class LanguageServerProcessor extends SingletonFactory {
         * @param       array<wcf\data\language\server\LanguageServer>  $languageServers
         */
        public function import(Language $language, array $languageServers) {
-               if (!count($languageServers)) return;
+               if (empty($languageServers)) return;
                $this->language = $language;
                
                // get package list
@@ -202,7 +202,7 @@ class LanguageServerProcessor extends SingletonFactory {
                }
                
                // ignore variables if no package is known
-               if (!count($packages)) return;
+               if (empty($packages)) return;
                
                $this->importVariables($variables, $packages);
        }
@@ -256,7 +256,7 @@ class LanguageServerProcessor extends SingletonFactory {
                }
                
                // create items
-               if (count($createItems)) {
+               if (!empty($createItems)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_language_item
                                                (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
                                VALUES          (?, ?, ?, ?, ?, ?)";
@@ -275,7 +275,7 @@ class LanguageServerProcessor extends SingletonFactory {
                }
                
                // update items
-               if (count($updateItems)) {
+               if (!empty($updateItems)) {
                        $sql = "UPDATE  wcf".WCF_N."_language_item
                                SET     languageItemValue = ?
                                WHERE   languageItemID = ?";
@@ -317,7 +317,7 @@ class LanguageServerProcessor extends SingletonFactory {
                
                // create non-existing categories
                $createCategories = array_diff($categoryNames, array_keys($existingCategories));
-               if (count($createCategories)) {
+               if (!empty($createCategories)) {
                        // use raw queries for better performance
                        $sql = "INSERT INTO     wcf".WCF_N."_language_category
                                                (languageCategory)
index 755960f86f27baba88531d4e2b6d94dca62ce347..9cdc0e477486cf10456ebefb2ae0f25a3f58348b 100644 (file)
@@ -58,7 +58,7 @@ class Mail {
                if (!empty($cc)) $this->addCC($cc);
                if (!empty($bcc)) $this->addBCC($bcc);
                
-               if (count($attachments) > 0) $this->setAttachments($attachments);
+               if (!empty($attachments)) $this->setAttachments($attachments);
        }
        
        /**
index 64d96b5568815c6c1f7e5a504f81d3ebda2eb8ca..b1e4c977fb2e2465d8e23b21bc55d796eafc2efb 100644 (file)
@@ -105,9 +105,9 @@ class SMTPMailSender extends MailSender {
         */
        public function sendMail(Mail $mail) {
                $this->recipients = array();
-               if (count($mail->getTo()) > 0)  $this->recipients = $mail->getTo();
-               if (count($mail->getCC()) > 0)  $this->recipients = array_merge($this->recipients, $mail->getCC());
-               if (count($mail->getBCC())> 0)  $this->recipients = array_merge($this->recipients, $mail->getBCC());
+               if (count($mail->getTo()) > 0) $this->recipients = $mail->getTo();
+               if (count($mail->getCC()) > 0) $this->recipients = array_merge($this->recipients, $mail->getCC());
+               if (count($mail->getBCC())> 0) $this->recipients = array_merge($this->recipients, $mail->getBCC());
                
                // apply connection
                if ($this->connection === null) {
index 5178f51d743b80b77a60bc17aeb696c001b6a35d..4cf8d963d24aa87d32a925a770bd8b2953e370a0 100644 (file)
@@ -131,7 +131,7 @@ abstract class TreeMenu extends SingletonFactory {
                
                foreach ($this->menuItems[$parentMenuItem] as $key => $item) {
                        $this->removeEmptyItems($item->menuItem);
-                       if (empty($item->menuItemLink) && (!isset($this->menuItems[$item->menuItem]) || !count($this->menuItems[$item->menuItem]))) {
+                       if (empty($item->menuItemLink) && (!isset($this->menuItems[$item->menuItem]) || empty($this->menuItems[$item->menuItem]))) {
                                // remove this item
                                unset($this->menuItems[$parentMenuItem][$key]);
                        }
index cf3af34a819d6a9db0694714663749f3f602bb64..fd41488fcb9cabe8b4a0b781b9019c4163a61348 100644 (file)
@@ -55,9 +55,9 @@ class MultiSelectOptionType extends SelectOptionType {
         * @see wcf\system\option\ISearchableUserOption::getCondition()
         */
        public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value) {
-               if (!is_array($value) || !count($value)) return false;
+               if (!is_array($value) || empty($value)) return false;
                $value = ArrayUtil::trim($value);
-               if (!count($value)) return false;
+               if (empty($value)) return false;
                
                $conditions->add("option_value.userOption".$option->optionID." = ?", array(implode("\n", $value)));
                return true;
index 36483812fdcf7d0513147712f73d1e93a2183ff8..107b153058c32f4dc389f503460ad7bb2e932245 100644 (file)
@@ -26,8 +26,7 @@ class TextI18nOptionType extends TextOptionType {
         * @see wcf\system\option\IOptionType::getFormElement()
         */
        public function getFormElement(Option $option, $value) {
-               $useRequestData = (count($_POST)) ? true : false;
-               I18nHandler::getInstance()->assignVariables($useRequestData);
+               I18nHandler::getInstance()->assignVariables(!empty($_POST));
                
                WCF::getTPL()->assign(array(
                        'option' => $option,
index ac73f751c12c437925894955601612e1a5e4bf8b..d2e0f2825c1eac0629c988ec881c50ab0d322988 100644 (file)
@@ -26,8 +26,7 @@ class TextareaI18nOptionType extends TextareaOptionType {
         * @see wcf\system\option\IOptionType::getFormElement()
         */
        public function getFormElement(Option $option, $value) {
-               $useRequestData = (count($_POST)) ? true : false;
-               I18nHandler::getInstance()->assignVariables($useRequestData);
+               I18nHandler::getInstance()->assignVariables(!empty($_POST));
                
                WCF::getTPL()->assign(array(
                        'option' => $option,
index 43eda0d62ccc15e985fc702b9cd088df70f25108..de522599ec2ae74b31e834affbff4564f48da4db 100644 (file)
@@ -56,7 +56,7 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler {
                                }
                                
                                // check if files from installing package are in conflict with already installed files
-                               if (!$this->packageInstallation->getPackage()->isApplication && count($lockedFiles) > 0) {
+                               if (!$this->packageInstallation->getPackage()->isApplication && !empty($lockedFiles)) {
                                        foreach ($fileNames as $key => $file) {
                                                if (isset($lockedFiles[$file]) && $packageID != $lockedFiles[$file]) {
                                                        $owningPackage = new Package($lockedFiles[$file]);
@@ -95,7 +95,7 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler {
                        }
                }
                
-               if (count($files)) {
+               if (!empty($files)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_".$this->tableName."
                                                (packageID, templateName)
                                VALUES          (?, ?)";
index d7bd21c0838bb647fbf8c53b2f1d153d44e4bd69..6bf1a51cb11cf85cd155f3c14310f9c82ba5bcaf 100644 (file)
@@ -38,7 +38,7 @@ class FilesFileHandler extends PackageInstallationFileHandler {
                                }
                                
                                // check delivered files
-                               if (count($lockedFiles) > 0) {
+                               if (!empty($lockedFiles)) {
                                        $dir = $this->packageInstallation->getPackage()->packageDir;
                                        foreach ($files as $key => $file) {
                                                if (isset($lockedFiles[$dir.$file])) {
index 757283385188b4ded6c81cbf83fb6f1fd54c151f..a0111a54b2d82d064e8e9cfd9d2f1a5d0d3146e3 100644 (file)
@@ -824,7 +824,7 @@ class PackageArchive {
         */
        public function getConflictedExcludedPackages() {
                $conflictedPackages = array();
-               if (count($this->excludedPackages) > 0) {
+               if (!empty($this->excludedPackages)) {
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("package IN (?)", array(array_keys($this->excludedPackages)));
                        
index f79c9eb024a2a427f83c471d113390cb22a77a8a..6b95d8ae81d1214e0cb998066edb0e29a4b24ab4 100644 (file)
@@ -240,23 +240,25 @@ class PackageInstallationDispatcher {
                        
                        // if package is plugin to com.woltlab.wcf it must not have any other requirement
                        $requirements = $this->getArchive()->getRequirements();
-                       if ($package->parentPackageID == 1 && count($requirements)) {
-                           foreach ($requirements as $package => $data) {
-                               if ($package == 'com.woltlab.wcf') continue;
-                               throw new SystemException('Package '.$package->package.' is plugin of com.woltlab.wcf (WCF) but has more than one requirement.');
-                           }
+                       if ($package->parentPackageID == 1 && !empty($requirements)) {
+                               foreach ($requirements as $package => $data) {
+                                       if ($package == 'com.woltlab.wcf') continue;
+                                       throw new SystemException('Package '.$package->package.' is plugin of com.woltlab.wcf (WCF) but has more than one requirement.');
+                               }
                        }
                        
                        // insert requirements and dependencies
                        $requirements = $this->getArchive()->getAllExistingRequirements();
-                       if (count($requirements) > 0) {
+                       if (!empty($requirements)) {
                                $sql = "INSERT INTO     wcf".WCF_N."_package_requirement
                                                        (packageID, requirement)
                                        VALUES          (?, ?)";
                                $statement = WCF::getDB()->prepareStatement($sql);
                                
                                foreach ($requirements as $identifier => $possibleRequirements) {
-                                       if (count($possibleRequirements) == 1) $requirement = array_shift($possibleRequirements);
+                                       if (count($possibleRequirements) == 1) {
+                                               $requirement = array_shift($possibleRequirements);
+                                       }
                                        else {
                                                $requirement = $possibleRequirements[$this->selectedRequirements[$identifier]];
                                        }
index 9c018a9abc7e781efc7c03b6283354790f3366fc..f15a8876ab3f9e4dc7ea8e59e38cb34c8a4ded6d 100644 (file)
@@ -511,11 +511,12 @@ class PackageInstallationNodeBuilder {
                }
                
                // insert nodes
-               if (count($pluginNodes) > 0) {
+               if (!empty($pluginNodes)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_package_installation_node
                                                (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData)
                                VALUES          (?, ?, ?, ?, ?, ?, ?)";
                        $statement = WCF::getDB()->prepareStatement($sql);
+                       
                        foreach ($pluginNodes as $index => $nodeData) {
                                $statement->execute(array(
                                        $this->installation->queue->queueID,
index 807c8c1eadc538524c87211cee9d9fef1dfbf5f0..47039fb72d0e1a49b5d7f67a4a5bfd4959427d76 100644 (file)
@@ -143,7 +143,7 @@ class PackageInstallationSQLParser extends SQLParser {
                }
                
                // columns
-               if (count($this->columnLog)) {
+               if (!empty($this->columnLog)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_package_installation_sql_log
                                WHERE           sqlTable = ?
                                                AND sqlColumn = ?";
@@ -171,7 +171,7 @@ class PackageInstallationSQLParser extends SQLParser {
                }
                
                // indices
-               if (count($this->indexLog)) {
+               if (!empty($this->indexLog)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_package_installation_sql_log
                                WHERE           sqlTable = ?
                                                AND sqlIndex = ?";
index 7610ed3d45e4048d48e326930a7345c4643f8083..5dc63dce776b8cebb389974c435663ead7abf2a7 100644 (file)
@@ -265,11 +265,11 @@ class PackageInstallationScheduler {
                        }
                }
                
-               if (count($authorizationRequiredException)) {
+               if (!empty($authorizationRequiredException)) {
                        throw array_shift($authorizationRequiredException);
                }
                
-               if (count($systemExceptions)) {
+               if (!empty($systemExceptions)) {
                        throw array_shift($systemExceptions);
                }
                
@@ -284,7 +284,7 @@ class PackageInstallationScheduler {
        public function getExcludedPackages() {
                $excludedPackages = array();
                
-               if (count($this->packageInstallationStack)) {
+               if (!empty($this->packageInstallationStack)) {
                        $packageInstallations = array();
                        $packageIdentifier = array();
                        foreach ($this->packageInstallationStack as $packageInstallation) {
@@ -292,7 +292,7 @@ class PackageInstallationScheduler {
                                $packageInstallations[] = $packageInstallation;
                                $packageIdentifier[] = $packageInstallation['package'];
                        }
-
+                       
                        // check exclusions of the new packages
                        // get package update ids
                        $conditions = new PreparedStatementConditionBuilder();
index 04de4848e416ba9e4f5baccf4ad5d163c10b126c..b534c790be9dfdc862d31340eb400809c1fa9ca7 100644 (file)
@@ -75,7 +75,7 @@ abstract class PackageUpdateDispatcher {
                unset($response);
                
                // save packages
-               if (count($allNewPackages)) {
+               if (!empty($allNewPackages)) {
                        self::savePackageUpdates($allNewPackages, $updateServer->packageUpdateServerID);
                }
                unset($allNewPackages);
@@ -362,7 +362,7 @@ abstract class PackageUpdateDispatcher {
                
                // get existing versions
                $existingPackageVersions = array();
-               if (count($existingPackages) > 0) {
+               if (!empty($existingPackages)) {
                        // get package update ids
                        $packageUpdateIDs = array();
                        foreach ($existingPackages as $packageUpdate) {
@@ -720,7 +720,7 @@ abstract class PackageUpdateDispatcher {
                        $versions[] = $row;
                }
                
-               if (!count($versions)) {
+               if (empty($versions)) {
                        throw new SystemException("Can not find package '".$package."' in version '".$version."'");
                }
                
index a5311df8699093396092562ba2b0b5fa44729e0e..d398f1d26ff70b757ba3862b46a6d13573622b09 100644 (file)
@@ -69,7 +69,7 @@ class ACPTemplatePackageInstallationPlugin extends AbstractPackageInstallationPl
                        $templates[] = 'acp/templates/'.$row['templateName'].'.tpl';
                }
                
-               if (count($templates) > 0) {
+               if (!empty($templates)) {
                        // delete template files
                        $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
                        $deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
index 0a1e7c6614f54b1ae1ed8eeeef7f28a7f4fcbc75..3323b527a4a416f186815cd0a63fc35acaa3249e 100644 (file)
@@ -48,7 +48,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                        $options[] = $element->getAttribute('name');
                }
                
-               if (count($options)) {
+               if (!empty($options)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_".$this->tableName."
                                WHERE           optionName = ?
                                AND packageID = ?";
@@ -69,7 +69,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                        $categories[] = $element->getAttribute('name');
                }
                
-               if (count($categories)) {
+               if (!empty($categories)) {
                        // delete options for given categories
                        $sql = "DELETE FROM     wcf".WCF_N."_".$this->tableName."
                                WHERE           categoryName = ?";
index 326b33f25915792857e11d0b918e51d5c8cb0a67..3732e03c75287ab5cf9ea6ea04c6f267a17c943f 100644 (file)
@@ -127,7 +127,7 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($this->installation->getPackageID()));
                
-               if (count($this->pages)) {
+               if (!empty($this->pages)) {
                        // insert pages
                        $sql = "INSERT INTO     wcf".WCF_N."_clipboard_page
                                                (pageClassName, packageID, actionID)
index 83ed31befde913e599f300edb0b31fc9aa929037..93042a7063d2faea426b14b156142ec3f3f8b599 100644 (file)
@@ -109,7 +109,7 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin {
                        $files[] = $row['filename'];
                }
                
-               if (count($files) > 0) {
+               if (!empty($files)) {
                        // delete files
                        $this->installation->deleteFiles($packageDir, $files);
                        
index a4a4622b25f98e8b08255ad20d0fb0102cca27fc..4375e1173135eb6070ca7850bbc26c298ae6ebdb 100644 (file)
@@ -135,7 +135,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl
                }
                
                // save package to language
-               if (count($addedLanguageIDArray)) {
+               if (!empty($addedLanguageIDArray)) {
                        $condition = '';
                        $statementParameters = array($this->installation->getPackageID());
                        foreach ($addedLanguageIDArray as $languageID) {
@@ -206,7 +206,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl
                        $categoryIDs[$row['languageCategoryID']] = true;
                }
                
-               if (count($itemIDs) > 0) {
+               if (!empty($itemIDs)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_".$this->tableName."
                                WHERE           languageItemID = ?
                                                AND packageID = ?";
@@ -273,7 +273,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl
                }
                
                // Delete categories from DB.
-               if (count($categoriesToDelete) > 0) {
+               if (!empty($categoriesToDelete)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_language_category
                                WHERE           languageCategory = ?";
                        $statement = WCF::getDB()->prepareStatement($sql);
index 90ba02310bb56d5df2dd47b337e2ae0447ae3f45..de5bec8f876ec31957beeb06ac1f3cedfc812eba 100644 (file)
@@ -70,7 +70,7 @@ class StylePackageInstallationPlugin extends AbstractPackageInstallationPlugin {
                        $styleList->readObjects();
                        $styles = $styleList->getObjects();
                        
-                       if (count($styles)) {
+                       if (!empty($styles)) {
                                $styleEditor = new StyleEditor($styles[0]);
                                $styleEditor->setAsDefault();
                        }
index da569be192a509680deb023c8407755c026fe47f..f844490ace7b0579e33ba3f68078e0b8fd9f571e 100644 (file)
@@ -58,7 +58,7 @@ class TemplatePackageInstallationPlugin extends AbstractPackageInstallationPlugi
                        $templates[] = 'templates/'.$row['templateName'].'.tpl';
                }
                
-               if (count($templates) > 0) {
+               if (!empty($templates)) {
                        // delete template files
                        $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
                        $deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
index 43441324e82ca6bcb6b4c09f13a7ace31510b209..204a9d040decb438764f2eca5fc0d4c0306202b7 100644 (file)
@@ -565,7 +565,7 @@ class SessionHandler extends SingletonFactory {
         * @param       array<integer>  $userIDs
         */
        public static function resetSessions(array $userIDs = array()) {
-               if (count($userIDs)) {
+               if (!empty($userIDs)) {
                        UserStorageHandler::getInstance()->reset($userIDs, 'groupIDs', 1);
                        UserStorageHandler::getInstance()->reset($userIDs, 'languageIDs', 1);
                }
index ecac03e10cecf34ea64445e52d218c5f866b8ac3..ea5e88b0852300fb69fbab835a0661f764b961e6 100644 (file)
@@ -165,7 +165,7 @@ class Installer {
                                $errors[] = array('file' => $file, 'code' => $e->getCode(), 'message' => $e->getMessage());
                        }
                }
-               if (count($errors) > 0) {
+               if (!empty($errors)) {
                        throw new SystemException('error(s) during the installation of the files.', $errors);
                }
                
index 4314fb9b5963876ae9bf867fc3b4a6eae4f9847b..ae67f2e9072b7c2d7eed6a9831b65dad60d21b28 100644 (file)
@@ -45,7 +45,7 @@ class SitemapHandler extends SingletonFactory {
        public function getTree() {
                $tree = array();
                
-               if (count($this->cache) > 0) {
+               if (!empty($this->cache)) {
                        foreach ($this->cache as $sitemap) {
                                $tree[] = $sitemap->sitemapName;
                        }
index 52315556733ddd0910ef9af1c8138de32181bfe4..669afe7581b7bfef474806b66eb1f9b4b9affa0e 100755 (executable)
@@ -556,7 +556,7 @@ class TemplateEngine extends SingletonFactory {
                }
                
                // add new template variables
-               if (count($variables)) {
+               if (!empty($variables)) {
                        $this->v = array_merge($this->v, $variables);
                }
                
@@ -589,7 +589,7 @@ class TemplateEngine extends SingletonFactory {
                }
                
                // add new template variables
-               if (count($variables)) {
+               if (!empty($variables)) {
                        $this->v = array_merge($this->v, $variables);
                }
                
@@ -700,7 +700,7 @@ class TemplateEngine extends SingletonFactory {
                }
                
                // add new template variables
-               if (count($variables)) {
+               if (!empty($variables)) {
                        $this->v = array_merge($this->v, $variables);
                }
                
@@ -762,7 +762,7 @@ class TemplateEngine extends SingletonFactory {
         */
        protected function loadTemplateListenerCode($templateName) {
                // cache was already loaded
-               if (!isset($this->templateListeners[$templateName]) || count($this->templateListeners[$templateName])) return;
+               if (!isset($this->templateListeners[$templateName]) || !empty($this->templateListeners[$templateName])) return;
                
                $cacheName = PACKAGE_ID.'-'.$this->environment.'-'.$templateName;
                CacheHandler::getInstance()->addResource(
index 3bb974770b426c861f0e2fd082f543f6de231f56..10c300530ff930e1a47a152ea9513cc91172acd9 100644 (file)
@@ -157,7 +157,7 @@ class UserStorageHandler extends SingletonFactory {
        public function shutdown() {
                WCF::getDB()->beginTransaction();
                // remove outdated entries
-               if (count($this->resetFields)) {
+               if (!empty($this->resetFields)) {
                        $sql = "DELETE FROM     wcf".WCF_N."_user_storage
                                WHERE           userID = ?
                                                AND field = ?
@@ -178,7 +178,7 @@ class UserStorageHandler extends SingletonFactory {
                }
                
                // insert data
-               if (count($this->updateFields)) {
+               if (!empty($this->updateFields)) {
                        $sql = "INSERT INTO     wcf".WCF_N."_user_storage
                                                (userID, field, fieldValue, packageID)
                                VALUES          (?, ?, ?, ?)";
index 1b470434c61f62de54116c7b180c0c03312838c8..1ae93c95ddf35a3c2685720ef54ecd5674e1a46b 100644 (file)
@@ -64,7 +64,7 @@ class XML {
                
                // check for errors occured in libxml
                $errors = $this->pollErrors();
-               if (count($errors)) {
+               if (!empty($errors)) {
                        $this->throwException("XML document '".$this->path."' is not valid XML.", $errors);
                }
        }
@@ -83,7 +83,7 @@ class XML {
                
                // check for errors occured in libxml
                $errors = $this->pollErrors();
-               if (count($errors)) {
+               if (!empty($errors)) {
                        $this->throwException("XML document '".$this->path."' is not valid XML.", $errors);
                }
        }
@@ -100,7 +100,7 @@ class XML {
                
                // check for errors occured in libxml
                $errors = $this->pollErrors();
-               if (count($errors)) {
+               if (!empty($errors)) {
                        $this->throwException("XML document '".$this->path."' violates XML schema definition.", $errors);
                }
        }
@@ -174,7 +174,7 @@ class XML {
         * @param       array           $errors
         */
        protected function throwException($message, array $errors = array()) {
-               if (count($errors)) {
+               if (!empty($errors)) {
                        $description = '<b>LibXML output:</b><pre>';
                        foreach ($errors as $error) {
                                $description .= "#".$error['line']."\t".$error['message'];