make it possible to connect to other ocs appstores and other ocs knowledgebase servers.
also make it possible to switch the app store and the knowledgebase off completely.
This commit is contained in:
parent
82b54938e3
commit
a191b75c31
|
@ -15,6 +15,10 @@ $CONFIG = array(
|
||||||
"theme" => "",
|
"theme" => "",
|
||||||
"3rdpartyroot" => "",
|
"3rdpartyroot" => "",
|
||||||
"3rdpartyurl" => "",
|
"3rdpartyurl" => "",
|
||||||
|
"knowledgebaseenabled" => true,
|
||||||
|
"knowledgebaseurl" => "",
|
||||||
|
"appstoreenabled" => true,
|
||||||
|
"appstoreurl" => "",
|
||||||
// "datadirectory" => ""
|
// "datadirectory" => ""
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -210,10 +210,13 @@ class OC_App{
|
||||||
public static function getSettingsNavigation(){
|
public static function getSettingsNavigation(){
|
||||||
$l=new OC_L10N('core');
|
$l=new OC_L10N('core');
|
||||||
|
|
||||||
|
$settings = array();
|
||||||
// by default, settings only contain the help menu
|
// by default, settings only contain the help menu
|
||||||
|
if(OC_Config::getValue('knowledgebaseenabled', true)==true){
|
||||||
$settings = array(
|
$settings = array(
|
||||||
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
|
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" ))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// if the user is logged-in
|
// if the user is logged-in
|
||||||
if (OC_User::isLoggedIn()) {
|
if (OC_User::isLoggedIn()) {
|
||||||
|
|
|
@ -28,6 +28,38 @@
|
||||||
|
|
||||||
class OC_OCSClient{
|
class OC_OCSClient{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the url of the OCS AppStore server.
|
||||||
|
* @returns string of the AppStore server
|
||||||
|
*
|
||||||
|
* This function returns the url of the OCS AppStore server. It´s possible to set it in the config file or it will fallback to the default
|
||||||
|
*/
|
||||||
|
private static function getAppStoreURL(){
|
||||||
|
$configurl=OC_Config::getValue('appstoreurl', '');
|
||||||
|
if($configurl<>'') {
|
||||||
|
$url=$configurl;
|
||||||
|
}else{
|
||||||
|
$url='http://api.apps.owncloud.com/v1';
|
||||||
|
}
|
||||||
|
return($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the url of the OCS KB server.
|
||||||
|
* @returns string of the KB server
|
||||||
|
* This function returns the url of the OCS knowledge base server. It´s possible to set it in the config file or it will fallback to the default
|
||||||
|
*/
|
||||||
|
private static function getKBURL(){
|
||||||
|
$configurl=OC_Config::getValue('knowledgebaseurl', '');
|
||||||
|
if($configurl<>'') {
|
||||||
|
$url=$configurl;
|
||||||
|
}else{
|
||||||
|
$url='http://api.apps.owncloud.com/v1';
|
||||||
|
}
|
||||||
|
return($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get all the categories from the OCS server
|
* @brief Get all the categories from the OCS server
|
||||||
* @returns array with category ids
|
* @returns array with category ids
|
||||||
|
@ -35,7 +67,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(){
|
||||||
$url='http://api.apps.owncloud.com/v1/content/categories';
|
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
if($xml==FALSE){
|
if($xml==FALSE){
|
||||||
|
@ -64,12 +96,16 @@ class OC_OCSClient{
|
||||||
* This function returns a list of all the applications on the OCS server
|
* This function returns a list of all the applications on the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getApplications($categories){
|
public static function getApplications($categories){
|
||||||
|
if(OC_Config::getValue('appstoreenabled', true)==false){
|
||||||
|
return(array());
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($categories)) {
|
if(is_array($categories)) {
|
||||||
$categoriesstring=implode('x',$categories);
|
$categoriesstring=implode('x',$categories);
|
||||||
}else{
|
}else{
|
||||||
$categoriesstring=$categories;
|
$categoriesstring=$categories;
|
||||||
}
|
}
|
||||||
$url='http://api.apps.owncloud.com/v1/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page=0&pagesize=10';
|
$url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page=0&pagesize=10';
|
||||||
$apps=array();
|
$apps=array();
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
if($xml==FALSE){
|
if($xml==FALSE){
|
||||||
|
@ -104,7 +140,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){
|
||||||
$url='http://api.apps.owncloud.com/v1/content/data/'.urlencode($id);
|
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
if($xml==FALSE){
|
if($xml==FALSE){
|
||||||
|
@ -137,7 +173,7 @@ class OC_OCSClient{
|
||||||
* This function returns an download url for an applications from the OCS server
|
* This function returns an download url for an applications from the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getApplicationDownload($id,$item){
|
public static function getApplicationDownload($id,$item){
|
||||||
$url='http://api.apps.owncloud.com/v1/content/download/'.urlencode($id).'/'.urlencode($item);
|
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
|
||||||
|
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
if($xml==FALSE){
|
if($xml==FALSE){
|
||||||
|
@ -164,9 +200,15 @@ class OC_OCSClient{
|
||||||
* This function returns a list of all the knowledgebase entries from the OCS server
|
* This function returns a list of all the knowledgebase entries from the OCS server
|
||||||
*/
|
*/
|
||||||
public static function getKnownledgebaseEntries($page,$pagesize){
|
public static function getKnownledgebaseEntries($page,$pagesize){
|
||||||
|
if(OC_Config::getValue('knowledgebaseenabled', true)==false){
|
||||||
|
$kbe=array();
|
||||||
|
$kbe['totalitems']=0;
|
||||||
|
return $kbe;
|
||||||
|
}
|
||||||
|
|
||||||
$p= (int) $page;
|
$p= (int) $page;
|
||||||
$s= (int) $pagesize;
|
$s= (int) $pagesize;
|
||||||
$url='http://api.apps.owncloud.com/v1/knowledgebase/data?type=150&page='.$p.'&pagesize='.$s;
|
$url=OC_OCSClient::getKBURL().'/knowledgebase/data?type=150&page='.$p.'&pagesize='.$s;
|
||||||
|
|
||||||
$kbe=array();
|
$kbe=array();
|
||||||
$xml=@file_get_contents($url);
|
$xml=@file_get_contents($url);
|
||||||
|
|
Loading…
Reference in New Issue