[Pkg-owncloud-commits] [owncloud] 33/258: Add isAppstoreEnabled instead of hijacking the URL

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 41d8157937605caca650eae65a411e1929fc9c1a
Author: Lukas Reschke <lukas at owncloud.com>
Date:   Tue Aug 26 10:20:51 2014 +0200

    Add isAppstoreEnabled instead of hijacking the URL
---
 lib/private/ocsclient.php | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index d173f39..dc147de 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -29,6 +29,18 @@
 class OC_OCSClient{
 
 	/**
+	 * Returns whether the AppStore is enabled (i.e. because the AppStore is disabled for EE)
+	 * @return bool
+	 */
+	protected static function isAppstoreEnabled() {
+		if(OC::$server->getConfig()->getSystemValue('appstoreenabled', true) === false OR OC_Util::getEditionString() !== '') {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
 	 * Get the url of the OCS AppStore server.
 	 * @return string of the AppStore server
 	 *
@@ -36,10 +48,9 @@ class OC_OCSClient{
 	 * to set it in the config file or it will fallback to the default
 	 */
 	private static function getAppStoreURL() {
-		return \OC::$server->getConfig()->getSystemValue('appstoreurl', 'https://api.owncloud.com/v1');
+		return OC::$server->getConfig()->getSystemValue('appstoreurl', 'https://api.owncloud.com/v1');
 	}
 
-
 	/**
 	 * Get the content of an OCS url call.
 	 * @return string of the response
@@ -58,7 +69,7 @@ class OC_OCSClient{
 	 * This function returns a list of all the application categories on the OCS server
 	 */
 	public static function getCategories() {
-		if(OC_Config::getValue('appstoreenabled', true)==false) {
+		if(!self::isAppstoreEnabled()) {
 			return null;
 		}
 		$url=OC_OCSClient::getAppStoreURL().'/content/categories';
@@ -94,7 +105,7 @@ class OC_OCSClient{
 	 * @param string $filter
 	 */
 	public static function getApplications($categories, $page, $filter) {
-		if(OC_Config::getValue('appstoreenabled', true)==false) {
+		if(!self::isAppstoreEnabled()) {
 			return(array());
 		}
 
@@ -149,7 +160,7 @@ class OC_OCSClient{
 	 * This function returns an applications from the OCS server
 	 */
 	public static function getApplication($id) {
-		if(OC_Config::getValue('appstoreenabled', true)==false) {
+		if(!self::isAppstoreEnabled()) {
 			return null;
 		}
 		$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
@@ -197,7 +208,7 @@ class OC_OCSClient{
 	 * @param integer $item
 	 */
 	public static function getApplicationDownload($id, $item) {
-		if(OC_Config::getValue('appstoreenabled', true)==false) {
+		if(!self::isAppstoreEnabled()) {
 			return null;
 		}
 		$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list