diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/app.php | 17 | ||||
-rw-r--r-- | lib/private/installer.php | 6 | ||||
-rw-r--r-- | lib/private/ocsclient.php | 18 | ||||
-rw-r--r-- | lib/private/server.php | 2 | ||||
-rw-r--r-- | lib/private/share/hooks.php | 4 |
5 files changed, 30 insertions, 17 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index d3dcf1f8c81..6f0abf58e17 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -294,8 +294,8 @@ class OC_App { * @return int */ public static function downloadApp($app) { - $appData=OC_OCSClient::getApplication($app); - $download=OC_OCSClient::getApplicationDownload($app, 1); + $appData=OC_OCSClient::getApplication($app, \OC_Util::getVersion()); + $download=OC_OCSClient::getApplicationDownload($app, 1, \OC_Util::getVersion()); if(isset($download['downloadlink']) and $download['downloadlink']!='') { // Replace spaces in download link without encoding entire URL $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -926,7 +926,7 @@ class OC_App { public static function getAppstoreApps($filter = 'approved', $category = null) { $categories = array($category); if (is_null($category)) { - $categoryNames = OC_OCSClient::getCategories(); + $categoryNames = OC_OCSClient::getCategories(\OC_Util::getVersion()); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!$categories = array_keys($categoryNames)) { @@ -938,7 +938,7 @@ class OC_App { } $page = 0; - $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); + $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter, \OC_Util::getVersion()); $app1 = array(); $i = 0; $l = \OC::$server->getL10N('core'); @@ -1088,7 +1088,7 @@ class OC_App { public static function installApp($app) { $l = \OC::$server->getL10N('core'); $config = \OC::$server->getConfig(); - $appData=OC_OCSClient::getApplication($app); + $appData=OC_OCSClient::getApplication($app, \OC_Util::getVersion()); // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string if(!is_numeric($app)) { @@ -1173,6 +1173,8 @@ class OC_App { $appData = self::getAppInfo($appId); if (array_key_exists('ocsid', $appData)) { OC_Appconfig::setValue($appId, 'ocsid', $appData['ocsid']); + } elseif(OC_Appconfig::getValue($appId, 'ocsid', null) !== null) { + OC_Appconfig::deleteKey($appId, 'ocsid'); } foreach ($appData['remote'] as $name => $path) { OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appId . '/' . $path); @@ -1227,17 +1229,18 @@ class OC_App { // manages line breaks itself // first of all we split on empty lines - $paragraphs = preg_split("!\n[[:space:]]*\n!m", $data['description']); + $paragraphs = preg_split("!\n[[:space:]]*\n!mu", $data['description']); $result = []; foreach ($paragraphs as $value) { // replace multiple whitespace (tabs, space, newlines) inside a paragraph // with a single space - also trims whitespace - $result[] = trim(preg_replace('![[:space:]]+!m', ' ', $value)); + $result[] = trim(preg_replace('![[:space:]]+!mu', ' ', $value)); } // join the single paragraphs with a empty line in between $data['description'] = implode("\n\n", $result); + } return $data; diff --git a/lib/private/installer.php b/lib/private/installer.php index 7325e0d0d6a..75687955fd8 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -205,8 +205,8 @@ class OC_Installer{ * @throws Exception */ public static function updateAppByOCSId($ocsid) { - $appdata = OC_OCSClient::getApplication($ocsid); - $download = OC_OCSClient::getApplicationDownload($ocsid, 1); + $appdata = OC_OCSClient::getApplication($ocsid, \OC_Util::getVersion()); + $download = OC_OCSClient::getApplicationDownload($ocsid, 1, \OC_Util::getVersion()); if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') { $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -368,7 +368,7 @@ class OC_Installer{ if($ocsid<>'') { - $ocsdata=OC_OCSClient::getApplication($ocsid); + $ocsdata=OC_OCSClient::getApplication($ocsid, \OC_Util::getVersion()); $ocsversion= (string) $ocsdata['version']; $currentversion=OC_App::getAppVersion($app); if (version_compare($ocsversion, $currentversion, '>')) { diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index 7ce6723128b..fe881be395b 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -67,12 +67,15 @@ class OC_OCSClient{ * @return array|null an array of category ids or null * @note returns NULL if config value appstoreenabled is set to false * This function returns a list of all the application categories on the OCS server + * + * @param array $targetVersion The target ownCloud version */ - public static function getCategories() { + public static function getCategories(array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { return null; @@ -103,8 +106,9 @@ class OC_OCSClient{ * @param array|string $categories * @param int $page * @param string $filter + * @param array $targetVersion The target ownCloud version */ - public static function getApplications($categories, $page, $filter) { + public static function getApplications($categories, $page, $filter, array $targetVersion) { if(!self::isAppstoreEnabled()) { return(array()); } @@ -115,7 +119,7 @@ class OC_OCSClient{ $categoriesstring=$categories; } - $version='&version='.implode('x', \OC_Util::getVersion()); + $version='&version='.implode('x', $targetVersion); $filterurl='&filter='.urlencode($filter); $url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring) .'&sortmode=new&page='.urlencode($page).'&pagesize=100'.$filterurl.$version; @@ -158,15 +162,17 @@ class OC_OCSClient{ /** * Get an the applications from the OCS server * @param string $id + * @param array $targetVersion The target ownCloud version * @return array|null an array of application data or null * * This function returns an applications from the OCS server */ - public static function getApplication($id) { + public static function getApplication($id, array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { @@ -209,12 +215,14 @@ class OC_OCSClient{ * This function returns an download url for an applications from the OCS server * @param string $id * @param integer $item + * @param array $targetVersion The target ownCloud version */ - public static function getApplicationDownload($id, $item) { + public static function getApplicationDownload($id, $item, array $targetVersion) { if(!self::isAppstoreEnabled()) { return null; } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); + $url .= '?version='.implode('x', $targetVersion); $xml=OC_OCSClient::getOCSresponse($url); if($xml==false) { diff --git a/lib/private/server.php b/lib/private/server.php index 957de1450b2..452a9ff489e 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -122,6 +122,8 @@ class Server extends SimpleContainer implements IServerContainer { }); $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); + //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks + \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); }); return $groupManager; }); diff --git a/lib/private/share/hooks.php b/lib/private/share/hooks.php index 66b197b921b..3cf5ceb1177 100644 --- a/lib/private/share/hooks.php +++ b/lib/private/share/hooks.php @@ -61,12 +61,12 @@ class Hooks extends \OC\Share\Constants { $itemTarget = $sourceExists['item_target']; } else { $itemTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER, $arguments['uid'], - $item['owner'], null, $item['parent']); + $item['uid_owner'], null, $item['parent']); // do we also need a file target if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') { $fileTarget = Helper::generateTarget('file', $item['file_target'], self::SHARE_TYPE_USER, $arguments['uid'], - $item['owner'], null, $item['parent']); + $item['uid_owner'], null, $item['parent']); } else { $fileTarget = null; } |