Add isAppstoreEnabled instead of hijacking the URL
This commit is contained in:
parent
4bc72cc4e0
commit
ca7e4c8c67
|
@ -28,6 +28,18 @@
|
||||||
|
|
||||||
class OC_OCSClient{
|
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.
|
* Get the url of the OCS AppStore server.
|
||||||
* @return string of the 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
|
* to set it in the config file or it will fallback to the default
|
||||||
*/
|
*/
|
||||||
private static function getAppStoreURL() {
|
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.
|
* Get the content of an OCS url call.
|
||||||
* @return string of the response
|
* @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
|
* This function returns a list of all the application categories on the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getCategories() {
|
public static function getCategories() {
|
||||||
if(OC_Config::getValue('appstoreenabled', true)==false) {
|
if(!self::isAppstoreEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
|
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
|
||||||
|
@ -94,7 +105,7 @@ class OC_OCSClient{
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
*/
|
*/
|
||||||
public static function getApplications($categories, $page, $filter) {
|
public static function getApplications($categories, $page, $filter) {
|
||||||
if(OC_Config::getValue('appstoreenabled', true)==false) {
|
if(!self::isAppstoreEnabled()) {
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +160,7 @@ class OC_OCSClient{
|
||||||
* This function returns an applications from the OCS server
|
* This function returns an applications from the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getApplication($id) {
|
public static function getApplication($id) {
|
||||||
if(OC_Config::getValue('appstoreenabled', true)==false) {
|
if(!self::isAppstoreEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
|
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
|
||||||
|
@ -197,7 +208,7 @@ class OC_OCSClient{
|
||||||
* @param integer $item
|
* @param integer $item
|
||||||
*/
|
*/
|
||||||
public static function getApplicationDownload($id, $item) {
|
public static function getApplicationDownload($id, $item) {
|
||||||
if(OC_Config::getValue('appstoreenabled', true)==false) {
|
if(!self::isAppstoreEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
|
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
|
||||||
|
|
Loading…
Reference in New Issue