summaryrefslogtreecommitdiffstats
path: root/lib/app.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.php')
-rw-r--r--lib/app.php40
1 files changed, 32 insertions, 8 deletions
diff --git a/lib/app.php b/lib/app.php
index 73bee11a69c..7aafeb36295 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -142,6 +142,8 @@ class OC_App{
* check if app is shipped
* @param string $appid the id of the app to check
* @return bool
+ *
+ * Check if an app that is installed is a shipped app or installed from the appstore.
*/
public static function isShipped($appid){
$info = self::getAppInfo($appid);
@@ -177,7 +179,7 @@ class OC_App{
* This function checks whether or not an app is enabled.
*/
public static function isEnabled( $app ) {
- if( 'files'==$app or 'yes' == OC_Appconfig::getValue( $app, 'enabled' )) {
+ if( 'files'==$app or ('yes' == OC_Appconfig::getValue( $app, 'enabled' ))) {
return true;
}
@@ -197,9 +199,10 @@ class OC_App{
if(!is_numeric($app)) {
$app = OC_Installer::installShippedApp($app);
}else{
+ $appdata=OC_OCSClient::getApplication($app);
$download=OC_OCSClient::getApplicationDownload($app, 1);
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
- $app=OC_Installer::installApp(array('source'=>'http', 'href'=>$download['downloadlink']));
+ $app=OC_Installer::installApp(array('source'=>'http', 'href'=>$download['downloadlink'],'appdata'=>$appdata));
}
}
}
@@ -212,6 +215,9 @@ class OC_App{
return false;
}else{
OC_Appconfig::setValue( $app, 'enabled', 'yes' );
+ if(isset($appdata['id'])) {
+ OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] );
+ }
return true;
}
}else{
@@ -227,8 +233,13 @@ class OC_App{
* This function set an app as disabled in appconfig.
*/
public static function disable( $app ) {
- // check if app is a shiped app or not. if not delete
+ // check if app is a shipped app or not. if not delete
OC_Appconfig::setValue( $app, 'enabled', 'no' );
+
+ // check if app is a shipped app or not. if not delete
+ if(!OC_App::isShipped( $app )){
+ OC_Installer::removeApp( $app );
+ }
}
/**
@@ -621,9 +632,13 @@ class OC_App{
if(isset($info['shipped']) and ($info['shipped']=='true')) {
$info['internal']=true;
$info['internallabel']='Internal App';
+ $info['internalclass']='';
+ $info['update']=false;
} else {
$info['internal']=false;
$info['internallabel']='3rd Party App';
+ $info['internalclass']='externalapp';
+ $info['update']=OC_Installer::isUpdateAvailable($app);
}
$info['preview'] = OC_Helper::imagePath('settings', 'trans.png');
@@ -633,15 +648,15 @@ class OC_App{
}
$remoteApps = OC_App::getAppstoreApps();
if ( $remoteApps ) {
- // Remove duplicates
+ // Remove duplicates
foreach ( $appList as $app ) {
foreach ( $remoteApps AS $key => $remote ) {
if (
$app['name'] == $remote['name']
- // To set duplicate detection to use OCS ID instead of string name,
- // enable this code, remove the line of code above,
- // and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
- // OR $app['ocs_id'] == $remote['ocs_id']
+ // To set duplicate detection to use OCS ID instead of string name,
+ // enable this code, remove the line of code above,
+ // and add <ocs_id>[ID]</ocs_id> to info.xml of each 3rd party app:
+ // OR $app['ocs_id'] == $remote['ocs_id']
) {
unset( $remoteApps[$key]);
}
@@ -675,6 +690,15 @@ class OC_App{
$app1[$i]['author'] = $app['personid'];
$app1[$i]['ocs_id'] = $app['id'];
$app1[$i]['internal'] = $app1[$i]['active'] = 0;
+ $app1[$i]['update'] = false;
+ if($app['label']=='recommended'){
+ $app1[$i]['internallabel'] = 'Recommended';
+ $app1[$i]['internalclass'] = 'recommendedapp';
+ }else{
+ $app1[$i]['internallabel'] = '3rd Party';
+ $app1[$i]['internalclass'] = 'externalapp';
+ }
+
// rating img
if($app['score']>=0 and $app['score']<5) $img=OC_Helper::imagePath( "core", "rating/s1.png" );